Skip to contentSkip to conversation

debug_print macros support

PATCH New Prafulla Wadaskar 7 participants 50 messages Apr 3, 2009 – May 26, 2009

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

PATCH 1/1 debug_print macros support

From: prafulla_wadaskar <[email protected]>

This debug_prints strategy provides-
A. pre-formatted debug and print macros to be used in a code B. flexiblility to enable selective debug prints without
modifying a source code
For more details refer doc/README.debug_prints

---
 config.mk               |    6 +++
 doc/README.debug_prints |   89 +++++++++++++++++++++++++++++++++++++++++++++++
 include/debug_prints.h  |   83 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 178 insertions(+), 0 deletions(-)
 create mode 100644 doc/README.debug_prints
 create mode 100644 include/debug_prints.h
config.mk +6 -0
index b1254e9..6e85cb5 100644
@@ -198,6 +198,12 @@ ifeq ($(PCI_CLOCK),PCI_66M)
 CFLAGS := $(CFLAGS) -DPCI_66M
 endif
 
+CFLAGS := $(CFLAGS) $(shell for dbgprn in $(DEBUG_PRINTS); do \
+			if [ "$$dbgprn" != "" ]; then \
+				echo "-D$$dbgprn "; \
+			fi ;	\
+		done)
+
 #########################################################################
 
 export	HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \
doc/README.debug_prints new file +89 -0

89 lines not on this page · raw message

include/debug_prints.h new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
1.5.3.3
#1 lore raw

PATCH 1/1 bin_dep.sh Support

From: prafulla_wadaskar <[email protected]>

In some cases the u-boot.bin need to be processed further to create bootable u-boot binary from boot device This processing may be cpu,soc and/or board spcific bin_dep.sh provides a mechanism to execute bin_dep.sh if present in above platform specific folders

---
 Makefile         |    2 +
 tools/bin_dep.sh |   79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100755 tools/bin_dep.sh
Makefile +2 -0
index f857641..8bf36ce 100644
@@ -318,6 +318,7 @@ $(obj)u-boot.srec:	$(obj)u-boot
 
 $(obj)u-boot.bin:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+		@./tools/bin_dep.sh $(CPU) $(BOARD) $(VENDOR) $(SOC) $@
 
 $(obj)u-boot.ldr:	$(obj)u-boot
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
@@ -3506,6 +3507,7 @@ clean:
 	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
 	       $(obj)tools/mkimage	   $(obj)tools/mpc86x_clk	  \
 	       $(obj)tools/ncb		   $(obj)tools/ubsha1
+	@./tools/bin_dep.sh $(CPU) $(BOARD) $(VENDOR) $(SOC) $@
 	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
 	       $(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin}	  \
 	       $(obj)board/trab/trab_fkt   $(obj)board/voiceblue/eeprom   \
tools/bin_dep.sh new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.5.3.3
#2 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Tested by: prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +
 drivers/mtd/spi/macronix.c  |  319 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c |    6 +-
 3 files changed, 325 insertions(+), 1 deletions(-)
 create mode 100644 drivers/mtd/spi/macronix.c
drivers/mtd/spi/Makefile +1 -0
index 3d4f892..e527eff 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi_flash.a
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/mtd/spi/macronix.c new file +319 -0

319 lines not on this page · raw message

drivers/mtd/spi/spi_flash.c +5 -1
index d1d81af..bafdfe7 100644
@@ -3,7 +3,6 @@
  *
  * Copyright (C) 2008 Atmel Corporation
  */
-#define DEBUG
 #include <common.h>
 #include <malloc.h>
 #include <spi.h>
@@ -134,6 +133,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		flash = spi_flash_probe_atmel(spi, idcode);
 		break;
 #endif
+#ifdef CONFIG_SPI_FLASH_MACRONIX
+	case 0xc2:
+		flash = spi_flash_probe_macronix(spi, idcode);
+		break;
+#endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:
 		flash = spi_flash_probe_stmicro(spi, idcode);
Signature · 1 line
1.5.3.3
#3 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

drivers/mtd/spi/Makefile LIB := $(obj)libspi_flash.a · line 31

Quoted 7 lines · On Friday 03 April 2009 07:49:19 Prafulla Wadaskar wrote:
drivers/mtd/spi/Makefile +1 -0
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi_flash.a
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o

please keep the list sorted

drivers/mtd/spi/macronix.c line 1

Quoted 4 lines
drivers/mtd/spi/macronix.c new file +1 -0
@@ -0,0 +1,319 @@
+ * Based on drivers/mtd/spi/stmicor.c

typo in file name

drivers/mtd/spi/macronix.c line 31

Quoted 6 lines
drivers/mtd/spi/macronix.c new file +6 -0
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+#include <common.h>

please add a new line there

drivers/mtd/spi/macronix.c line 49

Quoted 13 lines
drivers/mtd/spi/macronix.c new file +13 -0
+/* MX25Pxx-specific commands */
+#define CMD_MX25PXX_WREN	0x06	/* Write Enable */
+#define CMD_MX25PXX_WRDI	0x04	/* Write Disable */
+#define CMD_MX25PXX_RDSR	0x05	/* Read Status Register */
+#define CMD_MX25PXX_WRSR	0x01	/* Write Status Register */
+#define CMD_MX25PXX_READ	0x03	/* Read Data Bytes */
+#define CMD_MX25PXX_FAST_READ	0x0b	/* Read Data Bytes at Higher Speed */
+#define CMD_MX25PXX_PP		0x02	/* Page Program */
+#define CMD_MX25PXX_SE		0x20	/* Sector Erase */
+#define CMD_MX25PXX_BE		0xD8	/* Block Erase */
+#define CMD_MX25PXX_CE		0xc7	/* Chip Erase */
+#define CMD_MX25PXX_DP		0xb9	/* Deep Power-down */
+#define CMD_MX25PXX_RES		0xab	/* Release from DP, and Read Signature */

is it really MX25PXX ? or should it be MX25XX ? the P looks like a hold over from the stmicro driver.

drivers/mtd/spi/macronix.c line 73

Quoted 4 lines
drivers/mtd/spi/macronix.c new file +4 -0
+struct macronix_spi_flash {
+	const struct macronix_spi_flash_params *params;
+	struct spi_flash flash;
+};

the spi_flash struct needs to be the first member in order to prevent crashes when working with the spi flash layer

drivers/mtd/spi/macronix.c line 100

Quoted 3 lines
drivers/mtd/spi/macronix.c new file +3 -0
+	u8 cmd[4] = { CMD_MX25PXX_RDSR, 0xff, 0xff, 0xff };
+
+	ret = spi_xfer(spi, 32, &cmd[0], NULL, SPI_XFER_BEGIN);

do you actually need to read/write 4 bytes here ? shouldnt it be:
u8 cmd = CMD_MX25PXX_RDSR;
ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);

drivers/mtd/spi/macronix.c line 102

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +2 -0
+	if (ret) {
+		debug("SF: Failed to send command %02x: %d\n", cmd[0], ret);

then you'll need to change to "cmd"

drivers/mtd/spi/macronix.c line 295

Quoted 8 lines
drivers/mtd/spi/macronix.c new file +8 -0
+			debug("SF: STMicro Page Program failed\n");
+	debug("SF: STMicro: Successfully programmed %u bytes @ 0x%x\n",
+	      len, offset);
+			debug("SF: STMicro page erase failed\n");
+			debug("SF: STMicro page erase timed out\n");
+	debug("SF: STMicro: Successfully erased %u bytes @ 0x%x\n",
+	      len * sector_size, offset);
+		debug("SF: Unsupported STMicro ID %02x\n", id[1]);

this isnt STMicro anymore ...

drivers/mtd/spi/macronix.c line 261

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +2 -0
+		/* Up to 2 seconds */
+		ret = macronix_wait_ready(flash, 2 * CONFIG_SYS_HZ);

there's a common flash erase timeout define

drivers/mtd/spi/macronix.c line 40

Quoted 1 line
drivers/mtd/spi/macronix.c new file +1 -0
+*spi_flash_probe_macronix(struct spi_slave *spi, u8 * idcode)

no space between "*" and "idcode"

drivers/mtd/spi/macronix.c line 285

Quoted 5 lines
drivers/mtd/spi/macronix.c new file +5 -0
+	u8 id[3];
+
+	ret = spi_flash_cmd(spi, CMD_READ_ID, id, sizeof(id));
+	if (ret)
+		return NULL;

no need to read id here ... use the idcode passed in to you

drivers/mtd/spi/macronix.c line 291

Quoted 3 lines
drivers/mtd/spi/macronix.c new file +3 -0
+		if (params->idcode1 == idcode[2]) {
+			break;
+		}

drop the {} braces

drivers/mtd/spi/spi_flash.c line 8

Quoted 10 lines
drivers/mtd/spi/spi_flash.c +0 -1
@@ -3,7 +3,6 @@
  *
  * Copyright (C) 2008 Atmel Corporation
  */
-#define DEBUG
 #include <common.h>
 #include <malloc.h>
 #include <spi.h>

please drop this hunk ... it doesnt belong in this patch (and it's already been merged elsewhere)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090403/0c24ba2e/attachment.pgp

#4 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 10 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Friday, April 03, 2009 7:44 PM
To: u-boot at lists.denx.de
Cc: Prafulla Wadaskar; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] Macronix MX25xx MTD SPI flash driver

On Friday 03 April 2009 07:49:19 Prafulla Wadaskar wrote:

Quoted 9 lines

drivers/mtd/spi/Makefile LIB := $(obj)libspi_flash.a · line 31

Quoted 7 lines
drivers/mtd/spi/Makefile +1 -0
@@ -28,6 +28,7 @@ LIB	:= $(obj)libspi_flash.a
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o

please keep the list sorted

Done..

Quoted 7 lines

drivers/mtd/spi/macronix.c line 1

Quoted 5 lines
drivers/mtd/spi/macronix.c new file +1 -0
@@ -0,0 +1,319 @@
+ * Based on drivers/mtd/spi/stmicor.c

typo in file name

Corrected..

Quoted 10 lines

drivers/mtd/spi/macronix.c line 2

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +1 -0
+ * You should have received a copy of the GNU General 

Public License

drivers/mtd/spi/macronix.c line 31

Quoted 5 lines
drivers/mtd/spi/macronix.c new file +5 -0
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+#include <common.h>

please add a new line there

Added..

Quoted 17 lines

drivers/mtd/spi/macronix.c

Quoted 8 lines
drivers/mtd/spi/macronix.c new file +7 -0
+/* MX25Pxx-specific commands */
+#define CMD_MX25PXX_WREN	0x06	/* Write Enable */
+#define CMD_MX25PXX_WRDI	0x04	/* Write Disable */
+#define CMD_MX25PXX_RDSR	0x05	/* Read Status Register */
+#define CMD_MX25PXX_WRSR	0x01	/* Write Status Register */
+#define CMD_MX25PXX_READ	0x03	/* Read Data Bytes */
+#define CMD_MX25PXX_FAST_READ	0x0b	/* Read Data 

Bytes at Higher Speed */

drivers/mtd/spi/macronix.c

Quoted 6 lines
drivers/mtd/spi/macronix.c new file +6 -0
+#define CMD_MX25PXX_PP		0x02	/* Page Program */
+#define CMD_MX25PXX_SE		0x20	/* Sector Erase */
+#define CMD_MX25PXX_BE		0xD8	/* Block Erase */
+#define CMD_MX25PXX_CE		0xc7	/* Chip Erase */
+#define CMD_MX25PXX_DP		0xb9	/* Deep Power-down */
+#define CMD_MX25PXX_RES		0xab	/* Release from 

DP, and Read Signature */

Quoted 2 lines

is it really MX25PXX ? or should it be MX25XX ? the P looks like a hold over from the stmicro driver.

You are right
It should be MX25LXX for 3.0 volt operation And it should be MX27VXX for 2.5 volt operation To address a common driver for both, I am making it MX25XX

Quoted 8 lines

drivers/mtd/spi/macronix.c line 73

Quoted 5 lines
drivers/mtd/spi/macronix.c new file +4 -0
+struct macronix_spi_flash {
+	const struct macronix_spi_flash_params *params;
+	struct spi_flash flash;
+};

the spi_flash struct needs to be the first member in order to prevent crashes when working with the spi flash layer

Done..

Quoted 9 lines

drivers/mtd/spi/macronix.c line 100

Quoted 4 lines
drivers/mtd/spi/macronix.c new file +3 -0
+	u8 cmd[4] = { CMD_MX25PXX_RDSR, 0xff, 0xff, 0xff };
+
+	ret = spi_xfer(spi, 32, &cmd[0], NULL, SPI_XFER_BEGIN);

do you actually need to read/write 4 bytes here ? shouldnt it be:
u8 cmd = CMD_MX25PXX_RDSR;
ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);

Yes, I have checked specs too, we need only 8bit transfer here Done...

Quoted 6 lines

drivers/mtd/spi/macronix.c line 29

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +2 -0
+	if (ret) {
+		debug("SF: Failed to send command %02x: %d\n", 

cmd[0], ret);

then you'll need to change to "cmd"

Quoted 10 lines

drivers/mtd/spi/macronix.c line 295

Quoted 8 lines
drivers/mtd/spi/macronix.c new file +8 -0
+			debug("SF: STMicro Page Program failed\n");
+	debug("SF: STMicro: Successfully programmed %u bytes @ 0x%x\n",
+	      len, offset);
+			debug("SF: STMicro page erase failed\n");
+			debug("SF: STMicro page erase timed out\n");
+	debug("SF: STMicro: Successfully erased %u bytes @ 0x%x\n",
+	      len * sector_size, offset);
+		debug("SF: Unsupported STMicro ID %02x\n", id[1]);

this isnt STMicro anymore ...

Corrected... Very sorry for this :-(

Quoted 5 lines

drivers/mtd/spi/macronix.c line 261

Quoted 3 lines
drivers/mtd/spi/macronix.c new file +2 -0
+		/* Up to 2 seconds */
+		ret = macronix_wait_ready(flash, 2 * CONFIG_SYS_HZ);

there's a common flash erase timeout define

Block erase time for Micronix are different than specified in spi_flash_internals.h Hence MICRONIX spefic timouts defined and used in macronix.c

Quoted 4 lines

drivers/mtd/spi/macronix.c line 40

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +1 -0
+*spi_flash_probe_macronix(struct spi_slave *spi, u8 * idcode)

no space between "*" and "idcode"

Done..

Quoted 9 lines

drivers/mtd/spi/macronix.c line 285

Quoted 6 lines
drivers/mtd/spi/macronix.c new file +5 -0
+	u8 id[3];
+
+	ret = spi_flash_cmd(spi, CMD_READ_ID, id, sizeof(id));
+	if (ret)
+		return NULL;

no need to read id here ... use the idcode passed in to you

Done..

Quoted 5 lines

drivers/mtd/spi/macronix.c line 291

Quoted 3 lines
drivers/mtd/spi/macronix.c new file +3 -0
+		if (params->idcode1 == idcode[2]) {
+			break;
+		}

drop the {} braces

Dropped..

Quoted 14 lines

drivers/mtd/spi/spi_flash.c line 8

Quoted 11 lines
drivers/mtd/spi/spi_flash.c +0 -1
@@ -3,7 +3,6 @@
  *
  * Copyright (C) 2008 Atmel Corporation
  */
-#define DEBUG
 #include <common.h>
 #include <malloc.h>
 #include <spi.h>

please drop this hunk ... it doesnt belong in this patch (and it's already been merged elsewhere) -mike

Okay Dropped

I am ready with the updated patch,
How should I release it the community?
1. new patch with review feedback (with same name) Or
2. Delta on the top of previous patch

Any suggestion...?

Regards..
Prafulla . .

Quoted 1 line
#5 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 8 lines · On Monday 06 April 2009 03:23:30 Prafulla Wadaskar wrote:
Quoted 4 lines

drivers/mtd/spi/macronix.c line 261

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +2 -0
+		/* Up to 2 seconds */
+		ret = macronix_wait_ready(flash, 2 * CONFIG_SYS_HZ);

there's a common flash erase timeout define

Block erase time for Micronix are different than specified in spi_flash_internals.h Hence MICRONIX spefic timouts defined and used in macronix.c

every flash will have a different erase time, but i have a hard time believing you picked 2*HZ (2 seconds) because of your part's requirements. more likely you copied that from the stmicro driver (like every other spi flash driver until i cleaned them up). the latest tree increases the common timeouts to seconds rather than milliseconds, so unless your flash is truly truly awful and requires longer than that, you should use the common define.

Quoted 3 lines

I am ready with the updated patch,
How should I release it the community?
1. new patch with review feedback (with same name)

the current accepted practice is for you to:
- update the patch with all the comments
- add a "v2" to the subject (so it'd be "[PATCH v2] Macronix .....")
- in the comments section of the formatted patch (after the --- marker and
above the diffstat), add notes about what changed in the updated patch
- send it with the reply to header set to the last relevant message in the
patches' thread

Quoted 1 line

2. Delta on the top of previous patch

nooooooooo dont ever do this :)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/be05af06/attachment.pgp

#6 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 21 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Monday, April 06, 2009 1:09 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] Macronix MX25xx MTD SPI flash driver

Quoted 2 lines · On Monday 06 April 2009 03:23:30 Prafulla Wadaskar wrote:
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+		/* Up to 2 seconds */
+		ret = macronix_wait_ready(flash, 2 * 

CONFIG_SYS_HZ);

Quoted 5 lines
Quoted 2 lines

there's a common flash erase timeout define

Block erase time for Micronix are different than specified in spi_flash_internals.h Hence MICRONIX spefic timouts defined

and used

Quoted 1 line

in macronix.c

Quoted 8 lines

every flash will have a different erase time, but i have a hard time believing you picked 2*HZ (2 seconds) because of your part's requirements. more likely you copied that from the stmicro driver (like every other spi flash driver until i cleaned them up). the latest tree increases the common timeouts to seconds rather than milliseconds, so unless your flash is truly truly awful and requires longer than that, you should use the common define.

The MX25L12805D specifies Block erase max time to 2sec
Even sector erase time is higher (300milsec)
Specs can be found at (page 37) http://www.macronix.com/QuickPlace/hq/PageLibrary4825740B00298A3B.nsf/h_Index/7CE3021F57B8EA4848257412002E26CC/$File/MX25L12805D-1.1.pdf

Quoted 5 lines
Quoted 4 lines

I am ready with the updated patch,
How should I release it the community?
1. new patch with review feedback (with same name)

Quoted 8 lines

the current accepted practice is for you to:
- update the patch with all the comments
- add a "v2" to the subject (so it'd be "[PATCH v2] Macronix .....")
- in the comments section of the formatted patch (after the
--- marker and above the diffstat), add notes about what changed in the updated patch
- send it with the reply to header set to the last relevant
message in the patches' thread

I will do the needful accordingly

Quoted 4 lines
Quoted 2 lines

2. Delta on the top of previous patch

nooooooooo dont ever do this :)

Thanks....
Stored in my mind
Regards..
Prafulla . .

Quoted 2 lines

-mike

#7 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 20 lines · On Monday 06 April 2009 04:27:59 Prafulla Wadaskar wrote:

From: Mike Frysinger [mailto:vapier at gentoo.org]

Quoted 10 lines · On Monday 06 April 2009 03:23:30 Prafulla Wadaskar wrote:
Quoted 8 lines
Quoted 4 lines

drivers/mtd/spi/macronix.c line 261

Quoted 2 lines
drivers/mtd/spi/macronix.c new file +2 -0
+		/* Up to 2 seconds */
+		ret = macronix_wait_ready(flash, 2 * CONFIG_SYS_HZ);

there's a common flash erase timeout define

Block erase time for Micronix are different than specified in spi_flash_internals.h Hence MICRONIX spefic timouts defined and used in macronix.c

Quoted 8 lines

every flash will have a different erase time, but i have a hard time believing you picked 2*HZ (2 seconds) because of your part's requirements. more likely you copied that from the stmicro driver (like every other spi flash driver until i cleaned them up). the latest tree increases the common timeouts to seconds rather than milliseconds, so unless your flash is truly truly awful and requires longer than that, you should use the common define.

Quoted 1 line

The MX25L12805D specifies Block erase max time to 2sec

touche, i stand corrected

Quoted 1 line

Even sector erase time is higher (300milsec)

as i said, the latest code is updated to order of seconds. specifically, write is now 2 seconds while erase is 5 seconds. so both of these are OK for your chip and thus you should use them.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/f28f5acb/attachment.pgp

#8 lore raw

PATCH v2 1/1 Macroni ha ha ha ha ha

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Reviewed by: Mike Frysinger <[email protected]> Tested by: prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +
 drivers/mtd/spi/macronix.c  |  312 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c |    5 +
 3 files changed, 318 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/macronix.c
drivers/mtd/spi/Makefile +1 -0
index 3d4f892..2332249 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
 
 COBJS	:= $(COBJS-y)
drivers/mtd/spi/macronix.c new file +312 -0

312 lines not on this page · raw message

drivers/mtd/spi/spi_flash.c +5 -0
index d1d81af..be4c3ed 100644
@@ -134,6 +134,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		flash = spi_flash_probe_atmel(spi, idcode);
 		break;
 #endif
+#ifdef CONFIG_SPI_FLASH_MACRONIX
+	case 0xc2:
+		flash = spi_flash_probe_macronix(spi, idcode);
+		break;
+#endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:
 		flash = spi_flash_probe_stmicro(spi, idcode);
Signature · 1 line
1.5.3.3
#9 lore raw

PATCH v2 1/1 Macroni ha ha ha ha ha

Sorry
Pls ignore this email...

Regards..
Prafulla . .

Quoted 390 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Monday, April 06, 2009 9:23 PM
To: u-boot at lists.denx.de
Cc: Ronen Shitrit; Prafulla Wadaskar
Subject: [PATCH v2] Macroni ha ha ha ha ha

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Reviewed by: Mike Frysinger <[email protected]> Tested by:
prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +
 drivers/mtd/spi/macronix.c  |  312 
+++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c |    5 +
 3 files changed, 318 insertions(+), 0 deletions(-)  create 

mode 100644 drivers/mtd/spi/macronix.c

(quoted diff) +0 -0

b/drivers/mtd/spi/Makefile index 3d4f892..2332249 100644

drivers/mtd/spi/Makefile +1 -0
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
 
 COBJS	:= $(COBJS-y)
(quoted diff) +0 -0

b/drivers/mtd/spi/macronix.c new file mode 100644 index 0000000..c98d0e4

drivers/mtd/spi/macronix.c new file +41 -0
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2009(C) Marvell International Ltd. and its affiliates
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Based on drivers/mtd/spi/stmicro.c
+ *
+ * Copyright 2008, Network Appliance Inc.
+ * Jason McMullan <[email protected]>
+ *
+ * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * TsiChung Liew (Tsi-Chung.Liew at freescale.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <spi_flash.h>
+
+#include "spi_flash_internal.h"
+
+/* MX25xx-specific commands */
+#define CMD_MX25XX_WREN		0x06	/* Write Enable */
+#define CMD_MX25XX_WRDI		0x04	/* Write Disable */
+#define CMD_MX25XX_RDSR		0x05	/* Read Status 

Register */
+#define CMD_MX25XX_WRSR 0x01 /* Write Status
Register */

drivers/mtd/spi/macronix.c new file +2 -0
+#define CMD_MX25XX_READ		0x03	/* Read Data Bytes */
+#define CMD_MX25XX_FAST_READ	0x0b	/* Read Data Bytes at 

Higher Speed */

drivers/mtd/spi/macronix.c new file +6 -0
+#define CMD_MX25XX_PP		0x02	/* Page Program */
+#define CMD_MX25XX_SE		0x20	/* Sector Erase */
+#define CMD_MX25XX_BE		0xD8	/* Block Erase */
+#define CMD_MX25XX_CE		0xc7	/* Chip Erase */
+#define CMD_MX25XX_DP		0xb9	/* Deep Power-down */
+#define CMD_MX25XX_RES		0xab	/* Release from 

DP, and Read Signature */

drivers/mtd/spi/macronix.c new file +10 -0
+
+#define MXIC_ID_MX2516		0x15
+#define MXIC_ID_MX2520		0x12
+#define MXIC_ID_MX2532		0x16
+#define MXIC_ID_MX2540		0x13
+#define MXIC_ID_MX2564		0x17
+#define MXIC_ID_MX2580		0x14
+#define MXIC_ID_MX25128	0x18
+
+#define MACRONIX_SR_WIP		(1 << 0)	/* 

Write-in-Progress */

drivers/mtd/spi/macronix.c new file +15 -0
+
+struct macronix_spi_flash_params {
+	u8 idcode1;
+	u16 page_size;
+	u16 pages_per_sector;
+	u16 sectors_per_block;
+	u16 nr_blocks;
+	const char *name;
+};
+
+struct macronix_spi_flash {
+	struct spi_flash flash;
+	const struct macronix_spi_flash_params *params; };
+
+static inline struct macronix_spi_flash 

*to_macronix_spi_flash(struct spi_flash

drivers/mtd/spi/macronix.c new file +5 -0
+							     *flash)
+{
+	return container_of(flash, struct macronix_spi_flash, flash); }
+
+static const struct macronix_spi_flash_params 

macronix_spi_flash_table[] = {

drivers/mtd/spi/macronix.c new file +11 -0
+	{
+		.idcode1 = MXIC_ID_MX25128,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12805D",
+	},
+};
+
+static int macronix_wait_ready(struct spi_flash *flash, 

unsigned long

drivers/mtd/spi/macronix.c new file +10 -0
+timeout) {
+	struct spi_slave *spi = flash->spi;
+	unsigned long timebase;
+	int ret;
+	u8 status;
+	u8 cmd = CMD_MX25XX_RDSR;
+
+	ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);
+	if (ret) {
+		debug("SF: Failed to send command %02x: %d\n", 

cmd[0], ret);

drivers/mtd/spi/macronix.c new file +40 -0
+		return ret;
+	}
+
+	timebase = get_timer(0);
+	do {
+		ret = spi_xfer(spi, 8, NULL, &status, 0);
+		if (ret)
+			return -1;
+
+		if ((status & MACRONIX_SR_WIP) == 0)
+			break;
+
+	} while (get_timer(timebase) < timeout);
+
+	spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);
+
+	if ((status & MACRONIX_SR_WIP) == 0)
+		return 0;
+
+	/* Timed out */
+	return -1;
+}
+
+static int macronix_read_fast(struct spi_flash *flash,
+			     u32 offset, size_t len, void *buf) {
+	struct macronix_spi_flash *stm = to_macronix_spi_flash(flash);
+	unsigned long page_addr;
+	unsigned long page_size;
+	u8 cmd[5];
+
+	page_size = stm->params->page_size;
+	page_addr = offset / page_size;
+
+	cmd[0] = CMD_READ_ARRAY_FAST;
+	cmd[1] = page_addr >> 8;
+	cmd[2] = page_addr;
+	cmd[3] = offset % page_size;
+	cmd[4] = 0x00;
+
+	return spi_flash_read_common(flash, cmd, sizeof(cmd), 

buf, len); }

drivers/mtd/spi/macronix.c new file +33 -0
+
+static int macronix_write(struct spi_flash *flash,
+			 u32 offset, size_t len, const void *buf) {
+	struct macronix_spi_flash *stm = to_macronix_spi_flash(flash);
+	unsigned long page_addr;
+	unsigned long byte_addr;
+	unsigned long page_size;
+	size_t chunk_len;
+	size_t actual;
+	int ret;
+	u8 cmd[4];
+
+	page_size = stm->params->page_size;
+	page_addr = offset / page_size;
+	byte_addr = offset % page_size;
+
+	ret = spi_claim_bus(flash->spi);
+	if (ret) {
+		debug("SF: Unable to claim SPI bus\n");
+		return ret;
+	}
+
+	ret = 0;
+	for (actual = 0; actual < len; actual += chunk_len) {
+		chunk_len = min(len - actual, page_size - byte_addr);
+
+		cmd[0] = CMD_MX25XX_PP;
+		cmd[1] = page_addr >> 8;
+		cmd[2] = page_addr;
+		cmd[3] = byte_addr;
+
+		debug
+		    ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x 

} chunk_len = %d\n",

drivers/mtd/spi/macronix.c new file +1 -0
+		     buf + actual, cmd[0], cmd[1], cmd[2], 

cmd[3], chunk_len);

drivers/mtd/spi/macronix.c new file +2 -0
+
+		ret = spi_flash_cmd(flash->spi, 

CMD_MX25XX_WREN, NULL, 0);

drivers/mtd/spi/macronix.c new file +13 -0
+		if (ret < 0) {
+			debug("SF: Enabling Write failed\n");
+			break;
+		}
+
+		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
+					  buf + actual, chunk_len);
+		if (ret < 0) {
+			debug("SF: Macronix Page Program failed\n");
+			break;
+		}
+
+		ret = macronix_wait_ready(flash, 

SPI_FLASH_PROG_TIMEOUT);

drivers/mtd/spi/macronix.c new file +2 -0
+		if (ret < 0) {
+			debug("SF: Macronix page programming 

timed out\n");

drivers/mtd/spi/macronix.c new file +28 -0
+			break;
+		}
+
+		page_addr++;
+		byte_addr = 0;
+	}
+
+	debug("SF: Macronix: Successfully programmed %u bytes @ 0x%x\n",
+	      len, offset);
+
+	spi_release_bus(flash->spi);
+	return ret;
+}
+
+int macronix_erase(struct spi_flash *flash, u32 offset, size_t len) {
+	struct macronix_spi_flash *stm = to_macronix_spi_flash(flash);
+	unsigned long sector_size;
+	size_t actual;
+	int ret;
+	u8 cmd[4];
+
+	/*
+	 * This function currently uses sector erase only.
+	 * probably speed things up by using bulk erase
+	 * when possible.
+	 */
+
+	sector_size = stm->params->page_size * 

stm->params->pages_per_sector

drivers/mtd/spi/macronix.c new file +4 -0
+			* stm->params->sectors_per_block;
+
+	if (offset % sector_size || len % sector_size) {
+		debug("SF: Erase offset/length not multiple of 

sector size\n");

drivers/mtd/spi/macronix.c new file +19 -0
+		return -1;
+	}
+
+	len /= sector_size;
+	cmd[0] = CMD_MX25XX_BE;
+	cmd[2] = 0x00;
+	cmd[3] = 0x00;
+
+	ret = spi_claim_bus(flash->spi);
+	if (ret) {
+		debug("SF: Unable to claim SPI bus\n");
+		return ret;
+	}
+
+	ret = 0;
+	for (actual = 0; actual < len; actual++) {
+		cmd[1] = (offset / sector_size) + actual;
+
+		ret = spi_flash_cmd(flash->spi, 

CMD_MX25XX_WREN, NULL, 0);

drivers/mtd/spi/macronix.c new file +12 -0
+		if (ret < 0) {
+			debug("SF: Enabling Write failed\n");
+			break;
+		}
+
+		ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
+		if (ret < 0) {
+			debug("SF: Macronix page erase failed\n");
+			break;
+		}
+
+		ret = macronix_wait_ready(flash, 

SPI_FLASH_PAGE_ERASE_TIMEOUT);

drivers/mtd/spi/macronix.c new file +51 -0
+		if (ret < 0) {
+			debug("SF: Macronix page erase timed out\n");
+			break;
+		}
+	}
+
+	debug("SF: Macronix: Successfully erased %u bytes @ 0x%x\n",
+	      len * sector_size, offset);
+
+	spi_release_bus(flash->spi);
+	return ret;
+}
+
+struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 
+*idcode) {
+	const struct macronix_spi_flash_params *params;
+	struct macronix_spi_flash *stm;
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
+		params = &macronix_spi_flash_table[i];
+		if (params->idcode1 == idcode[2])
+			break;
+	}
+
+	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
+		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+		return NULL;
+	}
+
+	stm = malloc(sizeof(struct macronix_spi_flash));
+	if (!stm) {
+		debug("SF: Failed to allocate memory\n");
+		return NULL;
+	}
+
+	stm->params = params;
+	stm->flash.spi = spi;
+	stm->flash.name = params->name;
+
+	stm->flash.write = macronix_write;
+	stm->flash.erase = macronix_erase;
+	stm->flash.read = macronix_read_fast;
+	stm->flash.size = params->page_size * params->pages_per_sector
+	    * params->sectors_per_block * params->nr_blocks;
+
+	printf("SF: Detected %s with page size %u, total %u bytes\n",
+	      params->name, params->page_size, stm->flash.size);
+
+	return &stm->flash;
+}
(quoted diff) +0 -0

b/drivers/mtd/spi/spi_flash.c index d1d81af..be4c3ed 100644

drivers/mtd/spi/spi_flash.c +5 -0
@@ -134,6 +134,11 @@ struct spi_flash 
 *spi_flash_probe(unsigned int bus, unsigned int cs,
 		flash = spi_flash_probe_atmel(spi, idcode);
 		break;
 #endif
+#ifdef CONFIG_SPI_FLASH_MACRONIX
+	case 0xc2:
+		flash = spi_flash_probe_macronix(spi, idcode);
+		break;
+#endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:

flash = spi_flash_probe_stmicro(spi, idcode);
--
1.5.3.3

#10 lore raw

PATCH v2 1/1 Macroni ha ha ha ha ha

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 9 lines · In message <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Reviewed by: Mike Frysinger <[email protected]> Tested by: prafulla_wadaskar <[email protected]>

Do you think a commit messsage "Macroni ha ha ha ha ha" is adequate?

This is not funny. You are only wasting our time.

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The two most common things in the universe are hydrogen  and  stupi-
dity."
#11 lore raw

PATCH v2 1/1 Macroni ha ha ha ha ha

I already expressed my apology for the same..
Once again I am very sorry for the same.
Clearly my intention was not to waste your time. It was an accident I will take care not to happen such things ahead...
Hope you will understand me

Regards..
Prafulla . .

Quoted 38 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Monday, April 06, 2009 4:32 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v2] Macroni ha ha ha ha ha

Dear Prafulla Wadaskar,

In message

Quoted 7 lines · <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Reviewed by:

Quoted 2 lines

Mike Frysinger <[email protected]> Tested by: prafulla_wadaskar <[email protected]>

Do you think a commit messsage "Macroni ha ha ha ha ha" is adequate?

This is not funny. You are only wasting our time.

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: 
wd at denx.de "The two most common things in the universe are 
hydrogen  and  stupi- dity."
#12 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

In reply to Mike Frysinger

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Change log:
v2: typos corrected, MX25PXX renamed as MX25XX, spi_flash struct declared as first member,
RDSR command limited to 8bit transfer and cosmetic fixes

Reviewed by: Mike Frysinger <[email protected]> Tested by: prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +
 drivers/mtd/spi/macronix.c  |  312 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c |    5 +
 3 files changed, 318 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/macronix.c
drivers/mtd/spi/Makefile +1 -0
index 3d4f892..2332249 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
 
 COBJS	:= $(COBJS-y)
drivers/mtd/spi/macronix.c new file +312 -0

312 lines not on this page · raw message

drivers/mtd/spi/spi_flash.c +5 -0
index d1d81af..be4c3ed 100644
@@ -134,6 +134,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		flash = spi_flash_probe_atmel(spi, idcode);
 		break;
 #endif
+#ifdef CONFIG_SPI_FLASH_MACRONIX
+	case 0xc2:
+		flash = spi_flash_probe_macronix(spi, idcode);
+		break;
+#endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:
 		flash = spi_flash_probe_stmicro(spi, idcode);
Signature · 1 line
1.5.3.3
#13 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Hi Mike
I missed subject info (i.e. PATCH v2) is this a problem? Shall I send it again?

Regards..
Prafulla . .

Quoted 395 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Monday, April 06, 2009 9:25 PM
To: u-boot at lists.denx.de
Cc: Ronen Shitrit; Prafulla Wadaskar
Subject: [PATCH] Macronix MX25xx MTD SPI flash driver

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Change log:
v2: typos corrected, MX25PXX renamed as MX25XX, spi_flash struct declared as first member, RDSR command limited to 8bit transfer and cosmetic fixes

Reviewed by: Mike Frysinger <[email protected]> Tested by:
prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +
 drivers/mtd/spi/macronix.c  |  312 
+++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c |    5 +
 3 files changed, 318 insertions(+), 0 deletions(-)  create 

mode 100644 drivers/mtd/spi/macronix.c

(quoted diff) +0 -0

b/drivers/mtd/spi/Makefile index 3d4f892..2332249 100644

drivers/mtd/spi/Makefile +1 -0
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
 
 COBJS	:= $(COBJS-y)
(quoted diff) +0 -0

b/drivers/mtd/spi/macronix.c new file mode 100644 index 0000000..c98d0e4

drivers/mtd/spi/macronix.c new file +41 -0
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2009(C) Marvell International Ltd. and its affiliates
+ * Prafulla Wadaskar <[email protected]>
+ *
+ * Based on drivers/mtd/spi/stmicro.c
+ *
+ * Copyright 2008, Network Appliance Inc.
+ * Jason McMullan <[email protected]>
+ *
+ * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * TsiChung Liew (Tsi-Chung.Liew at freescale.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <spi_flash.h>
+
+#include "spi_flash_internal.h"
+
+/* MX25xx-specific commands */
+#define CMD_MX25XX_WREN		0x06	/* Write Enable */
+#define CMD_MX25XX_WRDI		0x04	/* Write Disable */
+#define CMD_MX25XX_RDSR		0x05	/* Read Status 

Register */
+#define CMD_MX25XX_WRSR 0x01 /* Write Status
Register */

drivers/mtd/spi/macronix.c new file +2 -0
+#define CMD_MX25XX_READ		0x03	/* Read Data Bytes */
+#define CMD_MX25XX_FAST_READ	0x0b	/* Read Data Bytes at 

Higher Speed */

drivers/mtd/spi/macronix.c new file +6 -0
+#define CMD_MX25XX_PP		0x02	/* Page Program */
+#define CMD_MX25XX_SE		0x20	/* Sector Erase */
+#define CMD_MX25XX_BE		0xD8	/* Block Erase */
+#define CMD_MX25XX_CE		0xc7	/* Chip Erase */
+#define CMD_MX25XX_DP		0xb9	/* Deep Power-down */
+#define CMD_MX25XX_RES		0xab	/* Release from 

DP, and Read Signature */

drivers/mtd/spi/macronix.c new file +10 -0
+
+#define MXIC_ID_MX2516		0x15
+#define MXIC_ID_MX2520		0x12
+#define MXIC_ID_MX2532		0x16
+#define MXIC_ID_MX2540		0x13
+#define MXIC_ID_MX2564		0x17
+#define MXIC_ID_MX2580		0x14
+#define MXIC_ID_MX25128	0x18
+
+#define MACRONIX_SR_WIP		(1 << 0)	/* 

Write-in-Progress */

drivers/mtd/spi/macronix.c new file +15 -0
+
+struct macronix_spi_flash_params {
+	u8 idcode1;
+	u16 page_size;
+	u16 pages_per_sector;
+	u16 sectors_per_block;
+	u16 nr_blocks;
+	const char *name;
+};
+
+struct macronix_spi_flash {
+	struct spi_flash flash;
+	const struct macronix_spi_flash_params *params; };
+
+static inline struct macronix_spi_flash 

*to_macronix_spi_flash(struct spi_flash

drivers/mtd/spi/macronix.c new file +5 -0
+							     *flash)
+{
+	return container_of(flash, struct macronix_spi_flash, flash); }
+
+static const struct macronix_spi_flash_params 

macronix_spi_flash_table[] = {

drivers/mtd/spi/macronix.c new file +11 -0
+	{
+		.idcode1 = MXIC_ID_MX25128,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12805D",
+	},
+};
+
+static int macronix_wait_ready(struct spi_flash *flash, 

unsigned long

drivers/mtd/spi/macronix.c new file +10 -0
+timeout) {
+	struct spi_slave *spi = flash->spi;
+	unsigned long timebase;
+	int ret;
+	u8 status;
+	u8 cmd = CMD_MX25XX_RDSR;
+
+	ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);
+	if (ret) {
+		debug("SF: Failed to send command %02x: %d\n", 

cmd[0], ret);

drivers/mtd/spi/macronix.c new file +40 -0
+		return ret;
+	}
+
+	timebase = get_timer(0);
+	do {
+		ret = spi_xfer(spi, 8, NULL, &status, 0);
+		if (ret)
+			return -1;
+
+		if ((status & MACRONIX_SR_WIP) == 0)
+			break;
+
+	} while (get_timer(timebase) < timeout);
+
+	spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);
+
+	if ((status & MACRONIX_SR_WIP) == 0)
+		return 0;
+
+	/* Timed out */
+	return -1;
+}
+
+static int macronix_read_fast(struct spi_flash *flash,
+			     u32 offset, size_t len, void *buf) {
+	struct macronix_spi_flash *stm = to_macronix_spi_flash(flash);
+	unsigned long page_addr;
+	unsigned long page_size;
+	u8 cmd[5];
+
+	page_size = stm->params->page_size;
+	page_addr = offset / page_size;
+
+	cmd[0] = CMD_READ_ARRAY_FAST;
+	cmd[1] = page_addr >> 8;
+	cmd[2] = page_addr;
+	cmd[3] = offset % page_size;
+	cmd[4] = 0x00;
+
+	return spi_flash_read_common(flash, cmd, sizeof(cmd), 

buf, len); }

drivers/mtd/spi/macronix.c new file +33 -0
+
+static int macronix_write(struct spi_flash *flash,
+			 u32 offset, size_t len, const void *buf) {
+	struct macronix_spi_flash *stm = to_macronix_spi_flash(flash);
+	unsigned long page_addr;
+	unsigned long byte_addr;
+	unsigned long page_size;
+	size_t chunk_len;
+	size_t actual;
+	int ret;
+	u8 cmd[4];
+
+	page_size = stm->params->page_size;
+	page_addr = offset / page_size;
+	byte_addr = offset % page_size;
+
+	ret = spi_claim_bus(flash->spi);
+	if (ret) {
+		debug("SF: Unable to claim SPI bus\n");
+		return ret;
+	}
+
+	ret = 0;
+	for (actual = 0; actual < len; actual += chunk_len) {
+		chunk_len = min(len - actual, page_size - byte_addr);
+
+		cmd[0] = CMD_MX25XX_PP;
+		cmd[1] = page_addr >> 8;
+		cmd[2] = page_addr;
+		cmd[3] = byte_addr;
+
+		debug
+		    ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x 

} chunk_len = %d\n",

drivers/mtd/spi/macronix.c new file +1 -0
+		     buf + actual, cmd[0], cmd[1], cmd[2], 

cmd[3], chunk_len);

drivers/mtd/spi/macronix.c new file +2 -0
+
+		ret = spi_flash_cmd(flash->spi, 

CMD_MX25XX_WREN, NULL, 0);

drivers/mtd/spi/macronix.c new file +13 -0
+		if (ret < 0) {
+			debug("SF: Enabling Write failed\n");
+			break;
+		}
+
+		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
+					  buf + actual, chunk_len);
+		if (ret < 0) {
+			debug("SF: Macronix Page Program failed\n");
+			break;
+		}
+
+		ret = macronix_wait_ready(flash, 

SPI_FLASH_PROG_TIMEOUT);

drivers/mtd/spi/macronix.c new file +2 -0
+		if (ret < 0) {
+			debug("SF: Macronix page programming 

timed out\n");

drivers/mtd/spi/macronix.c new file +28 -0
+			break;
+		}
+
+		page_addr++;
+		byte_addr = 0;
+	}
+
+	debug("SF: Macronix: Successfully programmed %u bytes @ 0x%x\n",
+	      len, offset);
+
+	spi_release_bus(flash->spi);
+	return ret;
+}
+
+int macronix_erase(struct spi_flash *flash, u32 offset, size_t len) {
+	struct macronix_spi_flash *stm = to_macronix_spi_flash(flash);
+	unsigned long sector_size;
+	size_t actual;
+	int ret;
+	u8 cmd[4];
+
+	/*
+	 * This function currently uses sector erase only.
+	 * probably speed things up by using bulk erase
+	 * when possible.
+	 */
+
+	sector_size = stm->params->page_size * 

stm->params->pages_per_sector

drivers/mtd/spi/macronix.c new file +4 -0
+			* stm->params->sectors_per_block;
+
+	if (offset % sector_size || len % sector_size) {
+		debug("SF: Erase offset/length not multiple of 

sector size\n");

drivers/mtd/spi/macronix.c new file +19 -0
+		return -1;
+	}
+
+	len /= sector_size;
+	cmd[0] = CMD_MX25XX_BE;
+	cmd[2] = 0x00;
+	cmd[3] = 0x00;
+
+	ret = spi_claim_bus(flash->spi);
+	if (ret) {
+		debug("SF: Unable to claim SPI bus\n");
+		return ret;
+	}
+
+	ret = 0;
+	for (actual = 0; actual < len; actual++) {
+		cmd[1] = (offset / sector_size) + actual;
+
+		ret = spi_flash_cmd(flash->spi, 

CMD_MX25XX_WREN, NULL, 0);

drivers/mtd/spi/macronix.c new file +12 -0
+		if (ret < 0) {
+			debug("SF: Enabling Write failed\n");
+			break;
+		}
+
+		ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
+		if (ret < 0) {
+			debug("SF: Macronix page erase failed\n");
+			break;
+		}
+
+		ret = macronix_wait_ready(flash, 

SPI_FLASH_PAGE_ERASE_TIMEOUT);

drivers/mtd/spi/macronix.c new file +51 -0
+		if (ret < 0) {
+			debug("SF: Macronix page erase timed out\n");
+			break;
+		}
+	}
+
+	debug("SF: Macronix: Successfully erased %u bytes @ 0x%x\n",
+	      len * sector_size, offset);
+
+	spi_release_bus(flash->spi);
+	return ret;
+}
+
+struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 
+*idcode) {
+	const struct macronix_spi_flash_params *params;
+	struct macronix_spi_flash *stm;
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
+		params = &macronix_spi_flash_table[i];
+		if (params->idcode1 == idcode[2])
+			break;
+	}
+
+	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
+		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+		return NULL;
+	}
+
+	stm = malloc(sizeof(struct macronix_spi_flash));
+	if (!stm) {
+		debug("SF: Failed to allocate memory\n");
+		return NULL;
+	}
+
+	stm->params = params;
+	stm->flash.spi = spi;
+	stm->flash.name = params->name;
+
+	stm->flash.write = macronix_write;
+	stm->flash.erase = macronix_erase;
+	stm->flash.read = macronix_read_fast;
+	stm->flash.size = params->page_size * params->pages_per_sector
+	    * params->sectors_per_block * params->nr_blocks;
+
+	printf("SF: Detected %s with page size %u, total %u bytes\n",
+	      params->name, params->page_size, stm->flash.size);
+
+	return &stm->flash;
+}
(quoted diff) +0 -0

b/drivers/mtd/spi/spi_flash.c index d1d81af..be4c3ed 100644

drivers/mtd/spi/spi_flash.c +5 -0
@@ -134,6 +134,11 @@ struct spi_flash 
 *spi_flash_probe(unsigned int bus, unsigned int cs,
 		flash = spi_flash_probe_atmel(spi, idcode);
 		break;
 #endif
+#ifdef CONFIG_SPI_FLASH_MACRONIX
+	case 0xc2:
+		flash = spi_flash_probe_macronix(spi, idcode);
+		break;
+#endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:

flash = spi_flash_probe_stmicro(spi, idcode);
--
1.5.3.3

#14 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 2 lines · On Monday 06 April 2009 06:46:29 Prafulla Wadaskar wrote:

I missed subject info (i.e. PATCH v2) is this a problem? Shall I send it again?

dont worry about it. the [PATCH ...] contents of the summary are dropped when merging into git. however, there is one other thing:

Quoted 13 lines
Quoted 13 lines

Subject: [PATCH] Macronix MX25xx MTD SPI flash driver

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Change log:
v2: typos corrected, MX25PXX renamed as MX25XX, spi_flash struct declared as first member, RDSR command limited to 8bit transfer and cosmetic fixes

Quoted 7 lines
Quoted 7 lines

Reviewed by: Mike Frysinger <[email protected]> Tested by:
prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +

the patch change log should go under that "---" rather than above it. the patch change log is to make reviewers' lives easier, not to go into the actual commit message. but dont worry about sending another patch, i'll just fix it up when i merge it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/802026ce/attachment.pgp

#15 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 24 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Monday, April 06, 2009 4:35 PM
To: u-boot at lists.denx.de
Cc: Prafulla Wadaskar; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] Macronix MX25xx MTD SPI flash driver

Quoted 4 lines
Quoted 4 lines

Change log:
v2: typos corrected, MX25PXX renamed as MX25XX, spi_flash struct declared as first member, RDSR command limited to 8bit

transfer and

Quoted 3 lines
Quoted 3 lines

cosmetic fixes

Reviewed by:

Quoted 6 lines
Quoted 6 lines

Mike Frysinger <[email protected]> Tested by:
prafulla_wadaskar <[email protected]>

---
 drivers/mtd/spi/Makefile    |    1 +
Quoted 7 lines

the patch change log should go under that "---" rather than above it. the patch change log is to make reviewers' lives easier, not to go into the actual commit message. but dont worry about sending another patch, i'll just fix it up when i merge it.
-mike

Okay Mike,
Thanks for your understanding.
I will keep quiet on this thread waiting this patch to get mainlined.

Regards..
Prafulla . .

#16 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

In reply to Prafulla Wadaskar

drivers/mtd/spi/Makefile LIB := $(obj)libspi_flash.a · line 31

Quoted 8 lines · On Monday 06 April 2009 11:54:43 Prafulla Wadaskar wrote:
drivers/mtd/spi/Makefile +1 -0
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o

when submitting patches, you should be developing them against mainline, not something older. trying to merge this patch would result in conflicts because this file has changed here.

drivers/mtd/spi/Makefile LIB := $(obj)libspi_flash.a

Quoted 4 lines
drivers/mtd/spi/Makefile +3 -0
+static int macronix_wait_ready(struct spi_flash *flash, unsigned long
...
+	if (ret) {
+		debug("SF: Failed to send command %02x: %d\n", cmd[0], ret);

looks like you forgot to change "cmd[0]" to "cmd"

since these are trivial and i'm in a good mood, i'll go ahead and fix up the conflicts and add them to my sf branch. but in the future please make sure to integrate these methodologies.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/4694e050/attachment.pgp

#17 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Dear Mike Frysinger,

Quoted 4 lines · In message <[email protected]> you wrote:

since these are trivial and i'm in a good mood, i'll go ahead and fix up the conflicts and add them to my sf branch. but in the future please make sure to integrate these methodologies.

Please don't or undo. The Signed-off-by: entry is not OK either, and we cannot change this.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have a theory that it's impossible to prove anything, but  I  can't
prove it.
#18 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 7 lines · On Monday 06 April 2009 14:15:23 Wolfgang Denk wrote:
Quoted 3 lines · In message Mike Frysinger

since these are trivial and i'm in a good mood, i'll go ahead and fix up the conflicts and add them to my sf branch. but in the future please make sure to integrate these methodologies.

Please don't or undo. The Signed-off-by: entry is not OK either, and we cannot change this.

how so ?

Prafulla: could you resubmit then ? the cleaned up patch i merged is here:
http://git.denx.de/?p=u-boot/u-boot-
blackfin.git;a=commitdiff;h=eddc6059da8dd71cbe84522b281b15b26dd927c7

the things i fixed:
- your name
- duplicate tags
- patch changelog in commit
- missing change to spi_flash_internal.h
- fixed Makefile conflicts
- cmd[0] vs cmd error
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/30b5ae08/attachment.pgp

#19 lore raw

PATCH v2 1/1 Macronix MX25xx MTD SPI flash driver

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

---
Change log:
v2: typos corrected, MX25PXX renamed as MX25XX, spi_flash struct declared as first member, struch ptr name stm changed to mcx
RDSR command limited to 8bit transfer and cosmetic fixes

 drivers/mtd/spi/Makefile             |    1 +
 drivers/mtd/spi/macronix.c           |  312 ++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c          |    5 +
 drivers/mtd/spi/spi_flash_internal.h |    1 +
 4 files changed, 319 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/macronix.c
drivers/mtd/spi/Makefile +1 -0
index a71b16e..27dcbff 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_SPANSION)	+= spansion.o
 COBJS-$(CONFIG_SPI_FLASH_SST)	+= sst.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
drivers/mtd/spi/macronix.c new file +312 -0

312 lines not on this page · raw message

drivers/mtd/spi/spi_flash.c +5 -0
index 274895a..0c83231 100644
@@ -134,6 +134,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		flash = spi_flash_probe_atmel(spi, idcode);
 		break;
 #endif
+#ifdef CONFIG_SPI_FLASH_MACRONIX
+	case 0xc2:
+		flash = spi_flash_probe_macronix(spi, idcode);
+		break;
+#endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:
 		flash = spi_flash_probe_stmicro(spi, idcode);
drivers/mtd/spi/spi_flash_internal.h +1 -0
index 5d1e395..0612383 100644
@@ -46,5 +46,6 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
 /* Manufacturer-specific probe functions */
 struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode);
 struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode);
+struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode);
 struct spi_flash *spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode);
 struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode);
Signature · 1 line
1.5.3.3
#20 lore raw

PATCH v2 1/1 Macronix MX25xx MTD SPI flash driver

Quoted 3 lines · On Tuesday 07 April 2009 10:17:37 Prafulla Wadaskar wrote:

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

ive added this to the blackfin repo in the sf branch, thanks
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090407/c0a74bfa/attachment.pgp

#21 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

In reply to Prafulla Wadaskar
Quoted 11 lines · On Monday 06 April 2009 11:54:43 Prafulla Wadaskar wrote:

From: prafulla_wadaskar <[email protected]>

Added macronix SF driver for MTD framework MX25L12805D is supported and tested
TBD: sector erase implementation, other deivces support

Change log:
v2: typos corrected, MX25PXX renamed as MX25XX, spi_flash struct declared as first member,
RDSR command limited to 8bit transfer and cosmetic fixes

Quoted 5 lines

Reviewed by: Mike Frysinger <[email protected]> Tested by: prafulla_wadaskar <[email protected]>

also i noticed these tags ... issues:
- duplicate Signed-off-by tags
- tag should have your proper name (so "Prafulla Wadaskar")
- tags are delimited by dashes, not spaces (so "Reviewed-by:")
- Tested-by is pretty much implied by Signed-off-by, so you dont need that if
the latter is present ... but that isnt a hard rule, and really only applies to the author of the patch rather than other people who have helped out.

i bet you've just misconfigured your GIT_AUTHOR_* vars or ~/.gitconfig (or however you're setting your name) so that it reads "prafulla_wadaskar" ... -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/42f3afb3/attachment.pgp

#22 lore raw

PATCH 1/1 Macronix MX25xx MTD SPI flash driver

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 4 lines · In message <[email protected]> you wrote:

Reviewed by: Mike Frysinger <[email protected]> Tested by: prafulla_wadaskar <[email protected]>

There are a couple of formal issues here:

Please change "Reviewed by:" into "Reviewed-by:" and "Tested by:" into "Tested-by:" - no, this is not nitpicking, some automated tools rely on the correct spelling.

Also, all these entries require a real name, so please change "prafulla_wadaskar" into "Prafulla Wadaskar".

Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wherever you go...There you are.                    - Buckaroo Banzai
#23 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 8 lines · In message <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

In some cases the u-boot.bin need to be processed further to create bootable u-boot binary from boot device This processing may be cpu,soc and/or board spcific bin_dep.sh provides a mechanism to execute bin_dep.sh if present in above platform specific folders

Quoted 6 lines
---
 Makefile         |    2 +
 tools/bin_dep.sh |   79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100755 tools/bin_dep.sh

I don't see use cases for this. This should probably remain out of tree.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I can't understand it. I can't even understand  the  people  who  can
understand it.                    - Queen Juliana of the Netherlands.
#24 lore raw

PATCH 1/1 bin_dep.sh Support

Quoted 25 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Friday, April 03, 2009 11:25 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] bin_dep.sh Support

Dear Prafulla Wadaskar,

In message

Quoted 4 lines · <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

In some cases the u-boot.bin need to be processed further to create bootable u-boot binary from boot device This processing may

be cpu,soc

Quoted 7 lines

and/or board spcific bin_dep.sh provides a mechanism to execute bin_dep.sh if present in above platform specific folders

---
 Makefile         |    2 +
 tools/bin_dep.sh |   79 
Quoted 7 lines

++++++++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 1 line
 2 files changed, 81 insertions(+), 0 deletions(-)  create 

mode 100755

Quoted 1 line

tools/bin_dep.sh

I don't see use cases for this. This should probably remain out of tree.

Dear Wolfgang Denk
Relevant use case will be Marvell Kirkwood SOC, this patch will be dependency for the same

Regards..
Prafulla . .

Quoted 13 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email:
wd at denx.de I can't understand it. I can't even understand the people who can
understand it. - Queen Juliana of the Netherlands.

#25 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Prafulla Wadaskar,

Quoted 6 lines · In message <[email protected]>…
Quoted 3 lines

I don't see use cases for this. This should probably remain out of tree.

Relevant use case will be Marvell Kirkwood SOC, this patch will be dependen cy for the same

It is obvious that you can invent some new stuff (or rather reinvent existing stuff) and then use it for your own boards.

The questions remain if this makes sense, and if this should be added to mainline.

#26 lore raw

PATCH 1/1 bin_dep.sh Support

Hi

I'm not sure we are on the same page here, the Kirkwood has an internal bootROM which can only boot an image if this image is wrapped by a specific header.

The do_image should take the u-boot bin and wrap it with this header.

How do u suggest we will support this header generation for the U-Boot?

Thanks for your help
Ronen Shitrit

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Monday, April 06, 2009 11:05 AM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] bin_dep.sh Support

Dear Prafulla Wadaskar,

Quoted 6 lines · In message <[email protected]>…
Quoted 3 lines

I don't see use cases for this. This should probably remain out of tree.

Relevant use case will be Marvell Kirkwood SOC, this patch will be dependen cy for the same

It is obvious that you can invent some new stuff (or rather reinvent existing stuff) and then use it for your own boards.

The questions remain if this makes sense, and if this should be added to mainline.

#27 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Ronen Shitrit,

Quoted 4 lines · In message <[email protected]>…

I'm not sure we are on the same page here, the Kirkwood has an internal bootROM which can only boot an image if this image is wrapped by a specific header.

What a stupid (read: broken) hardware design.

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

Quoted 3 lines

The do_image should take the u-boot bin and wrap it with this header.

How do u suggest we will support this header generation for the U-Boot?

Fix the hardware design?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"When anyone says `theoretically,' they really mean `not really.'"
- David Parnas
#28 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Ronen Shitrit,

Quoted 4 lines · In message <[email protected]>…

I'm not sure we are on the same page here, the Kirkwood has an internal bootROM which can only boot an image if this image is wrapped by a specific header.

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

[Ronen Shitrit] I still think we are not on the same page here.
This isn't another image format...
Why do we need the bootrom?
For example the KW doesn't have HW NAND ECC support :(
But we still want to support boot from NAND and ve protected from upto 4 bit ECC.
So the CPU wakes up and start running code from the bootROM (embedded ROM in the Kirkwood) this code read the NAND and verify its ECC, then according to the binary image header in the NAND it initialize the DRAM for this specific board and copy the binary image from the NAND to the DRAM and start running from there. I hope now its more clear...

Quoted 3 lines

The do_image should take the u-boot bin and wrap it with this header.

How do u suggest we will support this header generation for the U-Boot?

Fix the hardware design?
[Ronen Shitrit] probably won't happen...

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "When anyone says theoretically,' they really mean not really.'"
- David Parnas

#29 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Ronen Shitrit,

Quoted 6 lines · In message <[email protected]>…

Dear Ronen Shitrit,

In message <[email protected]>=

Quoted 1 line · you
Quoted 7 lines
Quoted 3 lines

I'm not sure we are on the same page here, the Kirkwood has an internal bootROM which can only boot an image if this image is wrapped by a specific header.

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

Could you please use standard quoting rules? See
http://www.netmeister.org/news/learn2quote.html

Aplso, please restrict your line lengh to some 70 characters or so.

Thanks.

Quoted 2 lines

[Ronen Shitrit] I still think we are not on the same page here. This isn't another image format...

But yes, it is.

Quoted 7 lines

Why do we need the bootrom?
For example the KW doesn't have HW NAND ECC support :(
But we still want to support boot from NAND and ve protected from upto 4 bi t ECC.
So the CPU wakes up and start running code from the bootROM (embedded ROM i n the Kirkwood) this code read the NAND and verify its ECC, then according to the binary image header in the NAND it initialize the DRAM for this spec

You see? "binary image header" Here you say yourself that this is a binary image header, i. e. a prorpietary image format.

Quoted 2 lines

Fix the hardware design?
[Ronen Shitrit] probably won't happen...

Though so.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
backups: always in season, never out of style.
#30 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Wolfgang Denk
Quoted 10 lines · On Monday 06 April 2009 04:24:39 Wolfgang Denk wrote:
Quoted 3 lines · In message Ronen Shitrit

I'm not sure we are on the same page here, the Kirkwood has an internal bootROM which can only boot an image if this image is wrapped by a specific header.

What a stupid (read: broken) hardware design.

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

true there are plenty of formats out there, but there arent really ones geared towards booting a processor. the ELF format is way too bloated/complex (and yet still not flexible enough) to be usable, and that's about the closest applicable format i'm familiar with. beyond the simple "processor will start execution at address XXXX", there isnt any standardization here.

the Blackfin processor too has a custom format (LDR) for booting code. it's akin to the PHDRs in ELF, plus some additional flag bits to control behavior. but in our world, i wrote external utilities to manage ELF->LDR conversion and so i didnt need a dedicated script in u-boot to do that ugly conversion mojo, just a new Makefile target (u-boot.ldr).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/0819dade/attachment.pgp

#31 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Mike,

Quoted 6 lines · in message <[email protected]> you wrote:

the Blackfin processor too has a custom format (LDR) for booting code. it's akin to the PHDRs in ELF, plus some additional flag bits to control behavior. but in our world, i wrote external utilities to manage ELF->LDR conversion and so i didnt need a dedicated script in u-boot to do that ugly conversion mojo, just a new Makefile target (u-boot.ldr).

...which seems to be an acceptable (to both sides) compromise to me.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"No matter where you go, there you are..."          - Buckaroo Banzai
#32 lore raw

PATCH 1/1 bin_dep.sh Support

Quoted 8 lines · On Monday 06 April 2009 05:16:02 Wolfgang Denk wrote:
Quoted 5 lines · in message Mike

the Blackfin processor too has a custom format (LDR) for booting code. it's akin to the PHDRs in ELF, plus some additional flag bits to control behavior. but in our world, i wrote external utilities to manage ELF->LDR conversion and so i didnt need a dedicated script in u-boot to do that ugly conversion mojo, just a new Makefile target (u-boot.ldr).

...which seems to be an acceptable (to both sides) compromise to me.

minus support for embedding the environment into the image ... i have a patch that adds an option to tools/envcrc to export the environment as a binary blob so that it can be passed to the external utility, but you wouldnt take it because you wanted me to fix my hardware instead ;).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/0cbe828b/attachment.pgp

#33 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Mike Frysinger,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines

...which seems to be an acceptable (to both sides) compromise to me.

minus support for embedding the environment into the image ... i have a patch that adds an option to tools/envcrc to export the environment as a binary blob so that it can be passed to the external utility, but you wouldnt take it because you wanted me to fix my hardware instead ;).

Not true. I can see that such a tool makes sense - it can be always usefult if you want to pre-initialize the environment on boards where the environment sector(s) is not embedded with the U-Boot image itself.

Just post your code :-)

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Athens  built  the  Acropolis.  Corinth  was  a   commercial   city,
interested  in  purely  materialistic things. Today we admire Athens,
visit it, preserve the old temples, yet we hardly ever  set  foot  in
Corinth."              - Dr. Harold Urey, Nobel Laureate in chemistry
#34 lore raw

PATCH 1/1 bin_dep.sh Support

Quoted 8 lines · On Monday 06 April 2009 06:28:33 Wolfgang Denk wrote:
Quoted 6 lines · In message Mike Frysinger
Quoted 1 line

...which seems to be an acceptable (to both sides) compromise to me.

minus support for embedding the environment into the image ... i have a patch that adds an option to tools/envcrc to export the environment as a binary blob so that it can be passed to the external utility, but you wouldnt take it because you wanted me to fix my hardware instead ;).

Quoted 6 lines

Not true. I can see that such a tool makes sense - it can be always usefult if you want to pre-initialize the environment on boards where the environment sector(s) is not embedded with the U-Boot image itself.

Just post your code :-)

ok, extracting the env as a blob isnt problematic, it's the addition of "ENV_IS_EMBEDDED_CUSTOM". the env is embedded in the final image that gets burned into flash, but not by u-boot. the external util takes cares of combining the u-boot ELF and the environment blob.

but i guess i can split the patch into (1) add --binary to tools/envcrc and
(2) add ENV_IS_EMBEDDED_CUSTOM. that way when (2) gets shot down again, at least (1) was added so it's one less thing for me to maintain out of tree. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/7e5aabd5/attachment-0001.pgp

#35 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Wolfgang Denk
Quoted 16 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Wolfgang Denk
Sent: Monday, April 06, 2009 2:46 PM
To: Mike Frysinger
Cc: u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] bin_dep.sh Support

Dear Mike,

Quoted 2 lines · in message <[email protected]> you wrote:

the Blackfin processor too has a custom format (LDR) for

booting code.

Quoted 8 lines
Quoted 1 line

it's akin to the PHDRs in ELF, plus some additional flag

bits to control behavior.

Quoted 2 lines

but in our world, i wrote external utilities to manage ELF->LDR conversion and so i didnt need a dedicated script in u-boot

to do that

Quoted 1 line

ugly conversion mojo, just a new Makefile target (u-boot.ldr).

...which seems to be an acceptable (to both sides) compromise to me.

I understood from the discussion so far that-
1. There are several cases where u-boot.bin does not help alone
2. in some cases there are external tools to be used for the conversion but ideally it is not possible to include each tool in a project

Let's consider specific case -
a board having serial console, flash, dram, a processor and supported u-boot.

As a user ideally I expect u-boot.bin generated by u-boot make
should go onto flash and board should work.
But if this doesn't work then how should we educate the uses and address their questions whereas he might have stumped flashing wrong u-boot.bin to his board...?

This is case with Kirkwood.
I don't think it is ONLY processor having this boot sequence architecture, there may be several in pipeline...who knows.
Kirkwood is today's need to be addressed.

In my opinion objective of any boot loader is to provide flashable binary.

Bin_dep.sh provides a framework inside u-boot,
whether to use it or not is sole decision of board/processor specific code. So why not include it :-)

Regards..
Prafulla . .

#36 lore raw

PATCH 1/1 bin_dep.sh Support

Quoted 2 lines · On Monday 06 April 2009 05:38:59 Prafulla Wadaskar wrote:

As a user ideally I expect u-boot.bin generated by u-boot make should go onto flash and board should work.

i disagree. u-boot.bin should be the exact flat binary of converting from the u-boot ELF file using objdump.

Quoted 3 lines

But if this doesn't work then how should we educate the uses and address their questions whereas he might have stumped flashing wrong u-boot.bin to his board...?

yes. we havent had a problem in the Blackfin world with educating people. if the bootrom is used, then they have to use u-boot.ldr. if they're using an older Blackfin part and the one bootmode that supports direct execution (the part starts running at a hardcoded address), then and only then can they use u-boot.bin.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/c3bde7fe/attachment.pgp

#37 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 6 lines · In message <[email protected]>…
Quoted 2 lines

...which seems to be an acceptable (to both sides) compromise to me.

I understood from the discussion so far that-
1. There are several cases where u-boot.bin does not help alone
2. in some cases there are external tools to be used for the conversion but ideally it is not possible to include each tool in a project

The U-Boot source tree includes the source code for the U-Boot boot loader. We do not attempt to include source code for all additional tools that may be needed to build a working U-Boot image - we don;t include GCC source code, nor binutils, nor any other tools that are not specific to U-Boot.

Quoted 2 lines

As a user ideally I expect u-boot.bin generated by u-boot make should go onto flash and board should work.

Not really. "u-boot.bin" is supposed to be a raw binary image; this may be directly executable on most processors, but depending on where and how it is stored additional provisions may be necessary. Such tools are out of the scope of the U-Boot project.

Quoted 2 lines

But if this doesn't work then how should we educate the uses and address their questions whereas he might have stumped flashing wrong u-boot.bin to his board...?

By providing adequate documentation?

You invent a processor with special requirements, so it seems only natural to me that you educate the users of your processor about the requirements.

Quoted 2 lines

I don't think it is ONLY processor having this boot sequence architecture, there may be several in pipeline...who knows.

Try and talk to your hardware design team about the problems such a complicated design is causing on the software side...

Quoted 3 lines

Bin_dep.sh provides a framework inside u-boot,
whether to use it or not is sole decision of board/processor specific code. So why not include it :-)

Because we do not attempt to include all possible code for any proprietary tool that may be needed to implement all the fancy stuff that might be useful for someone.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Given a choice between two theories, take the one which is funnier.
#38 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Prafulla Wadaskar
Quoted 3 lines · On Monday 06 April 2009 11:38:59 Prafulla Wadaskar wrote:

Bin_dep.sh provides a framework inside u-boot,
whether to use it or not is sole decision of board/processor specific code. So why not include it :-)

Since I'm currently working with a Kirkwood platform, I would like to "reactivate" this discussion about support for (external) tools for image creation.

On Kirkwood this image header can include the SDRAM intialization parameters (SDRAM controller registers settings). So this information which is currently *not* included in the Kirkwood U-Boot ports is very important and should be included into the U-Boot ports (from my point of view). Enabling support for such external tools or perhaps even including this tool directly into U-Boot seems to be the way to go for me. Then we could add this additional information like SDRAM init parameters into the U-Boot build process again. And it would be integrated into the mainline U-Boot git repository which is really important from my point of view.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#39 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Wolfgang Denk
Quoted 8 lines · Wolfgang Denk

Dear Ronen Shitrit,

Quoted 4 lines · In message <[email protected]>…

I'm not sure we are on the same page here, the Kirkwood has an internal bootROM which can only boot an image if this image is wrapped by a specific header.

Quoted 5 lines

What a stupid (read: broken) hardware design.

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

The same could be said about u-boot requiring its own image format (ELF and raw binary images can't be passed a device tree or bd_t, AFAICT).

-Scott

#40 lore raw

PATCH 1/1 bin_dep.sh Support

Dear Scott Wood,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

The same could be said about u-boot requiring its own image format (ELF and raw binary images can't be passed a device tree or bd_t, AFAICT).

When the U-Boot (or rather PPCBoot at that time) development was starte, there was a very important reason for not using ELF: wasting a full 64 kB for the standard ELF file header was unthinkable on most embedded devices of that time.

Now, on fat systems with ample resource on one side, and on the other side with the infrastructure more or less in place to compose a bootm command from small, separate building blocks, it should be not difficult to add such a feature, too.

On the other hand, ELF images are missing a few key points available in U-Boot images so I would not recommend using plain ELF for any system where reliability or just ease of use are important (which was the other part of the rationale that led to that format).

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The first rule of magic is simple. Don't waste your time waving your
hands and hoping when a rock or a club will do."
                                               - McCloctnik the Lucid
#41 lore raw

PATCH 1/1 bin_dep.sh Support

Quoted 18 lines · On Monday 06 April 2009 15:49:43 Wolfgang Denk wrote:
Quoted 6 lines · In message Scott Wood
Quoted 3 lines

There are tons of standards for image formats, and even more commonly used formats I would not dare to call standard; but this processor has to invent yet another one?

The same could be said about u-boot requiring its own image format (ELF and raw binary images can't be passed a device tree or bd_t, AFAICT).

When the U-Boot (or rather PPCBoot at that time) development was starte, there was a very important reason for not using ELF: wasting a full 64 kB for the standard ELF file header was unthinkable on most embedded devices of that time.

Now, on fat systems with ample resource on one side, and on the other side with the infrastructure more or less in place to compose a bootm command from small, separate building blocks, it should be not difficult to add such a feature, too.

Quoted 4 lines

On the other hand, ELF images are missing a few key points available in U-Boot images so I would not recommend using plain ELF for any system where reliability or just ease of use are important (which was the other part of the rationale that led to that format).

which are the same reasons processors do not implement support for ELF as a booting source ...

lets say i was to design a brand new part today with an on-chip rom that supports booting from a variety of sources (UART, SPI/I2C/NAND flashes, directly addressable NOR flashes, as a slave device to SPI/I2C, etc...), what format would you recommend that could satisfy all of these requirements ? i'm not aware of any which is why the Blackfin processor has its own stripped down LDR format.
-mike

#42 lore raw

PATCH 1/1 bin_dep.sh Support

In reply to Wolfgang Denk

Hi,

Quoted 18 lines

Dear Prafulla Wadaskar,

Quoted 8 lines · In message <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

In some cases the u-boot.bin need to be processed further to create bootable u-boot binary from boot device This processing may be cpu,soc and/or board spcific bin_dep.sh provides a mechanism to execute bin_dep.sh if present in above platform specific folders

Quoted 6 lines
---
 Makefile         |    2 +
 tools/bin_dep.sh |   79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100755 tools/bin_dep.sh
Quoted 2 lines

I don't see use cases for this. This should probably remain out of tree.

If the wrapping is needed to get a working U-Boot image for this specific board, I'll vote to add the code.

On the other hand, I wouldn't probably add this to the u-boot.bin target. A makefile should really specify what file is generated from what and generating an extra target in the u-boot.bin rule somewhat violates this rule.

I'd say, add another target and the script. Hopefully we can make this as generic as possible so that other boards needing this can only plug in their script.

Cheers
Detlev

Signature · 8 lines
I will use free software even if it is less powerful, or less reliable,
because freedom is the most important thing, and that is what the Free
Software movement is about.  How we get freedom.
                       -- Richard M. Stallman
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#43 lore raw

PATCH 1/1 bin_dep.sh Support

Quoted 28 lines

-----Original Message-----
From: Detlev Zundel [mailto:dzu at denx.de]
Sent: Monday, April 06, 2009 3:10 PM
To: Wolfgang Denk
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] bin_dep.sh Support

Hi,

Quoted 3 lines

Dear Prafulla Wadaskar,

In message

Quoted 3 lines · <[email protected]> you wrote:
Quoted 3 lines

From: prafulla_wadaskar <[email protected]>

In some cases the u-boot.bin need to be processed further

to create

Quoted 8 lines
Quoted 8 lines

bootable u-boot binary from boot device This processing may be cpu,soc and/or board spcific bin_dep.sh provides a mechanism to execute bin_dep.sh if present in above platform specific folders

---
 Makefile         |    2 +
 tools/bin_dep.sh |   79 

++++++++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
 2 files changed, 81 insertions(+), 0 deletions(-)  create mode 

100755 tools/bin_dep.sh

I don't see use cases for this. This should probably remain out of tree.

If the wrapping is needed to get a working U-Boot image for this specific board, I'll vote to add the code.

Dear Detlev
Thanks for your vote.

Regards..
Prafulla . .

#44 lore raw

PATCH 1/1 debug_print macros support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 9 lines · In message <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

This debug_prints strategy provides-
A. pre-formatted debug and print macros to be used in a code B. flexiblility to enable selective debug prints without
modifying a source code
For more details refer doc/README.debug_prints

This seems to be a lot of effort, from code to command line pollution
- for what exactly?

Which is the problem you are trying to solve?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wisdom is one of the few things that looks bigger the further away it
is.                               - Terry Pratchett, _Witches Abroad_
#45 lore raw

PATCH 1/1 debug_print macros support

Dear Wolfgang Denk

Quoted 19 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Friday, April 03, 2009 11:23 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] debug_print macros support

Dear Prafulla Wadaskar,

In message

Quoted 8 lines · <[email protected]> you wrote:

From: prafulla_wadaskar <[email protected]>

This debug_prints strategy provides-
A. pre-formatted debug and print macros to be used in a code B. flexiblility to enable selective debug prints without
modifying a source code
For more details refer doc/README.debug_prints

Quoted 6 lines
Quoted 1 line

This seems to be a lot of effort, from code to command line pollution
- for what exactly?

Which is the problem you are trying to solve?

If I understood current u-boot debugging properly, the debug statements are enabled by editing src file by adding "#define DEBUG"
Doing this the release contents will be tampered,
this may not be relevant from development point of view.
But the same release will be used by validation/testing/QA guys and to debug anything out of released contents, no one would like to tamper the source code subject to condition proper debugging strategy is in place.

Secondly, even during development it is a pain to enable/disable debug statements for their needs and finally remove them before release. I suffered this pain that's why discovered this strategy.

The suggested patch provides totally optional strategy that offers-
A) enabling selective debug statements without modifying source code
B) enabling selective debug statements only from specific source file/s
C) Last but not least- simple, small, easy to understand code.

Again.. it is an optional value added tool for u-boot developers :-)

Regards..
Prafulla . .

Quoted 13 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email:
wd at denx.de Wisdom is one of the few things that looks bigger the further away it
is. - Terry Pratchett, _Witches Abroad_

#46 lore raw

PATCH 1/1 debug_print macros support

Quoted 7 lines · On Monday 06 April 2009 01:32:30 Prafulla Wadaskar wrote:

If I understood current u-boot debugging properly, the debug statements are enabled by editing src file by adding "#define DEBUG" Doing this the release contents will be tampered,
this may not be relevant from development point of view.
But the same release will be used by validation/testing/QA guys and to debug anything out of released contents, no one would like to tamper the source code subject to condition proper debugging strategy is in place.

not really true ... you can do:
make DBGFLAGS=-DDEBUG

but that will probably enable debug() statements in a lot of things you dont care about ...

i dont really have an opinion on the idea in general
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/c530368d/attachment.pgp

#47 lore raw

PATCH 1/1 debug_print macros support

Quoted 19 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Monday, April 06, 2009 12:01 PM
To: u-boot at lists.denx.de
Cc: Prafulla Wadaskar; Wolfgang Denk; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH] debug_print macros support

Quoted 2 lines · On Monday 06 April 2009 01:32:30 Prafulla Wadaskar wrote:

If I understood current u-boot debugging properly, the debug statements are enabled by editing src file by adding

"#define DEBUG"

Quoted 3 lines

Doing this the release contents will be tampered, this may not be relevant from development point of view.
But the same release will be used by validation/testing/QA

guys and to

Quoted 1 line

debug anything out of released contents, no one would like

to tamper

Quoted 8 lines
Quoted 1 line

the source code subject to condition proper debugging

strategy is in place.

not really true ... you can do:
make DBGFLAGS=-DDEBUG

but that will probably enable debug() statements in a lot of things you dont care about ...

Even this can be resolved by this patch implementation Regards..
Prafulla . .

Quoted 3 lines

i dont really have an opinion on the idea in general -mike

#48 lore raw

PATCH 1/1 debug_print macros support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 8 lines · In message <[email protected]>…
Quoted 5 lines

This seems to be a lot of effort, from code to command line pollution
- for what exactly?

Which is the problem you are trying to solve?

If I understood current u-boot debugging properly, the debug statements are
enabled by editing src file by adding "#define DEBUG"
Doing this the release contents will be tampered,

This is just one way to solve this, which is most convenient when you want to enable debugging on a per-file level. Of course you can acchieve the same effect by just passing "-DDEBUG" as a compile option. The Makefile allows to do this globally - there are currently no fine-grained selections available by default.

On the other hand, this is debug code which is not supposed to be present in a production release, so modifying the source seems a minor issue to me.

Quoted 3 lines

But the same release will be used by validation/testing/QA guys and to debu g anything out of released contents, no one would like to tamper the source
code subject to condition proper debugging strategy is in place.

As mentioned, you can enable this by compile options as well.

Quoted 6 lines

The suggested patch provides totally optional strategy that offers-
A) enabling selective debug statements without modifying source code
B) enabling selective debug statements only from specific source file/s
C) Last but not least- simple, small, easy to understand code.

Again.. it is an optional value added tool for u-boot developers :-)

To be honest: I see more overhead added. Looks like overkill to me.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Even if you can deceive people about  a  product  through  misleading
statements, sooner or later the product will speak for itself.
- Hajime Karatsu
#49 lore raw

PATCH 1/1 debug_print macros support

Quoted 10 lines · On Monday 06 April 2009 03:56:39 Wolfgang Denk wrote:
Quoted 8 lines · In message Prafulla Wadaskar
Quoted 4 lines

This seems to be a lot of effort, from code to command line pollution
- for what exactly?

Which is the problem you are trying to solve?

If I understood current u-boot debugging properly, the debug statements are enabled by editing src file by adding "#define DEBUG" Doing this the release contents will be tampered,

Quoted 5 lines

This is just one way to solve this, which is most convenient when you want to enable debugging on a per-file level. Of course you can acchieve the same effect by just passing "-DDEBUG" as a compile option. The Makefile allows to do this globally - there are currently no fine-grained selections available by default.

i havent tested it, but i think this should get fine-grained flags in a flexible manner ? (the out of tree isnt exact, but you see what i'm after) -mike

config.mk +0 -0
index b1254e9..8791caa 100644
@@ -209,20 +209,20 @@ export	TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS 

CPPFLAGS CFLAGS AFLAGS
ifndef REMOTE_BUILD

%.s: %.S
- $(CPP) $(AFLAGS) -o $@ $<
+ $(CPP) $(AFLAGS) $(AFLAGS_$@) -o $@ $<
%.o: %.S
- $(CC) $(AFLAGS) -c -o $@ $<
+ $(CC) $(AFLAGS) $(AFLAGS_$@) -c -o $@ $<
%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CFLAGS_$@) -c -o $@ $<

else

$(obj)%.s: %.S
- $(CPP) $(AFLAGS) -o $@ $<
+ $(CPP) $(AFLAGS) $(AFLAGS_$@) -o $@ $<
$(obj)%.o: %.S
- $(CC) $(AFLAGS) -c -o $@ $<
+ $(CC) $(AFLAGS) $(AFLAGS_$@) -c -o $@ $<
$(obj)%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CFLAGS_$@) -c -o $@ $<
endif

#########################################################################

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090406/3b97a2d1/attachment.pgp