OMAP3: PM: Fix linker error without CONFIG_PM option
[linux-ginger.git] / arch / arm / mach-nomadik / board-nhk8815.c
blob6bfd537d5afbeba3f4518c5381f3711cac5d9311
1 /*
2 * linux/arch/arm/mach-nomadik/board-8815nhk.c
4 * Copyright (C) STMicroelectronics
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
10 * NHK15 board specifc driver definition
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/amba/bus.h>
17 #include <linux/interrupt.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>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/irq.h>
27 #include <asm/mach/flash.h>
28 #include <mach/setup.h>
29 #include <mach/nand.h>
30 #include <mach/fsmc.h>
31 #include "clock.h"
33 /* These adresses span 16MB, so use three individual pages */
34 static struct resource nhk8815_nand_resources[] = {
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,
53 static int nhk8815_nand_init(void)
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));
60 /* enable access to the chip select area */
61 writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0));
63 return 0;
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...
71 static struct mtd_partition nhk8815_partitions[] = {
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,
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,
107 static struct platform_device nhk8815_nand_device = {
108 .name = "nomadik_nand",
109 .dev = {
110 .platform_data = &nhk8815_nand_data,
112 .resource = nhk8815_nand_resources,
113 .num_resources = ARRAY_SIZE(nhk8815_nand_resources),
116 /* These are the partitions for the OneNand device, different from above */
117 static struct mtd_partition nhk8815_onenand_partitions[] = {
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,
145 static struct flash_platform_data nhk8815_onenand_data = {
146 .parts = nhk8815_onenand_partitions,
147 .nr_parts = ARRAY_SIZE(nhk8815_onenand_partitions),
150 static struct resource nhk8815_onenand_resource[] = {
152 .start = 0x30000000,
153 .end = 0x30000000 + SZ_128K - 1,
154 .flags = IORESOURCE_MEM,
158 static struct platform_device nhk8815_onenand_device = {
159 .name = "onenand",
160 .id = -1,
161 .dev = {
162 .platform_data = &nhk8815_onenand_data,
164 .resource = nhk8815_onenand_resource,
165 .num_resources = ARRAY_SIZE(nhk8815_onenand_resource),
168 static void __init nhk8815_onenand_init(void)
170 #ifdef CONFIG_ONENAND
171 /* Set up SMCS0 for OneNand */
172 writel(0x000030db, FSMC_BCR0);
173 writel(0x02100551, FSMC_BTR0);
174 #endif
177 #define __MEM_4K_RESOURCE(x) \
178 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
180 static struct amba_device uart0_device = {
181 .dev = { .init_name = "uart0" },
182 __MEM_4K_RESOURCE(NOMADIK_UART0_BASE),
183 .irq = {IRQ_UART0, NO_IRQ},
186 static struct amba_device uart1_device = {
187 .dev = { .init_name = "uart1" },
188 __MEM_4K_RESOURCE(NOMADIK_UART1_BASE),
189 .irq = {IRQ_UART1, NO_IRQ},
192 static struct amba_device *amba_devs[] __initdata = {
193 &uart0_device,
194 &uart1_device,
197 /* We have a fixed clock alone, by now */
198 static struct clk nhk8815_clk_48 = {
199 .rate = 48*1000*1000,
202 static struct resource nhk8815_eth_resources[] = {
204 .name = "smc91x-regs",
205 .start = 0x34000000 + 0x300,
206 .end = 0x34000000 + SZ_64K - 1,
207 .flags = IORESOURCE_MEM,
208 }, {
209 .start = NOMADIK_GPIO_TO_IRQ(115),
210 .end = NOMADIK_GPIO_TO_IRQ(115),
211 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
215 static struct platform_device nhk8815_eth_device = {
216 .name = "smc91x",
217 .resource = nhk8815_eth_resources,
218 .num_resources = ARRAY_SIZE(nhk8815_eth_resources),
221 static int __init nhk8815_eth_init(void)
223 int gpio_nr = 115; /* hardwired in the board */
224 int err;
226 err = gpio_request(gpio_nr, "eth_irq");
227 if (!err) err = nmk_gpio_set_mode(gpio_nr, NMK_GPIO_ALT_GPIO);
228 if (!err) err = gpio_direction_input(gpio_nr);
229 if (err)
230 pr_err("Error %i in %s\n", err, __func__);
231 return err;
233 device_initcall(nhk8815_eth_init);
235 static struct platform_device *nhk8815_platform_devices[] __initdata = {
236 &nhk8815_nand_device,
237 &nhk8815_onenand_device,
238 &nhk8815_eth_device,
239 /* will add more devices */
242 static void __init nhk8815_platform_init(void)
244 int i;
246 cpu8815_platform_init();
247 nhk8815_onenand_init();
248 platform_add_devices(nhk8815_platform_devices,
249 ARRAY_SIZE(nhk8815_platform_devices));
251 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
252 nmdk_clk_create(&nhk8815_clk_48, amba_devs[i]->dev.init_name);
253 amba_device_register(amba_devs[i], &iomem_resource);
257 MACHINE_START(NOMADIK, "NHK8815")
258 /* Maintainer: ST MicroElectronics */
259 .phys_io = NOMADIK_UART0_BASE,
260 .io_pg_offst = (IO_ADDRESS(NOMADIK_UART0_BASE) >> 18) & 0xfffc,
261 .boot_params = 0x100,
262 .map_io = cpu8815_map_io,
263 .init_irq = cpu8815_init_irq,
264 .timer = &nomadik_timer,
265 .init_machine = nhk8815_platform_init,
266 MACHINE_END