Changhwan Youn | b1d69cc | 2010-07-16 12:18:36 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5pv310/mach-smdkv310.c |
| 2 | * |
| 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com/ |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/serial_core.h> |
Hyuk Lee | 2b11148 | 2010-10-06 14:50:20 +0900 | [diff] [blame] | 12 | #include <linux/gpio.h> |
| 13 | #include <linux/mmc/host.h> |
| 14 | #include <linux/platform_device.h> |
Changhwan Youn | b1d69cc | 2010-07-16 12:18:36 +0900 | [diff] [blame] | 15 | |
| 16 | #include <asm/mach/arch.h> |
| 17 | #include <asm/mach-types.h> |
| 18 | #include <asm/hardware/cache-l2x0.h> |
| 19 | |
| 20 | #include <plat/regs-serial.h> |
| 21 | #include <plat/s5pv310.h> |
| 22 | #include <plat/cpu.h> |
Changhwan Youn | cdff6e6 | 2010-09-20 15:25:51 +0900 | [diff] [blame] | 23 | #include <plat/devs.h> |
Hyuk Lee | 2b11148 | 2010-10-06 14:50:20 +0900 | [diff] [blame] | 24 | #include <plat/sdhci.h> |
Changhwan Youn | b1d69cc | 2010-07-16 12:18:36 +0900 | [diff] [blame] | 25 | |
| 26 | #include <mach/map.h> |
| 27 | |
| 28 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
| 29 | #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
| 30 | S3C2410_UCON_RXILEVEL | \ |
| 31 | S3C2410_UCON_TXIRQMODE | \ |
| 32 | S3C2410_UCON_RXIRQMODE | \ |
| 33 | S3C2410_UCON_RXFIFO_TOI | \ |
| 34 | S3C2443_UCON_RXERR_IRQEN) |
| 35 | |
| 36 | #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8 |
| 37 | |
| 38 | #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
| 39 | S5PV210_UFCON_TXTRIG4 | \ |
| 40 | S5PV210_UFCON_RXTRIG4) |
| 41 | |
| 42 | static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = { |
| 43 | [0] = { |
| 44 | .hwport = 0, |
| 45 | .flags = 0, |
| 46 | .ucon = SMDKV310_UCON_DEFAULT, |
| 47 | .ulcon = SMDKV310_ULCON_DEFAULT, |
| 48 | .ufcon = SMDKV310_UFCON_DEFAULT, |
| 49 | }, |
| 50 | [1] = { |
| 51 | .hwport = 1, |
| 52 | .flags = 0, |
| 53 | .ucon = SMDKV310_UCON_DEFAULT, |
| 54 | .ulcon = SMDKV310_ULCON_DEFAULT, |
| 55 | .ufcon = SMDKV310_UFCON_DEFAULT, |
| 56 | }, |
| 57 | [2] = { |
| 58 | .hwport = 2, |
| 59 | .flags = 0, |
| 60 | .ucon = SMDKV310_UCON_DEFAULT, |
| 61 | .ulcon = SMDKV310_ULCON_DEFAULT, |
| 62 | .ufcon = SMDKV310_UFCON_DEFAULT, |
| 63 | }, |
| 64 | [3] = { |
| 65 | .hwport = 3, |
| 66 | .flags = 0, |
| 67 | .ucon = SMDKV310_UCON_DEFAULT, |
| 68 | .ulcon = SMDKV310_ULCON_DEFAULT, |
| 69 | .ufcon = SMDKV310_UFCON_DEFAULT, |
| 70 | }, |
| 71 | }; |
| 72 | |
Hyuk Lee | 2b11148 | 2010-10-06 14:50:20 +0900 | [diff] [blame] | 73 | static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = { |
| 74 | .cd_type = S3C_SDHCI_CD_GPIO, |
| 75 | .ext_cd_gpio = S5PV310_GPK0(2), |
| 76 | .ext_cd_gpio_invert = 1, |
| 77 | #ifdef CONFIG_S5PV310_SDHCI_CH0_8BIT |
| 78 | .max_width = 8, |
| 79 | .host_caps = MMC_CAP_8_BIT_DATA, |
| 80 | #endif |
| 81 | }; |
| 82 | |
| 83 | static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = { |
| 84 | .cd_type = S3C_SDHCI_CD_GPIO, |
| 85 | .ext_cd_gpio = S5PV310_GPK0(2), |
| 86 | .ext_cd_gpio_invert = 1, |
| 87 | }; |
| 88 | |
| 89 | static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = { |
| 90 | .cd_type = S3C_SDHCI_CD_GPIO, |
| 91 | .ext_cd_gpio = S5PV310_GPK2(2), |
| 92 | .ext_cd_gpio_invert = 1, |
| 93 | #ifdef CONFIG_S5PV310_SDHCI_CH2_8BIT |
| 94 | .max_width = 8, |
| 95 | .host_caps = MMC_CAP_8_BIT_DATA, |
| 96 | #endif |
| 97 | }; |
| 98 | |
| 99 | static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = { |
| 100 | .cd_type = S3C_SDHCI_CD_GPIO, |
| 101 | .ext_cd_gpio = S5PV310_GPK2(2), |
| 102 | .ext_cd_gpio_invert = 1, |
| 103 | }; |
| 104 | |
Changhwan Youn | cdff6e6 | 2010-09-20 15:25:51 +0900 | [diff] [blame] | 105 | static struct platform_device *smdkv310_devices[] __initdata = { |
Hyuk Lee | 2b11148 | 2010-10-06 14:50:20 +0900 | [diff] [blame] | 106 | &s3c_device_hsmmc0, |
| 107 | &s3c_device_hsmmc1, |
| 108 | &s3c_device_hsmmc2, |
| 109 | &s3c_device_hsmmc3, |
Changhwan Youn | cdff6e6 | 2010-09-20 15:25:51 +0900 | [diff] [blame] | 110 | &s3c_device_rtc, |
Jemings Ko | 8d75c91 | 2010-09-20 15:33:04 +0900 | [diff] [blame] | 111 | &s3c_device_wdt, |
Changhwan Youn | cdff6e6 | 2010-09-20 15:25:51 +0900 | [diff] [blame] | 112 | }; |
| 113 | |
Changhwan Youn | b1d69cc | 2010-07-16 12:18:36 +0900 | [diff] [blame] | 114 | static void __init smdkv310_map_io(void) |
| 115 | { |
| 116 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
| 117 | s3c24xx_init_clocks(24000000); |
| 118 | s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); |
| 119 | } |
| 120 | |
| 121 | static void __init smdkv310_machine_init(void) |
| 122 | { |
Hyuk Lee | 2b11148 | 2010-10-06 14:50:20 +0900 | [diff] [blame] | 123 | s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata); |
| 124 | s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata); |
| 125 | s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata); |
| 126 | s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata); |
| 127 | |
Changhwan Youn | b1d69cc | 2010-07-16 12:18:36 +0900 | [diff] [blame] | 128 | #ifdef CONFIG_CACHE_L2X0 |
| 129 | l2x0_init(S5P_VA_L2CC, 1 << 28, 0xffffffff); |
| 130 | #endif |
Changhwan Youn | cdff6e6 | 2010-09-20 15:25:51 +0900 | [diff] [blame] | 131 | |
| 132 | platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices)); |
Changhwan Youn | b1d69cc | 2010-07-16 12:18:36 +0900 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | MACHINE_START(SMDKV310, "SMDKV310") |
| 136 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ |
| 137 | /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */ |
| 138 | .phys_io = S3C_PA_UART & 0xfff00000, |
| 139 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, |
| 140 | .boot_params = S5P_PA_SDRAM + 0x100, |
| 141 | .init_irq = s5pv310_init_irq, |
| 142 | .map_io = smdkv310_map_io, |
| 143 | .init_machine = smdkv310_machine_init, |
| 144 | .timer = &s5pv310_timer, |
| 145 | MACHINE_END |