]>
Commit | Line | Data |
---|---|---|
b529ee4a MM |
1 | /* |
2 | * | |
3 | * HP t5325 Thin Client setup | |
4 | * | |
5 | * Copyright (C) 2010 Martin Michlmayr <tbm@cyrius.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation; either version | |
10 | * 2 of the License, or (at your option) any later version. | |
11 | */ | |
12 | ||
13 | #include <linux/kernel.h> | |
14 | #include <linux/init.h> | |
15 | #include <linux/platform_device.h> | |
16 | #include <linux/mtd/physmap.h> | |
17 | #include <linux/spi/flash.h> | |
18 | #include <linux/spi/spi.h> | |
b529ee4a MM |
19 | #include <linux/i2c.h> |
20 | #include <linux/mv643xx_eth.h> | |
21 | #include <linux/ata_platform.h> | |
22 | #include <linux/gpio.h> | |
23 | #include <linux/gpio_keys.h> | |
24 | #include <linux/input.h> | |
9d3e1c56 | 25 | #include <sound/alc5623.h> |
b529ee4a MM |
26 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | |
28 | #include <mach/kirkwood.h> | |
29 | #include "common.h" | |
30 | #include "mpp.h" | |
31 | ||
d1c925b2 | 32 | static struct mtd_partition hp_t5325_partitions[] = { |
b529ee4a MM |
33 | { |
34 | .name = "u-boot env", | |
35 | .size = SZ_64K, | |
36 | .offset = SZ_512K + SZ_256K, | |
37 | }, | |
38 | { | |
39 | .name = "permanent u-boot env", | |
40 | .size = SZ_64K, | |
41 | .offset = MTDPART_OFS_APPEND, | |
42 | .mask_flags = MTD_WRITEABLE, | |
43 | }, | |
44 | { | |
45 | .name = "HP env", | |
46 | .size = SZ_64K, | |
47 | .offset = MTDPART_OFS_APPEND, | |
48 | }, | |
49 | { | |
50 | .name = "u-boot", | |
51 | .size = SZ_512K, | |
52 | .offset = 0, | |
53 | .mask_flags = MTD_WRITEABLE, | |
54 | }, | |
55 | { | |
56 | .name = "SSD firmware", | |
57 | .size = SZ_256K, | |
58 | .offset = SZ_512K, | |
59 | }, | |
60 | }; | |
61 | ||
d1c925b2 | 62 | static const struct flash_platform_data hp_t5325_flash = { |
b529ee4a MM |
63 | .type = "mx25l8005", |
64 | .name = "spi_flash", | |
65 | .parts = hp_t5325_partitions, | |
66 | .nr_parts = ARRAY_SIZE(hp_t5325_partitions), | |
67 | }; | |
68 | ||
d1c925b2 | 69 | static struct spi_board_info __initdata hp_t5325_spi_slave_info[] = { |
b529ee4a MM |
70 | { |
71 | .modalias = "m25p80", | |
72 | .platform_data = &hp_t5325_flash, | |
73 | .irq = -1, | |
74 | }, | |
75 | }; | |
76 | ||
77 | static struct mv643xx_eth_platform_data hp_t5325_ge00_data = { | |
78 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | |
79 | }; | |
80 | ||
81 | static struct mv_sata_platform_data hp_t5325_sata_data = { | |
82 | .n_ports = 2, | |
83 | }; | |
84 | ||
85 | static struct gpio_keys_button hp_t5325_buttons[] = { | |
86 | { | |
87 | .code = KEY_POWER, | |
88 | .gpio = 45, | |
89 | .desc = "Power", | |
90 | .active_low = 1, | |
91 | }, | |
92 | }; | |
93 | ||
94 | static struct gpio_keys_platform_data hp_t5325_button_data = { | |
95 | .buttons = hp_t5325_buttons, | |
96 | .nbuttons = ARRAY_SIZE(hp_t5325_buttons), | |
97 | }; | |
98 | ||
99 | static struct platform_device hp_t5325_button_device = { | |
100 | .name = "gpio-keys", | |
101 | .id = -1, | |
102 | .num_resources = 0, | |
103 | .dev = { | |
104 | .platform_data = &hp_t5325_button_data, | |
105 | } | |
106 | }; | |
107 | ||
49915a54 AL |
108 | static struct platform_device hp_t5325_audio_device = { |
109 | .name = "t5325-audio", | |
110 | .id = -1, | |
111 | }; | |
112 | ||
b529ee4a MM |
113 | static unsigned int hp_t5325_mpp_config[] __initdata = { |
114 | MPP0_NF_IO2, | |
115 | MPP1_SPI_MOSI, | |
116 | MPP2_SPI_SCK, | |
117 | MPP3_SPI_MISO, | |
118 | MPP4_NF_IO6, | |
119 | MPP5_NF_IO7, | |
120 | MPP6_SYSRST_OUTn, | |
121 | MPP7_SPI_SCn, | |
6f2b186a NP |
122 | MPP8_TW0_SDA, |
123 | MPP9_TW0_SCK, | |
b529ee4a MM |
124 | MPP10_UART0_TXD, |
125 | MPP11_UART0_RXD, | |
126 | MPP12_SD_CLK, | |
127 | MPP13_GPIO, | |
128 | MPP14_GPIO, | |
129 | MPP15_GPIO, | |
130 | MPP16_GPIO, | |
131 | MPP17_GPIO, | |
132 | MPP18_NF_IO0, | |
133 | MPP19_NF_IO1, | |
134 | MPP20_GPIO, | |
135 | MPP21_GPIO, | |
136 | MPP22_GPIO, | |
137 | MPP23_GPIO, | |
138 | MPP32_GPIO, | |
6f2b186a NP |
139 | MPP33_GE1_TXCTL, |
140 | MPP39_AU_I2SBCLK, | |
141 | MPP40_AU_I2SDO, | |
9d3e1c56 | 142 | MPP43_AU_I2SDI, |
6f2b186a NP |
143 | MPP41_AU_I2SLRCLK, |
144 | MPP42_AU_I2SMCLK, | |
b529ee4a MM |
145 | MPP45_GPIO, /* Power button */ |
146 | MPP48_GPIO, /* Board power off */ | |
147 | 0 | |
148 | }; | |
149 | ||
9d3e1c56 AP |
150 | static struct alc5623_platform_data alc5621_data = { |
151 | .add_ctrl = 0x3700, | |
152 | .jack_det_ctrl = 0x4810, | |
153 | }; | |
154 | ||
155 | static struct i2c_board_info i2c_board_info[] __initdata = { | |
156 | { | |
157 | I2C_BOARD_INFO("alc5621", 0x1a), | |
158 | .platform_data = &alc5621_data, | |
159 | }, | |
160 | }; | |
161 | ||
b529ee4a MM |
162 | #define HP_T5325_GPIO_POWER_OFF 48 |
163 | ||
164 | static void hp_t5325_power_off(void) | |
165 | { | |
166 | gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1); | |
167 | } | |
168 | ||
169 | static void __init hp_t5325_init(void) | |
170 | { | |
171 | /* | |
172 | * Basic setup. Needs to be called early. | |
173 | */ | |
174 | kirkwood_init(); | |
175 | kirkwood_mpp_conf(hp_t5325_mpp_config); | |
176 | ||
177 | kirkwood_uart0_init(); | |
178 | spi_register_board_info(hp_t5325_spi_slave_info, | |
179 | ARRAY_SIZE(hp_t5325_spi_slave_info)); | |
180 | kirkwood_spi_init(); | |
181 | kirkwood_i2c_init(); | |
182 | kirkwood_ge00_init(&hp_t5325_ge00_data); | |
183 | kirkwood_sata_init(&hp_t5325_sata_data); | |
184 | kirkwood_ehci_init(); | |
185 | platform_device_register(&hp_t5325_button_device); | |
49915a54 | 186 | platform_device_register(&hp_t5325_audio_device); |
b529ee4a | 187 | |
9d3e1c56 AP |
188 | i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info)); |
189 | kirkwood_audio_init(); | |
190 | ||
b529ee4a MM |
191 | if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 && |
192 | gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0) | |
193 | pm_power_off = hp_t5325_power_off; | |
194 | else | |
195 | pr_err("t5325: failed to configure power-off GPIO\n"); | |
196 | } | |
197 | ||
198 | static int __init hp_t5325_pci_init(void) | |
199 | { | |
200 | if (machine_is_t5325()) | |
ffd58bd2 | 201 | kirkwood_pcie_init(KW_PCIE0); |
b529ee4a MM |
202 | |
203 | return 0; | |
204 | } | |
205 | subsys_initcall(hp_t5325_pci_init); | |
206 | ||
207 | MACHINE_START(T5325, "HP t5325 Thin Client") | |
208 | /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ | |
1b7bd28c | 209 | .atag_offset = 0x100, |
b529ee4a MM |
210 | .init_machine = hp_t5325_init, |
211 | .map_io = kirkwood_map_io, | |
4ee1f6b5 | 212 | .init_early = kirkwood_init_early, |
b529ee4a | 213 | .init_irq = kirkwood_init_irq, |
6bb27d73 | 214 | .init_time = kirkwood_timer_init, |
cb15dff4 | 215 | .restart = kirkwood_restart, |
b529ee4a | 216 | MACHINE_END |