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/ath5k_platform.h>
21 #include <linux/pci.h>
22 #include <linux/phy.h>
24 #include <linux/if_ether.h>
25 #include <linux/etherdevice.h>
26 #include <linux/string.h>
29 #include <lantiq_soc.h>
30 #include <lantiq_platform.h>
31 #include <dev-gpio-leds.h>
32 #include <dev-gpio-buttons.h>
34 #include "../machtypes.h"
35 #include "dev-wifi-athxk.h"
37 #include "dev-dwc_otg.h"
39 #include "mach-gigasx76x.h"
41 static u8 ltq_ethaddr
[6] = { 0 };
43 static int __init
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
= SX763
;
60 static int __init
setup_board(char *str
)
62 if (!strcmp(str
, "sx761"))
64 else if (!strcmp(str
, "sx762"))
66 else if (!strcmp(str
, "sx763"))
72 __setup("board=", setup_board
);
74 static struct mtd_partition gigasx76x_partitions
[] =
93 static struct gpio_led
94 gigasx76x_gpio_leds
[] __initdata
= {
95 { .name
= "soc:green:voip", .gpio
= 216, },
96 { .name
= "soc:green:adsl", .gpio
= 217, },
97 { .name
= "soc:green:usb", .gpio
= 218, },
98 { .name
= "soc:green:wifi", .gpio
= 219, },
99 { .name
= "soc:green:phone2", .gpio
= 220, },
100 { .name
= "soc:green:phone1", .gpio
= 221, },
101 { .name
= "soc:green:line", .gpio
= 222, },
102 { .name
= "soc:green:online", .gpio
= 223, },
105 static struct gpio_keys_button
106 gigasx76x_gpio_keys
[] __initdata
= {
110 .code
= KEY_WPS_BUTTON
,
111 .debounce_interval
= LTQ_KEYS_DEBOUNCE_INTERVAL
,
119 .debounce_interval
= LTQ_KEYS_DEBOUNCE_INTERVAL
,
125 static struct physmap_flash_data gigasx76x_flash_data
= {
126 .nr_parts
= ARRAY_SIZE(gigasx76x_partitions
),
127 .parts
= gigasx76x_partitions
,
130 static struct ltq_pci_data ltq_pci_data
= {
131 .clock
= PCI_CLOCK_INT
,
132 .gpio
= PCI_GNT1
| PCI_REQ1
,
133 .irq
= { [14] = INT_NUM_IM0_IRL0
+ 22, },
136 static struct ltq_eth_data ltq_eth_data
= {
137 .mii_mode
= PHY_INTERFACE_MODE_MII
,
140 static void __init
gigasx76x_init(void)
142 #define GIGASX76X_USB 29
144 ltq_register_gpio_stp();
145 ltq_register_nor(&gigasx76x_flash_data
);
146 ltq_register_pci(<q_pci_data
);
148 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(gigasx76x_gpio_leds
), gigasx76x_gpio_leds
);
149 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL
, ARRAY_SIZE(gigasx76x_gpio_keys
), gigasx76x_gpio_keys
);
150 xway_register_dwc(GIGASX76X_USB
);
152 if (!is_valid_ether_addr(ltq_ethaddr
))
153 random_ether_addr(ltq_ethaddr
);
155 memcpy(<q_eth_data
.mac
.sa_data
, ltq_ethaddr
, 6);
156 ltq_register_etop(<q_eth_data
);
158 ltq_register_ath5k(sx762_eeprom_data
, ltq_ethaddr
);
160 ltq_register_ath5k(sx763_eeprom_data
, ltq_ethaddr
);
163 MIPS_MACHINE(LANTIQ_MACH_GIGASX76X
,
165 "GIGASX76X - Gigaset SX761,SX762,SX763",