(re)enabled USB bus scan. It takes an eternity to finish, but finally
returns. Hub found, but no mouse yet.
This commit is contained in:
@@ -44,13 +44,13 @@
|
||||
#define PCIHTR 0x0E /* PCI Header Type Register */
|
||||
#define PCIBISTR 0x0F /* PCI Build-In Self Test Register */
|
||||
#define PCIBAR0 0x10 /* PCI Base Address Register for Memory
|
||||
Accesses to Local, Runtime, and DMA */
|
||||
Accesses to Local, Runtime, and DMA */
|
||||
#define PCIBAR1 0x14 /* PCI Base Address Register for I/O
|
||||
Accesses to Local, Runtime, and DMA */
|
||||
Accesses to Local, Runtime, and DMA */
|
||||
#define PCIBAR2 0x18 /* PCI Base Address Register for Memory
|
||||
Accesses to Local Address Space 0 */
|
||||
Accesses to Local Address Space 0 */
|
||||
#define PCIBAR3 0x1C /* PCI Base Address Register for Memory
|
||||
Accesses to Local Address Space 1 */
|
||||
Accesses to Local Address Space 1 */
|
||||
#define PCIBAR4 0x20 /* PCI Base Address Register, reserved */
|
||||
#define PCIBAR5 0x24 /* PCI Base Address Register, reserved */
|
||||
#define PCICIS 0x28 /* PCI Cardbus CIS Pointer, not support*/
|
||||
@@ -64,7 +64,7 @@
|
||||
#define PCIMLR 0x3F /* PCI Max_Lat Register */
|
||||
#define PMCAPID 0x40 /* Power Management Capability ID */
|
||||
#define PMNEXT 0x41 /* Power Management Next Capability
|
||||
Pointer */
|
||||
Pointer */
|
||||
#define PMC 0x42 /* Power Management Capabilities */
|
||||
#define PMCSR 0x44 /* Power Management Control/Status */
|
||||
#define PMCSR_BSE 0x46 /* PMCSR Bridge Support Extensions */
|
||||
@@ -74,7 +74,7 @@
|
||||
#define HS_CSR 0x4A /* Hot Swap Control/Status */
|
||||
#define PVPDCNTL 0x4C /* PCI Vital Product Data Control */
|
||||
#define PVPD_NEXT 0x4D /* PCI Vital Product Data Next
|
||||
Capability Pointer */
|
||||
Capability Pointer */
|
||||
#define PVPDAD 0x4E /* PCI Vital Product Data Address */
|
||||
#define PVPDATA 0x50 /* PCI VPD Data */
|
||||
|
||||
@@ -125,18 +125,18 @@
|
||||
|
||||
struct pci_rd /* structure of resource descriptor */
|
||||
{
|
||||
unsigned short next; /* length of the following structure */
|
||||
unsigned short flags; /* type of resource and misc. flags */
|
||||
unsigned long start; /* start-address of resource */
|
||||
unsigned long length; /* length of resource */
|
||||
unsigned long offset; /* offset PCI to phys. CPU Address */
|
||||
unsigned long dmaoffset; /* offset for DMA-transfers */
|
||||
unsigned short next; /* length of the following structure */
|
||||
unsigned short flags; /* type of resource and misc. flags */
|
||||
unsigned long start; /* start-address of resource */
|
||||
unsigned long length; /* length of resource */
|
||||
unsigned long offset; /* offset PCI to phys. CPU Address */
|
||||
unsigned long dmaoffset; /* offset for DMA-transfers */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
typedef struct /* structure of address conversion */
|
||||
{
|
||||
unsigned long adr; /* calculated address (CPU<->PCI) */
|
||||
unsigned long len; /* length of memory range */
|
||||
unsigned long adr; /* calculated address (CPU<->PCI) */
|
||||
unsigned long len; /* length of memory range */
|
||||
} PCI_CONV_ADR;
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -191,8 +191,8 @@ typedef struct /* structure of address conversion */
|
||||
#define PCI_COMMAND(i) (((i) >> 16) & 0xffff)
|
||||
|
||||
/* register 0x08 macros */
|
||||
#define PCI_CLASS_CODE(i) ((swpl((i)) & 0xff000000) >> 24)
|
||||
#define PCI_SUBCLASS(i) ((swpl((i)) & 0x00ff0000) >> 16)
|
||||
#define PCI_CLASS_CODE(i) ((swpl((i)) & 0xffff0000) >> 16)
|
||||
#define PCI_SUBCLASS(i) ((swpl((i)) & 0xffffff00) >> 8)
|
||||
#define PCI_PROG_IF(i) ((swpl((i)) & 0x0000ff00) >> 8)
|
||||
#define PCI_REVISION_ID(i) ((swpl((i)) & 0x000000ff))
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ static int32_t pci_get_interrupt_cause(int32_t *handles)
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
dbg("%s: no interrupt cause found\r\n");
|
||||
dbg("%s: no interrupt cause found\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void irq5_handler(void)
|
||||
newvalue = pci_call_interrupt_chain(handle, value);
|
||||
if (newvalue == value)
|
||||
{
|
||||
dbg("%s: interrupt not handled!\r\n");
|
||||
dbg("%s: interrupt not handled!\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ void irq7_handler(void)
|
||||
newvalue = pci_call_interrupt_chain(handle, value);
|
||||
if (newvalue == value)
|
||||
{
|
||||
dbg("%s: interrupt not handled!\r\n");
|
||||
dbg("%s: interrupt not handled!\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,7 +440,7 @@ int32_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index)
|
||||
uint16_t n = 0;
|
||||
int32_t handle;
|
||||
|
||||
for (bus = 0; bus < 2; bus++)
|
||||
for (bus = 0; bus < 1; bus++)
|
||||
{
|
||||
for (device = 10; device < 31; device++)
|
||||
{
|
||||
@@ -536,10 +536,10 @@ int32_t pci_find_classcode(uint32_t classcode, int index)
|
||||
}
|
||||
|
||||
/*
|
||||
* there is a device at this position, but not the one we are looking for.
|
||||
* Check to see if it is a multi-function device. We need to look "behind" it
|
||||
* for the other functions in that case.
|
||||
*/
|
||||
* there is a device at this position, but not the one we are looking for.
|
||||
* Check to see if it is a multi-function device. We need to look "behind" it
|
||||
* for the other functions in that case.
|
||||
*/
|
||||
if ((htr = pci_read_config_byte(handle, PCIHTR)) & 0x80)
|
||||
{
|
||||
/* yes, this is a multi-function device, look for more functions */
|
||||
@@ -810,7 +810,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
*/
|
||||
struct pci_rd *rd = &descriptors[barnum];
|
||||
|
||||
dbg("%s: address = %08x\r\n", address);
|
||||
dbg("%s: address = %08x\r\n", address);
|
||||
if (IS_PCI_MEM_BAR(address))
|
||||
{
|
||||
/* adjust base address to card's alignment requirements */
|
||||
@@ -899,10 +899,10 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
|
||||
/* write it to PCIERBAR and enable ROM */
|
||||
pci_write_config_longword(handle, PCIERBAR, swpl(address | 1));
|
||||
dbg("%s: set PCIERBAR on device 0x%02x to 0x%08x\r\n", handle, address | 1);
|
||||
dbg("%s: set PCIERBAR on device 0x%02x to 0x%08x\r\n", handle, address | 1);
|
||||
|
||||
/* read value back just to be sure */
|
||||
dbg("%s: PCIERBAR = %p\r\n", swpl(pci_read_config_longword(handle, PCIERBAR)));
|
||||
dbg("%s: PCIERBAR = %p\r\n", swpl(pci_read_config_longword(handle, PCIERBAR)));
|
||||
|
||||
|
||||
rd->next = sizeof(struct pci_rd);
|
||||
@@ -1081,9 +1081,9 @@ void init_pci(void)
|
||||
* setup the PCI arbiter
|
||||
*/
|
||||
MCF_PCIARB_PACR = MCF_PCIARB_PACR_INTMPRI /* internal master priority: high */
|
||||
| MCF_PCIARB_PACR_EXTMPRI(0xf) /* external master priority: high */
|
||||
| MCF_PCIARB_PACR_INTMINTEN /* enable "internal master broken" interrupt */
|
||||
| MCF_PCIARB_PACR_EXTMINTEN(0x0f); /* enable "external master broken" interrupt */
|
||||
| MCF_PCIARB_PACR_EXTMPRI(0xf) /* external master priority: high */
|
||||
| MCF_PCIARB_PACR_INTMINTEN /* enable "internal master broken" interrupt */
|
||||
| MCF_PCIARB_PACR_EXTMINTEN(0x0f); /* enable "external master broken" interrupt */
|
||||
|
||||
#ifdef _NOT_USED_ /* since this is already done in sysinit.c */
|
||||
#if MACHINE_FIREBEE
|
||||
|
||||
@@ -147,7 +147,7 @@ static MD *ffit(long amount, MPB *mp)
|
||||
q->m_link = p1;
|
||||
}
|
||||
/* link allocate block into allocated list,
|
||||
mark owner of block, & adjust rover */
|
||||
mark owner of block, & adjust rover */
|
||||
p->m_link = mp->mp_mal;
|
||||
mp->mp_mal = p;
|
||||
mp->mp_rover = (q == (MD *) &mp->mp_mfl ? q->m_link : q);
|
||||
@@ -273,7 +273,7 @@ void *driver_mem_alloc(uint32_t amount)
|
||||
|
||||
if (amount == -1L)
|
||||
{
|
||||
return((void *)ffit(-1L, &pmd));
|
||||
return (void *) ffit(-1L, &pmd);
|
||||
}
|
||||
|
||||
if (amount <= 0 )
|
||||
@@ -296,7 +296,7 @@ void *driver_mem_alloc(uint32_t amount)
|
||||
set_ipl(level);
|
||||
dbg("%s: driver_mem_alloc(%d) = 0x%08X\r\n", __FUNCTION__, amount, ret);
|
||||
|
||||
return(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int use_count = 0;
|
||||
@@ -320,7 +320,8 @@ int driver_mem_init(void)
|
||||
}
|
||||
use_count++;
|
||||
dbg("%s: driver_mem now has a use count of %d\r\n", __FUNCTION__, use_count);
|
||||
return(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void driver_mem_release(void)
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#include "usb.h"
|
||||
#include "video.h"
|
||||
|
||||
#define DEBUG_SYSINIT
|
||||
// #define DEBUG_SYSINIT
|
||||
#ifdef DEBUG_SYSINIT
|
||||
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
||||
#else
|
||||
@@ -711,7 +711,7 @@ void init_usb(void)
|
||||
|
||||
id = pci_read_config_longword(handle, PCIIDR);
|
||||
pci_class = pci_read_config_longword(handle, PCIREV);
|
||||
dbg("compare class code %d to %d\r\n", PCI_CLASS_CODE(pci_class), PCI_CLASS_SERIAL_USB);
|
||||
dbg("compare class code 0x%x to 0x%x\r\n", PCI_CLASS_CODE(pci_class), PCI_CLASS_SERIAL_USB);
|
||||
if (PCI_CLASS_CODE(pci_class) == PCI_CLASS_SERIAL_USB)
|
||||
{
|
||||
xprintf("serial USB found at bus=0x%x, dev=0x%x, fnc=0x%x (0x%x)\r\n",
|
||||
@@ -719,17 +719,17 @@ void init_usb(void)
|
||||
PCI_DEVICE_FROM_HANDLE(handle),
|
||||
PCI_FUNCTION_FROM_HANDLE(handle),
|
||||
handle);
|
||||
dbg("compare %d against %d\r\n", PCI_SUBCLASS(pci_class), PCI_CLASS_SERIAL_USB_EHCI);
|
||||
dbg("compare subclass code 0x%x against 0x%x\r\n", PCI_SUBCLASS(pci_class), PCI_CLASS_SERIAL_USB_EHCI);
|
||||
if (PCI_SUBCLASS(pci_class) == PCI_CLASS_SERIAL_USB_EHCI)
|
||||
{
|
||||
board = ehci_usb_pci_table;
|
||||
while (board->vendor)
|
||||
{
|
||||
dbg("compare vendor id %d against %d\r\n", board->vendor, PCI_VENDOR_ID(id));
|
||||
dbg("compare device id %d against %d\r\n", board->device, PCI_DEVICE_ID(id));
|
||||
dbg("compare vendor id 0x%x against 0x%x\r\n", board->vendor, PCI_VENDOR_ID(id));
|
||||
dbg("compare device id 0x%x against 0x%x\r\n", board->device, PCI_DEVICE_ID(id));
|
||||
if ((board->vendor == PCI_VENDOR_ID(id)) && board->device == PCI_DEVICE_ID(id))
|
||||
{
|
||||
dbg("match. trying to init board\r\n");
|
||||
dbg("match. trying to init board\r\n");
|
||||
if (usb_init(handle, board) >= 0)
|
||||
{
|
||||
usb_found++;
|
||||
@@ -739,15 +739,15 @@ void init_usb(void)
|
||||
}
|
||||
}
|
||||
|
||||
dbg("compare %d against %d\r\n", PCI_SUBCLASS(pci_class), PCI_CLASS_SERIAL_USB_OHCI);
|
||||
dbg("compare subclass code 0x%x against 0x%x\r\n", PCI_SUBCLASS(pci_class), PCI_CLASS_SERIAL_USB_OHCI);
|
||||
if (PCI_SUBCLASS(pci_class) == PCI_CLASS_SERIAL_USB_OHCI)
|
||||
{
|
||||
board = ohci_usb_pci_table;
|
||||
|
||||
while (board->vendor)
|
||||
{
|
||||
dbg("matched. compare vendor id %d against %d\r\n", board->vendor, PCI_VENDOR_ID(id));
|
||||
dbg("compare device id %d against %d\r\n", board->device, PCI_DEVICE_ID(id));
|
||||
dbg("matched. compare vendor id 0x%x against 0x%x\r\n", board->vendor, PCI_VENDOR_ID(id));
|
||||
dbg("compare device id 0x%x against 0x%x\r\n", board->device, PCI_DEVICE_ID(id));
|
||||
if ((board->vendor == PCI_VENDOR_ID(id)) && board->device == PCI_DEVICE_ID(id))
|
||||
{
|
||||
if (usb_init(handle, board) >= 0)
|
||||
@@ -758,6 +758,7 @@ void init_usb(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
dbg("PCI device handle = %x\r\n", handle);
|
||||
} while (handle >= 0);
|
||||
|
||||
xprintf("finished (found %d USB controller(s))\r\n", usb_found);
|
||||
@@ -1239,10 +1240,8 @@ void initialize_hardware(void)
|
||||
init_pci();
|
||||
video_init();
|
||||
|
||||
/* do not try to init USB for now on the Firebee, it hangs the machine */
|
||||
//#ifndef MACHINE_FIREBEE
|
||||
/* initialize USB devices */
|
||||
init_usb();
|
||||
//#endif
|
||||
|
||||
#if MACHINE_FIREBEE
|
||||
init_ac97();
|
||||
|
||||
@@ -89,9 +89,9 @@ char usb_error_str[256];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int dest;
|
||||
void (*func)(char);
|
||||
char *loc;
|
||||
int dest;
|
||||
void (*func)(char);
|
||||
char *loc;
|
||||
} PRINTK_INFO;
|
||||
|
||||
#define DEST_CONSOLE (1)
|
||||
@@ -116,22 +116,26 @@ int usb_init(int32_t handle, const struct pci_device_id *ent)
|
||||
void *priv;
|
||||
int res = 0;
|
||||
if (bus_index >= USB_MAX_BUS)
|
||||
return(-1);
|
||||
return -1;
|
||||
|
||||
dev_index[bus_index] = 0;
|
||||
asynch_allowed = 1;
|
||||
|
||||
if (handle && (ent != NULL))
|
||||
{
|
||||
if (driver_mem_init())
|
||||
{
|
||||
usb_started = 0;
|
||||
return -1; /* out of memoy */
|
||||
return -1; /* out of memory */
|
||||
}
|
||||
|
||||
if (usb_dev == NULL)
|
||||
usb_dev = (struct usb_device *) driver_mem_alloc(sizeof(struct usb_device) * USB_MAX_BUS * USB_MAX_DEVICE);
|
||||
|
||||
if (usb_dev == NULL)
|
||||
{
|
||||
usb_started = 0;
|
||||
return -1; /* out of memoy */
|
||||
return -1; /* out of memory */
|
||||
}
|
||||
}
|
||||
else /* restart */
|
||||
@@ -149,10 +153,12 @@ int usb_init(int32_t handle, const struct pci_device_id *ent)
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
usb_hub_reset(bus_index);
|
||||
|
||||
/* init low_level USB */
|
||||
debug_printf("USB: ");
|
||||
|
||||
switch(ent->class)
|
||||
{
|
||||
case PCI_CLASS_SERIAL_USB_UHCI:
|
||||
@@ -169,20 +175,25 @@ int usb_init(int32_t handle, const struct pci_device_id *ent)
|
||||
break;
|
||||
default: res = -1; break;
|
||||
}
|
||||
|
||||
if (!res)
|
||||
{
|
||||
/* if lowlevel init is OK, scan the bus for devices
|
||||
* i.e. search HUBs and configure them */
|
||||
if (setup_packet == NULL)
|
||||
setup_packet = (void *)driver_mem_alloc(sizeof(struct devrequest));
|
||||
setup_packet = (void *) driver_mem_alloc(sizeof(struct devrequest));
|
||||
|
||||
if (setup_packet == NULL)
|
||||
{
|
||||
usb_started = 0;
|
||||
return -1; /* out of memoy */
|
||||
}
|
||||
|
||||
xprintf("Scanning bus for devices... ");
|
||||
controller_priv[bus_index] = (struct hci *)priv;
|
||||
|
||||
controller_priv[bus_index] = (struct hci *) priv;
|
||||
controller_priv[bus_index]->usbnum = bus_index;
|
||||
|
||||
usb_scan_devices(priv);
|
||||
bus_index++;
|
||||
usb_started = 1;
|
||||
@@ -190,7 +201,7 @@ int usb_init(int32_t handle, const struct pci_device_id *ent)
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_printf("\r\nError, couldn't init Lowlevel part\r\n");
|
||||
xprintf("\r\nError, couldn't init Lowlevel part\r\n");
|
||||
usb_started = 0;
|
||||
return -1;
|
||||
}
|
||||
@@ -1076,6 +1087,7 @@ void usb_scan_devices(void *priv)
|
||||
{
|
||||
int i;
|
||||
struct usb_device *dev;
|
||||
|
||||
/* first make all devices unknown */
|
||||
for (i = 0; i < USB_MAX_DEVICE; i++)
|
||||
{
|
||||
@@ -1097,17 +1109,17 @@ void usb_scan_devices(void *priv)
|
||||
xprintf("%d USB Device(s) found\r\n", dev_index[bus_index]);
|
||||
}
|
||||
{
|
||||
#ifdef _NOT_USED_ /* not implemented yet */
|
||||
/* insert "driver" if possible */
|
||||
#ifdef _NOT_USED_
|
||||
if (drv_usb_kbd_init() < 0)
|
||||
debug_printf("No USB keyboard found\r\n");
|
||||
xprintf("No USB keyboard found\r\n");
|
||||
else
|
||||
debug_printf("USB HID keyboard driver installed\r\n");
|
||||
xprintf("USB HID keyboard driver installed\r\n");
|
||||
#endif /* _NOT_USED */
|
||||
if (drv_usb_mouse_init() < 0)
|
||||
debug_printf("No USB mouse found\r\n");
|
||||
xprintf("No USB mouse found\r\n");
|
||||
else
|
||||
debug_printf("USB HID mouse driver installed\r\n");
|
||||
xprintf("USB HID mouse driver installed\r\n");
|
||||
}
|
||||
xprintf("Scan end\r\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user