2 * Atheros PB44 reference board support
4 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/i2c.h>
14 #include <linux/gpio/machine.h>
15 #include <linux/platform_data/pcf857x.h>
17 #include "machtypes.h"
18 #include "dev-gpio-buttons.h"
19 #include "dev-leds-gpio.h"
24 #define PB44_GPIO_I2C_SCL 0
25 #define PB44_GPIO_I2C_SDA 1
27 #define PB44_GPIO_EXP_BASE 16
28 #define PB44_GPIO_SW_RESET (PB44_GPIO_EXP_BASE + 6)
29 #define PB44_GPIO_SW_JUMP (PB44_GPIO_EXP_BASE + 8)
30 #define PB44_GPIO_LED_JUMP1 (PB44_GPIO_EXP_BASE + 9)
31 #define PB44_GPIO_LED_JUMP2 (PB44_GPIO_EXP_BASE + 10)
33 #define PB44_KEYS_POLL_INTERVAL 20 /* msecs */
34 #define PB44_KEYS_DEBOUNCE_INTERVAL (3 * PB44_KEYS_POLL_INTERVAL)
36 static struct gpiod_lookup_table pb44_i2c_gpiod_table = {
39 GPIO_LOOKUP_IDX("ath79-gpio", PB44_GPIO_I2C_SDA,
40 NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
41 GPIO_LOOKUP_IDX("ath79-gpio", PB44_GPIO_I2C_SCL,
42 NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
46 static struct platform_device pb44_i2c_gpio_device = {
50 .platform_data = NULL,
54 static struct pcf857x_platform_data pb44_pcf857x_data = {
55 .gpio_base = PB44_GPIO_EXP_BASE,
58 static struct i2c_board_info pb44_i2c_board_info[] __initdata = {
60 I2C_BOARD_INFO("pcf8575", 0x20),
61 .platform_data = &pb44_pcf857x_data,
65 static struct gpio_led pb44_leds_gpio[] __initdata = {
67 .name = "pb44:amber:jump1",
68 .gpio = PB44_GPIO_LED_JUMP1,
71 .name = "pb44:green:jump2",
72 .gpio = PB44_GPIO_LED_JUMP2,
77 static struct gpio_keys_button pb44_gpio_keys[] __initdata = {
82 .debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL,
83 .gpio = PB44_GPIO_SW_RESET,
88 .code = KEY_WPS_BUTTON,
89 .debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL,
90 .gpio = PB44_GPIO_SW_JUMP,
95 static struct spi_board_info pb44_spi_info[] = {
99 .max_speed_hz = 25000000,
100 .modalias = "m25p64",
104 static struct ath79_spi_platform_data pb44_spi_data = {
109 static void __init pb44_init(void)
111 gpiod_add_lookup_table(&pb44_i2c_gpiod_table);
112 i2c_register_board_info(0, pb44_i2c_board_info,
113 ARRAY_SIZE(pb44_i2c_board_info));
114 platform_device_register(&pb44_i2c_gpio_device);
116 ath79_register_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio),
118 ath79_register_gpio_keys_polled(-1, PB44_KEYS_POLL_INTERVAL,
119 ARRAY_SIZE(pb44_gpio_keys),
121 ath79_register_spi(&pb44_spi_data, pb44_spi_info,
122 ARRAY_SIZE(pb44_spi_info));
123 ath79_register_usb();
124 ath79_register_pci();
127 MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",