]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/mach-kirkwood/board-dreamplug.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[karo-tx-linux.git] / arch / arm / mach-kirkwood / board-dreamplug.c
1 /*
2  * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3  *
4  * arch/arm/mach-kirkwood/board-dreamplug.c
5  *
6  * Marvell DreamPlug Reference Board Init for drivers not converted to
7  * flattened device tree yet.
8  *
9  * This file is licensed under the terms of the GNU General Public
10  * License version 2.  This program is licensed "as is" without any
11  * warranty of any kind, whether express or implied.
12  */
13
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/mtd/partitions.h>
18 #include <linux/ata_platform.h>
19 #include <linux/mv643xx_eth.h>
20 #include <linux/of.h>
21 #include <linux/of_address.h>
22 #include <linux/of_fdt.h>
23 #include <linux/of_irq.h>
24 #include <linux/of_platform.h>
25 #include <linux/gpio.h>
26 #include <linux/leds.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/spi/flash.h>
29 #include <linux/spi/spi.h>
30 #include <linux/spi/orion_spi.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <mach/kirkwood.h>
35 #include <mach/bridge-regs.h>
36 #include <plat/mvsdio.h>
37 #include "common.h"
38 #include "mpp.h"
39
40 struct mtd_partition dreamplug_partitions[] = {
41         {
42                 .name   = "u-boot",
43                 .size   = SZ_512K,
44                 .offset = 0,
45         },
46         {
47                 .name   = "u-boot env",
48                 .size   = SZ_64K,
49                 .offset = SZ_512K + SZ_512K,
50         },
51         {
52                 .name   = "dtb",
53                 .size   = SZ_64K,
54                 .offset = SZ_512K + SZ_512K + SZ_512K,
55         },
56 };
57
58 static const struct flash_platform_data dreamplug_spi_slave_data = {
59         .type           = "mx25l1606e",
60         .name           = "spi_flash",
61         .parts          = dreamplug_partitions,
62         .nr_parts       = ARRAY_SIZE(dreamplug_partitions),
63 };
64
65 static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
66         {
67                 .modalias       = "m25p80",
68                 .platform_data  = &dreamplug_spi_slave_data,
69                 .irq            = -1,
70                 .max_speed_hz   = 50000000,
71                 .bus_num        = 0,
72                 .chip_select    = 0,
73         },
74 };
75
76 static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
77         .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
78 };
79
80 static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
81         .phy_addr       = MV643XX_ETH_PHY_ADDR(1),
82 };
83
84 static struct mv_sata_platform_data dreamplug_sata_data = {
85         .n_ports        = 1,
86 };
87
88 static struct mvsdio_platform_data dreamplug_mvsdio_data = {
89         /* unfortunately the CD signal has not been connected */
90 };
91
92 static struct gpio_led dreamplug_led_pins[] = {
93         {
94                 .name                   = "dreamplug:blue:bluetooth",
95                 .gpio                   = 47,
96                 .active_low             = 1,
97         },
98         {
99                 .name                   = "dreamplug:green:wifi",
100                 .gpio                   = 48,
101                 .active_low             = 1,
102         },
103         {
104                 .name                   = "dreamplug:green:wifi_ap",
105                 .gpio                   = 49,
106                 .active_low             = 1,
107         },
108 };
109
110 static struct gpio_led_platform_data dreamplug_led_data = {
111         .leds           = dreamplug_led_pins,
112         .num_leds       = ARRAY_SIZE(dreamplug_led_pins),
113 };
114
115 static struct platform_device dreamplug_leds = {
116         .name   = "leds-gpio",
117         .id     = -1,
118         .dev    = {
119                 .platform_data  = &dreamplug_led_data,
120         }
121 };
122
123 static unsigned int dreamplug_mpp_config[] __initdata = {
124         MPP0_SPI_SCn,
125         MPP1_SPI_MOSI,
126         MPP2_SPI_SCK,
127         MPP3_SPI_MISO,
128         MPP47_GPIO,     /* Bluetooth LED */
129         MPP48_GPIO,     /* Wifi LED */
130         MPP49_GPIO,     /* Wifi AP LED */
131         0
132 };
133
134 void __init dreamplug_init(void)
135 {
136         /*
137          * Basic setup. Needs to be called early.
138          */
139         kirkwood_mpp_conf(dreamplug_mpp_config);
140
141         spi_register_board_info(dreamplug_spi_slave_info,
142                                 ARRAY_SIZE(dreamplug_spi_slave_info));
143         kirkwood_spi_init();
144
145         kirkwood_ehci_init();
146         kirkwood_ge00_init(&dreamplug_ge00_data);
147         kirkwood_ge01_init(&dreamplug_ge01_data);
148         kirkwood_sata_init(&dreamplug_sata_data);
149         kirkwood_sdio_init(&dreamplug_mvsdio_data);
150
151         platform_device_register(&dreamplug_leds);
152 }