diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/arm/mach-mxs/devices | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'arch/arm/mach-mxs/devices')
-rw-r--r-- | arch/arm/mach-mxs/devices/Kconfig | 25 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/Makefile | 10 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/amba-duart.c | 40 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-auart.c | 65 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-dma.c | 50 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-fec.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-flexcan.c | 51 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-gpio-mxs.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-mxs-i2c.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-mxs-mmc.c | 73 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-mxs-pwm.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-mxsfb.c | 47 |
12 files changed, 540 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig new file mode 100644 index 00000000000..acf9eea124c --- /dev/null +++ b/arch/arm/mach-mxs/devices/Kconfig | |||
@@ -0,0 +1,25 @@ | |||
1 | config MXS_HAVE_AMBA_DUART | ||
2 | bool | ||
3 | select ARM_AMBA | ||
4 | |||
5 | config MXS_HAVE_PLATFORM_AUART | ||
6 | bool | ||
7 | |||
8 | config MXS_HAVE_PLATFORM_FEC | ||
9 | bool | ||
10 | |||
11 | config MXS_HAVE_PLATFORM_FLEXCAN | ||
12 | select HAVE_CAN_FLEXCAN if CAN | ||
13 | bool | ||
14 | |||
15 | config MXS_HAVE_PLATFORM_MXS_I2C | ||
16 | bool | ||
17 | |||
18 | config MXS_HAVE_PLATFORM_MXS_MMC | ||
19 | bool | ||
20 | |||
21 | config MXS_HAVE_PLATFORM_MXS_PWM | ||
22 | bool | ||
23 | |||
24 | config MXS_HAVE_PLATFORM_MXSFB | ||
25 | bool | ||
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile new file mode 100644 index 00000000000..351915c683f --- /dev/null +++ b/arch/arm/mach-mxs/devices/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o | ||
2 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o | ||
3 | obj-y += platform-dma.o | ||
4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o | ||
5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | ||
6 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o | ||
7 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o | ||
8 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o | ||
9 | obj-y += platform-gpio-mxs.o | ||
10 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o | ||
diff --git a/arch/arm/mach-mxs/devices/amba-duart.c b/arch/arm/mach-mxs/devices/amba-duart.c new file mode 100644 index 00000000000..a559db09b49 --- /dev/null +++ b/arch/arm/mach-mxs/devices/amba-duart.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009-2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
5 | * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it under | ||
8 | * the terms of the GNU General Public License version 2 as published by the | ||
9 | * Free Software Foundation. | ||
10 | */ | ||
11 | #include <asm/irq.h> | ||
12 | #include <mach/mx23.h> | ||
13 | #include <mach/mx28.h> | ||
14 | #include <mach/devices-common.h> | ||
15 | |||
16 | #define MXS_AMBA_DUART_DEVICE(name, soc) \ | ||
17 | const struct amba_device name##_device __initconst = { \ | ||
18 | .dev = { \ | ||
19 | .init_name = "duart", \ | ||
20 | }, \ | ||
21 | .res = { \ | ||
22 | .start = soc ## _DUART_BASE_ADDR, \ | ||
23 | .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \ | ||
24 | .flags = IORESOURCE_MEM, \ | ||
25 | }, \ | ||
26 | .irq = {soc ## _INT_DUART, NO_IRQ}, \ | ||
27 | } | ||
28 | |||
29 | #ifdef CONFIG_SOC_IMX23 | ||
30 | MXS_AMBA_DUART_DEVICE(mx23_duart, MX23); | ||
31 | #endif | ||
32 | |||
33 | #ifdef CONFIG_SOC_IMX28 | ||
34 | MXS_AMBA_DUART_DEVICE(mx28_duart, MX28); | ||
35 | #endif | ||
36 | |||
37 | int __init mxs_add_duart(const struct amba_device *dev) | ||
38 | { | ||
39 | return mxs_add_amba_device(dev); | ||
40 | } | ||
diff --git a/arch/arm/mach-mxs/devices/platform-auart.c b/arch/arm/mach-mxs/devices/platform-auart.c new file mode 100644 index 00000000000..27608f5d2ac --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-auart.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Sascha Hauer <s.hauer@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <linux/dma-mapping.h> | ||
10 | #include <asm/sizes.h> | ||
11 | #include <mach/mx23.h> | ||
12 | #include <mach/mx28.h> | ||
13 | #include <mach/devices-common.h> | ||
14 | |||
15 | #define mxs_auart_data_entry_single(soc, _id, hwid) \ | ||
16 | { \ | ||
17 | .id = _id, \ | ||
18 | .iobase = soc ## _AUART ## hwid ## _BASE_ADDR, \ | ||
19 | .irq = soc ## _INT_AUART ## hwid, \ | ||
20 | } | ||
21 | |||
22 | #define mxs_auart_data_entry(soc, _id, hwid) \ | ||
23 | [_id] = mxs_auart_data_entry_single(soc, _id, hwid) | ||
24 | |||
25 | #ifdef CONFIG_SOC_IMX23 | ||
26 | const struct mxs_auart_data mx23_auart_data[] __initconst = { | ||
27 | #define mx23_auart_data_entry(_id, hwid) \ | ||
28 | mxs_auart_data_entry(MX23, _id, hwid) | ||
29 | mx23_auart_data_entry(0, 1), | ||
30 | mx23_auart_data_entry(1, 2), | ||
31 | }; | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_SOC_IMX28 | ||
35 | const struct mxs_auart_data mx28_auart_data[] __initconst = { | ||
36 | #define mx28_auart_data_entry(_id) \ | ||
37 | mxs_auart_data_entry(MX28, _id, _id) | ||
38 | mx28_auart_data_entry(0), | ||
39 | mx28_auart_data_entry(1), | ||
40 | mx28_auart_data_entry(2), | ||
41 | mx28_auart_data_entry(3), | ||
42 | mx28_auart_data_entry(4), | ||
43 | }; | ||
44 | #endif | ||
45 | |||
46 | struct platform_device *__init mxs_add_auart( | ||
47 | const struct mxs_auart_data *data) | ||
48 | { | ||
49 | struct resource res[] = { | ||
50 | { | ||
51 | .start = data->iobase, | ||
52 | .end = data->iobase + SZ_8K - 1, | ||
53 | .flags = IORESOURCE_MEM, | ||
54 | }, { | ||
55 | .start = data->irq, | ||
56 | .end = data->irq, | ||
57 | .flags = IORESOURCE_IRQ, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | return mxs_add_platform_device_dmamask("mxs-auart", data->id, | ||
62 | res, ARRAY_SIZE(res), NULL, 0, | ||
63 | DMA_BIT_MASK(32)); | ||
64 | } | ||
65 | |||
diff --git a/arch/arm/mach-mxs/devices/platform-dma.c b/arch/arm/mach-mxs/devices/platform-dma.c new file mode 100644 index 00000000000..6a0202b1016 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-dma.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it under | ||
5 | * the terms of the GNU General Public License version 2 as published by the | ||
6 | * Free Software Foundation. | ||
7 | */ | ||
8 | #include <linux/compiler.h> | ||
9 | #include <linux/dma-mapping.h> | ||
10 | #include <linux/err.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | #include <mach/mx23.h> | ||
14 | #include <mach/mx28.h> | ||
15 | #include <mach/devices-common.h> | ||
16 | |||
17 | static struct platform_device *__init mxs_add_dma(const char *devid, | ||
18 | resource_size_t base) | ||
19 | { | ||
20 | struct resource res[] = { | ||
21 | { | ||
22 | .start = base, | ||
23 | .end = base + SZ_8K - 1, | ||
24 | .flags = IORESOURCE_MEM, | ||
25 | } | ||
26 | }; | ||
27 | |||
28 | return mxs_add_platform_device_dmamask(devid, -1, | ||
29 | res, ARRAY_SIZE(res), NULL, 0, | ||
30 | DMA_BIT_MASK(32)); | ||
31 | } | ||
32 | |||
33 | static int __init mxs_add_mxs_dma(void) | ||
34 | { | ||
35 | char *apbh = "mxs-dma-apbh"; | ||
36 | char *apbx = "mxs-dma-apbx"; | ||
37 | |||
38 | if (cpu_is_mx23()) { | ||
39 | mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR); | ||
40 | mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR); | ||
41 | } | ||
42 | |||
43 | if (cpu_is_mx28()) { | ||
44 | mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR); | ||
45 | mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR); | ||
46 | } | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | arch_initcall(mxs_add_mxs_dma); | ||
diff --git a/arch/arm/mach-mxs/devices/platform-fec.c b/arch/arm/mach-mxs/devices/platform-fec.c new file mode 100644 index 00000000000..ae96a4fd8f1 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-fec.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <linux/dma-mapping.h> | ||
10 | #include <asm/sizes.h> | ||
11 | #include <mach/mx28.h> | ||
12 | #include <mach/devices-common.h> | ||
13 | |||
14 | #define mxs_fec_data_entry_single(soc, _id) \ | ||
15 | { \ | ||
16 | .id = _id, \ | ||
17 | .iobase = soc ## _ENET_MAC ## _id ## _BASE_ADDR, \ | ||
18 | .irq = soc ## _INT_ENET_MAC ## _id, \ | ||
19 | } | ||
20 | |||
21 | #define mxs_fec_data_entry(soc, _id) \ | ||
22 | [_id] = mxs_fec_data_entry_single(soc, _id) | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX28 | ||
25 | const struct mxs_fec_data mx28_fec_data[] __initconst = { | ||
26 | #define mx28_fec_data_entry(_id) \ | ||
27 | mxs_fec_data_entry(MX28, _id) | ||
28 | mx28_fec_data_entry(0), | ||
29 | mx28_fec_data_entry(1), | ||
30 | }; | ||
31 | #endif | ||
32 | |||
33 | struct platform_device *__init mxs_add_fec( | ||
34 | const struct mxs_fec_data *data, | ||
35 | const struct fec_platform_data *pdata) | ||
36 | { | ||
37 | struct resource res[] = { | ||
38 | { | ||
39 | .start = data->iobase, | ||
40 | .end = data->iobase + SZ_16K - 1, | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | }, { | ||
43 | .start = data->irq, | ||
44 | .end = data->irq, | ||
45 | .flags = IORESOURCE_IRQ, | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | return mxs_add_platform_device_dmamask("imx28-fec", data->id, | ||
50 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata), | ||
51 | DMA_BIT_MASK(32)); | ||
52 | } | ||
diff --git a/arch/arm/mach-mxs/devices/platform-flexcan.c b/arch/arm/mach-mxs/devices/platform-flexcan.c new file mode 100644 index 00000000000..43a6b4bae6f --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-flexcan.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010, 2011 Pengutronix, | ||
3 | * Marc Kleine-Budde <kernel@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/mx28.h> | ||
11 | #include <mach/devices-common.h> | ||
12 | |||
13 | #define mxs_flexcan_data_entry_single(soc, _id, _hwid, _size) \ | ||
14 | { \ | ||
15 | .id = _id, \ | ||
16 | .iobase = soc ## _CAN ## _hwid ## _BASE_ADDR, \ | ||
17 | .iosize = _size, \ | ||
18 | .irq = soc ## _INT_CAN ## _hwid, \ | ||
19 | } | ||
20 | |||
21 | #define mxs_flexcan_data_entry(soc, _id, _hwid, _size) \ | ||
22 | [_id] = mxs_flexcan_data_entry_single(soc, _id, _hwid, _size) | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX28 | ||
25 | const struct mxs_flexcan_data mx28_flexcan_data[] __initconst = { | ||
26 | #define mx28_flexcan_data_entry(_id, _hwid) \ | ||
27 | mxs_flexcan_data_entry_single(MX28, _id, _hwid, SZ_8K) | ||
28 | mx28_flexcan_data_entry(0, 0), | ||
29 | mx28_flexcan_data_entry(1, 1), | ||
30 | }; | ||
31 | #endif /* ifdef CONFIG_SOC_IMX28 */ | ||
32 | |||
33 | struct platform_device *__init mxs_add_flexcan( | ||
34 | const struct mxs_flexcan_data *data, | ||
35 | const struct flexcan_platform_data *pdata) | ||
36 | { | ||
37 | struct resource res[] = { | ||
38 | { | ||
39 | .start = data->iobase, | ||
40 | .end = data->iobase + data->iosize - 1, | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | }, { | ||
43 | .start = data->irq, | ||
44 | .end = data->irq, | ||
45 | .flags = IORESOURCE_IRQ, | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | return mxs_add_platform_device("flexcan", data->id, | ||
50 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); | ||
51 | } | ||
diff --git a/arch/arm/mach-mxs/devices/platform-gpio-mxs.c b/arch/arm/mach-mxs/devices/platform-gpio-mxs.c new file mode 100644 index 00000000000..ed0885e414e --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-gpio-mxs.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it under | ||
5 | * the terms of the GNU General Public License version 2 as published by the | ||
6 | * Free Software Foundation. | ||
7 | */ | ||
8 | #include <linux/compiler.h> | ||
9 | #include <linux/err.h> | ||
10 | #include <linux/init.h> | ||
11 | |||
12 | #include <mach/mx23.h> | ||
13 | #include <mach/mx28.h> | ||
14 | #include <mach/devices-common.h> | ||
15 | |||
16 | struct platform_device *__init mxs_add_gpio( | ||
17 | int id, resource_size_t iobase, int irq) | ||
18 | { | ||
19 | struct resource res[] = { | ||
20 | { | ||
21 | .start = iobase, | ||
22 | .end = iobase + SZ_8K - 1, | ||
23 | .flags = IORESOURCE_MEM, | ||
24 | }, { | ||
25 | .start = irq, | ||
26 | .end = irq, | ||
27 | .flags = IORESOURCE_IRQ, | ||
28 | }, | ||
29 | }; | ||
30 | |||
31 | return platform_device_register_resndata(&mxs_apbh_bus, | ||
32 | "gpio-mxs", id, res, ARRAY_SIZE(res), NULL, 0); | ||
33 | } | ||
34 | |||
35 | static int __init mxs_add_mxs_gpio(void) | ||
36 | { | ||
37 | if (cpu_is_mx23()) { | ||
38 | mxs_add_gpio(0, MX23_PINCTRL_BASE_ADDR, MX23_INT_GPIO0); | ||
39 | mxs_add_gpio(1, MX23_PINCTRL_BASE_ADDR, MX23_INT_GPIO1); | ||
40 | mxs_add_gpio(2, MX23_PINCTRL_BASE_ADDR, MX23_INT_GPIO2); | ||
41 | } | ||
42 | |||
43 | if (cpu_is_mx28()) { | ||
44 | mxs_add_gpio(0, MX28_PINCTRL_BASE_ADDR, MX28_INT_GPIO0); | ||
45 | mxs_add_gpio(1, MX28_PINCTRL_BASE_ADDR, MX28_INT_GPIO1); | ||
46 | mxs_add_gpio(2, MX28_PINCTRL_BASE_ADDR, MX28_INT_GPIO2); | ||
47 | mxs_add_gpio(3, MX28_PINCTRL_BASE_ADDR, MX28_INT_GPIO3); | ||
48 | mxs_add_gpio(4, MX28_PINCTRL_BASE_ADDR, MX28_INT_GPIO4); | ||
49 | } | ||
50 | |||
51 | return 0; | ||
52 | } | ||
53 | postcore_initcall(mxs_add_mxs_gpio); | ||
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-i2c.c b/arch/arm/mach-mxs/devices/platform-mxs-i2c.c new file mode 100644 index 00000000000..79222ec8ede --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxs-i2c.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Pengutronix | ||
3 | * Wolfram Sang <w.sang@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/mx28.h> | ||
11 | #include <mach/devices-common.h> | ||
12 | |||
13 | #define mxs_i2c_data_entry_single(soc, _id) \ | ||
14 | { \ | ||
15 | .id = _id, \ | ||
16 | .iobase = soc ## _I2C ## _id ## _BASE_ADDR, \ | ||
17 | .errirq = soc ## _INT_I2C ## _id ## _ERROR, \ | ||
18 | .dmairq = soc ## _INT_I2C ## _id ## _DMA, \ | ||
19 | } | ||
20 | |||
21 | #define mxs_i2c_data_entry(soc, _id) \ | ||
22 | [_id] = mxs_i2c_data_entry_single(soc, _id) | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX28 | ||
25 | const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst = { | ||
26 | mxs_i2c_data_entry(MX28, 0), | ||
27 | mxs_i2c_data_entry(MX28, 1), | ||
28 | }; | ||
29 | #endif | ||
30 | |||
31 | struct platform_device *__init mxs_add_mxs_i2c( | ||
32 | const struct mxs_mxs_i2c_data *data) | ||
33 | { | ||
34 | struct resource res[] = { | ||
35 | { | ||
36 | .start = data->iobase, | ||
37 | .end = data->iobase + SZ_8K - 1, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, { | ||
40 | .start = data->errirq, | ||
41 | .end = data->errirq, | ||
42 | .flags = IORESOURCE_IRQ, | ||
43 | }, { | ||
44 | .start = data->dmairq, | ||
45 | .end = data->dmairq, | ||
46 | .flags = IORESOURCE_IRQ, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | return mxs_add_platform_device("mxs-i2c", data->id, res, | ||
51 | ARRAY_SIZE(res), NULL, 0); | ||
52 | } | ||
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-mmc.c b/arch/arm/mach-mxs/devices/platform-mxs-mmc.c new file mode 100644 index 00000000000..382dacbeca2 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxs-mmc.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
5 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it under | ||
8 | * the terms of the GNU General Public License version 2 as published by the | ||
9 | * Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/compiler.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/init.h> | ||
15 | |||
16 | #include <mach/mx23.h> | ||
17 | #include <mach/mx28.h> | ||
18 | #include <mach/devices-common.h> | ||
19 | |||
20 | #define mxs_mxs_mmc_data_entry_single(soc, _id, hwid) \ | ||
21 | { \ | ||
22 | .id = _id, \ | ||
23 | .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \ | ||
24 | .dma = soc ## _DMA_SSP ## hwid, \ | ||
25 | .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \ | ||
26 | .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \ | ||
27 | } | ||
28 | |||
29 | #define mxs_mxs_mmc_data_entry(soc, _id, hwid) \ | ||
30 | [_id] = mxs_mxs_mmc_data_entry_single(soc, _id, hwid) | ||
31 | |||
32 | |||
33 | #ifdef CONFIG_SOC_IMX23 | ||
34 | const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = { | ||
35 | mxs_mxs_mmc_data_entry(MX23, 0, 1), | ||
36 | mxs_mxs_mmc_data_entry(MX23, 1, 2), | ||
37 | }; | ||
38 | #endif | ||
39 | |||
40 | #ifdef CONFIG_SOC_IMX28 | ||
41 | const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = { | ||
42 | mxs_mxs_mmc_data_entry(MX28, 0, 0), | ||
43 | mxs_mxs_mmc_data_entry(MX28, 1, 1), | ||
44 | }; | ||
45 | #endif | ||
46 | |||
47 | struct platform_device *__init mxs_add_mxs_mmc( | ||
48 | const struct mxs_mxs_mmc_data *data, | ||
49 | const struct mxs_mmc_platform_data *pdata) | ||
50 | { | ||
51 | struct resource res[] = { | ||
52 | { | ||
53 | .start = data->iobase, | ||
54 | .end = data->iobase + SZ_8K - 1, | ||
55 | .flags = IORESOURCE_MEM, | ||
56 | }, { | ||
57 | .start = data->dma, | ||
58 | .end = data->dma, | ||
59 | .flags = IORESOURCE_DMA, | ||
60 | }, { | ||
61 | .start = data->irq_err, | ||
62 | .end = data->irq_err, | ||
63 | .flags = IORESOURCE_IRQ, | ||
64 | }, { | ||
65 | .start = data->irq_dma, | ||
66 | .end = data->irq_dma, | ||
67 | .flags = IORESOURCE_IRQ, | ||
68 | }, | ||
69 | }; | ||
70 | |||
71 | return mxs_add_platform_device("mxs-mmc", data->id, | ||
72 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); | ||
73 | } | ||
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-pwm.c b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c new file mode 100644 index 00000000000..680f5a90293 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Sascha Hauer <s.hauer@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/devices-common.h> | ||
11 | |||
12 | struct platform_device *__init mxs_add_mxs_pwm(resource_size_t iobase, int id) | ||
13 | { | ||
14 | struct resource res = { | ||
15 | .flags = IORESOURCE_MEM, | ||
16 | }; | ||
17 | |||
18 | res.start = iobase + 0x10 + 0x20 * id; | ||
19 | res.end = res.start + 0x1f; | ||
20 | |||
21 | return mxs_add_platform_device("mxs-pwm", id, &res, 1, NULL, 0); | ||
22 | } | ||
diff --git a/arch/arm/mach-mxs/devices/platform-mxsfb.c b/arch/arm/mach-mxs/devices/platform-mxsfb.c new file mode 100644 index 00000000000..5a75b7180f7 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxsfb.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it under | ||
5 | * the terms of the GNU General Public License version 2 as published by the | ||
6 | * Free Software Foundation. | ||
7 | */ | ||
8 | #include <linux/dma-mapping.h> | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/mx23.h> | ||
11 | #include <mach/mx28.h> | ||
12 | #include <mach/devices-common.h> | ||
13 | #include <mach/mxsfb.h> | ||
14 | |||
15 | #ifdef CONFIG_SOC_IMX23 | ||
16 | struct platform_device *__init mx23_add_mxsfb( | ||
17 | const struct mxsfb_platform_data *pdata) | ||
18 | { | ||
19 | struct resource res[] = { | ||
20 | { | ||
21 | .start = MX23_LCDIF_BASE_ADDR, | ||
22 | .end = MX23_LCDIF_BASE_ADDR + SZ_8K - 1, | ||
23 | .flags = IORESOURCE_MEM, | ||
24 | }, | ||
25 | }; | ||
26 | |||
27 | return mxs_add_platform_device_dmamask("imx23-fb", -1, | ||
28 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
29 | } | ||
30 | #endif /* ifdef CONFIG_SOC_IMX23 */ | ||
31 | |||
32 | #ifdef CONFIG_SOC_IMX28 | ||
33 | struct platform_device *__init mx28_add_mxsfb( | ||
34 | const struct mxsfb_platform_data *pdata) | ||
35 | { | ||
36 | struct resource res[] = { | ||
37 | { | ||
38 | .start = MX28_LCDIF_BASE_ADDR, | ||
39 | .end = MX28_LCDIF_BASE_ADDR + SZ_8K - 1, | ||
40 | .flags = IORESOURCE_MEM, | ||
41 | }, | ||
42 | }; | ||
43 | |||
44 | return mxs_add_platform_device_dmamask("imx28-fb", -1, | ||
45 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
46 | } | ||
47 | #endif /* ifdef CONFIG_SOC_IMX28 */ | ||