Skip to contentSkip to conversation

2.6.8.1 compile failed.

PATCH Jim Nelson 2 participants 2 messages Oct 1, 2004 Memory technology devices (MTD)

lore
Share & tools
lore

Jim Nelson

author
#0 lore raw

It looks like struct map_info (in include/linux/mtd/map.h) uses 'bankwidth' instead of 'buswidth'.

A question from a relative newbie (just getting started in kernel hacking) - is there a focus on 2.6 development exclusively in this list or is there some attempt to maintain 2.4 compatibility? Although I can understand either way, I'd like to know if there needs to be an effort to maintain backwards compatibility.

Patch to drivers/mtd/chips/amd_flash.c included.

------------------------------------------------------------------------

amd_flash_fix.c renamed from amd_flash.c +0 -0
@@ -140,11 +140,11 @@
 

static inline __u32 wide_read(struct map_info *map, __u32 addr) {
- if (map->buswidth == 1) {

+	if (map->bankwidth == 1) {
		return map_read8(map, addr);
-	} else if (map->buswidth == 2) {
+	} else if (map->bankwidth == 2) {
		return map_read16(map, addr);
-	} else if (map->buswidth == 4) {
+	} else if (map->bankwidth == 4) {
		return map_read32(map, addr);
        }

@@ -153,11 +153,11 @@

static inline void wide_write(struct map_info *map, __u32 val, __u32 addr) {
- if (map->buswidth == 1) {

+	if (map->bankwidth == 1) {
		map_write8(map, val, addr);
-	} else if (map->buswidth == 2) {
+	} else if (map->bankwidth == 2) {
		map_write16(map, val, addr);
-	} else if (map->buswidth == 4) {
+	} else if (map->bankwidth == 4) {
		map_write32(map, val, addr);
	}
}
@@ -176,16 +176,16 @@
static inline void send_unlock(struct map_info *map, unsigned long base)
{
	wide_write(map, (CMD_UNLOCK_DATA_1 << 16) | CMD_UNLOCK_DATA_1,
-		   base + (map->buswidth * ADDR_UNLOCK_1));
+		   base + (map->bankwidth * ADDR_UNLOCK_1));
	wide_write(map, (CMD_UNLOCK_DATA_2 << 16) | CMD_UNLOCK_DATA_2,

- base + (map->buswidth * ADDR_UNLOCK_2));
+ base + (map->bankwidth * ADDR_UNLOCK_2));
}

static inline void send_cmd(struct map_info *map, unsigned long base, __u32 cmd)

{
	send_unlock(map, base);
	wide_write(map, make_cmd(map, cmd),

- base + (map->buswidth * ADDR_UNLOCK_1));
+ base + (map->bankwidth * ADDR_UNLOCK_1));
}

static inline void send_cmd_to_addr(struct map_info *map, unsigned long base, @@ -199,7 +199,7 @@
int interleave)
{

- if ((interleave == 2) && (map->buswidth == 4)) {

+	if ((interleave == 2) && (map->bankwidth == 4)) {
		__u32 read1, read2;

		read1 = wide_read(map, addr);
@@ -220,8 +220,8 @@
{
	/* Sector lock address. A6 = 1 for unlock, A6 = 0 for lock */
	int SLA = unlock ?

- (sect_addr | (0x40 * map->buswidth)) :
- (sect_addr & ~(0x40 * map->buswidth)) ;
+ (sect_addr | (0x40 * map->bankwidth)) :
+ (sect_addr & ~(0x40 * map->bankwidth)) ;

	__u32 cmd = make_cmd(map, CMD_UNLOCK_SECTOR);

@@ -240,7 +240,7 @@

	send_cmd(map, sect_addr, CMD_MANUFACTURER_UNLOCK_DATA);

	/* status is 0x0000 for unlocked and 0x0001 for locked */
-	status = wide_read(map, sect_addr + (map->buswidth * ADDR_SECTOR_LOCK));
+	status = wide_read(map, sect_addr + (map->bankwidth * ADDR_SECTOR_LOCK));
	wide_write(map, CMD_RESET_DATA, 0);
	return status;
}
@@ -326,10 +326,10 @@
	send_cmd(map, base, CMD_RESET_DATA);
	send_cmd(map, base, CMD_MANUFACTURER_UNLOCK_DATA);

- mfr_id = wide_read(map, base + (map->buswidth * ADDR_MANUFACTURER));
- dev_id = wide_read(map, base + (map->buswidth * ADDR_DEVICE_ID));
+ mfr_id = wide_read(map, base + (map->bankwidth * ADDR_MANUFACTURER));
+ dev_id = wide_read(map, base + (map->bankwidth * ADDR_DEVICE_ID));

- if ((map->buswidth == 4) && ((mfr_id >> 16) == (mfr_id & 0xffff)) &&
+ if ((map->bankwidth == 4) && ((mfr_id >> 16) == (mfr_id & 0xffff)) &&

	    ((dev_id >> 16) == (dev_id & 0xffff))) {
		mfr_id &= 0xffff;
		dev_id &= 0xffff;

@@ -353,12 +353,12 @@

mfr_id_other =
wide_read(map, chips[j].start +
- (map->buswidth *
+ (map->bankwidth *

								ADDR_MANUFACTURER
							       ));
					dev_id_other =
						wide_read(map, chips[j].start +
-					    		       (map->buswidth *
+					    		       (map->bankwidth *
							        ADDR_DEVICE_ID));
					if (temp.interleave == 2) {
						mfr_id_other &= 0xffff;
@@ -975,8 +975,8 @@
	chipstart = private->chips[chipnum].start;

	/* If it's not bus-aligned, do the first byte write. */
-	if (ofs & (map->buswidth - 1)) {
-		unsigned long bus_ofs = ofs & ~(map->buswidth - 1);
+	if (ofs & (map->bankwidth - 1)) {
+		unsigned long bus_ofs = ofs & ~(map->bankwidth - 1);
		int i = ofs - bus_ofs;
		int n = 0;
		u_char tmp_buf[4];

@@ -984,13 +984,13 @@

		map_copy_from(map, tmp_buf,
			       bus_ofs + private->chips[chipnum].start,

- map->buswidth);
- while (len && i < map->buswidth)
+ map->bankwidth);
+ while (len && i < map->bankwidth)

			tmp_buf[i++] = buf[n++], len--;

- if (map->buswidth == 2) {

+		if (map->bankwidth == 2) {
			datum = *(__u16*)tmp_buf;
-		} else if (map->buswidth == 4) {
+		} else if (map->bankwidth == 4) {
			datum = *(__u32*)tmp_buf;
		} else {
			return -EINVAL;  /* should never happen, but be safe */
@@ -1016,14 +1016,14 @@
	}
	
	/* We are now aligned, write as much as possible. */
-	while(len >= map->buswidth) {
+	while(len >= map->bankwidth) {
		__u32 datum;

- if (map->buswidth == 1) {

+		if (map->bankwidth == 1) {
			datum = *(__u8*)buf;
-		} else if (map->buswidth == 2) {
+		} else if (map->bankwidth == 2) {
			datum = *(__u16*)buf;
-		} else if (map->buswidth == 4) {
+		} else if (map->bankwidth == 4) {
			datum = *(__u32*)buf;
		} else {
			return -EINVAL;
@@ -1035,10 +1035,10 @@
			return ret;
		}

- ofs += map->buswidth;
- buf += map->buswidth;
- (*retlen) += map->buswidth;
- len -= map->buswidth;
+ ofs += map->bankwidth;
+ buf += map->bankwidth;
+ (*retlen) += map->bankwidth;
+ len -= map->bankwidth;

		if (ofs >> private->chipshift) {
			chipnum++;
@@ -1050,21 +1050,21 @@
		}
	}

- if (len & (map->buswidth - 1)) {

+	if (len & (map->bankwidth - 1)) {
		int i = 0, n = 0;
		u_char tmp_buf[2];
		__u32 datum;

		map_copy_from(map, tmp_buf,
			       ofs + private->chips[chipnum].start,
-			       map->buswidth);
+			       map->bankwidth);
		while (len--) {
			tmp_buf[i++] = buf[n++];
		}

- if (map->buswidth == 2) {

+		if (map->bankwidth == 2) {
			datum = *(__u16*)tmp_buf;
-		} else if (map->buswidth == 4) {
+		} else if (map->bankwidth == 4) {
			datum = *(__u32*)tmp_buf;
		} else {
			return -EINVAL;  /* should never happen, but be safe */
#1 lore raw
Quoted 5 lines · Jim Nelson

A question from a relative newbie (just getting started in kernel hacking) - is there a focus on 2.6 development exclusively in this list or is there some attempt to maintain 2.4 compatibility? Although I can understand either way, I'd like to know if there needs to be an effort to maintain backwards compatibility.

There's maybe an _attempt_ but no _effort_. That is; if we can easily choose to make changes in a way which doesn't make it break on 2.4 we will, but we won't go to any _trouble_.

The 2.4 kernel is an old, stable kernel. If it works for you that's great and you should continue using it. If it _doesn't_ then you should be using 2.6.

Quoted 1 line

Patch to drivers/mtd/chips/amd_flash.c included.

I left that broken on purpose. That driver has been obsoleted by jedec_probe and the CFI command set driver.

Signature · 1 line
dwmw2