All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files
@ 2009-09-04  3:12 Mike Frysinger
  2009-09-04  3:12 ` [U-Boot] [PATCH 2/3] standalone: convert to kbuild style Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mike Frysinger @ 2009-09-04  3:12 UTC (permalink / raw)
  To: u-boot

Rather than maintain/extend the current ifeq($(ARCH)) mess that exists in
the standalone Makefile, push the setting up of LOAD_ADDR out to the arch
config.mk (and rename to STANDALONE_LOAD_ADDR in the process).  This keeps
the common code clean and lets the arch do whatever crazy crap it wants in
its own area.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 examples/standalone/Makefile |   65 +-----------------------------------------
 lib_arm/config.mk            |   10 ++++++
 lib_avr32/config.mk          |    2 +
 lib_blackfin/config.mk       |    2 +
 lib_i386/config.mk           |    2 +
 lib_m68k/config.mk           |    3 ++
 lib_microblaze/config.mk     |    2 +
 lib_mips/config.mk           |    2 +
 lib_nios/config.mk           |    2 +
 lib_nios2/config.mk          |    2 +
 lib_ppc/config.mk            |    2 +
 lib_sh/config.mk             |    5 +++
 lib_sparc/config.mk          |    2 +
 13 files changed, 37 insertions(+), 64 deletions(-)

diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index d2e811a..d469904 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -21,65 +21,6 @@
 # MA 02111-1307 USA
 #
 
-ifeq ($(ARCH),ppc)
-LOAD_ADDR = 0x40000
-endif
-
-ifeq ($(ARCH),i386)
-LOAD_ADDR = 0x40000
-endif
-
-ifeq ($(ARCH),arm)
-ifeq ($(BOARD),omap2420h4)
-LOAD_ADDR = 0x80300000
-else
-ifeq ($(SOC),omap3)
-LOAD_ADDR = 0x80300000
-else
-LOAD_ADDR = 0xc100000
-endif
-endif
-endif
-
-ifeq ($(ARCH),mips)
-LOAD_ADDR = 0x80200000 -T mips.lds
-endif
-
-ifeq ($(ARCH),nios)
-LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds
-endif
-
-ifeq ($(ARCH),nios2)
-LOAD_ADDR = 0x02000000 -L $(gcclibdir) -T nios2.lds
-endif
-
-ifeq ($(ARCH),m68k)
-LOAD_ADDR = 0x20000  -L $(clibdir)
-endif
-
-ifeq ($(ARCH),microblaze)
-LOAD_ADDR = 0x80F00000
-endif
-
-ifeq ($(ARCH),blackfin)
-LOAD_ADDR = 0x1000
-endif
-
-ifeq ($(ARCH),avr32)
-LOAD_ADDR = 0x00000000
-endif
-
-ifeq ($(ARCH),sh)
-LOAD_ADDR = 0x8C000000
-ifeq ($(CPU),sh2)
-BIG_ENDIAN=y
-endif
-endif
-
-ifeq ($(ARCH),sparc)
-LOAD_ADDR = 0x00000000 -L $(gcclibdir) -T sparc.lds
-endif
-
 include $(TOPDIR)/config.mk
 
 ELF	= hello_world
@@ -139,9 +80,6 @@ SREC	+= eepro100_eeprom.srec
 BIN	+= eepro100_eeprom.bin
 endif
 
-ifeq ($(BIG_ENDIAN),y)
-EX_LDFLAGS += -EB
-endif
 
 COBJS	:= $(SREC:.srec=.o)
 
@@ -164,7 +102,6 @@ BIN	:= $(addprefix $(obj),$(BIN))
 SREC	:= $(addprefix $(obj),$(SREC))
 
 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-clibdir := $(shell dirname `$(CC) $(CFLAGS) -print-file-name=libc.a`)
 
 CPPFLAGS += -I..
 
@@ -176,7 +113,7 @@ $(LIB):	$(obj).depend $(LIBOBJS)
 
 $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
-		$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
+		$(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
diff --git a/lib_arm/config.mk b/lib_arm/config.mk
index 705dfc3..3c078df 100644
--- a/lib_arm/config.mk
+++ b/lib_arm/config.mk
@@ -23,6 +23,16 @@
 
 CROSS_COMPILE ?= arm-linux-
 
+ifeq ($(BOARD),omap2420h4)
+STANDALONE_LOAD_ADDR = 0x80300000
+else
+ifeq ($(SOC),omap3)
+STANDALONE_LOAD_ADDR = 0x80300000
+else
+STANDALONE_LOAD_ADDR = 0xc100000
+endif
+endif
+
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
 # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
diff --git a/lib_avr32/config.mk b/lib_avr32/config.mk
index c258b4b..1121ca1 100644
--- a/lib_avr32/config.mk
+++ b/lib_avr32/config.mk
@@ -23,5 +23,7 @@
 
 CROSS_COMPILE ?= avr32-linux-
 
+STANDALONE_LOAD_ADDR = 0x00000000
+
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
 PLATFORM_LDFLAGS	+= --relax
diff --git a/lib_blackfin/config.mk b/lib_blackfin/config.mk
index 1267c99..3f560c9 100644
--- a/lib_blackfin/config.mk
+++ b/lib_blackfin/config.mk
@@ -23,6 +23,8 @@
 
 CROSS_COMPILE ?= bfin-uclinux-
 
+STANDALONE_LOAD_ADDR = 0x1000
+
 CONFIG_BFIN_CPU := $(strip $(subst ",,$(CONFIG_BFIN_CPU)))
 CONFIG_BFIN_BOOT_MODE := $(strip $(subst ",,$(CONFIG_BFIN_BOOT_MODE)))
 CONFIG_ENV_OFFSET := $(strip $(subst ",,$(CONFIG_ENV_OFFSET)))
diff --git a/lib_i386/config.mk b/lib_i386/config.mk
index 5fe36d5..4b990e0 100644
--- a/lib_i386/config.mk
+++ b/lib_i386/config.mk
@@ -23,4 +23,6 @@
 
 CROSS_COMPILE ?= i386-linux-
 
+STANDALONE_LOAD_ADDR = 0x40000
+
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
diff --git a/lib_m68k/config.mk b/lib_m68k/config.mk
index f41d1b3..749c389 100644
--- a/lib_m68k/config.mk
+++ b/lib_m68k/config.mk
@@ -23,5 +23,8 @@
 
 CROSS_COMPILE ?= m68k-elf-
 
+clibdir = $(shell dirname `$(CC) $(CFLAGS) -print-file-name=libc.a`)
+STANDALONE_LOAD_ADDR = 0x20000 -L $(clibdir)
+
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
diff --git a/lib_microblaze/config.mk b/lib_microblaze/config.mk
index 68e7e21..c3c9f95 100644
--- a/lib_microblaze/config.mk
+++ b/lib_microblaze/config.mk
@@ -26,4 +26,6 @@
 
 CROSS_COMPILE ?= mb-
 
+STANDALONE_LOAD_ADDR = 0x80F00000
+
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
diff --git a/lib_mips/config.mk b/lib_mips/config.mk
index c785677..aa06761 100644
--- a/lib_mips/config.mk
+++ b/lib_mips/config.mk
@@ -23,6 +23,8 @@
 
 CROSS_COMPILE ?= mips_4KC-
 
+STANDALONE_LOAD_ADDR = 0x80200000 -T mips.lds
+
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
 #
diff --git a/lib_nios/config.mk b/lib_nios/config.mk
index 3ed7170..d48aa6d 100644
--- a/lib_nios/config.mk
+++ b/lib_nios/config.mk
@@ -24,4 +24,6 @@
 
 CROSS_COMPILE ?= nios-elf-
 
+STANDALONE_LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds
+
 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs
diff --git a/lib_nios2/config.mk b/lib_nios2/config.mk
index 59931c2..34ee697 100644
--- a/lib_nios2/config.mk
+++ b/lib_nios2/config.mk
@@ -24,5 +24,7 @@
 
 CROSS_COMPILE ?= nios2-elf-
 
+STANDALONE_LOAD_ADDR = 0x02000000 -L $(gcclibdir) -T nios2.lds
+
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -ffixed-r15 -G0
diff --git a/lib_ppc/config.mk b/lib_ppc/config.mk
index d91ef7f..010d874 100644
--- a/lib_ppc/config.mk
+++ b/lib_ppc/config.mk
@@ -23,6 +23,8 @@
 
 CROSS_COMPILE ?= ppc_8xx-
 
+STANDALONE_LOAD_ADDR = 0x40000
+
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
 
diff --git a/lib_sh/config.mk b/lib_sh/config.mk
index 67d7e9e..fa5369f 100644
--- a/lib_sh/config.mk
+++ b/lib_sh/config.mk
@@ -23,6 +23,11 @@
 
 CROSS_COMPILE ?= sh4-linux-
 
+STANDALONE_LOAD_ADDR = 0x8C000000
+ifeq ($(CPU),sh2)
+STANDALONE_LOAD_ADDR += -EB
+endif
+
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
 PLATFORM_LDFLAGS += -e $(TEXT_BASE) --defsym reloc_dst=$(TEXT_BASE)
 
diff --git a/lib_sparc/config.mk b/lib_sparc/config.mk
index 07b528c..4de6515 100644
--- a/lib_sparc/config.mk
+++ b/lib_sparc/config.mk
@@ -23,4 +23,6 @@
 
 CROSS_COMPILE ?= sparc-elf-
 
+STANDALONE_LOAD_ADDR = 0x00000000 -L $(gcclibdir) -T sparc.lds
+
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
-- 
1.6.4.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] standalone: convert to kbuild style
  2009-09-04  3:12 [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Mike Frysinger
@ 2009-09-04  3:12 ` Mike Frysinger
  2009-09-04 21:07   ` Wolfgang Denk
  2009-09-04  3:12 ` [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2 Mike Frysinger
  2009-09-04 21:06 ` [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Wolfgang Denk
  2 siblings, 1 reply; 9+ messages in thread
From: Mike Frysinger @ 2009-09-04  3:12 UTC (permalink / raw)
  To: u-boot

Clean up the arch/cpu/board/config checks as well as redundant setting of
srec/bin variables by using the kbuild VAR-$(...) style.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 examples/standalone/Makefile |   96 ++++++++++++-----------------------------
 1 files changed, 28 insertions(+), 68 deletions(-)

diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index d469904..6c1e8b7 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -23,79 +23,39 @@
 
 include $(TOPDIR)/config.mk
 
-ELF	= hello_world
-SREC	= hello_world.srec
-BIN	= hello_world.bin
-
-ifeq ($(CPU),mpc8xx)
-ELF	+= test_burst
-SREC	+= test_burst.srec
-BIN	+= test_burst.bin
-endif
-
-ifeq ($(ARCH),i386)
-ELF	+= 82559_eeprom
-SREC	+= 82559_eeprom.srec
-BIN	+= 82559_eeprom.bin
-endif
-
-ifeq ($(ARCH),ppc)
-ELF	+= sched
-SREC	+= sched.srec
-BIN	+= sched.bin
-endif
-
-ifeq ($(ARCH),blackfin)
-BFIN_BIN = smc91111_eeprom smc911x_eeprom
-ELF	+= $(BFIN_BIN)
-SREC	+= $(addsuffix .srec,$(BFIN_BIN))
-BIN	+= $(addsuffix .bin,$(BFIN_BIN))
-endif
-
-# The following example is pretty 8xx specific...
-ifeq ($(CPU),mpc8xx)
-ELF	+= timer
-SREC	+= timer.srec
-BIN	+= timer.bin
-endif
-
-# The following example is 8260 specific...
-ifeq ($(CPU),mpc8260)
-ELF	+= mem_to_mem_idma2intr
-SREC	+= mem_to_mem_idma2intr.srec
-BIN	+= mem_to_mem_idma2intr.bin
-endif
-
-# Demo for 52xx IRQs
-ifeq ($(CPU),mpc5xxx)
-ELF	+= interrupt
-SREC	+= interrupt.srec
-BIN	+= interrupt.bin
-endif
-
-# Utility for resetting i82559 EEPROM
-ifeq ($(BOARD),oxc)
-ELF	+= eepro100_eeprom
-SREC	+= eepro100_eeprom.srec
-BIN	+= eepro100_eeprom.bin
-endif
-
-
-COBJS	:= $(SREC:.srec=.o)
+ELF-$(ARCH)  :=
+ELF-$(BOARD) :=
+ELF-$(CPU)   :=
+ELF-y        := hello_world
+
+ELF-$(CONFIG_SMC91111)           += smc91111_eeprom
+ELF-$(CONFIG_SMC911X)            += smc911x_eeprom
+ELF-i386                         += 82559_eeprom
+ELF-mpc5xxx                      += interrupt
+ELF-mpc8xx                       += test_burst timer
+ELF-mpc8260                      += mem_to_mem_idma2intr
+ELF-ppc                          += sched
+ELF-oxc                          += eepro100_eeprom
+
+ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))
+SREC = $(addsuffix .srec,$(ELF))
+BIN  = $(addsuffix .bin,$(ELF))
+
+COBJS	:= $(ELF:=.o)
 
 LIB	= $(obj)libstubs.a
-LIBAOBJS=
-ifeq ($(ARCH),ppc)
-LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
-endif
-ifeq ($(CPU),mpc8xx)
-LIBAOBJS+= test_burst_lib.o
-endif
-LIBCOBJS= stubs.o
+
+LIBAOBJS-$(ARCH)     :=
+LIBAOBJS-$(CPU)      :=
+LIBAOBJS-ppc         += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
+LIBAOBJS-mpc8xx      += test_burst_lib.o
+LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
+
+LIBCOBJS = stubs.o
 
 LIBOBJS	= $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
 
-SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S))
+SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
 OBJS	:= $(addprefix $(obj),$(COBJS))
 ELF	:= $(addprefix $(obj),$(ELF))
 BIN	:= $(addprefix $(obj),$(BIN))
-- 
1.6.4.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2
  2009-09-04  3:12 [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Mike Frysinger
  2009-09-04  3:12 ` [U-Boot] [PATCH 2/3] standalone: convert to kbuild style Mike Frysinger
@ 2009-09-04  3:12 ` Mike Frysinger
  2009-09-04 21:08   ` Wolfgang Denk
  2009-09-04 21:06 ` [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Wolfgang Denk
  2 siblings, 1 reply; 9+ messages in thread
From: Mike Frysinger @ 2009-09-04  3:12 UTC (permalink / raw)
  To: u-boot

Atmel DataFlashes by default operate with pages that are slightly bigger
than normal binary sizes (i.e. many are 1056 byte pages rather than 1024
bytes).  However, they also have a "power of 2" mode where the pages show
up with the normal binary size.  The latter mode is required in order to
boot with a Blackfin processor, so many people wish to convert their
DataFlashes on their development systems to this mode.  This standalone
application does just that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 examples/standalone/.gitignore      |    1 +
 examples/standalone/Makefile        |    1 +
 examples/standalone/atmel_df_pow2.c |  209 +++++++++++++++++++++++++++++++++++
 3 files changed, 211 insertions(+), 0 deletions(-)
 create mode 100644 examples/standalone/atmel_df_pow2.c

diff --git a/examples/standalone/.gitignore b/examples/standalone/.gitignore
index 0d1864c..7b783fc 100644
--- a/examples/standalone/.gitignore
+++ b/examples/standalone/.gitignore
@@ -1,4 +1,5 @@
 /82559_eeprom
+/atmel_df_pow2
 /hello_world
 /interrupt
 /mem_to_mem_idma2intr
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 6c1e8b7..5e2f2bc 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -30,6 +30,7 @@ ELF-y        := hello_world
 
 ELF-$(CONFIG_SMC91111)           += smc91111_eeprom
 ELF-$(CONFIG_SMC911X)            += smc911x_eeprom
+ELF-$(CONFIG_SPI_FLASH_ATMEL)    += atmel_df_pow2
 ELF-i386                         += 82559_eeprom
 ELF-mpc5xxx                      += interrupt
 ELF-mpc8xx                       += test_burst timer
diff --git a/examples/standalone/atmel_df_pow2.c b/examples/standalone/atmel_df_pow2.c
new file mode 100644
index 0000000..db0cd69
--- /dev/null
+++ b/examples/standalone/atmel_df_pow2.c
@@ -0,0 +1,209 @@
+/*
+ * atmel_df_pow2.c - convert Atmel Dataflashes to Power of 2 mode
+ *
+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the 2-clause BSD.
+ */
+
+#include <common.h>
+#include <exports.h>
+
+#define CMD_ID    0x9f
+#define CMD_STAT  0xd7
+#define CMD_CFG   0x3d
+
+static int flash_cmd(struct spi_slave *slave, uchar cmd, uchar *buf, int len)
+{
+	buf[0] = cmd;
+	return spi_xfer(slave, 8 * len, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
+}
+
+static int flash_status(struct spi_slave *slave)
+{
+	uchar buf[2];
+	if (flash_cmd(slave, CMD_STAT, buf, sizeof(buf)))
+		return -1;
+	return buf[1];
+}
+
+static int flash_set_pow2(struct spi_slave *slave)
+{
+	int ret;
+	uchar buf[4];
+
+	buf[1] = 0x2a;
+	buf[2] = 0x80;
+	buf[3] = 0xa6;
+
+	ret = flash_cmd(slave, CMD_CFG, buf, sizeof(buf));
+	if (ret)
+		return ret;
+
+	/* wait Tp, or 6 msec */
+	udelay(6000);
+
+	ret = flash_status(slave);
+	if (ret == -1)
+		return 1;
+
+	return ret & 0x1 ? 0 : 1;
+}
+
+static int flash_check(struct spi_slave *slave)
+{
+	int ret;
+	uchar buf[4];
+
+	ret = flash_cmd(slave, CMD_ID, buf, sizeof(buf));
+	if (ret)
+		return ret;
+
+	if (buf[1] != 0x1F) {
+		printf("atmel flash not found (id[0] = %#x)\n", buf[1]);
+		return 1;
+	}
+
+	if ((buf[2] >> 5) != 0x1) {
+		printf("AT45 flash not found (id[0] = %#x)\n", buf[2]);
+		return 2;
+	}
+
+	return 0;
+}
+
+static char *getline(void)
+{
+	static char buffer[100];
+	char c;
+	size_t i;
+
+	i = 0;
+	while (1) {
+		buffer[i] = '\0';
+
+		c = getc();
+
+		switch (c) {
+		case '\r':	/* Enter/Return key */
+		case '\n':
+			puts("\n");
+			return buffer;
+
+		case 0x03:	/* ^C - break */
+			return NULL;
+
+		case 0x5F:
+		case 0x08:	/* ^H  - backspace */
+		case 0x7F:	/* DEL - backspace */
+			if (i) {
+				puts("\b \b");
+				i--;
+			}
+			break;
+
+		default:
+			/* Ignore control characters */
+			if (c < 0x20)
+				break;
+			/* Queue up all other characters */
+			buffer[i++] = c;
+			printf("%c", c);
+			break;
+		}
+	}
+}
+
+int atmel_df_pow2(int argc, char *argv[])
+{
+	/* Print the ABI version */
+	app_startup(argv);
+	if (XF_VERSION != get_version()) {
+		printf("Expects ABI version %d\n", XF_VERSION);
+		printf("Actual U-Boot ABI version %lu\n", get_version());
+		printf("Can't run\n\n");
+		return 1;
+	}
+
+	spi_init();
+
+	while (1) {
+		struct spi_slave *slave;
+		char *line, *p;
+		int bus, cs, status;
+
+		puts("\nenter the [BUS:]CS of the SPI flash: ");
+		line = getline();
+
+		/* CTRL+C */
+		if (!line)
+			return 0;
+		if (line[0] == '\0')
+			continue;
+
+		bus = cs = simple_strtoul(line, &p, 10);
+		if (*p) {
+			if (*p == ':') {
+				++p;
+				cs = simple_strtoul(p, &p, 10);
+			}
+			if (*p) {
+				puts("invalid format, please try again\n");
+				continue;
+			}
+		} else
+			bus = 0;
+
+		printf("\ngoing to work with dataflash@%i:%i\n", bus, cs);
+
+		/* use a low speed -- it'll work with all devices, and
+		 * speed here doesn't really matter.
+		 */
+		slave = spi_setup_slave(bus, cs, 1000, SPI_MODE_3);
+		if (!slave) {
+			puts("unable to setup slave\n");
+			continue;
+		}
+
+		if (spi_claim_bus(slave)) {
+			spi_free_slave(slave);
+			continue;
+		}
+
+		if (flash_check(slave)) {
+			puts("no flash found\n");
+			goto done;
+		}
+
+		status = flash_status(slave);
+		if (status == -1) {
+			puts("unable to read status register\n");
+			goto done;
+		}
+		if (status & 0x1) {
+			puts("flash is already in power-of-2 mode!\n");
+			goto done;
+		}
+
+		puts("are you sure you wish to set power-of-2 mode?\n");
+		puts("this operation is permanent and irreversible\n");
+		printf("enter YES to continue: ");
+		line = getline();
+		if (!line || strcmp(line, "YES"))
+			goto done;
+
+		if (flash_set_pow2(slave)) {
+			puts("setting pow2 mode failed\n");
+			goto done;
+		}
+
+		puts(
+			"Configuration should be updated now.  You will have to\n"
+			"power cycle the part in order to finish the conversion.\n"
+		);
+
+ done:
+		spi_release_bus(slave);
+		spi_free_slave(slave);
+	}
+}
-- 
1.6.4.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files
  2009-09-04  3:12 [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Mike Frysinger
  2009-09-04  3:12 ` [U-Boot] [PATCH 2/3] standalone: convert to kbuild style Mike Frysinger
  2009-09-04  3:12 ` [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2 Mike Frysinger
@ 2009-09-04 21:06 ` Wolfgang Denk
  2 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-04 21:06 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <1252033969-28357-1-git-send-email-vapier@gentoo.org> you wrote:
> Rather than maintain/extend the current ifeq($(ARCH)) mess that exists in
> the standalone Makefile, push the setting up of LOAD_ADDR out to the arch
> config.mk (and rename to STANDALONE_LOAD_ADDR in the process).  This keeps
> the common code clean and lets the arch do whatever crazy crap it wants in
> its own area.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  examples/standalone/Makefile |   65 +-----------------------------------------
>  lib_arm/config.mk            |   10 ++++++
>  lib_avr32/config.mk          |    2 +
>  lib_blackfin/config.mk       |    2 +
>  lib_i386/config.mk           |    2 +
>  lib_m68k/config.mk           |    3 ++
>  lib_microblaze/config.mk     |    2 +
>  lib_mips/config.mk           |    2 +
>  lib_nios/config.mk           |    2 +
>  lib_nios2/config.mk          |    2 +
>  lib_ppc/config.mk            |    2 +
>  lib_sh/config.mk             |    5 +++
>  lib_sparc/config.mk          |    2 +
>  13 files changed, 37 insertions(+), 64 deletions(-)

Applied, thanks.

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
Vulcans never bluff.
	-- Spock, "The Doomsday Machine", stardate 4202.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] standalone: convert to kbuild style
  2009-09-04  3:12 ` [U-Boot] [PATCH 2/3] standalone: convert to kbuild style Mike Frysinger
@ 2009-09-04 21:07   ` Wolfgang Denk
  2009-09-04 23:54     ` [U-Boot] [PATCH 2/3 v2] " Mike Frysinger
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-04 21:07 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <1252033969-28357-2-git-send-email-vapier@gentoo.org> you wrote:
> Clean up the arch/cpu/board/config checks as well as redundant setting of
> srec/bin variables by using the kbuild VAR-$(...) style.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  examples/standalone/Makefile |   96 ++++++++++++-----------------------------
>  1 files changed, 28 insertions(+), 68 deletions(-)

This does not apply any more. Please rebase and repost. Thanks in
advance.

Applying: standalone: convert to kbuild style
error: patch failed: examples/standalone/Makefile:23
error: examples/standalone/Makefile: patch does not apply
fatal: sha1 information is lacking or useless (examples/standalone/Makefile).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001.
When you have resolved this problem run "git am -i -3 --resolved".
If you would prefer to skip this patch, instead run "git am -i -3 --skip".
To restore the original branch and stop patching run "git am -i -3 --abort".


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
"To take a significant step forward, you must make a series of finite
improvements." - Donald J. Atwood, General Motors

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2
  2009-09-04  3:12 ` [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2 Mike Frysinger
@ 2009-09-04 21:08   ` Wolfgang Denk
  2009-09-04 23:50     ` Mike Frysinger
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-04 21:08 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <1252033969-28357-3-git-send-email-vapier@gentoo.org> you wrote:
> Atmel DataFlashes by default operate with pages that are slightly bigger
> than normal binary sizes (i.e. many are 1056 byte pages rather than 1024
> bytes).  However, they also have a "power of 2" mode where the pages show
> up with the normal binary size.  The latter mode is required in order to
> boot with a Blackfin processor, so many people wish to convert their
> DataFlashes on their development systems to this mode.  This standalone
> application does just that.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  examples/standalone/.gitignore      |    1 +
>  examples/standalone/Makefile        |    1 +
>  examples/standalone/atmel_df_pow2.c |  209 +++++++++++++++++++++++++++++++++++
>  3 files changed, 211 insertions(+), 0 deletions(-)
>  create mode 100644 examples/standalone/atmel_df_pow2.c

I already applied your older patch, so this doesn't match any more.
Can you please check if the cuttet TOT is ok, otherwise please post an
incremental patch.

Thanks in advance.

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
Physician: One upon whom we set our hopes when ill and our dogs  when
well.                                                - Ambrose Bierce

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2
  2009-09-04 21:08   ` Wolfgang Denk
@ 2009-09-04 23:50     ` Mike Frysinger
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Frysinger @ 2009-09-04 23:50 UTC (permalink / raw)
  To: u-boot

On Friday 04 September 2009 17:08:49 Wolfgang Denk wrote:
> In message Mike Frysinger wrote:
> > Atmel DataFlashes by default operate with pages that are slightly bigger
> > than normal binary sizes (i.e. many are 1056 byte pages rather than 1024
> > bytes).  However, they also have a "power of 2" mode where the pages show
> > up with the normal binary size.  The latter mode is required in order to
> > boot with a Blackfin processor, so many people wish to convert their
> > DataFlashes on their development systems to this mode.  This standalone
> > application does just that.
> >
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> >  examples/standalone/.gitignore      |    1 +
> >  examples/standalone/Makefile        |    1 +
> >  examples/standalone/atmel_df_pow2.c |  209
> >  create mode 100644 examples/standalone/atmel_df_pow2.c
>
> I already applied your older patch, so this doesn't match any more.
> Can you please check if the cuttet TOT is ok, otherwise please post an
> incremental patch.

only difference was the Makefile, but i can merge that into the previous 
kbuild patch
-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/20090904/ae4c76dd/attachment.pgp 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3 v2] standalone: convert to kbuild style
  2009-09-04 21:07   ` Wolfgang Denk
@ 2009-09-04 23:54     ` Mike Frysinger
  2009-09-15 20:27       ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Mike Frysinger @ 2009-09-04 23:54 UTC (permalink / raw)
  To: u-boot

Clean up the arch/cpu/board/config checks as well as redundant setting of
srec/bin variables by using the kbuild VAR-$(...) style.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- update to latest master

 examples/standalone/Makefile |  101 ++++++++++++------------------------------
 1 files changed, 29 insertions(+), 72 deletions(-)

diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index bc98120..5e2f2bc 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -23,83 +23,40 @@
 
 include $(TOPDIR)/config.mk
 
-ELF	= hello_world
-SREC	= hello_world.srec
-BIN	= hello_world.bin
-
-ELF	+= atmel_df_pow2
-SREC	+= atmel_df_pow2.srec
-BIN	+= atmel_df_pow2.bin
-
-ifeq ($(CPU),mpc8xx)
-ELF	+= test_burst
-SREC	+= test_burst.srec
-BIN	+= test_burst.bin
-endif
-
-ifeq ($(ARCH),i386)
-ELF	+= 82559_eeprom
-SREC	+= 82559_eeprom.srec
-BIN	+= 82559_eeprom.bin
-endif
-
-ifeq ($(ARCH),ppc)
-ELF	+= sched
-SREC	+= sched.srec
-BIN	+= sched.bin
-endif
-
-ifeq ($(ARCH),blackfin)
-BFIN_BIN = smc91111_eeprom smc911x_eeprom
-ELF	+= $(BFIN_BIN)
-SREC	+= $(addsuffix .srec,$(BFIN_BIN))
-BIN	+= $(addsuffix .bin,$(BFIN_BIN))
-endif
-
-# The following example is pretty 8xx specific...
-ifeq ($(CPU),mpc8xx)
-ELF	+= timer
-SREC	+= timer.srec
-BIN	+= timer.bin
-endif
-
-# The following example is 8260 specific...
-ifeq ($(CPU),mpc8260)
-ELF	+= mem_to_mem_idma2intr
-SREC	+= mem_to_mem_idma2intr.srec
-BIN	+= mem_to_mem_idma2intr.bin
-endif
-
-# Demo for 52xx IRQs
-ifeq ($(CPU),mpc5xxx)
-ELF	+= interrupt
-SREC	+= interrupt.srec
-BIN	+= interrupt.bin
-endif
-
-# Utility for resetting i82559 EEPROM
-ifeq ($(BOARD),oxc)
-ELF	+= eepro100_eeprom
-SREC	+= eepro100_eeprom.srec
-BIN	+= eepro100_eeprom.bin
-endif
-
-
-COBJS	:= $(SREC:.srec=.o)
+ELF-$(ARCH)  :=
+ELF-$(BOARD) :=
+ELF-$(CPU)   :=
+ELF-y        := hello_world
+
+ELF-$(CONFIG_SMC91111)           += smc91111_eeprom
+ELF-$(CONFIG_SMC911X)            += smc911x_eeprom
+ELF-$(CONFIG_SPI_FLASH_ATMEL)    += atmel_df_pow2
+ELF-i386                         += 82559_eeprom
+ELF-mpc5xxx                      += interrupt
+ELF-mpc8xx                       += test_burst timer
+ELF-mpc8260                      += mem_to_mem_idma2intr
+ELF-ppc                          += sched
+ELF-oxc                          += eepro100_eeprom
+
+ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))
+SREC = $(addsuffix .srec,$(ELF))
+BIN  = $(addsuffix .bin,$(ELF))
+
+COBJS	:= $(ELF:=.o)
 
 LIB	= $(obj)libstubs.a
-LIBAOBJS=
-ifeq ($(ARCH),ppc)
-LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
-endif
-ifeq ($(CPU),mpc8xx)
-LIBAOBJS+= test_burst_lib.o
-endif
-LIBCOBJS= stubs.o
+
+LIBAOBJS-$(ARCH)     :=
+LIBAOBJS-$(CPU)      :=
+LIBAOBJS-ppc         += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
+LIBAOBJS-mpc8xx      += test_burst_lib.o
+LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
+
+LIBCOBJS = stubs.o
 
 LIBOBJS	= $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
 
-SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S))
+SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
 OBJS	:= $(addprefix $(obj),$(COBJS))
 ELF	:= $(addprefix $(obj),$(ELF))
 BIN	:= $(addprefix $(obj),$(BIN))
-- 
1.6.4.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3 v2] standalone: convert to kbuild style
  2009-09-04 23:54     ` [U-Boot] [PATCH 2/3 v2] " Mike Frysinger
@ 2009-09-15 20:27       ` Wolfgang Denk
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-15 20:27 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <1252108485-26641-1-git-send-email-vapier@gentoo.org> you wrote:
> Clean up the arch/cpu/board/config checks as well as redundant setting of
> srec/bin variables by using the kbuild VAR-$(...) style.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v2
> 	- update to latest master
> 
>  examples/standalone/Makefile |  101 ++++++++++++------------------------------
>  1 files changed, 29 insertions(+), 72 deletions(-)

Applied, thanks.

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
The connection between the language in which we think/program and the
problems and solutions we can imagine is very close. For this  reason
restricting  language  features  with  the intent of eliminating pro-
grammer errors is at best dangerous.
               - Bjarne Stroustrup in "The  C++ Programming Language"

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-09-15 20:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-04  3:12 [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Mike Frysinger
2009-09-04  3:12 ` [U-Boot] [PATCH 2/3] standalone: convert to kbuild style Mike Frysinger
2009-09-04 21:07   ` Wolfgang Denk
2009-09-04 23:54     ` [U-Boot] [PATCH 2/3 v2] " Mike Frysinger
2009-09-15 20:27       ` Wolfgang Denk
2009-09-04  3:12 ` [U-Boot] [PATCH 3/3] atmel_df_pow2: standalone to convert dataflashes to pow2 Mike Frysinger
2009-09-04 21:08   ` Wolfgang Denk
2009-09-04 23:50     ` Mike Frysinger
2009-09-04 21:06 ` [U-Boot] [PATCH 1/3] push LOAD_ADDR out to arch mk files Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.