| 1 | #include <linux/init.h> |
| 2 | #include <linux/platform_device.h> |
| 3 | #include <linux/i2c-gpio.h> |
| 4 | |
| 5 | #include <dev-gpio-leds.h> |
| 6 | |
| 7 | #include "../machtypes.h" |
| 8 | #include "devices.h" |
| 9 | |
| 10 | #define BOARD_95C3AM1_GPIO_LED_0 10 |
| 11 | #define BOARD_95C3AM1_GPIO_LED_1 11 |
| 12 | #define BOARD_95C3AM1_GPIO_LED_2 12 |
| 13 | #define BOARD_95C3AM1_GPIO_LED_3 13 |
| 14 | |
| 15 | static struct mtd_partition board_95C3AM1_partitions[] = |
| 16 | { |
| 17 | { |
| 18 | .name = "uboot", |
| 19 | .offset = 0x0, |
| 20 | .size = 0x40000, |
| 21 | }, |
| 22 | { |
| 23 | .name = "uboot_env", |
| 24 | .offset = 0x40000, |
| 25 | .size = 0x40000, /* 2 sectors for redundant env. */ |
| 26 | }, |
| 27 | { |
| 28 | .name = "linux", |
| 29 | .offset = 0x80000, |
| 30 | .size = 0xF80000, /* map only 16 MiB */ |
| 31 | }, |
| 32 | }; |
| 33 | |
| 34 | static struct flash_platform_data board_95C3AM1_flash_platform_data = { |
| 35 | .name = "sflash", |
| 36 | .parts = board_95C3AM1_partitions, |
| 37 | .nr_parts = ARRAY_SIZE(board_95C3AM1_partitions) |
| 38 | }; |
| 39 | |
| 40 | static struct spi_board_info board_95C3AM1_flash_data __initdata = { |
| 41 | .modalias = "m25p80", |
| 42 | .bus_num = 0, |
| 43 | .chip_select = 0, |
| 44 | .max_speed_hz = 10 * 1000 * 1000, |
| 45 | .mode = SPI_MODE_3, |
| 46 | .platform_data = &board_95C3AM1_flash_platform_data |
| 47 | }; |
| 48 | |
| 49 | static struct gpio_led board_95C3AM1_gpio_leds[] __initdata = { |
| 50 | { |
| 51 | .name = "power", |
| 52 | .gpio = BOARD_95C3AM1_GPIO_LED_0, |
| 53 | .active_low = 0, |
| 54 | }, { |
| 55 | .name = "optical", |
| 56 | .gpio = BOARD_95C3AM1_GPIO_LED_1, |
| 57 | .active_low = 0, |
| 58 | }, { |
| 59 | .name = "lan", |
| 60 | .gpio = BOARD_95C3AM1_GPIO_LED_2, |
| 61 | .active_low = 0, |
| 62 | }, { |
| 63 | .name = "update", |
| 64 | .gpio = BOARD_95C3AM1_GPIO_LED_3, |
| 65 | .active_low = 0, |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | static struct i2c_gpio_platform_data board_95C3AM1_i2c_gpio_data = { |
| 70 | .sda_pin = 107, |
| 71 | .scl_pin = 108, |
| 72 | }; |
| 73 | |
| 74 | static struct platform_device board_95C3AM1_i2c_gpio_device = { |
| 75 | .name = "i2c-gpio", |
| 76 | .id = 0, |
| 77 | .dev = { |
| 78 | .platform_data = &board_95C3AM1_i2c_gpio_data, |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | static void __init board_95C3AM1_init(void) |
| 83 | { |
| 84 | falcon_register_i2c(); |
| 85 | falcon_register_spi_flash(&board_95C3AM1_flash_data); |
| 86 | platform_device_register(&board_95C3AM1_i2c_gpio_device); |
| 87 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(board_95C3AM1_gpio_leds), |
| 88 | board_95C3AM1_gpio_leds); |
| 89 | } |
| 90 | |
| 91 | MIPS_MACHINE(LANTIQ_MACH_95C3AM1, |
| 92 | "95C3AM1", |
| 93 | "95C3AM1 Board", |
| 94 | board_95C3AM1_init); |
| 95 | |