1 // SPDX-License-Identifier: GPL-2.0
3 // Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
4 // Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
5 // and modifications by SBZ <sbz@spgui.org> and
6 // Weibing <http://weibing.blogbus.com>
8 // For product information, visit http://www.arm.com/
10 #include <linux/kernel.h>
11 #include <linux/types.h>
12 #include <linux/gpio/machine.h>
13 #include <linux/interrupt.h>
14 #include <linux/list.h>
15 #include <linux/timer.h>
16 #include <linux/init.h>
18 #include <linux/serial_core.h>
19 #include <linux/serial_s3c.h>
20 #include <linux/dm9000.h>
21 #include <linux/platform_device.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
27 #include <linux/platform_data/fb-s3c2410.h>
29 #include <asm/mach-types.h>
31 #include "regs-gpio.h"
32 #include "gpio-samsung.h"
33 #include <linux/platform_data/mtd-nand-s3c2410.h>
34 #include <linux/platform_data/i2c-s3c2410.h>
36 #include <linux/mtd/mtd.h>
37 #include <linux/mtd/rawnand.h>
38 #include <linux/mtd/nand-ecc-sw-hamming.h>
39 #include <linux/mtd/partitions.h>
43 #include <linux/platform_data/mmc-s3cmci.h>
47 static struct map_desc at2440evb_iodesc[] __initdata = {
51 #define UCON S3C2410_UCON_DEFAULT
52 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
53 #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
55 static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
62 .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
70 .clk_sel = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
74 /* NAND Flash on AT2440EVB board */
76 static struct mtd_partition __initdata at2440evb_default_nand_part[] = {
89 .offset = SZ_256K + SZ_2M,
90 .size = MTDPART_SIZ_FULL,
94 static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = {
98 .nr_partitions = ARRAY_SIZE(at2440evb_default_nand_part),
99 .partitions = at2440evb_default_nand_part,
103 static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
107 .nr_sets = ARRAY_SIZE(at2440evb_nand_sets),
108 .sets = at2440evb_nand_sets,
109 .engine_type = NAND_ECC_ENGINE_TYPE_SOFT,
112 /* DM9000AEP 10/100 ethernet controller */
114 static struct resource at2440evb_dm9k_resource[] = {
115 [0] = DEFINE_RES_MEM(S3C2410_CS3, 4),
116 [1] = DEFINE_RES_MEM(S3C2410_CS3 + 4, 4),
117 [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \
118 | IORESOURCE_IRQ_HIGHEDGE),
121 static struct dm9000_plat_data at2440evb_dm9k_pdata = {
122 .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
125 static struct platform_device at2440evb_device_eth = {
128 .num_resources = ARRAY_SIZE(at2440evb_dm9k_resource),
129 .resource = at2440evb_dm9k_resource,
131 .platform_data = &at2440evb_dm9k_pdata,
135 static struct s3c24xx_mci_pdata at2440evb_mci_pdata __initdata = {
136 .set_power = s3c24xx_mci_def_set_power,
139 static struct gpiod_lookup_table at2440evb_mci_gpio_table = {
140 .dev_id = "s3c2410-sdi",
142 /* Card detect S3C2410_GPG(10) */
143 GPIO_LOOKUP("GPIOG", 10, "cd", GPIO_ACTIVE_LOW),
145 GPIO_LOOKUP_IDX("GPIOE", 5, "bus", 0, GPIO_ACTIVE_HIGH),
146 GPIO_LOOKUP_IDX("GPIOE", 6, "bus", 1, GPIO_ACTIVE_HIGH),
147 GPIO_LOOKUP_IDX("GPIOE", 7, "bus", 2, GPIO_ACTIVE_HIGH),
148 GPIO_LOOKUP_IDX("GPIOE", 8, "bus", 3, GPIO_ACTIVE_HIGH),
149 GPIO_LOOKUP_IDX("GPIOE", 9, "bus", 4, GPIO_ACTIVE_HIGH),
150 GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
158 static struct s3c2410fb_display at2440evb_lcd_cfg __initdata = {
160 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
161 S3C2410_LCDCON5_INVVLINE |
162 S3C2410_LCDCON5_INVVFRAME |
163 S3C2410_LCDCON5_PWREN |
164 S3C2410_LCDCON5_HWSWP,
166 .type = S3C2410_LCDCON1_TFT,
171 .pixclock = 33333, /* HCLK 60 MHz, divisor 2 */
183 static struct s3c2410fb_mach_info at2440evb_fb_info __initdata = {
184 .displays = &at2440evb_lcd_cfg,
186 .default_display = 0,
189 static struct platform_device *at2440evb_devices[] __initdata = {
198 &at2440evb_device_eth,
201 static void __init at2440evb_map_io(void)
203 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
204 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
205 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
208 static void __init at2440evb_init_time(void)
210 s3c2440_init_clocks(16934400);
211 s3c24xx_timer_init();
214 static void __init at2440evb_init(void)
216 s3c24xx_fb_set_platdata(&at2440evb_fb_info);
217 gpiod_add_lookup_table(&at2440evb_mci_gpio_table);
218 s3c24xx_mci_set_platdata(&at2440evb_mci_pdata);
219 s3c_nand_set_platdata(&at2440evb_nand_info);
220 s3c_i2c0_set_platdata(NULL);
222 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
226 MACHINE_START(AT2440EVB, "AT2440EVB")
227 .atag_offset = 0x100,
228 .map_io = at2440evb_map_io,
229 .init_machine = at2440evb_init,
230 .init_irq = s3c2440_init_irq,
231 .init_time = at2440evb_init_time,