aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2009-04-14 08:04:16 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-04-23 12:31:09 -0400
commitf5c122da543ebf98a5ccb3166768e38eea3120dd (patch)
tree0275d0646aab07c8e3bf9ef5a22572bcf668f400
parentc5b736d093217890245a33e9a98fe92d6f3529bf (diff)
davinci: add arch_ioremap() which uses existing static mappings
Add arch-specific ioremap() which uses any existing static mappings in place of doing a new mapping. From now on, drivers should always use ioremap() instead of IO_ADDRESS(). In addition, remove the davinci_[read|write]* macros in favor of using ioremap. Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-davinci/board-evm.c4
-rw-r--r--arch/arm/mach-davinci/devices.c2
-rw-r--r--arch/arm/mach-davinci/id.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h4
-rw-r--r--arch/arm/mach-davinci/include/mach/hardware.h51
-rw-r--r--arch/arm/mach-davinci/include/mach/io.h20
-rw-r--r--arch/arm/mach-davinci/io.c22
-rw-r--r--arch/arm/mach-davinci/irq.c6
-rw-r--r--arch/arm/mach-davinci/mux.c5
-rw-r--r--arch/arm/mach-davinci/psc.c2
-rw-r--r--arch/arm/mach-davinci/time.c79
-rw-r--r--arch/arm/mach-davinci/usb.c2
12 files changed, 105 insertions, 98 deletions
diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-evm.c
index 1b745c39d891..c2701d740a1d 100644
--- a/arch/arm/mach-davinci/board-evm.c
+++ b/arch/arm/mach-davinci/board-evm.c
@@ -36,6 +36,9 @@
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/i2c.h> 37#include <mach/i2c.h>
38 38
39#define DAVINCI_CFC_ATA_BASE 0x01C66000
40#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
41
39/* other misc. init functions */ 42/* other misc. init functions */
40void __init davinci_psc_init(void); 43void __init davinci_psc_init(void);
41void __init davinci_irq_init(void); 44void __init davinci_irq_init(void);
@@ -422,7 +425,6 @@ static __init void davinci_evm_init(void)
422 425
423static __init void davinci_evm_irq_init(void) 426static __init void davinci_evm_irq_init(void)
424{ 427{
425 davinci_init_common_hw();
426 davinci_irq_init(); 428 davinci_irq_init();
427} 429}
428 430
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 808633f9f03c..3ea6d477f06b 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -22,6 +22,8 @@
22#include <mach/i2c.h> 22#include <mach/i2c.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24 24
25#define DAVINCI_I2C_BASE 0x01C21000
26
25static struct resource i2c_resources[] = { 27static struct resource i2c_resources[] = {
26 { 28 {
27 .start = DAVINCI_I2C_BASE, 29 .start = DAVINCI_I2C_BASE,
diff --git a/arch/arm/mach-davinci/id.c b/arch/arm/mach-davinci/id.c
index 379f2baf66d6..018b994cd794 100644
--- a/arch/arm/mach-davinci/id.c
+++ b/arch/arm/mach-davinci/id.c
@@ -15,7 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#define JTAG_ID_BASE 0x01c40028 18#define JTAG_ID_BASE IO_ADDRESS(0x01c40028)
19 19
20static unsigned int davinci_revision; 20static unsigned int davinci_revision;
21 21
@@ -58,7 +58,7 @@ static u16 __init davinci_get_part_no(void)
58{ 58{
59 u32 dev_id, part_no; 59 u32 dev_id, part_no;
60 60
61 dev_id = davinci_readl(JTAG_ID_BASE); 61 dev_id = __raw_readl(JTAG_ID_BASE);
62 62
63 part_no = ((dev_id >> 12) & 0xffff); 63 part_no = ((dev_id >> 12) & 0xffff);
64 64
@@ -72,7 +72,7 @@ static u8 __init davinci_get_variant(void)
72{ 72{
73 u32 variant; 73 u32 variant;
74 74
75 variant = davinci_readl(JTAG_ID_BASE); 75 variant = __raw_readl(JTAG_ID_BASE);
76 76
77 variant = (variant >> 28) & 0xf; 77 variant = (variant >> 28) & 0xf;
78 78
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index b456f079f43f..5e7c36b202f1 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -15,9 +15,11 @@
15 15
16#include <linux/io.h> 16#include <linux/io.h>
17#include <asm-generic/gpio.h> 17#include <asm-generic/gpio.h>
18#include <mach/hardware.h> 18
19#include <mach/irqs.h> 19#include <mach/irqs.h>
20 20
21#define DAVINCI_GPIO_BASE 0x01C67000
22
21/* 23/*
22 * basic gpio routines 24 * basic gpio routines
23 * 25 *
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
index a2e8969afaca..48c77934d519 100644
--- a/arch/arm/mach-davinci/include/mach/hardware.h
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * Common hardware definitions 2 * Hardware definitions common to all DaVinci family processors
3 * 3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> 4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 * 5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under 6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
@@ -12,41 +12,16 @@
12#define __ASM_ARCH_HARDWARE_H 12#define __ASM_ARCH_HARDWARE_H
13 13
14/* 14/*
15 * Base register addresses 15 * Before you add anything to ths file:
16 *
17 * This header is for defines common to ALL DaVinci family chips.
18 * Anything that is chip specific should go in <chipname>.h,
19 * and the chip/board init code should then explicitly include
20 * <chipname>.h
16 */ 21 */
17#define DAVINCI_DMA_3PCC_BASE (0x01C00000) 22#define DAVINCI_SYSTEM_MODULE_BASE 0x01C40000
18#define DAVINCI_DMA_3PTC0_BASE (0x01C10000) 23
19#define DAVINCI_DMA_3PTC1_BASE (0x01C10400) 24/* System control register offsets */
20#define DAVINCI_I2C_BASE (0x01C21000) 25#define DM64XX_VDD3P3V_PWDN 0x48
21#define DAVINCI_PWM0_BASE (0x01C22000)
22#define DAVINCI_PWM1_BASE (0x01C22400)
23#define DAVINCI_PWM2_BASE (0x01C22800)
24#define DAVINCI_SYSTEM_MODULE_BASE (0x01C40000)
25#define DAVINCI_PLL_CNTRL0_BASE (0x01C40800)
26#define DAVINCI_PLL_CNTRL1_BASE (0x01C40C00)
27#define DAVINCI_PWR_SLEEP_CNTRL_BASE (0x01C41000)
28#define DAVINCI_SYSTEM_DFT_BASE (0x01C42000)
29#define DAVINCI_IEEE1394_BASE (0x01C60000)
30#define DAVINCI_USB_OTG_BASE (0x01C64000)
31#define DAVINCI_CFC_ATA_BASE (0x01C66000)
32#define DAVINCI_SPI_BASE (0x01C66800)
33#define DAVINCI_GPIO_BASE (0x01C67000)
34#define DAVINCI_UHPI_BASE (0x01C67800)
35#define DAVINCI_VPSS_REGS_BASE (0x01C70000)
36#define DAVINCI_EMAC_CNTRL_REGS_BASE (0x01C80000)
37#define DAVINCI_EMAC_WRAPPER_CNTRL_REGS_BASE (0x01C81000)
38#define DAVINCI_EMAC_WRAPPER_RAM_BASE (0x01C82000)
39#define DAVINCI_MDIO_CNTRL_REGS_BASE (0x01C84000)
40#define DAVINCI_IMCOP_BASE (0x01CC0000)
41#define DAVINCI_ASYNC_EMIF_CNTRL_BASE (0x01E00000)
42#define DAVINCI_VLYNQ_BASE (0x01E01000)
43#define DAVINCI_MCBSP_BASE (0x01E02000)
44#define DAVINCI_MMC_SD_BASE (0x01E10000)
45#define DAVINCI_MS_BASE (0x01E20000)
46#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE (0x02000000)
47#define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE (0x04000000)
48#define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE (0x06000000)
49#define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE (0x08000000)
50#define DAVINCI_VLYNQ_REMOTE_BASE (0x0C000000)
51 26
52#endif /* __ASM_ARCH_HARDWARE_H */ 27#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
index a48795fd2417..2479785405af 100644
--- a/arch/arm/mach-davinci/include/mach/io.h
+++ b/arch/arm/mach-davinci/include/mach/io.h
@@ -40,22 +40,12 @@
40#else 40#else
41#define IOMEM(x) ((void __force __iomem *)(x)) 41#define IOMEM(x) ((void __force __iomem *)(x))
42 42
43/* 43#define __arch_ioremap(p, s, t) davinci_ioremap(p, s, t)
44 * Functions to access the DaVinci IO region 44#define __arch_iounmap(v) davinci_iounmap(v)
45 *
46 * NOTE: - Use davinci_read/write[bwl] for physical register addresses
47 * - Use __raw_read/write[bwl]() for virtual register addresses
48 * - Use IO_ADDRESS(phys_addr) to convert registers to virtual addresses
49 * - DO NOT use hardcoded virtual addresses to allow changing the
50 * IO address space again if needed
51 */
52#define davinci_readb(a) __raw_readb(IO_ADDRESS(a))
53#define davinci_readw(a) __raw_readw(IO_ADDRESS(a))
54#define davinci_readl(a) __raw_readl(IO_ADDRESS(a))
55 45
56#define davinci_writeb(v, a) __raw_writeb(v, IO_ADDRESS(a)) 46void __iomem *davinci_ioremap(unsigned long phys, size_t size,
57#define davinci_writew(v, a) __raw_writew(v, IO_ADDRESS(a)) 47 unsigned int type);
58#define davinci_writel(v, a) __raw_writel(v, IO_ADDRESS(a)) 48void davinci_iounmap(volatile void __iomem *addr);
59 49
60#endif /* __ASSEMBLER__ */ 50#endif /* __ASSEMBLER__ */
61#endif /* __ASM_ARCH_IO_H */ 51#endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c
index 71a7ae342b91..a548abb513e2 100644
--- a/arch/arm/mach-davinci/io.c
+++ b/arch/arm/mach-davinci/io.c
@@ -51,6 +51,26 @@ void __init davinci_map_common_io(void)
51 davinci_check_revision(); 51 davinci_check_revision();
52} 52}
53 53
54void __init davinci_init_common_hw(void) 54#define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
55#define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst)))
56
57/*
58 * Intercept ioremap() requests for addresses in our fixed mapping regions.
59 */
60void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type)
61{
62 if (BETWEEN(p, IO_PHYS, IO_SIZE))
63 return XLATE(p, IO_PHYS, IO_VIRT);
64
65 return __arm_ioremap(p, size, type);
66}
67EXPORT_SYMBOL(davinci_ioremap);
68
69void davinci_iounmap(volatile void __iomem *addr)
55{ 70{
71 unsigned long virt = (unsigned long)addr;
72
73 if (virt >= VMALLOC_START && virt < VMALLOC_END)
74 __iounmap(addr);
56} 75}
76EXPORT_SYMBOL(davinci_iounmap);
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index 38021af8359a..e76835cf1018 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -40,14 +40,16 @@
40#define IRQ_INTPRI0_REG_OFFSET 0x0030 40#define IRQ_INTPRI0_REG_OFFSET 0x0030
41#define IRQ_INTPRI7_REG_OFFSET 0x004C 41#define IRQ_INTPRI7_REG_OFFSET 0x004C
42 42
43#define INTC_BASE IO_ADDRESS(DAVINCI_ARM_INTC_BASE)
44
43static inline unsigned int davinci_irq_readl(int offset) 45static inline unsigned int davinci_irq_readl(int offset)
44{ 46{
45 return davinci_readl(DAVINCI_ARM_INTC_BASE + offset); 47 return __raw_readl(INTC_BASE + offset);
46} 48}
47 49
48static inline void davinci_irq_writel(unsigned long value, int offset) 50static inline void davinci_irq_writel(unsigned long value, int offset)
49{ 51{
50 davinci_writel(value, DAVINCI_ARM_INTC_BASE + offset); 52 __raw_writel(value, INTC_BASE + offset);
51} 53}
52 54
53/* Disable interrupt */ 55/* Disable interrupt */
diff --git a/arch/arm/mach-davinci/mux.c b/arch/arm/mach-davinci/mux.c
index 8ff9d8aca60b..53734dee1f93 100644
--- a/arch/arm/mach-davinci/mux.c
+++ b/arch/arm/mach-davinci/mux.c
@@ -23,6 +23,7 @@ static DEFINE_SPINLOCK(mux_lock);
23 23
24void davinci_mux_peripheral(unsigned int mux, unsigned int enable) 24void davinci_mux_peripheral(unsigned int mux, unsigned int enable)
25{ 25{
26 void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
26 u32 pinmux, muxreg = PINMUX0; 27 u32 pinmux, muxreg = PINMUX0;
27 28
28 if (mux >= DAVINCI_MUX_LEVEL2) { 29 if (mux >= DAVINCI_MUX_LEVEL2) {
@@ -31,11 +32,11 @@ void davinci_mux_peripheral(unsigned int mux, unsigned int enable)
31 } 32 }
32 33
33 spin_lock(&mux_lock); 34 spin_lock(&mux_lock);
34 pinmux = davinci_readl(DAVINCI_SYSTEM_MODULE_BASE + muxreg); 35 pinmux = __raw_readl(base + muxreg);
35 if (enable) 36 if (enable)
36 pinmux |= (1 << mux); 37 pinmux |= (1 << mux);
37 else 38 else
38 pinmux &= ~(1 << mux); 39 pinmux &= ~(1 << mux);
39 davinci_writel(pinmux, DAVINCI_SYSTEM_MODULE_BASE + muxreg); 40 __raw_writel(pinmux, base + muxreg);
40 spin_unlock(&mux_lock); 41 spin_unlock(&mux_lock);
41} 42}
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index c5098831741f..e44544ac2b16 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -28,6 +28,8 @@
28#include <mach/psc.h> 28#include <mach/psc.h>
29#include <mach/mux.h> 29#include <mach/mux.h>
30 30
31#define DAVINCI_PWR_SLEEP_CNTRL_BASE 0x01C41000
32
31/* PSC register offsets */ 33/* PSC register offsets */
32#define EPCPR 0x070 34#define EPCPR 0x070
33#define PTCMD 0x120 35#define PTCMD 0x120
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 6c227d4ba998..88864ae067b8 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -16,6 +16,9 @@
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/err.h>
21#include <linux/device.h>
19 22
20#include <mach/hardware.h> 23#include <mach/hardware.h>
21#include <asm/system.h> 24#include <asm/system.h>
@@ -24,6 +27,8 @@
24#include <asm/mach/time.h> 27#include <asm/mach/time.h>
25#include <asm/errno.h> 28#include <asm/errno.h>
26#include <mach/io.h> 29#include <mach/io.h>
30#include <mach/cputype.h>
31#include "clock.h"
27 32
28static struct clock_event_device clockevent_davinci; 33static struct clock_event_device clockevent_davinci;
29 34
@@ -99,9 +104,9 @@ struct timer_s {
99 unsigned int id; 104 unsigned int id;
100 unsigned long period; 105 unsigned long period;
101 unsigned long opts; 106 unsigned long opts;
102 unsigned long reg_base; 107 void __iomem *base;
103 unsigned long tim_reg; 108 unsigned long tim_off;
104 unsigned long prd_reg; 109 unsigned long prd_off;
105 unsigned long enamode_shift; 110 unsigned long enamode_shift;
106 struct irqaction irqaction; 111 struct irqaction irqaction;
107}; 112};
@@ -114,15 +119,15 @@ static struct timer_s timers[];
114 119
115static int timer32_config(struct timer_s *t) 120static int timer32_config(struct timer_s *t)
116{ 121{
117 u32 tcr = davinci_readl(t->reg_base + TCR); 122 u32 tcr = __raw_readl(t->base + TCR);
118 123
119 /* disable timer */ 124 /* disable timer */
120 tcr &= ~(TCR_ENAMODE_MASK << t->enamode_shift); 125 tcr &= ~(TCR_ENAMODE_MASK << t->enamode_shift);
121 davinci_writel(tcr, t->reg_base + TCR); 126 __raw_writel(tcr, t->base + TCR);
122 127
123 /* reset counter to zero, set new period */ 128 /* reset counter to zero, set new period */
124 davinci_writel(0, t->tim_reg); 129 __raw_writel(0, t->base + t->tim_off);
125 davinci_writel(t->period, t->prd_reg); 130 __raw_writel(t->period, t->base + t->prd_off);
126 131
127 /* Set enable mode */ 132 /* Set enable mode */
128 if (t->opts & TIMER_OPTS_ONESHOT) { 133 if (t->opts & TIMER_OPTS_ONESHOT) {
@@ -131,13 +136,13 @@ static int timer32_config(struct timer_s *t)
131 tcr |= TCR_ENAMODE_PERIODIC << t->enamode_shift; 136 tcr |= TCR_ENAMODE_PERIODIC << t->enamode_shift;
132 } 137 }
133 138
134 davinci_writel(tcr, t->reg_base + TCR); 139 __raw_writel(tcr, t->base + TCR);
135 return 0; 140 return 0;
136} 141}
137 142
138static inline u32 timer32_read(struct timer_s *t) 143static inline u32 timer32_read(struct timer_s *t)
139{ 144{
140 return davinci_readl(t->tim_reg); 145 return __raw_readl(t->base + t->tim_off);
141} 146}
142 147
143static irqreturn_t timer_interrupt(int irq, void *dev_id) 148static irqreturn_t timer_interrupt(int irq, void *dev_id)
@@ -176,51 +181,54 @@ static struct timer_s timers[] = {
176 181
177static void __init timer_init(void) 182static void __init timer_init(void)
178{ 183{
179 u32 bases[] = {DAVINCI_TIMER0_BASE, DAVINCI_TIMER1_BASE}; 184 u32 phys_bases[] = {DAVINCI_TIMER0_BASE, DAVINCI_TIMER1_BASE};
180 int i; 185 int i;
181 186
182 /* Global init of each 64-bit timer as a whole */ 187 /* Global init of each 64-bit timer as a whole */
183 for(i=0; i<2; i++) { 188 for(i=0; i<2; i++) {
184 u32 tgcr, base = bases[i]; 189 u32 tgcr;
190 void __iomem *base = IO_ADDRESS(phys_bases[i]);
185 191
186 /* Disabled, Internal clock source */ 192 /* Disabled, Internal clock source */
187 davinci_writel(0, base + TCR); 193 __raw_writel(0, base + TCR);
188 194
189 /* reset both timers, no pre-scaler for timer34 */ 195 /* reset both timers, no pre-scaler for timer34 */
190 tgcr = 0; 196 tgcr = 0;
191 davinci_writel(tgcr, base + TGCR); 197 __raw_writel(tgcr, base + TGCR);
192 198
193 /* Set both timers to unchained 32-bit */ 199 /* Set both timers to unchained 32-bit */
194 tgcr = TGCR_TIMMODE_32BIT_UNCHAINED << TGCR_TIMMODE_SHIFT; 200 tgcr = TGCR_TIMMODE_32BIT_UNCHAINED << TGCR_TIMMODE_SHIFT;
195 davinci_writel(tgcr, base + TGCR); 201 __raw_writel(tgcr, base + TGCR);
196 202
197 /* Unreset timers */ 203 /* Unreset timers */
198 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) | 204 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) |
199 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT); 205 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT);
200 davinci_writel(tgcr, base + TGCR); 206 __raw_writel(tgcr, base + TGCR);
201 207
202 /* Init both counters to zero */ 208 /* Init both counters to zero */
203 davinci_writel(0, base + TIM12); 209 __raw_writel(0, base + TIM12);
204 davinci_writel(0, base + TIM34); 210 __raw_writel(0, base + TIM34);
205 } 211 }
206 212
207 /* Init of each timer as a 32-bit timer */ 213 /* Init of each timer as a 32-bit timer */
208 for (i=0; i< ARRAY_SIZE(timers); i++) { 214 for (i=0; i< ARRAY_SIZE(timers); i++) {
209 struct timer_s *t = &timers[i]; 215 struct timer_s *t = &timers[i];
216 u32 phys_base;
210 217
211 if (t->name) { 218 if (t->name) {
212 t->id = i; 219 t->id = i;
213 t->reg_base = (IS_TIMER1(t->id) ? 220 phys_base = (IS_TIMER1(t->id) ?
214 DAVINCI_TIMER1_BASE : DAVINCI_TIMER0_BASE); 221 DAVINCI_TIMER1_BASE : DAVINCI_TIMER0_BASE);
222 t->base = IO_ADDRESS(phys_base);
215 223
216 if (IS_TIMER_BOT(t->id)) { 224 if (IS_TIMER_BOT(t->id)) {
217 t->enamode_shift = 6; 225 t->enamode_shift = 6;
218 t->tim_reg = t->reg_base + TIM12; 226 t->tim_off = TIM12;
219 t->prd_reg = t->reg_base + PRD12; 227 t->prd_off = PRD12;
220 } else { 228 } else {
221 t->enamode_shift = 22; 229 t->enamode_shift = 22;
222 t->tim_reg = t->reg_base + TIM34; 230 t->tim_off = TIM34;
223 t->prd_reg = t->reg_base + PRD34; 231 t->prd_off = PRD34;
224 } 232 }
225 233
226 /* Register interrupt */ 234 /* Register interrupt */
@@ -333,42 +341,43 @@ struct sys_timer davinci_timer = {
333 341
334/* reset board using watchdog timer */ 342/* reset board using watchdog timer */
335void davinci_watchdog_reset(void) { 343void davinci_watchdog_reset(void) {
336 u32 tgcr, wdtcr, base = DAVINCI_WDOG_BASE; 344 u32 tgcr, wdtcr;
345 void __iomem *base = IO_ADDRESS(DAVINCI_WDOG_BASE);
337 346
338 /* disable, internal clock source */ 347 /* disable, internal clock source */
339 davinci_writel(0, base + TCR); 348 __raw_writel(0, base + TCR);
340 349
341 /* reset timer, set mode to 64-bit watchdog, and unreset */ 350 /* reset timer, set mode to 64-bit watchdog, and unreset */
342 tgcr = 0; 351 tgcr = 0;
343 davinci_writel(tgcr, base + TCR); 352 __raw_writel(tgcr, base + TCR);
344 tgcr = TGCR_TIMMODE_64BIT_WDOG << TGCR_TIMMODE_SHIFT; 353 tgcr = TGCR_TIMMODE_64BIT_WDOG << TGCR_TIMMODE_SHIFT;
345 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) | 354 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) |
346 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT); 355 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT);
347 davinci_writel(tgcr, base + TCR); 356 __raw_writel(tgcr, base + TCR);
348 357
349 /* clear counter and period regs */ 358 /* clear counter and period regs */
350 davinci_writel(0, base + TIM12); 359 __raw_writel(0, base + TIM12);
351 davinci_writel(0, base + TIM34); 360 __raw_writel(0, base + TIM34);
352 davinci_writel(0, base + PRD12); 361 __raw_writel(0, base + PRD12);
353 davinci_writel(0, base + PRD34); 362 __raw_writel(0, base + PRD34);
354 363
355 /* enable */ 364 /* enable */
356 wdtcr = davinci_readl(base + WDTCR); 365 wdtcr = __raw_readl(base + WDTCR);
357 wdtcr |= WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT; 366 wdtcr |= WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT;
358 davinci_writel(wdtcr, base + WDTCR); 367 __raw_writel(wdtcr, base + WDTCR);
359 368
360 /* put watchdog in pre-active state */ 369 /* put watchdog in pre-active state */
361 wdtcr = (WDTCR_WDKEY_SEQ0 << WDTCR_WDKEY_SHIFT) | 370 wdtcr = (WDTCR_WDKEY_SEQ0 << WDTCR_WDKEY_SHIFT) |
362 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT); 371 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT);
363 davinci_writel(wdtcr, base + WDTCR); 372 __raw_writel(wdtcr, base + WDTCR);
364 373
365 /* put watchdog in active state */ 374 /* put watchdog in active state */
366 wdtcr = (WDTCR_WDKEY_SEQ1 << WDTCR_WDKEY_SHIFT) | 375 wdtcr = (WDTCR_WDKEY_SEQ1 << WDTCR_WDKEY_SHIFT) |
367 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT); 376 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT);
368 davinci_writel(wdtcr, base + WDTCR); 377 __raw_writel(wdtcr, base + WDTCR);
369 378
370 /* write an invalid value to the WDKEY field to trigger 379 /* write an invalid value to the WDKEY field to trigger
371 * a watchdog reset */ 380 * a watchdog reset */
372 wdtcr = 0x00004000; 381 wdtcr = 0x00004000;
373 davinci_writel(wdtcr, base + WDTCR); 382 __raw_writel(wdtcr, base + WDTCR);
374} 383}
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 2429b79f6da2..abedb6337182 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -14,6 +14,8 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/irqs.h> 15#include <mach/irqs.h>
16 16
17#define DAVINCI_USB_OTG_BASE 0x01C64000
18
17#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 19#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
18static struct musb_hdrc_eps_bits musb_eps[] = { 20static struct musb_hdrc_eps_bits musb_eps[] = {
19 { "ep1_tx", 8, }, 21 { "ep1_tx", 8, },