* [U-Boot] [PATCH 1/5] ARM: Add Calxeda Highbank platform
2011-06-21 21:33 [U-Boot] [PATCH v3 0/5] Add Highbank platform Rob Herring
@ 2011-06-21 21:33 ` Rob Herring
2011-06-21 22:22 ` Fabio Estevam
2011-06-21 21:33 ` [U-Boot] [PATCH 2/5] arm: add __ilog2 function Rob Herring
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2011-06-21 21:33 UTC (permalink / raw)
To: u-boot
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>
---
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 +++++++++++++++++++++++++++
7 files changed, 374 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/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 at 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 at 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 d2cacc8..7395d9c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -126,6 +126,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
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [PATCH 1/5] ARM: Add Calxeda Highbank platform
2011-06-21 21:33 ` [U-Boot] [PATCH 1/5] ARM: Add Calxeda " Rob Herring
@ 2011-06-21 22:22 ` Fabio Estevam
2011-06-21 22:32 ` Rob Herring
0 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2011-06-21 22:22 UTC (permalink / raw)
To: u-boot
On Tue, Jun 21, 2011 at 6:33 PM, Rob Herring <robherring2@gmail.com> wrote:
> 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>
> ---
> ?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 +++++++++++++++++++++++++++
You should add an entry to MAINTAINERS file.
...
> +int dram_init(void)
> +{
> + ? ? ? gd->ram_size = SZ_512M;
You could use
gd->ram_size = get_ram_size((volatile void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 10+ messages in thread* [U-Boot] [PATCH 1/5] ARM: Add Calxeda Highbank platform
2011-06-21 22:22 ` Fabio Estevam
@ 2011-06-21 22:32 ` Rob Herring
0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-06-21 22:32 UTC (permalink / raw)
To: u-boot
On 06/21/2011 05:22 PM, Fabio Estevam wrote:
> On Tue, Jun 21, 2011 at 6:33 PM, Rob Herring <robherring2@gmail.com> wrote:
>> 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>
>> ---
>> 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 +++++++++++++++++++++++++++
>
> You should add an entry to MAINTAINERS file.
> ...
>
>> +int dram_init(void)
>> +{
>> + gd->ram_size = SZ_512M;
>
> You could use
> gd->ram_size = get_ram_size((volatile void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
Except that does not work on qemu, and qemu can't model all of ram. So I
need to limit the ram size, but have the same image work on h/w and qemu.
Rob
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 2/5] arm: add __ilog2 function
2011-06-21 21:33 [U-Boot] [PATCH v3 0/5] Add Highbank platform Rob Herring
2011-06-21 21:33 ` [U-Boot] [PATCH 1/5] ARM: Add Calxeda " Rob Herring
@ 2011-06-21 21:33 ` Rob Herring
2011-06-21 21:33 ` [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix Rob Herring
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-06-21 21:33 UTC (permalink / raw)
To: u-boot
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..
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix
2011-06-21 21:33 [U-Boot] [PATCH v3 0/5] Add Highbank platform Rob Herring
2011-06-21 21:33 ` [U-Boot] [PATCH 1/5] ARM: Add Calxeda " Rob Herring
2011-06-21 21:33 ` [U-Boot] [PATCH 2/5] arm: add __ilog2 function Rob Herring
@ 2011-06-21 21:33 ` Rob Herring
2011-07-25 22:06 ` Wolfgang Denk
[not found] ` <CANy1buLpmSEpQfA_z_xyQmfitXws-+qiHaW0kW4frVqud2f6Ag@mail.gmail.com>
2011-06-21 21:33 ` [U-Boot] [PATCH 4/5] scsi/ahci: add support for non-PCI controllers Rob Herring
2011-06-21 21:33 ` [U-Boot] [PATCH 5/5] ARM: highbank: Add AHCI support Rob Herring
4 siblings, 2 replies; 10+ messages in thread
From: Rob Herring @ 2011-06-21 21:33 UTC (permalink / raw)
To: u-boot
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;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix
2011-06-21 21:33 ` [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix Rob Herring
@ 2011-07-25 22:06 ` Wolfgang Denk
[not found] ` <CANy1buLpmSEpQfA_z_xyQmfitXws-+qiHaW0kW4frVqud2f6Ag@mail.gmail.com>
1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2011-07-25 22:06 UTC (permalink / raw)
To: u-boot
Dear Rob Herring,
In message <1308692003-2488-4-git-send-email-robherring2@gmail.com> you wrote:
> 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(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You go slow, be gentle. It's no one-way street -- you know how you
feel and that's all. It's how the girl feels too. Don't press. If the
girl feels anything for you at all, you'll know.
-- Kirk, "Charlie X", stardate 1535.8
^ permalink raw reply [flat|nested] 10+ messages in thread[parent not found: <CANy1buLpmSEpQfA_z_xyQmfitXws-+qiHaW0kW4frVqud2f6Ag@mail.gmail.com>]
* [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix
[not found] ` <CANy1buLpmSEpQfA_z_xyQmfitXws-+qiHaW0kW4frVqud2f6Ag@mail.gmail.com>
@ 2011-09-06 19:16 ` Vadim Bendebury (вб)
0 siblings, 0 replies; 10+ messages in thread
From: Vadim Bendebury (вб) @ 2011-09-06 19:16 UTC (permalink / raw)
To: u-boot
On Tue, Sep 6, 2011 at 12:07 PM, <vb@vsbe.com> wrote:
> ---------- Forwarded message ----------
> From: Rob Herring <robherring2@gmail.com>
> Date: Tue, Jun 21, 2011 at 2:33 PM
> Subject: [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix
> To: u-boot at lists.denx.de
> Cc: Rob Herring <rob.herring@calxeda.com>
>
>
> 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;
> }
>
> --
> 1.7.4.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
>
guys, I am looking into enabling the AHCI driver on the x86 platforms
(working off an older version of drivers/block/ahci.c, but planning to
reconcile).
One of my internal reviewers brought this up (and it seems quite a
reasonable question): why does one need to swap bytes always, no matter the
CPU endianness?
Also, can you please comment on what is going on in ata_scsiop_inquiry(),
in particular, what are the contents of the hdr[] array? Any hints would be
highly appreciated,
cheers,
/vb
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 4/5] scsi/ahci: add support for non-PCI controllers
2011-06-21 21:33 [U-Boot] [PATCH v3 0/5] Add Highbank platform Rob Herring
` (2 preceding siblings ...)
2011-06-21 21:33 ` [U-Boot] [PATCH 3/5] scsi/ahci: ata id little endian fix Rob Herring
@ 2011-06-21 21:33 ` Rob Herring
2011-06-21 21:33 ` [U-Boot] [PATCH 5/5] ARM: highbank: Add AHCI support Rob Herring
4 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-06-21 21:33 UTC (permalink / raw)
To: u-boot
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 */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [U-Boot] [PATCH 5/5] ARM: highbank: Add AHCI support
2011-06-21 21:33 [U-Boot] [PATCH v3 0/5] Add Highbank platform Rob Herring
` (3 preceding siblings ...)
2011-06-21 21:33 ` [U-Boot] [PATCH 4/5] scsi/ahci: add support for non-PCI controllers Rob Herring
@ 2011-06-21 21:33 ` Rob Herring
4 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-06-21 21:33 UTC (permalink / raw)
To: u-boot
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
/*
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread