Apply this against http://www.beagleboard.org/linux-2.6.git (branch :
2.6.28-oe-r8)
http://www.beagleboard.org/gitweb/?p=linux-2.6.git;a=shortlog;h=2.6.28-oe-r8
Signed-off-by: Syed Mohammed Khasim <kha...@ti.com>
---
--- linux-2.6.git/drivers/usb/musb/omap2430.c 2009-01-19
22:42:18.000000000 +0530
+++ linux-2.6.git/drivers/usb/musb/omap2430.c 2009-02-19
12:45:22.000000000 +0530
@@ -33,6 +33,7 @@
#include <linux/list.h>
#include <linux/clk.h>
#include <linux/io.h>
+#include <linux/i2c/twl4030.h>
#include <asm/mach-types.h>
#include <mach/hardware.h>
@@ -233,6 +234,14 @@ int __init musb_platform_init(struct mus
omap_cfg_reg(AE5_2430_USB0HS_STP);
#endif
+ /* Reset MUSB Controller */
+ omap_writel(SOFTRST,OTG_SYSCONFIG);
+
+#if defined(CONFIG_TWL4030_USB)
+ /* Reset the TWL USB PHY */
+ twl4030_i2c_write_u8(TWL4030_MODULE_USB, 0x60, 0x4);
+#endif
+
musb->xceiv = *x;
musb_platform_resume(musb);
Do you know what exactly what command I should issue (using
musb_ulpi_writeb) to reset the PHY ?
Regards,
Khasim
> /* ULPI Registers */
> #define ULPI_VBUS_CONTROL 0x70 /* 8 bit */
> #define ULPI_CARKIT_CONTROL 0x71 /* 8 bit */
> #define ULPI_INT_MASK 0x72 /* 8 bit */
> #define ULPI_INT_SRC 0x73 /* 8 bit */
> #define ULPI_REG_DATA 0x74 /* 8 bit */
> #define ULPI_REG_ADDR 0x75 /* 8 bit */
> #define ULPI_REG_CONTROL 0x76 /* 8 bit */
> #define ULPI_RAW_DATA 0x77 /* 8 bit */
>
> static inline u8 musb_ulpi_readb(void __iomem *addr, u8 offset)
> {
> int i = 0;
> u8 r;
>
> musb_writeb(addr, ULPI_REG_ADDR, offset);
> musb_writeb(addr, ULPI_REG_CONTROL, ULPI_REG_REQ | ULPI_RDN_WR);
>
> while (!(musb_readb(addr, ULPI_REG_CONTROL) & ULPI_REG_CMPLT)) {
> i++;
> if (i == 10000) {
> DBG(3, "ULPI read timed out\n");
> return 0;
> }
>
> }
> r = musb_readb(addr, ULPI_REG_CONTROL);
> r &= ~ULPI_REG_CMPLT;
> musb_writeb(addr, ULPI_REG_CONTROL, r);
>
> return musb_readb(addr, ULPI_REG_DATA);
> }
>
> static inline void musb_ulpi_writeb(void __iomem *addr,
> u8 offset, u8 data)
> {
> int i = 0;
> u8 r = 0;
>
> musb_writeb(addr, ULPI_REG_ADDR, offset);
> musb_writeb(addr, ULPI_REG_DATA, data);
> musb_writeb(addr, ULPI_REG_CONTROL, ULPI_REG_REQ);
>
> while(!(musb_readb(addr, ULPI_REG_CONTROL) & ULPI_REG_CMPLT)) {
> i++;
> if (i == 10000) {
> DBG(3, "ULPI write timed out\n");
> return;
> }
> }
>
> r = musb_readb(addr, ULPI_REG_CONTROL);
> r &= ~ULPI_REG_CMPLT;
> musb_writeb(addr, ULPI_REG_CONTROL, r);
> }
>
> add these to musb_regs.h, actually read/write could go to musb_io.h
>
>> >>> --- linux-2.6.git/drivers/usb/musb/omap2430.c 2009-01-19
>> >>> 22:42:18.000000000 +0530
>> >>> +++ linux-2.6.git/drivers/usb/musb/omap2430.c 2009-02-19
>> >>> 12:45:22.000000000 +0530
>> >>> @@ -33,6 +33,7 @@
>> >>> #include <linux/list.h>
>> >>> #include <linux/clk.h>
>> >>> #include <linux/io.h>
>> >>> +#include <linux/i2c/twl4030.h>
>> >>>
>> >>> #include <asm/mach-types.h>
>> >>> #include <mach/hardware.h>
>> >>> @@ -233,6 +234,14 @@ int __init musb_platform_init(struct mus
>> >>> omap_cfg_reg(AE5_2430_USB0HS_STP);
>> >>> #endif
>> >>>
>> >>> + /* Reset MUSB Controller */
>> >>> + omap_writel(SOFTRST,OTG_SYSCONFIG);
>> >>> +
>> >>> +#if defined(CONFIG_TWL4030_USB)
>> >>> + /* Reset the TWL USB PHY */
>> >>> + twl4030_i2c_write_u8(TWL4030_MODULE_USB, 0x60, 0x4);
>> >>> +#endif
>> >>> +
>> >>> musb->xceiv = *x;
>> >>> musb_platform_resume(musb);
>
> Resetting before probing makes sense to me, clears unwanted states left
> from bootloader at least, but the twl4030-usb part should go to its
> probe function at drivers/usb/otg/twl4030-usb.c
>
> --
> balbi
>
Felipe,
drivers/usb/musb/musb_io.h:157: error: 'ULPI_REG_REQ' undeclared
(first use in this function)
drivers/usb/musb/musb_io.h:157: error: (Each undeclared identifier is
reported only once
drivers/usb/musb/musb_io.h:157: error: for each function it appears in.)
drivers/usb/musb/musb_io.h:157: error: 'ULPI_RDN_WR' undeclared (first
use in this function)
drivers/usb/musb/musb_io.h:159: error: 'ULPI_REG_CMPLT' undeclared
(first use in this function)
drivers/usb/musb/musb_io.h: In function 'musb_ulpi_writeb':
drivers/usb/musb/musb_io.h:181: error: 'ULPI_REG_REQ' undeclared
(first use in this function)
drivers/usb/musb/musb_io.h:183: error: 'ULPI_REG_CMPLT' undeclared
(first use in this function)
What is offset for these ?
Regards,
Khasim
I have ulpi_read/writeb done:
return musb_readb(addr, ULPI_REG_DATA);
}
> >>> --- linux-2.6.git/drivers/usb/musb/omap2430.c 2009-01-19
> >>> 22:42:18.000000000 +0530
> >>> +++ linux-2.6.git/drivers/usb/musb/omap2430.c 2009-02-19
> >>> 12:45:22.000000000 +0530
> >>> @@ -33,6 +33,7 @@
> >>> #include <linux/list.h>
> >>> #include <linux/clk.h>
> >>> #include <linux/io.h>
> >>> +#include <linux/i2c/twl4030.h>
> >>>
> >>> #include <asm/mach-types.h>
> >>> #include <mach/hardware.h>
> >>> @@ -233,6 +234,14 @@ int __init musb_platform_init(struct mus
> >>> omap_cfg_reg(AE5_2430_USB0HS_STP);
> >>> #endif
> >>>
> >>> + /* Reset MUSB Controller */
> >>> + omap_writel(SOFTRST,OTG_SYSCONFIG);
> >>> +
> >>> +#if defined(CONFIG_TWL4030_USB)
> >>> + /* Reset the TWL USB PHY */
> >>> + twl4030_i2c_write_u8(TWL4030_MODULE_USB, 0x60, 0x4);
> >>> +#endif
> >>> +
> >>> musb->xceiv = *x;
> >>> musb_platform_resume(musb);
Resetting before probing makes sense to me, clears unwanted states left
sorry, I don't :-(
--
balbi
Write to FUNC_CTRL (register offset 0x04) bit RESET (bit 5).
i.e. (write 0x20 to register addr 0x04).
That should do the trick. The reset is auto-cleared.
Hope this helps.
Anand
#define ULPI_REG_REQ 0x01
#define ULPI_REG_CMPLT 0x02
#define ULPI_RDN_WR 0x04
I am trying to reset the PHY,
musb_ulpi_writeb(musb->mregs,0x04,0x20);
Syntax:
musb_ulpi_writeb(void __iomem *addr, u8 offset, u8 data)
Doesn't seem to work. Do you find any errors in this Call ?
Regards,
Khasim