patch-2.4.5 linux/arch/ppc/kernel/m8xx_setup.c

Next file: linux/arch/ppc/kernel/misc.S
Previous file: linux/arch/ppc/kernel/m8260_setup.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/arch/ppc/kernel/m8xx_setup.c linux/arch/ppc/kernel/m8xx_setup.c
@@ -1,6 +1,7 @@
 /*
- * $Id: m8xx_setup.c,v 1.4 1999/09/18 18:40:36 dmalek Exp $
- *
+ * BK Id: SCCS/s.m8xx_setup.c 1.17 05/18/01 07:54:04 patch
+ */
+/*
  *  linux/arch/ppc/kernel/setup.c
  *
  *  Copyright (C) 1995  Linus Torvalds
@@ -107,11 +108,17 @@
 ide_pio_timings_t ide_pio_clocks[6];
 
 /* Make clock cycles and always round up */
-#define PCMCIA_MK_CLKS( t, T ) (( (t) * (T) + 999U ) / 1000U )
+#define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
 
 #endif	/* CONFIG_BLK_DEV_MPC8xx_IDE */
 #endif	/* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
 
+#ifdef CONFIG_BLK_DEV_RAM
+extern int rd_doload;		/* 1 = load ramdisk, 0 = don't load */
+extern int rd_prompt;		/* 1 = prompt for ramdisk, 0 = don't prompt */
+extern int rd_image_start;	/* starting block # of image */
+#endif
+
 extern char saved_command_line[256];
 
 extern unsigned long find_available_memory(void);
@@ -200,7 +207,7 @@
 	/* Processor frequency is MHz.
 	 * The value 'fp' is the number of decrementer ticks per second.
 	 */
-	fp = (binfo->bi_intfreq * 1000000) / 16;
+	fp = binfo->bi_intfreq / 16;
 	freq = fp*60;	/* try to make freq/1e6 an integer */
         divisor = 60;
         printk("Decrementer Frequency = %d/%d\n", freq, divisor);
@@ -308,10 +315,10 @@
 
 	bp = (bd_t *)__res;
 			
-	len += sprintf(len+buffer,"clock\t\t: %ldMHz\n"
-		       "bus clock\t: %ldMHz\n",
-		       bp->bi_intfreq /*/ 1000000*/,
-		       bp->bi_busfreq /*/ 1000000*/);
+	len += sprintf(len+buffer,"clock\t\t: %dMHz\n"
+		       "bus clock\t: %dMHz\n",
+		       bp->bi_intfreq / 1000000,
+		       bp->bi_busfreq / 1000000);
 
 	return len;
 }
@@ -358,7 +365,7 @@
 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
 	ide_insw(port, buf, ns);
 #else
-	ide_insw(port+_IO_BASE, buf, ns);
+	_insw_ns((unsigned short *)(port+_IO_BASE), buf, ns);
 #endif
 }
 
@@ -368,7 +375,7 @@
 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
 	ide_outsw(port, buf, ns);
 #else
-	ide_outsw(port+_IO_BASE, buf, ns);
+	_outsw_ns((unsigned short *)(port+_IO_BASE), buf, ns);
 #endif
 }
 
@@ -381,7 +388,7 @@
 	
 	return (ioport_dsc[base].irq);
 #else
-        return 14;
+        return 9;
 #endif
 }
 
@@ -398,11 +405,7 @@
 		       const char *device,
 		       void *dev_id)
 {
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
 	return request_8xxirq(irq, handler, flags, device, dev_id);
-#else
-	return request_irq(irq, handler, flags, device, dev_id);
-#endif
 }
 
 /* We can use an external IDE controller
@@ -413,16 +416,14 @@
 void m8xx_ide_init_hwif_ports(hw_regs_t *hw,
 	ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
 {
-	ide_ioreg_t *p = hw->io_ports;
 	int i;
 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
+	ide_ioreg_t *p = hw->io_ports;
 	volatile pcmconf8xx_t	*pcmp;
 
 	static unsigned long pcmcia_base = 0;
-#else
-	ide_ioreg_t port = data_port;	/* ??? XXX ??? XXX */
-#endif
 	unsigned long base;
+#endif
 
 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
 	*p = 0;
@@ -500,12 +501,15 @@
 	
 	/* Just a regular IDE drive on some I/O port.
 	*/
-	i = 8;
-	while (i--)
-		*p++ = port++;
-	*p++ = base + 0x206;
-	if (irq != NULL)
-		*irq = 0;
+	if (data_port == 0)
+		return;
+
+	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
+		hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET;
+
+	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
+        return;
+
 #endif	/* CONFIG_BLK_DEV_MPC8xx_IDE */
 }
 #endif	/* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
@@ -523,7 +527,6 @@
 #define PCMCIA_SL(t) ((t==32) ? 0 : ((t & 0x1F)<<7)) /* Strobe Length	*/
 #endif
 
-
 /* Calculate PIO timings */
 static void
 m8xx_ide_tuneproc(ide_drive_t *drive, byte pio)
@@ -581,9 +584,27 @@
 
 #endif	/* CONFIG_BLK_DEV_MPC8xx_IDE */
 #endif	/* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
-
 /* -------------------------------------------------------------------- */
 
+/*
+ * This is a big hack right now, but it may turn into something real
+ * someday.
+ *
+ * For the 8xx boards (at this time anyway), there is nothing to initialize
+ * associated the PROM.  Rather than include all of the prom.c
+ * functions in the image just to get prom_init, all we really need right
+ * now is the initialization of the physical memory region.
+ */
+unsigned long __init m8xx_find_end_of_memory(void)
+{
+	bd_t	*binfo;
+	extern unsigned char __res[];
+	
+	binfo = (bd_t *)__res;
+
+	return binfo->bi_memsize;
+}
+
 void __init
 m8xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
 	 unsigned long r6, unsigned long r7)
@@ -629,18 +650,8 @@
 	ppc_md.get_rtc_time   = m8xx_get_rtc_time;
 	ppc_md.calibrate_decr = m8xx_calibrate_decr;
 
-#if 0
-	ppc_md.kbd_setkeycode    = pckbd_setkeycode;
-	ppc_md.kbd_getkeycode    = pckbd_getkeycode;
-	ppc_md.kbd_pretranslate  = pckbd_pretranslate;
-	ppc_md.kbd_translate     = pckbd_translate;
-	ppc_md.kbd_unexpected_up = pckbd_unexpected_up;
-	ppc_md.kbd_leds          = pckbd_leds;
-	ppc_md.kbd_init_hw       = pckbd_init_hw;
-#ifdef CONFIG_MAGIC_SYSRQ
-	ppc_md.kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
-#endif
-#else
+	ppc_md.find_end_of_memory = m8xx_find_end_of_memory;
+
 	ppc_md.kbd_setkeycode    = NULL;
 	ppc_md.kbd_getkeycode    = NULL;
 	ppc_md.kbd_translate     = NULL;
@@ -648,8 +659,7 @@
 	ppc_md.kbd_leds          = NULL;
 	ppc_md.kbd_init_hw       = NULL;
 #ifdef CONFIG_MAGIC_SYSRQ
-	ppc_md.kbd_sysrq_xlate	 = NULL;
-#endif
+	ppc_md.ppc_kbd_sysrq_xlate	 = NULL;
 #endif
 
 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)