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 <asm/mach/arch.h>
22 #include <asm/mach/map.h>
23 #include <asm/mach/irq.h>
25 #include <asm/arch/anubis-map.h>
26 #include <asm/arch/anubis-irq.h>
27 #include <asm/arch/anubis-cpld.h>
29 #include <asm/hardware.h>
32 #include <asm/mach-types.h>
34 #include <asm/arch/regs-serial.h>
35 #include <asm/arch/regs-gpio.h>
36 #include <asm/arch/regs-mem.h>
37 #include <asm/arch/regs-lcd.h>
38 #include <asm/arch/nand.h>
40 #include <linux/mtd/mtd.h>
41 #include <linux/mtd/nand.h>
42 #include <linux/mtd/nand_ecc.h>
43 #include <linux/mtd/partitions.h>
45 #include <net/ax88796.h>
47 #include <asm/plat-s3c24xx/clock.h>
48 #include <asm/plat-s3c24xx/devs.h>
49 #include <asm/plat-s3c24xx/cpu.h>
51 #define COPYRIGHT ", (c) 2005 Simtec Electronics"
53 static struct map_desc anubis_iodesc[] __initdata = {
57 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
58 .pfn = __phys_to_pfn(0x0),
62 .virtual = (u32)S3C24XX_VA_ISA_WORD,
63 .pfn = __phys_to_pfn(0x0),
68 /* we could possibly compress the next set down into a set of smaller tables
69 * pagetables, but that would mean using an L2 section, and it still means
70 * we cannot actually feed the same register to an LDR due to 16K spacing
73 /* CPLD control registers */
76 .virtual = (u32)ANUBIS_VA_CTRL1,
77 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL1),
81 .virtual = (u32)ANUBIS_VA_IDREG,
82 .pfn = __phys_to_pfn(ANUBIS_PA_IDREG),
88 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
89 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
90 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
92 static struct s3c24xx_uart_clksrc anubis_serial_clocks[] = {
108 static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
115 .clocks = anubis_serial_clocks,
116 .clocks_size = ARRAY_SIZE(anubis_serial_clocks),
124 .clocks = anubis_serial_clocks,
125 .clocks_size = ARRAY_SIZE(anubis_serial_clocks),
129 /* NAND Flash on Anubis board */
131 static int external_map[] = { 2 };
132 static int chip0_map[] = { 0 };
133 static int chip1_map[] = { 1 };
135 static struct mtd_partition anubis_default_nand_part[] = {
137 .name = "Boot Agent",
143 .size = SZ_4M - SZ_16K,
149 .size = SZ_32M - SZ_4M,
154 .size = MTDPART_SIZ_FULL,
158 /* the Anubis has 3 selectable slots for nand-flash, the two
159 * on-board chip areas, as well as the external slot.
161 * Note, there is no current hot-plug support for the External
165 static struct s3c2410_nand_set anubis_nand_sets[] = {
169 .nr_map = external_map,
170 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
171 .partitions = anubis_default_nand_part,
177 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
178 .partitions = anubis_default_nand_part,
184 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
185 .partitions = anubis_default_nand_part,
189 static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
193 slot = set->nr_map[slot] & 3;
195 pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
196 slot, set, set->nr_map);
198 tmp = __raw_readb(ANUBIS_VA_CTRL1);
199 tmp &= ~ANUBIS_CTRL1_NANDSEL;
202 pr_debug("anubis_nand: ctrl1 now %02x\n", tmp);
204 __raw_writeb(tmp, ANUBIS_VA_CTRL1);
207 static struct s3c2410_platform_nand anubis_nand_info = {
211 .nr_sets = ARRAY_SIZE(anubis_nand_sets),
212 .sets = anubis_nand_sets,
213 .select_chip = anubis_nand_select,
218 static struct resource anubis_ide0_resource[] = {
220 .start = S3C2410_CS3,
221 .end = S3C2410_CS3 + (8*32) - 1,
222 .flags = IORESOURCE_MEM,
224 .start = S3C2410_CS3 + (1<<26),
225 .end = S3C2410_CS3 + (1<<26) + (8*32) - 1,
226 .flags = IORESOURCE_MEM,
230 .flags = IORESOURCE_IRQ,
234 static struct platform_device anubis_device_ide0 = {
235 .name = "simtec-ide",
237 .num_resources = ARRAY_SIZE(anubis_ide0_resource),
238 .resource = anubis_ide0_resource,
241 static struct resource anubis_ide1_resource[] = {
243 .start = S3C2410_CS4,
244 .end = S3C2410_CS4 + (8*32) - 1,
245 .flags = IORESOURCE_MEM,
247 .start = S3C2410_CS4 + (1<<26),
248 .end = S3C2410_CS4 + (1<<26) + (8*32) - 1,
249 .flags = IORESOURCE_MEM,
253 .flags = IORESOURCE_IRQ,
258 static struct platform_device anubis_device_ide1 = {
259 .name = "simtec-ide",
261 .num_resources = ARRAY_SIZE(anubis_ide1_resource),
262 .resource = anubis_ide1_resource,
265 /* Asix AX88796 10/100 ethernet controller */
267 static struct ax_plat_data anubis_asix_platdata = {
268 .flags = AXFLG_MAC_FROMDEV,
274 static struct resource anubis_asix_resource[] = {
276 .start = S3C2410_CS5,
277 .end = S3C2410_CS5 + (0x20 * 0x20) -1,
278 .flags = IORESOURCE_MEM
283 .flags = IORESOURCE_IRQ
287 static struct platform_device anubis_device_asix = {
290 .num_resources = ARRAY_SIZE(anubis_asix_resource),
291 .resource = anubis_asix_resource,
293 .platform_data = &anubis_asix_platdata,
297 /* Standard Anubis devices */
299 static struct platform_device *anubis_devices[] __initdata = {
311 static struct clk *anubis_clocks[] = {
319 static void __init anubis_map_io(void)
321 /* initialise the clocks */
323 s3c24xx_dclk0.parent = NULL;
324 s3c24xx_dclk0.rate = 12*1000*1000;
326 s3c24xx_dclk1.parent = NULL;
327 s3c24xx_dclk1.rate = 24*1000*1000;
329 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
330 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
332 s3c24xx_uclk.parent = &s3c24xx_clkout1;
334 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
336 s3c_device_nand.dev.platform_data = &anubis_nand_info;
338 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
339 s3c24xx_init_clocks(0);
340 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
342 /* ensure that the GPIO is setup */
343 s3c2410_gpio_setpin(S3C2410_GPA0, 1);
346 static void __init anubis_init(void)
348 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
352 MACHINE_START(ANUBIS, "Simtec-Anubis")
353 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
354 .phys_io = S3C2410_PA_UART,
355 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
356 .boot_params = S3C2410_SDRAM_PA + 0x100,
357 .map_io = anubis_map_io,
358 .init_machine = anubis_init,
359 .init_irq = s3c24xx_init_irq,
360 .timer = &s3c24xx_timer,