Second set of OMAP PRCM cleanups for 3.8. These patches remove the use of omap_prcm_get_reset_sources() from the OMAP watchdog driver, and remove mach-omap2/prcm.c and plat-omap/include/plat/prcm.h. Basic test logs for this branch on top of Tony's cleanup-prcm branch at commit7fc54fd308
are here: http://www.pwsan.com/omap/testlogs/prcm_cleanup_b_3.8/20121108151646/ However, cleanup-prcm at7fc54fd3
does not include some fixes that are needed for a successful test. With several reverts, fixes, and workarounds applied, the following test logs were obtained: http://www.pwsan.com/omap/testlogs/TEST_prcm_cleanup_b_3.8/20121108151930/ which indicate that the series tests cleanly. This second pull request updates one of the patches which broke with rmk's allnoconfigs, and also updates the tag description to indicate that7fc54fd3
is building cleanly here. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJQoY0GAAoJEBvUPslcq6Vza0MQAI0idVoOclIHCC63tpc58YWA BpD5OLg4yRu0RUFS1CI/Fq5d+9PfYUspgaWja3TTgUy0EHRDVUUFRaxJdpWdl2NF gX7BCuhnQenznTbCE80nEmxvsh7U/dfvs+JYUK2PriypU61f1+TnSu9ZxTRvDJOx vbo1cfsioVcLfnBPSDSQVJ1fufbafklpeQkDNeRI8UDsCVeXwnxhNsXB3utoJMf0 5gaDaCdRBoimkLnAaLi41OnHYC7IbNCnl/VX0i/xffROsINfL7LDkBPfUOnR5vle jTCV49UEB/P5ekk2cvKKj8IOQZdimiCppWMLit6DObX7LbltTKuXx6T0PclgxQ14 hhav5O+f8NYA4yDAY/xxPlTvShMr8rQcYV6pg1G1OgD+dcq7cbbWNJAvbUJ03hH8 dqZ+ypLYkazb3Mm5XtpFr47gkoaFnCQbgZLXpjJ8+L01aGNrF2L6aE789So1N81+ X1s0ENjRxzDLNcqwxqhcoph0YQe7GlyiviYb7ev25MTSC3/TjrupTViZbKocZmLt Ad9m4SOktbHthAw0jdA48vOmPiSvmYzFiqzMhz/ryeNbyyV6rRxe5w4JUjPzHPxc U7NraSGIAzpqM3EKEp7Rb0yOfh6sGzML/FH9bS25+Rv37yKW0huc6ENIRgatZpY2 blLzsxaKfQgLeqKT82mj =tS2z -----END PGP SIGNATURE----- Merge tag 'omap-for-v3.8/cleanup-prcm-part2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/cleanup From Tony Lindgren <tony@atomide.com>: More PRCM cleanups via Paul Walmsley <paul@pwsan.com>: Second set of OMAP PRCM cleanups for 3.8. These patches remove the use of omap_prcm_get_reset_sources() from the OMAP watchdog driver, and remove mach-omap2/prcm.c and plat-omap/include/plat/prcm.h. Basic test logs for this branch on top of Tony's cleanup-prcm branch at commit7fc54fd308
are here: http://www.pwsan.com/omap/testlogs/prcm_cleanup_b_3.8/20121108151646/ However, cleanup-prcm at7fc54fd3
does not include some fixes that are needed for a successful test. With several reverts, fixes, and workarounds applied, the following test logs were obtained: http://www.pwsan.com/omap/testlogs/TEST_prcm_cleanup_b_3.8/20121108151930/ which indicate that the series tests cleanly. This second pull request updates one of the patches which broke with rmk's allnoconfigs, and also updates the tag description to indicate that7fc54fd3
is building cleanly here. * tag 'omap-for-v3.8/cleanup-prcm-part2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (27 commits) ARM: OMAP2: Fix compillation error in cm_common ARM: OMAP2+: PRCM: remove obsolete prcm.[ch] ARM: OMAP2+: hwmod: call to _omap4_disable_module() should use the SoC-specific call ARM: OMAP2+: PRCM: consolidate PRCM-related timeout macros ARM: OMAP2+: PRCM: split and relocate the PRM/CM globals setup ARM: OMAP2+: PRCM: remove omap2_cm_wait_idlest() ARM: OMAP2+: CM/clock: convert _omap2_module_wait_ready() to use SoC-independent CM functions ARM: OMAP2xxx: APLL/CM: convert to use omap2_cm_wait_module_ready() ARM: OMAP2+: board files: use SoC-specific system restart functions ARM: OMAP2+: PRCM: create SoC-specific chip restart functions ARM: OMAP2xxx: clock: move virt_prcm_set code into clkt2xxx_virt_prcm_set.c ARM: OMAP2xxx: clock: remove global 'dclk' variable ARM: OMAP2/3: PRM: add SoC reset functions (using the CORE DPLL method) ARM: OMAP2+: common: remove mach-omap2/common.c globals and map_common_io code ARM: OMAP2+: PRCM: remove omap_prcm_get_reset_sources() watchdog: OMAP: use standard GETBOOTSTATUS interface; use platform_data fn ptr ARM: OMAP2+: WDT: move init; add read_reset_sources pdata function pointer ARM: OMAP1: CGRM: fix omap1_get_reset_sources() return type ARM: OMAP2+: PRM: create PRM reset source API for the watchdog timer driver ARM: OMAP1: create read_reset_sources() function (for initial use by watchdog) ... Conflicts: arch/arm/mach-omap2/cm33xx.c arch/arm/mach-omap2/io.c arch/arm/mach-omap2/prm_common.c Signed-off-by: Arnd Bergmann <arnd@arndb.de>
391 lines
9.6 KiB
C
391 lines
9.6 KiB
C
/*
|
|
* linux/arch/arm/mach-omap2/board-h4.c
|
|
*
|
|
* Copyright (C) 2005 Nokia Corporation
|
|
* Author: Paul Mundt <paul.mundt@nokia.com>
|
|
*
|
|
* Modified from mach-omap/omap1/board-generic.c
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/gpio.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/mtd/partitions.h>
|
|
#include <linux/mtd/physmap.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/workqueue.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/i2c/at24.h>
|
|
#include <linux/input.h>
|
|
#include <linux/err.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/io.h>
|
|
#include <linux/input/matrix_keypad.h>
|
|
#include <linux/mfd/menelaus.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <plat-omap/dma-omap.h>
|
|
#include <plat/debug-devices.h>
|
|
|
|
#include <video/omapdss.h>
|
|
#include <video/omap-panel-generic-dpi.h>
|
|
|
|
#include "common.h"
|
|
#include "mux.h"
|
|
#include "control.h"
|
|
#include "gpmc.h"
|
|
|
|
#define H4_FLASH_CS 0
|
|
#define H4_SMC91X_CS 1
|
|
|
|
#define H4_ETHR_GPIO_IRQ 92
|
|
|
|
#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
|
|
static const uint32_t board_matrix_keys[] = {
|
|
KEY(0, 0, KEY_LEFT),
|
|
KEY(1, 0, KEY_RIGHT),
|
|
KEY(2, 0, KEY_A),
|
|
KEY(3, 0, KEY_B),
|
|
KEY(4, 0, KEY_C),
|
|
KEY(0, 1, KEY_DOWN),
|
|
KEY(1, 1, KEY_UP),
|
|
KEY(2, 1, KEY_E),
|
|
KEY(3, 1, KEY_F),
|
|
KEY(4, 1, KEY_G),
|
|
KEY(0, 2, KEY_ENTER),
|
|
KEY(1, 2, KEY_I),
|
|
KEY(2, 2, KEY_J),
|
|
KEY(3, 2, KEY_K),
|
|
KEY(4, 2, KEY_3),
|
|
KEY(0, 3, KEY_M),
|
|
KEY(1, 3, KEY_N),
|
|
KEY(2, 3, KEY_O),
|
|
KEY(3, 3, KEY_P),
|
|
KEY(4, 3, KEY_Q),
|
|
KEY(0, 4, KEY_R),
|
|
KEY(1, 4, KEY_4),
|
|
KEY(2, 4, KEY_T),
|
|
KEY(3, 4, KEY_U),
|
|
KEY(4, 4, KEY_ENTER),
|
|
KEY(0, 5, KEY_V),
|
|
KEY(1, 5, KEY_W),
|
|
KEY(2, 5, KEY_L),
|
|
KEY(3, 5, KEY_S),
|
|
KEY(4, 5, KEY_ENTER),
|
|
};
|
|
|
|
static const struct matrix_keymap_data board_keymap_data = {
|
|
.keymap = board_matrix_keys,
|
|
.keymap_size = ARRAY_SIZE(board_matrix_keys),
|
|
};
|
|
|
|
static unsigned int board_keypad_row_gpios[] = {
|
|
88, 89, 124, 11, 6, 96
|
|
};
|
|
|
|
static unsigned int board_keypad_col_gpios[] = {
|
|
90, 91, 100, 36, 12, 97, 98
|
|
};
|
|
|
|
static struct matrix_keypad_platform_data board_keypad_platform_data = {
|
|
.keymap_data = &board_keymap_data,
|
|
.row_gpios = board_keypad_row_gpios,
|
|
.num_row_gpios = ARRAY_SIZE(board_keypad_row_gpios),
|
|
.col_gpios = board_keypad_col_gpios,
|
|
.num_col_gpios = ARRAY_SIZE(board_keypad_col_gpios),
|
|
.active_low = 1,
|
|
|
|
.debounce_ms = 20,
|
|
.col_scan_delay_us = 5,
|
|
};
|
|
|
|
static struct platform_device board_keyboard = {
|
|
.name = "matrix-keypad",
|
|
.id = -1,
|
|
.dev = {
|
|
.platform_data = &board_keypad_platform_data,
|
|
},
|
|
};
|
|
static void __init board_mkp_init(void)
|
|
{
|
|
omap_mux_init_gpio(88, OMAP_PULL_ENA | OMAP_PULL_UP);
|
|
omap_mux_init_gpio(89, OMAP_PULL_ENA | OMAP_PULL_UP);
|
|
omap_mux_init_gpio(124, OMAP_PULL_ENA | OMAP_PULL_UP);
|
|
omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP);
|
|
if (omap_has_menelaus()) {
|
|
omap_mux_init_signal("sdrc_a14.gpio0",
|
|
OMAP_PULL_ENA | OMAP_PULL_UP);
|
|
omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
|
|
omap_mux_init_signal("gpio_98", 0);
|
|
board_keypad_row_gpios[5] = 0;
|
|
board_keypad_col_gpios[2] = 15;
|
|
board_keypad_col_gpios[6] = 18;
|
|
} else {
|
|
omap_mux_init_signal("gpio_96", OMAP_PULL_ENA | OMAP_PULL_UP);
|
|
omap_mux_init_signal("gpio_100", 0);
|
|
omap_mux_init_signal("gpio_98", 0);
|
|
}
|
|
omap_mux_init_signal("gpio_90", 0);
|
|
omap_mux_init_signal("gpio_91", 0);
|
|
omap_mux_init_signal("gpio_36", 0);
|
|
omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
|
|
omap_mux_init_signal("gpio_97", 0);
|
|
|
|
platform_device_register(&board_keyboard);
|
|
}
|
|
#else
|
|
static inline void board_mkp_init(void)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
static struct mtd_partition h4_partitions[] = {
|
|
/* bootloader (U-Boot, etc) in first sector */
|
|
{
|
|
.name = "bootloader",
|
|
.offset = 0,
|
|
.size = SZ_128K,
|
|
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
|
},
|
|
/* bootloader params in the next sector */
|
|
{
|
|
.name = "params",
|
|
.offset = MTDPART_OFS_APPEND,
|
|
.size = SZ_128K,
|
|
.mask_flags = 0,
|
|
},
|
|
/* kernel */
|
|
{
|
|
.name = "kernel",
|
|
.offset = MTDPART_OFS_APPEND,
|
|
.size = SZ_2M,
|
|
.mask_flags = 0
|
|
},
|
|
/* file system */
|
|
{
|
|
.name = "filesystem",
|
|
.offset = MTDPART_OFS_APPEND,
|
|
.size = MTDPART_SIZ_FULL,
|
|
.mask_flags = 0
|
|
}
|
|
};
|
|
|
|
static struct physmap_flash_data h4_flash_data = {
|
|
.width = 2,
|
|
.parts = h4_partitions,
|
|
.nr_parts = ARRAY_SIZE(h4_partitions),
|
|
};
|
|
|
|
static struct resource h4_flash_resource = {
|
|
.flags = IORESOURCE_MEM,
|
|
};
|
|
|
|
static struct platform_device h4_flash_device = {
|
|
.name = "physmap-flash",
|
|
.id = 0,
|
|
.dev = {
|
|
.platform_data = &h4_flash_data,
|
|
},
|
|
.num_resources = 1,
|
|
.resource = &h4_flash_resource,
|
|
};
|
|
|
|
static struct platform_device *h4_devices[] __initdata = {
|
|
&h4_flash_device,
|
|
};
|
|
|
|
static struct panel_generic_dpi_data h4_panel_data = {
|
|
.name = "h4",
|
|
};
|
|
|
|
static struct omap_dss_device h4_lcd_device = {
|
|
.name = "lcd",
|
|
.driver_name = "generic_dpi_panel",
|
|
.type = OMAP_DISPLAY_TYPE_DPI,
|
|
.phy.dpi.data_lines = 16,
|
|
.data = &h4_panel_data,
|
|
};
|
|
|
|
static struct omap_dss_device *h4_dss_devices[] = {
|
|
&h4_lcd_device,
|
|
};
|
|
|
|
static struct omap_dss_board_info h4_dss_data = {
|
|
.num_devices = ARRAY_SIZE(h4_dss_devices),
|
|
.devices = h4_dss_devices,
|
|
.default_device = &h4_lcd_device,
|
|
};
|
|
|
|
/* 2420 Sysboot setup (2430 is different) */
|
|
static u32 get_sysboot_value(void)
|
|
{
|
|
return (omap_ctrl_readl(OMAP24XX_CONTROL_STATUS) &
|
|
(OMAP2_SYSBOOT_5_MASK | OMAP2_SYSBOOT_4_MASK |
|
|
OMAP2_SYSBOOT_3_MASK | OMAP2_SYSBOOT_2_MASK |
|
|
OMAP2_SYSBOOT_1_MASK | OMAP2_SYSBOOT_0_MASK));
|
|
}
|
|
|
|
/* H4-2420's always used muxed mode, H4-2422's always use non-muxed
|
|
*
|
|
* Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423
|
|
* correctly. The macro needs to look at production_id not just hawkeye.
|
|
*/
|
|
static u32 is_gpmc_muxed(void)
|
|
{
|
|
u32 mux;
|
|
mux = get_sysboot_value();
|
|
if ((mux & 0xF) == 0xd)
|
|
return 1; /* NAND config (could be either) */
|
|
if (mux & 0x2) /* if mux'ed */
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
static inline void __init h4_init_debug(void)
|
|
{
|
|
int eth_cs;
|
|
unsigned long cs_mem_base;
|
|
unsigned int muxed, rate;
|
|
struct clk *gpmc_fck;
|
|
|
|
eth_cs = H4_SMC91X_CS;
|
|
|
|
gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */
|
|
if (IS_ERR(gpmc_fck)) {
|
|
WARN_ON(1);
|
|
return;
|
|
}
|
|
|
|
clk_prepare_enable(gpmc_fck);
|
|
rate = clk_get_rate(gpmc_fck);
|
|
clk_disable_unprepare(gpmc_fck);
|
|
clk_put(gpmc_fck);
|
|
|
|
if (is_gpmc_muxed())
|
|
muxed = 0x200;
|
|
else
|
|
muxed = 0;
|
|
|
|
/* Make sure CS1 timings are correct */
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1,
|
|
0x00011000 | muxed);
|
|
|
|
if (rate >= 160000000) {
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
|
|
} else if (rate >= 130000000) {
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
|
|
} else {/* rate = 100000000 */
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F);
|
|
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2);
|
|
}
|
|
|
|
if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
|
|
printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
|
|
goto out;
|
|
}
|
|
|
|
udelay(100);
|
|
|
|
omap_mux_init_gpio(92, 0);
|
|
if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0)
|
|
gpmc_cs_free(eth_cs);
|
|
|
|
out:
|
|
clk_disable_unprepare(gpmc_fck);
|
|
clk_put(gpmc_fck);
|
|
}
|
|
|
|
static void __init h4_init_flash(void)
|
|
{
|
|
unsigned long base;
|
|
|
|
if (gpmc_cs_request(H4_FLASH_CS, SZ_64M, &base) < 0) {
|
|
printk("Can't request GPMC CS for flash\n");
|
|
return;
|
|
}
|
|
h4_flash_resource.start = base;
|
|
h4_flash_resource.end = base + SZ_64M - 1;
|
|
}
|
|
|
|
static struct at24_platform_data m24c01 = {
|
|
.byte_len = SZ_1K / 8,
|
|
.page_size = 16,
|
|
};
|
|
|
|
static struct i2c_board_info __initdata h4_i2c_board_info[] = {
|
|
{
|
|
I2C_BOARD_INFO("isp1301_omap", 0x2d),
|
|
},
|
|
{ /* EEPROM on mainboard */
|
|
I2C_BOARD_INFO("24c01", 0x52),
|
|
.platform_data = &m24c01,
|
|
},
|
|
{ /* EEPROM on cpu card */
|
|
I2C_BOARD_INFO("24c01", 0x57),
|
|
.platform_data = &m24c01,
|
|
},
|
|
};
|
|
|
|
#ifdef CONFIG_OMAP_MUX
|
|
static struct omap_board_mux board_mux[] __initdata = {
|
|
{ .reg_offset = OMAP_MUX_TERMINATOR },
|
|
};
|
|
#endif
|
|
|
|
static void __init omap_h4_init(void)
|
|
{
|
|
omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAF);
|
|
|
|
/*
|
|
* Make sure the serial ports are muxed on at this point.
|
|
* You have to mux them off in device drivers later on
|
|
* if not needed.
|
|
*/
|
|
|
|
board_mkp_init();
|
|
h4_i2c_board_info[0].irq = gpio_to_irq(125);
|
|
i2c_register_board_info(1, h4_i2c_board_info,
|
|
ARRAY_SIZE(h4_i2c_board_info));
|
|
|
|
platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
|
|
omap_serial_init();
|
|
omap_sdrc_init(NULL, NULL);
|
|
h4_init_flash();
|
|
|
|
omap_display_init(&h4_dss_data);
|
|
}
|
|
|
|
MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
|
|
/* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
|
|
.atag_offset = 0x100,
|
|
.reserve = omap_reserve,
|
|
.map_io = omap242x_map_io,
|
|
.init_early = omap2420_init_early,
|
|
.init_irq = omap2_init_irq,
|
|
.handle_irq = omap2_intc_handle_irq,
|
|
.init_machine = omap_h4_init,
|
|
.init_late = omap2420_init_late,
|
|
.timer = &omap2_timer,
|
|
.restart = omap2xxx_restart,
|
|
MACHINE_END
|