aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c5
-rw-r--r--arch/arm/mach-omap1/board-h2.c3
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c2
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c2
-rw-r--r--arch/arm/mach-omap1/board-innovator.c2
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c2
-rw-r--r--arch/arm/mach-omap1/board-palmte.c3
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c3
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c3
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-sx1.c3
-rw-r--r--arch/arm/mach-omap1/devices.c11
-rw-r--r--arch/arm/mach-omap1/dma.c4
-rw-r--r--arch/arm/mach-omap1/dma.h83
-rw-r--r--arch/arm/mach-omap1/io.c2
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c4
-rw-r--r--arch/arm/mach-omap1/mcbsp.c3
-rw-r--r--arch/arm/mach-omap1/mmc.h18
-rw-r--r--arch/arm/mach-omap1/pm.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c4
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-apollon.c2
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c5
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c5
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c10
-rw-r--r--arch/arm/mach-omap2/board-flash.c50
-rw-r--r--arch/arm/mach-omap2/board-flash.h8
-rw-r--r--arch/arm/mach-omap2/board-h4.c4
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c5
-rw-r--r--arch/arm/mach-omap2/board-ldp.c6
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c10
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c8
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c4
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c10
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c2
-rw-r--r--arch/arm/mach-omap2/board-overo.c9
-rw-r--r--arch/arm/mach-omap2/board-rm680.c5
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c5
-rw-r--r--arch/arm/mach-omap2/board-rx51.c6
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c2
-rw-r--r--arch/arm/mach-omap2/board-zoom.c5
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c46
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h1
-rw-r--r--arch/arm/mach-omap2/devices.c3
-rw-r--r--arch/arm/mach-omap2/dma.c2
-rw-r--r--arch/arm/mach-omap2/dma.h131
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c85
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.h27
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c214
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.h24
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c2
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c2
-rw-r--r--arch/arm/mach-omap2/gpmc.c459
-rw-r--r--arch/arm/mach-omap2/gpmc.h (renamed from arch/arm/plat-omap/include/plat/gpmc.h)61
-rw-r--r--arch/arm/mach-omap2/hsmmc.c2
-rw-r--r--arch/arm/mach-omap2/io.c2
-rw-r--r--arch/arm/mach-omap2/mcbsp.c2
-rw-r--r--arch/arm/mach-omap2/mmc.h23
-rw-r--r--arch/arm/mach-omap2/msdi.c2
-rw-r--r--arch/arm/mach-omap2/omap4-common.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c4
-rw-r--r--arch/arm/mach-omap2/pm24xx.c2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c4
-rw-r--r--arch/arm/mach-omap2/serial.c2
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c2
-rw-r--r--arch/arm/plat-omap/common.c2
-rw-r--r--arch/arm/plat-omap/dma.c2
-rw-r--r--arch/arm/plat-omap/include/plat-omap/dma-omap.h (renamed from arch/arm/plat-omap/include/plat/dma.h)181
-rw-r--r--arch/arm/plat-omap/include/plat/dma-44xx.h147
-rw-r--r--drivers/char/hw_random/omap-rng.c2
-rw-r--r--drivers/crypto/omap-aes.c8
-rw-r--r--drivers/crypto/omap-sham.c10
-rw-r--r--drivers/dma/omap-dma.c11
-rw-r--r--drivers/media/platform/omap/omap_vout.c2
-rw-r--r--drivers/media/platform/omap/omap_vout_vrfb.c4
-rw-r--r--drivers/media/platform/omap3isp/isphist.c2
-rw-r--r--drivers/media/platform/omap3isp/ispstat.h2
-rw-r--r--drivers/media/platform/soc_camera/omap1_camera.c3
-rw-r--r--drivers/mmc/host/omap.c35
-rw-r--r--drivers/mmc/host/omap_hsmmc.c4
-rw-r--r--drivers/mtd/nand/omap2.c129
-rw-r--r--drivers/mtd/onenand/omap2.c11
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/host_os.h1
-rw-r--r--drivers/usb/gadget/omap_udc.c4
-rw-r--r--drivers/usb/musb/tusb6010_omap.c9
-rw-r--r--drivers/video/omap/lcdc.c2
-rw-r--r--drivers/video/omap/omapfb_main.c2
-rw-r--r--drivers/video/omap/sossi.c2
-rw-r--r--include/linux/platform_data/mmc-omap.h (renamed from arch/arm/plat-omap/include/plat/mmc.h)48
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h46
-rw-r--r--include/linux/platform_data/mtd-onenand-omap2.h28
-rw-r--r--sound/soc/omap/omap-pcm.c9
103 files changed, 900 insertions, 1270 deletions
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index e1362ce48497..7119ef28e0ad 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -13,12 +13,11 @@
13 */ 13 */
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16#include <linux/platform_data/gpio-omap.h>
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h>
20
21#include "board-h2.h" 19#include "board-h2.h"
20#include "mmc.h"
22 21
23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
24 23
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 376f7f29ef77..fc84e2b3400a 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -39,7 +39,7 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include <mach/mux.h> 41#include <mach/mux.h>
42#include <plat/dma.h> 42#include <plat-omap/dma-omap.h>
43#include <plat/tc.h> 43#include <plat/tc.h>
44#include <mach/irda.h> 44#include <mach/irda.h>
45#include <linux/platform_data/keypad-omap.h> 45#include <linux/platform_data/keypad-omap.h>
@@ -50,6 +50,7 @@
50 50
51#include "common.h" 51#include "common.h"
52#include "board-h2.h" 52#include "board-h2.h"
53#include "dma.h"
53 54
54/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 55/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
55#define OMAP1610_ETHR_START 0x04000300 56#define OMAP1610_ETHR_START 0x04000300
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index c74daace8cd6..17d77914d769 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -16,9 +16,8 @@
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h>
20
21#include "board-h3.h" 19#include "board-h3.h"
20#include "mmc.h"
22 21
23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
24 23
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index ededdb7ef28c..81f55a6c5678 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -43,7 +43,7 @@
43#include <mach/mux.h> 43#include <mach/mux.h>
44#include <plat/tc.h> 44#include <plat/tc.h>
45#include <linux/platform_data/keypad-omap.h> 45#include <linux/platform_data/keypad-omap.h>
46#include <plat/dma.h> 46#include <plat-omap/dma-omap.h>
47#include <mach/flash.h> 47#include <mach/flash.h>
48 48
49#include <mach/hardware.h> 49#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 87ab2086ef96..f23200ceb43d 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -43,7 +43,7 @@
43#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
44 44
45#include <mach/omap7xx.h> 45#include <mach/omap7xx.h>
46#include <plat/mmc.h> 46#include "mmc.h"
47 47
48#include <mach/irqs.h> 48#include <mach/irqs.h>
49#include <mach/usb.h> 49#include <mach/usb.h>
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index db5f7d2976e7..411cc5b14ce3 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -36,13 +36,13 @@
36#include <plat/fpga.h> 36#include <plat/fpga.h>
37#include <plat/tc.h> 37#include <plat/tc.h>
38#include <linux/platform_data/keypad-omap.h> 38#include <linux/platform_data/keypad-omap.h>
39#include <plat/mmc.h>
40 39
41#include <mach/hardware.h> 40#include <mach/hardware.h>
42#include <mach/usb.h> 41#include <mach/usb.h>
43 42
44#include "iomap.h" 43#include "iomap.h"
45#include "common.h" 44#include "common.h"
45#include "mmc.h"
46 46
47/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 47/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
48#define INNOVATOR1610_ETHR_START 0x04000300 48#define INNOVATOR1610_ETHR_START 0x04000300
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 7d5c06d6a52a..cb72f2474430 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -29,13 +29,13 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <mach/mux.h> 31#include <mach/mux.h>
32#include <plat/mmc.h>
33#include <plat/clock.h> 32#include <plat/clock.h>
34 33
35#include <mach/hardware.h> 34#include <mach/hardware.h>
36#include <mach/usb.h> 35#include <mach/usb.h>
37 36
38#include "common.h" 37#include "common.h"
38#include "mmc.h"
39 39
40#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
41 41
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 1c578d58923a..eac94c267f5b 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -37,7 +37,7 @@
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/tc.h> 39#include <plat/tc.h>
40#include <plat/dma.h> 40#include <plat-omap/dma-omap.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 42#include <linux/platform_data/keypad-omap.h>
43 43
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49#define PALMTE_USBDETECT_GPIO 0 50#define PALMTE_USBDETECT_GPIO 0
50#define PALMTE_USB_OR_DC_GPIO 1 51#define PALMTE_USB_OR_DC_GPIO 1
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 97158095083c..5b8ac0fcf451 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -36,7 +36,7 @@
36#include <plat/led.h> 36#include <plat/led.h>
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/dma.h> 39#include <plat-omap/dma-omap.h>
40#include <plat/tc.h> 40#include <plat/tc.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 42#include <linux/platform_data/keypad-omap.h>
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49#define PALMTT_USBDETECT_GPIO 0 50#define PALMTT_USBDETECT_GPIO 0
50#define PALMTT_CABLE_GPIO 1 51#define PALMTT_CABLE_GPIO 1
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index e311032e7eeb..9f3460321ecd 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -38,7 +38,7 @@
38 38
39#include <mach/flash.h> 39#include <mach/flash.h>
40#include <mach/mux.h> 40#include <mach/mux.h>
41#include <plat/dma.h> 41#include <plat-omap/dma-omap.h>
42#include <plat/tc.h> 42#include <plat/tc.h>
43#include <mach/irda.h> 43#include <mach/irda.h>
44#include <linux/platform_data/keypad-omap.h> 44#include <linux/platform_data/keypad-omap.h>
@@ -47,6 +47,7 @@
47#include <mach/usb.h> 47#include <mach/usb.h>
48 48
49#include "common.h" 49#include "common.h"
50#include "dma.h"
50 51
51#define PALMZ71_USBDETECT_GPIO 0 52#define PALMZ71_USBDETECT_GPIO 0
52#define PALMZ71_PENIRQ_GPIO 6 53#define PALMZ71_PENIRQ_GPIO 6
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index 5932d56e17bf..4fcf19c78a08 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -16,9 +16,10 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <plat/mmc.h>
20#include <mach/board-sx1.h> 19#include <mach/board-sx1.h>
21 20
21#include "mmc.h"
22
22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
23 24
24static int mmc_set_power(struct device *dev, int slot, int power_on, 25static int mmc_set_power(struct device *dev, int slot, int power_on,
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 13bf2cc56814..f4c5db991226 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -36,7 +36,7 @@
36 36
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/dma.h> 39#include <plat-omap/dma-omap.h>
40#include <mach/irda.h> 40#include <mach/irda.h>
41#include <plat/tc.h> 41#include <plat/tc.h>
42#include <mach/board-sx1.h> 42#include <mach/board-sx1.h>
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49/* Write to I2C device */ 50/* Write to I2C device */
50int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) 51int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index d3fec92c54cb..8e32d50d275b 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -21,8 +21,6 @@
21 21
22#include <plat/tc.h> 22#include <plat/tc.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/dma.h>
25#include <plat/mmc.h>
26 24
27#include <mach/omap7xx.h> 25#include <mach/omap7xx.h>
28#include <mach/camera.h> 26#include <mach/camera.h>
@@ -30,6 +28,8 @@
30 28
31#include "common.h" 29#include "common.h"
32#include "clock.h" 30#include "clock.h"
31#include "dma.h"
32#include "mmc.h"
33 33
34#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) 34#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
35 35
@@ -175,6 +175,13 @@ static int __init omap_mmc_add(const char *name, int id, unsigned long base,
175 res[3].name = "tx"; 175 res[3].name = "tx";
176 res[3].flags = IORESOURCE_DMA; 176 res[3].flags = IORESOURCE_DMA;
177 177
178 if (cpu_is_omap7xx())
179 data->slots[0].features = MMC_OMAP7XX;
180 if (cpu_is_omap15xx())
181 data->slots[0].features = MMC_OMAP15XX;
182 if (cpu_is_omap16xx())
183 data->slots[0].features = MMC_OMAP16XX;
184
178 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); 185 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
179 if (ret == 0) 186 if (ret == 0)
180 ret = platform_device_add_data(pdev, data, sizeof(*data)); 187 ret = platform_device_add_data(pdev, data, sizeof(*data));
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index 29007fef84cd..91594177f6bc 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -25,11 +25,13 @@
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <plat/dma.h> 28#include <plat-omap/dma-omap.h>
29#include <plat/tc.h> 29#include <plat/tc.h>
30 30
31#include <mach/irqs.h> 31#include <mach/irqs.h>
32 32
33#include "dma.h"
34
33#define OMAP1_DMA_BASE (0xfffed800) 35#define OMAP1_DMA_BASE (0xfffed800)
34#define OMAP1_LOGICAL_DMA_CH_COUNT 17 36#define OMAP1_LOGICAL_DMA_CH_COUNT 17
35#define OMAP1_DMA_STRIDE 0x40 37#define OMAP1_DMA_STRIDE 0x40
diff --git a/arch/arm/mach-omap1/dma.h b/arch/arm/mach-omap1/dma.h
new file mode 100644
index 000000000000..da6345dab03f
--- /dev/null
+++ b/arch/arm/mach-omap1/dma.h
@@ -0,0 +1,83 @@
1/*
2 * OMAP1 DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP1_DMA_CHANNEL_H
20#define __OMAP1_DMA_CHANNEL_H
21
22/* DMA channels for omap1 */
23#define OMAP_DMA_NO_DEVICE 0
24#define OMAP_DMA_MCSI1_TX 1
25#define OMAP_DMA_MCSI1_RX 2
26#define OMAP_DMA_I2C_RX 3
27#define OMAP_DMA_I2C_TX 4
28#define OMAP_DMA_EXT_NDMA_REQ 5
29#define OMAP_DMA_EXT_NDMA_REQ2 6
30#define OMAP_DMA_UWIRE_TX 7
31#define OMAP_DMA_MCBSP1_TX 8
32#define OMAP_DMA_MCBSP1_RX 9
33#define OMAP_DMA_MCBSP3_TX 10
34#define OMAP_DMA_MCBSP3_RX 11
35#define OMAP_DMA_UART1_TX 12
36#define OMAP_DMA_UART1_RX 13
37#define OMAP_DMA_UART2_TX 14
38#define OMAP_DMA_UART2_RX 15
39#define OMAP_DMA_MCBSP2_TX 16
40#define OMAP_DMA_MCBSP2_RX 17
41#define OMAP_DMA_UART3_TX 18
42#define OMAP_DMA_UART3_RX 19
43#define OMAP_DMA_CAMERA_IF_RX 20
44#define OMAP_DMA_MMC_TX 21
45#define OMAP_DMA_MMC_RX 22
46#define OMAP_DMA_NAND 23
47#define OMAP_DMA_IRQ_LCD_LINE 24
48#define OMAP_DMA_MEMORY_STICK 25
49#define OMAP_DMA_USB_W2FC_RX0 26
50#define OMAP_DMA_USB_W2FC_RX1 27
51#define OMAP_DMA_USB_W2FC_RX2 28
52#define OMAP_DMA_USB_W2FC_TX0 29
53#define OMAP_DMA_USB_W2FC_TX1 30
54#define OMAP_DMA_USB_W2FC_TX2 31
55
56/* These are only for 1610 */
57#define OMAP_DMA_CRYPTO_DES_IN 32
58#define OMAP_DMA_SPI_TX 33
59#define OMAP_DMA_SPI_RX 34
60#define OMAP_DMA_CRYPTO_HASH 35
61#define OMAP_DMA_CCP_ATTN 36
62#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
63#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
64#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
65#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
66#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
67#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
68#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
69#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
70#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
71#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
72#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
73#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
74#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
75#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
76#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
77#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
78#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
79#define OMAP_DMA_MMC2_TX 54
80#define OMAP_DMA_MMC2_RX 55
81#define OMAP_DMA_CRYPTO_DES_OUT 56
82
83#endif /* __OMAP1_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 6a5baab1f4cb..244cc757ce7d 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -18,7 +18,7 @@
18 18
19#include <mach/mux.h> 19#include <mach/mux.h>
20#include <plat/tc.h> 20#include <plat/tc.h>
21#include <plat/dma.h> 21#include <plat-omap/dma-omap.h>
22 22
23#include "iomap.h" 23#include "iomap.h"
24#include "common.h" 24#include "common.h"
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index ed42628611bc..7ed8c1857d56 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -27,11 +27,13 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <plat/dma.h> 30#include <plat-omap/dma-omap.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/lcdc.h> 33#include <mach/lcdc.h>
34 34
35#include "dma.h"
36
35int omap_lcd_dma_running(void) 37int omap_lcd_dma_running(void)
36{ 38{
37 /* 39 /*
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index bdc2e7541adb..3d461e1b8577 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -19,7 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21 21
22#include <plat/dma.h> 22#include <plat-omap/dma-omap.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/cpu.h> 24#include <plat/cpu.h>
25#include <linux/platform_data/asoc-ti-mcbsp.h> 25#include <linux/platform_data/asoc-ti-mcbsp.h>
@@ -27,6 +27,7 @@
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28 28
29#include "iomap.h" 29#include "iomap.h"
30#include "dma.h"
30 31
31#define DPS_RSTCT2_PER_EN (1 << 0) 32#define DPS_RSTCT2_PER_EN (1 << 0)
32#define DSP_RSTCT2_WD_PER_EN (1 << 1) 33#define DSP_RSTCT2_WD_PER_EN (1 << 1)
diff --git a/arch/arm/mach-omap1/mmc.h b/arch/arm/mach-omap1/mmc.h
new file mode 100644
index 000000000000..39c2b13de884
--- /dev/null
+++ b/arch/arm/mach-omap1/mmc.h
@@ -0,0 +1,18 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3
4#define OMAP15XX_NR_MMC 1
5#define OMAP16XX_NR_MMC 2
6#define OMAP1_MMC_SIZE 0x080
7#define OMAP1_MMC1_BASE 0xfffb7800
8#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
9
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
12 int nr_controllers);
13#else
14static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
15 int nr_controllers)
16{
17}
18#endif
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 47ec16155483..c16b03ad5b50 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -54,7 +54,7 @@
54#include <plat/sram.h> 54#include <plat/sram.h>
55#include <plat/tc.h> 55#include <plat/tc.h>
56#include <mach/mux.h> 56#include <mach/mux.h>
57#include <plat/dma.h> 57#include <plat-omap/dma-omap.h>
58#include <plat/dmtimer.h> 58#include <plat/dmtimer.h>
59 59
60#include <mach/irqs.h> 60#include <mach/irqs.h>
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 95b384d54f8a..49e49d0b7cf5 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -34,7 +34,7 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include "common.h" 36#include "common.h"
37#include <plat/gpmc.h> 37#include "gpmc.h"
38#include <plat/usb.h> 38#include <plat/usb.h>
39#include "gpmc-smc91x.h" 39#include "gpmc-smc91x.h"
40 40
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 96cd3693e1ae..3e8725b73161 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -32,11 +32,11 @@
32 32
33#include <plat/usb.h> 33#include <plat/usb.h>
34#include "common.h" 34#include "common.h"
35#include <plat/dma.h> 35#include <plat-omap/dma-omap.h>
36#include <plat/gpmc.h>
37#include <video/omapdss.h> 36#include <video/omapdss.h>
38#include <video/omap-panel-tfp410.h> 37#include <video/omap-panel-tfp410.h>
39 38
39#include "gpmc.h"
40#include "gpmc-smc91x.h" 40#include "gpmc-smc91x.h"
41 41
42#include "board-flash.h" 42#include "board-flash.h"
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 3669c120c7e8..2ab267ec3b75 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -35,7 +35,6 @@
35 35
36#include "common.h" 36#include "common.h"
37#include <plat/usb.h> 37#include <plat/usb.h>
38#include <plat/mmc.h>
39#include "omap4-keypad.h" 38#include "omap4-keypad.h"
40#include <video/omapdss.h> 39#include <video/omapdss.h>
41#include <video/omap-panel-nokia-dsi.h> 40#include <video/omap-panel-nokia-dsi.h>
@@ -45,6 +44,7 @@
45 44
46#include "soc.h" 45#include "soc.h"
47#include "mux.h" 46#include "mux.h"
47#include "mmc.h"
48#include "hsmmc.h" 48#include "hsmmc.h"
49#include "control.h" 49#include "control.h"
50#include "common-board-devices.h" 50#include "common-board-devices.h"
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index cea3abace815..8cdd18699de6 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -35,7 +35,7 @@
35 35
36#include <plat/led.h> 36#include <plat/led.h>
37#include "common.h" 37#include "common.h"
38#include <plat/gpmc.h> 38#include "gpmc.h"
39 39
40#include <video/omapdss.h> 40#include <video/omapdss.h>
41#include <video/omap-panel-generic-dpi.h> 41#include <video/omap-panel-generic-dpi.h>
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 376d26eb601c..73e2ba9b343b 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -40,7 +40,7 @@
40 40
41#include "common.h" 41#include "common.h"
42#include <linux/platform_data/mtd-nand-omap2.h> 42#include <linux/platform_data/mtd-nand-omap2.h>
43#include <plat/gpmc.h> 43#include "gpmc.h"
44#include <plat/usb.h> 44#include <plat/usb.h>
45#include <video/omapdss.h> 45#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 46#include <video/omap-panel-generic-dpi.h>
@@ -53,6 +53,7 @@
53#include "sdram-micron-mt46h32m32lf-6.h" 53#include "sdram-micron-mt46h32m32lf-6.h"
54#include "hsmmc.h" 54#include "hsmmc.h"
55#include "common-board-devices.h" 55#include "common-board-devices.h"
56#include "gpmc-nand.h"
56 57
57#define CM_T35_GPIO_PENDOWN 57 58#define CM_T35_GPIO_PENDOWN 57
58#define SB_T35_USB_HUB_RESET_GPIO 167 59#define SB_T35_USB_HUB_RESET_GPIO 167
@@ -181,7 +182,7 @@ static struct omap_nand_platform_data cm_t35_nand_data = {
181 182
182static void __init cm_t35_init_nand(void) 183static void __init cm_t35_init_nand(void)
183{ 184{
184 if (gpmc_nand_init(&cm_t35_nand_data) < 0) 185 if (gpmc_nand_init(&cm_t35_nand_data, NULL) < 0)
185 pr_err("CM-T35: Unable to register NAND device\n"); 186 pr_err("CM-T35: Unable to register NAND device\n");
186} 187}
187#else 188#else
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 59c0a45f75b0..b5495e415024 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -41,7 +41,7 @@
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/platform_data/mtd-nand-omap2.h> 43#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/gpmc.h> 44#include "gpmc.h"
45 45
46#include "am35xx.h" 46#include "am35xx.h"
47 47
@@ -49,6 +49,7 @@
49#include "control.h" 49#include "control.h"
50#include "common-board-devices.h" 50#include "common-board-devices.h"
51#include "am35xx-emac.h" 51#include "am35xx-emac.h"
52#include "gpmc-nand.h"
52 53
53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 54#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
54static struct gpio_led cm_t3517_leds[] = { 55static struct gpio_led cm_t3517_leds[] = {
@@ -240,7 +241,7 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
240 241
241static void __init cm_t3517_init_nand(void) 242static void __init cm_t3517_init_nand(void)
242{ 243{
243 if (gpmc_nand_init(&cm_t3517_nand_data) < 0) 244 if (gpmc_nand_init(&cm_t3517_nand_data, NULL) < 0)
244 pr_err("CM-T3517: NAND initialization failed\n"); 245 pr_err("CM-T3517: NAND initialization failed\n");
245} 246}
246#else 247#else
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 1fd161e934c7..3eedb8fd0370 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -39,7 +39,7 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/gpmc.h> 42#include "gpmc.h"
43#include <linux/platform_data/mtd-nand-omap2.h> 43#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/usb.h> 44#include <plat/usb.h>
45#include <video/omapdss.h> 45#include <video/omapdss.h>
@@ -55,8 +55,11 @@
55#include "sdram-micron-mt46h32m32lf-6.h" 55#include "sdram-micron-mt46h32m32lf-6.h"
56#include "mux.h" 56#include "mux.h"
57#include "hsmmc.h" 57#include "hsmmc.h"
58#include "board-flash.h"
58#include "common-board-devices.h" 59#include "common-board-devices.h"
59 60
61#define NAND_CS 0
62
60#define OMAP_DM9000_GPIO_IRQ 25 63#define OMAP_DM9000_GPIO_IRQ 25
61#define OMAP3_DEVKIT_TS_GPIO 27 64#define OMAP3_DEVKIT_TS_GPIO 27
62 65
@@ -621,8 +624,9 @@ static void __init devkit8000_init(void)
621 624
622 usb_musb_init(NULL); 625 usb_musb_init(NULL);
623 usbhs_init(&usbhs_bdata); 626 usbhs_init(&usbhs_bdata);
624 omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions, 627 board_nand_init(devkit8000_nand_partitions,
625 ARRAY_SIZE(devkit8000_nand_partitions)); 628 ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
629 NAND_BUSWIDTH_16, NULL);
626 omap_twl4030_audio_init("omap3beagle"); 630 omap_twl4030_audio_init("omap3beagle");
627 631
628 /* Ensure SDRC pins are mux'd for self-refresh */ 632 /* Ensure SDRC pins are mux'd for self-refresh */
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index e642acf9cad0..020b96b91f73 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -18,13 +18,15 @@
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include <plat/cpu.h> 20#include <plat/cpu.h>
21#include <plat/gpmc.h> 21#include "gpmc.h"
22#include <linux/platform_data/mtd-nand-omap2.h> 22#include <linux/platform_data/mtd-nand-omap2.h>
23#include <linux/platform_data/mtd-onenand-omap2.h> 23#include <linux/platform_data/mtd-onenand-omap2.h>
24#include <plat/tc.h> 24#include <plat/tc.h>
25 25
26#include "common.h" 26#include "common.h"
27#include "board-flash.h" 27#include "board-flash.h"
28#include "gpmc-onenand.h"
29#include "gpmc-nand.h"
28 30
29#define REG_FPGA_REV 0x10 31#define REG_FPGA_REV 0x10
30#define REG_FPGA_DIP_SWITCH_INPUT2 0x60 32#define REG_FPGA_DIP_SWITCH_INPUT2 0x60
@@ -104,36 +106,35 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
104 defined(CONFIG_MTD_NAND_OMAP2_MODULE) 106 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
105 107
106/* Note that all values in this struct are in nanoseconds */ 108/* Note that all values in this struct are in nanoseconds */
107static struct gpmc_timings nand_timings = { 109struct gpmc_timings nand_default_timings[1] = {
110 {
111 .sync_clk = 0,
108 112
109 .sync_clk = 0, 113 .cs_on = 0,
114 .cs_rd_off = 36,
115 .cs_wr_off = 36,
110 116
111 .cs_on = 0, 117 .adv_on = 6,
112 .cs_rd_off = 36, 118 .adv_rd_off = 24,
113 .cs_wr_off = 36, 119 .adv_wr_off = 36,
114 120
115 .adv_on = 6, 121 .we_off = 30,
116 .adv_rd_off = 24, 122 .oe_off = 48,
117 .adv_wr_off = 36,
118 123
119 .we_off = 30, 124 .access = 54,
120 .oe_off = 48, 125 .rd_cycle = 72,
126 .wr_cycle = 72,
121 127
122 .access = 54, 128 .wr_access = 30,
123 .rd_cycle = 72, 129 .wr_data_mux_bus = 0,
124 .wr_cycle = 72, 130 },
125
126 .wr_access = 30,
127 .wr_data_mux_bus = 0,
128}; 131};
129 132
130static struct omap_nand_platform_data board_nand_data = { 133static struct omap_nand_platform_data board_nand_data;
131 .gpmc_t = &nand_timings,
132};
133 134
134void 135void
135__init board_nand_init(struct mtd_partition *nand_parts, 136__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
136 u8 nr_parts, u8 cs, int nand_type) 137 int nand_type, struct gpmc_timings *gpmc_t)
137{ 138{
138 board_nand_data.cs = cs; 139 board_nand_data.cs = cs;
139 board_nand_data.parts = nand_parts; 140 board_nand_data.parts = nand_parts;
@@ -141,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts,
141 board_nand_data.devsize = nand_type; 142 board_nand_data.devsize = nand_type;
142 143
143 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT; 144 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
144 gpmc_nand_init(&board_nand_data); 145 gpmc_nand_init(&board_nand_data, gpmc_t);
145} 146}
146#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 147#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
147 148
@@ -238,5 +239,6 @@ void __init board_flash_init(struct flash_partitions partition_info[],
238 pr_err("NAND: Unable to find configuration in GPMC\n"); 239 pr_err("NAND: Unable to find configuration in GPMC\n");
239 else 240 else
240 board_nand_init(partition_info[2].parts, 241 board_nand_init(partition_info[2].parts,
241 partition_info[2].nr_parts, nandcs, nand_type); 242 partition_info[2].nr_parts, nandcs,
243 nand_type, nand_default_timings);
242} 244}
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h
index c44b70d52021..2fb5d41a9fae 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15#include <plat/gpmc.h> 15#include "gpmc.h"
16 16
17#define PDC_NOR 1 17#define PDC_NOR 1
18#define PDC_NAND 2 18#define PDC_NAND 2
@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],
40#if defined(CONFIG_MTD_NAND_OMAP2) || \ 40#if defined(CONFIG_MTD_NAND_OMAP2) || \
41 defined(CONFIG_MTD_NAND_OMAP2_MODULE) 41 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
42extern void board_nand_init(struct mtd_partition *nand_parts, 42extern void board_nand_init(struct mtd_partition *nand_parts,
43 u8 nr_parts, u8 cs, int nand_type); 43 u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t);
44extern struct gpmc_timings nand_default_timings[];
44#else 45#else
45static inline void board_nand_init(struct mtd_partition *nand_parts, 46static inline void board_nand_init(struct mtd_partition *nand_parts,
46 u8 nr_parts, u8 cs, int nand_type) 47 u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t)
47{ 48{
48} 49}
50#define nand_default_timings NULL
49#endif 51#endif
50 52
51#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 53#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 8d04bf851af4..366ebd93ae24 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -32,8 +32,7 @@
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <plat/menelaus.h> 34#include <plat/menelaus.h>
35#include <plat/dma.h> 35#include <plat-omap/dma-omap.h>
36#include <plat/gpmc.h>
37#include "debug-devices.h" 36#include "debug-devices.h"
38 37
39#include <video/omapdss.h> 38#include <video/omapdss.h>
@@ -42,6 +41,7 @@
42#include "common.h" 41#include "common.h"
43#include "mux.h" 42#include "mux.h"
44#include "control.h" 43#include "control.h"
44#include "gpmc.h"
45 45
46#define H4_FLASH_CS 0 46#define H4_FLASH_CS 0
47#define H4_SMC91X_CS 1 47#define H4_SMC91X_CS 1
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 48d5e41dfbfa..9a9a9b5f78b6 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -30,7 +30,7 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#include "common.h" 32#include "common.h"
33#include <plat/gpmc.h> 33#include "gpmc.h"
34#include <plat/usb.h> 34#include <plat/usb.h>
35 35
36#include <video/omapdss.h> 36#include <video/omapdss.h>
@@ -43,6 +43,7 @@
43#include "common-board-devices.h" 43#include "common-board-devices.h"
44#include "board-flash.h" 44#include "board-flash.h"
45#include "control.h" 45#include "control.h"
46#include "gpmc-onenand.h"
46 47
47#define IGEP2_SMSC911X_CS 5 48#define IGEP2_SMSC911X_CS 5
48#define IGEP2_SMSC911X_GPIO 176 49#define IGEP2_SMSC911X_GPIO 176
@@ -175,7 +176,7 @@ static void __init igep_flash_init(void)
175 pr_info("IGEP: initializing NAND memory device\n"); 176 pr_info("IGEP: initializing NAND memory device\n");
176 board_nand_init(igep_flash_partitions, 177 board_nand_init(igep_flash_partitions,
177 ARRAY_SIZE(igep_flash_partitions), 178 ARRAY_SIZE(igep_flash_partitions),
178 0, NAND_BUSWIDTH_16); 179 0, NAND_BUSWIDTH_16, nand_default_timings);
179 } else if (mux == IGEP_SYSBOOT_ONENAND) { 180 } else if (mux == IGEP_SYSBOOT_ONENAND) {
180 pr_info("IGEP: initializing OneNAND memory device\n"); 181 pr_info("IGEP: initializing OneNAND memory device\n");
181 board_onenand_init(igep_flash_partitions, 182 board_onenand_init(igep_flash_partitions,
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index ee8c3cfb95b3..e1628cd25ab4 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -35,7 +35,7 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include "common.h" 37#include "common.h"
38#include <plat/gpmc.h> 38#include "gpmc.h"
39#include <mach/board-zoom.h> 39#include <mach/board-zoom.h>
40#include <plat/usb.h> 40#include <plat/usb.h>
41#include "gpmc-smsc911x.h" 41#include "gpmc-smsc911x.h"
@@ -420,8 +420,8 @@ static void __init omap_ldp_init(void)
420 omap_serial_init(); 420 omap_serial_init();
421 omap_sdrc_init(NULL, NULL); 421 omap_sdrc_init(NULL, NULL);
422 usb_musb_init(NULL); 422 usb_musb_init(NULL);
423 board_nand_init(ldp_nand_partitions, 423 board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
424 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 424 ZOOM_NAND_CS, 0, nand_default_timings);
425 425
426 omap_hsmmc_init(mmc); 426 omap_hsmmc_init(mmc);
427 ldp_display_init(); 427 ldp_display_init();
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index d95f727ca39a..cea433b9b7b9 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -29,9 +29,10 @@
29 29
30#include "common.h" 30#include "common.h"
31#include <plat/menelaus.h> 31#include <plat/menelaus.h>
32#include <plat/mmc.h> 32#include "mmc.h"
33 33
34#include "mux.h" 34#include "mux.h"
35#include "gpmc-onenand.h"
35 36
36#define TUSB6010_ASYNC_CS 1 37#define TUSB6010_ASYNC_CS 1
37#define TUSB6010_SYNC_CS 4 38#define TUSB6010_SYNC_CS 4
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 388c431c745a..f11a5eb595f7 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -41,7 +41,7 @@
41#include "common.h" 41#include "common.h"
42#include <video/omapdss.h> 42#include <video/omapdss.h>
43#include <video/omap-panel-tfp410.h> 43#include <video/omap-panel-tfp410.h>
44#include <plat/gpmc.h> 44#include "gpmc.h"
45#include <linux/platform_data/mtd-nand-omap2.h> 45#include <linux/platform_data/mtd-nand-omap2.h>
46#include <plat/usb.h> 46#include <plat/usb.h>
47#include <plat/omap_device.h> 47#include <plat/omap_device.h>
@@ -49,8 +49,11 @@
49#include "mux.h" 49#include "mux.h"
50#include "hsmmc.h" 50#include "hsmmc.h"
51#include "pm.h" 51#include "pm.h"
52#include "board-flash.h"
52#include "common-board-devices.h" 53#include "common-board-devices.h"
53 54
55#define NAND_CS 0
56
54/* 57/*
55 * OMAP3 Beagle revision 58 * OMAP3 Beagle revision
56 * Run time detection of Beagle revision is done by reading GPIO. 59 * Run time detection of Beagle revision is done by reading GPIO.
@@ -512,8 +515,9 @@ static void __init omap3_beagle_init(void)
512 515
513 usb_musb_init(NULL); 516 usb_musb_init(NULL);
514 usbhs_init(&usbhs_bdata); 517 usbhs_init(&usbhs_bdata);
515 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 518 board_nand_init(omap3beagle_nand_partitions,
516 ARRAY_SIZE(omap3beagle_nand_partitions)); 519 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
520 NAND_BUSWIDTH_16, NULL);
517 omap_twl4030_audio_init("omap3beagle"); 521 omap_twl4030_audio_init("omap3beagle");
518 522
519 /* Ensure msecure is mux'd to be able to set the RTC. */ 523 /* Ensure msecure is mux'd to be able to set the RTC. */
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b9b776b6c954..1d8e926b52fe 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -56,6 +56,9 @@
56#include "sdram-micron-mt46h32m32lf-6.h" 56#include "sdram-micron-mt46h32m32lf-6.h"
57#include "hsmmc.h" 57#include "hsmmc.h"
58#include "common-board-devices.h" 58#include "common-board-devices.h"
59#include "board-flash.h"
60
61#define NAND_CS 0
59 62
60#define OMAP3_EVM_TS_GPIO 175 63#define OMAP3_EVM_TS_GPIO 175
61#define OMAP3_EVM_EHCI_VBUS 22 64#define OMAP3_EVM_EHCI_VBUS 22
@@ -731,8 +734,9 @@ static void __init omap3_evm_init(void)
731 } 734 }
732 usb_musb_init(&musb_board_data); 735 usb_musb_init(&musb_board_data);
733 usbhs_init(&usbhs_bdata); 736 usbhs_init(&usbhs_bdata);
734 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions, 737 board_nand_init(omap3evm_nand_partitions,
735 ARRAY_SIZE(omap3evm_nand_partitions)); 738 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
739 NAND_BUSWIDTH_16, NULL);
736 740
737 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); 741 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
738 omap3evm_init_smsc911x(); 742 omap3evm_init_smsc911x();
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index cbcea420e332..6f58cad5bf74 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -34,8 +34,6 @@
34#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include "gpmc-smsc911x.h"
38#include <plat/gpmc.h>
39#include <plat/usb.h> 37#include <plat/usb.h>
40 38
41#include "common.h" 39#include "common.h"
@@ -43,6 +41,8 @@
43#include "hsmmc.h" 41#include "hsmmc.h"
44#include "control.h" 42#include "control.h"
45#include "common-board-devices.h" 43#include "common-board-devices.h"
44#include "gpmc.h"
45#include "gpmc-smsc911x.h"
46 46
47#define OMAP3LOGIC_SMSC911X_CS 1 47#define OMAP3LOGIC_SMSC911X_CS 1
48 48
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 00a1f4ae6e44..f286b4b4bd5b 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -50,6 +50,7 @@
50#include "sdram-micron-mt46h32m32lf-6.h" 50#include "sdram-micron-mt46h32m32lf-6.h"
51#include "hsmmc.h" 51#include "hsmmc.h"
52#include "common-board-devices.h" 52#include "common-board-devices.h"
53#include "gpmc-nand.h"
53 54
54#define PANDORA_WIFI_IRQ_GPIO 21 55#define PANDORA_WIFI_IRQ_GPIO 21
55#define PANDORA_WIFI_NRESET_GPIO 23 56#define PANDORA_WIFI_NRESET_GPIO 23
@@ -602,7 +603,7 @@ static void __init omap3pandora_init(void)
602 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 603 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
603 usbhs_init(&usbhs_bdata); 604 usbhs_init(&usbhs_bdata);
604 usb_musb_init(NULL); 605 usb_musb_init(NULL);
605 gpmc_nand_init(&pandora_nand_data); 606 gpmc_nand_init(&pandora_nand_data, NULL);
606 607
607 /* Ensure SDRC pins are mux'd for self-refresh */ 608 /* Ensure SDRC pins are mux'd for self-refresh */
608 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 609 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 731235eb319e..3c83b9fbff45 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -40,7 +40,7 @@
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include "common.h" 42#include "common.h"
43#include <plat/gpmc.h> 43#include "gpmc.h"
44#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
45#include <plat/usb.h> 45#include <plat/usb.h>
46#include <video/omapdss.h> 46#include <video/omapdss.h>
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 944ffc436577..cd282ae0856b 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -44,12 +44,13 @@
44#include <asm/system_info.h> 44#include <asm/system_info.h>
45 45
46#include "common.h" 46#include "common.h"
47#include <plat/gpmc.h> 47#include "gpmc.h"
48#include <linux/platform_data/mtd-nand-omap2.h> 48#include <linux/platform_data/mtd-nand-omap2.h>
49#include <plat/usb.h> 49#include <plat/usb.h>
50 50
51#include "mux.h" 51#include "mux.h"
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "board-flash.h"
53#include "common-board-devices.h" 54#include "common-board-devices.h"
54 55
55#include <asm/setup.h> 56#include <asm/setup.h>
@@ -59,6 +60,8 @@
59#define TB_BL_PWM_TIMER 9 60#define TB_BL_PWM_TIMER 9
60#define TB_KILL_POWER_GPIO 168 61#define TB_KILL_POWER_GPIO 168
61 62
63#define NAND_CS 0
64
62static unsigned long touchbook_revision; 65static unsigned long touchbook_revision;
63 66
64static struct mtd_partition omap3touchbook_nand_partitions[] = { 67static struct mtd_partition omap3touchbook_nand_partitions[] = {
@@ -365,8 +368,9 @@ static void __init omap3_touchbook_init(void)
365 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 368 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
366 usb_musb_init(NULL); 369 usb_musb_init(NULL);
367 usbhs_init(&usbhs_bdata); 370 usbhs_init(&usbhs_bdata);
368 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions, 371 board_nand_init(omap3touchbook_nand_partitions,
369 ARRAY_SIZE(omap3touchbook_nand_partitions)); 372 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
373 NAND_BUSWIDTH_16, NULL);
370 374
371 /* Ensure SDRC pins are mux'd for self-refresh */ 375 /* Ensure SDRC pins are mux'd for self-refresh */
372 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 376 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index bfcd397e233c..e9ce9fb9ffac 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -40,10 +40,10 @@
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <plat/mmc.h>
44#include <video/omap-panel-tfp410.h> 43#include <video/omap-panel-tfp410.h>
45 44
46#include "soc.h" 45#include "soc.h"
46#include "mmc.h"
47#include "hsmmc.h" 47#include "hsmmc.h"
48#include "control.h" 48#include "control.h"
49#include "mux.h" 49#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index b700685762b5..3a9d1fa8bebd 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -49,14 +49,17 @@
49#include <video/omapdss.h> 49#include <video/omapdss.h>
50#include <video/omap-panel-generic-dpi.h> 50#include <video/omap-panel-generic-dpi.h>
51#include <video/omap-panel-tfp410.h> 51#include <video/omap-panel-tfp410.h>
52#include <plat/gpmc.h> 52#include "gpmc.h"
53#include <plat/usb.h> 53#include <plat/usb.h>
54 54
55#include "mux.h" 55#include "mux.h"
56#include "sdram-micron-mt46h32m32lf-6.h" 56#include "sdram-micron-mt46h32m32lf-6.h"
57#include "hsmmc.h" 57#include "hsmmc.h"
58#include "board-flash.h"
58#include "common-board-devices.h" 59#include "common-board-devices.h"
59 60
61#define NAND_CS 0
62
60#define OVERO_GPIO_BT_XGATE 15 63#define OVERO_GPIO_BT_XGATE 15
61#define OVERO_GPIO_W2W_NRESET 16 64#define OVERO_GPIO_W2W_NRESET 16
62#define OVERO_GPIO_PENDOWN 114 65#define OVERO_GPIO_PENDOWN 114
@@ -495,8 +498,8 @@ static void __init overo_init(void)
495 omap_serial_init(); 498 omap_serial_init();
496 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 499 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
497 mt46h32m32lf6_sdrc_params); 500 mt46h32m32lf6_sdrc_params);
498 omap_nand_flash_init(0, overo_nand_partitions, 501 board_nand_init(overo_nand_partitions,
499 ARRAY_SIZE(overo_nand_partitions)); 502 ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
500 usb_musb_init(NULL); 503 usb_musb_init(NULL);
501 usbhs_init(&usbhs_bdata); 504 usbhs_init(&usbhs_bdata);
502 overo_spi_init(); 505 overo_spi_init();
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 45997bfbcbd2..208a7a239db5 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -23,16 +23,17 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <plat/i2c.h> 25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <plat/usb.h> 26#include <plat/usb.h>
28#include <plat/gpmc.h> 27#include "gpmc.h"
29#include "common.h" 28#include "common.h"
30#include <plat/serial.h> 29#include <plat/serial.h>
31 30
32#include "mux.h" 31#include "mux.h"
32#include "mmc.h"
33#include "hsmmc.h" 33#include "hsmmc.h"
34#include "sdram-nokia.h" 34#include "sdram-nokia.h"
35#include "common-board-devices.h" 35#include "common-board-devices.h"
36#include "gpmc-onenand.h"
36 37
37static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 38static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
38 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 39 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 020e03c95bfe..c2eed847c05b 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -31,8 +31,7 @@
31#include <asm/system_info.h> 31#include <asm/system_info.h>
32 32
33#include "common.h" 33#include "common.h"
34#include <plat/dma.h> 34#include <plat-omap/dma-omap.h>
35#include <plat/gpmc.h>
36#include <plat/omap-pm.h> 35#include <plat/omap-pm.h>
37#include "gpmc-smc91x.h" 36#include "gpmc-smc91x.h"
38 37
@@ -54,6 +53,8 @@
54#include "mux.h" 53#include "mux.h"
55#include "hsmmc.h" 54#include "hsmmc.h"
56#include "common-board-devices.h" 55#include "common-board-devices.h"
56#include "gpmc.h"
57#include "gpmc-onenand.h"
57 58
58#define SYSTEM_REV_B_USES_VAUX3 0x1699 59#define SYSTEM_REV_B_USES_VAUX3 0x1699
59#define SYSTEM_REV_S_USES_VAUX3 0x8 60#define SYSTEM_REV_S_USES_VAUX3 0x8
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 7bbb05d9689b..63b33c63bd94 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -23,12 +23,12 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include "common.h" 26#include <plat-omap/dma-omap.h>
27#include <plat/dma.h>
28#include <plat/gpmc.h>
29#include <plat/usb.h> 27#include <plat/usb.h>
30 28
29#include "common.h"
31#include "mux.h" 30#include "mux.h"
31#include "gpmc.h"
32#include "pm.h" 32#include "pm.h"
33#include "sdram-nokia.h" 33#include "sdram-nokia.h"
34 34
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index afb2278a29f6..be9f71d436bf 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -17,7 +17,7 @@
17#include <linux/regulator/fixed.h> 17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21#include "gpmc-smsc911x.h" 21#include "gpmc-smsc911x.h"
22 22
23#include <mach/board-zoom.h> 23#include <mach/board-zoom.h>
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 4994438e1f46..c39578c1fa6d 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -113,8 +113,9 @@ static void __init omap_zoom_init(void)
113 usbhs_init(&usbhs_bdata); 113 usbhs_init(&usbhs_bdata);
114 } 114 }
115 115
116 board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions), 116 board_nand_init(zoom_nand_partitions,
117 ZOOM_NAND_CS, NAND_BUSWIDTH_16); 117 ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
118 NAND_BUSWIDTH_16, nand_default_timings);
118 zoom_debugboard_init(); 119 zoom_debugboard_init();
119 zoom_peripherals_init(); 120 zoom_peripherals_init();
120 121
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index 48daac2581b4..ad856092c06a 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -25,7 +25,6 @@
25#include <linux/spi/ads7846.h> 25#include <linux/spi/ads7846.h>
26 26
27#include <linux/platform_data/spi-omap2-mcspi.h> 27#include <linux/platform_data/spi-omap2-mcspi.h>
28#include <linux/platform_data/mtd-nand-omap2.h>
29 28
30#include "common.h" 29#include "common.h"
31#include "common-board-devices.h" 30#include "common-board-devices.h"
@@ -96,48 +95,3 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
96{ 95{
97} 96}
98#endif 97#endif
99
100#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
101static struct omap_nand_platform_data nand_data;
102
103void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
104 int nr_parts)
105{
106 u8 cs = 0;
107 u8 nandcs = GPMC_CS_NUM + 1;
108
109 /* find out the chip-select on which NAND exists */
110 while (cs < GPMC_CS_NUM) {
111 u32 ret = 0;
112 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
113
114 if ((ret & 0xC00) == 0x800) {
115 printk(KERN_INFO "Found NAND on CS%d\n", cs);
116 if (nandcs > GPMC_CS_NUM)
117 nandcs = cs;
118 }
119 cs++;
120 }
121
122 if (nandcs > GPMC_CS_NUM) {
123 pr_info("NAND: Unable to find configuration in GPMC\n");
124 return;
125 }
126
127 if (nandcs < GPMC_CS_NUM) {
128 nand_data.cs = nandcs;
129 nand_data.parts = parts;
130 nand_data.nr_parts = nr_parts;
131 nand_data.devsize = options;
132
133 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
134 if (gpmc_nand_init(&nand_data) < 0)
135 printk(KERN_ERR "Unable to register NAND device\n");
136 }
137}
138#else
139void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
140 int nr_parts)
141{
142}
143#endif
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index a0b4a42836ab..72bb41b3fd25 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -10,6 +10,5 @@ struct ads7846_platform_data;
10 10
11void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, 11void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
12 struct ads7846_platform_data *board_pdata); 12 struct ads7846_platform_data *board_pdata);
13void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts);
14 13
15#endif /* __OMAP_COMMON_BOARD_DEVICES__ */ 14#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c8c211731d26..e9ee9d99f881 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -24,7 +24,7 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include "iomap.h" 26#include "iomap.h"
27#include <plat/dma.h> 27#include <plat-omap/dma-omap.h>
28#include <plat/omap_hwmod.h> 28#include <plat/omap_hwmod.h>
29#include <plat/omap_device.h> 29#include <plat/omap_device.h>
30#include "omap4-keypad.h" 30#include "omap4-keypad.h"
@@ -34,6 +34,7 @@
34#include "mux.h" 34#include "mux.h"
35#include "control.h" 35#include "control.h"
36#include "devices.h" 36#include "devices.h"
37#include "dma.h"
37 38
38#define L3_MODULES_MAX_LEN 12 39#define L3_MODULES_MAX_LEN 12
39#define L3_MODULES 3 40#define L3_MODULES 3
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index ff75abe60af2..4e3ac6b9449e 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -30,7 +30,7 @@
30 30
31#include <plat/omap_hwmod.h> 31#include <plat/omap_hwmod.h>
32#include <plat/omap_device.h> 32#include <plat/omap_device.h>
33#include <plat/dma.h> 33#include <plat-omap/dma-omap.h>
34 34
35#define OMAP2_DMA_STRIDE 0x60 35#define OMAP2_DMA_STRIDE 0x60
36 36
diff --git a/arch/arm/mach-omap2/dma.h b/arch/arm/mach-omap2/dma.h
new file mode 100644
index 000000000000..eba80dbc5218
--- /dev/null
+++ b/arch/arm/mach-omap2/dma.h
@@ -0,0 +1,131 @@
1/*
2 * OMAP2PLUS DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP2PLUS_DMA_CHANNEL_H
20#define __OMAP2PLUS_DMA_CHANNEL_H
21
22
23/* DMA channels for 24xx */
24#define OMAP24XX_DMA_NO_DEVICE 0
25#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
26#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
27#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
28#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
29#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
30#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
31#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
32#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
33#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
34#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
35#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
36#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
37#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
38#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
39#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
40#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
41#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
42#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
43#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
44#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
45#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
46#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
47#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
48#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
49#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
50#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
51#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
52#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
53#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
54#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
55#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
56#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
57#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
58#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
59#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
60#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
61#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
62#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
63#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
64#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
65#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
66#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
67#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
68#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
69#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
70#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
71#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
72#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
73#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
74#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
75#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
76#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
77#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
78#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
79#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
80#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
81#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
82#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
83#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
84#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
85#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
86#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
87#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
88#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
89#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
90#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
91#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
92#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
93#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
94#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
95#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
96#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
97#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
98#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
99#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
100#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
101#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
102#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
103#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
104#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
105#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
106#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
107#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
108#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
109#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
110#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
111#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
112#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
113#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
114#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
115#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
116#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
117#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
118#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
119#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
120#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
121#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
122#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
123
124#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
125#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
126
127/* Only for AM35xx */
128#define AM35XX_DMA_UART4_TX 54
129#define AM35XX_DMA_UART4_RX 55
130
131#endif /* __OMAP2PLUS_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 4acf497faeb3..8607735b3ab3 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -17,9 +17,12 @@
17 17
18#include <asm/mach/flash.h> 18#include <asm/mach/flash.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21
22#include "soc.h" 21#include "soc.h"
22#include "gpmc-nand.h"
23
24/* minimum size for IO mapping */
25#define NAND_IO_SIZE 4
23 26
24static struct resource gpmc_nand_resource[] = { 27static struct resource gpmc_nand_resource[] = {
25 { 28 {
@@ -40,41 +43,36 @@ static struct platform_device gpmc_nand_device = {
40 .resource = gpmc_nand_resource, 43 .resource = gpmc_nand_resource,
41}; 44};
42 45
43static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data) 46static int omap2_nand_gpmc_retime(
47 struct omap_nand_platform_data *gpmc_nand_data,
48 struct gpmc_timings *gpmc_t)
44{ 49{
45 struct gpmc_timings t; 50 struct gpmc_timings t;
46 int err; 51 int err;
47 52
48 if (!gpmc_nand_data->gpmc_t)
49 return 0;
50
51 memset(&t, 0, sizeof(t)); 53 memset(&t, 0, sizeof(t));
52 t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk; 54 t.sync_clk = gpmc_t->sync_clk;
53 t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on); 55 t.cs_on = gpmc_round_ns_to_ticks(gpmc_t->cs_on);
54 t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on); 56 t.adv_on = gpmc_round_ns_to_ticks(gpmc_t->adv_on);
55 57
56 /* Read */ 58 /* Read */
57 t.adv_rd_off = gpmc_round_ns_to_ticks( 59 t.adv_rd_off = gpmc_round_ns_to_ticks(gpmc_t->adv_rd_off);
58 gpmc_nand_data->gpmc_t->adv_rd_off);
59 t.oe_on = t.adv_on; 60 t.oe_on = t.adv_on;
60 t.access = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->access); 61 t.access = gpmc_round_ns_to_ticks(gpmc_t->access);
61 t.oe_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->oe_off); 62 t.oe_off = gpmc_round_ns_to_ticks(gpmc_t->oe_off);
62 t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_rd_off); 63 t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_t->cs_rd_off);
63 t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->rd_cycle); 64 t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_t->rd_cycle);
64 65
65 /* Write */ 66 /* Write */
66 t.adv_wr_off = gpmc_round_ns_to_ticks( 67 t.adv_wr_off = gpmc_round_ns_to_ticks(gpmc_t->adv_wr_off);
67 gpmc_nand_data->gpmc_t->adv_wr_off);
68 t.we_on = t.oe_on; 68 t.we_on = t.oe_on;
69 if (cpu_is_omap34xx()) { 69 if (cpu_is_omap34xx()) {
70 t.wr_data_mux_bus = gpmc_round_ns_to_ticks( 70 t.wr_data_mux_bus = gpmc_round_ns_to_ticks(gpmc_t->wr_data_mux_bus);
71 gpmc_nand_data->gpmc_t->wr_data_mux_bus); 71 t.wr_access = gpmc_round_ns_to_ticks(gpmc_t->wr_access);
72 t.wr_access = gpmc_round_ns_to_ticks(
73 gpmc_nand_data->gpmc_t->wr_access);
74 } 72 }
75 t.we_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->we_off); 73 t.we_off = gpmc_round_ns_to_ticks(gpmc_t->we_off);
76 t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_wr_off); 74 t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_t->cs_wr_off);
77 t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->wr_cycle); 75 t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_t->wr_cycle);
78 76
79 /* Configure GPMC */ 77 /* Configure GPMC */
80 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 78 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
@@ -91,7 +89,29 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data
91 return 0; 89 return 0;
92} 90}
93 91
94int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data) 92static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
93{
94 /* support only OMAP3 class */
95 if (!cpu_is_omap34xx()) {
96 pr_err("BCH ecc is not supported on this CPU\n");
97 return 0;
98 }
99
100 /*
101 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
102 * Other chips may be added if confirmed to work.
103 */
104 if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) &&
105 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
106 pr_err("BCH 4-bit mode is not supported on this CPU\n");
107 return 0;
108 }
109
110 return 1;
111}
112
113int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
114 struct gpmc_timings *gpmc_t)
95{ 115{
96 int err = 0; 116 int err = 0;
97 struct device *dev = &gpmc_nand_device.dev; 117 struct device *dev = &gpmc_nand_device.dev;
@@ -112,11 +132,13 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
112 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE); 132 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
113 gpmc_nand_resource[2].start = 133 gpmc_nand_resource[2].start =
114 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT); 134 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
115 /* Set timings in GPMC */ 135
116 err = omap2_nand_gpmc_retime(gpmc_nand_data); 136 if (gpmc_t) {
117 if (err < 0) { 137 err = omap2_nand_gpmc_retime(gpmc_nand_data, gpmc_t);
118 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 138 if (err < 0) {
119 return err; 139 dev_err(dev, "Unable to set gpmc timings: %d\n", err);
140 return err;
141 }
120 } 142 }
121 143
122 /* Enable RD PIN Monitoring Reg */ 144 /* Enable RD PIN Monitoring Reg */
@@ -126,6 +148,9 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
126 148
127 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 149 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
128 150
151 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt))
152 return -EINVAL;
153
129 err = platform_device_register(&gpmc_nand_device); 154 err = platform_device_register(&gpmc_nand_device);
130 if (err < 0) { 155 if (err < 0) {
131 dev_err(dev, "Unable to register NAND device\n"); 156 dev_err(dev, "Unable to register NAND device\n");
diff --git a/arch/arm/mach-omap2/gpmc-nand.h b/arch/arm/mach-omap2/gpmc-nand.h
new file mode 100644
index 000000000000..d59e1281e851
--- /dev/null
+++ b/arch/arm/mach-omap2/gpmc-nand.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-omap2/gpmc-nand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_NAND_H
11#define __OMAP2_GPMC_NAND_H
12
13#include "gpmc.h"
14#include <linux/platform_data/mtd-nand-omap2.h>
15
16#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
17extern int gpmc_nand_init(struct omap_nand_platform_data *d,
18 struct gpmc_timings *gpmc_t);
19#else
20static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
21 struct gpmc_timings *gpmc_t)
22{
23 return 0;
24}
25#endif
26
27#endif
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 916716e1da3b..d102183ed9a5 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -16,15 +16,25 @@
16#include <linux/mtd/onenand_regs.h> 16#include <linux/mtd/onenand_regs.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/mtd-onenand-omap2.h> 18#include <linux/platform_data/mtd-onenand-omap2.h>
19#include <linux/err.h>
19 20
20#include <asm/mach/flash.h> 21#include <asm/mach/flash.h>
21 22
22#include <plat/gpmc.h> 23#include "gpmc.h"
23
24#include "soc.h" 24#include "soc.h"
25#include "gpmc-onenand.h"
25 26
26#define ONENAND_IO_SIZE SZ_128K 27#define ONENAND_IO_SIZE SZ_128K
27 28
29#define ONENAND_FLAG_SYNCREAD (1 << 0)
30#define ONENAND_FLAG_SYNCWRITE (1 << 1)
31#define ONENAND_FLAG_HF (1 << 2)
32#define ONENAND_FLAG_VHF (1 << 3)
33
34static unsigned onenand_flags;
35static unsigned latency;
36static int fclk_offset;
37
28static struct omap_onenand_platform_data *gpmc_onenand_data; 38static struct omap_onenand_platform_data *gpmc_onenand_data;
29 39
30static struct resource gpmc_onenand_resource = { 40static struct resource gpmc_onenand_resource = {
@@ -38,11 +48,9 @@ static struct platform_device gpmc_onenand_device = {
38 .resource = &gpmc_onenand_resource, 48 .resource = &gpmc_onenand_resource,
39}; 49};
40 50
41static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) 51static struct gpmc_timings omap2_onenand_calc_async_timings(void)
42{ 52{
43 struct gpmc_timings t; 53 struct gpmc_timings t;
44 u32 reg;
45 int err;
46 54
47 const int t_cer = 15; 55 const int t_cer = 15;
48 const int t_avdp = 12; 56 const int t_avdp = 12;
@@ -55,11 +63,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
55 const int t_wpl = 40; 63 const int t_wpl = 40;
56 const int t_wph = 30; 64 const int t_wph = 30;
57 65
58 /* Ensure sync read and sync write are disabled */
59 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
60 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
61 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
62
63 memset(&t, 0, sizeof(t)); 66 memset(&t, 0, sizeof(t));
64 t.sync_clk = 0; 67 t.sync_clk = 0;
65 t.cs_on = 0; 68 t.cs_on = 0;
@@ -86,25 +89,30 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
86 t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph); 89 t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph);
87 t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez); 90 t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
88 91
92 return t;
93}
94
95static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
96{
89 /* Configure GPMC for asynchronous read */ 97 /* Configure GPMC for asynchronous read */
90 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 98 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
91 GPMC_CONFIG1_DEVICESIZE_16 | 99 GPMC_CONFIG1_DEVICESIZE_16 |
92 GPMC_CONFIG1_MUXADDDATA); 100 GPMC_CONFIG1_MUXADDDATA);
93 101
94 err = gpmc_cs_set_timings(cs, &t); 102 return gpmc_cs_set_timings(cs, t);
95 if (err) 103}
96 return err; 104
105static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
106{
107 u32 reg;
97 108
98 /* Ensure sync read and sync write are disabled */ 109 /* Ensure sync read and sync write are disabled */
99 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1); 110 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
100 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE; 111 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
101 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1); 112 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
102
103 return 0;
104} 113}
105 114
106static void set_onenand_cfg(void __iomem *onenand_base, int latency, 115static void set_onenand_cfg(void __iomem *onenand_base)
107 int sync_read, int sync_write, int hf, int vhf)
108{ 116{
109 u32 reg; 117 u32 reg;
110 118
@@ -112,19 +120,19 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
112 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9)); 120 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9));
113 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) | 121 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
114 ONENAND_SYS_CFG1_BL_16; 122 ONENAND_SYS_CFG1_BL_16;
115 if (sync_read) 123 if (onenand_flags & ONENAND_FLAG_SYNCREAD)
116 reg |= ONENAND_SYS_CFG1_SYNC_READ; 124 reg |= ONENAND_SYS_CFG1_SYNC_READ;
117 else 125 else
118 reg &= ~ONENAND_SYS_CFG1_SYNC_READ; 126 reg &= ~ONENAND_SYS_CFG1_SYNC_READ;
119 if (sync_write) 127 if (onenand_flags & ONENAND_FLAG_SYNCWRITE)
120 reg |= ONENAND_SYS_CFG1_SYNC_WRITE; 128 reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
121 else 129 else
122 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE; 130 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
123 if (hf) 131 if (onenand_flags & ONENAND_FLAG_HF)
124 reg |= ONENAND_SYS_CFG1_HF; 132 reg |= ONENAND_SYS_CFG1_HF;
125 else 133 else
126 reg &= ~ONENAND_SYS_CFG1_HF; 134 reg &= ~ONENAND_SYS_CFG1_HF;
127 if (vhf) 135 if (onenand_flags & ONENAND_FLAG_VHF)
128 reg |= ONENAND_SYS_CFG1_VHF; 136 reg |= ONENAND_SYS_CFG1_VHF;
129 else 137 else
130 reg &= ~ONENAND_SYS_CFG1_VHF; 138 reg &= ~ONENAND_SYS_CFG1_VHF;
@@ -132,21 +140,10 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
132} 140}
133 141
134static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, 142static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
135 void __iomem *onenand_base, bool *clk_dep) 143 void __iomem *onenand_base)
136{ 144{
137 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID); 145 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID);
138 int freq = 0; 146 int freq;
139
140 if (cfg->get_freq) {
141 struct onenand_freq_info fi;
142
143 fi.maf_id = readw(onenand_base + ONENAND_REG_MANUFACTURER_ID);
144 fi.dev_id = readw(onenand_base + ONENAND_REG_DEVICE_ID);
145 fi.ver_id = ver;
146 freq = cfg->get_freq(&fi, clk_dep);
147 if (freq)
148 return freq;
149 }
150 147
151 switch ((ver >> 4) & 0xf) { 148 switch ((ver >> 4) & 0xf) {
152 case 0: 149 case 0:
@@ -172,9 +169,9 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
172 return freq; 169 return freq;
173} 170}
174 171
175static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, 172static struct gpmc_timings
176 void __iomem *onenand_base, 173omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
177 int *freq_ptr) 174 int freq)
178{ 175{
179 struct gpmc_timings t; 176 struct gpmc_timings t;
180 const int t_cer = 15; 177 const int t_cer = 15;
@@ -184,29 +181,15 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
184 const int t_wpl = 40; 181 const int t_wpl = 40;
185 const int t_wph = 30; 182 const int t_wph = 30;
186 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; 183 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
187 int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;
188 int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
189 int err, ticks_cez;
190 int cs = cfg->cs, freq = *freq_ptr;
191 u32 reg; 184 u32 reg;
192 bool clk_dep = false; 185 int div, fclk_offset_ns, gpmc_clk_ns;
186 int ticks_cez;
187 int cs = cfg->cs;
193 188
194 if (cfg->flags & ONENAND_SYNC_READ) { 189 if (cfg->flags & ONENAND_SYNC_READ)
195 sync_read = 1; 190 onenand_flags = ONENAND_FLAG_SYNCREAD;
196 } else if (cfg->flags & ONENAND_SYNC_READWRITE) { 191 else if (cfg->flags & ONENAND_SYNC_READWRITE)
197 sync_read = 1; 192 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
198 sync_write = 1;
199 } else
200 return omap2_onenand_set_async_mode(cs, onenand_base);
201
202 if (!freq) {
203 /* Very first call freq is not known */
204 err = omap2_onenand_set_async_mode(cs, onenand_base);
205 if (err)
206 return err;
207 freq = omap2_onenand_get_freq(cfg, onenand_base, &clk_dep);
208 first_time = 1;
209 }
210 193
211 switch (freq) { 194 switch (freq) {
212 case 104: 195 case 104:
@@ -244,44 +227,31 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
244 t_ach = 9; 227 t_ach = 9;
245 t_aavdh = 7; 228 t_aavdh = 7;
246 t_rdyo = 15; 229 t_rdyo = 15;
247 sync_write = 0; 230 onenand_flags &= ~ONENAND_FLAG_SYNCWRITE;
248 break; 231 break;
249 } 232 }
250 233
251 div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period); 234 div = gpmc_calc_divider(min_gpmc_clk_period);
252 gpmc_clk_ns = gpmc_ticks_to_ns(div); 235 gpmc_clk_ns = gpmc_ticks_to_ns(div);
253 if (gpmc_clk_ns < 15) /* >66Mhz */ 236 if (gpmc_clk_ns < 15) /* >66Mhz */
254 hf = 1; 237 onenand_flags |= ONENAND_FLAG_HF;
238 else
239 onenand_flags &= ~ONENAND_FLAG_HF;
255 if (gpmc_clk_ns < 12) /* >83Mhz */ 240 if (gpmc_clk_ns < 12) /* >83Mhz */
256 vhf = 1; 241 onenand_flags |= ONENAND_FLAG_VHF;
257 if (vhf) 242 else
243 onenand_flags &= ~ONENAND_FLAG_VHF;
244 if (onenand_flags & ONENAND_FLAG_VHF)
258 latency = 8; 245 latency = 8;
259 else if (hf) 246 else if (onenand_flags & ONENAND_FLAG_HF)
260 latency = 6; 247 latency = 6;
261 else if (gpmc_clk_ns >= 25) /* 40 MHz*/ 248 else if (gpmc_clk_ns >= 25) /* 40 MHz*/
262 latency = 3; 249 latency = 3;
263 else 250 else
264 latency = 4; 251 latency = 4;
265 252
266 if (clk_dep) { 253 /* Set synchronous read timings */
267 if (gpmc_clk_ns < 12) { /* >83Mhz */ 254 memset(&t, 0, sizeof(t));
268 t_ces = 3;
269 t_avds = 4;
270 } else if (gpmc_clk_ns < 15) { /* >66Mhz */
271 t_ces = 5;
272 t_avds = 4;
273 } else if (gpmc_clk_ns < 25) { /* >40Mhz */
274 t_ces = 6;
275 t_avds = 5;
276 } else {
277 t_ces = 7;
278 t_avds = 7;
279 }
280 }
281
282 if (first_time)
283 set_onenand_cfg(onenand_base, latency,
284 sync_read, sync_write, hf, vhf);
285 255
286 if (div == 1) { 256 if (div == 1) {
287 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2); 257 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
@@ -307,8 +277,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
307 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg); 277 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
308 } 278 }
309 279
310 /* Set synchronous read timings */
311 memset(&t, 0, sizeof(t));
312 t.sync_clk = min_gpmc_clk_period; 280 t.sync_clk = min_gpmc_clk_period;
313 t.cs_on = 0; 281 t.cs_on = 0;
314 t.adv_on = 0; 282 t.adv_on = 0;
@@ -330,7 +298,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
330 ticks_cez); 298 ticks_cez);
331 299
332 /* Write */ 300 /* Write */
333 if (sync_write) { 301 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
334 t.adv_wr_off = t.adv_rd_off; 302 t.adv_wr_off = t.adv_rd_off;
335 t.we_on = 0; 303 t.we_on = 0;
336 t.we_off = t.cs_rd_off; 304 t.we_off = t.cs_rd_off;
@@ -355,6 +323,14 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
355 } 323 }
356 } 324 }
357 325
326 return t;
327}
328
329static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t)
330{
331 unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD;
332 unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE;
333
358 /* Configure GPMC for synchronous read */ 334 /* Configure GPMC for synchronous read */
359 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 335 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
360 GPMC_CONFIG1_WRAPBURST_SUPP | 336 GPMC_CONFIG1_WRAPBURST_SUPP |
@@ -371,11 +347,45 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
371 GPMC_CONFIG1_DEVICETYPE_NOR | 347 GPMC_CONFIG1_DEVICETYPE_NOR |
372 GPMC_CONFIG1_MUXADDDATA); 348 GPMC_CONFIG1_MUXADDDATA);
373 349
374 err = gpmc_cs_set_timings(cs, &t); 350 return gpmc_cs_set_timings(cs, t);
375 if (err) 351}
376 return err; 352
353static int omap2_onenand_setup_async(void __iomem *onenand_base)
354{
355 struct gpmc_timings t;
356 int ret;
357
358 omap2_onenand_set_async_mode(onenand_base);
377 359
378 set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf, vhf); 360 t = omap2_onenand_calc_async_timings();
361
362 ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
363 if (IS_ERR_VALUE(ret))
364 return ret;
365
366 omap2_onenand_set_async_mode(onenand_base);
367
368 return 0;
369}
370
371static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
372{
373 int ret, freq = *freq_ptr;
374 struct gpmc_timings t;
375
376 if (!freq) {
377 /* Very first call freq is not known */
378 freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
379 set_onenand_cfg(onenand_base);
380 }
381
382 t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq);
383
384 ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t);
385 if (IS_ERR_VALUE(ret))
386 return ret;
387
388 set_onenand_cfg(onenand_base);
379 389
380 *freq_ptr = freq; 390 *freq_ptr = freq;
381 391
@@ -385,15 +395,22 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
385static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) 395static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
386{ 396{
387 struct device *dev = &gpmc_onenand_device.dev; 397 struct device *dev = &gpmc_onenand_device.dev;
398 unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE;
399 int ret;
388 400
389 /* Set sync timings in GPMC */ 401 ret = omap2_onenand_setup_async(onenand_base);
390 if (omap2_onenand_set_sync_mode(gpmc_onenand_data, onenand_base, 402 if (ret) {
391 freq_ptr) < 0) { 403 dev_err(dev, "unable to set to async mode\n");
392 dev_err(dev, "Unable to set synchronous mode\n"); 404 return ret;
393 return -EINVAL;
394 } 405 }
395 406
396 return 0; 407 if (!(gpmc_onenand_data->flags & l))
408 return 0;
409
410 ret = omap2_onenand_setup_sync(onenand_base, freq_ptr);
411 if (ret)
412 dev_err(dev, "unable to set to sync mode\n");
413 return ret;
397} 414}
398 415
399void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) 416void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
@@ -411,6 +428,11 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
411 gpmc_onenand_data->flags |= ONENAND_SYNC_READ; 428 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
412 } 429 }
413 430
431 if (cpu_is_omap34xx())
432 gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX;
433 else
434 gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
435
414 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, 436 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
415 (unsigned long *)&gpmc_onenand_resource.start); 437 (unsigned long *)&gpmc_onenand_resource.start);
416 if (err < 0) { 438 if (err < 0) {
diff --git a/arch/arm/mach-omap2/gpmc-onenand.h b/arch/arm/mach-omap2/gpmc-onenand.h
new file mode 100644
index 000000000000..216f23a8b45c
--- /dev/null
+++ b/arch/arm/mach-omap2/gpmc-onenand.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-omap2/gpmc-onenand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_ONENAND_H
11#define __OMAP2_GPMC_ONENAND_H
12
13#include <linux/platform_data/mtd-onenand-omap2.h>
14
15#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
16extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
17#else
18#define board_onenand_data NULL
19static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
20{
21}
22#endif
23
24#endif
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index 565475310374..6eed907d594c 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -17,7 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/smc91x.h> 18#include <linux/smc91x.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21#include "gpmc-smc91x.h" 21#include "gpmc-smc91x.h"
22 22
23#include "soc.h" 23#include "soc.h"
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 249a0b440cd6..ef990118d32b 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -20,7 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22 22
23#include <plat/gpmc.h> 23#include "gpmc.h"
24#include "gpmc-smsc911x.h" 24#include "gpmc-smsc911x.h"
25 25
26static struct resource gpmc_smsc911x_resources[] = { 26static struct resource gpmc_smsc911x_resources[] = {
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index e7f2b80721c4..9472541a4d8d 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -26,15 +26,16 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28 28
29#include <linux/platform_data/mtd-nand-omap2.h>
30
29#include <asm/mach-types.h> 31#include <asm/mach-types.h>
30#include <plat/gpmc.h>
31 32
32#include <plat/cpu.h> 33#include <plat/cpu.h>
33#include <plat/gpmc.h>
34#include <plat/omap_device.h> 34#include <plat/omap_device.h>
35 35
36#include "soc.h" 36#include "soc.h"
37#include "common.h" 37#include "common.h"
38#include "gpmc.h"
38 39
39#define DEVICE_NAME "omap-gpmc" 40#define DEVICE_NAME "omap-gpmc"
40 41
@@ -58,6 +59,9 @@
58#define GPMC_ECC_SIZE_CONFIG 0x1fc 59#define GPMC_ECC_SIZE_CONFIG 0x1fc
59#define GPMC_ECC1_RESULT 0x200 60#define GPMC_ECC1_RESULT 0x200
60#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */ 61#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */
62#define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
63#define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
64#define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
61 65
62/* GPMC ECC control settings */ 66/* GPMC ECC control settings */
63#define GPMC_ECC_CTRL_ECCCLEAR 0x100 67#define GPMC_ECC_CTRL_ECCCLEAR 0x100
@@ -74,6 +78,7 @@
74 78
75#define GPMC_CS0_OFFSET 0x60 79#define GPMC_CS0_OFFSET 0x60
76#define GPMC_CS_SIZE 0x30 80#define GPMC_CS_SIZE 0x30
81#define GPMC_BCH_SIZE 0x10
77 82
78#define GPMC_MEM_START 0x00000000 83#define GPMC_MEM_START 0x00000000
79#define GPMC_MEM_END 0x3FFFFFFF 84#define GPMC_MEM_END 0x3FFFFFFF
@@ -136,7 +141,6 @@ static struct resource gpmc_mem_root;
136static struct resource gpmc_cs_mem[GPMC_CS_NUM]; 141static struct resource gpmc_cs_mem[GPMC_CS_NUM];
137static DEFINE_SPINLOCK(gpmc_mem_lock); 142static DEFINE_SPINLOCK(gpmc_mem_lock);
138static unsigned int gpmc_cs_map; /* flag for cs which are initialized */ 143static unsigned int gpmc_cs_map; /* flag for cs which are initialized */
139static int gpmc_ecc_used = -EINVAL; /* cs using ecc engine */
140static struct device *gpmc_dev; 144static struct device *gpmc_dev;
141static int gpmc_irq; 145static int gpmc_irq;
142static resource_size_t phys_base, mem_size; 146static resource_size_t phys_base, mem_size;
@@ -157,22 +161,6 @@ static u32 gpmc_read_reg(int idx)
157 return __raw_readl(gpmc_base + idx); 161 return __raw_readl(gpmc_base + idx);
158} 162}
159 163
160static void gpmc_cs_write_byte(int cs, int idx, u8 val)
161{
162 void __iomem *reg_addr;
163
164 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
165 __raw_writeb(val, reg_addr);
166}
167
168static u8 gpmc_cs_read_byte(int cs, int idx)
169{
170 void __iomem *reg_addr;
171
172 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
173 return __raw_readb(reg_addr);
174}
175
176void gpmc_cs_write_reg(int cs, int idx, u32 val) 164void gpmc_cs_write_reg(int cs, int idx, u32 val)
177{ 165{
178 void __iomem *reg_addr; 166 void __iomem *reg_addr;
@@ -287,7 +275,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
287 return -1 275 return -1
288#endif 276#endif
289 277
290int gpmc_cs_calc_divider(int cs, unsigned int sync_clk) 278int gpmc_calc_divider(unsigned int sync_clk)
291{ 279{
292 int div; 280 int div;
293 u32 l; 281 u32 l;
@@ -307,7 +295,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
307 int div; 295 int div;
308 u32 l; 296 u32 l;
309 297
310 div = gpmc_cs_calc_divider(cs, t->sync_clk); 298 div = gpmc_calc_divider(t->sync_clk);
311 if (div < 0) 299 if (div < 0)
312 return div; 300 return div;
313 301
@@ -508,44 +496,6 @@ void gpmc_cs_free(int cs)
508EXPORT_SYMBOL(gpmc_cs_free); 496EXPORT_SYMBOL(gpmc_cs_free);
509 497
510/** 498/**
511 * gpmc_read_status - read access request to get the different gpmc status
512 * @cmd: command type
513 * @return status
514 */
515int gpmc_read_status(int cmd)
516{
517 int status = -EINVAL;
518 u32 regval = 0;
519
520 switch (cmd) {
521 case GPMC_GET_IRQ_STATUS:
522 status = gpmc_read_reg(GPMC_IRQSTATUS);
523 break;
524
525 case GPMC_PREFETCH_FIFO_CNT:
526 regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
527 status = GPMC_PREFETCH_STATUS_FIFO_CNT(regval);
528 break;
529
530 case GPMC_PREFETCH_COUNT:
531 regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
532 status = GPMC_PREFETCH_STATUS_COUNT(regval);
533 break;
534
535 case GPMC_STATUS_BUFFER:
536 regval = gpmc_read_reg(GPMC_STATUS);
537 /* 1 : buffer is available to write */
538 status = regval & GPMC_STATUS_BUFF_EMPTY;
539 break;
540
541 default:
542 printk(KERN_ERR "gpmc_read_status: Not supported\n");
543 }
544 return status;
545}
546EXPORT_SYMBOL(gpmc_read_status);
547
548/**
549 * gpmc_cs_configure - write request to configure gpmc 499 * gpmc_cs_configure - write request to configure gpmc
550 * @cs: chip select number 500 * @cs: chip select number
551 * @cmd: command type 501 * @cmd: command type
@@ -613,121 +563,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
613} 563}
614EXPORT_SYMBOL(gpmc_cs_configure); 564EXPORT_SYMBOL(gpmc_cs_configure);
615 565
616/**
617 * gpmc_nand_read - nand specific read access request
618 * @cs: chip select number
619 * @cmd: command type
620 */
621int gpmc_nand_read(int cs, int cmd)
622{
623 int rval = -EINVAL;
624
625 switch (cmd) {
626 case GPMC_NAND_DATA:
627 rval = gpmc_cs_read_byte(cs, GPMC_CS_NAND_DATA);
628 break;
629
630 default:
631 printk(KERN_ERR "gpmc_read_nand_ctrl: Not supported\n");
632 }
633 return rval;
634}
635EXPORT_SYMBOL(gpmc_nand_read);
636
637/**
638 * gpmc_nand_write - nand specific write request
639 * @cs: chip select number
640 * @cmd: command type
641 * @wval: value to write
642 */
643int gpmc_nand_write(int cs, int cmd, int wval)
644{
645 int err = 0;
646
647 switch (cmd) {
648 case GPMC_NAND_COMMAND:
649 gpmc_cs_write_byte(cs, GPMC_CS_NAND_COMMAND, wval);
650 break;
651
652 case GPMC_NAND_ADDRESS:
653 gpmc_cs_write_byte(cs, GPMC_CS_NAND_ADDRESS, wval);
654 break;
655
656 case GPMC_NAND_DATA:
657 gpmc_cs_write_byte(cs, GPMC_CS_NAND_DATA, wval);
658
659 default:
660 printk(KERN_ERR "gpmc_write_nand_ctrl: Not supported\n");
661 err = -EINVAL;
662 }
663 return err;
664}
665EXPORT_SYMBOL(gpmc_nand_write);
666
667
668
669/**
670 * gpmc_prefetch_enable - configures and starts prefetch transfer
671 * @cs: cs (chip select) number
672 * @fifo_th: fifo threshold to be used for read/ write
673 * @dma_mode: dma mode enable (1) or disable (0)
674 * @u32_count: number of bytes to be transferred
675 * @is_write: prefetch read(0) or write post(1) mode
676 */
677int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
678 unsigned int u32_count, int is_write)
679{
680
681 if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX) {
682 pr_err("gpmc: fifo threshold is not supported\n");
683 return -1;
684 } else if (!(gpmc_read_reg(GPMC_PREFETCH_CONTROL))) {
685 /* Set the amount of bytes to be prefetched */
686 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, u32_count);
687
688 /* Set dma/mpu mode, the prefetch read / post write and
689 * enable the engine. Set which cs is has requested for.
690 */
691 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, ((cs << CS_NUM_SHIFT) |
692 PREFETCH_FIFOTHRESHOLD(fifo_th) |
693 ENABLE_PREFETCH |
694 (dma_mode << DMA_MPU_MODE) |
695 (0x1 & is_write)));
696
697 /* Start the prefetch engine */
698 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x1);
699 } else {
700 return -EBUSY;
701 }
702
703 return 0;
704}
705EXPORT_SYMBOL(gpmc_prefetch_enable);
706
707/**
708 * gpmc_prefetch_reset - disables and stops the prefetch engine
709 */
710int gpmc_prefetch_reset(int cs)
711{
712 u32 config1;
713
714 /* check if the same module/cs is trying to reset */
715 config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
716 if (((config1 >> CS_NUM_SHIFT) & 0x7) != cs)
717 return -EINVAL;
718
719 /* Stop the PFPW engine */
720 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x0);
721
722 /* Reset/disable the PFPW engine */
723 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, 0x0);
724
725 return 0;
726}
727EXPORT_SYMBOL(gpmc_prefetch_reset);
728
729void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) 566void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
730{ 567{
568 int i;
569
731 reg->gpmc_status = gpmc_base + GPMC_STATUS; 570 reg->gpmc_status = gpmc_base + GPMC_STATUS;
732 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET + 571 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
733 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs; 572 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
@@ -743,7 +582,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
743 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL; 582 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL;
744 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG; 583 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG;
745 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT; 584 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT;
746 reg->gpmc_bch_result0 = gpmc_base + GPMC_ECC_BCH_RESULT_0; 585
586 for (i = 0; i < GPMC_BCH_NUM_REMAINDER; i++) {
587 reg->gpmc_bch_result0[i] = gpmc_base + GPMC_ECC_BCH_RESULT_0 +
588 GPMC_BCH_SIZE * i;
589 reg->gpmc_bch_result1[i] = gpmc_base + GPMC_ECC_BCH_RESULT_1 +
590 GPMC_BCH_SIZE * i;
591 reg->gpmc_bch_result2[i] = gpmc_base + GPMC_ECC_BCH_RESULT_2 +
592 GPMC_BCH_SIZE * i;
593 reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
594 GPMC_BCH_SIZE * i;
595 }
747} 596}
748 597
749int gpmc_get_client_irq(unsigned irq_config) 598int gpmc_get_client_irq(unsigned irq_config)
@@ -1078,267 +927,3 @@ void omap3_gpmc_restore_context(void)
1078 } 927 }
1079} 928}
1080#endif /* CONFIG_ARCH_OMAP3 */ 929#endif /* CONFIG_ARCH_OMAP3 */
1081
1082/**
1083 * gpmc_enable_hwecc - enable hardware ecc functionality
1084 * @cs: chip select number
1085 * @mode: read/write mode
1086 * @dev_width: device bus width(1 for x16, 0 for x8)
1087 * @ecc_size: bytes for which ECC will be generated
1088 */
1089int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
1090{
1091 unsigned int val;
1092
1093 /* check if ecc module is in used */
1094 if (gpmc_ecc_used != -EINVAL)
1095 return -EINVAL;
1096
1097 gpmc_ecc_used = cs;
1098
1099 /* clear ecc and enable bits */
1100 gpmc_write_reg(GPMC_ECC_CONTROL,
1101 GPMC_ECC_CTRL_ECCCLEAR |
1102 GPMC_ECC_CTRL_ECCREG1);
1103
1104 /* program ecc and result sizes */
1105 val = ((((ecc_size >> 1) - 1) << 22) | (0x0000000F));
1106 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, val);
1107
1108 switch (mode) {
1109 case GPMC_ECC_READ:
1110 case GPMC_ECC_WRITE:
1111 gpmc_write_reg(GPMC_ECC_CONTROL,
1112 GPMC_ECC_CTRL_ECCCLEAR |
1113 GPMC_ECC_CTRL_ECCREG1);
1114 break;
1115 case GPMC_ECC_READSYN:
1116 gpmc_write_reg(GPMC_ECC_CONTROL,
1117 GPMC_ECC_CTRL_ECCCLEAR |
1118 GPMC_ECC_CTRL_ECCDISABLE);
1119 break;
1120 default:
1121 printk(KERN_INFO "Error: Unrecognized Mode[%d]!\n", mode);
1122 break;
1123 }
1124
1125 /* (ECC 16 or 8 bit col) | ( CS ) | ECC Enable */
1126 val = (dev_width << 7) | (cs << 1) | (0x1);
1127 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1128 return 0;
1129}
1130EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
1131
1132/**
1133 * gpmc_calculate_ecc - generate non-inverted ecc bytes
1134 * @cs: chip select number
1135 * @dat: data pointer over which ecc is computed
1136 * @ecc_code: ecc code buffer
1137 *
1138 * Using non-inverted ECC is considered ugly since writing a blank
1139 * page (padding) will clear the ECC bytes. This is not a problem as long
1140 * no one is trying to write data on the seemingly unused page. Reading
1141 * an erased page will produce an ECC mismatch between generated and read
1142 * ECC bytes that has to be dealt with separately.
1143 */
1144int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
1145{
1146 unsigned int val = 0x0;
1147
1148 if (gpmc_ecc_used != cs)
1149 return -EINVAL;
1150
1151 /* read ecc result */
1152 val = gpmc_read_reg(GPMC_ECC1_RESULT);
1153 *ecc_code++ = val; /* P128e, ..., P1e */
1154 *ecc_code++ = val >> 16; /* P128o, ..., P1o */
1155 /* P2048o, P1024o, P512o, P256o, P2048e, P1024e, P512e, P256e */
1156 *ecc_code++ = ((val >> 8) & 0x0f) | ((val >> 20) & 0xf0);
1157
1158 gpmc_ecc_used = -EINVAL;
1159 return 0;
1160}
1161EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
1162
1163#ifdef CONFIG_ARCH_OMAP3
1164
1165/**
1166 * gpmc_init_hwecc_bch - initialize hardware BCH ecc functionality
1167 * @cs: chip select number
1168 * @nsectors: how many 512-byte sectors to process
1169 * @nerrors: how many errors to correct per sector (4 or 8)
1170 *
1171 * This function must be executed before any call to gpmc_enable_hwecc_bch.
1172 */
1173int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors)
1174{
1175 /* check if ecc module is in use */
1176 if (gpmc_ecc_used != -EINVAL)
1177 return -EINVAL;
1178
1179 /* support only OMAP3 class */
1180 if (!cpu_is_omap34xx()) {
1181 printk(KERN_ERR "BCH ecc is not supported on this CPU\n");
1182 return -EINVAL;
1183 }
1184
1185 /*
1186 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
1187 * Other chips may be added if confirmed to work.
1188 */
1189 if ((nerrors == 4) &&
1190 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
1191 printk(KERN_ERR "BCH 4-bit mode is not supported on this CPU\n");
1192 return -EINVAL;
1193 }
1194
1195 /* sanity check */
1196 if (nsectors > 8) {
1197 printk(KERN_ERR "BCH cannot process %d sectors (max is 8)\n",
1198 nsectors);
1199 return -EINVAL;
1200 }
1201
1202 return 0;
1203}
1204EXPORT_SYMBOL_GPL(gpmc_init_hwecc_bch);
1205
1206/**
1207 * gpmc_enable_hwecc_bch - enable hardware BCH ecc functionality
1208 * @cs: chip select number
1209 * @mode: read/write mode
1210 * @dev_width: device bus width(1 for x16, 0 for x8)
1211 * @nsectors: how many 512-byte sectors to process
1212 * @nerrors: how many errors to correct per sector (4 or 8)
1213 */
1214int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
1215 int nerrors)
1216{
1217 unsigned int val;
1218
1219 /* check if ecc module is in use */
1220 if (gpmc_ecc_used != -EINVAL)
1221 return -EINVAL;
1222
1223 gpmc_ecc_used = cs;
1224
1225 /* clear ecc and enable bits */
1226 gpmc_write_reg(GPMC_ECC_CONTROL, 0x1);
1227
1228 /*
1229 * When using BCH, sector size is hardcoded to 512 bytes.
1230 * Here we are using wrapping mode 6 both for reading and writing, with:
1231 * size0 = 0 (no additional protected byte in spare area)
1232 * size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
1233 */
1234 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, (32 << 22) | (0 << 12));
1235
1236 /* BCH configuration */
1237 val = ((1 << 16) | /* enable BCH */
1238 (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
1239 (0x06 << 8) | /* wrap mode = 6 */
1240 (dev_width << 7) | /* bus width */
1241 (((nsectors-1) & 0x7) << 4) | /* number of sectors */
1242 (cs << 1) | /* ECC CS */
1243 (0x1)); /* enable ECC */
1244
1245 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1246 gpmc_write_reg(GPMC_ECC_CONTROL, 0x101);
1247 return 0;
1248}
1249EXPORT_SYMBOL_GPL(gpmc_enable_hwecc_bch);
1250
1251/**
1252 * gpmc_calculate_ecc_bch4 - Generate 7 ecc bytes per sector of 512 data bytes
1253 * @cs: chip select number
1254 * @dat: The pointer to data on which ecc is computed
1255 * @ecc: The ecc output buffer
1256 */
1257int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc)
1258{
1259 int i;
1260 unsigned long nsectors, reg, val1, val2;
1261
1262 if (gpmc_ecc_used != cs)
1263 return -EINVAL;
1264
1265 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1266
1267 for (i = 0; i < nsectors; i++) {
1268
1269 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1270
1271 /* Read hw-computed remainder */
1272 val1 = gpmc_read_reg(reg + 0);
1273 val2 = gpmc_read_reg(reg + 4);
1274
1275 /*
1276 * Add constant polynomial to remainder, in order to get an ecc
1277 * sequence of 0xFFs for a buffer filled with 0xFFs; and
1278 * left-justify the resulting polynomial.
1279 */
1280 *ecc++ = 0x28 ^ ((val2 >> 12) & 0xFF);
1281 *ecc++ = 0x13 ^ ((val2 >> 4) & 0xFF);
1282 *ecc++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
1283 *ecc++ = 0x39 ^ ((val1 >> 20) & 0xFF);
1284 *ecc++ = 0x96 ^ ((val1 >> 12) & 0xFF);
1285 *ecc++ = 0xac ^ ((val1 >> 4) & 0xFF);
1286 *ecc++ = 0x7f ^ ((val1 & 0xF) << 4);
1287 }
1288
1289 gpmc_ecc_used = -EINVAL;
1290 return 0;
1291}
1292EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch4);
1293
1294/**
1295 * gpmc_calculate_ecc_bch8 - Generate 13 ecc bytes per block of 512 data bytes
1296 * @cs: chip select number
1297 * @dat: The pointer to data on which ecc is computed
1298 * @ecc: The ecc output buffer
1299 */
1300int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc)
1301{
1302 int i;
1303 unsigned long nsectors, reg, val1, val2, val3, val4;
1304
1305 if (gpmc_ecc_used != cs)
1306 return -EINVAL;
1307
1308 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1309
1310 for (i = 0; i < nsectors; i++) {
1311
1312 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1313
1314 /* Read hw-computed remainder */
1315 val1 = gpmc_read_reg(reg + 0);
1316 val2 = gpmc_read_reg(reg + 4);
1317 val3 = gpmc_read_reg(reg + 8);
1318 val4 = gpmc_read_reg(reg + 12);
1319
1320 /*
1321 * Add constant polynomial to remainder, in order to get an ecc
1322 * sequence of 0xFFs for a buffer filled with 0xFFs.
1323 */
1324 *ecc++ = 0xef ^ (val4 & 0xFF);
1325 *ecc++ = 0x51 ^ ((val3 >> 24) & 0xFF);
1326 *ecc++ = 0x2e ^ ((val3 >> 16) & 0xFF);
1327 *ecc++ = 0x09 ^ ((val3 >> 8) & 0xFF);
1328 *ecc++ = 0xed ^ (val3 & 0xFF);
1329 *ecc++ = 0x93 ^ ((val2 >> 24) & 0xFF);
1330 *ecc++ = 0x9a ^ ((val2 >> 16) & 0xFF);
1331 *ecc++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
1332 *ecc++ = 0x97 ^ (val2 & 0xFF);
1333 *ecc++ = 0x79 ^ ((val1 >> 24) & 0xFF);
1334 *ecc++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
1335 *ecc++ = 0x24 ^ ((val1 >> 8) & 0xFF);
1336 *ecc++ = 0xb5 ^ (val1 & 0xFF);
1337 }
1338
1339 gpmc_ecc_used = -EINVAL;
1340 return 0;
1341}
1342EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch8);
1343
1344#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index 2e6e2597178c..79f4dfc2adb3 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -11,6 +11,8 @@
11#ifndef __OMAP2_GPMC_H 11#ifndef __OMAP2_GPMC_H
12#define __OMAP2_GPMC_H 12#define __OMAP2_GPMC_H
13 13
14#include <linux/platform_data/mtd-nand-omap2.h>
15
14/* Maximum Number of Chip Selects */ 16/* Maximum Number of Chip Selects */
15#define GPMC_CS_NUM 8 17#define GPMC_CS_NUM 8
16 18
@@ -32,15 +34,6 @@
32#define GPMC_SET_IRQ_STATUS 0x00000004 34#define GPMC_SET_IRQ_STATUS 0x00000004
33#define GPMC_CONFIG_WP 0x00000005 35#define GPMC_CONFIG_WP 0x00000005
34 36
35#define GPMC_GET_IRQ_STATUS 0x00000006
36#define GPMC_PREFETCH_FIFO_CNT 0x00000007 /* bytes available in FIFO for r/w */
37#define GPMC_PREFETCH_COUNT 0x00000008 /* remaining bytes to be read/write*/
38#define GPMC_STATUS_BUFFER 0x00000009 /* 1: buffer is available to write */
39
40#define GPMC_NAND_COMMAND 0x0000000a
41#define GPMC_NAND_ADDRESS 0x0000000b
42#define GPMC_NAND_DATA 0x0000000c
43
44#define GPMC_ENABLE_IRQ 0x0000000d 37#define GPMC_ENABLE_IRQ 0x0000000d
45 38
46/* ECC commands */ 39/* ECC commands */
@@ -76,25 +69,10 @@
76#define GPMC_DEVICETYPE_NOR 0 69#define GPMC_DEVICETYPE_NOR 0
77#define GPMC_DEVICETYPE_NAND 2 70#define GPMC_DEVICETYPE_NAND 2
78#define GPMC_CONFIG_WRITEPROTECT 0x00000010 71#define GPMC_CONFIG_WRITEPROTECT 0x00000010
79#define GPMC_STATUS_BUFF_EMPTY 0x00000001
80#define WR_RD_PIN_MONITORING 0x00600000 72#define WR_RD_PIN_MONITORING 0x00600000
81#define GPMC_PREFETCH_STATUS_FIFO_CNT(val) ((val >> 24) & 0x7F)
82#define GPMC_PREFETCH_STATUS_COUNT(val) (val & 0x00003fff)
83#define GPMC_IRQ_FIFOEVENTENABLE 0x01 73#define GPMC_IRQ_FIFOEVENTENABLE 0x01
84#define GPMC_IRQ_COUNT_EVENT 0x02 74#define GPMC_IRQ_COUNT_EVENT 0x02
85 75
86#define PREFETCH_FIFOTHRESHOLD_MAX 0x40
87#define PREFETCH_FIFOTHRESHOLD(val) ((val) << 8)
88
89enum omap_ecc {
90 /* 1-bit ecc: stored at end of spare area */
91 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
92 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
93 /* 1-bit ecc: stored at beginning of spare area as romcode */
94 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
95 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
96 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
97};
98 76
99/* 77/*
100 * Note that all values in this struct are in nanoseconds except sync_clk 78 * Note that all values in this struct are in nanoseconds except sync_clk
@@ -133,22 +111,6 @@ struct gpmc_timings {
133 u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */ 111 u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */
134}; 112};
135 113
136struct gpmc_nand_regs {
137 void __iomem *gpmc_status;
138 void __iomem *gpmc_nand_command;
139 void __iomem *gpmc_nand_address;
140 void __iomem *gpmc_nand_data;
141 void __iomem *gpmc_prefetch_config1;
142 void __iomem *gpmc_prefetch_config2;
143 void __iomem *gpmc_prefetch_control;
144 void __iomem *gpmc_prefetch_status;
145 void __iomem *gpmc_ecc_config;
146 void __iomem *gpmc_ecc_control;
147 void __iomem *gpmc_ecc_size_config;
148 void __iomem *gpmc_ecc1_result;
149 void __iomem *gpmc_bch_result0;
150};
151
152extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); 114extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
153extern int gpmc_get_client_irq(unsigned irq_config); 115extern int gpmc_get_client_irq(unsigned irq_config);
154 116
@@ -160,31 +122,14 @@ extern unsigned long gpmc_get_fclk_period(void);
160 122
161extern void gpmc_cs_write_reg(int cs, int idx, u32 val); 123extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
162extern u32 gpmc_cs_read_reg(int cs, int idx); 124extern u32 gpmc_cs_read_reg(int cs, int idx);
163extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk); 125extern int gpmc_calc_divider(unsigned int sync_clk);
164extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 126extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
165extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); 127extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
166extern void gpmc_cs_free(int cs); 128extern void gpmc_cs_free(int cs);
167extern int gpmc_cs_set_reserved(int cs, int reserved); 129extern int gpmc_cs_set_reserved(int cs, int reserved);
168extern int gpmc_cs_reserved(int cs); 130extern int gpmc_cs_reserved(int cs);
169extern int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
170 unsigned int u32_count, int is_write);
171extern int gpmc_prefetch_reset(int cs);
172extern void omap3_gpmc_save_context(void); 131extern void omap3_gpmc_save_context(void);
173extern void omap3_gpmc_restore_context(void); 132extern void omap3_gpmc_restore_context(void);
174extern int gpmc_read_status(int cmd);
175extern int gpmc_cs_configure(int cs, int cmd, int wval); 133extern int gpmc_cs_configure(int cs, int cmd, int wval);
176extern int gpmc_nand_read(int cs, int cmd);
177extern int gpmc_nand_write(int cs, int cmd, int wval);
178
179int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size);
180int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code);
181
182#ifdef CONFIG_ARCH_OMAP3
183int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors);
184int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
185 int nerrors);
186int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc);
187int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc);
188#endif /* CONFIG_ARCH_OMAP3 */
189 134
190#endif 135#endif
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 4d3a6324155f..ec6c2230cb38 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -17,11 +17,11 @@
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <linux/platform_data/gpio-omap.h> 18#include <linux/platform_data/gpio-omap.h>
19 19
20#include <plat/mmc.h>
21#include <plat/omap-pm.h> 20#include <plat/omap-pm.h>
22#include <plat/omap_device.h> 21#include <plat/omap_device.h>
23 22
24#include "mux.h" 23#include "mux.h"
24#include "mmc.h"
25#include "hsmmc.h" 25#include "hsmmc.h"
26#include "control.h" 26#include "control.h"
27 27
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index ab82dbe92e02..f71e51bfbe2a 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -30,7 +30,7 @@
30#include <plat/omap-pm.h> 30#include <plat/omap-pm.h>
31#include <plat/omap_hwmod.h> 31#include <plat/omap_hwmod.h>
32#include <plat/multi.h> 32#include <plat/multi.h>
33#include <plat/dma.h> 33#include <plat-omap/dma-omap.h>
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 37f8f948047b..b2c7f2300759 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -20,7 +20,7 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/platform_data/asoc-ti-mcbsp.h> 21#include <linux/platform_data/asoc-ti-mcbsp.h>
22 22
23#include <plat/dma.h> 23#include <plat-omap/dma-omap.h>
24#include <plat/omap_device.h> 24#include <plat/omap_device.h>
25#include <linux/pm_runtime.h> 25#include <linux/pm_runtime.h>
26 26
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h
new file mode 100644
index 000000000000..0cd4b089da9c
--- /dev/null
+++ b/arch/arm/mach-omap2/mmc.h
@@ -0,0 +1,23 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3
4#define OMAP24XX_NR_MMC 2
5#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
6#define OMAP2_MMC1_BASE 0x4809c000
7
8#define OMAP4_MMC_REG_OFFSET 0x100
9
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
12#else
13static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
14{
15}
16#endif
17
18struct omap_hwmod;
19int omap_msdi_reset(struct omap_hwmod *oh);
20
21/* called from board-specific card detection service routine */
22extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
23 int is_closed);
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index 9e57b4aadb06..a6020d750431 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -27,11 +27,11 @@
27 27
28#include <plat/omap_hwmod.h> 28#include <plat/omap_hwmod.h>
29#include <plat/omap_device.h> 29#include <plat/omap_device.h>
30#include <plat/mmc.h>
31 30
32#include "common.h" 31#include "common.h"
33#include "control.h" 32#include "control.h"
34#include "mux.h" 33#include "mux.h"
34#include "mmc.h"
35 35
36/* 36/*
37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register 37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index e1f289748c5d..de89d382f52c 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -27,12 +27,12 @@
27 27
28#include <plat/sram.h> 28#include <plat/sram.h>
29#include <plat/omap-secure.h> 29#include <plat/omap-secure.h>
30#include <plat/mmc.h>
31 30
32#include "omap-wakeupgen.h" 31#include "omap-wakeupgen.h"
33 32
34#include "soc.h" 33#include "soc.h"
35#include "common.h" 34#include "common.h"
35#include "mmc.h"
36#include "hsmmc.h" 36#include "hsmmc.h"
37#include "omap4-sar-layout.h" 37#include "omap4-sar-layout.h"
38 38
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index b5db6007c523..80bbbee57649 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -15,18 +15,18 @@
15#include <linux/platform_data/spi-omap2-mcspi.h> 15#include <linux/platform_data/spi-omap2-mcspi.h>
16 16
17#include <plat/omap_hwmod.h> 17#include <plat/omap_hwmod.h>
18#include <plat/dma.h> 18#include <plat-omap/dma-omap.h>
19#include <plat/serial.h> 19#include <plat/serial.h>
20#include <plat/i2c.h> 20#include <plat/i2c.h>
21#include <plat/dmtimer.h> 21#include <plat/dmtimer.h>
22#include "l3_2xxx.h" 22#include "l3_2xxx.h"
23#include "l4_2xxx.h" 23#include "l4_2xxx.h"
24#include <plat/mmc.h>
25 24
26#include "omap_hwmod_common_data.h" 25#include "omap_hwmod_common_data.h"
27 26
28#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
29#include "prm-regbits-24xx.h" 28#include "prm-regbits-24xx.h"
29#include "mmc.h"
30#include "wd_timer.h" 30#include "wd_timer.h"
31 31
32/* 32/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c455e41b0237..dff04f948a2f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -16,11 +16,11 @@
16#include <linux/platform_data/spi-omap2-mcspi.h> 16#include <linux/platform_data/spi-omap2-mcspi.h>
17 17
18#include <plat/omap_hwmod.h> 18#include <plat/omap_hwmod.h>
19#include <plat/dma.h> 19#include <plat-omap/dma-omap.h>
20#include <plat/serial.h> 20#include <plat/serial.h>
21#include <plat/i2c.h> 21#include <plat/i2c.h>
22#include <plat/dmtimer.h> 22#include <plat/dmtimer.h>
23#include <plat/mmc.h> 23#include "mmc.h"
24#include "l3_2xxx.h" 24#include "l3_2xxx.h"
25 25
26#include "soc.h" 26#include "soc.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
index 8851bbb6bb24..2420097d29f5 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -11,11 +11,12 @@
11 */ 11 */
12#include <plat/omap_hwmod.h> 12#include <plat/omap_hwmod.h>
13#include <plat/serial.h> 13#include <plat/serial.h>
14#include <plat/dma.h> 14#include <plat-omap/dma-omap.h>
15#include <plat/common.h> 15#include <plat/common.h>
16#include "hdq1w.h" 16#include "hdq1w.h"
17 17
18#include "omap_hwmod_common_data.h" 18#include "omap_hwmod_common_data.h"
19#include "dma.h"
19 20
20/* UART */ 21/* UART */
21 22
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index bd9220ed5ab9..b9024868774c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -11,7 +11,7 @@
11#include <plat/omap_hwmod.h> 11#include <plat/omap_hwmod.h>
12#include <plat/serial.h> 12#include <plat/serial.h>
13#include <linux/platform_data/gpio-omap.h> 13#include <linux/platform_data/gpio-omap.h>
14#include <plat/dma.h> 14#include <plat-omap/dma-omap.h>
15#include <plat/dmtimer.h> 15#include <plat/dmtimer.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 16#include <linux/platform_data/spi-omap2-mcspi.h>
17 17
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 59d5c1cd316d..44a661882a7e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -18,8 +18,6 @@
18#include <plat/cpu.h> 18#include <plat/cpu.h>
19#include <linux/platform_data/gpio-omap.h> 19#include <linux/platform_data/gpio-omap.h>
20#include <linux/platform_data/spi-omap2-mcspi.h> 20#include <linux/platform_data/spi-omap2-mcspi.h>
21#include <plat/dma.h>
22#include <plat/mmc.h>
23#include <plat/i2c.h> 21#include <plat/i2c.h>
24 22
25#include "omap_hwmod_common_data.h" 23#include "omap_hwmod_common_data.h"
@@ -28,6 +26,7 @@
28#include "cm33xx.h" 26#include "cm33xx.h"
29#include "prm33xx.h" 27#include "prm33xx.h"
30#include "prm-regbits-33xx.h" 28#include "prm-regbits-33xx.h"
29#include "mmc.h"
31 30
32/* 31/*
33 * IP blocks 32 * IP blocks
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index f67b7ee07dd4..2aaf3ce80626 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -18,12 +18,11 @@
18#include <linux/platform_data/gpio-omap.h> 18#include <linux/platform_data/gpio-omap.h>
19 19
20#include <plat/omap_hwmod.h> 20#include <plat/omap_hwmod.h>
21#include <plat/dma.h> 21#include <plat-omap/dma-omap.h>
22#include <plat/serial.h> 22#include <plat/serial.h>
23#include "l3_3xxx.h" 23#include "l3_3xxx.h"
24#include "l4_3xxx.h" 24#include "l4_3xxx.h"
25#include <plat/i2c.h> 25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <linux/platform_data/asoc-ti-mcbsp.h> 26#include <linux/platform_data/asoc-ti-mcbsp.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 27#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <plat/dmtimer.h> 28#include <plat/dmtimer.h>
@@ -35,6 +34,9 @@
35#include "omap_hwmod_common_data.h" 34#include "omap_hwmod_common_data.h"
36#include "prm-regbits-34xx.h" 35#include "prm-regbits-34xx.h"
37#include "cm-regbits-34xx.h" 36#include "cm-regbits-34xx.h"
37
38#include "dma.h"
39#include "mmc.h"
38#include "wd_timer.h" 40#include "wd_timer.h"
39 41
40/* 42/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 652d0285bd6d..f47a57fa1f3a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -24,10 +24,9 @@
24 24
25#include <plat/omap_hwmod.h> 25#include <plat/omap_hwmod.h>
26#include <plat/i2c.h> 26#include <plat/i2c.h>
27#include <plat/dma.h> 27#include <plat-omap/dma-omap.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 28#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <linux/platform_data/asoc-ti-mcbsp.h> 29#include <linux/platform_data/asoc-ti-mcbsp.h>
30#include <plat/mmc.h>
31#include <plat/dmtimer.h> 30#include <plat/dmtimer.h>
32#include <plat/common.h> 31#include <plat/common.h>
33#include <plat/iommu.h> 32#include <plat/iommu.h>
@@ -37,6 +36,7 @@
37#include "cm2_44xx.h" 36#include "cm2_44xx.h"
38#include "prm44xx.h" 37#include "prm44xx.h"
39#include "prm-regbits-44xx.h" 38#include "prm-regbits-44xx.h"
39#include "mmc.h"
40#include "wd_timer.h" 40#include "wd_timer.h"
41 41
42/* Base offset for all OMAP4 interrupts external to MPUSS */ 42/* Base offset for all OMAP4 interrupts external to MPUSS */
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 8af6cd6ac331..601a49bc264c 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -38,7 +38,7 @@
38 38
39#include <plat/clock.h> 39#include <plat/clock.h>
40#include <plat/sram.h> 40#include <plat/sram.h>
41#include <plat/dma.h> 41#include <plat-omap/dma-omap.h>
42 42
43#include "common.h" 43#include "common.h"
44#include "prm2xxx_3xxx.h" 44#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index ee0bffc614be..bbe15cb1b874 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -39,12 +39,12 @@
39#include "clockdomain.h" 39#include "clockdomain.h"
40#include "powerdomain.h" 40#include "powerdomain.h"
41#include <plat/prcm.h> 41#include <plat/prcm.h>
42#include <plat/gpmc.h> 42#include <plat-omap/dma-omap.h>
43#include <plat/dma.h>
44 43
45#include "common.h" 44#include "common.h"
46#include "cm2xxx_3xxx.h" 45#include "cm2xxx_3xxx.h"
47#include "cm-regbits-34xx.h" 46#include "cm-regbits-34xx.h"
47#include "gpmc.h"
48#include "prm-regbits-34xx.h" 48#include "prm-regbits-34xx.h"
49 49
50#include "prm2xxx_3xxx.h" 50#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0405c8190803..67c41961fa42 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -29,7 +29,7 @@
29 29
30#include <plat/omap-serial.h> 30#include <plat/omap-serial.h>
31#include "common.h" 31#include "common.h"
32#include <plat/dma.h> 32#include <plat-omap/dma-omap.h>
33#include <plat/omap_hwmod.h> 33#include <plat/omap_hwmod.h>
34#include <plat/omap_device.h> 34#include <plat/omap_device.h>
35#include <plat/omap-pm.h> 35#include <plat/omap-pm.h>
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 805bea6edf17..6064425ed47b 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -18,7 +18,7 @@
18 18
19#include <linux/usb/musb.h> 19#include <linux/usb/musb.h>
20 20
21#include <plat/gpmc.h> 21#include "gpmc.h"
22 22
23#include "mux.h" 23#include "mux.h"
24 24
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 111315a69354..b388e87b522b 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -19,7 +19,7 @@
19#include <plat/common.h> 19#include <plat/common.h>
20#include <plat/vram.h> 20#include <plat/vram.h>
21#include <linux/platform_data/dsp-omap.h> 21#include <linux/platform_data/dsp-omap.h>
22#include <plat/dma.h> 22#include <plat-omap/dma-omap.h>
23 23
24#include <plat/omap-secure.h> 24#include <plat/omap-secure.h>
25 25
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c76ed8bff838..b729623f2967 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -37,7 +37,7 @@
37#include <linux/delay.h> 37#include <linux/delay.h>
38 38
39#include <plat/cpu.h> 39#include <plat/cpu.h>
40#include <plat/dma.h> 40#include <plat-omap/dma-omap.h>
41#include <plat/tc.h> 41#include <plat/tc.h>
42 42
43/* 43/*
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat-omap/dma-omap.h
index 0a87b052f8f7..222be7e934e5 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat-omap/dma-omap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/dma.h 2 * OMAP DMA handling defines and function
3 * 3 *
4 * Copyright (C) 2003 Nokia Corporation 4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
@@ -23,187 +23,8 @@
23 23
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26/*
27 * TODO: These dma channel defines should go away once all
28 * the omap drivers hwmod adapted.
29 */
30
31/* Move omap4 specific defines to dma-44xx.h */
32#include "dma-44xx.h"
33
34#define INT_DMA_LCD 25 26#define INT_DMA_LCD 25
35 27
36/* DMA channels for omap1 */
37#define OMAP_DMA_NO_DEVICE 0
38#define OMAP_DMA_MCSI1_TX 1
39#define OMAP_DMA_MCSI1_RX 2
40#define OMAP_DMA_I2C_RX 3
41#define OMAP_DMA_I2C_TX 4
42#define OMAP_DMA_EXT_NDMA_REQ 5
43#define OMAP_DMA_EXT_NDMA_REQ2 6
44#define OMAP_DMA_UWIRE_TX 7
45#define OMAP_DMA_MCBSP1_TX 8
46#define OMAP_DMA_MCBSP1_RX 9
47#define OMAP_DMA_MCBSP3_TX 10
48#define OMAP_DMA_MCBSP3_RX 11
49#define OMAP_DMA_UART1_TX 12
50#define OMAP_DMA_UART1_RX 13
51#define OMAP_DMA_UART2_TX 14
52#define OMAP_DMA_UART2_RX 15
53#define OMAP_DMA_MCBSP2_TX 16
54#define OMAP_DMA_MCBSP2_RX 17
55#define OMAP_DMA_UART3_TX 18
56#define OMAP_DMA_UART3_RX 19
57#define OMAP_DMA_CAMERA_IF_RX 20
58#define OMAP_DMA_MMC_TX 21
59#define OMAP_DMA_MMC_RX 22
60#define OMAP_DMA_NAND 23
61#define OMAP_DMA_IRQ_LCD_LINE 24
62#define OMAP_DMA_MEMORY_STICK 25
63#define OMAP_DMA_USB_W2FC_RX0 26
64#define OMAP_DMA_USB_W2FC_RX1 27
65#define OMAP_DMA_USB_W2FC_RX2 28
66#define OMAP_DMA_USB_W2FC_TX0 29
67#define OMAP_DMA_USB_W2FC_TX1 30
68#define OMAP_DMA_USB_W2FC_TX2 31
69
70/* These are only for 1610 */
71#define OMAP_DMA_CRYPTO_DES_IN 32
72#define OMAP_DMA_SPI_TX 33
73#define OMAP_DMA_SPI_RX 34
74#define OMAP_DMA_CRYPTO_HASH 35
75#define OMAP_DMA_CCP_ATTN 36
76#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
77#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
78#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
79#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
80#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
81#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
82#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
83#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
84#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
85#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
86#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
87#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
88#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
89#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
90#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
91#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
92#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
93#define OMAP_DMA_MMC2_TX 54
94#define OMAP_DMA_MMC2_RX 55
95#define OMAP_DMA_CRYPTO_DES_OUT 56
96
97/* DMA channels for 24xx */
98#define OMAP24XX_DMA_NO_DEVICE 0
99#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
100#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
101#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
102#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
103#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
104#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
105#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
106#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
107#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
108#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
109#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
110#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
111#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
112#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
113#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
114#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
115#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
116#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
117#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
118#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
119#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
120#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
121#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
122#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
123#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
124#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
125#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
126#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
127#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
128#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
129#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
130#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
131#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
132#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
133#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
134#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
135#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
136#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
137#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
138#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
139#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
140#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
141#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
142#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
143#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
144#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
145#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
146#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
147#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
148#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
149#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
150#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
151#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
152#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
153#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
154#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
155#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
156#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
157#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
158#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
159#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
160#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
161#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
162#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
163#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
164#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
165#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
166#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
167#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
168#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
169#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
170#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
171#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
172#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
173#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
174#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
175#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
176#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
177#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
178#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
179#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
180#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
181#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
182#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
183#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
184#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
185#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
186#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
187#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
188#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
189#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
190#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
191#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
192#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
193#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
194#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
195#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
196#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
197
198#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
199#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
200
201/* Only for AM35xx */
202#define AM35XX_DMA_UART4_TX 54
203#define AM35XX_DMA_UART4_RX 55
204
205/*----------------------------------------------------------------------------*/
206
207#define OMAP1_DMA_TOUT_IRQ (1 << 0) 28#define OMAP1_DMA_TOUT_IRQ (1 << 0)
208#define OMAP_DMA_DROP_IRQ (1 << 1) 29#define OMAP_DMA_DROP_IRQ (1 << 1)
209#define OMAP_DMA_HALF_IRQ (1 << 2) 30#define OMAP_DMA_HALF_IRQ (1 << 2)
diff --git a/arch/arm/plat-omap/include/plat/dma-44xx.h b/arch/arm/plat-omap/include/plat/dma-44xx.h
deleted file mode 100644
index 1f767cb2f38a..000000000000
--- a/arch/arm/plat-omap/include/plat/dma-44xx.h
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2 * OMAP4 SDMA channel definitions
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 * Paul Walmsley (paul@pwsan.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
23#define __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
24
25#define OMAP44XX_DMA_SYS_REQ0 2
26#define OMAP44XX_DMA_SYS_REQ1 3
27#define OMAP44XX_DMA_GPMC 4
28#define OMAP44XX_DMA_DSS_DISPC_REQ 6
29#define OMAP44XX_DMA_SYS_REQ2 7
30#define OMAP44XX_DMA_MCASP1_AXEVT 8
31#define OMAP44XX_DMA_ISS_REQ1 9
32#define OMAP44XX_DMA_ISS_REQ2 10
33#define OMAP44XX_DMA_MCASP1_AREVT 11
34#define OMAP44XX_DMA_ISS_REQ3 12
35#define OMAP44XX_DMA_ISS_REQ4 13
36#define OMAP44XX_DMA_DSS_RFBI_REQ 14
37#define OMAP44XX_DMA_SPI3_TX0 15
38#define OMAP44XX_DMA_SPI3_RX0 16
39#define OMAP44XX_DMA_MCBSP2_TX 17
40#define OMAP44XX_DMA_MCBSP2_RX 18
41#define OMAP44XX_DMA_MCBSP3_TX 19
42#define OMAP44XX_DMA_MCBSP3_RX 20
43#define OMAP44XX_DMA_C2C_SSCM_GPO0 21
44#define OMAP44XX_DMA_C2C_SSCM_GPO1 22
45#define OMAP44XX_DMA_SPI3_TX1 23
46#define OMAP44XX_DMA_SPI3_RX1 24
47#define OMAP44XX_DMA_I2C3_TX 25
48#define OMAP44XX_DMA_I2C3_RX 26
49#define OMAP44XX_DMA_I2C1_TX 27
50#define OMAP44XX_DMA_I2C1_RX 28
51#define OMAP44XX_DMA_I2C2_TX 29
52#define OMAP44XX_DMA_I2C2_RX 30
53#define OMAP44XX_DMA_MCBSP4_TX 31
54#define OMAP44XX_DMA_MCBSP4_RX 32
55#define OMAP44XX_DMA_MCBSP1_TX 33
56#define OMAP44XX_DMA_MCBSP1_RX 34
57#define OMAP44XX_DMA_SPI1_TX0 35
58#define OMAP44XX_DMA_SPI1_RX0 36
59#define OMAP44XX_DMA_SPI1_TX1 37
60#define OMAP44XX_DMA_SPI1_RX1 38
61#define OMAP44XX_DMA_SPI1_TX2 39
62#define OMAP44XX_DMA_SPI1_RX2 40
63#define OMAP44XX_DMA_SPI1_TX3 41
64#define OMAP44XX_DMA_SPI1_RX3 42
65#define OMAP44XX_DMA_SPI2_TX0 43
66#define OMAP44XX_DMA_SPI2_RX0 44
67#define OMAP44XX_DMA_SPI2_TX1 45
68#define OMAP44XX_DMA_SPI2_RX1 46
69#define OMAP44XX_DMA_MMC2_TX 47
70#define OMAP44XX_DMA_MMC2_RX 48
71#define OMAP44XX_DMA_UART1_TX 49
72#define OMAP44XX_DMA_UART1_RX 50
73#define OMAP44XX_DMA_UART2_TX 51
74#define OMAP44XX_DMA_UART2_RX 52
75#define OMAP44XX_DMA_UART3_TX 53
76#define OMAP44XX_DMA_UART3_RX 54
77#define OMAP44XX_DMA_UART4_TX 55
78#define OMAP44XX_DMA_UART4_RX 56
79#define OMAP44XX_DMA_MMC4_TX 57
80#define OMAP44XX_DMA_MMC4_RX 58
81#define OMAP44XX_DMA_MMC5_TX 59
82#define OMAP44XX_DMA_MMC5_RX 60
83#define OMAP44XX_DMA_MMC1_TX 61
84#define OMAP44XX_DMA_MMC1_RX 62
85#define OMAP44XX_DMA_SYS_REQ3 64
86#define OMAP44XX_DMA_MCPDM_UP 65
87#define OMAP44XX_DMA_MCPDM_DL 66
88#define OMAP44XX_DMA_DMIC_REQ 67
89#define OMAP44XX_DMA_C2C_SSCM_GPO2 68
90#define OMAP44XX_DMA_C2C_SSCM_GPO3 69
91#define OMAP44XX_DMA_SPI4_TX0 70
92#define OMAP44XX_DMA_SPI4_RX0 71
93#define OMAP44XX_DMA_DSS_DSI1_REQ0 72
94#define OMAP44XX_DMA_DSS_DSI1_REQ1 73
95#define OMAP44XX_DMA_DSS_DSI1_REQ2 74
96#define OMAP44XX_DMA_DSS_DSI1_REQ3 75
97#define OMAP44XX_DMA_DSS_HDMI_REQ 76
98#define OMAP44XX_DMA_MMC3_TX 77
99#define OMAP44XX_DMA_MMC3_RX 78
100#define OMAP44XX_DMA_USIM_TX 79
101#define OMAP44XX_DMA_USIM_RX 80
102#define OMAP44XX_DMA_DSS_DSI2_REQ0 81
103#define OMAP44XX_DMA_DSS_DSI2_REQ1 82
104#define OMAP44XX_DMA_DSS_DSI2_REQ2 83
105#define OMAP44XX_DMA_DSS_DSI2_REQ3 84
106#define OMAP44XX_DMA_SLIMBUS1_TX0 85
107#define OMAP44XX_DMA_SLIMBUS1_TX1 86
108#define OMAP44XX_DMA_SLIMBUS1_TX2 87
109#define OMAP44XX_DMA_SLIMBUS1_TX3 88
110#define OMAP44XX_DMA_SLIMBUS1_RX0 89
111#define OMAP44XX_DMA_SLIMBUS1_RX1 90
112#define OMAP44XX_DMA_SLIMBUS1_RX2 91
113#define OMAP44XX_DMA_SLIMBUS1_RX3 92
114#define OMAP44XX_DMA_SLIMBUS2_TX0 93
115#define OMAP44XX_DMA_SLIMBUS2_TX1 94
116#define OMAP44XX_DMA_SLIMBUS2_TX2 95
117#define OMAP44XX_DMA_SLIMBUS2_TX3 96
118#define OMAP44XX_DMA_SLIMBUS2_RX0 97
119#define OMAP44XX_DMA_SLIMBUS2_RX1 98
120#define OMAP44XX_DMA_SLIMBUS2_RX2 99
121#define OMAP44XX_DMA_SLIMBUS2_RX3 100
122#define OMAP44XX_DMA_ABE_REQ_0 101
123#define OMAP44XX_DMA_ABE_REQ_1 102
124#define OMAP44XX_DMA_ABE_REQ_2 103
125#define OMAP44XX_DMA_ABE_REQ_3 104
126#define OMAP44XX_DMA_ABE_REQ_4 105
127#define OMAP44XX_DMA_ABE_REQ_5 106
128#define OMAP44XX_DMA_ABE_REQ_6 107
129#define OMAP44XX_DMA_ABE_REQ_7 108
130#define OMAP44XX_DMA_AES1_P_CTX_IN_REQ 109
131#define OMAP44XX_DMA_AES1_P_DATA_IN_REQ 110
132#define OMAP44XX_DMA_AES1_P_DATA_OUT_REQ 111
133#define OMAP44XX_DMA_AES2_P_CTX_IN_REQ 112
134#define OMAP44XX_DMA_AES2_P_DATA_IN_REQ 113
135#define OMAP44XX_DMA_AES2_P_DATA_OUT_REQ 114
136#define OMAP44XX_DMA_DES_P_CTX_IN_REQ 115
137#define OMAP44XX_DMA_DES_P_DATA_IN_REQ 116
138#define OMAP44XX_DMA_DES_P_DATA_OUT_REQ 117
139#define OMAP44XX_DMA_SHA2_CTXIN_P 118
140#define OMAP44XX_DMA_SHA2_DIN_P 119
141#define OMAP44XX_DMA_SHA2_CTXOUT_P 120
142#define OMAP44XX_DMA_AES1_P_CONTEXT_OUT_REQ 121
143#define OMAP44XX_DMA_AES2_P_CONTEXT_OUT_REQ 122
144#define OMAP44XX_DMA_I2C4_TX 124
145#define OMAP44XX_DMA_I2C4_RX 125
146
147#endif
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index a5effd813abd..45e467dcc8c8 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -27,8 +27,6 @@
27 27
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30#include <plat/cpu.h>
31
32#define RNG_OUT_REG 0x00 /* Output register */ 30#define RNG_OUT_REG 0x00 /* Output register */
33#define RNG_STAT_REG 0x04 /* Status register 31#define RNG_STAT_REG 0x04 /* Status register
34 [0] = STAT_BUSY */ 32 [0] = STAT_BUSY */
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index 093a8af59cbe..649a146e1382 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -29,8 +29,7 @@
29#include <crypto/scatterwalk.h> 29#include <crypto/scatterwalk.h>
30#include <crypto/aes.h> 30#include <crypto/aes.h>
31 31
32#include <plat/cpu.h> 32#include <plat-omap/dma-omap.h>
33#include <plat/dma.h>
34 33
35/* OMAP TRM gives bitfields as start:end, where start is the higher bit 34/* OMAP TRM gives bitfields as start:end, where start is the higher bit
36 number. For example 7:0 */ 35 number. For example 7:0 */
@@ -941,11 +940,6 @@ static int __init omap_aes_mod_init(void)
941{ 940{
942 pr_info("loading %s driver\n", "omap-aes"); 941 pr_info("loading %s driver\n", "omap-aes");
943 942
944 if (!cpu_class_is_omap2() || omap_type() != OMAP2_DEVICE_TYPE_SEC) {
945 pr_err("Unsupported cpu\n");
946 return -ENODEV;
947 }
948
949 return platform_driver_register(&omap_aes_driver); 943 return platform_driver_register(&omap_aes_driver);
950} 944}
951 945
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index a3fd6fc504b1..d76fe06b9417 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -37,8 +37,7 @@
37#include <crypto/hash.h> 37#include <crypto/hash.h>
38#include <crypto/internal/hash.h> 38#include <crypto/internal/hash.h>
39 39
40#include <plat/cpu.h> 40#include <plat-omap/dma-omap.h>
41#include <plat/dma.h>
42#include <mach/irqs.h> 41#include <mach/irqs.h>
43 42
44#define SHA_REG_DIGEST(x) (0x00 + ((x) * 0x04)) 43#define SHA_REG_DIGEST(x) (0x00 + ((x) * 0x04))
@@ -1289,13 +1288,6 @@ static int __init omap_sham_mod_init(void)
1289{ 1288{
1290 pr_info("loading %s driver\n", "omap-sham"); 1289 pr_info("loading %s driver\n", "omap-sham");
1291 1290
1292 if (!cpu_class_is_omap2() ||
1293 (omap_type() != OMAP2_DEVICE_TYPE_SEC &&
1294 omap_type() != OMAP2_DEVICE_TYPE_EMU)) {
1295 pr_err("Unsupported cpu\n");
1296 return -ENODEV;
1297 }
1298
1299 return platform_driver_register(&omap_sham_driver); 1291 return platform_driver_register(&omap_sham_driver);
1300} 1292}
1301 1293
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index bb2d8e7029eb..56d925312a5c 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -19,8 +19,13 @@
19 19
20#include "virt-dma.h" 20#include "virt-dma.h"
21 21
22#include <plat/cpu.h> 22#include <plat-omap/dma-omap.h>
23#include <plat/dma.h> 23
24#ifdef CONFIG_ARCH_OMAP2PLUS
25#define dma_omap2plus() 1
26#else
27#define dma_omap2plus() 0
28#endif
24 29
25struct omap_dmadev { 30struct omap_dmadev {
26 struct dma_device ddev; 31 struct dma_device ddev;
@@ -438,7 +443,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
438 omap_disable_dma_irq(c->dma_ch, OMAP_DMA_BLOCK_IRQ); 443 omap_disable_dma_irq(c->dma_ch, OMAP_DMA_BLOCK_IRQ);
439 } 444 }
440 445
441 if (!cpu_class_is_omap1()) { 446 if (dma_omap2plus()) {
442 omap_set_dma_src_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16); 447 omap_set_dma_src_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16);
443 omap_set_dma_dest_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16); 448 omap_set_dma_dest_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16);
444 } 449 }
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index 3ff94a30fde4..4b1becc86e54 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -45,7 +45,7 @@
45#include <media/v4l2-ioctl.h> 45#include <media/v4l2-ioctl.h>
46 46
47#include <plat/cpu.h> 47#include <plat/cpu.h>
48#include <plat/dma.h> 48#include <plat-omap/dma-omap.h>
49#include <video/omapvrfb.h> 49#include <video/omapvrfb.h>
50#include <video/omapdss.h> 50#include <video/omapdss.h>
51 51
diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c
index 6c37f9240ddf..8340445a0ee5 100644
--- a/drivers/media/platform/omap/omap_vout_vrfb.c
+++ b/drivers/media/platform/omap/omap_vout_vrfb.c
@@ -16,12 +16,14 @@
16#include <media/videobuf-dma-contig.h> 16#include <media/videobuf-dma-contig.h>
17#include <media/v4l2-device.h> 17#include <media/v4l2-device.h>
18 18
19#include <plat/dma.h> 19#include <plat-omap/dma-omap.h>
20#include <video/omapvrfb.h> 20#include <video/omapvrfb.h>
21 21
22#include "omap_voutdef.h" 22#include "omap_voutdef.h"
23#include "omap_voutlib.h" 23#include "omap_voutlib.h"
24 24
25#define OMAP_DMA_NO_DEVICE 0
26
25/* 27/*
26 * Function for allocating video buffers 28 * Function for allocating video buffers
27 */ 29 */
diff --git a/drivers/media/platform/omap3isp/isphist.c b/drivers/media/platform/omap3isp/isphist.c
index d1a8dee5e1ca..e7f9c4292cc6 100644
--- a/drivers/media/platform/omap3isp/isphist.c
+++ b/drivers/media/platform/omap3isp/isphist.c
@@ -34,6 +34,8 @@
34#include "ispreg.h" 34#include "ispreg.h"
35#include "isphist.h" 35#include "isphist.h"
36 36
37#define OMAP24XX_DMA_NO_DEVICE 0
38
37#define HIST_CONFIG_DMA 1 39#define HIST_CONFIG_DMA 1
38 40
39#define HIST_USING_DMA(hist) ((hist)->dma_ch >= 0) 41#define HIST_USING_DMA(hist) ((hist)->dma_ch >= 0)
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h
index a6fe653eb237..40f87cdd7994 100644
--- a/drivers/media/platform/omap3isp/ispstat.h
+++ b/drivers/media/platform/omap3isp/ispstat.h
@@ -30,7 +30,7 @@
30 30
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/omap3isp.h> 32#include <linux/omap3isp.h>
33#include <plat/dma.h> 33#include <plat-omap/dma-omap.h>
34#include <media/v4l2-event.h> 34#include <media/v4l2-event.h>
35 35
36#include "isp.h" 36#include "isp.h"
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c
index fa08c7695ccb..cae9ce6275e9 100644
--- a/drivers/media/platform/soc_camera/omap1_camera.c
+++ b/drivers/media/platform/soc_camera/omap1_camera.c
@@ -34,12 +34,13 @@
34#include <media/videobuf-dma-contig.h> 34#include <media/videobuf-dma-contig.h>
35#include <media/videobuf-dma-sg.h> 35#include <media/videobuf-dma-sg.h>
36 36
37#include <plat/dma.h> 37#include <plat-omap/dma-omap.h>
38 38
39 39
40#define DRIVER_NAME "omap1-camera" 40#define DRIVER_NAME "omap1-camera"
41#define DRIVER_VERSION "0.0.2" 41#define DRIVER_VERSION "0.0.2"
42 42
43#define OMAP_DMA_CAMERA_IF_RX 20
43 44
44/* 45/*
45 * --------------------------------------------------------------------------- 46 * ---------------------------------------------------------------------------
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 48ad361613ef..ae115c01283b 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -28,9 +28,8 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/scatterlist.h> 29#include <linux/scatterlist.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/platform_data/mmc-omap.h>
31 32
32#include <plat/mmc.h>
33#include <plat/dma.h>
34 33
35#define OMAP_MMC_REG_CMD 0x00 34#define OMAP_MMC_REG_CMD 0x00
36#define OMAP_MMC_REG_ARGL 0x01 35#define OMAP_MMC_REG_ARGL 0x01
@@ -72,6 +71,13 @@
72#define OMAP_MMC_STAT_CARD_BUSY (1 << 2) 71#define OMAP_MMC_STAT_CARD_BUSY (1 << 2)
73#define OMAP_MMC_STAT_END_OF_CMD (1 << 0) 72#define OMAP_MMC_STAT_END_OF_CMD (1 << 0)
74 73
74#define mmc_omap7xx() (host->features & MMC_OMAP7XX)
75#define mmc_omap15xx() (host->features & MMC_OMAP15XX)
76#define mmc_omap16xx() (host->features & MMC_OMAP16XX)
77#define MMC_OMAP1_MASK (MMC_OMAP7XX | MMC_OMAP15XX | MMC_OMAP16XX)
78#define mmc_omap1() (host->features & MMC_OMAP1_MASK)
79#define mmc_omap2() (!mmc_omap1())
80
75#define OMAP_MMC_REG(host, reg) (OMAP_MMC_REG_##reg << (host)->reg_shift) 81#define OMAP_MMC_REG(host, reg) (OMAP_MMC_REG_##reg << (host)->reg_shift)
76#define OMAP_MMC_READ(host, reg) __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg)) 82#define OMAP_MMC_READ(host, reg) __raw_readw((host)->virt_base + OMAP_MMC_REG(host, reg))
77#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg)) 83#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)->virt_base + OMAP_MMC_REG(host, reg))
@@ -84,6 +90,16 @@
84#define OMAP_MMC_CMDTYPE_AC 2 90#define OMAP_MMC_CMDTYPE_AC 2
85#define OMAP_MMC_CMDTYPE_ADTC 3 91#define OMAP_MMC_CMDTYPE_ADTC 3
86 92
93#define OMAP_DMA_MMC_TX 21
94#define OMAP_DMA_MMC_RX 22
95#define OMAP_DMA_MMC2_TX 54
96#define OMAP_DMA_MMC2_RX 55
97
98#define OMAP24XX_DMA_MMC2_TX 47
99#define OMAP24XX_DMA_MMC2_RX 48
100#define OMAP24XX_DMA_MMC1_TX 61
101#define OMAP24XX_DMA_MMC1_RX 62
102
87 103
88#define DRIVER_NAME "mmci-omap" 104#define DRIVER_NAME "mmci-omap"
89 105
@@ -147,6 +163,7 @@ struct mmc_omap_host {
147 u32 buffer_bytes_left; 163 u32 buffer_bytes_left;
148 u32 total_bytes_left; 164 u32 total_bytes_left;
149 165
166 unsigned features;
150 unsigned use_dma:1; 167 unsigned use_dma:1;
151 unsigned brs_received:1, dma_done:1; 168 unsigned brs_received:1, dma_done:1;
152 unsigned dma_in_use:1; 169 unsigned dma_in_use:1;
@@ -988,7 +1005,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
988 * blocksize is at least that large. Blocksize is 1005 * blocksize is at least that large. Blocksize is
989 * usually 512 bytes; but not for some SD reads. 1006 * usually 512 bytes; but not for some SD reads.
990 */ 1007 */
991 burst = cpu_is_omap15xx() ? 32 : 64; 1008 burst = mmc_omap15xx() ? 32 : 64;
992 if (burst > data->blksz) 1009 if (burst > data->blksz)
993 burst = data->blksz; 1010 burst = data->blksz;
994 1011
@@ -1104,8 +1121,7 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
1104 if (slot->pdata->set_power != NULL) 1121 if (slot->pdata->set_power != NULL)
1105 slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on, 1122 slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
1106 vdd); 1123 vdd);
1107 1124 if (mmc_omap2()) {
1108 if (cpu_is_omap24xx()) {
1109 u16 w; 1125 u16 w;
1110 1126
1111 if (power_on) { 1127 if (power_on) {
@@ -1239,7 +1255,7 @@ static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id)
1239 mmc->ops = &mmc_omap_ops; 1255 mmc->ops = &mmc_omap_ops;
1240 mmc->f_min = 400000; 1256 mmc->f_min = 400000;
1241 1257
1242 if (cpu_class_is_omap2()) 1258 if (mmc_omap2())
1243 mmc->f_max = 48000000; 1259 mmc->f_max = 48000000;
1244 else 1260 else
1245 mmc->f_max = 24000000; 1261 mmc->f_max = 24000000;
@@ -1359,6 +1375,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1359 init_waitqueue_head(&host->slot_wq); 1375 init_waitqueue_head(&host->slot_wq);
1360 1376
1361 host->pdata = pdata; 1377 host->pdata = pdata;
1378 host->features = host->pdata->slots[0].features;
1362 host->dev = &pdev->dev; 1379 host->dev = &pdev->dev;
1363 platform_set_drvdata(pdev, host); 1380 platform_set_drvdata(pdev, host);
1364 1381
@@ -1391,7 +1408,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1391 host->dma_tx_burst = -1; 1408 host->dma_tx_burst = -1;
1392 host->dma_rx_burst = -1; 1409 host->dma_rx_burst = -1;
1393 1410
1394 if (cpu_is_omap24xx()) 1411 if (mmc_omap2())
1395 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; 1412 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
1396 else 1413 else
1397 sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; 1414 sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
@@ -1407,7 +1424,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1407 dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", 1424 dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
1408 sig); 1425 sig);
1409#endif 1426#endif
1410 if (cpu_is_omap24xx()) 1427 if (mmc_omap2())
1411 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; 1428 sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
1412 else 1429 else
1413 sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; 1430 sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
@@ -1435,7 +1452,7 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1435 } 1452 }
1436 1453
1437 host->nr_slots = pdata->nr_slots; 1454 host->nr_slots = pdata->nr_slots;
1438 host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); 1455 host->reg_shift = (mmc_omap7xx() ? 1 : 2);
1439 1456
1440 host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); 1457 host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
1441 if (!host->mmc_omap_wq) 1458 if (!host->mmc_omap_wq)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 54bfd0cc106b..9b24bd46aad3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -38,9 +38,7 @@
38#include <linux/gpio.h> 38#include <linux/gpio.h>
39#include <linux/regulator/consumer.h> 39#include <linux/regulator/consumer.h>
40#include <linux/pm_runtime.h> 40#include <linux/pm_runtime.h>
41#include <mach/hardware.h> 41#include <linux/platform_data/mmc-omap.h>
42#include <plat/mmc.h>
43#include <plat/cpu.h>
44 42
45/* OMAP HSMMC Host Controller Registers */ 43/* OMAP HSMMC Host Controller Registers */
46#define OMAP_HSMMC_SYSSTATUS 0x0014 44#define OMAP_HSMMC_SYSSTATUS 0x0014
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 5b3138620646..5c8978e90240 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -27,8 +27,7 @@
27#include <linux/bch.h> 27#include <linux/bch.h>
28#endif 28#endif
29 29
30#include <plat/dma.h> 30#include <plat-omap/dma-omap.h>
31#include <plat/gpmc.h>
32#include <linux/platform_data/mtd-nand-omap2.h> 31#include <linux/platform_data/mtd-nand-omap2.h>
33 32
34#define DRIVER_NAME "omap2-nand" 33#define DRIVER_NAME "omap2-nand"
@@ -106,10 +105,18 @@
106#define CS_MASK 0x7 105#define CS_MASK 0x7
107#define ENABLE_PREFETCH (0x1 << 7) 106#define ENABLE_PREFETCH (0x1 << 7)
108#define DMA_MPU_MODE_SHIFT 2 107#define DMA_MPU_MODE_SHIFT 2
108#define ECCSIZE0_SHIFT 12
109#define ECCSIZE1_SHIFT 22 109#define ECCSIZE1_SHIFT 22
110#define ECC1RESULTSIZE 0x1 110#define ECC1RESULTSIZE 0x1
111#define ECCCLEAR 0x100 111#define ECCCLEAR 0x100
112#define ECC1 0x1 112#define ECC1 0x1
113#define PREFETCH_FIFOTHRESHOLD_MAX 0x40
114#define PREFETCH_FIFOTHRESHOLD(val) ((val) << 8)
115#define PREFETCH_STATUS_COUNT(val) (val & 0x00003fff)
116#define PREFETCH_STATUS_FIFO_CNT(val) ((val >> 24) & 0x7F)
117#define STATUS_BUFF_EMPTY 0x00000001
118
119#define OMAP24XX_DMA_GPMC 4
113 120
114/* oob info generated runtime depending on ecc algorithm and layout selected */ 121/* oob info generated runtime depending on ecc algorithm and layout selected */
115static struct nand_ecclayout omap_oobinfo; 122static struct nand_ecclayout omap_oobinfo;
@@ -269,7 +276,7 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
269 /* wait until buffer is available for write */ 276 /* wait until buffer is available for write */
270 do { 277 do {
271 status = readl(info->reg.gpmc_status) & 278 status = readl(info->reg.gpmc_status) &
272 GPMC_STATUS_BUFF_EMPTY; 279 STATUS_BUFF_EMPTY;
273 } while (!status); 280 } while (!status);
274 } 281 }
275} 282}
@@ -307,7 +314,7 @@ static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
307 /* wait until buffer is available for write */ 314 /* wait until buffer is available for write */
308 do { 315 do {
309 status = readl(info->reg.gpmc_status) & 316 status = readl(info->reg.gpmc_status) &
310 GPMC_STATUS_BUFF_EMPTY; 317 STATUS_BUFF_EMPTY;
311 } while (!status); 318 } while (!status);
312 } 319 }
313} 320}
@@ -348,7 +355,7 @@ static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len)
348 } else { 355 } else {
349 do { 356 do {
350 r_count = readl(info->reg.gpmc_prefetch_status); 357 r_count = readl(info->reg.gpmc_prefetch_status);
351 r_count = GPMC_PREFETCH_STATUS_FIFO_CNT(r_count); 358 r_count = PREFETCH_STATUS_FIFO_CNT(r_count);
352 r_count = r_count >> 2; 359 r_count = r_count >> 2;
353 ioread32_rep(info->nand.IO_ADDR_R, p, r_count); 360 ioread32_rep(info->nand.IO_ADDR_R, p, r_count);
354 p += r_count; 361 p += r_count;
@@ -395,7 +402,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
395 } else { 402 } else {
396 while (len) { 403 while (len) {
397 w_count = readl(info->reg.gpmc_prefetch_status); 404 w_count = readl(info->reg.gpmc_prefetch_status);
398 w_count = GPMC_PREFETCH_STATUS_FIFO_CNT(w_count); 405 w_count = PREFETCH_STATUS_FIFO_CNT(w_count);
399 w_count = w_count >> 1; 406 w_count = w_count >> 1;
400 for (i = 0; (i < w_count) && len; i++, len -= 2) 407 for (i = 0; (i < w_count) && len; i++, len -= 2)
401 iowrite16(*p++, info->nand.IO_ADDR_W); 408 iowrite16(*p++, info->nand.IO_ADDR_W);
@@ -407,7 +414,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
407 do { 414 do {
408 cpu_relax(); 415 cpu_relax();
409 val = readl(info->reg.gpmc_prefetch_status); 416 val = readl(info->reg.gpmc_prefetch_status);
410 val = GPMC_PREFETCH_STATUS_COUNT(val); 417 val = PREFETCH_STATUS_COUNT(val);
411 } while (val && (tim++ < limit)); 418 } while (val && (tim++ < limit));
412 419
413 /* disable and stop the PFPW engine */ 420 /* disable and stop the PFPW engine */
@@ -493,7 +500,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr,
493 do { 500 do {
494 cpu_relax(); 501 cpu_relax();
495 val = readl(info->reg.gpmc_prefetch_status); 502 val = readl(info->reg.gpmc_prefetch_status);
496 val = GPMC_PREFETCH_STATUS_COUNT(val); 503 val = PREFETCH_STATUS_COUNT(val);
497 } while (val && (tim++ < limit)); 504 } while (val && (tim++ < limit));
498 505
499 /* disable and stop the PFPW engine */ 506 /* disable and stop the PFPW engine */
@@ -556,7 +563,7 @@ static irqreturn_t omap_nand_irq(int this_irq, void *dev)
556 u32 bytes; 563 u32 bytes;
557 564
558 bytes = readl(info->reg.gpmc_prefetch_status); 565 bytes = readl(info->reg.gpmc_prefetch_status);
559 bytes = GPMC_PREFETCH_STATUS_FIFO_CNT(bytes); 566 bytes = PREFETCH_STATUS_FIFO_CNT(bytes);
560 bytes = bytes & 0xFFFC; /* io in multiple of 4 bytes */ 567 bytes = bytes & 0xFFFC; /* io in multiple of 4 bytes */
561 if (info->iomode == OMAP_NAND_IO_WRITE) { /* checks for write io */ 568 if (info->iomode == OMAP_NAND_IO_WRITE) { /* checks for write io */
562 if (this_irq == info->gpmc_irq_count) 569 if (this_irq == info->gpmc_irq_count)
@@ -682,7 +689,7 @@ static void omap_write_buf_irq_pref(struct mtd_info *mtd,
682 limit = (loops_per_jiffy * msecs_to_jiffies(OMAP_NAND_TIMEOUT_MS)); 689 limit = (loops_per_jiffy * msecs_to_jiffies(OMAP_NAND_TIMEOUT_MS));
683 do { 690 do {
684 val = readl(info->reg.gpmc_prefetch_status); 691 val = readl(info->reg.gpmc_prefetch_status);
685 val = GPMC_PREFETCH_STATUS_COUNT(val); 692 val = PREFETCH_STATUS_COUNT(val);
686 cpu_relax(); 693 cpu_relax();
687 } while (val && (tim++ < limit)); 694 } while (val && (tim++ < limit));
688 695
@@ -996,7 +1003,7 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
996 cond_resched(); 1003 cond_resched();
997 } 1004 }
998 1005
999 status = gpmc_nand_read(info->gpmc_cs, GPMC_NAND_DATA); 1006 status = readb(info->reg.gpmc_nand_data);
1000 return status; 1007 return status;
1001} 1008}
1002 1009
@@ -1029,19 +1036,45 @@ static int omap_dev_ready(struct mtd_info *mtd)
1029static void omap3_enable_hwecc_bch(struct mtd_info *mtd, int mode) 1036static void omap3_enable_hwecc_bch(struct mtd_info *mtd, int mode)
1030{ 1037{
1031 int nerrors; 1038 int nerrors;
1032 unsigned int dev_width; 1039 unsigned int dev_width, nsectors;
1033 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, 1040 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
1034 mtd); 1041 mtd);
1035 struct nand_chip *chip = mtd->priv; 1042 struct nand_chip *chip = mtd->priv;
1043 u32 val;
1036 1044
1037 nerrors = (info->nand.ecc.bytes == 13) ? 8 : 4; 1045 nerrors = (info->nand.ecc.bytes == 13) ? 8 : 4;
1038 dev_width = (chip->options & NAND_BUSWIDTH_16) ? 1 : 0; 1046 dev_width = (chip->options & NAND_BUSWIDTH_16) ? 1 : 0;
1047 nsectors = 1;
1039 /* 1048 /*
1040 * Program GPMC to perform correction on one 512-byte sector at a time. 1049 * Program GPMC to perform correction on one 512-byte sector at a time.
1041 * Using 4 sectors at a time (i.e. ecc.size = 2048) is also possible and 1050 * Using 4 sectors at a time (i.e. ecc.size = 2048) is also possible and
1042 * gives a slight (5%) performance gain (but requires additional code). 1051 * gives a slight (5%) performance gain (but requires additional code).
1043 */ 1052 */
1044 (void)gpmc_enable_hwecc_bch(info->gpmc_cs, mode, dev_width, 1, nerrors); 1053
1054 writel(ECC1, info->reg.gpmc_ecc_control);
1055
1056 /*
1057 * When using BCH, sector size is hardcoded to 512 bytes.
1058 * Here we are using wrapping mode 6 both for reading and writing, with:
1059 * size0 = 0 (no additional protected byte in spare area)
1060 * size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
1061 */
1062 val = (32 << ECCSIZE1_SHIFT) | (0 << ECCSIZE0_SHIFT);
1063 writel(val, info->reg.gpmc_ecc_size_config);
1064
1065 /* BCH configuration */
1066 val = ((1 << 16) | /* enable BCH */
1067 (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
1068 (0x06 << 8) | /* wrap mode = 6 */
1069 (dev_width << 7) | /* bus width */
1070 (((nsectors-1) & 0x7) << 4) | /* number of sectors */
1071 (info->gpmc_cs << 1) | /* ECC CS */
1072 (0x1)); /* enable ECC */
1073
1074 writel(val, info->reg.gpmc_ecc_config);
1075
1076 /* clear ecc and enable bits */
1077 writel(ECCCLEAR | ECC1, info->reg.gpmc_ecc_control);
1045} 1078}
1046 1079
1047/** 1080/**
@@ -1055,7 +1088,32 @@ static int omap3_calculate_ecc_bch4(struct mtd_info *mtd, const u_char *dat,
1055{ 1088{
1056 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, 1089 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
1057 mtd); 1090 mtd);
1058 return gpmc_calculate_ecc_bch4(info->gpmc_cs, dat, ecc_code); 1091 unsigned long nsectors, val1, val2;
1092 int i;
1093
1094 nsectors = ((readl(info->reg.gpmc_ecc_config) >> 4) & 0x7) + 1;
1095
1096 for (i = 0; i < nsectors; i++) {
1097
1098 /* Read hw-computed remainder */
1099 val1 = readl(info->reg.gpmc_bch_result0[i]);
1100 val2 = readl(info->reg.gpmc_bch_result1[i]);
1101
1102 /*
1103 * Add constant polynomial to remainder, in order to get an ecc
1104 * sequence of 0xFFs for a buffer filled with 0xFFs; and
1105 * left-justify the resulting polynomial.
1106 */
1107 *ecc_code++ = 0x28 ^ ((val2 >> 12) & 0xFF);
1108 *ecc_code++ = 0x13 ^ ((val2 >> 4) & 0xFF);
1109 *ecc_code++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
1110 *ecc_code++ = 0x39 ^ ((val1 >> 20) & 0xFF);
1111 *ecc_code++ = 0x96 ^ ((val1 >> 12) & 0xFF);
1112 *ecc_code++ = 0xac ^ ((val1 >> 4) & 0xFF);
1113 *ecc_code++ = 0x7f ^ ((val1 & 0xF) << 4);
1114 }
1115
1116 return 0;
1059} 1117}
1060 1118
1061/** 1119/**
@@ -1069,7 +1127,39 @@ static int omap3_calculate_ecc_bch8(struct mtd_info *mtd, const u_char *dat,
1069{ 1127{
1070 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, 1128 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
1071 mtd); 1129 mtd);
1072 return gpmc_calculate_ecc_bch8(info->gpmc_cs, dat, ecc_code); 1130 unsigned long nsectors, val1, val2, val3, val4;
1131 int i;
1132
1133 nsectors = ((readl(info->reg.gpmc_ecc_config) >> 4) & 0x7) + 1;
1134
1135 for (i = 0; i < nsectors; i++) {
1136
1137 /* Read hw-computed remainder */
1138 val1 = readl(info->reg.gpmc_bch_result0[i]);
1139 val2 = readl(info->reg.gpmc_bch_result1[i]);
1140 val3 = readl(info->reg.gpmc_bch_result2[i]);
1141 val4 = readl(info->reg.gpmc_bch_result3[i]);
1142
1143 /*
1144 * Add constant polynomial to remainder, in order to get an ecc
1145 * sequence of 0xFFs for a buffer filled with 0xFFs.
1146 */
1147 *ecc_code++ = 0xef ^ (val4 & 0xFF);
1148 *ecc_code++ = 0x51 ^ ((val3 >> 24) & 0xFF);
1149 *ecc_code++ = 0x2e ^ ((val3 >> 16) & 0xFF);
1150 *ecc_code++ = 0x09 ^ ((val3 >> 8) & 0xFF);
1151 *ecc_code++ = 0xed ^ (val3 & 0xFF);
1152 *ecc_code++ = 0x93 ^ ((val2 >> 24) & 0xFF);
1153 *ecc_code++ = 0x9a ^ ((val2 >> 16) & 0xFF);
1154 *ecc_code++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
1155 *ecc_code++ = 0x97 ^ (val2 & 0xFF);
1156 *ecc_code++ = 0x79 ^ ((val1 >> 24) & 0xFF);
1157 *ecc_code++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
1158 *ecc_code++ = 0x24 ^ ((val1 >> 8) & 0xFF);
1159 *ecc_code++ = 0xb5 ^ (val1 & 0xFF);
1160 }
1161
1162 return 0;
1073} 1163}
1074 1164
1075/** 1165/**
@@ -1125,7 +1215,7 @@ static void omap3_free_bch(struct mtd_info *mtd)
1125 */ 1215 */
1126static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt) 1216static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt)
1127{ 1217{
1128 int ret, max_errors; 1218 int max_errors;
1129 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, 1219 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
1130 mtd); 1220 mtd);
1131#ifdef CONFIG_MTD_NAND_OMAP_BCH8 1221#ifdef CONFIG_MTD_NAND_OMAP_BCH8
@@ -1142,11 +1232,6 @@ static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt)
1142 goto fail; 1232 goto fail;
1143 } 1233 }
1144 1234
1145 /* initialize GPMC BCH engine */
1146 ret = gpmc_init_hwecc_bch(info->gpmc_cs, 1, max_errors);
1147 if (ret)
1148 goto fail;
1149
1150 /* software bch library is only used to detect and locate errors */ 1235 /* software bch library is only used to detect and locate errors */
1151 info->bch = init_bch(13, max_errors, 0x201b /* hw polynomial */); 1236 info->bch = init_bch(13, max_errors, 0x201b /* hw polynomial */);
1152 if (!info->bch) 1237 if (!info->bch)
@@ -1513,7 +1598,7 @@ static int omap_nand_remove(struct platform_device *pdev)
1513 /* Release NAND device, its internal structures and partitions */ 1598 /* Release NAND device, its internal structures and partitions */
1514 nand_release(&info->mtd); 1599 nand_release(&info->mtd);
1515 iounmap(info->nand.IO_ADDR_R); 1600 iounmap(info->nand.IO_ADDR_R);
1516 release_mem_region(info->phys_base, NAND_IO_SIZE); 1601 release_mem_region(info->phys_base, info->mem_size);
1517 kfree(info); 1602 kfree(info);
1518 return 0; 1603 return 0;
1519} 1604}
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 1961be985171..53069aef1f48 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -38,12 +38,10 @@
38#include <linux/regulator/consumer.h> 38#include <linux/regulator/consumer.h>
39 39
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41#include <plat/gpmc.h>
42#include <linux/platform_data/mtd-onenand-omap2.h> 41#include <linux/platform_data/mtd-onenand-omap2.h>
43#include <asm/gpio.h> 42#include <asm/gpio.h>
44 43
45#include <plat/dma.h> 44#include <plat-omap/dma-omap.h>
46#include <plat/cpu.h>
47 45
48#define DRIVER_NAME "omap2-onenand" 46#define DRIVER_NAME "omap2-onenand"
49 47
@@ -63,6 +61,7 @@ struct omap2_onenand {
63 int freq; 61 int freq;
64 int (*setup)(void __iomem *base, int *freq_ptr); 62 int (*setup)(void __iomem *base, int *freq_ptr);
65 struct regulator *regulator; 63 struct regulator *regulator;
64 u8 flags;
66}; 65};
67 66
68static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data) 67static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data)
@@ -155,7 +154,7 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
155 if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) { 154 if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
156 syscfg |= ONENAND_SYS_CFG1_IOBE; 155 syscfg |= ONENAND_SYS_CFG1_IOBE;
157 write_reg(c, syscfg, ONENAND_REG_SYS_CFG1); 156 write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
158 if (cpu_is_omap34xx()) 157 if (c->flags & ONENAND_IN_OMAP34XX)
159 /* Add a delay to let GPIO settle */ 158 /* Add a delay to let GPIO settle */
160 syscfg = read_reg(c, ONENAND_REG_SYS_CFG1); 159 syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
161 } 160 }
@@ -639,6 +638,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
639 638
640 init_completion(&c->irq_done); 639 init_completion(&c->irq_done);
641 init_completion(&c->dma_done); 640 init_completion(&c->dma_done);
641 c->flags = pdata->flags;
642 c->gpmc_cs = pdata->cs; 642 c->gpmc_cs = pdata->cs;
643 c->gpio_irq = pdata->gpio_irq; 643 c->gpio_irq = pdata->gpio_irq;
644 c->dma_channel = pdata->dma_channel; 644 c->dma_channel = pdata->dma_channel;
@@ -729,7 +729,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
729 this = &c->onenand; 729 this = &c->onenand;
730 if (c->dma_channel >= 0) { 730 if (c->dma_channel >= 0) {
731 this->wait = omap2_onenand_wait; 731 this->wait = omap2_onenand_wait;
732 if (cpu_is_omap34xx()) { 732 if (c->flags & ONENAND_IN_OMAP34XX) {
733 this->read_bufferram = omap3_onenand_read_bufferram; 733 this->read_bufferram = omap3_onenand_read_bufferram;
734 this->write_bufferram = omap3_onenand_write_bufferram; 734 this->write_bufferram = omap3_onenand_write_bufferram;
735 } else { 735 } else {
@@ -803,7 +803,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
803 } 803 }
804 iounmap(c->onenand.base); 804 iounmap(c->onenand.base);
805 release_mem_region(c->phys_base, c->mem_size); 805 release_mem_region(c->phys_base, c->mem_size);
806 gpmc_cs_free(c->gpmc_cs);
807 kfree(c); 806 kfree(c);
808 807
809 return 0; 808 return 0;
diff --git a/drivers/staging/tidspbridge/include/dspbridge/host_os.h b/drivers/staging/tidspbridge/include/dspbridge/host_os.h
index ed00d3da3205..896f1579d5d7 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/host_os.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/host_os.h
@@ -40,7 +40,6 @@
40#include <linux/vmalloc.h> 40#include <linux/vmalloc.h>
41#include <linux/ioport.h> 41#include <linux/ioport.h>
42#include <linux/platform_device.h> 42#include <linux/platform_device.h>
43#include <plat/clock.h>
44#include <linux/clk.h> 43#include <linux/clk.h>
45#include <plat/mailbox.h> 44#include <plat/mailbox.h>
46#include <linux/pagemap.h> 45#include <linux/pagemap.h>
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 2a4749c3eb3f..23afa06b65a4 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -44,7 +44,7 @@
44#include <asm/unaligned.h> 44#include <asm/unaligned.h>
45#include <asm/mach-types.h> 45#include <asm/mach-types.h>
46 46
47#include <plat/dma.h> 47#include <plat-omap/dma-omap.h>
48 48
49#include <mach/usb.h> 49#include <mach/usb.h>
50 50
@@ -61,6 +61,8 @@
61#define DRIVER_DESC "OMAP UDC driver" 61#define DRIVER_DESC "OMAP UDC driver"
62#define DRIVER_VERSION "4 October 2004" 62#define DRIVER_VERSION "4 October 2004"
63 63
64#define OMAP_DMA_USB_W2FC_TX0 29
65
64/* 66/*
65 * The OMAP UDC needs _very_ early endpoint setup: before enabling the 67 * The OMAP UDC needs _very_ early endpoint setup: before enabling the
66 * D+ pullup to allow enumeration. That's too early for the gadget 68 * D+ pullup to allow enumeration. That's too early for the gadget
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c
index 7a62b95dac24..bfca114f7c56 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -16,7 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <plat/dma.h> 19#include <plat-omap/dma-omap.h>
20 20
21#include "musb_core.h" 21#include "musb_core.h"
22#include "tusb6010.h" 22#include "tusb6010.h"
@@ -25,6 +25,13 @@
25 25
26#define MAX_DMAREQ 5 /* REVISIT: Really 6, but req5 not OK */ 26#define MAX_DMAREQ 5 /* REVISIT: Really 6, but req5 not OK */
27 27
28#define OMAP24XX_DMA_EXT_DMAREQ0 2
29#define OMAP24XX_DMA_EXT_DMAREQ1 3
30#define OMAP242X_DMA_EXT_DMAREQ2 14
31#define OMAP242X_DMA_EXT_DMAREQ3 15
32#define OMAP242X_DMA_EXT_DMAREQ4 16
33#define OMAP242X_DMA_EXT_DMAREQ5 64
34
28struct tusb_omap_dma_ch { 35struct tusb_omap_dma_ch {
29 struct musb *musb; 36 struct musb *musb;
30 void __iomem *tbase; 37 void __iomem *tbase;
diff --git a/drivers/video/omap/lcdc.c b/drivers/video/omap/lcdc.c
index 7767338f8b14..c39d6e46f8c5 100644
--- a/drivers/video/omap/lcdc.c
+++ b/drivers/video/omap/lcdc.c
@@ -31,7 +31,7 @@
31#include <linux/gfp.h> 31#include <linux/gfp.h>
32 32
33#include <mach/lcdc.h> 33#include <mach/lcdc.h>
34#include <plat/dma.h> 34#include <plat-omap/dma-omap.h>
35 35
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37 37
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 4351c438b76f..1b5ee8ec192a 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -30,7 +30,7 @@
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/module.h> 31#include <linux/module.h>
32 32
33#include <plat/dma.h> 33#include <plat-omap/dma-omap.h>
34 34
35#include "omapfb.h" 35#include "omapfb.h"
36#include "lcdc.h" 36#include "lcdc.h"
diff --git a/drivers/video/omap/sossi.c b/drivers/video/omap/sossi.c
index f79c137753d7..c510a4457398 100644
--- a/drivers/video/omap/sossi.c
+++ b/drivers/video/omap/sossi.c
@@ -25,7 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27 27
28#include <plat/dma.h> 28#include <plat-omap/dma-omap.h>
29 29
30#include "omapfb.h" 30#include "omapfb.h"
31#include "lcdc.h" 31#include "lcdc.h"
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/include/linux/platform_data/mmc-omap.h
index 8b4e4f2da2f5..2bf6ea82ff94 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -8,27 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef __OMAP2_MMC_H
12#define __OMAP2_MMC_H
13
14#include <linux/types.h>
15#include <linux/device.h>
16#include <linux/mmc/host.h>
17
18#include <plat/omap_hwmod.h>
19
20#define OMAP15XX_NR_MMC 1
21#define OMAP16XX_NR_MMC 2
22#define OMAP1_MMC_SIZE 0x080
23#define OMAP1_MMC1_BASE 0xfffb7800
24#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
25
26#define OMAP24XX_NR_MMC 2
27#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
28#define OMAP2_MMC1_BASE 0x4809c000
29
30#define OMAP4_MMC_REG_OFFSET 0x100
31
32#define OMAP_MMC_MAX_SLOTS 2 11#define OMAP_MMC_MAX_SLOTS 2
33 12
34/* 13/*
@@ -50,6 +29,8 @@
50#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) 29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
51#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1) 30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
52 31
32struct mmc_card;
33
53struct omap_mmc_dev_attr { 34struct omap_mmc_dev_attr {
54 u8 flags; 35 u8 flags;
55}; 36};
@@ -126,6 +107,9 @@ struct omap_mmc_platform_data {
126 /* we can put the features above into this variable */ 107 /* we can put the features above into this variable */
127#define HSMMC_HAS_PBIAS (1 << 0) 108#define HSMMC_HAS_PBIAS (1 << 0)
128#define HSMMC_HAS_UPDATED_RESET (1 << 1) 109#define HSMMC_HAS_UPDATED_RESET (1 << 1)
110#define MMC_OMAP7XX (1 << 2)
111#define MMC_OMAP15XX (1 << 3)
112#define MMC_OMAP16XX (1 << 4)
129 unsigned features; 113 unsigned features;
130 114
131 int switch_pin; /* gpio (card detect) */ 115 int switch_pin; /* gpio (card detect) */
@@ -164,25 +148,3 @@ struct omap_mmc_platform_data {
164 148
165 } slots[OMAP_MMC_MAX_SLOTS]; 149 } slots[OMAP_MMC_MAX_SLOTS];
166}; 150};
167
168/* called from board-specific card detection service routine */
169extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
170 int is_closed);
171
172#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
173void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
174 int nr_controllers);
175void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
176#else
177static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
178 int nr_controllers)
179{
180}
181static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
182{
183}
184#endif
185
186extern int omap_msdi_reset(struct omap_hwmod *oh);
187
188#endif
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 1a68c1e5fe53..24d32ca34bef 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -8,9 +8,13 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <plat/gpmc.h> 11#ifndef _MTD_NAND_OMAP2_H
12#define _MTD_NAND_OMAP2_H
13
12#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
13 15
16#define GPMC_BCH_NUM_REMAINDER 8
17
14enum nand_io { 18enum nand_io {
15 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ 19 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
16 NAND_OMAP_POLLED, /* polled mode, without prefetch */ 20 NAND_OMAP_POLLED, /* polled mode, without prefetch */
@@ -18,10 +22,38 @@ enum nand_io {
18 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ 22 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
19}; 23};
20 24
25enum omap_ecc {
26 /* 1-bit ecc: stored at end of spare area */
27 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
28 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
29 /* 1-bit ecc: stored at beginning of spare area as romcode */
30 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
31 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
32 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
33};
34
35struct gpmc_nand_regs {
36 void __iomem *gpmc_status;
37 void __iomem *gpmc_nand_command;
38 void __iomem *gpmc_nand_address;
39 void __iomem *gpmc_nand_data;
40 void __iomem *gpmc_prefetch_config1;
41 void __iomem *gpmc_prefetch_config2;
42 void __iomem *gpmc_prefetch_control;
43 void __iomem *gpmc_prefetch_status;
44 void __iomem *gpmc_ecc_config;
45 void __iomem *gpmc_ecc_control;
46 void __iomem *gpmc_ecc_size_config;
47 void __iomem *gpmc_ecc1_result;
48 void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
49 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
50 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
51 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
52};
53
21struct omap_nand_platform_data { 54struct omap_nand_platform_data {
22 int cs; 55 int cs;
23 struct mtd_partition *parts; 56 struct mtd_partition *parts;
24 struct gpmc_timings *gpmc_t;
25 int nr_parts; 57 int nr_parts;
26 bool dev_ready; 58 bool dev_ready;
27 enum nand_io xfer_type; 59 enum nand_io xfer_type;
@@ -30,14 +62,4 @@ struct omap_nand_platform_data {
30 struct gpmc_nand_regs reg; 62 struct gpmc_nand_regs reg;
31}; 63};
32 64
33/* minimum size for IO mapping */
34#define NAND_IO_SIZE 4
35
36#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
37extern int gpmc_nand_init(struct omap_nand_platform_data *d);
38#else
39static inline int gpmc_nand_init(struct omap_nand_platform_data *d)
40{
41 return 0;
42}
43#endif 65#endif
diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h
index 2858667d2e4f..685af7e8b120 100644
--- a/include/linux/platform_data/mtd-onenand-omap2.h
+++ b/include/linux/platform_data/mtd-onenand-omap2.h
@@ -9,17 +9,15 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#ifndef __MTD_ONENAND_OMAP2_H
13#define __MTD_ONENAND_OMAP2_H
14
12#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h> 16#include <linux/mtd/partitions.h>
14 17
15#define ONENAND_SYNC_READ (1 << 0) 18#define ONENAND_SYNC_READ (1 << 0)
16#define ONENAND_SYNC_READWRITE (1 << 1) 19#define ONENAND_SYNC_READWRITE (1 << 1)
17 20#define ONENAND_IN_OMAP34XX (1 << 2)
18struct onenand_freq_info {
19 u16 maf_id;
20 u16 dev_id;
21 u16 ver_id;
22};
23 21
24struct omap_onenand_platform_data { 22struct omap_onenand_platform_data {
25 int cs; 23 int cs;
@@ -27,27 +25,9 @@ struct omap_onenand_platform_data {
27 struct mtd_partition *parts; 25 struct mtd_partition *parts;
28 int nr_parts; 26 int nr_parts;
29 int (*onenand_setup)(void __iomem *, int *freq_ptr); 27 int (*onenand_setup)(void __iomem *, int *freq_ptr);
30 int (*get_freq)(const struct onenand_freq_info *freq_info,
31 bool *clk_dep);
32 int dma_channel; 28 int dma_channel;
33 u8 flags; 29 u8 flags;
34 u8 regulator_can_sleep; 30 u8 regulator_can_sleep;
35 u8 skip_initial_unlocking; 31 u8 skip_initial_unlocking;
36}; 32};
37
38#define ONENAND_MAX_PARTITIONS 8
39
40#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
41 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
42
43extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
44
45#else
46
47#define board_onenand_data NULL
48
49static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
50{
51}
52
53#endif 33#endif
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 340874ebf9ae..52977aa30355 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -32,9 +32,14 @@
32#include <sound/dmaengine_pcm.h> 32#include <sound/dmaengine_pcm.h>
33#include <sound/soc.h> 33#include <sound/soc.h>
34 34
35#include <plat/cpu.h>
36#include "omap-pcm.h" 35#include "omap-pcm.h"
37 36
37#ifdef CONFIG_ARCH_OMAP1
38#define pcm_omap1510() cpu_is_omap1510()
39#else
40#define pcm_omap1510() 0
41#endif
42
38static const struct snd_pcm_hardware omap_pcm_hardware = { 43static const struct snd_pcm_hardware omap_pcm_hardware = {
39 .info = SNDRV_PCM_INFO_MMAP | 44 .info = SNDRV_PCM_INFO_MMAP |
40 SNDRV_PCM_INFO_MMAP_VALID | 45 SNDRV_PCM_INFO_MMAP_VALID |
@@ -159,7 +164,7 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream)
159{ 164{
160 snd_pcm_uframes_t offset; 165 snd_pcm_uframes_t offset;
161 166
162 if (cpu_is_omap1510()) 167 if (pcm_omap1510())
163 offset = snd_dmaengine_pcm_pointer_no_residue(substream); 168 offset = snd_dmaengine_pcm_pointer_no_residue(substream);
164 else 169 else
165 offset = snd_dmaengine_pcm_pointer(substream); 170 offset = snd_dmaengine_pcm_pointer(substream);