From patchwork Tue Apr 17 10:15:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 153117 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 358D7B6FC3 for ; Tue, 17 Apr 2012 20:19:50 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SK5TS-0001MN-Sb; Tue, 17 Apr 2012 10:17:26 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SK5Si-00018t-CI for linux-arm-kernel@lists.infradead.org; Tue, 17 Apr 2012 10:16:45 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3VX2Rz0CYDz4LDf9; Tue, 17 Apr 2012 12:16:31 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.8.164]) by mail.m-online.net (Postfix) with ESMTP id 3VX2Ry6Qy0z4KK5c; Tue, 17 Apr 2012 12:16:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from smtp-auth.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new, port 10024) with ESMTP id RNWhV9AdefXP; Tue, 17 Apr 2012 12:16:30 +0200 (CEST) Received: from mashiro.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA; Tue, 17 Apr 2012 12:16:29 +0200 (CEST) From: Marek Vasut To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/8] MXS: Add platform registration hooks for USB EHCI Date: Tue, 17 Apr 2012 12:15:47 +0200 Message-Id: <1334657751-27678-5-git-send-email-marex@denx.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1334657751-27678-1-git-send-email-marex@denx.de> References: <1334657751-27678-1-git-send-email-marex@denx.de> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.18.0.9 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marek Vasut , Li Frank-B20596 , Tony Lin , Lin Tony-B19295 , Detlev Zundel , Chen Peter-B29397 , Sascha Hauer , Linux USB , Stefano Babic , Wolfgang Denk , Shawn Guo , Fabio Estevam , Shawn Guo , Subodh Nijsure X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Based on code by: Tony Lin Signed-off-by: Marek Vasut Cc: Chen Peter-B29397 Cc: Detlev Zundel Cc: Fabio Estevam Cc: Li Frank-B20596 Cc: Lin Tony-B19295 Cc: Linux USB Cc: Sascha Hauer Cc: Shawn Guo Cc: Shawn Guo Cc: Stefano Babic Cc: Subodh Nijsure Cc: Tony Lin Cc: Wolfgang Denk --- arch/arm/mach-mxs/devices-mx28.h | 4 ++ arch/arm/mach-mxs/devices/Kconfig | 3 + arch/arm/mach-mxs/devices/Makefile | 1 + arch/arm/mach-mxs/devices/platform-usb.c | 79 +++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/devices-common.h | 9 +++ 5 files changed, 96 insertions(+) create mode 100644 arch/arm/mach-mxs/devices/platform-usb.c diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 5f71bb2..428b184 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h @@ -47,6 +47,10 @@ extern const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst; #define mx28_add_mxs_pwm(id) mxs_add_mxs_pwm(MX28_PWM_BASE_ADDR, id) +extern const struct mxs_usbh_data mx28_mxs_usbh_data[] __initconst; +#define mx28_add_mxs_usbh(id) \ + mxs_add_mxs_usbh(&mx28_mxs_usbh_data[id]) + struct platform_device *__init mx28_add_mxsfb( const struct mxsfb_platform_data *pdata); diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index abad78d..a297d12 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig @@ -35,3 +35,6 @@ config MXS_HAVE_PLATFORM_MXS_SAIF config MXS_HAVE_PLATFORM_RTC_STMP3XXX bool + +config MXS_HAVE_PLATFORM_USB + bool diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index 3e6fb12..2dbdf99 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile @@ -12,3 +12,4 @@ obj-y += platform-gpio-mxs.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_SAIF) += platform-mxs-saif.o obj-$(CONFIG_MXS_HAVE_PLATFORM_RTC_STMP3XXX) += platform-rtc-stmp3xxx.o +obj-$(CONFIG_MXS_HAVE_PLATFORM_USB) += platform-usb.o diff --git a/arch/arm/mach-mxs/devices/platform-usb.c b/arch/arm/mach-mxs/devices/platform-usb.c new file mode 100644 index 0000000..0e2bdb6 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-usb.c @@ -0,0 +1,79 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#define mxs_usbh_data_entry_single(soc, _id, hwid) \ + { \ + .id = _id, \ + .usb_irq = soc ## _INT_USB ## hwid, \ + .usb_iobase = soc ## _USBCTRL ## hwid ## _BASE_ADDR, \ + .phy_iobase = soc ## _USBPHY ## hwid ## _BASE_ADDR, \ + } + +#define mxs_usbh_data_entry(soc, _id, hwid) \ + [_id] = mxs_usbh_data_entry_single(soc, _id, hwid) + +#ifdef CONFIG_SOC_IMX23 +const struct mxs_usbh_data mx23_mxs_usbh_data[] __initconst = { + mxs_usbh_data_entry(MX23, 0, 0), +}; +#endif + +#ifdef CONFIG_SOC_IMX28 +const struct mxs_usbh_data mx28_mxs_usbh_data[] __initconst = { + mxs_usbh_data_entry(MX28, 0, 0), + mxs_usbh_data_entry(MX28, 1, 1), +}; +#endif + +void __init mxs_add_mxs_usbh(const struct mxs_usbh_data *data) +{ + struct platform_device *pdev; + struct resource usb_res[] = { + { + .start = data->usb_iobase, + .end = data->usb_iobase + SZ_64K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = data->usb_irq, + .end = data->usb_irq, + .flags = IORESOURCE_IRQ, + }, + }; + + struct resource phy_res[] = { + { + .start = data->phy_iobase, + .end = data->phy_iobase + SZ_256 - 1, + .flags = IORESOURCE_MEM, + }, + }; + + pdev = mxs_add_platform_device_dmamask("mxs-ehci", data->id, + usb_res, ARRAY_SIZE(usb_res), + NULL, 0, + DMA_BIT_MASK(32)); + if (!pdev) + pr_err("Failed to register EHCI USB controller!\n"); + + pdev = mxs_add_platform_device_dmamask("mxs-phy", data->id, + phy_res, ARRAY_SIZE(phy_res), + NULL, 0, + DMA_BIT_MASK(32)); + + if (!pdev) + pr_err("Failed to register EHCI USB PHY!\n"); +} diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index 3bffcd5..8fdd936 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h @@ -42,6 +42,15 @@ struct mxs_auart_data { struct platform_device *__init mxs_add_auart( const struct mxs_auart_data *data); +/* usb host */ +struct mxs_usbh_data { + int id; + resource_size_t usb_irq; + resource_size_t usb_iobase; + resource_size_t phy_iobase; +}; +void __init mxs_add_mxs_usbh(const struct mxs_usbh_data *data); + /* fec */ #include struct mxs_fec_data {