From patchwork Sat Jun 1 21:55:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2649051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 87DF83FDBC for ; Sat, 1 Jun 2013 21:55:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uitlp-0005AJ-8I; Sat, 01 Jun 2013 21:55:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uitlm-0004nX-EY; Sat, 01 Jun 2013 21:55:26 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uitlj-0004mh-5y for linux-arm-kernel@lists.infradead.org; Sat, 01 Jun 2013 21:55:24 +0000 Received: by mail-lb0-f173.google.com with SMTP id t10so2733500lbi.32 for ; Sat, 01 Jun 2013 14:54:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:organization:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id:x-gm-message-state; bh=2nmEDKSy56cV+k7H/13YeCMgefce6smcqlSNO2YVMoQ=; b=KjW7JAuydkCs/couOpoC/ez3FVoXbA/jdWdwAgtKYsKp3ON8ma+MfcmKfEEHwXR0wr sm9ZQo7rsQIhZGiFwWuVKnlD2XNgLso/PlI7ayOVmL2eQPFTjU0CW7pgO9DQmG5AbAxN W+m7LxzuUGkge9a8YrKfSD1IurzOPoS4qDkUempOoCfqpLr7RW+YVzNCqexVB2rEN2iG 7hPWU7sStwkheh2IFLmdhnGiRu98RrrqASDR/jHhUUIXacFqfxVqCGpz3b7j82rIJ/+e HVPArhouZPBExk8GzM97Un9XCSzDqDThvEeYyw+08oomoazetuRfDukBqKfKbXyAr6on GvHQ== X-Received: by 10.112.135.200 with SMTP id pu8mr6168394lbb.15.1370123696511; Sat, 01 Jun 2013 14:54:56 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-145-9.pppoe.mtu-net.ru. [91.76.145.9]) by mx.google.com with ESMTPSA id zo6sm20981287lbb.9.2013.06.01.14.54.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 01 Jun 2013 14:54:55 -0700 (PDT) From: Sergei Shtylyov Organization: Cogent Embedded To: horms@verge.net.au, linux-sh@vger.kernel.org Subject: [PATCH v8 8/9] ARM: shmobile: Marzen: pass platform data to USB PHY device Date: Sun, 2 Jun 2013 01:55:04 +0400 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.i686.PAE; KDE/4.4.5; i686; ; ) References: <201306020128.05914.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201306020128.05914.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201306020155.04976.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQlliXzMJn8Ttxl1O4uD77TG8vblvTYQVMIooiXi+oajz5d4TbNrGFKFsC7ALZu9DwglHGi5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130601_175523_483597_F0F0E84D X-CRM114-Status: GOOD ( 20.47 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.173 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux@arm.linux.org.uk, linux-usb@vger.kernel.org, magnus.damm@gmail.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since we're now going to setup the USBPCTRL0 register using the USB PHY device's platform data, we now need a way to pass those platform data from the board file to the device which is situated in setup-r8a7779.c -- and what I'm suggesting is r8a7779_add_usb_phy_device() that will register USB PHY platform device with the passed platform data using platform_device_register_resndata() call; creating this function involves deletion of 'usb_phy_device' from r8a7779_devices_dt[], so that it will no longer be registered for the generic R8A7779 machine (where we can't provide the platform data anyway), hence EHCI/OHCI drivers will fail to load as well. For the Marzen board, this new function will be called from marzen_init() to register the USB PHY device early enough. Note that the board and the SoC code have to be in one patch to keep the code bisectable... The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov Acked-by: Kuninori Morimoto Acked-by: Simon Horman --- Changes since version 6: - renamed the R-Car PHY driver header file in #include. Changes since version 5: - annotated USB PHY resources and platform data as '__initdata' since they're kmemdup()'ed while registering the platform device anyway; - fixed typo in the changelog. Changes since version 4: - refreshed the patch. Changes since version 3: - removed the initializer for 'usb_phy_platform_data'; - refreshed the 'board-marzen.c' file. Changes since version 2: - refreshed atop of the prior patches; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - added a note about bisectability to the changelog. arch/arm/mach-shmobile/board-marzen.c | 3 +++ arch/arm/mach-shmobile/include/mach/r8a7779.h | 2 ++ arch/arm/mach-shmobile/setup-r8a7779.c | 18 +++++++++--------- 3 files changed, 14 insertions(+), 9 deletions(-) Index: renesas/arch/arm/mach-shmobile/board-marzen.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/board-marzen.c +++ renesas/arch/arm/mach-shmobile/board-marzen.c @@ -57,6 +57,8 @@ static struct regulator_consumer_supply REGULATOR_SUPPLY("vdd33a", "smsc911x"), }; +static struct rcar_phy_platform_data usb_phy_platform_data __initdata; + /* SMSC LAN89218 */ static struct resource smsc911x_resources[] = { [0] = { @@ -232,6 +234,7 @@ static void __init marzen_init(void) r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */ r8a7779_add_standard_devices(); + r8a7779_add_usb_phy_device(&usb_phy_platform_data); platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); } Index: renesas/arch/arm/mach-shmobile/include/mach/r8a7779.h =================================================================== --- renesas.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ renesas/arch/arm/mach-shmobile/include/mach/r8a7779.h @@ -4,6 +4,7 @@ #include #include #include +#include struct platform_device; @@ -33,6 +34,7 @@ extern void r8a7779_add_early_devices(vo extern void r8a7779_add_standard_devices(void); extern void r8a7779_add_standard_devices_dt(void); extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); +extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata); extern void r8a7779_init_late(void); extern void r8a7779_clock_init(void); extern void r8a7779_pinmux_init(void); Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -389,7 +389,7 @@ static struct platform_device sata_devic }; /* USB PHY */ -static struct resource usb_phy_resources[] = { +static struct resource usb_phy_resources[] __initdata = { [0] = { .start = 0xffe70800, .end = 0xffe70900 - 1, @@ -397,13 +397,6 @@ static struct resource usb_phy_resources }, }; -static struct platform_device usb_phy_device = { - .name = "rcar_usb_phy", - .id = -1, - .resource = usb_phy_resources, - .num_resources = ARRAY_SIZE(usb_phy_resources), -}; - /* USB */ static struct usb_phy *phy; @@ -575,7 +568,6 @@ static struct platform_device *r8a7779_d &scif5_device, &tmu00_device, &tmu01_device, - &usb_phy_device, }; static struct platform_device *r8a7779_standard_devices[] __initdata = { @@ -610,6 +602,14 @@ void __init r8a7779_add_ether_device(str pdata, sizeof(*pdata)); } +void __init r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata) +{ + platform_device_register_resndata(&platform_bus, "rcar_usb_phy", -1, + usb_phy_resources, + ARRAY_SIZE(usb_phy_resources), + pdata, sizeof(*pdata)); +} + /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ void __init __weak r8a7779_register_twd(void) { }