2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
6 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/input.h>
15 #include <linux/phy.h>
16 #include <linux/spi/spi_gpio.h>
17 #include <linux/spi/flash.h>
19 #include <lantiq_soc.h>
22 #include "../machtypes.h"
24 #include "dev-ifxhcd.h"
25 #include "dev-gpio-leds.h"
26 #include "dev-gpio-buttons.h"
28 static struct mtd_partition fritz3370_partitions
[] = {
40 .name
= "reserved-kernel",
55 .name
= "nand-filesystem",
61 static struct mtd_partition spi_flash_partitions
[] = {
79 static struct gpio_led
80 fritz3370_gpio_leds
[] __initdata
= {
81 { .name
= "soc:green:1", .gpio
= 32, .active_low
= 1, .default_trigger
= "default-on" },
82 { .name
= "soc:red:2", .gpio
= 33, .active_low
= 1, .default_trigger
= "default-on" },
83 { .name
= "soc:red:3", .gpio
= 34, .active_low
= 1, .default_trigger
= "default-on" },
84 { .name
= "soc:green:4", .gpio
= 35, .active_low
= 1, .default_trigger
= "default-on" },
85 { .name
= "soc:green:5", .gpio
= 36, .active_low
= 1, .default_trigger
= "default-on" },
86 { .name
= "soc:green:6", .gpio
= 47, .active_low
= 1, .default_trigger
= "default-on" },
89 static struct gpio_keys_button
90 fritz3370_gpio_keys
[] __initdata
= {
95 .debounce_interval
= LTQ_KEYS_DEBOUNCE_INTERVAL
,
101 static struct ltq_eth_data ltq_eth_data
= {
102 .mii_mode
= PHY_INTERFACE_MODE_RMII
,
105 static int usb_pins
[2] = { 5, 14 };
107 #define SPI_GPIO_MRST 16
108 #define SPI_GPIO_MTSR 17
109 #define SPI_GPIO_CLK 18
110 #define SPI_GPIO_CS0 10
112 static struct spi_gpio_platform_data spi_gpio_data
= {
114 .mosi
= SPI_GPIO_MTSR
,
115 .miso
= SPI_GPIO_MRST
,
119 static struct platform_device spi_gpio_device
= {
121 .dev
.platform_data
= &spi_gpio_data
,
124 static struct flash_platform_data spi_flash_data
= {
126 .parts
= spi_flash_partitions
,
127 .nr_parts
= ARRAY_SIZE(spi_flash_partitions
),
130 static struct spi_board_info spi_flash __initdata
= {
131 .modalias
= "m25p80",
134 .max_speed_hz
= 10 * 1000 * 1000,
137 .controller_data
= (void *) SPI_GPIO_CS0
,
138 .platform_data
= &spi_flash_data
144 spi_register_board_info(&spi_flash
, 1);
145 platform_device_register(&spi_gpio_device
);
148 static void __init
fritz3370_init(void)
151 platform_device_register_simple("pcie-xway", 0, NULL
, 0);
152 xway_register_nand(fritz3370_partitions
, ARRAY_SIZE(fritz3370_partitions
));
153 xway_register_hcd(usb_pins
);
154 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(fritz3370_gpio_leds
), fritz3370_gpio_leds
);
155 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL
,
156 ARRAY_SIZE(fritz3370_gpio_keys
), fritz3370_gpio_keys
);
157 ltq_register_vrx200(<q_eth_data
);
160 MIPS_MACHINE(LANTIQ_MACH_FRITZ3370
,