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) 2011 Andrej Vlašić
7 * Copyright (C) 2011 Luka Perkov
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/leds.h>
15 #include <linux/gpio.h>
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/partitions.h>
18 #include <linux/mtd/physmap.h>
19 #include <linux/input.h>
20 #include <linux/pci.h>
21 #include <linux/phy.h>
23 #include <linux/if_ether.h>
24 #include <linux/etherdevice.h>
25 #include <linux/string.h>
28 #include <lantiq_soc.h>
29 #include <lantiq_platform.h>
30 #include <dev-gpio-leds.h>
31 #include <dev-gpio-buttons.h>
33 #include "../machtypes.h"
34 #include "dev-wifi-athxk.h"
36 #include "dev-dwc_otg.h"
38 #include "mach-gigasx76x.h"
40 static u8 ltq_ethaddr[6] = { 0 };
43 setup_ethaddr(char *str)
45 if (!mac_pton(str, ltq_ethaddr))
46 memset(ltq_ethaddr, 0, 6);
49 __setup("ethaddr=", setup_ethaddr);
58 static u8 board __initdata = SX763;
61 setup_board(char *str)
63 if (!strcmp(str, "sx761"))
65 else if (!strcmp(str, "sx762"))
67 else if (!strcmp(str, "sx763"))
73 __setup("board=", setup_board);
75 static struct mtd_partition gigasx76x_partitions[] =
94 static struct gpio_led
95 gigasx76x_gpio_leds[] __initdata = {
96 { .name = "soc:green:voip", .gpio = 216, },
97 { .name = "soc:green:adsl", .gpio = 217, },
98 { .name = "soc:green:usb", .gpio = 218, },
99 { .name = "soc:green:wifi", .gpio = 219, },
100 { .name = "soc:green:phone2", .gpio = 220, },
101 { .name = "soc:green:phone1", .gpio = 221, },
102 { .name = "soc:green:line", .gpio = 222, },
103 { .name = "soc:green:online", .gpio = 223, },
106 static struct gpio_keys_button
107 gigasx76x_gpio_keys[] __initdata = {
111 .code = KEY_WPS_BUTTON,
112 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
120 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
126 static struct physmap_flash_data gigasx76x_flash_data = {
127 .nr_parts = ARRAY_SIZE(gigasx76x_partitions),
128 .parts = gigasx76x_partitions,
131 static struct ltq_pci_data ltq_pci_data = {
132 .clock = PCI_CLOCK_INT,
133 .gpio = PCI_GNT1 | PCI_REQ1,
134 .irq = { [14] = INT_NUM_IM0_IRL0 + 22, },
137 static struct ltq_eth_data ltq_eth_data = {
138 .mii_mode = PHY_INTERFACE_MODE_MII,
144 #define GIGASX76X_USB 29
146 ltq_register_gpio_stp();
147 ltq_register_nor(&gigasx76x_flash_data);
148 ltq_register_pci(<q_pci_data);
150 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(gigasx76x_gpio_leds), gigasx76x_gpio_leds);
151 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(gigasx76x_gpio_keys), gigasx76x_gpio_keys);
152 xway_register_dwc(GIGASX76X_USB);
154 if (!is_valid_ether_addr(ltq_ethaddr))
155 random_ether_addr(ltq_ethaddr);
157 memcpy(<q_eth_data.mac.sa_data, ltq_ethaddr, 6);
158 ltq_register_etop(<q_eth_data);
160 ltq_register_ath5k(sx762_eeprom_data, ltq_ethaddr);
162 ltq_register_ath5k(sx763_eeprom_data, ltq_ethaddr);
165 MIPS_MACHINE(LANTIQ_MACH_GIGASX76X,
167 "GIGASX76X - Gigaset SX761,SX762,SX763",