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> |
| 21 | #include <linux/serial_core.h> |
| 22 | #include <linux/types.h> |
| 23 | |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/map.h> |
| 27 | |
| 28 | #include <mach/map.h> |
| 29 | #include <mach/regs-gpio.h> |
| 30 | #include <mach/regs-srom.h> |
| 31 | #include <mach/s3c6410.h> |
| 32 | |
| 33 | #include <plat/cpu.h> |
| 34 | #include <plat/devs.h> |
| 35 | #include <plat/regs-serial.h> |
| 36 | |
| 37 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) |
| 38 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) |
| 39 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) |
| 40 | |
| 41 | static struct s3c2410_uartcfg mini6410_uartcfgs[] __initdata = { |
| 42 | [0] = { |
| 43 | .hwport = 0, |
| 44 | .flags = 0, |
| 45 | .ucon = UCON, |
| 46 | .ulcon = ULCON, |
| 47 | .ufcon = UFCON, |
| 48 | }, |
| 49 | [1] = { |
| 50 | .hwport = 1, |
| 51 | .flags = 0, |
| 52 | .ucon = UCON, |
| 53 | .ulcon = ULCON, |
| 54 | .ufcon = UFCON, |
| 55 | }, |
| 56 | [2] = { |
| 57 | .hwport = 2, |
| 58 | .flags = 0, |
| 59 | .ucon = UCON, |
| 60 | .ulcon = ULCON, |
| 61 | .ufcon = UFCON, |
| 62 | }, |
| 63 | [3] = { |
| 64 | .hwport = 3, |
| 65 | .flags = 0, |
| 66 | .ucon = UCON, |
| 67 | .ulcon = ULCON, |
| 68 | .ufcon = UFCON, |
| 69 | }, |
| 70 | }; |
| 71 | |
| 72 | /* DM9000AEP 10/100 ethernet controller */ |
| 73 | |
| 74 | static struct resource mini6410_dm9k_resource[] = { |
| 75 | [0] = { |
| 76 | .start = S3C64XX_PA_XM0CSN1, |
| 77 | .end = S3C64XX_PA_XM0CSN1 + 1, |
| 78 | .flags = IORESOURCE_MEM |
| 79 | }, |
| 80 | [1] = { |
| 81 | .start = S3C64XX_PA_XM0CSN1 + 4, |
| 82 | .end = S3C64XX_PA_XM0CSN1 + 5, |
| 83 | .flags = IORESOURCE_MEM |
| 84 | }, |
| 85 | [2] = { |
| 86 | .start = S3C_EINT(7), |
| 87 | .end = S3C_EINT(7), |
| 88 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL |
| 89 | } |
| 90 | }; |
| 91 | |
| 92 | static struct dm9000_plat_data mini6410_dm9k_pdata = { |
| 93 | .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), |
| 94 | }; |
| 95 | |
| 96 | static struct platform_device mini6410_device_eth = { |
| 97 | .name = "dm9000", |
| 98 | .id = -1, |
| 99 | .num_resources = ARRAY_SIZE(mini6410_dm9k_resource), |
| 100 | .resource = mini6410_dm9k_resource, |
| 101 | .dev = { |
| 102 | .platform_data = &mini6410_dm9k_pdata, |
| 103 | }, |
| 104 | }; |
| 105 | |
| 106 | static struct platform_device *mini6410_devices[] __initdata = { |
| 107 | &mini6410_device_eth, |
| 108 | &s3c_device_hsmmc0, |
| 109 | &s3c_device_hsmmc1, |
| 110 | &s3c_device_ohci, |
| 111 | }; |
| 112 | |
| 113 | static void __init mini6410_map_io(void) |
| 114 | { |
| 115 | s3c64xx_init_io(NULL, 0); |
| 116 | s3c24xx_init_clocks(12000000); |
| 117 | s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); |
| 118 | } |
| 119 | |
| 120 | static void __init mini6410_machine_init(void) |
| 121 | { |
| 122 | u32 cs1; |
| 123 | |
| 124 | /* configure nCS1 width to 16 bits */ |
| 125 | |
| 126 | cs1 = __raw_readl(S3C64XX_SROM_BW) & |
| 127 | ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT); |
| 128 | cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) | |
| 129 | (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) | |
| 130 | (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) << |
| 131 | S3C64XX_SROM_BW__NCS1__SHIFT; |
| 132 | __raw_writel(cs1, S3C64XX_SROM_BW); |
| 133 | |
| 134 | /* set timing for nCS1 suitable for ethernet chip */ |
| 135 | |
| 136 | __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) | |
| 137 | (6 << S3C64XX_SROM_BCX__TACP__SHIFT) | |
| 138 | (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) | |
| 139 | (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) | |
| 140 | (13 << S3C64XX_SROM_BCX__TACC__SHIFT) | |
| 141 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | |
| 142 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); |
| 143 | |
| 144 | platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices)); |
| 145 | } |
| 146 | |
| 147 | MACHINE_START(MINI6410, "MINI6410") |
| 148 | /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */ |
| 149 | .boot_params = S3C64XX_PA_SDRAM + 0x100, |
| 150 | .init_irq = s3c6410_init_irq, |
| 151 | .map_io = mini6410_map_io, |
| 152 | .init_machine = mini6410_machine_init, |
| 153 | .timer = &s3c24xx_timer, |
| 154 | MACHINE_END |