Skip to contentSkip to conversation

DDB-5074 support

PATCH New Peter De Schrijver 1 participant 1 message Jan 14, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DDB-5074 support

Hi,

The attached patch against the linux/mips CVS tree is a first attempt to get the NEC DDB-5074 support back to work. The board boots now, but there are still some things to be done :

- Support for the onboard Tulip ethernet controller
- Support for ps/2 mouse & keyboard
- Getting the matrox fb device to work on a Millenium I/II without running the BIOS
- ...

Happy hacking,

Peter.

arch/mips/Makefile +2 -2
diff -uN -r --exclude=CVS linux-cvs/arch/mips/Makefile linux-ddb/arch/mips/Makefile
@@ -189,8 +189,8 @@
 # NEC DDB Vrc-5074
 #
 ifdef CONFIG_DDB5074
-SUBDIRS       += arch/mips/ddb5074
-LIBS          += arch/mips/ddb5074/ddb5074.a
+SUBDIRS       += arch/mips/ddb5xxx/common arch/mips/ddb5xxx/ddb5074
+LIBS          += arch/mips/ddb5xxx/common/ddb5xxx.o arch/mips/ddb5xxx/ddb5074/ddb5074.o
 LOADADDR      += 0x80080000
 endif
 
arch/mips/ddb5xxx/ddb5074/Makefile +21 -0
diff -uN -r --exclude=CVS linux-cvs/arch/mips/ddb5xxx/ddb5074/Makefile linux-ddb/arch/mips/ddb5xxx/ddb5074/Makefile
@@ -0,0 +1,21 @@
+#
+# Makefile for the NEC DDB Vrc-5074 specific kernel interface routines
+# under Linux.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+#
+
+.S.s:
+	$(CPP) $(CFLAGS) $< -o $*.s
+.S.o:
+	$(CC) $(CFLAGS) -c $< -o $*.o
+
+O_TARGET = ddb5074.o
+
+obj-y				+= setup.o irq.o int-handler.o pci.o pci_ops.o nile4_pic.o 
+
+include $(TOPDIR)/Rules.make
arch/mips/ddb5xxx/ddb5074/int-handler.S +120 -0

120 lines not on this page · raw message

arch/mips/ddb5xxx/ddb5074/irq.c +175 -0

175 lines not on this page · raw message

arch/mips/ddb5xxx/ddb5074/nile4_pic.c +274 -0

274 lines not on this page · raw message

arch/mips/ddb5xxx/ddb5074/pci.c +128 -0

128 lines not on this page · raw message

arch/mips/ddb5xxx/ddb5074/pci_ops.c +345 -0

345 lines not on this page · raw message

arch/mips/ddb5xxx/ddb5074/setup.c +246 -0

246 lines not on this page · raw message

drivers/net/tulip/interrupt.c +3 -0
diff -uN -r --exclude=CVS linux-cvs/drivers/net/tulip/interrupt.c linux-ddb/drivers/net/tulip/interrupt.c
@@ -186,6 +186,9 @@
 				       tp->rx_buffers[entry].skb->tail,
 				       pkt_len);
 #endif
+#if defined(__mips__)
+				dma_cache_inv((unsigned long)bus_to_virt(tp->rx_ring[entry].buffer1),pkt_len);
+#endif
 			} else { 	/* Pass up the skb already on the Rx ring. */
 				char *temp = skb_put(skb = tp->rx_buffers[entry].skb,
 						     pkt_len);
drivers/net/tulip/tulip.h +1 -1
diff -uN -r --exclude=CVS linux-cvs/drivers/net/tulip/tulip.h linux-ddb/drivers/net/tulip/tulip.h
@@ -29,7 +29,7 @@
 
 
 /* undefine, or define to various debugging levels (>4 == obscene levels) */
-#define TULIP_DEBUG 1
+#define TULIP_DEBUG 5
 
 /* undefine USE_IO_OPS for MMIO, define for PIO */
 #ifdef CONFIG_TULIP_MMIO
drivers/net/tulip/tulip_core.c +29 -0
diff -uN -r --exclude=CVS linux-cvs/drivers/net/tulip/tulip_core.c linux-ddb/drivers/net/tulip/tulip_core.c
@@ -93,6 +93,8 @@
 static int csr0 = 0x01A00000 | 0x9000;
 #elif defined(__arm__) || defined(__sh__)
 static int csr0 = 0x01A00000 | 0x4800;
+#elif defined(__mips__)
+static int csr0 = 0x00200000 | 0x4000;
 #else
 #warning Processor architecture undefined!
 static int csr0 = 0x00A00000 | 0x4800;
@@ -315,6 +317,11 @@
 		tp->tx_buffers[tp->cur_tx].skb = NULL;
 		tp->tx_buffers[tp->cur_tx].mapping = mapping;
 
+#if defined(__mips__)
+              dma_cache_wback_inv((unsigned long)tp->setup_frame,
+                                            sizeof(tp->setup_frame));
+#endif
+
 		/* Put the setup frame on the Tx list. */
 		tp->tx_ring[tp->cur_tx].length = cpu_to_le32(0x08000000 | 192);
 		tp->tx_ring[tp->cur_tx].buffer1 = cpu_to_le32(mapping);
@@ -618,6 +625,10 @@
 					 PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
 		tp->rx_buffers[i].mapping = mapping;
 		skb->dev = dev;			/* Mark as being used by this device. */
+#if defined(__mips__)
+		/* Kick out any matching lines in the cache. */
+		dma_cache_inv((unsigned long)skb->tail, PKT_BUF_SZ);
+#endif
 		tp->rx_ring[i].status = cpu_to_le32(DescOwned);	/* Owned by Tulip chip */
 		tp->rx_ring[i].buffer1 = cpu_to_le32(mapping);
 	}
@@ -670,6 +681,11 @@
 	/* if we were using Transmit Automatic Polling, we would need a
 	 * wmb() here. */
 	tp->tx_ring[entry].status = cpu_to_le32(DescOwned);
+	printk("tp->tx_ring[entry].status: %08x, tp->tx_ring[entry].length: %d",
+					tp->tx_ring[entry].status,tp->tx_ring[entry].length & ~flag);
+#if defined(__mips__)
+	dma_cache_wback_inv((unsigned long)skb->data, skb->len);
+#endif
 	wmb();
 
 	tp->cur_tx++;
@@ -1384,6 +1400,7 @@
 	ioaddr = pci_resource_start (pdev, 0);
 	irq = pdev->irq;
 
+
 	/* alloc_etherdev ensures aligned and zeroed private structures */
 	dev = alloc_etherdev (sizeof (*tp));
 	if (!dev) {
@@ -1428,6 +1445,8 @@
 	tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE);
 	tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE;
 
+	printk("tp->tx_ring: %p\n",tp->tx_ring);
+
 	tp->chip_id = chip_idx;
 	tp->flags = tulip_tbl[chip_idx].flags;
 	tp->pdev = pdev;
@@ -1515,6 +1534,16 @@
                        /* No media table either */
                        tp->flags &= ~HAS_MEDIA_TABLE;
                }
+#endif
+#ifdef CONFIG_DDB5074
+printk("PCI_SLOT(pdev->devfn): %d\n",PCI_SLOT(pdev->devfn));
+               if ((pdev->bus->number == 0) && (PCI_SLOT(pdev->devfn) == 1)) {
+                       /* DDB5477 MAC address in first EEPROM locations. */
+                       sa_offset = 0;
+                       /* No media table either */
+                       tp->flags &= ~HAS_MEDIA_TABLE;
+               }
+
 #endif
 		for (i = 0; i < 6; i ++) {
 			dev->dev_addr[i] = ee_data[i + sa_offset];
drivers/video/matrox/matroxfb_Ti3026.c +2 -2
diff -uN -r --exclude=CVS linux-cvs/drivers/video/matrox/matroxfb_Ti3026.c linux-ddb/drivers/video/matrox/matroxfb_Ti3026.c
@@ -667,7 +667,7 @@
 		udelay(10);
 	}
 	if (!tmout)
-		printk(KERN_ERR "matroxfb: Pixel PLL not locked after 5 secs\n");
+		printk(KERN_ERR "matroxfb: Pixel PLL not locked after 5 secs, %02x\n",inTi3026(PMINFO TVP3026_XPIXPLLDATA));
 }
 
 static void ti3026_ramdac_init(WPMINFO struct matrox_hw_state* hw){
@@ -754,7 +754,7 @@
 			CRITEND
 
 			if (!tmout)
-				printk(KERN_ERR "matroxfb: Pixel PLL not locked after 5 secs\n");
+				printk(KERN_ERR "matroxfb: Pixel PLL not locked after 5 secs,%02x\n",inTi3026(PMINFO TVP3026_XPIXPLLDATA));
 			else
 				dprintk(KERN_INFO "PixelPLL: %d\n", 500000-tmout);
 			CRITBEGIN
drivers/video/matrox/matroxfb_misc.c +3 -0
diff -uN -r --exclude=CVS linux-cvs/drivers/video/matrox/matroxfb_misc.c linux-ddb/drivers/video/matrox/matroxfb_misc.c
@@ -127,12 +127,15 @@
 void matroxfb_DAC_out(CPMINFO int reg, int val) {
 	DBG_REG("outDAC");
 	mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg);
+	wmb();
 	mga_outb(M_RAMDAC_BASE+M_X_DATAREG, val);
+	wmb();
 }
 
 int matroxfb_DAC_in(CPMINFO int reg) {
 	DBG_REG("inDAC");
 	mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg);
+	wmb();
 	return mga_inb(M_RAMDAC_BASE+M_X_DATAREG);
 }
 
include/asm-mips/ddb5xxx/ddb5074.h +38 -0
diff -uN -r --exclude=CVS linux-cvs/include/asm-mips/ddb5xxx/ddb5074.h linux-ddb/include/asm-mips/ddb5xxx/ddb5074.h
@@ -0,0 +1,38 @@
+/*
+ *  include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
+ *
+ *  Copyright (C) 2000 Geert Uytterhoeven <[email protected]>
+ *                     Sony Software Development Center Europe (SDCE), Brussels
+ */
+
+#ifndef _ASM_DDB5XXX_DDB5074_H
+#define _ASM_DDB5XXX_DDB5074_H
+
+#include <asm/nile4.h>
+
+#define DDB_SDRAM_SIZE      0x04000000      /* 64MB */
+
+#define DDB_PCI_IO_BASE     0x06000000
+#define DDB_PCI_IO_SIZE     0x02000000      /* 32 MB */
+
+#define DDB_PCI_MEM_BASE    0x08000000
+#define DDB_PCI_MEM_SIZE    0x08000000  /* 128 MB */
+
+#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
+#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
+
+#define NILE4_PCI_IO_BASE   0xa6000000
+#define NILE4_PCI_MEM_BASE  0xa8000000
+#define NILE4_PCI_CFG_BASE  NILE4_PCI_MEM_BASE
+#define DDB_PCI_IACK_BASE NILE4_PCI_IO_BASE
+
+#define NILE4_IRQ_BASE NUM_I8259_INTERRUPTS
+#define CPU_IRQ_BASE NUM_NILE4_INTERRUPTS
+#define CPU_NILE4_CASCADE 2
+
+extern void ddb5074_led_hex(int hex);
+extern void ddb5074_led_d2(int on);
+extern void ddb5074_led_d3(int on);
+
+extern void nile4_irq_setup(u32 base);
+#endif
include/asm-mips/nile4.h +4 -0
diff -uN -r --exclude=CVS linux-cvs/include/asm-mips/nile4.h linux-ddb/include/asm-mips/nile4.h
@@ -9,6 +9,9 @@
  *	NEC Vrc 5074 System Controller Data Sheet, June 1998
  */
 
+#ifndef _ASM_NILE4_H
+#define _ASM_NILE4_H
+
 #define NILE4_BASE		0xbfa00000
 #define NILE4_SIZE		0x00200000		/* 2 MB */
 
@@ -303,3 +306,4 @@
 extern u8 nile4_i8259_iack(void);
 extern void nile4_dump_irq_status(void);	/* Debug */
 
+#endif
init/main.c +2 -0
diff -uN -r --exclude=CVS linux-cvs/init/main.c linux-ddb/init/main.c
@@ -77,9 +77,11 @@
  * To avoid associated bogus bug reports, we flatly refuse to compile
  * with a gcc that is known to be too old from the very beginning.
  */
+#if 0
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 91)
 #error Sorry, your GCC is too old. It builds incorrect kernels.
 #endif
+#endif
 
 extern char _stext, _etext;
 extern char *linux_banner;
arch/mips/config.in +4 -1
diff -u linux-cvs/arch/mips/config.in linux-ddb/arch/mips/config.in
@@ -183,9 +176,12 @@
    define_bool CONFIG_I8259 y
    define_bool CONFIG_ISA y
    define_bool CONFIG_NONCOHERENT_IO y
+   define_bool CONFIG_IRQ_CPU y
    define_bool CONFIG_PCI y
+   define_bool CONFIG_NEW_PCI y
+   define_bool CONFIG_PCI_AUTO y
    define_bool CONFIG_PC_KEYB y
-   define_bool CONFIG_OLD_TIME_C y
+   define_bool CONFIG_NEW_TIME_C y
 fi
 if [ "$CONFIG_DDB5476"  = "y" ]; then
    define_bool CONFIG_ISA y