2 * arch/ubicom32/mach-ip5k/board-ip5170dpf.c
3 * Platform initialization for ip5160dpf board.
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
23 * Ubicom32 implementation derived from (with many thanks):
28 #include <linux/device.h>
29 #include <linux/platform_device.h>
30 #include <linux/gpio.h>
31 #include <linux/leds.h>
33 #include <linux/i2c.h>
34 #include <linux/i2c-gpio.h>
36 #include <linux/input.h>
37 #include <asm/board.h>
38 #include <asm/machdep.h>
39 #include <asm/ubicom32hid.h>
40 #include <asm/vdc_tio.h>
45 * WLAN PD9 (Note this is shared with MISO, but we don't use it)
48 * TODO: check triggers, are they generic?
50 static struct gpio_led ip5170dpf_gpio_leds
[] = {
52 .name
= "d31:green:WLAN1",
53 .default_trigger
= "WLAN1",
58 .name
= "d30:green:WPS",
59 .default_trigger
= "WPS",
65 static struct gpio_led_platform_data ip5170dpf_gpio_led_platform_data
= {
67 .leds
= ip5170dpf_gpio_leds
,
70 static struct platform_device ip5170dpf_gpio_leds_device
= {
74 .platform_data
= &ip5170dpf_gpio_led_platform_data
,
79 * Backlight on the board PD0, hardware PWM
81 static const struct ubicom32hid_button ip5170dpf_ubicom32hid_buttons
[] = {
119 static const struct ubicom32hid_ir ip5170dpf_ubicom32hid_ircodes
[] = {
123 .ir_code
= 0xF807916E
128 .ir_code
= 0xF20D916E
133 .ir_code
= 0xF609916E
138 .ir_code
= 0xF40B916E
143 .ir_code
= 0xF50A916E
148 .ir_code
= 0xF906916E
153 .ir_code
= 0xF708916E
158 .ir_code
= 0xF30C916E
163 .ir_code
= 0xF10E916E
167 .code
= KEY_VOLUMEUP
,
168 .ir_code
= 0xF00F916E
172 .code
= KEY_VOLUMEDOWN
,
173 .ir_code
= 0xED12916E
178 .ir_code
= 0xEA15916E
183 .ir_code
= 0xEF10916E
188 .ir_code
= 0xEE11916E
193 .ir_code
= 0xEB14916E
198 .ir_code
= 0xFD02916E
202 static struct ubicom32hid_platform_data ip5170dpf_ubicom32hid_platform_data
= {
203 .gpio_reset
= GPIO_RA_4
,
204 .gpio_reset_polarity
= 0,
205 .type
= UBICOM32HID_BL_TYPE_BINARY
,
207 .default_intensity
= 1,
208 .buttons
= ip5170dpf_ubicom32hid_buttons
,
209 .nbuttons
= ARRAY_SIZE(ip5170dpf_ubicom32hid_buttons
),
210 .ircodes
= ip5170dpf_ubicom32hid_ircodes
,
211 .nircodes
= ARRAY_SIZE(ip5170dpf_ubicom32hid_ircodes
),
215 * Devices on the I2C bus
217 static struct i2c_board_info __initdata ip5170dpf_i2c_board_info
[] = {
222 .type
= "ubicom32hid",
224 .platform_data
= &ip5170dpf_ubicom32hid_platform_data
,
228 * U14, CS4350 DAC, address 0x4B
233 * I2C bus on the board, SDA PF13, SCL PF14
235 static struct i2c_gpio_platform_data ip5170dpf_i2c_data
= {
236 .sda_pin
= GPIO_RF_13
,
237 .scl_pin
= GPIO_RF_14
,
238 .sda_is_open_drain
= 0,
239 .scl_is_open_drain
= 0,
240 .scl_is_output_only
= 1,
244 static struct platform_device ip5170dpf_i2c_device
= {
248 .platform_data
= &ip5170dpf_i2c_data
,
253 * List of all devices in our system
255 static struct platform_device
*ip5170dpf_devices
[] __initdata
= {
256 &ip5170dpf_i2c_device
,
257 &ip5170dpf_gpio_leds_device
,
262 * Called to add the devices which we have on this board
264 static int __init
ip5170dpf_init(void)
270 printk(KERN_INFO
"%s: registering device resources\n", __FUNCTION__
);
271 platform_add_devices(ip5170dpf_devices
, ARRAY_SIZE(ip5170dpf_devices
));
273 printk(KERN_INFO
"%s: registering i2c resources\n", __FUNCTION__
);
274 i2c_register_board_info(0, ip5170dpf_i2c_board_info
, ARRAY_SIZE(ip5170dpf_i2c_board_info
));
279 arch_initcall(ip5170dpf_init
);