r3969 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Tue Jan 29 05:25:15 CET 2008


Author: werner
Date: 2008-01-29 05:25:10 +0100 (Tue, 29 Jan 2008)
New Revision: 3969

Added:
   trunk/src/target/u-boot/patches/gta02-nor.patch
Log:
This patch adds the minimum infrastructure necessary for having a correct
"mtdparts" variable that contains the NOR partition, and still making sure that
u-boot understands the partition layout.

CFG_MTDPARTS_PREFIX is admittedly a bit of a hack. Should probably extend the
dynparts logic to handle multiple devices.

Note that this patch isn't in "series" yet. There's more to come.

gta02-nor.patch:
- drivers/mtd/nand/nand_bbt.c (nand_create_mtd_dynpart): if CFG_MTDPARTS_PREFIX
  is defined, prepend it to the "mtdparts" setting
- include/configs/neo1973_gta02.h: added CFG_MTDPARTS_PREFIX with the NOR
  prefix
- include/configs/neo1973_gta02.h (CONFIG_EXTRA_ENV_SETTINGS): changed root
  from /dev/mtdblock4 to /dev/mtdblock5
- include/configs/neo1973_gta02.h (CONFIG_CMD_FLASH, CFG_MAX_FLASH_BANKS, 
  CFG_MAX_FLASH_SECT, MTDIDS_DEFAULT), board/neo1973/gta02/Makefile,
  board/neo1973/gta02/nor.c: added pro forma NOR support
- include/configs/neo1973_gta02.h: removed CFG_NO_FLASH
- drivers/usb/usbdfu.c (get_partition_nand): search for the first NAND device
  instead of just assuming that the first entry is the right one



Added: trunk/src/target/u-boot/patches/gta02-nor.patch
===================================================================
--- trunk/src/target/u-boot/patches/gta02-nor.patch	2008-01-28 14:16:57 UTC (rev 3968)
+++ trunk/src/target/u-boot/patches/gta02-nor.patch	2008-01-29 04:25:10 UTC (rev 3969)
@@ -0,0 +1,155 @@
+Index: u-boot/board/neo1973/gta02/Makefile
+===================================================================
+--- u-boot.orig/board/neo1973/gta02/Makefile
++++ u-boot/board/neo1973/gta02/Makefile
+@@ -25,7 +25,7 @@
+ 
+ LIB	= lib$(BOARD).a
+ 
+-OBJS	:= gta02.o pcf50633.o nand.o ../common/cmd_neo1973.o \
++OBJS	:= gta02.o pcf50633.o nand.o nor.o ../common/cmd_neo1973.o \
+ 	   ../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
+ SOBJS	:= ../common/lowlevel_init.o
+ 
+Index: u-boot/board/neo1973/gta02/nor.c
+===================================================================
+--- /dev/null
++++ u-boot/board/neo1973/gta02/nor.c
+@@ -0,0 +1,30 @@
++#include <common.h>
++
++
++flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
++
++
++ulong flash_init (void)
++{
++	flash_info[0].sector_count = 1;
++	flash_info[0].start[0] = 0x18000000;
++	memset(flash_info[0].protect, 0, CFG_MAX_FLASH_SECT);
++	return flash_info[0].size = 0x200000;
++}
++
++
++void flash_print_info (flash_info_t * info)
++{
++}
++
++
++int flash_erase (flash_info_t * info, int s_first, int s_last)
++{
++	return ERR_PROG_ERROR;
++}
++
++
++int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
++{
++	return ERR_PROG_ERROR;
++}
+Index: u-boot/include/configs/neo1973_gta02.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973_gta02.h
++++ u-boot/include/configs/neo1973_gta02.h
+@@ -100,6 +100,7 @@
+ 			/* CFG_CMD_HWFLOW	 | */ \
+ #define CONFIG_CMD_SAVES
+ #define CONFIG_CMD_NAND
++#define CONFIG_CMD_FLASH
+ #define CONFIG_CMD_PORTIO
+ #define CONFIG_CMD_MMC
+ #define CONFIG_CMD_FAT
+@@ -188,7 +189,7 @@
+ 
+ #define CONFIG_EXTRA_ENV_SETTINGS 					\
+ 	"usbtty=cdc_acm\0"						\
+-	"bootargs_base=rootfstype=jffs2 root=/dev/mtdblock4 console=ttySAC2,115200 console=tty0 loglevel=8\0" \
++	"bootargs_base=rootfstype=jffs2 root=/dev/mtdblock5 console=ttySAC2,115200 console=tty0 loglevel=8\0" \
+ 	""
+ 
+ /*-----------------------------------------------------------------------
+@@ -203,9 +204,6 @@
+  * FLASH and environment organization
+  */
+ 
+-/* No NOR flash in this device */
+-#define CFG_NO_FLASH		1
+-
+ #define	CFG_ENV_IS_IN_NAND	1
+ #define CFG_ENV_SIZE		0x40000	/* 128k Total Size of Environment Sector */
+ #define CFG_ENV_OFFSET_OOB	1	/* Location of ENV stored in block 0 OOB */
+@@ -274,9 +272,13 @@
+ #define CONFIG_DRIVER_PCF50633		1
+ #define	CONFIG_RTC_PCF50633		1
+ 
+-#define MTDIDS_DEFAULT	"nand0=neo1973-nand"
++#define MTDIDS_DEFAULT	"nor0=physmap-flash,nand0=neo1973-nand"
+ #define MTPARTS_DEFAULT	"neo1973-nand:256k(u-boot),128k(u-boot_env),2M(kernel),640k(splash),-(rootfs)"
++#define CFG_MTDPARTS_PREFIX "physmap-flash:-(nor);"
+ #define CFG_NAND_DYNPART_MTD_KERNEL_NAME "neo1973-nand"
+ #define CONFIG_NAND_DYNPART
+ 
++#define CFG_MAX_FLASH_BANKS 1
++#define CFG_MAX_FLASH_SECT 1
++
+ #endif	/* __CONFIG_H */
+Index: u-boot/drivers/mtd/nand/nand_bbt.c
+===================================================================
+--- u-boot.orig/drivers/mtd/nand/nand_bbt.c
++++ u-boot/drivers/mtd/nand/nand_bbt.c
+@@ -1071,7 +1071,11 @@
+ 	if (!mtdparts)
+ 		return -ENOMEM;
+ 
+-	sprintf(mtdparts, "mtdparts=" CFG_NAND_DYNPART_MTD_KERNEL_NAME ":");
++	sprintf(mtdparts, "mtdparts="
++#ifdef CFG_MTDPARTS_PREFIX
++	    CFG_MTDPARTS_PREFIX
++#endif
++	    CFG_NAND_DYNPART_MTD_KERNEL_NAME ":");
+ 
+ 	for (part = 0; dynpart_size[part] != 0; part++) {
+ 		unsigned int bb_delta = 0;
+Index: u-boot/drivers/usb/usbdfu.c
+===================================================================
+--- u-boot.orig/drivers/usb/usbdfu.c
++++ u-boot/drivers/usb/usbdfu.c
+@@ -112,25 +112,28 @@
+ {
+ 	struct mtd_device *dev;
+ 	struct part_info *part;
++	struct list_head *dentry;
+ 	struct list_head *pentry;
+ 	int i;
+ 
+ 	if (mtdparts_init())
+ 		return NULL;
+-	if (list_empty(&devices))
+-		return NULL;
+ 
+-	dev = list_entry(devices.next, struct mtd_device, link);
+-	i = 0;
+-	list_for_each(pentry, &dev->parts) {
+-		if (i == idx)  {
+-			part = list_entry(pentry, struct part_info, link);
+-			return part;
++	list_for_each(dentry, &devices) {
++		dev = list_entry(dentry, struct mtd_device, link);
++		if (dev->id->type == MTD_DEV_TYPE_NAND) {
++			i = 0;
++			list_for_each(pentry, &dev->parts) {
++				if (i == idx)  {
++					part = list_entry(pentry,
++					    struct part_info, link);
++					return part;
++				}
++				i++;
++			}
++			return NULL;
+ 		}
+-		i++;
+ 	}
+-
+-	return NULL;
+ }
+ 
+ #define LOAD_ADDR ((unsigned char *)0x32000000)





More information about the commitlog mailing list