Path: blob/master/arch/arm/mach-kirkwood/ts219-setup.c
10817 views
/*1*2* QNAP TS-11x/TS-21x Turbo NAS Board Setup3*4* Copyright (C) 2009 Martin Michlmayr <[email protected]>5* Copyright (C) 2008 Byron Bradley <[email protected]>6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License9* as published by the Free Software Foundation; either version10* 2 of the License, or (at your option) any later version.11*/1213#include <linux/kernel.h>14#include <linux/init.h>15#include <linux/platform_device.h>16#include <linux/i2c.h>17#include <linux/mv643xx_eth.h>18#include <linux/ata_platform.h>19#include <linux/gpio_keys.h>20#include <linux/input.h>21#include <asm/mach-types.h>22#include <asm/mach/arch.h>23#include <mach/kirkwood.h>24#include "common.h"25#include "mpp.h"26#include "tsx1x-common.h"2728static struct i2c_board_info __initdata qnap_ts219_i2c_rtc = {29I2C_BOARD_INFO("s35390a", 0x30),30};3132static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {33.phy_addr = MV643XX_ETH_PHY_ADDR(8),34};3536static struct mv_sata_platform_data qnap_ts219_sata_data = {37.n_ports = 2,38};3940static struct gpio_keys_button qnap_ts219_buttons[] = {41{42.code = KEY_COPY,43.gpio = 15,44.desc = "USB Copy",45.active_low = 1,46},47{48.code = KEY_RESTART,49.gpio = 16,50.desc = "Reset",51.active_low = 1,52},53};5455static struct gpio_keys_platform_data qnap_ts219_button_data = {56.buttons = qnap_ts219_buttons,57.nbuttons = ARRAY_SIZE(qnap_ts219_buttons),58};5960static struct platform_device qnap_ts219_button_device = {61.name = "gpio-keys",62.id = -1,63.num_resources = 0,64.dev = {65.platform_data = &qnap_ts219_button_data,66}67};6869static unsigned int qnap_ts219_mpp_config[] __initdata = {70MPP0_SPI_SCn,71MPP1_SPI_MOSI,72MPP2_SPI_SCK,73MPP3_SPI_MISO,74MPP4_SATA1_ACTn,75MPP5_SATA0_ACTn,76MPP8_TW0_SDA,77MPP9_TW0_SCK,78MPP10_UART0_TXD,79MPP11_UART0_RXD,80MPP13_UART1_TXD, /* PIC controller */81MPP14_UART1_RXD, /* PIC controller */82MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */83MPP16_GPIO, /* Reset button (on devices with 88F6281) */84MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */85MPP37_GPIO, /* Reset button (on devices with 88F6282) */86MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */87MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */88089};9091static void __init qnap_ts219_init(void)92{93u32 dev, rev;9495/*96* Basic setup. Needs to be called early.97*/98kirkwood_init();99kirkwood_mpp_conf(qnap_ts219_mpp_config);100101kirkwood_uart0_init();102kirkwood_uart1_init(); /* A PIC controller is connected here. */103qnap_tsx1x_register_flash();104kirkwood_i2c_init();105i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1);106107kirkwood_pcie_id(&dev, &rev);108if (dev == MV88F6282_DEV_ID) {109qnap_ts219_buttons[0].gpio = 43; /* USB Copy button */110qnap_ts219_buttons[1].gpio = 37; /* Reset button */111qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);112}113114kirkwood_ge00_init(&qnap_ts219_ge00_data);115kirkwood_sata_init(&qnap_ts219_sata_data);116kirkwood_ehci_init();117platform_device_register(&qnap_ts219_button_device);118119pm_power_off = qnap_tsx1x_power_off;120121}122123static int __init ts219_pci_init(void)124{125if (machine_is_ts219())126kirkwood_pcie_init(KW_PCIE0);127128return 0;129}130subsys_initcall(ts219_pci_init);131132MACHINE_START(TS219, "QNAP TS-119/TS-219")133/* Maintainer: Martin Michlmayr <[email protected]> */134.boot_params = 0x00000100,135.init_machine = qnap_ts219_init,136.map_io = kirkwood_map_io,137.init_early = kirkwood_init_early,138.init_irq = kirkwood_init_irq,139.timer = &kirkwood_timer,140MACHINE_END141142143