diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2009-10-15 10:03:20 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2009-10-15 10:03:20 +0000 |
commit | 8bd8d06842f9fe5d9c25d47c28f064052b375fa3 (patch) | |
tree | a279ce246a3388a0c8e7da5af577226fbf6c1b02 /firmware/target | |
parent | 5303ab101be6f2497f43da5db83edf2adeb362fe (diff) |
Sansa AMS USB driver : still not working
Implement usb_enable()
Reorder/Modify usb_drv_init() to match closer the OF and remove a freeze
(USB registers were accessed before the USB module was enabled)
Add a panic in USB isr to be sure we notice when it's called
Reset GPIOA direction for usb_detect() to notice extraction
Add some comments
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23184 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/as3525/usb-as3525.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525.c | 46 |
2 files changed, 26 insertions, 26 deletions
diff --git a/firmware/target/arm/as3525/usb-as3525.c b/firmware/target/arm/as3525/usb-as3525.c index 5e913789b5..c32aa3c249 100644 --- a/firmware/target/arm/as3525/usb-as3525.c +++ b/firmware/target/arm/as3525/usb-as3525.c @@ -22,6 +22,7 @@ #include <stdbool.h> #include "config.h" #include "usb.h" +#include "usb_core.h" #include "usb-target.h" #include "power.h" #include "as3525.h" @@ -38,7 +39,10 @@ void usb_enable(bool on) { - (void)on; + if (on) + usb_core_init(); + else + usb_core_exit(); } void usb_init_device(void) diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index bac5f6776b..8a1abea74f 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c @@ -26,6 +26,10 @@ #include "ascodec.h" #include "as3514.h" #include <stdbool.h> +#include "panic.h" +//#define LOGF_ENABLE +#include "logf.h" + /* 4 input endpoints */ #define USB_IEP_CTRL(i) *((volatile unsigned long*) USB_BASE + 0x0000 + (i*0x20)) @@ -120,11 +124,6 @@ void usb_drv_init(void) ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2); ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) & ~(1<<4)); - USB_GPIO_CSR |= 0x1C00000; //sleep(3) - sleep(1); - USB_GPIO_CSR |= 0x200000; //sleep(10) - sleep(1); - /* PHY part */ CGU_USB = 1<<5 /* enable */ | (CLK_DIV(AS3525_PLLA_FREQ, 48000000) / 2) << 2 @@ -133,37 +132,33 @@ void usb_drv_init(void) /* AHB part */ CGU_PERI |= CGU_USB_CLOCK_ENABLE; - /* UVDD */ - ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) | (1<<4)); - - sleep(10); - - USB_DEV_CFG |= (1<<31); /* soft reset */ - volatile int tmp = USB_DEV_CFG; - (void)tmp; - USB_GPIO_CSR = 0x6180000; - USB_DEV_CFG = (USB_DEV_CFG & ~3) | 1; /* full speed */ - USB_DEV_CTRL |= 0x400; /* soft disconnect */ + /* UVDD */ + ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) | (1<<4)); + sleep(10); //msleep(100) + + USB_GPIO_CSR = 0x6180000; - USB_GPIO_CSR |= 0x1C00000; //sleep(3) - sleep(1); - USB_GPIO_CSR |= 0x200000; //sleep(10) - sleep(1); + USB_GPIO_CSR |= 0x1C00000; + sleep(1); //msleep(3) + USB_GPIO_CSR |= 0x200000; + sleep(1); //msleep(10) USB_DEV_CTRL |= 0x400; /* soft disconnect */ - USB_GPIO_CSR &= ~0x1C00000; //sleep(3) - sleep(1); - USB_GPIO_CSR &= ~0x200000; //sleep(10) - sleep(1); - USB_DEV_CTRL &= ~0x400; /* soft disconnect */ + USB_GPIO_CSR &= ~0x1C00000; + sleep(1); //msleep(3) + USB_GPIO_CSR &= ~0x200000; + sleep(1); //msleep(10) + USB_DEV_CTRL &= ~0x400; /* clear soft disconnect */ + /* note : this pin might be Clip specific */ GPIOA_DIR |= (1<<6); GPIOA_PIN(6) = (1<<6); + GPIOA_DIR &= ~(1<<6); /* restore direction for usb_detect() */ #if 0 /* linux */ USB_DEV_CFG |= (1<<17) /* csr programming */ @@ -260,6 +255,7 @@ int usb_drv_send_nonblocking(int ep, void *ptr, int len) /* interrupt service routine */ void INT_USB(void) { + panicf("USB interrupt !"); } /* (not essential? , not implemented in usb-tcc.c) */ |