From fdc5f2efd589542ad40b7a8acd905fad64b92e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Fri, 8 Nov 2013 05:43:29 +0000 Subject: [PATCH] cleanly finish PCI configuration access in pci_read_config_longword --- BaS_gcc/sources/pci.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/BaS_gcc/sources/pci.c b/BaS_gcc/sources/pci.c index cac7bec..962c58d 100644 --- a/BaS_gcc/sources/pci.c +++ b/BaS_gcc/sources/pci.c @@ -125,6 +125,9 @@ uint32_t pci_read_config_longword(int32_t handle, int offset) value = * (volatile uint32_t *) PCI_IO_OFFSET; /* access device */ + /* finish PCI configuration access special cycle (allow regular PCI accesses) */ + MCF_PCI_PCICAR &= ~MCF_PCI_PCICAR_E; + return value; } @@ -520,6 +523,42 @@ void init_pci(void) /* initialize handles array */ memset(handles, 0, NUM_CARDS * sizeof(uint16_t)); +#if MACHINE_FIREBEE + /* + * experimental: leave "old" USB initialization in place for the FireBee USB controller + * which seems to be found on second access only with the new PCI scan routines + */ + + /* PCI config space access for UPD720101 on AD17 */ + MCF_PCI_PCICAR = MCF_PCI_PCICAR_E + + MCF_PCI_PCICAR_DEVNUM(17) + + MCF_PCI_PCICAR_FUNCNUM(0) + + MCF_PCI_PCICAR_DWORD(0); + + if (* (uint32_t *) PCI_IO_OFFSET == 0x33103500) + { + /* device found */ + + MCF_PCI_PCICAR = MCF_PCI_PCICAR_E + + MCF_PCI_PCICAR_DEVNUM(17) + + MCF_PCI_PCICAR_FUNCNUM(0) + + MCF_PCI_PCICAR_DWORD(57); /* FIXME: PCI configuration access to reserved register? */ + + * (uint8_t *) PCI_IO_OFFSET = 0x20; // commented out (hangs currently) + } + else + { + xprintf("FireBee USB controller not found - disable"); + + MCF_PCI_PCICAR = MCF_PCI_PCICAR_DEVNUM(17) + + MCF_PCI_PCICAR_FUNCNUM(0) + + MCF_PCI_PCICAR_DWORD(57); + } +#endif /* MACHINE_FIREBEE */ + + /* + * do normal initialization + */ pci_scan(); }