1 /* linux/arch/arm/mach-s3c2440/mach-anubis.c
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/interrupt.h>
15 #include <linux/list.h>
16 #include <linux/timer.h>
17 #include <linux/init.h>
18 #include <linux/serial_core.h>
19 #include <linux/platform_device.h>
21 #include <linux/sm501.h>
22 #include <linux/sm501-regs.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
28 #include <asm/arch/anubis-map.h>
29 #include <asm/arch/anubis-irq.h>
30 #include <asm/arch/anubis-cpld.h>
32 #include <asm/hardware.h>
35 #include <asm/mach-types.h>
37 #include <asm/arch/regs-serial.h>
38 #include <asm/arch/regs-gpio.h>
39 #include <asm/arch/regs-mem.h>
40 #include <asm/arch/regs-lcd.h>
41 #include <asm/arch/nand.h>
43 #include <linux/mtd/mtd.h>
44 #include <linux/mtd/nand.h>
45 #include <linux/mtd/nand_ecc.h>
46 #include <linux/mtd/partitions.h>
48 #include <net/ax88796.h>
50 #include <asm/plat-s3c24xx/clock.h>
51 #include <asm/plat-s3c24xx/devs.h>
52 #include <asm/plat-s3c24xx/cpu.h>
54 #define COPYRIGHT ", (c) 2005 Simtec Electronics"
56 static struct map_desc anubis_iodesc[] __initdata = {
60 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
61 .pfn = __phys_to_pfn(0x0),
65 .virtual = (u32)S3C24XX_VA_ISA_WORD,
66 .pfn = __phys_to_pfn(0x0),
71 /* we could possibly compress the next set down into a set of smaller tables
72 * pagetables, but that would mean using an L2 section, and it still means
73 * we cannot actually feed the same register to an LDR due to 16K spacing
76 /* CPLD control registers */
79 .virtual = (u32)ANUBIS_VA_CTRL1,
80 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL1),
84 .virtual = (u32)ANUBIS_VA_IDREG,
85 .pfn = __phys_to_pfn(ANUBIS_PA_IDREG),
91 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
92 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
93 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
95 static struct s3c24xx_uart_clksrc anubis_serial_clocks[] = {
111 static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
118 .clocks = anubis_serial_clocks,
119 .clocks_size = ARRAY_SIZE(anubis_serial_clocks),
127 .clocks = anubis_serial_clocks,
128 .clocks_size = ARRAY_SIZE(anubis_serial_clocks),
132 /* NAND Flash on Anubis board */
134 static int external_map[] = { 2 };
135 static int chip0_map[] = { 0 };
136 static int chip1_map[] = { 1 };
138 static struct mtd_partition anubis_default_nand_part[] = {
140 .name = "Boot Agent",
146 .size = SZ_4M - SZ_16K,
152 .size = SZ_32M - SZ_4M,
157 .size = MTDPART_SIZ_FULL,
161 static struct mtd_partition anubis_default_nand_part_large[] = {
163 .name = "Boot Agent",
169 .size = SZ_4M - SZ_128K,
175 .size = SZ_32M - SZ_4M,
180 .size = MTDPART_SIZ_FULL,
184 /* the Anubis has 3 selectable slots for nand-flash, the two
185 * on-board chip areas, as well as the external slot.
187 * Note, there is no current hot-plug support for the External
191 static struct s3c2410_nand_set anubis_nand_sets[] = {
195 .nr_map = external_map,
196 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
197 .partitions = anubis_default_nand_part,
203 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
204 .partitions = anubis_default_nand_part,
210 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
211 .partitions = anubis_default_nand_part,
215 static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
219 slot = set->nr_map[slot] & 3;
221 pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
222 slot, set, set->nr_map);
224 tmp = __raw_readb(ANUBIS_VA_CTRL1);
225 tmp &= ~ANUBIS_CTRL1_NANDSEL;
228 pr_debug("anubis_nand: ctrl1 now %02x\n", tmp);
230 __raw_writeb(tmp, ANUBIS_VA_CTRL1);
233 static struct s3c2410_platform_nand anubis_nand_info = {
237 .nr_sets = ARRAY_SIZE(anubis_nand_sets),
238 .sets = anubis_nand_sets,
239 .select_chip = anubis_nand_select,
244 static struct resource anubis_ide0_resource[] = {
246 .start = S3C2410_CS3,
247 .end = S3C2410_CS3 + (8*32) - 1,
248 .flags = IORESOURCE_MEM,
250 .start = S3C2410_CS3 + (1<<26),
251 .end = S3C2410_CS3 + (1<<26) + (8*32) - 1,
252 .flags = IORESOURCE_MEM,
256 .flags = IORESOURCE_IRQ,
260 static struct platform_device anubis_device_ide0 = {
261 .name = "simtec-ide",
263 .num_resources = ARRAY_SIZE(anubis_ide0_resource),
264 .resource = anubis_ide0_resource,
267 static struct resource anubis_ide1_resource[] = {
269 .start = S3C2410_CS4,
270 .end = S3C2410_CS4 + (8*32) - 1,
271 .flags = IORESOURCE_MEM,
273 .start = S3C2410_CS4 + (1<<26),
274 .end = S3C2410_CS4 + (1<<26) + (8*32) - 1,
275 .flags = IORESOURCE_MEM,
279 .flags = IORESOURCE_IRQ,
284 static struct platform_device anubis_device_ide1 = {
285 .name = "simtec-ide",
287 .num_resources = ARRAY_SIZE(anubis_ide1_resource),
288 .resource = anubis_ide1_resource,
291 /* Asix AX88796 10/100 ethernet controller */
293 static struct ax_plat_data anubis_asix_platdata = {
294 .flags = AXFLG_MAC_FROMDEV,
300 static struct resource anubis_asix_resource[] = {
302 .start = S3C2410_CS5,
303 .end = S3C2410_CS5 + (0x20 * 0x20) -1,
304 .flags = IORESOURCE_MEM
309 .flags = IORESOURCE_IRQ
313 static struct platform_device anubis_device_asix = {
316 .num_resources = ARRAY_SIZE(anubis_asix_resource),
317 .resource = anubis_asix_resource,
319 .platform_data = &anubis_asix_platdata,
325 static struct resource anubis_sm501_resource[] = {
327 .start = S3C2410_CS2,
328 .end = S3C2410_CS2 + SZ_8M,
329 .flags = IORESOURCE_MEM,
332 .start = S3C2410_CS2 + SZ_64M - SZ_2M,
333 .end = S3C2410_CS2 + SZ_64M - 1,
334 .flags = IORESOURCE_MEM,
339 .flags = IORESOURCE_IRQ,
343 static struct sm501_initdata anubis_sm501_initdata = {
345 .set = 0x3F000000, /* 24bit panel */
349 .set = 0x010100, /* SDRAM timing */
353 .set = SM501_MISC_PNL_24BIT,
357 /* set the SDRAM and bus clocks */
362 static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = {
373 static struct sm501_platdata anubis_sm501_platdata = {
374 .init = &anubis_sm501_initdata,
375 .gpio_i2c = anubis_sm501_gpio_i2c,
376 .gpio_i2c_nr = ARRAY_SIZE(anubis_sm501_gpio_i2c),
379 static struct platform_device anubis_device_sm501 = {
382 .num_resources = ARRAY_SIZE(anubis_sm501_resource),
383 .resource = anubis_sm501_resource,
385 .platform_data = &anubis_sm501_platdata,
389 /* Standard Anubis devices */
391 static struct platform_device *anubis_devices[] __initdata = {
401 &anubis_device_sm501,
404 static struct clk *anubis_clocks[] = {
412 static void __init anubis_map_io(void)
414 /* initialise the clocks */
416 s3c24xx_dclk0.parent = NULL;
417 s3c24xx_dclk0.rate = 12*1000*1000;
419 s3c24xx_dclk1.parent = NULL;
420 s3c24xx_dclk1.rate = 24*1000*1000;
422 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
423 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
425 s3c24xx_uclk.parent = &s3c24xx_clkout1;
427 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
429 s3c_device_nand.dev.platform_data = &anubis_nand_info;
431 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
432 s3c24xx_init_clocks(0);
433 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
435 /* check for the newer revision boards with large page nand */
437 if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) {
438 printk(KERN_INFO "ANUBIS-B detected (revision %d)\n",
439 __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK);
440 anubis_nand_sets[0].partitions = anubis_default_nand_part_large;
441 anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large);
443 /* ensure that the GPIO is setup */
444 s3c2410_gpio_setpin(S3C2410_GPA0, 1);
448 static void __init anubis_init(void)
450 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
454 MACHINE_START(ANUBIS, "Simtec-Anubis")
455 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
456 .phys_io = S3C2410_PA_UART,
457 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
458 .boot_params = S3C2410_SDRAM_PA + 0x100,
459 .map_io = anubis_map_io,
460 .init_machine = anubis_init,
461 .init_irq = s3c24xx_init_irq,
462 .timer = &s3c24xx_timer,