aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/Kconfig5
-rw-r--r--arch/arm/mach-omap1/Makefile1
-rw-r--r--arch/arm/mach-omap1/board-fsample.c2
-rw-r--r--arch/arm/mach-omap1/board-h3.c2
-rw-r--r--arch/arm/mach-omap1/board-innovator.c2
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c2
-rw-r--r--arch/arm/mach-omap1/devices.c71
-rw-r--r--arch/arm/mach-omap1/io.c4
-rw-r--r--arch/arm/mach-omap1/mailbox.c206
9 files changed, 257 insertions, 38 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index c7e229b00f6e..856c681ebbbc 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -22,6 +22,7 @@ comment "OMAP Board Type"
22config MACH_OMAP_INNOVATOR 22config MACH_OMAP_INNOVATOR
23 bool "TI Innovator" 23 bool "TI Innovator"
24 depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX) 24 depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX)
25 select OMAP_MCBSP
25 help 26 help
26 TI OMAP 1510 or 1610 Innovator board support. Say Y here if you 27 TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
27 have such a board. 28 have such a board.
@@ -29,6 +30,7 @@ config MACH_OMAP_INNOVATOR
29config MACH_OMAP_H2 30config MACH_OMAP_H2
30 bool "TI H2 Support" 31 bool "TI H2 Support"
31 depends on ARCH_OMAP1 && ARCH_OMAP16XX 32 depends on ARCH_OMAP1 && ARCH_OMAP16XX
33 select OMAP_MCBSP
32 help 34 help
33 TI OMAP 1610/1611B H2 board support. Say Y here if you have such 35 TI OMAP 1610/1611B H2 board support. Say Y here if you have such
34 a board. 36 a board.
@@ -36,6 +38,7 @@ config MACH_OMAP_H2
36config MACH_OMAP_H3 38config MACH_OMAP_H3
37 bool "TI H3 Support" 39 bool "TI H3 Support"
38 depends on ARCH_OMAP1 && ARCH_OMAP16XX 40 depends on ARCH_OMAP1 && ARCH_OMAP16XX
41 select GPIOEXPANDER_OMAP
39 help 42 help
40 TI OMAP 1710 H3 board support. Say Y here if you have such 43 TI OMAP 1710 H3 board support. Say Y here if you have such
41 a board. 44 a board.
@@ -43,7 +46,7 @@ config MACH_OMAP_H3
43config MACH_OMAP_OSK 46config MACH_OMAP_OSK
44 bool "TI OSK Support" 47 bool "TI OSK Support"
45 depends on ARCH_OMAP1 && ARCH_OMAP16XX 48 depends on ARCH_OMAP1 && ARCH_OMAP16XX
46 select TPS65010 49 select OMAP_MCBSP
47 help 50 help
48 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here 51 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
49 if you have such a board. 52 if you have such a board.
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 7165f74f78da..a8b9a00cea22 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -37,4 +37,3 @@ led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
37led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o 37led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
38led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o 38led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
39obj-$(CONFIG_LEDS) += $(led-y) 39obj-$(CONFIG_LEDS) += $(led-y)
40
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 62e42c7a628e..f65baa95986e 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -246,7 +246,7 @@ static void __init fsample_init_smc91x(void)
246 mdelay(50); 246 mdelay(50);
247} 247}
248 248
249void omap_fsample_init_irq(void) 249static void __init omap_fsample_init_irq(void)
250{ 250{
251 omap1_init_common_hw(); 251 omap1_init_common_hw();
252 omap_init_irq(); 252 omap_init_irq();
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 9d2346fb68f4..7b260b7c537b 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -455,7 +455,7 @@ static void __init h3_init_smc91x(void)
455 } 455 }
456} 456}
457 457
458void h3_init_irq(void) 458static void __init h3_init_irq(void)
459{ 459{
460 omap1_init_common_hw(); 460 omap1_init_common_hw();
461 omap_init_irq(); 461 omap_init_irq();
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index cb00530ad279..7e63a41e37c6 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -308,7 +308,7 @@ static void __init innovator_init_smc91x(void)
308 } 308 }
309} 309}
310 310
311void innovator_init_irq(void) 311static void __init innovator_init_irq(void)
312{ 312{
313 omap1_init_common_hw(); 313 omap1_init_common_hw();
314 omap_init_irq(); 314 omap_init_irq();
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index fa4be962df67..1d5c8d509722 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -246,7 +246,7 @@ static void __init perseus2_init_smc91x(void)
246 mdelay(50); 246 mdelay(50);
247} 247}
248 248
249void omap_perseus2_init_irq(void) 249static void __init omap_perseus2_init_irq(void)
250{ 250{
251 omap1_init_common_hw(); 251 omap1_init_common_hw();
252 omap_init_irq(); 252 omap_init_irq();
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 6dcd10ab4496..da8a3ac47e13 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -24,35 +24,6 @@
24#include <asm/arch/mux.h> 24#include <asm/arch/mux.h>
25#include <asm/arch/gpio.h> 25#include <asm/arch/gpio.h>
26 26
27#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
28
29static u64 irda_dmamask = 0xffffffff;
30
31static struct platform_device omap1610ir_device = {
32 .name = "omap1610-ir",
33 .id = -1,
34 .dev = {
35 .dma_mask = &irda_dmamask,
36 },
37};
38
39static void omap_init_irda(void)
40{
41 /* FIXME define and use a boot tag, members something like:
42 * u8 uart; // uart1, or uart3
43 * ... but driver only handles uart3 for now
44 * s16 fir_sel; // gpio for SIR vs FIR
45 * ... may prefer a callback for SIR/MIR/FIR mode select;
46 * while h2 uses a GPIO, H3 uses a gpio expander
47 */
48 if (machine_is_omap_h2()
49 || machine_is_omap_h3())
50 (void) platform_device_register(&omap1610ir_device);
51}
52#else
53static inline void omap_init_irda(void) {}
54#endif
55
56/*-------------------------------------------------------------------------*/ 27/*-------------------------------------------------------------------------*/
57 28
58#if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) 29#if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
@@ -90,6 +61,45 @@ static void omap_init_rtc(void)
90static inline void omap_init_rtc(void) {} 61static inline void omap_init_rtc(void) {}
91#endif 62#endif
92 63
64#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
65
66#if defined(CONFIG_ARCH_OMAP15XX)
67# define OMAP1_MBOX_SIZE 0x23
68# define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1
69#elif defined(CONFIG_ARCH_OMAP16XX)
70# define OMAP1_MBOX_SIZE 0x2f
71# define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
72#endif
73
74#define OMAP1_MBOX_BASE IO_ADDRESS(OMAP16XX_MAILBOX_BASE)
75
76static struct resource mbox_resources[] = {
77 {
78 .start = OMAP1_MBOX_BASE,
79 .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
80 .flags = IORESOURCE_MEM,
81 },
82 {
83 .start = INT_DSP_MAILBOX1,
84 .flags = IORESOURCE_IRQ,
85 },
86};
87
88static struct platform_device mbox_device = {
89 .name = "mailbox",
90 .id = -1,
91 .num_resources = ARRAY_SIZE(mbox_resources),
92 .resource = mbox_resources,
93};
94
95static inline void omap_init_mbox(void)
96{
97 platform_device_register(&mbox_device);
98}
99#else
100static inline void omap_init_mbox(void) { }
101#endif
102
93#if defined(CONFIG_OMAP_STI) 103#if defined(CONFIG_OMAP_STI)
94 104
95#define OMAP1_STI_BASE IO_ADDRESS(0xfffea000) 105#define OMAP1_STI_BASE IO_ADDRESS(0xfffea000)
@@ -154,7 +164,8 @@ static int __init omap1_init_devices(void)
154 /* please keep these calls, and their implementations above, 164 /* please keep these calls, and their implementations above,
155 * in alphabetical order so they're easier to sort through. 165 * in alphabetical order so they're easier to sort through.
156 */ 166 */
157 omap_init_irda(); 167
168 omap_init_mbox();
158 omap_init_rtc(); 169 omap_init_rtc();
159 omap_init_sti(); 170 omap_init_sti();
160 171
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index fab8b0b27cfb..81c4e738506c 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -17,11 +17,11 @@
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/arch/mux.h> 18#include <asm/arch/mux.h>
19#include <asm/arch/tc.h> 19#include <asm/arch/tc.h>
20#include <asm/arch/omapfb.h>
21 20
22extern int omap1_clk_init(void); 21extern int omap1_clk_init(void);
23extern void omap_check_revision(void); 22extern void omap_check_revision(void);
24extern void omap_sram_init(void); 23extern void omap_sram_init(void);
24extern void omapfb_reserve_sdram(void);
25 25
26/* 26/*
27 * The machine specific code may provide the extra mapping besides the 27 * The machine specific code may provide the extra mapping besides the
@@ -121,7 +121,7 @@ void __init omap1_map_common_io(void)
121#endif 121#endif
122 122
123 omap_sram_init(); 123 omap_sram_init();
124 omapfb_reserve_mem(); 124 omapfb_reserve_sdram();
125} 125}
126 126
127/* 127/*
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
new file mode 100644
index 000000000000..d3abf5609902
--- /dev/null
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -0,0 +1,206 @@
1/*
2 * Mailbox reservation modules for DSP
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/kernel.h>
13#include <linux/resource.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <asm/arch/mailbox.h>
17#include <asm/arch/irqs.h>
18#include <asm/io.h>
19
20#define MAILBOX_ARM2DSP1 0x00
21#define MAILBOX_ARM2DSP1b 0x04
22#define MAILBOX_DSP2ARM1 0x08
23#define MAILBOX_DSP2ARM1b 0x0c
24#define MAILBOX_DSP2ARM2 0x10
25#define MAILBOX_DSP2ARM2b 0x14
26#define MAILBOX_ARM2DSP1_Flag 0x18
27#define MAILBOX_DSP2ARM1_Flag 0x1c
28#define MAILBOX_DSP2ARM2_Flag 0x20
29
30unsigned long mbox_base;
31
32struct omap_mbox1_fifo {
33 unsigned long cmd;
34 unsigned long data;
35 unsigned long flag;
36};
37
38struct omap_mbox1_priv {
39 struct omap_mbox1_fifo tx_fifo;
40 struct omap_mbox1_fifo rx_fifo;
41};
42
43static inline int mbox_read_reg(unsigned int reg)
44{
45 return __raw_readw(mbox_base + reg);
46}
47
48static inline void mbox_write_reg(unsigned int val, unsigned int reg)
49{
50 __raw_writew(val, mbox_base + reg);
51}
52
53/* msg */
54static inline mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
55{
56 struct omap_mbox1_fifo *fifo =
57 &((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
58 mbox_msg_t msg;
59
60 msg = mbox_read_reg(fifo->data);
61 msg |= ((mbox_msg_t) mbox_read_reg(fifo->cmd)) << 16;
62
63 return msg;
64}
65
66static inline void
67omap1_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
68{
69 struct omap_mbox1_fifo *fifo =
70 &((struct omap_mbox1_priv *)mbox->priv)->tx_fifo;
71
72 mbox_write_reg(msg & 0xffff, fifo->data);
73 mbox_write_reg(msg >> 16, fifo->cmd);
74}
75
76static inline int omap1_mbox_fifo_empty(struct omap_mbox *mbox)
77{
78 return 0;
79}
80
81static inline int omap1_mbox_fifo_full(struct omap_mbox *mbox)
82{
83 struct omap_mbox1_fifo *fifo =
84 &((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
85
86 return (mbox_read_reg(fifo->flag));
87}
88
89/* irq */
90static inline void
91omap1_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
92{
93 if (irq == IRQ_RX)
94 enable_irq(mbox->irq);
95}
96
97static inline void
98omap1_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
99{
100 if (irq == IRQ_RX)
101 disable_irq(mbox->irq);
102}
103
104static inline int
105omap1_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
106{
107 if (irq == IRQ_TX)
108 return 0;
109 return 1;
110}
111
112static struct omap_mbox_ops omap1_mbox_ops = {
113 .type = OMAP_MBOX_TYPE1,
114 .fifo_read = omap1_mbox_fifo_read,
115 .fifo_write = omap1_mbox_fifo_write,
116 .fifo_empty = omap1_mbox_fifo_empty,
117 .fifo_full = omap1_mbox_fifo_full,
118 .enable_irq = omap1_mbox_enable_irq,
119 .disable_irq = omap1_mbox_disable_irq,
120 .is_irq = omap1_mbox_is_irq,
121};
122
123/* FIXME: the following struct should be created automatically by the user id */
124
125/* DSP */
126static struct omap_mbox1_priv omap1_mbox_dsp_priv = {
127 .tx_fifo = {
128 .cmd = MAILBOX_ARM2DSP1b,
129 .data = MAILBOX_ARM2DSP1,
130 .flag = MAILBOX_ARM2DSP1_Flag,
131 },
132 .rx_fifo = {
133 .cmd = MAILBOX_DSP2ARM1b,
134 .data = MAILBOX_DSP2ARM1,
135 .flag = MAILBOX_DSP2ARM1_Flag,
136 },
137};
138
139struct omap_mbox mbox_dsp_info = {
140 .name = "dsp",
141 .ops = &omap1_mbox_ops,
142 .priv = &omap1_mbox_dsp_priv,
143};
144EXPORT_SYMBOL(mbox_dsp_info);
145
146static int __init omap1_mbox_probe(struct platform_device *pdev)
147{
148 struct resource *res;
149 int ret = 0;
150
151 if (pdev->num_resources != 2) {
152 dev_err(&pdev->dev, "invalid number of resources: %d\n",
153 pdev->num_resources);
154 return -ENODEV;
155 }
156
157 /* MBOX base */
158 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
159 if (unlikely(!res)) {
160 dev_err(&pdev->dev, "invalid mem resource\n");
161 return -ENODEV;
162 }
163 mbox_base = res->start;
164
165 /* DSP IRQ */
166 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
167 if (unlikely(!res)) {
168 dev_err(&pdev->dev, "invalid irq resource\n");
169 return -ENODEV;
170 }
171 mbox_dsp_info.irq = res->start;
172
173 ret = omap_mbox_register(&mbox_dsp_info);
174
175 return ret;
176}
177
178static int omap1_mbox_remove(struct platform_device *pdev)
179{
180 omap_mbox_unregister(&mbox_dsp_info);
181
182 return 0;
183}
184
185static struct platform_driver omap1_mbox_driver = {
186 .probe = omap1_mbox_probe,
187 .remove = omap1_mbox_remove,
188 .driver = {
189 .name = "mailbox",
190 },
191};
192
193static int __init omap1_mbox_init(void)
194{
195 return platform_driver_register(&omap1_mbox_driver);
196}
197
198static void __exit omap1_mbox_exit(void)
199{
200 platform_driver_unregister(&omap1_mbox_driver);
201}
202
203module_init(omap1_mbox_init);
204module_exit(omap1_mbox_exit);
205
206MODULE_LICENSE("GPL");