Skip to contentSkip to conversation

lasat updates

PATCH In review Brian Murphy 2 participants 2 messages Jun 20, 2003 – Jun 22, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lasat updates

Hi Ralf,
This patch fixes up the Lasat code so it works as well as before the latest chain of updates (which is not quite). The patch to the PCI code is necessary because I stupidly copied the code from the mips-boards code which also has the same problem (writes of full 32 bit words are ignored). The people who made pci-sb1250.c seem to have
made the same error too...

/Brian

Index: arch/mips/lasat/Makefile
===================================================================
RCS file: /cvs/linux/arch/mips/lasat/Makefile,v
retrieving revision 1.7

mips/lasat/Makefile +0 -2
diff -u -r1.7 Makefile
@@ -12,7 +12,5 @@
 obj-$(CONFIG_PICVUE) += picvue.o
 obj-$(CONFIG_PICVUE_PROC) += picvue_proc.o
 
-obj-$(CONFIG_PCI) += pci.o
-
 clean:
 	make -C image clean

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

mips/lasat/lasat_board.c +6 -3
diff -u -r1.3 lasat_board.c
@@ -24,6 +24,7 @@
  * Routines specific to the LASAT boards
  */
 #include <linux/types.h>
+#include <linux/crc32.h>
 #include <asm/lasat/lasat.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -33,9 +34,11 @@
 #include "at93c.h"
 /* New model description table */
 #include "lasat_models.h"
+
+#define EEPROM_CRC(data, len) (~0 ^ crc32(~0, data, len))
+
 struct lasat_info lasat_board_info;
 
-unsigned long crc32(unsigned long, unsigned char *, int);
 void update_bcastaddr(void);
 
 int EEPROMRead(unsigned int pos, unsigned char *data, int len)
@@ -109,7 +112,7 @@
 		   sizeof(struct lasat_eeprom_struct));
 
 	/* Check the CRC */
-	crc = crc32(0x0, (unsigned char *)(&lasat_board_info.li_eeprom_info),
+	crc = EEPROM_CRC((unsigned char *)(&lasat_board_info.li_eeprom_info),
 		    sizeof(struct lasat_eeprom_struct) - 4);
 
 	if (crc != lasat_board_info.li_eeprom_info.crc32) {
@@ -268,7 +271,7 @@
 	unsigned long crc;
 
 	/* Generate the CRC */
-	crc = crc32(0x0, (unsigned char *)(&lasat_board_info.li_eeprom_info),
+	crc = EEPROM_CRC((unsigned char *)(&lasat_board_info.li_eeprom_info),
 		    sizeof(struct lasat_eeprom_struct) - 4);
 	lasat_board_info.li_eeprom_info.crc32 = crc;
 

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

mips/lasat/image/Makefile +6 -4
diff -u -r1.5 Makefile
@@ -27,15 +27,17 @@
 
 obj-y = head.o kImage.o
 
-rom.sw:	rom.bin
+rom.sw:	$(obj)/rom.sw
+
+$(obj)/rom.sw:	$(obj)/rom.bin
 	$(MKLASATIMG) -o $@ -k $^ -m $(MKLASATIMG_ARCH)
 
-rom.bin: $(obj)/rom
-	$(OBJCOPY) -O binary -S rom rom.bin
+$(obj)/rom.bin: $(obj)/rom
+	$(OBJCOPY) -O binary -S $^ $@
 
 # Rule to make the bootloader
 $(obj)/rom: $(addprefix $(obj)/,$(obj-y))
-	$(LD) $(LDFLAGS) $(LDSCRIPT) -o rom $^
+	$(LD) $(LDFLAGS) $(LDSCRIPT) -o $@ $^
 
 $(obj)/%.o: $(obj)/%.gz
 	$(LD) -r -o $@ -b binary $<

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

mips/pci/pci-lasat.c +3 -1
diff -u -r1.2 pci-lasat.c
@@ -152,7 +152,7 @@
 		/* Error occured */
 #ifdef DEBUG_PCI
 		printk("\terror %x at adr %x\n", err,
-		       vrc_pciregs[LO(PCIERR)]);
+		       vrc_pciregs[LO(NILE4_PCIERR)]);
 #endif
 		return -1;
 	}
@@ -204,6 +204,8 @@
 	else if (size == 2)
 		data = (data & ~(0xffff << ((where & 3) << 3))) |
 		    (val << ((where & 3) << 3));
+	else
+		data = val;
 
 	if (lasat_pcibios_config_access
 	    (PCI_ACCESS_WRITE, bus, devfn, where, &data))

Index: arch/mips/defconfig-lasat200
===================================================================
RCS file: /cvs/linux/arch/mips/defconfig-lasat200,v retrieving revision 1.51

mips/defconfig-lasat200 +39 -8

77 lines not on this page · raw message

#1 lore raw
Quoted 7 lines · Brian Murphy

This patch fixes up the Lasat code so it works as well as before the latest chain of updates (which is not quite). The patch to the PCI code is necessary because I stupidly copied the code from the mips-boards code which also has the same problem (writes of full 32 bit words are ignored). The people who made pci-sb1250.c seem to have
made the same error too...

Yep, too much code copying. Guess why I'm doing this no-prisoners taken cleanup of the PCI code ...

Ralf