From patchwork Tue Jan 17 12:26:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9520645 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 A81EB6020B for ; Tue, 17 Jan 2017 12:28:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84C3F2853B for ; Tue, 17 Jan 2017 12:28:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78B812853D; Tue, 17 Jan 2017 12:28:54 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 029D42853B for ; Tue, 17 Jan 2017 12:28:54 +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 1cTSsc-0007NS-Jf; Tue, 17 Jan 2017 12:28:50 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cTSr2-0004ky-Nk for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2017 12:27:15 +0000 Received: by mail-wm0-x235.google.com with SMTP id r144so219860295wme.1 for ; Tue, 17 Jan 2017 04:26:54 -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=8V7Z9cJr5n1/82/YU4RI1/TYB3nNTqn1Migb9Uk8kBE=; b=OS0G7ZYZJOgXc4UBHMw/svJPPPsnlUjscSZXgmkuAJwmo28rPCqgkr+jMl3ycOzPTx aRqQpWjfhCrNDFbKhlgNTJnQVy8HdD0/RTJ5YJqgWtFrfu/v/lvXuKeIrUNxZFIEWwmT 2h+KuXyTj0stdkaNC6eq5lPMt1wXIiKpZ1S5TorX24uZsfcOQ1Rhc3aaq/j9jS2Pc3L/ OhrIsBgOmbtIGGcBP8rOb/YHVvZ9mwCLUac+Dd+yp2ClXzQBBwYasJSXiuuR3C+vfV/z O/2Lnu1vZEhdduH6wSStXWkB1Vs/zuFom9s5/UcOku2zPc8CRPDJGS7gBsnUfhQ7MDWZ gexA== 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=8V7Z9cJr5n1/82/YU4RI1/TYB3nNTqn1Migb9Uk8kBE=; b=mWVu1v5BATAwKhmgaNd7MuTDEVFFMIRUaHooxYVwEnxcJNPQ9/WgdBnh3HhRqXjEcc DGBaxDM4zACZh0TSBpV/ZPKEpZ48qEBZhDE8wX+BZVFSi3c/g1CvABd4koudnZV5Jtgo 7P93u1neUybjrQleNRh41PMLbSmsuqyHR58dxw/v2lLDCRj04VbQE87+H9Hn5sl+EwgV Vky2TZcScWMCTmCDFj/s5pFnHYgCL2JBAS9oeEhKOMohNxFCeJBJZjnR68tJYm2rrXIl /yP2b7K7YNNhhNQggP5Sngh92kwb03Qcg1hr8z2TRSydAl1of7kNfi5aLb7UIl6K4Mul YLfw== X-Gm-Message-State: AIkVDXKXP6EmbrHX0c65sABNWGMLjwNziAwBS+8eTd8QE09i8TOhJcxRg3ch5QghKiNwcOEK X-Received: by 10.223.136.85 with SMTP id e21mr13425800wre.28.1484656013018; Tue, 17 Jan 2017 04:26:53 -0800 (PST) Received: from bgdev-debian.lan (jua06-1-82-242-157-225.fbx.proxad.net. [82.242.157.225]) by smtp.gmail.com with ESMTPSA id o143sm5466112wmd.3.2017.01.17.04.26.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 04:26:52 -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 v2 06/14] ARM: davinci: da850: model the SATA refclk Date: Tue, 17 Jan 2017 13:26:08 +0100 Message-Id: <1484655976-25382-7-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1484655976-25382-1-git-send-email-bgolaszewski@baylibre.com> References: <1484655976-25382-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170117_042712_972523_4FAFC925 X-CRM114-Status: GOOD ( 14.78 ) 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 DT mode. For non-DT boot we don't register the clock - instead we rely on the default MPY value defined in the da850 ahci driver (as is done currently). Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/da8xx-dt.c | 8 ++++++++ arch/arm/mach-davinci/devices-da8xx.c | 23 +++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 1 + 3 files changed, 32 insertions(+) diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index b83e5d1..13137cb 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -61,6 +61,14 @@ static void __init da850_init_machine(void) pr_warn("%s: registering USB 1.1 PHY clock failed: %d", __func__, ret); + if (of_machine_is_compatible("ti,da850-evm") || + of_machine_is_compatible("ti,da850-lcdk")) { + ret = da850_register_sata_refclk(100000000); + if (ret) + pr_warn("%s: registering SATA_REFCLK clock 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..2bb5b69 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, 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);