From e67ae6be734de909954e20317c38472af983b92c Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 2 Nov 2012 01:31:10 +0100 Subject: ARM: integrator: hook the AP into the SoC bus This hooks the Integrator/AP into the SoC bus when booting from device tree, by mapping the AP controller registers first, then registering the SoC device, and then populating the device tree with the SoC device as parent. Introduce some helpers in the core to provide sysfs files detailing the use of the SoC ID which will later be reused by the Integrator/CP patch for the same bus grouping. Cc: Lee Jones Acked-by: Arnd Bergmann Signed-off-by: Linus Walleij --- arch/arm/boot/dts/integratorap.dts | 5 ++ arch/arm/mach-integrator/Kconfig | 1 + arch/arm/mach-integrator/common.h | 1 + arch/arm/mach-integrator/core.c | 91 ++++++++++++++++++++++++++++++++ arch/arm/mach-integrator/integrator_ap.c | 57 +++++++++++++++++++- 5 files changed, 153 insertions(+), 2 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts index 61767757b50a..c9c3fa344647 100644 --- a/arch/arm/boot/dts/integratorap.dts +++ b/arch/arm/boot/dts/integratorap.dts @@ -18,6 +18,11 @@ bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk"; }; + syscon { + /* AP system controller registers */ + reg = <0x11000000 0x100>; + }; + timer0: timer@13000000 { compatible = "arm,integrator-timer"; }; diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig index 350e26636a06..3961942c9e11 100644 --- a/arch/arm/mach-integrator/Kconfig +++ b/arch/arm/mach-integrator/Kconfig @@ -8,6 +8,7 @@ config ARCH_INTEGRATOR_AP select MIGHT_HAVE_PCI select SERIAL_AMBA_PL010 select SERIAL_AMBA_PL010_CONSOLE + select SOC_BUS help Include support for the ARM(R) Integrator/AP and Integrator/PP2 platforms. diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h index c3ff21b5ea24..fc9f47d289f4 100644 --- a/arch/arm/mach-integrator/common.h +++ b/arch/arm/mach-integrator/common.h @@ -4,3 +4,4 @@ void integrator_init_early(void); int integrator_init(bool is_cp); void integrator_reserve(void); void integrator_restart(char, const char *); +void integrator_init_sysfs(struct device *parent, u32 id); diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index ea22a17246d7..161fbf8596bd 100644 --- a/arch/arm/mach-integrator/core.c +++ b/arch/arm/mach-integrator/core.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -169,3 +170,93 @@ void integrator_restart(char mode, const char *cmd) { cm_control(CM_CTRL_RESET, CM_CTRL_RESET); } + +static u32 integrator_id; + +static ssize_t intcp_get_manf(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%02x\n", integrator_id >> 24); +} + +static struct device_attribute intcp_manf_attr = + __ATTR(manufacturer, S_IRUGO, intcp_get_manf, NULL); + +static ssize_t intcp_get_arch(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + const char *arch; + + switch ((integrator_id >> 16) & 0xff) { + case 0x00: + arch = "ASB little-endian"; + break; + case 0x01: + arch = "AHB little-endian"; + break; + case 0x03: + arch = "AHB-Lite system bus, bi-endian"; + break; + case 0x04: + arch = "AHB"; + break; + default: + arch = "Unknown"; + break; + } + + return sprintf(buf, "%s\n", arch); +} + +static struct device_attribute intcp_arch_attr = + __ATTR(architecture, S_IRUGO, intcp_get_arch, NULL); + +static ssize_t intcp_get_fpga(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + const char *fpga; + + switch ((integrator_id >> 12) & 0xf) { + case 0x01: + fpga = "XC4062"; + break; + case 0x02: + fpga = "XC4085"; + break; + case 0x04: + fpga = "EPM7256AE (Altera PLD)"; + break; + default: + fpga = "Unknown"; + break; + } + + return sprintf(buf, "%s\n", fpga); +} + +static struct device_attribute intcp_fpga_attr = + __ATTR(fpga, S_IRUGO, intcp_get_fpga, NULL); + +static ssize_t intcp_get_build(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%02x\n", (integrator_id >> 4) & 0xFF); +} + +static struct device_attribute intcp_build_attr = + __ATTR(build, S_IRUGO, intcp_get_build, NULL); + + + +void integrator_init_sysfs(struct device *parent, u32 id) +{ + integrator_id = id; + device_create_file(parent, &intcp_manf_attr); + device_create_file(parent, &intcp_arch_attr); + device_create_file(parent, &intcp_fpga_attr); + device_create_file(parent, &intcp_build_attr); +} diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index e6617c134faf..7d84080f9aa3 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include