2009-03-22 07:22:11 -07:00
|
|
|
/*
|
|
|
|
*
|
2009-11-05 11:15:31 -07:00
|
|
|
* QNAP TS-11x/TS-21x Turbo NAS Board Setup
|
2009-03-22 07:22:11 -07:00
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
|
|
|
|
* Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/mv643xx_eth.h>
|
|
|
|
#include <linux/ata_platform.h>
|
|
|
|
#include <linux/gpio_keys.h>
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <mach/kirkwood.h>
|
|
|
|
#include "common.h"
|
|
|
|
#include "mpp.h"
|
2009-11-05 13:27:46 -07:00
|
|
|
#include "tsx1x-common.h"
|
2009-03-22 07:22:11 -07:00
|
|
|
|
|
|
|
static struct i2c_board_info __initdata qnap_ts219_i2c_rtc = {
|
|
|
|
I2C_BOARD_INFO("s35390a", 0x30),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
|
|
|
|
.phy_addr = MV643XX_ETH_PHY_ADDR(8),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mv_sata_platform_data qnap_ts219_sata_data = {
|
|
|
|
.n_ports = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_button qnap_ts219_buttons[] = {
|
|
|
|
{
|
|
|
|
.code = KEY_COPY,
|
|
|
|
.gpio = 15,
|
|
|
|
.desc = "USB Copy",
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.code = KEY_RESTART,
|
|
|
|
.gpio = 16,
|
|
|
|
.desc = "Reset",
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data qnap_ts219_button_data = {
|
|
|
|
.buttons = qnap_ts219_buttons,
|
|
|
|
.nbuttons = ARRAY_SIZE(qnap_ts219_buttons),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device qnap_ts219_button_device = {
|
|
|
|
.name = "gpio-keys",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &qnap_ts219_button_data,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static unsigned int qnap_ts219_mpp_config[] __initdata = {
|
|
|
|
MPP0_SPI_SCn,
|
|
|
|
MPP1_SPI_MOSI,
|
|
|
|
MPP2_SPI_SCK,
|
|
|
|
MPP3_SPI_MISO,
|
2009-05-19 10:35:26 -07:00
|
|
|
MPP4_SATA1_ACTn,
|
|
|
|
MPP5_SATA0_ACTn,
|
2010-06-08 01:00:22 -07:00
|
|
|
MPP8_TW0_SDA,
|
|
|
|
MPP9_TW0_SCK,
|
2009-03-22 07:22:11 -07:00
|
|
|
MPP10_UART0_TXD,
|
|
|
|
MPP11_UART0_RXD,
|
|
|
|
MPP13_UART1_TXD, /* PIC controller */
|
|
|
|
MPP14_UART1_RXD, /* PIC controller */
|
2010-12-06 14:53:16 -07:00
|
|
|
MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
|
|
|
|
MPP16_GPIO, /* Reset button (on devices with 88F6281) */
|
2009-11-05 11:09:01 -07:00
|
|
|
MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
|
2010-12-06 14:53:16 -07:00
|
|
|
MPP37_GPIO, /* Reset button (on devices with 88F6282) */
|
|
|
|
MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
|
2010-06-13 11:37:18 -07:00
|
|
|
MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
|
2009-03-22 07:22:11 -07:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init qnap_ts219_init(void)
|
|
|
|
{
|
2010-12-06 14:53:16 -07:00
|
|
|
u32 dev, rev;
|
|
|
|
|
2009-03-22 07:22:11 -07:00
|
|
|
/*
|
|
|
|
* Basic setup. Needs to be called early.
|
|
|
|
*/
|
|
|
|
kirkwood_init();
|
|
|
|
kirkwood_mpp_conf(qnap_ts219_mpp_config);
|
|
|
|
|
|
|
|
kirkwood_uart0_init();
|
|
|
|
kirkwood_uart1_init(); /* A PIC controller is connected here. */
|
2009-11-05 13:27:46 -07:00
|
|
|
qnap_tsx1x_register_flash();
|
2009-03-22 07:22:11 -07:00
|
|
|
kirkwood_i2c_init();
|
|
|
|
i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1);
|
2010-12-06 14:53:16 -07:00
|
|
|
|
|
|
|
kirkwood_pcie_id(&dev, &rev);
|
|
|
|
if (dev == MV88F6282_DEV_ID) {
|
|
|
|
qnap_ts219_buttons[0].gpio = 43; /* USB Copy button */
|
|
|
|
qnap_ts219_buttons[1].gpio = 37; /* Reset button */
|
|
|
|
qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
|
|
|
|
}
|
|
|
|
|
2009-03-22 07:22:11 -07:00
|
|
|
kirkwood_ge00_init(&qnap_ts219_ge00_data);
|
|
|
|
kirkwood_sata_init(&qnap_ts219_sata_data);
|
|
|
|
kirkwood_ehci_init();
|
|
|
|
platform_device_register(&qnap_ts219_button_device);
|
|
|
|
|
2009-11-05 13:27:46 -07:00
|
|
|
pm_power_off = qnap_tsx1x_power_off;
|
2009-03-22 07:22:11 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-08-19 16:24:03 -07:00
|
|
|
static int __init ts219_pci_init(void)
|
|
|
|
{
|
2010-06-08 04:21:34 -07:00
|
|
|
if (machine_is_ts219())
|
|
|
|
kirkwood_pcie_init(KW_PCIE0);
|
2009-08-19 16:24:03 -07:00
|
|
|
|
2010-06-08 04:21:34 -07:00
|
|
|
return 0;
|
2009-08-19 16:24:03 -07:00
|
|
|
}
|
|
|
|
subsys_initcall(ts219_pci_init);
|
|
|
|
|
2009-03-22 07:22:11 -07:00
|
|
|
MACHINE_START(TS219, "QNAP TS-119/TS-219")
|
|
|
|
/* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
|
|
|
|
.boot_params = 0x00000100,
|
|
|
|
.init_machine = qnap_ts219_init,
|
|
|
|
.map_io = kirkwood_map_io,
|
2010-10-15 07:50:26 -07:00
|
|
|
.init_early = kirkwood_init_early,
|
2009-03-22 07:22:11 -07:00
|
|
|
.init_irq = kirkwood_init_irq,
|
|
|
|
.timer = &kirkwood_timer,
|
|
|
|
MACHINE_END
|