Date: Mon, 5 Nov 2007 18:54:51 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 128688 for review Message-ID: <200711051854.lA5IspJx014785@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=128688 Change 128688 by gonzo@gonzo_jeeves on 2007/11/05 18:53:51 o Perform PCI registers fixup for Korina ethernet on PCI bridge initialization. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips32/idt/idtpci.c#4 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips32/idt/idtpci.c#4 (text+ko) ==== @@ -111,6 +111,13 @@ #define REG_READ(o) *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1(IDT_BASE_PCI + (o))) #define REG_WRITE(o,v) (REG_READ(o)) = (v) +unsigned int korina_fixup[24] = { + 0x00000157, 0x00000000, 0x00003c04, 0x00000008, 0x18800001, 0x18000001, + 0x48000008, 0x00000000, 0x00000000, 0x00000000, 0x011d0214, 0x00000000, + 0x00000000, 0x00000000, 0x38080101, 0x00008080, 0x00000d6e, 0x00000000, + 0x00000051, 0x00000000, 0x00000055, 0x18000000, 0x00000000, 0x00000000 +}; + struct idtpci_softc { device_t sc_dev; @@ -122,6 +129,13 @@ uint32_t sc_io; }; +static uint32_t +idtpci_make_addr(int bus, int slot, int func, int reg) +{ + + return 0x80000000 | (bus << 16) | (slot << 11) | (func << 8) | reg; +} + static int idtpci_probe(device_t dev) { @@ -135,6 +149,8 @@ int busno = 0; struct idtpci_softc *sc = device_get_softc(dev); unsigned int pci_data, force_endianess = 0; + int i; + bus_addr_t addr; sc->sc_dev = dev; sc->sc_busno = busno; @@ -210,6 +226,19 @@ /* Rewrite Target Control register with default values */ REG_WRITE(IDT_PCI_TC, (IDT_PCI_TC_DTIMER << 8) | IDT_PCI_TC_RTIMER); + /* Perform Korina fixup */ + addr = idtpci_make_addr(0, 0, 0, 4); + for (i = 0; i < 24; i++) { + + REG_WRITE(IDT_PCI_CFG_ADDR, addr); + REG_WRITE(IDT_PCI_CFG_DATA, korina_fixup[i]); + __asm__ volatile ("sync"); + + REG_WRITE(IDT_PCI_CFG_ADDR, 0); + REG_WRITE(IDT_PCI_CFG_DATA, 0); + addr += 4; + } + /* Use KSEG1 to access IO ports for it is uncached */ sc->sc_io = 0; sc->sc_io_rman.rm_type = RMAN_ARRAY; @@ -249,13 +278,6 @@ } static uint32_t -idtpci_make_addr(int bus, int slot, int func, int reg) -{ - - return 0x80000000 | (bus << 16) | (slot << 11) | (func << 8) | reg; -} - -static uint32_t idtpci_read_config(device_t dev, int bus, int slot, int func, int reg, int bytes) { @@ -455,6 +477,7 @@ } rv = rman_reserve_resource(rm, start, end, count, flags, child); + if (rv == NULL) return (NULL); @@ -493,7 +516,7 @@ int flags, driver_filter_t *filt, driver_intr_t *handler, void *arg, void **cookiep) { - + panic("setup_intr"); #if 0 struct idtpci_softc *sc = device_get_softc(dev); struct intr_event *event;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711051854.lA5IspJx014785>