Skip to contentSkip to conversation

Latest updates for LASAT 2.4

PATCH New Brian Murphy 1 participant 1 message Feb 19, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Latest updates for LASAT 2.4

This is just a maintainance patch for LASAT removing unused cruft and updating stuff to be more compatible with the 2.5 way of doing things (mostly local_irq_* stuff). It also impliments a polling printf (prom_printf) for debugging and if you have a recent prom monitor / bootloader it gets started after a shutdown or panic from whence you can restart, examine memory, etc...

I have a unifying patch for 2.5 but It wont work until a newer 2.5 is merged back to the mips-linux tree (for crc support) and the serial driver in 2.5 is fixed so a serial port can be registered dynamically (or do you want the patch anyway Ralf to sync things up?)

/Brian

Index: arch/mips/lasat/ds1603.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/ds1603.c,v retrieving revision 1.1.1.2
retrieving revision 1.4

mips/lasat/ds1603.c +3 -1
diff -u -r1.1.1.2 -r1.4
@@ -145,12 +145,14 @@
 	return word;
 }
 
-void ds1603_set(unsigned long time)
+int ds1603_set(unsigned long time)
 {
 	rtc_init_op();
 	rtc_write_byte(SET_TIME_CMD);
 	rtc_write_word(time);
 	rtc_end_op();
+
+	return 0;
 }
 
 void ds1603_set_trimmer(unsigned int trimval)

Index: arch/mips/lasat/ds1603.h
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/ds1603.h,v retrieving revision 1.1.1.2
retrieving revision 1.4

mips/lasat/ds1603.h +1 -1
diff -u -r1.1.1.2 -r1.4
@@ -21,7 +21,7 @@
 extern struct ds_defs *ds1603;
 
 unsigned long ds1603_read(void);
-void ds1603_set(unsigned long);
+int ds1603_set(unsigned long);
 void ds1603_set_trimmer(unsigned int);
 void ds1603_enable(void);
 void ds1603_disable(void);

Index: arch/mips/lasat/interrupt.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/interrupt.c,v retrieving revision 1.1.1.2
retrieving revision 1.15

mips/lasat/interrupt.c +8 -8
diff -u -r1.1.1.2 -r1.15
@@ -53,9 +53,9 @@
 	unsigned long flags;
 	DEBUG_INT("disable_lasat_irq: %d", irq_nr);
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 	*lasat_int_mask &= ~(1 << irq_nr) << lasat_int_mask_shift;
-	restore_flags(flags);
+	local_irq_restore(flags);
 }
 
 void enable_lasat_irq(unsigned int irq_nr)
@@ -63,9 +63,9 @@
 	unsigned long flags;
 	DEBUG_INT("enable_lasat_irq: %d", irq_nr);
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 	*lasat_int_mask |= (1 << irq_nr) << lasat_int_mask_shift;
-	restore_flags(flags);
+	local_irq_restore(flags);
 }
 
 static unsigned int startup_lasat_irq(unsigned int irq)
@@ -164,15 +164,15 @@
 
 	switch (mips_machtype) {
 	case MACH_LASAT_100:
-		lasat_int_status = LASAT_INT_STATUS_REG_100;
-		lasat_int_mask = LASAT_INT_MASK_REG_100;
+		lasat_int_status = (void *)LASAT_INT_STATUS_REG_100;
+		lasat_int_mask = (void *)LASAT_INT_MASK_REG_100;
 		lasat_int_mask_shift = LASATINT_MASK_SHIFT_100;
 		get_int_status = get_int_status_100;
 		*lasat_int_mask = 0;
 		break;
 	case MACH_LASAT_200:
-		lasat_int_status = LASAT_INT_STATUS_REG_200;
-		lasat_int_mask = LASAT_INT_MASK_REG_200;
+		lasat_int_status = (void *)LASAT_INT_STATUS_REG_200;
+		lasat_int_mask = (void *)LASAT_INT_MASK_REG_200;
 		lasat_int_mask_shift = LASATINT_MASK_SHIFT_200;
 		get_int_status = get_int_status_200;
 		*lasat_int_mask &= 0xffff;

Index: arch/mips/lasat/lasat_board.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/lasat_board.c,v retrieving revision 1.1.1.2
retrieving revision 1.15

mips/lasat/lasat_board.c +40 -202

338 lines not on this page · raw message

Index: arch/mips/lasat/pci.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/pci.c,v
retrieving revision 1.1.1.3
retrieving revision 1.7

mips/lasat/pci.c +15 -15
diff -u -r1.1.1.3 -r1.7
@@ -164,16 +164,16 @@
 {
         u32 data=0, flags;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 
 	if (lasat_pcibios_config_access(PCI_ACCESS_READ, dev, reg, &data)) {
-		restore_flags(flags);
+		local_irq_restore(flags);
 		return -1;
 	}
 
 	*val = (data >> ((reg & 3) << 3)) & 0xff;
 
-	restore_flags(flags);
+	local_irq_restore(flags);
 	return PCIBIOS_SUCCESSFUL;
 }
 
@@ -185,16 +185,16 @@
 	if (reg & 1)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 
 	if (lasat_pcibios_config_access(PCI_ACCESS_READ, dev, reg, &data)) {
-		restore_flags(flags);
+		local_irq_restore(flags);
 		return -1;
 	}
 
 	*val = (data >> ((reg & 3) << 3)) & 0xffff;
 
-	restore_flags(flags);
+	local_irq_restore(flags);
 	return PCIBIOS_SUCCESSFUL;
 }
 
@@ -205,16 +205,16 @@
 	if (reg & 3)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 
 	if (lasat_pcibios_config_access(PCI_ACCESS_READ, dev, reg, &data)) {
-		restore_flags(flags);
+		local_irq_restore(flags);
 		return -1;
 	}
 
 	*val = data;
 
-	restore_flags(flags);
+	local_irq_restore(flags);
 	return PCIBIOS_SUCCESSFUL;
 }
 
@@ -223,7 +223,7 @@
 {
         u32 data=0, flags, err;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 
         err = lasat_pcibios_config_access(PCI_ACCESS_READ, dev, reg, &data);
         if (err)
@@ -234,7 +234,7 @@
 
 	err = lasat_pcibios_config_access(PCI_ACCESS_WRITE, dev, reg, &data);
 out:
-	restore_flags(flags);
+	local_irq_restore(flags);
 
 	if (err)
 		return -1;
@@ -249,7 +249,7 @@
 	if (reg & 1)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
        
-	save_and_cli(flags);
+	local_irq_save(flags);
 
         err = lasat_pcibios_config_access(PCI_ACCESS_READ, dev, reg, &data);
         if (err)
@@ -260,7 +260,7 @@
 
 	err = lasat_pcibios_config_access(PCI_ACCESS_WRITE, dev, reg, &data);
 out:
-	restore_flags(flags);
+	local_irq_restore(flags);
 
 	if (err)
 		return -1;
@@ -275,10 +275,10 @@
 	if (reg & 3)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 
 	err = lasat_pcibios_config_access(PCI_ACCESS_WRITE, dev, reg, &val);
-	restore_flags(flags);
+	local_irq_restore(flags);
 
 	if (err)
 		return -1;

Index: arch/mips/lasat/picvue.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/picvue.c,v retrieving revision 1.1.1.2
retrieving revision 1.11

mips/lasat/picvue.c +44 -8

110 lines not on this page · raw message

Index: arch/mips/lasat/picvue.h
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/picvue.h,v retrieving revision 1.1.1.2

mips/lasat/picvue.h +2 -0
diff -u -r1.1.1.2 picvue.h
@@ -23,6 +23,8 @@
 #define PVC_VISIBLE_CHARS	16
 
 void pvc_write_string(const unsigned char *str, u8 addr, int line);
+void pvc_write_string_centered(const unsigned char *str, int line);
+void pvc_dump_string(const unsigned char *str);
 
 #define BM_SIZE			8
 #define MAX_PROGRAMMABLE_CHARS	8

Index: arch/mips/lasat/picvue_proc.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/picvue_proc.c,v retrieving revision 1.1.1.2
retrieving revision 1.6

mips/lasat/picvue_proc.c +17 -2
diff -u -r1.1.1.2 -r1.6
@@ -81,7 +81,7 @@
         return origcount;
 }
 
-static int pvc_proc_scroll(struct file *file, const char *buffer,            
+static int pvc_proc_write_scroll(struct file *file, const char *buffer,
                            unsigned long count, void *data)
 {
         int origcount = count;
@@ -109,6 +109,20 @@
         return origcount;
 }
 
+static int pvc_proc_read_scroll(char *page, char **start,
+                             off_t off, int count,
+                             int *eof, void *data)
+{
+        char *origpage = page;
+
+	down(&pvc_sem);
+        page += sprintf(page, "%d\n", scroll_dir * scroll_interval);
+	up(&pvc_sem);
+
+        return page - origpage; 
+}
+
+
 void pvc_proc_timerfunc(unsigned long data)
 {
 	if (scroll_dir < 0)
@@ -155,7 +169,8 @@
 	proc_entry = create_proc_entry("scroll", 0644, pvc_display_dir);
 	if (proc_entry == NULL)
 		goto error;
-	proc_entry->write_proc = pvc_proc_scroll;
+	proc_entry->write_proc = pvc_proc_write_scroll;
+	proc_entry->read_proc = pvc_proc_read_scroll;
 
 	init_timer(&timer);
 	timer.function = pvc_proc_timerfunc;

Index: arch/mips/lasat/prom.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/prom.c,v retrieving revision 1.1.1.2
retrieving revision 1.12

mips/lasat/prom.c +72 -10

111 lines not on this page · raw message

Index: arch/mips/lasat/prom.h
===================================================================
RCS file: arch/mips/lasat/prom.h

mips/lasat/prom.h new file +6 -0
diff -N arch/mips/lasat/prom.h
@@ -0,0 +1,6 @@
+#ifndef PROM_H
+#define PROM_H
+extern void (* prom_display)(const char *string, int pos, int clear);
+extern void (* prom_monitor)(void);
+extern void (* prom_printf)(const char * fmt, ...);
+#endif

Index: arch/mips/lasat/reset.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/reset.c,v retrieving revision 1.1.1.2
retrieving revision 1.6

mips/lasat/reset.c +10 -11
diff -u -r1.1.1.2 -r1.6
@@ -29,6 +29,7 @@
 #include <asm/system.h>
 #include <asm/lasat/lasat.h>
 #include "picvue.h"
+#include "prom.h"
 
 static void lasat_machine_restart(char *command);
 static void lasat_machine_halt(void);
@@ -38,31 +39,29 @@
 
 static void lasat_machine_restart(char *command)
 {
-	cli();
+	local_irq_disable();
 
-	{
-		volatile unsigned int *softres_reg = lasat_misc->reset_reg;
-
-		if (lasat_boot_to_service) {
-			printk("machine_restart: Rebooting to service mode\n");
-			*(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
-			*(volatile unsigned int *)0xa00000fc = 0xfedeabba;
-		}
-		*softres_reg = 0xbedead;
+	if (lasat_boot_to_service) {
+		printk("machine_restart: Rebooting to service mode\n");
+		*(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
+		*(volatile unsigned int *)0xa00000fc = 0xfedeabba;
 	}
+	*lasat_misc->reset_reg = 0xbedead;
 	for (;;) ;
 }
 
 #define MESSAGE "System halted"
 static void lasat_machine_halt(void)
 {
+	local_irq_disable();
+
 	/* Disable interrupts and loop forever */
 	printk(KERN_NOTICE MESSAGE "\n");
 #ifdef CONFIG_PICVUE
 	pvc_clear();
 	pvc_write_string(MESSAGE, 0, 0);
 #endif
-	cli();
+	prom_monitor();
 	for (;;) ;
 }
 

Index: arch/mips/lasat/setup.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/setup.c,v retrieving revision 1.1.1.4
retrieving revision 1.19

mips/lasat/setup.c +28 -83

170 lines not on this page · raw message

Index: arch/mips/lasat/sysctl.c
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/sysctl.c,v retrieving revision 1.1.1.1
retrieving revision 1.5

mips/lasat/sysctl.c +22 -64

147 lines not on this page · raw message

Index: arch/mips/lasat/sysctl.h
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/sysctl.h,v retrieving revision 1.1.1.1
retrieving revision 1.2

mips/lasat/sysctl.h +11 -30

47 lines not on this page · raw message

Index: arch/mips/lasat/image/Makefile
===================================================================
RCS file: /cvs/linux-mips/arch/mips/lasat/image/Makefile,v retrieving revision 1.1.1.2
retrieving revision 1.6

mips/lasat/image/Makefile +1 -1
diff -u -r1.1.1.2 -r1.6
@@ -11,7 +11,7 @@
 endif
 
 MKLASATIMG = mklasatimg
-MKLASATIMG_ARCH = mq2,mqpro
+MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
 ifdef CONFIG_LASAT_SERVICE
 MKLASATIMG_FLAG = -s
 else

Index: drivers/mtd/maps/lasat.c
===================================================================
RCS file: /cvs/linux-mips/drivers/mtd/maps/lasat.c,v retrieving revision 1.1.1.2

mtd/maps/lasat.c +9 -6
diff -u -r1.1.1.2 lasat.c
@@ -12,7 +12,6 @@
 #include <linux/mtd/partitions.h>
 #include <linux/config.h>
 #include <asm/lasat/lasat.h>
-#include <asm/lasat/lasat_mtd.h>
 
 static struct mtd_info *mymtd;
 
@@ -73,11 +72,12 @@
 };
 
 static struct mtd_partition partition_info[LASAT_MTD_LAST];
-static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Filesystem", "Config"};
+static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Config", "Filesystem"};
 
 static int __init init_sp(void)
 {
 	int i;
+	int nparts = 0;
 	/* this does not play well with the old flash code which 
 	 * protects and uprotects the flash when necessary */
        	printk(KERN_NOTICE "Unprotecting flash\n");
@@ -100,12 +100,15 @@
 
 		for (i=0; i < LASAT_MTD_LAST; i++) {
 			size = lasat_flash_partition_size(i);
-			partition_info[i].size = size;
-			partition_info[i].offset = offset;
-			offset += size;
+			if (size != 0) {
+				nparts++;
+				partition_info[i].size = size;
+				partition_info[i].offset = offset;
+				offset += size;
+			}
 		}
 
-		add_mtd_partitions( mymtd, partition_info, LASAT_MTD_LAST );
+		add_mtd_partitions( mymtd, partition_info, nparts );
 		return 0;
 	}
 

Index: include/asm-mips/lasat/lasat.h
===================================================================
RCS file: /cvs/linux-mips/include/asm-mips/lasat/lasat.h,v retrieving revision 1.1.1.2
retrieving revision 1.8

asm-mips/lasat/lasat.h +32 -36

109 lines not on this page · raw message

Index: include/asm-mips/lasat/lasat_mtd.h
===================================================================
RCS file: include/asm-mips/lasat/lasat_mtd.h

asm-mips/lasat/lasat_mtd.h deleted +0 -15
diff -N include/asm-mips/lasat/lasat_mtd.h
@@ -1,15 +0,0 @@
-#include <linux/types.h>
-
-enum lasat_mtdparts {
-	LASAT_MTD_BOOTLOADER,
-	LASAT_MTD_SERVICE,
-	LASAT_MTD_NORMAL,
-	LASAT_MTD_FS,
-	LASAT_MTD_CONFIG,
-	LASAT_MTD_LAST
-}; 
-
-#define BOOTLOADER_SIZE 0x40000
-
-extern unsigned long lasat_flash_partition_start(int partno);
-extern unsigned long lasat_flash_partition_size(int partno);