From patchwork Sun Sep 4 20:28:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9312799 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 92A906075E for ; Sun, 4 Sep 2016 20:31:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 845EA286C8 for ; Sun, 4 Sep 2016 20:31:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78976287F5; Sun, 4 Sep 2016 20:31:28 +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 AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E413A286C8 for ; Sun, 4 Sep 2016 20:31:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bge2i-0004xm-7W; Sun, 04 Sep 2016 20:29:28 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bge2c-0004wz-KP for linux-arm-kernel@lists.infradead.org; Sun, 04 Sep 2016 20:29:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=neCnQbB496YFDIpPyXvGYe2e3c/TuiQBITdI9sVW4pE=; b=TjtnTT2WJmljBQNFnZXz+aWQaWDXOlmmqwjXMfr3DFXtTKX82oL8OV6aNwQ7G70SNv/lUdA3GCda/+XnGX6KZCZE0KVK27z+v+lOrjtYuGUezqWORRUFZg6HUjQjgU13xuxv29dS2aO0m0fU6D4eAXDF8wudQWUUoNk+yFCVrhI=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:54847) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1bge2A-0000q4-LB; Sun, 04 Sep 2016 21:28:54 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1bge27-0006u5-KA; Sun, 04 Sep 2016 21:28:51 +0100 Date: Sun, 4 Sep 2016 21:28:51 +0100 From: Russell King - ARM Linux To: Robert Jarzmik Subject: Re: [PATCH 2/3] ARM: pxa: lubbock: add pcmcia clock Message-ID: <20160904202851.GA26352@n2100.armlinux.org.uk> References: <1473015587-15589-1-git-send-email-robert.jarzmik@free.fr> <1473015587-15589-2-git-send-email-robert.jarzmik@free.fr> <20160904200827.GL1041@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160904200827.GL1041@n2100.armlinux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160904_132922_987873_A612A970 X-CRM114-Status: GOOD ( 31.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Haojian Zhuang , Daniel Mack , linux-kernel@vger.kernel.org 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 On Sun, Sep 04, 2016 at 09:08:27PM +0100, Russell King - ARM Linux wrote: > On Sun, Sep 04, 2016 at 08:59:46PM +0200, Robert Jarzmik wrote: > > Add the clock provided to the PCMCIA block so that sa1111_pcmcia_add() > > doesn't end up on error while probing "1800" device. > > I don't think this is correct - SA1111 is not really the PCMCIA > controller - it's a load of logic which sits between the host > device and the PCMCIA sockets to manage buffers and the PCMCIA > socket control signals. > > The timing is done by the SoC, and the PCMCIA driver needs a > clock to compute the timing information for the PCMCIA interface. > Originally, in 2.6.12-rc2, lubbock (and all of the PXA socket > drivers) were using pxa2xx_base.c, which got the clock frequency > via get_memclk_frequency_10khz(). > > In 2a125dd56b3a ("ARM: pxa: remove get_memclk_frequency_10khz()") > this was changed to use the clk API, and added the "pxa2xx-pcmcia" > clock. However, it ignored Lubbock, because that doesn't use > _that_ device, but the SA1111 PCMCIA sub-device "1800". This commit > should have introduced an identical entry for the SA1111 PCMCIA > sub-device. > > This is actually one of the problems converting these platforms to > DT - seemingly simple stuff is actually quite complex because the > resources are spread around. In the case of Lubbock, some of the > resources are on the PXA255 SoC, others are on the SA1111 which > requires a fair amount of initialisation to get to. I think we're > really into the "combine multiple devices into one logical device" > game (iow, using the component helper), just like DRM and other > subsystems. > > The quick fix here is to add a clock for the SA1111 PCMCIA sub-device, > but it still needs to be the SoC memory clock - iow, what > get_memclk_frequency_10khz() would have returned as that's what > pxa2xx_base.c wants. IOW, something like: arch/arm/mach-pxa/lubbock.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index cd401546cea8..d7c5fb00da7a 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c @@ -149,6 +149,20 @@ static struct gpiod_lookup_table sa1111_pcmcia_gpio_table = { }, }; +static void lubbock_init_pcmcia(void) +{ + struct clk *clk; + + gpiod_add_lookup_table(&sa1111_pcmcia_gpio_table); + + /* Add an alias for the SA1111 PCMCIA clock */ + clk = clk_get_sys("pxa2xx-pcmcia", NULL); + if (!IS_ERR(clk)) { + clkdev_create(clk, NULL, "1800"); + clk_put(clk); + } +} + static struct resource sa1111_resources[] = { [0] = { .start = 0x10000000, @@ -488,7 +502,7 @@ static void __init lubbock_init(void) pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); - gpiod_add_lookup_table(&sa1111_pcmcia_gpio_table); + lubbock_init_pcmcia(); clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); pxa_set_udc_info(&udc_info);