Andrew Lunn | 9eb61f4 | 2012-05-12 14:57:59 +0200 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT |
| 4 | * |
| 5 | * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch> |
| 6 | * |
| 7 | * Based on the board file ts219-setup.c: |
| 8 | * |
| 9 | * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com> |
| 10 | * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com> |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version |
| 15 | * 2 of the License, or (at your option) any later version. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/mv643xx_eth.h> |
| 22 | #include <linux/ata_platform.h> |
| 23 | #include <linux/gpio_keys.h> |
| 24 | #include <linux/input.h> |
| 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <mach/kirkwood.h> |
| 28 | #include "common.h" |
| 29 | #include "mpp.h" |
| 30 | #include "tsx1x-common.h" |
| 31 | |
| 32 | static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = { |
| 33 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
| 34 | }; |
| 35 | |
Andrew Lunn | 9eb61f4 | 2012-05-12 14:57:59 +0200 | [diff] [blame] | 36 | static unsigned int qnap_ts219_mpp_config[] __initdata = { |
| 37 | MPP0_SPI_SCn, |
| 38 | MPP1_SPI_MOSI, |
| 39 | MPP2_SPI_SCK, |
| 40 | MPP3_SPI_MISO, |
| 41 | MPP4_SATA1_ACTn, |
| 42 | MPP5_SATA0_ACTn, |
| 43 | MPP8_TW0_SDA, |
| 44 | MPP9_TW0_SCK, |
| 45 | MPP10_UART0_TXD, |
| 46 | MPP11_UART0_RXD, |
| 47 | MPP13_UART1_TXD, /* PIC controller */ |
| 48 | MPP14_UART1_RXD, /* PIC controller */ |
| 49 | MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */ |
| 50 | MPP16_GPIO, /* Reset button (on devices with 88F6281) */ |
| 51 | MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */ |
| 52 | MPP37_GPIO, /* Reset button (on devices with 88F6282) */ |
| 53 | MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */ |
| 54 | MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */ |
| 55 | 0 |
| 56 | }; |
| 57 | |
| 58 | void __init qnap_dt_ts219_init(void) |
| 59 | { |
| 60 | u32 dev, rev; |
| 61 | |
| 62 | kirkwood_mpp_conf(qnap_ts219_mpp_config); |
| 63 | |
| 64 | kirkwood_pcie_id(&dev, &rev); |
| 65 | if (dev == MV88F6282_DEV_ID) |
| 66 | qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); |
| 67 | |
| 68 | kirkwood_ge00_init(&qnap_ts219_ge00_data); |
Andrew Lunn | 9eb61f4 | 2012-05-12 14:57:59 +0200 | [diff] [blame] | 69 | |
| 70 | pm_power_off = qnap_tsx1x_power_off; |
| 71 | } |
| 72 | |
| 73 | /* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */ |
| 74 | static int __init ts219_pci_init(void) |
| 75 | { |
| 76 | if (machine_is_ts219()) |
| 77 | kirkwood_pcie_init(KW_PCIE0); |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | subsys_initcall(ts219_pci_init); |