From patchwork Fri Jan 20 11:21:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 92054 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp730654qgi; Fri, 20 Jan 2017 03:22:41 -0800 (PST) X-Received: by 10.98.194.153 with SMTP id w25mr15876684pfk.181.1484911361284; Fri, 20 Jan 2017 03:22:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d74si6552000pfd.278.2017.01.20.03.22.41; Fri, 20 Jan 2017 03:22:41 -0800 (PST) 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=@baylibre-com.20150623.gappssmtp.com; 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 S1752056AbdATLWW (ORCPT + 25 others); Fri, 20 Jan 2017 06:22:22 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36430 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751981AbdATLWR (ORCPT ); Fri, 20 Jan 2017 06:22:17 -0500 Received: by mail-wm0-f48.google.com with SMTP id c85so32867498wmi.1 for ; Fri, 20 Jan 2017 03:22:16 -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=T6gzl9HyGK55GI2aibVlSUvEKMzsJ/QOqM7JLj+mwEUUU4Mac60LvzwBlAOZ1PMq2b 3pKbOXU+vPTeXJlhPqI1mALkk/g+7FAybssHRqjOoBYSUXKxhhEG6/CBH8i1GjTus0lC WXGwm0DmGk8bMB402HxWVQBU02hn7AYtqZpMuEcX0ZoAEsGRmzOywuDeyl5U4BGLKidL VQvBK9J0G1vXYWzf/sLJfd3BGHKW2qSIBLscqIYzeB6e/DECWyw+RPlxSk1lWRnJSwcC 2hnA+zajChplMVwAk11ugZzqUgEz6MwK3DUSzY7DydwksfxuY6u+HfmewH1M09+0dxaX X3qQ== 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=iaeiGCPRBDH1QJHs2PBXLTMSLf5lzpScB/8LiCTiYQyhcqhkcbBbuuiN7Mx3MprstE emQWj4X27enVT8GaceDzChysVgB87IQW4ItrkCmW4HLTQJN8hvSe2UsWgSTG6mK9/8OE agCpzOwRq+T9ChKsMxGBVwf4rtQ/uEs4WXOlOW1cqHgH+GseFiBAgFXlSYqmA60hi5ot DzRyhXFQ1Pky6x+oxurwOVzBiZAGxYaoCORFQh1Kj8NI0YByt9QNl8Z4oBXNW2Ufv52n GQ3SNkAVJ0JwvB8oW4xO6WV9VAGoAXUim+7H3nMB6yBZuZGtxsfBJIFSl24+OHiDdMwT kzRg== X-Gm-Message-State: AIkVDXKaJjYPzY/xqblkuvS+BCW71PmidHHZnoETKfy29fHQSyzCYr3Ui8H33WGBo6ErWIZq X-Received: by 10.223.136.155 with SMTP id f27mr10937319wrf.98.1484911335712; Fri, 20 Jan 2017 03:22:15 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l74sm5482402wmg.2.2017.01.20.03.22.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Jan 2017 03:22:15 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Sekhar Nori , Patrick Titiano , Michael Turquette , Tejun Heo , Rob Herring , Mark Rutland , Russell King , David Lechner Cc: linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH v5 06/14] ARM: davinci: da850: model the SATA refclk Date: Fri, 20 Jan 2017 12:21:57 +0100 Message-Id: <1484911325-23425-7-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1484911325-23425-1-git-send-email-bgolaszewski@baylibre.com> References: <1484911325-23425-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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);