From: theStack Date: Fri, 4 Sep 2009 23:35:26 +0000 (+0200) Subject: the whitespace hunter has struck again! X-Git-Tag: firstresponse~38 X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=ppcskel.git;a=commitdiff_plain;h=4f2380bcdb96509a0b45e8f36939fab9dd88bee5 the whitespace hunter has struck again! --- diff --git a/ohci.c b/ohci.c index 89ab5d7..9e67d12 100644 --- a/ohci.c +++ b/ohci.c @@ -17,98 +17,101 @@ Copyright (C) 2009 Sebastian Falbesoner static struct ohci_hcca hcca_oh0; -static void dbg_op_state() { - switch (read32(OHCI0_HC_CONTROL) & OHCI_CTRL_HCFS) { - case OHCI_USB_SUSPEND: - printf("ohci-- OHCI_USB_SUSPEND\n"); - break; - case OHCI_USB_RESET: - printf("ohci-- OHCI_USB_RESET\n"); - break; - case OHCI_USB_OPER: - printf("ohci-- OHCI_USB_OPER\n"); - break; - case OHCI_USB_RESUME: - printf("ohci-- OHCI_USB_RESUME\n"); - break; - } +static void dbg_op_state() +{ + switch (read32(OHCI0_HC_CONTROL) & OHCI_CTRL_HCFS) { + case OHCI_USB_SUSPEND: + printf("ohci-- OHCI_USB_SUSPEND\n"); + break; + case OHCI_USB_RESET: + printf("ohci-- OHCI_USB_RESET\n"); + break; + case OHCI_USB_OPER: + printf("ohci-- OHCI_USB_OPER\n"); + break; + case OHCI_USB_RESUME: + printf("ohci-- OHCI_USB_RESUME\n"); + break; + } } -void ohci_init() { - printf("ohci-- init\n"); - dbg_op_state(); +void ohci_init() +{ + printf("ohci-- init\n"); + dbg_op_state(); - /* disable hc interrupts */ - set32(OHCI0_HC_INT_DISABLE, OHCI_INTR_MIE); + /* disable hc interrupts */ + set32(OHCI0_HC_INT_DISABLE, OHCI_INTR_MIE); - /* save fmInterval and calculate FSMPS */ + /* save fmInterval and calculate FSMPS */ #define FSMP(fi) (0x7fff & ((6 * ((fi) - 210)) / 7)) #define FI 0x2edf /* 12000 bits per frame (-1) */ - u32 fmint = read32(OHCI0_HC_FM_INTERVAL) & 0x3fff; - if(fmint != FI) - printf("ohci-- fminterval delta: %d\n", fmint - FI); - fmint |= FSMP (fmint) << 16; - - /* enable interrupts of both usb host controllers */ - set32(EHCI_CTL, EHCI_CTL_OH0INTE | EHCI_CTL_OH1INTE | 0xe0000); - - /* reset HC */ - write32(OHCI0_HC_COMMAND_STATUS, OHCI_HCR); - - /* wait max. 30us */ - u32 ts = 30; - while ((read32(OHCI0_HC_COMMAND_STATUS) & OHCI_HCR) != 0) { - if(--ts == 0) { - printf("ohci-- FAILED"); - return; - } - udelay(1); - } - - /* disable interrupts; 2ms timelimit here! - now we're in the SUSPEND state ... must go OPERATIONAL - within 2msec else HC enters RESUME */ - - u32 cookie = irq_kill(); - - /* Tell the controller where the control and bulk lists are - * The lists are empty now. */ - write32(OHCI0_HC_CTRL_HEAD_ED, 0); - write32(OHCI0_HC_BULK_HEAD_ED, 0); - - /* set hcca adress */ - sync_after_write(&hcca_oh0, 256); - write32(OHCI0_HC_HCCA, virt_to_phys(&hcca_oh0)); - - /* set periodicstart */ + u32 fmint = read32(OHCI0_HC_FM_INTERVAL) & 0x3fff; + if(fmint != FI) + printf("ohci-- fminterval delta: %d\n", fmint - FI); + fmint |= FSMP (fmint) << 16; + + /* enable interrupts of both usb host controllers */ + set32(EHCI_CTL, EHCI_CTL_OH0INTE | EHCI_CTL_OH1INTE | 0xe0000); + + /* reset HC */ + write32(OHCI0_HC_COMMAND_STATUS, OHCI_HCR); + + /* wait max. 30us */ + u32 ts = 30; + while ((read32(OHCI0_HC_COMMAND_STATUS) & OHCI_HCR) != 0) { + if(--ts == 0) { + printf("ohci-- FAILED"); + return; + } + udelay(1); + } + + /* disable interrupts; 2ms timelimit here! + now we're in the SUSPEND state ... must go OPERATIONAL + within 2msec else HC enters RESUME */ + + u32 cookie = irq_kill(); + + /* Tell the controller where the control and bulk lists are + * The lists are empty now. */ + write32(OHCI0_HC_CTRL_HEAD_ED, 0); + write32(OHCI0_HC_BULK_HEAD_ED, 0); + + /* set hcca adress */ + sync_after_write(&hcca_oh0, 256); + write32(OHCI0_HC_HCCA, virt_to_phys(&hcca_oh0)); + + /* set periodicstart */ #define FIT (1<<31) - u32 fmInterval = read32(OHCI0_HC_FM_INTERVAL) &0x3fff; - u32 fit = read32(OHCI0_HC_FM_INTERVAL) & FIT; + u32 fmInterval = read32(OHCI0_HC_FM_INTERVAL) &0x3fff; + u32 fit = read32(OHCI0_HC_FM_INTERVAL) & FIT; - write32(OHCI0_HC_FM_INTERVAL, fmint | (fit ^ FIT)); - write32(OHCI0_HC_PERIODIC_START, ((9*fmInterval)/10)&0x3fff); + write32(OHCI0_HC_FM_INTERVAL, fmint | (fit ^ FIT)); + write32(OHCI0_HC_PERIODIC_START, ((9*fmInterval)/10)&0x3fff); - /* testing bla */ - if ((read32(OHCI0_HC_FM_INTERVAL) & 0x3fff0000) == 0 || !read32(OHCI0_HC_PERIODIC_START)) { - printf("ohci-- w00t, fail!! see ohci-hcd.c:669\n"); - } - - /* start HC operations */ - write32(OHCI0_HC_CONTROL, OHCI_CONTROL_INIT | OHCI_USB_OPER); + /* testing bla */ + if ((read32(OHCI0_HC_FM_INTERVAL) & 0x3fff0000) == 0 || !read32(OHCI0_HC_PERIODIC_START)) { + printf("ohci-- w00t, fail!! see ohci-hcd.c:669\n"); + } + + /* start HC operations */ + write32(OHCI0_HC_CONTROL, OHCI_CONTROL_INIT | OHCI_USB_OPER); - /* wake on ConnectStatusChange, matching external hubs */ - set32(OHCI0_HC_RH_STATUS, RH_HS_DRWE); + /* wake on ConnectStatusChange, matching external hubs */ + set32(OHCI0_HC_RH_STATUS, RH_HS_DRWE); - /* Choose the interrupts we care about now, others later on demand */ - write32(OHCI0_HC_INT_STATUS, ~0); - write32(OHCI0_HC_INT_ENABLE, OHCI_INTR_INIT); + /* Choose the interrupts we care about now, others later on demand */ + write32(OHCI0_HC_INT_STATUS, ~0); + write32(OHCI0_HC_INT_ENABLE, OHCI_INTR_INIT); - irq_restore(cookie); + irq_restore(cookie); - dbg_op_state(); + dbg_op_state(); } -void ohci0_irq() { +void ohci0_irq() +{ write32(OHCI0_HC_INT_STATUS, ~0); printf("ohci_irq\n"); }