[PATCH] ulpi: Modify the ulpi framework to accept port number
Govindraj.R
govindraj.raja at ti.com
Fri Jan 27 14:04:11 CET 2012
Based on discussion in the thread [1] this patch
attempts to modify the ulpi framework to accept the
port number along with view port address, adding the omap-ulpi
view port that helps us in using the generic ulpi
framework to configure ulpi phy using the INSNREG05_ULPI viewport
reg available on omap platform.
Tested on beagle-xm and Panda.
Compile tested on efikamx platform.
This patch is based on earlier posted patch series[1].
Prior to this patch ulpi reset was done directly now
it is done using ulpi_reset.
Thanks to Igor Grinberg <grinberg at compulab.co.il> for reviewing the
omap-ehci patches and suggesting this approach.
This patch along with the patch series [1] rebased on latest u-boot
is available here.
git://gitorious.org/denx_u-boot/denx_uboot_omap.git v2_ehci_omap4
[1]: http://www.mail-archive.com/u-boot@lists.denx.de/msg76076.html
[2]: "[PATCH v2 0/4] Clean up ehci-omap and extend support for omap3/4 socs=
"
Signed-off-by: Govindraj.R <govindraj.raja at ti.com>
---
board/efikamx/efikamx-usb.c | 21 ++++---
drivers/usb/host/ehci-omap.c | 21 ++-----
drivers/usb/ulpi/Makefile | 1 +
drivers/usb/ulpi/omap-ulpi-viewport.c | 110 +++++++++++++++++++++++++++++=
++++
drivers/usb/ulpi/ulpi-viewport.c | 30 +++++-----
drivers/usb/ulpi/ulpi.c | 54 ++++++++--------
include/configs/omap3_beagle.h | 3 +
include/configs/omap4_panda.h | 2 +
include/usb/ulpi.h | 37 ++++++++----
9 files changed, 202 insertions(+), 77 deletions(-)
create mode 100644 drivers/usb/ulpi/omap-ulpi-viewport.c
diff --git a/board/efikamx/efikamx-usb.c b/board/efikamx/efikamx-usb.c
index 840bd9a..bb1398b 100644
--- a/board/efikamx/efikamx-usb.c
+++ b/board/efikamx/efikamx-usb.c
@@ -120,6 +120,7 @@ static void efika_ehci_init(struct usb_ehci *ehci,
uint32_t stp_gpio,
{
int ret;
struct ulpi_regs *ulpi =3D (struct ulpi_regs *)0;
+ struct ulpi_viewport ulpi_vp;
mxc_request_iomux(stp_gpio, alt0);
mxc_iomux_set_pad(stp_gpio, PAD_CTL_DRV_HIGH |
@@ -133,23 +134,25 @@ static void efika_ehci_init(struct usb_ehci
*ehci, uint32_t stp_gpio,
mxc_iomux_set_pad(stp_gpio, USB_PAD_CONFIG);
udelay(10000);
- ret =3D ulpi_init((u32)&ehci->ulpi_viewpoint);
+ ulpi_vp.viewport_addr =3D (u32)&ehci->ulpi_viewpoint;
+
+ ret =3D ulpi_init(&ulpi_vp);
if (ret) {
printf("Efika USB ULPI initialization failed\n");
return;
}
/* ULPI set flags */
- ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl,
+ ulpi_write(&ulpi_vp, &ulpi->otg_ctrl,
ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN |
ULPI_OTG_EXTVBUSIND);
- ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->function_ctrl,
+ ulpi_write(&ulpi_vp, &ulpi->function_ctrl,
ULPI_FC_FULL_SPEED | ULPI_FC_OPMODE_NORMAL |
ULPI_FC_SUSPENDM);
- ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->iface_ctrl, 0);
+ ulpi_write(&ulpi_vp, &ulpi->iface_ctrl, 0);
/* Set VBus */
- ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl_set,
+ ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set,
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
/*
@@ -158,7 +161,7 @@ static void efika_ehci_init(struct usb_ehci *ehci,
uint32_t stp_gpio,
* NOTE: This violates USB specification, but otherwise, USB on Efika
* doesn't work.
*/
- ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl_set,
+ ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set,
ULPI_OTG_CHRGVBUS);
}
@@ -177,9 +180,11 @@ void ehci_powerup_fixup(uint32_t *status_reg,
uint32_t *reg)
uint32_t port =3D OTG_BASE_ADDR + (0x200 * CONFIG_MXC_USB_PORT);
struct usb_ehci *ehci =3D (struct usb_ehci *)port;
struct ulpi_regs *ulpi =3D (struct ulpi_regs *)0;
+ struct ulpi_viewport ulpi_vp;
- ulpi_write((u32)&ehci->ulpi_viewpoint, &ulpi->otg_ctrl_set,
- ULPI_OTG_CHRGVBUS);
+ ulpi_vp.viewport_addr =3D (u32)&ehci->ulpi_viewpoint;
+
+ ulpi_write(&ulpi_vp, &ulpi->otg_ctrl_set, ULPI_OTG_CHRGVBUS);
wait_ms(50);
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 01c22e6..f68ceb2 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -27,6 +27,7 @@
*/
#include <common.h>
#include <usb.h>
+#include <usb/ulpi.h>
#include <errno.h>
#include <asm/io.h>
#include <asm/gpio.h>
@@ -93,25 +94,13 @@ static void omap_usbhs_hsic_init(int tll_cnt)
static void omap_ehci_soft_phy_reset(int port)
{
- unsigned int reg =3D 0;
- unsigned long init =3D get_timer(0);
+ struct ulpi_viewport ulpi_vp;
- /* FUNCTION_CTRL_SET register */
- reg =3D ULPI_FUNC_CTRL_RESET |
- (ULPI_SET(ULPI_FUNC_CTRL) << EHCI_INSNREG05_ULPI_REGADD_SHIFT) |
- (2 << EHCI_INSNREG05_ULPI_OPSEL_SHIFT) |
- ((port + 1) << EHCI_INSNREG05_ULPI_PORTSEL_SHIFT) |
- (1 << EHCI_INSNREG05_ULPI_CONTROL_SHIFT);
+ ulpi_vp.viewport_addr =3D (u32)&ehci->insreg05_utmi_ulpi;
+ ulpi_vp.port_num =3D port;
- writel(reg, &ehci->insreg05_utmi_ulpi);
+ ulpi_reset(&ulpi_vp);
- /* Wait for ULPI access completion */
- while ((readl(&ehci->insreg05_utmi_ulpi) &
- (1 << EHCI_INSNREG05_ULPI_CONTROL_SHIFT)))
- if (get_timer(init) > CONFIG_SYS_HZ) {
- debug("OMAP EHCI error: timeout resetting phy\n");
- break;
- }
}
inline int __board_usb_init(void)
diff --git a/drivers/usb/ulpi/Makefile b/drivers/usb/ulpi/Makefile
index d43b229..67d5e5e 100644
--- a/drivers/usb/ulpi/Makefile
+++ b/drivers/usb/ulpi/Makefile
@@ -24,6 +24,7 @@ LIB :=3D $(obj)libusb_ulpi.o
COBJS-$(CONFIG_USB_ULPI) +=3D ulpi.o
COBJS-$(CONFIG_USB_ULPI_VIEWPORT) +=3D ulpi-viewport.o
+COBJS-$(CONFIG_USB_OMAP_ULPI_VIEWPORT) +=3D omap-ulpi-viewport.o
COBJS :=3D $(COBJS-y)
SRCS :=3D $(COBJS:.o=3D.c)
diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c
b/drivers/usb/ulpi/omap-ulpi-viewport.c
new file mode 100644
index 0000000..1718788
--- /dev/null
+++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
@@ -0,0 +1,110 @@
+/*
+ * OMAP ulpi viewport support
+ * Based on drivers/usb/ulpi/ulpi-viewport.c
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Govindraj R <govindraj.raja at ti.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <usb/ulpi.h>
+
+/* ULPI viewport control bits */
+#define OMAP_ULPI_PORT_SHIFT 24
+
+#define OMAP_ULPI_WR_OPSEL (3 << 21)
+#define OMAP_ULPI_ACCESS (1 << 31)
+
+/*
+ * Wait for the ULPI Access to complete
+ */
+static int ulpi_wait(struct ulpi_viewport *ulpi_vp, u32 mask)
+{
+ int timeout =3D CONFIG_USB_ULPI_TIMEOUT;
+
+ while (--timeout) {
+ if ((readl(ulpi_vp->viewport_addr) & mask))
+ return 0;
+
+ udelay(1);
+ }
+
+ return ULPI_ERROR;
+}
+
+/*
+ * Wake the ULPI PHY up for communication
+ *
+ * returns 0 on success.
+ */
+static int ulpi_wakeup(struct ulpi_viewport *ulpi_vp)
+{
+ int err;
+
+ if (readl(ulpi_vp->viewport_addr) & OMAP_ULPI_ACCESS)
+ return 0; /* already awake */
+
+ writel(OMAP_ULPI_ACCESS, ulpi_vp->viewport_addr);
+
+ err =3D ulpi_wait(ulpi_vp, OMAP_ULPI_ACCESS);
+ if (err)
+ debug("ULPI wakeup timed out\n");
+
+ return err;
+}
+
+/*
+ * Issue a ULPI read/write request
+ */
+static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
+{
+ int err;
+
+ err =3D ulpi_wakeup(ulpi_vp);
+ if (err)
+ return err;
+
+ writel(value, ulpi_vp->viewport_addr);
+
+ err =3D ulpi_wait(ulpi_vp, OMAP_ULPI_ACCESS);
+ if (err)
+ debug("ULPI request timed out\n");
+
+ return err;
+}
+
+int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
+{
+ u32 val =3D (ulpi_vp->port_num << OMAP_ULPI_PORT_SHIFT) |
+ OMAP_ULPI_WR_OPSEL |
+ ((u32)reg << 16) | (value & 0xff);
+
+ return ulpi_request(ulpi_vp, val);
+}
+
+u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
+{
+ int err;
+ u32 val =3D (ulpi_vp->port_num << OMAP_ULPI_PORT_SHIFT) |
+ OMAP_ULPI_WR_OPSEL |
+ ((u32)reg << 16);
+
+ err =3D ulpi_request(ulpi_vp, val);
+ if (err)
+ return err;
+
+ return readl(ulpi_vp->viewport_addr) & 0xff;
+}
diff --git a/drivers/usb/ulpi/ulpi-viewport.c b/drivers/usb/ulpi/ulpi-viewp=
ort.c
index 490fb0e..6f03f08 100644
--- a/drivers/usb/ulpi/ulpi-viewport.c
+++ b/drivers/usb/ulpi/ulpi-viewport.c
@@ -40,13 +40,13 @@
*
* returns 0 on mask match, ULPI_ERROR on time out.
*/
-static int ulpi_wait(u32 ulpi_viewport, u32 mask)
+static int ulpi_wait(struct ulpi_viewport *ulpi_vp, u32 mask)
{
int timeout =3D CONFIG_USB_ULPI_TIMEOUT;
/* Wait for the bits in mask to become zero. */
while (--timeout) {
- if ((readl(ulpi_viewport) & mask) =3D=3D 0)
+ if ((readl(ulpi_vp->viewport_addr) & mask) =3D=3D 0)
return 0;
udelay(1);
@@ -60,16 +60,16 @@ static int ulpi_wait(u32 ulpi_viewport, u32 mask)
*
* returns 0 on success.
*/
-static int ulpi_wakeup(u32 ulpi_viewport)
+static int ulpi_wakeup(struct ulpi_viewport *ulpi_vp)
{
int err;
- if (readl(ulpi_viewport) & ULPI_SS)
+ if (readl(ulpi_vp->viewport_addr) & ULPI_SS)
return 0; /* already awake */
- writel(ULPI_WU, ulpi_viewport);
+ writel(ULPI_WU, ulpi_vp->viewport_addr);
- err =3D ulpi_wait(ulpi_viewport, ULPI_WU);
+ err =3D ulpi_wait(ulpi_vp, ULPI_WU);
if (err)
printf("ULPI wakeup timed out\n");
@@ -81,38 +81,38 @@ static int ulpi_wakeup(u32 ulpi_viewport)
*
* @value - the ULPI request
*/
-static int ulpi_request(u32 ulpi_viewport, u32 value)
+static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
{
int err;
- err =3D ulpi_wakeup(ulpi_viewport);
+ err =3D ulpi_wakeup(ulpi_vp);
if (err)
return err;
- writel(value, ulpi_viewport);
+ writel(value, ulpi_vp->viewport_addr);
- err =3D ulpi_wait(ulpi_viewport, ULPI_RWRUN);
+ err =3D ulpi_wait(ulpi_vp, ULPI_RWRUN);
if (err)
printf("ULPI request timed out\n");
return err;
}
-int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)
+int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
{
u32 val =3D ULPI_RWRUN | ULPI_RWCTRL | ((u32)reg << 16) | (value & 0xff);
- return ulpi_request(ulpi_viewport, val);
+ return ulpi_request(ulpi_vp, val);
}
-u32 ulpi_read(u32 ulpi_viewport, u8 *reg)
+u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
{
int err;
u32 val =3D ULPI_RWRUN | ((u32)reg << 16);
- err =3D ulpi_request(ulpi_viewport, val);
+ err =3D ulpi_request(ulpi_vp, val);
if (err)
return err;
- return (readl(ulpi_viewport) >> 8) & 0xff;
+ return (readl(ulpi_vp->viewport_addr) >> 8) & 0xff;
}
diff --git a/drivers/usb/ulpi/ulpi.c b/drivers/usb/ulpi/ulpi.c
index 6202227..dde2585 100644
--- a/drivers/usb/ulpi/ulpi.c
+++ b/drivers/usb/ulpi/ulpi.c
@@ -37,18 +37,18 @@
static struct ulpi_regs *ulpi =3D (struct ulpi_regs *)0;
-static int ulpi_integrity_check(u32 ulpi_viewport)
+static int ulpi_integrity_check(struct ulpi_viewport *ulpi_vp)
{
u32 val, tval =3D ULPI_TEST_VALUE;
int err, i;
/* Use the 'special' test value to check all bits */
for (i =3D 0; i < 2; i++, tval <<=3D 1) {
- err =3D ulpi_write(ulpi_viewport, &ulpi->scratch, tval);
+ err =3D ulpi_write(ulpi_vp, &ulpi->scratch, tval);
if (err)
return err;
- val =3D ulpi_read(ulpi_viewport, &ulpi->scratch);
+ val =3D ulpi_read(ulpi_vp, &ulpi->scratch);
if (val !=3D tval) {
printf("ULPI integrity check failed\n");
return val;
@@ -58,7 +58,7 @@ static int ulpi_integrity_check(u32 ulpi_viewport)
return 0;
}
-int ulpi_init(u32 ulpi_viewport)
+int ulpi_init(struct ulpi_viewport *ulpi_vp)
{
u32 val, id =3D 0;
u8 *reg =3D &ulpi->product_id_high;
@@ -66,7 +66,7 @@ int ulpi_init(u32 ulpi_viewport)
/* Assemble ID from four ULPI ID registers (8 bits each). */
for (i =3D 0; i < ULPI_ID_REGS_COUNT; i++) {
- val =3D ulpi_read(ulpi_viewport, reg - i);
+ val =3D ulpi_read(ulpi_vp, reg - i);
if (val =3D=3D ULPI_ERROR)
return val;
@@ -76,10 +76,10 @@ int ulpi_init(u32 ulpi_viewport)
/* Split ID into vendor and product ID. */
debug("ULPI transceiver ID 0x%04x:0x%04x\n", id >> 16, id & 0xffff);
- return ulpi_integrity_check(ulpi_viewport);
+ return ulpi_integrity_check(ulpi_vp);
}
-int ulpi_select_transceiver(u32 ulpi_viewport, unsigned speed)
+int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed)
{
u32 tspeed =3D ULPI_FC_FULL_SPEED;
u32 val;
@@ -96,17 +96,18 @@ int ulpi_select_transceiver(u32 ulpi_viewport,
unsigned speed)
"falling back to full speed\n", __func__, speed);
}
- val =3D ulpi_read(ulpi_viewport, &ulpi->function_ctrl);
+ val =3D ulpi_read(ulpi_vp, &ulpi->function_ctrl);
if (val =3D=3D ULPI_ERROR)
return val;
/* clear the previous speed setting */
val =3D (val & ~ULPI_FC_XCVRSEL_MASK) | tspeed;
- return ulpi_write(ulpi_viewport, &ulpi->function_ctrl, val);
+ return ulpi_write(ulpi_vp, &ulpi->function_ctrl, val);
}
-int ulpi_set_vbus(u32 ulpi_viewport, int on, int ext_power, int ext_ind)
+int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power,
+ int ext_ind)
{
u32 flags =3D ULPI_OTG_DRVVBUS;
u8 *reg =3D on ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
@@ -116,18 +117,18 @@ int ulpi_set_vbus(u32 ulpi_viewport, int on, int
ext_power, int ext_ind)
if (ext_ind)
flags |=3D ULPI_OTG_EXTVBUSIND;
- return ulpi_write(ulpi_viewport, reg, flags);
+ return ulpi_write(ulpi_vp, reg, flags);
}
-int ulpi_set_pd(u32 ulpi_viewport, int enable)
+int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable)
{
u32 val =3D ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN;
u8 *reg =3D enable ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
- return ulpi_write(ulpi_viewport, reg, val);
+ return ulpi_write(ulpi_vp, reg, val);
}
-int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode)
+int ulpi_opmode_sel(struct ulpi_viewport *ulpi_vp, unsigned opmode)
{
u32 topmode =3D ULPI_FC_OPMODE_NORMAL;
u32 val;
@@ -144,17 +145,17 @@ int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmod=
e)
"falling back to OpMode Normal\n", __func__, opmode);
}
- val =3D ulpi_read(ulpi_viewport, &ulpi->function_ctrl);
+ val =3D ulpi_read(ulpi_vp, &ulpi->function_ctrl);
if (val =3D=3D ULPI_ERROR)
return val;
/* clear the previous opmode setting */
val =3D (val & ~ULPI_FC_OPMODE_MASK) | topmode;
- return ulpi_write(ulpi_viewport, &ulpi->function_ctrl, val);
+ return ulpi_write(ulpi_vp, &ulpi->function_ctrl, val);
}
-int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode)
+int ulpi_serial_mode_enable(struct ulpi_viewport *ulpi_vp, unsigned smode)
{
switch (smode) {
case ULPI_IFACE_6_PIN_SERIAL_MODE:
@@ -166,14 +167,14 @@ int ulpi_serial_mode_enable(u32 ulpi_viewport,
unsigned smode)
return ULPI_ERROR;
}
- return ulpi_write(ulpi_viewport, &ulpi->iface_ctrl_set, smode);
+ return ulpi_write(ulpi_vp, &ulpi->iface_ctrl_set, smode);
}
-int ulpi_suspend(u32 ulpi_viewport)
+int ulpi_suspend(struct ulpi_viewport *ulpi_vp)
{
int err;
- err =3D ulpi_write(ulpi_viewport, &ulpi->function_ctrl_clear,
+ err =3D ulpi_write(ulpi_vp, &ulpi->function_ctrl_clear,
ULPI_FC_SUSPENDM);
if (err)
printf("ULPI: %s: failed writing the suspend bit\n", __func__);
@@ -186,7 +187,7 @@ int ulpi_suspend(u32 ulpi_viewport)
* Actual wait for reset must be done in a view port specific way,
* because it involves checking the DIR line.
*/
-static int __ulpi_reset_wait(u32 ulpi_viewport)
+static int __ulpi_reset_wait(struct ulpi_viewport *ulpi_vp)
{
u32 val;
int timeout =3D CONFIG_USB_ULPI_TIMEOUT;
@@ -199,7 +200,7 @@ static int __ulpi_reset_wait(u32 ulpi_viewport)
* for the error of ulpi_read(), if there is one, then
* there will be a timeout.
*/
- val =3D ulpi_read(ulpi_viewport, &ulpi->function_ctrl);
+ val =3D ulpi_read(ulpi_vp, &ulpi->function_ctrl);
if (!(val & ULPI_FC_RESET))
return 0;
@@ -210,18 +211,19 @@ static int __ulpi_reset_wait(u32 ulpi_viewport)
return ULPI_ERROR;
}
-int ulpi_reset_wait(u32) __attribute__((weak, alias("__ulpi_reset_wait")))=
;
+int ulpi_reset_wait(struct ulpi_viewport *ulpi_vp)
+ __attribute__((weak, alias("__ulpi_reset_wait")));
-int ulpi_reset(u32 ulpi_viewport)
+int ulpi_reset(struct ulpi_viewport *ulpi_vp)
{
int err;
- err =3D ulpi_write(ulpi_viewport,
+ err =3D ulpi_write(ulpi_vp,
&ulpi->function_ctrl_set, ULPI_FC_RESET);
if (err) {
printf("ULPI: %s: failed writing reset bit\n", __func__);
return err;
}
- return ulpi_reset_wait(ulpi_viewport);
+ return ulpi_reset_wait(ulpi_vp);
}
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.=
h
index b4d6443..2183ea6 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -130,6 +130,9 @@
#define CONFIG_CMD_USB
#define CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_OMAP_ULPI_VIEWPORT
+
/*#define CONFIG_EHCI_DCACHE*/ /* leave it disabled for now */
#define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO 147
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h
index 23c0230..0228a66 100644
--- a/include/configs/omap4_panda.h
+++ b/include/configs/omap4_panda.h
@@ -38,6 +38,8 @@
#define CONFIG_USB_HOST
#define CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_OMAP_ULPI_VIEWPORT
#define CONFIG_USB_STORAGE
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 802f077..1da43ae 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -28,12 +28,24 @@
#endif
/*
+ * ulpi view port address and
+ * Port_number that can be passed.
+ * Any additional data to be passed can
+ * be extended from this structure
+ */
+struct ulpi_viewport {
+ u32 viewport_addr;
+ u8 port_num;
+};
+
+/*
* Initialize the ULPI transciever and check the interface integrity.
- * @ulpi_viewport - the address of the ULPI viewport register.
+ * @ulpi_viewport - structure containing the address of the ULPI viewport
+ register and port number to access.
*
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_init(u32 ulpi_viewport);
+int ulpi_init(struct ulpi_viewport *ulpi_vp);
/*
* Select transceiver speed.
@@ -41,7 +53,7 @@ int ulpi_init(u32 ulpi_viewport);
* ULPI_FC_LOW_SPEED, ULPI_FC_FS4LS
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_select_transceiver(u32 ulpi_viewport, unsigned speed);
+int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed)=
;
/*
* Enable/disable VBUS.
@@ -50,14 +62,15 @@ int ulpi_select_transceiver(u32 ulpi_viewport,
unsigned speed);
*
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_enable_vbus(u32 ulpi_viewport, int on, int ext_power, int ext_ind=
);
+int ulpi_enable_vbus(struct ulpi_viewport *ulpi_vp,
+ int on, int ext_power, int ext_ind);
/*
* Enable/disable pull-down resistors on D+ and D- USB lines.
*
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_set_pd(u32 ulpi_viewport, int enable);
+int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable);
/*
* Select OpMode.
@@ -66,7 +79,7 @@ int ulpi_set_pd(u32 ulpi_viewport, int enable);
*
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode);
+int ulpi_opmode_sel(struct ulpi_viewport *ulpi_vp, unsigned opmode);
/*
* Switch to Serial Mode.
@@ -78,7 +91,7 @@ int ulpi_opmode_sel(u32 ulpi_viewport, unsigned opmode);
* Switches immediately to Serial Mode.
* To return from Serial Mode, STP line needs to be asserted.
*/
-int ulpi_serial_mode_enable(u32 ulpi_viewport, unsigned smode);
+int ulpi_serial_mode_enable(struct ulpi_viewport *ulpi_vp, unsigned smode)=
;
/*
* Put PHY into low power mode.
@@ -89,14 +102,14 @@ int ulpi_serial_mode_enable(u32 ulpi_viewport,
unsigned smode);
* STP line must be driven low to keep the PHY in suspend.
* To resume the PHY, STP line needs to be asserted.
*/
-int ulpi_suspend(u32 ulpi_viewport);
+int ulpi_suspend(struct ulpi_viewport *ulpi_vp);
/*
* Reset the transceiver. ULPI interface and registers are not affected.
*
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_reset(u32 ulpi_viewport);
+int ulpi_reset(struct ulpi_viewport *ulpi_vp);
/* ULPI access methods below must be implemented for each ULPI viewport. *=
/
@@ -108,7 +121,7 @@ int ulpi_reset(u32 ulpi_viewport);
*
* returns 0 on success, ULPI_ERROR on failure.
*/
-int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value);
+int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value);
/*
* Read the ULPI PHY register content via the viewport.
@@ -116,14 +129,14 @@ int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)=
;
*
* returns register content on success, ULPI_ERROR on failure.
*/
-u32 ulpi_read(u32 ulpi_viewport, u8 *reg);
+u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg);
/*
* Wait for the reset to complete.
* The Link must not attempt to access the PHY until the reset has
* completed and DIR line is de-asserted.
*/
-int ulpi_reset_wait(u32 ulpi_viewport);
+int ulpi_reset_wait(struct ulpi_viewport *ulpi_vp);
/* Access Extended Register Set (indicator) */
#define ACCESS_EXT_REGS_OFFSET 0x2f /* read-write */
--=20
1.7.5.4
More information about the U-Boot
mailing list