Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226013
b: refs/heads/master
c: 01afdd1
h: refs/heads/master
i:
  226011: 6ac9f44
v: v3
  • Loading branch information
Rabin Vincent authored and Linus Walleij committed Dec 8, 2010
1 parent 6a6023a commit 233e7dc
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 140 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d568ae5362c00c5b0b8e61bceb1829c8051002e
refs/heads/master: 01afdd1353ca83904f430be4f6202d1a20912f4d
2 changes: 1 addition & 1 deletion trunk/arch/arm/mach-ux500/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

obj-y := clock.o cpu.o devices.o devices-common.o
obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o devices-db5500.o dma-db5500.o
obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o
obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o
obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o
obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o
Expand Down
33 changes: 24 additions & 9 deletions trunk/arch/arm/mach-ux500/cpu-db5500.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <asm/mach/map.h>

#include <plat/gpio.h>

#include <mach/hardware.h>
#include <mach/devices.h>
#include <mach/setup.h>
Expand Down Expand Up @@ -113,19 +115,32 @@ static struct platform_device mbox2_device = {
};

static struct platform_device *u5500_platform_devs[] __initdata = {
&u5500_gpio_devs[0],
&u5500_gpio_devs[1],
&u5500_gpio_devs[2],
&u5500_gpio_devs[3],
&u5500_gpio_devs[4],
&u5500_gpio_devs[5],
&u5500_gpio_devs[6],
&u5500_gpio_devs[7],
&mbox0_device,
&mbox1_device,
&mbox2_device,
};

static resource_size_t __initdata db5500_gpio_base[] = {
U5500_GPIOBANK0_BASE,
U5500_GPIOBANK1_BASE,
U5500_GPIOBANK2_BASE,
U5500_GPIOBANK3_BASE,
U5500_GPIOBANK4_BASE,
U5500_GPIOBANK5_BASE,
U5500_GPIOBANK6_BASE,
U5500_GPIOBANK7_BASE,
};

static void __init db5500_add_gpios(void)
{
struct nmk_gpio_platform_data pdata = {
/* No custom data yet */
};

dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base),
IRQ_DB5500_GPIO0, &pdata);
}

void __init u5500_map_io(void)
{
ux500_map_io();
Expand All @@ -135,8 +150,8 @@ void __init u5500_map_io(void)

void __init u5500_init_devices(void)
{
db5500_add_gpios();
db5500_dma_init();

db5500_add_rtc();

platform_add_devices(u5500_platform_devs,
Expand Down
32 changes: 23 additions & 9 deletions trunk/arch/arm/mach-ux500/cpu-db8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
#include "devices-db8500.h"

static struct platform_device *platform_devs[] __initdata = {
&u8500_gpio_devs[0],
&u8500_gpio_devs[1],
&u8500_gpio_devs[2],
&u8500_gpio_devs[3],
&u8500_gpio_devs[4],
&u8500_gpio_devs[5],
&u8500_gpio_devs[6],
&u8500_gpio_devs[7],
&u8500_gpio_devs[8],
&u8500_dma40_device,
};

Expand Down Expand Up @@ -141,6 +132,28 @@ void __init u8500_map_io(void)
get_db8500_asic_id();
}

static resource_size_t __initdata db8500_gpio_base[] = {
U8500_GPIOBANK0_BASE,
U8500_GPIOBANK1_BASE,
U8500_GPIOBANK2_BASE,
U8500_GPIOBANK3_BASE,
U8500_GPIOBANK4_BASE,
U8500_GPIOBANK5_BASE,
U8500_GPIOBANK6_BASE,
U8500_GPIOBANK7_BASE,
U8500_GPIOBANK8_BASE,
};

static void __init db8500_add_gpios(void)
{
struct nmk_gpio_platform_data pdata = {
/* No custom data yet */
};

dbx500_add_gpios(ARRAY_AND_SIZE(db8500_gpio_base),
IRQ_DB8500_GPIO0, &pdata);
}

/*
* This function is called from the board init
*/
Expand All @@ -164,6 +177,7 @@ void __init u8500_init_devices(void)
dma40_u8500ed_fixup();

db8500_add_rtc();
db8500_add_gpios();

platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));

Expand Down
38 changes: 38 additions & 0 deletions trunk/arch/arm/mach-ux500/devices-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <linux/platform_device.h>
#include <linux/amba/bus.h>

#include <plat/gpio.h>

#include <mach/hardware.h>

#include "devices-common.h"
Expand Down Expand Up @@ -105,3 +107,39 @@ dbx500_add_platform_device_4k1irq(const char *name, int id,
return dbx500_add_platform_device(name, id, pdata, resources,
ARRAY_SIZE(resources));
}

static struct platform_device *
dbx500_add_gpio(int id, resource_size_t addr, int irq,
struct nmk_gpio_platform_data *pdata)
{
struct resource resources[] = {
{
.start = addr,
.end = addr + 127,
.flags = IORESOURCE_MEM,
},
{
.start = irq,
.end = irq,
.flags = IORESOURCE_IRQ,
}
};

return platform_device_register_resndata(NULL, "gpio", id,
resources, ARRAY_SIZE(resources),
pdata, sizeof(*pdata));
}

void dbx500_add_gpios(resource_size_t *base, int num, int irq,
struct nmk_gpio_platform_data *pdata)
{
int first = 0;
int i;

for (i = 0; i < num; i++, first += 32, irq++) {
pdata->first_gpio = first;
pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);

dbx500_add_gpio(i, base[i], irq, pdata);
}
}
5 changes: 5 additions & 0 deletions trunk/arch/arm/mach-ux500/devices-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ dbx500_add_rtc(resource_size_t base, int irq)
return dbx500_add_amba_device("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);

#endif
46 changes: 0 additions & 46 deletions trunk/arch/arm/mach-ux500/devices-db5500.c

This file was deleted.

36 changes: 0 additions & 36 deletions trunk/arch/arm/mach-ux500/devices-db8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,6 @@

#include "ste-dma40-db8500.h"

static struct nmk_gpio_platform_data u8500_gpio_data[] = {
GPIO_DATA("GPIO-0-31", 0),
GPIO_DATA("GPIO-32-63", 32), /* 37..63 not routed to pin */
GPIO_DATA("GPIO-64-95", 64),
GPIO_DATA("GPIO-96-127", 96), /* 98..127 not routed to pin */
GPIO_DATA("GPIO-128-159", 128),
GPIO_DATA("GPIO-160-191", 160), /* 172..191 not routed to pin */
GPIO_DATA("GPIO-192-223", 192),
GPIO_DATA("GPIO-224-255", 224), /* 231..255 not routed to pin */
GPIO_DATA("GPIO-256-288", 256), /* 268..288 not routed to pin */
};

static struct resource u8500_gpio_resources[] = {
GPIO_RESOURCE(0),
GPIO_RESOURCE(1),
GPIO_RESOURCE(2),
GPIO_RESOURCE(3),
GPIO_RESOURCE(4),
GPIO_RESOURCE(5),
GPIO_RESOURCE(6),
GPIO_RESOURCE(7),
GPIO_RESOURCE(8),
};

struct platform_device u8500_gpio_devs[] = {
GPIO_DEVICE(0),
GPIO_DEVICE(1),
GPIO_DEVICE(2),
GPIO_DEVICE(3),
GPIO_DEVICE(4),
GPIO_DEVICE(5),
GPIO_DEVICE(6),
GPIO_DEVICE(7),
GPIO_DEVICE(8),
};

static struct resource dma40_resources[] = {
[0] = {
.start = U8500_DMA_BASE,
Expand Down
38 changes: 0 additions & 38 deletions trunk/arch/arm/mach-ux500/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,4 @@

#include <plat/gpio.h>

#define __GPIO_RESOURCE(soc, block) \
{ \
.start = soc##_GPIOBANK##block##_BASE, \
.end = soc##_GPIOBANK##block##_BASE + 127, \
.flags = IORESOURCE_MEM, \
}, \
{ \
.start = IRQ_GPIO##block, \
.end = IRQ_GPIO##block, \
.flags = IORESOURCE_IRQ, \
}

#define __GPIO_DEVICE(soc, block) \
{ \
.name = "gpio", \
.id = block, \
.num_resources = 2, \
.resource = &soc##_gpio_resources[block * 2], \
.dev = { \
.platform_data = &soc##_gpio_data[block], \
}, \
}

#define GPIO_DATA(_name, first) \
{ \
.name = _name, \
.first_gpio = first, \
.first_irq = NOMADIK_GPIO_TO_IRQ(first), \
}

#ifdef CONFIG_UX500_SOC_DB8500
#define GPIO_RESOURCE(block) __GPIO_RESOURCE(U8500, block)
#define GPIO_DEVICE(block) __GPIO_DEVICE(u8500, block)
#elif defined(CONFIG_UX500_SOC_DB5500)
#define GPIO_RESOURCE(block) __GPIO_RESOURCE(U5500, block)
#define GPIO_DEVICE(block) __GPIO_DEVICE(u5500, block)
#endif

#endif /* __ASM_ARCH_GPIO_H */
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-ux500/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ static inline bool cpu_is_u5500(void)
#endif
}

#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)

#endif

#endif /* __MACH_HARDWARE_H */

0 comments on commit 233e7dc

Please sign in to comment.