1 /* linux/arch/arm/mach-s3c2410/mach-anubis.c
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 * 02-May-2005 BJD Copied from mach-bast.c
17 #include <linux/kernel.h>
18 #include <linux/types.h>
19 #include <linux/interrupt.h>
20 #include <linux/list.h>
21 #include <linux/timer.h>
22 #include <linux/init.h>
23 #include <linux/device.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/irq.h>
29 #include <asm/arch/anubis-map.h>
30 #include <asm/arch/anubis-irq.h>
31 #include <asm/arch/anubis-cpld.h>
33 #include <asm/hardware.h>
36 #include <asm/mach-types.h>
38 #include <asm/arch/regs-serial.h>
39 #include <asm/arch/regs-gpio.h>
40 #include <asm/arch/regs-mem.h>
41 #include <asm/arch/regs-lcd.h>
42 #include <asm/arch/nand.h>
44 #include <linux/mtd/mtd.h>
45 #include <linux/mtd/nand.h>
46 #include <linux/mtd/nand_ecc.h>
47 #include <linux/mtd/partitions.h>
53 #define COPYRIGHT ", (c) 2005 Simtec Electronics"
55 static struct map_desc anubis_iodesc
[] __initdata
= {
58 { (u32
)S3C24XX_VA_ISA_BYTE
, 0x0, SZ_16M
, MT_DEVICE
},
59 { (u32
)S3C24XX_VA_ISA_WORD
, 0x0, SZ_16M
, MT_DEVICE
},
61 /* we could possibly compress the next set down into a set of smaller tables
62 * pagetables, but that would mean using an L2 section, and it still means
63 * we cannot actually feed the same register to an LDR due to 16K spacing
66 /* CPLD control registers */
68 { (u32
)ANUBIS_VA_CTRL1
, ANUBIS_PA_CTRL1
, SZ_4K
, MT_DEVICE
},
69 { (u32
)ANUBIS_VA_CTRL2
, ANUBIS_PA_CTRL2
, SZ_4K
, MT_DEVICE
},
73 { (u32
)ANUBIS_IDEPRI
, S3C2410_CS3
, SZ_1M
, MT_DEVICE
},
74 { (u32
)ANUBIS_IDEPRIAUX
, S3C2410_CS3
+(1<<26), SZ_1M
, MT_DEVICE
},
76 { (u32
)ANUBIS_IDESEC
, S3C2410_CS4
, SZ_1M
, MT_DEVICE
},
77 { (u32
)ANUBIS_IDESECAUX
, S3C2410_CS4
+(1<<26), SZ_1M
, MT_DEVICE
},
80 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
81 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
82 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
84 static struct s3c24xx_uart_clksrc anubis_serial_clocks
[] = {
100 static struct s3c2410_uartcfg anubis_uartcfgs
[] = {
107 .clocks
= anubis_serial_clocks
,
108 .clocks_size
= ARRAY_SIZE(anubis_serial_clocks
)
116 .clocks
= anubis_serial_clocks
,
117 .clocks_size
= ARRAY_SIZE(anubis_serial_clocks
)
121 /* NAND Flash on Anubis board */
123 static int external_map
[] = { 2 };
124 static int chip0_map
[] = { 0 };
125 static int chip1_map
[] = { 1 };
127 struct mtd_partition anubis_default_nand_part
[] = {
129 .name
= "Boot Agent",
135 .size
= SZ_4M
- SZ_16K
,
141 .size
= SZ_32M
- SZ_4M
,
146 .size
= MTDPART_SIZ_FULL
,
150 /* the Anubis has 3 selectable slots for nand-flash, the two
151 * on-board chip areas, as well as the external slot.
153 * Note, there is no current hot-plug support for the External
157 static struct s3c2410_nand_set anubis_nand_sets
[] = {
161 .nr_map
= external_map
,
162 .nr_partitions
= ARRAY_SIZE(anubis_default_nand_part
),
163 .partitions
= anubis_default_nand_part
169 .nr_partitions
= ARRAY_SIZE(anubis_default_nand_part
),
170 .partitions
= anubis_default_nand_part
176 .nr_partitions
= ARRAY_SIZE(anubis_default_nand_part
),
177 .partitions
= anubis_default_nand_part
181 static void anubis_nand_select(struct s3c2410_nand_set
*set
, int slot
)
185 slot
= set
->nr_map
[slot
] & 3;
187 pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
188 slot
, set
, set
->nr_map
);
190 tmp
= __raw_readb(ANUBIS_VA_CTRL1
);
191 tmp
&= ~ANUBIS_CTRL1_NANDSEL
;
194 pr_debug("anubis_nand: ctrl1 now %02x\n", tmp
);
196 __raw_writeb(tmp
, ANUBIS_VA_CTRL1
);
199 static struct s3c2410_platform_nand anubis_nand_info
= {
203 .nr_sets
= ARRAY_SIZE(anubis_nand_sets
),
204 .sets
= anubis_nand_sets
,
205 .select_chip
= anubis_nand_select
,
209 /* Standard Anubis devices */
211 static struct platform_device
*anubis_devices
[] __initdata
= {
220 static struct clk
*anubis_clocks
[] = {
228 static struct s3c24xx_board anubis_board __initdata
= {
229 .devices
= anubis_devices
,
230 .devices_count
= ARRAY_SIZE(anubis_devices
),
231 .clocks
= anubis_clocks
,
232 .clocks_count
= ARRAY_SIZE(anubis_clocks
)
235 void __init
anubis_map_io(void)
237 /* initialise the clocks */
239 s3c24xx_dclk0
.parent
= NULL
;
240 s3c24xx_dclk0
.rate
= 12*1000*1000;
242 s3c24xx_dclk1
.parent
= NULL
;
243 s3c24xx_dclk1
.rate
= 24*1000*1000;
245 s3c24xx_clkout0
.parent
= &s3c24xx_dclk0
;
246 s3c24xx_clkout1
.parent
= &s3c24xx_dclk1
;
248 s3c24xx_uclk
.parent
= &s3c24xx_clkout1
;
250 s3c_device_nand
.dev
.platform_data
= &anubis_nand_info
;
252 s3c24xx_init_io(anubis_iodesc
, ARRAY_SIZE(anubis_iodesc
));
253 s3c24xx_init_clocks(0);
254 s3c24xx_init_uarts(anubis_uartcfgs
, ARRAY_SIZE(anubis_uartcfgs
));
255 s3c24xx_set_board(&anubis_board
);
257 /* ensure that the GPIO is setup */
258 s3c2410_gpio_setpin(S3C2410_GPA0
, 1);
261 MACHINE_START(ANUBIS
, "Simtec-Anubis")
262 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
263 .phys_ram
= S3C2410_SDRAM_PA
,
264 .phys_io
= S3C2410_PA_UART
,
265 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
266 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
267 .map_io
= anubis_map_io
,
268 .init_irq
= s3c24xx_init_irq
,
269 .timer
= &s3c24xx_timer
,