blob: e6b9b1b22a35d1202823578e819b461c50163977 [file] [log] [blame]
Martin Michlmayrb529ee42010-06-13 20:00:16 +01001/*
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>
19#include <linux/spi/orion_spi.h>
20#include <linux/i2c.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio.h>
24#include <linux/gpio_keys.h>
25#include <linux/input.h>
Arnaud Patard9d3e1c52011-03-02 22:27:41 +010026#include <sound/alc5623.h>
Martin Michlmayrb529ee42010-06-13 20:00:16 +010027#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <mach/kirkwood.h>
30#include "common.h"
31#include "mpp.h"
32
33struct mtd_partition hp_t5325_partitions[] = {
34 {
35 .name = "u-boot env",
36 .size = SZ_64K,
37 .offset = SZ_512K + SZ_256K,
38 },
39 {
40 .name = "permanent u-boot env",
41 .size = SZ_64K,
42 .offset = MTDPART_OFS_APPEND,
43 .mask_flags = MTD_WRITEABLE,
44 },
45 {
46 .name = "HP env",
47 .size = SZ_64K,
48 .offset = MTDPART_OFS_APPEND,
49 },
50 {
51 .name = "u-boot",
52 .size = SZ_512K,
53 .offset = 0,
54 .mask_flags = MTD_WRITEABLE,
55 },
56 {
57 .name = "SSD firmware",
58 .size = SZ_256K,
59 .offset = SZ_512K,
60 },
61};
62
63const struct flash_platform_data hp_t5325_flash = {
64 .type = "mx25l8005",
65 .name = "spi_flash",
66 .parts = hp_t5325_partitions,
67 .nr_parts = ARRAY_SIZE(hp_t5325_partitions),
68};
69
70struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {
71 {
72 .modalias = "m25p80",
73 .platform_data = &hp_t5325_flash,
74 .irq = -1,
75 },
76};
77
78static struct mv643xx_eth_platform_data hp_t5325_ge00_data = {
79 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
80};
81
82static struct mv_sata_platform_data hp_t5325_sata_data = {
83 .n_ports = 2,
84};
85
86static struct gpio_keys_button hp_t5325_buttons[] = {
87 {
88 .code = KEY_POWER,
89 .gpio = 45,
90 .desc = "Power",
91 .active_low = 1,
92 },
93};
94
95static struct gpio_keys_platform_data hp_t5325_button_data = {
96 .buttons = hp_t5325_buttons,
97 .nbuttons = ARRAY_SIZE(hp_t5325_buttons),
98};
99
100static struct platform_device hp_t5325_button_device = {
101 .name = "gpio-keys",
102 .id = -1,
103 .num_resources = 0,
104 .dev = {
105 .platform_data = &hp_t5325_button_data,
106 }
107};
108
109static unsigned int hp_t5325_mpp_config[] __initdata = {
110 MPP0_NF_IO2,
111 MPP1_SPI_MOSI,
112 MPP2_SPI_SCK,
113 MPP3_SPI_MISO,
114 MPP4_NF_IO6,
115 MPP5_NF_IO7,
116 MPP6_SYSRST_OUTn,
117 MPP7_SPI_SCn,
Nicolas Pitre6f2b1862010-06-21 23:29:28 -0400118 MPP8_TW0_SDA,
119 MPP9_TW0_SCK,
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100120 MPP10_UART0_TXD,
121 MPP11_UART0_RXD,
122 MPP12_SD_CLK,
123 MPP13_GPIO,
124 MPP14_GPIO,
125 MPP15_GPIO,
126 MPP16_GPIO,
127 MPP17_GPIO,
128 MPP18_NF_IO0,
129 MPP19_NF_IO1,
130 MPP20_GPIO,
131 MPP21_GPIO,
132 MPP22_GPIO,
133 MPP23_GPIO,
134 MPP32_GPIO,
Nicolas Pitre6f2b1862010-06-21 23:29:28 -0400135 MPP33_GE1_TXCTL,
136 MPP39_AU_I2SBCLK,
137 MPP40_AU_I2SDO,
Arnaud Patard9d3e1c52011-03-02 22:27:41 +0100138 MPP43_AU_I2SDI,
Nicolas Pitre6f2b1862010-06-21 23:29:28 -0400139 MPP41_AU_I2SLRCLK,
140 MPP42_AU_I2SMCLK,
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100141 MPP45_GPIO, /* Power button */
142 MPP48_GPIO, /* Board power off */
143 0
144};
145
Arnaud Patard9d3e1c52011-03-02 22:27:41 +0100146static struct alc5623_platform_data alc5621_data = {
147 .add_ctrl = 0x3700,
148 .jack_det_ctrl = 0x4810,
149};
150
151static struct i2c_board_info i2c_board_info[] __initdata = {
152 {
153 I2C_BOARD_INFO("alc5621", 0x1a),
154 .platform_data = &alc5621_data,
155 },
156};
157
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100158#define HP_T5325_GPIO_POWER_OFF 48
159
160static void hp_t5325_power_off(void)
161{
162 gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1);
163}
164
165static void __init hp_t5325_init(void)
166{
167 /*
168 * Basic setup. Needs to be called early.
169 */
170 kirkwood_init();
171 kirkwood_mpp_conf(hp_t5325_mpp_config);
172
173 kirkwood_uart0_init();
174 spi_register_board_info(hp_t5325_spi_slave_info,
175 ARRAY_SIZE(hp_t5325_spi_slave_info));
176 kirkwood_spi_init();
177 kirkwood_i2c_init();
178 kirkwood_ge00_init(&hp_t5325_ge00_data);
179 kirkwood_sata_init(&hp_t5325_sata_data);
180 kirkwood_ehci_init();
181 platform_device_register(&hp_t5325_button_device);
182
Arnaud Patard9d3e1c52011-03-02 22:27:41 +0100183 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
184 kirkwood_audio_init();
185
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100186 if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&
187 gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)
188 pm_power_off = hp_t5325_power_off;
189 else
190 pr_err("t5325: failed to configure power-off GPIO\n");
191}
192
193static int __init hp_t5325_pci_init(void)
194{
195 if (machine_is_t5325())
Saeed Bisharaffd58bd2010-06-08 14:21:34 +0300196 kirkwood_pcie_init(KW_PCIE0);
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100197
198 return 0;
199}
200subsys_initcall(hp_t5325_pci_init);
201
202MACHINE_START(T5325, "HP t5325 Thin Client")
203 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100204 .boot_params = 0x00000100,
205 .init_machine = hp_t5325_init,
206 .map_io = kirkwood_map_io,
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200207 .init_early = kirkwood_init_early,
Martin Michlmayrb529ee42010-06-13 20:00:16 +0100208 .init_irq = kirkwood_init_irq,
209 .timer = &kirkwood_timer,
210MACHINE_END