* [PATCH v2 1/3] ARM: mx3/mx35_3ds: Add USB OTG Host mode @ 2010-12-22 14:25 Fabio Estevam 2010-12-22 14:25 ` [PATCH v2 2/3] ARM: imx/mx27_3ds: Add USB OTG support Fabio Estevam 0 siblings, 1 reply; 3+ messages in thread From: Fabio Estevam @ 2010-12-22 14:25 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- Changes since v1: - removed ULPI dependencies arch/arm/mach-mx3/mach-mx35_3ds.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c index 8bd8992..b1963f2 100644 --- a/arch/arm/mach-mx3/mach-mx35_3ds.c +++ b/arch/arm/mach-mx3/mach-mx35_3ds.c @@ -26,6 +26,7 @@ #include <linux/platform_device.h> #include <linux/memory.h> #include <linux/gpio.h> +#include <linux/usb/otg.h> #include <linux/mtd/physmap.h> @@ -125,6 +126,11 @@ static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = { .phy_mode = FSL_USB2_PHY_UTMI_WIDE, }; +static struct mxc_usbh_platform_data otg_pdata __initdata = { + .portsc = MXC_EHCI_MODE_UTMI, + .flags = MXC_EHCI_INTERNAL_PHY, +}; + /* USB HOST config */ static const struct mxc_usbh_platform_data usb_host_pdata __initconst = { .portsc = MXC_EHCI_MODE_SERIAL, @@ -132,6 +138,21 @@ static const struct mxc_usbh_platform_data usb_host_pdata __initconst = { MXC_EHCI_INTERNAL_PHY, }; +static int otg_mode_host; + +static int __init mx35_3ds_otg_mode(char *options) +{ + if (!strcmp(options, "host")) + otg_mode_host = 1; + else if (!strcmp(options, "device")) + otg_mode_host = 0; + else + pr_info("otg_mode neither \"host\" nor \"device\". " + "Defaulting to device\n"); + return 0; +} +__setup("otg_mode=", mx35_3ds_otg_mode); + /* * Board specific initialization. */ @@ -145,10 +166,14 @@ static void __init mxc_board_init(void) imx35_add_imx_uart0(&uart_pdata); - imx35_add_fsl_usb2_udc(&usb_otg_pdata); + if (otg_mode_host) + imx35_add_mxc_ehci_otg(&otg_pdata); imx35_add_mxc_ehci_hs(&usb_host_pdata); + if (!otg_mode_host) + imx35_add_fsl_usb2_udc(&usb_otg_pdata); + imx35_add_mxc_nand(&mx35pdk_nand_board_info); imx35_add_sdhci_esdhc_imx(0, NULL); -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/3] ARM: imx/mx27_3ds: Add USB OTG support 2010-12-22 14:25 [PATCH v2 1/3] ARM: mx3/mx35_3ds: Add USB OTG Host mode Fabio Estevam @ 2010-12-22 14:25 ` Fabio Estevam 2010-12-22 14:25 ` [PATCH v2 3/3] ARM: imx/mx25_3ds: Add USB support Fabio Estevam 0 siblings, 1 reply; 3+ messages in thread From: Fabio Estevam @ 2010-12-22 14:25 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- arch/arm/mach-imx/Kconfig | 3 ++ arch/arm/mach-imx/mach-mx27_3ds.c | 71 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index fed3ee5..9a715ce 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -235,10 +235,13 @@ endchoice config MACH_MX27_3DS bool "MX27PDK platform" select SOC_IMX27 + select IMX_HAVE_PLATFORM_FSL_USB2_UDC select IMX_HAVE_PLATFORM_IMX2_WDT select IMX_HAVE_PLATFORM_IMX_KEYPAD select IMX_HAVE_PLATFORM_IMX_UART + select IMX_HAVE_PLATFORM_MXC_EHCI select IMX_HAVE_PLATFORM_MXC_MMC + select MXC_ULPI if USB_ULPI help Include support for MX27PDK platform. This includes specific configurations for the board and its peripherals. diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 1a7e879..0ed2fcc 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c @@ -23,16 +23,22 @@ #include <linux/platform_device.h> #include <linux/gpio.h> #include <linux/irq.h> +#include <linux/usb/otg.h> +#include <linux/usb/ulpi.h> +#include <linux/delay.h> + #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> #include <mach/hardware.h> #include <mach/common.h> #include <mach/iomux-mx27.h> +#include <mach/ulpi.h> #include "devices-imx27.h" #define SD1_EN_GPIO (GPIO_PORTB + 25) +#define OTG_PHY_RESET_GPIO (GPIO_PORTB + 23) static const int mx27pdk_pins[] __initconst = { /* UART1 */ @@ -67,6 +73,20 @@ static const int mx27pdk_pins[] __initconst = { PE22_PF_SD1_CMD, PE23_PF_SD1_CLK, SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT, + /* OTG */ + OTG_PHY_RESET_GPIO | GPIO_GPIO | GPIO_OUT, + PC7_PF_USBOTG_DATA5, + PC8_PF_USBOTG_DATA6, + PC9_PF_USBOTG_DATA0, + PC10_PF_USBOTG_DATA2, + PC11_PF_USBOTG_DATA1, + PC12_PF_USBOTG_DATA4, + PC13_PF_USBOTG_DATA3, + PE0_PF_USBOTG_NXT, + PE1_PF_USBOTG_STP, + PE2_PF_USBOTG_DIR, + PE24_PF_USBOTG_CLK, + PE25_PF_USBOTG_DATA7, }; static const struct imxuart_platform_data uart_pdata __initconst = { @@ -118,6 +138,45 @@ static void mx27_3ds_sdhc1_enable_level_translator(void) gpio_direction_output(SD1_EN_GPIO, 1); } + +static int otg_phy_init(void) +{ + gpio_request(OTG_PHY_RESET_GPIO, "usb-otg-reset"); + gpio_direction_output(OTG_PHY_RESET_GPIO, 0); + mdelay(1); + gpio_set_value(OTG_PHY_RESET_GPIO, 1); + return 0; +} + +#if defined(CONFIG_USB_ULPI) + +static struct mxc_usbh_platform_data otg_pdata __initdata = { + .portsc = MXC_EHCI_MODE_ULPI, + .flags = MXC_EHCI_INTERFACE_DIFF_UNI, +}; +#endif + +static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { + .operating_mode = FSL_USB2_DR_DEVICE, + .phy_mode = FSL_USB2_PHY_ULPI, +}; + +static int otg_mode_host; + +static int __init mx27_3ds_otg_mode(char *options) +{ + if (!strcmp(options, "host")) + otg_mode_host = 1; + else if (!strcmp(options, "device")) + otg_mode_host = 0; + else + pr_info("otg_mode neither \"host\" nor \"device\". " + "Defaulting to device\n"); + return 0; +} +__setup("otg_mode=", mx27_3ds_otg_mode); + + static void __init mx27pdk_init(void) { mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), @@ -128,6 +187,18 @@ static void __init mx27pdk_init(void) imx27_add_imx_keypad(&mx27_3ds_keymap_data); imx27_add_mxc_mmc(0, &sdhc1_pdata); imx27_add_imx2_wdt(NULL); + otg_phy_init(); +#if defined(CONFIG_USB_ULPI) + if (otg_mode_host) { + otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, + ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); + + imx27_add_mxc_ehci_otg(&otg_pdata); + } +#endif + if (!otg_mode_host) + imx27_add_fsl_usb2_udc(&otg_device_pdata); + } static void __init mx27pdk_timer_init(void) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 3/3] ARM: imx/mx25_3ds: Add USB support 2010-12-22 14:25 ` [PATCH v2 2/3] ARM: imx/mx27_3ds: Add USB OTG support Fabio Estevam @ 2010-12-22 14:25 ` Fabio Estevam 0 siblings, 0 replies; 3+ messages in thread From: Fabio Estevam @ 2010-12-22 14:25 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- Changes since v1: - removed ULPI dependencies arch/arm/mach-imx/Kconfig | 1 + arch/arm/mach-imx/mach-mx25_3ds.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index fed3ee5..b19fb54 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -97,6 +97,7 @@ comment "MX25 platforms:" config MACH_MX25_3DS bool "Support MX25PDK (3DS) Platform" select SOC_IMX25 + select IMX_HAVE_PLATFORM_FSL_USB2_UDC select IMX_HAVE_PLATFORM_IMX2_WDT select IMX_HAVE_PLATFORM_IMXDI_RTC select IMX_HAVE_PLATFORM_IMX_FB diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c index 8b8e75b..aa76cfd 100644 --- a/arch/arm/mach-imx/mach-mx25_3ds.c +++ b/arch/arm/mach-imx/mach-mx25_3ds.c @@ -30,6 +30,7 @@ #include <linux/gpio.h> #include <linux/platform_device.h> #include <linux/input/matrix_keypad.h> +#include <linux/usb/otg.h> #include <mach/hardware.h> #include <asm/mach-types.h> @@ -184,13 +185,24 @@ static const struct matrix_keymap_data mx25pdk_keymap_data __initdata = { .keymap_size = ARRAY_SIZE(mx25pdk_keymap), }; +static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { + .portsc = MXC_EHCI_MODE_SERIAL, + .flags = MXC_EHCI_INTERNAL_PHY, +}; + +static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { + .operating_mode = FSL_USB2_DR_DEVICE, + .phy_mode = FSL_USB2_PHY_UTMI, +}; + static void __init mx25pdk_init(void) { mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, ARRAY_SIZE(mx25pdk_pads)); imx25_add_imx_uart0(&uart_pdata); - imx25_add_mxc_ehci_hs(NULL); + imx25_add_fsl_usb2_udc(&otg_device_pdata); + imx25_add_mxc_ehci_hs(&usbh2_pdata); imx25_add_mxc_nand(&mx25pdk_nand_board_info); imx25_add_imxdi_rtc(NULL); imx25_add_imx_fb(&mx25pdk_fb_pdata); -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-22 14:25 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-12-22 14:25 [PATCH v2 1/3] ARM: mx3/mx35_3ds: Add USB OTG Host mode Fabio Estevam 2010-12-22 14:25 ` [PATCH v2 2/3] ARM: imx/mx27_3ds: Add USB OTG support Fabio Estevam 2010-12-22 14:25 ` [PATCH v2 3/3] ARM: imx/mx25_3ds: Add USB support Fabio Estevam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).