Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3795447imm; Mon, 2 Jul 2018 05:51:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLHTJxPwGdbB9X3+eqh2bkzooC3HzZgGTWeKBNHO0i2C2yPLRzyNeXQx3gYQH42R+fnpULT X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr25888620plb.14.1530535860431; Mon, 02 Jul 2018 05:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530535860; cv=none; d=google.com; s=arc-20160816; b=a6e6Qt1Xy4UQMioOQd4rU6ogIy1xst0Mab1op3ZCJsa0b/vW8CYHuG3aPzPpc6pQN3 Ff9L39CFR6ku5LhFG6a7O303i7msrkoRCSUB4EXNPPRLU7CUEhywNaIscaenDbZ0excu 8cFAlrrBKgWkLoYWPeKZdk0c/6+y3jGldONkN8E24Ux78DfjE9yTH7elORzNRwhxw1xB 7qnwEw+z/c6PXRnv9PQ0c+GWrAC6dt7XuW6qNxdiwZy//tJlsnHi9WKgj5cTJAwD4kqC PjNYKsQa5uQG05+/qSL2unNb0ilevIZ1L5SKoX9JOWOhEMHHQanFgifVRD4veuauOJHc KZLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=ZZuGIuVlk2QgIP99thcp8rZkkz6c+/0sb5071mEUneg=; b=aV+4T5imKiCBFfYQspLUPaOdHxRadbMuhcTC3+RgckTv2Djx2qTt3ZzGzy4pRQ7dyT iiJCXI1kiSqpk4GaD7dMN00CP0hCYAzjRYpH94hzcn3wIiWa18QpVuFI4gGXk/JFrnQi jqpSH63KIc7rwQ21JzJtcGW0ScCKhPn5J3rRu6hSUfgyTAayBlFnxwppg0YOd023obVB tKpo42hLMFMVaUe4YrMkNp+lAbqb0jJ1rXHeTgthM3l/+uGDyf43iJGS7dW+QbKJZxRd 8GySrHjZYjiitd2dtFdMPl9sGwgHvMwvjP0Ejfe198p1OoQLom9gcog8H/ESOz3PjudL /B6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b="kHT70/2e"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si802591pgp.439.2018.07.02.05.50.45; Mon, 02 Jul 2018 05:51:00 -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=@agner.ch header.s=dkim header.b="kHT70/2e"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbeGBMs5 (ORCPT + 99 others); Mon, 2 Jul 2018 08:48:57 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:59320 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbeGBMsz (ORCPT ); Mon, 2 Jul 2018 08:48:55 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 091385C0228; Mon, 2 Jul 2018 14:48:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1530535734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZZuGIuVlk2QgIP99thcp8rZkkz6c+/0sb5071mEUneg=; b=kHT70/2e4fT/DnZEX4WZRxsWKkMA5gqENrAo++rwCAh22Vj2BcKwzHSZHnRDA7AqNjmLeP 3pJ5w5th+C0dAMKKY7yX2HAkT2VzzcWvBlkIK5LLpKuMQ/g3ftrc3g41LTNC8HU7dOaQIp pE5RbJh3wbJ0blj5ndOh+uIZ3X13vXA= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Mon, 02 Jul 2018 14:48:52 +0200 From: Stefan Agner To: Krzysztof Kozlowski Cc: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo , stable@vger.kernel.org Subject: Re: [PATCH] spi: spi-fsl-dspi: Fix imprecise abort on VF500 during probe In-Reply-To: <1530271989-9022-1-git-send-email-krzk@kernel.org> References: <1530271989-9022-1-git-send-email-krzk@kernel.org> Message-ID: <5e8df85076b005de1214ecb5e5de4927@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.4 X-Spamd-Result: default: False [-3.09 / 15.00]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.99)[99.97%]; ARC_NA(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.06.2018 13:33, Krzysztof Kozlowski wrote: > 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 Reviewed-by: Stefan Agner Up until commit d2233325e5b7 ("spi: spi-fsl-dspi: remove clk reference when regmap_mmio initialize") regmap with clocks has been used. I guess an alternative would have been to use this again, but I guess this has been dropped for good reasons. -- Stefan > --- > 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);