aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-05-09 05:28:08 -0400
committerOlof Johansson <olof@lixom.net>2012-05-09 05:28:46 -0400
commitcba3309e38cf0407fbdbea788758ad65624c2319 (patch)
treef93dfd4451c1d67f2b05626e7f6c98e519abf35a /arch/arm/mach-omap1
parent976eb445e2051735346779dbdaeb681c7641fec4 (diff)
parent09f45b83109cb8e23a06d5efb1096a08a9545974 (diff)
Merge tag 'omap-cleanup-sparse-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/cleanup
Sparse and cppcheck warning fixes By Paul Walmsley via Paul Walmsley (1) and Tony Lindgren (1) * tag 'omap-cleanup-sparse-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: clean up some cppcheck warnings ARM: OMAP1: board files: deduplicate and clean some NAND-related code ARM: OMAP: USB: remove unnecessary sideways include ARM: OMAP: DMA: use constant array maximum, drop some LCD DMA code ARM: OMAP: OCM RAM: use memset_io() when clearing SRAM ARM: OMAP: fix 'using plain integer as NULL pointer' sparse warnings ARM: OMAP2+: GPMC: resolve type-conversion warning from sparse ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus ARM: OMAP1: OCPI: move to mach-omap1/ ARM: OMAP: add includes for missing prototypes ARM: OMAP2+: declare file-local functions as static Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/Makefile13
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq.c2
-rw-r--r--arch/arm/mach-omap1/board-fsample.c16
-rw-r--r--arch/arm/mach-omap1/board-h2.c17
-rw-r--r--arch/arm/mach-omap1/board-h3.c16
-rw-r--r--arch/arm/mach-omap1/board-nand.c37
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c4
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c16
-rw-r--r--arch/arm/mach-omap1/clock.c3
-rw-r--r--arch/arm/mach-omap1/common.h11
-rw-r--r--arch/arm/mach-omap1/fpga.c2
-rw-r--r--arch/arm/mach-omap1/id.c2
-rw-r--r--arch/arm/mach-omap1/io.c3
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c7
-rw-r--r--arch/arm/mach-omap1/ocpi.c112
-rw-r--r--arch/arm/mach-omap1/pm.c9
-rw-r--r--arch/arm/mach-omap1/reset.c2
-rw-r--r--arch/arm/mach-omap1/timer.c3
-rw-r--r--arch/arm/mach-omap1/usb.c3
20 files changed, 193 insertions, 87 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 9923f92b5450..398e9e53e189 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -12,6 +12,9 @@ endif
12 12
13obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 13obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
14 14
15# OCPI interconnect support for 1710, 1610 and 5912
16obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
17
15# Power Management 18# Power Management
16obj-$(CONFIG_PM) += pm.o sleep.o 19obj-$(CONFIG_PM) += pm.o sleep.o
17 20
@@ -28,13 +31,15 @@ usb-fs-$(CONFIG_USB) := usb.o
28obj-y += $(usb-fs-m) $(usb-fs-y) 31obj-y += $(usb-fs-m) $(usb-fs-y)
29 32
30# Specific board support 33# Specific board support
31obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o 34obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o \
35 board-nand.o
32obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o 36obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
33obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 37obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
34obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o 38obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o board-nand.o
35obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o 39obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o board-nand.o
36obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o 40obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
37obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o 41obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o \
42 board-nand.o
38obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o 43obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
39obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o 44obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o
40obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o 45obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c
index fcce7ff37630..31197bd2dedc 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq.c
+++ b/arch/arm/mach-omap1/ams-delta-fiq.c
@@ -102,7 +102,7 @@ void __init ams_delta_init_fiq(void)
102 } 102 }
103 103
104 retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq, 104 retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq,
105 IRQ_TYPE_EDGE_RISING, "deferred_fiq", 0); 105 IRQ_TYPE_EDGE_RISING, "deferred_fiq", NULL);
106 if (retval < 0) { 106 if (retval < 0) {
107 pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval); 107 pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval);
108 release_fiq(&fh); 108 release_fiq(&fh);
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 80bd43c7f4ec..4a4afb371022 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -185,20 +185,6 @@ static struct platform_device nor_device = {
185 .resource = &nor_resource, 185 .resource = &nor_resource,
186}; 186};
187 187
188static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
189{
190 struct nand_chip *this = mtd->priv;
191 unsigned long mask;
192
193 if (cmd == NAND_CMD_NONE)
194 return;
195
196 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
197 if (ctrl & NAND_ALE)
198 mask |= 0x04;
199 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
200}
201
202#define FSAMPLE_NAND_RB_GPIO_PIN 62 188#define FSAMPLE_NAND_RB_GPIO_PIN 62
203 189
204static int nand_dev_ready(struct mtd_info *mtd) 190static int nand_dev_ready(struct mtd_info *mtd)
@@ -216,7 +202,7 @@ static struct platform_nand_data nand_data = {
216 .part_probe_types = part_probes, 202 .part_probe_types = part_probes,
217 }, 203 },
218 .ctrl = { 204 .ctrl = {
219 .cmd_ctrl = nand_cmd_ctl, 205 .cmd_ctrl = omap1_nand_cmd_ctl,
220 .dev_ready = nand_dev_ready, 206 .dev_ready = nand_dev_ready,
221 }, 207 },
222}; 208};
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 553a2e535764..057ec13f0649 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -179,20 +179,6 @@ static struct mtd_partition h2_nand_partitions[] = {
179 }, 179 },
180}; 180};
181 181
182static void h2_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
183{
184 struct nand_chip *this = mtd->priv;
185 unsigned long mask;
186
187 if (cmd == NAND_CMD_NONE)
188 return;
189
190 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
191 if (ctrl & NAND_ALE)
192 mask |= 0x04;
193 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
194}
195
196#define H2_NAND_RB_GPIO_PIN 62 182#define H2_NAND_RB_GPIO_PIN 62
197 183
198static int h2_nand_dev_ready(struct mtd_info *mtd) 184static int h2_nand_dev_ready(struct mtd_info *mtd)
@@ -212,9 +198,8 @@ static struct platform_nand_data h2_nand_platdata = {
212 .part_probe_types = h2_part_probes, 198 .part_probe_types = h2_part_probes,
213 }, 199 },
214 .ctrl = { 200 .ctrl = {
215 .cmd_ctrl = h2_nand_cmd_ctl, 201 .cmd_ctrl = omap1_nand_cmd_ctl,
216 .dev_ready = h2_nand_dev_ready, 202 .dev_ready = h2_nand_dev_ready,
217
218 }, 203 },
219}; 204};
220 205
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 4c19f4c06851..f6ddf8759657 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -181,20 +181,6 @@ static struct mtd_partition nand_partitions[] = {
181 }, 181 },
182}; 182};
183 183
184static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
185{
186 struct nand_chip *this = mtd->priv;
187 unsigned long mask;
188
189 if (cmd == NAND_CMD_NONE)
190 return;
191
192 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
193 if (ctrl & NAND_ALE)
194 mask |= 0x04;
195 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
196}
197
198#define H3_NAND_RB_GPIO_PIN 10 184#define H3_NAND_RB_GPIO_PIN 10
199 185
200static int nand_dev_ready(struct mtd_info *mtd) 186static int nand_dev_ready(struct mtd_info *mtd)
@@ -214,7 +200,7 @@ static struct platform_nand_data nand_platdata = {
214 .part_probe_types = part_probes, 200 .part_probe_types = part_probes,
215 }, 201 },
216 .ctrl = { 202 .ctrl = {
217 .cmd_ctrl = nand_cmd_ctl, 203 .cmd_ctrl = omap1_nand_cmd_ctl,
218 .dev_ready = nand_dev_ready, 204 .dev_ready = nand_dev_ready,
219 205
220 }, 206 },
diff --git a/arch/arm/mach-omap1/board-nand.c b/arch/arm/mach-omap1/board-nand.c
new file mode 100644
index 000000000000..4d0835327d20
--- /dev/null
+++ b/arch/arm/mach-omap1/board-nand.c
@@ -0,0 +1,37 @@
1/*
2 * linux/arch/arm/mach-omap1/board-nand.c
3 *
4 * Common OMAP1 board NAND code
5 *
6 * Copyright (C) 2004, 2012 Texas Instruments, Inc.
7 * Copyright (C) 2002 MontaVista Software, Inc.
8 * Copyright (C) 2001 RidgeRun, Inc.
9 * Author: RidgeRun, Inc.
10 * Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/mtd/mtd.h>
19#include <linux/mtd/nand.h>
20
21#include "common.h"
22
23void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
24{
25 struct nand_chip *this = mtd->priv;
26 unsigned long mask;
27
28 if (cmd == NAND_CMD_NONE)
29 return;
30
31 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
32 if (ctrl & NAND_ALE)
33 mask |= 0x04;
34
35 writeb(cmd, this->IO_ADDR_W + mask);
36}
37
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index a2c5abcd7c84..61ed4f0247ce 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -289,10 +289,10 @@ palmz71_gpio_setup(int early)
289 gpio_direction_input(PALMZ71_USBDETECT_GPIO); 289 gpio_direction_input(PALMZ71_USBDETECT_GPIO);
290 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO), 290 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
291 palmz71_powercable, IRQF_SAMPLE_RANDOM, 291 palmz71_powercable, IRQF_SAMPLE_RANDOM,
292 "palmz71-cable", 0)) 292 "palmz71-cable", NULL))
293 printk(KERN_ERR 293 printk(KERN_ERR
294 "IRQ request for power cable failed!\n"); 294 "IRQ request for power cable failed!\n");
295 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), 0); 295 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), NULL);
296 } 296 }
297} 297}
298 298
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 76d4ee05a814..a2c88890e767 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -143,20 +143,6 @@ static struct platform_device nor_device = {
143 .resource = &nor_resource, 143 .resource = &nor_resource,
144}; 144};
145 145
146static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
147{
148 struct nand_chip *this = mtd->priv;
149 unsigned long mask;
150
151 if (cmd == NAND_CMD_NONE)
152 return;
153
154 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
155 if (ctrl & NAND_ALE)
156 mask |= 0x04;
157 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
158}
159
160#define P2_NAND_RB_GPIO_PIN 62 146#define P2_NAND_RB_GPIO_PIN 62
161 147
162static int nand_dev_ready(struct mtd_info *mtd) 148static int nand_dev_ready(struct mtd_info *mtd)
@@ -174,7 +160,7 @@ static struct platform_nand_data nand_data = {
174 .part_probe_types = part_probes, 160 .part_probe_types = part_probes,
175 }, 161 },
176 .ctrl = { 162 .ctrl = {
177 .cmd_ctrl = nand_cmd_ctl, 163 .cmd_ctrl = omap1_nand_cmd_ctl,
178 .dev_ready = nand_dev_ready, 164 .dev_ready = nand_dev_ready,
179 }, 165 },
180}; 166};
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 67382ddd8c83..a9ee06b6cb42 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -194,9 +194,8 @@ int omap1_select_table_rate(struct clk *clk, unsigned long rate)
194{ 194{
195 /* Find the highest supported frequency <= rate and switch to it */ 195 /* Find the highest supported frequency <= rate and switch to it */
196 struct mpu_rate * ptr; 196 struct mpu_rate * ptr;
197 unsigned long dpll1_rate, ref_rate; 197 unsigned long ref_rate;
198 198
199 dpll1_rate = ck_dpll1_p->rate;
200 ref_rate = ck_ref_p->rate; 199 ref_rate = ck_ref_p->rate;
201 200
202 for (ptr = omap1_rate_table; ptr->rate; ptr++) { 201 for (ptr = omap1_rate_table; ptr->rate; ptr++) {
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index af658ad338ec..8cc616e6f54a 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -27,6 +27,7 @@
27#define __ARCH_ARM_MACH_OMAP1_COMMON_H 27#define __ARCH_ARM_MACH_OMAP1_COMMON_H
28 28
29#include <plat/common.h> 29#include <plat/common.h>
30#include <linux/mtd/mtd.h>
30 31
31#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 32#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
32void omap7xx_map_io(void); 33void omap7xx_map_io(void);
@@ -56,8 +57,16 @@ void omap1_init_early(void);
56void omap1_init_irq(void); 57void omap1_init_irq(void);
57void omap1_restart(char, const char *); 58void omap1_restart(char, const char *);
58 59
60extern void __init omap_check_revision(void);
61
62extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
63 unsigned int ctrl);
64
59extern struct sys_timer omap1_timer; 65extern struct sys_timer omap1_timer;
60extern bool omap_32k_timer_init(void); 66extern bool omap_32k_timer_init(void);
61extern void __init omap_init_consistent_dma_size(void); 67
68extern u32 omap_irq_flags;
69
70extern int ocpi_enable(void);
62 71
63#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 72#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 76c67b3f9f61..29ec50fc688d 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -87,7 +87,7 @@ static void fpga_mask_ack_irq(struct irq_data *d)
87 fpga_ack_irq(d); 87 fpga_ack_irq(d);
88} 88}
89 89
90void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc) 90static void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
91{ 91{
92 u32 stat; 92 u32 stat;
93 int fpga_irq; 93 int fpga_irq;
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index 2b28e1da14b0..a1b846aacdaf 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -21,6 +21,8 @@
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23 23
24#include "common.h"
25
24#define OMAP_DIE_ID_0 0xfffe1800 26#define OMAP_DIE_ID_0 0xfffe1800
25#define OMAP_DIE_ID_1 0xfffe1804 27#define OMAP_DIE_ID_1 0xfffe1804
26#define OMAP_PRODUCTION_ID_0 0xfffe2000 28#define OMAP_PRODUCTION_ID_0 0xfffe2000
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index d969a7203d14..71ce017bf5d8 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -18,13 +18,12 @@
18 18
19#include <plat/mux.h> 19#include <plat/mux.h>
20#include <plat/tc.h> 20#include <plat/tc.h>
21#include <plat/dma.h>
21 22
22#include "iomap.h" 23#include "iomap.h"
23#include "common.h" 24#include "common.h"
24#include "clock.h" 25#include "clock.h"
25 26
26extern void omap_check_revision(void);
27
28/* 27/*
29 * The machine specific code may provide the extra mapping besides the 28 * The machine specific code may provide the extra mapping besides the
30 * default mapping provided here. 29 * default mapping provided here.
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 4448114fab72..6995fb6a3345 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -49,6 +49,8 @@
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51 51
52#include "common.h"
53
52#define IRQ_BANK(irq) ((irq) >> 5) 54#define IRQ_BANK(irq) ((irq) >> 5)
53#define IRQ_BIT(irq) ((irq) & 0x1f) 55#define IRQ_BIT(irq) ((irq) & 0x1f)
54 56
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index 86ace9aaa663..5769c71815b2 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -57,7 +57,7 @@ static struct lcd_dma_info {
57 void *cb_data; 57 void *cb_data;
58 58
59 int active; 59 int active;
60 unsigned long addr, size; 60 unsigned long addr;
61 int rotate, data_type, xres, yres; 61 int rotate, data_type, xres, yres;
62 int vxres; 62 int vxres;
63 int mirror; 63 int mirror;
@@ -77,11 +77,6 @@ void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
77} 77}
78EXPORT_SYMBOL(omap_set_lcd_dma_b1); 78EXPORT_SYMBOL(omap_set_lcd_dma_b1);
79 79
80void omap_set_lcd_dma_src_port(int port)
81{
82 lcd_dma.src_port = port;
83}
84
85void omap_set_lcd_dma_ext_controller(int external) 80void omap_set_lcd_dma_ext_controller(int external)
86{ 81{
87 lcd_dma.ext_ctrl = external; 82 lcd_dma.ext_ctrl = external;
diff --git a/arch/arm/mach-omap1/ocpi.c b/arch/arm/mach-omap1/ocpi.c
new file mode 100644
index 000000000000..238170cab5b7
--- /dev/null
+++ b/arch/arm/mach-omap1/ocpi.c
@@ -0,0 +1,112 @@
1/*
2 * linux/arch/arm/plat-omap/ocpi.c
3 *
4 * Minimal OCP bus support for omap16xx
5 *
6 * Copyright (C) 2003 - 2005 Nokia Corporation
7 * Copyright (C) 2012 Texas Instruments, Inc.
8 * Written by Tony Lindgren <tony@atomide.com>
9 *
10 * Modified for clock framework by Paul Mundt <paul.mundt@nokia.com>.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#include <linux/module.h>
28#include <linux/types.h>
29#include <linux/errno.h>
30#include <linux/kernel.h>
31#include <linux/init.h>
32#include <linux/spinlock.h>
33#include <linux/err.h>
34#include <linux/clk.h>
35#include <linux/io.h>
36
37#include <mach/hardware.h>
38
39#include "common.h"
40
41#define OCPI_BASE 0xfffec320
42#define OCPI_FAULT (OCPI_BASE + 0x00)
43#define OCPI_CMD_FAULT (OCPI_BASE + 0x04)
44#define OCPI_SINT0 (OCPI_BASE + 0x08)
45#define OCPI_TABORT (OCPI_BASE + 0x0c)
46#define OCPI_SINT1 (OCPI_BASE + 0x10)
47#define OCPI_PROT (OCPI_BASE + 0x14)
48#define OCPI_SEC (OCPI_BASE + 0x18)
49
50/* USB OHCI OCPI access error registers */
51#define HOSTUEADDR 0xfffba0e0
52#define HOSTUESTATUS 0xfffba0e4
53
54static struct clk *ocpi_ck;
55
56/*
57 * Enables device access to OMAP buses via the OCPI bridge
58 * FIXME: Add locking
59 */
60int ocpi_enable(void)
61{
62 unsigned int val;
63
64 if (!cpu_is_omap16xx())
65 return -ENODEV;
66
67 /* Enable access for OHCI in OCPI */
68 val = omap_readl(OCPI_PROT);
69 val &= ~0xff;
70 /* val &= (1 << 0); Allow access only to EMIFS */
71 omap_writel(val, OCPI_PROT);
72
73 val = omap_readl(OCPI_SEC);
74 val &= ~0xff;
75 omap_writel(val, OCPI_SEC);
76
77 return 0;
78}
79EXPORT_SYMBOL(ocpi_enable);
80
81static int __init omap_ocpi_init(void)
82{
83 if (!cpu_is_omap16xx())
84 return -ENODEV;
85
86 ocpi_ck = clk_get(NULL, "l3_ocpi_ck");
87 if (IS_ERR(ocpi_ck))
88 return PTR_ERR(ocpi_ck);
89
90 clk_enable(ocpi_ck);
91 ocpi_enable();
92 pr_info("OMAP OCPI interconnect driver loaded\n");
93
94 return 0;
95}
96
97static void __exit omap_ocpi_exit(void)
98{
99 /* REVISIT: Disable OCPI */
100
101 if (!cpu_is_omap16xx())
102 return;
103
104 clk_disable(ocpi_ck);
105 clk_put(ocpi_ck);
106}
107
108MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
109MODULE_DESCRIPTION("OMAP OCPI bus controller module");
110MODULE_LICENSE("GPL");
111module_init(omap_ocpi_init);
112module_exit(omap_ocpi_exit);
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index f66c32912b22..b2560d32b3a0 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -569,11 +569,10 @@ static int omap_pm_read_proc(
569 569
570static void omap_pm_init_proc(void) 570static void omap_pm_init_proc(void)
571{ 571{
572 struct proc_dir_entry *entry; 572 /* XXX Appears to leak memory */
573 573 create_proc_read_entry("driver/omap_pm",
574 entry = create_proc_read_entry("driver/omap_pm", 574 S_IWUSR | S_IRUGO, NULL,
575 S_IWUSR | S_IRUGO, NULL, 575 omap_pm_read_proc, NULL);
576 omap_pm_read_proc, NULL);
577} 576}
578 577
579#endif /* DEBUG && CONFIG_PROC_FS */ 578#endif /* DEBUG && CONFIG_PROC_FS */
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index f255b153b863..b17709103866 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -8,6 +8,8 @@
8 8
9#include <mach/hardware.h> 9#include <mach/hardware.h>
10 10
11#include "common.h"
12
11void omap1_restart(char mode, const char *cmd) 13void omap1_restart(char mode, const char *cmd)
12{ 14{
13 /* 15 /*
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index fb202af01d0d..64c65bcb2d67 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -54,8 +54,7 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,
54 return 0; 54 return 0;
55} 55}
56 56
57 57static int __init omap1_dm_timer_init(void)
58int __init omap1_dm_timer_init(void)
59{ 58{
60 int i; 59 int i;
61 int ret; 60 int ret;
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c
index 19de03b074e3..e61afd922766 100644
--- a/arch/arm/mach-omap1/usb.c
+++ b/arch/arm/mach-omap1/usb.c
@@ -29,6 +29,8 @@
29#include <plat/mux.h> 29#include <plat/mux.h>
30#include <plat/usb.h> 30#include <plat/usb.h>
31 31
32#include "common.h"
33
32/* These routines should handle the standard chip-specific modes 34/* These routines should handle the standard chip-specific modes
33 * for usb0/1/2 ports, covering basic mux and transceiver setup. 35 * for usb0/1/2 ports, covering basic mux and transceiver setup.
34 * 36 *
@@ -138,6 +140,7 @@ static inline void ohci_device_init(struct omap_usb_config *pdata)
138 if (cpu_is_omap7xx()) 140 if (cpu_is_omap7xx())
139 ohci_resources[1].start = INT_7XX_USB_HHC_1; 141 ohci_resources[1].start = INT_7XX_USB_HHC_1;
140 pdata->ohci_device = &ohci_device; 142 pdata->ohci_device = &ohci_device;
143 pdata->ocpi_enable = &ocpi_enable;
141} 144}
142 145
143#else 146#else