Darius Augulis | e9debd9 | 2010-10-21 07:42:29 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c64xx/mach-mini6410.c |
| 2 | * |
| 3 | * Copyright 2010 Darius Augulis <augulis.darius@gmail.com> |
| 4 | * Copyright 2008 Openmoko, Inc. |
| 5 | * Copyright 2008 Simtec Electronics |
| 6 | * Ben Dooks <ben@simtec.co.uk> |
| 7 | * http://armlinux.simtec.co.uk/ |
| 8 | * |
| 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. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/gpio.h> |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/list.h> |
| 20 | #include <linux/dm9000.h> |
Darius Augulis | 1c5d76e | 2010-10-19 16:04:16 +0900 | [diff] [blame^] | 21 | #include <linux/mtd/mtd.h> |
| 22 | #include <linux/mtd/partitions.h> |
Darius Augulis | e9debd9 | 2010-10-21 07:42:29 +0900 | [diff] [blame] | 23 | #include <linux/serial_core.h> |
| 24 | #include <linux/types.h> |
| 25 | |
| 26 | #include <asm/mach-types.h> |
| 27 | #include <asm/mach/arch.h> |
| 28 | #include <asm/mach/map.h> |
| 29 | |
| 30 | #include <mach/map.h> |
| 31 | #include <mach/regs-gpio.h> |
| 32 | #include <mach/regs-srom.h> |
| 33 | #include <mach/s3c6410.h> |
| 34 | |
| 35 | #include <plat/cpu.h> |
| 36 | #include <plat/devs.h> |
Darius Augulis | 1c5d76e | 2010-10-19 16:04:16 +0900 | [diff] [blame^] | 37 | #include <plat/nand.h> |
Darius Augulis | e9debd9 | 2010-10-21 07:42:29 +0900 | [diff] [blame] | 38 | #include <plat/regs-serial.h> |
| 39 | |
| 40 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) |
| 41 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) |
| 42 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) |
| 43 | |
| 44 | static struct s3c2410_uartcfg mini6410_uartcfgs[] __initdata = { |
| 45 | [0] = { |
| 46 | .hwport = 0, |
| 47 | .flags = 0, |
| 48 | .ucon = UCON, |
| 49 | .ulcon = ULCON, |
| 50 | .ufcon = UFCON, |
| 51 | }, |
| 52 | [1] = { |
| 53 | .hwport = 1, |
| 54 | .flags = 0, |
| 55 | .ucon = UCON, |
| 56 | .ulcon = ULCON, |
| 57 | .ufcon = UFCON, |
| 58 | }, |
| 59 | [2] = { |
| 60 | .hwport = 2, |
| 61 | .flags = 0, |
| 62 | .ucon = UCON, |
| 63 | .ulcon = ULCON, |
| 64 | .ufcon = UFCON, |
| 65 | }, |
| 66 | [3] = { |
| 67 | .hwport = 3, |
| 68 | .flags = 0, |
| 69 | .ucon = UCON, |
| 70 | .ulcon = ULCON, |
| 71 | .ufcon = UFCON, |
| 72 | }, |
| 73 | }; |
| 74 | |
| 75 | /* DM9000AEP 10/100 ethernet controller */ |
| 76 | |
| 77 | static struct resource mini6410_dm9k_resource[] = { |
| 78 | [0] = { |
| 79 | .start = S3C64XX_PA_XM0CSN1, |
| 80 | .end = S3C64XX_PA_XM0CSN1 + 1, |
| 81 | .flags = IORESOURCE_MEM |
| 82 | }, |
| 83 | [1] = { |
| 84 | .start = S3C64XX_PA_XM0CSN1 + 4, |
| 85 | .end = S3C64XX_PA_XM0CSN1 + 5, |
| 86 | .flags = IORESOURCE_MEM |
| 87 | }, |
| 88 | [2] = { |
| 89 | .start = S3C_EINT(7), |
| 90 | .end = S3C_EINT(7), |
| 91 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL |
| 92 | } |
| 93 | }; |
| 94 | |
| 95 | static struct dm9000_plat_data mini6410_dm9k_pdata = { |
| 96 | .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), |
| 97 | }; |
| 98 | |
| 99 | static struct platform_device mini6410_device_eth = { |
| 100 | .name = "dm9000", |
| 101 | .id = -1, |
| 102 | .num_resources = ARRAY_SIZE(mini6410_dm9k_resource), |
| 103 | .resource = mini6410_dm9k_resource, |
| 104 | .dev = { |
| 105 | .platform_data = &mini6410_dm9k_pdata, |
| 106 | }, |
| 107 | }; |
| 108 | |
Darius Augulis | 1c5d76e | 2010-10-19 16:04:16 +0900 | [diff] [blame^] | 109 | static struct mtd_partition mini6410_nand_part[] = { |
| 110 | [0] = { |
| 111 | .name = "uboot", |
| 112 | .size = SZ_1M, |
| 113 | .offset = 0, |
| 114 | }, |
| 115 | [1] = { |
| 116 | .name = "kernel", |
| 117 | .size = SZ_2M, |
| 118 | .offset = SZ_1M, |
| 119 | }, |
| 120 | [2] = { |
| 121 | .name = "rootfs", |
| 122 | .size = MTDPART_SIZ_FULL, |
| 123 | .offset = SZ_1M + SZ_2M, |
| 124 | }, |
| 125 | }; |
| 126 | |
| 127 | static struct s3c2410_nand_set mini6410_nand_sets[] = { |
| 128 | [0] = { |
| 129 | .name = "nand", |
| 130 | .nr_chips = 1, |
| 131 | .nr_partitions = ARRAY_SIZE(mini6410_nand_part), |
| 132 | .partitions = mini6410_nand_part, |
| 133 | }, |
| 134 | }; |
| 135 | |
| 136 | static struct s3c2410_platform_nand mini6410_nand_info = { |
| 137 | .tacls = 25, |
| 138 | .twrph0 = 55, |
| 139 | .twrph1 = 40, |
| 140 | .nr_sets = ARRAY_SIZE(mini6410_nand_sets), |
| 141 | .sets = mini6410_nand_sets, |
| 142 | }; |
| 143 | |
Darius Augulis | e9debd9 | 2010-10-21 07:42:29 +0900 | [diff] [blame] | 144 | static struct platform_device *mini6410_devices[] __initdata = { |
| 145 | &mini6410_device_eth, |
| 146 | &s3c_device_hsmmc0, |
| 147 | &s3c_device_hsmmc1, |
| 148 | &s3c_device_ohci, |
Darius Augulis | 1c5d76e | 2010-10-19 16:04:16 +0900 | [diff] [blame^] | 149 | &s3c_device_nand, |
Darius Augulis | e9debd9 | 2010-10-21 07:42:29 +0900 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | static void __init mini6410_map_io(void) |
| 153 | { |
| 154 | s3c64xx_init_io(NULL, 0); |
| 155 | s3c24xx_init_clocks(12000000); |
| 156 | s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); |
| 157 | } |
| 158 | |
| 159 | static void __init mini6410_machine_init(void) |
| 160 | { |
| 161 | u32 cs1; |
| 162 | |
Darius Augulis | 1c5d76e | 2010-10-19 16:04:16 +0900 | [diff] [blame^] | 163 | s3c_nand_set_platdata(&mini6410_nand_info); |
| 164 | |
Darius Augulis | e9debd9 | 2010-10-21 07:42:29 +0900 | [diff] [blame] | 165 | /* configure nCS1 width to 16 bits */ |
| 166 | |
| 167 | cs1 = __raw_readl(S3C64XX_SROM_BW) & |
| 168 | ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT); |
| 169 | cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) | |
| 170 | (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) | |
| 171 | (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) << |
| 172 | S3C64XX_SROM_BW__NCS1__SHIFT; |
| 173 | __raw_writel(cs1, S3C64XX_SROM_BW); |
| 174 | |
| 175 | /* set timing for nCS1 suitable for ethernet chip */ |
| 176 | |
| 177 | __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) | |
| 178 | (6 << S3C64XX_SROM_BCX__TACP__SHIFT) | |
| 179 | (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) | |
| 180 | (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) | |
| 181 | (13 << S3C64XX_SROM_BCX__TACC__SHIFT) | |
| 182 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | |
| 183 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); |
| 184 | |
| 185 | platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices)); |
| 186 | } |
| 187 | |
| 188 | MACHINE_START(MINI6410, "MINI6410") |
| 189 | /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */ |
| 190 | .boot_params = S3C64XX_PA_SDRAM + 0x100, |
| 191 | .init_irq = s3c6410_init_irq, |
| 192 | .map_io = mini6410_map_io, |
| 193 | .init_machine = mini6410_machine_init, |
| 194 | .timer = &s3c24xx_timer, |
| 195 | MACHINE_END |