Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5pv310/mach-universal_c210.c |
| 2 | * |
| 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation. |
| 8 | */ |
| 9 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 10 | #include <linux/platform_device.h> |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 11 | #include <linux/serial_core.h> |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 12 | #include <linux/input.h> |
Kyungmin Park | 3b7998f | 2010-10-08 22:34:56 +0900 | [diff] [blame] | 13 | #include <linux/i2c.h> |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 14 | #include <linux/gpio_keys.h> |
| 15 | #include <linux/gpio.h> |
Kyungmin Park | a8928ce | 2010-12-22 13:34:23 +0900 | [diff] [blame^] | 16 | #include <linux/regulator/machine.h> |
| 17 | #include <linux/regulator/fixed.h> |
| 18 | #include <linux/mmc/host.h> |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 19 | |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach-types.h> |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 22 | |
| 23 | #include <plat/regs-serial.h> |
| 24 | #include <plat/s5pv310.h> |
| 25 | #include <plat/cpu.h> |
Kyungmin Park | acf5eda | 2010-10-08 22:34:52 +0900 | [diff] [blame] | 26 | #include <plat/devs.h> |
Kyungmin Park | a8928ce | 2010-12-22 13:34:23 +0900 | [diff] [blame^] | 27 | #include <plat/sdhci.h> |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 28 | |
| 29 | #include <mach/map.h> |
| 30 | |
| 31 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
| 32 | #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
| 33 | S3C2410_UCON_RXILEVEL | \ |
| 34 | S3C2410_UCON_TXIRQMODE | \ |
| 35 | S3C2410_UCON_RXIRQMODE | \ |
| 36 | S3C2410_UCON_RXFIFO_TOI | \ |
| 37 | S3C2443_UCON_RXERR_IRQEN) |
| 38 | |
| 39 | #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8 |
| 40 | |
| 41 | #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
| 42 | S5PV210_UFCON_TXTRIG256 | \ |
| 43 | S5PV210_UFCON_RXTRIG256) |
| 44 | |
| 45 | static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = { |
| 46 | [0] = { |
| 47 | .hwport = 0, |
| 48 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 49 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 50 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 51 | }, |
| 52 | [1] = { |
| 53 | .hwport = 1, |
| 54 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 55 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 56 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 57 | }, |
| 58 | [2] = { |
| 59 | .hwport = 2, |
| 60 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 61 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 62 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 63 | }, |
| 64 | [3] = { |
| 65 | .hwport = 3, |
| 66 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 67 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 68 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 69 | }, |
| 70 | }; |
| 71 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 72 | static struct gpio_keys_button universal_gpio_keys_tables[] = { |
| 73 | { |
| 74 | .code = KEY_VOLUMEUP, |
| 75 | .gpio = S5PV310_GPX2(0), /* XEINT16 */ |
| 76 | .desc = "gpio-keys: KEY_VOLUMEUP", |
| 77 | .type = EV_KEY, |
| 78 | .active_low = 1, |
| 79 | .debounce_interval = 1, |
| 80 | }, { |
| 81 | .code = KEY_VOLUMEDOWN, |
| 82 | .gpio = S5PV310_GPX2(1), /* XEINT17 */ |
| 83 | .desc = "gpio-keys: KEY_VOLUMEDOWN", |
| 84 | .type = EV_KEY, |
| 85 | .active_low = 1, |
| 86 | .debounce_interval = 1, |
| 87 | }, { |
| 88 | .code = KEY_CONFIG, |
| 89 | .gpio = S5PV310_GPX2(2), /* XEINT18 */ |
| 90 | .desc = "gpio-keys: KEY_CONFIG", |
| 91 | .type = EV_KEY, |
| 92 | .active_low = 1, |
| 93 | .debounce_interval = 1, |
| 94 | }, { |
| 95 | .code = KEY_CAMERA, |
| 96 | .gpio = S5PV310_GPX2(3), /* XEINT19 */ |
| 97 | .desc = "gpio-keys: KEY_CAMERA", |
| 98 | .type = EV_KEY, |
| 99 | .active_low = 1, |
| 100 | .debounce_interval = 1, |
| 101 | }, { |
| 102 | .code = KEY_OK, |
| 103 | .gpio = S5PV310_GPX3(5), /* XEINT29 */ |
| 104 | .desc = "gpio-keys: KEY_OK", |
| 105 | .type = EV_KEY, |
| 106 | .active_low = 1, |
| 107 | .debounce_interval = 1, |
| 108 | }, |
| 109 | }; |
| 110 | |
| 111 | static struct gpio_keys_platform_data universal_gpio_keys_data = { |
| 112 | .buttons = universal_gpio_keys_tables, |
| 113 | .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables), |
| 114 | }; |
| 115 | |
| 116 | static struct platform_device universal_gpio_keys = { |
| 117 | .name = "gpio-keys", |
| 118 | .dev = { |
| 119 | .platform_data = &universal_gpio_keys_data, |
| 120 | }, |
| 121 | }; |
| 122 | |
Kyungmin Park | a8928ce | 2010-12-22 13:34:23 +0900 | [diff] [blame^] | 123 | /* eMMC */ |
| 124 | static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { |
| 125 | .max_width = 8, |
| 126 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | |
| 127 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
| 128 | MMC_CAP_DISABLE), |
| 129 | .cd_type = S3C_SDHCI_CD_PERMANENT, |
| 130 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, |
| 131 | }; |
| 132 | |
| 133 | static struct regulator_consumer_supply mmc0_supplies[] = { |
| 134 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), |
| 135 | }; |
| 136 | |
| 137 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { |
| 138 | .constraints = { |
| 139 | .name = "VMEM_VDD_2.8V", |
| 140 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 141 | }, |
| 142 | .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies), |
| 143 | .consumer_supplies = mmc0_supplies, |
| 144 | }; |
| 145 | |
| 146 | static struct fixed_voltage_config mmc0_fixed_voltage_config = { |
| 147 | .supply_name = "MASSMEMORY_EN", |
| 148 | .microvolts = 2800000, |
| 149 | .gpio = S5PV310_GPE1(3), |
| 150 | .enable_high = true, |
| 151 | .init_data = &mmc0_fixed_voltage_init_data, |
| 152 | }; |
| 153 | |
| 154 | static struct platform_device mmc0_fixed_voltage = { |
| 155 | .name = "reg-fixed-voltage", |
| 156 | .id = 0, |
| 157 | .dev = { |
| 158 | .platform_data = &mmc0_fixed_voltage_config, |
| 159 | }, |
| 160 | }; |
| 161 | |
| 162 | /* SD */ |
| 163 | static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = { |
| 164 | .max_width = 4, |
| 165 | .host_caps = MMC_CAP_4_BIT_DATA | |
| 166 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
| 167 | MMC_CAP_DISABLE, |
| 168 | .ext_cd_gpio = S5PV310_GPX3(4), /* XEINT_28 */ |
| 169 | .ext_cd_gpio_invert = 1, |
| 170 | .cd_type = S3C_SDHCI_CD_GPIO, |
| 171 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, |
| 172 | }; |
| 173 | |
| 174 | /* WiFi */ |
| 175 | static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = { |
| 176 | .max_width = 4, |
| 177 | .host_caps = MMC_CAP_4_BIT_DATA | |
| 178 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
| 179 | MMC_CAP_DISABLE, |
| 180 | .cd_type = S3C_SDHCI_CD_EXTERNAL, |
| 181 | }; |
| 182 | |
| 183 | static void __init universal_sdhci_init(void) |
| 184 | { |
| 185 | s3c_sdhci0_set_platdata(&universal_hsmmc0_data); |
| 186 | s3c_sdhci2_set_platdata(&universal_hsmmc2_data); |
| 187 | s3c_sdhci3_set_platdata(&universal_hsmmc3_data); |
| 188 | } |
| 189 | |
Kyungmin Park | 3b7998f | 2010-10-08 22:34:56 +0900 | [diff] [blame] | 190 | /* I2C0 */ |
| 191 | static struct i2c_board_info i2c0_devs[] __initdata = { |
| 192 | /* Camera, To be updated */ |
| 193 | }; |
| 194 | |
| 195 | /* I2C1 */ |
| 196 | static struct i2c_board_info i2c1_devs[] __initdata = { |
| 197 | /* Gyro, To be updated */ |
| 198 | }; |
| 199 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 200 | static struct platform_device *universal_devices[] __initdata = { |
Kyungmin Park | a8928ce | 2010-12-22 13:34:23 +0900 | [diff] [blame^] | 201 | /* Samsung Platform Devices */ |
| 202 | &mmc0_fixed_voltage, |
| 203 | &s3c_device_hsmmc0, |
| 204 | &s3c_device_hsmmc2, |
| 205 | &s3c_device_hsmmc3, |
| 206 | |
| 207 | /* Universal Devices */ |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 208 | &universal_gpio_keys, |
Kyungmin Park | acf5eda | 2010-10-08 22:34:52 +0900 | [diff] [blame] | 209 | &s5p_device_onenand, |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 210 | }; |
| 211 | |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 212 | static void __init universal_map_io(void) |
| 213 | { |
| 214 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
| 215 | s3c24xx_init_clocks(24000000); |
| 216 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); |
| 217 | } |
| 218 | |
| 219 | static void __init universal_machine_init(void) |
| 220 | { |
Kyungmin Park | a8928ce | 2010-12-22 13:34:23 +0900 | [diff] [blame^] | 221 | universal_sdhci_init(); |
| 222 | |
Kyungmin Park | 3b7998f | 2010-10-08 22:34:56 +0900 | [diff] [blame] | 223 | i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); |
| 224 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); |
| 225 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 226 | /* Last */ |
| 227 | platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices)); |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") |
| 231 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 232 | .boot_params = S5P_PA_SDRAM + 0x100, |
| 233 | .init_irq = s5pv310_init_irq, |
| 234 | .map_io = universal_map_io, |
| 235 | .init_machine = universal_machine_init, |
| 236 | .timer = &s5pv310_timer, |
| 237 | MACHINE_END |