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) 2012 Luka Perkov <openwrt@lukaperkov.net>
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/leds.h>
12 #include <linux/gpio.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/input.h>
17 #include <linux/kernel.h>
18 #include <linux/delay.h>
20 #include <linux/if_ether.h>
21 #include <linux/etherdevice.h>
22 #include <linux/string.h>
24 #include <lantiq_soc.h>
25 #include <lantiq_platform.h>
26 #include <dev-gpio-leds.h>
27 #include <dev-gpio-buttons.h>
29 #include "../machtypes.h"
31 #include "dev-dwc_otg.h"
33 static u8 ltq_ethaddr
[6] = { 0 };
36 setup_ethaddr(char *str
)
38 if (!mac_pton(str
, ltq_ethaddr
))
39 memset(ltq_ethaddr
, 0, 6);
42 __setup("ethaddr=", setup_ethaddr
);
44 static struct mtd_partition h201l_partitions
[] __initdata
=
63 static struct physmap_flash_data h201l_flash_data __initdata
= {
64 .nr_parts
= ARRAY_SIZE(h201l_partitions
),
65 .parts
= h201l_partitions
,
68 static struct gpio_led
69 h201l_leds_gpio
[] __initdata
= {
72 static struct gpio_keys_button
73 h201l_gpio_keys
[] __initdata
= {
76 static struct ltq_eth_data ltq_eth_data
= {
77 .mii_mode
= PHY_INTERFACE_MODE_RMII
,
83 ltq_register_gpio_stp();
84 ltq_register_nor(&h201l_flash_data
);
85 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(h201l_leds_gpio
), h201l_leds_gpio
);
86 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL
, ARRAY_SIZE(h201l_gpio_keys
), h201l_gpio_keys
);
88 if (!is_valid_ether_addr(ltq_ethaddr
))
89 random_ether_addr(ltq_ethaddr
);
91 memcpy(<q_eth_data
.mac
.sa_data
, ltq_ethaddr
, 6);
92 ltq_register_etop(<q_eth_data
);
94 xway_register_dwc(-1);
97 MIPS_MACHINE(LANTIQ_MACH_H201L
,