[U-Boot] [PATCH v4 0/6] Add Highbank platform

From: Rob Herring rob.herring@calxeda.com
This series enables non-PCI AHCI controllers and adds support for Calxeda Highbank platform which uses the AHCI changes.
Changes from v3: - Added Highbank to MAINTAINERS - Added back patch to fix CONFIG_SKIP_LOWLEVEL_INIT (mistakenly dropped from v2)
Wolfgang, Albert,
Can you apply these to your trees for v2011.09? All review comments have been addressed.
Rob
Rob Herring (6): ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7 ARM: Add Calxeda Highbank platform arm: add __ilog2 function scsi/ahci: ata id little endian fix scsi/ahci: add support for non-PCI controllers ARM: highbank: Add AHCI support
MAINTAINERS | 4 + arch/arm/cpu/armv7/highbank/Makefile | 46 ++++++++++++ arch/arm/cpu/armv7/highbank/config.mk | 4 + arch/arm/cpu/armv7/highbank/timer.c | 124 +++++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/start.S | 2 + arch/arm/include/asm/bitops.h | 9 +++ board/highbank/Makefile | 49 +++++++++++++ board/highbank/highbank.c | 58 +++++++++++++++ boards.cfg | 1 + common/cmd_scsi.c | 6 +- drivers/block/ahci.c | 72 ++++++++++++++++--- include/ahci.h | 4 + include/configs/highbank.h | 112 +++++++++++++++++++++++++++++ include/scsi.h | 1 + 14 files changed, 480 insertions(+), 12 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/config.mk create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h

From: Rob Herring rob.herring@calxeda.com
cpu_init_crit can be skipped, but the code is still enabled requiring a platform to supply lowlevel_init.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.aribaud@free.fr --- arch/arm/cpu/armv7/start.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index d91ae12..ec54125 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -275,6 +275,7 @@ _rel_dyn_end_ofs: _dynsym_start_ofs: .word __dynsym_start - _start
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT /************************************************************************* * * CPU_init_critical registers @@ -311,6 +312,7 @@ cpu_init_crit: bl lowlevel_init @ go setup pll,mux,memory mov lr, ip @ restore link mov pc, lr @ back to my caller +#endif /* ************************************************************************* *

From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support to boot is included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.aribaud@free.fr --- MAINTAINERS | 4 + arch/arm/cpu/armv7/highbank/Makefile | 46 ++++++++++++ arch/arm/cpu/armv7/highbank/config.mk | 4 + arch/arm/cpu/armv7/highbank/timer.c | 124 +++++++++++++++++++++++++++++++++ board/highbank/Makefile | 49 +++++++++++++ board/highbank/highbank.c | 49 +++++++++++++ boards.cfg | 1 + include/configs/highbank.h | 101 +++++++++++++++++++++++++++ 8 files changed, 378 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/config.mk create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h
diff --git a/MAINTAINERS b/MAINTAINERS index 2bba7b4..515347d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -225,6 +225,10 @@ Wolfgang Grandegger wg@denx.de IPHASE4539 MPC8260 SCM MPC8260
+Rob Herring rob.herring@calxeda.com + + highbank highbank + Klaus Heydeck heydeck@kieback-peter.de
KUP4K MPC855 diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile new file mode 100644 index 0000000..76faeb0 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +COBJS := timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/armv7/highbank/config.mk b/arch/arm/cpu/armv7/highbank/config.mk new file mode 100644 index 0000000..5ed5c39 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/config.mk @@ -0,0 +1,4 @@ +STANDALONE_LOAD_ADDR = 0x100000 + +PLATFORM_CPPFLAGS += -march=armv7-a + diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c new file mode 100644 index 0000000..263f11a --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -0,0 +1,124 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * Based on arm926ejs/mx27/timer.c + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <div64.h> +#include <linux/types.h> /* for size_t */ +#include <linux/stddef.h> /* for NULL */ +#include <asm/io.h> +#include <asm/arch-armv7/systimer.h> + +#undef SYSTIMER_BASE +#define SYSTIMER_BASE 0xFFF34000 /* Timer 0 and 1 base */ +#define SYSTIMER_RATE 150000000 + +static ulong timestamp; +static ulong lastinc; +static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE; + +/* + * Start the timer + */ +int timer_init(void) +{ + /* + * Setup timer0 + */ + writel(SYSTIMER_RELOAD, &systimer_base->timer0load); + writel(SYSTIMER_RELOAD, &systimer_base->timer0value); + writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control); + + reset_timer_masked(); + + return 0; + +} + +#define TICK_PER_TIME ((SYSTIMER_RATE + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define NS_PER_TICK (1000000000 / SYSTIMER_RATE) + +static inline unsigned long long tick_to_time(unsigned long long tick) +{ + do_div(tick, TICK_PER_TIME); + return tick; +} + +static inline unsigned long long time_to_tick(unsigned long long time) +{ + return time * TICK_PER_TIME; +} + +static inline unsigned long long us_to_tick(unsigned long long us) +{ + unsigned long long tick = us << 16; + tick += NS_PER_TICK - 1; + do_div(tick, NS_PER_TICK); + return tick >> 16; +} + +unsigned long long get_ticks(void) +{ + ulong now = ~readl(&systimer_base->timer0value); + + if (now >= lastinc) /* normal mode (non roll) */ + /* move stamp forward with absolut diff ticks */ + timestamp += (now - lastinc); + else /* we have rollover of incrementer */ + timestamp += (0xFFFFFFFF - lastinc) + now; + lastinc = now; + return timestamp; +} + +/* + * Delay x useconds AND preserve advance timstamp value + * assumes timer is ticking at 1 msec + */ +void __udelay(ulong usec) +{ + unsigned long long tmp; + ulong tmo; + + tmo = us_to_tick(usec); + tmp = get_ticks() + tmo; /* get current timestamp */ + + while (get_ticks() < tmp) /* loop till event */ + /*NOP*/; +} + +ulong get_timer(ulong base) +{ + return get_timer_masked() - base; +} + +void reset_timer_masked(void) +{ + lastinc = ~readl(&systimer_base->timer0value); + timestamp = 0; +} + +void reset_timer(void) +{ + reset_timer_masked(); +} + +ulong get_timer_masked(void) +{ + return tick_to_time(get_ticks()); +} + diff --git a/board/highbank/Makefile b/board/highbank/Makefile new file mode 100644 index 0000000..d5b8362 --- /dev/null +++ b/board/highbank/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := highbank.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +clean: + rm -f $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c new file mode 100644 index 0000000..9a0fc19 --- /dev/null +++ b/board/highbank/highbank.c @@ -0,0 +1,49 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> + +#include <asm/sizes.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Miscellaneous platform dependent initialisations + */ +int board_init(void) +{ + icache_enable(); + + return 0; +} + +int dram_init(void) +{ + gd->ram_size = SZ_512M; + return 0; +} + +void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +void reset_cpu(ulong addr) +{ +} + diff --git a/boards.cfg b/boards.cfg index dfefc3f..b7eda53 100644 --- a/boards.cfg +++ b/boards.cfg @@ -135,6 +135,7 @@ omap5912osk arm arm926ejs - ti edminiv2 arm arm926ejs - LaCie orion5x dkb arm arm926ejs - Marvell pantheon ca9x4_ct_vxp arm armv7 vexpress armltd +highbank arm armv7 highbank - highbank efikamx arm armv7 efikamx - mx5 mx51evk:IMX_CONFIG=board/efikamx/imximage.cfg mx51evk arm armv7 mx51evk freescale mx5 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg mx53evk arm armv7 mx53evk freescale mx5 mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg diff --git a/include/configs/highbank.h b/include/configs/highbank.h new file mode 100644 index 0000000..6e26848 --- /dev/null +++ b/include/configs/highbank.h @@ -0,0 +1,101 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_L2_OFF + +#define CONFIG_SYS_NO_FLASH +#define CFG_HZ 1000 +#define CONFIG_SYS_HZ CFG_HZ + +#define CONFIG_OF_LIBFDT +#define CONFIG_FIT +#define CONFIG_SYS_BOOTMAPSZ (16 << 20) + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (512 * 1024) + +#define CONFIG_PL011_SERIAL +#define CONFIG_PL011_CLOCK 150000000 +#define CONFIG_PL01x_PORTS { (void *)(0xFFF36000) } +#define CONFIG_CONS_INDEX 0 + +#define CONFIG_BAUDRATE 38400 +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS + +#define CONFIG_CMD_BDI +#define CONFIG_CMD_ELF +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_LOADS + +#define CONFIG_BOOTDELAY 2 +/* + * Miscellaneous configurable options + */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PROMPT "Highbank #" +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT)+16) + +#define CONFIG_SYS_LOAD_ADDR 0x800000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ +#endif + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1_SIZE (4089 << 20) +#define CONFIG_SYS_MEMTEST_START 0x100000 +#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1_SIZE - 0x100000) + +/* Room required on the stack for the environment data */ +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_TEXT_BASE 0x00001000 +#define CONFIG_SYS_INIT_SP_ADDR 0x01000000 +#define CONFIG_SKIP_LOWLEVEL_INIT + +#endif

From: Rob Herring rob.herring@calxeda.com
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.aribaud@free.fr --- arch/arm/include/asm/bitops.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 270f163..0420182 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr) return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
+extern __inline__ int __ilog2(unsigned int x) +{ + int ret; + + asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); + ret = 31 - ret; + return ret; +} + /* * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first..

Dear Rob Herring,
In message 1309275583-11763-4-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.aribaud@free.fr
arch/arm/include/asm/bitops.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 270f163..0420182 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr) return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
+extern __inline__ int __ilog2(unsigned int x)
checkpatch says: WARNING: plain inline is preferred over __inline__
Best regards,
Wolfgang Denk

Wolfgang,
On 07/04/2011 05:13 AM, Wolfgang Denk wrote:
Dear Rob Herring,
In message 1309275583-11763-4-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.aribaud@free.fr
arch/arm/include/asm/bitops.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 270f163..0420182 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr) return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
+extern __inline__ int __ilog2(unsigned int x)
checkpatch says: WARNING: plain inline is preferred over __inline__
Sorry about this. I thought I was running checkpatch, but there was a problem in my script I used and it was failing silently.
Rob

Hi Rob,
On Tuesday 28 June 2011 09:09 PM, Rob Herring wrote:
From: Rob Herringrob.herring@calxeda.com
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.aribaud@free.fr
arch/arm/include/asm/bitops.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 270f163..0420182 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -106,6 +106,15 @@ static inline int test_bit(int nr, const void * addr) return ((unsigned char *) addr)[nr>> 3]& (1U<< (nr& 7)); }
+extern __inline__ int __ilog2(unsigned int x) +{
- int ret;
- asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
I tried doing the same sometime back for the same need. I had to abandon it because CLZ seems to be added only in ARMv5. And at least one ARMv7 SoC uses -march=armv4 while building.
best regards, Aneesh

Dear Aneesh V,
In message 4E129653.7050807@ti.com you wrote:
I tried doing the same sometime back for the same need. I had to abandon it because CLZ seems to be added only in ARMv5. And at least one ARMv7 SoC uses -march=armv4 while building.
Does this setting make any sense, or should we fix that?
Best regards,
Wolfgang Denk

Dear Wolfgang,
On Tuesday 05 July 2011 03:28 PM, Wolfgang Denk wrote:
Dear Aneesh V,
In message4E129653.7050807@ti.com you wrote:
I tried doing the same sometime back for the same need. I had to abandon it because CLZ seems to be added only in ARMv5. And at least one ARMv7 SoC uses -march=armv4 while building.
Does this setting make any sense, or should we fix that?
Looks like it makes sense. Here is what the comment says in arch/arm/cpu/armv7/tegra2/config.mk
# Use ARMv4 for Tegra2 - initial code runs on the AVP, which is an ARM7TDI. PLATFORM_CPPFLAGS += -march=armv4
Even if we could fix this, Rob is adding the API for all 'arm', which I feel is not correct.
best regards, Aneesh

Dear Aneesh V,
In message 4E12E2C6.7020401@ti.com you wrote:
Looks like it makes sense. Here is what the comment says in arch/arm/cpu/armv7/tegra2/config.mk
# Use ARMv4 for Tegra2 - initial code runs on the AVP, which is an ARM7TDI. PLATFORM_CPPFLAGS += -march=armv4
I'm not sure what "initial code" here means - all of U-Boot?
Even if we could fix this, Rob is adding the API for all 'arm', which I feel is not correct.
Agreed. But then, it's the overwhelming majority that could use this code.
Best regards,
Wolfgang Denk

Le 05/07/2011 13:17, Wolfgang Denk a écrit :
Dear Aneesh V,
In message4E12E2C6.7020401@ti.com you wrote:
Looks like it makes sense. Here is what the comment says in arch/arm/cpu/armv7/tegra2/config.mk
# Use ARMv4 for Tegra2 - initial code runs on the AVP, which is an ARM7TDI. PLATFORM_CPPFLAGS += -march=armv4
I'm not sure what "initial code" here means - all of U-Boot?
Even if we could fix this, Rob is adding the API for all 'arm', which I feel is not correct.
Agreed. But then, it's the overwhelming majority that could use this code.
Maybe we could condition this __ilog2 definition on whether we build for armv4 (and below) or armv5t (or above)?
Best regards,
Wolfgang Denk
Amicalement,

From: Rob Herring rob.herring@calxeda.com
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.aribaud@free.fr --- Performance here is not critical, so I'm changing this to use the C version.
v2 changes: - Change __inline__ to inline. - Use generic_fls function instead of clz asm so it works with ARMv4.
arch/arm/include/asm/bitops.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 270f163..879e20e 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -106,6 +106,11 @@ static inline int test_bit(int nr, const void * addr) return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
+static inline int __ilog2(unsigned int x) +{ + return generic_fls(x) - 1; +} + /* * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first..

Hi Rob,
Le 05/07/2011 16:38, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add __ilog2 function for ARM. Needed for ahci.c
Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.aribaud@free.fr
Applied to u-boot-arm/master, thanks!
(but please do not use my old e-mail address)
Amicalement,

From: Rob Herring rob.herring@calxeda.com
The ata id string always needs swapping, not just on BE machines.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de --- drivers/block/ahci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index a3ca2dc..d431c5a 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -468,7 +468,7 @@ static char *ata_id_strcpy(u16 *target, u16 *src, int len) { int i; for (i = 0; i < len / 2; i++) - target[i] = le16_to_cpu(src[i]); + target[i] = swab16(src[i]); return (char *)target; }

From: Rob Herring rob.herring@calxeda.com
Add support for AHCI controllers that are not PCI based.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de --- common/cmd_scsi.c | 6 +++- drivers/block/ahci.c | 70 +++++++++++++++++++++++++++++++++++++++++++------ include/ahci.h | 4 +++ include/scsi.h | 1 + 4 files changed, 70 insertions(+), 11 deletions(-)
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index be4fe74..25a8299 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -47,7 +47,8 @@ #define SCSI_DEV_ID 0x5288
#else -#error no scsi device defined +#define SCSI_VEND_ID 0 +#define SCSI_DEV_ID 0 #endif
@@ -174,7 +175,7 @@ removable: scsi_curr_dev = -1; }
- +#ifdef CONFIG_PCI void scsi_init(void) { int busdevfunc; @@ -192,6 +193,7 @@ void scsi_init(void) scsi_low_level_init(busdevfunc); scsi_scan(1); } +#endif
block_dev_desc_t * scsi_get_dev(int dev) { diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index d431c5a..d12cb71 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -78,13 +78,15 @@ static int waiting_for_cmd_completed(volatile u8 *offset,
static int ahci_host_init(struct ahci_probe_ent *probe_ent) { +#ifdef CONFIG_PCI pci_dev_t pdev = probe_ent->dev; + u16 tmp16; + unsigned short vendor; +#endif volatile u8 *mmio = (volatile u8 *)probe_ent->mmio_base; u32 tmp, cap_save; - u16 tmp16; int i, j; volatile u8 *port_mmio; - unsigned short vendor;
cap_save = readl(mmio + HOST_CAP); cap_save &= ((1 << 28) | (1 << 17)); @@ -110,6 +112,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) writel(cap_save, mmio + HOST_CAP); writel_with_flush(0xf, mmio + HOST_PORTS_IMPL);
+#ifdef CONFIG_PCI pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor);
if (vendor == PCI_VENDOR_ID_INTEL) { @@ -118,7 +121,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) tmp16 |= 0xf; pci_write_config_word(pdev, 0x92, tmp16); } - +#endif probe_ent->cap = readl(mmio + HOST_CAP); probe_ent->port_map = readl(mmio + HOST_PORTS_IMPL); probe_ent->n_ports = (probe_ent->cap & 0x1f) + 1; @@ -183,22 +186,24 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL); tmp = readl(mmio + HOST_CTL); debug("HOST_CTL 0x%x\n", tmp); - +#ifdef CONFIG_PCI pci_read_config_word(pdev, PCI_COMMAND, &tmp16); tmp |= PCI_COMMAND_MASTER; pci_write_config_word(pdev, PCI_COMMAND, tmp16); - +#endif return 0; }
static void ahci_print_info(struct ahci_probe_ent *probe_ent) { +#ifdef CONFIG_PCI pci_dev_t pdev = probe_ent->dev; + u16 cc; +#endif volatile u8 *mmio = (volatile u8 *)probe_ent->mmio_base; u32 vers, cap, impl, speed; const char *speed_s; - u16 cc; const char *scc_s;
vers = readl(mmio + HOST_VERSION); @@ -212,7 +217,7 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) speed_s = "3"; else speed_s = "?"; - +#ifdef CONFIG_PCI pci_read_config_word(pdev, 0x0a, &cc); if (cc == 0x0101) scc_s = "IDE"; @@ -222,7 +227,9 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) scc_s = "RAID"; else scc_s = "unknown"; - +#else + scc_s = "SATA"; +#endif printf("AHCI %02x%02x.%02x%02x " "%u slots %u ports %s Gbps 0x%x impl %s mode\n", (vers >> 24) & 0xff, @@ -249,6 +256,7 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) cap & (1 << 13) ? "part " : ""); }
+#ifdef CONFIG_PCI static int ahci_init_one(pci_dev_t pdev) { u16 vendor; @@ -291,7 +299,7 @@ static int ahci_init_one(pci_dev_t pdev) err_out: return rc; } - +#endif
#define MAX_DATA_BYTE_COUNT (4*1024*1024)
@@ -667,7 +675,9 @@ void scsi_low_level_init(int busdevfunc) int i; u32 linkmap;
+#ifdef CONFIG_PCI ahci_init_one(busdevfunc); +#endif
linkmap = probe_ent->link_port_map;
@@ -682,6 +692,48 @@ void scsi_low_level_init(int busdevfunc) } }
+int ahci_init(u32 base) +{ + int i, rc = 0; + u32 linkmap; + + memset(ataid, 0, sizeof(ataid)); + + probe_ent = malloc(sizeof(struct ahci_probe_ent)); + memset(probe_ent, 0, sizeof(struct ahci_probe_ent)); + + probe_ent->host_flags = ATA_FLAG_SATA + | ATA_FLAG_NO_LEGACY + | ATA_FLAG_MMIO + | ATA_FLAG_PIO_DMA + | ATA_FLAG_NO_ATAPI; + probe_ent->pio_mask = 0x1f; + probe_ent->udma_mask = 0x7f; /*Fixme,assume to support UDMA6 */ + + probe_ent->mmio_base = base; + + /* initialize adapter */ + rc = ahci_host_init(probe_ent); + if (rc) + goto err_out; + + ahci_print_info(probe_ent); + + linkmap = probe_ent->link_port_map; + + for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) { + if (((linkmap >> i) & 0x01)) { + if (ahci_port_start((u8) i)) { + printf("Can not start port %d\n", i); + continue; + } + ahci_set_feature((u8) i); + } + } +err_out: + return rc; +} +
void scsi_bus_reset(void) { diff --git a/include/ahci.h b/include/ahci.h index 0c6bbbd..c0a0a47 100644 --- a/include/ahci.h +++ b/include/ahci.h @@ -25,6 +25,8 @@ #ifndef _AHCI_H_ #define _AHCI_H_
+#include <pci.h> + #define AHCI_PCI_BAR 0x24 #define AHCI_MAX_SG 56 /* hardware max is 64K */ #define AHCI_CMD_SLOT_SZ 32 @@ -187,4 +189,6 @@ struct ahci_probe_ent { u32 link_port_map; /*linkup port map*/ };
+int ahci_init(u32 base); + #endif diff --git a/include/scsi.h b/include/scsi.h index aaafc9c..c52759c 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -185,6 +185,7 @@ void scsi_low_level_init(int busdevfunc); * functions residing inside cmd_scsi.c */ void scsi_init(void); +void scsi_scan(int mode);
#define SCSI_IDENTIFY 0xC0 /* not used */

Dear Rob Herring,
In message 1309275583-11763-6-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add support for AHCI controllers that are not PCI based.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de
common/cmd_scsi.c | 6 +++- drivers/block/ahci.c | 70 +++++++++++++++++++++++++++++++++++++++++++------ include/ahci.h | 4 +++ include/scsi.h | 1 + 4 files changed, 70 insertions(+), 11 deletions(-)
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index be4fe74..25a8299 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -47,7 +47,8 @@ #define SCSI_DEV_ID 0x5288
#else -#error no scsi device defined +#define SCSI_VEND_ID 0 +#define SCSI_DEV_ID 0 #endif
I'm not sure if this is a good idea. Please explain.
Also, checkpatch says:
ERROR: trailing whitespace WARNING: please, no spaces at the start of a line #287: FILE: include/ahci.h:193: + $
+#ifdef CONFIG_PCI pci_read_config_word(pdev, 0x0a, &cc); if (cc == 0x0101) scc_s = "IDE"; @@ -222,7 +227,9 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) scc_s = "RAID"; else scc_s = "unknown";
+#else
- scc_s = "SATA";
+#endif
Is SATA really the only possible option here?
+int ahci_init(u32 base) +{
...
+}
Should this always be compiled in?
Best regards,
Wolfgang Denk

Wolfgang,
On 07/04/2011 05:17 AM, Wolfgang Denk wrote:
Dear Rob Herring,
In message 1309275583-11763-6-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add support for AHCI controllers that are not PCI based.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de
common/cmd_scsi.c | 6 +++- drivers/block/ahci.c | 70 +++++++++++++++++++++++++++++++++++++++++++------ include/ahci.h | 4 +++ include/scsi.h | 1 + 4 files changed, 70 insertions(+), 11 deletions(-)
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index be4fe74..25a8299 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -47,7 +47,8 @@ #define SCSI_DEV_ID 0x5288
#else -#error no scsi device defined +#define SCSI_VEND_ID 0 +#define SCSI_DEV_ID 0 #endif
I'm not sure if this is a good idea. Please explain.
This is the PCI ID and is only used here:
common/cmd_scsi.c:183: busdevfunc=pci_find_device(SCSI_VEND_ID,SCSI_DEV_ID,0); /* get PCI Device ID */
For a non-PCI AHCI controller, there is no id. For PCI, I don't think 0 is a valid vendor ID anyway.
Also, checkpatch says:
ERROR: trailing whitespace WARNING: please, no spaces at the start of a line #287: FILE: include/ahci.h:193:
- $
+#ifdef CONFIG_PCI pci_read_config_word(pdev, 0x0a, &cc); if (cc == 0x0101) scc_s = "IDE"; @@ -222,7 +227,9 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) scc_s = "RAID"; else scc_s = "unknown";
+#else
- scc_s = "SATA";
+#endif
Is SATA really the only possible option here?
Well I suppose anything is possible, but for embbedded SOCs with AHCI I've seen, they are SATA only. It's purely informational.
+int ahci_init(u32 base) +{
...
+}
Should this always be compiled in?
I can add a config option CONFIG_SCSI_AHCI_PLAT. Perhaps this would be better than using CONFIG_PCI as I suppose you could have non-PCI AHCI controller on a platform with PCI.
Rob

Dear Rob,
In message 4E11D372.8090708@calxeda.com you wrote:
-#error no scsi device defined +#define SCSI_VEND_ID 0 +#define SCSI_DEV_ID 0 #endif
I'm not sure if this is a good idea. Please explain.
This is the PCI ID and is only used here:
common/cmd_scsi.c:183: busdevfunc=pci_find_device(SCSI_VEND_ID,SCSI_DEV_ID,0); /* get PCI Device ID */
For a non-PCI AHCI controller, there is no id. For PCI, I don't think 0 is a valid vendor ID anyway.
I think we should rather skip the respective parts of the code instead of inserting invalid vendor IDs.
Should this always be compiled in?
I can add a config option CONFIG_SCSI_AHCI_PLAT. Perhaps this would be better than using CONFIG_PCI as I suppose you could have non-PCI AHCI controller on a platform with PCI.
Yes, please.
Best regards,
Wolfgang Denk

From: Rob Herring rob.herring@calxeda.com
Add support for AHCI controllers that are not PCI based.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de --- changes in v2: - fix checkpatch.pl warnings/errors - fix label indentation - simplify "sizeof(hd_driveid_t *) * AHCI_MAX_PORTS" to "sizeof(ataid)" - Add function prototypes for ahci_init and scsi_scan
changes in v3: - Introduce CONFIG_SCSI_AHCI_PLAT and replace CONFIG_PCI with it in ahci.c - Make no SCSI_DEV_ID and SCSI_VEND_ID only okay if CONFIG_SCSI_AHCI_PLAT is defined. - fix checkpatch.pl warnings/errors (again...)
common/cmd_scsi.c | 5 ++- drivers/block/ahci.c | 70 ++++++++++++++++++++++++++++++++++++++++++++----- include/ahci.h | 4 +++ include/scsi.h | 1 + 4 files changed, 70 insertions(+), 10 deletions(-)
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index be4fe74..352781b 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -46,7 +46,7 @@ #define SCSI_VEND_ID 0x10b9 #define SCSI_DEV_ID 0x5288
-#else +#elif !defined(CONFIG_SCSI_AHCI_PLAT) #error no scsi device defined #endif
@@ -174,7 +174,7 @@ removable: scsi_curr_dev = -1; }
- +#ifdef CONFIG_PCI void scsi_init(void) { int busdevfunc; @@ -192,6 +192,7 @@ void scsi_init(void) scsi_low_level_init(busdevfunc); scsi_scan(1); } +#endif
block_dev_desc_t * scsi_get_dev(int dev) { diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index d431c5a..64f52bb 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -78,13 +78,15 @@ static int waiting_for_cmd_completed(volatile u8 *offset,
static int ahci_host_init(struct ahci_probe_ent *probe_ent) { +#ifndef CONFIG_SCSI_AHCI_PLAT pci_dev_t pdev = probe_ent->dev; + u16 tmp16; + unsigned short vendor; +#endif volatile u8 *mmio = (volatile u8 *)probe_ent->mmio_base; u32 tmp, cap_save; - u16 tmp16; int i, j; volatile u8 *port_mmio; - unsigned short vendor;
cap_save = readl(mmio + HOST_CAP); cap_save &= ((1 << 28) | (1 << 17)); @@ -110,6 +112,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) writel(cap_save, mmio + HOST_CAP); writel_with_flush(0xf, mmio + HOST_PORTS_IMPL);
+#ifndef CONFIG_SCSI_AHCI_PLAT pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor);
if (vendor == PCI_VENDOR_ID_INTEL) { @@ -118,7 +121,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) tmp16 |= 0xf; pci_write_config_word(pdev, 0x92, tmp16); } - +#endif probe_ent->cap = readl(mmio + HOST_CAP); probe_ent->port_map = readl(mmio + HOST_PORTS_IMPL); probe_ent->n_ports = (probe_ent->cap & 0x1f) + 1; @@ -183,22 +186,24 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL); tmp = readl(mmio + HOST_CTL); debug("HOST_CTL 0x%x\n", tmp); - +#ifndef CONFIG_SCSI_AHCI_PLAT pci_read_config_word(pdev, PCI_COMMAND, &tmp16); tmp |= PCI_COMMAND_MASTER; pci_write_config_word(pdev, PCI_COMMAND, tmp16); - +#endif return 0; }
static void ahci_print_info(struct ahci_probe_ent *probe_ent) { +#ifndef CONFIG_SCSI_AHCI_PLAT pci_dev_t pdev = probe_ent->dev; + u16 cc; +#endif volatile u8 *mmio = (volatile u8 *)probe_ent->mmio_base; u32 vers, cap, impl, speed; const char *speed_s; - u16 cc; const char *scc_s;
vers = readl(mmio + HOST_VERSION); @@ -213,6 +218,9 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) else speed_s = "?";
+#ifdef CONFIG_SCSI_AHCI_PLAT + scc_s = "SATA"; +#else pci_read_config_word(pdev, 0x0a, &cc); if (cc == 0x0101) scc_s = "IDE"; @@ -222,7 +230,7 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) scc_s = "RAID"; else scc_s = "unknown"; - +#endif printf("AHCI %02x%02x.%02x%02x " "%u slots %u ports %s Gbps 0x%x impl %s mode\n", (vers >> 24) & 0xff, @@ -249,6 +257,7 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) cap & (1 << 13) ? "part " : ""); }
+#ifndef CONFIG_SCSI_AHCI_PLAT static int ahci_init_one(pci_dev_t pdev) { u16 vendor; @@ -291,7 +300,7 @@ static int ahci_init_one(pci_dev_t pdev) err_out: return rc; } - +#endif
#define MAX_DATA_BYTE_COUNT (4*1024*1024)
@@ -667,7 +676,9 @@ void scsi_low_level_init(int busdevfunc) int i; u32 linkmap;
+#ifndef CONFIG_SCSI_AHCI_PLAT ahci_init_one(busdevfunc); +#endif
linkmap = probe_ent->link_port_map;
@@ -682,6 +693,49 @@ void scsi_low_level_init(int busdevfunc) } }
+#ifdef CONFIG_SCSI_AHCI_PLAT +int ahci_init(u32 base) +{ + int i, rc = 0; + u32 linkmap; + + memset(ataid, 0, sizeof(ataid)); + + probe_ent = malloc(sizeof(struct ahci_probe_ent)); + memset(probe_ent, 0, sizeof(struct ahci_probe_ent)); + + probe_ent->host_flags = ATA_FLAG_SATA + | ATA_FLAG_NO_LEGACY + | ATA_FLAG_MMIO + | ATA_FLAG_PIO_DMA + | ATA_FLAG_NO_ATAPI; + probe_ent->pio_mask = 0x1f; + probe_ent->udma_mask = 0x7f; /*Fixme,assume to support UDMA6 */ + + probe_ent->mmio_base = base; + + /* initialize adapter */ + rc = ahci_host_init(probe_ent); + if (rc) + goto err_out; + + ahci_print_info(probe_ent); + + linkmap = probe_ent->link_port_map; + + for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) { + if (((linkmap >> i) & 0x01)) { + if (ahci_port_start((u8) i)) { + printf("Can not start port %d\n", i); + continue; + } + ahci_set_feature((u8) i); + } + } +err_out: + return rc; +} +#endif
void scsi_bus_reset(void) { diff --git a/include/ahci.h b/include/ahci.h index 0c6bbbd..465ea7f 100644 --- a/include/ahci.h +++ b/include/ahci.h @@ -25,6 +25,8 @@ #ifndef _AHCI_H_ #define _AHCI_H_
+#include <pci.h> + #define AHCI_PCI_BAR 0x24 #define AHCI_MAX_SG 56 /* hardware max is 64K */ #define AHCI_CMD_SLOT_SZ 32 @@ -187,4 +189,6 @@ struct ahci_probe_ent { u32 link_port_map; /*linkup port map*/ };
+int ahci_init(u32 base); + #endif diff --git a/include/scsi.h b/include/scsi.h index aaafc9c..c52759c 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -185,6 +185,7 @@ void scsi_low_level_init(int busdevfunc); * functions residing inside cmd_scsi.c */ void scsi_init(void); +void scsi_scan(int mode);
#define SCSI_IDENTIFY 0xC0 /* not used */

Dear Rob Herring,
In message 1310004816-18266-1-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add support for AHCI controllers that are not PCI based.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de
changes in v2:
- fix checkpatch.pl warnings/errors
- fix label indentation
- simplify "sizeof(hd_driveid_t *) * AHCI_MAX_PORTS" to "sizeof(ataid)"
- Add function prototypes for ahci_init and scsi_scan
changes in v3:
- Introduce CONFIG_SCSI_AHCI_PLAT and replace CONFIG_PCI with it in ahci.c
- Make no SCSI_DEV_ID and SCSI_VEND_ID only okay if CONFIG_SCSI_AHCI_PLAT is defined.
- fix checkpatch.pl warnings/errors (again...)
common/cmd_scsi.c | 5 ++- drivers/block/ahci.c | 70 ++++++++++++++++++++++++++++++++++++++++++++----- include/ahci.h | 4 +++ include/scsi.h | 1 + 4 files changed, 70 insertions(+), 10 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

From: Rob Herring rob.herring@calxeda.com
This enables the AHCI driver on highbank platforms.
Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Wolfgang Denk wd@denx.de Cc: Albert ARIBAUD albert.aribaud@free.fr --- board/highbank/highbank.c | 9 +++++++++ include/configs/highbank.h | 11 +++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index 9a0fc19..bec3d2f 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -16,6 +16,8 @@ */
#include <common.h> +#include <ahci.h> +#include <scsi.h>
#include <asm/sizes.h>
@@ -31,6 +33,13 @@ int board_init(void) return 0; }
+int misc_init_r(void) +{ + ahci_init(0xffe08000); + scsi_scan(1); + return 0; +} + int dram_init(void) { gd->ram_size = SZ_512M; diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 6e26848..0ae198d 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -41,6 +41,15 @@ #define CONFIG_BAUDRATE 38400 #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
+#define CONFIG_MISC_INIT_R +#define CONFIG_SCSI_AHCI +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 5 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) + +#define CONFIG_DOS_PARTITION + /* * Command line configuration. */ @@ -52,6 +61,8 @@ #define CONFIG_CMD_ELF #define CONFIG_CMD_MEMORY #define CONFIG_CMD_LOADS +#define CONFIG_CMD_SCSI +#define CONFIG_CMD_EXT2
#define CONFIG_BOOTDELAY 2 /*

Hi Rob,
Le 28/06/2011 17:39, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
This series enables non-PCI AHCI controllers and adds support for Calxeda Highbank platform which uses the AHCI changes.
Changes from v3:
- Added Highbank to MAINTAINERS
- Added back patch to fix CONFIG_SKIP_LOWLEVEL_INIT (mistakenly dropped
from v2)
Wolfgang, Albert,
Can you apply these to your trees for v2011.09? All review comments have been addressed.
Rob
Seems like there are no additional comments and most of the code is for ARM without any other custodian involved, so:
Acked-By: Albert ARIBAUD albert-u-boot@aribaud.net
... and I'll pull it in u-boot-arm/master once the current ARM pull request is processed.
Amicalement,

Dear Albert ARIBAUD,
In message 4E0C63D0.9010801@aribaud.net you wrote:
Seems like there are no additional comments and most of the code is for
There are not much additional comments because Rob's patches should all be ignored, or do you have the time to find out which of this versions is what, and what he actually changed?
It seems he did not even run checkpatch.
Acked-By: Albert ARIBAUD albert-u-boot@aribaud.net
... and I'll pull it in u-boot-arm/master once the current ARM pull
request is processed.
I'm not sure if this is a good idea.
Best regards,
Wolfgang Denk

Hi Wolfgang,
Le 04/07/2011 12:28, Wolfgang Denk a écrit :
Dear Albert ARIBAUD,
In message4E0C63D0.9010801@aribaud.net you wrote:
Seems like there are no additional comments and most of the code is for
There are not much additional comments because Rob's patches should all be ignored, or do you have the time to find out which of this versions is what, and what he actually changed?
It seems he did not even run checkpatch.
Acked-By: Albert ARIBAUDalbert-u-boot@aribaud.net
... and I'll pull it in u-boot-arm/master once the current ARM pull
request is processed.
I'm not sure if this is a good idea.
Understood.
Best regards,
Wolfgang Denk
Amicalement,

Dear Rob Herring,
In message 1309275583-11763-1-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
This series enables non-PCI AHCI controllers and adds support for Calxeda Highbank platform which uses the AHCI changes.
Changes from v3:
- Added Highbank to MAINTAINERS
- Added back patch to fix CONFIG_SKIP_LOWLEVEL_INIT (mistakenly dropped
from v2)
Wolfgang, Albert,
Can you apply these to your trees for v2011.09? All review comments have been addressed.
I have to admit that I dislike the way you are working.
If I'm not wrong, there have been several versions of your patches around, but you repost again and again without any indication that these are reposts, nor what exactly has been changed between versions. For example, I see three different posts here:
06/11 Rob Herring [U-Boot] [PATCH 8/8] ARM: Add Calxeda Highbank platform http://article.gmane.org/gmane.comp.boot-loaders.u-boot/101435 06/21 Rob Herring [U-Boot] [PATCH 1/5] ARM: Add Calxeda Highbank platform http://article.gmane.org/gmane.comp.boot-loaders.u-boot/101867 06/28 Rob Herring [U-Boot] [PATCH 2/6] ARM: Add Calxeda Highbank platform http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102124
None of these adheres to the requirements as documented here: http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
Please be aware that NOT documentaing what you changed means that all (potential) reviewers of your code have to spend additional time figuring out what you might have changed, and checking back in the history if you really implemented all earlier review comments. Speaking for me, I must state that being notoriously short of time I am not willing to waste additional time on such postings, so I tend to ignore them.
In short: please stick to the rules if you want your patches to go into mainline.
Best regards,
Wolfgang Denk

Wolfgang,
On 07/04/2011 05:28 AM, Wolfgang Denk wrote:
Dear Rob Herring,
In message 1309275583-11763-1-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
This series enables non-PCI AHCI controllers and adds support for Calxeda Highbank platform which uses the AHCI changes.
Changes from v3:
- Added Highbank to MAINTAINERS
- Added back patch to fix CONFIG_SKIP_LOWLEVEL_INIT (mistakenly dropped
from v2)
Wolfgang, Albert,
Can you apply these to your trees for v2011.09? All review comments have been addressed.
I have to admit that I dislike the way you are working.
If I'm not wrong, there have been several versions of your patches around, but you repost again and again without any indication that these are reposts, nor what exactly has been changed between versions. For example, I see three different posts here:
06/11 Rob Herring [U-Boot] [PATCH 8/8] ARM: Add Calxeda Highbank platform http://article.gmane.org/gmane.comp.boot-loaders.u-boot/101435 06/21 Rob Herring [U-Boot] [PATCH 1/5] ARM: Add Calxeda Highbank platform http://article.gmane.org/gmane.comp.boot-loaders.u-boot/101867 06/28 Rob Herring [U-Boot] [PATCH 2/6] ARM: Add Calxeda Highbank platform http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102124
None of these adheres to the requirements as documented here: http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
Please be aware that NOT documentaing what you changed means that all (potential) reviewers of your code have to spend additional time figuring out what you might have changed, and checking back in the history if you really implemented all earlier review comments. Speaking for me, I must state that being notoriously short of time I am not willing to waste additional time on such postings, so I tend to ignore them.
In short: please stick to the rules if you want your patches to go into mainline.
Sorry about this. I will follow this more closely going forward. Much of the significant change was to the series itself and less so the content itself. I added Highbank support based on you wanting to see a platform use the AHCI changes. Then I dropped the SDHCI changes as another "common" implementation appeared on the list and it will take some time to sort out.
The history for "ARM: Add Calxeda Highbank platform" is: v2: - Move SATA and MMC board init to separate patches - Fix DRAM size setup v3: - Add maintainer
I can repost it if you like with the history, but I'd like to get any review comments from you first.
Up until my last post, the following patches have had no comments and no changes. They were only reposted as part of the whole series:
ARM: add missing CONFIG_SKIP_LOWLEVEL_INIT for armv7 arm: add __ilog2 function scsi/ahci: ata id little endian fix
I have posted v2 of "arm: add __ilog2 function" and v3 of "scsi/ahci: add support for non-PCI controllers" as a replies to the prior versions.
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102679 http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102775
Regards, Rob

From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net ---
changes in v4: - Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018) - Add back SATA support to inital patch as dependencies are all in mainline
changes in v3: - Add hignbank to MAINTAINERS
changes in v2: - Set DRAM size to correct value - split SATA and SD enabling to separate patches
MAINTAINERS | 4 + arch/arm/cpu/armv7/highbank/Makefile | 46 ++++++++++++ arch/arm/cpu/armv7/highbank/config.mk | 4 + arch/arm/cpu/armv7/highbank/timer.c | 124 +++++++++++++++++++++++++++++++++ board/highbank/Makefile | 49 +++++++++++++ board/highbank/highbank.c | 58 +++++++++++++++ boards.cfg | 1 + include/configs/highbank.h | 113 ++++++++++++++++++++++++++++++ 8 files changed, 399 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/config.mk create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h
diff --git a/MAINTAINERS b/MAINTAINERS index f8d8559..f06f12d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -219,6 +219,10 @@ Wolfgang Grandegger wg@denx.de IPHASE4539 MPC8260 SCM MPC8260
+Rob Herring rob.herring@calxeda.com + + highbank highbank + Klaus Heydeck heydeck@kieback-peter.de
KUP4K MPC855 diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile new file mode 100644 index 0000000..76faeb0 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +COBJS := timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/armv7/highbank/config.mk b/arch/arm/cpu/armv7/highbank/config.mk new file mode 100644 index 0000000..5ed5c39 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/config.mk @@ -0,0 +1,4 @@ +STANDALONE_LOAD_ADDR = 0x100000 + +PLATFORM_CPPFLAGS += -march=armv7-a + diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c new file mode 100644 index 0000000..263f11a --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -0,0 +1,124 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * Based on arm926ejs/mx27/timer.c + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <div64.h> +#include <linux/types.h> /* for size_t */ +#include <linux/stddef.h> /* for NULL */ +#include <asm/io.h> +#include <asm/arch-armv7/systimer.h> + +#undef SYSTIMER_BASE +#define SYSTIMER_BASE 0xFFF34000 /* Timer 0 and 1 base */ +#define SYSTIMER_RATE 150000000 + +static ulong timestamp; +static ulong lastinc; +static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE; + +/* + * Start the timer + */ +int timer_init(void) +{ + /* + * Setup timer0 + */ + writel(SYSTIMER_RELOAD, &systimer_base->timer0load); + writel(SYSTIMER_RELOAD, &systimer_base->timer0value); + writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control); + + reset_timer_masked(); + + return 0; + +} + +#define TICK_PER_TIME ((SYSTIMER_RATE + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define NS_PER_TICK (1000000000 / SYSTIMER_RATE) + +static inline unsigned long long tick_to_time(unsigned long long tick) +{ + do_div(tick, TICK_PER_TIME); + return tick; +} + +static inline unsigned long long time_to_tick(unsigned long long time) +{ + return time * TICK_PER_TIME; +} + +static inline unsigned long long us_to_tick(unsigned long long us) +{ + unsigned long long tick = us << 16; + tick += NS_PER_TICK - 1; + do_div(tick, NS_PER_TICK); + return tick >> 16; +} + +unsigned long long get_ticks(void) +{ + ulong now = ~readl(&systimer_base->timer0value); + + if (now >= lastinc) /* normal mode (non roll) */ + /* move stamp forward with absolut diff ticks */ + timestamp += (now - lastinc); + else /* we have rollover of incrementer */ + timestamp += (0xFFFFFFFF - lastinc) + now; + lastinc = now; + return timestamp; +} + +/* + * Delay x useconds AND preserve advance timstamp value + * assumes timer is ticking at 1 msec + */ +void __udelay(ulong usec) +{ + unsigned long long tmp; + ulong tmo; + + tmo = us_to_tick(usec); + tmp = get_ticks() + tmo; /* get current timestamp */ + + while (get_ticks() < tmp) /* loop till event */ + /*NOP*/; +} + +ulong get_timer(ulong base) +{ + return get_timer_masked() - base; +} + +void reset_timer_masked(void) +{ + lastinc = ~readl(&systimer_base->timer0value); + timestamp = 0; +} + +void reset_timer(void) +{ + reset_timer_masked(); +} + +ulong get_timer_masked(void) +{ + return tick_to_time(get_ticks()); +} + diff --git a/board/highbank/Makefile b/board/highbank/Makefile new file mode 100644 index 0000000..d5b8362 --- /dev/null +++ b/board/highbank/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := highbank.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +clean: + rm -f $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c new file mode 100644 index 0000000..bec3d2f --- /dev/null +++ b/board/highbank/highbank.c @@ -0,0 +1,58 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <ahci.h> +#include <scsi.h> + +#include <asm/sizes.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Miscellaneous platform dependent initialisations + */ +int board_init(void) +{ + icache_enable(); + + return 0; +} + +int misc_init_r(void) +{ + ahci_init(0xffe08000); + scsi_scan(1); + return 0; +} + +int dram_init(void) +{ + gd->ram_size = SZ_512M; + return 0; +} + +void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +void reset_cpu(ulong addr) +{ +} + diff --git a/boards.cfg b/boards.cfg index 3e79c82..a2eff60 100644 --- a/boards.cfg +++ b/boards.cfg @@ -140,6 +140,7 @@ omap5912osk arm arm926ejs - ti edminiv2 arm arm926ejs - LaCie orion5x dkb arm arm926ejs - Marvell pantheon ca9x4_ct_vxp arm armv7 vexpress armltd +highbank arm armv7 highbank - highbank efikamx arm armv7 efikamx - mx5 efikamx:IMX_CONFIG=board/efikamx/imximage.cfg mx51evk arm armv7 mx51evk freescale mx5 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg mx53ard arm armv7 mx53ard freescale mx5 mx53ard:IMX_CONFIG=board/freescale/mx53ard/imximage_dd3.cfg diff --git a/include/configs/highbank.h b/include/configs/highbank.h new file mode 100644 index 0000000..9c85788 --- /dev/null +++ b/include/configs/highbank.h @@ -0,0 +1,113 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_L2_OFF + +#define CONFIG_SYS_NO_FLASH +#define CFG_HZ 1000 +#define CONFIG_SYS_HZ CFG_HZ + +#define CONFIG_OF_LIBFDT +#define CONFIG_FIT +#define CONFIG_SYS_BOOTMAPSZ (16 << 20) + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (512 * 1024) + +#define CONFIG_PL011_SERIAL +#define CONFIG_PL011_CLOCK 150000000 +#define CONFIG_PL01x_PORTS { (void *)(0xFFF36000) } +#define CONFIG_CONS_INDEX 0 + +#define CONFIG_BAUDRATE 38400 +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } + +#define CONFIG_MISC_INIT_R +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 5 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) + +#define CONFIG_DOS_PARTITION + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS + +#define CONFIG_CMD_BDI +#define CONFIG_CMD_ELF +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_LOADS +#define CONFIG_CMD_SCSI +#define CONFIG_CMD_EXT2 + +#define CONFIG_BOOTDELAY 2 +/* + * Miscellaneous configurable options + */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PROMPT "Highbank #" +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT)+16) + +#define CONFIG_SYS_LOAD_ADDR 0x800000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ +#endif + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1_SIZE (4089 << 20) +#define CONFIG_SYS_MEMTEST_START 0x100000 +#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1_SIZE - 0x100000) + +/* Room required on the stack for the environment data */ +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_TEXT_BASE 0x00001000 +#define CONFIG_SYS_INIT_SP_ADDR 0x01000000 +#define CONFIG_SKIP_LOWLEVEL_INIT + +#endif

Hi Rob,
Le 04/08/2011 22:22, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
changes in v4:
- Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018)
- Add back SATA support to inital patch as dependencies are all in mainline
changes in v3:
- Add hignbank to MAINTAINERS
changes in v2:
- Set DRAM size to correct value
- split SATA and SD enabling to separate patches
Sorry, this does not seem to apply cleanly on top of current u-boot-arm/master. Can you rebase and submit a V5 patch (with history updated, stating that V5 is a rebase only)?
Thanks in advance and apologies for the delay.
Amicalement,

From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net --- changes in v5: - Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4: - Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018) - Add back SATA support to inital patch as dependencies are all in mainline
changes in v3: - Add hignbank to MAINTAINERS
changes in v2: - Set DRAM size to correct value - split SATA and SD enabling to separate patches
MAINTAINERS | 4 + arch/arm/cpu/armv7/highbank/Makefile | 46 ++++++++++++ arch/arm/cpu/armv7/highbank/config.mk | 4 + arch/arm/cpu/armv7/highbank/timer.c | 124 +++++++++++++++++++++++++++++++++ board/highbank/Makefile | 49 +++++++++++++ board/highbank/highbank.c | 58 +++++++++++++++ boards.cfg | 1 + include/configs/highbank.h | 113 ++++++++++++++++++++++++++++++ 8 files changed, 399 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/config.mk create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h
diff --git a/MAINTAINERS b/MAINTAINERS index f895e9a..c383f6d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -219,6 +219,10 @@ Wolfgang Grandegger wg@denx.de IPHASE4539 MPC8260 SCM MPC8260
+Rob Herring rob.herring@calxeda.com + + highbank highbank + Klaus Heydeck heydeck@kieback-peter.de
KUP4K MPC855 diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile new file mode 100644 index 0000000..76faeb0 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +COBJS := timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/armv7/highbank/config.mk b/arch/arm/cpu/armv7/highbank/config.mk new file mode 100644 index 0000000..5ed5c39 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/config.mk @@ -0,0 +1,4 @@ +STANDALONE_LOAD_ADDR = 0x100000 + +PLATFORM_CPPFLAGS += -march=armv7-a + diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c new file mode 100644 index 0000000..263f11a --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -0,0 +1,124 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * Based on arm926ejs/mx27/timer.c + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <div64.h> +#include <linux/types.h> /* for size_t */ +#include <linux/stddef.h> /* for NULL */ +#include <asm/io.h> +#include <asm/arch-armv7/systimer.h> + +#undef SYSTIMER_BASE +#define SYSTIMER_BASE 0xFFF34000 /* Timer 0 and 1 base */ +#define SYSTIMER_RATE 150000000 + +static ulong timestamp; +static ulong lastinc; +static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE; + +/* + * Start the timer + */ +int timer_init(void) +{ + /* + * Setup timer0 + */ + writel(SYSTIMER_RELOAD, &systimer_base->timer0load); + writel(SYSTIMER_RELOAD, &systimer_base->timer0value); + writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control); + + reset_timer_masked(); + + return 0; + +} + +#define TICK_PER_TIME ((SYSTIMER_RATE + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define NS_PER_TICK (1000000000 / SYSTIMER_RATE) + +static inline unsigned long long tick_to_time(unsigned long long tick) +{ + do_div(tick, TICK_PER_TIME); + return tick; +} + +static inline unsigned long long time_to_tick(unsigned long long time) +{ + return time * TICK_PER_TIME; +} + +static inline unsigned long long us_to_tick(unsigned long long us) +{ + unsigned long long tick = us << 16; + tick += NS_PER_TICK - 1; + do_div(tick, NS_PER_TICK); + return tick >> 16; +} + +unsigned long long get_ticks(void) +{ + ulong now = ~readl(&systimer_base->timer0value); + + if (now >= lastinc) /* normal mode (non roll) */ + /* move stamp forward with absolut diff ticks */ + timestamp += (now - lastinc); + else /* we have rollover of incrementer */ + timestamp += (0xFFFFFFFF - lastinc) + now; + lastinc = now; + return timestamp; +} + +/* + * Delay x useconds AND preserve advance timstamp value + * assumes timer is ticking at 1 msec + */ +void __udelay(ulong usec) +{ + unsigned long long tmp; + ulong tmo; + + tmo = us_to_tick(usec); + tmp = get_ticks() + tmo; /* get current timestamp */ + + while (get_ticks() < tmp) /* loop till event */ + /*NOP*/; +} + +ulong get_timer(ulong base) +{ + return get_timer_masked() - base; +} + +void reset_timer_masked(void) +{ + lastinc = ~readl(&systimer_base->timer0value); + timestamp = 0; +} + +void reset_timer(void) +{ + reset_timer_masked(); +} + +ulong get_timer_masked(void) +{ + return tick_to_time(get_ticks()); +} + diff --git a/board/highbank/Makefile b/board/highbank/Makefile new file mode 100644 index 0000000..d5b8362 --- /dev/null +++ b/board/highbank/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := highbank.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +clean: + rm -f $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c new file mode 100644 index 0000000..bec3d2f --- /dev/null +++ b/board/highbank/highbank.c @@ -0,0 +1,58 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <ahci.h> +#include <scsi.h> + +#include <asm/sizes.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Miscellaneous platform dependent initialisations + */ +int board_init(void) +{ + icache_enable(); + + return 0; +} + +int misc_init_r(void) +{ + ahci_init(0xffe08000); + scsi_scan(1); + return 0; +} + +int dram_init(void) +{ + gd->ram_size = SZ_512M; + return 0; +} + +void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +void reset_cpu(ulong addr) +{ +} + diff --git a/boards.cfg b/boards.cfg index c31114d..dfa405e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -173,6 +173,7 @@ dkb arm arm926ejs - Marvell pantheon integratorap_cm946es arm arm946es integrator armltd - integratorap integratorcp_cm946es arm arm946es integrator armltd - integratorcp ca9x4_ct_vxp arm armv7 vexpress armltd +highbank arm armv7 highbank - highbank efikamx arm armv7 efikamx - mx5 efikamx:IMX_CONFIG=board/efikamx/imximage.cfg mx51evk arm armv7 mx51evk freescale mx5 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg mx53ard arm armv7 mx53ard freescale mx5 mx53ard:IMX_CONFIG=board/freescale/mx53ard/imximage_dd3.cfg diff --git a/include/configs/highbank.h b/include/configs/highbank.h new file mode 100644 index 0000000..9c85788 --- /dev/null +++ b/include/configs/highbank.h @@ -0,0 +1,113 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_L2_OFF + +#define CONFIG_SYS_NO_FLASH +#define CFG_HZ 1000 +#define CONFIG_SYS_HZ CFG_HZ + +#define CONFIG_OF_LIBFDT +#define CONFIG_FIT +#define CONFIG_SYS_BOOTMAPSZ (16 << 20) + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (512 * 1024) + +#define CONFIG_PL011_SERIAL +#define CONFIG_PL011_CLOCK 150000000 +#define CONFIG_PL01x_PORTS { (void *)(0xFFF36000) } +#define CONFIG_CONS_INDEX 0 + +#define CONFIG_BAUDRATE 38400 +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } + +#define CONFIG_MISC_INIT_R +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 5 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) + +#define CONFIG_DOS_PARTITION + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS + +#define CONFIG_CMD_BDI +#define CONFIG_CMD_ELF +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_LOADS +#define CONFIG_CMD_SCSI +#define CONFIG_CMD_EXT2 + +#define CONFIG_BOOTDELAY 2 +/* + * Miscellaneous configurable options + */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PROMPT "Highbank #" +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT)+16) + +#define CONFIG_SYS_LOAD_ADDR 0x800000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ +#endif + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1_SIZE (4089 << 20) +#define CONFIG_SYS_MEMTEST_START 0x100000 +#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1_SIZE - 0x100000) + +/* Room required on the stack for the environment data */ +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_TEXT_BASE 0x00001000 +#define CONFIG_SYS_INIT_SP_ADDR 0x01000000 +#define CONFIG_SKIP_LOWLEVEL_INIT + +#endif

Hi Rob,
Le 21/08/2011 15:16, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
This applies to u-boot-arm/master, with three empty lines at end of new files removed, but the compilation with ELDK 4.2 fails with:
uboot@lilith:~/src/u-boot-arm$ ./MAKEALL highbank Configuring for highbank board... include/common.h:0: error: bad value (armv7-a) for -march= switch include/common.h:0: error: bad value (armv7-a) for -march= switch lib/asm-offsets.c:1: error: bad value (armv7-a) for -march= switch make: *** [lib/asm-offsets.s] Erreur 1 arm-linux-size: './u-boot': No such file
--------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with warnings or errors: 1 ( highbank ) ----------------------------------------------------------
Seems like ELDK 4.2 does not know armv7-a. Is it a requirement that this board build with this march flag?
Amicalement,

On 08/21/2011 09:40 AM, Albert ARIBAUD wrote:
Hi Rob,
Le 21/08/2011 15:16, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
This applies to u-boot-arm/master, with three empty lines at end of new files removed, but the compilation with ELDK 4.2 fails with:
uboot@lilith:~/src/u-boot-arm$ ./MAKEALL highbank Configuring for highbank board... include/common.h:0: error: bad value (armv7-a) for -march= switch include/common.h:0: error: bad value (armv7-a) for -march= switch lib/asm-offsets.c:1: error: bad value (armv7-a) for -march= switch make: *** [lib/asm-offsets.s] Erreur 1 arm-linux-size: './u-boot': No such file
--------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with warnings or errors: 1 ( highbank )
Seems like ELDK 4.2 does not know armv7-a. Is it a requirement that this board build with this march flag?
With device tree, there are lots of endian conversions. With v7, those conversions are a single inline "rev" instruction vs. 10-20 assembly instructions. Since there is no state maintained in the fdt code, the conversions are done over and over.
So there's not a hard requirement, but it is something I will always set and I imagine others with v7 platforms will want to also. I think Tegra prevents doing this change globally.
Rob

Albert,
On 08/21/2011 02:28 PM, Rob Herring wrote:
On 08/21/2011 09:40 AM, Albert ARIBAUD wrote:
Hi Rob,
Le 21/08/2011 15:16, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
This applies to u-boot-arm/master, with three empty lines at end of new files removed, but the compilation with ELDK 4.2 fails with:
uboot@lilith:~/src/u-boot-arm$ ./MAKEALL highbank Configuring for highbank board... include/common.h:0: error: bad value (armv7-a) for -march= switch include/common.h:0: error: bad value (armv7-a) for -march= switch lib/asm-offsets.c:1: error: bad value (armv7-a) for -march= switch make: *** [lib/asm-offsets.s] Erreur 1 arm-linux-size: './u-boot': No such file
--------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with warnings or errors: 1 ( highbank )
Seems like ELDK 4.2 does not know armv7-a. Is it a requirement that this board build with this march flag?
With device tree, there are lots of endian conversions. With v7, those conversions are a single inline "rev" instruction vs. 10-20 assembly instructions. Since there is no state maintained in the fdt code, the conversions are done over and over.
So there's not a hard requirement, but it is something I will always set and I imagine others with v7 platforms will want to also. I think Tegra prevents doing this change globally.
What do you want to do here?
arch/arm/cpu/armv7/highbank/config.mk can simply be deleted if you don't want to compile with armv7-a.
Rob

Le 23/08/2011 16:32, Rob Herring a écrit :
Albert,
On 08/21/2011 02:28 PM, Rob Herring wrote:
On 08/21/2011 09:40 AM, Albert ARIBAUD wrote:
Hi Rob,
Le 21/08/2011 15:16, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
This applies to u-boot-arm/master, with three empty lines at end of new files removed, but the compilation with ELDK 4.2 fails with:
uboot@lilith:~/src/u-boot-arm$ ./MAKEALL highbank Configuring for highbank board... include/common.h:0: error: bad value (armv7-a) for -march= switch include/common.h:0: error: bad value (armv7-a) for -march= switch lib/asm-offsets.c:1: error: bad value (armv7-a) for -march= switch make: *** [lib/asm-offsets.s] Erreur 1 arm-linux-size: './u-boot': No such file
--------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with warnings or errors: 1 ( highbank )
Seems like ELDK 4.2 does not know armv7-a. Is it a requirement that this board build with this march flag?
With device tree, there are lots of endian conversions. With v7, those conversions are a single inline "rev" instruction vs. 10-20 assembly instructions. Since there is no state maintained in the fdt code, the conversions are done over and over.
So there's not a hard requirement, but it is something I will always set and I imagine others with v7 platforms will want to also. I think Tegra prevents doing this change globally.
What do you want to do here?
arch/arm/cpu/armv7/highbank/config.mk can simply be deleted if you don't want to compile with armv7-a.
Well, it is more a question of which toolchain(s) we want supported in U-Boot. Denx ELDK is one of them I guess :) but now that ELDK 5.0 is out, I don't know if ELDK 4.2 support is still required.
(I am assuming that ELDK5.0 has armv7-a support here. Please correct me if not)
If ELDK4.2 must be supported, then I would suggest creating a configuration option to allow the use of armv7-a ISA, then the arch/arm/cpu/armv7/highbank/config.mk file would select armv7-a ISA based on this option, and then any ARMv7 compatible board that needs or wants to use this ISA can set this config option in its config header file.
If ELDK4.2 support is dropped (at least partially) then no change would be needed.
Wolfgang:, I think that toolchain support for ARM is more your choice than mine.
Rob
Amicalement,

Le 24/08/2011 10:37, Albert ARIBAUD a écrit :
Le 23/08/2011 16:32, Rob Herring a écrit :
Albert,
On 08/21/2011 02:28 PM, Rob Herring wrote:
On 08/21/2011 09:40 AM, Albert ARIBAUD wrote:
Hi Rob,
Le 21/08/2011 15:16, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
This applies to u-boot-arm/master, with three empty lines at end of new files removed, but the compilation with ELDK 4.2 fails with:
uboot@lilith:~/src/u-boot-arm$ ./MAKEALL highbank Configuring for highbank board... include/common.h:0: error: bad value (armv7-a) for -march= switch include/common.h:0: error: bad value (armv7-a) for -march= switch lib/asm-offsets.c:1: error: bad value (armv7-a) for -march= switch make: *** [lib/asm-offsets.s] Erreur 1 arm-linux-size: './u-boot': No such file
--------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with warnings or errors: 1 ( highbank )
Seems like ELDK 4.2 does not know armv7-a. Is it a requirement that this board build with this march flag?
With device tree, there are lots of endian conversions. With v7, those conversions are a single inline "rev" instruction vs. 10-20 assembly instructions. Since there is no state maintained in the fdt code, the conversions are done over and over.
So there's not a hard requirement, but it is something I will always set and I imagine others with v7 platforms will want to also. I think Tegra prevents doing this change globally.
What do you want to do here?
arch/arm/cpu/armv7/highbank/config.mk can simply be deleted if you don't want to compile with armv7-a.
Well, it is more a question of which toolchain(s) we want supported in U-Boot. Denx ELDK is one of them I guess :) but now that ELDK 5.0 is out, I don't know if ELDK 4.2 support is still required.
(I am assuming that ELDK5.0 has armv7-a support here. Please correct me if not)
If ELDK4.2 must be supported, then I would suggest creating a configuration option to allow the use of armv7-a ISA, then the arch/arm/cpu/armv7/highbank/config.mk file would select armv7-a ISA based on this option, and then any ARMv7 compatible board that needs or wants to use this ISA can set this config option in its config header file.
If ELDK4.2 support is dropped (at least partially) then no change would be needed.
... adding Wolfgang, this time...
Wolfgang:, I think that toolchain support for ARM is more your choice than mine.
Rob
Amicalement,
Amicalement,

Dear Albert ARIBAUD,
In message 4E54B862.2070000@aribaud.net you wrote:
Well, it is more a question of which toolchain(s) we want supported in U-Boot. Denx ELDK is one of them I guess :) but now that ELDK 5.0 is out, I don't know if ELDK 4.2 support is still required.
It seems reasonable to support any gcc 4.x configuration.
If ELDK4.2 must be supported, then I would suggest creating a configuration option to allow the use of armv7-a ISA, then the arch/arm/cpu/armv7/highbank/config.mk file would select armv7-a ISA
I don't tink I want to accept a board specific config.mk for such apurpose. We want to get rid of thse config.mk files. Either ARMv7 based boards all need this option, or they all don;t need it. Thisis NOT a board specific feature.
If ELDK4.2 support is dropped (at least partially) then no change would be needed.
Wolfgang:, I think that toolchain support for ARM is more your choice than mine.
See above - I see no reason why we should abandon ELDK 4.2 when adding a new board - when all other boards with similar CPUs work just fine.
Best regards,
Wolfgang Denk

From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net --- changes in v6: - Remove arch/arm/cpu/armv7/highbank/config.mk - Fix some whitespace errors (blank lines at EOF)
changes in v5: - Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4: - Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018) - Add back SATA support to inital patch as dependencies are all in mainline
changes in v3: - Add hignbank to MAINTAINERS
changes in v2: - Set DRAM size to correct value - split SATA and SD enabling to separate patches
MAINTAINERS | 4 + arch/arm/cpu/armv7/highbank/Makefile | 46 +++++++++++++ arch/arm/cpu/armv7/highbank/timer.c | 123 ++++++++++++++++++++++++++++++++++ board/highbank/Makefile | 49 +++++++++++++ board/highbank/highbank.c | 57 ++++++++++++++++ boards.cfg | 1 + include/configs/highbank.h | 113 +++++++++++++++++++++++++++++++ 7 files changed, 393 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h
diff --git a/MAINTAINERS b/MAINTAINERS index f895e9a..c383f6d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -219,6 +219,10 @@ Wolfgang Grandegger wg@denx.de IPHASE4539 MPC8260 SCM MPC8260
+Rob Herring rob.herring@calxeda.com + + highbank highbank + Klaus Heydeck heydeck@kieback-peter.de
KUP4K MPC855 diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile new file mode 100644 index 0000000..76faeb0 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +COBJS := timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c new file mode 100644 index 0000000..d8a0288 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -0,0 +1,123 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * Based on arm926ejs/mx27/timer.c + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <div64.h> +#include <linux/types.h> /* for size_t */ +#include <linux/stddef.h> /* for NULL */ +#include <asm/io.h> +#include <asm/arch-armv7/systimer.h> + +#undef SYSTIMER_BASE +#define SYSTIMER_BASE 0xFFF34000 /* Timer 0 and 1 base */ +#define SYSTIMER_RATE 150000000 + +static ulong timestamp; +static ulong lastinc; +static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE; + +/* + * Start the timer + */ +int timer_init(void) +{ + /* + * Setup timer0 + */ + writel(SYSTIMER_RELOAD, &systimer_base->timer0load); + writel(SYSTIMER_RELOAD, &systimer_base->timer0value); + writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control); + + reset_timer_masked(); + + return 0; + +} + +#define TICK_PER_TIME ((SYSTIMER_RATE + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define NS_PER_TICK (1000000000 / SYSTIMER_RATE) + +static inline unsigned long long tick_to_time(unsigned long long tick) +{ + do_div(tick, TICK_PER_TIME); + return tick; +} + +static inline unsigned long long time_to_tick(unsigned long long time) +{ + return time * TICK_PER_TIME; +} + +static inline unsigned long long us_to_tick(unsigned long long us) +{ + unsigned long long tick = us << 16; + tick += NS_PER_TICK - 1; + do_div(tick, NS_PER_TICK); + return tick >> 16; +} + +unsigned long long get_ticks(void) +{ + ulong now = ~readl(&systimer_base->timer0value); + + if (now >= lastinc) /* normal mode (non roll) */ + /* move stamp forward with absolut diff ticks */ + timestamp += (now - lastinc); + else /* we have rollover of incrementer */ + timestamp += (0xFFFFFFFF - lastinc) + now; + lastinc = now; + return timestamp; +} + +/* + * Delay x useconds AND preserve advance timstamp value + * assumes timer is ticking at 1 msec + */ +void __udelay(ulong usec) +{ + unsigned long long tmp; + ulong tmo; + + tmo = us_to_tick(usec); + tmp = get_ticks() + tmo; /* get current timestamp */ + + while (get_ticks() < tmp) /* loop till event */ + /*NOP*/; +} + +ulong get_timer(ulong base) +{ + return get_timer_masked() - base; +} + +void reset_timer_masked(void) +{ + lastinc = ~readl(&systimer_base->timer0value); + timestamp = 0; +} + +void reset_timer(void) +{ + reset_timer_masked(); +} + +ulong get_timer_masked(void) +{ + return tick_to_time(get_ticks()); +} diff --git a/board/highbank/Makefile b/board/highbank/Makefile new file mode 100644 index 0000000..d5b8362 --- /dev/null +++ b/board/highbank/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := highbank.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +clean: + rm -f $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c new file mode 100644 index 0000000..8db8a2b --- /dev/null +++ b/board/highbank/highbank.c @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <ahci.h> +#include <scsi.h> + +#include <asm/sizes.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Miscellaneous platform dependent initialisations + */ +int board_init(void) +{ + icache_enable(); + + return 0; +} + +int misc_init_r(void) +{ + ahci_init(0xffe08000); + scsi_scan(1); + return 0; +} + +int dram_init(void) +{ + gd->ram_size = SZ_512M; + return 0; +} + +void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +void reset_cpu(ulong addr) +{ +} diff --git a/boards.cfg b/boards.cfg index c31114d..dfa405e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -173,6 +173,7 @@ dkb arm arm926ejs - Marvell pantheon integratorap_cm946es arm arm946es integrator armltd - integratorap integratorcp_cm946es arm arm946es integrator armltd - integratorcp ca9x4_ct_vxp arm armv7 vexpress armltd +highbank arm armv7 highbank - highbank efikamx arm armv7 efikamx - mx5 efikamx:IMX_CONFIG=board/efikamx/imximage.cfg mx51evk arm armv7 mx51evk freescale mx5 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg mx53ard arm armv7 mx53ard freescale mx5 mx53ard:IMX_CONFIG=board/freescale/mx53ard/imximage_dd3.cfg diff --git a/include/configs/highbank.h b/include/configs/highbank.h new file mode 100644 index 0000000..9c85788 --- /dev/null +++ b/include/configs/highbank.h @@ -0,0 +1,113 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_L2_OFF + +#define CONFIG_SYS_NO_FLASH +#define CFG_HZ 1000 +#define CONFIG_SYS_HZ CFG_HZ + +#define CONFIG_OF_LIBFDT +#define CONFIG_FIT +#define CONFIG_SYS_BOOTMAPSZ (16 << 20) + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (512 * 1024) + +#define CONFIG_PL011_SERIAL +#define CONFIG_PL011_CLOCK 150000000 +#define CONFIG_PL01x_PORTS { (void *)(0xFFF36000) } +#define CONFIG_CONS_INDEX 0 + +#define CONFIG_BAUDRATE 38400 +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } + +#define CONFIG_MISC_INIT_R +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 5 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) + +#define CONFIG_DOS_PARTITION + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS + +#define CONFIG_CMD_BDI +#define CONFIG_CMD_ELF +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_LOADS +#define CONFIG_CMD_SCSI +#define CONFIG_CMD_EXT2 + +#define CONFIG_BOOTDELAY 2 +/* + * Miscellaneous configurable options + */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PROMPT "Highbank #" +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT)+16) + +#define CONFIG_SYS_LOAD_ADDR 0x800000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ +#endif + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1_SIZE (4089 << 20) +#define CONFIG_SYS_MEMTEST_START 0x100000 +#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1_SIZE - 0x100000) + +/* Room required on the stack for the environment data */ +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_TEXT_BASE 0x00001000 +#define CONFIG_SYS_INIT_SP_ADDR 0x01000000 +#define CONFIG_SKIP_LOWLEVEL_INIT + +#endif

Dear Rob Herring,
In message 1314193751-6097-1-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net
changes in v6:
- Remove arch/arm/cpu/armv7/highbank/config.mk
- Fix some whitespace errors (blank lines at EOF)
changes in v5:
- Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4:
- Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018)
- Add back SATA support to inital patch as dependencies are all in mainline
changes in v3:
- Add hignbank to MAINTAINERS
changes in v2:
- Set DRAM size to correct value
- split SATA and SD enabling to separate patches
Which patch version is this, then? The Subject does not mention anything...
Best regards,
Wolfgang Denk

On 08/24/2011 10:06 AM, Wolfgang Denk wrote:
Dear Rob Herring,
In message 1314193751-6097-1-git-send-email-robherring2@gmail.com you wrote:
From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net
changes in v6:
- Remove arch/arm/cpu/armv7/highbank/config.mk
- Fix some whitespace errors (blank lines at EOF)
changes in v5:
- Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4:
- Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018)
- Add back SATA support to inital patch as dependencies are all in mainline
changes in v3:
- Add hignbank to MAINTAINERS
changes in v2:
- Set DRAM size to correct value
- split SATA and SD enabling to separate patches
Which patch version is this, then? The Subject does not mention anything...
Sorry, it's v6 as the change log says. I forgot to fix the subject.
Rob

Albert,
On 08/24/2011 08:49 AM, Rob Herring wrote:
From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net
changes in v6:
- Remove arch/arm/cpu/armv7/highbank/config.mk
- Fix some whitespace errors (blank lines at EOF)
changes in v5:
- Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4:
- Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018)
- Add back SATA support to inital patch as dependencies are all in mainline
changes in v3:
- Add hignbank to MAINTAINERS
changes in v2:
- Set DRAM size to correct value
- split SATA and SD enabling to separate patches
Can you please merge this.
Regards, Rob

Hi Rob,
Le 04/10/2011 17:30, Rob Herring a écrit :
Albert,
On 08/24/2011 08:49 AM, Rob Herring wrote:
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
changes in v6:
- Remove arch/arm/cpu/armv7/highbank/config.mk
- Fix some whitespace errors (blank lines at EOF)
changes in v5:
- Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4:
- Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018)
- Add back SATA support to inital patch as dependencies are all in mainline
changes in v3:
- Add hignbank to MAINTAINERS
changes in v2:
- Set DRAM size to correct value
- split SATA and SD enabling to separate patches
Can you please merge this.
This does not apply on current u-boot-arm/master. Please rebase and submit -- and make sure you put "V7" in the subject tag. :)
Regards, Rob
Amicalement,

From: Rob Herring rob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbs jason.hobbs@calxeda.com Signed-off-by: Rob Herring rob.herring@calxeda.com Cc: Albert ARIBAUD albert.u.boot@aribaud.net ---
changes in v7: - Rebase to current master (4962e38 mkimage: adding support for Davinci AIS image)
changes in v6: - Remove arch/arm/cpu/armv7/highbank/config.mk - Fix some whitespace errors (blank lines at EOF)
changes in v5: - Rebase to current u-boot-arm/master (5557e86bb0793012057d5462976c2a902bc629ac)
changes in v4: - Rebase to current mainline (d50a8f45c9a640b3bcbd0ede91f83c8646cca018) - Add back SATA support to inital patch as dependencies are all in mainline
changes in v3: - Add hignbank to MAINTAINERS
changes in v2: - Set DRAM size to correct value - split SATA and SD enabling to separate patches
MAINTAINERS | 4 + arch/arm/cpu/armv7/highbank/Makefile | 46 +++++++++++++ arch/arm/cpu/armv7/highbank/timer.c | 123 ++++++++++++++++++++++++++++++++++ board/highbank/Makefile | 49 +++++++++++++ board/highbank/highbank.c | 57 ++++++++++++++++ boards.cfg | 1 + include/configs/highbank.h | 113 +++++++++++++++++++++++++++++++ 7 files changed, 393 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/highbank/Makefile create mode 100644 arch/arm/cpu/armv7/highbank/timer.c create mode 100644 board/highbank/Makefile create mode 100644 board/highbank/highbank.c create mode 100644 include/configs/highbank.h
diff --git a/MAINTAINERS b/MAINTAINERS index f5168b0..a8b066e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -215,6 +215,10 @@ Wolfgang Grandegger wg@denx.de IPHASE4539 MPC8260 SCM MPC8260
+Rob Herring rob.herring@calxeda.com + + highbank highbank + Klaus Heydeck heydeck@kieback-peter.de
KUP4K MPC855 diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile new file mode 100644 index 0000000..76faeb0 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +COBJS := timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c new file mode 100644 index 0000000..d8a0288 --- /dev/null +++ b/arch/arm/cpu/armv7/highbank/timer.c @@ -0,0 +1,123 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * Based on arm926ejs/mx27/timer.c + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <div64.h> +#include <linux/types.h> /* for size_t */ +#include <linux/stddef.h> /* for NULL */ +#include <asm/io.h> +#include <asm/arch-armv7/systimer.h> + +#undef SYSTIMER_BASE +#define SYSTIMER_BASE 0xFFF34000 /* Timer 0 and 1 base */ +#define SYSTIMER_RATE 150000000 + +static ulong timestamp; +static ulong lastinc; +static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE; + +/* + * Start the timer + */ +int timer_init(void) +{ + /* + * Setup timer0 + */ + writel(SYSTIMER_RELOAD, &systimer_base->timer0load); + writel(SYSTIMER_RELOAD, &systimer_base->timer0value); + writel(SYSTIMER_EN | SYSTIMER_32BIT, &systimer_base->timer0control); + + reset_timer_masked(); + + return 0; + +} + +#define TICK_PER_TIME ((SYSTIMER_RATE + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define NS_PER_TICK (1000000000 / SYSTIMER_RATE) + +static inline unsigned long long tick_to_time(unsigned long long tick) +{ + do_div(tick, TICK_PER_TIME); + return tick; +} + +static inline unsigned long long time_to_tick(unsigned long long time) +{ + return time * TICK_PER_TIME; +} + +static inline unsigned long long us_to_tick(unsigned long long us) +{ + unsigned long long tick = us << 16; + tick += NS_PER_TICK - 1; + do_div(tick, NS_PER_TICK); + return tick >> 16; +} + +unsigned long long get_ticks(void) +{ + ulong now = ~readl(&systimer_base->timer0value); + + if (now >= lastinc) /* normal mode (non roll) */ + /* move stamp forward with absolut diff ticks */ + timestamp += (now - lastinc); + else /* we have rollover of incrementer */ + timestamp += (0xFFFFFFFF - lastinc) + now; + lastinc = now; + return timestamp; +} + +/* + * Delay x useconds AND preserve advance timstamp value + * assumes timer is ticking at 1 msec + */ +void __udelay(ulong usec) +{ + unsigned long long tmp; + ulong tmo; + + tmo = us_to_tick(usec); + tmp = get_ticks() + tmo; /* get current timestamp */ + + while (get_ticks() < tmp) /* loop till event */ + /*NOP*/; +} + +ulong get_timer(ulong base) +{ + return get_timer_masked() - base; +} + +void reset_timer_masked(void) +{ + lastinc = ~readl(&systimer_base->timer0value); + timestamp = 0; +} + +void reset_timer(void) +{ + reset_timer_masked(); +} + +ulong get_timer_masked(void) +{ + return tick_to_time(get_ticks()); +} diff --git a/board/highbank/Makefile b/board/highbank/Makefile new file mode 100644 index 0000000..d5b8362 --- /dev/null +++ b/board/highbank/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# 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., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := highbank.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +clean: + rm -f $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c new file mode 100644 index 0000000..8db8a2b --- /dev/null +++ b/board/highbank/highbank.c @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#include <common.h> +#include <ahci.h> +#include <scsi.h> + +#include <asm/sizes.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Miscellaneous platform dependent initialisations + */ +int board_init(void) +{ + icache_enable(); + + return 0; +} + +int misc_init_r(void) +{ + ahci_init(0xffe08000); + scsi_scan(1); + return 0; +} + +int dram_init(void) +{ + gd->ram_size = SZ_512M; + return 0; +} + +void dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +void reset_cpu(ulong addr) +{ +} diff --git a/boards.cfg b/boards.cfg index bccb832..cac55fb 100644 --- a/boards.cfg +++ b/boards.cfg @@ -161,6 +161,7 @@ dkb arm arm926ejs - Marvell pantheon integratorap_cm946es arm arm946es integrator armltd - integratorap integratorcp_cm946es arm arm946es integrator armltd - integratorcp ca9x4_ct_vxp arm armv7 vexpress armltd +highbank arm armv7 highbank - highbank efikamx arm armv7 efikamx - mx5 efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/efikamx/imximage_mx.cfg efikasb arm armv7 efikamx - mx5 efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/efikamx/imximage_sb.cfg mx51evk arm armv7 mx51evk freescale mx5 mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg diff --git a/include/configs/highbank.h b/include/configs/highbank.h new file mode 100644 index 0000000..9c85788 --- /dev/null +++ b/include/configs/highbank.h @@ -0,0 +1,113 @@ +/* + * Copyright 2010-2011 Calxeda, Inc. + * + * 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 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, see http://www.gnu.org/licenses/. + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_L2_OFF + +#define CONFIG_SYS_NO_FLASH +#define CFG_HZ 1000 +#define CONFIG_SYS_HZ CFG_HZ + +#define CONFIG_OF_LIBFDT +#define CONFIG_FIT +#define CONFIG_SYS_BOOTMAPSZ (16 << 20) + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (512 * 1024) + +#define CONFIG_PL011_SERIAL +#define CONFIG_PL011_CLOCK 150000000 +#define CONFIG_PL01x_PORTS { (void *)(0xFFF36000) } +#define CONFIG_CONS_INDEX 0 + +#define CONFIG_BAUDRATE 38400 +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } + +#define CONFIG_MISC_INIT_R +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 5 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) + +#define CONFIG_DOS_PARTITION + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS + +#define CONFIG_CMD_BDI +#define CONFIG_CMD_ELF +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_LOADS +#define CONFIG_CMD_SCSI +#define CONFIG_CMD_EXT2 + +#define CONFIG_BOOTDELAY 2 +/* + * Miscellaneous configurable options + */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PROMPT "Highbank #" +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT)+16) + +#define CONFIG_SYS_LOAD_ADDR 0x800000 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128*1024) /* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ +#endif + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1_SIZE (4089 << 20) +#define CONFIG_SYS_MEMTEST_START 0x100000 +#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1_SIZE - 0x100000) + +/* Room required on the stack for the environment data */ +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_IS_NOWHERE + +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_TEXT_BASE 0x00001000 +#define CONFIG_SYS_INIT_SP_ADDR 0x01000000 +#define CONFIG_SKIP_LOWLEVEL_INIT + +#endif

Hi Rob,
Le 24/10/2011 20:50, Rob Herring a écrit :
From: Rob Herringrob.herring@calxeda.com
Add basic support for Calxeda Highbank platform. Only minimal support with serial and SATA are included.
Signed-off-by: Jason Hobbsjason.hobbs@calxeda.com Signed-off-by: Rob Herringrob.herring@calxeda.com Cc: Albert ARIBAUDalbert.u.boot@aribaud.net
changes in v7:
- Rebase to current master (4962e38 mkimage: adding support for Davinci AIS image)
Applied to u-boot-arm/master (with manual adjustment to boards.cfg), thanks.
Amicalement,
participants (5)
-
Albert ARIBAUD
-
Aneesh V
-
Rob Herring
-
Rob Herring
-
Wolfgang Denk