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/leds.h>
12 #include <linux/gpio.h>
13 #include <linux/gpio_buttons.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/input.h>
18 #include <linux/etherdevice.h>
19 #include <linux/mdio-gpio.h>
20 #include <linux/kernel.h>
21 #include <linux/delay.h>
23 #include <lantiq_soc.h>
24 #include <lantiq_platform.h>
25 #include <dev-gpio-leds.h>
26 #include <dev-gpio-buttons.h>
28 #include "../machtypes.h"
30 #include "dev-dwc_otg.h"
32 static struct mtd_partition p2601hnfx_partitions
[] __initdata
=
51 static struct physmap_flash_data p2601hnfx_flash_data __initdata
= {
52 .nr_parts
= ARRAY_SIZE(p2601hnfx_partitions
),
53 .parts
= p2601hnfx_partitions
,
56 static struct gpio_led
57 p2601hnfx_leds_gpio
[] __initdata
= {
58 { .name
= "soc:yellow:phone", .gpio
= 216, .active_low
= 1 },
59 { .name
= "soc:green:phone", .gpio
= 217, .active_low
= 1 },
60 { .name
= "soc:yellow:wifi", .gpio
= 218, .active_low
= 1 },
61 { .name
= "soc:green:power", .gpio
= 219, .active_low
= 1 },
62 { .name
= "soc:red:internet", .gpio
= 220, .active_low
= 1 },
63 { .name
= "soc:green:internet", .gpio
= 221, .active_low
= 1 },
64 { .name
= "soc:green:dsl", .gpio
= 222, .active_low
= 1 },
65 { .name
= "soc:green:wifi", .gpio
= 223, .active_low
= 1 },
68 static struct gpio_keys_button
69 p2601hnfx_gpio_keys
[] __initdata
= {
74 .debounce_interval
= LTQ_KEYS_DEBOUNCE_INTERVAL
,
82 .debounce_interval
= LTQ_KEYS_DEBOUNCE_INTERVAL
,
88 static struct ltq_eth_data ltq_eth_data
= {
89 .mii_mode
= PHY_INTERFACE_MODE_RMII
,
95 #define P2601HNFX_USB 9
97 ltq_register_gpio_stp();
98 ltq_register_nor(&p2601hnfx_flash_data
);
99 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(p2601hnfx_leds_gpio
), p2601hnfx_leds_gpio
);
100 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL
, ARRAY_SIZE(p2601hnfx_gpio_keys
), p2601hnfx_gpio_keys
);
101 ltq_register_etop(<q_eth_data
);
102 xway_register_dwc(P2601HNFX_USB
);
104 // enable the ethernet ports on the SoC
105 // ltq_w32((ltq_r32(LTQ_GPORT_P0_CTL) & ~(1 << 17)) | (1 << 18), LTQ_GPORT_P0_CTL);
106 // ltq_w32((ltq_r32(LTQ_GPORT_P1_CTL) & ~(1 << 17)) | (1 << 18), LTQ_GPORT_P1_CTL);
107 // ltq_w32((ltq_r32(LTQ_GPORT_P2_CTL) & ~(1 << 17)) | (1 << 18), LTQ_GPORT_P2_CTL);
110 MIPS_MACHINE(LANTIQ_MACH_P2601HNFX
,