blob: 06670bb89cab4f3507c886b1e3f1ca7a3387a780 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* linux/arch/arm/mach-s3c2410/mach-bast.c
2 *
Ben Dooks042cf0f2008-07-03 11:24:41 +01003 * Copyright (c) 2003-2005,2008 Simtec Electronics
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/
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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070011*/
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
Ben Dooksec976d62009-05-13 22:52:24 +010019#include <linux/gpio.h>
Ben Dooks6ddc4b02008-04-16 00:06:14 +010020#include <linux/sysdev.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010021#include <linux/serial_core.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010022#include <linux/platform_device.h>
Ben Dooksd97a6662005-06-23 21:56:47 +010023#include <linux/dm9000.h>
Ben Dooksb7a12d12008-07-03 11:24:37 +010024#include <linux/ata_platform.h>
Ben Dooks042cf0f2008-07-03 11:24:41 +010025#include <linux/i2c.h>
Russell Kingfced80c2008-09-06 12:10:45 +010026#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Ben Dooks5ce4b1f2007-07-12 10:44:53 +010028#include <net/ax88796.h>
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32#include <asm/mach/irq.h>
33
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/bast-map.h>
35#include <mach/bast-irq.h>
36#include <mach/bast-cpld.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Russell Kinga09e64f2008-08-05 16:14:15 +010038#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include <asm/irq.h>
40#include <asm/mach-types.h>
41
42//#include <asm/debug-ll.h>
Ben Dooksa2b7ba92008-10-07 22:26:09 +010043#include <plat/regs-serial.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010044#include <mach/regs-gpio.h>
45#include <mach/regs-mem.h>
46#include <mach/regs-lcd.h>
Ben Dooks58c8d572005-10-28 15:31:46 +010047
Ben Dooks885f9eb2009-07-18 10:12:26 +010048#include <plat/hwmon.h>
Ben Dooks7926b5a2008-10-30 10:14:35 +000049#include <plat/nand.h>
Ben Dooks9498cb72008-10-30 10:14:33 +000050#include <plat/iic.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010051#include <mach/fb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53#include <linux/mtd/mtd.h>
54#include <linux/mtd/nand.h>
55#include <linux/mtd/nand_ecc.h>
56#include <linux/mtd/partitions.h>
57
Ben Dooks65cc3372005-07-18 10:24:32 +010058#include <linux/serial_8250.h>
59
Ben Dooksd5120ae2008-10-07 23:09:51 +010060#include <plat/clock.h>
Ben Dooksa2b7ba92008-10-07 22:26:09 +010061#include <plat/devs.h>
62#include <plat/cpu.h>
Ben Dooks9d529c62008-07-03 11:24:39 +010063
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#include "usb-simtec.h"
Ben Dooks9d529c62008-07-03 11:24:39 +010065#include "nor-simtec.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics"
68
69/* macros for virtual address mods for the io space entries */
70#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
71#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
72#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
73#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
74
75/* macros to modify the physical addresses for io space */
76
Ben Dooks1d23b652005-11-08 19:15:31 +000077#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
78#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
79#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
80#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82static struct map_desc bast_iodesc[] __initdata = {
83 /* ISA IO areas */
Ben Dooks1d23b652005-11-08 19:15:31 +000084 {
85 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
86 .pfn = PA_CS2(BAST_PA_ISAIO),
87 .length = SZ_16M,
88 .type = MT_DEVICE,
89 }, {
90 .virtual = (u32)S3C24XX_VA_ISA_WORD,
91 .pfn = PA_CS3(BAST_PA_ISAIO),
92 .length = SZ_16M,
93 .type = MT_DEVICE,
94 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 /* bast CPLD control registers, and external interrupt controls */
Ben Dooks1d23b652005-11-08 19:15:31 +000096 {
97 .virtual = (u32)BAST_VA_CTRL1,
98 .pfn = __phys_to_pfn(BAST_PA_CTRL1),
99 .length = SZ_1M,
100 .type = MT_DEVICE,
101 }, {
102 .virtual = (u32)BAST_VA_CTRL2,
103 .pfn = __phys_to_pfn(BAST_PA_CTRL2),
104 .length = SZ_1M,
105 .type = MT_DEVICE,
106 }, {
107 .virtual = (u32)BAST_VA_CTRL3,
108 .pfn = __phys_to_pfn(BAST_PA_CTRL3),
109 .length = SZ_1M,
110 .type = MT_DEVICE,
111 }, {
112 .virtual = (u32)BAST_VA_CTRL4,
113 .pfn = __phys_to_pfn(BAST_PA_CTRL4),
114 .length = SZ_1M,
115 .type = MT_DEVICE,
116 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 /* PC104 IRQ mux */
Ben Dooks1d23b652005-11-08 19:15:31 +0000118 {
119 .virtual = (u32)BAST_VA_PC104_IRQREQ,
120 .pfn = __phys_to_pfn(BAST_PA_PC104_IRQREQ),
121 .length = SZ_1M,
122 .type = MT_DEVICE,
123 }, {
124 .virtual = (u32)BAST_VA_PC104_IRQRAW,
125 .pfn = __phys_to_pfn(BAST_PA_PC104_IRQRAW),
126 .length = SZ_1M,
127 .type = MT_DEVICE,
128 }, {
129 .virtual = (u32)BAST_VA_PC104_IRQMASK,
130 .pfn = __phys_to_pfn(BAST_PA_PC104_IRQMASK),
131 .length = SZ_1M,
132 .type = MT_DEVICE,
133 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134
135 /* peripheral space... one for each of fast/slow/byte/16bit */
136 /* note, ide is only decoded in word space, even though some registers
137 * are only 8bit */
138
139 /* slow, byte */
140 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
141 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
144 /* slow, word */
145 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
146 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
149 /* fast, byte */
150 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
151 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153
154 /* fast, word */
155 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
156 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158};
159
160#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
161#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
162#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
163
164static struct s3c24xx_uart_clksrc bast_serial_clocks[] = {
165 [0] = {
166 .name = "uclk",
167 .divisor = 1,
168 .min_baud = 0,
169 .max_baud = 0,
170 },
171 [1] = {
172 .name = "pclk",
173 .divisor = 1,
174 .min_baud = 0,
Ben Dooksb526bf22005-11-16 15:05:12 +0000175 .max_baud = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 }
177};
178
179
Ben Dooks66a9b492006-06-18 23:04:05 +0100180static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 [0] = {
182 .hwport = 0,
183 .flags = 0,
184 .ucon = UCON,
185 .ulcon = ULCON,
186 .ufcon = UFCON,
187 .clocks = bast_serial_clocks,
Ben Dooksb526bf22005-11-16 15:05:12 +0000188 .clocks_size = ARRAY_SIZE(bast_serial_clocks),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 },
190 [1] = {
191 .hwport = 1,
192 .flags = 0,
193 .ucon = UCON,
194 .ulcon = ULCON,
195 .ufcon = UFCON,
196 .clocks = bast_serial_clocks,
Ben Dooksb526bf22005-11-16 15:05:12 +0000197 .clocks_size = ARRAY_SIZE(bast_serial_clocks),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 },
199 /* port 2 is not actually used */
200 [2] = {
201 .hwport = 2,
202 .flags = 0,
203 .ucon = UCON,
204 .ulcon = ULCON,
205 .ufcon = UFCON,
206 .clocks = bast_serial_clocks,
Ben Dooksb526bf22005-11-16 15:05:12 +0000207 .clocks_size = ARRAY_SIZE(bast_serial_clocks),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 }
209};
210
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211/* NAND Flash on BAST board */
212
Ben Dooks6ddc4b02008-04-16 00:06:14 +0100213#ifdef CONFIG_PM
214static int bast_pm_suspend(struct sys_device *sd, pm_message_t state)
215{
216 /* ensure that an nRESET is not generated on resume. */
Ben Dooks070276d2009-05-17 22:32:23 +0100217 s3c2410_gpio_setpin(S3C2410_GPA(21), 1);
218 s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT);
Ben Dooks6ddc4b02008-04-16 00:06:14 +0100219
220 return 0;
221}
222
223static int bast_pm_resume(struct sys_device *sd)
224{
Ben Dooks070276d2009-05-17 22:32:23 +0100225 s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
Ben Dooks6ddc4b02008-04-16 00:06:14 +0100226 return 0;
227}
228
229#else
230#define bast_pm_suspend NULL
231#define bast_pm_resume NULL
232#endif
233
234static struct sysdev_class bast_pm_sysclass = {
Ben Dooks140749e2008-04-19 13:08:43 +0100235 .name = "mach-bast",
Ben Dooks6ddc4b02008-04-16 00:06:14 +0100236 .suspend = bast_pm_suspend,
237 .resume = bast_pm_resume,
238};
239
240static struct sys_device bast_pm_sysdev = {
241 .cls = &bast_pm_sysclass,
242};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243
244static int smartmedia_map[] = { 0 };
245static int chip0_map[] = { 1 };
246static int chip1_map[] = { 2 };
247static int chip2_map[] = { 3 };
248
Ben Dooks9f693d72005-10-12 19:58:07 +0100249static struct mtd_partition bast_default_nand_part[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 [0] = {
251 .name = "Boot Agent",
252 .size = SZ_16K,
Ben Dooksb526bf22005-11-16 15:05:12 +0000253 .offset = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 },
255 [1] = {
256 .name = "/boot",
257 .size = SZ_4M - SZ_16K,
258 .offset = SZ_16K,
259 },
260 [2] = {
261 .name = "user",
262 .offset = SZ_4M,
263 .size = MTDPART_SIZ_FULL,
264 }
265};
266
267/* the bast has 4 selectable slots for nand-flash, the three
268 * on-board chip areas, as well as the external SmartMedia
269 * slot.
270 *
271 * Note, there is no current hot-plug support for the SmartMedia
272 * socket.
273*/
274
275static struct s3c2410_nand_set bast_nand_sets[] = {
276 [0] = {
277 .name = "SmartMedia",
278 .nr_chips = 1,
279 .nr_map = smartmedia_map,
280 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
Ben Dooksb526bf22005-11-16 15:05:12 +0000281 .partitions = bast_default_nand_part,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 },
283 [1] = {
284 .name = "chip0",
285 .nr_chips = 1,
286 .nr_map = chip0_map,
287 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
Ben Dooksb526bf22005-11-16 15:05:12 +0000288 .partitions = bast_default_nand_part,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 },
290 [2] = {
291 .name = "chip1",
292 .nr_chips = 1,
293 .nr_map = chip1_map,
294 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
Ben Dooksb526bf22005-11-16 15:05:12 +0000295 .partitions = bast_default_nand_part,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 },
297 [3] = {
298 .name = "chip2",
299 .nr_chips = 1,
300 .nr_map = chip2_map,
301 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
Ben Dooksb526bf22005-11-16 15:05:12 +0000302 .partitions = bast_default_nand_part,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 }
304};
305
306static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
307{
308 unsigned int tmp;
309
310 slot = set->nr_map[slot] & 3;
311
312 pr_debug("bast_nand: selecting slot %d (set %p,%p)\n",
313 slot, set, set->nr_map);
314
315 tmp = __raw_readb(BAST_VA_CTRL2);
316 tmp &= BAST_CPLD_CTLR2_IDERST;
317 tmp |= slot;
318 tmp |= BAST_CPLD_CTRL2_WNAND;
319
320 pr_debug("bast_nand: ctrl2 now %02x\n", tmp);
321
322 __raw_writeb(tmp, BAST_VA_CTRL2);
323}
324
325static struct s3c2410_platform_nand bast_nand_info = {
Ben Dooksb048dbf2005-10-20 23:21:19 +0100326 .tacls = 30,
327 .twrph0 = 60,
328 .twrph1 = 60,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 .nr_sets = ARRAY_SIZE(bast_nand_sets),
330 .sets = bast_nand_sets,
331 .select_chip = bast_nand_select,
332};
333
Ben Dooksd97a6662005-06-23 21:56:47 +0100334/* DM9000 */
335
336static struct resource bast_dm9k_resource[] = {
337 [0] = {
338 .start = S3C2410_CS5 + BAST_PA_DM9000,
339 .end = S3C2410_CS5 + BAST_PA_DM9000 + 3,
Ben Dooksb526bf22005-11-16 15:05:12 +0000340 .flags = IORESOURCE_MEM,
Ben Dooksd97a6662005-06-23 21:56:47 +0100341 },
342 [1] = {
343 .start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
344 .end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
Ben Dooksb526bf22005-11-16 15:05:12 +0000345 .flags = IORESOURCE_MEM,
Ben Dooksd97a6662005-06-23 21:56:47 +0100346 },
347 [2] = {
348 .start = IRQ_DM9000,
349 .end = IRQ_DM9000,
Ben Dooks9cf345e2008-07-03 11:24:22 +0100350 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
Ben Dooksd97a6662005-06-23 21:56:47 +0100351 }
352
353};
354
355/* for the moment we limit ourselves to 16bit IO until some
356 * better IO routines can be written and tested
357*/
358
Ben Dooks9f693d72005-10-12 19:58:07 +0100359static struct dm9000_plat_data bast_dm9k_platdata = {
Ben Dooksb526bf22005-11-16 15:05:12 +0000360 .flags = DM9000_PLATF_16BITONLY,
Ben Dooksd97a6662005-06-23 21:56:47 +0100361};
362
363static struct platform_device bast_device_dm9k = {
364 .name = "dm9000",
365 .id = 0,
366 .num_resources = ARRAY_SIZE(bast_dm9k_resource),
367 .resource = bast_dm9k_resource,
368 .dev = {
369 .platform_data = &bast_dm9k_platdata,
370 }
371};
372
Ben Dooks65cc3372005-07-18 10:24:32 +0100373/* serial devices */
374
375#define SERIAL_BASE (S3C2410_CS2 + BAST_PA_SUPERIO)
376#define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ)
377#define SERIAL_CLK (1843200)
378
379static struct plat_serial8250_port bast_sio_data[] = {
380 [0] = {
381 .mapbase = SERIAL_BASE + 0x2f8,
382 .irq = IRQ_PCSERIAL1,
383 .flags = SERIAL_FLAGS,
384 .iotype = UPIO_MEM,
385 .regshift = 0,
386 .uartclk = SERIAL_CLK,
387 },
388 [1] = {
389 .mapbase = SERIAL_BASE + 0x3f8,
390 .irq = IRQ_PCSERIAL2,
391 .flags = SERIAL_FLAGS,
392 .iotype = UPIO_MEM,
393 .regshift = 0,
394 .uartclk = SERIAL_CLK,
395 },
396 { }
397};
398
399static struct platform_device bast_sio = {
400 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100401 .id = PLAT8250_DEV_PLATFORM,
Ben Dooks65cc3372005-07-18 10:24:32 +0100402 .dev = {
403 .platform_data = &bast_sio_data,
404 },
405};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406
Ben Dooks1fcf8442005-08-03 19:49:16 +0100407/* we have devices on the bus which cannot work much over the
408 * standard 100KHz i2c bus frequency
409*/
410
Ben Dooks3e1b7762008-10-31 16:14:40 +0000411static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
Ben Dooks1fcf8442005-08-03 19:49:16 +0100412 .flags = 0,
413 .slave_addr = 0x10,
Daniel Silverstonec564e6a2009-03-13 13:53:46 +0000414 .frequency = 100*1000,
Ben Dooks1fcf8442005-08-03 19:49:16 +0100415};
416
Ben Dooks5ce4b1f2007-07-12 10:44:53 +0100417/* Asix AX88796 10/100 ethernet controller */
418
419static struct ax_plat_data bast_asix_platdata = {
420 .flags = AXFLG_MAC_FROMDEV,
421 .wordlength = 2,
422 .dcr_val = 0x48,
423 .rcr_val = 0x40,
424};
425
426static struct resource bast_asix_resource[] = {
427 [0] = {
428 .start = S3C2410_CS5 + BAST_PA_ASIXNET,
429 .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20) - 1,
430 .flags = IORESOURCE_MEM,
431 },
432 [1] = {
433 .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20),
434 .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20),
435 .flags = IORESOURCE_MEM,
436 },
437 [2] = {
438 .start = IRQ_ASIX,
439 .end = IRQ_ASIX,
440 .flags = IORESOURCE_IRQ
441 }
442};
443
444static struct platform_device bast_device_asix = {
445 .name = "ax88796",
446 .id = 0,
447 .num_resources = ARRAY_SIZE(bast_asix_resource),
448 .resource = bast_asix_resource,
449 .dev = {
450 .platform_data = &bast_asix_platdata
451 }
452};
453
454/* Asix AX88796 10/100 ethernet controller parallel port */
455
456static struct resource bast_asixpp_resource[] = {
457 [0] = {
458 .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20),
459 .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1b * 0x20) - 1,
460 .flags = IORESOURCE_MEM,
461 }
462};
463
464static struct platform_device bast_device_axpp = {
465 .name = "ax88796-pp",
466 .id = 0,
467 .num_resources = ARRAY_SIZE(bast_asixpp_resource),
468 .resource = bast_asixpp_resource,
469};
470
471/* LCD/VGA controller */
Ben Dooks58c8d572005-10-28 15:31:46 +0100472
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700473static struct s3c2410fb_display __initdata bast_lcd_info[] = {
474 {
Krzysztof Helt1f411532007-10-16 01:28:57 -0700475 .type = S3C2410_LCDCON1_TFT,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700476 .width = 640,
477 .height = 480,
Krzysztof Helt5f20f692007-10-16 01:28:59 -0700478
Krzysztof Helt69816692007-10-16 01:29:06 -0700479 .pixclock = 33333,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700480 .xres = 640,
481 .yres = 480,
482 .bpp = 4,
Krzysztof Helt1f411532007-10-16 01:28:57 -0700483 .left_margin = 40,
484 .right_margin = 20,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700485 .hsync_len = 88,
Krzysztof Helt5f20f692007-10-16 01:28:59 -0700486 .upper_margin = 30,
487 .lower_margin = 32,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700488 .vsync_len = 3,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700489
Krzysztof Heltf28ef572007-10-16 01:28:58 -0700490 .lcdcon5 = 0x00014b02,
Ben Dooks58c8d572005-10-28 15:31:46 +0100491 },
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700492 {
Krzysztof Helt1f411532007-10-16 01:28:57 -0700493 .type = S3C2410_LCDCON1_TFT,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700494 .width = 640,
495 .height = 480,
Ben Dooks58c8d572005-10-28 15:31:46 +0100496
Krzysztof Helt69816692007-10-16 01:29:06 -0700497 .pixclock = 33333,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700498 .xres = 640,
499 .yres = 480,
500 .bpp = 8,
Krzysztof Helt1f411532007-10-16 01:28:57 -0700501 .left_margin = 40,
502 .right_margin = 20,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700503 .hsync_len = 88,
Krzysztof Helt5f20f692007-10-16 01:28:59 -0700504 .upper_margin = 30,
505 .lower_margin = 32,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700506 .vsync_len = 3,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700507
Krzysztof Heltf28ef572007-10-16 01:28:58 -0700508 .lcdcon5 = 0x00014b02,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700509 },
510 {
Krzysztof Helt1f411532007-10-16 01:28:57 -0700511 .type = S3C2410_LCDCON1_TFT,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700512 .width = 640,
513 .height = 480,
514
Krzysztof Helt69816692007-10-16 01:29:06 -0700515 .pixclock = 33333,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700516 .xres = 640,
517 .yres = 480,
518 .bpp = 16,
Krzysztof Helt1f411532007-10-16 01:28:57 -0700519 .left_margin = 40,
520 .right_margin = 20,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700521 .hsync_len = 88,
Krzysztof Helt5f20f692007-10-16 01:28:59 -0700522 .upper_margin = 30,
523 .lower_margin = 32,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700524 .vsync_len = 3,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700525
Krzysztof Heltf28ef572007-10-16 01:28:58 -0700526 .lcdcon5 = 0x00014b02,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700527 },
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700528};
529
530/* LCD/VGA controller */
531
532static struct s3c2410fb_mach_info __initdata bast_fb_info = {
533
534 .displays = bast_lcd_info,
535 .num_displays = ARRAY_SIZE(bast_lcd_info),
Ben Dooks9cbae122007-12-23 03:09:38 +0100536 .default_display = 1,
Ben Dooks58c8d572005-10-28 15:31:46 +0100537};
538
Ben Dooks042cf0f2008-07-03 11:24:41 +0100539/* I2C devices fitted. */
540
541static struct i2c_board_info bast_i2c_devs[] __initdata = {
542 {
543 I2C_BOARD_INFO("tlv320aic23", 0x1a),
544 }, {
545 I2C_BOARD_INFO("simtec-pmu", 0x6b),
546 }, {
547 I2C_BOARD_INFO("ch7013", 0x75),
548 },
549};
Ben Dooksb7a12d12008-07-03 11:24:37 +0100550
Ben Dooks885f9eb2009-07-18 10:12:26 +0100551static struct s3c_hwmon_pdata bast_hwmon_info = {
552 /* LCD contrast (0-6.6V) */
553 .in[0] = &(struct s3c_hwmon_chcfg) {
554 .name = "lcd-contrast",
555 .mult = 3300,
556 .div = 512,
557 },
558 /* LED current feedback */
559 .in[1] = &(struct s3c_hwmon_chcfg) {
560 .name = "led-feedback",
561 .mult = 3300,
562 .div = 1024,
563 },
564 /* LCD feedback (0-6.6V) */
565 .in[2] = &(struct s3c_hwmon_chcfg) {
566 .name = "lcd-feedback",
567 .mult = 3300,
568 .div = 512,
569 },
570 /* Vcore (1.8-2.0V), Vref 3.3V */
571 .in[3] = &(struct s3c_hwmon_chcfg) {
572 .name = "vcore",
573 .mult = 3300,
574 .div = 1024,
575 },
576};
577
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578/* Standard BAST devices */
Ben Dooks885f9eb2009-07-18 10:12:26 +0100579// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580
581static struct platform_device *bast_devices[] __initdata = {
582 &s3c_device_usb,
583 &s3c_device_lcd,
584 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000585 &s3c_device_i2c0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 &s3c_device_rtc,
587 &s3c_device_nand,
Ben Dooks885f9eb2009-07-18 10:12:26 +0100588 &s3c_device_adc,
589 &s3c_device_hwmon,
Ben Dooksd97a6662005-06-23 21:56:47 +0100590 &bast_device_dm9k,
Ben Dooks5ce4b1f2007-07-12 10:44:53 +0100591 &bast_device_asix,
592 &bast_device_axpp,
Ben Dooks65cc3372005-07-18 10:24:32 +0100593 &bast_sio,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594};
595
Ben Dooks2bc75092008-07-15 17:17:48 +0100596static struct clk *bast_clocks[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 &s3c24xx_dclk0,
598 &s3c24xx_dclk1,
599 &s3c24xx_clkout0,
600 &s3c24xx_clkout1,
601 &s3c24xx_uclk,
602};
603
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100604static void __init bast_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605{
606 /* initialise the clocks */
607
Ben Dooksd96a9802008-04-16 00:12:39 +0100608 s3c24xx_dclk0.parent = &clk_upll;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 s3c24xx_dclk0.rate = 12*1000*1000;
610
Ben Dooksd96a9802008-04-16 00:12:39 +0100611 s3c24xx_dclk1.parent = &clk_upll;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 s3c24xx_dclk1.rate = 24*1000*1000;
613
614 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
615 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
616
617 s3c24xx_uclk.parent = &s3c24xx_clkout1;
618
Ben Dooksce89c202007-04-20 11:15:27 +0100619 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
620
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 s3c_device_nand.dev.platform_data = &bast_nand_info;
Ben Dooks885f9eb2009-07-18 10:12:26 +0100622 s3c_device_hwmon.dev.platform_data = &bast_hwmon_info;
Ben Dooks3e1b7762008-10-31 16:14:40 +0000623
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
625 s3c24xx_init_clocks(0);
626 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627}
628
Ben Dooks58c8d572005-10-28 15:31:46 +0100629static void __init bast_init(void)
630{
Ben Dooks6ddc4b02008-04-16 00:06:14 +0100631 sysdev_class_register(&bast_pm_sysclass);
632 sysdev_register(&bast_pm_sysdev);
633
Ben Dooksa8af6de2009-05-15 14:57:09 +0100634 s3c_i2c0_set_platdata(&bast_i2c_info);
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700635 s3c24xx_fb_set_platdata(&bast_fb_info);
Ben Dooks57e51712007-04-20 11:19:16 +0100636 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
Ben Dooks9d529c62008-07-03 11:24:39 +0100637
Ben Dooks042cf0f2008-07-03 11:24:41 +0100638 i2c_register_board_info(0, bast_i2c_devs,
639 ARRAY_SIZE(bast_i2c_devs));
640
Ben Dooks7a05a2c2009-05-18 20:15:01 +0100641 usb_simtec_init();
Ben Dooks9d529c62008-07-03 11:24:39 +0100642 nor_simtec_init();
Ben Dooks58c8d572005-10-28 15:31:46 +0100643}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644
645MACHINE_START(BAST, "Simtec-BAST")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100646 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100647 .phys_io = S3C2410_PA_UART,
648 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
649 .boot_params = S3C2410_SDRAM_PA + 0x100,
Ben Dooksf705b1a2005-06-29 11:09:15 +0100650 .map_io = bast_map_io,
651 .init_irq = s3c24xx_init_irq,
Ben Dooks58c8d572005-10-28 15:31:46 +0100652 .init_machine = bast_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 .timer = &s3c24xx_timer,
654MACHINE_END