Subversion Repositories freemyipod

Rev

Rev 66 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 66 Rev 85
Line 29... Line 29...
29
#include "timer.h"
29
#include "timer.h"
30
#include "usb.h"
30
#include "usb.h"
31
#include "usb_ch9.h"
31
#include "usb_ch9.h"
32
#include "synopsysotg.h"
32
#include "synopsysotg.h"
33
#include "util.h"
33
#include "util.h"
-
 
34
#include "interrupt.h"
34
 
35
 
35
 
36
 
36
struct ep_type
37
struct ep_type
37
{
38
{
38
    bool active;
39
    bool active;
Line 131... Line 132...
131
    volatile int i;
132
    volatile int i;
132
 
133
 
133
    DCTL = 0x802;  /* Soft Disconnect */
134
    DCTL = 0x802;  /* Soft Disconnect */
134
 
135
 
135
    OPHYPWR = 0;  /* PHY: Power up */
136
    OPHYPWR = 0;  /* PHY: Power up */
136
    OPHYUNK1 = 0xFFFFFFFF;
137
    OPHYUNK1 = 1;
137
    OPHYUNK2 = 0xE3F;
138
    OPHYUNK2 = 0xE3F;
138
    OPHYCLK = 0;  /* PHY: 48MHz clock */
139
    OPHYCLK = SYNOPSYSOTG_CLOCK;
139
    ORSTCON = 1;  /* PHY: Assert Software Reset */
140
    ORSTCON = 1;  /* PHY: Assert Software Reset */
140
    udelay(10);
141
    udelay(10);
141
    ORSTCON = 0;  /* PHY: Deassert Software Reset */
142
    ORSTCON = 0;  /* PHY: Deassert Software Reset */
142
 
143
 
143
    GRSTCTL = 1;  /* OTG: Assert Software Reset */
144
    GRSTCTL = 1;  /* OTG: Assert Software Reset */
144
    while (GRSTCTL & 1);  /* Wait for OTG to ack reset */
145
    while (GRSTCTL & 1);  /* Wait for OTG to ack reset */
145
    while (!(GRSTCTL & 0x80000000));  /* Wait for OTG AHB master idle */
146
    while (!(GRSTCTL & 0x80000000));  /* Wait for OTG AHB master idle */
146
 
147
 
147
    GRXFSIZ = 0x00000200;  /* RX FIFO: 512 bytes */
148
    GRXFSIZ = 0x00000200;  /* RX FIFO: 512 bytes */
148
    GNPTXFSIZ = 0x02000200;  /* Non-periodic TX FIFO: 512 bytes */
149
    GNPTXFSIZ = 0x02000200;  /* Non-periodic TX FIFO: 512 bytes */
149
    GAHBCFG = 0x27;  /* OTG AHB config: Unmask ints, burst length 4, DMA on */
150
    GAHBCFG = SYNOPSYSOTG_AHBCFG;
150
    GUSBCFG = 0x1408;  /* OTG: 16bit PHY and some reserved bits */
151
    GUSBCFG = 0x1408;  /* OTG: 16bit PHY and some reserved bits */
151
 
152
 
152
    DCFG = 4;  /* Address 0 */
153
    DCFG = 4;  /* Address 0 */
153
    DCTL = 0x800;  /* Soft Reconnect */
154
    DCTL = 0x800;  /* Soft Reconnect */
154
    DIEPMSK = 0x0D;  /* IN EP interrupt mask */
155
    DIEPMSK = 0x0D;  /* IN EP interrupt mask */
Line 359... Line 360...
359
    PWRCON &= ~0x4000;
360
    PWRCON &= ~0x4000;
360
    PWRCONEXT &= ~0x800;
361
    PWRCONEXT &= ~0x800;
361
    PCGCCTL = 0;
362
    PCGCCTL = 0;
362
 
363
 
363
    /* unmask irq */
364
    /* unmask irq */
364
    INTMSK |= INTMSK_USB_OTG;
365
    interrupt_enable(IRQ_USB_FUNC, true);
365
 
366
 
366
    /* reset the beast */
367
    /* reset the beast */
367
    usb_reset();
368
    usb_reset();
368
}
369
}
369
 
370