* [PATCH 0/3] mx31moboard OTG host support
@ 2010-05-10 17:49 Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Philippe Rétornaz
0 siblings, 1 reply; 9+ messages in thread
From: Philippe Rétornaz @ 2010-05-10 17:49 UTC (permalink / raw)
To: linux-arm-kernel
Hello
This patch set add the OTG host support for the eyebot robot.
The first patch fix the usb PHY reset so we really do reset and configure
the pad pull-up/down so the signal are stable while applying the reset
signal (observed with an oscilloscope).
The last two patches are adding a new number to the mx31moboard_baseboard
bootparam so we can choose at boot if we want an usb device or host on the
smartbot board.
Regards,
Philippe
Philippe Retornaz (3):
mx31moboard: Fix usb PHY reset
mx31moboard: Move usb OTG device registration
mx31moboard: OTG host support for smartbot board
arch/arm/mach-mx3/mach-mx31moboard.c | 104 +++++++-------------
arch/arm/mach-mx3/mx31moboard-devboard.c | 9 ++
arch/arm/mach-mx3/mx31moboard-marxbot.c | 8 ++
arch/arm/mach-mx3/mx31moboard-smartbot.c | 42 ++++++++-
arch/arm/plat-mxc/include/mach/board-mx31moboard.h | 3 +-
5 files changed, 97 insertions(+), 69 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] mx31moboard: Fix usb PHY reset
2010-05-10 17:49 [PATCH 0/3] mx31moboard OTG host support Philippe Rétornaz
@ 2010-05-10 17:49 ` Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Philippe Rétornaz
2010-05-11 8:52 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Valentin Longchamp
0 siblings, 2 replies; 9+ messages in thread
From: Philippe Rétornaz @ 2010-05-10 17:49 UTC (permalink / raw)
To: linux-arm-kernel
Setup the pad with correct pull-up/down before doing the reset.
Assert the PHY enable signal so the reset is really done.
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
arch/arm/mach-mx3/mach-mx31moboard.c | 98 +++++++++++++---------------------
1 files changed, 37 insertions(+), 61 deletions(-)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index fccb920..5c44489 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -306,37 +306,51 @@ static struct imxmmc_platform_data sdhc1_pdata = {
* this pin is dedicated for all mx31moboard systems, so we do it here
*/
#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
-
-static void usb_xcvr_reset(void)
-{
- gpio_request(USB_RESET_B, "usb-reset");
- gpio_direction_output(USB_RESET_B, 0);
- mdelay(1);
- gpio_set_value(USB_RESET_B, 1);
-}
-
#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
- PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
+ PAD_CTL_ODE_CMOS)
#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
+#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
-static void moboard_usbotg_init(void)
+static void usb_xcvr_reset(void)
{
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
+
+ mxc_iomux_set_gpr(MUX_PGP_UH2, true);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
gpio_request(OTG_EN_B, "usb-udc-en");
gpio_direction_output(OTG_EN_B, 0);
+ gpio_request(USBH2_EN_B, "usbh2-en");
+ gpio_direction_output(USBH2_EN_B, 0);
+
+ gpio_request(USB_RESET_B, "usb-reset");
+ gpio_direction_output(USB_RESET_B, 0);
+ mdelay(1);
+ gpio_set_value(USB_RESET_B, 1);
+ mdelay(1);
}
static struct fsl_usb2_platform_data usb_pdata = {
@@ -346,44 +360,7 @@ static struct fsl_usb2_platform_data usb_pdata = {
#if defined(CONFIG_USB_ULPI)
-#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
-
-static int moboard_usbh2_hw_init(struct platform_device *pdev)
-{
- int ret;
-
- mxc_iomux_set_gpr(MUX_PGP_UH2, true);
-
- mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
-
- ret = gpio_request(USBH2_EN_B, "usbh2-en");
- if (ret)
- return ret;
- gpio_direction_output(USBH2_EN_B, 0);
-
- return 0;
-}
-
-static int moboard_usbh2_hw_exit(struct platform_device *pdev)
-{
- gpio_free(USBH2_EN_B);
- return 0;
-}
-
static struct mxc_usbh_platform_data usbh2_pdata = {
- .init = moboard_usbh2_hw_init,
- .exit = moboard_usbh2_hw_exit,
.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
.flags = MXC_EHCI_POWER_PINS_ENABLED,
};
@@ -508,7 +485,6 @@ static void __init mxc_board_init(void)
usb_xcvr_reset();
- moboard_usbotg_init();
mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
moboard_usbh2_init();
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] mx31moboard: Move usb OTG device registration
2010-05-10 17:49 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Philippe Rétornaz
@ 2010-05-10 17:49 ` Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 3/3] mx31moboard: OTG host support for smartbot board Philippe Rétornaz
2010-05-11 8:53 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Valentin Longchamp
2010-05-11 8:52 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Valentin Longchamp
1 sibling, 2 replies; 9+ messages in thread
From: Philippe Rétornaz @ 2010-05-10 17:49 UTC (permalink / raw)
To: linux-arm-kernel
In preparation for a new robot which need the
OTG port as host.
This move the OTG device registration into board
initialisation.
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
arch/arm/mach-mx3/mach-mx31moboard.c | 7 -------
arch/arm/mach-mx3/mx31moboard-devboard.c | 9 +++++++++
arch/arm/mach-mx3/mx31moboard-marxbot.c | 8 ++++++++
arch/arm/mach-mx3/mx31moboard-smartbot.c | 8 ++++++++
4 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index 5c44489..4bb011a 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -18,7 +18,6 @@
#include <linux/delay.h>
#include <linux/dma-mapping.h>
-#include <linux/fsl_devices.h>
#include <linux/gfp.h>
#include <linux/gpio.h>
#include <linux/init.h>
@@ -353,11 +352,6 @@ static void usb_xcvr_reset(void)
mdelay(1);
}
-static struct fsl_usb2_platform_data usb_pdata = {
- .operating_mode = FSL_USB2_DR_DEVICE,
- .phy_mode = FSL_USB2_PHY_ULPI,
-};
-
#if defined(CONFIG_USB_ULPI)
static struct mxc_usbh_platform_data usbh2_pdata = {
@@ -485,7 +479,6 @@ static void __init mxc_board_init(void)
usb_xcvr_reset();
- mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
moboard_usbh2_init();
switch (mx31moboard_baseboard) {
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 11b906c..582299c 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -22,6 +22,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/types.h>
+#include <linux/fsl_devices.h>
#include <linux/usb/otg.h>
@@ -213,6 +214,12 @@ static int __init devboard_usbh1_init(void)
return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
}
+
+static struct fsl_usb2_platform_data usb_pdata = {
+ .operating_mode = FSL_USB2_DR_DEVICE,
+ .phy_mode = FSL_USB2_PHY_ULPI,
+};
+
/*
* system init for baseboard usage. Will be called by mx31moboard init.
*/
@@ -229,5 +236,7 @@ void __init mx31moboard_devboard_init(void)
devboard_init_sel_gpios();
+ mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+
devboard_usbh1_init();
}
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 8cf3ad2..a1dffcb 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -25,6 +25,7 @@
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/types.h>
+#include <linux/fsl_devices.h>
#include <linux/usb/otg.h>
@@ -331,6 +332,11 @@ static int __init marxbot_usbh1_init(void)
return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
}
+static struct fsl_usb2_platform_data usb_pdata = {
+ .operating_mode = FSL_USB2_DR_DEVICE,
+ .phy_mode = FSL_USB2_PHY_ULPI,
+};
+
/*
* system init for baseboard usage. Will be called by mx31moboard init.
*/
@@ -358,5 +364,7 @@ void __init mx31moboard_marxbot_init(void)
gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
+ mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+
marxbot_usbh1_init();
}
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 83d2b9f..ac1a163 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -23,6 +23,7 @@
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/types.h>
+#include <linux/fsl_devices.h>
#include <mach/common.h>
#include <mach/hardware.h>
@@ -116,6 +117,11 @@ static int __init smartbot_cam_init(void)
return 0;
}
+static struct fsl_usb2_platform_data usb_pdata = {
+ .operating_mode = FSL_USB2_DR_DEVICE,
+ .phy_mode = FSL_USB2_PHY_ULPI,
+};
+
#define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
#define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
@@ -155,6 +161,8 @@ void __init mx31moboard_smartbot_init(void)
mxc_register_device(&mxc_uart_device1, &uart_pdata);
+ mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+
smartbot_resets_init();
smartbot_cam_init();
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] mx31moboard: OTG host support for smartbot board
2010-05-10 17:49 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Philippe Rétornaz
@ 2010-05-10 17:49 ` Philippe Rétornaz
2010-05-11 8:47 ` Valentin Longchamp
2010-05-11 8:53 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Valentin Longchamp
1 sibling, 1 reply; 9+ messages in thread
From: Philippe Rétornaz @ 2010-05-10 17:49 UTC (permalink / raw)
To: linux-arm-kernel
The Eyebot robot need the OTG port in host mode on the smartbot.
Add a new board definition so we can select the usb host/device
mode at boot with the mx31moboard_baseboard boot parameter.
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
---
arch/arm/mach-mx3/mach-mx31moboard.c | 3 +-
arch/arm/mach-mx3/mx31moboard-smartbot.c | 36 ++++++++++++++++++-
arch/arm/plat-mxc/include/mach/board-mx31moboard.h | 3 +-
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index 4bb011a..33a8d35 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -491,7 +491,8 @@ static void __init mxc_board_init(void)
mx31moboard_marxbot_init();
break;
case MX31SMARTBOT:
- mx31moboard_smartbot_init();
+ case MX31EYEBOT:
+ mx31moboard_smartbot_init(mx31moboard_baseboard);
break;
default:
printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index ac1a163..aee0a14 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -25,10 +25,16 @@
#include <linux/types.h>
#include <linux/fsl_devices.h>
+#include <linux/usb/otg.h>
+#include <linux/usb/ulpi.h>
+
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
+#include <mach/board-mx31moboard.h>
+#include <mach/mxc_ehci.h>
+#include <mach/ulpi.h>
#include <media/soc_camera.h>
@@ -122,6 +128,24 @@ static struct fsl_usb2_platform_data usb_pdata = {
.phy_mode = FSL_USB2_PHY_ULPI,
};
+#if defined(CONFIG_USB_ULPI)
+
+static struct mxc_usbh_platform_data otg_host_pdata = {
+ .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
+ .flags = MXC_EHCI_POWER_PINS_ENABLED,
+};
+
+static int __init smartbot_otg_host_init(void)
+{
+ otg_host_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
+ USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
+
+ return mxc_register_device(&mxc_otg_host, &otg_host_pdata);
+}
+#else
+static inline int smartbot_otg_host_init(void) { return 0; }
+#endif
+
#define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
#define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
@@ -152,7 +176,7 @@ static void smartbot_resets_init(void)
/*
* system init for baseboard usage. Will be called by mx31moboard init.
*/
-void __init mx31moboard_smartbot_init(void)
+void __init mx31moboard_smartbot_init(int board)
{
printk(KERN_INFO "Initializing mx31smartbot peripherals\n");
@@ -161,7 +185,15 @@ void __init mx31moboard_smartbot_init(void)
mxc_register_device(&mxc_uart_device1, &uart_pdata);
- mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+
+ switch (board) {
+ case MX31SMARTBOT:
+ mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
+ break;
+ case MX31EYEBOT:
+ smartbot_otg_host_init();
+ break;
+ }
smartbot_resets_init();
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
index fc5fec9..36ff3ce 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
@@ -26,6 +26,7 @@ enum mx31moboard_boards {
MX31DEVBOARD = 1,
MX31MARXBOT = 2,
MX31SMARTBOT = 3,
+ MX31EYEBOT = 4,
};
/*
@@ -35,7 +36,7 @@ enum mx31moboard_boards {
extern void mx31moboard_devboard_init(void);
extern void mx31moboard_marxbot_init(void);
-extern void mx31moboard_smartbot_init(void);
+extern void mx31moboard_smartbot_init(int board);
#endif
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] mx31moboard: OTG host support for smartbot board
2010-05-10 17:49 ` [PATCH 3/3] mx31moboard: OTG host support for smartbot board Philippe Rétornaz
@ 2010-05-11 8:47 ` Valentin Longchamp
0 siblings, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2010-05-11 8:47 UTC (permalink / raw)
To: linux-arm-kernel
On 05/10/2010 07:49 PM, Philippe R?tornaz wrote:
> The Eyebot robot need the OTG port in host mode on the smartbot.
s/need/needs/
You have forgotten all the 's at the end of the verbs in all your
patches (also in the previous series). Not so important, but change the
commit message if some have to be resent.
>
> Add a new board definition so we can select the usb host/device
> mode at boot with the mx31moboard_baseboard boot parameter.
Ok, one small thing still below.
>
> Signed-off-by: Philippe R?tornaz<philippe.retornaz@epfl.ch>
> ---
> arch/arm/mach-mx3/mach-mx31moboard.c | 3 +-
> arch/arm/mach-mx3/mx31moboard-smartbot.c | 36 ++++++++++++++++++-
> arch/arm/plat-mxc/include/mach/board-mx31moboard.h | 3 +-
> 3 files changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
> index 4bb011a..33a8d35 100644
> --- a/arch/arm/mach-mx3/mach-mx31moboard.c
> +++ b/arch/arm/mach-mx3/mach-mx31moboard.c
> @@ -491,7 +491,8 @@ static void __init mxc_board_init(void)
> mx31moboard_marxbot_init();
> break;
> case MX31SMARTBOT:
> - mx31moboard_smartbot_init();
> + case MX31EYEBOT:
> + mx31moboard_smartbot_init(mx31moboard_baseboard);
> break;
> default:
> printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
> diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
> index ac1a163..aee0a14 100644
> --- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
> +++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
> @@ -25,10 +25,16 @@
> #include<linux/types.h>
> #include<linux/fsl_devices.h>
>
> +#include<linux/usb/otg.h>
> +#include<linux/usb/ulpi.h>
> +
> #include<mach/common.h>
> #include<mach/hardware.h>
> #include<mach/imx-uart.h>
> #include<mach/iomux-mx3.h>
> +#include<mach/board-mx31moboard.h>
> +#include<mach/mxc_ehci.h>
> +#include<mach/ulpi.h>
>
> #include<media/soc_camera.h>
>
> @@ -122,6 +128,24 @@ static struct fsl_usb2_platform_data usb_pdata = {
> .phy_mode = FSL_USB2_PHY_ULPI,
> };
>
> +#if defined(CONFIG_USB_ULPI)
> +
> +static struct mxc_usbh_platform_data otg_host_pdata = {
> + .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
> + .flags = MXC_EHCI_POWER_PINS_ENABLED,
> +};
> +
> +static int __init smartbot_otg_host_init(void)
> +{
> + otg_host_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
> + USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
> +
> + return mxc_register_device(&mxc_otg_host,&otg_host_pdata);
> +}
> +#else
> +static inline int smartbot_otg_host_init(void) { return 0; }
> +#endif
> +
> #define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
> #define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
> #define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
> @@ -152,7 +176,7 @@ static void smartbot_resets_init(void)
> /*
> * system init for baseboard usage. Will be called by mx31moboard init.
> */
> -void __init mx31moboard_smartbot_init(void)
> +void __init mx31moboard_smartbot_init(int board)
> {
> printk(KERN_INFO "Initializing mx31smartbot peripherals\n");
>
> @@ -161,7 +185,15 @@ void __init mx31moboard_smartbot_init(void)
>
> mxc_register_device(&mxc_uart_device1,&uart_pdata);
>
> - mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> +
> + switch (board) {
> + case MX31SMARTBOT:
> + mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> + break;
> + case MX31EYEBOT:
> + smartbot_otg_host_init();
> + break;
I know it's never going to be called with anything different thant
MX31SMARTBOT or MX31EYEBOT, but a default clause here with a message
saying that we did not initialize anything (or to which of the two
configuration it was default) wouldn't hurt.
> + }
>
> smartbot_resets_init();
>
> diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
> index fc5fec9..36ff3ce 100644
> --- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
> +++ b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
> @@ -26,6 +26,7 @@ enum mx31moboard_boards {
> MX31DEVBOARD = 1,
> MX31MARXBOT = 2,
> MX31SMARTBOT = 3,
> + MX31EYEBOT = 4,
> };
>
> /*
> @@ -35,7 +36,7 @@ enum mx31moboard_boards {
>
> extern void mx31moboard_devboard_init(void);
> extern void mx31moboard_marxbot_init(void);
> -extern void mx31moboard_smartbot_init(void);
> +extern void mx31moboard_smartbot_init(int board);
>
> #endif
>
--
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp at epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEB3494, Station 9, CH-1015 Lausanne
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] mx31moboard: Fix usb PHY reset
2010-05-10 17:49 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Philippe Rétornaz
@ 2010-05-11 8:52 ` Valentin Longchamp
2010-05-11 15:44 ` s.hauer at pengutronix.de
1 sibling, 1 reply; 9+ messages in thread
From: Valentin Longchamp @ 2010-05-11 8:52 UTC (permalink / raw)
To: linux-arm-kernel
On 05/10/2010 07:49 PM, Philippe R?tornaz wrote:
> Setup the pad with correct pull-up/down before doing the reset.
> Assert the PHY enable signal so the reset is really done.
For Sascha and other people involved in mx31 support: as I am ending my
thesis and I will leave the lab afterwards, Philippe is replacing me for
the Linux support of the mx31moboard. We still discuss the patches
together, but he now is the one that writes and pushes them.
Acked-by: Valentin Longchamp<valentin.longchamp@epfl.ch>
>
> Signed-off-by: Philippe R?tornaz<philippe.retornaz@epfl.ch>
> ---
> arch/arm/mach-mx3/mach-mx31moboard.c | 98 +++++++++++++---------------------
> 1 files changed, 37 insertions(+), 61 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
> index fccb920..5c44489 100644
> --- a/arch/arm/mach-mx3/mach-mx31moboard.c
> +++ b/arch/arm/mach-mx3/mach-mx31moboard.c
> @@ -306,37 +306,51 @@ static struct imxmmc_platform_data sdhc1_pdata = {
> * this pin is dedicated for all mx31moboard systems, so we do it here
> */
> #define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
> -
> -static void usb_xcvr_reset(void)
> -{
> - gpio_request(USB_RESET_B, "usb-reset");
> - gpio_direction_output(USB_RESET_B, 0);
> - mdelay(1);
> - gpio_set_value(USB_RESET_B, 1);
> -}
> -
> #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
> - PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
> + PAD_CTL_ODE_CMOS)
>
> #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
> +#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
>
> -static void moboard_usbotg_init(void)
> +static void usb_xcvr_reset(void)
> {
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
> +
> + mxc_iomux_set_gpr(MUX_PGP_UH2, true);
> + mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
> + mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
> + mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
>
> gpio_request(OTG_EN_B, "usb-udc-en");
> gpio_direction_output(OTG_EN_B, 0);
> + gpio_request(USBH2_EN_B, "usbh2-en");
> + gpio_direction_output(USBH2_EN_B, 0);
> +
> + gpio_request(USB_RESET_B, "usb-reset");
> + gpio_direction_output(USB_RESET_B, 0);
> + mdelay(1);
> + gpio_set_value(USB_RESET_B, 1);
> + mdelay(1);
> }
>
> static struct fsl_usb2_platform_data usb_pdata = {
> @@ -346,44 +360,7 @@ static struct fsl_usb2_platform_data usb_pdata = {
>
> #if defined(CONFIG_USB_ULPI)
>
> -#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
> -
> -static int moboard_usbh2_hw_init(struct platform_device *pdev)
> -{
> - int ret;
> -
> - mxc_iomux_set_gpr(MUX_PGP_UH2, true);
> -
> - mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
> - mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
> -
> - ret = gpio_request(USBH2_EN_B, "usbh2-en");
> - if (ret)
> - return ret;
> - gpio_direction_output(USBH2_EN_B, 0);
> -
> - return 0;
> -}
> -
> -static int moboard_usbh2_hw_exit(struct platform_device *pdev)
> -{
> - gpio_free(USBH2_EN_B);
> - return 0;
> -}
> -
> static struct mxc_usbh_platform_data usbh2_pdata = {
> - .init = moboard_usbh2_hw_init,
> - .exit = moboard_usbh2_hw_exit,
> .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
> .flags = MXC_EHCI_POWER_PINS_ENABLED,
> };
> @@ -508,7 +485,6 @@ static void __init mxc_board_init(void)
>
> usb_xcvr_reset();
>
> - moboard_usbotg_init();
> mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> moboard_usbh2_init();
>
--
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp at epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEB3494, Station 9, CH-1015 Lausanne
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] mx31moboard: Move usb OTG device registration
2010-05-10 17:49 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 3/3] mx31moboard: OTG host support for smartbot board Philippe Rétornaz
@ 2010-05-11 8:53 ` Valentin Longchamp
1 sibling, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2010-05-11 8:53 UTC (permalink / raw)
To: linux-arm-kernel
On 05/10/2010 07:49 PM, Philippe R?tornaz wrote:
> In preparation for a new robot which need the
> OTG port as host.
s/need/needs/
>
> This move the OTG device registration into board
> initialisation.
s/move/moves
Othewise,
Acked-by: Valentin Longchamp<valentin.longchamp@epfl.ch>
>
> Signed-off-by: Philippe R?tornaz<philippe.retornaz@epfl.ch>
> ---
> arch/arm/mach-mx3/mach-mx31moboard.c | 7 -------
> arch/arm/mach-mx3/mx31moboard-devboard.c | 9 +++++++++
> arch/arm/mach-mx3/mx31moboard-marxbot.c | 8 ++++++++
> arch/arm/mach-mx3/mx31moboard-smartbot.c | 8 ++++++++
> 4 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
> index 5c44489..4bb011a 100644
> --- a/arch/arm/mach-mx3/mach-mx31moboard.c
> +++ b/arch/arm/mach-mx3/mach-mx31moboard.c
> @@ -18,7 +18,6 @@
>
> #include<linux/delay.h>
> #include<linux/dma-mapping.h>
> -#include<linux/fsl_devices.h>
> #include<linux/gfp.h>
> #include<linux/gpio.h>
> #include<linux/init.h>
> @@ -353,11 +352,6 @@ static void usb_xcvr_reset(void)
> mdelay(1);
> }
>
> -static struct fsl_usb2_platform_data usb_pdata = {
> - .operating_mode = FSL_USB2_DR_DEVICE,
> - .phy_mode = FSL_USB2_PHY_ULPI,
> -};
> -
> #if defined(CONFIG_USB_ULPI)
>
> static struct mxc_usbh_platform_data usbh2_pdata = {
> @@ -485,7 +479,6 @@ static void __init mxc_board_init(void)
>
> usb_xcvr_reset();
>
> - mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> moboard_usbh2_init();
>
> switch (mx31moboard_baseboard) {
> diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
> index 11b906c..582299c 100644
> --- a/arch/arm/mach-mx3/mx31moboard-devboard.c
> +++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
> @@ -22,6 +22,7 @@
> #include<linux/platform_device.h>
> #include<linux/slab.h>
> #include<linux/types.h>
> +#include<linux/fsl_devices.h>
>
> #include<linux/usb/otg.h>
>
> @@ -213,6 +214,12 @@ static int __init devboard_usbh1_init(void)
> return mxc_register_device(&mxc_usbh1,&usbh1_pdata);
> }
>
> +
> +static struct fsl_usb2_platform_data usb_pdata = {
> + .operating_mode = FSL_USB2_DR_DEVICE,
> + .phy_mode = FSL_USB2_PHY_ULPI,
> +};
> +
> /*
> * system init for baseboard usage. Will be called by mx31moboard init.
> */
> @@ -229,5 +236,7 @@ void __init mx31moboard_devboard_init(void)
>
> devboard_init_sel_gpios();
>
> + mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> +
> devboard_usbh1_init();
> }
> diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
> index 8cf3ad2..a1dffcb 100644
> --- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
> +++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
> @@ -25,6 +25,7 @@
> #include<linux/slab.h>
> #include<linux/platform_device.h>
> #include<linux/types.h>
> +#include<linux/fsl_devices.h>
>
> #include<linux/usb/otg.h>
>
> @@ -331,6 +332,11 @@ static int __init marxbot_usbh1_init(void)
> return mxc_register_device(&mxc_usbh1,&usbh1_pdata);
> }
>
> +static struct fsl_usb2_platform_data usb_pdata = {
> + .operating_mode = FSL_USB2_DR_DEVICE,
> + .phy_mode = FSL_USB2_PHY_ULPI,
> +};
> +
> /*
> * system init for baseboard usage. Will be called by mx31moboard init.
> */
> @@ -358,5 +364,7 @@ void __init mx31moboard_marxbot_init(void)
> gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
> gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
>
> + mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> +
> marxbot_usbh1_init();
> }
> diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
> index 83d2b9f..ac1a163 100644
> --- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
> +++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
> @@ -23,6 +23,7 @@
> #include<linux/i2c.h>
> #include<linux/platform_device.h>
> #include<linux/types.h>
> +#include<linux/fsl_devices.h>
>
> #include<mach/common.h>
> #include<mach/hardware.h>
> @@ -116,6 +117,11 @@ static int __init smartbot_cam_init(void)
> return 0;
> }
>
> +static struct fsl_usb2_platform_data usb_pdata = {
> + .operating_mode = FSL_USB2_DR_DEVICE,
> + .phy_mode = FSL_USB2_PHY_ULPI,
> +};
> +
> #define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
> #define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
> #define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
> @@ -155,6 +161,8 @@ void __init mx31moboard_smartbot_init(void)
>
> mxc_register_device(&mxc_uart_device1,&uart_pdata);
>
> + mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
> +
> smartbot_resets_init();
>
> smartbot_cam_init();
--
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp at epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEB3494, Station 9, CH-1015 Lausanne
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] mx31moboard: Fix usb PHY reset
2010-05-11 14:57 [PATCH 0/3 v2] mx31moboard: OTG host support Philippe Rétornaz
@ 2010-05-11 14:57 ` Philippe Rétornaz
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Rétornaz @ 2010-05-11 14:57 UTC (permalink / raw)
To: linux-arm-kernel
Setup the pad with correct pull-up/down before doing the reset.
Assert the PHY enable signal so the reset is really done.
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
Acked-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
arch/arm/mach-mx3/mach-mx31moboard.c | 98 +++++++++++++---------------------
1 files changed, 37 insertions(+), 61 deletions(-)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index fccb920..5c44489 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -306,37 +306,51 @@ static struct imxmmc_platform_data sdhc1_pdata = {
* this pin is dedicated for all mx31moboard systems, so we do it here
*/
#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
-
-static void usb_xcvr_reset(void)
-{
- gpio_request(USB_RESET_B, "usb-reset");
- gpio_direction_output(USB_RESET_B, 0);
- mdelay(1);
- gpio_set_value(USB_RESET_B, 1);
-}
-
#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
- PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
+ PAD_CTL_ODE_CMOS)
#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
+#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
-static void moboard_usbotg_init(void)
+static void usb_xcvr_reset(void)
{
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
+
+ mxc_iomux_set_gpr(MUX_PGP_UH2, true);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
+ mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
gpio_request(OTG_EN_B, "usb-udc-en");
gpio_direction_output(OTG_EN_B, 0);
+ gpio_request(USBH2_EN_B, "usbh2-en");
+ gpio_direction_output(USBH2_EN_B, 0);
+
+ gpio_request(USB_RESET_B, "usb-reset");
+ gpio_direction_output(USB_RESET_B, 0);
+ mdelay(1);
+ gpio_set_value(USB_RESET_B, 1);
+ mdelay(1);
}
static struct fsl_usb2_platform_data usb_pdata = {
@@ -346,44 +360,7 @@ static struct fsl_usb2_platform_data usb_pdata = {
#if defined(CONFIG_USB_ULPI)
-#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
-
-static int moboard_usbh2_hw_init(struct platform_device *pdev)
-{
- int ret;
-
- mxc_iomux_set_gpr(MUX_PGP_UH2, true);
-
- mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
- mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
-
- ret = gpio_request(USBH2_EN_B, "usbh2-en");
- if (ret)
- return ret;
- gpio_direction_output(USBH2_EN_B, 0);
-
- return 0;
-}
-
-static int moboard_usbh2_hw_exit(struct platform_device *pdev)
-{
- gpio_free(USBH2_EN_B);
- return 0;
-}
-
static struct mxc_usbh_platform_data usbh2_pdata = {
- .init = moboard_usbh2_hw_init,
- .exit = moboard_usbh2_hw_exit,
.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
.flags = MXC_EHCI_POWER_PINS_ENABLED,
};
@@ -508,7 +485,6 @@ static void __init mxc_board_init(void)
usb_xcvr_reset();
- moboard_usbotg_init();
mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
moboard_usbh2_init();
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/3] mx31moboard: Fix usb PHY reset
2010-05-11 8:52 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Valentin Longchamp
@ 2010-05-11 15:44 ` s.hauer at pengutronix.de
0 siblings, 0 replies; 9+ messages in thread
From: s.hauer at pengutronix.de @ 2010-05-11 15:44 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, May 11, 2010 at 10:52:11AM +0200, Valentin Longchamp wrote:
> On 05/10/2010 07:49 PM, Philippe R?tornaz wrote:
>> Setup the pad with correct pull-up/down before doing the reset.
>> Assert the PHY enable signal so the reset is really done.
>
> For Sascha and other people involved in mx31 support: as I am ending my
> thesis and I will leave the lab afterwards, Philippe is replacing me for
> the Linux support of the mx31moboard. We still discuss the patches
> together, but he now is the one that writes and pushes them.
Ok, I won't wait for your ack then.
Sascha
>
> Acked-by: Valentin Longchamp<valentin.longchamp@epfl.ch>
>
>>
>> Signed-off-by: Philippe R?tornaz<philippe.retornaz@epfl.ch>
>> ---
>> arch/arm/mach-mx3/mach-mx31moboard.c | 98 +++++++++++++---------------------
>> 1 files changed, 37 insertions(+), 61 deletions(-)
>>
>> diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
>> index fccb920..5c44489 100644
>> --- a/arch/arm/mach-mx3/mach-mx31moboard.c
>> +++ b/arch/arm/mach-mx3/mach-mx31moboard.c
>> @@ -306,37 +306,51 @@ static struct imxmmc_platform_data sdhc1_pdata = {
>> * this pin is dedicated for all mx31moboard systems, so we do it here
>> */
>> #define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
>> -
>> -static void usb_xcvr_reset(void)
>> -{
>> - gpio_request(USB_RESET_B, "usb-reset");
>> - gpio_direction_output(USB_RESET_B, 0);
>> - mdelay(1);
>> - gpio_set_value(USB_RESET_B, 1);
>> -}
>> -
>> #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
>> - PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
>> + PAD_CTL_ODE_CMOS)
>>
>> #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
>> +#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
>>
>> -static void moboard_usbotg_init(void)
>> +static void usb_xcvr_reset(void)
>> {
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
>> +
>> + mxc_iomux_set_gpr(MUX_PGP_UH2, true);
>> + mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
>> + mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
>> + mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
>>
>> gpio_request(OTG_EN_B, "usb-udc-en");
>> gpio_direction_output(OTG_EN_B, 0);
>> + gpio_request(USBH2_EN_B, "usbh2-en");
>> + gpio_direction_output(USBH2_EN_B, 0);
>> +
>> + gpio_request(USB_RESET_B, "usb-reset");
>> + gpio_direction_output(USB_RESET_B, 0);
>> + mdelay(1);
>> + gpio_set_value(USB_RESET_B, 1);
>> + mdelay(1);
>> }
>>
>> static struct fsl_usb2_platform_data usb_pdata = {
>> @@ -346,44 +360,7 @@ static struct fsl_usb2_platform_data usb_pdata = {
>>
>> #if defined(CONFIG_USB_ULPI)
>>
>> -#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
>> -
>> -static int moboard_usbh2_hw_init(struct platform_device *pdev)
>> -{
>> - int ret;
>> -
>> - mxc_iomux_set_gpr(MUX_PGP_UH2, true);
>> -
>> - mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
>> - mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
>> -
>> - ret = gpio_request(USBH2_EN_B, "usbh2-en");
>> - if (ret)
>> - return ret;
>> - gpio_direction_output(USBH2_EN_B, 0);
>> -
>> - return 0;
>> -}
>> -
>> -static int moboard_usbh2_hw_exit(struct platform_device *pdev)
>> -{
>> - gpio_free(USBH2_EN_B);
>> - return 0;
>> -}
>> -
>> static struct mxc_usbh_platform_data usbh2_pdata = {
>> - .init = moboard_usbh2_hw_init,
>> - .exit = moboard_usbh2_hw_exit,
>> .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
>> .flags = MXC_EHCI_POWER_PINS_ENABLED,
>> };
>> @@ -508,7 +485,6 @@ static void __init mxc_board_init(void)
>>
>> usb_xcvr_reset();
>>
>> - moboard_usbotg_init();
>> mxc_register_device(&mxc_otg_udc_device,&usb_pdata);
>> moboard_usbh2_init();
>>
>
>
> --
> Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
> valentin.longchamp at epfl.ch, Phone: +41216937827
> http://people.epfl.ch/valentin.longchamp
> MEB3494, Station 9, CH-1015 Lausanne
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-05-11 15:44 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 17:49 [PATCH 0/3] mx31moboard OTG host support Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Philippe Rétornaz
2010-05-10 17:49 ` [PATCH 3/3] mx31moboard: OTG host support for smartbot board Philippe Rétornaz
2010-05-11 8:47 ` Valentin Longchamp
2010-05-11 8:53 ` [PATCH 2/3] mx31moboard: Move usb OTG device registration Valentin Longchamp
2010-05-11 8:52 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Valentin Longchamp
2010-05-11 15:44 ` s.hauer at pengutronix.de
-- strict thread matches above, loose matches on Subject: below --
2010-05-11 14:57 [PATCH 0/3 v2] mx31moboard: OTG host support Philippe Rétornaz
2010-05-11 14:57 ` [PATCH 1/3] mx31moboard: Fix usb PHY reset Philippe Rétornaz
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).