Gabor Juhos | 0cde722 | 2011-01-04 21:28:17 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Atheros PB44 reference board support |
| 3 | * |
| 4 | * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org> |
| 5 | * |
| 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. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/platform_device.h> |
| 13 | #include <linux/i2c.h> |
| 14 | #include <linux/i2c-gpio.h> |
| 15 | #include <linux/i2c/pcf857x.h> |
| 16 | |
| 17 | #include "machtypes.h" |
Gabor Juhos | d8fec1f | 2011-01-04 21:28:18 +0100 | [diff] [blame^] | 18 | #include "dev-leds-gpio.h" |
Gabor Juhos | 0cde722 | 2011-01-04 21:28:17 +0100 | [diff] [blame] | 19 | |
| 20 | #define PB44_GPIO_I2C_SCL 0 |
| 21 | #define PB44_GPIO_I2C_SDA 1 |
| 22 | |
| 23 | #define PB44_GPIO_EXP_BASE 16 |
Gabor Juhos | d8fec1f | 2011-01-04 21:28:18 +0100 | [diff] [blame^] | 24 | #define PB44_GPIO_LED_JUMP1 (PB44_GPIO_EXP_BASE + 9) |
| 25 | #define PB44_GPIO_LED_JUMP2 (PB44_GPIO_EXP_BASE + 10) |
Gabor Juhos | 0cde722 | 2011-01-04 21:28:17 +0100 | [diff] [blame] | 26 | |
| 27 | static struct i2c_gpio_platform_data pb44_i2c_gpio_data = { |
| 28 | .sda_pin = PB44_GPIO_I2C_SDA, |
| 29 | .scl_pin = PB44_GPIO_I2C_SCL, |
| 30 | }; |
| 31 | |
| 32 | static struct platform_device pb44_i2c_gpio_device = { |
| 33 | .name = "i2c-gpio", |
| 34 | .id = 0, |
| 35 | .dev = { |
| 36 | .platform_data = &pb44_i2c_gpio_data, |
| 37 | } |
| 38 | }; |
| 39 | |
| 40 | static struct pcf857x_platform_data pb44_pcf857x_data = { |
| 41 | .gpio_base = PB44_GPIO_EXP_BASE, |
| 42 | }; |
| 43 | |
| 44 | static struct i2c_board_info pb44_i2c_board_info[] __initdata = { |
| 45 | { |
| 46 | I2C_BOARD_INFO("pcf8575", 0x20), |
| 47 | .platform_data = &pb44_pcf857x_data, |
| 48 | }, |
| 49 | }; |
| 50 | |
Gabor Juhos | d8fec1f | 2011-01-04 21:28:18 +0100 | [diff] [blame^] | 51 | static struct gpio_led pb44_leds_gpio[] __initdata = { |
| 52 | { |
| 53 | .name = "pb44:amber:jump1", |
| 54 | .gpio = PB44_GPIO_LED_JUMP1, |
| 55 | .active_low = 1, |
| 56 | }, { |
| 57 | .name = "pb44:green:jump2", |
| 58 | .gpio = PB44_GPIO_LED_JUMP2, |
| 59 | .active_low = 1, |
| 60 | }, |
| 61 | }; |
| 62 | |
Gabor Juhos | 0cde722 | 2011-01-04 21:28:17 +0100 | [diff] [blame] | 63 | static void __init pb44_init(void) |
| 64 | { |
| 65 | i2c_register_board_info(0, pb44_i2c_board_info, |
| 66 | ARRAY_SIZE(pb44_i2c_board_info)); |
| 67 | platform_device_register(&pb44_i2c_gpio_device); |
Gabor Juhos | d8fec1f | 2011-01-04 21:28:18 +0100 | [diff] [blame^] | 68 | |
| 69 | ath79_register_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio), |
| 70 | pb44_leds_gpio); |
Gabor Juhos | 0cde722 | 2011-01-04 21:28:17 +0100 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board", |
| 74 | pb44_init); |