diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 14:45:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 14:45:16 -0500 |
commit | 8287361abca36504da813638310d2547469283eb (patch) | |
tree | 8d98e9a910885efdb09ae5390a3ae44040557e2f /drivers | |
parent | 2989950cea13711f0cc573c26cde8fe08a36be03 (diff) | |
parent | 8556650dd3370a927217f16444aac5cc0c71e61b (diff) |
Merge tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC Header cleanups from Olof Johansson:
"This is a collection of header file cleanups, mostly for OMAP and
AT91, that keeps moving the platforms in the direction of
multiplatform by removing the need for mach-dependent header files
used in drivers and other places."
Fix up mostly trivial conflicts as per Olof.
* tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (106 commits)
ARM: OMAP2+: Move iommu/iovmm headers to platform_data
ARM: OMAP2+: Make some definitions local
ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c
ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h
ARM: OMAP2+: Move iopgtable header to drivers/iommu/
ARM: OMAP: Merge iommu2.h into iommu.h
atmel: move ATMEL_MAX_UART to platform_data/atmel.h
ARM: OMAP: Remove omap_init_consistent_dma_size()
arm: at91: move at91rm9200 rtc header in drivers/rtc
arm: at91: move reset controller header to arm/arm/mach-at91
arm: at91: move pit define to the driver
arm: at91: move at91_shdwc.h to arch/arm/mach-at91
arm: at91: move board header to arch/arm/mach-at91
arn: at91: move at91_tc.h to arch/arm/mach-at91
arm: at91 move at91_aic.h to arch/arm/mach-at91
arm: at91 move board.h to arch/arm/mach-at91
arm: at91: move platfarm_data to include/linux/platform_data/atmel.h
arm: at91: drop machine defconfig
ARM: OMAP: Remove NEED_MACH_GPIO_H
ARM: OMAP: Remove unnecessary mach and plat includes
...
Diffstat (limited to 'drivers')
70 files changed, 1323 insertions, 213 deletions
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 53d3770a0b1b..2a96bb2c53ee 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -27,9 +27,9 @@ | |||
27 | #include <linux/libata.h> | 27 | #include <linux/libata.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/ata_platform.h> | 29 | #include <linux/ata_platform.h> |
30 | #include <linux/platform_data/atmel.h> | ||
30 | 31 | ||
31 | #include <mach/at91sam9_smc.h> | 32 | #include <mach/at91sam9_smc.h> |
32 | #include <mach/board.h> | ||
33 | #include <asm/gpio.h> | 33 | #include <asm/gpio.h> |
34 | 34 | ||
35 | #define DRV_NAME "pata_at91" | 35 | #define DRV_NAME "pata_at91" |
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..7d35c237fbf1 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -19,8 +19,7 @@ | |||
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> | ||
24 | 23 | ||
25 | struct omap_dmadev { | 24 | struct omap_dmadev { |
26 | struct dma_device ddev; | 25 | struct dma_device ddev; |
@@ -438,7 +437,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic( | |||
438 | omap_disable_dma_irq(c->dma_ch, OMAP_DMA_BLOCK_IRQ); | 437 | omap_disable_dma_irq(c->dma_ch, OMAP_DMA_BLOCK_IRQ); |
439 | } | 438 | } |
440 | 439 | ||
441 | if (!cpu_class_is_omap1()) { | 440 | if (dma_omap2plus()) { |
442 | omap_set_dma_src_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16); | 441 | 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); | 442 | omap_set_dma_dest_burst_mode(c->dma_ch, OMAP_DMA_DATA_BURST_16); |
444 | } | 443 | } |
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 201b2d2ec1b3..ea392ee138ed 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <mach/board.h> | 25 | #include <linux/platform_data/atmel.h> |
26 | #include <mach/cpu.h> | 26 | #include <mach/cpu.h> |
27 | 27 | ||
28 | /* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */ | 28 | /* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */ |
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index 14a4d5fc94fa..f66b816d455c 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_DMAR_TABLE) += dmar.o | |||
7 | obj-$(CONFIG_INTEL_IOMMU) += iova.o intel-iommu.o | 7 | obj-$(CONFIG_INTEL_IOMMU) += iova.o intel-iommu.o |
8 | obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o | 8 | obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o |
9 | obj-$(CONFIG_OMAP_IOMMU) += omap-iommu.o | 9 | obj-$(CONFIG_OMAP_IOMMU) += omap-iommu.o |
10 | obj-$(CONFIG_OMAP_IOMMU) += omap-iommu2.o | ||
10 | obj-$(CONFIG_OMAP_IOVMM) += omap-iovmm.o | 11 | obj-$(CONFIG_OMAP_IOVMM) += omap-iovmm.o |
11 | obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o | 12 | obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o |
12 | obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o | 13 | obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o |
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index f55fc5dfbadc..d97fbe4fb9b1 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -18,11 +18,11 @@ | |||
18 | #include <linux/uaccess.h> | 18 | #include <linux/uaccess.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/debugfs.h> | 20 | #include <linux/debugfs.h> |
21 | #include <linux/omap-iommu.h> | ||
22 | #include <linux/platform_data/iommu-omap.h> | ||
21 | 23 | ||
22 | #include <plat/iommu.h> | 24 | #include "omap-iopgtable.h" |
23 | #include <plat/iovmm.h> | 25 | #include "omap-iommu.h" |
24 | |||
25 | #include <plat/iopgtable.h> | ||
26 | 26 | ||
27 | #define MAXCOLUMN 100 /* for short messages */ | 27 | #define MAXCOLUMN 100 /* for short messages */ |
28 | 28 | ||
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index d0b1234581be..badc17c2bcb4 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c | |||
@@ -19,14 +19,17 @@ | |||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/iommu.h> | 21 | #include <linux/iommu.h> |
22 | #include <linux/omap-iommu.h> | ||
22 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
23 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/io.h> | ||
24 | 26 | ||
25 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
26 | 28 | ||
27 | #include <plat/iommu.h> | 29 | #include <linux/platform_data/iommu-omap.h> |
28 | 30 | ||
29 | #include <plat/iopgtable.h> | 31 | #include "omap-iopgtable.h" |
32 | #include "omap-iommu.h" | ||
30 | 33 | ||
31 | #define for_each_iotlb_cr(obj, n, __i, cr) \ | 34 | #define for_each_iotlb_cr(obj, n, __i, cr) \ |
32 | for (__i = 0; \ | 35 | for (__i = 0; \ |
@@ -51,6 +54,21 @@ struct omap_iommu_domain { | |||
51 | spinlock_t lock; | 54 | spinlock_t lock; |
52 | }; | 55 | }; |
53 | 56 | ||
57 | #define MMU_LOCK_BASE_SHIFT 10 | ||
58 | #define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT) | ||
59 | #define MMU_LOCK_BASE(x) \ | ||
60 | ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT) | ||
61 | |||
62 | #define MMU_LOCK_VICT_SHIFT 4 | ||
63 | #define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT) | ||
64 | #define MMU_LOCK_VICT(x) \ | ||
65 | ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT) | ||
66 | |||
67 | struct iotlb_lock { | ||
68 | short base; | ||
69 | short vict; | ||
70 | }; | ||
71 | |||
54 | /* accommodate the difference between omap1 and omap2/3 */ | 72 | /* accommodate the difference between omap1 and omap2/3 */ |
55 | static const struct iommu_functions *arch_iommu; | 73 | static const struct iommu_functions *arch_iommu; |
56 | 74 | ||
@@ -1015,6 +1033,23 @@ static void iopte_cachep_ctor(void *iopte) | |||
1015 | clean_dcache_area(iopte, IOPTE_TABLE_SIZE); | 1033 | clean_dcache_area(iopte, IOPTE_TABLE_SIZE); |
1016 | } | 1034 | } |
1017 | 1035 | ||
1036 | static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, | ||
1037 | u32 flags) | ||
1038 | { | ||
1039 | memset(e, 0, sizeof(*e)); | ||
1040 | |||
1041 | e->da = da; | ||
1042 | e->pa = pa; | ||
1043 | e->valid = 1; | ||
1044 | /* FIXME: add OMAP1 support */ | ||
1045 | e->pgsz = flags & MMU_CAM_PGSZ_MASK; | ||
1046 | e->endian = flags & MMU_RAM_ENDIAN_MASK; | ||
1047 | e->elsz = flags & MMU_RAM_ELSZ_MASK; | ||
1048 | e->mixed = flags & MMU_RAM_MIXED_MASK; | ||
1049 | |||
1050 | return iopgsz_to_bytes(e->pgsz); | ||
1051 | } | ||
1052 | |||
1018 | static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, | 1053 | static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, |
1019 | phys_addr_t pa, size_t bytes, int prot) | 1054 | phys_addr_t pa, size_t bytes, int prot) |
1020 | { | 1055 | { |
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h new file mode 100644 index 000000000000..2b5f3c04d167 --- /dev/null +++ b/drivers/iommu/omap-iommu.h | |||
@@ -0,0 +1,228 @@ | |||
1 | /* | ||
2 | * omap iommu: main structures | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #if defined(CONFIG_ARCH_OMAP1) | ||
14 | #error "iommu for this processor not implemented yet" | ||
15 | #endif | ||
16 | |||
17 | struct iotlb_entry { | ||
18 | u32 da; | ||
19 | u32 pa; | ||
20 | u32 pgsz, prsvd, valid; | ||
21 | union { | ||
22 | u16 ap; | ||
23 | struct { | ||
24 | u32 endian, elsz, mixed; | ||
25 | }; | ||
26 | }; | ||
27 | }; | ||
28 | |||
29 | struct omap_iommu { | ||
30 | const char *name; | ||
31 | struct module *owner; | ||
32 | struct clk *clk; | ||
33 | void __iomem *regbase; | ||
34 | struct device *dev; | ||
35 | void *isr_priv; | ||
36 | struct iommu_domain *domain; | ||
37 | |||
38 | unsigned int refcount; | ||
39 | spinlock_t iommu_lock; /* global for this whole object */ | ||
40 | |||
41 | /* | ||
42 | * We don't change iopgd for a situation like pgd for a task, | ||
43 | * but share it globally for each iommu. | ||
44 | */ | ||
45 | u32 *iopgd; | ||
46 | spinlock_t page_table_lock; /* protect iopgd */ | ||
47 | |||
48 | int nr_tlb_entries; | ||
49 | |||
50 | struct list_head mmap; | ||
51 | struct mutex mmap_lock; /* protect mmap */ | ||
52 | |||
53 | void *ctx; /* iommu context: registres saved area */ | ||
54 | u32 da_start; | ||
55 | u32 da_end; | ||
56 | }; | ||
57 | |||
58 | struct cr_regs { | ||
59 | union { | ||
60 | struct { | ||
61 | u16 cam_l; | ||
62 | u16 cam_h; | ||
63 | }; | ||
64 | u32 cam; | ||
65 | }; | ||
66 | union { | ||
67 | struct { | ||
68 | u16 ram_l; | ||
69 | u16 ram_h; | ||
70 | }; | ||
71 | u32 ram; | ||
72 | }; | ||
73 | }; | ||
74 | |||
75 | /* architecture specific functions */ | ||
76 | struct iommu_functions { | ||
77 | unsigned long version; | ||
78 | |||
79 | int (*enable)(struct omap_iommu *obj); | ||
80 | void (*disable)(struct omap_iommu *obj); | ||
81 | void (*set_twl)(struct omap_iommu *obj, bool on); | ||
82 | u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra); | ||
83 | |||
84 | void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr); | ||
85 | void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr); | ||
86 | |||
87 | struct cr_regs *(*alloc_cr)(struct omap_iommu *obj, | ||
88 | struct iotlb_entry *e); | ||
89 | int (*cr_valid)(struct cr_regs *cr); | ||
90 | u32 (*cr_to_virt)(struct cr_regs *cr); | ||
91 | void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e); | ||
92 | ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr, | ||
93 | char *buf); | ||
94 | |||
95 | u32 (*get_pte_attr)(struct iotlb_entry *e); | ||
96 | |||
97 | void (*save_ctx)(struct omap_iommu *obj); | ||
98 | void (*restore_ctx)(struct omap_iommu *obj); | ||
99 | ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len); | ||
100 | }; | ||
101 | |||
102 | #ifdef CONFIG_IOMMU_API | ||
103 | /** | ||
104 | * dev_to_omap_iommu() - retrieves an omap iommu object from a user device | ||
105 | * @dev: iommu client device | ||
106 | */ | ||
107 | static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) | ||
108 | { | ||
109 | struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; | ||
110 | |||
111 | return arch_data->iommu_dev; | ||
112 | } | ||
113 | #endif | ||
114 | |||
115 | /* | ||
116 | * MMU Register offsets | ||
117 | */ | ||
118 | #define MMU_REVISION 0x00 | ||
119 | #define MMU_SYSCONFIG 0x10 | ||
120 | #define MMU_SYSSTATUS 0x14 | ||
121 | #define MMU_IRQSTATUS 0x18 | ||
122 | #define MMU_IRQENABLE 0x1c | ||
123 | #define MMU_WALKING_ST 0x40 | ||
124 | #define MMU_CNTL 0x44 | ||
125 | #define MMU_FAULT_AD 0x48 | ||
126 | #define MMU_TTB 0x4c | ||
127 | #define MMU_LOCK 0x50 | ||
128 | #define MMU_LD_TLB 0x54 | ||
129 | #define MMU_CAM 0x58 | ||
130 | #define MMU_RAM 0x5c | ||
131 | #define MMU_GFLUSH 0x60 | ||
132 | #define MMU_FLUSH_ENTRY 0x64 | ||
133 | #define MMU_READ_CAM 0x68 | ||
134 | #define MMU_READ_RAM 0x6c | ||
135 | #define MMU_EMU_FAULT_AD 0x70 | ||
136 | |||
137 | #define MMU_REG_SIZE 256 | ||
138 | |||
139 | /* | ||
140 | * MMU Register bit definitions | ||
141 | */ | ||
142 | #define MMU_CAM_VATAG_SHIFT 12 | ||
143 | #define MMU_CAM_VATAG_MASK \ | ||
144 | ((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT) | ||
145 | #define MMU_CAM_P (1 << 3) | ||
146 | #define MMU_CAM_V (1 << 2) | ||
147 | #define MMU_CAM_PGSZ_MASK 3 | ||
148 | #define MMU_CAM_PGSZ_1M (0 << 0) | ||
149 | #define MMU_CAM_PGSZ_64K (1 << 0) | ||
150 | #define MMU_CAM_PGSZ_4K (2 << 0) | ||
151 | #define MMU_CAM_PGSZ_16M (3 << 0) | ||
152 | |||
153 | #define MMU_RAM_PADDR_SHIFT 12 | ||
154 | #define MMU_RAM_PADDR_MASK \ | ||
155 | ((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT) | ||
156 | |||
157 | #define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT) | ||
158 | #define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT) | ||
159 | |||
160 | #define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT) | ||
161 | #define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) | ||
162 | #define MMU_RAM_ELSZ_16 (1 << MMU_RAM_ELSZ_SHIFT) | ||
163 | #define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT) | ||
164 | #define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT) | ||
165 | #define MMU_RAM_MIXED_SHIFT 6 | ||
166 | #define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT) | ||
167 | #define MMU_RAM_MIXED MMU_RAM_MIXED_MASK | ||
168 | |||
169 | /* | ||
170 | * utilities for super page(16MB, 1MB, 64KB and 4KB) | ||
171 | */ | ||
172 | |||
173 | #define iopgsz_max(bytes) \ | ||
174 | (((bytes) >= SZ_16M) ? SZ_16M : \ | ||
175 | ((bytes) >= SZ_1M) ? SZ_1M : \ | ||
176 | ((bytes) >= SZ_64K) ? SZ_64K : \ | ||
177 | ((bytes) >= SZ_4K) ? SZ_4K : 0) | ||
178 | |||
179 | #define bytes_to_iopgsz(bytes) \ | ||
180 | (((bytes) == SZ_16M) ? MMU_CAM_PGSZ_16M : \ | ||
181 | ((bytes) == SZ_1M) ? MMU_CAM_PGSZ_1M : \ | ||
182 | ((bytes) == SZ_64K) ? MMU_CAM_PGSZ_64K : \ | ||
183 | ((bytes) == SZ_4K) ? MMU_CAM_PGSZ_4K : -1) | ||
184 | |||
185 | #define iopgsz_to_bytes(iopgsz) \ | ||
186 | (((iopgsz) == MMU_CAM_PGSZ_16M) ? SZ_16M : \ | ||
187 | ((iopgsz) == MMU_CAM_PGSZ_1M) ? SZ_1M : \ | ||
188 | ((iopgsz) == MMU_CAM_PGSZ_64K) ? SZ_64K : \ | ||
189 | ((iopgsz) == MMU_CAM_PGSZ_4K) ? SZ_4K : 0) | ||
190 | |||
191 | #define iopgsz_ok(bytes) (bytes_to_iopgsz(bytes) >= 0) | ||
192 | |||
193 | /* | ||
194 | * global functions | ||
195 | */ | ||
196 | extern u32 omap_iommu_arch_version(void); | ||
197 | |||
198 | extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); | ||
199 | |||
200 | extern int | ||
201 | omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); | ||
202 | |||
203 | extern void omap_iommu_save_ctx(struct device *dev); | ||
204 | extern void omap_iommu_restore_ctx(struct device *dev); | ||
205 | |||
206 | extern int omap_foreach_iommu_device(void *data, | ||
207 | int (*fn)(struct device *, void *)); | ||
208 | |||
209 | extern int omap_install_iommu_arch(const struct iommu_functions *ops); | ||
210 | extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); | ||
211 | |||
212 | extern ssize_t | ||
213 | omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); | ||
214 | extern size_t | ||
215 | omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); | ||
216 | |||
217 | /* | ||
218 | * register accessors | ||
219 | */ | ||
220 | static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs) | ||
221 | { | ||
222 | return __raw_readl(obj->regbase + offs); | ||
223 | } | ||
224 | |||
225 | static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs) | ||
226 | { | ||
227 | __raw_writel(val, obj->regbase + offs); | ||
228 | } | ||
diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c new file mode 100644 index 000000000000..c02020292377 --- /dev/null +++ b/drivers/iommu/omap-iommu2.c | |||
@@ -0,0 +1,370 @@ | |||
1 | /* | ||
2 | * omap iommu: omap2/3 architecture specific functions | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, | ||
7 | * Paul Mundt and Toshihiro Kobayashi | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/err.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/jiffies.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/omap-iommu.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/stringify.h> | ||
22 | #include <linux/platform_data/iommu-omap.h> | ||
23 | |||
24 | #include "omap-iommu.h" | ||
25 | |||
26 | /* | ||
27 | * omap2 architecture specific register bit definitions | ||
28 | */ | ||
29 | #define IOMMU_ARCH_VERSION 0x00000011 | ||
30 | |||
31 | /* SYSCONF */ | ||
32 | #define MMU_SYS_IDLE_SHIFT 3 | ||
33 | #define MMU_SYS_IDLE_FORCE (0 << MMU_SYS_IDLE_SHIFT) | ||
34 | #define MMU_SYS_IDLE_NONE (1 << MMU_SYS_IDLE_SHIFT) | ||
35 | #define MMU_SYS_IDLE_SMART (2 << MMU_SYS_IDLE_SHIFT) | ||
36 | #define MMU_SYS_IDLE_MASK (3 << MMU_SYS_IDLE_SHIFT) | ||
37 | |||
38 | #define MMU_SYS_SOFTRESET (1 << 1) | ||
39 | #define MMU_SYS_AUTOIDLE 1 | ||
40 | |||
41 | /* SYSSTATUS */ | ||
42 | #define MMU_SYS_RESETDONE 1 | ||
43 | |||
44 | /* IRQSTATUS & IRQENABLE */ | ||
45 | #define MMU_IRQ_MULTIHITFAULT (1 << 4) | ||
46 | #define MMU_IRQ_TABLEWALKFAULT (1 << 3) | ||
47 | #define MMU_IRQ_EMUMISS (1 << 2) | ||
48 | #define MMU_IRQ_TRANSLATIONFAULT (1 << 1) | ||
49 | #define MMU_IRQ_TLBMISS (1 << 0) | ||
50 | |||
51 | #define __MMU_IRQ_FAULT \ | ||
52 | (MMU_IRQ_MULTIHITFAULT | MMU_IRQ_EMUMISS | MMU_IRQ_TRANSLATIONFAULT) | ||
53 | #define MMU_IRQ_MASK \ | ||
54 | (__MMU_IRQ_FAULT | MMU_IRQ_TABLEWALKFAULT | MMU_IRQ_TLBMISS) | ||
55 | #define MMU_IRQ_TWL_MASK (__MMU_IRQ_FAULT | MMU_IRQ_TABLEWALKFAULT) | ||
56 | #define MMU_IRQ_TLB_MISS_MASK (__MMU_IRQ_FAULT | MMU_IRQ_TLBMISS) | ||
57 | |||
58 | /* MMU_CNTL */ | ||
59 | #define MMU_CNTL_SHIFT 1 | ||
60 | #define MMU_CNTL_MASK (7 << MMU_CNTL_SHIFT) | ||
61 | #define MMU_CNTL_EML_TLB (1 << 3) | ||
62 | #define MMU_CNTL_TWL_EN (1 << 2) | ||
63 | #define MMU_CNTL_MMU_EN (1 << 1) | ||
64 | |||
65 | #define get_cam_va_mask(pgsz) \ | ||
66 | (((pgsz) == MMU_CAM_PGSZ_16M) ? 0xff000000 : \ | ||
67 | ((pgsz) == MMU_CAM_PGSZ_1M) ? 0xfff00000 : \ | ||
68 | ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 : \ | ||
69 | ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) | ||
70 | |||
71 | /* IOMMU errors */ | ||
72 | #define OMAP_IOMMU_ERR_TLB_MISS (1 << 0) | ||
73 | #define OMAP_IOMMU_ERR_TRANS_FAULT (1 << 1) | ||
74 | #define OMAP_IOMMU_ERR_EMU_MISS (1 << 2) | ||
75 | #define OMAP_IOMMU_ERR_TBLWALK_FAULT (1 << 3) | ||
76 | #define OMAP_IOMMU_ERR_MULTIHIT_FAULT (1 << 4) | ||
77 | |||
78 | static void __iommu_set_twl(struct omap_iommu *obj, bool on) | ||
79 | { | ||
80 | u32 l = iommu_read_reg(obj, MMU_CNTL); | ||
81 | |||
82 | if (on) | ||
83 | iommu_write_reg(obj, MMU_IRQ_TWL_MASK, MMU_IRQENABLE); | ||
84 | else | ||
85 | iommu_write_reg(obj, MMU_IRQ_TLB_MISS_MASK, MMU_IRQENABLE); | ||
86 | |||
87 | l &= ~MMU_CNTL_MASK; | ||
88 | if (on) | ||
89 | l |= (MMU_CNTL_MMU_EN | MMU_CNTL_TWL_EN); | ||
90 | else | ||
91 | l |= (MMU_CNTL_MMU_EN); | ||
92 | |||
93 | iommu_write_reg(obj, l, MMU_CNTL); | ||
94 | } | ||
95 | |||
96 | |||
97 | static int omap2_iommu_enable(struct omap_iommu *obj) | ||
98 | { | ||
99 | u32 l, pa; | ||
100 | unsigned long timeout; | ||
101 | |||
102 | if (!obj->iopgd || !IS_ALIGNED((u32)obj->iopgd, SZ_16K)) | ||
103 | return -EINVAL; | ||
104 | |||
105 | pa = virt_to_phys(obj->iopgd); | ||
106 | if (!IS_ALIGNED(pa, SZ_16K)) | ||
107 | return -EINVAL; | ||
108 | |||
109 | iommu_write_reg(obj, MMU_SYS_SOFTRESET, MMU_SYSCONFIG); | ||
110 | |||
111 | timeout = jiffies + msecs_to_jiffies(20); | ||
112 | do { | ||
113 | l = iommu_read_reg(obj, MMU_SYSSTATUS); | ||
114 | if (l & MMU_SYS_RESETDONE) | ||
115 | break; | ||
116 | } while (!time_after(jiffies, timeout)); | ||
117 | |||
118 | if (!(l & MMU_SYS_RESETDONE)) { | ||
119 | dev_err(obj->dev, "can't take mmu out of reset\n"); | ||
120 | return -ENODEV; | ||
121 | } | ||
122 | |||
123 | l = iommu_read_reg(obj, MMU_REVISION); | ||
124 | dev_info(obj->dev, "%s: version %d.%d\n", obj->name, | ||
125 | (l >> 4) & 0xf, l & 0xf); | ||
126 | |||
127 | l = iommu_read_reg(obj, MMU_SYSCONFIG); | ||
128 | l &= ~MMU_SYS_IDLE_MASK; | ||
129 | l |= (MMU_SYS_IDLE_SMART | MMU_SYS_AUTOIDLE); | ||
130 | iommu_write_reg(obj, l, MMU_SYSCONFIG); | ||
131 | |||
132 | iommu_write_reg(obj, pa, MMU_TTB); | ||
133 | |||
134 | __iommu_set_twl(obj, true); | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static void omap2_iommu_disable(struct omap_iommu *obj) | ||
140 | { | ||
141 | u32 l = iommu_read_reg(obj, MMU_CNTL); | ||
142 | |||
143 | l &= ~MMU_CNTL_MASK; | ||
144 | iommu_write_reg(obj, l, MMU_CNTL); | ||
145 | iommu_write_reg(obj, MMU_SYS_IDLE_FORCE, MMU_SYSCONFIG); | ||
146 | |||
147 | dev_dbg(obj->dev, "%s is shutting down\n", obj->name); | ||
148 | } | ||
149 | |||
150 | static void omap2_iommu_set_twl(struct omap_iommu *obj, bool on) | ||
151 | { | ||
152 | __iommu_set_twl(obj, false); | ||
153 | } | ||
154 | |||
155 | static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra) | ||
156 | { | ||
157 | u32 stat, da; | ||
158 | u32 errs = 0; | ||
159 | |||
160 | stat = iommu_read_reg(obj, MMU_IRQSTATUS); | ||
161 | stat &= MMU_IRQ_MASK; | ||
162 | if (!stat) { | ||
163 | *ra = 0; | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | da = iommu_read_reg(obj, MMU_FAULT_AD); | ||
168 | *ra = da; | ||
169 | |||
170 | if (stat & MMU_IRQ_TLBMISS) | ||
171 | errs |= OMAP_IOMMU_ERR_TLB_MISS; | ||
172 | if (stat & MMU_IRQ_TRANSLATIONFAULT) | ||
173 | errs |= OMAP_IOMMU_ERR_TRANS_FAULT; | ||
174 | if (stat & MMU_IRQ_EMUMISS) | ||
175 | errs |= OMAP_IOMMU_ERR_EMU_MISS; | ||
176 | if (stat & MMU_IRQ_TABLEWALKFAULT) | ||
177 | errs |= OMAP_IOMMU_ERR_TBLWALK_FAULT; | ||
178 | if (stat & MMU_IRQ_MULTIHITFAULT) | ||
179 | errs |= OMAP_IOMMU_ERR_MULTIHIT_FAULT; | ||
180 | iommu_write_reg(obj, stat, MMU_IRQSTATUS); | ||
181 | |||
182 | return errs; | ||
183 | } | ||
184 | |||
185 | static void omap2_tlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr) | ||
186 | { | ||
187 | cr->cam = iommu_read_reg(obj, MMU_READ_CAM); | ||
188 | cr->ram = iommu_read_reg(obj, MMU_READ_RAM); | ||
189 | } | ||
190 | |||
191 | static void omap2_tlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr) | ||
192 | { | ||
193 | iommu_write_reg(obj, cr->cam | MMU_CAM_V, MMU_CAM); | ||
194 | iommu_write_reg(obj, cr->ram, MMU_RAM); | ||
195 | } | ||
196 | |||
197 | static u32 omap2_cr_to_virt(struct cr_regs *cr) | ||
198 | { | ||
199 | u32 page_size = cr->cam & MMU_CAM_PGSZ_MASK; | ||
200 | u32 mask = get_cam_va_mask(cr->cam & page_size); | ||
201 | |||
202 | return cr->cam & mask; | ||
203 | } | ||
204 | |||
205 | static struct cr_regs *omap2_alloc_cr(struct omap_iommu *obj, | ||
206 | struct iotlb_entry *e) | ||
207 | { | ||
208 | struct cr_regs *cr; | ||
209 | |||
210 | if (e->da & ~(get_cam_va_mask(e->pgsz))) { | ||
211 | dev_err(obj->dev, "%s:\twrong alignment: %08x\n", __func__, | ||
212 | e->da); | ||
213 | return ERR_PTR(-EINVAL); | ||
214 | } | ||
215 | |||
216 | cr = kmalloc(sizeof(*cr), GFP_KERNEL); | ||
217 | if (!cr) | ||
218 | return ERR_PTR(-ENOMEM); | ||
219 | |||
220 | cr->cam = (e->da & MMU_CAM_VATAG_MASK) | e->prsvd | e->pgsz | e->valid; | ||
221 | cr->ram = e->pa | e->endian | e->elsz | e->mixed; | ||
222 | |||
223 | return cr; | ||
224 | } | ||
225 | |||
226 | static inline int omap2_cr_valid(struct cr_regs *cr) | ||
227 | { | ||
228 | return cr->cam & MMU_CAM_V; | ||
229 | } | ||
230 | |||
231 | static u32 omap2_get_pte_attr(struct iotlb_entry *e) | ||
232 | { | ||
233 | u32 attr; | ||
234 | |||
235 | attr = e->mixed << 5; | ||
236 | attr |= e->endian; | ||
237 | attr |= e->elsz >> 3; | ||
238 | attr <<= (((e->pgsz == MMU_CAM_PGSZ_4K) || | ||
239 | (e->pgsz == MMU_CAM_PGSZ_64K)) ? 0 : 6); | ||
240 | return attr; | ||
241 | } | ||
242 | |||
243 | static ssize_t | ||
244 | omap2_dump_cr(struct omap_iommu *obj, struct cr_regs *cr, char *buf) | ||
245 | { | ||
246 | char *p = buf; | ||
247 | |||
248 | /* FIXME: Need more detail analysis of cam/ram */ | ||
249 | p += sprintf(p, "%08x %08x %01x\n", cr->cam, cr->ram, | ||
250 | (cr->cam & MMU_CAM_P) ? 1 : 0); | ||
251 | |||
252 | return p - buf; | ||
253 | } | ||
254 | |||
255 | #define pr_reg(name) \ | ||
256 | do { \ | ||
257 | ssize_t bytes; \ | ||
258 | const char *str = "%20s: %08x\n"; \ | ||
259 | const int maxcol = 32; \ | ||
260 | bytes = snprintf(p, maxcol, str, __stringify(name), \ | ||
261 | iommu_read_reg(obj, MMU_##name)); \ | ||
262 | p += bytes; \ | ||
263 | len -= bytes; \ | ||
264 | if (len < maxcol) \ | ||
265 | goto out; \ | ||
266 | } while (0) | ||
267 | |||
268 | static ssize_t | ||
269 | omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len) | ||
270 | { | ||
271 | char *p = buf; | ||
272 | |||
273 | pr_reg(REVISION); | ||
274 | pr_reg(SYSCONFIG); | ||
275 | pr_reg(SYSSTATUS); | ||
276 | pr_reg(IRQSTATUS); | ||
277 | pr_reg(IRQENABLE); | ||
278 | pr_reg(WALKING_ST); | ||
279 | pr_reg(CNTL); | ||
280 | pr_reg(FAULT_AD); | ||
281 | pr_reg(TTB); | ||
282 | pr_reg(LOCK); | ||
283 | pr_reg(LD_TLB); | ||
284 | pr_reg(CAM); | ||
285 | pr_reg(RAM); | ||
286 | pr_reg(GFLUSH); | ||
287 | pr_reg(FLUSH_ENTRY); | ||
288 | pr_reg(READ_CAM); | ||
289 | pr_reg(READ_RAM); | ||
290 | pr_reg(EMU_FAULT_AD); | ||
291 | out: | ||
292 | return p - buf; | ||
293 | } | ||
294 | |||
295 | static void omap2_iommu_save_ctx(struct omap_iommu *obj) | ||
296 | { | ||
297 | int i; | ||
298 | u32 *p = obj->ctx; | ||
299 | |||
300 | for (i = 0; i < (MMU_REG_SIZE / sizeof(u32)); i++) { | ||
301 | p[i] = iommu_read_reg(obj, i * sizeof(u32)); | ||
302 | dev_dbg(obj->dev, "%s\t[%02d] %08x\n", __func__, i, p[i]); | ||
303 | } | ||
304 | |||
305 | BUG_ON(p[0] != IOMMU_ARCH_VERSION); | ||
306 | } | ||
307 | |||
308 | static void omap2_iommu_restore_ctx(struct omap_iommu *obj) | ||
309 | { | ||
310 | int i; | ||
311 | u32 *p = obj->ctx; | ||
312 | |||
313 | for (i = 0; i < (MMU_REG_SIZE / sizeof(u32)); i++) { | ||
314 | iommu_write_reg(obj, p[i], i * sizeof(u32)); | ||
315 | dev_dbg(obj->dev, "%s\t[%02d] %08x\n", __func__, i, p[i]); | ||
316 | } | ||
317 | |||
318 | BUG_ON(p[0] != IOMMU_ARCH_VERSION); | ||
319 | } | ||
320 | |||
321 | static void omap2_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) | ||
322 | { | ||
323 | e->da = cr->cam & MMU_CAM_VATAG_MASK; | ||
324 | e->pa = cr->ram & MMU_RAM_PADDR_MASK; | ||
325 | e->valid = cr->cam & MMU_CAM_V; | ||
326 | e->pgsz = cr->cam & MMU_CAM_PGSZ_MASK; | ||
327 | e->endian = cr->ram & MMU_RAM_ENDIAN_MASK; | ||
328 | e->elsz = cr->ram & MMU_RAM_ELSZ_MASK; | ||
329 | e->mixed = cr->ram & MMU_RAM_MIXED; | ||
330 | } | ||
331 | |||
332 | static const struct iommu_functions omap2_iommu_ops = { | ||
333 | .version = IOMMU_ARCH_VERSION, | ||
334 | |||
335 | .enable = omap2_iommu_enable, | ||
336 | .disable = omap2_iommu_disable, | ||
337 | .set_twl = omap2_iommu_set_twl, | ||
338 | .fault_isr = omap2_iommu_fault_isr, | ||
339 | |||
340 | .tlb_read_cr = omap2_tlb_read_cr, | ||
341 | .tlb_load_cr = omap2_tlb_load_cr, | ||
342 | |||
343 | .cr_to_e = omap2_cr_to_e, | ||
344 | .cr_to_virt = omap2_cr_to_virt, | ||
345 | .alloc_cr = omap2_alloc_cr, | ||
346 | .cr_valid = omap2_cr_valid, | ||
347 | .dump_cr = omap2_dump_cr, | ||
348 | |||
349 | .get_pte_attr = omap2_get_pte_attr, | ||
350 | |||
351 | .save_ctx = omap2_iommu_save_ctx, | ||
352 | .restore_ctx = omap2_iommu_restore_ctx, | ||
353 | .dump_ctx = omap2_iommu_dump_ctx, | ||
354 | }; | ||
355 | |||
356 | static int __init omap2_iommu_init(void) | ||
357 | { | ||
358 | return omap_install_iommu_arch(&omap2_iommu_ops); | ||
359 | } | ||
360 | module_init(omap2_iommu_init); | ||
361 | |||
362 | static void __exit omap2_iommu_exit(void) | ||
363 | { | ||
364 | omap_uninstall_iommu_arch(&omap2_iommu_ops); | ||
365 | } | ||
366 | module_exit(omap2_iommu_exit); | ||
367 | |||
368 | MODULE_AUTHOR("Hiroshi DOYU, Paul Mundt and Toshihiro Kobayashi"); | ||
369 | MODULE_DESCRIPTION("omap iommu: omap2/3 architecture specific functions"); | ||
370 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h new file mode 100644 index 000000000000..cd4ae9e5b0c6 --- /dev/null +++ b/drivers/iommu/omap-iopgtable.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * omap iommu: pagetable definitions | ||
3 | * | ||
4 | * Copyright (C) 2008-2010 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * "L2 table" address mask and size definitions. | ||
15 | */ | ||
16 | #define IOPGD_SHIFT 20 | ||
17 | #define IOPGD_SIZE (1UL << IOPGD_SHIFT) | ||
18 | #define IOPGD_MASK (~(IOPGD_SIZE - 1)) | ||
19 | |||
20 | /* | ||
21 | * "section" address mask and size definitions. | ||
22 | */ | ||
23 | #define IOSECTION_SHIFT 20 | ||
24 | #define IOSECTION_SIZE (1UL << IOSECTION_SHIFT) | ||
25 | #define IOSECTION_MASK (~(IOSECTION_SIZE - 1)) | ||
26 | |||
27 | /* | ||
28 | * "supersection" address mask and size definitions. | ||
29 | */ | ||
30 | #define IOSUPER_SHIFT 24 | ||
31 | #define IOSUPER_SIZE (1UL << IOSUPER_SHIFT) | ||
32 | #define IOSUPER_MASK (~(IOSUPER_SIZE - 1)) | ||
33 | |||
34 | #define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT)) | ||
35 | #define IOPGD_TABLE_SIZE (PTRS_PER_IOPGD * sizeof(u32)) | ||
36 | |||
37 | /* | ||
38 | * "small page" address mask and size definitions. | ||
39 | */ | ||
40 | #define IOPTE_SHIFT 12 | ||
41 | #define IOPTE_SIZE (1UL << IOPTE_SHIFT) | ||
42 | #define IOPTE_MASK (~(IOPTE_SIZE - 1)) | ||
43 | |||
44 | /* | ||
45 | * "large page" address mask and size definitions. | ||
46 | */ | ||
47 | #define IOLARGE_SHIFT 16 | ||
48 | #define IOLARGE_SIZE (1UL << IOLARGE_SHIFT) | ||
49 | #define IOLARGE_MASK (~(IOLARGE_SIZE - 1)) | ||
50 | |||
51 | #define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT)) | ||
52 | #define IOPTE_TABLE_SIZE (PTRS_PER_IOPTE * sizeof(u32)) | ||
53 | |||
54 | #define IOPAGE_MASK IOPTE_MASK | ||
55 | |||
56 | /** | ||
57 | * omap_iommu_translate() - va to pa translation | ||
58 | * @d: omap iommu descriptor | ||
59 | * @va: virtual address | ||
60 | * @mask: omap iommu descriptor mask | ||
61 | * | ||
62 | * va to pa translation | ||
63 | */ | ||
64 | static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask) | ||
65 | { | ||
66 | return (d & mask) | (va & (~mask)); | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * some descriptor attributes. | ||
71 | */ | ||
72 | #define IOPGD_TABLE (1 << 0) | ||
73 | #define IOPGD_SECTION (2 << 0) | ||
74 | #define IOPGD_SUPER (1 << 18 | 2 << 0) | ||
75 | |||
76 | #define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE) | ||
77 | #define iopgd_is_section(x) (((x) & (1 << 18 | 3)) == IOPGD_SECTION) | ||
78 | #define iopgd_is_super(x) (((x) & (1 << 18 | 3)) == IOPGD_SUPER) | ||
79 | |||
80 | #define IOPTE_SMALL (2 << 0) | ||
81 | #define IOPTE_LARGE (1 << 0) | ||
82 | |||
83 | #define iopte_is_small(x) (((x) & 2) == IOPTE_SMALL) | ||
84 | #define iopte_is_large(x) (((x) & 3) == IOPTE_LARGE) | ||
85 | |||
86 | /* to find an entry in a page-table-directory */ | ||
87 | #define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1)) | ||
88 | #define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da)) | ||
89 | |||
90 | #define iopgd_page_paddr(iopgd) (*iopgd & ~((1 << 10) - 1)) | ||
91 | #define iopgd_page_vaddr(iopgd) ((u32 *)phys_to_virt(iopgd_page_paddr(iopgd))) | ||
92 | |||
93 | /* to find an entry in the second-level page table. */ | ||
94 | #define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1)) | ||
95 | #define iopte_offset(iopgd, da) (iopgd_page_vaddr(iopgd) + iopte_index(da)) | ||
96 | |||
97 | #define to_iommu(dev) \ | ||
98 | (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)) | ||
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 2e10c3e0a7ae..46d875690739 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c | |||
@@ -17,14 +17,58 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
19 | #include <linux/iommu.h> | 19 | #include <linux/iommu.h> |
20 | #include <linux/omap-iommu.h> | ||
21 | #include <linux/platform_data/iommu-omap.h> | ||
20 | 22 | ||
21 | #include <asm/cacheflush.h> | 23 | #include <asm/cacheflush.h> |
22 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
23 | 25 | ||
24 | #include <plat/iommu.h> | 26 | #include "omap-iopgtable.h" |
25 | #include <plat/iovmm.h> | 27 | #include "omap-iommu.h" |
26 | 28 | ||
27 | #include <plat/iopgtable.h> | 29 | /* |
30 | * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma) | ||
31 | * | ||
32 | * lower 16 bit is used for h/w and upper 16 bit is for s/w. | ||
33 | */ | ||
34 | #define IOVMF_SW_SHIFT 16 | ||
35 | |||
36 | /* | ||
37 | * iovma: h/w flags derived from cam and ram attribute | ||
38 | */ | ||
39 | #define IOVMF_CAM_MASK (~((1 << 10) - 1)) | ||
40 | #define IOVMF_RAM_MASK (~IOVMF_CAM_MASK) | ||
41 | |||
42 | #define IOVMF_PGSZ_MASK (3 << 0) | ||
43 | #define IOVMF_PGSZ_1M MMU_CAM_PGSZ_1M | ||
44 | #define IOVMF_PGSZ_64K MMU_CAM_PGSZ_64K | ||
45 | #define IOVMF_PGSZ_4K MMU_CAM_PGSZ_4K | ||
46 | #define IOVMF_PGSZ_16M MMU_CAM_PGSZ_16M | ||
47 | |||
48 | #define IOVMF_ENDIAN_MASK (1 << 9) | ||
49 | #define IOVMF_ENDIAN_BIG MMU_RAM_ENDIAN_BIG | ||
50 | |||
51 | #define IOVMF_ELSZ_MASK (3 << 7) | ||
52 | #define IOVMF_ELSZ_16 MMU_RAM_ELSZ_16 | ||
53 | #define IOVMF_ELSZ_32 MMU_RAM_ELSZ_32 | ||
54 | #define IOVMF_ELSZ_NONE MMU_RAM_ELSZ_NONE | ||
55 | |||
56 | #define IOVMF_MIXED_MASK (1 << 6) | ||
57 | #define IOVMF_MIXED MMU_RAM_MIXED | ||
58 | |||
59 | /* | ||
60 | * iovma: s/w flags, used for mapping and umapping internally. | ||
61 | */ | ||
62 | #define IOVMF_MMIO (1 << IOVMF_SW_SHIFT) | ||
63 | #define IOVMF_ALLOC (2 << IOVMF_SW_SHIFT) | ||
64 | #define IOVMF_ALLOC_MASK (3 << IOVMF_SW_SHIFT) | ||
65 | |||
66 | /* "superpages" is supported just with physically linear pages */ | ||
67 | #define IOVMF_DISCONT (1 << (2 + IOVMF_SW_SHIFT)) | ||
68 | #define IOVMF_LINEAR (2 << (2 + IOVMF_SW_SHIFT)) | ||
69 | #define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT)) | ||
70 | |||
71 | #define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT)) | ||
28 | 72 | ||
29 | static struct kmem_cache *iovm_area_cachep; | 73 | static struct kmem_cache *iovm_area_cachep; |
30 | 74 | ||
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index a3b1a34c896d..4b1becc86e54 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c | |||
@@ -45,8 +45,8 @@ | |||
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 <plat/vrfb.h> | 49 | #include <video/omapvrfb.h> |
50 | #include <video/omapdss.h> | 50 | #include <video/omapdss.h> |
51 | 51 | ||
52 | #include "omap_voutlib.h" | 52 | #include "omap_voutlib.h" |
diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c index 4be26abf6cea..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 <plat/vrfb.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/omap/omap_voutdef.h b/drivers/media/platform/omap/omap_voutdef.h index 27a95d23b913..9ccfe1f475a4 100644 --- a/drivers/media/platform/omap/omap_voutdef.h +++ b/drivers/media/platform/omap/omap_voutdef.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #define OMAP_VOUTDEF_H | 12 | #define OMAP_VOUTDEF_H |
13 | 13 | ||
14 | #include <video/omapdss.h> | 14 | #include <video/omapdss.h> |
15 | #include <plat/vrfb.h> | 15 | #include <video/omapvrfb.h> |
16 | 16 | ||
17 | #define YUYV_BPP 2 | 17 | #define YUYV_BPP 2 |
18 | #define RGB565_BPP 2 | 18 | #define RGB565_BPP 2 |
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 99640d8c1db0..7f182f0ff3da 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/i2c.h> | 61 | #include <linux/i2c.h> |
62 | #include <linux/interrupt.h> | 62 | #include <linux/interrupt.h> |
63 | #include <linux/module.h> | 63 | #include <linux/module.h> |
64 | #include <linux/omap-iommu.h> | ||
64 | #include <linux/platform_device.h> | 65 | #include <linux/platform_device.h> |
65 | #include <linux/regulator/consumer.h> | 66 | #include <linux/regulator/consumer.h> |
66 | #include <linux/slab.h> | 67 | #include <linux/slab.h> |
diff --git a/drivers/media/platform/omap3isp/isp.h b/drivers/media/platform/omap3isp/isp.h index 8be7487c326f..8d6866942b85 100644 --- a/drivers/media/platform/omap3isp/isp.h +++ b/drivers/media/platform/omap3isp/isp.h | |||
@@ -31,11 +31,9 @@ | |||
31 | #include <media/v4l2-device.h> | 31 | #include <media/v4l2-device.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/iommu.h> | ||
34 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
35 | #include <linux/wait.h> | 36 | #include <linux/wait.h> |
36 | #include <linux/iommu.h> | ||
37 | #include <plat/iommu.h> | ||
38 | #include <plat/iovmm.h> | ||
39 | 37 | ||
40 | #include "ispstat.h" | 38 | #include "ispstat.h" |
41 | #include "ispccdc.h" | 39 | #include "ispccdc.h" |
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c index aa9df9d71a7b..60e60aa64fb4 100644 --- a/drivers/media/platform/omap3isp/ispccdc.c +++ b/drivers/media/platform/omap3isp/ispccdc.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
32 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
33 | #include <linux/omap-iommu.h> | ||
33 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
34 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
35 | #include <media/v4l2-event.h> | 36 | #include <media/v4l2-event.h> |
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.c b/drivers/media/platform/omap3isp/ispstat.c index b8640be692f1..e7939869bda7 100644 --- a/drivers/media/platform/omap3isp/ispstat.c +++ b/drivers/media/platform/omap3isp/ispstat.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
29 | #include <linux/omap-iommu.h> | ||
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
30 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
31 | 32 | ||
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h index 9b7c8654dc8a..99cf10449cf5 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/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index 75cd309035f9..3311d6bb3456 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/omap-iommu.h> | ||
30 | #include <linux/pagemap.h> | 31 | #include <linux/pagemap.h> |
31 | #include <linux/scatterlist.h> | 32 | #include <linux/scatterlist.h> |
32 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c index 13636a585106..d3cfe65c0494 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/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c index 546199e9ccc7..82e6c1e282d5 100644 --- a/drivers/media/rc/ir-rx51.c +++ b/drivers/media/rc/ir-rx51.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include <plat/dmtimer.h> | 29 | #include <plat/dmtimer.h> |
30 | #include <plat/clock.h> | 30 | #include <plat/clock.h> |
31 | #include <plat/omap-pm.h> | ||
32 | 31 | ||
33 | #include <media/lirc.h> | 32 | #include <media/lirc.h> |
34 | #include <media/lirc_dev.h> | 33 | #include <media/lirc_dev.h> |
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c index 55d589981412..998ce8cb3065 100644 --- a/drivers/mfd/menelaus.c +++ b/drivers/mfd/menelaus.c | |||
@@ -41,11 +41,11 @@ | |||
41 | #include <linux/rtc.h> | 41 | #include <linux/rtc.h> |
42 | #include <linux/bcd.h> | 42 | #include <linux/bcd.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/mfd/menelaus.h> | ||
44 | 45 | ||
45 | #include <asm/mach/irq.h> | 46 | #include <asm/mach/irq.h> |
46 | 47 | ||
47 | #include <asm/gpio.h> | 48 | #include <asm/gpio.h> |
48 | #include <plat/menelaus.h> | ||
49 | 49 | ||
50 | #define DRIVER_NAME "menelaus" | 50 | #define DRIVER_NAME "menelaus" |
51 | 51 | ||
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 29b8ed21213e..770a0d01e0b9 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -26,9 +26,12 @@ | |||
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <plat/cpu.h> | 28 | #include <plat/cpu.h> |
29 | #include <plat/usb.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/platform_data/usb-omap.h> | ||
30 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> |
31 | 32 | ||
33 | #include "omap-usb.h" | ||
34 | |||
32 | #define USBHS_DRIVER_NAME "usbhs_omap" | 35 | #define USBHS_DRIVER_NAME "usbhs_omap" |
33 | #define OMAP_EHCI_DEVICE "ehci-omap" | 36 | #define OMAP_EHCI_DEVICE "ehci-omap" |
34 | #define OMAP_OHCI_DEVICE "ohci-omap3" | 37 | #define OMAP_OHCI_DEVICE "ohci-omap3" |
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c index 401b976e3aff..eb869153206d 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <plat/usb.h> | ||
29 | #include <linux/pm_runtime.h> | 28 | #include <linux/pm_runtime.h> |
29 | #include <linux/platform_data/usb-omap.h> | ||
30 | 30 | ||
31 | #define USBTLL_DRIVER_NAME "usbhs_tll" | 31 | #define USBTLL_DRIVER_NAME "usbhs_tll" |
32 | 32 | ||
diff --git a/drivers/mfd/omap-usb.h b/drivers/mfd/omap-usb.h new file mode 100644 index 000000000000..972aa961b064 --- /dev/null +++ b/drivers/mfd/omap-usb.h | |||
@@ -0,0 +1,2 @@ | |||
1 | extern int omap_tll_enable(void); | ||
2 | extern int omap_tll_disable(void); | ||
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 5248ba4369a3..722af1de7967 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/stat.h> | 29 | #include <linux/stat.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/platform_data/atmel.h> | ||
31 | 32 | ||
32 | #include <linux/mmc/host.h> | 33 | #include <linux/mmc/host.h> |
33 | #include <linux/mmc/sdio.h> | 34 | #include <linux/mmc/sdio.h> |
@@ -40,7 +41,6 @@ | |||
40 | #include <asm/unaligned.h> | 41 | #include <asm/unaligned.h> |
41 | 42 | ||
42 | #include <mach/cpu.h> | 43 | #include <mach/cpu.h> |
43 | #include <mach/board.h> | ||
44 | 44 | ||
45 | #include "atmel-mci-regs.h" | 45 | #include "atmel-mci-regs.h" |
46 | 46 | ||
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 4e749ab690c8..4254975f931d 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 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 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 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 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 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 e1f3c1135f93..bc5807873b2c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -39,9 +39,7 @@ | |||
39 | #include <linux/regulator/consumer.h> | 39 | #include <linux/regulator/consumer.h> |
40 | #include <linux/pinctrl/consumer.h> | 40 | #include <linux/pinctrl/consumer.h> |
41 | #include <linux/pm_runtime.h> | 41 | #include <linux/pm_runtime.h> |
42 | #include <mach/hardware.h> | 42 | #include <linux/platform_data/mmc-omap.h> |
43 | #include <plat/mmc.h> | ||
44 | #include <plat/cpu.h> | ||
45 | 43 | ||
46 | /* OMAP HSMMC Host Controller Registers */ | 44 | /* OMAP HSMMC Host Controller Registers */ |
47 | #define OMAP_HSMMC_SYSSTATUS 0x0014 | 45 | #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 */ |
115 | static struct nand_ecclayout omap_oobinfo; | 122 | static 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) | |||
1029 | static void omap3_enable_hwecc_bch(struct mtd_info *mtd, int mode) | 1036 | static 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 | */ |
1126 | static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt) | 1216 | static 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..99f96e19ebea 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 | ||
68 | static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data) | 67 | static 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 | } |
@@ -446,13 +445,19 @@ out_copy: | |||
446 | 445 | ||
447 | #else | 446 | #else |
448 | 447 | ||
449 | int omap3_onenand_read_bufferram(struct mtd_info *mtd, int area, | 448 | static int omap3_onenand_read_bufferram(struct mtd_info *mtd, int area, |
450 | unsigned char *buffer, int offset, | 449 | unsigned char *buffer, int offset, |
451 | size_t count); | 450 | size_t count) |
451 | { | ||
452 | return -ENOSYS; | ||
453 | } | ||
452 | 454 | ||
453 | int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area, | 455 | static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area, |
454 | const unsigned char *buffer, | 456 | const unsigned char *buffer, |
455 | int offset, size_t count); | 457 | int offset, size_t count) |
458 | { | ||
459 | return -ENOSYS; | ||
460 | } | ||
456 | 461 | ||
457 | #endif | 462 | #endif |
458 | 463 | ||
@@ -550,13 +555,19 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area, | |||
550 | 555 | ||
551 | #else | 556 | #else |
552 | 557 | ||
553 | int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area, | 558 | static int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area, |
554 | unsigned char *buffer, int offset, | 559 | unsigned char *buffer, int offset, |
555 | size_t count); | 560 | size_t count) |
561 | { | ||
562 | return -ENOSYS; | ||
563 | } | ||
556 | 564 | ||
557 | int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area, | 565 | static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area, |
558 | const unsigned char *buffer, | 566 | const unsigned char *buffer, |
559 | int offset, size_t count); | 567 | int offset, size_t count) |
568 | { | ||
569 | return -ENOSYS; | ||
570 | } | ||
560 | 571 | ||
561 | #endif | 572 | #endif |
562 | 573 | ||
@@ -639,6 +650,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev) | |||
639 | 650 | ||
640 | init_completion(&c->irq_done); | 651 | init_completion(&c->irq_done); |
641 | init_completion(&c->dma_done); | 652 | init_completion(&c->dma_done); |
653 | c->flags = pdata->flags; | ||
642 | c->gpmc_cs = pdata->cs; | 654 | c->gpmc_cs = pdata->cs; |
643 | c->gpio_irq = pdata->gpio_irq; | 655 | c->gpio_irq = pdata->gpio_irq; |
644 | c->dma_channel = pdata->dma_channel; | 656 | c->dma_channel = pdata->dma_channel; |
@@ -729,7 +741,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev) | |||
729 | this = &c->onenand; | 741 | this = &c->onenand; |
730 | if (c->dma_channel >= 0) { | 742 | if (c->dma_channel >= 0) { |
731 | this->wait = omap2_onenand_wait; | 743 | this->wait = omap2_onenand_wait; |
732 | if (cpu_is_omap34xx()) { | 744 | if (c->flags & ONENAND_IN_OMAP34XX) { |
733 | this->read_bufferram = omap3_onenand_read_bufferram; | 745 | this->read_bufferram = omap3_onenand_read_bufferram; |
734 | this->write_bufferram = omap3_onenand_write_bufferram; | 746 | this->write_bufferram = omap3_onenand_write_bufferram; |
735 | } else { | 747 | } else { |
@@ -803,7 +815,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev) | |||
803 | } | 815 | } |
804 | iounmap(c->onenand.base); | 816 | iounmap(c->onenand.base); |
805 | release_mem_region(c->phys_base, c->mem_size); | 817 | release_mem_region(c->phys_base, c->mem_size); |
806 | gpmc_cs_free(c->gpmc_cs); | ||
807 | kfree(c); | 818 | kfree(c); |
808 | 819 | ||
809 | return 0; | 820 | return 0; |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index fcff73a73b1d..994b6acd65f4 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -33,12 +33,11 @@ | |||
33 | #include <linux/spinlock.h> | 33 | #include <linux/spinlock.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/types.h> | 35 | #include <linux/types.h> |
36 | #include <linux/platform_data/atmel.h> | ||
36 | 37 | ||
37 | #include <linux/can/dev.h> | 38 | #include <linux/can/dev.h> |
38 | #include <linux/can/error.h> | 39 | #include <linux/can/error.h> |
39 | 40 | ||
40 | #include <mach/board.h> | ||
41 | |||
42 | #define AT91_MB_MASK(i) ((1 << (i)) - 1) | 41 | #define AT91_MB_MASK(i) ((1 << (i)) - 1) |
43 | 42 | ||
44 | /* Common registers */ | 43 | /* Common registers */ |
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 4e980a7886fb..35fc6edbacf8 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/phy.h> | 33 | #include <linux/phy.h> |
34 | #include <linux/platform_data/atmel.h> | ||
34 | 35 | ||
35 | #include <asm/io.h> | 36 | #include <asm/io.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -38,7 +39,6 @@ | |||
38 | 39 | ||
39 | #include <mach/at91rm9200_emac.h> | 40 | #include <mach/at91rm9200_emac.h> |
40 | #include <asm/gpio.h> | 41 | #include <asm/gpio.h> |
41 | #include <mach/board.h> | ||
42 | 42 | ||
43 | #include "at91_ether.h" | 43 | #include "at91_ether.h" |
44 | 44 | ||
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 9694c1e783a5..01463c781847 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/platform_data/atmel.h> | ||
20 | 21 | ||
21 | #include <pcmcia/ss.h> | 22 | #include <pcmcia/ss.h> |
22 | 23 | ||
@@ -24,7 +25,6 @@ | |||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/sizes.h> | 26 | #include <asm/sizes.h> |
26 | 27 | ||
27 | #include <mach/board.h> | ||
28 | #include <mach/at91rm9200_mc.h> | 28 | #include <mach/at91rm9200_mc.h> |
29 | #include <mach/at91_ramc.h> | 29 | #include <mach/at91_ramc.h> |
30 | 30 | ||
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index fa74efe82206..25c4b1993b3d 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <asm/sizes.h> | 25 | #include <asm/sizes.h> |
26 | 26 | ||
27 | #include <mach/mux.h> | 27 | #include <mach/mux.h> |
28 | #include <plat/tc.h> | 28 | #include <mach/tc.h> |
29 | 29 | ||
30 | 30 | ||
31 | /* NOTE: don't expect this to support many I/O cards. The 16xx chips have | 31 | /* NOTE: don't expect this to support many I/O cards. The 16xx chips have |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index fca9790c7de7..b6469e2cae89 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | 33 | ||
34 | #include <mach/at91_rtc.h> | 34 | #include "rtc-at91rm9200.h" |
35 | 35 | ||
36 | #define at91_rtc_read(field) \ | 36 | #define at91_rtc_read(field) \ |
37 | __raw_readl(at91_rtc_regs + field) | 37 | __raw_readl(at91_rtc_regs + field) |
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h new file mode 100644 index 000000000000..da1945e5f714 --- /dev/null +++ b/drivers/rtc/rtc-at91rm9200.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/include/mach/at91_rtc.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Ivan Kokshaysky | ||
5 | * Copyright (C) SAN People | ||
6 | * | ||
7 | * Real Time Clock (RTC) - System peripheral registers. | ||
8 | * Based on AT91RM9200 datasheet revision E. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef AT91_RTC_H | ||
17 | #define AT91_RTC_H | ||
18 | |||
19 | #define AT91_RTC_CR 0x00 /* Control Register */ | ||
20 | #define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */ | ||
21 | #define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ | ||
22 | #define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ | ||
23 | #define AT91_RTC_TIMEVSEL_MINUTE (0 << 8) | ||
24 | #define AT91_RTC_TIMEVSEL_HOUR (1 << 8) | ||
25 | #define AT91_RTC_TIMEVSEL_DAY24 (2 << 8) | ||
26 | #define AT91_RTC_TIMEVSEL_DAY12 (3 << 8) | ||
27 | #define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */ | ||
28 | #define AT91_RTC_CALEVSEL_WEEK (0 << 16) | ||
29 | #define AT91_RTC_CALEVSEL_MONTH (1 << 16) | ||
30 | #define AT91_RTC_CALEVSEL_YEAR (2 << 16) | ||
31 | |||
32 | #define AT91_RTC_MR 0x04 /* Mode Register */ | ||
33 | #define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ | ||
34 | |||
35 | #define AT91_RTC_TIMR 0x08 /* Time Register */ | ||
36 | #define AT91_RTC_SEC (0x7f << 0) /* Current Second */ | ||
37 | #define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ | ||
38 | #define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ | ||
39 | #define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ | ||
40 | |||
41 | #define AT91_RTC_CALR 0x0c /* Calendar Register */ | ||
42 | #define AT91_RTC_CENT (0x7f << 0) /* Current Century */ | ||
43 | #define AT91_RTC_YEAR (0xff << 8) /* Current Year */ | ||
44 | #define AT91_RTC_MONTH (0x1f << 16) /* Current Month */ | ||
45 | #define AT91_RTC_DAY (7 << 21) /* Current Day */ | ||
46 | #define AT91_RTC_DATE (0x3f << 24) /* Current Date */ | ||
47 | |||
48 | #define AT91_RTC_TIMALR 0x10 /* Time Alarm Register */ | ||
49 | #define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */ | ||
50 | #define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */ | ||
51 | #define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */ | ||
52 | |||
53 | #define AT91_RTC_CALALR 0x14 /* Calendar Alarm Register */ | ||
54 | #define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */ | ||
55 | #define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */ | ||
56 | |||
57 | #define AT91_RTC_SR 0x18 /* Status Register */ | ||
58 | #define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */ | ||
59 | #define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */ | ||
60 | #define AT91_RTC_SECEV (1 << 2) /* Second Event */ | ||
61 | #define AT91_RTC_TIMEV (1 << 3) /* Time Event */ | ||
62 | #define AT91_RTC_CALEV (1 << 4) /* Calendar Event */ | ||
63 | |||
64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ | ||
65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ | ||
66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ | ||
67 | #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ | ||
68 | |||
69 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ | ||
70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ | ||
71 | #define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */ | ||
72 | #define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */ | ||
73 | #define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */ | ||
74 | |||
75 | #endif | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 2dfe7a2fb998..e981798e9a9b 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -19,8 +19,8 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/ioctl.h> | 20 | #include <linux/ioctl.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/platform_data/atmel.h> | ||
22 | 23 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/at91_rtt.h> | 24 | #include <mach/at91_rtt.h> |
25 | #include <mach/cpu.h> | 25 | #include <mach/cpu.h> |
26 | 26 | ||
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 16d6a839c7fa..61fb0ec26f06 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -19,9 +19,9 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/platform_data/atmel.h> | ||
22 | 23 | ||
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
24 | #include <mach/board.h> | ||
25 | #include <asm/gpio.h> | 25 | #include <asm/gpio.h> |
26 | #include <mach/cpu.h> | 26 | #include <mach/cpu.h> |
27 | 27 | ||
diff --git a/drivers/staging/tidspbridge/include/dspbridge/host_os.h b/drivers/staging/tidspbridge/include/dspbridge/host_os.h index 5e2f4d82d925..7f3a1db31619 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/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 1a8a2713dd95..922e85aeb63a 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -40,12 +40,11 @@ | |||
40 | #include <linux/atmel_serial.h> | 40 | #include <linux/atmel_serial.h> |
41 | #include <linux/uaccess.h> | 41 | #include <linux/uaccess.h> |
42 | #include <linux/pinctrl/consumer.h> | 42 | #include <linux/pinctrl/consumer.h> |
43 | #include <linux/platform_data/atmel.h> | ||
43 | 44 | ||
44 | #include <asm/io.h> | 45 | #include <asm/io.h> |
45 | #include <asm/ioctls.h> | 46 | #include <asm/ioctls.h> |
46 | 47 | ||
47 | #include <mach/board.h> | ||
48 | |||
49 | #ifdef CONFIG_ARM | 48 | #ifdef CONFIG_ARM |
50 | #include <mach/cpu.h> | 49 | #include <mach/cpu.h> |
51 | #include <asm/gpio.h> | 50 | #include <asm/gpio.h> |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index e6135faabc3a..59dcea2f6957 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/usb/gadget.h> | 31 | #include <linux/usb/gadget.h> |
32 | #include <linux/of.h> | 32 | #include <linux/of.h> |
33 | #include <linux/of_gpio.h> | 33 | #include <linux/of_gpio.h> |
34 | #include <linux/platform_data/atmel.h> | ||
34 | 35 | ||
35 | #include <asm/byteorder.h> | 36 | #include <asm/byteorder.h> |
36 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
@@ -38,7 +39,6 @@ | |||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/gpio.h> | 40 | #include <asm/gpio.h> |
40 | 41 | ||
41 | #include <mach/board.h> | ||
42 | #include <mach/cpu.h> | 42 | #include <mach/cpu.h> |
43 | #include <mach/at91sam9261_matrix.h> | 43 | #include <mach/at91sam9261_matrix.h> |
44 | #include <mach/at91_matrix.h> | 44 | #include <mach/at91_matrix.h> |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 9a9bced813ed..a7aed84d98c9 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -21,9 +21,9 @@ | |||
21 | #include <linux/usb/gadget.h> | 21 | #include <linux/usb/gadget.h> |
22 | #include <linux/usb/atmel_usba_udc.h> | 22 | #include <linux/usb/atmel_usba_udc.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/platform_data/atmel.h> | ||
24 | 25 | ||
25 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
26 | #include <mach/board.h> | ||
27 | 27 | ||
28 | #include "atmel_usba_udc.h" | 28 | #include "atmel_usba_udc.h" |
29 | 29 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 9412bf53b864..09699f6e87f8 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/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 44e7d0f638e8..ac17a7c3a0cd 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -39,12 +39,13 @@ | |||
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/usb/ulpi.h> | 41 | #include <linux/usb/ulpi.h> |
42 | #include <plat/usb.h> | ||
43 | #include <linux/regulator/consumer.h> | 42 | #include <linux/regulator/consumer.h> |
44 | #include <linux/pm_runtime.h> | 43 | #include <linux/pm_runtime.h> |
45 | #include <linux/gpio.h> | 44 | #include <linux/gpio.h> |
46 | #include <linux/clk.h> | 45 | #include <linux/clk.h> |
47 | 46 | ||
47 | #include <linux/platform_data/usb-omap.h> | ||
48 | |||
48 | /* EHCI Register Set */ | 49 | /* EHCI Register Set */ |
49 | #define EHCI_INSNREG04 (0xA0) | 50 | #define EHCI_INSNREG04 (0xA0) |
50 | #define EHCI_INSNREG04_DISABLE_UNSUSPEND (1 << 5) | 51 | #define EHCI_INSNREG04_DISABLE_UNSUSPEND (1 << 5) |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 221850a8c25f..a0cb44f0e724 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -16,11 +16,11 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
18 | #include <linux/of_gpio.h> | 18 | #include <linux/of_gpio.h> |
19 | #include <linux/platform_data/atmel.h> | ||
19 | 20 | ||
20 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
21 | #include <asm/gpio.h> | 22 | #include <asm/gpio.h> |
22 | 23 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/cpu.h> | 24 | #include <mach/cpu.h> |
25 | 25 | ||
26 | #ifndef CONFIG_ARCH_AT91 | 26 | #ifndef CONFIG_ARCH_AT91 |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 733c77c36355..b1d32fb4a7ae 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
26 | 26 | ||
27 | #include <mach/mux.h> | 27 | #include <mach/mux.h> |
28 | #include <plat/fpga.h> | ||
29 | 28 | ||
30 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
31 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
@@ -93,14 +92,14 @@ static int omap_ohci_transceiver_power(int on) | |||
93 | { | 92 | { |
94 | if (on) { | 93 | if (on) { |
95 | if (machine_is_omap_innovator() && cpu_is_omap1510()) | 94 | if (machine_is_omap_innovator() && cpu_is_omap1510()) |
96 | fpga_write(fpga_read(INNOVATOR_FPGA_CAM_USB_CONTROL) | 95 | __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL) |
97 | | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), | 96 | | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), |
98 | INNOVATOR_FPGA_CAM_USB_CONTROL); | 97 | INNOVATOR_FPGA_CAM_USB_CONTROL); |
99 | else if (machine_is_omap_osk()) | 98 | else if (machine_is_omap_osk()) |
100 | tps65010_set_gpio_out_value(GPIO1, LOW); | 99 | tps65010_set_gpio_out_value(GPIO1, LOW); |
101 | } else { | 100 | } else { |
102 | if (machine_is_omap_innovator() && cpu_is_omap1510()) | 101 | if (machine_is_omap_innovator() && cpu_is_omap1510()) |
103 | fpga_write(fpga_read(INNOVATOR_FPGA_CAM_USB_CONTROL) | 102 | __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL) |
104 | & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), | 103 | & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), |
105 | INNOVATOR_FPGA_CAM_USB_CONTROL); | 104 | INNOVATOR_FPGA_CAM_USB_CONTROL); |
106 | else if (machine_is_omap_osk()) | 105 | else if (machine_is_omap_osk()) |
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c index 4382af3a45f9..eb35d9630237 100644 --- a/drivers/usb/host/ohci-omap3.c +++ b/drivers/usb/host/ohci-omap3.c | |||
@@ -30,7 +30,6 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <plat/usb.h> | ||
34 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> |
35 | 34 | ||
36 | /*-------------------------------------------------------------------------*/ | 35 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 3d1c71b50f76..c107d7cdfa69 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -34,8 +34,7 @@ | |||
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
36 | #include <linux/usb/nop-usb-xceiv.h> | 36 | #include <linux/usb/nop-usb-xceiv.h> |
37 | 37 | #include <linux/platform_data/usb-omap.h> | |
38 | #include <plat/usb.h> | ||
39 | 38 | ||
40 | #include "musb_core.h" | 39 | #include "musb_core.h" |
41 | 40 | ||
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 9a975aa0dee2..e6f2ae8368bb 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -38,13 +38,12 @@ | |||
38 | #include <linux/pm_runtime.h> | 38 | #include <linux/pm_runtime.h> |
39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
40 | #include <linux/usb/nop-usb-xceiv.h> | 40 | #include <linux/usb/nop-usb-xceiv.h> |
41 | #include <linux/platform_data/usb-omap.h> | ||
41 | 42 | ||
42 | #include <linux/of.h> | 43 | #include <linux/of.h> |
43 | #include <linux/of_device.h> | 44 | #include <linux/of_device.h> |
44 | #include <linux/of_address.h> | 45 | #include <linux/of_address.h> |
45 | 46 | ||
46 | #include <plat/usb.h> | ||
47 | |||
48 | #include "musb_core.h" | 47 | #include "musb_core.h" |
49 | 48 | ||
50 | #ifdef CONFIG_OF | 49 | #ifdef CONFIG_OF |
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h index b85f3973e78c..8ef656659fcb 100644 --- a/drivers/usb/musb/omap2430.h +++ b/drivers/usb/musb/omap2430.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #ifndef __MUSB_OMAP243X_H__ | 10 | #ifndef __MUSB_OMAP243X_H__ |
11 | #define __MUSB_OMAP243X_H__ | 11 | #define __MUSB_OMAP243X_H__ |
12 | 12 | ||
13 | #include <plat/usb.h> | 13 | #include <linux/platform_data/usb-omap.h> |
14 | 14 | ||
15 | /* | 15 | /* |
16 | * OMAP2430-specific definitions | 16 | * OMAP2430-specific definitions |
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index 2c46d42e6618..9716850a4309 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 | |||
28 | struct tusb_omap_dma_ch { | 35 | struct 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/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 94cac9f9919f..12cf5f31ee8f 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -19,8 +19,8 @@ | |||
19 | #include <linux/backlight.h> | 19 | #include <linux/backlight.h> |
20 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/platform_data/atmel.h> | ||
22 | 23 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/cpu.h> | 24 | #include <mach/cpu.h> |
25 | #include <asm/gpio.h> | 25 | #include <asm/gpio.h> |
26 | 26 | ||
diff --git a/drivers/video/omap/lcd_inn1510.c b/drivers/video/omap/lcd_inn1510.c index b38b1dd15ce3..2ee423279e35 100644 --- a/drivers/video/omap/lcd_inn1510.c +++ b/drivers/video/omap/lcd_inn1510.c | |||
@@ -23,7 +23,8 @@ | |||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | 25 | ||
26 | #include <plat/fpga.h> | 26 | #include <mach/hardware.h> |
27 | |||
27 | #include "omapfb.h" | 28 | #include "omapfb.h" |
28 | 29 | ||
29 | static int innovator1510_panel_init(struct lcd_panel *panel, | 30 | static int innovator1510_panel_init(struct lcd_panel *panel, |
@@ -38,13 +39,13 @@ static void innovator1510_panel_cleanup(struct lcd_panel *panel) | |||
38 | 39 | ||
39 | static int innovator1510_panel_enable(struct lcd_panel *panel) | 40 | static int innovator1510_panel_enable(struct lcd_panel *panel) |
40 | { | 41 | { |
41 | fpga_write(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL); | 42 | __raw_writeb(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL); |
42 | return 0; | 43 | return 0; |
43 | } | 44 | } |
44 | 45 | ||
45 | static void innovator1510_panel_disable(struct lcd_panel *panel) | 46 | static void innovator1510_panel_disable(struct lcd_panel *panel) |
46 | { | 47 | { |
47 | fpga_write(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL); | 48 | __raw_writeb(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL); |
48 | } | 49 | } |
49 | 50 | ||
50 | static unsigned long innovator1510_panel_get_caps(struct lcd_panel *panel) | 51 | static unsigned long innovator1510_panel_get_caps(struct lcd_panel *panel) |
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/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index b2af72dc20bd..d94ef9e31a35 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -237,7 +237,7 @@ static int __init omap_dss_probe(struct platform_device *pdev) | |||
237 | 237 | ||
238 | core.pdev = pdev; | 238 | core.pdev = pdev; |
239 | 239 | ||
240 | dss_features_init(); | 240 | dss_features_init(pdata->version); |
241 | 241 | ||
242 | dss_apply_init(); | 242 | dss_apply_init(); |
243 | 243 | ||
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index b43477a5fae8..a5ab354f267a 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | #include <linux/pm_runtime.h> | 38 | #include <linux/pm_runtime.h> |
39 | 39 | ||
40 | #include <plat/cpu.h> | ||
41 | |||
42 | #include <video/omapdss.h> | 40 | #include <video/omapdss.h> |
43 | 41 | ||
44 | #include "dss.h" | 42 | #include "dss.h" |
@@ -4042,29 +4040,44 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = { | |||
4042 | .gfx_fifo_workaround = true, | 4040 | .gfx_fifo_workaround = true, |
4043 | }; | 4041 | }; |
4044 | 4042 | ||
4045 | static int __init dispc_init_features(struct device *dev) | 4043 | static int __init dispc_init_features(struct platform_device *pdev) |
4046 | { | 4044 | { |
4045 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
4047 | const struct dispc_features *src; | 4046 | const struct dispc_features *src; |
4048 | struct dispc_features *dst; | 4047 | struct dispc_features *dst; |
4049 | 4048 | ||
4050 | dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); | 4049 | dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); |
4051 | if (!dst) { | 4050 | if (!dst) { |
4052 | dev_err(dev, "Failed to allocate DISPC Features\n"); | 4051 | dev_err(&pdev->dev, "Failed to allocate DISPC Features\n"); |
4053 | return -ENOMEM; | 4052 | return -ENOMEM; |
4054 | } | 4053 | } |
4055 | 4054 | ||
4056 | if (cpu_is_omap24xx()) { | 4055 | switch (pdata->version) { |
4056 | case OMAPDSS_VER_OMAP24xx: | ||
4057 | src = &omap24xx_dispc_feats; | 4057 | src = &omap24xx_dispc_feats; |
4058 | } else if (cpu_is_omap34xx()) { | 4058 | break; |
4059 | if (omap_rev() < OMAP3430_REV_ES3_0) | 4059 | |
4060 | src = &omap34xx_rev1_0_dispc_feats; | 4060 | case OMAPDSS_VER_OMAP34xx_ES1: |
4061 | else | 4061 | src = &omap34xx_rev1_0_dispc_feats; |
4062 | src = &omap34xx_rev3_0_dispc_feats; | 4062 | break; |
4063 | } else if (cpu_is_omap44xx()) { | 4063 | |
4064 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
4065 | case OMAPDSS_VER_OMAP3630: | ||
4066 | case OMAPDSS_VER_AM35xx: | ||
4067 | src = &omap34xx_rev3_0_dispc_feats; | ||
4068 | break; | ||
4069 | |||
4070 | case OMAPDSS_VER_OMAP4430_ES1: | ||
4071 | case OMAPDSS_VER_OMAP4430_ES2: | ||
4072 | case OMAPDSS_VER_OMAP4: | ||
4064 | src = &omap44xx_dispc_feats; | 4073 | src = &omap44xx_dispc_feats; |
4065 | } else if (soc_is_omap54xx()) { | 4074 | break; |
4075 | |||
4076 | case OMAPDSS_VER_OMAP5: | ||
4066 | src = &omap44xx_dispc_feats; | 4077 | src = &omap44xx_dispc_feats; |
4067 | } else { | 4078 | break; |
4079 | |||
4080 | default: | ||
4068 | return -ENODEV; | 4081 | return -ENODEV; |
4069 | } | 4082 | } |
4070 | 4083 | ||
@@ -4084,7 +4097,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev) | |||
4084 | 4097 | ||
4085 | dispc.pdev = pdev; | 4098 | dispc.pdev = pdev; |
4086 | 4099 | ||
4087 | r = dispc_init_features(&dispc.pdev->dev); | 4100 | r = dispc_init_features(dispc.pdev); |
4088 | if (r) | 4101 | if (r) |
4089 | return r; | 4102 | return r; |
4090 | 4103 | ||
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 5f6eea801b06..602102cebcbf 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
37 | 37 | ||
38 | #include <plat/cpu.h> | ||
39 | |||
40 | #include "dss.h" | 38 | #include "dss.h" |
41 | #include "dss_features.h" | 39 | #include "dss_features.h" |
42 | 40 | ||
@@ -796,29 +794,46 @@ static const struct dss_features omap54xx_dss_feats __initconst = { | |||
796 | .dpi_select_source = &dss_dpi_select_source_omap5, | 794 | .dpi_select_source = &dss_dpi_select_source_omap5, |
797 | }; | 795 | }; |
798 | 796 | ||
799 | static int __init dss_init_features(struct device *dev) | 797 | static int __init dss_init_features(struct platform_device *pdev) |
800 | { | 798 | { |
799 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
801 | const struct dss_features *src; | 800 | const struct dss_features *src; |
802 | struct dss_features *dst; | 801 | struct dss_features *dst; |
803 | 802 | ||
804 | dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); | 803 | dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); |
805 | if (!dst) { | 804 | if (!dst) { |
806 | dev_err(dev, "Failed to allocate local DSS Features\n"); | 805 | dev_err(&pdev->dev, "Failed to allocate local DSS Features\n"); |
807 | return -ENOMEM; | 806 | return -ENOMEM; |
808 | } | 807 | } |
809 | 808 | ||
810 | if (cpu_is_omap24xx()) | 809 | switch (pdata->version) { |
810 | case OMAPDSS_VER_OMAP24xx: | ||
811 | src = &omap24xx_dss_feats; | 811 | src = &omap24xx_dss_feats; |
812 | else if (cpu_is_omap3630()) | 812 | break; |
813 | src = &omap3630_dss_feats; | 813 | |
814 | else if (cpu_is_omap34xx()) | 814 | case OMAPDSS_VER_OMAP34xx_ES1: |
815 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
816 | case OMAPDSS_VER_AM35xx: | ||
815 | src = &omap34xx_dss_feats; | 817 | src = &omap34xx_dss_feats; |
816 | else if (cpu_is_omap44xx()) | 818 | break; |
819 | |||
820 | case OMAPDSS_VER_OMAP3630: | ||
821 | src = &omap3630_dss_feats; | ||
822 | break; | ||
823 | |||
824 | case OMAPDSS_VER_OMAP4430_ES1: | ||
825 | case OMAPDSS_VER_OMAP4430_ES2: | ||
826 | case OMAPDSS_VER_OMAP4: | ||
817 | src = &omap44xx_dss_feats; | 827 | src = &omap44xx_dss_feats; |
818 | else if (soc_is_omap54xx()) | 828 | break; |
829 | |||
830 | case OMAPDSS_VER_OMAP5: | ||
819 | src = &omap54xx_dss_feats; | 831 | src = &omap54xx_dss_feats; |
820 | else | 832 | break; |
833 | |||
834 | default: | ||
821 | return -ENODEV; | 835 | return -ENODEV; |
836 | } | ||
822 | 837 | ||
823 | memcpy(dst, src, sizeof(*dst)); | 838 | memcpy(dst, src, sizeof(*dst)); |
824 | dss.feat = dst; | 839 | dss.feat = dst; |
@@ -835,7 +850,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev) | |||
835 | 850 | ||
836 | dss.pdev = pdev; | 851 | dss.pdev = pdev; |
837 | 852 | ||
838 | r = dss_init_features(&dss.pdev->dev); | 853 | r = dss_init_features(dss.pdev); |
839 | if (r) | 854 | if (r) |
840 | return r; | 855 | return r; |
841 | 856 | ||
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index acbc1e1efba3..3e8287c8709d 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | 24 | ||
25 | #include <video/omapdss.h> | 25 | #include <video/omapdss.h> |
26 | #include <plat/cpu.h> | ||
27 | 26 | ||
28 | #include "dss.h" | 27 | #include "dss.h" |
29 | #include "dss_features.h" | 28 | #include "dss_features.h" |
@@ -825,10 +824,20 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { | |||
825 | 824 | ||
826 | }; | 825 | }; |
827 | 826 | ||
828 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data) | 827 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, |
828 | enum omapdss_version version) | ||
829 | { | 829 | { |
830 | if (cpu_is_omap44xx()) | 830 | switch (version) { |
831 | case OMAPDSS_VER_OMAP4430_ES1: | ||
832 | case OMAPDSS_VER_OMAP4430_ES2: | ||
833 | case OMAPDSS_VER_OMAP4: | ||
831 | ip_data->ops = &omap4_hdmi_functions; | 834 | ip_data->ops = &omap4_hdmi_functions; |
835 | break; | ||
836 | default: | ||
837 | ip_data->ops = NULL; | ||
838 | } | ||
839 | |||
840 | WARN_ON(ip_data->ops == NULL); | ||
832 | } | 841 | } |
833 | #endif | 842 | #endif |
834 | 843 | ||
@@ -929,29 +938,44 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type) | |||
929 | return omap_current_dss_features->supported_rotation_types & rot_type; | 938 | return omap_current_dss_features->supported_rotation_types & rot_type; |
930 | } | 939 | } |
931 | 940 | ||
932 | void dss_features_init(void) | 941 | void dss_features_init(enum omapdss_version version) |
933 | { | 942 | { |
934 | if (cpu_is_omap24xx()) | 943 | switch (version) { |
944 | case OMAPDSS_VER_OMAP24xx: | ||
935 | omap_current_dss_features = &omap2_dss_features; | 945 | omap_current_dss_features = &omap2_dss_features; |
936 | else if (cpu_is_omap3630()) | 946 | break; |
947 | |||
948 | case OMAPDSS_VER_OMAP34xx_ES1: | ||
949 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
950 | omap_current_dss_features = &omap3430_dss_features; | ||
951 | break; | ||
952 | |||
953 | case OMAPDSS_VER_OMAP3630: | ||
937 | omap_current_dss_features = &omap3630_dss_features; | 954 | omap_current_dss_features = &omap3630_dss_features; |
938 | else if (cpu_is_omap34xx()) { | 955 | break; |
939 | if (soc_is_am35xx()) { | 956 | |
940 | omap_current_dss_features = &am35xx_dss_features; | 957 | case OMAPDSS_VER_OMAP4430_ES1: |
941 | } else { | ||
942 | omap_current_dss_features = &omap3430_dss_features; | ||
943 | } | ||
944 | } | ||
945 | else if (omap_rev() == OMAP4430_REV_ES1_0) | ||
946 | omap_current_dss_features = &omap4430_es1_0_dss_features; | 958 | omap_current_dss_features = &omap4430_es1_0_dss_features; |
947 | else if (omap_rev() == OMAP4430_REV_ES2_0 || | 959 | break; |
948 | omap_rev() == OMAP4430_REV_ES2_1 || | 960 | |
949 | omap_rev() == OMAP4430_REV_ES2_2) | 961 | case OMAPDSS_VER_OMAP4430_ES2: |
950 | omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; | 962 | omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; |
951 | else if (cpu_is_omap44xx()) | 963 | break; |
964 | |||
965 | case OMAPDSS_VER_OMAP4: | ||
952 | omap_current_dss_features = &omap4_dss_features; | 966 | omap_current_dss_features = &omap4_dss_features; |
953 | else if (soc_is_omap54xx()) | 967 | break; |
968 | |||
969 | case OMAPDSS_VER_OMAP5: | ||
954 | omap_current_dss_features = &omap5_dss_features; | 970 | omap_current_dss_features = &omap5_dss_features; |
955 | else | 971 | break; |
972 | |||
973 | case OMAPDSS_VER_AM35xx: | ||
974 | omap_current_dss_features = &am35xx_dss_features; | ||
975 | break; | ||
976 | |||
977 | default: | ||
956 | DSSWARN("Unsupported OMAP version"); | 978 | DSSWARN("Unsupported OMAP version"); |
979 | break; | ||
980 | } | ||
957 | } | 981 | } |
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h index 9218113b5e88..fc492ef72a51 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/omap2/dss/dss_features.h | |||
@@ -123,8 +123,9 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type); | |||
123 | 123 | ||
124 | bool dss_has_feature(enum dss_feat_id id); | 124 | bool dss_has_feature(enum dss_feat_id id); |
125 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); | 125 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); |
126 | void dss_features_init(void); | 126 | void dss_features_init(enum omapdss_version version); |
127 | #if defined(CONFIG_OMAP4_DSS_HDMI) | 127 | #if defined(CONFIG_OMAP4_DSS_HDMI) |
128 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data); | 128 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, |
129 | enum omapdss_version version); | ||
129 | #endif | 130 | #endif |
130 | #endif | 131 | #endif |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 8c9b8b3b7f77..0d6d7213a858 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -323,6 +323,7 @@ static void hdmi_runtime_put(void) | |||
323 | 323 | ||
324 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) | 324 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
325 | { | 325 | { |
326 | struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data; | ||
326 | int r; | 327 | int r; |
327 | 328 | ||
328 | struct gpio gpios[] = { | 329 | struct gpio gpios[] = { |
@@ -333,7 +334,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev) | |||
333 | 334 | ||
334 | DSSDBG("init_display\n"); | 335 | DSSDBG("init_display\n"); |
335 | 336 | ||
336 | dss_init_hdmi_ip_ops(&hdmi.ip_data); | 337 | dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version); |
337 | 338 | ||
338 | if (hdmi.vdda_hdmi_dac_reg == NULL) { | 339 | if (hdmi.vdda_hdmi_dac_reg == NULL) { |
339 | struct regulator *reg; | 340 | struct regulator *reg; |
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index d630b26a005c..532a31b3d96b 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <video/omapvrfb.h> |
34 | #include <plat/vram.h> | 34 | #include <plat/vram.h> |
35 | 35 | ||
36 | #include "omapfb.h" | 36 | #include "omapfb.h" |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 16db1589bd91..bc225e46fdd2 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -31,9 +31,8 @@ | |||
31 | #include <linux/omapfb.h> | 31 | #include <linux/omapfb.h> |
32 | 32 | ||
33 | #include <video/omapdss.h> | 33 | #include <video/omapdss.h> |
34 | #include <plat/cpu.h> | ||
35 | #include <plat/vram.h> | 34 | #include <plat/vram.h> |
36 | #include <plat/vrfb.h> | 35 | #include <video/omapvrfb.h> |
37 | 36 | ||
38 | #include "omapfb.h" | 37 | #include "omapfb.h" |
39 | 38 | ||
@@ -2396,10 +2395,7 @@ static int __init omapfb_probe(struct platform_device *pdev) | |||
2396 | goto err0; | 2395 | goto err0; |
2397 | } | 2396 | } |
2398 | 2397 | ||
2399 | /* TODO : Replace cpu check with omap_has_vrfb once HAS_FEATURE | 2398 | if (def_vrfb && !omap_vrfb_supported()) { |
2400 | * available for OMAP2 and OMAP3 | ||
2401 | */ | ||
2402 | if (def_vrfb && !cpu_is_omap24xx() && !cpu_is_omap34xx()) { | ||
2403 | def_vrfb = 0; | 2399 | def_vrfb = 0; |
2404 | dev_warn(&pdev->dev, "VRFB is not supported on this hardware, " | 2400 | dev_warn(&pdev->dev, "VRFB is not supported on this hardware, " |
2405 | "ignoring the module parameter vrfb=y\n"); | 2401 | "ignoring the module parameter vrfb=y\n"); |
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c index e8d8cc76a435..17aa174e187c 100644 --- a/drivers/video/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/omapfb.h> | 30 | #include <linux/omapfb.h> |
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <video/omapvrfb.h> |
34 | 34 | ||
35 | #include "omapfb.h" | 35 | #include "omapfb.h" |
36 | 36 | ||
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index 7e990220ad2a..5d8fdac3b800 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c | |||
@@ -26,9 +26,9 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/bitops.h> | 27 | #include <linux/bitops.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/platform_device.h> | ||
29 | 30 | ||
30 | #include <plat/vrfb.h> | 31 | #include <video/omapvrfb.h> |
31 | #include <plat/sdrc.h> | ||
32 | 32 | ||
33 | #ifdef DEBUG | 33 | #ifdef DEBUG |
34 | #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__) | 34 | #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__) |
@@ -36,10 +36,10 @@ | |||
36 | #define DBG(format, ...) | 36 | #define DBG(format, ...) |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define SMS_ROT_VIRT_BASE(context, rot) \ | 39 | #define SMS_ROT_CONTROL(context) (0x0 + 0x10 * context) |
40 | (((context >= 4) ? 0xD0000000 : 0x70000000) \ | 40 | #define SMS_ROT_SIZE(context) (0x4 + 0x10 * context) |
41 | + (0x4000000 * (context)) \ | 41 | #define SMS_ROT_PHYSICAL_BA(context) (0x8 + 0x10 * context) |
42 | + (0x1000000 * (rot))) | 42 | #define SMS_ROT_VIRT_BASE(rot) (0x1000000 * (rot)) |
43 | 43 | ||
44 | #define OMAP_VRFB_SIZE (2048 * 2048 * 4) | 44 | #define OMAP_VRFB_SIZE (2048 * 2048 * 4) |
45 | 45 | ||
@@ -53,10 +53,16 @@ | |||
53 | #define SMS_PW_OFFSET 4 | 53 | #define SMS_PW_OFFSET 4 |
54 | #define SMS_PS_OFFSET 0 | 54 | #define SMS_PS_OFFSET 0 |
55 | 55 | ||
56 | #define VRFB_NUM_CTXS 12 | ||
57 | /* bitmap of reserved contexts */ | 56 | /* bitmap of reserved contexts */ |
58 | static unsigned long ctx_map; | 57 | static unsigned long ctx_map; |
59 | 58 | ||
59 | struct vrfb_ctx { | ||
60 | u32 base; | ||
61 | u32 physical_ba; | ||
62 | u32 control; | ||
63 | u32 size; | ||
64 | }; | ||
65 | |||
60 | static DEFINE_MUTEX(ctx_lock); | 66 | static DEFINE_MUTEX(ctx_lock); |
61 | 67 | ||
62 | /* | 68 | /* |
@@ -65,17 +71,34 @@ static DEFINE_MUTEX(ctx_lock); | |||
65 | * we don't need locking, since no drivers will run until after the wake-up | 71 | * we don't need locking, since no drivers will run until after the wake-up |
66 | * has finished. | 72 | * has finished. |
67 | */ | 73 | */ |
68 | static struct { | 74 | |
69 | u32 physical_ba; | 75 | static void __iomem *vrfb_base; |
70 | u32 control; | 76 | |
71 | u32 size; | 77 | static int num_ctxs; |
72 | } vrfb_hw_context[VRFB_NUM_CTXS]; | 78 | static struct vrfb_ctx *ctxs; |
79 | |||
80 | static bool vrfb_loaded; | ||
81 | |||
82 | static void omap2_sms_write_rot_control(u32 val, unsigned ctx) | ||
83 | { | ||
84 | __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx)); | ||
85 | } | ||
86 | |||
87 | static void omap2_sms_write_rot_size(u32 val, unsigned ctx) | ||
88 | { | ||
89 | __raw_writel(val, vrfb_base + SMS_ROT_SIZE(ctx)); | ||
90 | } | ||
91 | |||
92 | static void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) | ||
93 | { | ||
94 | __raw_writel(val, vrfb_base + SMS_ROT_PHYSICAL_BA(ctx)); | ||
95 | } | ||
73 | 96 | ||
74 | static inline void restore_hw_context(int ctx) | 97 | static inline void restore_hw_context(int ctx) |
75 | { | 98 | { |
76 | omap2_sms_write_rot_control(vrfb_hw_context[ctx].control, ctx); | 99 | omap2_sms_write_rot_control(ctxs[ctx].control, ctx); |
77 | omap2_sms_write_rot_size(vrfb_hw_context[ctx].size, ctx); | 100 | omap2_sms_write_rot_size(ctxs[ctx].size, ctx); |
78 | omap2_sms_write_rot_physical_ba(vrfb_hw_context[ctx].physical_ba, ctx); | 101 | omap2_sms_write_rot_physical_ba(ctxs[ctx].physical_ba, ctx); |
79 | } | 102 | } |
80 | 103 | ||
81 | static u32 get_image_width_roundup(u16 width, u8 bytespp) | 104 | static u32 get_image_width_roundup(u16 width, u8 bytespp) |
@@ -196,9 +219,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, | |||
196 | control |= VRFB_PAGE_WIDTH_EXP << SMS_PW_OFFSET; | 219 | control |= VRFB_PAGE_WIDTH_EXP << SMS_PW_OFFSET; |
197 | control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET; | 220 | control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET; |
198 | 221 | ||
199 | vrfb_hw_context[ctx].physical_ba = paddr; | 222 | ctxs[ctx].physical_ba = paddr; |
200 | vrfb_hw_context[ctx].size = size; | 223 | ctxs[ctx].size = size; |
201 | vrfb_hw_context[ctx].control = control; | 224 | ctxs[ctx].control = control; |
202 | 225 | ||
203 | omap2_sms_write_rot_physical_ba(paddr, ctx); | 226 | omap2_sms_write_rot_physical_ba(paddr, ctx); |
204 | omap2_sms_write_rot_size(size, ctx); | 227 | omap2_sms_write_rot_size(size, ctx); |
@@ -274,11 +297,11 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb) | |||
274 | 297 | ||
275 | mutex_lock(&ctx_lock); | 298 | mutex_lock(&ctx_lock); |
276 | 299 | ||
277 | for (ctx = 0; ctx < VRFB_NUM_CTXS; ++ctx) | 300 | for (ctx = 0; ctx < num_ctxs; ++ctx) |
278 | if ((ctx_map & (1 << ctx)) == 0) | 301 | if ((ctx_map & (1 << ctx)) == 0) |
279 | break; | 302 | break; |
280 | 303 | ||
281 | if (ctx == VRFB_NUM_CTXS) { | 304 | if (ctx == num_ctxs) { |
282 | pr_err("vrfb: no free contexts\n"); | 305 | pr_err("vrfb: no free contexts\n"); |
283 | r = -EBUSY; | 306 | r = -EBUSY; |
284 | goto out; | 307 | goto out; |
@@ -293,7 +316,7 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb) | |||
293 | vrfb->context = ctx; | 316 | vrfb->context = ctx; |
294 | 317 | ||
295 | for (rot = 0; rot < 4; ++rot) { | 318 | for (rot = 0; rot < 4; ++rot) { |
296 | paddr = SMS_ROT_VIRT_BASE(ctx, rot); | 319 | paddr = ctxs[ctx].base + SMS_ROT_VIRT_BASE(rot); |
297 | if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) { | 320 | if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) { |
298 | pr_err("vrfb: failed to reserve VRFB " | 321 | pr_err("vrfb: failed to reserve VRFB " |
299 | "area for ctx %d, rotation %d\n", | 322 | "area for ctx %d, rotation %d\n", |
@@ -314,3 +337,80 @@ out: | |||
314 | return r; | 337 | return r; |
315 | } | 338 | } |
316 | EXPORT_SYMBOL(omap_vrfb_request_ctx); | 339 | EXPORT_SYMBOL(omap_vrfb_request_ctx); |
340 | |||
341 | bool omap_vrfb_supported(void) | ||
342 | { | ||
343 | return vrfb_loaded; | ||
344 | } | ||
345 | EXPORT_SYMBOL(omap_vrfb_supported); | ||
346 | |||
347 | static int __init vrfb_probe(struct platform_device *pdev) | ||
348 | { | ||
349 | struct resource *mem; | ||
350 | int i; | ||
351 | |||
352 | /* first resource is the register res, the rest are vrfb contexts */ | ||
353 | |||
354 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
355 | if (!mem) { | ||
356 | dev_err(&pdev->dev, "can't get vrfb base address\n"); | ||
357 | return -EINVAL; | ||
358 | } | ||
359 | |||
360 | vrfb_base = devm_request_and_ioremap(&pdev->dev, mem); | ||
361 | if (!vrfb_base) { | ||
362 | dev_err(&pdev->dev, "can't ioremap vrfb memory\n"); | ||
363 | return -ENOMEM; | ||
364 | } | ||
365 | |||
366 | num_ctxs = pdev->num_resources - 1; | ||
367 | |||
368 | ctxs = devm_kzalloc(&pdev->dev, | ||
369 | sizeof(struct vrfb_ctx) * num_ctxs, | ||
370 | GFP_KERNEL); | ||
371 | |||
372 | if (!ctxs) | ||
373 | return -ENOMEM; | ||
374 | |||
375 | for (i = 0; i < num_ctxs; ++i) { | ||
376 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i); | ||
377 | if (!mem) { | ||
378 | dev_err(&pdev->dev, "can't get vrfb ctx %d address\n", | ||
379 | i); | ||
380 | return -EINVAL; | ||
381 | } | ||
382 | |||
383 | ctxs[i].base = mem->start; | ||
384 | } | ||
385 | |||
386 | vrfb_loaded = true; | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static void __exit vrfb_remove(struct platform_device *pdev) | ||
392 | { | ||
393 | vrfb_loaded = false; | ||
394 | } | ||
395 | |||
396 | static struct platform_driver vrfb_driver = { | ||
397 | .driver.name = "omapvrfb", | ||
398 | .remove = __exit_p(vrfb_remove), | ||
399 | }; | ||
400 | |||
401 | static int __init vrfb_init(void) | ||
402 | { | ||
403 | return platform_driver_probe(&vrfb_driver, &vrfb_probe); | ||
404 | } | ||
405 | |||
406 | static void __exit vrfb_exit(void) | ||
407 | { | ||
408 | platform_driver_unregister(&vrfb_driver); | ||
409 | } | ||
410 | |||
411 | module_init(vrfb_init); | ||
412 | module_exit(vrfb_exit); | ||
413 | |||
414 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); | ||
415 | MODULE_DESCRIPTION("OMAP VRFB"); | ||
416 | MODULE_LICENSE("GPL v2"); | ||