Path: blob/master/arch/arm/mach-orion5x/lsmini-setup.c
10817 views
/*1* arch/arm/mach-orion5x/lsmini-setup.c2*3* Maintainer: Alexey Kopytko <[email protected]>4*5* This file is licensed under the terms of the GNU General Public6* License version 2. This program is licensed "as is" without any7* warranty of any kind, whether express or implied.8*/910#include <linux/kernel.h>11#include <linux/init.h>12#include <linux/platform_device.h>13#include <linux/mtd/physmap.h>14#include <linux/mv643xx_eth.h>15#include <linux/leds.h>16#include <linux/gpio_keys.h>17#include <linux/input.h>18#include <linux/i2c.h>19#include <linux/ata_platform.h>20#include <linux/gpio.h>21#include <asm/mach-types.h>22#include <asm/mach/arch.h>23#include <asm/system.h>24#include <mach/orion5x.h>25#include "common.h"26#include "mpp.h"2728/*****************************************************************************29* Linkstation Mini Info30****************************************************************************/3132/*33* 256K NOR flash Device bus boot chip select34*/3536#define LSMINI_NOR_BOOT_BASE 0xf400000037#define LSMINI_NOR_BOOT_SIZE SZ_256K3839/*****************************************************************************40* 256KB NOR Flash on BOOT Device41****************************************************************************/4243static struct physmap_flash_data lsmini_nor_flash_data = {44.width = 1,45};4647static struct resource lsmini_nor_flash_resource = {48.flags = IORESOURCE_MEM,49.start = LSMINI_NOR_BOOT_BASE,50.end = LSMINI_NOR_BOOT_BASE + LSMINI_NOR_BOOT_SIZE - 1,51};5253static struct platform_device lsmini_nor_flash = {54.name = "physmap-flash",55.id = 0,56.dev = {57.platform_data = &lsmini_nor_flash_data,58},59.num_resources = 1,60.resource = &lsmini_nor_flash_resource,61};6263/*****************************************************************************64* Ethernet65****************************************************************************/6667static struct mv643xx_eth_platform_data lsmini_eth_data = {68.phy_addr = 8,69};7071/*****************************************************************************72* RTC 5C372a on I2C bus73****************************************************************************/7475static struct i2c_board_info __initdata lsmini_i2c_rtc = {76I2C_BOARD_INFO("rs5c372a", 0x32),77};7879/*****************************************************************************80* LEDs attached to GPIO81****************************************************************************/8283#define LSMINI_GPIO_LED_ALARM 284#define LSMINI_GPIO_LED_INFO 385#define LSMINI_GPIO_LED_FUNC 986#define LSMINI_GPIO_LED_PWR 148788static struct gpio_led lsmini_led_pins[] = {89{90.name = "alarm:red",91.gpio = LSMINI_GPIO_LED_ALARM,92.active_low = 1,93}, {94.name = "info:amber",95.gpio = LSMINI_GPIO_LED_INFO,96.active_low = 1,97}, {98.name = "func:blue:top",99.gpio = LSMINI_GPIO_LED_FUNC,100.active_low = 1,101}, {102.name = "power:blue:bottom",103.gpio = LSMINI_GPIO_LED_PWR,104},105};106107static struct gpio_led_platform_data lsmini_led_data = {108.leds = lsmini_led_pins,109.num_leds = ARRAY_SIZE(lsmini_led_pins),110};111112static struct platform_device lsmini_leds = {113.name = "leds-gpio",114.id = -1,115.dev = {116.platform_data = &lsmini_led_data,117},118};119120/****************************************************************************121* GPIO Attached Keys122****************************************************************************/123124#define LSMINI_GPIO_KEY_FUNC 15125#define LSMINI_GPIO_KEY_POWER 18126#define LSMINI_GPIO_KEY_AUTOPOWER 17127128#define LSMINI_SW_POWER 0x00129#define LSMINI_SW_AUTOPOWER 0x01130131static struct gpio_keys_button lsmini_buttons[] = {132{133.code = KEY_OPTION,134.gpio = LSMINI_GPIO_KEY_FUNC,135.desc = "Function Button",136.active_low = 1,137}, {138.type = EV_SW,139.code = LSMINI_SW_POWER,140.gpio = LSMINI_GPIO_KEY_POWER,141.desc = "Power-on Switch",142.active_low = 1,143}, {144.type = EV_SW,145.code = LSMINI_SW_AUTOPOWER,146.gpio = LSMINI_GPIO_KEY_AUTOPOWER,147.desc = "Power-auto Switch",148.active_low = 1,149},150};151152static struct gpio_keys_platform_data lsmini_button_data = {153.buttons = lsmini_buttons,154.nbuttons = ARRAY_SIZE(lsmini_buttons),155};156157static struct platform_device lsmini_button_device = {158.name = "gpio-keys",159.id = -1,160.num_resources = 0,161.dev = {162.platform_data = &lsmini_button_data,163},164};165166167/*****************************************************************************168* SATA169****************************************************************************/170static struct mv_sata_platform_data lsmini_sata_data = {171.n_ports = 2,172};173174175/*****************************************************************************176* Linkstation Mini specific power off method: reboot177****************************************************************************/178/*179* On the Linkstation Mini, the shutdown process is following:180* - Userland monitors key events until the power switch goes to off position181* - The board reboots182* - U-boot starts and goes into an idle mode waiting for the user183* to move the switch to ON position184*/185186static void lsmini_power_off(void)187{188arm_machine_restart('h', NULL);189}190191192/*****************************************************************************193* General Setup194****************************************************************************/195196#define LSMINI_GPIO_USB_POWER 16197#define LSMINI_GPIO_AUTO_POWER 17198#define LSMINI_GPIO_POWER 18199200#define LSMINI_GPIO_HDD_POWER0 1201#define LSMINI_GPIO_HDD_POWER1 19202203static unsigned int lsmini_mpp_modes[] __initdata = {204MPP0_UNUSED, /* LED_RESERVE1 (unused) */205MPP1_GPIO, /* HDD_PWR */206MPP2_GPIO, /* LED_ALARM */207MPP3_GPIO, /* LED_INFO */208MPP4_UNUSED,209MPP5_UNUSED,210MPP6_UNUSED,211MPP7_UNUSED,212MPP8_UNUSED,213MPP9_GPIO, /* LED_FUNC */214MPP10_UNUSED,215MPP11_UNUSED, /* LED_ETH (dummy) */216MPP12_UNUSED,217MPP13_UNUSED,218MPP14_GPIO, /* LED_PWR */219MPP15_GPIO, /* FUNC */220MPP16_GPIO, /* USB_PWR */221MPP17_GPIO, /* AUTO_POWER */222MPP18_GPIO, /* POWER */223MPP19_GPIO, /* HDD_PWR1 */2240,225};226227static void __init lsmini_init(void)228{229/*230* Setup basic Orion functions. Need to be called early.231*/232orion5x_init();233234orion5x_mpp_conf(lsmini_mpp_modes);235236/*237* Configure peripherals.238*/239orion5x_ehci0_init();240orion5x_ehci1_init();241orion5x_eth_init(&lsmini_eth_data);242orion5x_i2c_init();243orion5x_sata_init(&lsmini_sata_data);244orion5x_uart0_init();245orion5x_xor_init();246247orion5x_setup_dev_boot_win(LSMINI_NOR_BOOT_BASE,248LSMINI_NOR_BOOT_SIZE);249platform_device_register(&lsmini_nor_flash);250251platform_device_register(&lsmini_button_device);252253platform_device_register(&lsmini_leds);254255i2c_register_board_info(0, &lsmini_i2c_rtc, 1);256257/* enable USB power */258gpio_set_value(LSMINI_GPIO_USB_POWER, 1);259260/* register power-off method */261pm_power_off = lsmini_power_off;262263pr_info("%s: finished\n", __func__);264}265266#ifdef CONFIG_MACH_LINKSTATION_MINI267MACHINE_START(LINKSTATION_MINI, "Buffalo Linkstation Mini")268/* Maintainer: Alexey Kopytko <[email protected]> */269.boot_params = 0x00000100,270.init_machine = lsmini_init,271.map_io = orion5x_map_io,272.init_early = orion5x_init_early,273.init_irq = orion5x_init_irq,274.timer = &orion5x_timer,275.fixup = tag_fixup_mem32,276MACHINE_END277#endif278279280