diff mbox

[U-Boot,v2] lsxl: add support for lschlv2 and lsxhl

Message ID 1330700546-27631-1-git-send-email-michael@walle.cc
State Superseded
Headers show

Commit Message

Michael Walle March 2, 2012, 3:02 p.m. UTC
This patchset adds support for both the Linkstation Live (LS-CHLv2) and
Linkstation Pro (LS-XHL) by Buffalo.

Signed-off-by: Michael Walle <michael@walle.cc>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Cc: Wolfgang Denk <wd@denx.de>
---

v2:
 - add to buffalo vendor directory instead of Marvell
 - add both boards to MAINTAINERS
 - don't define values for feature macros
 - use tab for vertical alignment
 - remove static network configuration, instead introduce a rescue mode
 - add some convenience scripts
 - small cleanups

 MAINTAINERS                           |    5 +
 board/buffalo/lsxl/Makefile           |   50 ++++++
 board/buffalo/lsxl/config.mk          |    1 +
 board/buffalo/lsxl/kwbimage-lschl.cfg |   66 ++++++++
 board/buffalo/lsxl/kwbimage-lsxhl.cfg |   66 ++++++++
 board/buffalo/lsxl/lsxl.c             |  294 +++++++++++++++++++++++++++++++++
 board/buffalo/lsxl/lsxl.h             |   75 +++++++++
 boards.cfg                            |    3 +
 include/configs/lsxl.h                |  171 +++++++++++++++++++
 9 files changed, 731 insertions(+), 0 deletions(-)
 create mode 100644 board/buffalo/lsxl/Makefile
 create mode 100644 board/buffalo/lsxl/config.mk
 create mode 100644 board/buffalo/lsxl/kwbimage-lschl.cfg
 create mode 100644 board/buffalo/lsxl/kwbimage-lsxhl.cfg
 create mode 100644 board/buffalo/lsxl/lsxl.c
 create mode 100644 board/buffalo/lsxl/lsxl.h
 create mode 100644 include/configs/lsxl.h

Comments

Michael Walle March 26, 2012, 10:15 a.m. UTC | #1
On Fri, March 2, 2012 17:02, Michael Walle wrote:
> This patchset adds support for both the Linkstation Live (LS-CHLv2) and
> Linkstation Pro (LS-XHL) by Buffalo.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
>
> v2:
>  - add to buffalo vendor directory instead of Marvell
>  - add both boards to MAINTAINERS
>  - don't define values for feature macros
>  - use tab for vertical alignment
>  - remove static network configuration, instead introduce a rescue mode
>  - add some convenience scripts
>  - small cleanups

Ping :)
Prafulla Wadaskar March 27, 2012, 7:27 a.m. UTC | #2
>

Please use "Kirkwood: add xxx board support" as a patch heading to identify the patch for kirkwood

> This patchset adds support for both the Linkstation Live (LS-CHLv2) and
> Linkstation Pro (LS-XHL) by Buffalo.
>
> Signed-off-by: Michael Walle <michael <at> walle.cc>
> Cc: Prafulla Wadaskar <prafulla <at> marvell.com>
> Cc: Wolfgang Denk <wd <at> denx.de>
> ---
>
> v2:
>  - add to buffalo vendor directory instead of Marvell
>  - add both boards to MAINTAINERS
>  - don't define values for feature macros
>  - use tab for vertical alignment
>  - remove static network configuration, instead introduce a rescue mode
>  - add some convenience scripts
>  - small cleanups
>
>  MAINTAINERS                           |    5 +
>  board/buffalo/lsxl/Makefile           |   50 ++++++
>  board/buffalo/lsxl/config.mk          |    1 +
>  board/buffalo/lsxl/kwbimage-lschl.cfg |   66 ++++++++
>  board/buffalo/lsxl/kwbimage-lsxhl.cfg |   66 ++++++++
>  board/buffalo/lsxl/lsxl.c             |  294
+++++++++++++++++++++++++++++++++
>  board/buffalo/lsxl/lsxl.h             |   75 +++++++++
>  boards.cfg                            |    3 +
>  include/configs/lsxl.h                |  171 +++++++++++++++++++
>  9 files changed, 731 insertions(+), 0 deletions(-)
>  create mode 100644 board/buffalo/lsxl/Makefile
>  create mode 100644 board/buffalo/lsxl/config.mk
>  create mode 100644 board/buffalo/lsxl/kwbimage-lschl.cfg
>  create mode 100644 board/buffalo/lsxl/kwbimage-lsxhl.cfg
>  create mode 100644 board/buffalo/lsxl/lsxl.c
>  create mode 100644 board/buffalo/lsxl/lsxl.h
>  create mode 100644 include/configs/lsxl.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1e40af2..25a5a5d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -905,6 +905,11 @@ Prafulla Wadaskar <prafulla <at> marvell.com>
>       rd6281a         ARM926EJS (Kirkwood SoC)
>       sheevaplug      ARM926EJS (Kirkwood SoC)
>
> +Michael Walle <michael <at> walle.cc>
> +
> +     lschlv2         ARM926EJS (Kirkwood SoC)
> +     lsxhl           ARM926EJS (Kirkwood SoC)
> +
>  Tom Warren <twarren <at> nvidia.com>
>
>       harmony         Tegra2 (ARM7 & A9 Dual Core)
> diff --git a/board/buffalo/lsxl/Makefile b/board/buffalo/lsxl/Makefile
> new file mode 100644
> index 0000000..4c08079
> --- /dev/null
> +++ b/board/buffalo/lsxl/Makefile
> @@ -0,0 +1,50 @@
> +#
> +# Copyright (c) 2011 Michael Walle
> +# Michael Walle <michael <at> walle.cc>
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.        See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA 02110-1301 USA
> +#
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB  = $(obj)lib$(BOARD).o
> +
> +COBJS        := lsxl.o
> +
> +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> +OBJS := $(addprefix $(obj),$(COBJS))
> +SOBJS        := $(addprefix $(obj),$(SOBJS))
> +
> +$(LIB):      $(obj).depend $(OBJS) $(SOBJS)
> +     $(call cmd_link_o_target, $(OBJS) $(SOBJS))
> +
> +clean:
> +     rm -f $(SOBJS) $(OBJS)
> +
> +distclean:   clean
> +     rm -f $(LIB) core *.bak .depend
> +
> +#########################################################################
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#########################################################################
> diff --git a/board/buffalo/lsxl/config.mk b/board/buffalo/lsxl/config.mk
> new file mode 100644
> index 0000000..062554b
> --- /dev/null
> +++ b/board/buffalo/lsxl/config.mk
> @@ -0,0 +1 @@
> +ALL-y += $(obj)u-boot.kwb

Pls remove this file

> diff --git a/board/buffalo/lsxl/kwbimage-lschl.cfg
b/board/buffalo/lsxl/kwbimage-lschl.cfg
> new file mode 100644
> index 0000000..4d96c3f
> --- /dev/null
> +++ b/board/buffalo/lsxl/kwbimage-lschl.cfg
> @@ -0,0 +1,66 @@
> +#
> +# Copyright (c) 2011 Michael Walle
> +# Michael Walle <michael <at> walle.cc>
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA 02110-1301 USA
> +#
> +# Refer docs/README.kwimage for more details about how-to configure
> +# and create kirkwood boot image
> +#
> +
> +# Boot Media configurations
> +BOOT_FROM    spi     # Boot from SPI flash
> +
> +# SOC registers configuration using bootrom header extension
> +# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
> +
> +# Configure RGMII-0/1 interface pad voltage to 1.8V
> +DATA 0xFFD100E0 0x1B1B1B9B
> +
> +DATA 0xFFD20134 0xBBBBBBBB  # L2 RAM Timing 0
> +DATA 0xFFD20138 0x00BBBBBB  # L2 RAM Timint 1
> +
> +# DRAM configuration
> +DATA 0xFFD01400 0x43000618  # DDR Configuration register
> +DATA 0xFFD01404 0x39543000  # DDR Controller Control Low
> +DATA 0xFFD01408 0x3302444F  # DDR Timing (Low)
> +DATA 0xFFD0140C 0x00000823  # DDR Timing (High)
> +DATA 0xFFD01410 0x00000009  # DDR Address Control
> +DATA 0xFFD01414 0x00000000   # DDR Open Pages Control
> +DATA 0xFFD01418 0x00000000   # DDR Operation
> +DATA 0xFFD0141C 0x00000652  # DDR Mode
> +DATA 0xFFD01420 0x00000042  # DDR Extended Mode
> +DATA 0xFFD01424 0x0000F1FF  # DDR Controller Control High
> +DATA 0xFFD01428 0x00085520   # DDR2 ODT Read Timing (default values)
> +DATA 0xFFD0147C 0x00008552   # DDR2 ODT Write Timing (default values)
> +DATA 0xFFD0142C 0x00000000  # DDR Operation Control
> +
> +DATA 0xFFD01500 0x00000000   # CS[0]n Base address to 0x0
> +DATA 0xFFD01504 0x03FFFFF1  # CS[0]n Size
> +DATA 0xFFD0150C 0x00000000   # CS[1]n Size, window disabled
> +DATA 0xFFD01514 0x00000000   # CS[2]n Size, window disabled
> +DATA 0xFFD0151C 0x00000000   # CS[3]n Size, window disabled
> +
> +DATA 0xFFD01494 0x003C0000  # DDR ODT Control (Low)
> +DATA 0xFFD01498 0x00000000   # DDR ODT Control (High)
> +DATA 0xFFD0149C 0x0000E80F  # CPU ODT Control
> +DATA 0xFFD01480 0x00000001   # DDR Initialization Control

Please use the syntax like other kwbimage.cfg file with detailed description of each entry

> +
> +# End of Header extension
> +DATA 0x0 0x0
> diff --git a/board/buffalo/lsxl/kwbimage-lsxhl.cfg
b/board/buffalo/lsxl/kwbimage-lsxhl.cfg
> new file mode 100644
> index 0000000..1f978fe
> --- /dev/null
> +++ b/board/buffalo/lsxl/kwbimage-lsxhl.cfg

BTW: What is difference between them? if it is very small you can manage it through c file.

> @@ -0,0 +1,66 @@
> +#
> +# Copyright (c) 2011 Michael Walle
> +# Michael Walle <michael <at> walle.cc>
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA 02110-1301 USA
> +#
> +# Refer docs/README.kwimage for more details about how-to configure
> +# and create kirkwood boot image
> +#
> +
> +# Boot Media configurations
> +BOOT_FROM      spi     # Boot from SPI flash
> +
> +# SOC registers configuration using bootrom header extension
> +# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
> +
> +# Configure RGMII-0/1 interface pad voltage to 1.8V
> +DATA 0xFFD100E0 0x1B1B9B9B
> +
> +DATA 0xFFD20134 0xBBBBBBBB  # L2 RAM Timing 0
> +DATA 0xFFD20138 0x00BBBBBB  # L2 RAM Timint 1
> +
> +# DRAM configuration
> +DATA 0xFFD01400 0x43000618  # DDR Configuration register
> +DATA 0xFFD01404 0x39543010  # DDR Controller Control Low
> +DATA 0xFFD01408 0x22125441  # DDR Timing (Low)
> +DATA 0xFFD0140C 0x00000832  # DDR Timing (High)
> +DATA 0xFFD01410 0x0000000C  # DDR Address Control
> +DATA 0xFFD01414 0x00000000     # DDR Open Pages Control
> +DATA 0xFFD01418 0x00000000     # DDR Operation
> +DATA 0xFFD0141C 0x00000652  # DDR Mode
> +DATA 0xFFD01420 0x00000006  # DDR Extended Mode
> +DATA 0xFFD01424 0x0000F17F  # DDR Controller Control High
> +DATA 0xFFD01428 0x00085520     # DDR2 ODT Read Timing (default values)
> +DATA 0xFFD0147C 0x00008552     # DDR2 ODT Write Timing (default values)
> +DATA 0xFFD0142C 0x00000000  # DDR Operation Control
> +
> +DATA 0xFFD01500 0x00000000     # CS[0]n Base address to 0x0
> +DATA 0xFFD01504 0x0FFFFFF1  # CS[0]n Size
> +DATA 0xFFD0150C 0x00000000     # CS[1]n Size, window disabled
> +DATA 0xFFD01514 0x00000000     # CS[2]n Size, window disabled
> +DATA 0xFFD0151C 0x00000000     # CS[3]n Size, window disabled
> +
> +DATA 0xFFD01494 0x00010000  # DDR ODT Control (Low)
> +DATA 0xFFD01498 0x00000000     # DDR ODT Control (High)
> +DATA 0xFFD0149C 0x0000E80F  # CPU ODT Control
> +DATA 0xFFD01480 0x00000001     # DDR Initialization Control
> +
> +# End of Header extension
> +DATA 0x0 0x0
> diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
> new file mode 100644
> index 0000000..1b9f024
> --- /dev/null
> +++ b/board/buffalo/lsxl/lsxl.c
> @@ -0,0 +1,294 @@
> +/*
> + * Copyright (c) 2011 Michael Walle
> + * Michael Walle <michael <at> walle.cc>
> + *
> + * Based on sheevaplug/sheevaplug.c by
> + *   Marvell Semiconductor <www.marvell.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> + * MA 02110-1301 USA
> + */
> +
> +#include <common.h>
> +#include <malloc.h>
> +#include <netdev.h>
> +#include <miiphy.h>
> +#include <asm/arch/kirkwood.h>
> +#include <asm/arch/cpu.h>
> +#include <asm/arch/mpp.h>
> +#include <asm/arch/gpio.h>
> +#include <spi_flash.h>
> +
> +#include "lsxl.h"
> +
> +/*
> + * Rescue mode
> + *
> + * Selected by holding the push button for 3 seconds, while powering on
> + * the device.
> + *
> + * These linkstations don't have a (populated) serial port. There is no
> + * way to access an (unmodified) board other than using the netconsole. If
> + * you want to recover from a bad environment setting or an empty
environment,
> + * you can do this only with a working network connection. Therefore, the
> + * following network configuration will be set when rescue mode is stared.
> + * Additionally, the bootsource is set to 'cli'.
> + */
> +#define RESCUE_ETHADDR   "02:00:01:00:00:00"
> +#define RESCUE_IPADDR    "192.168.11.150"
> +#define RESCUE_NETMASK   "255.255.255.0"
> +#define RESCUE_SERVERIP  "192.168.11.1"

NAK, no hardcoding please.

> +#define RESCUE_NCIP      RESCUE_SERVERIP
> +
> +#ifndef CONFIG_ENV_OVERWRITE
> +# error "You need to set CONFIG_ENV_OVERWRITE"
> +#endif
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +int board_early_init_f(void)
> +{
> +     /*
> +      * default gpio configuration
> +      * There are maximum 64 gpios controlled through 2 sets of registers
> +      * the  below configuration configures mainly initial LED status
> +      */
> +     kw_config_gpio(LSXL_OE_VAL_LOW,
> +                     LSXL_OE_VAL_HIGH,
> +                     LSXL_OE_LOW, LSXL_OE_HIGH);
> +
> +     /* Multi-Purpose Pins Functionality configuration */
> +     u32 kwmpp_config[] = {
> +             MPP0_SPI_SCn,
> +             MPP1_SPI_MOSI,
> +             MPP2_SPI_SCK,
> +             MPP3_SPI_MISO,
> +             MPP4_UART0_RXD,
> +             MPP5_UART0_TXD,
> +             MPP6_SYSRST_OUTn,
> +             MPP7_GPO,
> +             MPP8_GPIO,
> +             MPP9_GPIO,
> +             MPP10_GPO,
> +             MPP11_GPIO,
> +             MPP12_SD_CLK,
> +             MPP13_SD_CMD,
> +             MPP14_SD_D0,
> +             MPP15_SD_D1,
> +             MPP16_SD_D2,
> +             MPP17_SD_D3,
> +             MPP18_GPO,
> +             MPP19_GPO,
> +             MPP20_GE1_0,
> +             MPP21_GE1_1,
> +             MPP22_GE1_2,
> +             MPP23_GE1_3,
> +             MPP24_GE1_4,
> +             MPP25_GE1_5,
> +             MPP26_GE1_6,
> +             MPP27_GE1_7,
> +             MPP28_GPIO,
> +             MPP29_GPIO,
> +             MPP30_GE1_10,
> +             MPP31_GE1_11,
> +             MPP32_GE1_12,
> +             MPP33_GE1_13,
> +             MPP34_GPIO,
> +             MPP35_GPIO,
> +             MPP36_GPIO,
> +             MPP37_GPIO,
> +             MPP38_GPIO,
> +             MPP39_GPIO,
> +             MPP40_GPIO,
> +             MPP41_GPIO,
> +             MPP42_GPIO,
> +             MPP43_GPIO,
> +             MPP44_GPIO,
> +             MPP45_GPIO,
> +             MPP46_GPIO,
> +             MPP47_GPIO,
> +             MPP48_GPIO,
> +             MPP49_GPIO,

are you using all there MFPs on your board, it's better to comment about GPIOs for their usage

> +             0
> +     };
> +
> +     kirkwood_mpp_conf(kwmpp_config);
> +
> +     return 0;
> +}
> +
> +#define LED_OFF             0
> +#define LED_ALARM_ON        1
> +#define LED_ALARM_BLINKING  2
> +#define LED_POWER_ON        3
> +#define LED_POWER_BLINKING  4
> +#define LED_INFO_ON         5
> +#define LED_INFO_BLINKING   6
> +
> +static void __set_led(int blink_alarm, int blink_info, int blink_power,
> +             int value_alarm, int value_info, int value_power)
> +{
> +     kw_gpio_set_blink(GPIO_ALARM_LED, blink_alarm);
> +     kw_gpio_set_blink(GPIO_INFO_LED, blink_info);
> +     kw_gpio_set_blink(GPIO_POWER_LED, blink_power);
> +     kw_gpio_set_value(GPIO_ALARM_LED, value_alarm);
> +     kw_gpio_set_value(GPIO_INFO_LED, value_info);
> +     kw_gpio_set_value(GPIO_POWER_LED, value_power);
> +}
> +
> +static void set_led(int state)
> +{
> +     switch (state) {
> +     case LED_OFF:
> +             __set_led(0, 0, 0, 0, 0, 0);
> +             break;
> +     case LED_ALARM_ON:
> +             __set_led(0, 0, 0, 0, 1, 1);
> +             break;
> +     case LED_ALARM_BLINKING:
> +             __set_led(1, 0, 0, 1, 1, 1);
> +             break;
> +     case LED_INFO_ON:
> +             __set_led(0, 0, 0, 1, 0, 1);
> +             break;
> +     case LED_INFO_BLINKING:
> +             __set_led(0, 1, 0, 1, 1, 1);
> +             break;
> +     case LED_POWER_ON:
> +             __set_led(0, 0, 0, 1, 1, 0);
> +             break;
> +     case LED_POWER_BLINKING:
> +             __set_led(0, 0, 1, 1, 1, 1);
> +             break;
> +     }
> +}
> +
> +int board_init(void)
> +{
> +     /* address of boot parameters */
> +     gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
> +
> +     set_led(LED_POWER_BLINKING);
> +
> +     return 0;
> +}
> +
> +#ifdef CONFIG_MISC_INIT_R
> +void check_enetaddr(void)
> +{
> +     if (getenv("ethaddr") == NULL) {
> +             /* signal unset ethaddr to user */
> +             set_led(LED_INFO_BLINKING);
> +     }
> +}
> +
> +static void erase_environment(void)
> +{
> +     struct spi_flash *flash;
> +
> +     printf("Erasing environment..\n");
> +     flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
> +     if (!flash) {
> +             printf("Erasing flash failed\n");
> +             return;
> +     }
> +
> +     spi_flash_erase(flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE);
> +     spi_flash_free(flash);
> +     do_reset(NULL, 0, 0, NULL);
> +}
> +
> +static void rescue_mode(void)
> +{
> +     printf("Entering rescue mode..\n");
> +     setenv("bootsource", "cli");
> +     if (getenv("ethaddr") == NULL)
> +             setenv("ethaddr", RESCUE_ETHADDR);
> +     setenv("ipaddr", RESCUE_IPADDR);
> +     setenv("netmask", RESCUE_NETMASK);
> +     setenv("serverip", RESCUE_SERVERIP);
> +     setenv("ncip", RESCUE_NCIP);
> +     setenv("stdin", "nc");
> +     setenv("stdout", "nc");
> +     setenv("stderr", "nc");
> +     set_led(LED_ALARM_ON);
> +     printf("Rescue mode active\n");
> +}
> +
> +static void check_push_button(void)
> +{
> +     int i = 0;
> +
> +     while (!kw_gpio_get_value(GPIO_FUNC_BUTTON)) {
> +             udelay(100000);
> +             i++;
> +
> +             if (i == 10)
> +                     set_led(LED_INFO_ON);
> +
> +             if (i >= 100) {
> +                     set_led(LED_INFO_BLINKING);
> +                     break;
> +             }
> +     }
> +
> +     if (i >= 100)
> +             erase_environment();
> +     else if (i >= 10)
> +             rescue_mode();
> +}
> +
> +int misc_init_r(void)
> +{
> +     check_enetaddr();
> +     check_push_button();
> +
> +     return 0;
> +}
> +#endif
> +
> +#ifdef CONFIG_SHOW_BOOT_PROGRESS
> +void show_boot_progress(int progress)
> +{
> +     if (progress < 0) {
> +             set_led(LED_ALARM_BLINKING);
> +             return;
> +     }
> +}
> +#endif
> +
> +#ifdef CONFIG_RESET_PHY_R
> +/* Configure and enable MV88E1118 PHY */
> +void reset_phy(void)
> +{
> +     u16 devadr;
> +     char *name = "egiga1";
> +
> +     if (miiphy_set_current_dev(name))
> +             return;
> +
> +     /* command to read PHY dev address */
> +     if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
> +             printf("Err..%s could not read PHY dev address\n", __func__);
> +             return;
> +     }
> +
> +     /* reset the phy */
> +     miiphy_reset(name, devadr);
> +}
> +#endif /* CONFIG_RESET_PHY_R */
> diff --git a/board/buffalo/lsxl/lsxl.h b/board/buffalo/lsxl/lsxl.h
> new file mode 100644
> index 0000000..db6108f
> --- /dev/null
> +++ b/board/buffalo/lsxl/lsxl.h
> @@ -0,0 +1,75 @@
> +/*
> + * Copyright (c) 2011 Michael Walle
> + * Michael Walle <michael <at> walle.cc>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> + * MA 02110-1301 USA
> + */
> +
> +#ifndef __LSXL_H
> +#define __LSXL_H
> +
> +#define GPIO_HDD_POWER         10
> +#define GPIO_USB_VBUS          11
> +#define GPIO_FAN_HIGH          18
> +#define GPIO_FAN_LOW           19
> +#define GPIO_FUNC_LED          36
> +#define GPIO_ALARM_LED         37
> +#define GPIO_INFO_LED          38
> +#define GPIO_POWER_LED         39
> +#define GPIO_FAN_LOCK          40
> +#define GPIO_FUNC_BUTTON       41
> +#define GPIO_POWER_SWITCH      42
> +#define GPIO_POWER_AUTO_SWITCH 43
> +#define GPIO_FUNC_RED_LED      48
> +
> +#define _BIT(x) (1<<(x))
> +
> +#define LSXL_OE_LOW (~(_BIT(GPIO_HDD_POWER)                 \
> +                     | _BIT(GPIO_USB_VBUS)               \
> +                     | _BIT(GPIO_FAN_HIGH)               \
> +                     | _BIT(GPIO_FAN_LOW)))
> +
> +#define LSXL_OE_HIGH (~(_BIT(GPIO_FUNC_LED - 32)            \
> +                     | _BIT(GPIO_ALARM_LED - 32)         \
> +                     | _BIT(GPIO_INFO_LED - 32)          \
> +                     | _BIT(GPIO_POWER_LED - 32)         \
> +                     | _BIT(GPIO_FUNC_RED_LED - 32)))
> +
> +#define LSXL_OE_VAL_LOW (_BIT(GPIO_HDD_POWER)               \
> +                     | _BIT(GPIO_USB_VBUS))
> +
> +#define LSXL_OE_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)          \
> +                     | _BIT(GPIO_ALARM_LED - 32)         \
> +                     | _BIT(GPIO_INFO_LED - 32)          \
> +                     | _BIT(GPIO_POWER_LED - 32)         \
> +                     | _BIT(GPIO_FUNC_RED_LED - 32))
> +
> +#define LSXL_POL_VAL_LOW (_BIT(GPIO_FAN_HIGH)               \
> +                     | _BIT(GPIO_FAN_LOW))
> +
> +#define LSXL_POL_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)         \
> +                     | _BIT(GPIO_ALARM_LED - 32)         \
> +                     | _BIT(GPIO_INFO_LED - 32)          \
> +                     | _BIT(GPIO_POWER_LED - 32)         \
> +                     | _BIT(GPIO_FUNC_BUTTON - 32)       \
> +                     | _BIT(GPIO_POWER_SWITCH - 32)      \
> +                     | _BIT(GPIO_POWER_AUTO_SWITCH - 32) \
> +                     | _BIT(GPIO_FUNC_RED_LED - 32))
> +
> +#endif /* __LSXL_H */
> diff --git a/boards.cfg b/boards.cfg
> index 05ce1ae..0155ea8 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -137,6 +137,9 @@ hawkboard_uart               arm         arm926ejs
da8xxevm            davinci
>  enbw_cmc                     arm         arm926ejs   enbw_cmc
enbw           davinci
>  calimain                     arm         arm926ejs   calimain
omicron        davinci
>  dns325                       arm         arm926ejs   -                   d-
link         kirkwood
> +lschlv2                      arm         arm926ejs   lsxl
buffalo        kirkwood    lsxl:LSCHLV2
> +lschlv2_ramboot              arm         arm926ejs   lsxl
buffalo        kirkwood    lsxl:LSCHLV2,SYS_RAMBOOT,SYS_TEXT_BASE=0x00700000
> +lsxhl                        arm         arm926ejs   lsxl

Again, if the board is boot from RAM, you dont need kwbimage.cfg for that particular board.

      buffalo        kirkwood    lsxl:LSXHL
>  km_kirkwood                  arm         arm926ejs   km_arm
keymile        kirkwood km_kirkwood:KM_DISABLE_PCI
>  km_kirkwood_pci              arm         arm926ejs   km_arm
keymile        kirkwood km_kirkwood:KM_RECONFIG_XLX
>  mgcoge3un                    arm         arm926ejs   km_arm
keymile        kirkwood
> diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h
> new file mode 100644
> index 0000000..451cbc7
> --- /dev/null
> +++ b/include/configs/lsxl.h
> @@ -0,0 +1,171 @@
> +/*
> + * Copyright (c) 2011 Michael Walle
> + * Michael Walle <michael <at> walle.cc>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> + * MA 02110-1301 USA
> + */
> +
> +#ifndef _CONFIG_LSXL_H
> +#define _CONFIG_LSXL_H
> +
> +/*
> + * Version number information
> + */
> +#if defined(CONFIG_LSCHLV2)
> +#define CONFIG_IDENT_STRING "\nBuffalo Linkstation Live (LS-CHLv2)"

Please use short string

> +#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-
lschl.cfg

> +#define CONFIG_MACH_TYPE 3006
> +#define CONFIG_SYS_TCLK 166666667 /* 166 MHz */

No hardcoding, why you want to run kirkwood at 166?
Is the chip 6281/6282 or 6192?

> +#elif defined(CONFIG_LSXHL)
> +#define CONFIG_IDENT_STRING "\nBuffalo Linkstation Pro (LS-XHL)"
> +#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-
lsxhl.cfg
> +#define CONFIG_MACH_TYPE 2663
> +#define CONFIG_SYS_TCLK 200000000 /* 200 MHz */

This is not needed, default

> +#else
> +#error "unknown board"
> +#endif
> +
> +/*
> + * General configuration options
> + */
> +#define CONFIG_FEROCEON_88FR131              /* CPU Core subversion */
> +#define CONFIG_KIRKWOOD                      /* SOC Family Name */
> +#define CONFIG_KW88F6281             /* SOC Name */
> +
> +#define CONFIG_SKIP_LOWLEVEL_INIT    /* disable board lowlevel_init */
> +#define CONFIG_MISC_INIT_R
> +#define CONFIG_SHOW_BOOT_PROGRESS
> +
> +#define CONFIG_KIRKWOOD_GPIO
> +#define CONFIG_OF_LIBFDT
> +
> +#define CONFIG_SYS_NO_FLASH
> +#define CONFIG_SYS_HUSH_PARSER
> +#define CONFIG_SYS_CONSOLE_IS_IN_ENV
> +#define CONFIG_SYS_CONSOLE_INFO_QUIET
> +
> +/*
> + * Commands configuration
> + */
> +#include <config_cmd_default.h>
> +#define CONFIG_CMD_DHCP
> +#define CONFIG_CMD_PING
> +#define CONFIG_CMD_ENV
> +#define CONFIG_CMD_FAT
> +#define CONFIG_CMD_PING
> +#define CONFIG_CMD_SF
> +#define CONFIG_CMD_USB
> +#define CONFIG_CMD_IDE
> +#define CONFIG_CMD_SPI
> +#define CONFIG_CMD_EXT2
> +
> +#define CONFIG_DOS_PARTITION
> +#define CONFIG_EFI_PARTITION
> +
> +#ifdef CONFIG_SYS_RAMBOOT
> +#define CONFIG_SKIP_LOWLEVEL_INIT

Redefinition

> +#define CONFIG_SKIP_RELOCATE_UBOOT
> +#endif
> +
> +/*
> + * mv-common.h should be defined after CMD configs since it used them
> + * to enable certain macros
> + */
> +#include "mv-common.h"
> +
> +/* ST M25P40 */
> +#undef CONFIG_SPI_FLASH_MACRONIX
> +#define CONFIG_SPI_FLASH_STMICRO
> +#undef CONFIG_ENV_SPI_MAX_HZ
> +#define CONFIG_ENV_SPI_MAX_HZ                25000000
> +#undef CONFIG_SF_DEFAULT_SPEED
> +#define CONFIG_SF_DEFAULT_SPEED              25000000
> +
> +
> +#undef CONFIG_SYS_PROMPT
> +#define CONFIG_SYS_PROMPT            "=> "
> +#define CONFIG_SYS_PROMPT_HUSH_PS2   "> "
> +
> +/*
> + *  Environment variables configurations
> + */
> +#ifdef CONFIG_SPI_FLASH
> +#define CONFIG_SYS_MAX_FLASH_BANKS   1
> +#define CONFIG_SYS_MAX_FLASH_SECT    8
> +#define CONFIG_ENV_IS_IN_SPI_FLASH   1
> +#define CONFIG_ENV_SECT_SIZE         0x10000 /* 64K */
> +#else
> +#define CONFIG_ENV_IS_NOWHERE
> +#endif
> +
> +#define CONFIG_ENV_SIZE                      0x10000 /* 64k */
> +#define CONFIG_ENV_OFFSET            0x70000 /* env starts here */
> +
> +/*
> + * Default environment variables
> + */
> +#define CONFIG_LOADADDR              0x00800000
> +#define CONFIG_BOOTCOMMAND   "run bootcmd_${bootsource}"
> +#define CONFIG_BOOTARGS              "console=ttyS0,115200 root=/dev/sda2"
> +#define CONFIG_EXTRA_ENV_SETTINGS                                    \
> +     "bootsource=hdd\0"                                              \
> +     "hdpart=0:1\0"                                                  \
> +     "bootcmd_net=bootp 0x00100000 uImage "                          \
> +             "&& tftpboot 0x00800000 uInitrd "                       \
> +             "&& bootm 0x00100000 0x00800000\0"                      \
> +     "bootcmd_hdd=ide reset; "                                       \
> +             "&& ext2load ide ${hdpart} 0x00100000 /uImage "         \
> +             "&& ext2load ide ${hdpart} 0x00800000 /uInitrd "        \
> +             "&& bootm 0x00100000 0x00800000\0"                      \
> +     "bootcmd_usb=usb start "                                        \
> +             "&& fatload usb 0:1 0x00100000 /uImage "                \
> +             "&& fatload usb 0:1 0x00800000 /uInitrd "               \
> +             "&& bootm 0x00100000 0x00800000\0"                      \
> +     "bootcmd_cli=echo Entering CLI\0"                               \
> +     "eraseenv=sf probe 0 "                                          \
> +             "&& sf erase " MK_STR(CONFIG_ENV_OFFSET)                \
> +                     " +" MK_STR(CONFIG_ENV_SIZE) "\0"               \
> +     "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \
> +             "setenv ncip; setenv bootsource hdd; run ser\0"         \
> +     "ser=setenv stdin serial; setenv stdout serial; "               \
> +             "setenv stderr serial\0"                                \
> +     "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0"      \
> +     "restore_env=run standard_env; saveenv; reset\0"                \
> +     "stdin=serial\0"                                                \
> +     "stdout=serial\0"                                               \
> +     "stderr=serial\0"
> +
> +/*
> + * Ethernet Driver configuration
> + */
> +#ifdef CONFIG_CMD_NET
> +#define CONFIG_MVGBE_PORTS           {0, 1} /* enable port 1 only */
> +#define CONFIG_PHY_BASE_ADR          7
> +#endif /* CONFIG_CMD_NET */
> +
> +#ifdef CONFIG_CMD_IDE
> +#undef CONFIG_IDE_LED
> +#undef CONFIG_SYS_IDE_MAXBUS
> +#define CONFIG_SYS_IDE_MAXBUS                1
> +#undef CONFIG_SYS_IDE_MAXDEVICE
> +#define CONFIG_SYS_IDE_MAXDEVICE     1
> +#define CONFIG_SYS_ATA_IDE0_OFFSET   MV_SATA_PORT0_OFFSET
> +#endif
> +
> +#endif /* _CONFIG_LSXL_H */


Regards..
Prafulla . .
Prafulla Wadaskar March 27, 2012, 7:28 a.m. UTC | #3
> -----Original Message-----
> From: Michael Walle [mailto:michael@walle.cc]
> Sent: 26 March 2012 15:46
> To: u-boot@lists.denx.de
> Cc: Prafulla Wadaskar; Wolfgang Denk
> Subject: Re: [PATCH v2] lsxl: add support for lschlv2 and lsxhl
> 
> On Fri, March 2, 2012 17:02, Michael Walle wrote:
> > This patchset adds support for both the Linkstation Live (LS-CHLv2)
> and
> > Linkstation Pro (LS-XHL) by Buffalo.
> >
> > Signed-off-by: Michael Walle <michael@walle.cc>
> > Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > Cc: Wolfgang Denk <wd@denx.de>
> > ---
> >
> > v2:
> >  - add to buffalo vendor directory instead of Marvell
> >  - add both boards to MAINTAINERS
> >  - don't define values for feature macros
> >  - use tab for vertical alignment
> >  - remove static network configuration, instead introduce a rescue
> mode
> >  - add some convenience scripts
> >  - small cleanups
> 
> Ping :)

Sorry Michael,
This is missed, may be because the subject don't have "Kirkwood:"

Regards.
Prafulla . .
Michael Walle March 27, 2012, 8:38 p.m. UTC | #4
Am Dienstag 27 März 2012, 09:27:49 schrieb Prafulla Wadaskar:
> Is the chip 6281/6282 or 6192?
It' a 88F6281-A1.
Michael Walle March 29, 2012, 12:38 p.m. UTC | #5
Am Dienstag 27 März 2012, 09:27:49 schrieb Prafulla Wadaskar:
> > # diff --git a/board/buffalo/lsxl/config.mk
> > b/board/buffalo/lsxl/config.mk new file mode 100644
> > index 0000000..062554b
> > --- /dev/null
> > +++ b/board/buffalo/lsxl/config.mk
> > @@ -0,0 +1 @@
> > +ALL-y += $(obj)u-boot.kwb
> 
> Pls remove this file
Is there another way to build the u-boot.kwb binary by default?

The main Makefile states:
# Always append ALL so that arch config.mk's can add custom ones

and theres a rule for $(obj)u-boot.kwb.
Prafulla Wadaskar March 29, 2012, 2:24 p.m. UTC | #6
> -----Original Message-----
> From: Michael Walle [mailto:michael@walle.cc]
> Sent: 29 March 2012 18:08
> To: Prafulla Wadaskar
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH v2] lsxl: add support for lschlv2 and lsxhl
> 
> Am Dienstag 27 März 2012, 09:27:49 schrieb Prafulla Wadaskar:
> > > # diff --git a/board/buffalo/lsxl/config.mk
> > > b/board/buffalo/lsxl/config.mk new file mode 100644
> > > index 0000000..062554b
> > > --- /dev/null
> > > +++ b/board/buffalo/lsxl/config.mk
> > > @@ -0,0 +1 @@
> > > +ALL-y += $(obj)u-boot.kwb
> >
> > Pls remove this file
> Is there another way to build the u-boot.kwb binary by default?
> 
> The main Makefile states:
> # Always append ALL so that arch config.mk's can add custom ones
> 
> and theres a rule for $(obj)u-boot.kwb.
> 

Just pass u-boot.kwm to the make, will do the needful, if this satisfies the goal of generating u-boot.kwb, then why to add one file to the source code?

If you have some more things to do then board specific config.mk can be considered.

Regards..
Prafulla . . .
Michael Walle March 29, 2012, 2:39 p.m. UTC | #7
Am Donnerstag 29 März 2012, 16:24:23 schrieb Prafulla Wadaskar:
> > -----Original Message-----
> > From: Michael Walle [mailto:michael@walle.cc]
> > Sent: 29 March 2012 18:08
> > To: Prafulla Wadaskar
> > Cc: u-boot@lists.denx.de
> > Subject: Re: [PATCH v2] lsxl: add support for lschlv2 and lsxhl
> > 
> > Am Dienstag 27 März 2012, 09:27:49 schrieb Prafulla Wadaskar:
> > > > # diff --git a/board/buffalo/lsxl/config.mk
> > > > b/board/buffalo/lsxl/config.mk new file mode 100644
> > > > index 0000000..062554b
> > > > --- /dev/null
> > > > +++ b/board/buffalo/lsxl/config.mk
> > > > @@ -0,0 +1 @@
> > > > +ALL-y += $(obj)u-boot.kwb
> > > 
> > > Pls remove this file
> > 
> > Is there another way to build the u-boot.kwb binary by default?
> > 
> > The main Makefile states:
> > # Always append ALL so that arch config.mk's can add custom ones
> > 
> > and theres a rule for $(obj)u-boot.kwb.
> 
> Just pass u-boot.kwm to the make, will do the needful, if this satisfies
> the goal of generating u-boot.kwb, then why to add one file to the source
> code?
 - this won't work easily for out-of-tree builds, will it? because you have to 
pass $(obj)u-boot.kwb to make and $(obj) is $O which is specified by the user, 
so he has to specify it twice
 - i'm only interested in the u-boot.kwb, why shouldn't it be generated by 
default?
 - i can't build it with a sinlge make call. Eg. atm i'm doing
    make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi- lschlv2
   otherwise i have to do
    make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi- lschlv2
    make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi- \
       `pwd`/u-boot.kwb

Overall, it will greatly simplify thinks :)
Prafulla Wadaskar March 30, 2012, 11:18 a.m. UTC | #8
> -----Original Message-----
> From: Michael Walle [mailto:michael@walle.cc]
> Sent: 29 March 2012 20:09
> To: Prafulla Wadaskar
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH v2] lsxl: add support for lschlv2 and lsxhl
> 
> Am Donnerstag 29 März 2012, 16:24:23 schrieb Prafulla Wadaskar:
> > > -----Original Message-----
> > > From: Michael Walle [mailto:michael@walle.cc]
> > > Sent: 29 March 2012 18:08
> > > To: Prafulla Wadaskar
> > > Cc: u-boot@lists.denx.de
> > > Subject: Re: [PATCH v2] lsxl: add support for lschlv2 and lsxhl
> > >
> > > Am Dienstag 27 März 2012, 09:27:49 schrieb Prafulla Wadaskar:
> > > > > # diff --git a/board/buffalo/lsxl/config.mk
> > > > > b/board/buffalo/lsxl/config.mk new file mode 100644
> > > > > index 0000000..062554b
> > > > > --- /dev/null
> > > > > +++ b/board/buffalo/lsxl/config.mk
> > > > > @@ -0,0 +1 @@
> > > > > +ALL-y += $(obj)u-boot.kwb
> > > >
> > > > Pls remove this file
> > >
> > > Is there another way to build the u-boot.kwb binary by default?
> > >
> > > The main Makefile states:
> > > # Always append ALL so that arch config.mk's can add custom ones
> > >
> > > and theres a rule for $(obj)u-boot.kwb.
> >
> > Just pass u-boot.kwm to the make, will do the needful, if this
> satisfies
> > the goal of generating u-boot.kwb, then why to add one file to the
> source
> > code?
>  - this won't work easily for out-of-tree builds, will it? because you
> have to
> pass $(obj)u-boot.kwb to make and $(obj) is $O which is specified by
> the user,
> so he has to specify it twice

Dear Michael,

AFAIK, you need to pass only "u-boot.kwb" to the make (no $(okj) needed)

>  - i'm only interested in the u-boot.kwb, why shouldn't it be
> generated by
> default?
>  - i can't build it with a sinlge make call. Eg. atm i'm doing
>     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi-
> lschlv2
>    otherwise i have to do
>     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi-
> lschlv2
>     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi- \
>        `pwd`/u-boot.kwb

"make u-boot.kwb CROSS_COMPILE=arm-linux-gnueabi-"
generates u-boot.kwb, this should be valid with other use case too.
if not, it makes sense to add an additional line in script that a file in code :-)

Regards..
Prafulla . ..
Michael Walle March 30, 2012, 1:57 p.m. UTC | #9
Hi Prafulla,

[ I'm CCing Wolfgang on this, because i don't know who's responsible for the 
build/make infrastructure. ]

> AFAIK, you need to pass only "u-boot.kwb" to the make (no $(okj) needed)
Sorry you're wrong here, that won't work for out-of-tree builds, see below.

[mw@thanatos b-u-boot]$ LANG=C make -j3 -C ../u-boot O=`pwd` 
CROSS_COMPILE=arm-linux-gnueabi- u-boot.kwb
make: Entering directory `/home/mw/repo/u-boot'
make: *** No rule to make target `u-boot.kwb'.  Stop.
make: Leaving directory `/home/mw/repo/u-boot'

> >  - i'm only interested in the u-boot.kwb, why shouldn't it be
> > 
> > generated by
> > default?
> > 
> >  - i can't build it with a sinlge make call. Eg. atm i'm doing
> >  
> >     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi-
> > 
> > lschlv2
> > 
> >    otherwise i have to do
> >    
> >     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi-
> > 
> > lschlv2
> > 
> >     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi- \
> >     
> >        `pwd`/u-boot.kwb
> 
> "make u-boot.kwb CROSS_COMPILE=arm-linux-gnueabi-"
> generates u-boot.kwb, this should be valid with other use case too.
> if not, it makes sense to add an additional line in script that a file in
> code :-)

Mh, i don't understands what is wrong with a config.mk with only an additional 
make target? There are other boards too, which handles image generating this 
way (grep for ALL-y in boards/). Shouldn't be building an uboot image as 
simple as possible?

If we add
  .PHONY: u-boot.kwb
  u-boot.kwb: $(obj)u-boot.kwb
to the main Makefile, i would say we should add all other image targets, too.

I'd say one could add the target to the kirkwood config.mk (if there is one 
per platform) but i doubt every kirkwood based board will need one (and 
provides a kwbimage.cfg).
Prafulla Wadaskar April 2, 2012, 6:37 a.m. UTC | #10
> -----Original Message-----
> From: Michael Walle [mailto:michael@walle.cc] 
> Sent: 30 March 2012 19:27
> To: Prafulla Wadaskar
> Cc: u-boot@lists.denx.de; Wolfgang Denk
> Subject: Re: [PATCH v2] lsxl: add support for lschlv2 and lsxhl
> 
> 
> Hi Prafulla,
> 
> [ I'm CCing Wolfgang on this, because i don't know who's 
> responsible for the build/make infrastructure. ]
> 
> > AFAIK, you need to pass only "u-boot.kwb" to the make (no $(okj) 
> > needed)
> Sorry you're wrong here, that won't work for out-of-tree 
> builds, see below.

Kirkwood is not only target that may need to be build for out-of-tree builds.
This should be addressed for generic use case.

> 
> [mw@thanatos b-u-boot]$ LANG=C make -j3 -C ../u-boot O=`pwd`
> CROSS_COMPILE=arm-linux-gnueabi- u-boot.kwb
> make: Entering directory `/home/mw/repo/u-boot'
> make: *** No rule to make target `u-boot.kwb'.  Stop.
> make: Leaving directory `/home/mw/repo/u-boot'
> 
> > >  - i'm only interested in the u-boot.kwb, why shouldn't it be
> > > 
> > > generated by
> > > default?

AFAIK, any target apart from u-boot.bin are optional, can be generated if needed

> > > 
> > >  - i can't build it with a sinlge make call. Eg. atm i'm doing
> > >  
> > >     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi-
> > > 
> > > lschlv2
> > > 
> > >    otherwise i have to do
> > >    
> > >     make -j3 -C ../u-boot O=`pwd` CROSS_COMPILE=arm-linux-gnueabi-
> > > 
> > > lschlv2
> > > 
> > >     make -j3 -C ../u-boot O=`pwd` 
> CROSS_COMPILE=arm-linux-gnueabi- \
> > >     
> > >        `pwd`/u-boot.kwb
> > 
> > "make u-boot.kwb CROSS_COMPILE=arm-linux-gnueabi-"
> > generates u-boot.kwb, this should be valid with other use case too.
> > if not, it makes sense to add an additional line in script 
> that a file 
> > in code :-)
> 
> Mh, i don't understands what is wrong with a config.mk with 
> only an additional make target? There are other boards too, 
> which handles image generating this way (grep for ALL-y in 
> boards/). Shouldn't be building an uboot image as simple as possible?

I understand and know this, I greped for the same but all of them have some more configuration.
Anyway I am not interested to argue on this.
My intention here is, this in not the only board that needs this functionaltiy. Why not to add it in generic way?

> 
> If we add
>   .PHONY: u-boot.kwb
>   u-boot.kwb: $(obj)u-boot.kwb
> to the main Makefile, i would say we should add all other 
> image targets, too.

I would greatly appreciate is something like this can be implemented.

> 
> I'd say one could add the target to the kirkwood config.mk 
> (if there is one per platform) but i doubt every kirkwood 
> based board will need one (and provides a kwbimage.cfg).

FYI: all kirkwood boards as of now needs u-boot.kwb, but this is optional to any future board. 
I can think of adding arch/arm/cpu/arm926ejs/kirkwood/config.mk if above proposed method is not acceptable.

Regards..
Prafulla . . .
diff mbox

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 1e40af2..25a5a5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -905,6 +905,11 @@  Prafulla Wadaskar <prafulla@marvell.com>
 	rd6281a		ARM926EJS (Kirkwood SoC)
 	sheevaplug	ARM926EJS (Kirkwood SoC)
 
+Michael Walle <michael@walle.cc>
+
+	lschlv2		ARM926EJS (Kirkwood SoC)
+	lsxhl		ARM926EJS (Kirkwood SoC)
+
 Tom Warren <twarren@nvidia.com>
 
 	harmony		Tegra2 (ARM7 & A9 Dual Core)
diff --git a/board/buffalo/lsxl/Makefile b/board/buffalo/lsxl/Makefile
new file mode 100644
index 0000000..4c08079
--- /dev/null
+++ b/board/buffalo/lsxl/Makefile
@@ -0,0 +1,50 @@ 
+#
+# Copyright (c) 2011 Michael Walle
+# Michael Walle <michael@walle.cc>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= lsxl.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/buffalo/lsxl/config.mk b/board/buffalo/lsxl/config.mk
new file mode 100644
index 0000000..062554b
--- /dev/null
+++ b/board/buffalo/lsxl/config.mk
@@ -0,0 +1 @@ 
+ALL-y += $(obj)u-boot.kwb
diff --git a/board/buffalo/lsxl/kwbimage-lschl.cfg b/board/buffalo/lsxl/kwbimage-lschl.cfg
new file mode 100644
index 0000000..4d96c3f
--- /dev/null
+++ b/board/buffalo/lsxl/kwbimage-lschl.cfg
@@ -0,0 +1,66 @@ 
+#
+# Copyright (c) 2011 Michael Walle
+# Michael Walle <michael@walle.cc>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM	spi	# Boot from SPI flash
+
+# SOC registers configuration using bootrom header extension
+# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
+
+# Configure RGMII-0/1 interface pad voltage to 1.8V
+DATA 0xFFD100E0 0x1B1B1B9B
+
+DATA 0xFFD20134 0xBBBBBBBB  # L2 RAM Timing 0
+DATA 0xFFD20138 0x00BBBBBB  # L2 RAM Timint 1
+
+# DRAM configuration
+DATA 0xFFD01400 0x43000618  # DDR Configuration register
+DATA 0xFFD01404 0x39543000  # DDR Controller Control Low
+DATA 0xFFD01408 0x3302444F  # DDR Timing (Low)
+DATA 0xFFD0140C 0x00000823  # DDR Timing (High)
+DATA 0xFFD01410 0x00000009  # DDR Address Control
+DATA 0xFFD01414 0x00000000	# DDR Open Pages Control
+DATA 0xFFD01418 0x00000000	# DDR Operation
+DATA 0xFFD0141C 0x00000652  # DDR Mode
+DATA 0xFFD01420 0x00000042  # DDR Extended Mode
+DATA 0xFFD01424 0x0000F1FF  # DDR Controller Control High
+DATA 0xFFD01428 0x00085520	# DDR2 ODT Read Timing (default values)
+DATA 0xFFD0147C 0x00008552	# DDR2 ODT Write Timing (default values)
+DATA 0xFFD0142C 0x00000000  # DDR Operation Control
+
+DATA 0xFFD01500 0x00000000	# CS[0]n Base address to 0x0
+DATA 0xFFD01504 0x03FFFFF1  # CS[0]n Size
+DATA 0xFFD0150C 0x00000000	# CS[1]n Size, window disabled
+DATA 0xFFD01514 0x00000000	# CS[2]n Size, window disabled
+DATA 0xFFD0151C 0x00000000	# CS[3]n Size, window disabled
+
+DATA 0xFFD01494 0x003C0000  # DDR ODT Control (Low)
+DATA 0xFFD01498 0x00000000	# DDR ODT Control (High)
+DATA 0xFFD0149C 0x0000E80F  # CPU ODT Control
+DATA 0xFFD01480 0x00000001	# DDR Initialization Control
+
+# End of Header extension
+DATA 0x0 0x0
diff --git a/board/buffalo/lsxl/kwbimage-lsxhl.cfg b/board/buffalo/lsxl/kwbimage-lsxhl.cfg
new file mode 100644
index 0000000..1f978fe
--- /dev/null
+++ b/board/buffalo/lsxl/kwbimage-lsxhl.cfg
@@ -0,0 +1,66 @@ 
+#
+# Copyright (c) 2011 Michael Walle
+# Michael Walle <michael@walle.cc>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM      spi     # Boot from SPI flash
+
+# SOC registers configuration using bootrom header extension
+# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
+
+# Configure RGMII-0/1 interface pad voltage to 1.8V
+DATA 0xFFD100E0 0x1B1B9B9B
+
+DATA 0xFFD20134 0xBBBBBBBB  # L2 RAM Timing 0
+DATA 0xFFD20138 0x00BBBBBB  # L2 RAM Timint 1
+
+# DRAM configuration
+DATA 0xFFD01400 0x43000618  # DDR Configuration register
+DATA 0xFFD01404 0x39543010  # DDR Controller Control Low
+DATA 0xFFD01408 0x22125441  # DDR Timing (Low)
+DATA 0xFFD0140C 0x00000832  # DDR Timing (High)
+DATA 0xFFD01410 0x0000000C  # DDR Address Control
+DATA 0xFFD01414 0x00000000     # DDR Open Pages Control
+DATA 0xFFD01418 0x00000000     # DDR Operation
+DATA 0xFFD0141C 0x00000652  # DDR Mode
+DATA 0xFFD01420 0x00000006  # DDR Extended Mode
+DATA 0xFFD01424 0x0000F17F  # DDR Controller Control High
+DATA 0xFFD01428 0x00085520     # DDR2 ODT Read Timing (default values)
+DATA 0xFFD0147C 0x00008552     # DDR2 ODT Write Timing (default values)
+DATA 0xFFD0142C 0x00000000  # DDR Operation Control
+
+DATA 0xFFD01500 0x00000000     # CS[0]n Base address to 0x0
+DATA 0xFFD01504 0x0FFFFFF1  # CS[0]n Size
+DATA 0xFFD0150C 0x00000000     # CS[1]n Size, window disabled
+DATA 0xFFD01514 0x00000000     # CS[2]n Size, window disabled
+DATA 0xFFD0151C 0x00000000     # CS[3]n Size, window disabled
+
+DATA 0xFFD01494 0x00010000  # DDR ODT Control (Low)
+DATA 0xFFD01498 0x00000000     # DDR ODT Control (High)
+DATA 0xFFD0149C 0x0000E80F  # CPU ODT Control
+DATA 0xFFD01480 0x00000001     # DDR Initialization Control
+
+# End of Header extension
+DATA 0x0 0x0
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
new file mode 100644
index 0000000..1b9f024
--- /dev/null
+++ b/board/buffalo/lsxl/lsxl.c
@@ -0,0 +1,294 @@ 
+/*
+ * Copyright (c) 2011 Michael Walle
+ * Michael Walle <michael@walle.cc>
+ *
+ * Based on sheevaplug/sheevaplug.c by
+ *   Marvell Semiconductor <www.marvell.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <netdev.h>
+#include <miiphy.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/mpp.h>
+#include <asm/arch/gpio.h>
+#include <spi_flash.h>
+
+#include "lsxl.h"
+
+/*
+ * Rescue mode
+ *
+ * Selected by holding the push button for 3 seconds, while powering on
+ * the device.
+ *
+ * These linkstations don't have a (populated) serial port. There is no
+ * way to access an (unmodified) board other than using the netconsole. If
+ * you want to recover from a bad environment setting or an empty environment,
+ * you can do this only with a working network connection. Therefore, the
+ * following network configuration will be set when rescue mode is stared.
+ * Additionally, the bootsource is set to 'cli'.
+ */
+#define RESCUE_ETHADDR   "02:00:01:00:00:00"
+#define RESCUE_IPADDR    "192.168.11.150"
+#define RESCUE_NETMASK   "255.255.255.0"
+#define RESCUE_SERVERIP  "192.168.11.1"
+#define RESCUE_NCIP      RESCUE_SERVERIP
+
+#ifndef CONFIG_ENV_OVERWRITE
+# error "You need to set CONFIG_ENV_OVERWRITE"
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+	/*
+	 * default gpio configuration
+	 * There are maximum 64 gpios controlled through 2 sets of registers
+	 * the  below configuration configures mainly initial LED status
+	 */
+	kw_config_gpio(LSXL_OE_VAL_LOW,
+			LSXL_OE_VAL_HIGH,
+			LSXL_OE_LOW, LSXL_OE_HIGH);
+
+	/* Multi-Purpose Pins Functionality configuration */
+	u32 kwmpp_config[] = {
+		MPP0_SPI_SCn,
+		MPP1_SPI_MOSI,
+		MPP2_SPI_SCK,
+		MPP3_SPI_MISO,
+		MPP4_UART0_RXD,
+		MPP5_UART0_TXD,
+		MPP6_SYSRST_OUTn,
+		MPP7_GPO,
+		MPP8_GPIO,
+		MPP9_GPIO,
+		MPP10_GPO,
+		MPP11_GPIO,
+		MPP12_SD_CLK,
+		MPP13_SD_CMD,
+		MPP14_SD_D0,
+		MPP15_SD_D1,
+		MPP16_SD_D2,
+		MPP17_SD_D3,
+		MPP18_GPO,
+		MPP19_GPO,
+		MPP20_GE1_0,
+		MPP21_GE1_1,
+		MPP22_GE1_2,
+		MPP23_GE1_3,
+		MPP24_GE1_4,
+		MPP25_GE1_5,
+		MPP26_GE1_6,
+		MPP27_GE1_7,
+		MPP28_GPIO,
+		MPP29_GPIO,
+		MPP30_GE1_10,
+		MPP31_GE1_11,
+		MPP32_GE1_12,
+		MPP33_GE1_13,
+		MPP34_GPIO,
+		MPP35_GPIO,
+		MPP36_GPIO,
+		MPP37_GPIO,
+		MPP38_GPIO,
+		MPP39_GPIO,
+		MPP40_GPIO,
+		MPP41_GPIO,
+		MPP42_GPIO,
+		MPP43_GPIO,
+		MPP44_GPIO,
+		MPP45_GPIO,
+		MPP46_GPIO,
+		MPP47_GPIO,
+		MPP48_GPIO,
+		MPP49_GPIO,
+		0
+	};
+
+	kirkwood_mpp_conf(kwmpp_config);
+
+	return 0;
+}
+
+#define LED_OFF             0
+#define LED_ALARM_ON        1
+#define LED_ALARM_BLINKING  2
+#define LED_POWER_ON        3
+#define LED_POWER_BLINKING  4
+#define LED_INFO_ON         5
+#define LED_INFO_BLINKING   6
+
+static void __set_led(int blink_alarm, int blink_info, int blink_power,
+		int value_alarm, int value_info, int value_power)
+{
+	kw_gpio_set_blink(GPIO_ALARM_LED, blink_alarm);
+	kw_gpio_set_blink(GPIO_INFO_LED, blink_info);
+	kw_gpio_set_blink(GPIO_POWER_LED, blink_power);
+	kw_gpio_set_value(GPIO_ALARM_LED, value_alarm);
+	kw_gpio_set_value(GPIO_INFO_LED, value_info);
+	kw_gpio_set_value(GPIO_POWER_LED, value_power);
+}
+
+static void set_led(int state)
+{
+	switch (state) {
+	case LED_OFF:
+		__set_led(0, 0, 0, 0, 0, 0);
+		break;
+	case LED_ALARM_ON:
+		__set_led(0, 0, 0, 0, 1, 1);
+		break;
+	case LED_ALARM_BLINKING:
+		__set_led(1, 0, 0, 1, 1, 1);
+		break;
+	case LED_INFO_ON:
+		__set_led(0, 0, 0, 1, 0, 1);
+		break;
+	case LED_INFO_BLINKING:
+		__set_led(0, 1, 0, 1, 1, 1);
+		break;
+	case LED_POWER_ON:
+		__set_led(0, 0, 0, 1, 1, 0);
+		break;
+	case LED_POWER_BLINKING:
+		__set_led(0, 0, 1, 1, 1, 1);
+		break;
+	}
+}
+
+int board_init(void)
+{
+	/* address of boot parameters */
+	gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+
+	set_led(LED_POWER_BLINKING);
+
+	return 0;
+}
+
+#ifdef CONFIG_MISC_INIT_R
+void check_enetaddr(void)
+{
+	if (getenv("ethaddr") == NULL) {
+		/* signal unset ethaddr to user */
+		set_led(LED_INFO_BLINKING);
+	}
+}
+
+static void erase_environment(void)
+{
+	struct spi_flash *flash;
+
+	printf("Erasing environment..\n");
+	flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
+	if (!flash) {
+		printf("Erasing flash failed\n");
+		return;
+	}
+
+	spi_flash_erase(flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE);
+	spi_flash_free(flash);
+	do_reset(NULL, 0, 0, NULL);
+}
+
+static void rescue_mode(void)
+{
+	printf("Entering rescue mode..\n");
+	setenv("bootsource", "cli");
+	if (getenv("ethaddr") == NULL)
+		setenv("ethaddr", RESCUE_ETHADDR);
+	setenv("ipaddr", RESCUE_IPADDR);
+	setenv("netmask", RESCUE_NETMASK);
+	setenv("serverip", RESCUE_SERVERIP);
+	setenv("ncip", RESCUE_NCIP);
+	setenv("stdin", "nc");
+	setenv("stdout", "nc");
+	setenv("stderr", "nc");
+	set_led(LED_ALARM_ON);
+	printf("Rescue mode active\n");
+}
+
+static void check_push_button(void)
+{
+	int i = 0;
+
+	while (!kw_gpio_get_value(GPIO_FUNC_BUTTON)) {
+		udelay(100000);
+		i++;
+
+		if (i == 10)
+			set_led(LED_INFO_ON);
+
+		if (i >= 100) {
+			set_led(LED_INFO_BLINKING);
+			break;
+		}
+	}
+
+	if (i >= 100)
+		erase_environment();
+	else if (i >= 10)
+		rescue_mode();
+}
+
+int misc_init_r(void)
+{
+	check_enetaddr();
+	check_push_button();
+
+	return 0;
+}
+#endif
+
+#ifdef CONFIG_SHOW_BOOT_PROGRESS
+void show_boot_progress(int progress)
+{
+	if (progress < 0) {
+		set_led(LED_ALARM_BLINKING);
+		return;
+	}
+}
+#endif
+
+#ifdef CONFIG_RESET_PHY_R
+/* Configure and enable MV88E1118 PHY */
+void reset_phy(void)
+{
+	u16 devadr;
+	char *name = "egiga1";
+
+	if (miiphy_set_current_dev(name))
+		return;
+
+	/* command to read PHY dev address */
+	if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
+		printf("Err..%s could not read PHY dev address\n", __func__);
+		return;
+	}
+
+	/* reset the phy */
+	miiphy_reset(name, devadr);
+}
+#endif /* CONFIG_RESET_PHY_R */
diff --git a/board/buffalo/lsxl/lsxl.h b/board/buffalo/lsxl/lsxl.h
new file mode 100644
index 0000000..db6108f
--- /dev/null
+++ b/board/buffalo/lsxl/lsxl.h
@@ -0,0 +1,75 @@ 
+/*
+ * Copyright (c) 2011 Michael Walle
+ * Michael Walle <michael@walle.cc>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef __LSXL_H
+#define __LSXL_H
+
+#define GPIO_HDD_POWER         10
+#define GPIO_USB_VBUS          11
+#define GPIO_FAN_HIGH          18
+#define GPIO_FAN_LOW           19
+#define GPIO_FUNC_LED          36
+#define GPIO_ALARM_LED         37
+#define GPIO_INFO_LED          38
+#define GPIO_POWER_LED         39
+#define GPIO_FAN_LOCK          40
+#define GPIO_FUNC_BUTTON       41
+#define GPIO_POWER_SWITCH      42
+#define GPIO_POWER_AUTO_SWITCH 43
+#define GPIO_FUNC_RED_LED      48
+
+#define _BIT(x) (1<<(x))
+
+#define LSXL_OE_LOW (~(_BIT(GPIO_HDD_POWER)                 \
+			| _BIT(GPIO_USB_VBUS)               \
+			| _BIT(GPIO_FAN_HIGH)               \
+			| _BIT(GPIO_FAN_LOW)))
+
+#define LSXL_OE_HIGH (~(_BIT(GPIO_FUNC_LED - 32)            \
+			| _BIT(GPIO_ALARM_LED - 32)         \
+			| _BIT(GPIO_INFO_LED - 32)          \
+			| _BIT(GPIO_POWER_LED - 32)         \
+			| _BIT(GPIO_FUNC_RED_LED - 32)))
+
+#define LSXL_OE_VAL_LOW (_BIT(GPIO_HDD_POWER)               \
+			| _BIT(GPIO_USB_VBUS))
+
+#define LSXL_OE_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)          \
+			| _BIT(GPIO_ALARM_LED - 32)         \
+			| _BIT(GPIO_INFO_LED - 32)          \
+			| _BIT(GPIO_POWER_LED - 32)         \
+			| _BIT(GPIO_FUNC_RED_LED - 32))
+
+#define LSXL_POL_VAL_LOW (_BIT(GPIO_FAN_HIGH)               \
+			| _BIT(GPIO_FAN_LOW))
+
+#define LSXL_POL_VAL_HIGH (_BIT(GPIO_FUNC_LED - 32)         \
+			| _BIT(GPIO_ALARM_LED - 32)         \
+			| _BIT(GPIO_INFO_LED - 32)          \
+			| _BIT(GPIO_POWER_LED - 32)         \
+			| _BIT(GPIO_FUNC_BUTTON - 32)       \
+			| _BIT(GPIO_POWER_SWITCH - 32)      \
+			| _BIT(GPIO_POWER_AUTO_SWITCH - 32) \
+			| _BIT(GPIO_FUNC_RED_LED - 32))
+
+#endif /* __LSXL_H */
diff --git a/boards.cfg b/boards.cfg
index 05ce1ae..0155ea8 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -137,6 +137,9 @@  hawkboard_uart               arm         arm926ejs   da8xxevm            davinci
 enbw_cmc                     arm         arm926ejs   enbw_cmc            enbw           davinci
 calimain                     arm         arm926ejs   calimain            omicron        davinci
 dns325                       arm         arm926ejs   -                   d-link         kirkwood
+lschlv2                      arm         arm926ejs   lsxl                buffalo        kirkwood    lsxl:LSCHLV2
+lschlv2_ramboot              arm         arm926ejs   lsxl                buffalo        kirkwood    lsxl:LSCHLV2,SYS_RAMBOOT,SYS_TEXT_BASE=0x00700000
+lsxhl                        arm         arm926ejs   lsxl                buffalo        kirkwood    lsxl:LSXHL
 km_kirkwood                  arm         arm926ejs   km_arm              keymile        kirkwood	km_kirkwood:KM_DISABLE_PCI
 km_kirkwood_pci              arm         arm926ejs   km_arm              keymile        kirkwood	km_kirkwood:KM_RECONFIG_XLX
 mgcoge3un                    arm         arm926ejs   km_arm              keymile        kirkwood
diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h
new file mode 100644
index 0000000..451cbc7
--- /dev/null
+++ b/include/configs/lsxl.h
@@ -0,0 +1,171 @@ 
+/*
+ * Copyright (c) 2011 Michael Walle
+ * Michael Walle <michael@walle.cc>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_LSXL_H
+#define _CONFIG_LSXL_H
+
+/*
+ * Version number information
+ */
+#if defined(CONFIG_LSCHLV2)
+#define CONFIG_IDENT_STRING "\nBuffalo Linkstation Live (LS-CHLv2)"
+#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-lschl.cfg
+#define CONFIG_MACH_TYPE 3006
+#define CONFIG_SYS_TCLK 166666667 /* 166 MHz */
+#elif defined(CONFIG_LSXHL)
+#define CONFIG_IDENT_STRING "\nBuffalo Linkstation Pro (LS-XHL)"
+#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-lsxhl.cfg
+#define CONFIG_MACH_TYPE 2663
+#define CONFIG_SYS_TCLK 200000000 /* 200 MHz */
+#else
+#error "unknown board"
+#endif
+
+/*
+ * General configuration options
+ */
+#define CONFIG_FEROCEON_88FR131		/* CPU Core subversion */
+#define CONFIG_KIRKWOOD			/* SOC Family Name */
+#define CONFIG_KW88F6281		/* SOC Name */
+
+#define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
+#define CONFIG_MISC_INIT_R
+#define CONFIG_SHOW_BOOT_PROGRESS
+
+#define CONFIG_KIRKWOOD_GPIO
+#define CONFIG_OF_LIBFDT
+
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
+
+/*
+ * Commands configuration
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_SF
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_EXT2
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+
+#ifdef CONFIG_SYS_RAMBOOT
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+#endif
+
+/*
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
+ */
+#include "mv-common.h"
+
+/* ST M25P40 */
+#undef CONFIG_SPI_FLASH_MACRONIX
+#define CONFIG_SPI_FLASH_STMICRO
+#undef CONFIG_ENV_SPI_MAX_HZ
+#define CONFIG_ENV_SPI_MAX_HZ		25000000
+#undef CONFIG_SF_DEFAULT_SPEED
+#define CONFIG_SF_DEFAULT_SPEED		25000000
+
+
+#undef CONFIG_SYS_PROMPT
+#define CONFIG_SYS_PROMPT		"=> "
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+
+/*
+ *  Environment variables configurations
+ */
+#ifdef CONFIG_SPI_FLASH
+#define CONFIG_SYS_MAX_FLASH_BANKS	1
+#define CONFIG_SYS_MAX_FLASH_SECT	8
+#define CONFIG_ENV_IS_IN_SPI_FLASH	1
+#define CONFIG_ENV_SECT_SIZE		0x10000 /* 64K */
+#else
+#define CONFIG_ENV_IS_NOWHERE
+#endif
+
+#define CONFIG_ENV_SIZE			0x10000 /* 64k */
+#define CONFIG_ENV_OFFSET		0x70000 /* env starts here */
+
+/*
+ * Default environment variables
+ */
+#define CONFIG_LOADADDR		0x00800000
+#define CONFIG_BOOTCOMMAND	"run bootcmd_${bootsource}"
+#define CONFIG_BOOTARGS		"console=ttyS0,115200 root=/dev/sda2"
+#define CONFIG_EXTRA_ENV_SETTINGS					\
+	"bootsource=hdd\0"						\
+	"hdpart=0:1\0"							\
+	"bootcmd_net=bootp 0x00100000 uImage "				\
+		"&& tftpboot 0x00800000 uInitrd "			\
+		"&& bootm 0x00100000 0x00800000\0"			\
+	"bootcmd_hdd=ide reset; "					\
+		"&& ext2load ide ${hdpart} 0x00100000 /uImage "		\
+		"&& ext2load ide ${hdpart} 0x00800000 /uInitrd "	\
+		"&& bootm 0x00100000 0x00800000\0"			\
+	"bootcmd_usb=usb start "					\
+		"&& fatload usb 0:1 0x00100000 /uImage "		\
+		"&& fatload usb 0:1 0x00800000 /uInitrd "		\
+		"&& bootm 0x00100000 0x00800000\0"			\
+	"bootcmd_cli=echo Entering CLI\0"				\
+	"eraseenv=sf probe 0 "						\
+		"&& sf erase " MK_STR(CONFIG_ENV_OFFSET)		\
+			" +" MK_STR(CONFIG_ENV_SIZE) "\0"		\
+	"standard_env=setenv ipaddr; setenv netmask; setenv serverip; "	\
+		"setenv ncip; setenv bootsource hdd; run ser\0"		\
+	"ser=setenv stdin serial; setenv stdout serial; "		\
+		"setenv stderr serial\0"				\
+	"nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0"	\
+	"restore_env=run standard_env; saveenv; reset\0"		\
+	"stdin=serial\0"						\
+	"stdout=serial\0"						\
+	"stderr=serial\0"
+
+/*
+ * Ethernet Driver configuration
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_MVGBE_PORTS		{0, 1} /* enable port 1 only */
+#define CONFIG_PHY_BASE_ADR		7
+#endif /* CONFIG_CMD_NET */
+
+#ifdef CONFIG_CMD_IDE
+#undef CONFIG_IDE_LED
+#undef CONFIG_SYS_IDE_MAXBUS
+#define CONFIG_SYS_IDE_MAXBUS		1
+#undef CONFIG_SYS_IDE_MAXDEVICE
+#define CONFIG_SYS_IDE_MAXDEVICE	1
+#define CONFIG_SYS_ATA_IDE0_OFFSET	MV_SATA_PORT0_OFFSET
+#endif
+
+#endif /* _CONFIG_LSXL_H */