From patchwork Mon Jan 23 17:00:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 92245 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1320109qgi; Mon, 23 Jan 2017 09:06:09 -0800 (PST) X-Received: by 10.55.179.4 with SMTP id c4mr25674028qkf.167.1485191169916; Mon, 23 Jan 2017 09:06:09 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id l123si11174969qkf.174.2017.01.23.09.06.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 09:06:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cVi4E-0006LG-Sg; Mon, 23 Jan 2017 17:06:06 +0000 Received: from mail-wm0-f51.google.com ([74.125.82.51]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVi0n-0002b3-5f for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2017 17:02:35 +0000 Received: by mail-wm0-f51.google.com with SMTP id c85so142176506wmi.1 for ; Mon, 23 Jan 2017 09:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MVOVlMW/ybWoes+XT/Wiqvk9IQhXHTWV3d2Yn+3B0NM=; b=pkhwozOCEbA/bobmQU7MCXdh80kLIHapZpMUu5pI6yl4vTsre7ruDfWheLLIbfa5Tb wItlsd2cNKXGPkFr0UD/rT/WUnx0GKT9jQ1QdT36K1h/3cBydOAGXefUziLwIBhyYjjn mjSotzt3FI9Ymiq70wzFaLUpYLVNj6D2j5VOpsmf4Er9fTd2Q6GLSCailUXuVc0PrqCX Rzhfez6yHyjvqcdx3x7bu7+CtpLEHgrKaJu/JZP3K7foHDkp9nuiRuR08J7AL//boHxJ 2bHZK1vzY4s5k9/7BiJgY2TE3lDkd71JXVhyHwEq8BrBUOpxBZcS5cvfMjmRIPlKdODm IVjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MVOVlMW/ybWoes+XT/Wiqvk9IQhXHTWV3d2Yn+3B0NM=; b=ZpkIPYq6aAqnXhVJexlJgLhn6MJHTl1YKPOemMwunQVIodjooQfz4fhsTccaCYrptj YLpJbk/CnjTd3dKWzYu6hiSJq1um80yQBLLPUkpi9Z2OA9A1pPTmhlFd5UOKHb6XGaTh cuoNq/WxhGg/+Vc7AhHcT2Pr7tH27qnO0i5amUEC2voCD6ELUhIoK3ZNG7RZGMmJACj7 /5x8r6riU6Gj6NEL3dYpOPTR2qeK22DESSUNpYKlZchKsQLCrYa8SWcKgT4snBWTRqBk iwSxNbuuIe9wPTxVVEKf7J6J2R/fivwPvGmlAr2oyfzrNoiRKNNvfvpX4UepL/TKRj53 toXw== X-Gm-Message-State: AIkVDXLescv52zuKMNX5X5uDXZqoAFCNu03VFUZvGdxeqMk/YNGaGFFkg2qYdZxOLalC/2MK X-Received: by 10.28.182.70 with SMTP id g67mr15048449wmf.131.1485190871900; Mon, 23 Jan 2017 09:01:11 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l10sm12758910wrb.44.2017.01.23.09.01.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:01:11 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Sekhar Nori , Patrick Titiano , Michael Turquette , Tejun Heo , Rob Herring , Mark Rutland , Russell King , David Lechner Subject: [PATCH v6 06/14] ARM: davinci: da850: model the SATA refclk Date: Mon, 23 Jan 2017 18:00:48 +0100 Message-Id: <1485190856-4711-7-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1485190856-4711-1-git-send-email-bgolaszewski@baylibre.com> References: <1485190856-4711-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170123_090233_386562_059FBA38 X-CRM114-Status: GOOD ( 14.64 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [74.125.82.51 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.51 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.51 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ide@vger.kernel.org, Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Register a fixed rate clock modelling the external SATA oscillator for da850 (both DT and board file mode). Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/da8xx-dt.c | 8 ++++++++ arch/arm/mach-davinci/devices-da8xx.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 1 + 3 files changed, 38 insertions(+) -- 2.9.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index b83e5d1..55342ca 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -50,6 +50,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { static void __init da850_init_machine(void) { + /* All existing boards use 100MHz SATA refclkpn */ + static const unsigned long sata_refclkpn = 100 * 1000 * 1000; + int ret; ret = da8xx_register_usb20_phy_clk(false); @@ -61,6 +64,11 @@ static void __init da850_init_machine(void) pr_warn("%s: registering USB 1.1 PHY clock failed: %d", __func__, ret); + ret = da850_register_sata_refclk(sata_refclkpn); + if (ret) + pr_warn("%s: registering SATA REFCLK failed: %d", + __func__, ret); + of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); davinci_pm_init(); } diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index c2457b3..cfceb32 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "cpuidle.h" #include "sram.h" @@ -1023,6 +1024,28 @@ int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect) } #ifdef CONFIG_ARCH_DAVINCI_DA850 +static struct clk sata_refclk = { + .name = "sata_refclk", + .set_rate = davinci_simple_set_rate, +}; + +static struct clk_lookup sata_refclk_lookup = + CLK("ahci_da850", "refclk", &sata_refclk); + +int __init da850_register_sata_refclk(int rate) +{ + int ret; + + sata_refclk.rate = rate; + ret = clk_register(&sata_refclk); + if (ret) + return ret; + + clkdev_add(&sata_refclk_lookup); + + return 0; +} + static struct resource da850_sata_resources[] = { { .start = DA850_SATA_BASE, @@ -1055,9 +1078,15 @@ static struct platform_device da850_sata_device = { int __init da850_register_sata(unsigned long refclkpn) { + int ret; + /* please see comment in drivers/ata/ahci_da850.c */ BUG_ON(refclkpn != 100 * 1000 * 1000); + ret = da850_register_sata_refclk(refclkpn); + if (ret) + return ret; + return platform_device_register(&da850_sata_device); } #endif diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 85ff218..7e46422 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -95,6 +95,7 @@ int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); int da8xx_register_usb_refclkin(int rate); int da8xx_register_usb20_phy_clk(bool use_usb_refclkin); int da8xx_register_usb11_phy_clk(bool use_usb_refclkin); +int da850_register_sata_refclk(int rate); int da8xx_register_emac(void); int da8xx_register_uio_pruss(void); int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);