ux500: Export SoC information and some platform clean-up
cover ux500: Export SoC information and some platform clean-up
This patch-set satisfies 4 objectives:
1. Ensures each platform device can specify a suitable parent
2. Provides a bus for SoC devices as a means to export information
3. Allows ux500 to make use of the new SoC bus
4. Cleans up unnecessary complexity from ux500 code
--- Documentation/ABI/testing/sysfs-devices-soc | 58 ++++++++ arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/board-mop500-sdi.c | 31 ++-- arch/arm/mach-ux500/board-mop500.c | 74 ++++++---- arch/arm/mach-ux500/board-mop500.h | 8 +- arch/arm/mach-ux500/board-u5500-sdi.c | 4 +- arch/arm/mach-ux500/board-u5500.c | 27 ++-- arch/arm/mach-ux500/cpu-db5500.c | 36 ++++- arch/arm/mach-ux500/cpu-db8500.c | 44 +++++- arch/arm/mach-ux500/cpu.c | 75 ++++++++++ arch/arm/mach-ux500/devices-common.c | 79 ++-------- arch/arm/mach-ux500/devices-common.h | 83 ++++++----- arch/arm/mach-ux500/devices-db5500.h | 116 +++++++++------ arch/arm/mach-ux500/devices-db8500.h | 176 +++++++++++++---------- arch/arm/mach-ux500/dma-db5500.c | 3 +- arch/arm/mach-ux500/include/mach/db8500-regs.h | 3 + arch/arm/mach-ux500/include/mach/setup.h | 10 +- arch/arm/mach-ux500/include/mach/usb.h | 4 +- arch/arm/mach-ux500/usb.c | 7 +- drivers/base/Kconfig | 3 + drivers/base/Makefile | 1 + drivers/base/soc.c | 186 ++++++++++++++++++++++++ include/linux/syssoc.h | 74 ++++++++++ 23 files changed, 799 insertions(+), 304 deletions(-)
PATCH 1/6 mach-ux500: pass parent pointer to each platform device
This patch provides a means for any device within ux500 platform code to allocate its own parent. This is particularly prudent with the introduction of /sys/devices/socX, as a device can now proclaim to be integral part of an SoC, rather than a more generic platform device. Latter patches make good use of this functionality.
--- arch/arm/mach-ux500/board-mop500-sdi.c | 31 +++--- arch/arm/mach-ux500/board-mop500.c | 62 ++++++----- arch/arm/mach-ux500/board-mop500.h | 8 +- arch/arm/mach-ux500/board-u5500-sdi.c | 4 +- arch/arm/mach-ux500/board-u5500.c | 23 +++-- arch/arm/mach-ux500/cpu-db5500.c | 18 ++-- arch/arm/mach-ux500/cpu-db8500.c | 15 ++-- arch/arm/mach-ux500/devices-common.c | 13 ++- arch/arm/mach-ux500/devices-common.h | 39 ++++--- arch/arm/mach-ux500/devices-db5500.h | 116 ++++++++++++--------- arch/arm/mach-ux500/devices-db8500.h | 166 +++++++++++++++++------------- arch/arm/mach-ux500/dma-db5500.c | 3 +- arch/arm/mach-ux500/include/mach/setup.h | 8 +- arch/arm/mach-ux500/include/mach/usb.h | 4 +- arch/arm/mach-ux500/usb.c | 4 +- 15 files changed, 289 insertions(+), 225 deletions(-)
arch/arm/mach-ux500/board-mop500-sdi.c +16 -15
@@ -104,7 +104,7 @@ static struct mmci_platform_data mop500_sdi0_data = {#endif }; -static void sdi0_configure (void ) +static void sdi0_configure (struct device *parent) {int ret;
@@ -123,15 +123,15 @@ static void sdi0_configure(void)gpio_direction_output (sdi0_en,1 );/* Add the device, force v2 to subrevision 1 */ -db8500_add_sdi0 (&mop500_sdi0_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi0 (parent, &mop500_sdi0_data,U8500_SDI_V2_PERIPHID ); } -void mop500_sdi_tc35892_init (void ) +void mop500_sdi_tc35892_init (struct device *parent) { mop500_sdi0_data.gpio_cd =GPIO_SDMMC_CD ; sdi0_en =GPIO_SDMMC_EN ; sdi0_vsel =GPIO_SDMMC_1V8_3V_SEL ; -sdi0_configure (); +sdi0_configure (parent); }/*
@@ -246,12 +246,13 @@ static struct mmci_platform_data mop500_sdi4_data = {#endif }; -void __init mop500_sdi_init (void ) +void __init mop500_sdi_init (struct device *parent) {/* PoP:ed eMMC */ -db8500_add_sdi2 (&mop500_sdi2_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi2 (parent, &mop500_sdi2_data,U8500_SDI_V2_PERIPHID );/* On-board eMMC */ -db8500_add_sdi4 (&mop500_sdi4_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi4 (parent, &mop500_sdi4_data,U8500_SDI_V2_PERIPHID ); +/* * On boards with the TC35892 GPIO expander, sdi0 will finally * be added when the TC35892 initializes and calls
@@ -259,29 +260,29 @@ void __init mop500_sdi_init(void)*/ } -void __init snowball_sdi_init (void ) +void __init snowball_sdi_init (struct device *parent) {/* On-board eMMC */ -db8500_add_sdi4 (&mop500_sdi4_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi4 (parent, &mop500_sdi4_data,U8500_SDI_V2_PERIPHID );/* External Micro SD slot */ mop500_sdi0_data.gpio_cd =SNOWBALL_SDMMC_CD_GPIO ; mop500_sdi0_data.cd_invert = true; sdi0_en =SNOWBALL_SDMMC_EN_GPIO ; sdi0_vsel =SNOWBALL_SDMMC_1V8_3V_GPIO ; -sdi0_configure (); +sdi0_configure (parent); } -void __init hrefv60_sdi_init (void ) +void __init hrefv60_sdi_init (struct device *parent) {/* PoP:ed eMMC */ -db8500_add_sdi2 (&mop500_sdi2_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi2 (parent, &mop500_sdi2_data,U8500_SDI_V2_PERIPHID );/* On-board eMMC */ -db8500_add_sdi4 (&mop500_sdi4_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi4 (parent, &mop500_sdi4_data,U8500_SDI_V2_PERIPHID );/* External Micro SD slot */ mop500_sdi0_data.gpio_cd =HREFV60_SDMMC_CD_GPIO ; sdi0_en =HREFV60_SDMMC_EN_GPIO ; sdi0_vsel =HREFV60_SDMMC_1V8_3V_GPIO ; -sdi0_configure (); +sdi0_configure (parent);/* WLAN SDIO channel */ -db8500_add_sdi1 (&mop500_sdi1_data,U8500_SDI_V2_PERIPHID ); +db8500_add_sdi1 (parent, &mop500_sdi1_data,U8500_SDI_V2_PERIPHID ); }
arch/arm/mach-ux500/board-mop500.c +35 -27
137 lines not on this page · raw message
arch/arm/mach-ux500/board-mop500.h +4 -4
@@ -75,10 +75,10 @@struct i2c_board_info ; -extern void mop500_sdi_init (void ); -extern void snowball_sdi_init (void ); -extern void hrefv60_sdi_init (void ); -extern void mop500_sdi_tc35892_init (void ); +extern void mop500_sdi_init (struct device *parent); +extern void snowball_sdi_init (struct device *parent); +extern void hrefv60_sdi_init (struct device *parent); +extern void mop500_sdi_tc35892_init (struct device *parent);void __init mop500_u8500uib_init (void );void __init mop500_stuib_init (void );void __init mop500_pins_init (void );
arch/arm/mach-ux500/board-u5500-sdi.c +2 -2
@@ -66,9 +66,9 @@ static struct mmci_platform_data u5500_sdi0_data = {#endif }; -void __init u5500_sdi_init (void ) +void __init u5500_sdi_init (struct device *parent) {nmk_config_pins (u5500_sdi_pins,ARRAY_SIZE (u5500_sdi_pins)); -db5500_add_sdi0 (&u5500_sdi0_data); +db5500_add_sdi0 (parent, &u5500_sdi0_data); }
arch/arm/mach-ux500/board-u5500.c +13 -10
@@ -97,9 +97,9 @@ static struct i2c_board_info __initdata u5500_i2c2_devices[] = { }, }; -static void __init u5500_i2c_init (void ) +static void __init u5500_i2c_init (struct device *parent) { -db5500_add_i2c2 (&u5500_i2c2_data); +db5500_add_i2c2 (parent, &u5500_i2c2_data);i2c_register_board_info (2 ,ARRAY_AND_SIZE (u5500_i2c2_devices)); }
@@ -126,20 +126,23 @@ static struct platform_device *u5500_platform_devices[] __initdata = { &ab5500_device, }; -static void __init u5500_uart_init (void ) +static void __init u5500_uart_init (struct device *parent) { -db5500_add_uart0 (NULL ); -db5500_add_uart1 (NULL ); -db5500_add_uart2 (NULL ); +db5500_add_uart0 (parent,NULL ); +db5500_add_uart1 (parent,NULL ); +db5500_add_uart2 (parent,NULL ); }static void __init u5500_init_machine (void ) { -u5500_init_devices (); +struct device *parent =NULL ; + + parent =u5500_init_devices ();nmk_config_pins (u5500_pins,ARRAY_SIZE (u5500_pins)); -u5500_i2c_init (); -u5500_sdi_init (); -u5500_uart_init (); + +u5500_i2c_init (parent); +u5500_sdi_init (parent); +u5500_uart_init (parent);platform_add_devices (u5500_platform_devices,ARRAY_SIZE (u5500_platform_devices));
arch/arm/mach-ux500/cpu-db5500.c +11 -7
@@ -147,13 +147,13 @@ static resource_size_t __initdata db5500_gpio_base[] = { U5500_GPIOBANK7_BASE, }; -static void __init db5500_add_gpios (void ) +static void __init db5500_add_gpios (struct device *parent) {struct nmk_gpio_platform_data pdata = {/* No custom data yet */ }; -dbx500_add_gpios (ARRAY_AND_SIZE (db5500_gpio_base), +dbx500_add_gpios (parent,ARRAY_AND_SIZE (db5500_gpio_base),IRQ_DB5500_GPIO0 , &pdata); }
@@ -212,14 +212,18 @@ static int usb_db5500_tx_dma_cfg[] = { DB5500_DMA_DEV38_USB_OTG_OEP_8 }; -void __init u5500_init_devices (void ) +struct device *__init u5500_init_devices (void ) { -db5500_add_gpios (); +/* FIXME: First parameter to be a real parent. */ +db5500_add_gpios (NULL );db5500_pmu_init (); -db5500_dma_init (); -db5500_add_rtc (); -db5500_add_usb (usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); +db5500_dma_init (NULL ); +db5500_add_rtc (NULL ); +db5500_add_usb (NULL , usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);platform_add_devices (db5500_platform_devs,ARRAY_SIZE (db5500_platform_devs)); + +/* FIXME: Return value to be a real parent. */ +return NULL ; }
arch/arm/mach-ux500/cpu-db8500.c +8 -7
@@ -132,13 +132,13 @@ static resource_size_t __initdata db8500_gpio_base[] = { U8500_GPIOBANK8_BASE, }; -static void __init db8500_add_gpios (void ) +static void __init db8500_add_gpios (struct device *parent) {struct nmk_gpio_platform_data pdata = { .supports_sleepmode = true, }; -dbx500_add_gpios (ARRAY_AND_SIZE (db8500_gpio_base), +dbx500_add_gpios (parent,ARRAY_AND_SIZE (db8500_gpio_base),IRQ_DB8500_GPIO0 , &pdata); }
@@ -167,14 +167,15 @@ static int usb_db8500_tx_dma_cfg[] = {/* * This function is called from the board init */ -void __init u8500_init_devices (void ) +struct device *__init u8500_init_devices (void ) { -db8500_add_rtc (); -db8500_add_gpios (); -db8500_add_usb (usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); +db8500_add_rtc (NULL ); +db8500_add_gpios (NULL ); +db8500_add_usb (NULL , usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);platform_device_register_simple ("cpufreq-u8500" ,-1 ,NULL ,0 );platform_add_devices (platform_devs,ARRAY_SIZE (platform_devs)); -return ; +/* FIXME: Return value to be a real parent. */ +return NULL ; }
arch/arm/mach-ux500/devices-common.c +7 -6
@@ -20,8 +20,9 @@#include "devices-common.h" struct amba_device * -dbx500_add_amba_device (const char *name,resource_size_t base, -int irq,void *pdata,unsigned int periphid) +dbx500_add_amba_device (struct device *parent,const char *name, +resource_size_t base,int irq,void *pdata, +unsigned int periphid) {struct amba_device *dev;int ret;
@@ -109,7 +110,7 @@ dbx500_add_platform_device_4k1irq(const char *name, int id, }static struct platform_device * -dbx500_add_gpio (int id,resource_size_t addr,int irq, +dbx500_add_gpio (struct device *parent,int id,resource_size_t addr,int irq,struct nmk_gpio_platform_data *pdata) {struct resource resources[] = {
@@ -130,8 +131,8 @@ dbx500_add_gpio(int id, resource_size_t addr, int irq, pdata, sizeof(*pdata)); } -void dbx500_add_gpios (resource_size_t *base,int num,int irq, -struct nmk_gpio_platform_data *pdata) +void dbx500_add_gpios (struct device *parent,resource_size_t *base,int num, +int irq,struct nmk_gpio_platform_data *pdata) {int first =0 ;int i;
@@ -141,6 +142,6 @@ void dbx500_add_gpios(resource_size_t *base, int num, int irq, pdata->first_irq =NOMADIK_GPIO_TO_IRQ (first); pdata->num_gpio =32 ; -dbx500_add_gpio (i, base[i], irq, pdata); +dbx500_add_gpio (parent, i, base[i], irq, pdata); } }
arch/arm/mach-ux500/devices-common.h +21 -18
@@ -9,7 +9,7 @@#define __DEVICES_COMMON_Hextern struct amba_device * -dbx500_add_amba_device (const char *name,resource_size_t base, +dbx500_add_amba_device (struct device *parent,const char *name,resource_size_t base,int irq,void *pdata,unsigned int periphid); extern struct platform_device *
@@ -20,43 +20,46 @@ dbx500_add_platform_device_4k1irq(const char *name, int id,struct spi_master_cntlr ;static inline struct amba_device * -dbx500_add_msp_spi (const char *name,resource_size_t base,int irq, +dbx500_add_msp_spi (struct device *parent,const char *name, +resource_size_t base,int irq,struct spi_master_cntlr *pdata) { -return dbx500_add_amba_device (name, base, irq, pdata,0 ); +return dbx500_add_amba_device (parent, name, base, irq, + pdata,0 ); }static inline struct amba_device * -dbx500_add_spi (const char *name,resource_size_t base,int irq, -struct spi_master_cntlr *pdata, +dbx500_add_spi (struct device *parent,const char *name,resource_size_t base, +int irq,struct spi_master_cntlr *pdata,u32 periphid) { -return dbx500_add_amba_device (name, base, irq, pdata, periphid); +return dbx500_add_amba_device (parent, name, base, irq, + pdata, periphid); }struct mmci_platform_data ;static inline struct amba_device * -dbx500_add_sdi (const char *name,resource_size_t base,int irq, -struct mmci_platform_data *pdata, -u32 periphid) +dbx500_add_sdi (struct device *parent,const char *name,resource_size_t base, +int irq,struct mmci_platform_data *pdata,u32 periphid) { -return dbx500_add_amba_device (name, base, irq, pdata, periphid); +return dbx500_add_amba_device (parent, name, base, irq, + pdata, periphid); }struct amba_pl011_data ;static inline struct amba_device * -dbx500_add_uart (const char *name,resource_size_t base,int irq, -struct amba_pl011_data *pdata) +dbx500_add_uart (struct device *parent,const char *name,resource_size_t base, +int irq,struct amba_pl011_data *pdata) { -return dbx500_add_amba_device (name, base, irq, pdata,0 ); +return dbx500_add_amba_device (parent, name, base, irq, pdata,0 ); }struct nmk_i2c_controller ;static inline struct platform_device * -dbx500_add_i2c (int id,resource_size_t base,int irq, +dbx500_add_i2c (struct device *parent,int id,resource_size_t base,int irq,struct nmk_i2c_controller *pdata) { return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
@@ -74,14 +77,14 @@ dbx500_add_msp_i2s(int id, resource_size_t base, int irq, }static inline struct amba_device * -dbx500_add_rtc (resource_size_t base,int irq) +dbx500_add_rtc (struct device *parent,resource_size_t base,int irq) { -return dbx500_add_amba_device ("rtc-pl031" , base, irq,NULL ,0 ); +return dbx500_add_amba_device (parent,"rtc-pl031" , base, irq,NULL ,0 ); }struct nmk_gpio_platform_data ; -void dbx500_add_gpios (resource_size_t *base,int num,int irq, -struct nmk_gpio_platform_data *pdata); +void dbx500_add_gpios (struct device *parent,resource_size_t *base,int num, +int irq,struct nmk_gpio_platform_data *pdata);#endif
arch/arm/mach-ux500/devices-db5500.h +68 -48
138 lines not on this page · raw message
arch/arm/mach-ux500/devices-db8500.h +94 -72
181 lines not on this page · raw message
arch/arm/mach-ux500/dma-db5500.c +2 -1
@@ -125,10 +125,11 @@ static struct platform_device dma40_device = { .resource = dma40_resources }; -void __init db5500_dma_init (void ) +void __init db5500_dma_init (struct device *parent) {int ret; + dma40_device.dev.parent = parent; ret =platform_device_register (&dma40_device);if (ret)dev_err (&dma40_device.dev,"unable to register device: %d\n" , ret);
arch/arm/mach-ux500/include/mach/setup.h +4 -4
@@ -18,14 +18,14 @@ void __init ux500_map_io(void);extern void __init u5500_map_io (void );extern void __init u8500_map_io (void ); -extern void __init u5500_init_devices (void ); -extern void __init u8500_init_devices (void ); +extern struct device *__init u5500_init_devices (void ); +extern struct device *__init u8500_init_devices (void );extern void __init ux500_init_irq (void ); -extern void __init u5500_sdi_init (void ); +extern void __init u5500_sdi_init (struct device *parent); -extern void __init db5500_dma_init (void ); +extern void __init db5500_dma_init (struct device *parent);/* We re-use nomadik_timer for this platform */ extern void nmdk_timer_init (void );
arch/arm/mach-ux500/include/mach/usb.h +2 -2
@@ -20,6 +20,6 @@ struct ux500_musb_board_data { bool (*dma_filter)(struct dma_chan *chan, void *filter_param); }; -void ux500_add_usb (resource_size_t base,int irq,int *dma_rx_cfg, -int *dma_tx_cfg); +void ux500_add_usb (struct device *parent,resource_size_t base, +int irq,int *dma_rx_cfg,int *dma_tx_cfg);#endif
arch/arm/mach-ux500/usb.c +2 -2
@@ -146,8 +146,8 @@ static inline void ux500_usb_dma_update_tx_ch_config(int *dst_dev_type) musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx]; } -void ux500_add_usb (resource_size_t base,int irq,int *dma_rx_cfg, -int *dma_tx_cfg) +void ux500_add_usb (struct device *parent,resource_size_t base,int irq, +int *dma_rx_cfg,int *dma_tx_cfg) { ux500_musb_device.resource[0 ].start = base; ux500_musb_device.resource[0 ].end = base +SZ_64K -1 ;
Signature · 1 line
1.7.5.4
PATCH 2/6 drivers/base: add bus for System-on-Chip devices
In reply to Lee JonesTraditionally, any System-on-Chip based platform creates a flat list of platform_devices directly under /sys/devices/platform.
In order to give these some better structure, this introduces a new bus type for soc_devices that are registered with the new soc_device_register() function. All devices that are on the same chip should then be registered as child devices of the soc device.
The soc bus also exports a few standardised device attributes which allow user space to query the specific type of soc.
--- drivers/base/Kconfig | 3 + drivers/base/Makefile | 1 + drivers/base/soc.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/syssoc.h | 74 +++++++++++++++++++ 4 files changed, 264 insertions(+), 0 deletions(-) create mode 100644 drivers/base/soc.c create mode 100644 include/linux/syssoc.h
drivers/base/Kconfig +3 -0
@@ -176,6 +176,9 @@ config GENERIC_CPU_DEVICES bool default n +config SOC_BUS + bool + source "drivers/base/regmap/Kconfig" config DMA_SHARED_BUFFER
drivers/base/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_MODULES) += module.o endif obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o obj-$(CONFIG_REGMAP) += regmap/ +obj-$(CONFIG_SOC_BUS) += soc.o ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
drivers/base/soc.c new file +186 -0
186 lines not on this page · raw message
include/linux/syssoc.h new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 2/6 drivers/base: add bus for System-on-Chip devices
Hi Lee,
I'm not able to give this a full testing, but it looks good to me, I have one really minor nit, but I'll look forward to integrating this into picoxcell as soon as I get chance!
Jamie
Quoted 15 lines · Lee Jones
drivers/base/soc.c new file +9
-0@@ -0,0 +1,186 @@ +/* +* Copyright (C) ST-Ericsson SA 2011 +* +* Author: Lee Jones <[email protected]> for ST-Ericsson. +* License terms: ?GNU General Public License (GPL), version 2 +*/ + +#include <linux/sysfs.h> +#include <linux/module.h>
drivers/base/soc.c line 19
Quoted 10 lines
drivers/base/soc.c new file +10
-0+#include <linux/init.h> +#include <linux/stat.h> +#include <linux/slab.h> +#include <linux/idr.h> +#include <linux/spinlock.h> +#include <linux/sys_soc.h> +#include <linux/err.h> + +static struct ida soc_ida; +static spinlock_t soc_lock;
Use DEFINE_IDR() and DEFINE_SPINLOCK() rather than initialising them at runtime?
Jamie
PATCH 2/6 drivers/base: add bus for System-on-Chip devices
Quoted 5 lines · Jamie Iles
drivers/base/soc.c line 19
Quoted 2 lines
drivers/base/soc.c new file +2
-0+static struct ida soc_ida; +static spinlock_t soc_lock;Use
DEFINE_IDR()andDEFINE_SPINLOCK()rather than initialising them at runtime?
Good point! "static DEFINE_{IDR,SPINLOCK}()" even, in case that wasn't clear.
Arnd
PATCH 3/6 Documentation: add information for new sysfs soc bus functionality
In reply to Lee JonesThis change applies the required documentation for each new attribute recenty added by the new System-On-Chip (SoC) information export bus driver.
--- Documentation/ABI/testing/sysfs-devices-soc | 58 +++++++++++++++++++++++++++ 1 files changed, 58 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-soc
Documentation/ABI/testing/sysfs-devices-soc new file +58 -0
@@ -0,0 +1,58 @@ +What: /sys/devices/socX +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + The /sys/devices/ directory contains a sub-directory for each + System-on-Chip (SoC) device on a running platform. Information + regarding each SoC can be obtained by reading sysfs files. This + functionality is only available if implemented by the platform. + + The directory created for each SoC will also house information + about devices which are commonly contained in /sys/devices/platform. + It has been agreed that if an SoC device exists, its supported + devices would be better suited to appear as children of that SoC. + +What: /sys/devices/socX/machine +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + Read-only attribute common to all SoCs. Contains the SoC machine + name (e.g. Ux500). + +What: /sys/devices/socX/family +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + Read-only attribute common to all SoCs. Contains SoC family name + (e.g. DB8500). + +What: /sys/devices/socX/soc_id +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + Read-only attribute supported by most SoCs. In the case of + ST-Ericsson's chips this contains the SoC serial number. + +What: /sys/devices/socX/revision +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + Read-only attribute supported by most SoCs. Contains the SoC's + manufacturing revision number. + +What: /sys/devices/socX/process +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + Read-only attribute supported ST-Ericsson's silicon. Contains the + the process by which the silicon chip was manufactured. + +What: /sys/bus/soc +Date: January 2012 +contact: Lee Jones <[email protected]> +Description: + The /sys/bus/soc/ directory contains the usual sub-folders + expected under most buses. /sys/bus/soc/devices is of particular + interest, as it contains a symlink for each SoC device found on + the system. Each symlink points back into the aforementioned + /sys/devices/socX devices.
Signature · 1 line
1.7.5.4
PATCH 4/6 mach-ux500: export System-on-Chip information ux500 via sysfs
In reply to Lee JonesHere we make use of the new System-On-Chip bus driver to export vital SoC information out to userspace via sysfs. This patch provides a data structure of strings to populate the base nodes found in:
/sys/devices/soc[0|1|2|...]/[family|machine|revision|soc_id].
It also adds one more node as requested by ST-Ericsson. 'process' depicts the way in which the silicon was manufactured.
--- arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/cpu-db5500.c | 30 +++++++--- arch/arm/mach-ux500/cpu-db8500.c | 33 +++++++++-- arch/arm/mach-ux500/cpu.c | 75 ++++++++++++++++++++++++ arch/arm/mach-ux500/include/mach/db8500-regs.h | 3 + arch/arm/mach-ux500/include/mach/setup.h | 2 + 6 files changed, 130 insertions(+), 14 deletions(-)
arch/arm/mach-ux500/Kconfig +1 -0
@@ -27,6 +27,7 @@ config MACH_U8500 bool "U8500 Development platform" depends on UX500_SOC_DB8500 select TPS6105X + select SOC_BUS help Include support for the mop500 development platform.
arch/arm/mach-ux500/cpu-db5500.c +22 -8
@@ -212,18 +212,32 @@ static int usb_db5500_tx_dma_cfg[] = { DB5500_DMA_DEV38_USB_OTG_OEP_8 }; -struct device *__init u5500_init_devices (void ) +static const char *db5500_read_soc_id (void ) { -/* FIXME: First parameter to be a real parent. */ -db5500_add_gpios (NULL ); +return kasprintf (GFP_KERNEL ,"u5500 currently unsupported\n" ); +} + +static struct device *__init db5500_soc_device_init (void ) +{ +const char *soc_id =db5500_read_soc_id (); + +return ux500_soc_device_init (soc_id); +} + +struct device *__init u5500_init_devices (void ) +{ +struct device *parent; + + parent =db5500_soc_device_init (); + +db5500_add_gpios (parent);db5500_pmu_init (); -db5500_dma_init (NULL ); -db5500_add_rtc (NULL ); -db5500_add_usb (NULL , usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); +db5500_dma_init (parent); +db5500_add_rtc (parent); +db5500_add_usb (parent, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);platform_add_devices (db5500_platform_devs,ARRAY_SIZE (db5500_platform_devs)); -/* FIXME: Return value to be a real parent. */ -return NULL ; +return parent; }
arch/arm/mach-ux500/cpu-db8500.c +27 -6
@@ -24,6 +24,7 @@#include <mach/setup.h> #include <mach/devices.h> #include <mach/usb.h> +#include <mach/db8500-regs.h> #include "devices-db8500.h" #include "ste-dma40-db8500.h"
@@ -164,18 +165,38 @@ static int usb_db8500_tx_dma_cfg[] = {DB8500_DMA_DEV39_USB_OTG_OEP_8 }; +static const char *db8500_read_soc_id (void ) +{ +void __iomem *uid =__io_address (U8500_BB_UID_BASE ); + +return kasprintf (GFP_KERNEL ,"%08x%08x%08x%08x%08x" , +readl ((u32 *)uid+1 ), +readl ((u32 *)uid+1 ),readl ((u32 *)uid+2 ), +readl ((u32 *)uid+3 ),readl ((u32 *)uid+4 )); +} + +static struct device *__init db8500_soc_device_init (void ) +{ +const char *soc_id =db8500_read_soc_id (); + +return ux500_soc_device_init (soc_id); +} +/* * This function is called from the board init */ -struct device *__init u8500_init_devices (void ) +struct device *__init u8500_init_devices (void ) { -db8500_add_rtc (NULL ); -db8500_add_gpios (NULL ); -db8500_add_usb (NULL , usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); +struct device *parent; + + parent =db8500_soc_device_init (); + +db8500_add_rtc (parent); +db8500_add_gpios (parent); +db8500_add_usb (parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);platform_device_register_simple ("cpufreq-u8500" ,-1 ,NULL ,0 );platform_add_devices (platform_devs,ARRAY_SIZE (platform_devs)); -/* FIXME: Return value to be a real parent. */ -return NULL ; +return parent; }
arch/arm/mach-ux500/cpu.c +75 -0
90 lines not on this page · raw message
arch/arm/mach-ux500/include/mach/db8500-regs.h +3 -0
@@ -161,4 +161,7 @@#define U8500_MODEM_BASE 0xe000000#define U8500_APE_BASE 0x6000000 +/* SoC identification number information */ +#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0) +#endif
arch/arm/mach-ux500/include/mach/setup.h +2 -0
@@ -27,6 +27,8 @@ extern void __init u5500_sdi_init(struct device *parent);extern void __init db5500_dma_init (struct device *parent); +extern struct device *ux500_soc_device_init (const char *soc_id); +/* We re-use nomadik_timer for this platform */ extern void nmdk_timer_init (void );
Signature · 1 line
1.7.5.4
PATCH 5/6 mach-ux500: move top level platform devices in sysfs to /sys/devices/socX
In reply to Lee JonesAt the request of Arnd Bergmann this patch moves all SoC platform devices found in sysfs from /sys/devices/platform to /sys/devices/soc<SoCNum>/. It is believed as the devices are SoC specific and a /sys/devices/soc node has recently become available, that this would be a more appropriate place to display the data.
--- arch/arm/mach-ux500/board-mop500.c | 12 ++++++++++++ arch/arm/mach-ux500/board-u5500.c | 4 ++++ arch/arm/mach-ux500/cpu-db5500.c | 4 ++++ arch/arm/mach-ux500/cpu-db8500.c | 8 +++++++- arch/arm/mach-ux500/devices-common.c | 13 ++++++++++--- arch/arm/mach-ux500/usb.c | 3 +++ 6 files changed, 40 insertions(+), 4 deletions(-)
arch/arm/mach-ux500/board-mop500.c +12 -0
@@ -610,6 +610,7 @@ static void __init mop500_init_machine(void) {struct device *parent =NULL ;int i2c0_devs; +int i; mop500_gpio_keys[0 ].gpio =GPIO_PROX_SENSOR ;
@@ -617,6 +618,9 @@ static void __init mop500_init_machine(void)mop500_pins_init (); +for (i =0 ; i <ARRAY_SIZE (mop500_platform_devs); i++) + mop500_platform_devs[i]->dev.parent = parent; +platform_add_devices (mop500_platform_devs,ARRAY_SIZE (mop500_platform_devs));
@@ -639,11 +643,15 @@ static void __init snowball_init_machine(void) {struct device *parent =NULL ;int i2c0_devs; +int i; parent =u8500_init_devices ();snowball_pins_init (); +for (i =0 ; i <ARRAY_SIZE (snowball_platform_devs); i++) + snowball_platform_devs[i]->dev.parent = parent; +platform_add_devices (snowball_platform_devs,ARRAY_SIZE (snowball_platform_devs));
@@ -665,6 +673,7 @@ static void __init hrefv60_init_machine(void) {struct device *parent =NULL ;int i2c0_devs; +int i;/* * The HREFv60 board removed a GPIO expander and routed
@@ -677,6 +686,9 @@ static void __init hrefv60_init_machine(void)hrefv60_pins_init (); +for (i =0 ; i <ARRAY_SIZE (mop500_platform_devs); i++) + mop500_platform_devs[i]->dev.parent = parent; +platform_add_devices (mop500_platform_devs,ARRAY_SIZE (mop500_platform_devs));
arch/arm/mach-ux500/board-u5500.c +4 -0
@@ -136,6 +136,7 @@ static void __init u5500_uart_init(struct device *parent)static void __init u5500_init_machine (void ) {struct device *parent =NULL ; +int i; parent =u5500_init_devices ();nmk_config_pins (u5500_pins,ARRAY_SIZE (u5500_pins));
@@ -144,6 +145,9 @@ static void __init u5500_init_machine(void)u5500_sdi_init (parent);u5500_uart_init (parent); +for (i =0 ; i <ARRAY_SIZE (u5500_platform_devices); i++) + u5500_platform_devices[i]->dev.parent = parent; +platform_add_devices (u5500_platform_devices,ARRAY_SIZE (u5500_platform_devices)); }
arch/arm/mach-ux500/cpu-db5500.c +4 -0
@@ -227,6 +227,7 @@ static struct device * __init db5500_soc_device_init(void)struct device *__init u5500_init_devices (void ) {struct device *parent; +int i; parent =db5500_soc_device_init ();
@@ -236,6 +237,9 @@ struct device * __init u5500_init_devices(void)db5500_add_rtc (parent);db5500_add_usb (parent, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); +for (i =0 ; i <ARRAY_SIZE (db5500_platform_devs); i++) + db5500_platform_devs[i]->dev.parent = parent; +platform_add_devices (db5500_platform_devs,ARRAY_SIZE (db5500_platform_devs));
arch/arm/mach-ux500/cpu-db8500.c +7 -1
@@ -188,6 +188,7 @@ static struct device * __init db8500_soc_device_init(void)struct device *__init u8500_init_devices (void ) {struct device *parent; +int i; parent =db8500_soc_device_init ();
@@ -195,7 +196,12 @@ struct device * __init u8500_init_devices(void)db8500_add_gpios (parent);db8500_add_usb (parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); -platform_device_register_simple ("cpufreq-u8500" ,-1 ,NULL ,0 ); +platform_device_register_data (parent, +"cpufreq-u8500" ,-1 ,NULL ,0 ); + +for (i =0 ; i <ARRAY_SIZE (platform_devs); i++) + platform_devs[i]->dev.parent = parent; +platform_add_devices (platform_devs,ARRAY_SIZE (platform_devs));return parent;
arch/arm/mach-ux500/devices-common.c +10 -3
@@ -47,6 +47,8 @@ dbx500_add_amba_device(struct device *parent, const char *name, dev->dev.platform_data = pdata; + dev->dev.parent = parent; + ret =amba_device_register (dev, &iomem_resource);if (ret) {kfree (dev);
@@ -126,9 +128,14 @@ dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, } }; -return platform_device_register_resndata (NULL ,"gpio" , id, - resources,ARRAY_SIZE (resources), - pdata,sizeof (*pdata)); +return platform_device_register_resndata ( + parent, +"gpio" , + id, + resources, +ARRAY_SIZE (resources), + pdata, +sizeof (*pdata)); } void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
arch/arm/mach-ux500/usb.c +3 -0
@@ -7,6 +7,7 @@#include <linux/platform_device.h> #include <linux/usb/musb.h> #include <linux/dma-mapping.h> +#include <plat/ste_dma40.h> #include <mach/hardware.h> #include <mach/usb.h>
@@ -157,5 +158,7 @@ void ux500_add_usb(struct device *parent, resource_size_t base, int irq,ux500_usb_dma_update_rx_ch_config (dma_rx_cfg);ux500_usb_dma_update_tx_ch_config (dma_tx_cfg); + ux500_musb_device.dev.parent = parent; +platform_device_register (&ux500_musb_device); }
Signature · 1 line
1.7.5.4
PATCH 6/6 mach-ux500: remove intermediary add_platform_device* functions
In reply to Lee JonesThese are no longer required since a 'parent' pointer is now passed to each registering device.
--- arch/arm/mach-ux500/devices-common.c | 53 ---------------------------------- arch/arm/mach-ux500/devices-common.h | 46 ++++++++++++++++------------- arch/arm/mach-ux500/devices-db8500.h | 10 ++++-- 3 files changed, 33 insertions(+), 76 deletions(-)
arch/arm/mach-ux500/devices-common.c +0 -53
@@ -59,59 +59,6 @@ dbx500_add_amba_device(struct device *parent, const char *name, }static struct platform_device * -dbx500_add_platform_device (const char *name,int id,void *pdata, -struct resource *res,int resnum) -{ -struct platform_device *dev; -int ret; - - dev =platform_device_alloc (name, id); -if (!dev) -return ERR_PTR (-ENOMEM ); - - dev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; - - ret =platform_device_add_resources (dev, res, resnum); -if (ret) - goto out_free; - - dev->dev.platform_data = pdata; - - ret =platform_device_add (dev); -if (ret) - goto out_free; - -return dev; - -out_free: -platform_device_put (dev); -return ERR_PTR (ret); -} - -struct platform_device * -dbx500_add_platform_device_4k1irq (const char *name,int id, -resource_size_t base, -int irq,void *pdata) -{ -struct resource resources[] = { - [0 ] = { - .start = base, - .end = base +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start = irq, - .end = irq, - .flags =IORESOURCE_IRQ , - } - }; - -return dbx500_add_platform_device (name, id, pdata, resources, -ARRAY_SIZE (resources)); -} - -static struct platform_device *dbx500_add_gpio (struct device *parent,int id,resource_size_t addr,int irq,struct nmk_gpio_platform_data *pdata) {
arch/arm/mach-ux500/devices-common.h +26 -20
60 lines not on this page · raw message
arch/arm/mach-ux500/devices-db8500.h +7 -3
@@ -18,9 +18,13 @@ db8500_add_ske_keypad(struct device *parent, struct ske_keypad_platform_data *pdata, size_t size) { -return dbx500_add_platform_device_4k1irq ("nmk-ske-keypad" ,-1 , -U8500_SKE_BASE , -IRQ_DB8500_KB , pdata); +struct resource resources[] = { +DEFINE_RES_MEM (U8500_SKE_BASE ,SZ_4K ), +DEFINE_RES_IRQ (IRQ_DB8500_KB ), + }; + +return platform_device_register_resndata (parent,"nmk-ske-keypad" ,-1 , + resources,2 , pdata, size); } static inline struct amba_device *
Signature · 1 line
1.7.5.4