Hi Kieran, 2010/6/8 Kieran Bingham <[email protected]>
> From: Kieran Bingham <[email protected]> > > This patch was created by pulling in the code required from the Arago Tree. > Checked by running on a Spectrum Digital DM365EVM Revision C. > > Signed-off-by: Kieran Bingham <[email protected]> > --- > arch/arm/mach-davinci/board-dm365-evm.c | 13 +++++++++++++ > drivers/usb/musb/davinci.c | 12 ++++++++++++ > drivers/usb/musb/davinci.h | 4 ++++ > 3 files changed, 29 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-davinci/board-dm365-evm.c > b/arch/arm/mach-davinci/board-dm365-evm.c > index fdb073e..c4a05fc 100644 > --- a/arch/arm/mach-davinci/board-dm365-evm.c > +++ b/arch/arm/mach-davinci/board-dm365-evm.c > @@ -18,6 +18,7 @@ > #include <linux/i2c.h> > #include <linux/io.h> > #include <linux/clk.h> > +#include <linux/gpio.h> > #include <linux/i2c/at24.h> > #include <linux/leds.h> > #include <linux/mtd/mtd.h> > @@ -39,6 +40,7 @@ > #include <mach/mmc.h> > #include <mach/nand.h> > #include <mach/keyscan.h> > +#include <mach/usb.h> > > #include <media/tvp514x.h> > > @@ -590,6 +592,15 @@ static struct spi_board_info dm365_evm_spi_info[] > __initconst = { > }, > }; > > +static void dm365evm_usb_configure(void) > +{ > + davinci_cfg_reg(DM365_GPIO33); > + gpio_request(33, "usb"); > + gpio_direction_output(33, 1); > + davinci_setup_usb(500, 8); > +} > + > + > static __init void dm365_evm_init(void) > { > evm_init_i2c(); > @@ -607,6 +618,8 @@ static __init void dm365_evm_init(void) > dm365_init_rtc(); > dm365_init_ks(&dm365evm_ks_data); > > + dm365evm_usb_configure(); > + > dm365_init_spi0(BIT(0), dm365_evm_spi_info, > ARRAY_SIZE(dm365_evm_spi_info)); > } > diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c > index ce2e16f..3736792 100644 > --- a/drivers/usb/musb/davinci.c > +++ b/drivers/usb/musb/davinci.c > @@ -64,6 +64,16 @@ static inline void phy_on(void) > /* power everything up; start the on-chip PHY and its PLL */ > phy_ctrl &= ~(USBPHY_OSCPDWN | USBPHY_OTGPDWN | USBPHY_PHYPDWN); > phy_ctrl |= USBPHY_SESNDEN | USBPHY_VBDTCTEN | USBPHY_PHYPLLON; > + > + if (cpu_is_davinci_dm365()) { > + /* > + * DM365 PHYCLKFREQ field [15:12] is set to 2 > + * to get clock from 24MHz crystal > + */ > + phy_ctrl |= USBPHY_CLKFREQ_24MHZ; > + /*phy_ctrl &= ~USBPHY_PHYPDWN;*/ > + } > + > __raw_writel(phy_ctrl, USB_PHY_CTRL); > > /* wait for PLL to lock before proceeding */ > @@ -188,6 +198,8 @@ static void davinci_source_power(struct musb *musb, int > is_on, int immediate) > if (immediate) > vbus_state = is_on; > #endif > + if (cpu_is_davinci_dm365()) > + gpio_set_value(33, is_on); > } > > static void davinci_set_vbus(struct musb *musb, int is_on) > diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h > index 046c844..0577ec6 100644 > --- a/drivers/usb/musb/davinci.h > +++ b/drivers/usb/musb/davinci.h > @@ -16,6 +16,10 @@ > > /* Integrated highspeed/otg PHY */ > #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34) > +#define USBPHY_NDATAPOL BIT(18) > +#define USBPHY_SESSION_VBUS BIT(17) > +#define USBPHY_PERI_USBID BIT(16) > +#define USBPHY_CLKFREQ_24MHZ BIT(13) > #define USBPHY_DATAPOL BIT(11) /* (dm355) switch D+/D- */ > #define USBPHY_PHYCLKGD BIT(8) > #define USBPHY_SESNDEN BIT(7) /* v(sess_end) comparator */ > -- > 1.6.2.1 > > _______________________________________________ > Davinci-linux-open-source mailing list > [email protected] > http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source > I have applied and tested your patch. On the target: modprobe g_cdc or modprobe g_ether ifconfig usb0 128.16.0.1 netmask 255.255.224.0 and on the ubuntu host: ifconfig usb0 128.16.0.2 netmask 255.255.224.0 Instead the win-xp host can't do get_descriptor. I've tested also with beagle sniffer. With win-xp host I get only: and the win-xp thinks to see null vid and pids. ========================= musb_hdrc: version 6.0, pio, peripheral, debug=0 musb_hdrc: ConfigData=0x06 (UTMI-8, dyn FIFOs, SoftConn) musb_hdrc: MHDRC RTL version 1.500 musb_hdrc: setup fifo_mode 2 musb_hdrc: 7/9 max ep, 2624/4096 memory musb_hdrc musb_hdrc: USB Peripheral mode controller at fec64000 using PIO, IRQ 12 g_ether gadget: using random self ethernet address g_ether gadget: using random host ethernet address usb0: MAC 82:aa:9e:2a:87:e1 usb0: HOST MAC 6a:eb:1b:a6:67:69 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 g_ether gadget: g_ether ready musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_idle musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 With Ubuntu host I get: ================================= musb_hdrc: version 6.0, pio, peripheral, debug=0 musb_hdrc: ConfigData=0x06 (UTMI-8, dyn FIFOs, SoftConn) musb_hdrc: MHDRC RTL version 1.500 musb_hdrc: setup fifo_mode 2 musb_hdrc: 7/9 max ep, 2624/4096 memory musb_hdrc musb_hdrc: USB Peripheral mode controller at fec64000 using PIO, IRQ 12 g_ether gadget: using random self ethernet address g_ether gadget: using random host ethernet address usb0: MAC 02:9a:94:85:fb:cb usb0: HOST MAC fa:78:0d:33:51:9e g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 g_ether gadget: g_ether ready musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_idle musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=f0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_stage0_irq 384: <== Power=e0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_read_setup 577: SETUP req80.06 v0100 i0000 l64 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=18 musb_stage0_irq 384: <== Power=e0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_read_setup 577: SETUP req00.05 v000d i0000 l0 musb_g_ep0_irq 825: handled 1, csr 0001, ep0stage in/status musb_read_setup 577: SETUP req80.06 v0100 i0000 l18 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=18 musb_read_setup 577: SETUP req80.06 v0600 i0000 l10 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=10 musb_read_setup 577: SETUP req80.06 v0200 i0000 l9 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=9 musb_read_setup 577: SETUP req80.06 v0200 i0000 l75 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=75 musb_read_setup 577: SETUP req80.06 v0201 i0000 l9 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=9 musb_read_setup 577: SETUP req80.06 v0201 i0000 l80 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=80 musb_read_setup 577: SETUP req80.06 v0300 i0000 l255 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=4 musb_read_setup 577: SETUP req80.06 v0302 i0409 l255 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=44 musb_read_setup 577: SETUP req80.06 v0301 i0409 l255 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=56 musb_read_setup 577: SETUP req00.09 v0001 i0000 l0 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage wait g_ether gadget: full speed config #1: CDC Ethernet (ECM) musb_ep_restart 1088: <== TX/IN request c7761a00 len 8 on hw_ep2 txstate 410: ep2in TX/IN pio len 8/8, txcsr 2003, fifo 8/512 musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=0 musb_read_setup 577: SETUP req80.06 v0306 i0409 l255 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=66 musb_read_setup 577: SETUP req01.0b v0001 i0001 l0 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage wait musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=0 musb_read_setup 577: SETUP req80.06 v0308 i0409 l255 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=26 musb_read_setup 577: SETUP req80.06 v0307 i0409 l255 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=36 txstate 410: ep2in TX/IN pio len 8/8, txcsr 2003, fifo 8/512 txstate 410: ep2in TX/IN pio len 16/16, txcsr 2003, fifo 16/512 So, after having done a failure test with win-xp, I wrote devmem2 0x01c64401 w 0xd1 forcing, with HSEN set to 0, full-speed mode. In this way win-xp can go on. By now I have not a good win-xo driver and so I can't end the enumeration. Note: In the ubuntu host case, I see that the line before SETUP there is a changing in Power register from 0xf0 to 0xe0. musb_stage0_irq 384: <== Power=e0, DevCtl=99, int_usb=0x4 musb_stage0_irq 767: BUS RESET as b_peripheral musb_g_reset 2013: <== B-Device addr=0 driver 'g_ether' musb_g_disconnect 1957: devctl 99 musb_read_setup 577: SETUP req80.06 v0100 i0000 l64 musb_g_ep0_irq 825: handled 0, csr 0001, ep0stage in musb_g_ep0_queue 931: queue to ep0 (OUT/RX), length=18 But the major difference is that win-xp does only three retries, instead ubuntu nine retries. Suggestions? Regards, Raffaele
_______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
