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/Makefile4
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c17
-rw-r--r--arch/arm/mach-omap1/board-osk.c18
-rw-r--r--arch/arm/mach-omap1/fpga.c10
-rw-r--r--arch/arm/mach-omap1/mcbsp.c280
-rw-r--r--arch/arm/mach-omap1/pm.c7
-rw-r--r--arch/arm/mach-omap1/sram.S57
7 files changed, 368 insertions, 25 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index c06f5254c0f3..1bda8f5d7546 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,9 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o clock.o irq.o mux.o serial.o devices.o 6obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
7
8obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
7 9
8obj-$(CONFIG_OMAP_MPU_TIMER) += time.o 10obj-$(CONFIG_OMAP_MPU_TIMER) += time.o
9obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 11obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index bcb984f2300f..3f39e0e79c9f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mutex.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/input.h> 15#include <linux/input.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
@@ -202,7 +203,7 @@ static struct omap_board_config_kernel nokia770_config[] __initdata = {
202#define AMPLIFIER_CTRL_GPIO 58 203#define AMPLIFIER_CTRL_GPIO 58
203 204
204static struct clk *dspxor_ck; 205static struct clk *dspxor_ck;
205static DECLARE_MUTEX(audio_pwr_sem); 206static DEFINE_MUTEX(audio_pwr_lock);
206/* 207/*
207 * audio_pwr_state 208 * audio_pwr_state
208 * +--+-------------------------+---------------------------------------+ 209 * +--+-------------------------+---------------------------------------+
@@ -218,7 +219,7 @@ static DECLARE_MUTEX(audio_pwr_sem);
218static int audio_pwr_state = -1; 219static int audio_pwr_state = -1;
219 220
220/* 221/*
221 * audio_pwr_up / down should be called under audio_pwr_sem 222 * audio_pwr_up / down should be called under audio_pwr_lock
222 */ 223 */
223static void nokia770_audio_pwr_up(void) 224static void nokia770_audio_pwr_up(void)
224{ 225{
@@ -237,11 +238,11 @@ static void nokia770_audio_pwr_up(void)
237 238
238static void codec_delayed_power_down(struct work_struct *work) 239static void codec_delayed_power_down(struct work_struct *work)
239{ 240{
240 down(&audio_pwr_sem); 241 mutex_lock(&audio_pwr_lock);
241 if (audio_pwr_state == -1) 242 if (audio_pwr_state == -1)
242 aic23_power_down(); 243 aic23_power_down();
243 clk_disable(dspxor_ck); 244 clk_disable(dspxor_ck);
244 up(&audio_pwr_sem); 245 mutex_unlock(&audio_pwr_lock);
245} 246}
246 247
247static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); 248static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
@@ -258,19 +259,19 @@ static void nokia770_audio_pwr_down(void)
258static int 259static int
259nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) 260nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
260{ 261{
261 down(&audio_pwr_sem); 262 mutex_lock(&audio_pwr_lock);
262 if (audio_pwr_state == -1) 263 if (audio_pwr_state == -1)
263 nokia770_audio_pwr_up(); 264 nokia770_audio_pwr_up();
264 /* force audio_pwr_state = 0, even if it was 1. */ 265 /* force audio_pwr_state = 0, even if it was 1. */
265 audio_pwr_state = 0; 266 audio_pwr_state = 0;
266 up(&audio_pwr_sem); 267 mutex_unlock(&audio_pwr_lock);
267 return 0; 268 return 0;
268} 269}
269 270
270static int 271static int
271nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) 272nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
272{ 273{
273 down(&audio_pwr_sem); 274 mutex_lock(&audio_pwr_lock);
274 switch (stage) { 275 switch (stage) {
275 case 1: 276 case 1:
276 if (audio_pwr_state == 0) 277 if (audio_pwr_state == 0)
@@ -283,7 +284,7 @@ nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
283 } 284 }
284 break; 285 break;
285 } 286 }
286 up(&audio_pwr_sem); 287 mutex_unlock(&audio_pwr_lock);
287 return 0; 288 return 0;
288} 289}
289 290
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index a66505f58b15..845c66371ca3 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -267,13 +267,17 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {
267 267
268static void __init osk_init_smc91x(void) 268static void __init osk_init_smc91x(void)
269{ 269{
270 u32 l;
271
270 if ((gpio_request(0, "smc_irq")) < 0) { 272 if ((gpio_request(0, "smc_irq")) < 0) {
271 printk("Error requesting gpio 0 for smc91x irq\n"); 273 printk("Error requesting gpio 0 for smc91x irq\n");
272 return; 274 return;
273 } 275 }
274 276
275 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 277 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
276 EMIFS_CCS(1) |= 0x3; 278 l = omap_readl(EMIFS_CCS(1));
279 l |= 0x3;
280 omap_writel(l, EMIFS_CCS(1));
277} 281}
278 282
279static void __init osk_init_cf(void) 283static void __init osk_init_cf(void)
@@ -526,20 +530,26 @@ static void __init osk_mistral_init(void) { }
526 530
527static void __init osk_init(void) 531static void __init osk_init(void)
528{ 532{
533 u32 l;
534
529 /* Workaround for wrong CS3 (NOR flash) timing 535 /* Workaround for wrong CS3 (NOR flash) timing
530 * There are some U-Boot versions out there which configure 536 * There are some U-Boot versions out there which configure
531 * wrong CS3 memory timings. This mainly leads to CRC 537 * wrong CS3 memory timings. This mainly leads to CRC
532 * or similar errors if you use NOR flash (e.g. with JFFS2) 538 * or similar errors if you use NOR flash (e.g. with JFFS2)
533 */ 539 */
534 if (EMIFS_CCS(3) != EMIFS_CS3_VAL) 540 l = omap_readl(EMIFS_CCS(3));
535 EMIFS_CCS(3) = EMIFS_CS3_VAL; 541 if (l != EMIFS_CS3_VAL)
542 omap_writel(EMIFS_CS3_VAL, EMIFS_CCS(3));
536 543
537 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 544 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
538 osk_flash_resource.end += SZ_32M - 1; 545 osk_flash_resource.end += SZ_32M - 1;
539 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 546 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
540 omap_board_config = osk_config; 547 omap_board_config = osk_config;
541 omap_board_config_size = ARRAY_SIZE(osk_config); 548 omap_board_config_size = ARRAY_SIZE(osk_config);
542 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 549
550 l = omap_readl(USB_TRANSCEIVER_CTRL);
551 l |= (3 << 1);
552 omap_writel(l, USB_TRANSCEIVER_CTRL);
543 553
544 /* irq for tps65010 chip */ 554 /* irq for tps65010 chip */
545 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ 555 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 30e188109046..0cf62ef5ecb7 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -32,7 +32,7 @@
32 32
33static void fpga_mask_irq(unsigned int irq) 33static void fpga_mask_irq(unsigned int irq)
34{ 34{
35 irq -= OMAP1510_IH_FPGA_BASE; 35 irq -= OMAP_FPGA_IRQ_BASE;
36 36
37 if (irq < 8) 37 if (irq < 8)
38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) 38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO)
@@ -65,7 +65,7 @@ static void fpga_ack_irq(unsigned int irq)
65 65
66static void fpga_unmask_irq(unsigned int irq) 66static void fpga_unmask_irq(unsigned int irq)
67{ 67{
68 irq -= OMAP1510_IH_FPGA_BASE; 68 irq -= OMAP_FPGA_IRQ_BASE;
69 69
70 if (irq < 8) 70 if (irq < 8)
71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)), 71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)),
@@ -95,8 +95,8 @@ void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
95 if (!stat) 95 if (!stat)
96 return; 96 return;
97 97
98 for (fpga_irq = OMAP1510_IH_FPGA_BASE; 98 for (fpga_irq = OMAP_FPGA_IRQ_BASE;
99 (fpga_irq < (OMAP1510_IH_FPGA_BASE + NR_FPGA_IRQS)) && stat; 99 (fpga_irq < OMAP_FPGA_IRQ_END) && stat;
100 fpga_irq++, stat >>= 1) { 100 fpga_irq++, stat >>= 1) {
101 if (stat & 1) { 101 if (stat & 1) {
102 d = irq_desc + fpga_irq; 102 d = irq_desc + fpga_irq;
@@ -151,7 +151,7 @@ void omap1510_fpga_init_irq(void)
151 __raw_writeb(0, OMAP1510_FPGA_IMR_HI); 151 __raw_writeb(0, OMAP1510_FPGA_IMR_HI);
152 __raw_writeb(0, INNOVATOR_FPGA_IMR2); 152 __raw_writeb(0, INNOVATOR_FPGA_IMR2);
153 153
154 for (i = OMAP1510_IH_FPGA_BASE; i < (OMAP1510_IH_FPGA_BASE + NR_FPGA_IRQS); i++) { 154 for (i = OMAP_FPGA_IRQ_BASE; i < OMAP_FPGA_IRQ_END; i++) {
155 155
156 if (i == OMAP1510_INT_FPGA_TS) { 156 if (i == OMAP1510_INT_FPGA_TS) {
157 /* 157 /*
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
new file mode 100644
index 000000000000..2d2c2522b048
--- /dev/null
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -0,0 +1,280 @@
1/*
2 * linux/arch/arm/mach-omap1/mcbsp.c
3 *
4 * Copyright (C) 2008 Instituto Nokia de Tecnologia
5 * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Multichannel mode not supported.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19
20#include <asm/arch/dma.h>
21#include <asm/arch/mux.h>
22#include <asm/arch/cpu.h>
23#include <asm/arch/mcbsp.h>
24#include <asm/arch/dsp_common.h>
25
26#define DPS_RSTCT2_PER_EN (1 << 0)
27#define DSP_RSTCT2_WD_PER_EN (1 << 1)
28
29struct mcbsp_internal_clk {
30 struct clk clk;
31 struct clk **childs;
32 int n_childs;
33};
34
35#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
36static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
37{
38 const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
39 int i;
40
41 mclk->n_childs = ARRAY_SIZE(clk_names);
42 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
43 GFP_KERNEL);
44
45 for (i = 0; i < mclk->n_childs; i++) {
46 /* We fake a platform device to get correct device id */
47 struct platform_device pdev;
48
49 pdev.dev.bus = &platform_bus_type;
50 pdev.id = mclk->clk.id;
51 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
52 if (IS_ERR(mclk->childs[i]))
53 printk(KERN_ERR "Could not get clock %s (%d).\n",
54 clk_names[i], mclk->clk.id);
55 }
56}
57
58static int omap_mcbsp_clk_enable(struct clk *clk)
59{
60 struct mcbsp_internal_clk *mclk = container_of(clk,
61 struct mcbsp_internal_clk, clk);
62 int i;
63
64 for (i = 0; i < mclk->n_childs; i++)
65 clk_enable(mclk->childs[i]);
66 return 0;
67}
68
69static void omap_mcbsp_clk_disable(struct clk *clk)
70{
71 struct mcbsp_internal_clk *mclk = container_of(clk,
72 struct mcbsp_internal_clk, clk);
73 int i;
74
75 for (i = 0; i < mclk->n_childs; i++)
76 clk_disable(mclk->childs[i]);
77}
78
79static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
80 {
81 .clk = {
82 .name = "mcbsp_clk",
83 .id = 1,
84 .enable = omap_mcbsp_clk_enable,
85 .disable = omap_mcbsp_clk_disable,
86 },
87 },
88 {
89 .clk = {
90 .name = "mcbsp_clk",
91 .id = 3,
92 .enable = omap_mcbsp_clk_enable,
93 .disable = omap_mcbsp_clk_disable,
94 },
95 },
96};
97
98#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
99#else
100#define omap_mcbsp_clks_size 0
101static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
102static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
103{ }
104#endif
105
106static int omap1_mcbsp_check(unsigned int id)
107{
108 /* REVISIT: Check correctly for number of registered McBSPs */
109 if (cpu_is_omap730()) {
110 if (id > OMAP_MAX_MCBSP_COUNT - 2) {
111 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n",
112 id + 1);
113 return -ENODEV;
114 }
115 return 0;
116 }
117
118 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
119 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
120 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n",
121 id + 1);
122 return -ENODEV;
123 }
124 return 0;
125 }
126
127 return -ENODEV;
128}
129
130static void omap1_mcbsp_request(unsigned int id)
131{
132 /*
133 * On 1510, 1610 and 1710, McBSP1 and McBSP3
134 * are DSP public peripherals.
135 */
136 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
137 omap_dsp_request_mem();
138 /*
139 * DSP external peripheral reset
140 * FIXME: This should be moved to dsp code
141 */
142 __raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN |
143 DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2);
144 }
145}
146
147static void omap1_mcbsp_free(unsigned int id)
148{
149 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
150 omap_dsp_release_mem();
151}
152
153static struct omap_mcbsp_ops omap1_mcbsp_ops = {
154 .check = omap1_mcbsp_check,
155 .request = omap1_mcbsp_request,
156 .free = omap1_mcbsp_free,
157};
158
159#ifdef CONFIG_ARCH_OMAP730
160static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
161 {
162 .virt_base = io_p2v(OMAP730_MCBSP1_BASE),
163 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
164 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
165 .rx_irq = INT_730_McBSP1RX,
166 .tx_irq = INT_730_McBSP1TX,
167 .ops = &omap1_mcbsp_ops,
168 },
169 {
170 .virt_base = io_p2v(OMAP730_MCBSP2_BASE),
171 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
172 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
173 .rx_irq = INT_730_McBSP2RX,
174 .tx_irq = INT_730_McBSP2TX,
175 .ops = &omap1_mcbsp_ops,
176 },
177};
178#define OMAP730_MCBSP_PDATA_SZ ARRAY_SIZE(omap730_mcbsp_pdata)
179#else
180#define omap730_mcbsp_pdata NULL
181#define OMAP730_MCBSP_PDATA_SZ 0
182#endif
183
184#ifdef CONFIG_ARCH_OMAP15XX
185static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
186 {
187 .virt_base = OMAP1510_MCBSP1_BASE,
188 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
189 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
190 .rx_irq = INT_McBSP1RX,
191 .tx_irq = INT_McBSP1TX,
192 .ops = &omap1_mcbsp_ops,
193 .clk_name = "mcbsp_clk",
194 },
195 {
196 .virt_base = io_p2v(OMAP1510_MCBSP2_BASE),
197 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
198 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
199 .rx_irq = INT_1510_SPI_RX,
200 .tx_irq = INT_1510_SPI_TX,
201 .ops = &omap1_mcbsp_ops,
202 },
203 {
204 .virt_base = OMAP1510_MCBSP3_BASE,
205 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
206 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
207 .rx_irq = INT_McBSP3RX,
208 .tx_irq = INT_McBSP3TX,
209 .ops = &omap1_mcbsp_ops,
210 .clk_name = "mcbsp_clk",
211 },
212};
213#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
214#else
215#define omap15xx_mcbsp_pdata NULL
216#define OMAP15XX_MCBSP_PDATA_SZ 0
217#endif
218
219#ifdef CONFIG_ARCH_OMAP16XX
220static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
221 {
222 .virt_base = OMAP1610_MCBSP1_BASE,
223 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
224 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
225 .rx_irq = INT_McBSP1RX,
226 .tx_irq = INT_McBSP1TX,
227 .ops = &omap1_mcbsp_ops,
228 .clk_name = "mcbsp_clk",
229 },
230 {
231 .virt_base = io_p2v(OMAP1610_MCBSP2_BASE),
232 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
233 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
234 .rx_irq = INT_1610_McBSP2_RX,
235 .tx_irq = INT_1610_McBSP2_TX,
236 .ops = &omap1_mcbsp_ops,
237 },
238 {
239 .virt_base = OMAP1610_MCBSP3_BASE,
240 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
241 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
242 .rx_irq = INT_McBSP3RX,
243 .tx_irq = INT_McBSP3TX,
244 .ops = &omap1_mcbsp_ops,
245 .clk_name = "mcbsp_clk",
246 },
247};
248#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
249#else
250#define omap16xx_mcbsp_pdata NULL
251#define OMAP16XX_MCBSP_PDATA_SZ 0
252#endif
253
254int __init omap1_mcbsp_init(void)
255{
256 int i;
257
258 for (i = 0; i < omap_mcbsp_clks_size; i++) {
259 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
260 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
261 clk_register(&omap_mcbsp_clks[i].clk);
262 }
263 }
264
265 if (cpu_is_omap730())
266 omap_mcbsp_register_board_cfg(omap730_mcbsp_pdata,
267 OMAP730_MCBSP_PDATA_SZ);
268
269 if (cpu_is_omap15xx())
270 omap_mcbsp_register_board_cfg(omap15xx_mcbsp_pdata,
271 OMAP15XX_MCBSP_PDATA_SZ);
272
273 if (cpu_is_omap16xx())
274 omap_mcbsp_register_board_cfg(omap16xx_mcbsp_pdata,
275 OMAP16XX_MCBSP_PDATA_SZ);
276
277 return omap_mcbsp_init();
278}
279
280arch_initcall(omap1_mcbsp_init);
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index e6c64e10b7ec..742f79e73bd7 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -116,13 +116,6 @@ void omap_pm_idle(void)
116 return; 116 return;
117 } 117 }
118 118
119 /*
120 * Since an interrupt may set up a timer, we don't want to
121 * reprogram the hardware timer with interrupts enabled.
122 * Re-enable interrupts only after returning from idle.
123 */
124 timer_dyn_reprogram();
125
126#ifdef CONFIG_OMAP_MPU_TIMER 119#ifdef CONFIG_OMAP_MPU_TIMER
127#warning Enable 32kHz OS timer in order to allow sleep states in idle 120#warning Enable 32kHz OS timer in order to allow sleep states in idle
128 use_idlect1 = use_idlect1 & ~(1 << 9); 121 use_idlect1 = use_idlect1 & ~(1 << 9);
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S
new file mode 100644
index 000000000000..126d252062d7
--- /dev/null
+++ b/arch/arm/mach-omap1/sram.S
@@ -0,0 +1,57 @@
1/*
2 * linux/arch/arm/plat-omap/sram-fn.S
3 *
4 * Functions that need to be run in internal SRAM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/linkage.h>
12#include <asm/assembler.h>
13#include <asm/arch/io.h>
14#include <asm/hardware.h>
15
16 .text
17
18/*
19 * Reprograms ULPD and CKCTL.
20 */
21ENTRY(omap1_sram_reprogram_clock)
22 stmfd sp!, {r0 - r12, lr} @ save registers on stack
23
24 mov r2, #IO_ADDRESS(DPLL_CTL) & 0xff000000
25 orr r2, r2, #IO_ADDRESS(DPLL_CTL) & 0x00ff0000
26 orr r2, r2, #IO_ADDRESS(DPLL_CTL) & 0x0000ff00
27
28 mov r3, #IO_ADDRESS(ARM_CKCTL) & 0xff000000
29 orr r3, r3, #IO_ADDRESS(ARM_CKCTL) & 0x00ff0000
30 orr r3, r3, #IO_ADDRESS(ARM_CKCTL) & 0x0000ff00
31
32 tst r0, #1 << 4 @ want lock mode?
33 beq newck @ nope
34 bic r0, r0, #1 << 4 @ else clear lock bit
35 strh r0, [r2] @ set dpll into bypass mode
36 orr r0, r0, #1 << 4 @ set lock bit again
37
38newck:
39 strh r1, [r3] @ write new ckctl value
40 strh r0, [r2] @ write new dpll value
41
42 mov r4, #0x0700 @ let the clocks settle
43 orr r4, r4, #0x00ff
44delay: sub r4, r4, #1
45 cmp r4, #0
46 bne delay
47
48lock: ldrh r4, [r2], #0 @ read back dpll value
49 tst r0, #1 << 4 @ want lock mode?
50 beq out @ nope
51 tst r4, #1 << 0 @ dpll rate locked?
52 beq lock @ try again
53
54out:
55 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
56ENTRY(omap1_sram_reprogram_clock_sz)
57 .word . - omap1_sram_reprogram_clock