code runs until ohci_lowlevel_init() but can't continue since pci_get_resource() is not implemented yet
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
# can be either "Y" or "N" (without quotes). "Y" for using the m68k-elf-, "N" for using the m68k-atari-mint
|
||||
# toolchain
|
||||
COMPILE_ELF=N
|
||||
COMPILE_ELF=Y
|
||||
|
||||
ifeq (Y,$(COMPILE_ELF))
|
||||
TCPREFIX=m68k-elf-
|
||||
@@ -84,6 +84,7 @@ CSRCS= \
|
||||
$(SRCDIR)/MCD_tasksInit.c \
|
||||
\
|
||||
$(SRCDIR)/usb.c \
|
||||
$(SRCDIR)/usb_mem.c \
|
||||
$(SRCDIR)/ohci-hcd.c \
|
||||
$(SRCDIR)/ehci-hcd.c \
|
||||
\
|
||||
|
||||
@@ -13,7 +13,7 @@ MEMORY
|
||||
/*
|
||||
* target to copy BaS data segment to. 20k should be enough for now
|
||||
*/
|
||||
bas_ram (WX) : ORIGIN = 0x1FFFB000, LENGTH = 0x005000
|
||||
bas_ram (WX) : ORIGIN = 0x1FFFB000, LENGTH = 0x900000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
@@ -35,6 +35,7 @@ SECTIONS
|
||||
OBJDIR/mmu.o(.text)
|
||||
OBJDIR/pci.o(.text)
|
||||
OBJDIR/usb.o(.text)
|
||||
OBJDIR/usb_mem.o(.text)
|
||||
OBJDIR/ohci-hcd.o(.text)
|
||||
OBJDIR/ehci-hcd.o(.text)
|
||||
|
||||
@@ -75,6 +76,9 @@ SECTIONS
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
#endif
|
||||
. = ALIGN(16);
|
||||
_usb_buffer = .;
|
||||
//. = . + USB_BUFFER_SIZE;
|
||||
} > bas_rom
|
||||
|
||||
#if (TARGET_ADDRESS == BOOTFLASH_BASE_ADDRESS)
|
||||
@@ -97,6 +101,8 @@ SECTIONS
|
||||
* is a multiple of the following value.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_usb_buffer = .;
|
||||
//. = . + USB_BUFFER_SIZE;
|
||||
} > bas_ram
|
||||
#endif
|
||||
|
||||
|
||||
@@ -42,4 +42,6 @@
|
||||
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
||||
#endif /* COMPILE_RAM */
|
||||
|
||||
#define USB_BUFFER_SIZE 0x80000
|
||||
|
||||
#endif /* _FIREBEE_H_ */
|
||||
|
||||
@@ -16,4 +16,6 @@
|
||||
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
||||
#endif /* COMPILE_RAM */
|
||||
|
||||
#define USB_BUFFER_SIZE 0x80000
|
||||
|
||||
#endif /* _M5484L_H_ */
|
||||
|
||||
@@ -210,7 +210,7 @@ struct resource_descriptor
|
||||
uint8_t private;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
extern uint16_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index);
|
||||
extern int16_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index);
|
||||
|
||||
extern uint32_t pci_read_config_longword(uint16_t handle, uint16_t offset);
|
||||
extern uint16_t pci_read_config_word(uint16_t handle, uint16_t offset);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "util.h" /* for endian conversions */
|
||||
#include "wait.h"
|
||||
#include "cache.h"
|
||||
#include "usb.h"
|
||||
#include "ehci.h"
|
||||
|
||||
@@ -177,15 +178,7 @@ static struct ehci {
|
||||
|
||||
static void cache_qtd(struct qTD *qtd, int flush)
|
||||
{
|
||||
uint32_t *ptr = (uint32_t *) swpl(qtd->qt_buffer[0]);
|
||||
int len = (qtd->qt_token & 0x7fff0000) >> 16;
|
||||
|
||||
flush_invalidate((uint32_t)qtd, sizeof(struct qTD), flush);
|
||||
if((ptr != NULL) && len)
|
||||
{
|
||||
ptr += gehci.dma_offset;
|
||||
flush_invalidate((uint32_t)ptr, len, flush);
|
||||
}
|
||||
flush_and_invalidate_caches();
|
||||
}
|
||||
|
||||
static inline struct QH *qh_addr(struct QH *qh)
|
||||
@@ -201,7 +194,7 @@ static void cache_qh(struct QH *qh, int flush)
|
||||
/* Walk the QH list and flush/invalidate all entries */
|
||||
while(1)
|
||||
{
|
||||
flush_invalidate((uint32_t)qh_addr(qh), sizeof(struct QH), flush);
|
||||
flush_and_invalidate_caches();
|
||||
if((uint32_t)qh & QH_LINK_TYPE_QH)
|
||||
break;
|
||||
qh = qh_addr(qh);
|
||||
@@ -255,7 +248,7 @@ static int handshake(uint32_t *ptr, uint32_t mask, uint32_t done, int usec)
|
||||
result &= mask;
|
||||
if(result == done)
|
||||
return 0;
|
||||
udelay(1);
|
||||
wait(1);
|
||||
usec--;
|
||||
}
|
||||
while(usec > 0);
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#define MCF_PSC3_PSCTB_8BIT __MBAR+0x890C
|
||||
|
||||
.global _vec_init
|
||||
.global _asm_set_ipl
|
||||
|
||||
// interrupt sources
|
||||
.equ INT_SOURCE_EPORT_EPF1,1 // edge port flag 1
|
||||
|
||||
@@ -78,10 +78,35 @@
|
||||
|
||||
#define min_t(type, x, y) ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
|
||||
|
||||
struct pci_device_id ohci_usb_pci_table[] = {
|
||||
{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5237, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_SERIAL_USB_OHCI, 0, 0 }, /* ULI1575 PCI OHCI module ids */
|
||||
{ PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_SERIAL_USB_OHCI, 0, 0 }, /* NEC PCI OHCI module ids */
|
||||
{ PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_ISP1561, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_SERIAL_USB_OHCI, 0, 0 }, /* Philips 1561 PCI OHCI module ids */
|
||||
struct pci_device_id ohci_usb_pci_table[] =
|
||||
{
|
||||
{
|
||||
PCI_VENDOR_ID_AL,
|
||||
PCI_DEVICE_ID_AL_M5237,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_CLASS_SERIAL_USB_OHCI,
|
||||
0,
|
||||
0
|
||||
}, /* ULI1575 PCI OHCI module ids */
|
||||
{
|
||||
PCI_VENDOR_ID_NEC,
|
||||
PCI_DEVICE_ID_NEC_USB,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_CLASS_SERIAL_USB_OHCI,
|
||||
0,
|
||||
0
|
||||
}, /* NEC PCI OHCI module ids */
|
||||
{
|
||||
PCI_VENDOR_ID_PHILIPS,
|
||||
PCI_DEVICE_ID_PHILIPS_ISP1561,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_CLASS_SERIAL_USB_OHCI,
|
||||
0,
|
||||
0
|
||||
}, /* Philips 1561 PCI OHCI module ids */
|
||||
/* Please add supported PCI OHCI controller ids here */
|
||||
{ 0, 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@ struct resource_descriptor *pci_get_resource(uint16_t handle)
|
||||
return (struct resource_descriptor *) 0L;
|
||||
}
|
||||
|
||||
uint16_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index)
|
||||
int16_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index)
|
||||
{
|
||||
uint16_t bus;
|
||||
uint16_t slot;
|
||||
@@ -184,16 +184,23 @@ uint16_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index)
|
||||
value = pci_read_config_longword(handle, 0);
|
||||
if (value != 0xffffffff) /* we have a device at this position */
|
||||
{
|
||||
if (vendor_id == 0xffff) /* ignore vendor id */
|
||||
if (vendor_id == 0xffff && pos == index) /* ignore device id */
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
else if (PCI_VENDOR_ID(value) == vendor_id && PCI_DEVICE_ID(value) == device_id)
|
||||
else
|
||||
{
|
||||
/* we found a match, but at wrong position */
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
if (PCI_VENDOR_ID(value) == vendor_id && PCI_DEVICE_ID(value) == device_id)
|
||||
{
|
||||
if (pos == index)
|
||||
return handle;
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
#include "m5484l.h"
|
||||
#endif /* MACHINE_M5484LITE */
|
||||
|
||||
#include "mod_devicetable.h"
|
||||
#include "pci_ids.h"
|
||||
#include "usb.h"
|
||||
|
||||
#define UNUSED(x) (void)(x) /* Unused variable */
|
||||
|
||||
extern volatile long _VRAM; /* start address of video ram from linker script */
|
||||
@@ -491,35 +495,71 @@ void init_video_ddr(void) {
|
||||
|
||||
|
||||
/*
|
||||
* probe for UPC720101 (USB)
|
||||
* probe for NEC compatible USB host controller and install if found
|
||||
*/
|
||||
void test_upd720101(void)
|
||||
void init_usb(void)
|
||||
{
|
||||
xprintf("UDP720101 USB controller initialization: ");
|
||||
extern struct pci_device_id ohci_usb_pci_table[];
|
||||
extern struct pci_device_id ehci_usb_pci_table[];
|
||||
struct pci_device_id *board;
|
||||
int16_t handle;
|
||||
uint16_t usb_found;
|
||||
int index = 0;
|
||||
|
||||
/* select UPD720101 AD17 */
|
||||
MCF_PCI_PCICAR = MCF_PCI_PCICAR_E +
|
||||
MCF_PCI_PCICAR_DEVNUM(17) +
|
||||
MCF_PCI_PCICAR_FUNCNUM(0) +
|
||||
MCF_PCI_PCICAR_DWORD(0);
|
||||
xprintf("USB controller initialization: ");
|
||||
|
||||
if (* (uint32_t *) PCI_IO_OFFSET == 0x33103500)
|
||||
do
|
||||
{
|
||||
MCF_PCI_PCICAR = MCF_PCI_PCICAR_E +
|
||||
MCF_PCI_PCICAR_DEVNUM(17) +
|
||||
MCF_PCI_PCICAR_FUNCNUM(0) +
|
||||
MCF_PCI_PCICAR_DWORD(57);
|
||||
handle = pci_find_device(0x0000, 0xffffL, index++);
|
||||
xprintf("checking %d\r\n", handle);
|
||||
if (handle > 0)
|
||||
{
|
||||
uint32_t id = 0;
|
||||
uint32_t class = 0;
|
||||
|
||||
* (uint8_t *) PCI_IO_OFFSET = 0x20;
|
||||
xprintf("ckecking board #%d, handle %d\r\n", index, handle);
|
||||
id = pci_read_config_longword(handle, PCIIDR);
|
||||
class = pci_read_config_longword(handle, PCIREV);
|
||||
|
||||
if (class >> 16 == PCI_CLASS_SERIAL_USB)
|
||||
{
|
||||
xprintf("serial USB found at #%d\r\n", handle);
|
||||
if (class >> 8 == PCI_CLASS_SERIAL_USB_EHCI)
|
||||
{
|
||||
board = ehci_usb_pci_table;
|
||||
while (board->vendor)
|
||||
{
|
||||
xprintf("ckecking %x against %x\r\n", board->vendor, id & 0xffff);
|
||||
if ((board->vendor == (id & 0xffff)) && board->device == (id >> 16))
|
||||
{
|
||||
xprintf("board match at handle %x\r\n", handle);
|
||||
if (usb_init(handle, board) >= 0)
|
||||
{
|
||||
usb_found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("NOT ");
|
||||
|
||||
MCF_PCI_PCICAR = MCF_PCI_PCICAR_DEVNUM(17) +
|
||||
MCF_PCI_PCICAR_FUNCNUM(0) +
|
||||
MCF_PCI_PCICAR_DWORD(57);
|
||||
}
|
||||
board++;
|
||||
}
|
||||
}
|
||||
if (class >> 8 == PCI_CLASS_SERIAL_USB_OHCI)
|
||||
{
|
||||
board = ohci_usb_pci_table;
|
||||
while (board->vendor)
|
||||
{
|
||||
xprintf("ckecking %x against %x\r\n", board->vendor, id & 0xffff);
|
||||
if ((board->vendor == (id & 0xffff)) && board->device == (id >> 16))
|
||||
{
|
||||
xprintf("board match at handle %x\r\n", handle);
|
||||
if (usb_init(handle, board) >= 0)
|
||||
usb_found++;
|
||||
}
|
||||
board++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (handle >= 0);
|
||||
|
||||
xprintf("finished\r\n");
|
||||
}
|
||||
|
||||
@@ -976,7 +1016,7 @@ void initialize_hardware(void)
|
||||
init_video_ddr();
|
||||
dvi_on();
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
test_upd720101();
|
||||
init_usb();
|
||||
//video_1280_1024();
|
||||
#ifdef MACHINE_FIREBEE
|
||||
init_ac97();
|
||||
|
||||
@@ -150,25 +150,23 @@ int usb_init(long handle, const struct pci_device_id *ent)
|
||||
return res;
|
||||
}
|
||||
usb_hub_reset(bus_index);
|
||||
|
||||
/* init low_level USB */
|
||||
xprintf("USB: ");
|
||||
switch(ent->class)
|
||||
{
|
||||
#ifdef CONFIG_USB_UHCI
|
||||
case PCI_CLASS_SERIAL_USB_UHCI:
|
||||
res = uhci_usb_lowlevel_init(handle, ent, &priv);
|
||||
//res = uhci_usb_lowlevel_init(handle, ent, &priv);
|
||||
xprintf("sorry, no uhci driver available\r\n");
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_USB_OHCI
|
||||
case PCI_CLASS_SERIAL_USB_OHCI:
|
||||
xprintf("initialize ohci interface, ");
|
||||
res = ohci_usb_lowlevel_init(handle, ent, &priv);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
case PCI_CLASS_SERIAL_USB_EHCI:
|
||||
xprintf("initialize ehci interface, ");
|
||||
res = ehci_usb_lowlevel_init(handle, ent, &priv);
|
||||
break;
|
||||
#endif
|
||||
default: res = -1; break;
|
||||
}
|
||||
if(!res)
|
||||
@@ -1087,6 +1085,7 @@ void usb_scan_devices(void *priv)
|
||||
}
|
||||
{
|
||||
/* insert "driver" if possible */
|
||||
#ifdef _NOT_USED_
|
||||
if (drv_usb_kbd_init() < 0)
|
||||
xprintf("No USB keyboard found\r\n");
|
||||
else
|
||||
@@ -1095,6 +1094,7 @@ void usb_scan_devices(void *priv)
|
||||
xprintf("No USB mouse found\r\n");
|
||||
else
|
||||
xprintf("USB HID mouse driver installed\r\n");
|
||||
#endif /* _NOT_USED */
|
||||
}
|
||||
xprintf("Scan end\r\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user