diff options
author | Sukumar Ghorai <s-ghorai@ti.com> | 2010-07-09 10:27:47 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-08-02 08:43:29 -0400 |
commit | 13d6b73cf189945b7d20e749f9034329d227be6a (patch) | |
tree | eb100f7b4df6a6dd39e1c632d7c96f1e110baf33 | |
parent | f450d86790ebf72ac93c7ea5addd6fa278aae64c (diff) |
omap3 flash: rename board-sdp-flash.c to be use by other boards
rename board-sdp-flash.c(board-flash.c) and board-sdp.h(board-flash.h) to
used by other board e.g. zoom
Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-3430sdp.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-flash.c (renamed from arch/arm/mach-omap2/board-sdp-flash.c) | 88 | ||||
-rw-r--r-- | arch/arm/mach-omap2/include/mach/board-flash.h (renamed from arch/arm/mach-omap2/include/mach/board-sdp.h) | 9 |
4 files changed, 60 insertions, 55 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 0db90ff52617..9abefccbce8d 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -121,7 +121,7 @@ obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \ | |||
121 | hsmmc.o | 121 | hsmmc.o |
122 | obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ | 122 | obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ |
123 | hsmmc.o \ | 123 | hsmmc.o \ |
124 | board-sdp-flash.o | 124 | board-flash.o |
125 | obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o | 125 | obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o |
126 | obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ | 126 | obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ |
127 | board-rx51-sdram.o \ | 127 | board-rx51-sdram.o \ |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index f474a80b8867..4b8595b6787d 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <plat/control.h> | 41 | #include <plat/control.h> |
42 | #include <plat/gpmc-smc91x.h> | 42 | #include <plat/gpmc-smc91x.h> |
43 | 43 | ||
44 | #include <mach/board-sdp.h> | 44 | #include <mach/board-flash.h> |
45 | 45 | ||
46 | #include "mux.h" | 46 | #include "mux.h" |
47 | #include "sdram-qimonda-hyb18m512160af-6.h" | 47 | #include "sdram-qimonda-hyb18m512160af-6.h" |
@@ -667,6 +667,18 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
667 | #define board_mux NULL | 667 | #define board_mux NULL |
668 | #endif | 668 | #endif |
669 | 669 | ||
670 | /* | ||
671 | * SDP3430 V2 Board CS organization | ||
672 | * Different from SDP3430 V1. Now 4 switches used to specify CS | ||
673 | * | ||
674 | * See also the Switch S8 settings in the comments. | ||
675 | */ | ||
676 | static char chip_sel_3430[][GPMC_CS_NUM] = { | ||
677 | {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */ | ||
678 | {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */ | ||
679 | {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */ | ||
680 | }; | ||
681 | |||
670 | static struct mtd_partition sdp_nor_partitions[] = { | 682 | static struct mtd_partition sdp_nor_partitions[] = { |
671 | /* bootloader (U-Boot, etc) in first sector */ | 683 | /* bootloader (U-Boot, etc) in first sector */ |
672 | { | 684 | { |
@@ -797,7 +809,7 @@ static void __init omap_3430sdp_init(void) | |||
797 | omap_serial_init(); | 809 | omap_serial_init(); |
798 | usb_musb_init(&musb_board_data); | 810 | usb_musb_init(&musb_board_data); |
799 | board_smc91x_init(); | 811 | board_smc91x_init(); |
800 | sdp_flash_init(sdp_flash_partitions); | 812 | board_flash_init(sdp_flash_partitions, chip_sel_3430); |
801 | sdp3430_display_init(); | 813 | sdp3430_display_init(); |
802 | enable_board_wakeup_source(); | 814 | enable_board_wakeup_source(); |
803 | usb_ehci_init(&ehci_pdata); | 815 | usb_ehci_init(&ehci_pdata); |
diff --git a/arch/arm/mach-omap2/board-sdp-flash.c b/arch/arm/mach-omap2/board-flash.c index 2638c834dec2..ac834aa7abf6 100644 --- a/arch/arm/mach-omap2/board-sdp-flash.c +++ b/arch/arm/mach-omap2/board-flash.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <plat/nand.h> | 21 | #include <plat/nand.h> |
22 | #include <plat/onenand.h> | 22 | #include <plat/onenand.h> |
23 | #include <plat/tc.h> | 23 | #include <plat/tc.h> |
24 | #include <mach/board-sdp.h> | 24 | #include <mach/board-flash.h> |
25 | 25 | ||
26 | #define REG_FPGA_REV 0x10 | 26 | #define REG_FPGA_REV 0x10 |
27 | #define REG_FPGA_DIP_SWITCH_INPUT2 0x60 | 27 | #define REG_FPGA_DIP_SWITCH_INPUT2 0x60 |
@@ -29,72 +29,53 @@ | |||
29 | 29 | ||
30 | #define DEBUG_BASE 0x08000000 /* debug board */ | 30 | #define DEBUG_BASE 0x08000000 /* debug board */ |
31 | 31 | ||
32 | #define PDC_NOR 1 | ||
33 | #define PDC_NAND 2 | ||
34 | #define PDC_ONENAND 3 | ||
35 | #define DBG_MPDB 4 | ||
36 | |||
37 | /* various memory sizes */ | 32 | /* various memory sizes */ |
38 | #define FLASH_SIZE_SDPV1 SZ_64M /* NOR flash (64 Meg aligned) */ | 33 | #define FLASH_SIZE_SDPV1 SZ_64M /* NOR flash (64 Meg aligned) */ |
39 | #define FLASH_SIZE_SDPV2 SZ_128M /* NOR flash (256 Meg aligned) */ | 34 | #define FLASH_SIZE_SDPV2 SZ_128M /* NOR flash (256 Meg aligned) */ |
40 | 35 | ||
41 | /* | 36 | static struct physmap_flash_data board_nor_data = { |
42 | * SDP3430 V2 Board CS organization | ||
43 | * Different from SDP3430 V1. Now 4 switches used to specify CS | ||
44 | * | ||
45 | * See also the Switch S8 settings in the comments. | ||
46 | * | ||
47 | * REVISIT: Add support for 2430 SDP | ||
48 | */ | ||
49 | static const unsigned char chip_sel_sdp[][GPMC_CS_NUM] = { | ||
50 | {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */ | ||
51 | {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */ | ||
52 | {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */ | ||
53 | }; | ||
54 | |||
55 | static struct physmap_flash_data sdp_nor_data = { | ||
56 | .width = 2, | 37 | .width = 2, |
57 | }; | 38 | }; |
58 | 39 | ||
59 | static struct resource sdp_nor_resource = { | 40 | static struct resource board_nor_resource = { |
60 | .flags = IORESOURCE_MEM, | 41 | .flags = IORESOURCE_MEM, |
61 | }; | 42 | }; |
62 | 43 | ||
63 | static struct platform_device sdp_nor_device = { | 44 | static struct platform_device board_nor_device = { |
64 | .name = "physmap-flash", | 45 | .name = "physmap-flash", |
65 | .id = 0, | 46 | .id = 0, |
66 | .dev = { | 47 | .dev = { |
67 | .platform_data = &sdp_nor_data, | 48 | .platform_data = &board_nor_data, |
68 | }, | 49 | }, |
69 | .num_resources = 1, | 50 | .num_resources = 1, |
70 | .resource = &sdp_nor_resource, | 51 | .resource = &board_nor_resource, |
71 | }; | 52 | }; |
72 | 53 | ||
73 | static void | 54 | static void |
74 | __init board_nor_init(struct flash_partitions sdp_nor_parts, u8 cs) | 55 | __init board_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs) |
75 | { | 56 | { |
76 | int err; | 57 | int err; |
77 | 58 | ||
78 | sdp_nor_data.parts = sdp_nor_parts.parts; | 59 | board_nor_data.parts = nor_parts; |
79 | sdp_nor_data.nr_parts = sdp_nor_parts.nr_parts; | 60 | board_nor_data.nr_parts = nr_parts; |
80 | 61 | ||
81 | /* Configure start address and size of NOR device */ | 62 | /* Configure start address and size of NOR device */ |
82 | if (omap_rev() >= OMAP3430_REV_ES1_0) { | 63 | if (omap_rev() >= OMAP3430_REV_ES1_0) { |
83 | err = gpmc_cs_request(cs, FLASH_SIZE_SDPV2 - 1, | 64 | err = gpmc_cs_request(cs, FLASH_SIZE_SDPV2 - 1, |
84 | (unsigned long *)&sdp_nor_resource.start); | 65 | (unsigned long *)&board_nor_resource.start); |
85 | sdp_nor_resource.end = sdp_nor_resource.start | 66 | board_nor_resource.end = board_nor_resource.start |
86 | + FLASH_SIZE_SDPV2 - 1; | 67 | + FLASH_SIZE_SDPV2 - 1; |
87 | } else { | 68 | } else { |
88 | err = gpmc_cs_request(cs, FLASH_SIZE_SDPV1 - 1, | 69 | err = gpmc_cs_request(cs, FLASH_SIZE_SDPV1 - 1, |
89 | (unsigned long *)&sdp_nor_resource.start); | 70 | (unsigned long *)&board_nor_resource.start); |
90 | sdp_nor_resource.end = sdp_nor_resource.start | 71 | board_nor_resource.end = board_nor_resource.start |
91 | + FLASH_SIZE_SDPV1 - 1; | 72 | + FLASH_SIZE_SDPV1 - 1; |
92 | } | 73 | } |
93 | if (err < 0) { | 74 | if (err < 0) { |
94 | printk(KERN_ERR "NOR: Can't request GPMC CS\n"); | 75 | printk(KERN_ERR "NOR: Can't request GPMC CS\n"); |
95 | return; | 76 | return; |
96 | } | 77 | } |
97 | if (platform_device_register(&sdp_nor_device) < 0) | 78 | if (platform_device_register(&board_nor_device) < 0) |
98 | printk(KERN_ERR "Unable to register NOR device\n"); | 79 | printk(KERN_ERR "Unable to register NOR device\n"); |
99 | } | 80 | } |
100 | 81 | ||
@@ -105,17 +86,18 @@ static struct omap_onenand_platform_data board_onenand_data = { | |||
105 | }; | 86 | }; |
106 | 87 | ||
107 | static void | 88 | static void |
108 | __init board_onenand_init(struct flash_partitions sdp_onenand_parts, u8 cs) | 89 | __init board_onenand_init(struct mtd_partition *onenand_parts, |
90 | u8 nr_parts, u8 cs) | ||
109 | { | 91 | { |
110 | board_onenand_data.cs = cs; | 92 | board_onenand_data.cs = cs; |
111 | board_onenand_data.parts = sdp_onenand_parts.parts; | 93 | board_onenand_data.parts = onenand_parts; |
112 | board_onenand_data.nr_parts = sdp_onenand_parts.nr_parts; | 94 | board_onenand_data.nr_parts = nr_parts; |
113 | 95 | ||
114 | gpmc_onenand_init(&board_onenand_data); | 96 | gpmc_onenand_init(&board_onenand_data); |
115 | } | 97 | } |
116 | #else | 98 | #else |
117 | static void | 99 | static void |
118 | __init board_onenand_init(struct flash_partitions sdp_onenand_parts, u8 cs) | 100 | __init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs) |
119 | { | 101 | { |
120 | } | 102 | } |
121 | #endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */ | 103 | #endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */ |
@@ -147,7 +129,7 @@ static struct gpmc_timings nand_timings = { | |||
147 | .wr_data_mux_bus = 0, | 129 | .wr_data_mux_bus = 0, |
148 | }; | 130 | }; |
149 | 131 | ||
150 | static struct omap_nand_platform_data sdp_nand_data = { | 132 | static struct omap_nand_platform_data board_nand_data = { |
151 | .nand_setup = NULL, | 133 | .nand_setup = NULL, |
152 | .gpmc_t = &nand_timings, | 134 | .gpmc_t = &nand_timings, |
153 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | 135 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ |
@@ -155,18 +137,18 @@ static struct omap_nand_platform_data sdp_nand_data = { | |||
155 | .devsize = 0, /* '0' for 8-bit, '1' for 16-bit device */ | 137 | .devsize = 0, /* '0' for 8-bit, '1' for 16-bit device */ |
156 | }; | 138 | }; |
157 | 139 | ||
158 | static void | 140 | void |
159 | __init board_nand_init(struct flash_partitions sdp_nand_parts, u8 cs) | 141 | __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs) |
160 | { | 142 | { |
161 | sdp_nand_data.cs = cs; | 143 | board_nand_data.cs = cs; |
162 | sdp_nand_data.parts = sdp_nand_parts.parts; | 144 | board_nand_data.parts = nand_parts; |
163 | sdp_nand_data.nr_parts = sdp_nand_parts.nr_parts; | 145 | board_nand_data.nr_parts = nr_parts; |
164 | 146 | ||
165 | gpmc_nand_init(&sdp_nand_data); | 147 | gpmc_nand_init(&board_nand_data); |
166 | } | 148 | } |
167 | #else | 149 | #else |
168 | static void | 150 | void |
169 | __init board_nand_init(struct flash_partitions sdp_nand_parts, u8 cs) | 151 | __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs) |
170 | { | 152 | { |
171 | } | 153 | } |
172 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ | 154 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ |
@@ -210,7 +192,8 @@ unmap: | |||
210 | * | 192 | * |
211 | * @return - void. | 193 | * @return - void. |
212 | */ | 194 | */ |
213 | void __init sdp_flash_init(struct flash_partitions sdp_partition_info[]) | 195 | void board_flash_init(struct flash_partitions partition_info[], |
196 | char chip_sel_board[][GPMC_CS_NUM]) | ||
214 | { | 197 | { |
215 | u8 cs = 0; | 198 | u8 cs = 0; |
216 | u8 norcs = GPMC_CS_NUM + 1; | 199 | u8 norcs = GPMC_CS_NUM + 1; |
@@ -227,7 +210,7 @@ void __init sdp_flash_init(struct flash_partitions sdp_partition_info[]) | |||
227 | printk(KERN_ERR "%s: Invalid chip select: %d\n", __func__, cs); | 210 | printk(KERN_ERR "%s: Invalid chip select: %d\n", __func__, cs); |
228 | return; | 211 | return; |
229 | } | 212 | } |
230 | config_sel = (unsigned char *)(chip_sel_sdp[idx]); | 213 | config_sel = (unsigned char *)(chip_sel_board[idx]); |
231 | 214 | ||
232 | while (cs < GPMC_CS_NUM) { | 215 | while (cs < GPMC_CS_NUM) { |
233 | switch (config_sel[cs]) { | 216 | switch (config_sel[cs]) { |
@@ -251,17 +234,20 @@ void __init sdp_flash_init(struct flash_partitions sdp_partition_info[]) | |||
251 | printk(KERN_INFO "NOR: Unable to find configuration " | 234 | printk(KERN_INFO "NOR: Unable to find configuration " |
252 | "in GPMC\n"); | 235 | "in GPMC\n"); |
253 | else | 236 | else |
254 | board_nor_init(sdp_partition_info[0], norcs); | 237 | board_nor_init(partition_info[0].parts, |
238 | partition_info[0].nr_parts, norcs); | ||
255 | 239 | ||
256 | if (onenandcs > GPMC_CS_NUM) | 240 | if (onenandcs > GPMC_CS_NUM) |
257 | printk(KERN_INFO "OneNAND: Unable to find configuration " | 241 | printk(KERN_INFO "OneNAND: Unable to find configuration " |
258 | "in GPMC\n"); | 242 | "in GPMC\n"); |
259 | else | 243 | else |
260 | board_onenand_init(sdp_partition_info[1], onenandcs); | 244 | board_onenand_init(partition_info[1].parts, |
245 | partition_info[1].nr_parts, onenandcs); | ||
261 | 246 | ||
262 | if (nandcs > GPMC_CS_NUM) | 247 | if (nandcs > GPMC_CS_NUM) |
263 | printk(KERN_INFO "NAND: Unable to find configuration " | 248 | printk(KERN_INFO "NAND: Unable to find configuration " |
264 | "in GPMC\n"); | 249 | "in GPMC\n"); |
265 | else | 250 | else |
266 | board_nand_init(sdp_partition_info[2], nandcs); | 251 | board_nand_init(partition_info[2].parts, |
252 | partition_info[2].nr_parts, nandcs); | ||
267 | } | 253 | } |
diff --git a/arch/arm/mach-omap2/include/mach/board-sdp.h b/arch/arm/mach-omap2/include/mach/board-flash.h index 465169c0908a..b2242ae2bb6f 100644 --- a/arch/arm/mach-omap2/include/mach/board-sdp.h +++ b/arch/arm/mach-omap2/include/mach/board-flash.h | |||
@@ -12,10 +12,17 @@ | |||
12 | */ | 12 | */ |
13 | #include <linux/mtd/mtd.h> | 13 | #include <linux/mtd/mtd.h> |
14 | #include <linux/mtd/partitions.h> | 14 | #include <linux/mtd/partitions.h> |
15 | #include <plat/gpmc.h> | ||
16 | |||
17 | #define PDC_NOR 1 | ||
18 | #define PDC_NAND 2 | ||
19 | #define PDC_ONENAND 3 | ||
20 | #define DBG_MPDB 4 | ||
15 | 21 | ||
16 | struct flash_partitions { | 22 | struct flash_partitions { |
17 | struct mtd_partition *parts; | 23 | struct mtd_partition *parts; |
18 | int nr_parts; | 24 | int nr_parts; |
19 | }; | 25 | }; |
20 | 26 | ||
21 | extern void sdp_flash_init(struct flash_partitions []); | 27 | extern void board_flash_init(struct flash_partitions [], |
28 | char chip_sel[][GPMC_CS_NUM]); | ||