* [PATCH 0/3] vexpress: detect the mapping based on the amba devices
@ 2013-02-12 13:00 Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 1/3] amba: introduce amba_device_get_pid/cid Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-12 13:00 UTC (permalink / raw)
To: barebox
HI,
so we can run on a9 on the non legacy hw
The following changes since commit 2d91386102612773074832d55e2ef11702fbb432:
arm: add vexpress board support (2013-02-12 05:53:04 +0800)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/vexpress
for you to fetch changes up to 92b8828ad6b2b01248bd84888b8bbf920df85c31:
vexpress: detect the board periph mapping and detecting the sp804 mapping (2013-02-12 05:53:04 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
amba: introduce amba_device_get_pid/cid
sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address
vexpress: detect the board periph mapping and detecting the sp804 mapping
arch/arm/boards/vexpress/init.c | 35 +++++++++++++++++++----------------
arch/arm/boards/vexpress/lowlevel.c | 4 +++-
arch/arm/mach-vexpress/devices.c | 4 ++--
arch/arm/mach-vexpress/include/mach/devices.h | 6 +++---
arch/arm/mach-vexpress/v2m.c | 2 +-
drivers/amba/bus.c | 10 +++-------
drivers/clocksource/amba-sp804.c | 6 +++---
include/linux/amba/bus.h | 28 ++++++++++++++++++++++++++++
include/linux/amba/sp804.h | 30 ++++++++++++++++++++++++++++++
9 files changed, 92 insertions(+), 33 deletions(-)
create mode 100644 include/linux/amba/sp804.h
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] amba: introduce amba_device_get_pid/cid
2013-02-12 13:00 [PATCH 0/3] vexpress: detect the mapping based on the amba devices Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-12 13:03 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 2/3] sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 3/3] vexpress: detect the board periph mapping and detecting the sp804 mapping Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-12 13:03 UTC (permalink / raw)
To: barebox
so we can use it on vexpress to detect the hardware mapping
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/amba/bus.c | 10 +++-------
include/linux/amba/bus.h | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index d1ab53c..65385be 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -104,7 +104,7 @@ int amba_device_add(struct amba_device *dev)
{
u32 size;
void __iomem *tmp;
- int i, ret;
+ int ret;
struct resource *res = NULL;
dev->dev.bus = &amba_bustype;
@@ -135,12 +135,8 @@ int amba_device_add(struct amba_device *dev)
* Read pid and cid based on size of resource
* they are located at end of region
*/
- for (pid = 0, i = 0; i < 4; i++)
- pid |= (readl(tmp + size - 0x20 + 4 * i) & 255) <<
- (i * 8);
- for (cid = 0, i = 0; i < 4; i++)
- cid |= (readl(tmp + size - 0x10 + 4 * i) & 255) <<
- (i * 8);
+ pid = amba_device_get_pid(tmp, size);
+ cid = amba_device_get_cid(tmp, size);
if (cid == AMBA_CID)
dev->periphid = pid;
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index cb3e3bd..a7bbae0 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -150,4 +150,32 @@ struct amba_device name##_device = { \
.periphid = id, \
}
+#include <io.h>
+/*
+ * Read pid and cid based on size of resource
+ * they are located at end of region
+ */
+static inline u32 amba_device_get_pid(void *base, u32 size)
+{
+ int i;
+ u32 pid;
+
+ for (pid = 0, i = 0; i < 4; i++)
+ pid |= (readl(base + size - 0x20 + 4 * i) & 255) <<
+ (i * 8);
+
+ return pid;
+}
+
+static inline u32 amba_device_get_cid(void *base, u32 size)
+{
+ int i;
+ u32 cid;
+
+ for (cid = 0, i = 0; i < 4; i++)
+ cid |= (readl(base + size - 0x10 + 4 * i) & 255) <<
+ (i * 8);
+
+ return cid;
+}
#endif
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address
2013-02-12 13:03 ` [PATCH 1/3] amba: introduce amba_device_get_pid/cid Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-12 13:03 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 3/3] vexpress: detect the board periph mapping and detecting the sp804 mapping Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-12 13:03 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/clocksource/amba-sp804.c | 6 +++---
include/linux/amba/sp804.h | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 3 deletions(-)
create mode 100644 include/linux/amba/sp804.h
diff --git a/drivers/clocksource/amba-sp804.c b/drivers/clocksource/amba-sp804.c
index d9a30c2..fedcb64 100644
--- a/drivers/clocksource/amba-sp804.c
+++ b/drivers/clocksource/amba-sp804.c
@@ -9,7 +9,7 @@
#include <io.h>
#include <driver.h>
#include <errno.h>
-#include <linux/amba/bus.h>
+#include <linux/amba/sp804.h>
#include <linux/clk.h>
#include <linux/err.h>
@@ -73,8 +73,8 @@ static int sp804_probe(struct amba_device *dev, const struct amba_id *id)
static struct amba_id sp804_ids[] = {
{
- .id = 0x00141804,
- .mask = 0x00ffffff,
+ .id = AMBA_ARM_SP804_ID,
+ .mask = AMBA_ARM_SP804_ID_MASK,
},
{ 0, 0 },
};
diff --git a/include/linux/amba/sp804.h b/include/linux/amba/sp804.h
new file mode 100644
index 0000000..aba550c
--- /dev/null
+++ b/include/linux/amba/sp804.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
+ *
+ * GPLv2 only
+ */
+
+#ifndef __AMBA_SP804_H__
+#define __AMBA_SP804_H__
+
+#include <linux/amba/bus.h>
+#include <sizes.h>
+
+#define AMBA_ARM_SP804_ID 0x00141804
+#define AMBA_ARM_SP804_ID_MASK 0x00ffffff
+
+static inline bool amba_is_arm_sp804(void __iomem *base)
+{
+ u32 pid, cid;
+ u32 size = SZ_4K;
+
+ cid = amba_device_get_cid(base, size);
+
+ if (cid != AMBA_CID)
+ return false;
+
+ pid = amba_device_get_pid(base, size);
+
+ return (pid & AMBA_ARM_SP804_ID_MASK) == AMBA_ARM_SP804_ID;
+}
+#endif /* __AMBA_SP804_H__ */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] vexpress: detect the board periph mapping and detecting the sp804 mapping
2013-02-12 13:03 ` [PATCH 1/3] amba: introduce amba_device_get_pid/cid Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 2/3] sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-12 13:03 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-12 13:03 UTC (permalink / raw)
To: barebox
at 0x10011000 for a9 legacy otherwise at 0x1c110000
as the new board also support Cortex-A9
so this is working
qemu/arm-softmmu/qemu-system-arm -M vexpress-a15 -m 1024 -smp 1 -kernel build/vexpress/barebox -pflash build/vexpress/flash -nographic -cpu cortex-a9
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/vexpress/init.c | 35 ++++++++++++++-----------
arch/arm/boards/vexpress/lowlevel.c | 4 ++-
arch/arm/mach-vexpress/devices.c | 4 +--
arch/arm/mach-vexpress/include/mach/devices.h | 6 ++---
arch/arm/mach-vexpress/v2m.c | 2 +-
5 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/arch/arm/boards/vexpress/init.c b/arch/arm/boards/vexpress/init.c
index f940824..2b2d085 100644
--- a/arch/arm/boards/vexpress/init.c
+++ b/arch/arm/boards/vexpress/init.c
@@ -15,6 +15,7 @@
#include <sizes.h>
#include <io.h>
#include <globalvar.h>
+#include <linux/amba/sp804.h>
struct vexpress_init {
void (*core_init)(void);
@@ -57,12 +58,12 @@ struct vexpress_init vexpress_init_ax = {
.devices_init = vexpress_ax_devices_init,
};
-static void vexpress_a9_mem_init(void)
+static void vexpress_a9_legacy_mem_init(void)
{
- vexpress_a9_add_ddram(SZ_512M, SZ_512M);
+ vexpress_a9_legacy_add_ddram(SZ_512M, SZ_512M);
}
-static void vexpress_a9_devices_init(void)
+static void vexpress_a9_legacy_devices_init(void)
{
add_cfi_flash_device(0, 0x40000000, SZ_64M, 0);
add_cfi_flash_device(1, 0x44000000, SZ_64M, 0);
@@ -73,20 +74,20 @@ static void vexpress_a9_devices_init(void)
armlinux_set_bootparams((void *)(0x60000100));
}
-static void vexpress_a9_console_init(void)
+static void vexpress_a9_legacy_console_init(void)
{
- vexpress_a9_register_uart(0);
- vexpress_a9_register_uart(1);
- vexpress_a9_register_uart(2);
- vexpress_a9_register_uart(3);
+ vexpress_a9_legacy_register_uart(0);
+ vexpress_a9_legacy_register_uart(1);
+ vexpress_a9_legacy_register_uart(2);
+ vexpress_a9_legacy_register_uart(3);
}
-struct vexpress_init vexpress_init_a9 = {
- .core_init = vexpress_a9_init,
- .mem_init = vexpress_a9_mem_init,
- .console_init = vexpress_a9_console_init,
- .devices_init = vexpress_a9_devices_init,
- .hostname = "vexpress-a9",
+struct vexpress_init vexpress_init_a9_legacy = {
+ .core_init = vexpress_a9_legacy_init,
+ .mem_init = vexpress_a9_legacy_mem_init,
+ .console_init = vexpress_a9_legacy_console_init,
+ .devices_init = vexpress_a9_legacy_devices_init,
+ .hostname = "vexpress-a9-legacy",
};
static int vexpress_mem_init(void)
@@ -123,14 +124,16 @@ console_initcall(vexpress_console_init);
static int vexpress_core_init(void)
{
- if (cpu_is_cortex_a9()) {
- v2m_init = &vexpress_init_a9;
+ if (amba_is_arm_sp804(IOMEM(0x10011000))) {
+ v2m_init = &vexpress_init_a9_legacy;
} else {
v2m_init = &vexpress_init_ax;
if (cpu_is_cortex_a5())
v2m_init->hostname = "vexpress-a5";
else if (cpu_is_cortex_a7())
v2m_init->hostname = "vexpress-a7";
+ else if (cpu_is_cortex_a9())
+ v2m_init->hostname = "vexpress-a9";
else if (cpu_is_cortex_a15())
v2m_init->hostname = "vexpress-a15";
}
diff --git a/arch/arm/boards/vexpress/lowlevel.c b/arch/arm/boards/vexpress/lowlevel.c
index 04ed84b..5b0c6b7 100644
--- a/arch/arm/boards/vexpress/lowlevel.c
+++ b/arch/arm/boards/vexpress/lowlevel.c
@@ -9,11 +9,13 @@
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
#include <asm/system_info.h>
+#include <linux/amba/sp804.h>
void __naked reset(void)
{
common_reset();
- if (cpu_is_cortex_a9())
+
+ if (amba_is_arm_sp804(IOMEM(0x10011000)))
barebox_arm_entry(0x60000000, SZ_512M, 0);
else
barebox_arm_entry(0x80000000, SZ_512M, 0);
diff --git a/arch/arm/mach-vexpress/devices.c b/arch/arm/mach-vexpress/devices.c
index 69c93ef..6ccce52 100644
--- a/arch/arm/mach-vexpress/devices.c
+++ b/arch/arm/mach-vexpress/devices.c
@@ -12,7 +12,7 @@
#include <mach/devices.h>
-void vexpress_a9_add_ddram(u32 ddr0_size, u32 ddr1_size)
+void vexpress_a9_legacy_add_ddram(u32 ddr0_size, u32 ddr1_size)
{
arm_add_mem_device("ram0", 0x60000000, ddr0_size);
@@ -21,7 +21,7 @@ void vexpress_a9_add_ddram(u32 ddr0_size, u32 ddr1_size)
}
-void vexpress_a9_register_uart(unsigned id)
+void vexpress_a9_legacy_register_uart(unsigned id)
{
resource_size_t start;
diff --git a/arch/arm/mach-vexpress/include/mach/devices.h b/arch/arm/mach-vexpress/include/mach/devices.h
index adeada8..3146a47 100644
--- a/arch/arm/mach-vexpress/include/mach/devices.h
+++ b/arch/arm/mach-vexpress/include/mach/devices.h
@@ -7,13 +7,13 @@
#ifndef __ASM_ARCH_DEVICES_H__
#define __ASM_ARCH_DEVICES_H__
-void vexpress_a9_add_ddram(u32 ddr0_size, u32 ddr1_size);
+void vexpress_a9_legacy_add_ddram(u32 ddr0_size, u32 ddr1_size);
void vexpress_add_ddram(u32 size);
-void vexpress_a9_register_uart(unsigned id);
+void vexpress_a9_legacy_register_uart(unsigned id);
void vexpress_register_uart(unsigned id);
-void vexpress_a9_init(void);
+void vexpress_a9_legacy_init(void);
void vexpress_init(void);
extern void *v2m_wdt_base;
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 12d5d1a..d6dde83 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -64,7 +64,7 @@ static void __init v2m_sp804_init(void __iomem *base)
amba_apb_device_add(NULL, "sp804", DEVICE_ID_SINGLE, (resource_size_t)base, 4096, NULL, 0);
}
-void vexpress_a9_init(void)
+void vexpress_a9_legacy_init(void)
{
v2m_wdt_base = IOMEM(0x1000f000);
v2m_sysreg_base = IOMEM(0x10001000);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-12 13:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 13:00 [PATCH 0/3] vexpress: detect the mapping based on the amba devices Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 1/3] amba: introduce amba_device_get_pid/cid Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 2/3] sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 13:03 ` [PATCH 3/3] vexpress: detect the board periph mapping and detecting the sp804 mapping Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox