Skip to contentSkip to conversation

MIPS core flash driver

PATCH In review Aurelien Jarno 2 participants 2 messages Aug 5, 2007 – Aug 6, 2007

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

PATCH 3/4 MIPS core flash driver

The patch below against 2.6.23-rc1-mm2 fixes the size of the flash window and detect the width of the flash bus (8 or 16 bits).

It originally comes from the OpenWrt patches.

drivers/ssb/driver_mipscore.c +6 -2
@@ -186,12 +186,16 @@
 {
 	struct ssb_bus *bus = mcore->dev->bus;
 
+	mcore->flash_buswidth = 2;
 	if (bus->chipco.dev) {
 		mcore->flash_window = 0x1c000000;
-		mcore->flash_window_size = 0x800000;
+		mcore->flash_window_size = 0x02000000;
+		if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
+		               & SSB_CHIPCO_CFG_DS16) == 0)
+			mcore->flash_buswidth = 1;
 	} else {
 		mcore->flash_window = 0x1fc00000;
-		mcore->flash_window_size = 0x400000;
+		mcore->flash_window_size = 0x00400000;
 	}
 }
 
include/linux/ssb/ssb_driver_mips.h +1 -0
@@ -20,6 +20,7 @@
 	int nr_serial_ports;
 	struct ssb_serial_port serial_ports[4];
 
+	int flash_buswidth;
 	u32 flash_window;
 	u32 flash_window_size;
 };
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#1 lore raw
Quoted 32 lines · Aurelien Jarno

The patch below against 2.6.23-rc1-mm2 fixes the size of the flash window and detect the width of the flash bus (8 or 16 bits).

It originally comes from the OpenWrt patches.

drivers/ssb/driver_mipscore.c +6 -2
@@ -186,12 +186,16 @@
 {
 	struct ssb_bus *bus = mcore->dev->bus;
 
+	mcore->flash_buswidth = 2;
 	if (bus->chipco.dev) {
 		mcore->flash_window = 0x1c000000;
-		mcore->flash_window_size = 0x800000;
+		mcore->flash_window_size = 0x02000000;
+		if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
+		               & SSB_CHIPCO_CFG_DS16) == 0)
+			mcore->flash_buswidth = 1;
 	} else {
 		mcore->flash_window = 0x1fc00000;
-		mcore->flash_window_size = 0x400000;
+		mcore->flash_window_size = 0x00400000;
 	}
 }
 

include/linux/ssb/ssb_driver_mips.h line 23

Quoted 4 lines
include/linux/ssb/ssb_driver_mips.h +1 -0
@@ -20,6 +20,7 @@
 	int nr_serial_ports;
 	struct ssb_serial_port serial_ports[4];
 
+	int flash_buswidth;

u8 please (although it doesn't save space in this case (padding)), but the struct could be reorganized to save space later.

Quoted 4 lines
include/linux/ssb/ssb_driver_mips.h +0 -0
 	u32 flash_window;
 	u32 flash_window_size;
 };