OSDN Git Service

ARM: Orion: SPI: Add clk/clkdev support.
[uclinux-h8/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 <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <mach/kirkwood.h>
34 #include <mach/bridge-regs.h>
35 #include <plat/mvsdio.h>
36 #include "common.h"
37 #include "mpp.h"
38
39 struct mtd_partition dreamplug_partitions[] = {
40         {
41                 .name   = "u-boot",
42                 .size   = SZ_512K,
43                 .offset = 0,
44         },
45         {
46                 .name   = "u-boot env",
47                 .size   = SZ_64K,
48                 .offset = SZ_512K + SZ_512K,
49         },
50         {
51                 .name   = "dtb",
52                 .size   = SZ_64K,
53                 .offset = SZ_512K + SZ_512K + SZ_512K,
54         },
55 };
56
57 static const struct flash_platform_data dreamplug_spi_slave_data = {
58         .type           = "mx25l1606e",
59         .name           = "spi_flash",
60         .parts          = dreamplug_partitions,
61         .nr_parts       = ARRAY_SIZE(dreamplug_partitions),
62 };
63
64 static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
65         {
66                 .modalias       = "m25p80",
67                 .platform_data  = &dreamplug_spi_slave_data,
68                 .irq            = -1,
69                 .max_speed_hz   = 50000000,
70                 .bus_num        = 0,
71                 .chip_select    = 0,
72         },
73 };
74
75 static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
76         .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
77 };
78
79 static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
80         .phy_addr       = MV643XX_ETH_PHY_ADDR(1),
81 };
82
83 static struct mv_sata_platform_data dreamplug_sata_data = {
84         .n_ports        = 1,
85 };
86
87 static struct mvsdio_platform_data dreamplug_mvsdio_data = {
88         /* unfortunately the CD signal has not been connected */
89 };
90
91 static struct gpio_led dreamplug_led_pins[] = {
92         {
93                 .name                   = "dreamplug:blue:bluetooth",
94                 .gpio                   = 47,
95                 .active_low             = 1,
96         },
97         {
98                 .name                   = "dreamplug:green:wifi",
99                 .gpio                   = 48,
100                 .active_low             = 1,
101         },
102         {
103                 .name                   = "dreamplug:green:wifi_ap",
104                 .gpio                   = 49,
105                 .active_low             = 1,
106         },
107 };
108
109 static struct gpio_led_platform_data dreamplug_led_data = {
110         .leds           = dreamplug_led_pins,
111         .num_leds       = ARRAY_SIZE(dreamplug_led_pins),
112 };
113
114 static struct platform_device dreamplug_leds = {
115         .name   = "leds-gpio",
116         .id     = -1,
117         .dev    = {
118                 .platform_data  = &dreamplug_led_data,
119         }
120 };
121
122 static unsigned int dreamplug_mpp_config[] __initdata = {
123         MPP0_SPI_SCn,
124         MPP1_SPI_MOSI,
125         MPP2_SPI_SCK,
126         MPP3_SPI_MISO,
127         MPP47_GPIO,     /* Bluetooth LED */
128         MPP48_GPIO,     /* Wifi LED */
129         MPP49_GPIO,     /* Wifi AP LED */
130         0
131 };
132
133 void __init dreamplug_init(void)
134 {
135         /*
136          * Basic setup. Needs to be called early.
137          */
138         kirkwood_mpp_conf(dreamplug_mpp_config);
139
140         spi_register_board_info(dreamplug_spi_slave_info,
141                                 ARRAY_SIZE(dreamplug_spi_slave_info));
142         kirkwood_spi_init();
143
144         kirkwood_ehci_init();
145         kirkwood_ge00_init(&dreamplug_ge00_data);
146         kirkwood_ge01_init(&dreamplug_ge01_data);
147         kirkwood_sata_init(&dreamplug_sata_data);
148         kirkwood_sdio_init(&dreamplug_mvsdio_data);
149
150         platform_device_register(&dreamplug_leds);
151 }