921faaf55ace6bd29771919597bbcbcd59a23675
[openwrt.git] / target / linux / kirkwood / patches / 100-dockstar.patch
1 This patch adds support for the Seagate FreeAgent DockStar, a Marvell
2 Sheevaplug derivative.  I have already registered the DOCKSTAR machine
3 ID.
4
5 Signed-off-by: Eric Cooper <ecc@xxxxxxx>
6 ---
7  arch/arm/mach-kirkwood/Kconfig          |    6 ++
8  arch/arm/mach-kirkwood/Makefile         |    1 +
9  arch/arm/mach-kirkwood/dockstar-setup.c |  112 +++++++++++++++++++++++++++++++
10  arch/arm/tools/mach-types               |    1 +
11  4 files changed, 120 insertions(+), 0 deletions(-)
12  create mode 100644 arch/arm/mach-kirkwood/dockstar-setup.c
13
14 diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
15 index 29b2163..74d832f 100644
16 --- a/arch/arm/mach-kirkwood/Kconfig
17 +++ b/arch/arm/mach-kirkwood/Kconfig
18 @@ -32,6 +32,12 @@ config MACH_TS219
19           Say 'Y' here if you want your kernel to support the
20           QNAP TS-119 and TS-219 Turbo NAS devices.
21  
22 +config MACH_DOCKSTAR
23 +       bool "Seagate FreeAgent DockStar"
24 +       help
25 +         Say 'Y' here if you want your kernel to support the
26 +         Seagate FreeAgent DockStar.
27 +
28  endmenu
29   
30  endif
31 diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
32 index c0cd5d3..025b256 100644
33 --- a/arch/arm/mach-kirkwood/Makefile
34 +++ b/arch/arm/mach-kirkwood/Makefile
35 @@ -6,4 +6,5 @@ obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG)     += sheevaplug-setup.o
36  obj-$(CONFIG_MACH_SHEEVAPLUG)          += sheevaplug-setup.o
37  obj-$(CONFIG_MACH_TS219)               += ts219-setup.o tsx1x-common.o
38 +obj-$(CONFIG_MACH_DOCKSTAR)            += dockstar-setup.o
39  
40  obj-$(CONFIG_CPU_IDLE)                 += cpuidle.o
41 diff --git a/arch/arm/mach-kirkwood/dockstar-setup.c b/arch/arm/mach-kirkwood/dockstar-setup.c
42 new file mode 100644
43 index 0000000..a90475d
44 --- /dev/null
45 +++ b/arch/arm/mach-kirkwood/dockstar-setup.c
46 @@ -0,0 +1,148 @@
47 +/*
48 + * arch/arm/mach-kirkwood/dockstar-setup.c
49 + *
50 + * Seagate FreeAgent DockStar Setup
51 + *
52 + * This file is licensed under the terms of the GNU General Public
53 + * License version 2.  This program is licensed "as is" without any
54 + * warranty of any kind, whether express or implied.
55 + */
56 +
57 +#include <linux/kernel.h>
58 +#include <linux/init.h>
59 +#include <linux/platform_device.h>
60 +#include <linux/ata_platform.h>
61 +#include <linux/mtd/partitions.h>
62 +#include <linux/mv643xx_eth.h>
63 +#include <linux/gpio.h>
64 +#include <linux/leds.h>
65 +#include <asm/mach-types.h>
66 +#include <asm/mach/arch.h>
67 +#include <mach/kirkwood.h>
68 +#include <plat/mvsdio.h>
69 +#include <plat/orion_nand.h>
70 +#include "common.h"
71 +#include "mpp.h"
72 +
73 +static struct mtd_partition dockstar_nand_parts[] = {
74 +       {
75 +               .name = "u-boot",
76 +               .offset = 0,
77 +               .size = SZ_1M
78 +       },      {
79 +               .name = "second_stage_u-boot",
80 +               .offset = MTDPART_OFS_NXTBLK,
81 +               .size = SZ_1M
82 +       }, {
83 +               .name = "uImage",
84 +               .offset = MTDPART_OFS_NXTBLK,
85 +               .size = SZ_1M + SZ_2M,
86 +       }, {
87 +               .name = "rootfs",
88 +               .offset = MTDPART_OFS_NXTBLK,
89 +               .size = SZ_64M,
90 +       }, {
91 +               .name = "data",
92 +               .offset = MTDPART_OFS_NXTBLK,
93 +               .size = MTDPART_SIZ_FULL
94 +       },
95 +};
96 +
97 +static struct resource dockstar_nand_resource = {
98 +       .flags          = IORESOURCE_MEM,
99 +       .start          = KIRKWOOD_NAND_MEM_PHYS_BASE,
100 +       .end            = KIRKWOOD_NAND_MEM_PHYS_BASE +
101 +                         KIRKWOOD_NAND_MEM_SIZE - 1,
102 +};
103 +
104 +static struct orion_nand_data dockstar_nand_data = {
105 +       .parts          = dockstar_nand_parts,
106 +       .nr_parts       = ARRAY_SIZE(dockstar_nand_parts),
107 +       .cle            = 0,
108 +       .ale            = 1,
109 +       .width          = 8,
110 +       .chip_delay     = 25,
111 +};
112 +
113 +static struct platform_device dockstar_nand_flash = {
114 +       .name           = "orion_nand",
115 +       .id             = -1,
116 +       .dev            = {
117 +               .platform_data  = &dockstar_nand_data,
118 +       },
119 +       .resource       = &dockstar_nand_resource,
120 +       .num_resources  = 1,
121 +};
122 +
123 +
124 +static struct mv643xx_eth_platform_data dockstar_ge00_data = {
125 +       .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
126 +};
127 +
128 +static struct gpio_led dockstar_led_pins[] = {
129 +       {
130 +               .name                   = "dockstar:green:health",
131 +               .default_trigger        = "default-on",
132 +               .gpio                   = 46,
133 +               .active_low             = 1,
134 +       },
135 +       {
136 +               .name                   = "dockstar:orange:misc",
137 +               .default_trigger        = "none",
138 +               .gpio                   = 47,
139 +               .active_low             = 1,
140 +       },
141 +};
142 +
143 +static struct gpio_led_platform_data dockstar_led_data = {
144 +       .leds           = dockstar_led_pins,
145 +       .num_leds       = ARRAY_SIZE(dockstar_led_pins),
146 +};
147 +
148 +static struct platform_device dockstar_leds = {
149 +       .name   = "leds-gpio",
150 +       .id     = -1,
151 +       .dev    = {
152 +               .platform_data  = &dockstar_led_data,
153 +       }
154 +};
155 +
156 +static unsigned int dockstar_mpp_config[] __initdata = {
157 +       MPP29_GPIO,     /* USB Power Enable */
158 +       MPP46_GPIO,     /* LED green */
159 +       MPP47_GPIO,     /* LED orange */
160 +       0
161 +};
162 +
163 +static void __init dockstar_init(void)
164 +{
165 +       /*
166 +        * Basic setup. Needs to be called early.
167 +        */
168 +       kirkwood_init();
169 +
170 +       /* setup gpio pin select */
171 +       kirkwood_mpp_conf(dockstar_mpp_config);
172 +
173 +       kirkwood_uart0_init();
174 +
175 +       if (gpio_request(29, "USB Power Enable") != 0 ||
176 +           gpio_direction_output(29, 1) != 0)
177 +               printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
178 +       kirkwood_ehci_init();
179 +
180 +       kirkwood_ge00_init(&dockstar_ge00_data);
181 +
182 +       platform_device_register(&dockstar_nand_flash);
183 +       platform_device_register(&dockstar_leds);
184 +}
185 +
186 +MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
187 +       .phys_io        = KIRKWOOD_REGS_PHYS_BASE,
188 +       .io_pg_offst    = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
189 +       .boot_params    = 0x00000100,
190 +       .init_machine   = dockstar_init,
191 +       .map_io         = kirkwood_map_io,
192 +       .init_irq       = kirkwood_init_irq,
193 +       .timer          = &kirkwood_timer,
194 +MACHINE_END
195 diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
196 index 48cbdcb..8d56837 100644
197 --- a/arch/arm/tools/mach-types
198 +++ b/arch/arm/tools/mach-types
199 @@ -2245,3 +2245,4 @@ davinci_dm365_dvr MACH_DAVINCI_DM365_DVR  DAVINCI_DM365_DVR       2963
200  omap3_wl_ff            MACH_OMAP3_WL_FF        OMAP3_WL_FF             2258
201  simcom                 MACH_SIMCOM             SIMCOM                  2259
202  mcwebio                        MACH_MCWEBIO            MCWEBIO                 2260
203 +dockstar               MACH_DOCKSTAR           DOCKSTAR                2998
204 -- 
205 1.7.1
206