2 * linux/arch/arm/mach-omap2/board-h4.c
4 * Copyright (C) 2005 Nokia Corporation
5 * Author: Paul Mundt <paul.mundt@nokia.com>
7 * Modified from mach-omap/omap1/board-generic.c
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 #include <linux/gpio.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/partitions.h>
19 #include <linux/mtd/physmap.h>
20 #include <linux/delay.h>
21 #include <linux/workqueue.h>
22 #include <linux/i2c.h>
23 #include <linux/i2c/at24.h>
24 #include <linux/input.h>
25 #include <linux/err.h>
26 #include <linux/clk.h>
28 #include <linux/input/matrix_keypad.h>
29 #include <linux/mfd/menelaus.h>
30 #include <linux/omap-dma.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
36 #include <video/omapdss.h>
37 #include <video/omap-panel-data.h>
43 #include "gpmc-smc91x.h"
47 #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
48 static const uint32_t board_matrix_keys
[] = {
81 static const struct matrix_keymap_data board_keymap_data
= {
82 .keymap
= board_matrix_keys
,
83 .keymap_size
= ARRAY_SIZE(board_matrix_keys
),
86 static unsigned int board_keypad_row_gpios
[] = {
87 88, 89, 124, 11, 6, 96
90 static unsigned int board_keypad_col_gpios
[] = {
91 90, 91, 100, 36, 12, 97, 98
94 static struct matrix_keypad_platform_data board_keypad_platform_data
= {
95 .keymap_data
= &board_keymap_data
,
96 .row_gpios
= board_keypad_row_gpios
,
97 .num_row_gpios
= ARRAY_SIZE(board_keypad_row_gpios
),
98 .col_gpios
= board_keypad_col_gpios
,
99 .num_col_gpios
= ARRAY_SIZE(board_keypad_col_gpios
),
103 .col_scan_delay_us
= 5,
106 static struct platform_device board_keyboard
= {
107 .name
= "matrix-keypad",
110 .platform_data
= &board_keypad_platform_data
,
113 static void __init
board_mkp_init(void)
115 omap_mux_init_gpio(88, OMAP_PULL_ENA
| OMAP_PULL_UP
);
116 omap_mux_init_gpio(89, OMAP_PULL_ENA
| OMAP_PULL_UP
);
117 omap_mux_init_gpio(124, OMAP_PULL_ENA
| OMAP_PULL_UP
);
118 omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA
| OMAP_PULL_UP
);
119 if (omap_has_menelaus()) {
120 omap_mux_init_signal("sdrc_a14.gpio0",
121 OMAP_PULL_ENA
| OMAP_PULL_UP
);
122 omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
123 omap_mux_init_signal("gpio_98", 0);
124 board_keypad_row_gpios
[5] = 0;
125 board_keypad_col_gpios
[2] = 15;
126 board_keypad_col_gpios
[6] = 18;
128 omap_mux_init_signal("gpio_96", OMAP_PULL_ENA
| OMAP_PULL_UP
);
129 omap_mux_init_signal("gpio_100", 0);
130 omap_mux_init_signal("gpio_98", 0);
132 omap_mux_init_signal("gpio_90", 0);
133 omap_mux_init_signal("gpio_91", 0);
134 omap_mux_init_signal("gpio_36", 0);
135 omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
136 omap_mux_init_signal("gpio_97", 0);
138 platform_device_register(&board_keyboard
);
141 static inline void board_mkp_init(void)
146 static struct mtd_partition h4_partitions
[] = {
147 /* bootloader (U-Boot, etc) in first sector */
149 .name
= "bootloader",
152 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
154 /* bootloader params in the next sector */
157 .offset
= MTDPART_OFS_APPEND
,
164 .offset
= MTDPART_OFS_APPEND
,
170 .name
= "filesystem",
171 .offset
= MTDPART_OFS_APPEND
,
172 .size
= MTDPART_SIZ_FULL
,
177 static struct physmap_flash_data h4_flash_data
= {
179 .parts
= h4_partitions
,
180 .nr_parts
= ARRAY_SIZE(h4_partitions
),
183 static struct resource h4_flash_resource
= {
184 .flags
= IORESOURCE_MEM
,
187 static struct platform_device h4_flash_device
= {
188 .name
= "physmap-flash",
191 .platform_data
= &h4_flash_data
,
194 .resource
= &h4_flash_resource
,
197 static const struct display_timing cm_t35_lcd_videomode
= {
198 .pixelclock
= { 0, 6250000, 0 },
200 .hactive
= { 0, 240, 0 },
201 .hfront_porch
= { 0, 15, 0 },
202 .hback_porch
= { 0, 60, 0 },
203 .hsync_len
= { 0, 15, 0 },
205 .vactive
= { 0, 320, 0 },
206 .vfront_porch
= { 0, 1, 0 },
207 .vback_porch
= { 0, 1, 0 },
208 .vsync_len
= { 0, 1, 0 },
210 .flags
= DISPLAY_FLAGS_HSYNC_HIGH
| DISPLAY_FLAGS_VSYNC_HIGH
|
211 DISPLAY_FLAGS_DE_HIGH
| DISPLAY_FLAGS_PIXDATA_POSEDGE
,
214 static struct panel_dpi_platform_data cm_t35_lcd_pdata
= {
220 .display_timing
= &cm_t35_lcd_videomode
,
223 .backlight_gpio
= -1,
226 static struct platform_device cm_t35_lcd_device
= {
229 .dev
.platform_data
= &cm_t35_lcd_pdata
,
232 static struct platform_device
*h4_devices
[] __initdata
= {
237 static struct omap_dss_board_info h4_dss_data
= {
238 .default_display_name
= "lcd",
241 /* 2420 Sysboot setup (2430 is different) */
242 static u32
get_sysboot_value(void)
244 return (omap_ctrl_readl(OMAP24XX_CONTROL_STATUS
) &
245 (OMAP2_SYSBOOT_5_MASK
| OMAP2_SYSBOOT_4_MASK
|
246 OMAP2_SYSBOOT_3_MASK
| OMAP2_SYSBOOT_2_MASK
|
247 OMAP2_SYSBOOT_1_MASK
| OMAP2_SYSBOOT_0_MASK
));
250 /* H4-2420's always used muxed mode, H4-2422's always use non-muxed
252 * Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423
253 * correctly. The macro needs to look at production_id not just hawkeye.
255 static u32
is_gpmc_muxed(void)
258 mux
= get_sysboot_value();
259 if ((mux
& 0xF) == 0xd)
260 return 1; /* NAND config (could be either) */
261 if (mux
& 0x2) /* if mux'ed */
267 #if IS_ENABLED(CONFIG_SMC91X)
269 static struct omap_smc91x_platform_data board_smc91x_data
= {
272 .flags
= GPMC_TIMINGS_SMC91C96
| IORESOURCE_IRQ_LOWLEVEL
,
275 static void __init
board_smc91x_init(void)
278 board_smc91x_data
.flags
|= GPMC_MUX_ADD_DATA
;
280 omap_mux_init_gpio(board_smc91x_data
.gpio_irq
, OMAP_PIN_INPUT
);
281 gpmc_smc91x_init(&board_smc91x_data
);
286 static inline void board_smc91x_init(void)
292 static void __init
h4_init_flash(void)
296 if (gpmc_cs_request(H4_FLASH_CS
, SZ_64M
, &base
) < 0) {
297 printk("Can't request GPMC CS for flash\n");
300 h4_flash_resource
.start
= base
;
301 h4_flash_resource
.end
= base
+ SZ_64M
- 1;
304 static struct at24_platform_data m24c01
= {
305 .byte_len
= SZ_1K
/ 8,
309 static struct i2c_board_info __initdata h4_i2c_board_info
[] = {
311 I2C_BOARD_INFO("isp1301_omap", 0x2d),
313 { /* EEPROM on mainboard */
314 I2C_BOARD_INFO("24c01", 0x52),
315 .platform_data
= &m24c01
,
317 { /* EEPROM on cpu card */
318 I2C_BOARD_INFO("24c01", 0x57),
319 .platform_data
= &m24c01
,
323 #ifdef CONFIG_OMAP_MUX
324 static struct omap_board_mux board_mux
[] __initdata
= {
325 { .reg_offset
= OMAP_MUX_TERMINATOR
},
329 static void __init
omap_h4_init(void)
331 omap2420_mux_init(board_mux
, OMAP_PACKAGE_ZAF
);
334 * Make sure the serial ports are muxed on at this point.
335 * You have to mux them off in device drivers later on
340 h4_i2c_board_info
[0].irq
= gpio_to_irq(125);
341 i2c_register_board_info(1, h4_i2c_board_info
,
342 ARRAY_SIZE(h4_i2c_board_info
));
344 platform_add_devices(h4_devices
, ARRAY_SIZE(h4_devices
));
346 omap_sdrc_init(NULL
, NULL
);
350 omap_display_init(&h4_dss_data
);
353 MACHINE_START(OMAP_H4
, "OMAP2420 H4 board")
354 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
355 .atag_offset
= 0x100,
356 .reserve
= omap_reserve
,
357 .map_io
= omap242x_map_io
,
358 .init_early
= omap2420_init_early
,
359 .init_irq
= omap2_init_irq
,
360 .handle_irq
= omap2_intc_handle_irq
,
361 .init_machine
= omap_h4_init
,
362 .init_late
= omap2420_init_late
,
363 .init_time
= omap2_sync32k_timer_init
,
364 .restart
= omap2xxx_restart
,