diff options
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/board-h4.c | 95 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-omap3beagle.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-rx51.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock24xx.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock24xx.h | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-omap2/irq.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/timer-gp.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-omap2/usb-tusb6010.c | 2 |
10 files changed, 71 insertions, 152 deletions
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index a0267a9ab466..e7d017cdc438 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -33,10 +33,8 @@ | |||
33 | 33 | ||
34 | #include <mach/control.h> | 34 | #include <mach/control.h> |
35 | #include <mach/gpio.h> | 35 | #include <mach/gpio.h> |
36 | #include <mach/gpioexpander.h> | ||
37 | #include <mach/mux.h> | 36 | #include <mach/mux.h> |
38 | #include <mach/usb.h> | 37 | #include <mach/usb.h> |
39 | #include <mach/irda.h> | ||
40 | #include <mach/board.h> | 38 | #include <mach/board.h> |
41 | #include <mach/common.h> | 39 | #include <mach/common.h> |
42 | #include <mach/keypad.h> | 40 | #include <mach/keypad.h> |
@@ -138,98 +136,6 @@ static struct platform_device h4_flash_device = { | |||
138 | .resource = &h4_flash_resource, | 136 | .resource = &h4_flash_resource, |
139 | }; | 137 | }; |
140 | 138 | ||
141 | /* Select between the IrDA and aGPS module | ||
142 | */ | ||
143 | static int h4_select_irda(struct device *dev, int state) | ||
144 | { | ||
145 | unsigned char expa; | ||
146 | int err = 0; | ||
147 | |||
148 | if ((err = read_gpio_expa(&expa, 0x21))) { | ||
149 | printk(KERN_ERR "Error reading from I/O expander\n"); | ||
150 | return err; | ||
151 | } | ||
152 | |||
153 | /* 'P6' enable/disable IRDA_TX and IRDA_RX */ | ||
154 | if (state & IR_SEL) { /* IrDa */ | ||
155 | if ((err = write_gpio_expa(expa | 0x01, 0x21))) { | ||
156 | printk(KERN_ERR "Error writing to I/O expander\n"); | ||
157 | return err; | ||
158 | } | ||
159 | } else { | ||
160 | if ((err = write_gpio_expa(expa & ~0x01, 0x21))) { | ||
161 | printk(KERN_ERR "Error writing to I/O expander\n"); | ||
162 | return err; | ||
163 | } | ||
164 | } | ||
165 | return err; | ||
166 | } | ||
167 | |||
168 | static void set_trans_mode(struct work_struct *work) | ||
169 | { | ||
170 | struct omap_irda_config *irda_config = | ||
171 | container_of(work, struct omap_irda_config, gpio_expa.work); | ||
172 | int mode = irda_config->mode; | ||
173 | unsigned char expa; | ||
174 | int err = 0; | ||
175 | |||
176 | if ((err = read_gpio_expa(&expa, 0x20)) != 0) { | ||
177 | printk(KERN_ERR "Error reading from I/O expander\n"); | ||
178 | } | ||
179 | |||
180 | expa &= ~0x01; | ||
181 | |||
182 | if (!(mode & IR_SIRMODE)) { /* MIR/FIR */ | ||
183 | expa |= 0x01; | ||
184 | } | ||
185 | |||
186 | if ((err = write_gpio_expa(expa, 0x20)) != 0) { | ||
187 | printk(KERN_ERR "Error writing to I/O expander\n"); | ||
188 | } | ||
189 | } | ||
190 | |||
191 | static int h4_transceiver_mode(struct device *dev, int mode) | ||
192 | { | ||
193 | struct omap_irda_config *irda_config = dev->platform_data; | ||
194 | |||
195 | irda_config->mode = mode; | ||
196 | cancel_delayed_work(&irda_config->gpio_expa); | ||
197 | PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode); | ||
198 | schedule_delayed_work(&irda_config->gpio_expa, 0); | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static struct omap_irda_config h4_irda_data = { | ||
204 | .transceiver_cap = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE, | ||
205 | .transceiver_mode = h4_transceiver_mode, | ||
206 | .select_irda = h4_select_irda, | ||
207 | .rx_channel = OMAP24XX_DMA_UART3_RX, | ||
208 | .tx_channel = OMAP24XX_DMA_UART3_TX, | ||
209 | .dest_start = OMAP_UART3_BASE, | ||
210 | .src_start = OMAP_UART3_BASE, | ||
211 | .tx_trigger = OMAP24XX_DMA_UART3_TX, | ||
212 | .rx_trigger = OMAP24XX_DMA_UART3_RX, | ||
213 | }; | ||
214 | |||
215 | static struct resource h4_irda_resources[] = { | ||
216 | [0] = { | ||
217 | .start = INT_24XX_UART3_IRQ, | ||
218 | .end = INT_24XX_UART3_IRQ, | ||
219 | .flags = IORESOURCE_IRQ, | ||
220 | }, | ||
221 | }; | ||
222 | |||
223 | static struct platform_device h4_irda_device = { | ||
224 | .name = "omapirda", | ||
225 | .id = -1, | ||
226 | .dev = { | ||
227 | .platform_data = &h4_irda_data, | ||
228 | }, | ||
229 | .num_resources = 1, | ||
230 | .resource = h4_irda_resources, | ||
231 | }; | ||
232 | |||
233 | static struct omap_kp_platform_data h4_kp_data = { | 139 | static struct omap_kp_platform_data h4_kp_data = { |
234 | .rows = 6, | 140 | .rows = 6, |
235 | .cols = 7, | 141 | .cols = 7, |
@@ -255,7 +161,6 @@ static struct platform_device h4_lcd_device = { | |||
255 | 161 | ||
256 | static struct platform_device *h4_devices[] __initdata = { | 162 | static struct platform_device *h4_devices[] __initdata = { |
257 | &h4_flash_device, | 163 | &h4_flash_device, |
258 | &h4_irda_device, | ||
259 | &h4_kp_device, | 164 | &h4_kp_device, |
260 | &h4_lcd_device, | 165 | &h4_lcd_device, |
261 | }; | 166 | }; |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 744740ae1b9c..3a7a29d1f9a7 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <mach/nand.h> | 42 | #include <mach/nand.h> |
43 | #include <mach/mux.h> | 43 | #include <mach/mux.h> |
44 | #include <mach/usb.h> | 44 | #include <mach/usb.h> |
45 | #include <mach/timer-gp.h> | ||
45 | 46 | ||
46 | #include "mmc-twl4030.h" | 47 | #include "mmc-twl4030.h" |
47 | 48 | ||
@@ -186,6 +187,9 @@ static void __init omap3_beagle_init_irq(void) | |||
186 | { | 187 | { |
187 | omap2_init_common_hw(NULL); | 188 | omap2_init_common_hw(NULL); |
188 | omap_init_irq(); | 189 | omap_init_irq(); |
190 | #ifdef CONFIG_OMAP_32K_TIMER | ||
191 | omap2_gp_clockevent_set_gptimer(12); | ||
192 | #endif | ||
189 | omap_gpio_init(); | 193 | omap_gpio_init(); |
190 | } | 194 | } |
191 | 195 | ||
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index 3a0daac6c839..374ff63c3eb2 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/delay.h> | ||
19 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
20 | 19 | ||
21 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c index 1e839c5a28c5..efc59c49341b 100644 --- a/arch/arm/mach-omap2/clock24xx.c +++ b/arch/arm/mach-omap2/clock24xx.c | |||
@@ -60,12 +60,13 @@ struct omap_clk { | |||
60 | }, \ | 60 | }, \ |
61 | } | 61 | } |
62 | 62 | ||
63 | #define CK_243X (1 << 0) | 63 | #define CK_243X RATE_IN_243X |
64 | #define CK_242X (1 << 1) | 64 | #define CK_242X RATE_IN_242X |
65 | 65 | ||
66 | static struct omap_clk omap24xx_clks[] = { | 66 | static struct omap_clk omap24xx_clks[] = { |
67 | /* external root sources */ | 67 | /* external root sources */ |
68 | CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X), | 68 | CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X), |
69 | CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X | CK_242X), | ||
69 | CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X), | 70 | CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X), |
70 | CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X), | 71 | CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X), |
71 | CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X), | 72 | CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X), |
@@ -711,7 +712,7 @@ int __init omap2_clk_init(void) | |||
711 | { | 712 | { |
712 | struct prcm_config *prcm; | 713 | struct prcm_config *prcm; |
713 | struct omap_clk *c; | 714 | struct omap_clk *c; |
714 | u32 clkrate, cpu_mask; | 715 | u32 clkrate; |
715 | 716 | ||
716 | if (cpu_is_omap242x()) | 717 | if (cpu_is_omap242x()) |
717 | cpu_mask = RATE_IN_242X; | 718 | cpu_mask = RATE_IN_242X; |
@@ -720,21 +721,15 @@ int __init omap2_clk_init(void) | |||
720 | 721 | ||
721 | clk_init(&omap2_clk_functions); | 722 | clk_init(&omap2_clk_functions); |
722 | 723 | ||
724 | for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) | ||
725 | clk_init_one(c->lk.clk); | ||
726 | |||
723 | osc_ck.rate = omap2_osc_clk_recalc(&osc_ck); | 727 | osc_ck.rate = omap2_osc_clk_recalc(&osc_ck); |
724 | propagate_rate(&osc_ck); | 728 | propagate_rate(&osc_ck); |
725 | sys_ck.rate = omap2_sys_clk_recalc(&sys_ck); | 729 | sys_ck.rate = omap2_sys_clk_recalc(&sys_ck); |
726 | propagate_rate(&sys_ck); | 730 | propagate_rate(&sys_ck); |
727 | 731 | ||
728 | for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) | 732 | for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) |
729 | clk_init_one(c->lk.clk); | ||
730 | |||
731 | cpu_mask = 0; | ||
732 | if (cpu_is_omap2420()) | ||
733 | cpu_mask |= CK_242X; | ||
734 | if (cpu_is_omap2430()) | ||
735 | cpu_mask |= CK_243X; | ||
736 | |||
737 | for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) | ||
738 | if (c->cpu & cpu_mask) { | 733 | if (c->cpu & cpu_mask) { |
739 | clkdev_add(&c->lk); | 734 | clkdev_add(&c->lk); |
740 | clk_register(c->lk.clk); | 735 | clk_register(c->lk.clk); |
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h index 33c3e5b14323..88c5acb40fcf 100644 --- a/arch/arm/mach-omap2/clock24xx.h +++ b/arch/arm/mach-omap2/clock24xx.h | |||
@@ -625,6 +625,14 @@ static struct clk func_32k_ck = { | |||
625 | .clkdm_name = "wkup_clkdm", | 625 | .clkdm_name = "wkup_clkdm", |
626 | }; | 626 | }; |
627 | 627 | ||
628 | static struct clk secure_32k_ck = { | ||
629 | .name = "secure_32k_ck", | ||
630 | .ops = &clkops_null, | ||
631 | .rate = 32768, | ||
632 | .flags = RATE_FIXED, | ||
633 | .clkdm_name = "wkup_clkdm", | ||
634 | }; | ||
635 | |||
628 | /* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ | 636 | /* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ |
629 | static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ | 637 | static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ |
630 | .name = "osc_ck", | 638 | .name = "osc_ck", |
@@ -1790,7 +1798,7 @@ static struct clk gpt12_ick = { | |||
1790 | static struct clk gpt12_fck = { | 1798 | static struct clk gpt12_fck = { |
1791 | .name = "gpt12_fck", | 1799 | .name = "gpt12_fck", |
1792 | .ops = &clkops_omap2_dflt_wait, | 1800 | .ops = &clkops_omap2_dflt_wait, |
1793 | .parent = &func_32k_ck, | 1801 | .parent = &secure_32k_ck, |
1794 | .clkdm_name = "core_l4_clkdm", | 1802 | .clkdm_name = "core_l4_clkdm", |
1795 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1803 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1796 | .enable_bit = OMAP24XX_EN_GPT12_SHIFT, | 1804 | .enable_bit = OMAP24XX_EN_GPT12_SHIFT, |
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h index 70ec10deb654..6763b8f73028 100644 --- a/arch/arm/mach-omap2/clock34xx.h +++ b/arch/arm/mach-omap2/clock34xx.h | |||
@@ -2052,7 +2052,7 @@ static struct clk dss_ick = { | |||
2052 | 2052 | ||
2053 | static struct clk cam_mclk = { | 2053 | static struct clk cam_mclk = { |
2054 | .name = "cam_mclk", | 2054 | .name = "cam_mclk", |
2055 | .ops = &clkops_omap2_dflt_wait, | 2055 | .ops = &clkops_omap2_dflt, |
2056 | .parent = &dpll4_m5x2_ck, | 2056 | .parent = &dpll4_m5x2_ck, |
2057 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), | 2057 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), |
2058 | .enable_bit = OMAP3430_EN_CAM_SHIFT, | 2058 | .enable_bit = OMAP3430_EN_CAM_SHIFT, |
@@ -2063,7 +2063,7 @@ static struct clk cam_mclk = { | |||
2063 | static struct clk cam_ick = { | 2063 | static struct clk cam_ick = { |
2064 | /* Handles both L3 and L4 clocks */ | 2064 | /* Handles both L3 and L4 clocks */ |
2065 | .name = "cam_ick", | 2065 | .name = "cam_ick", |
2066 | .ops = &clkops_omap2_dflt_wait, | 2066 | .ops = &clkops_omap2_dflt, |
2067 | .parent = &l4_ick, | 2067 | .parent = &l4_ick, |
2068 | .init = &omap2_init_clk_clkdm, | 2068 | .init = &omap2_init_clk_clkdm, |
2069 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), | 2069 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), |
@@ -2074,7 +2074,7 @@ static struct clk cam_ick = { | |||
2074 | 2074 | ||
2075 | static struct clk csi2_96m_fck = { | 2075 | static struct clk csi2_96m_fck = { |
2076 | .name = "csi2_96m_fck", | 2076 | .name = "csi2_96m_fck", |
2077 | .ops = &clkops_omap2_dflt_wait, | 2077 | .ops = &clkops_omap2_dflt, |
2078 | .parent = &core_96m_fck, | 2078 | .parent = &core_96m_fck, |
2079 | .init = &omap2_init_clk_clkdm, | 2079 | .init = &omap2_init_clk_clkdm, |
2080 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), | 2080 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), |
@@ -2901,7 +2901,6 @@ static struct clk sr_l4_ick = { | |||
2901 | 2901 | ||
2902 | /* SECURE_32K_FCK clocks */ | 2902 | /* SECURE_32K_FCK clocks */ |
2903 | 2903 | ||
2904 | /* XXX This clock no longer exists in 3430 TRM rev F */ | ||
2905 | static struct clk gpt12_fck = { | 2904 | static struct clk gpt12_fck = { |
2906 | .name = "gpt12_fck", | 2905 | .name = "gpt12_fck", |
2907 | .ops = &clkops_null, | 2906 | .ops = &clkops_null, |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index d6b4b2f8722f..496983ade97e 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <mach/board.h> | 25 | #include <mach/board.h> |
26 | #include <mach/mux.h> | 26 | #include <mach/mux.h> |
27 | #include <mach/gpio.h> | 27 | #include <mach/gpio.h> |
28 | #include <mach/eac.h> | ||
29 | #include <mach/mmc.h> | 28 | #include <mach/mmc.h> |
30 | 29 | ||
31 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) | 30 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) |
@@ -366,38 +365,6 @@ static void omap_init_mcspi(void) | |||
366 | static inline void omap_init_mcspi(void) {} | 365 | static inline void omap_init_mcspi(void) {} |
367 | #endif | 366 | #endif |
368 | 367 | ||
369 | #ifdef CONFIG_SND_OMAP24XX_EAC | ||
370 | |||
371 | #define OMAP2_EAC_BASE 0x48090000 | ||
372 | |||
373 | static struct resource omap2_eac_resources[] = { | ||
374 | { | ||
375 | .start = OMAP2_EAC_BASE, | ||
376 | .end = OMAP2_EAC_BASE + 0x109, | ||
377 | .flags = IORESOURCE_MEM, | ||
378 | }, | ||
379 | }; | ||
380 | |||
381 | static struct platform_device omap2_eac_device = { | ||
382 | .name = "omap24xx-eac", | ||
383 | .id = -1, | ||
384 | .num_resources = ARRAY_SIZE(omap2_eac_resources), | ||
385 | .resource = omap2_eac_resources, | ||
386 | .dev = { | ||
387 | .platform_data = NULL, | ||
388 | }, | ||
389 | }; | ||
390 | |||
391 | void omap_init_eac(struct eac_platform_data *pdata) | ||
392 | { | ||
393 | omap2_eac_device.dev.platform_data = pdata; | ||
394 | platform_device_register(&omap2_eac_device); | ||
395 | } | ||
396 | |||
397 | #else | ||
398 | void omap_init_eac(struct eac_platform_data *pdata) {} | ||
399 | #endif | ||
400 | |||
401 | #ifdef CONFIG_OMAP_SHA1_MD5 | 368 | #ifdef CONFIG_OMAP_SHA1_MD5 |
402 | static struct resource sha1_md5_resources[] = { | 369 | static struct resource sha1_md5_resources[] = { |
403 | { | 370 | { |
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c index 9ba20d985dda..998c5c45587e 100644 --- a/arch/arm/mach-omap2/irq.c +++ b/arch/arm/mach-omap2/irq.c | |||
@@ -73,9 +73,9 @@ static int omap_check_spurious(unsigned int irq) | |||
73 | u32 sir, spurious; | 73 | u32 sir, spurious; |
74 | 74 | ||
75 | sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR); | 75 | sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR); |
76 | spurious = sir >> 6; | 76 | spurious = sir >> 7; |
77 | 77 | ||
78 | if (spurious > 1) { | 78 | if (spurious) { |
79 | printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush " | 79 | printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush " |
80 | "posted write for irq %i\n", | 80 | "posted write for irq %i\n", |
81 | irq, sir, previous_irq); | 81 | irq, sir, previous_irq); |
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 1cb2c0909c2b..f36aba12090e 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * OMAP2 GP timer support. | 4 | * OMAP2 GP timer support. |
5 | * | 5 | * |
6 | * Copyright (C) 2009 Nokia Corporation | ||
7 | * | ||
6 | * Update to use new clocksource/clockevent layers | 8 | * Update to use new clocksource/clockevent layers |
7 | * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> | 9 | * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> |
8 | * Copyright (C) 2007 MontaVista Software, Inc. | 10 | * Copyright (C) 2007 MontaVista Software, Inc. |
@@ -36,8 +38,13 @@ | |||
36 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
37 | #include <mach/dmtimer.h> | 39 | #include <mach/dmtimer.h> |
38 | 40 | ||
41 | /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */ | ||
42 | #define MAX_GPTIMER_ID 12 | ||
43 | |||
39 | static struct omap_dm_timer *gptimer; | 44 | static struct omap_dm_timer *gptimer; |
40 | static struct clock_event_device clockevent_gpt; | 45 | static struct clock_event_device clockevent_gpt; |
46 | static u8 __initdata gptimer_id = 1; | ||
47 | static u8 __initdata inited; | ||
41 | 48 | ||
42 | static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) | 49 | static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) |
43 | { | 50 | { |
@@ -95,20 +102,53 @@ static struct clock_event_device clockevent_gpt = { | |||
95 | .set_mode = omap2_gp_timer_set_mode, | 102 | .set_mode = omap2_gp_timer_set_mode, |
96 | }; | 103 | }; |
97 | 104 | ||
105 | /** | ||
106 | * omap2_gp_clockevent_set_gptimer - set which GPTIMER is used for clockevents | ||
107 | * @id: GPTIMER to use (1..MAX_GPTIMER_ID) | ||
108 | * | ||
109 | * Define the GPTIMER that the system should use for the tick timer. | ||
110 | * Meant to be called from board-*.c files in the event that GPTIMER1, the | ||
111 | * default, is unsuitable. Returns -EINVAL on error or 0 on success. | ||
112 | */ | ||
113 | int __init omap2_gp_clockevent_set_gptimer(u8 id) | ||
114 | { | ||
115 | if (id < 1 || id > MAX_GPTIMER_ID) | ||
116 | return -EINVAL; | ||
117 | |||
118 | BUG_ON(inited); | ||
119 | |||
120 | gptimer_id = id; | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
98 | static void __init omap2_gp_clockevent_init(void) | 125 | static void __init omap2_gp_clockevent_init(void) |
99 | { | 126 | { |
100 | u32 tick_rate; | 127 | u32 tick_rate; |
128 | int src; | ||
129 | |||
130 | inited = 1; | ||
101 | 131 | ||
102 | gptimer = omap_dm_timer_request_specific(1); | 132 | gptimer = omap_dm_timer_request_specific(gptimer_id); |
103 | BUG_ON(gptimer == NULL); | 133 | BUG_ON(gptimer == NULL); |
104 | 134 | ||
105 | #if defined(CONFIG_OMAP_32K_TIMER) | 135 | #if defined(CONFIG_OMAP_32K_TIMER) |
106 | omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_32_KHZ); | 136 | src = OMAP_TIMER_SRC_32_KHZ; |
107 | #else | 137 | #else |
108 | omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK); | 138 | src = OMAP_TIMER_SRC_SYS_CLK; |
139 | WARN(gptimer_id == 12, "WARNING: GPTIMER12 can only use the " | ||
140 | "secure 32KiHz clock source\n"); | ||
109 | #endif | 141 | #endif |
142 | |||
143 | if (gptimer_id != 12) | ||
144 | WARN(IS_ERR_VALUE(omap_dm_timer_set_source(gptimer, src)), | ||
145 | "timer-gp: omap_dm_timer_set_source() failed\n"); | ||
146 | |||
110 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer)); | 147 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer)); |
111 | 148 | ||
149 | pr_info("OMAP clockevent source: GPTIMER%d at %u Hz\n", | ||
150 | gptimer_id, tick_rate); | ||
151 | |||
112 | omap2_gp_timer_irq.dev_id = (void *)gptimer; | 152 | omap2_gp_timer_irq.dev_id = (void *)gptimer; |
113 | setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); | 153 | setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); |
114 | omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW); | 154 | omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW); |
@@ -125,6 +165,8 @@ static void __init omap2_gp_clockevent_init(void) | |||
125 | clockevents_register_device(&clockevent_gpt); | 165 | clockevents_register_device(&clockevent_gpt); |
126 | } | 166 | } |
127 | 167 | ||
168 | /* Clocksource code */ | ||
169 | |||
128 | #ifdef CONFIG_OMAP_32K_TIMER | 170 | #ifdef CONFIG_OMAP_32K_TIMER |
129 | /* | 171 | /* |
130 | * When 32k-timer is enabled, don't use GPTimer for clocksource | 172 | * When 32k-timer is enabled, don't use GPTimer for clocksource |
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index 15e509013def..8df55f40f4c0 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c | |||
@@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk) | |||
187 | unsigned sysclk_ps; | 187 | unsigned sysclk_ps; |
188 | int status; | 188 | int status; |
189 | 189 | ||
190 | if (!refclk_psec) | 190 | if (!refclk_psec || sysclk_ps == 0) |
191 | return -ENODEV; | 191 | return -ENODEV; |
192 | 192 | ||
193 | sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; | 193 | sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; |