Browse Source

Fix the usb bug when using BMC

1.when ohci1 has USB KBD and after bmc boot, pmon booting ,usb kbd can't work.
2.sb700_usb.c  fixed usb hub can't work in systerm.

Targets: Bonito3aserver
master
meiwenbin 12 years ago
committed by wanghongmei
parent
commit
5347322596
  1. 5
      Targets/Bonito3aserver/pci/sb700_usb.c
  2. 23
      sys/dev/usb/usb-ohci.c

5
Targets/Bonito3aserver/pci/sb700_usb.c

@ -4,6 +4,7 @@
static void usb_init(device_t dev)
{
#ifndef USE_BMC
u8 byte;
u16 word;
u32 dword;
@ -65,10 +66,12 @@ static void usb_init(device_t dev)
/*enable io/memory space*/
pci_write_config8(dev, 0x04, (1<<0|1<<1|1<<2));
#endif
#endif
}
static void usb_init2(device_t dev)
{
#ifndef USE_BMC
u8 byte;
u16 word;
u32 dword;
@ -123,6 +126,6 @@ static void usb_init2(device_t dev)
pci_write_config8(dev, 0x0c, 64 >> 2); //PCI_CACHE_LINE_SIZE
/*enable io/memory space*/
pci_write_config8(dev, 0x04, (1<<0|1<<1|1<<2));
#endif
}

23
sys/dev/usb/usb-ohci.c

@ -137,6 +137,9 @@ struct usb_device *devgone;
//QYL-2008-03-07
#define OHCI_MAX_USBDEVICES 8
#ifdef USE_BMC
#define OHCI_MAX_USBDEVICES 32
#endif
#define OHCI_MAX_ENDPOINTS_PER_DEVICE 32
urb_priv_t ohci_urb[OHCI_MAX_USBDEVICES][OHCI_MAX_ENDPOINTS_PER_DEVICE];
extern struct usb_device usb_dev[];
@ -1102,11 +1105,23 @@ static int balance (ohci_t *ohci, int interval, int load)
static void periodic_link (ohci_t *ohci, ed_t *ed)
{
unsigned i;
#ifdef USE_BMC
unsigned int num;
#endif
if(ohci_debug)printf("link %x branch %d [%dus.], interval %d\n",
ed, ed->int_branch, ed->int_load, ed->int_interval);
#ifdef USE_BMC
if (ed->int_interval == 1) {
num = NUM_INTS - 22;
} else {
num = NUM_INTS;
}
for (i = ed->int_branch; i < num; i += ed->int_interval) {
#else
for (i = ed->int_branch; i < NUM_INTS; i += ed->int_interval) {
#endif
ed_t **prev = &ohci->periodic [i];
volatile unsigned int *prev_p = &ohci->hcca->int_table [i];
ed_t *here = *prev;
@ -1276,6 +1291,11 @@ static int ep_link (ohci_t *ohci, ed_t *edi)
case PIPE_INTERRUPT:
ed->hwNextED = 0;
branch = balance(ohci, ed->int_interval, ed->int_load);
#ifdef USE_BMC
if (ed->int_interval == 1) {
branch = 1;
}
#endif
ed->int_branch = branch;
periodic_link (ohci, (ed_t *)ed);
break;
@ -2901,6 +2921,9 @@ static int ohci_submit_int_msg(struct usb_device *dev, unsigned long pipe, void
int s;
if(ohci_debug)printf("submit int(%08x)\n", dev);
#ifdef USE_BMC
delay(0x4000);
#endif
s = submit_common_msg(dev, pipe, buffer, transfer_len, NULL, interval);
return s;
}

Loading…
Cancel
Save