]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - arch/arm/mach-omap1/board-palmtt.c
Merge tag 'amd-drm-fixes-5.9-2020-08-20' of git://people.freedesktop.org/~agd5f/linux...
[mirror_ubuntu-hirsute-kernel.git] / arch / arm / mach-omap1 / board-palmtt.c
CommitLineData
d2912cb1 1// SPDX-License-Identifier: GPL-2.0-only
dc563b4f
MV
2/*
3 * linux/arch/arm/mach-omap1/board-palmtt.c
4 *
5 * Modified from board-palmtt2.c
6 *
7 * Modified and amended for Palm Tungsten|T
8 * by Marek Vasut <marek.vasut@gmail.com>
dc563b4f
MV
9 */
10
11#include <linux/delay.h>
2f8163ba 12#include <linux/gpio.h>
dc563b4f
MV
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/notifier.h>
17#include <linux/clk.h>
18#include <linux/input.h>
19#include <linux/interrupt.h>
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/partitions.h>
561b036a 22#include <linux/mtd/physmap.h>
dc563b4f 23#include <linux/leds.h>
ddba6c7f 24#include <linux/omapfb.h>
2e3ee9f4
TL
25#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h>
cc012729 27#include <linux/platform_data/omap1_bl.h>
a8f7445c 28#include <linux/platform_data/leds-omap.h>
dc563b4f 29
dc563b4f
MV
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
dc563b4f 33
100f9638 34#include "flash.h"
70c494c3 35#include <mach/mux.h>
45c3eb7d 36#include <linux/omap-dma.h>
54b693d4 37#include <mach/tc.h>
2203747c 38#include <linux/platform_data/keypad-omap.h>
dc563b4f 39
2e3ee9f4 40#include <mach/hardware.h>
b924b204 41#include <mach/usb.h>
2e3ee9f4
TL
42
43#include "common.h"
dc563b4f 44
b2830810
TL
45#define PALMTT_USBDETECT_GPIO 0
46#define PALMTT_CABLE_GPIO 1
47#define PALMTT_LED_GPIO 3
48#define PALMTT_PENIRQ_GPIO 6
49#define PALMTT_MMC_WP_GPIO 8
50#define PALMTT_HDQ_GPIO 11
51
da1f026b 52static const unsigned int palmtt_keymap[] = {
dc563b4f 53 KEY(0, 0, KEY_ESC),
da1f026b
JK
54 KEY(1, 0, KEY_SPACE),
55 KEY(2, 0, KEY_LEFTCTRL),
56 KEY(3, 0, KEY_TAB),
57 KEY(4, 0, KEY_ENTER),
58 KEY(0, 1, KEY_LEFT),
dc563b4f 59 KEY(1, 1, KEY_DOWN),
da1f026b
JK
60 KEY(2, 1, KEY_UP),
61 KEY(3, 1, KEY_RIGHT),
62 KEY(0, 2, KEY_SLEEP),
63 KEY(4, 2, KEY_Y),
dc563b4f
MV
64};
65
66static struct mtd_partition palmtt_partitions[] = {
67 {
68 .name = "write8k",
69 .offset = 0,
70 .size = SZ_8K,
71 .mask_flags = 0,
72 },
73 {
74 .name = "PalmOS-BootLoader(ro)",
75 .offset = SZ_8K,
76 .size = 7 * SZ_8K,
77 .mask_flags = MTD_WRITEABLE,
78 },
79 {
80 .name = "u-boot",
81 .offset = MTDPART_OFS_APPEND,
82 .size = 8 * SZ_8K,
83 .mask_flags = 0,
84 },
85 {
86 .name = "PalmOS-FS(ro)",
87 .offset = MTDPART_OFS_APPEND,
88 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
89 .mask_flags = MTD_WRITEABLE,
90 },
91 {
92 .name = "u-boot(rez)",
93 .offset = MTDPART_OFS_APPEND,
94 .size = SZ_128K,
95 .mask_flags = 0
96 },
97 {
98 .name = "empty",
99 .offset = MTDPART_OFS_APPEND,
100 .size = MTDPART_SIZ_FULL,
101 .mask_flags = 0
102 }
103};
104
561b036a 105static struct physmap_flash_data palmtt_flash_data = {
dc563b4f 106 .width = 2,
561b036a 107 .set_vpp = omap1_set_vpp,
dc563b4f
MV
108 .parts = palmtt_partitions,
109 .nr_parts = ARRAY_SIZE(palmtt_partitions),
110};
111
112static struct resource palmtt_flash_resource = {
113 .start = OMAP_CS0_PHYS,
114 .end = OMAP_CS0_PHYS + SZ_8M - 1,
115 .flags = IORESOURCE_MEM,
116};
117
118static struct platform_device palmtt_flash_device = {
561b036a 119 .name = "physmap-flash",
dc563b4f
MV
120 .id = 0,
121 .dev = {
122 .platform_data = &palmtt_flash_data,
123 },
124 .num_resources = 1,
125 .resource = &palmtt_flash_resource,
126};
127
dc563b4f
MV
128static struct resource palmtt_kp_resources[] = {
129 [0] = {
130 .start = INT_KEYBOARD,
131 .end = INT_KEYBOARD,
132 .flags = IORESOURCE_IRQ,
133 },
134};
135
da1f026b
JK
136static const struct matrix_keymap_data palmtt_keymap_data = {
137 .keymap = palmtt_keymap,
138 .keymap_size = ARRAY_SIZE(palmtt_keymap),
139};
140
dc563b4f
MV
141static struct omap_kp_platform_data palmtt_kp_data = {
142 .rows = 6,
143 .cols = 3,
da1f026b 144 .keymap_data = &palmtt_keymap_data,
dc563b4f
MV
145};
146
147static struct platform_device palmtt_kp_device = {
148 .name = "omap-keypad",
149 .id = -1,
150 .dev = {
151 .platform_data = &palmtt_kp_data,
152 },
153 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
154 .resource = palmtt_kp_resources,
155};
156
157static struct platform_device palmtt_lcd_device = {
158 .name = "lcd_palmtt",
159 .id = -1,
160};
dc563b4f
MV
161
162static struct platform_device palmtt_spi_device = {
163 .name = "spi_palmtt",
164 .id = -1,
165};
166
167static struct omap_backlight_config palmtt_backlight_config = {
168 .default_intensity = 0xa0,
169};
170
171static struct platform_device palmtt_backlight_device = {
172 .name = "omap-bl",
173 .id = -1,
174 .dev = {
175 .platform_data= &palmtt_backlight_config,
176 },
177};
178
179static struct omap_led_config palmtt_led_config[] = {
180 {
181 .cdev = {
182 .name = "palmtt:led0",
183 },
184 .gpio = PALMTT_LED_GPIO,
185 },
186};
187
188static struct omap_led_platform_data palmtt_led_data = {
189 .nr_leds = ARRAY_SIZE(palmtt_led_config),
190 .leds = palmtt_led_config,
191};
192
193static struct platform_device palmtt_led_device = {
194 .name = "omap-led",
195 .id = -1,
196 .dev = {
197 .platform_data = &palmtt_led_data,
198 },
199};
200
201static struct platform_device *palmtt_devices[] __initdata = {
202 &palmtt_flash_device,
dc563b4f
MV
203 &palmtt_kp_device,
204 &palmtt_lcd_device,
dc563b4f
MV
205 &palmtt_spi_device,
206 &palmtt_backlight_device,
207 &palmtt_led_device,
208};
209
210static int palmtt_get_pendown_state(void)
211{
0b84b5ca 212 return !gpio_get_value(6);
dc563b4f
MV
213}
214
215static const struct ads7846_platform_data palmtt_ts_info = {
216 .model = 7846,
217 .vref_delay_usecs = 100, /* internal, no capacitor */
218 .x_plate_ohms = 419,
219 .y_plate_ohms = 486,
220 .get_pendown_state = palmtt_get_pendown_state,
221};
222
223static struct spi_board_info __initdata palmtt_boardinfo[] = {
224 {
225 /* MicroWire (bus 2) CS0 has an ads7846e */
226 .modalias = "ads7846",
227 .platform_data = &palmtt_ts_info,
dc563b4f
MV
228 .max_speed_hz = 120000 /* max sample rate at 3V */
229 * 26 /* command + data + overhead */,
230 .bus_num = 2,
231 .chip_select = 0,
232 }
233};
234
dc563b4f
MV
235static struct omap_usb_config palmtt_usb_config __initdata = {
236 .register_dev = 1,
237 .hmc_mode = 0,
238 .pins[0] = 2,
239};
240
d25c70cf 241static const struct omap_lcd_config palmtt_lcd_config __initconst = {
dc563b4f
MV
242 .ctrl_name = "internal",
243};
244
dc563b4f
MV
245static void __init omap_mpu_wdt_mode(int mode) {
246 if (mode)
247 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
248 else {
249 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
250 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
251 }
252}
253
254static void __init omap_palmtt_init(void)
255{
c33da3a8
JK
256 /* mux pins for uarts */
257 omap_cfg_reg(UART1_TX);
258 omap_cfg_reg(UART1_RTS);
259 omap_cfg_reg(UART2_TX);
260 omap_cfg_reg(UART2_RTS);
261 omap_cfg_reg(UART3_TX);
262 omap_cfg_reg(UART3_RX);
263
dc563b4f
MV
264 omap_mpu_wdt_mode(0);
265
dc563b4f
MV
266 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
267
46a0a540 268 palmtt_boardinfo[0].irq = gpio_to_irq(6);
dc563b4f
MV
269 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
270 omap_serial_init();
dd0cdd88 271 omap1_usb_init(&palmtt_usb_config);
1ed16a86 272 omap_register_i2c_bus(1, 100, NULL, 0);
ddba6c7f
TV
273
274 omapfb_set_lcd_config(&palmtt_lcd_config);
dc563b4f
MV
275}
276
dc563b4f 277MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
246e389d 278 .atag_offset = 0x100,
7b88e62f
TL
279 .map_io = omap15xx_map_io,
280 .init_early = omap1_init_early,
7b88e62f 281 .init_irq = omap1_init_irq,
b694331c 282 .handle_irq = omap1_handle_irq,
dc563b4f 283 .init_machine = omap_palmtt_init,
82c3bd03 284 .init_late = omap1_init_late,
6bb27d73 285 .init_time = omap1_timer_init,
baa95883 286 .restart = omap1_restart,
dc563b4f 287MACHINE_END