11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 2dbdf9cedfcc81202360763530412d746d798b7b6Tony Lindgren * linux/arch/arm/mach-omap1/board-voiceblue.c 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Modified from board-generic.c 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (C) 2004 2N Telekomunikace, Ladislav Michl <michl@2n.cz> 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Code for OMAP5910 based VoiceBlue board (VoIP to GSM gateway). 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is free software; you can redistribute it and/or modify 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * it under the terms of the GNU General Public License version 2 as 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * published by the Free Software Foundation. 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/delay.h> 162f8163baada3dbd0ce891c35bc59ae46e773487aRussell King#include <linux/gpio.h> 17d052d1beff706920e82c5d55006b08e256b5df09Russell King#include <linux/platform_device.h> 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/interrupt.h> 19652bcd8f72cc0cdf4499ce7d73990514e5e3e4b9Tony Lindgren#include <linux/irq.h> 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/init.h> 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/kernel.h> 22561b036ad9d0b4f0cd311d2e38025919c2cb437fLadislav Michl#include <linux/mtd/physmap.h> 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/notifier.h> 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/reboot.h> 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/serial_8250.h> 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/serial_reg.h> 273bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl#include <linux/smc91x.h> 28dc28094b905a872f8884f1f1c48ca86b3b78583aPaul Gortmaker#include <linux/export.h> 297b6d864b48d95e6ea1df7df64475b9cb9616dcf9Robin Holt#include <linux/reboot.h> 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/mach-types.h> 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/mach/arch.h> 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/mach/map.h> 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 35c510da1c642b56d32206b2d9d62098784063d152Tony Lindgren#include <mach/board-voiceblue.h> 36578fad4d16742b281a626a1d1725f2c16c386cf7Tony Lindgren#include <mach/flash.h> 3770c494c3122fb3d53518aea53c8cf5d61cad909aTony Lindgren#include <mach/mux.h> 3854b693d46772f59fcfcb2cdd0f8b4bff2392b188Tony Lindgren#include <mach/tc.h> 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 402e3ee9f45b3c25faa012abc9a62ab7aa515cd617Tony Lindgren#include <mach/hardware.h> 41b924b2047045844644e04b3c6e8308b2114afe7eTony Lindgren#include <mach/usb.h> 422e3ee9f45b3c25faa012abc9a62ab7aa515cd617Tony Lindgren 432e3ee9f45b3c25faa012abc9a62ab7aa515cd617Tony Lindgren#include "common.h" 442e3ee9f45b3c25faa012abc9a62ab7aa515cd617Tony Lindgren 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct plat_serial8250_port voiceblue_ports[] = { 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x40000), 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .iotype = UPIO_MEM, 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .regshift = 1, 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .uartclk = 3686400, 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds }, 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x50000), 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .iotype = UPIO_MEM, 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .regshift = 1, 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .uartclk = 3686400, 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds }, 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x60000), 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .iotype = UPIO_MEM, 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .regshift = 1, 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .uartclk = 3686400, 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds }, 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x70000), 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .iotype = UPIO_MEM, 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .regshift = 1, 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .uartclk = 3686400, 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds }, 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { }, 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct platform_device serial_device = { 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .name = "serial8250", 796df29debb7fc04ac3f92038c57437f40bab4e72dRussell King .id = PLAT8250_DEV_PLATFORM1, 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic int __init ext_uart_init(void) 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 847f9187c26fd120bd2f0ce089e5f46c4bd3c4193bTony Lindgren if (!machine_is_voiceblue()) 857f9187c26fd120bd2f0ce089e5f46c4bd3c4193bTony Lindgren return -ENODEV; 867f9187c26fd120bd2f0ce089e5f46c4bd3c4193bTony Lindgren 8746a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma voiceblue_ports[0].irq = gpio_to_irq(12); 8846a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma voiceblue_ports[1].irq = gpio_to_irq(13); 8946a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma voiceblue_ports[2].irq = gpio_to_irq(14); 9046a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma voiceblue_ports[3].irq = gpio_to_irq(15); 9146a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma serial_device.dev.platform_data = voiceblue_ports; 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return platform_device_register(&serial_device); 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsarch_initcall(ext_uart_init); 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 96561b036ad9d0b4f0cd311d2e38025919c2cb437fLadislav Michlstatic struct physmap_flash_data voiceblue_flash_data = { 977c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .width = 2, 98561b036ad9d0b4f0cd311d2e38025919c2cb437fLadislav Michl .set_vpp = omap1_set_vpp, 997c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren}; 1007c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren 1017c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgrenstatic struct resource voiceblue_flash_resource = { 1027c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .start = OMAP_CS0_PHYS, 1037c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .end = OMAP_CS0_PHYS + SZ_32M - 1, 1047c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .flags = IORESOURCE_MEM, 1057c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren}; 1067c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren 1077c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgrenstatic struct platform_device voiceblue_flash_device = { 108561b036ad9d0b4f0cd311d2e38025919c2cb437fLadislav Michl .name = "physmap-flash", 1097c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .id = 0, 1107c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .dev = { 1117c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .platform_data = &voiceblue_flash_data, 1127c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren }, 1137c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .num_resources = 1, 1147c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren .resource = &voiceblue_flash_resource, 1157c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren}; 1167c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren 1173bc48014782a89f7201734d3e23865cb283926a7Ladislav Michlstatic struct smc91x_platdata voiceblue_smc91x_info = { 1183bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 1193bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl .leda = RPC_LED_100_10, 1203bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl .ledb = RPC_LED_TX_RX, 1213bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl}; 1223bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct resource voiceblue_smc91x_resources[] = { 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds [0] = { 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .start = OMAP_CS2_PHYS + 0x300, 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .end = OMAP_CS2_PHYS + 0x300 + 16, 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .flags = IORESOURCE_MEM, 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds }, 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds [1] = { 130e7b3dc7ef1e27fd5713a0df71f82c0a27de1c2ebRussell King .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds }, 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct platform_device voiceblue_smc91x_device = { 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .name = "smc91x", 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .id = 0, 1373bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl .dev = { 1383bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl .platform_data = &voiceblue_smc91x_info, 1393bc48014782a89f7201734d3e23865cb283926a7Ladislav Michl }, 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .num_resources = ARRAY_SIZE(voiceblue_smc91x_resources), 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .resource = voiceblue_smc91x_resources, 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct platform_device *voiceblue_devices[] __initdata = { 1457c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren &voiceblue_flash_device, 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds &voiceblue_smc91x_device, 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct omap_usb_config voiceblue_usb_config __initdata = { 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .hmc_mode = 3, 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .register_host = 1, 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .register_dev = 1, 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .pins[0] = 2, 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .pins[1] = 6, 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .pins[2] = 6, 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MACHINE_PANICED 1 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MACHINE_REBOOTING 2 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MACHINE_REBOOT 4 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic unsigned long machine_state; 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic int panic_event(struct notifier_block *this, unsigned long event, 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds void *ptr) 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (test_and_set_bit(MACHINE_PANICED, &machine_state)) 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return NOTIFY_DONE; 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1697c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren /* Flash power LED */ 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds omap_writeb(0x78, OMAP_LPG1_LCR); 1717c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgren omap_writeb(0x01, OMAP_LPG1_PMR); /* Enable clock */ 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return NOTIFY_DONE; 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic struct notifier_block panic_block = { 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .notifier_call = panic_event, 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1807c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgrenstatic int __init voiceblue_setup(void) 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 1827f9187c26fd120bd2f0ce089e5f46c4bd3c4193bTony Lindgren if (!machine_is_voiceblue()) 1837f9187c26fd120bd2f0ce089e5f46c4bd3c4193bTony Lindgren return -ENODEV; 1847f9187c26fd120bd2f0ce089e5f46c4bd3c4193bTony Lindgren 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Setup panic notifier */ 186a524626b113e36fc70cb456449444018e3045d5fTony Lindgren atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return 0; 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 1907c38cf021b42a4297bc8f860ab627734bdd6c8d1Tony Lindgrenpostcore_initcall(voiceblue_setup); 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic int wdt_gpio_state; 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid voiceblue_wdt_enable(void) 1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 196e918edf7c2f2270dcf18cdcbdf86174a013a124eDavid Brownell gpio_direction_output(0, 0); 1970b84b5ca43a9c86cfad848c135fdbf7c72af68faDavid Brownell gpio_set_value(0, 1); 1980b84b5ca43a9c86cfad848c135fdbf7c72af68faDavid Brownell gpio_set_value(0, 0); 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds wdt_gpio_state = 0; 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid voiceblue_wdt_disable(void) 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2040b84b5ca43a9c86cfad848c135fdbf7c72af68faDavid Brownell gpio_set_value(0, 0); 2050b84b5ca43a9c86cfad848c135fdbf7c72af68faDavid Brownell gpio_set_value(0, 1); 2060b84b5ca43a9c86cfad848c135fdbf7c72af68faDavid Brownell gpio_set_value(0, 0); 20740e3925ba15b604c9ff87154d77a914221d11cdcDavid Brownell gpio_direction_input(0); 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid voiceblue_wdt_ping(void) 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (test_bit(MACHINE_REBOOT, &machine_state)) 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return; 2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds wdt_gpio_state = !wdt_gpio_state; 2160b84b5ca43a9c86cfad848c135fdbf7c72af68faDavid Brownell gpio_set_value(0, wdt_gpio_state); 2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 2181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2197b6d864b48d95e6ea1df7df64475b9cb9616dcf9Robin Holtstatic void voiceblue_restart(enum reboot_mode mode, const char *cmd) 2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 221ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* 222ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 223ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux * "Global Software Reset Affects Traffic Controller Frequency". 224ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux */ 225ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux if (cpu_is_omap5912()) { 226ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4), DPLL_CTL); 227ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_writew(0x8, ARM_RSTCT1); 228ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux } 229ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux 2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds set_bit(MACHINE_REBOOT, &machine_state); 2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds voiceblue_wdt_enable(); 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (1) ; 2331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsEXPORT_SYMBOL(voiceblue_wdt_enable); 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsEXPORT_SYMBOL(voiceblue_wdt_disable); 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsEXPORT_SYMBOL(voiceblue_wdt_ping); 2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 239ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linuxstatic void __init voiceblue_init(void) 240ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux{ 241ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* mux pins for uarts */ 242ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_cfg_reg(UART1_TX); 243ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_cfg_reg(UART1_RTS); 244ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_cfg_reg(UART2_TX); 245ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_cfg_reg(UART2_RTS); 246ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_cfg_reg(UART3_TX); 247ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_cfg_reg(UART3_RX); 248ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux 249ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* Watchdog */ 250ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(0, "Watchdog"); 251ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* smc91x reset */ 252ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(7, "SMC91x reset"); 253ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_direction_output(7, 1); 254ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux udelay(2); /* wait at least 100ns */ 255ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_set_value(7, 0); 256ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux mdelay(50); /* 50ms until PHY ready */ 257ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* smc91x interrupt pin */ 258ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(8, "SMC91x irq"); 259ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* 16C554 reset*/ 260ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(6, "16C554 reset"); 261ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_direction_output(6, 0); 262ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* 16C554 interrupt pins */ 263ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(12, "16C554 irq"); 264ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(13, "16C554 irq"); 265ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(14, "16C554 irq"); 266ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux gpio_request(15, "16C554 irq"); 2676845664a6a7d443f03883db59d10749d38d98b8eThomas Gleixner irq_set_irq_type(gpio_to_irq(12), IRQ_TYPE_EDGE_RISING); 2686845664a6a7d443f03883db59d10749d38d98b8eThomas Gleixner irq_set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING); 2696845664a6a7d443f03883db59d10749d38d98b8eThomas Gleixner irq_set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING); 2706845664a6a7d443f03883db59d10749d38d98b8eThomas Gleixner irq_set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING); 271ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux 27246a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma voiceblue_smc91x_resources[1].start = gpio_to_irq(8); 27346a0a5402f7b477bc98bf26596c2234f2ddbf473Tarun Kanti DebBarma voiceblue_smc91x_resources[1].end = gpio_to_irq(8); 274ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); 275ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_serial_init(); 276ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap1_usb_init(&voiceblue_usb_config); 277ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_register_i2c_bus(1, 100, NULL, 0); 278ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux 279ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux /* There is a good chance board is going up, so enable power LED 280ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux * (it is connected through invertor) */ 281ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_writeb(0x00, OMAP_LPG1_LCR); 282ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux omap_writeb(0x00, OMAP_LPG1_PMR); /* Disable clock */ 283ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux} 284ee54dba9c360944b34e06478c05c6f283bf64edaRussell King - ARM Linux 2851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsMACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") 286e9dea0c65d2de6981356c055781fb99d7191b14eRussell King /* Maintainer: Ladislav Michl <michl@2n.cz> */ 287246e389d2a9e326f0a03a3be64eb77dd06f593dcNicolas Pitre .atag_offset = 0x100, 2887b88e62f5d219a86d81bdf4388012c97dc42e8f8Tony Lindgren .map_io = omap15xx_map_io, 2897b88e62f5d219a86d81bdf4388012c97dc42e8f8Tony Lindgren .init_early = omap1_init_early, 2907b88e62f5d219a86d81bdf4388012c97dc42e8f8Tony Lindgren .init_irq = omap1_init_irq, 291e9dea0c65d2de6981356c055781fb99d7191b14eRussell King .init_machine = voiceblue_init, 29282c3bd03535f1571426fdd19b7d832f76b7ac85eShawn Guo .init_late = omap1_init_late, 2936bb27d7349db51b50c40534710fe164ca0d58902Stephen Warren .init_time = omap1_timer_init, 294baa9588344d35d751d6e2b1677ec67e7b32d2878Russell King .restart = voiceblue_restart, 2951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus TorvaldsMACHINE_END 296