diff options
Diffstat (limited to 'arch/arm/mach-nomadik/board-nhk8815.c')
| -rw-r--r-- | arch/arm/mach-nomadik/board-nhk8815.c | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index 79bdea943eb4..6bfd537d5afb 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c | |||
| @@ -16,12 +16,164 @@ | |||
| 16 | #include <linux/amba/bus.h> | 16 | #include <linux/amba/bus.h> |
| 17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
| 19 | #include <linux/mtd/mtd.h> | ||
| 20 | #include <linux/mtd/nand.h> | ||
| 21 | #include <linux/mtd/partitions.h> | ||
| 22 | #include <linux/io.h> | ||
| 23 | #include <asm/sizes.h> | ||
| 19 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/irq.h> | 26 | #include <asm/mach/irq.h> |
| 27 | #include <asm/mach/flash.h> | ||
| 22 | #include <mach/setup.h> | 28 | #include <mach/setup.h> |
| 29 | #include <mach/nand.h> | ||
| 30 | #include <mach/fsmc.h> | ||
| 23 | #include "clock.h" | 31 | #include "clock.h" |
| 24 | 32 | ||
| 33 | /* These adresses span 16MB, so use three individual pages */ | ||
| 34 | static struct resource nhk8815_nand_resources[] = { | ||
| 35 | { | ||
| 36 | .name = "nand_addr", | ||
| 37 | .start = NAND_IO_ADDR, | ||
| 38 | .end = NAND_IO_ADDR + 0xfff, | ||
| 39 | .flags = IORESOURCE_MEM, | ||
| 40 | }, { | ||
| 41 | .name = "nand_cmd", | ||
| 42 | .start = NAND_IO_CMD, | ||
| 43 | .end = NAND_IO_CMD + 0xfff, | ||
| 44 | .flags = IORESOURCE_MEM, | ||
| 45 | }, { | ||
| 46 | .name = "nand_data", | ||
| 47 | .start = NAND_IO_DATA, | ||
| 48 | .end = NAND_IO_DATA + 0xfff, | ||
| 49 | .flags = IORESOURCE_MEM, | ||
| 50 | } | ||
| 51 | }; | ||
| 52 | |||
| 53 | static int nhk8815_nand_init(void) | ||
| 54 | { | ||
| 55 | /* FSMC setup for nand chip select (8-bit nand in 8815NHK) */ | ||
| 56 | writel(0x0000000E, FSMC_PCR(0)); | ||
| 57 | writel(0x000D0A00, FSMC_PMEM(0)); | ||
| 58 | writel(0x00100A00, FSMC_PATT(0)); | ||
| 59 | |||
| 60 | /* enable access to the chip select area */ | ||
| 61 | writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0)); | ||
| 62 | |||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | |||
| 66 | /* | ||
| 67 | * These partitions are the same as those used in the 2.6.20 release | ||
| 68 | * shipped by the vendor; the first two partitions are mandated | ||
| 69 | * by the boot ROM, and the bootloader area is somehow oversized... | ||
| 70 | */ | ||
| 71 | static struct mtd_partition nhk8815_partitions[] = { | ||
| 72 | { | ||
| 73 | .name = "X-Loader(NAND)", | ||
| 74 | .offset = 0, | ||
| 75 | .size = SZ_256K, | ||
| 76 | }, { | ||
| 77 | .name = "MemInit(NAND)", | ||
| 78 | .offset = MTDPART_OFS_APPEND, | ||
| 79 | .size = SZ_256K, | ||
| 80 | }, { | ||
| 81 | .name = "BootLoader(NAND)", | ||
| 82 | .offset = MTDPART_OFS_APPEND, | ||
| 83 | .size = SZ_2M, | ||
| 84 | }, { | ||
| 85 | .name = "Kernel zImage(NAND)", | ||
| 86 | .offset = MTDPART_OFS_APPEND, | ||
| 87 | .size = 3 * SZ_1M, | ||
| 88 | }, { | ||
| 89 | .name = "Root Filesystem(NAND)", | ||
| 90 | .offset = MTDPART_OFS_APPEND, | ||
| 91 | .size = 22 * SZ_1M, | ||
| 92 | }, { | ||
| 93 | .name = "User Filesystem(NAND)", | ||
| 94 | .offset = MTDPART_OFS_APPEND, | ||
| 95 | .size = MTDPART_SIZ_FULL, | ||
| 96 | } | ||
| 97 | }; | ||
| 98 | |||
| 99 | static struct nomadik_nand_platform_data nhk8815_nand_data = { | ||
| 100 | .parts = nhk8815_partitions, | ||
| 101 | .nparts = ARRAY_SIZE(nhk8815_partitions), | ||
| 102 | .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \ | ||
| 103 | | NAND_NO_READRDY | NAND_NO_AUTOINCR, | ||
| 104 | .init = nhk8815_nand_init, | ||
| 105 | }; | ||
| 106 | |||
| 107 | static struct platform_device nhk8815_nand_device = { | ||
| 108 | .name = "nomadik_nand", | ||
| 109 | .dev = { | ||
| 110 | .platform_data = &nhk8815_nand_data, | ||
| 111 | }, | ||
| 112 | .resource = nhk8815_nand_resources, | ||
| 113 | .num_resources = ARRAY_SIZE(nhk8815_nand_resources), | ||
| 114 | }; | ||
| 115 | |||
| 116 | /* These are the partitions for the OneNand device, different from above */ | ||
| 117 | static struct mtd_partition nhk8815_onenand_partitions[] = { | ||
| 118 | { | ||
| 119 | .name = "X-Loader(OneNAND)", | ||
| 120 | .offset = 0, | ||
| 121 | .size = SZ_256K, | ||
| 122 | }, { | ||
| 123 | .name = "MemInit(OneNAND)", | ||
| 124 | .offset = MTDPART_OFS_APPEND, | ||
| 125 | .size = SZ_256K, | ||
| 126 | }, { | ||
| 127 | .name = "BootLoader(OneNAND)", | ||
| 128 | .offset = MTDPART_OFS_APPEND, | ||
| 129 | .size = SZ_2M-SZ_256K, | ||
| 130 | }, { | ||
| 131 | .name = "SysImage(OneNAND)", | ||
| 132 | .offset = MTDPART_OFS_APPEND, | ||
| 133 | .size = 4 * SZ_1M, | ||
| 134 | }, { | ||
| 135 | .name = "Root Filesystem(OneNAND)", | ||
| 136 | .offset = MTDPART_OFS_APPEND, | ||
| 137 | .size = 22 * SZ_1M, | ||
| 138 | }, { | ||
| 139 | .name = "User Filesystem(OneNAND)", | ||
| 140 | .offset = MTDPART_OFS_APPEND, | ||
| 141 | .size = MTDPART_SIZ_FULL, | ||
| 142 | } | ||
| 143 | }; | ||
| 144 | |||
| 145 | static struct flash_platform_data nhk8815_onenand_data = { | ||
| 146 | .parts = nhk8815_onenand_partitions, | ||
| 147 | .nr_parts = ARRAY_SIZE(nhk8815_onenand_partitions), | ||
| 148 | }; | ||
| 149 | |||
| 150 | static struct resource nhk8815_onenand_resource[] = { | ||
| 151 | { | ||
| 152 | .start = 0x30000000, | ||
| 153 | .end = 0x30000000 + SZ_128K - 1, | ||
| 154 | .flags = IORESOURCE_MEM, | ||
| 155 | }, | ||
| 156 | }; | ||
| 157 | |||
| 158 | static struct platform_device nhk8815_onenand_device = { | ||
| 159 | .name = "onenand", | ||
| 160 | .id = -1, | ||
| 161 | .dev = { | ||
| 162 | .platform_data = &nhk8815_onenand_data, | ||
| 163 | }, | ||
| 164 | .resource = nhk8815_onenand_resource, | ||
| 165 | .num_resources = ARRAY_SIZE(nhk8815_onenand_resource), | ||
| 166 | }; | ||
| 167 | |||
| 168 | static void __init nhk8815_onenand_init(void) | ||
| 169 | { | ||
| 170 | #ifdef CONFIG_ONENAND | ||
| 171 | /* Set up SMCS0 for OneNand */ | ||
| 172 | writel(0x000030db, FSMC_BCR0); | ||
| 173 | writel(0x02100551, FSMC_BTR0); | ||
| 174 | #endif | ||
| 175 | } | ||
| 176 | |||
| 25 | #define __MEM_4K_RESOURCE(x) \ | 177 | #define __MEM_4K_RESOURCE(x) \ |
| 26 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} | 178 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} |
| 27 | 179 | ||
| @@ -81,6 +233,8 @@ static int __init nhk8815_eth_init(void) | |||
| 81 | device_initcall(nhk8815_eth_init); | 233 | device_initcall(nhk8815_eth_init); |
| 82 | 234 | ||
| 83 | static struct platform_device *nhk8815_platform_devices[] __initdata = { | 235 | static struct platform_device *nhk8815_platform_devices[] __initdata = { |
| 236 | &nhk8815_nand_device, | ||
| 237 | &nhk8815_onenand_device, | ||
| 84 | &nhk8815_eth_device, | 238 | &nhk8815_eth_device, |
| 85 | /* will add more devices */ | 239 | /* will add more devices */ |
| 86 | }; | 240 | }; |
| @@ -90,6 +244,7 @@ static void __init nhk8815_platform_init(void) | |||
| 90 | int i; | 244 | int i; |
| 91 | 245 | ||
| 92 | cpu8815_platform_init(); | 246 | cpu8815_platform_init(); |
| 247 | nhk8815_onenand_init(); | ||
| 93 | platform_add_devices(nhk8815_platform_devices, | 248 | platform_add_devices(nhk8815_platform_devices, |
| 94 | ARRAY_SIZE(nhk8815_platform_devices)); | 249 | ARRAY_SIZE(nhk8815_platform_devices)); |
| 95 | 250 | ||
