]> git.karo-electronics.de Git - mv-sheeva.git/blob - arch/arm/mach-kirkwood/tk71-setup.c
Update to reflect new board init
[mv-sheeva.git] / arch / arm / mach-kirkwood / tk71-setup.c
1 /*
2  * arch/arm/mach-kirkwood/tk71-setup.c
3  * based on
4  * arch/arm/mach-kirkwood/rd88f6281-setup.c
5  *
6  * TK71 Kirkwood based Q7 formfactor board
7  *
8  * This file is licensed under the terms of the GNU General Public
9  * License version 2.  This program is licensed "as is" without any
10  * warranty of any kind, whether express or implied.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/irq.h>
17 #include <linux/mtd/nand.h>
18 #include <linux/mtd/partitions.h>
19 #include <linux/ata_platform.h>
20 #include <linux/mv643xx_eth.h>
21 #include <linux/gpio.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <mach/kirkwood.h>
25 #include <plat/mvsdio.h>
26 #include <plat/orion_nand.h>
27 #include "common.h"
28 #include "mpp.h"
29
30 static struct mtd_partition tk71_nand_parts[] = {
31         {
32                 .name = "u-boot",
33                 .offset = 0,
34                 .size = 0x80000
35         }, {
36                 .name = "u-boot-env",
37                 .offset = MTDPART_OFS_NXTBLK,
38                 .size = 0x80000
39         }, {
40                 .name = "kernel",
41                 .offset = MTDPART_OFS_NXTBLK,
42                 .size = 0x300000
43         }, {
44                 .name = "root",
45                 .offset = MTDPART_OFS_NXTBLK,
46                 .size = MTDPART_SIZ_FULL
47         },
48 };
49
50 static struct mv643xx_eth_platform_data tk71_ge00_data = {
51         .phy_addr       = MV643XX_ETH_PHY_ADDR(8),
52         /* in case a hardcoded MAC address is needed uncomment next line */
53         /* .mac_addr    = {0x00, 0x0c, 0xc6, 0x76, 0x76, 0x2b}, */
54 };
55
56 static struct mv643xx_eth_platform_data tk71_ge01_data = {
57         .phy_addr       = MV643XX_ETH_PHY_ADDR(28),
58         /* in case a hardcoded MAC address is needed uncomment next line */
59         /* .mac_addr    = {0x00, 0x0c, 0xc6, 0x76, 0x76, 0x2c}, */
60 };
61
62 static struct mv_sata_platform_data tk71_sata_data = {
63         .n_ports        = 2,
64 };
65
66 static struct mvsdio_platform_data tk71_mvsdio_data = {
67         .gpio_card_detect = 29,
68 };
69
70 static unsigned int tk71_mpp_config[] __initdata = {
71 #if 0
72         MPP0_SPI_SCn,           /* SPI - currently unused */
73         MPP1_SPI_MOSI,
74         MPP2_SPI_SCK,
75         MPP3_SPI_MISO,
76 #endif
77         MPP7_PEX_RST_OUTn,      /* PCIe #reset */
78         MPP8_TW0_SDA,           /* I2C */
79         MPP9_TW0_SCK,           /* I2C */
80         MPP20_GE1_TXD0,         /* second GigE */
81         MPP21_GE1_TXD1,
82         MPP22_GE1_TXD2,
83         MPP23_GE1_TXD3,
84         MPP24_GE1_RXD0,
85         MPP25_GE1_RXD1,
86         MPP26_GE1_RXD2,
87         MPP27_GE1_RXD3,
88         MPP28_GPIO,             /* PHY2 RESET */
89         MPP29_GPIO,             /* SDIO_CD# */
90         MPP30_GE1_RXCTL,
91         MPP31_GE1_RXCLK,
92         MPP32_GE1_TCLKOUT,
93         MPP33_GE1_TXCTL,
94         MPP34_GPIO,             /* SDIO_PWR# */
95         0
96 };
97
98 static void __init tk71_init(void)
99 {
100         /*
101          * Basic setup. Needs to be called early.
102          */
103         kirkwood_init();
104
105         kirkwood_mpp_conf(tk71_mpp_config);
106
107         kirkwood_uart0_init();
108
109         kirkwood_nand_init(ARRAY_AND_SIZE(tk71_nand_parts), 25);
110
111         /* kirkwood_spi_init(); */ /* if you want to use SPI, uncomment this and MPP setup above*/
112
113         kirkwood_i2c_init();
114
115         /* eth0 */
116         kirkwood_ge00_init(&tk71_ge00_data);
117
118         /* eth1 */
119         if (gpio_request(28, "PHY2 reset") != 0 ||
120                 gpio_direction_input(28) != 0) /* high-z */
121                 pr_err("can't deassert GPIO 28 (PHY2 reset)\n");
122         else
123                 kirkwood_ge01_init(&tk71_ge01_data);
124
125         kirkwood_sata_init(&tk71_sata_data);
126
127         kirkwood_ehci_init();
128
129         if (gpio_request(34, "SDIO Power Enable") != 0 ||
130                 gpio_direction_output(34, 0) != 0) /* low active */
131                 pr_err("can't set up GPIO 34 (SDIO Power Enable)\n");
132         kirkwood_sdio_init(&tk71_mvsdio_data);
133 }
134
135 static int __init tk71_pci_init(void)
136 {
137         if (machine_is_tk71())
138                 kirkwood_pcie_init(KW_PCIE0);
139
140         return 0;
141 }
142 subsys_initcall(tk71_pci_init);
143
144 MACHINE_START(TK71, "TK71 Kirkwood based Q7 formfactor board")
145         /* Maintainer: Nils Faerber <nils.faerber@kernelconcepts.de> */
146         .boot_params    = 0x00000100,
147         .init_machine   = tk71_init,
148         .map_io         = kirkwood_map_io,
149         .init_irq       = kirkwood_init_irq,
150         .timer          = &kirkwood_timer,
151 MACHINE_END