Commit 0b2af1f1 authored by Alessandro Rubini's avatar Alessandro Rubini

build: use new barebox, with dataflash and ubi support

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 7aa092f4
......@@ -11,8 +11,8 @@ at91bootstrap-3-3.0.tar.gz 059a3e99cd93727c642ab7843c714887 \
http://repository.timesys.com/buildsources/a/at91bootstrap-3/at91bootstrap-3-3.0/at91bootstrap-3-3.0.tar.gz
# boot loader
barebox-2012.05.0.tar.bz2 208495f31b832eb6ae0c887787431def \
http://www.barebox.org/download/barebox-2012.05.0.tar.bz2
barebox-2014.04.0.tar.bz2 e1f089fc24cc7f24478e663c0e3b91d9 \
http://www.barebox.org/download/barebox-2014.04.0.tar.bz2
# kernel
linux-2.6.39.tar.bz2 1aab7a741abe08d42e8eccf20de61e05 \
......
......@@ -11,7 +11,7 @@ fi
wrs_check_vars WRS_OUTPUT_DIR WRS_DOWNLOAD_DIR CROSS_COMPILE
wrs_echo "--- Barebox"
tarname="barebox-2012.05.0.tar.bz2"
tarname="barebox-2014.04.0.tar.bz2"
wrs_download $tarname
mkdir -p $WRS_OUTPUT_DIR/build || wrs_die "mkdir build"
......@@ -19,8 +19,8 @@ mkdir -p $WRS_OUTPUT_DIR/images || wrs_die "mkdir images"
# go to the build dir and compile it
cd $WRS_OUTPUT_DIR/build
version="v2012.05"
dirname="barebox-2012.05.0"
version="v2014.04"
dirname="barebox-2014.04.0"
rm -rf $dirname
tar xjf ${WRS_DOWNLOAD_DIR}/$tarname || wrs_die "untar $tarname"
cd $dirname
......
From 6a749ab56344d6868aedc0b5dc8fbbc9ac8d17bb Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Fri, 16 Sep 2011 01:12:15 +0200
Subject: [PATCH 1/8] sam945: include mtd/nand.h in device file
---
arch/arm/mach-at91/at91sam9g45_devices.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 5af8761..bb422fd 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -22,6 +22,7 @@
#include <mach/iomux.h>
#include <mach/io.h>
#include <i2c/i2c-gpio.h>
+#include <linux/mtd/nand.h>
#include "generic.h"
--
1.7.7.2
From 3824d57e37a5576a094adfe889cc55c9ea323e4d Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Thu, 15 Sep 2011 23:53:57 +0200
Subject: [PATCH 2/8] arm: change prompt for pm9263 (wrs piggy-backs on that
code)
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 1e43be5..629a1ab 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -169,8 +169,8 @@ device_initcall(pm9g45_devices_init);
static int pm9g45_console_init(void)
{
- barebox_set_model("Ronetix PM9G45");
- barebox_set_hostname("pm9g45");
+ barebox_set_model("White Rabbit Switch");
+ barebox_set_hostname("wrs");
at91_register_uart(0, 0);
return 0;
--
1.7.7.2
From 2f5ef2e2ea8caf5b69c4acc93c434fd53b5da70d Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Tue, 6 Mar 2012 01:26:28 +0100
Subject: [PATCH 3/8] nand wrs: our nand is 16-bit connected: fix accordingly
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 629a1ab..e2286ed 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -47,9 +47,9 @@ static struct atmel_nand_data nand_pdata = {
.ale = 21,
.cle = 22,
.det_pin = -EINVAL,
- .rdy_pin = AT91_PIN_PD3,
+ .rdy_pin = AT91_PIN_PC8,
.enable_pin = AT91_PIN_PC14,
- .bus_width_16 = 0,
+ .bus_width_16 = 1,
.on_flash_bbt = 1,
};
@@ -73,7 +73,7 @@ static struct sam9_smc_config pm_nand_smc_config = {
static void pm_add_device_nand(void)
{
- pm_nand_smc_config.mode |= AT91_SMC_DBW_8;
+ pm_nand_smc_config.mode |= AT91_SMC_DBW_16;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(0, 3, &pm_nand_smc_config);
--
1.7.7.2
From 81987499eefe5a714bbc0653ea5daf573e11eeba Mon Sep 17 00:00:00 2001
From: Benoit Rat <benoit@sevensols.com>
Date: Mon, 28 May 2012 12:23:13 +0200
Subject: [PATCH 4/8] gpio: add function to check them
---
arch/arm/boards/pm9g45/init.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index e2286ed..e5b1e12 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -43,6 +43,25 @@ struct w1_gpio_platform_data w1_pdata = {
.is_open_drain = 0,
};
+/*
+ * board revision encoding
+ * V3.1 => by default: PA4 is 1 & PC7 is 0.
+ * V3.2 => by default: PA4 is 0 & PC7 is 1
+ */
+static void wrs3_check_gpios(void)
+{
+ if (!gpio_request(AT91_PIN_PA4, "") &&
+ !gpio_request(AT91_PIN_PC7, ""))
+ {
+ printf("GPIOs: PA4=%d (%d), PC7=%d (%d)\n",
+ gpio_get_value(AT91_PIN_PA4),AT91_PIN_PA4,gpio_get_value(AT91_PIN_PC7),AT91_PIN_PC7);
+ }
+ else
+ {
+ printf("Error: unable to acquire board GPIOs\n");
+ }
+}
+
static struct atmel_nand_data nand_pdata = {
.ale = 21,
.cle = 22,
@@ -163,6 +182,8 @@ static int pm9g45_devices_init(void)
armlinux_set_architecture(MACH_TYPE_PM9G45);
+ wrs3_check_gpios();
+
return 0;
}
device_initcall(pm9g45_devices_init);
--
1.7.7.2
From 8ec5e0b30090928df96318f043f30610653b0b3d Mon Sep 17 00:00:00 2001
From: Benoit Rat <benoit@sevensols.com>
Date: Mon, 9 Jul 2012 13:40:30 +0200
Subject: [PATCH 5/8] wrs (on pm9g45): change nand setup
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index e5b1e12..93efaff 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -15,7 +15,6 @@
*
*
*/
-
#include <common.h>
#include <net.h>
#include <init.h>
@@ -173,11 +172,8 @@ static int pm9g45_devices_init(void)
pm9g45_add_device_eth();
pm9g45_add_device_usbh();
- devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
- dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
- devfs_add_partition("nand0", SZ_128K, SZ_256K, DEVFS_PARTITION_FIXED, "self_raw");
- dev_add_bb_dev("self_raw", "self0");
- devfs_add_partition("nand0", SZ_256K + SZ_128K, SZ_128K, DEVFS_PARTITION_FIXED, "env_raw");
+ //device, offset, size, flag, name
+ devfs_add_partition("nand0", 0x40000, 0x40000, DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
armlinux_set_architecture(MACH_TYPE_PM9G45);
--
1.7.7.2
From b0c7f0b480138a99d95ea967334a10579288f6a5 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Fri, 2 May 2014 12:43:47 +0200
Subject: [PATCH 6/8] wrs (on pm9g45): add dataflash initialization
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
arch/arm/boards/pm9g45/init.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 93efaff..9665c18 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -114,6 +114,22 @@ static void pm9g45_add_device_mci(void)
static void pm9g45_add_device_mci(void) {}
#endif
+static const struct spi_board_info ek_spi_devices[] = {
+ {
+ .name = "mtd_dataflash",
+ .chip_select = 0,
+ .max_speed_hz = 15 * 1000 * 1000,
+ .bus_num = 0,
+ }
+};
+
+static void ek_add_device_spi(void)
+{
+ spi_register_board_info(ek_spi_devices,
+ ARRAY_SIZE(ek_spi_devices));
+ at91_add_device_spi(0, NULL);
+}
+
/*
* USB OHCI Host port
*/
@@ -168,6 +184,7 @@ static int pm9g45_devices_init(void)
add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata);
pm_add_device_nand();
+ ek_add_device_spi();
pm9g45_add_device_mci();
pm9g45_add_device_eth();
pm9g45_add_device_usbh();
--
1.7.7.2
#!/bin/sh
# boot kernel from bad block aware partition
cp /dev/nand0.kernel.bb /dev/mem.kernel
bootargs="quiet console=ttyS0,115200 panic=10 mem=64M"
bootargs="$bootargs root=/dev/mtdblock1 rootfstype=jffs2 ro"
bootargs="$bootargs wr_nic.macaddr=$macaddr"
bootz /dev/mem.kernel
# If it don't boot, show the menu
echo "Can't boot from NAND"
# Sleep 2 seconds so you can see the message and return to menu
sleep 2
menu -s boot
#!/bin/sh
# This script loads a wrboot script from the TFTP server and runs it.
if [ "x$eth0.ipaddr" = "x" ] || [ "$eth0.ipaddr" = "0.0.0.0" ]; then
dhcp 5;
fi
# fetch wrboot-<MAC> script, or <IP>/wrboot or wrboot
tftp wrboot-$eth0.ethaddr wrboot
if [ "$?" -ne "0" ]; then
sleep 1
tftp $eth0.ipaddr/wrboot wrboot
fi
if [ "$?" -ne "0" ]; then
sleep 1
tftp wrboot wrboot
fi
if [ "$?" -eq "0" ]; then
./wrboot
fi
# If the script doesn't boot return to menu after some time to read output
sleep 2
menu -s boot
#!/bin/sh
edit /env/config
. /env/config
saveenv
sleep 2
menu -s boot
#!/bin/sh
# If we are in the flashing procedure, start with the kernel and file system
# loaded into the DDR memory
memcmp -s /dev/mem -d /env/magicstr 0x71FFFFF8 0x0 8
if [ $? -eq 0 ]; then
echo "Booting kernel for NAND flashing procedure"
bootargs="console=ttyS0,115200 panic=10 mem=64M"
bootargs="$bootargs initrd=0x72000000,25M"
bootargs="$bootargs root=/dev/ram0"
addpart /dev/ram0 0x1000000@0x1000000(kernel)
addpart /dev/ram0 0x1000000@0x2000000(initrd)
bootm /dev/ram0.kernel
fi
#default value (can be overridden in /env/config)
preboot_timeout="3"
autoboot_timeout="5"
autoboot_select="1"
### Override default value using /env/config
. /env/config
echo "Starting up barebox [wrs3] (MAC=$eth0.ethaddr)"
### Generic setup
PATH=/env/bin
export PATH
if [ x$autoboot_timeout != x ]; then
menu_timeout="-A $autoboot_timeout"
fi
#Set 2nd LED ON (PA2)
gpio_set_value 33 0
PS1="wrs-$eth0.ethaddr# "
### Creating the partitions:
if [ -e /dev/mem.kernel ]; then
else
addpart /dev/mem 8M@0x71000000(kernel)
fi
if [ -e /dev/nand0.kernel ]; then
else
addpart /dev/nand0 256k@0x4000(bareboxenv),8M@0x100000(kernel),-@0x4000000(rootfs)
fi
if [ -e /dev/nand0.kernel.bb ]; then
else
nand -a /dev/nand0.*
fi
# Create the menu
#menu -r -m boot
menu -a -m boot -d "Welcome on WRSv3 Boot Sequence"
menu -e -a -m boot -c 'boot-nand' -d "boot from nand (default)"
menu -e -a -m boot -c 'boot-script' -d "boot from TFTP script"
menu -e -a -m boot -c 'edit-config' -d "edit config"
menu -e -a -m boot -c 'exit 0' -d "exit to shell"
menu -e -a -m boot -c reset -d "reboot"
# allow the user to see previous messages
echo "starting menu in ${preboot_timeout} seconds"
sleep ${preboot_timeout}
# Select by default a specific menu
menu -m boot -S -n $autoboot_select
#Use a timeout to let the user change the entry in menu
menu -s boot $menu_timeout
#!/bin/sh
## Please type Ctrl+D to Save-and-exit or Ctrl+C to Exit
## eth0.ethaddr corresponds to the MAC address of the switch, it can also be
## changes using flasher
# eth0.ethaddr=
## macaddr is the base MAC address to assign to the first switch port. All
## the other ports are sequentially assigned
# macaddr=
## You can set your networking parameters here
## If unset, then boot-script will use dhcp
## This is shipped as unset ("if false" below)
if false; then
eth0.serverip=192.168.1.1
eth0.ipaddr=192.168.1.2
eth0.netmask=255.255.255.0
eth0.gateway=192.168.1.254
fi
## Timeout to autoboot in the pre-selected menu
autoboot_timeout="5";
paperino
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment