arm64: dts: Revert "specify console via command line"
[linux/fpc-iii.git] / arch / arm / mach-omap1 / board-palmz71.c
blob034e5bc6a02963b673f63d2d9257fc251e5c72ec
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * linux/arch/arm/mach-omap1/board-palmz71.c
5 * Modified from board-generic.c
7 * Support for the Palm Zire71 PDA.
9 * Original version : Laurent Gonzalez
11 * Modified for zire71 : Marek Vasut
14 #include <linux/delay.h>
15 #include <linux/gpio.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/notifier.h>
20 #include <linux/clk.h>
21 #include <linux/irq.h>
22 #include <linux/input.h>
23 #include <linux/interrupt.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/partitions.h>
26 #include <linux/mtd/physmap.h>
27 #include <linux/omapfb.h>
28 #include <linux/spi/spi.h>
29 #include <linux/spi/ads7846.h>
30 #include <linux/platform_data/omap1_bl.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
36 #include "flash.h"
37 #include <mach/mux.h>
38 #include <linux/omap-dma.h>
39 #include <mach/tc.h>
40 #include <linux/platform_data/keypad-omap.h>
42 #include <mach/hardware.h>
43 #include <mach/usb.h>
45 #include "common.h"
47 #define PALMZ71_USBDETECT_GPIO 0
48 #define PALMZ71_PENIRQ_GPIO 6
49 #define PALMZ71_MMC_WP_GPIO 8
50 #define PALMZ71_HDQ_GPIO 11
52 #define PALMZ71_HOTSYNC_GPIO OMAP_MPUIO(1)
53 #define PALMZ71_CABLE_GPIO OMAP_MPUIO(2)
54 #define PALMZ71_SLIDER_GPIO OMAP_MPUIO(3)
55 #define PALMZ71_MMC_IN_GPIO OMAP_MPUIO(4)
57 static const unsigned int palmz71_keymap[] = {
58 KEY(0, 0, KEY_F1),
59 KEY(1, 0, KEY_F2),
60 KEY(2, 0, KEY_F3),
61 KEY(3, 0, KEY_F4),
62 KEY(4, 0, KEY_POWER),
63 KEY(0, 1, KEY_LEFT),
64 KEY(1, 1, KEY_DOWN),
65 KEY(2, 1, KEY_UP),
66 KEY(3, 1, KEY_RIGHT),
67 KEY(4, 1, KEY_ENTER),
68 KEY(0, 2, KEY_CAMERA),
71 static const struct matrix_keymap_data palmz71_keymap_data = {
72 .keymap = palmz71_keymap,
73 .keymap_size = ARRAY_SIZE(palmz71_keymap),
76 static struct omap_kp_platform_data palmz71_kp_data = {
77 .rows = 8,
78 .cols = 8,
79 .keymap_data = &palmz71_keymap_data,
80 .rep = true,
81 .delay = 80,
84 static struct resource palmz71_kp_resources[] = {
85 [0] = {
86 .start = INT_KEYBOARD,
87 .end = INT_KEYBOARD,
88 .flags = IORESOURCE_IRQ,
92 static struct platform_device palmz71_kp_device = {
93 .name = "omap-keypad",
94 .id = -1,
95 .dev = {
96 .platform_data = &palmz71_kp_data,
98 .num_resources = ARRAY_SIZE(palmz71_kp_resources),
99 .resource = palmz71_kp_resources,
102 static struct mtd_partition palmz71_rom_partitions[] = {
103 /* PalmOS "Small ROM", contains the bootloader and the debugger */
105 .name = "smallrom",
106 .offset = 0,
107 .size = 0xa000,
108 .mask_flags = MTD_WRITEABLE,
110 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
112 .name = "bigrom",
113 .offset = SZ_128K,
115 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
116 * 0x7b0000 bytes in the English-only ("enUS") version.
118 .size = 0x7b0000,
119 .mask_flags = MTD_WRITEABLE,
123 static struct physmap_flash_data palmz71_rom_data = {
124 .width = 2,
125 .set_vpp = omap1_set_vpp,
126 .parts = palmz71_rom_partitions,
127 .nr_parts = ARRAY_SIZE(palmz71_rom_partitions),
130 static struct resource palmz71_rom_resource = {
131 .start = OMAP_CS0_PHYS,
132 .end = OMAP_CS0_PHYS + SZ_8M - 1,
133 .flags = IORESOURCE_MEM,
136 static struct platform_device palmz71_rom_device = {
137 .name = "physmap-flash",
138 .id = -1,
139 .dev = {
140 .platform_data = &palmz71_rom_data,
142 .num_resources = 1,
143 .resource = &palmz71_rom_resource,
146 static struct platform_device palmz71_lcd_device = {
147 .name = "lcd_palmz71",
148 .id = -1,
151 static struct platform_device palmz71_spi_device = {
152 .name = "spi_palmz71",
153 .id = -1,
156 static struct omap_backlight_config palmz71_backlight_config = {
157 .default_intensity = 0xa0,
160 static struct platform_device palmz71_backlight_device = {
161 .name = "omap-bl",
162 .id = -1,
163 .dev = {
164 .platform_data = &palmz71_backlight_config,
168 static struct platform_device *devices[] __initdata = {
169 &palmz71_rom_device,
170 &palmz71_kp_device,
171 &palmz71_lcd_device,
172 &palmz71_spi_device,
173 &palmz71_backlight_device,
176 static int
177 palmz71_get_pendown_state(void)
179 return !gpio_get_value(PALMZ71_PENIRQ_GPIO);
182 static const struct ads7846_platform_data palmz71_ts_info = {
183 .model = 7846,
184 .vref_delay_usecs = 100, /* internal, no capacitor */
185 .x_plate_ohms = 419,
186 .y_plate_ohms = 486,
187 .get_pendown_state = palmz71_get_pendown_state,
190 static struct spi_board_info __initdata palmz71_boardinfo[] = { {
191 /* MicroWire (bus 2) CS0 has an ads7846e */
192 .modalias = "ads7846",
193 .platform_data = &palmz71_ts_info,
194 .max_speed_hz = 120000 /* max sample rate at 3V */
195 * 26 /* command + data + overhead */,
196 .bus_num = 2,
197 .chip_select = 0,
198 } };
200 static struct omap_usb_config palmz71_usb_config __initdata = {
201 .register_dev = 1, /* Mini-B only receptacle */
202 .hmc_mode = 0,
203 .pins[0] = 2,
206 static const struct omap_lcd_config palmz71_lcd_config __initconst = {
207 .ctrl_name = "internal",
210 static irqreturn_t
211 palmz71_powercable(int irq, void *dev_id)
213 if (gpio_get_value(PALMZ71_USBDETECT_GPIO)) {
214 printk(KERN_INFO "PM: Power cable connected\n");
215 irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
216 IRQ_TYPE_EDGE_FALLING);
217 } else {
218 printk(KERN_INFO "PM: Power cable disconnected\n");
219 irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
220 IRQ_TYPE_EDGE_RISING);
222 return IRQ_HANDLED;
225 static void __init
226 omap_mpu_wdt_mode(int mode)
228 if (mode)
229 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
230 else {
231 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
232 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
236 static void __init
237 palmz71_gpio_setup(int early)
239 if (early) {
240 /* Only set GPIO1 so we have a working serial */
241 gpio_direction_output(1, 1);
242 } else {
243 /* Set MMC/SD host WP pin as input */
244 if (gpio_request(PALMZ71_MMC_WP_GPIO, "MMC WP") < 0) {
245 printk(KERN_ERR "Could not reserve WP GPIO!\n");
246 return;
248 gpio_direction_input(PALMZ71_MMC_WP_GPIO);
250 /* Monitor the Power-cable-connected signal */
251 if (gpio_request(PALMZ71_USBDETECT_GPIO, "USB detect") < 0) {
252 printk(KERN_ERR
253 "Could not reserve cable signal GPIO!\n");
254 return;
256 gpio_direction_input(PALMZ71_USBDETECT_GPIO);
257 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
258 palmz71_powercable, 0, "palmz71-cable", NULL))
259 printk(KERN_ERR
260 "IRQ request for power cable failed!\n");
261 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), NULL);
265 static void __init
266 omap_palmz71_init(void)
268 /* mux pins for uarts */
269 omap_cfg_reg(UART1_TX);
270 omap_cfg_reg(UART1_RTS);
271 omap_cfg_reg(UART2_TX);
272 omap_cfg_reg(UART2_RTS);
273 omap_cfg_reg(UART3_TX);
274 omap_cfg_reg(UART3_RX);
276 palmz71_gpio_setup(1);
277 omap_mpu_wdt_mode(0);
279 platform_add_devices(devices, ARRAY_SIZE(devices));
281 palmz71_boardinfo[0].irq = gpio_to_irq(PALMZ71_PENIRQ_GPIO);
282 spi_register_board_info(palmz71_boardinfo,
283 ARRAY_SIZE(palmz71_boardinfo));
284 omap1_usb_init(&palmz71_usb_config);
285 omap_serial_init();
286 omap_register_i2c_bus(1, 100, NULL, 0);
287 palmz71_gpio_setup(0);
289 omapfb_set_lcd_config(&palmz71_lcd_config);
292 MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
293 .atag_offset = 0x100,
294 .map_io = omap15xx_map_io,
295 .init_early = omap1_init_early,
296 .init_irq = omap1_init_irq,
297 .handle_irq = omap1_handle_irq,
298 .init_machine = omap_palmz71_init,
299 .init_late = omap1_init_late,
300 .init_time = omap1_timer_init,
301 .restart = omap1_restart,
302 MACHINE_END