diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2010-08-04 03:43:59 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-06 19:10:43 +0200 |
commit | e2e48bfe48aa2406c494b448e69e66124f9c006a (patch) | |
tree | 0105659e4bc1dae35693d6630001922f1648ab5a /arch/arm/boards/nhk8815 | |
parent | 7192259daaf5d69441f999bdaabeaf3175e911d9 (diff) | |
download | barebox-e2e48bfe48aa2406c494b448e69e66124f9c006a.tar.gz barebox-e2e48bfe48aa2406c494b448e69e66124f9c006a.tar.xz |
arm: add nhk8815 board support
with the following support
uart 0 & 1
network
nand
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Andrea GALLO <andrea.gallo@stericsson.com>
Cc: Gael SALLES <gael.salles@stericsson.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/nhk8815')
-rw-r--r-- | arch/arm/boards/nhk8815/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/config.h | 0 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/bin/_update | 36 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/bin/boot | 38 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/bin/init | 28 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem | 19 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/bin/update_kernel | 8 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/bin/update_root | 8 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/env/config | 32 | ||||
-rw-r--r-- | arch/arm/boards/nhk8815/setup.c | 106 |
10 files changed, 276 insertions, 0 deletions
diff --git a/arch/arm/boards/nhk8815/Makefile b/arch/arm/boards/nhk8815/Makefile new file mode 100644 index 0000000000..2b9dba4589 --- /dev/null +++ b/arch/arm/boards/nhk8815/Makefile @@ -0,0 +1 @@ +obj-y += setup.o diff --git a/arch/arm/boards/nhk8815/config.h b/arch/arm/boards/nhk8815/config.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/arch/arm/boards/nhk8815/config.h diff --git a/arch/arm/boards/nhk8815/env/bin/_update b/arch/arm/boards/nhk8815/env/bin/_update new file mode 100644 index 0000000000..fb7cbe8619 --- /dev/null +++ b/arch/arm/boards/nhk8815/env/bin/_update @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ -z "$part" -o -z "$image" ]; then + echo "define \$part and \$image" + exit 1 +fi + +if [ \! -e "$part" ]; then + echo "Partition $part does not exist" + exit 1 +fi + +if [ $# = 1 ]; then + image=$1 +fi + +if [ x$ip = xdhcp ]; then + dhcp +fi + +ping $eth0.serverip +if [ $? -ne 0 ] ; then + echo "update aborted" + exit 1 +fi + +unprotect $part + +echo +echo "erasing partition $part" +erase $part + +echo +echo "flashing $image to $part" +echo +tftp $image $part diff --git a/arch/arm/boards/nhk8815/env/bin/boot b/arch/arm/boards/nhk8815/env/bin/boot new file mode 100644 index 0000000000..fd8d957db1 --- /dev/null +++ b/arch/arm/boards/nhk8815/env/bin/boot @@ -0,0 +1,38 @@ +#!/bin/sh + +. /env/config + +if [ x$1 = xflash ]; then + root=flash + kernel=flash +fi + +if [ x$1 = xnet ]; then + root=net + kernel=net +fi + +if [ x$ip = xdhcp ]; then + bootargs="$bootargs ip=dhcp" +else + bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::" +fi + +if [ x$root = xflash ]; then + bootargs="$bootargs root=$rootpart rootfstype=jffs2" +else + bootargs="$bootargs root=/dev/nfs nfsroot=192.168.23.111:$nfsroot" +fi + +bootargs="$bootargs" + +if [ $kernel = net ]; then + if [ x$ip = xdhcp ]; then + dhcp + fi + tftp $uimage uImage + bootm uImage +else + bootm /dev/nor0.kernel +fi + diff --git a/arch/arm/boards/nhk8815/env/bin/init b/arch/arm/boards/nhk8815/env/bin/init new file mode 100644 index 0000000000..5b45a70d47 --- /dev/null +++ b/arch/arm/boards/nhk8815/env/bin/init @@ -0,0 +1,28 @@ +#!/bin/sh + +PATH=/env/bin +export PATH + +. /env/config + +if [ -e /dev/nand0 ]; then + addpart /dev/nand0 $nand_parts + + # Uh, oh, hush first expands wildcards and then starts executing + # commands. What a bug! + source /env/bin/hush_hack +fi + +echo +echo -n "Hit any key to stop autoboot: " +timeout -a $autoboot_timeout +if [ $? != 0 ]; then + echo + echo "type update_kernel [<imagename>] to update kernel into flash" + echo "type udate_root [<imagename>] to update rootfs into flash" + echo "type update_barebox_xmodem nor to update barebox into flash" + echo + exit +fi + +boot diff --git a/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem b/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem new file mode 100644 index 0000000000..40f4ad3dc0 --- /dev/null +++ b/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem @@ -0,0 +1,19 @@ +#!/bin/sh + +. /env/config + +part=/dev/nand0.barebox + +loadb -f barebox.bin -c + +unprotect $part +echo +echo "erasing partition $part" +erase $part + +echo +echo "flashing barebox.bin to $part" +echo +cp barebox.bin $part +crc32 -f barebox.bin +crc32 -f $part diff --git a/arch/arm/boards/nhk8815/env/bin/update_kernel b/arch/arm/boards/nhk8815/env/bin/update_kernel new file mode 100644 index 0000000000..db0f4c2678 --- /dev/null +++ b/arch/arm/boards/nhk8815/env/bin/update_kernel @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$uimage +part=/dev/nand0.kernel + +. /env/bin/_update $1 diff --git a/arch/arm/boards/nhk8815/env/bin/update_root b/arch/arm/boards/nhk8815/env/bin/update_root new file mode 100644 index 0000000000..9530e847ef --- /dev/null +++ b/arch/arm/boards/nhk8815/env/bin/update_root @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$jffs2 +part=/dev/nand0.rootfs + +. /env/bin/_update $1 diff --git a/arch/arm/boards/nhk8815/env/config b/arch/arm/boards/nhk8815/env/config new file mode 100644 index 0000000000..2b50b25ec5 --- /dev/null +++ b/arch/arm/boards/nhk8815/env/config @@ -0,0 +1,32 @@ +#!/bin/sh + +# can be either 'net' or 'flash' +kernel=net +root=net + +# use 'dhcp' todo dhcp in uboot and in kernel +ip=dhcp + +# +# setup default ethernet address +# +#eth0.serverip=192.168.23.108 + +# Partition Size Start +# XloaderTOC + X-Loader 256KB 0x00000000 +# Memory init function 256KB 0x00040000 +# Barebox + env 2MB 0x00080000 +# Kernel Image 3MB 0x00280000 +# JFFS2 Root filesystem 22MB 0x00580000 +# JFFS2 User Data 100MB 0x01b80000 + +nand_parts="256k(xloader)ro,256k(meminit),2M(uboot),3M(kernel),22M(rootfs),100M(userfs),384k(free),128k(ubootenv)" + +uimage=uImage-nhk15 + +# use 'dhcp' to do dhcp in uboot and in kernel +ip=dhcp + +autoboot_timeout=3 + +bootargs="root=/dev/ram0 console=ttyAMA1,115200n8 init=linuxrc" diff --git a/arch/arm/boards/nhk8815/setup.c b/arch/arm/boards/nhk8815/setup.c new file mode 100644 index 0000000000..e9295f651e --- /dev/null +++ b/arch/arm/boards/nhk8815/setup.c @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#include <common.h> +#include <init.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/nand.h> +#include <partition.h> +#include <nand.h> +#include <asm/armlinux.h> +#include <asm/mach-types.h> +#include <asm/io.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/nand.h> +#include <mach/fsmc.h> + +static struct device_d nhk8815_network_dev = { + .name = "smc91c111", + .map_base = 0x34000300, + .size = 16, +}; + +static int nhk8815_nand_init(void) +{ + /* FSMC setup for nand chip select (8-bit nand in 8815NHK) */ + writel(0x0000000E, FSMC_PCR(0)); + writel(0x000D0A00, FSMC_PMEM(0)); + writel(0x00100A00, FSMC_PATT(0)); + + /* enable access to the chip select area */ + writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0)); + + return 0; +} + +static struct nomadik_nand_platform_data nhk8815_nand_data = { + .addr_va = NAND_IO_ADDR, + .cmd_va = NAND_IO_CMD, + .data_va = NAND_IO_DATA, + .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \ + | NAND_NO_READRDY | NAND_NO_AUTOINCR, + .init = nhk8815_nand_init, +}; + +static struct device_d nhk8815_nand_device = { + .name = "nomadik_nand", + .platform_data = &nhk8815_nand_data, +}; + +static int nhk8815_devices_init(void) +{ + st8815_add_device_sdram(64 * 1024 *1024); + + writel(0xC37800F0, NOMADIK_GPIO1_BASE + 0x20); + writel(0x00000000, NOMADIK_GPIO1_BASE + 0x24); + writel(0x00000000, NOMADIK_GPIO1_BASE + 0x28); + writel(readl(NOMADIK_SRC_BASE) | 0x8000, NOMADIK_SRC_BASE); + + /* Set up SMCS1 for Ethernet: sram-like, enabled, timing values */ + writel(0x0000305b, FSMC_BCR(1)); + writel(0x00033f33, FSMC_BTR(1)); + + register_device(&nhk8815_network_dev); + + register_device(&nhk8815_nand_device); + + armlinux_set_architecture(MACH_TYPE_NOMADIK); + armlinux_set_bootparams((void *)(0x00000100)); + + devfs_add_partition("nand0", 0x0000000, 0x040000, PARTITION_FIXED, "xloader_raw"); + devfs_add_partition("nand0", 0x0040000, 0x080000, PARTITION_FIXED, "meminit_raw"); + devfs_add_partition("nand0", 0x0080000, 0x200000, PARTITION_FIXED, "self_raw"); + dev_add_bb_dev("self_raw", "self0"); + devfs_add_partition("nand0", 0x7FE0000, 0x020000, PARTITION_FIXED, "env_raw"); + dev_add_bb_dev("env_raw", "env0"); + + return 0; +} +device_initcall(nhk8815_devices_init); + +static int nhk8815_console_init(void) +{ + st8815_register_uart(1); + return 0; +} + +console_initcall(nhk8815_console_init); |