Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp902151imm; Fri, 29 Jun 2018 08:11:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIIGyPt2PqrMq6WeB/sqdz8FO+iB2UQmaemQ+c4vZDd+5r6kfrHylaUQw6UAIzutvQ3oNBt X-Received: by 2002:a63:107:: with SMTP id 7-v6mr12708595pgb.289.1530285068510; Fri, 29 Jun 2018 08:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530285068; cv=none; d=google.com; s=arc-20160816; b=MR7YVfgvfqAHyE/BBkVU87Ci3UiiqmFIRnII7n5irq1ut/NSOVvvIWvQAmot+KeqbR I4gIj/z2Xl/Wm01pzD7pTC3YC1Yizd3EhNrJZNMDInnvKxS7+n8rWxc2qtv9Xs5a2amF a14j7l8LO4LUG/OSIpi93qPE1Tyun9L7NJpgFdZv0H4jpTvchOT/nZ0OFYS6IPnJwSdL QdSYiFmJj8W44niLVSmGelyC3vP6eoiQd7qBajZqx0hLQ/SiP324UZ/e0x4ICTIIB3iE rji2FuJC9RqP1JmmQVZh7U8A8iHqTgN8GFYlnqQLc1BRw4O9gG1WfSSdRTHTam/QUJUK +1lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=a0rJRczn/vhQAakIYvCxO9ZHRcnN/RQ0Ny5PEppKbPM=; b=iNV9dBfJvXDrtGuAqx9sdT/x4U/iKQZcUs+ZsFu58sBayAYVuMKj5ZiJ7aQ0sOmyKr Ti8N3l3IcM9jCNXO+17fm8ZXDkv+TtPiPzYnENcteoai/XlR9HZqTiiWsw15mSgkdR0l TnFzGM060wqC+1T+HvjAtGG9aPkiTFkg5EM/HQPpT9NCeJnQJ+kvj+1E4yVIVZ5H20sc z1MHmEgA8sQAsMznlQc4x1L1aRXr9wrf19IHE7CEuZkjs889a+MaFFCutQHc7gVeej2A w05QSzvwRmsrLgUjJdhH+dx2WNJHehXg3ahJe0IBHHUzBgI7mqpbX7FZN2Sq9fmT2GAQ 7ptQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UteO7VRy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t89-v6si8697996pfe.59.2018.06.29.08.10.52; Fri, 29 Jun 2018 08:11:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UteO7VRy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935975AbeF2LdX (ORCPT + 99 others); Fri, 29 Jun 2018 07:33:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:42336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935520AbeF2LdU (ORCPT ); Fri, 29 Jun 2018 07:33:20 -0400 Received: from PC-kkoz.proceq.com (unknown [213.160.61.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D94CC27E08; Fri, 29 Jun 2018 11:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530272000; bh=U/NOwqW3QEw5IMUMjam+l+Wpuvj8muXySQlXGHb+Tik=; h=From:To:Cc:Subject:Date:From; b=UteO7VRy55O36LE/suvzLTt18KaP3vhtNuBzcbVPE3J0eMpxb+EUt8WdKW6G7cdE0 ofNw9yJ11NfAPZlDPQEaVXLSHJ1va2nPsg/v14Mj4krPZCpYMIdufXm1w59y24S3mG uZY9Pyn1sBVqeXO/ni9o5eEgEi8fcDs4GysqsZxw= From: Krzysztof Kozlowski To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefan Agner , Shawn Guo , Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH] spi: spi-fsl-dspi: Fix imprecise abort on VF500 during probe Date: Fri, 29 Jun 2018 13:33:09 +0200 Message-Id: <1530271989-9022-1-git-send-email-krzk@kernel.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Registers of DSPI should not be accessed before enabling its clock. On Toradex Colibri VF50 on Iris carrier board this could be seen during bootup as imprecise abort: Unhandled fault: imprecise external abort (0x1c06) at 0x00000000 Internal error: : 1c06 [#1] ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.39-dirty #97 Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) Backtrace: [<804166a8>] (regmap_write) from [<80466b5c>] (dspi_probe+0x1f0/0x8dc) [<8046696c>] (dspi_probe) from [<8040107c>] (platform_drv_probe+0x54/0xb8) [<80401028>] (platform_drv_probe) from [<803ff53c>] (driver_probe_device+0x280/0x2f8) [<803ff2bc>] (driver_probe_device) from [<803ff674>] (__driver_attach+0xc0/0xc4) [<803ff5b4>] (__driver_attach) from [<803fd818>] (bus_for_each_dev+0x70/0xa4) [<803fd7a8>] (bus_for_each_dev) from [<803fee74>] (driver_attach+0x24/0x28) [<803fee50>] (driver_attach) from [<803fe980>] (bus_add_driver+0x1a0/0x218) [<803fe7e0>] (bus_add_driver) from [<803fffe8>] (driver_register+0x80/0x100) [<803fff68>] (driver_register) from [<80400fdc>] (__platform_driver_register+0x48/0x50) [<80400f94>] (__platform_driver_register) from [<8091cf7c>] (fsl_dspi_driver_init+0x1c/0x20) [<8091cf60>] (fsl_dspi_driver_init) from [<8010195c>] (do_one_initcall+0x4c/0x174) [<80101910>] (do_one_initcall) from [<80900e8c>] (kernel_init_freeable+0x144/0x1d8) [<80900d48>] (kernel_init_freeable) from [<805ff6a8>] (kernel_init+0x10/0x114) [<805ff698>] (kernel_init) from [<80107be8>] (ret_from_fork+0x14/0x2c) Cc: Fixes: 5ee67b587a2b ("spi: dspi: clear SPI_SR before enable interrupt") Signed-off-by: Krzysztof Kozlowski --- drivers/spi/spi-fsl-dspi.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index ff7456be9d6d..89a1e7a4fe5d 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1071,30 +1071,30 @@ static int dspi_probe(struct platform_device *pdev) } } + dspi->clk = devm_clk_get(&pdev->dev, "dspi"); + if (IS_ERR(dspi->clk)) { + ret = PTR_ERR(dspi->clk); + dev_err(&pdev->dev, "unable to get clock\n"); + goto out_master_put; + } + ret = clk_prepare_enable(dspi->clk); + if (ret) + goto out_master_put; + dspi_init(dspi); dspi->irq = platform_get_irq(pdev, 0); if (dspi->irq < 0) { dev_err(&pdev->dev, "can't get platform irq\n"); ret = dspi->irq; - goto out_master_put; + goto out_clk_put; } ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt, 0, pdev->name, dspi); if (ret < 0) { dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n"); - goto out_master_put; - } - - dspi->clk = devm_clk_get(&pdev->dev, "dspi"); - if (IS_ERR(dspi->clk)) { - ret = PTR_ERR(dspi->clk); - dev_err(&pdev->dev, "unable to get clock\n"); - goto out_master_put; + goto out_clk_put; } - ret = clk_prepare_enable(dspi->clk); - if (ret) - goto out_master_put; if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { ret = dspi_request_dma(dspi, res->start); -- 2.7.4