2009-11-05 17:45:32 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup
|
|
|
|
*
|
2010-05-22 01:23:10 +00:00
|
|
|
* Copyright (C) 2009-2010 Martin Michlmayr <tbm@cyrius.com>
|
2009-11-05 17:45:32 +00:00
|
|
|
* 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>
|
2010-05-22 01:23:10 +00:00
|
|
|
#include <linux/gpio.h>
|
2009-11-05 17:45:32 +00:00
|
|
|
#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 20:27:46 +00:00
|
|
|
#include "tsx1x-common.h"
|
2009-11-05 17:45:32 +00:00
|
|
|
|
2010-10-21 19:48:33 +00:00
|
|
|
/* for the PCIe reset workaround */
|
|
|
|
#include <plat/pcie.h>
|
|
|
|
|
|
|
|
|
2010-05-22 01:23:10 +00:00
|
|
|
#define QNAP_TS41X_JUMPER_JP1 45
|
|
|
|
|
2009-11-05 17:45:32 +00:00
|
|
|
static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
|
|
|
|
I2C_BOARD_INFO("s35390a", 0x30),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mv643xx_eth_platform_data qnap_ts41x_ge00_data = {
|
|
|
|
.phy_addr = MV643XX_ETH_PHY_ADDR(8),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mv643xx_eth_platform_data qnap_ts41x_ge01_data = {
|
|
|
|
.phy_addr = MV643XX_ETH_PHY_ADDR(0),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mv_sata_platform_data qnap_ts41x_sata_data = {
|
|
|
|
.n_ports = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_button qnap_ts41x_buttons[] = {
|
|
|
|
{
|
|
|
|
.code = KEY_COPY,
|
|
|
|
.gpio = 43,
|
|
|
|
.desc = "USB Copy",
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.code = KEY_RESTART,
|
|
|
|
.gpio = 37,
|
|
|
|
.desc = "Reset",
|
|
|
|
.active_low = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data qnap_ts41x_button_data = {
|
|
|
|
.buttons = qnap_ts41x_buttons,
|
|
|
|
.nbuttons = ARRAY_SIZE(qnap_ts41x_buttons),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device qnap_ts41x_button_device = {
|
|
|
|
.name = "gpio-keys",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &qnap_ts41x_button_data,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static unsigned int qnap_ts41x_mpp_config[] __initdata = {
|
|
|
|
MPP0_SPI_SCn,
|
|
|
|
MPP1_SPI_MOSI,
|
|
|
|
MPP2_SPI_SCK,
|
|
|
|
MPP3_SPI_MISO,
|
|
|
|
MPP6_SYSRST_OUTn,
|
|
|
|
MPP7_PEX_RST_OUTn,
|
2010-06-08 08:00:22 +00:00
|
|
|
MPP8_TW0_SDA,
|
|
|
|
MPP9_TW0_SCK,
|
2009-11-05 17:45:32 +00:00
|
|
|
MPP10_UART0_TXD,
|
|
|
|
MPP11_UART0_RXD,
|
|
|
|
MPP13_UART1_TXD, /* PIC controller */
|
|
|
|
MPP14_UART1_RXD, /* PIC controller */
|
|
|
|
MPP15_SATA0_ACTn,
|
|
|
|
MPP16_SATA1_ACTn,
|
2010-06-08 08:00:22 +00:00
|
|
|
MPP20_GE1_TXD0,
|
|
|
|
MPP21_GE1_TXD1,
|
|
|
|
MPP22_GE1_TXD2,
|
|
|
|
MPP23_GE1_TXD3,
|
|
|
|
MPP24_GE1_RXD0,
|
|
|
|
MPP25_GE1_RXD1,
|
|
|
|
MPP26_GE1_RXD2,
|
|
|
|
MPP27_GE1_RXD3,
|
|
|
|
MPP30_GE1_RXCTL,
|
|
|
|
MPP31_GE1_RXCLK,
|
|
|
|
MPP32_GE1_TCLKOUT,
|
|
|
|
MPP33_GE1_TXCTL,
|
2009-11-05 17:45:32 +00:00
|
|
|
MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
|
|
|
|
MPP37_GPIO, /* Reset button */
|
|
|
|
MPP43_GPIO, /* USB Copy button */
|
|
|
|
MPP44_GPIO, /* Board ID: 0: TS-419U, 1: TS-419 */
|
2010-05-25 17:20:14 +00:00
|
|
|
MPP45_GPIO, /* JP1: 0: LCD, 1: serial console */
|
2009-11-05 17:45:32 +00:00
|
|
|
MPP46_GPIO, /* External SATA HDD1 error indicator */
|
|
|
|
MPP47_GPIO, /* External SATA HDD2 error indicator */
|
|
|
|
MPP48_GPIO, /* External SATA HDD3 error indicator */
|
|
|
|
MPP49_GPIO, /* External SATA HDD4 error indicator */
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init qnap_ts41x_init(void)
|
|
|
|
{
|
2010-12-06 21:53:16 +00:00
|
|
|
u32 dev, rev;
|
|
|
|
|
2009-11-05 17:45:32 +00:00
|
|
|
/*
|
|
|
|
* Basic setup. Needs to be called early.
|
|
|
|
*/
|
|
|
|
kirkwood_init();
|
|
|
|
kirkwood_mpp_conf(qnap_ts41x_mpp_config);
|
|
|
|
|
|
|
|
kirkwood_uart0_init();
|
|
|
|
kirkwood_uart1_init(); /* A PIC controller is connected here. */
|
2009-11-05 20:27:46 +00:00
|
|
|
qnap_tsx1x_register_flash();
|
2009-11-05 17:45:32 +00:00
|
|
|
kirkwood_i2c_init();
|
|
|
|
i2c_register_board_info(0, &qnap_ts41x_i2c_rtc, 1);
|
2010-12-06 21:53:16 +00:00
|
|
|
|
|
|
|
kirkwood_pcie_id(&dev, &rev);
|
|
|
|
if (dev == MV88F6282_DEV_ID) {
|
|
|
|
qnap_ts41x_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
|
|
|
|
qnap_ts41x_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
|
|
|
|
}
|
2009-11-05 17:45:32 +00:00
|
|
|
kirkwood_ge00_init(&qnap_ts41x_ge00_data);
|
|
|
|
kirkwood_ge01_init(&qnap_ts41x_ge01_data);
|
2010-12-06 21:53:16 +00:00
|
|
|
|
2009-11-05 17:45:32 +00:00
|
|
|
kirkwood_sata_init(&qnap_ts41x_sata_data);
|
|
|
|
kirkwood_ehci_init();
|
|
|
|
platform_device_register(&qnap_ts41x_button_device);
|
|
|
|
|
2009-11-05 20:27:46 +00:00
|
|
|
pm_power_off = qnap_tsx1x_power_off;
|
2009-11-05 17:45:32 +00:00
|
|
|
|
2010-05-22 01:23:10 +00:00
|
|
|
if (gpio_request(QNAP_TS41X_JUMPER_JP1, "JP1") == 0)
|
|
|
|
gpio_export(QNAP_TS41X_JUMPER_JP1, 0);
|
2009-11-05 17:45:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int __init ts41x_pci_init(void)
|
|
|
|
{
|
2010-10-21 19:48:33 +00:00
|
|
|
if (machine_is_ts41x()) {
|
2011-02-14 16:38:13 +00:00
|
|
|
u32 dev, rev;
|
|
|
|
|
2010-10-21 19:48:33 +00:00
|
|
|
/*
|
|
|
|
* Without this explicit reset, the PCIe SATA controller
|
|
|
|
* (Marvell 88sx7042/sata_mv) is known to stop working
|
|
|
|
* after a few minutes.
|
|
|
|
*/
|
|
|
|
orion_pcie_reset((void __iomem *)PCIE_VIRT_BASE);
|
|
|
|
|
2011-02-14 16:38:13 +00:00
|
|
|
kirkwood_pcie_id(&dev, &rev);
|
|
|
|
if (dev == MV88F6282_DEV_ID)
|
|
|
|
kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
|
|
|
|
else
|
|
|
|
kirkwood_pcie_init(KW_PCIE0);
|
2010-10-21 19:48:33 +00:00
|
|
|
}
|
2009-11-05 17:45:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
subsys_initcall(ts41x_pci_init);
|
|
|
|
|
|
|
|
MACHINE_START(TS41X, "QNAP TS-41x")
|
|
|
|
/* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
|
2011-07-06 02:38:13 +00:00
|
|
|
.atag_offset = 0x100,
|
2009-11-05 17:45:32 +00:00
|
|
|
.init_machine = qnap_ts41x_init,
|
|
|
|
.map_io = kirkwood_map_io,
|
2010-10-15 14:50:26 +00:00
|
|
|
.init_early = kirkwood_init_early,
|
2009-11-05 17:45:32 +00:00
|
|
|
.init_irq = kirkwood_init_irq,
|
|
|
|
.timer = &kirkwood_timer,
|
2011-11-05 10:03:47 +00:00
|
|
|
.restart = kirkwood_restart,
|
2009-11-05 17:45:32 +00:00
|
|
|
MACHINE_END
|