[PATCH 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-08-11 Thread Gerald Kerma
From: Kerma Gérald 

Add initial support for the ESPRESSOBin-Ultra board from Globalscale
Technologies, Inc.

The board is based on the 64-bit dual-core Marvell Armada 3720 SoC.
Peripherals:
 - 5 Gigabit Ethernet ports (WAN has PoE, up to 30W, Topaz 6341 switch)
 - RTC clock (PCF8563)
 - USB 3.0 port
 - USB 2.0 port
 - 4x LED
 - UART over Micro-USB
 - M.2 slot (2280)
 - Mini PCI-E slot

Additionally, automatic import of the Marvell hw_info parameters is
enabled via the recently added hw_info command.
The parameters stored in Marvell hw_info are usually the board serial
number and MAC addresses.

Signed-off-by: Kerma Gérald 
Cc: Luka Kovacic 
Cc: Luka Perkov 
Cc: Robert Marko 
Signed-off-by: Kerma Gérald 
---
 arch/arm/dts/Makefile |   1 +
 .../arm/dts/armada-3720-espressobin-ultra.dts | 202 ++
 board/Marvell/mvebu_armada-37xx/MAINTAINERS   |   9 +
 board/Marvell/mvebu_armada-37xx/board.c   |  92 +++-
 .../mvebu_espressobin-ultra-88f3720_defconfig |  92 
 5 files changed, 390 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/armada-3720-espressobin-ultra.dts
 create mode 100644 configs/mvebu_espressobin-ultra-88f3720_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c42715ead4..f21c9c94d3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -213,6 +213,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
 dtb-$(CONFIG_ARCH_MVEBU) +=\
armada-3720-db.dtb  \
armada-3720-espressobin.dtb \
+   armada-3720-espressobin-ultra.dtb   \
armada-3720-turris-mox.dtb  \
armada-3720-uDPU.dtb\
armada-375-db.dtb   \
diff --git a/arch/arm/dts/armada-3720-espressobin-ultra.dts 
b/arch/arm/dts/armada-3720-espressobin-ultra.dts
new file mode 100644
index 00..66ceee60c8
--- /dev/null
+++ b/arch/arm/dts/armada-3720-espressobin-ultra.dts
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for ESPRESSObin-Ultra board
+ * Copyright (C) 2016 Marvell
+ * Copyright (C) 2019 Globalscale technologies, Inc.
+ * Copyright (C) 2020 Sartura Ltd.
+ *
+ * Author: Jason Hung 
+ * Author: Luka Kovacic 
+ * Author: Vladimir Vid 
+ */
+
+/dts-v1/;
+
+#include "armada-372x.dtsi"
+
+/ {
+   model = "Globalscale Marvell ESPRESSOBin Ultra Board";
+   compatible = "globalscale,espressobin-ultra", "marvell,armada3720", 
"marvell,armada3710";
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   aliases {
+   ethernet0 = 
+   i2c0 = 
+   spi0 = 
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x 0x 0x2000>;
+   };
+
+   vcc_sd_reg0: regulator@0 {
+   compatible = "regulator-gpio";
+   regulator-name = "vcc_sd0";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <330>;
+   regulator-type = "voltage";
+   states = <180 0x1
+ 330 0x0>;
+   gpios = < 4 GPIO_ACTIVE_HIGH>;
+   };
+
+   gpio-leds {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>, <_pins>, <_pins>, 
<_pins>;
+   compatible = "gpio-leds";
+
+   led1 {
+   label = "led1";
+   gpios = < 11 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   led2 {
+   label = "led2";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   led3 {
+   label = "led3";
+   gpios = < 13 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   led4 {
+   label = "led4";
+   gpios = < 14 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   };
+};
+
+_nb {
+   led1_pins: led1-pins {
+   groups = "pwm0";
+   function = "gpio";
+   };
+   led2_pins: led2-pins {
+   groups = "pwm1";
+   function = "gpio";
+   };
+   led3_pins: led3-pins {
+   groups = "pwm2";
+   function = "gpio";
+   };
+   led4_pins: led4-pins {
+   groups = "pwm3";
+   function = "gpio";
+   };
+};
+
+ {
+   max-lanes = <3>;
+   phy0 {
+   phy-type = ;
+   phy-speed = ;
+   };
+
+   phy1 {
+   phy-type = ;
+   phy-speed = ;
+   };
+
+   phy2 {
+   phy-type = ;
+   phy-speed = ;
+   };
+};
+
+ {
+   status = "okay";
+   

[PATCH 2/3] arm: mvebu: mvebu_armada-37xx: Define the loadaddr environment variable

2021-08-11 Thread Gerald Kerma
From: Kerma Gérald 

Add the loadaddr U-Boot environment variable, as this is available in
the stock Marvell U-Boot by default on Marvell Armada A37XX platforms.

Signed-off-by: Kerma Gérald 
Cc: Luka Kovacic 
Cc: Luka Perkov 
Cc: Robert Marko 
---
 include/configs/mvebu_armada-37xx.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/mvebu_armada-37xx.h 
b/include/configs/mvebu_armada-37xx.h
index c8c34d7d92..83f710efd4 100644
--- a/include/configs/mvebu_armada-37xx.h
+++ b/include/configs/mvebu_armada-37xx.h
@@ -103,6 +103,7 @@
 
 /* fdt_addr and kernel_addr are needed for existing distribution boot scripts 
*/
 #define CONFIG_EXTRA_ENV_SETTINGS  \
+   "loadaddr=0x600\0"  \
"scriptaddr=0x6d0\0"\
"pxefile_addr_r=0x6e0\0"\
"fdt_addr=0x6f0\0"  \
-- 
2.30.2



[PATCH 1/3] cmd: mvebu: Implement the Marvell hw_info command

2021-08-11 Thread Gerald Kerma
From: Kerma Gérald 

The hw_info command is implemented to enable parsing Marvell hw_info
formatted environments. This format is often used on Marvell Armada A37XX
based devices to store parameters like the board serial number, factory
MAC addresses and some other information.
These parameters are usually written to the flash in the factory.

Currently the command supports reading/writing parameters and dumping the
current hw_info parameters.
EEPROM config pattern and checksum aren't supported.

This functionality has been tested on the GST ESPRESSOBin-Ultra board
successfully, both reading the stock U-Boot parameters in mainline U-Boot
and reading the parameters written by this command in the stock U-Boot.

Usage example:
 => hw_info load
 => saveenv

Signed-off-by: Kerma Gérald 
Cc: Luka Kovacic 
Cc: Luka Perkov 
Cc: Robert Marko 
---
 cmd/mvebu/Kconfig   |  23 
 cmd/mvebu/Makefile  |   2 +
 cmd/mvebu/hw_info.c | 312 
 lib/hashtable.c |   2 +-
 4 files changed, 338 insertions(+), 1 deletion(-)
 create mode 100644 cmd/mvebu/hw_info.c

diff --git a/cmd/mvebu/Kconfig b/cmd/mvebu/Kconfig
index 7c42c75afb..d87220d44c 100644
--- a/cmd/mvebu/Kconfig
+++ b/cmd/mvebu/Kconfig
@@ -9,6 +9,29 @@ config CMD_MVEBU_BUBT
  For details about bubt command please see the documentation
  in doc/mvebu/cmd/bubt.txt
 
+config CMD_MVEBU_HW_INFO
+   bool "hw_info"
+   depends on SPI_FLASH && ENV_IS_IN_SPI_FLASH && ARCH_MVEBU
+   default n
+   help
+ Enable loading of the Marvell hw_info parameters from the
+ SPI flash hw_info area. Parameters (usually the board serial
+ number and MAC addresses) are then imported into the
+ existing U-Boot environment.
+ Implementation of this command is compatible with the
+ original Marvell U-Boot command. Reading and writing is
+ supported.
+ EEPROM config pattern and checksum aren't supported.
+
+config CMD_MVEBU_HW_INFO_OFFSET
+   hex "Marvell hw_info SPI flash offset"
+   depends on CMD_MVEBU_HW_INFO
+   default 0x3E
+   help
+ This option defines the SPI flash offset of the Marvell
+ hw_info area. This defaults to 0x3E on most Armada
+ A3720 platforms.
+
 choice
prompt "Flash for image"
default MVEBU_SPI_BOOT
diff --git a/cmd/mvebu/Makefile b/cmd/mvebu/Makefile
index ca96ad01d9..c988dca38c 100644
--- a/cmd/mvebu/Makefile
+++ b/cmd/mvebu/Makefile
@@ -6,3 +6,5 @@
 
 obj-$(CONFIG_CMD_MVEBU_BUBT) += bubt.o
 obj-$(CONFIG_CMD_MVEBU_COMPHY_RX_TRAINING) += comphy_rx_training.o
+obj-$(CONFIG_CMD_MVEBU_HW_INFO) += hw_info.o
+
diff --git a/cmd/mvebu/hw_info.c b/cmd/mvebu/hw_info.c
new file mode 100644
index 00..1ef49d78d4
--- /dev/null
+++ b/cmd/mvebu/hw_info.c
@@ -0,0 +1,312 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Marvell hw_info command
+ * Helper command for interfacing with the Marvell hw_info parameters
+ *
+ * Copyright (c) 2021 Sartura Ltd.
+ * Copyright (c) 2018 Marvell International Ltd.
+ *
+ * Author: Luka Kovacic 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define HW_INFO_SPI_FLASH_OFFSET   CONFIG_CMD_MVEBU_HW_INFO_OFFSET
+
+#define HW_INFO_MAX_ENV_SIZE   0x1F0
+#define HW_INFO_ENV_OFFSET 0xA
+#define HW_INFO_ENV_SEP0x20
+
+#define HW_INFO_MAX_NAME_LEN   32
+
+static char hw_info_allowed_parameters[][HW_INFO_MAX_NAME_LEN] = {
+   "pcb_slm",
+   "pcb_rev",
+   "eco_rev",
+   "pcb_sn",
+   "ethaddr",
+   "eth1addr",
+   "eth2addr",
+   "eth3addr",
+   "eth4addr",
+   "eth5addr",
+   "eth6addr",
+   "eth7addr",
+   "eth8addr",
+   "eth9addr",
+};
+
+static int hw_info_allowed_param_count = (sizeof(hw_info_allowed_parameters) /
+   sizeof(hw_info_allowed_parameters[0]));
+
+static int hw_info_check_parameter(char *name)
+{
+   int idx;
+
+   for (idx = 0; idx < hw_info_allowed_param_count; idx++) {
+   if (strcmp(name, hw_info_allowed_parameters[idx]) == 0)
+   return 0;
+   }
+
+   return -EINVAL;
+}
+
+static int read_spi_flash_offset(char *buf, int offset)
+{
+   struct spi_flash *flash;
+   int ret;
+
+   flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
+   CONFIG_SF_DEFAULT_CS,
+   CONFIG_SF_DEFAULT_SPEED,
+   CONFIG_SF_DEFAULT_MODE);
+
+   if (!flash) {
+   printf("Error - unable to probe SPI flash.\n");
+   return -EIO;
+   }
+
+   ret = spi_flash_read(flash, offset, HW_INFO_MAX_ENV_SIZE, buf);
+   if (ret) {
+   printf("Error - unable to read hw_info environment from SPI 
flash.\n");
+   return ret;
+   }
+
+   return ret;
+}
+
+static int write_spi_flash_offset(char 

[PATCH 0/3] Add support for the GST ESPRESSOBin-Ultra board

2021-08-11 Thread Gerald Kerma
From: Kerma Gérald 

Add support for the GST ESPRESSOBin-Ultra board

Kerma Gérald (3):
  cmd: mvebu: Implement the Marvell hw_info command
  arm: mvebu: mvebu_armada-37xx: Define the loadaddr environment
variable
  arm: mvebu: Initial ESPRESSOBin-Ultra board support

 arch/arm/dts/Makefile |   1 +
 .../arm/dts/armada-3720-espressobin-ultra.dts | 202 
 board/Marvell/mvebu_armada-37xx/MAINTAINERS   |   9 +
 board/Marvell/mvebu_armada-37xx/board.c   |  92 +-
 cmd/mvebu/Kconfig |  23 ++
 cmd/mvebu/Makefile|   2 +
 cmd/mvebu/hw_info.c   | 312 ++
 .../mvebu_espressobin-ultra-88f3720_defconfig |  92 ++
 include/configs/mvebu_armada-37xx.h   |   1 +
 lib/hashtable.c   |   2 +-
 10 files changed, 729 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/armada-3720-espressobin-ultra.dts
 create mode 100644 cmd/mvebu/hw_info.c
 create mode 100644 configs/mvebu_espressobin-ultra-88f3720_defconfig

-- 
2.30.2



[U-Boot] [PATCH 1/1] kikwood: uboot-envtools: add plugs boards

2014-12-18 Thread Gerald Kerma
Add some kirkwood plugs to uboot-envtools
- SheevaPlug
- SheevaPlug with eSATA
- GuruplugServerPlus

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 package/boot/uboot-envtools/files/kirkwood | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-envtools/files/kirkwood 
b/package/boot/uboot-envtools/files/kirkwood
index b15b8f9..13b3e60 100644
--- a/package/boot/uboot-envtools/files/kirkwood
+++ b/package/boot/uboot-envtools/files/kirkwood
@@ -17,7 +17,10 @@ case $board in
 ea3500 | \
 ea4500 | \
 ib62x0 | \
-pogo_e02)
+guruplug-server-plus | \
+pogo_e02| \
+sheevaplug | \
+sheevaplug-esata )
ubootenv_add_uci_config /dev/mtd1 0x0 0x2 0x2
;;
 esac
-- 
2.1.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/1] marvell: kirkwood: guruplug refresh for newer kernel

2014-12-18 Thread Gerald Kerma
Refresh for newer kernel.
Prepare ENV settings for sheevaplugs to be OpenWRT ready.

+--+
| UBOOT|  896 Kb (7x128)  = uboot
+--+
| ENV  |  128 Kb  = uboot_env
+--+
| ROOT(FS) |  511 Mb @ 1 Mb   = root - rootfs (ubifs)
+--+

With (CC) TRUNK OpenWRT build (QUICK HOWTO) :

INTERRUPT
Marvell nand erase.part root
Marvell ubi part root
Marvell ubi remove rootfs
Marvell ubi create rootfs
Marvell usb reset
Marvell fatload usb 2:1 0x80 
guruplug/openwrt/openwrt-kirkwood-guruplug-rootfs.ubifs
Marvell ubi write 0x80 rootfs ${filesize}
Marvell reset

Changes in v1:
- ADD generic board define
- ADD FDT support
- ADD HUSH interpreter
- Define new NAND partition mapping

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 include/configs/guruplug.h | 84 --
 1 file changed, 67 insertions(+), 17 deletions(-)

diff --git a/include/configs/guruplug.h b/include/configs/guruplug.h
index a56a4cb..8e53af8 100644
--- a/include/configs/guruplug.h
+++ b/include/configs/guruplug.h
@@ -1,5 +1,6 @@
 /*
- * (C) Copyright 2009
+ * (C) Copyright 2009-2014
+ * Gerald Kerma drea...@doukki.net
  * Marvell Semiconductor www.marvell.com
  * Written-by: Siddarth Gore go...@marvell.com
  *
@@ -9,6 +10,8 @@
 #ifndef _CONFIG_GURUPLUG_H
 #define _CONFIG_GURUPLUG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /*
  * Version number information
  */
@@ -23,17 +26,36 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT  /* disable board lowlevel_init */
 
 /*
+ * Compression configuration
+ */
+#define CONFIG_BZIP2
+#define CONFIG_LZMA
+#define CONFIG_LZO
+
+/*
+ * Enable device tree support
+ */
+#define CONFIG_OF_LIBFDT
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_HUSH_PARSER /* use hush command parser */
+
+/*
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH/* Declare no flash (NOR/SPI) */
 #include config_cmd_default.h
+#define CONFIG_CMD_BOOTZ
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
-#define CONFIG_CMD_FAT
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
-#define CONFIG_CMD_IDE
+#define CONFIG_CMD_FAT
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
@@ -55,24 +77,38 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x6
-#define CONFIG_ENV_OFFSET  0x6 /* env starts here */
+#define CONFIG_ENV_OFFSET  0xE /* env starts here */
 
 /*
  * Default environment variables
  */
-#define CONFIG_BOOTCOMMAND setenv ethact egiga0;  \
-   ${x_bootcmd_ethernet}; setenv ethact egiga1;  \
-   ${x_bootcmd_ethernet}; ${x_bootcmd_usb}; ${x_bootcmd_kernel}; \
-   setenv bootargs ${x_bootargs} ${x_bootargs_root}; \
-   bootm 0x640;
-
-#define CONFIG_EXTRA_ENV_SETTINGS  \
-   x_bootcmd_ethernet=ping 192.168.2.1\0 \
-   x_bootcmd_usb=usb start\0 \
-   x_bootcmd_kernel=nand read.e 0x640 0x10 0x40\0 \
-   x_bootargs=console=ttyS0,115200\0 \
-   x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0
+#define CONFIG_BOOTCOMMAND \
+   setenv bootargs ${console} ${mtdparts} ${bootargs_root};  \
+   ubi part root;\
+   ubifsmount ubi:rootfs;\
+   ubifsload 0x80 ${kernel}; \
+   ubifsload 0x70 ${fdt};\
+   ubifsumount;  \
+   fdt addr 0x70; fdt resize; fdt chosen;\
+   bootz 0x80 - 0x70
+
+#define CONFIG_MTDPARTS\
+   mtdparts=orion_nand:  \
+   896K(uboot),128K(uboot_env),  \
+   -@1M(root)\0
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+   console=console=ttyS0,115200\0\
+   mtdids=nand0=orion_nand\0 \
+   mtdparts=CONFIG_MTDPARTS  \
+   kernel=/boot/zImage\0 \
+   fdt=/boot/guruplug-server-plus.dtb\0  \
+   bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0
+
+#define MTDIDS_DEFAULT nand0=orion_nand
+
+#define MTDPARTS_DEFAULT   \
+   mtdparts=CONFIG_MTDPARTS
 
 /*
  * Ethernet Driver configuration
@@ -89,6 +125,20 @@
 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
 #endif /*CONFIG_MVSATA_IDE*/
 
+/*
+ * File system
+ */
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_JFFS2
+#define CONFIG_CMD_UBI
+#define

[U-Boot] [PATCH v2 1/1] marvell: kirkwood: guruplug refresh for newer kernel

2014-12-18 Thread Gerald Kerma
Refresh for newer kernel.
Prepare ENV settings for guruplugs to be OpenWRT ready.

+--+
| UBOOT|  896 Kb (7x128)  = uboot
+--+
| ENV  |  128 Kb  = uboot_env
+--+
| ROOT(FS) |  511 Mb @ 1 Mb   = root - rootfs (ubifs)
+--+

With (CC) TRUNK OpenWRT build (QUICK HOWTO) :

INTERRUPT
Marvell nand erase.part root
Marvell ubi part root
Marvell ubi remove rootfs
Marvell ubi create rootfs
Marvell usb start
Marvell fatload usb 2:1 0x80 
guruplug/openwrt/openwrt-kirkwood-guruplugserverplus-rootfs.ubifs
Marvell ubi write 0x80 rootfs ${filesize}
Marvell reset

Changes in v2:
- Fix commit comments

Changes in v1:
- ADD generic board define
- ADD FDT support
- ADD HUSH interpreter
- Define new NAND partition mapping

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 include/configs/guruplug.h | 84 --
 1 file changed, 67 insertions(+), 17 deletions(-)

diff --git a/include/configs/guruplug.h b/include/configs/guruplug.h
index a56a4cb..8e53af8 100644
--- a/include/configs/guruplug.h
+++ b/include/configs/guruplug.h
@@ -1,5 +1,6 @@
 /*
- * (C) Copyright 2009
+ * (C) Copyright 2009-2014
+ * Gerald Kerma drea...@doukki.net
  * Marvell Semiconductor www.marvell.com
  * Written-by: Siddarth Gore go...@marvell.com
  *
@@ -9,6 +10,8 @@
 #ifndef _CONFIG_GURUPLUG_H
 #define _CONFIG_GURUPLUG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /*
  * Version number information
  */
@@ -23,17 +26,36 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT  /* disable board lowlevel_init */
 
 /*
+ * Compression configuration
+ */
+#define CONFIG_BZIP2
+#define CONFIG_LZMA
+#define CONFIG_LZO
+
+/*
+ * Enable device tree support
+ */
+#define CONFIG_OF_LIBFDT
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_HUSH_PARSER /* use hush command parser */
+
+/*
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH/* Declare no flash (NOR/SPI) */
 #include config_cmd_default.h
+#define CONFIG_CMD_BOOTZ
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
-#define CONFIG_CMD_FAT
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
-#define CONFIG_CMD_IDE
+#define CONFIG_CMD_FAT
 
 /*
  * mv-common.h should be defined after CMD configs since it used them
@@ -55,24 +77,38 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x6
-#define CONFIG_ENV_OFFSET  0x6 /* env starts here */
+#define CONFIG_ENV_OFFSET  0xE /* env starts here */
 
 /*
  * Default environment variables
  */
-#define CONFIG_BOOTCOMMAND setenv ethact egiga0;  \
-   ${x_bootcmd_ethernet}; setenv ethact egiga1;  \
-   ${x_bootcmd_ethernet}; ${x_bootcmd_usb}; ${x_bootcmd_kernel}; \
-   setenv bootargs ${x_bootargs} ${x_bootargs_root}; \
-   bootm 0x640;
-
-#define CONFIG_EXTRA_ENV_SETTINGS  \
-   x_bootcmd_ethernet=ping 192.168.2.1\0 \
-   x_bootcmd_usb=usb start\0 \
-   x_bootcmd_kernel=nand read.e 0x640 0x10 0x40\0 \
-   x_bootargs=console=ttyS0,115200\0 \
-   x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0
+#define CONFIG_BOOTCOMMAND \
+   setenv bootargs ${console} ${mtdparts} ${bootargs_root};  \
+   ubi part root;\
+   ubifsmount ubi:rootfs;\
+   ubifsload 0x80 ${kernel}; \
+   ubifsload 0x70 ${fdt};\
+   ubifsumount;  \
+   fdt addr 0x70; fdt resize; fdt chosen;\
+   bootz 0x80 - 0x70
+
+#define CONFIG_MTDPARTS\
+   mtdparts=orion_nand:  \
+   896K(uboot),128K(uboot_env),  \
+   -@1M(root)\0
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+   console=console=ttyS0,115200\0\
+   mtdids=nand0=orion_nand\0 \
+   mtdparts=CONFIG_MTDPARTS  \
+   kernel=/boot/zImage\0 \
+   fdt=/boot/guruplug-server-plus.dtb\0  \
+   bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0
+
+#define MTDIDS_DEFAULT nand0=orion_nand
+
+#define MTDPARTS_DEFAULT   \
+   mtdparts=CONFIG_MTDPARTS
 
 /*
  * Ethernet Driver configuration
@@ -89,6 +125,20 @@
 #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
 #endif /*CONFIG_MVSATA_IDE*/
 
+/*
+ * File system
+ */
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_FAT
+#define

[U-Boot] [PATCH 3/3] ARM: kwimage: fix v0 format

2014-10-30 Thread Gerald Kerma
This patch fix the kwimage tools for version 0 fileformat used for kirkwood
Tested on sheevaplug

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 tools/kwbimage.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 1120e9b..7e2fb5e 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -324,7 +324,7 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,
main_hdr = image;
 
/* Fill in the main header */
-   main_hdr-blocksize = payloadsz + sizeof(uint32_t);
+   main_hdr-blocksize = payloadsz + sizeof(uint32_t) - headersz;
main_hdr-srcaddr   = headersz;
main_hdr-ext   = has_ext;
main_hdr-destaddr  = params-addr;
@@ -792,8 +792,8 @@ static void kwbimage_print_header(const void *ptr)
 
printf(Image Type:   MVEBU Boot from %s Image\n,
   image_boot_mode_name(mhdr-blockid));
-   printf(Data Size:);
printf(Image version:%d\n, image_version((void *)ptr));
+   printf(Data Size:);
genimg_print_size(mhdr-blocksize - sizeof(uint32_t));
printf(Load Address: %08x\n, mhdr-destaddr);
printf(Entry Point:  %08x\n, mhdr-execaddr);
@@ -816,7 +816,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int 
image_size,
 
main_hdr = (void *)ptr;
checksum = image_checksum8(ptr,
-  sizeof(struct main_hdr_v0));
+  sizeof(struct main_hdr_v0)
+  - sizeof(uint8_t));
if (checksum != main_hdr-checksum)
return -FDT_ERR_BADSTRUCTURE;
 
@@ -824,7 +825,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int 
image_size,
if (image_version((void *)ptr) == 0) {
ext_hdr = (void *)ptr + sizeof(struct main_hdr_v0);
checksum = image_checksum8(ext_hdr,
-  sizeof(struct ext_hdr_v0));
+  sizeof(struct ext_hdr_v0)
+  - sizeof(uint8_t));
if (checksum != ext_hdr-checksum)
return -FDT_ERR_BADSTRUCTURE;
}
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/2] arm: marvell: fix ENV and MTDPARTS for sheevaplug

2014-10-26 Thread Gerald Kerma
This patch redefine ENV offset and MTDPARTS

 Changes in v3:
 - add a bootstrap from nand
 - fix typo errors
 Changes in v2:
 - fix MTDPARTS typo errors
 Changes in v1:
 - define ENV offset to 0xe
 - define MTDPARTS and BOOTARGS to stay backward compatibles

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 include/configs/sheevaplug.h | 56 
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 247789c..ef905bb 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -75,32 +75,48 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x8
-#define CONFIG_ENV_OFFSET  0x8 /* env starts here */
+#define CONFIG_ENV_ADDR0xe
+#define CONFIG_ENV_OFFSET  0xe /* env starts here */
 
 /*
  * Default environment variables
  */
-#define CONFIG_BOOTCOMMAND ${x_bootcmd_kernel};  \
-   setenv bootargs ${x_bootargs} ${x_bootargs_root}; \
-   ${x_bootcmd_usb}; bootm 0x640;
 
 #define CONFIG_MTDPARTS\
-   mtdparts=orion_nand:512K(uboot),  \
-   512K(env),1M(script),6M(kernel),  \
-   12M(ramdisk),4M(spare),-(rootfs)
-
-#define CONFIG_EXTRA_ENV_SETTINGS  x_bootargs=console\
-   =ttyS0,115200 mtdparts=CONFIG_MTDPARTS\
-   x_bootcmd_kernel=nand read 0x640 0x10 0x30\0 \
-   x_bootcmd_usb=usb start\0 \
-   x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0
-
-#define MTDIDS_DEFAULT nand0=orion_nand
-
-#define MTDPARTS_DEFAULT   \
-   mtdparts=CONFIG_MTDPARTS
-
+   mtdparts=orion_nand:  \
+   0xe@0x0(uboot),   \
+   0x2@0xe(uboot_env),   \
+   3m@1m(kernel),\
+   1m@4m(script),\
+   -@5m(root)\0
+ 
+#define MTDIDS_DEFAULT nand0=orion_nand
+
+#define MTDPARTS_DEFAULT   CONFIG_MTDPARTS
+
+#define CONFIG_BOOTCOMMAND \
+   run z_bootcmd_script; run z_bootcmd_nand;
+
+#define CONFIG_EXTRA_ENV_SETTINGS  \
+   mtdparts=MTDPARTS_DEFAULT \
+   mtdids=MTDIDS_DEFAULT\0 \
+   kernel=/boot/uImage\0 \
+   ramdisk=/boot/uInitrd\0   \
+   fdt=/boot/dtb\0   \
+   z_bootcmd_script=nand read 0x640 script;  \
+setenv bootargs ${x_bootargs} ${x_bootargs_root};\
+run x_bootcmd_usb; run x_bootcmd_ide;\
+source 0x640;\0  \
+   z_bootcmd_nand=run x_bootcmd_nand_kernel; \
+setenv bootargs ${x_bootargs} ${x_bootargs_nand_root};   \
+run x_bootcmd_usb; bootm 0x640;\0\
+   x_bootargs=console=ttyS0,115200 CONFIG_MTDPARTS   \
+   x_bootargs_root=root=LABEL=ROOTFS rw panic=5\0\
+   x_bootcmd_usb=usb reset\0 \
+   x_bootcmd_ide=ide reset\0 \
+   x_bootargs_nand_root=root=/dev/mtdblock4 rw rootfstype=jffs2\0\
+   x_bootcmd_nand_kernel=nand read 0x640 kernel\0
+   
 /*
  * Ethernet Driver configuration
  */
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 0/2] arm: marvell: sheevaplug: add FDT and fixes MTDPARTS

2014-10-26 Thread Gerald Kerma
These series of patch :
 - fixes ENV and MTDPARTS for sheevaplug
 - add FDT support for sheevaplug
 - add the possibility to use a bootstrap from nand (bootscript)

Gerald Kerma (2):
  arm: marvell: add LIBFDT support to sheevaplug
  arm: marvell: fix ENV and MTDPARTS for sheevaplug

 include/configs/sheevaplug.h | 62 ++--
 1 file changed, 42 insertions(+), 20 deletions(-)

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/2] arm: marvell: add LIBFDT support to sheevaplug

2014-10-26 Thread Gerald Kerma
This patch add LIBFDT support to Marvell Sheevaplug

 Changes in v2:
 - mainline rebased
 Changes in v1:
 - add LIBFDT support

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 include/configs/sheevaplug.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 71be823..247789c 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -49,6 +49,12 @@
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
+
+/*
+* Enable device tree support
+*/
+#define CONFIG_OF_LIBFDT
+
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/1] ARM: sheevaplug: add LIBFDT support

2014-10-18 Thread Gerald Kerma
This patch add LIBFDT support to Marvell Sheevaplug

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v1:
 - add LIBFDT support

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 include/configs/sheevaplug.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 71be823..247789c 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -49,6 +49,12 @@
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
+
+/*
+* Enable device tree support
+*/
+#define CONFIG_OF_LIBFDT
+
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] ARM: sheevaplug: fix ENV offset and MTDPARTS

2014-10-18 Thread Gerald Kerma
This patch redefine ENV offset and MTDPARTS

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v1:
 - define ENV offset to 0xe
 - define MTDPARTS and BOOTARGS to stay backward compatibles

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 include/configs/sheevaplug.h | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 247789c..72b8af1 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -75,8 +75,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x8
-#define CONFIG_ENV_OFFSET  0x8 /* env starts here */
+#define CONFIG_ENV_ADDR0xe
+#define CONFIG_ENV_OFFSET  0xe /* env starts here */
 
 /*
  * Default environment variables
@@ -86,15 +86,18 @@
${x_bootcmd_usb}; bootm 0x640;
 
 #define CONFIG_MTDPARTS\
-   mtdparts=orion_nand:512K(uboot),  \
-   512K(env),1M(script),6M(kernel),  \
-   12M(ramdisk),4M(spare),-(rootfs)
+   mtdparts=orion_nand:  \
+   0xe@0x0(uboot),   \
+   0x2@0xe(uboot_env),   \
+   3m@1m(kernel) \
+   1m@4m(script) \
+   -@5m(root)\0
 
 #define CONFIG_EXTRA_ENV_SETTINGS  x_bootargs=console\
=ttyS0,115200 mtdparts=CONFIG_MTDPARTS\
x_bootcmd_kernel=nand read 0x640 0x10 0x30\0 \
x_bootcmd_usb=usb start\0 \
-   x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0
+   x_bootargs_root=root=/dev/mtdblock4 rw rootfstype=jffs2\0
 
 #define MTDIDS_DEFAULT nand0=orion_nand
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/5] ARM: sheevaplug: refresh for 201410

2014-09-07 Thread Gerald Kerma
This serie of patches add some needed features to sheevaplug

Gerald Kerma (5):
  ARM: sheevaplug: change env location
  ARM: sheevaplug: add MVSATA driver
  ARM: sheevaplug: add MTD defaults
  ARM: sheevaplug: redefine MTDPARTS
  ARM: sheevaplug: add HUSH parser

 include/configs/sheevaplug.h | 46 +++-
 1 file changed, 41 insertions(+), 5 deletions(-)

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/5] ARM: sheevaplug: change env location

2014-09-07 Thread Gerald Kerma
This patch move the environment offset in sheevaplug.
The size of the u-boot binary is become too big.
Fix saving environments was result of corrupting the u-boot.

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v2:
 - patch description

 Changes in v1:
 - fix sheevaplug environment offset

---
 include/configs/sheevaplug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 4747adf..d89bc37 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -54,8 +54,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x6
-#define CONFIG_ENV_OFFSET  0x6 /* env starts here */
+#define CONFIG_ENV_ADDR0x8
+#define CONFIG_ENV_OFFSET  0x8 /* env starts here */
 
 /*
  * Default environment variables
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/5] ARM: sheevaplug: add MTD defaults

2014-09-07 Thread Gerald Kerma
This patch add MTDIDS and MTDPARTS defaults settings to sheevaplug

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v1:
 - add MTDIDS and MTDPARTS default to sheevaplug

---
 include/configs/sheevaplug.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 9661b8f..0a3118d 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -83,6 +83,11 @@
x_bootcmd_usb=usb start\0 \
x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0
 
+#define MTDIDS_DEFAULT nand0=orion_nand
+
+#define MTDPARTS_DEFAULT   \
+   mtdparts=CONFIG_MTDPARTS
+
 /*
  * Ethernet Driver configuration
  */
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/5] ARM: sheevaplug: add MVSATA driver

2014-09-07 Thread Gerald Kerma
This patch add MVSATA driver to sheevaplug

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v1:
 - add MVSATA driver to sheevaplug
 - enable ext4 FS support

---
 include/configs/sheevaplug.h | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index d89bc37..9661b8f 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -1,5 +1,6 @@
 /*
- * (C) Copyright 2009
+ * (C) Copyright 2009-2014
+ * Gerald Kerma drea...@doukki.net
  * Marvell Semiconductor www.marvell.com
  * Written-by: Prafulla Wadaskar prafu...@marvell.com
  *
@@ -23,12 +24,21 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT  /* disable board lowlevel_init */
 
 /*
+ * Compression configuration
+ */
+#define CONFIG_BZIP2
+#define CONFIG_LZMA
+#define CONFIG_LZO
+
+/*
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH/* Declare no flash (NOR/SPI) */
 #include config_cmd_default.h
+#define CONFIG_CMD_BOOTZ
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
+#define CONFIG_CMD_IDE
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_NAND
@@ -92,9 +102,23 @@
 #endif /* CONFIG_CMD_MMC */
 
 /*
+ * SATA driver configuration
+ */
+#ifdef CONFIG_CMD_IDE
+#define __io
+#define CONFIG_IDE_PREINIT
+#define CONFIG_DOS_PARTITION
+#define CONFIG_MVSATA_IDE_USE_PORT0
+#define CONFIG_MVSATA_IDE_USE_PORT1
+#define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
+#define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET
+#endif /* CONFIG_CMD_IDE */
+
+/*
  * File system
  */
 #define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_UBI
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 5/5] ARM: sheevaplug: add HUSH parser

2014-09-07 Thread Gerald Kerma
This patch add HUSH command parser

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v1:
 - add HUSH command parser

---
 include/configs/sheevaplug.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 62f46b7..6428c83 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -30,6 +30,11 @@
 #define CONFIG_LZMA
 #define CONFIG_LZO
 
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_HUSH_PARSER /* use hush command parser */
+
 /*
  * Commands configuration
  */
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/5] ARM: sheevaplug: redefine MTDPARTS

2014-09-07 Thread Gerald Kerma
This patch redefine MTDPARTS

Signed-off-by: Gerald Kerma drea...@doukki.net

 Changes in v1:
 - redefine MTDPARTS

---
 include/configs/sheevaplug.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 0a3118d..62f46b7 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -74,8 +74,10 @@
setenv bootargs ${x_bootargs} ${x_bootargs_root}; \
${x_bootcmd_usb}; bootm 0x640;
 
-#define CONFIG_MTDPARTSorion_nand:512k(uboot),   \
-   3m@1m(kernel),1m@4m(psm),13m@5m(rootfs) rw\0
+#define CONFIG_MTDPARTS\
+   mtdparts=orion_nand:512K(uboot),  \
+   512K(env),1M(script),6M(kernel),  \
+   12M(ramdisk),4M(spare),-(rootfs)

 #define CONFIG_EXTRA_ENV_SETTINGS  x_bootargs=console\
=ttyS0,115200 mtdparts=CONFIG_MTDPARTS\
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/1] ARM: sheevaplug: fix uboot corruption

2014-07-26 Thread Gerald Kerma
This patch move the environment offset in sheevaplug.
The size of the u-boot binary is become too big.
Saving environments will result of corrupting the u-boot.

Signed-off-by: Gerald Kerma drea...@doukki.net
---

 Changes in v1:
 - fix sheevaplug environment offset

 include/configs/sheevaplug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index 3d6ff09..85c6bc2 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -55,8 +55,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x6
-#define CONFIG_ENV_OFFSET  0x6 /* env starts here */
+#define CONFIG_ENV_ADDR0x8
+#define CONFIG_ENV_OFFSET  0x8 /* env starts here */
 
 /*
  * Default environment variables
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v5 1/1] ARM: kirkwood: add mvsdio driver

2014-07-25 Thread Gerald Kerma
This patch add Marvell kirkwood MVSDIO/MMC driver
and enable it for Sheevaplugs and OpenRD boards.

Signed-off-by: Gerald Kerma drea...@doukki.net
---

 Changes in v5:
 - purge uneeded code
 - remove some extra debug

 Changes in v4:
 - rename drivers files to MVSDIO
 - fix MMC clock init which now use dev ID
 - clean debug strings
 - remove MVSDIO_TWEAK_NOSDHS quirk
 - remove dead code

 Changes in v3:
 - Add MVSDIO_TWEAK_NOSDHS quirk
 - Minor clean

 Changes in v2:
 - Fix some typo and missing lines from patch import

 arch/arm/include/asm/arch-kirkwood/kirkwood.h |   1 +
 board/Marvell/openrd/openrd.c |  11 +
 board/Marvell/sheevaplug/sheevaplug.c |  11 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/mvsdio.c  | 353 ++
 include/configs/openrd.h  |   8 +
 include/configs/sheevaplug.h  |  17 +-
 include/mvsdio.h  | 279 
 8 files changed, 679 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mmc/mvsdio.c
 create mode 100644 include/mvsdio.h

diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..3ea51d7 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
 #define KW_SATA_BASE   (KW_REGISTER(0x8))
+#define KW_SDIO_BASE   (KW_REGISTER(0x9))
 
 /* Kirkwood Sata controller has two ports */
 #define KW_SATA_PORT0_OFFSET   0x2000
diff --git a/board/Marvell/openrd/openrd.c b/board/Marvell/openrd/openrd.c
index a005a2f..6e9dca6 100644
--- a/board/Marvell/openrd/openrd.c
+++ b/board/Marvell/openrd/openrd.c
@@ -17,6 +17,9 @@
 #include asm/arch/kirkwood.h
 #include asm/arch/mpp.h
 #include openrd.h
+#ifdef CONFIG_MVSDIO_MMC
+# include mvsdio.h
+#endif /* CONFIG_MVSDIO_MMC */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -159,3 +162,11 @@ void reset_phy(void)
 #endif
 }
 #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+   mrvl_mmc_init(bis);
+   return 0;
+}
+#endif /* CONFIG_MRVL_MMC */
diff --git a/board/Marvell/sheevaplug/sheevaplug.c 
b/board/Marvell/sheevaplug/sheevaplug.c
index 87e49f4..c33f55c 100644
--- a/board/Marvell/sheevaplug/sheevaplug.c
+++ b/board/Marvell/sheevaplug/sheevaplug.c
@@ -12,6 +12,9 @@
 #include asm/arch/kirkwood.h
 #include asm/arch/mpp.h
 #include sheevaplug.h
+#ifdef CONFIG_MVSDIO_MMC
+# include mvsdio.h
+#endif /* CONFIG_MVSDIO_MMC */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -131,3 +134,11 @@ void reset_phy(void)
printf(88E1116 Initialized on %s\n, name);
 }
 #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+   mrvl_mmc_init(bis);
+   return 0;
+}
+#endif /* CONFIG_MRVL_MMC */
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 34febf5..1c8f275 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -37,3 +37,4 @@ obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
+obj-$(CONFIG_MVSDIO_MMC) += mvsdio.o
diff --git a/drivers/mmc/mvsdio.c b/drivers/mmc/mvsdio.c
new file mode 100644
index 000..3139526
--- /dev/null
+++ b/drivers/mmc/mvsdio.c
@@ -0,0 +1,353 @@
+/*
+ * Marvell MMC/SD/SDIO driver
+ *
+ * (C) Copyright 2012
+ * Marvell Semiconductor www.marvell.com
+ * Written-by: Maen Suleiman, Gérald Kerma
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include malloc.h
+#include part.h
+#include mmc.h
+#include asm/io.h
+#include asm/arch/cpu.h
+#include asm/arch/kirkwood.h
+
+#include mvsdio.h
+
+#define DRIVER_NAMEMVSDIO
+
+#define mvsd_write(offs, val) writel(val, CONFIG_SYS_MMC_BASE + (offs))
+#define mvsd_read(offs) readl(CONFIG_SYS_MMC_BASE + (offs))
+
+#define MRVL_MMC_MAKE_CMD(c, f) (((c  0xff)  8) | (f  0xff))
+
+static int mrvl_mmc_setup_data(struct mmc_data *data)
+{
+   u32 ctrl_reg;
+
+   debug(%s, data %s : blocks=%d blksz=%d\n, DRIVER_NAME,
+ (data-flags  MMC_DATA_READ) ? read : write,
+ data-blocks, data-blocksize);
+
+   /* default to maximum timeout */
+   ctrl_reg = mvsd_read(SDIO_HOST_CTRL);
+   ctrl_reg |= SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX);
+   mvsd_write(SDIO_HOST_CTRL, ctrl_reg);
+
+   if (data-flags  MMC_DATA_READ) {
+   mvsd_write(SDIO_SYS_ADDR_LOW, (u32)data-dest  0x);
+   mvsd_write(SDIO_SYS_ADDR_HI, (u32)data-dest  16);
+   } else {
+   mvsd_write(SDIO_SYS_ADDR_LOW, (u32)data-src  0x);
+   mvsd_write(SDIO_SYS_ADDR_HI, (u32)data-src  16);
+   }
+
+   mvsd_write(SDIO_BLK_COUNT, data-blocks);
+   mvsd_write(SDIO_BLK_SIZE, data-blocksize

[U-Boot] [PATCH v6 1/1] ARM: kirkwood: add mvsdio driver

2014-07-25 Thread Gerald Kerma
This patch add Marvell kirkwood MVSDIO/MMC driver
and enable it for Sheevaplugs and OpenRD boards.

Signed-off-by: Gerald Kerma drea...@doukki.net
---

 Changes in v6:
 - rename driver to mvebu_mmc
 - renames constants and functions
 - move mmc_init to kirkwood/cpu
 - code cleaning

 Changes in v5:
 - purge uneeded code
 - remove some extra debug

 Changes in v4:
 - rename drivers files to MVSDIO
 - fix MMC clock init which now use dev ID
 - clean debug strings
 - remove MVSDIO_TWEAK_NOSDHS quirk
 - remove dead code

 Changes in v3:
 - Add MVSDIO_TWEAK_NOSDHS quirk
 - Minor clean

 Changes in v2:
 - Fix some typo and missing lines from patch import

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c |  11 +
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |   1 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/mvebu_mmc.c   | 355 ++
 include/configs/openrd.h  |   8 +
 include/configs/sheevaplug.h  |  17 +-
 include/mvebu_mmc.h   | 279 
 7 files changed, 670 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mmc/mvebu_mmc.c
 create mode 100644 include/mvebu_mmc.h

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index da80240..94db160 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -13,6 +13,9 @@
 #include asm/io.h
 #include asm/arch/cpu.h
 #include asm/arch/kirkwood.h
+#ifdef CONFIG_MVEBU_MMC
+# include mvebu_mmc.h
+#endif /* CONFIG_MVEBU_MMC */
 
 #define BUFLEN 16
 
@@ -377,3 +380,11 @@ int cpu_eth_init(bd_t *bis)
return 0;
 }
 #endif
+
+#ifdef CONFIG_MVEBU_MMC
+int board_mmc_init(bd_t *bis)
+{
+   mvebu_mmc_init(bis);
+   return 0;
+}
+#endif /* CONFIG_MVEBU_MMC */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..3ea51d7 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
 #define KW_SATA_BASE   (KW_REGISTER(0x8))
+#define KW_SDIO_BASE   (KW_REGISTER(0x9))
 
 /* Kirkwood Sata controller has two ports */
 #define KW_SATA_PORT0_OFFSET   0x2000
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 34febf5..f5be96f 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -37,3 +37,4 @@ obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
+obj-$(CONFIG_MVEBU_MMC) += mvebu_mmc.o
diff --git a/drivers/mmc/mvebu_mmc.c b/drivers/mmc/mvebu_mmc.c
new file mode 100644
index 000..fbcb656
--- /dev/null
+++ b/drivers/mmc/mvebu_mmc.c
@@ -0,0 +1,355 @@
+/*
+ * Marvell MMC/SD/SDIO driver
+ *
+ * (C) Copyright 2012
+ * Marvell Semiconductor www.marvell.com
+ * Written-by: Maen Suleiman, Gerald Kerma
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include malloc.h
+#include part.h
+#include mmc.h
+#include asm/io.h
+#include asm/arch/cpu.h
+#include asm/arch/kirkwood.h
+
+#include mvebu_mmc.h
+
+#define DRIVER_NAMEMVEBU_MMC
+
+#define mvebu_mmc_write(offs, val) writel(val, CONFIG_SYS_MMC_BASE + (offs))
+#define mvebu_mmc_read(offs) readl(CONFIG_SYS_MMC_BASE + (offs))
+
+#define MVEBU_MMC_MAKE_CMD(c, f) (((c  0xff)  8) | (f  0xff))
+
+static int mvebu_mmc_setup_data(struct mmc_data *data)
+{
+   u32 ctrl_reg;
+
+   debug(%s, data %s : blocks=%d blksz=%d\n, DRIVER_NAME,
+ (data-flags  MMC_DATA_READ) ? read : write,
+ data-blocks, data-blocksize);
+
+   /* default to maximum timeout */
+   ctrl_reg = mvebu_mmc_read(SDIO_HOST_CTRL);
+   ctrl_reg |= SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX);
+   mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
+
+   if (data-flags  MMC_DATA_READ) {
+   mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data-dest  0x);
+   mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data-dest  16);
+   } else {
+   mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data-src  0x);
+   mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data-src  16);
+   }
+
+   mvebu_mmc_write(SDIO_BLK_COUNT, data-blocks);
+   mvebu_mmc_write(SDIO_BLK_SIZE, data-blocksize);
+
+   return 0;
+}
+
+static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+ struct mmc_data *data)
+{
+   int timeout = 10;
+   ushort waittype = 0;
+   ushort resptype = 0;
+   ushort xfertype = 0;
+   ushort resp_indx = 0;
+
+   debug(cmdidx [0x%x] resp_type[0x%x] cmdarg[0x%x]\n,
+ cmd-cmdidx, cmd-resp_type, cmd-cmdarg);
+
+   udelay(10*1000);
+
+   debug(%s: cmd %d (hw state 0x%04x)\n, DRIVER_NAME,
+ cmd

[U-Boot] [PATCH v7 1/1] ARM: kirkwood: add mvsdio driver

2014-07-25 Thread Gerald Kerma
This patch add Marvell kirkwood MVSDIO/MMC driver
and enable it for Sheevaplugs and OpenRD boards.

Signed-off-by: Gerald Kerma drea...@doukki.net
---

 Changes in v7:
 - removed unrelated stuff
 - minor code cleaning

 Changes in v6:
 - rename driver to mvebu_mmc
 - renames constants and functions
 - move mmc_init to kirkwood/cpu
 - code cleaning

 Changes in v5:
 - purge uneeded code
 - remove some extra debug

 Changes in v4:
 - rename drivers files to MVSDIO
 - fix MMC clock init which now use dev ID
 - clean debug strings
 - remove MVSDIO_TWEAK_NOSDHS quirk
 - remove dead code

 Changes in v3:
 - Add MVSDIO_TWEAK_NOSDHS quirk
 - Minor clean

 Changes in v2:
 - Fix some typo and missing lines from patch import

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c |   9 +
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |   1 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/mvebu_mmc.c   | 361 ++
 include/configs/openrd.h  |   8 +
 include/configs/sheevaplug.h  |  11 +
 include/mvebu_mmc.h   | 278 
 7 files changed, 669 insertions(+)
 create mode 100644 drivers/mmc/mvebu_mmc.c
 create mode 100644 include/mvebu_mmc.h

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index da80240..881e2de 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -13,6 +13,7 @@
 #include asm/io.h
 #include asm/arch/cpu.h
 #include asm/arch/kirkwood.h
+#include mvebu_mmc.h
 
 #define BUFLEN 16
 
@@ -377,3 +378,11 @@ int cpu_eth_init(bd_t *bis)
return 0;
 }
 #endif
+
+#ifdef CONFIG_MVEBU_MMC
+int board_mmc_init(bd_t *bis)
+{
+   mvebu_mmc_init(bis);
+   return 0;
+}
+#endif /* CONFIG_MVEBU_MMC */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..3ea51d7 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
 #define KW_SATA_BASE   (KW_REGISTER(0x8))
+#define KW_SDIO_BASE   (KW_REGISTER(0x9))
 
 /* Kirkwood Sata controller has two ports */
 #define KW_SATA_PORT0_OFFSET   0x2000
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 34febf5..f5be96f 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -37,3 +37,4 @@ obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
+obj-$(CONFIG_MVEBU_MMC) += mvebu_mmc.o
diff --git a/drivers/mmc/mvebu_mmc.c b/drivers/mmc/mvebu_mmc.c
new file mode 100644
index 000..9759198
--- /dev/null
+++ b/drivers/mmc/mvebu_mmc.c
@@ -0,0 +1,361 @@
+/*
+ * Marvell MMC/SD/SDIO driver
+ *
+ * (C) Copyright 2012
+ * Marvell Semiconductor www.marvell.com
+ * Written-by: Maen Suleiman, Gerald Kerma
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include malloc.h
+#include part.h
+#include mmc.h
+#include asm/io.h
+#include asm/arch/cpu.h
+#include asm/arch/kirkwood.h
+#include mvebu_mmc.h
+
+#define DRIVER_NAME MVEBU_MMC
+
+static void mvebu_mmc_write(u32 offs, u32 val)
+{
+   writel(val, CONFIG_SYS_MMC_BASE + (offs));
+}
+
+static u32 mvebu_mmc_read(u32 offs)
+{
+   return readl(CONFIG_SYS_MMC_BASE + (offs));
+}
+
+static int mvebu_mmc_setup_data(struct mmc_data *data)
+{
+   u32 ctrl_reg;
+
+   debug(%s, data %s : blocks=%d blksz=%d\n, DRIVER_NAME,
+ (data-flags  MMC_DATA_READ) ? read : write,
+ data-blocks, data-blocksize);
+
+   /* default to maximum timeout */
+   ctrl_reg = mvebu_mmc_read(SDIO_HOST_CTRL);
+   ctrl_reg |= SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX);
+   mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
+
+   if (data-flags  MMC_DATA_READ) {
+   mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data-dest  0x);
+   mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data-dest  16);
+   } else {
+   mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data-src  0x);
+   mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data-src  16);
+   }
+
+   mvebu_mmc_write(SDIO_BLK_COUNT, data-blocks);
+   mvebu_mmc_write(SDIO_BLK_SIZE, data-blocksize);
+
+   return 0;
+}
+
+static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+ struct mmc_data *data)
+{
+   int timeout = 10;
+   ushort waittype = 0;
+   ushort resptype = 0;
+   ushort xfertype = 0;
+   ushort resp_indx = 0;
+
+   debug(cmdidx [0x%x] resp_type[0x%x] cmdarg[0x%x]\n,
+ cmd-cmdidx, cmd-resp_type, cmd-cmdarg);
+
+   udelay(10*1000);
+
+   debug(%s: cmd %d (hw state 0x%04x)\n, DRIVER_NAME,
+ cmd-cmdidx, mvebu_mmc_read

[U-Boot] [PATCH v4 1/1] ARM: kirkwood: add mvsdio driver

2014-07-24 Thread Gerald Kerma
Signed-off-by: Gerald Kerma drea...@doukki.net
---
 Changes in v4:
 - rename drivers files to MVSDIO
 - fix MMC clock init which now use dev ID
 - clean debug strings
 - remove MVSDIO_TWEAK_NOSDHS quirk
 - remove dead code

 Changes in v3:
 - Add MVSDIO_TWEAK_NOSDHS quirk
 - Minor clean

 Changes in v2:
 - Fix some typo and missing lines from patch import

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c  |  58 
 arch/arm/include/asm/arch-kirkwood/config.h|   2 +
 arch/arm/include/asm/arch-kirkwood/cpu.h   |   2 +
 arch/arm/include/asm/arch-kirkwood/kirkwood.h  |  24 ++
 arch/arm/include/asm/arch-kirkwood/kw88f6282.h |  33 +++
 board/Marvell/openrd/openrd.c  |  11 +
 board/Marvell/sheevaplug/sheevaplug.c  |  11 +
 drivers/mmc/Makefile   |   1 +
 drivers/mmc/mvsdio.c   | 384 +
 include/configs/openrd.h   |   8 +
 include/configs/sheevaplug.h   |  19 +-
 include/mvsdio.h   | 279 ++
 12 files changed, 830 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-kirkwood/kw88f6282.h
 create mode 100644 drivers/mmc/mvsdio.c
 create mode 100644 include/mvsdio.h

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index da80240..472aa8a 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -333,6 +333,64 @@ int arch_cpu_init(void)
 }
 #endif /* CONFIG_ARCH_CPU_INIT */
 
+/*
+ * General
+ /
+#if defined(CONFIG_ARCH_DEV_ID)
+
+void kirkwood_pcie_id(u32 *dev, u32 *rev)
+{
+   *dev = (readl(KW_REG_PCIE_DEVID)  16)  0x;
+   *rev = readl(KW_REG_PCIE_REVID)  0xff;
+}
+
+/*
+ * Identify device ID and revision.
+ */
+char *kirkwood_id(void)
+{
+   u32 dev, rev;
+
+   kirkwood_pcie_id(dev, rev);
+
+   if (dev == MV88F6281_DEV_ID) {
+   if (rev == MV88F6281_REV_Z0)
+   return MV88F6281-Z0;
+   else if (rev == MV88F6281_REV_A0)
+   return MV88F6281-A0;
+   else if (rev == MV88F6281_REV_A1)
+   return MV88F6281-A1;
+   else
+   return MV88F6281-Rev-Unsupported;
+   } else if (dev == MV88F6192_DEV_ID) {
+   if (rev == MV88F6192_REV_Z0)
+   return MV88F6192-Z0;
+   else if (rev == MV88F6192_REV_A0)
+   return MV88F6192-A0;
+   else if (rev == MV88F6192_REV_A1)
+   return MV88F6192-A1;
+   else
+   return MV88F6192-Rev-Unsupported;
+   } else if (dev == MV88F6180_DEV_ID) {
+   if (rev == MV88F6180_REV_A0)
+   return MV88F6180-Rev-A0;
+   else if (rev == MV88F6180_REV_A1)
+   return MV88F6180-Rev-A1;
+   else
+   return MV88F6180-Rev-Unsupported;
+   } else if (dev == MV88F6282_DEV_ID) {
+   if (rev == MV88F6282_REV_A0)
+   return MV88F6282-Rev-A0;
+   else if (rev == MV88F6282_REV_A1)
+   return MV88F6282-Rev-A1;
+   else
+   return MV88F6282-Rev-Unsupported;
+   } else {
+   return Device-Unknown;
+   }
+}
+#endif /* CONFIG_ARCH_DEV_ID */
+
 /*
  * SOC specific misc init
  */
diff --git a/arch/arm/include/asm/arch-kirkwood/config.h 
b/arch/arm/include/asm/arch-kirkwood/config.h
index 7a688e4..a0563a3 100644
--- a/arch/arm/include/asm/arch-kirkwood/config.h
+++ b/arch/arm/include/asm/arch-kirkwood/config.h
@@ -19,6 +19,8 @@
 #include asm/arch/kw88f6281.h
 #elif defined (CONFIG_KW88F6192)
 #include asm/arch/kw88f6192.h
+#elif defined(CONFIG_KW88F6182)
+#include asm/arch/kw88f6182.h
 #else
 #error SOC Name not defined
 #endif /* CONFIG_KW88F6281 */
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h 
b/arch/arm/include/asm/arch-kirkwood/cpu.h
index 97daa40..e7b6448 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -151,5 +151,7 @@ int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
unsigned int mpp32_39, unsigned int mpp40_47,
unsigned int mpp48_55);
 unsigned int kw_winctrl_calcsize(unsigned int sizeval);
+void kirkwood_pcie_id(u32 *dev, u32 *rev);
+char *kirkwood_id(void);
 #endif /* __ASSEMBLY__ */
 #endif /* _KWCPU_H */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..489517f 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE

[U-Boot] [PATCH v3 1/1] ARM: kirkwood: add mvsdio driver

2014-07-22 Thread Gerald Kerma
This patch add Marvell kirkwood MVSDIO/MMC driver and enable it for Sheevaplugs
and OpenRD boards.

Signed-off-by: Gerald Kerma drea...@doukki.net
---

Changes in v3:
- Add MVSDIO_TWEAK_NOSDHS quirk
- Minor clean

Changes in v2:
- Fix some typo and missing lines from patch import

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c  |  58 
 arch/arm/include/asm/arch-kirkwood/config.h|   2 +
 arch/arm/include/asm/arch-kirkwood/cpu.h   |   2 +
 arch/arm/include/asm/arch-kirkwood/kirkwood.h  |  24 ++
 arch/arm/include/asm/arch-kirkwood/kw88f6282.h |  33 ++
 board/Marvell/openrd/openrd.c  |  11 +
 board/Marvell/sheevaplug/sheevaplug.c  |  11 +
 drivers/mmc/Makefile   |   1 +
 drivers/mmc/mrvl_mmc.c | 461 +
 include/configs/openrd.h   |   8 +
 include/configs/sheevaplug.h   |  19 +-
 include/mrvl_mmc.h | 290 
 12 files changed, 918 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-kirkwood/kw88f6282.h
 create mode 100644 drivers/mmc/mrvl_mmc.c
 create mode 100644 include/mrvl_mmc.h

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index d4711c0..a6e18ff 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -334,6 +334,64 @@ int arch_cpu_init(void)
 }
 #endif /* CONFIG_ARCH_CPU_INIT */
 
+/*
+ * General
+ /
+#if defined(CONFIG_ARCH_DEV_ID)
+
+void kirkwood_pcie_id(u32 *dev, u32 *rev)
+{
+   *dev = (readl(KW_REG_PCIE_DEVID)  16)  0x;
+   *rev = readl(KW_REG_PCIE_REVID)  0xff;
+}
+
+/*
+ * Identify device ID and revision.
+ */
+char *kirkwood_id(void)
+{
+   u32 dev, rev;
+
+   kirkwood_pcie_id(dev, rev);
+
+   if (dev == MV88F6281_DEV_ID) {
+   if (rev == MV88F6281_REV_Z0)
+   return MV88F6281-Z0;
+   else if (rev == MV88F6281_REV_A0)
+   return MV88F6281-A0;
+   else if (rev == MV88F6281_REV_A1)
+   return MV88F6281-A1;
+   else
+   return MV88F6281-Rev-Unsupported;
+   } else if (dev == MV88F6192_DEV_ID) {
+   if (rev == MV88F6192_REV_Z0)
+   return MV88F6192-Z0;
+   else if (rev == MV88F6192_REV_A0)
+   return MV88F6192-A0;
+   else if (rev == MV88F6192_REV_A1)
+   return MV88F6192-A1;
+   else
+   return MV88F6192-Rev-Unsupported;
+   } else if (dev == MV88F6180_DEV_ID) {
+   if (rev == MV88F6180_REV_A0)
+   return MV88F6180-Rev-A0;
+   else if (rev == MV88F6180_REV_A1)
+   return MV88F6180-Rev-A1;
+   else
+   return MV88F6180-Rev-Unsupported;
+   } else if (dev == MV88F6282_DEV_ID) {
+   if (rev == MV88F6282_REV_A0)
+   return MV88F6282-Rev-A0;
+   else if (rev == MV88F6282_REV_A1)
+   return MV88F6282-Rev-A1;
+   else
+   return MV88F6282-Rev-Unsupported;
+   } else {
+   return Device-Unknown;
+   }
+}
+#endif /* CONFIG_ARCH_DEV_ID */
+
 /*
  * SOC specific misc init
  */
diff --git a/arch/arm/include/asm/arch-kirkwood/config.h 
b/arch/arm/include/asm/arch-kirkwood/config.h
index 7a688e4..a0563a3 100644
--- a/arch/arm/include/asm/arch-kirkwood/config.h
+++ b/arch/arm/include/asm/arch-kirkwood/config.h
@@ -19,6 +19,8 @@
 #include asm/arch/kw88f6281.h
 #elif defined (CONFIG_KW88F6192)
 #include asm/arch/kw88f6192.h
+#elif defined(CONFIG_KW88F6182)
+#include asm/arch/kw88f6182.h
 #else
 #error SOC Name not defined
 #endif /* CONFIG_KW88F6281 */
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h 
b/arch/arm/include/asm/arch-kirkwood/cpu.h
index 97daa40..e7b6448 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -151,5 +151,7 @@ int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
unsigned int mpp32_39, unsigned int mpp40_47,
unsigned int mpp48_55);
 unsigned int kw_winctrl_calcsize(unsigned int sizeval);
+void kirkwood_pcie_id(u32 *dev, u32 *rev);
+char *kirkwood_id(void);
 #endif /* __ASSEMBLY__ */
 #endif /* _KWCPU_H */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..489517f 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE

[U-Boot] [PATCH 1/1] ARM: kirkwood: add mvsdio driver

2014-07-20 Thread Gerald Kerma
This patch add Marvell kirkwood MVSDIO/MMC driver and enable it for Sheevaplugs
and OpenRD boards.

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 arch/arm/cpu/arm926ejs/kirkwood/cpu.c  |  58 
 arch/arm/include/asm/arch-kirkwood/config.h|   2 +
 arch/arm/include/asm/arch-kirkwood/cpu.h   |   2 +
 arch/arm/include/asm/arch-kirkwood/kirkwood.h  |  24 ++
 arch/arm/include/asm/arch-kirkwood/kw88f6282.h |  33 ++
 board/Marvell/openrd/openrd.c  |  11 +
 board/Marvell/sheevaplug/sheevaplug.c  |  11 +
 drivers/mmc/Makefile   |   1 +
 drivers/mmc/mrvl_mmc.c | 460 +
 include/configs/openrd.h   |   8 +
 include/configs/sheevaplug.h   |  19 +-
 include/mrvl_mmc.h | 289 
 12 files changed, 916 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-kirkwood/kw88f6282.h
 create mode 100644 drivers/mmc/mrvl_mmc.c
 create mode 100644 include/mrvl_mmc.h

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index da80240..472aa8a 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -333,6 +333,64 @@ int arch_cpu_init(void)
 }
 #endif /* CONFIG_ARCH_CPU_INIT */
 
+/*
+ * General
+ /
+#if defined(CONFIG_ARCH_DEV_ID)
+
+void kirkwood_pcie_id(u32 *dev, u32 *rev)
+{
+   *dev = (readl(KW_REG_PCIE_DEVID)  16)  0x;
+   *rev = readl(KW_REG_PCIE_REVID)  0xff;
+}
+
+/*
+ * Identify device ID and revision.
+ */
+char *kirkwood_id(void)
+{
+   u32 dev, rev;
+
+   kirkwood_pcie_id(dev, rev);
+
+   if (dev == MV88F6281_DEV_ID) {
+   if (rev == MV88F6281_REV_Z0)
+   return MV88F6281-Z0;
+   else if (rev == MV88F6281_REV_A0)
+   return MV88F6281-A0;
+   else if (rev == MV88F6281_REV_A1)
+   return MV88F6281-A1;
+   else
+   return MV88F6281-Rev-Unsupported;
+   } else if (dev == MV88F6192_DEV_ID) {
+   if (rev == MV88F6192_REV_Z0)
+   return MV88F6192-Z0;
+   else if (rev == MV88F6192_REV_A0)
+   return MV88F6192-A0;
+   else if (rev == MV88F6192_REV_A1)
+   return MV88F6192-A1;
+   else
+   return MV88F6192-Rev-Unsupported;
+   } else if (dev == MV88F6180_DEV_ID) {
+   if (rev == MV88F6180_REV_A0)
+   return MV88F6180-Rev-A0;
+   else if (rev == MV88F6180_REV_A1)
+   return MV88F6180-Rev-A1;
+   else
+   return MV88F6180-Rev-Unsupported;
+   } else if (dev == MV88F6282_DEV_ID) {
+   if (rev == MV88F6282_REV_A0)
+   return MV88F6282-Rev-A0;
+   else if (rev == MV88F6282_REV_A1)
+   return MV88F6282-Rev-A1;
+   else
+   return MV88F6282-Rev-Unsupported;
+   } else {
+   return Device-Unknown;
+   }
+}
+#endif /* CONFIG_ARCH_DEV_ID */
+
 /*
  * SOC specific misc init
  */
diff --git a/arch/arm/include/asm/arch-kirkwood/config.h 
b/arch/arm/include/asm/arch-kirkwood/config.h
index 7a688e4..a0563a3 100644
--- a/arch/arm/include/asm/arch-kirkwood/config.h
+++ b/arch/arm/include/asm/arch-kirkwood/config.h
@@ -19,6 +19,8 @@
 #include asm/arch/kw88f6281.h
 #elif defined (CONFIG_KW88F6192)
 #include asm/arch/kw88f6192.h
+#elif defined(CONFIG_KW88F6182)
+#include asm/arch/kw88f6182.h
 #else
 #error SOC Name not defined
 #endif /* CONFIG_KW88F6281 */
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h 
b/arch/arm/include/asm/arch-kirkwood/cpu.h
index 97daa40..e7b6448 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -151,5 +151,7 @@ int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
unsigned int mpp32_39, unsigned int mpp40_47,
unsigned int mpp48_55);
 unsigned int kw_winctrl_calcsize(unsigned int sizeval);
+void kirkwood_pcie_id(u32 *dev, u32 *rev);
+char *kirkwood_id(void);
 #endif /* __ASSEMBLY__ */
 #endif /* _KWCPU_H */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..489517f 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
 #define KW_SATA_BASE   (KW_REGISTER(0x8))
+#define KW_SDIO_BASE

[U-Boot] [PATCH v2 1/1] ARM: kirkwood: add mvsdio driver

2014-07-20 Thread Gerald Kerma
This patch add Marvell kirkwood MVSDIO/MMC driver and enable it for Sheevaplugs
and OpenRD boards.
- Fix some typo and missing lines from patch import

Signed-off-by: Gerald Kerma drea...@doukki.net
---
 arch/arm/cpu/arm926ejs/kirkwood/cpu.c  |  58 
 arch/arm/include/asm/arch-kirkwood/config.h|   2 +
 arch/arm/include/asm/arch-kirkwood/cpu.h   |   2 +
 arch/arm/include/asm/arch-kirkwood/kirkwood.h  |  24 ++
 arch/arm/include/asm/arch-kirkwood/kw88f6282.h |  33 ++
 board/Marvell/openrd/openrd.c  |  11 +
 board/Marvell/sheevaplug/sheevaplug.c  |  11 +
 drivers/mmc/Makefile   |   1 +
 drivers/mmc/mrvl_mmc.c | 463 +
 include/configs/openrd.h   |   8 +
 include/configs/sheevaplug.h   |  19 +-
 include/mrvl_mmc.h | 290 
 12 files changed, 920 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-kirkwood/kw88f6282.h
 create mode 100644 drivers/mmc/mrvl_mmc.c
 create mode 100644 include/mrvl_mmc.h

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index da80240..472aa8a 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -333,6 +333,64 @@ int arch_cpu_init(void)
 }
 #endif /* CONFIG_ARCH_CPU_INIT */
 
+/*
+ * General
+ /
+#if defined(CONFIG_ARCH_DEV_ID)
+
+void kirkwood_pcie_id(u32 *dev, u32 *rev)
+{
+   *dev = (readl(KW_REG_PCIE_DEVID)  16)  0x;
+   *rev = readl(KW_REG_PCIE_REVID)  0xff;
+}
+
+/*
+ * Identify device ID and revision.
+ */
+char *kirkwood_id(void)
+{
+   u32 dev, rev;
+
+   kirkwood_pcie_id(dev, rev);
+
+   if (dev == MV88F6281_DEV_ID) {
+   if (rev == MV88F6281_REV_Z0)
+   return MV88F6281-Z0;
+   else if (rev == MV88F6281_REV_A0)
+   return MV88F6281-A0;
+   else if (rev == MV88F6281_REV_A1)
+   return MV88F6281-A1;
+   else
+   return MV88F6281-Rev-Unsupported;
+   } else if (dev == MV88F6192_DEV_ID) {
+   if (rev == MV88F6192_REV_Z0)
+   return MV88F6192-Z0;
+   else if (rev == MV88F6192_REV_A0)
+   return MV88F6192-A0;
+   else if (rev == MV88F6192_REV_A1)
+   return MV88F6192-A1;
+   else
+   return MV88F6192-Rev-Unsupported;
+   } else if (dev == MV88F6180_DEV_ID) {
+   if (rev == MV88F6180_REV_A0)
+   return MV88F6180-Rev-A0;
+   else if (rev == MV88F6180_REV_A1)
+   return MV88F6180-Rev-A1;
+   else
+   return MV88F6180-Rev-Unsupported;
+   } else if (dev == MV88F6282_DEV_ID) {
+   if (rev == MV88F6282_REV_A0)
+   return MV88F6282-Rev-A0;
+   else if (rev == MV88F6282_REV_A1)
+   return MV88F6282-Rev-A1;
+   else
+   return MV88F6282-Rev-Unsupported;
+   } else {
+   return Device-Unknown;
+   }
+}
+#endif /* CONFIG_ARCH_DEV_ID */
+
 /*
  * SOC specific misc init
  */
diff --git a/arch/arm/include/asm/arch-kirkwood/config.h 
b/arch/arm/include/asm/arch-kirkwood/config.h
index 7a688e4..a0563a3 100644
--- a/arch/arm/include/asm/arch-kirkwood/config.h
+++ b/arch/arm/include/asm/arch-kirkwood/config.h
@@ -19,6 +19,8 @@
 #include asm/arch/kw88f6281.h
 #elif defined (CONFIG_KW88F6192)
 #include asm/arch/kw88f6192.h
+#elif defined(CONFIG_KW88F6182)
+#include asm/arch/kw88f6182.h
 #else
 #error SOC Name not defined
 #endif /* CONFIG_KW88F6281 */
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h 
b/arch/arm/include/asm/arch-kirkwood/cpu.h
index 97daa40..e7b6448 100644
--- a/arch/arm/include/asm/arch-kirkwood/cpu.h
+++ b/arch/arm/include/asm/arch-kirkwood/cpu.h
@@ -151,5 +151,7 @@ int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
unsigned int mpp32_39, unsigned int mpp40_47,
unsigned int mpp48_55);
 unsigned int kw_winctrl_calcsize(unsigned int sizeval);
+void kirkwood_pcie_id(u32 *dev, u32 *rev);
+char *kirkwood_id(void);
 #endif /* __ASSEMBLY__ */
 #endif /* _KWCPU_H */
diff --git a/arch/arm/include/asm/arch-kirkwood/kirkwood.h 
b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
index bc207f5..489517f 100644
--- a/arch/arm/include/asm/arch-kirkwood/kirkwood.h
+++ b/arch/arm/include/asm/arch-kirkwood/kirkwood.h
@@ -39,6 +39,7 @@
 #define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
 #define KW_SATA_BASE   (KW_REGISTER