diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-06-04 01:16:41 -0400 |
---|---|---|
committer | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-07-04 11:43:27 -0400 |
commit | a53b8e3b995f8b7c8a8c4ef5aa367958e46139b3 (patch) | |
tree | b6fea956eb93a06aa4b7d66338e27717e140b9d5 /arch/arm | |
parent | 48cb1258e8b0f8c81cfb699b42326c5b2147b3f8 (diff) |
OMAP: New twl-common for common TWL configuration
Introduce a new file, which will be used to configure
common pmic (TWL) devices, regulators, and TWL audio.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/common-board-devices.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-omap2/common-board-devices.h | 26 | ||||
-rw-r--r-- | arch/arm/mach-omap2/twl-common.c | 46 | ||||
-rw-r--r-- | arch/arm/mach-omap2/twl-common.h | 28 |
5 files changed, 77 insertions, 46 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index adbe82d72d4e..ff1466fbf5c5 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -269,4 +269,4 @@ obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o | |||
269 | disp-$(CONFIG_OMAP2_DSS) := display.o | 269 | disp-$(CONFIG_OMAP2_DSS) := display.o |
270 | obj-y += $(disp-m) $(disp-y) | 270 | obj-y += $(disp-m) $(disp-y) |
271 | 271 | ||
272 | obj-y += common-board-devices.o | 272 | obj-y += common-board-devices.o twl-common.o |
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c index 0043fa8e3703..bcb0c5817167 100644 --- a/arch/arm/mach-omap2/common-board-devices.c +++ b/arch/arm/mach-omap2/common-board-devices.c | |||
@@ -20,36 +20,15 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/i2c/twl.h> | ||
25 | |||
26 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
27 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/ads7846.h> | 25 | #include <linux/spi/ads7846.h> |
29 | 26 | ||
30 | #include <plat/i2c.h> | ||
31 | #include <plat/mcspi.h> | 27 | #include <plat/mcspi.h> |
32 | #include <plat/nand.h> | 28 | #include <plat/nand.h> |
33 | 29 | ||
34 | #include "common-board-devices.h" | 30 | #include "common-board-devices.h" |
35 | 31 | ||
36 | static struct i2c_board_info __initdata pmic_i2c_board_info = { | ||
37 | .addr = 0x48, | ||
38 | .flags = I2C_CLIENT_WAKE, | ||
39 | }; | ||
40 | |||
41 | void __init omap_pmic_init(int bus, u32 clkrate, | ||
42 | const char *pmic_type, int pmic_irq, | ||
43 | struct twl4030_platform_data *pmic_data) | ||
44 | { | ||
45 | strncpy(pmic_i2c_board_info.type, pmic_type, | ||
46 | sizeof(pmic_i2c_board_info.type)); | ||
47 | pmic_i2c_board_info.irq = pmic_irq; | ||
48 | pmic_i2c_board_info.platform_data = pmic_data; | ||
49 | |||
50 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); | ||
51 | } | ||
52 | |||
53 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ | 32 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ |
54 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | 33 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
55 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | 34 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h index 679719051df5..a0b4a42836ab 100644 --- a/arch/arm/mach-omap2/common-board-devices.h +++ b/arch/arm/mach-omap2/common-board-devices.h | |||
@@ -1,33 +1,11 @@ | |||
1 | #ifndef __OMAP_COMMON_BOARD_DEVICES__ | 1 | #ifndef __OMAP_COMMON_BOARD_DEVICES__ |
2 | #define __OMAP_COMMON_BOARD_DEVICES__ | 2 | #define __OMAP_COMMON_BOARD_DEVICES__ |
3 | 3 | ||
4 | #include "twl-common.h" | ||
5 | |||
4 | #define NAND_BLOCK_SIZE SZ_128K | 6 | #define NAND_BLOCK_SIZE SZ_128K |
5 | 7 | ||
6 | struct twl4030_platform_data; | ||
7 | struct mtd_partition; | 8 | struct mtd_partition; |
8 | |||
9 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | ||
10 | struct twl4030_platform_data *pmic_data); | ||
11 | |||
12 | static inline void omap2_pmic_init(const char *pmic_type, | ||
13 | struct twl4030_platform_data *pmic_data) | ||
14 | { | ||
15 | omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data); | ||
16 | } | ||
17 | |||
18 | static inline void omap3_pmic_init(const char *pmic_type, | ||
19 | struct twl4030_platform_data *pmic_data) | ||
20 | { | ||
21 | omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); | ||
22 | } | ||
23 | |||
24 | static inline void omap4_pmic_init(const char *pmic_type, | ||
25 | struct twl4030_platform_data *pmic_data) | ||
26 | { | ||
27 | /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ | ||
28 | omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); | ||
29 | } | ||
30 | |||
31 | struct ads7846_platform_data; | 9 | struct ads7846_platform_data; |
32 | 10 | ||
33 | void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, | 11 | void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, |
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c new file mode 100644 index 000000000000..4f7b24c1a264 --- /dev/null +++ b/arch/arm/mach-omap2/twl-common.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * twl-common.c | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments, Inc.. | ||
5 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * version 2 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/i2c/twl.h> | ||
25 | #include <linux/gpio.h> | ||
26 | |||
27 | #include <plat/i2c.h> | ||
28 | |||
29 | #include "twl-common.h" | ||
30 | |||
31 | static struct i2c_board_info __initdata pmic_i2c_board_info = { | ||
32 | .addr = 0x48, | ||
33 | .flags = I2C_CLIENT_WAKE, | ||
34 | }; | ||
35 | |||
36 | void __init omap_pmic_init(int bus, u32 clkrate, | ||
37 | const char *pmic_type, int pmic_irq, | ||
38 | struct twl4030_platform_data *pmic_data) | ||
39 | { | ||
40 | strncpy(pmic_i2c_board_info.type, pmic_type, | ||
41 | sizeof(pmic_i2c_board_info.type)); | ||
42 | pmic_i2c_board_info.irq = pmic_irq; | ||
43 | pmic_i2c_board_info.platform_data = pmic_data; | ||
44 | |||
45 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); | ||
46 | } | ||
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h new file mode 100644 index 000000000000..e9fe2ab4944a --- /dev/null +++ b/arch/arm/mach-omap2/twl-common.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef __OMAP_PMIC_COMMON__ | ||
2 | #define __OMAP_PMIC_COMMON__ | ||
3 | |||
4 | struct twl4030_platform_data; | ||
5 | |||
6 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | ||
7 | struct twl4030_platform_data *pmic_data); | ||
8 | |||
9 | static inline void omap2_pmic_init(const char *pmic_type, | ||
10 | struct twl4030_platform_data *pmic_data) | ||
11 | { | ||
12 | omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data); | ||
13 | } | ||
14 | |||
15 | static inline void omap3_pmic_init(const char *pmic_type, | ||
16 | struct twl4030_platform_data *pmic_data) | ||
17 | { | ||
18 | omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); | ||
19 | } | ||
20 | |||
21 | static inline void omap4_pmic_init(const char *pmic_type, | ||
22 | struct twl4030_platform_data *pmic_data) | ||
23 | { | ||
24 | /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ | ||
25 | omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); | ||
26 | } | ||
27 | |||
28 | #endif /* __OMAP_PMIC_COMMON__ */ | ||