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 | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 16 | |
| 17 | #include <asm/mach/arch.h> |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <asm/hardware/cache-l2x0.h> |
| 20 | |
| 21 | #include <plat/regs-serial.h> |
| 22 | #include <plat/s5pv310.h> |
| 23 | #include <plat/cpu.h> |
Kyungmin Park | acf5eda | 2010-10-08 22:34:52 +0900 | [diff] [blame] | 24 | #include <plat/devs.h> |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 25 | |
| 26 | #include <mach/map.h> |
| 27 | |
| 28 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
| 29 | #define UNIVERSAL_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 UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8 |
| 37 | |
| 38 | #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
| 39 | S5PV210_UFCON_TXTRIG256 | \ |
| 40 | S5PV210_UFCON_RXTRIG256) |
| 41 | |
| 42 | static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = { |
| 43 | [0] = { |
| 44 | .hwport = 0, |
| 45 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 46 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 47 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 48 | }, |
| 49 | [1] = { |
| 50 | .hwport = 1, |
| 51 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 52 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 53 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 54 | }, |
| 55 | [2] = { |
| 56 | .hwport = 2, |
| 57 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 58 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 59 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 60 | }, |
| 61 | [3] = { |
| 62 | .hwport = 3, |
| 63 | .ucon = UNIVERSAL_UCON_DEFAULT, |
| 64 | .ulcon = UNIVERSAL_ULCON_DEFAULT, |
| 65 | .ufcon = UNIVERSAL_UFCON_DEFAULT, |
| 66 | }, |
| 67 | }; |
| 68 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 69 | static struct gpio_keys_button universal_gpio_keys_tables[] = { |
| 70 | { |
| 71 | .code = KEY_VOLUMEUP, |
| 72 | .gpio = S5PV310_GPX2(0), /* XEINT16 */ |
| 73 | .desc = "gpio-keys: KEY_VOLUMEUP", |
| 74 | .type = EV_KEY, |
| 75 | .active_low = 1, |
| 76 | .debounce_interval = 1, |
| 77 | }, { |
| 78 | .code = KEY_VOLUMEDOWN, |
| 79 | .gpio = S5PV310_GPX2(1), /* XEINT17 */ |
| 80 | .desc = "gpio-keys: KEY_VOLUMEDOWN", |
| 81 | .type = EV_KEY, |
| 82 | .active_low = 1, |
| 83 | .debounce_interval = 1, |
| 84 | }, { |
| 85 | .code = KEY_CONFIG, |
| 86 | .gpio = S5PV310_GPX2(2), /* XEINT18 */ |
| 87 | .desc = "gpio-keys: KEY_CONFIG", |
| 88 | .type = EV_KEY, |
| 89 | .active_low = 1, |
| 90 | .debounce_interval = 1, |
| 91 | }, { |
| 92 | .code = KEY_CAMERA, |
| 93 | .gpio = S5PV310_GPX2(3), /* XEINT19 */ |
| 94 | .desc = "gpio-keys: KEY_CAMERA", |
| 95 | .type = EV_KEY, |
| 96 | .active_low = 1, |
| 97 | .debounce_interval = 1, |
| 98 | }, { |
| 99 | .code = KEY_OK, |
| 100 | .gpio = S5PV310_GPX3(5), /* XEINT29 */ |
| 101 | .desc = "gpio-keys: KEY_OK", |
| 102 | .type = EV_KEY, |
| 103 | .active_low = 1, |
| 104 | .debounce_interval = 1, |
| 105 | }, |
| 106 | }; |
| 107 | |
| 108 | static struct gpio_keys_platform_data universal_gpio_keys_data = { |
| 109 | .buttons = universal_gpio_keys_tables, |
| 110 | .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables), |
| 111 | }; |
| 112 | |
| 113 | static struct platform_device universal_gpio_keys = { |
| 114 | .name = "gpio-keys", |
| 115 | .dev = { |
| 116 | .platform_data = &universal_gpio_keys_data, |
| 117 | }, |
| 118 | }; |
| 119 | |
Kyungmin Park | 3b7998f | 2010-10-08 22:34:56 +0900 | [diff] [blame^] | 120 | /* I2C0 */ |
| 121 | static struct i2c_board_info i2c0_devs[] __initdata = { |
| 122 | /* Camera, To be updated */ |
| 123 | }; |
| 124 | |
| 125 | /* I2C1 */ |
| 126 | static struct i2c_board_info i2c1_devs[] __initdata = { |
| 127 | /* Gyro, To be updated */ |
| 128 | }; |
| 129 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 130 | static struct platform_device *universal_devices[] __initdata = { |
| 131 | &universal_gpio_keys, |
Kyungmin Park | acf5eda | 2010-10-08 22:34:52 +0900 | [diff] [blame] | 132 | &s5p_device_onenand, |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 133 | }; |
| 134 | |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 135 | static void __init universal_map_io(void) |
| 136 | { |
| 137 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
| 138 | s3c24xx_init_clocks(24000000); |
| 139 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); |
| 140 | } |
| 141 | |
| 142 | static void __init universal_machine_init(void) |
| 143 | { |
| 144 | #ifdef CONFIG_CACHE_L2X0 |
| 145 | l2x0_init(S5P_VA_L2CC, 1 << 28, 0xffffffff); |
| 146 | #endif |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 147 | |
Kyungmin Park | 3b7998f | 2010-10-08 22:34:56 +0900 | [diff] [blame^] | 148 | i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); |
| 149 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); |
| 150 | |
Kyungmin Park | 34d7931 | 2010-08-21 09:49:49 +0900 | [diff] [blame] | 151 | /* Last */ |
| 152 | platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices)); |
Kyungmin Park | 516607d | 2010-08-06 19:59:21 +0900 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") |
| 156 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ |
| 157 | .phys_io = S3C_PA_UART & 0xfff00000, |
| 158 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, |
| 159 | .boot_params = S5P_PA_SDRAM + 0x100, |
| 160 | .init_irq = s5pv310_init_irq, |
| 161 | .map_io = universal_map_io, |
| 162 | .init_machine = universal_machine_init, |
| 163 | .timer = &s5pv310_timer, |
| 164 | MACHINE_END |