Skip to content

Commit

Permalink
Merge branch 'ux500/soc' into next/soc2
Browse files Browse the repository at this point in the history
* ux500/soc:
  ARM: ux500: remove intermediary add_platform_device* functions
  ARM: ux500: move top level platform devices in sysfs to /sys/devices/socX
  ARM: ux500: export System-on-Chip information ux500 via sysfs
  ARM: ux500: pass parent pointer to each platform device
  • Loading branch information
Arnd Bergmann committed Feb 13, 2012
2 parents eaa5699 + 3510ec6 commit 281a9f7
Show file tree
Hide file tree
Showing 18 changed files with 477 additions and 304 deletions.
1 change: 1 addition & 0 deletions arch/arm/mach-ux500/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,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.

Expand Down
31 changes: 16 additions & 15 deletions arch/arm/mach-ux500/board-mop500-sdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}

/*
Expand Down Expand Up @@ -246,44 +246,45 @@ 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
* mop500_sdi_tc35892_init() above.
*/
}

void __init snowball_sdi_init(void)
void __init snowball_sdi_init(struct device *parent)
{
/* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
/* 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);
}
74 changes: 47 additions & 27 deletions arch/arm/mach-ux500/board-mop500.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ static struct tps6105x_platform_data mop500_tps61052_data = {

static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
{
mop500_sdi_tc35892_init();
struct device *parent = NULL;
#if 0
/* FIXME: Is the sdi actually part of tc3589x? */
parent = tc3589x->dev;
#endif
mop500_sdi_tc35892_init(parent);
}

static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Expand Down Expand Up @@ -353,12 +358,12 @@ U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);

static void __init mop500_i2c_init(void)
static void __init mop500_i2c_init(struct device *parent)
{
db8500_add_i2c0(&u8500_i2c0_data);
db8500_add_i2c1(&u8500_i2c1_data);
db8500_add_i2c2(&u8500_i2c2_data);
db8500_add_i2c3(&u8500_i2c3_data);
db8500_add_i2c0(parent, &u8500_i2c0_data);
db8500_add_i2c1(parent, &u8500_i2c1_data);
db8500_add_i2c2(parent, &u8500_i2c2_data);
db8500_add_i2c3(parent, &u8500_i2c3_data);
}

static struct gpio_keys_button mop500_gpio_keys[] = {
Expand Down Expand Up @@ -451,9 +456,9 @@ static struct pl022_ssp_controller ssp0_platform_data = {
.num_chipselect = 5,
};

static void __init mop500_spi_init(void)
static void __init mop500_spi_init(struct device *parent)
{
db8500_add_ssp0(&ssp0_platform_data);
db8500_add_ssp0(parent, &ssp0_platform_data);
}

#ifdef CONFIG_STE_DMA40
Expand Down Expand Up @@ -587,11 +592,11 @@ static struct amba_pl011_data uart2_plat = {
#endif
};

static void __init mop500_uart_init(void)
static void __init mop500_uart_init(struct device *parent)
{
db8500_add_uart0(&uart0_plat);
db8500_add_uart1(&uart1_plat);
db8500_add_uart2(&uart2_plat);
db8500_add_uart0(parent, &uart0_plat);
db8500_add_uart1(parent, &uart1_plat);
db8500_add_uart2(parent, &uart2_plat);
}

static struct platform_device *snowball_platform_devs[] __initdata = {
Expand All @@ -603,21 +608,26 @@ static struct platform_device *snowball_platform_devs[] __initdata = {

static void __init mop500_init_machine(void)
{
struct device *parent = NULL;
int i2c0_devs;
int i;

mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;

u8500_init_devices();
parent = u8500_init_devices();

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));

mop500_i2c_init();
mop500_sdi_init();
mop500_spi_init();
mop500_uart_init();
mop500_i2c_init(parent);
mop500_sdi_init(parent);
mop500_spi_init(parent);
mop500_uart_init(parent);

i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);

Expand All @@ -631,19 +641,24 @@ static void __init mop500_init_machine(void)

static void __init snowball_init_machine(void)
{
struct device *parent = NULL;
int i2c0_devs;
int i;

u8500_init_devices();
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));

mop500_i2c_init();
snowball_sdi_init();
mop500_spi_init();
mop500_uart_init();
mop500_i2c_init(parent);
snowball_sdi_init(parent);
mop500_spi_init(parent);
mop500_uart_init(parent);

i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Expand All @@ -656,7 +671,9 @@ static void __init snowball_init_machine(void)

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
Expand All @@ -665,17 +682,20 @@ static void __init hrefv60_init_machine(void)
*/
mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;

u8500_init_devices();
parent = u8500_init_devices();

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));

mop500_i2c_init();
hrefv60_sdi_init();
mop500_spi_init();
mop500_uart_init();
mop500_i2c_init(parent);
hrefv60_sdi_init(parent);
mop500_spi_init(parent);
mop500_uart_init(parent);

i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);

Expand Down
8 changes: 4 additions & 4 deletions arch/arm/mach-ux500/board-mop500.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-ux500/board-u5500-sdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
27 changes: 17 additions & 10 deletions arch/arm/mach-ux500/board-u5500.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand All @@ -126,20 +126,27 @@ 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;
int i;

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);

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));
Expand Down
36 changes: 29 additions & 7 deletions arch/arm/mach-ux500/cpu-db5500.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -212,14 +212,36 @@ static int usb_db5500_tx_dma_cfg[] = {
DB5500_DMA_DEV38_USB_OTG_OEP_8
};

void __init u5500_init_devices(void)
static const char *db5500_read_soc_id(void)
{
db5500_add_gpios();
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;
int i;

parent = db5500_soc_device_init();

db5500_add_gpios(parent);
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(parent);
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));

return parent;
}
Loading

0 comments on commit 281a9f7

Please sign in to comment.