From patchwork Thu Jan 19 13:29:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9525725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 77B4C6020B for ; Thu, 19 Jan 2017 13:32:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 686AD26E64 for ; Thu, 19 Jan 2017 13:32:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CE6327DF9; Thu, 19 Jan 2017 13:32:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_SORBS_SPAM, RDNS_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (unknown [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB50226E64 for ; Thu, 19 Jan 2017 13:32:58 +0000 (UTC) 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 1cUCpl-0003BV-Dg; Thu, 19 Jan 2017 13:32:57 +0000 Received: from mail-wm0-f54.google.com ([74.125.82.54]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cUCoF-0000gy-5z for linux-arm-kernel@lists.infradead.org; Thu, 19 Jan 2017 13:31:26 +0000 Received: by mail-wm0-f54.google.com with SMTP id r126so289569524wmr.0 for ; Thu, 19 Jan 2017 05:31:02 -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=BjMR1BZkr3GUGJVSs3F2Zk0WTOOGY/XpkCWwbGjzTGo=; b=N9mLuTSJUY3BBacy50b2qcVS/GW9M+XAwiKWD/bKLrtdrvra5xW9EG7vyXagjFeZW6 hVAZtYBEnNnft96saJB0vYqpJSJSz8lZ8PqH8SwvBJz2aYea7GfgssmlalnPwj7Y5f5D fs8xCUzgL1blduijOkCeIWDM2YHWtNJM6fv+3vfWFD4ZO9wwZzAMZuxULnwQ7IBdCKNE 73lGzwujTFhi7GFsh2RACyYw7Y13Et4PYDue6yFMmNuZUVLTe0Gfq+xsa4jIJT+wML6g KB47m2J5T1RMpEgcFSaItrMI/0I4X8XarjZWyOEB2ecoO1/u8wxCbAtCusunkk3ZnQhC knQw== 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=BjMR1BZkr3GUGJVSs3F2Zk0WTOOGY/XpkCWwbGjzTGo=; b=WwRAqtc5SBSVfaQwzQ1pAqDzOMaHCVmlpfzMysgX3+QFmndD+lM53SzrHl9PVMPEOZ sqmT3lFXsGn7ejqgrMUUvhvbvoFzkYVHpSXma0HPJQ9kmNJG3N9vCGEc0sd0EdEmzEv7 sAMkUSE1KgJRnu2PcL8C2bgxRrtR7A9sfsIQT7PV1dv4xl9PiaZSCGvpWJ8maPbJe1jw uPIl1UFK7dNDS8yWLCfkM+uEoPh3J920S1oKUygcdvhU/7XUj3C/wuKan6Slnz9Ki42x wxA7qbjag0YMgCWc9QTHKQlCW2CPCCFM3rMLOh8CLp08yrcNCymQ/ONbHnWFW93/VntH GsTg== X-Gm-Message-State: AIkVDXL6vhVUDV/fzjSeAAdkmXQz7mmloJftMSSuzp++32UKJW4WYUcR/xIafpaKTRiM/E4h X-Received: by 10.223.173.183 with SMTP id w52mr9057255wrc.164.1484832601337; Thu, 19 Jan 2017 05:30:01 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c202sm53251996wmd.10.2017.01.19.05.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 05:30:00 -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 v4 06/14] ARM: davinci: da850: model the SATA refclk Date: Thu, 19 Jan 2017 14:29:40 +0100 Message-Id: <1484832588-18413-7-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1484832588-18413-1-git-send-email-bgolaszewski@baylibre.com> References: <1484832588-18413-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170119_053123_530571_6BCDB6B7 X-CRM114-Status: GOOD ( 15.15 ) 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Register a dummy 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(+) 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);