[pxa]: upgrade to 2.6.37
[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 --- a/arch/arm/mach-kirkwood/Kconfig
15 +++ b/arch/arm/mach-kirkwood/Kconfig
16 @@ -99,6 +99,12 @@ config MACH_NET5BIG_V2
17           Say 'Y' here if you want your kernel to support the
18           LaCie 5Big Network v2 NAS.
19  
20 +config MACH_DOCKSTAR
21 +       bool "Seagate FreeAgent DockStar"
22 +       help
23 +         Say 'Y' here if you want your kernel to support the
24 +         Seagate FreeAgent DockStar.
25 +
26  endmenu
27  
28  endif
29 --- a/arch/arm/mach-kirkwood/Makefile
30 +++ b/arch/arm/mach-kirkwood/Makefile
31 @@ -5,6 +5,7 @@ obj-$(CONFIG_MACH_RD88F6192_NAS)        += rd88
32  obj-$(CONFIG_MACH_RD88F6281)           += rd88f6281-setup.o
33  obj-$(CONFIG_MACH_MV88F6281GTW_GE)     += mv88f6281gtw_ge-setup.o
34  obj-$(CONFIG_MACH_SHEEVAPLUG)          += sheevaplug-setup.o
35 +obj-$(CONFIG_MACH_DOCKSTAR)            += dockstar-setup.o
36  obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG)    += sheevaplug-setup.o
37  obj-$(CONFIG_MACH_GURUPLUG)            += guruplug-setup.o
38  obj-$(CONFIG_MACH_TS219)               += ts219-setup.o tsx1x-common.o
39 --- /dev/null
40 +++ b/arch/arm/mach-kirkwood/dockstar-setup.c
41 @@ -0,0 +1,121 @@
42 +/*
43 + * arch/arm/mach-kirkwood/dockstar-setup.c
44 + *
45 + * Seagate FreeAgent DockStar Setup
46 + *
47 + * This file is licensed under the terms of the GNU General Public
48 + * License version 2.  This program is licensed "as is" without any
49 + * warranty of any kind, whether express or implied.
50 + */
51 +
52 +#include <linux/kernel.h>
53 +#include <linux/init.h>
54 +#include <linux/platform_device.h>
55 +#include <linux/ata_platform.h>
56 +#include <linux/mtd/partitions.h>
57 +#include <linux/mv643xx_eth.h>
58 +#include <linux/gpio.h>
59 +#include <linux/leds.h>
60 +#include <asm/mach-types.h>
61 +#include <asm/mach/arch.h>
62 +#include <mach/kirkwood.h>
63 +#include <plat/mvsdio.h>
64 +#include "common.h"
65 +#include "mpp.h"
66 +
67 +static struct mtd_partition dockstar_nand_parts[] = {
68 +       {
69 +               .name = "u-boot",
70 +               .offset = 0,
71 +               .size = SZ_1M
72 +       },      {
73 +               .name = "second_stage_u-boot",
74 +               .offset = MTDPART_OFS_NXTBLK,
75 +               .size = SZ_1M
76 +       }, {
77 +               .name = "uImage",
78 +               .offset = MTDPART_OFS_NXTBLK,
79 +               .size = SZ_1M + SZ_2M,
80 +       }, {
81 +               .name = "rootfs",
82 +               .offset = MTDPART_OFS_NXTBLK,
83 +               .size = SZ_32M,
84 +       }, {
85 +               .name = "data",
86 +               .offset = MTDPART_OFS_NXTBLK,
87 +               .size = MTDPART_SIZ_FULL
88 +       },
89 +};
90 +
91 +static struct mv643xx_eth_platform_data dockstar_ge00_data = {
92 +       .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
93 +};
94 +
95 +static struct gpio_led dockstar_led_pins[] = {
96 +       {
97 +               .name                   = "dockstar:green:health",
98 +               .default_trigger        = "default-on",
99 +               .gpio                   = 46,
100 +               .active_low             = 1,
101 +       },
102 +       {
103 +               .name                   = "dockstar:orange:misc",
104 +               .default_trigger        = "none",
105 +               .gpio                   = 47,
106 +               .active_low             = 1,
107 +       },
108 +};
109 +
110 +static struct gpio_led_platform_data dockstar_led_data = {
111 +       .leds           = dockstar_led_pins,
112 +       .num_leds       = ARRAY_SIZE(dockstar_led_pins),
113 +};
114 +
115 +static struct platform_device dockstar_leds = {
116 +       .name   = "leds-gpio",
117 +       .id     = -1,
118 +       .dev    = {
119 +               .platform_data  = &dockstar_led_data,
120 +       }
121 +};
122 +
123 +static unsigned int dockstar_mpp_config[] __initdata = {
124 +       MPP29_GPIO,     /* USB Power Enable */
125 +       MPP46_GPIO,     /* LED green */
126 +       MPP47_GPIO,     /* LED orange */
127 +       0
128 +};
129 +
130 +static void __init dockstar_init(void)
131 +{
132 +       /*
133 +        * Basic setup. Needs to be called early.
134 +        */
135 +       kirkwood_init();
136 +
137 +       /* setup gpio pin select */
138 +       kirkwood_mpp_conf(dockstar_mpp_config);
139 +
140 +       kirkwood_uart0_init();
141 +
142 +       if (gpio_request(29, "USB Power Enable") != 0 ||
143 +           gpio_direction_output(29, 1) != 0)
144 +               printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
145 +       kirkwood_ehci_init();
146 +
147 +       kirkwood_nand_init(ARRAY_AND_SIZE(dockstar_nand_parts), 25);
148 +
149 +       kirkwood_ge00_init(&dockstar_ge00_data);
150 +
151 +       platform_device_register(&dockstar_leds);
152 +}
153 +
154 +MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
155 +       .phys_io        = KIRKWOOD_REGS_PHYS_BASE,
156 +       .io_pg_offst    = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
157 +       .boot_params    = 0x00000100,
158 +       .init_machine   = dockstar_init,
159 +       .map_io         = kirkwood_map_io,
160 +       .init_irq       = kirkwood_init_irq,
161 +       .timer          = &kirkwood_timer,
162 +MACHINE_END