From patchwork Fri Jun 22 12:14:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 933296 X-Patchwork-Delegate: tudor.ambarus@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Or8hv0JQ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41ByHT1g0Tz9s3C for ; Fri, 22 Jun 2018 22:17:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D9Z+DAy5AMjVV1ew4cHcySUxWeFcbUKqriSZJPgxDnA=; b=Or8hv0JQNlE+ud F9l3jkHvqIrI56UUezBVd+2XdAQbczJkbiYKYm9UUIBNOPOiXbYEpx/3+hIekVGofdATw9tUcOpqN DTl6ZYygMqPt+wksz2/80siv4/cs+HCkPlVnLOmQnjyd2rfoZop552pee+Ik091qTgGUz7ETYZJ98 FnEAxWt5MYwc0mHDI5MlZVGHpr9y66Gn4imyhCUVmSzcCKvqslGo+zBEIYCYi0mcRfT/YTWewcXXz WpDEF7ORkrbGhnTModkP/AKCe7JROUe1QhnBgns8hsnAUEUpOZc2fCOz90s5mgfATrkNmAVGx4xn0 lUZlGSlmDJEg+z1W+8tQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fWKzo-0006af-As; Fri, 22 Jun 2018 12:16:56 +0000 Received: from 14.mo6.mail-out.ovh.net ([46.105.56.113]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fWKyJ-0004gK-3I for linux-mtd@lists.infradead.org; Fri, 22 Jun 2018 12:15:47 +0000 Received: from player792.ha.ovh.net (unknown [10.109.105.105]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 934AA1660AD for ; Fri, 22 Jun 2018 14:15:09 +0200 (CEST) Received: from zorba.kaod.org (LFbn-TOU-1-49-10.w86-201.abo.wanadoo.fr [86.201.141.10]) (Authenticated sender: clg@kaod.org) by player792.ha.ovh.net (Postfix) with ESMTPSA id 1702AA0090; Fri, 22 Jun 2018 14:14:59 +0200 (CEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: linux-mtd@lists.infradead.org Subject: [PATCH 3/4] mtd: spi-nor: aspeed: retrieve the ABH clock frequency Date: Fri, 22 Jun 2018 14:14:16 +0200 Message-Id: <20180622121417.6762-4-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180622121417.6762-1-clg@kaod.org> References: <20180622121417.6762-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 16739035392343706547 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtiedrtdeigdeglecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180622_051523_479069_DA093190 X-CRM114-Status: GOOD ( 13.84 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [46.105.56.113 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , linux-aspeed@lists.ozlabs.org, Andrew Jeffery , Richard Weinberger , Marek Vasut , Joel Stanley , Brian Norris , David Woodhouse , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We will need the AHB frequency to set the SPI clock frequency to perform the SPI calibration sequence and optimize the controller settings for the fast reads. Signed-off-by: Cédric Le Goater Reviewed-by: Joel Stanley --- drivers/mtd/spi-nor/aspeed-smc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c index 054614f34698..0251724eeecb 100644 --- a/drivers/mtd/spi-nor/aspeed-smc.c +++ b/drivers/mtd/spi-nor/aspeed-smc.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -113,6 +114,8 @@ struct aspeed_smc_controller { void __iomem *ahb_base; /* per-chip windows resource */ u32 ahb_window_size; /* full mapping window size */ + unsigned long clk_frequency; + struct aspeed_smc_chip *chips[0]; /* pointers to attached chips */ }; @@ -911,6 +914,7 @@ static int aspeed_smc_probe(struct platform_device *pdev) struct aspeed_smc_controller *controller; const struct of_device_id *match; const struct aspeed_smc_info *info; + struct clk *clk; struct resource *res; int ret; @@ -942,6 +946,12 @@ static int aspeed_smc_probe(struct platform_device *pdev) controller->ahb_window_size = resource_size(res); + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) + return PTR_ERR(clk); + controller->clk_frequency = clk_get_rate(clk); + devm_clk_put(&pdev->dev, clk); + ret = aspeed_smc_setup_flash(controller, np, res); if (ret) dev_err(dev, "Aspeed SMC probe failed %d\n", ret);