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>
26 #include "../machtypes.h"
28 #include "../dev-gpio-leds.h"
29 #include "dev-dwc_otg.h"
32 static struct mtd_partition p2601hnf1_partitions
[] __initdata
=
50 .name
= "board_config",
56 static struct physmap_flash_data p2601hnf1_flash_data __initdata
= {
57 .nr_parts
= ARRAY_SIZE(p2601hnf1_partitions
),
58 .parts
= p2601hnf1_partitions
,
61 static struct gpio_led p2601hnf1_leds_gpio
[] __initdata
= {
62 { .name
= "soc:red:power", .gpio
= 29, .active_low
= 1, .default_trigger
= "default-off" },
63 { .name
= "soc:yellow:phone", .gpio
= 64, .active_low
= 1, .default_trigger
= "default-off" },
64 { .name
= "soc:green:phone", .gpio
= 65, .active_low
= 1, .default_trigger
= "default-off" },
65 { .name
= "soc:yellow:wlan", .gpio
= 66, .active_low
= 1, .default_trigger
= "default-off" },
66 { .name
= "soc:green:power", .gpio
= 67, .active_low
= 1, .default_trigger
= "default-on" },
67 { .name
= "soc:red:internet", .gpio
= 68, .active_low
= 1, .default_trigger
= "default-off" },
68 { .name
= "soc:green:internet", .gpio
= 69, .active_low
= 1, .default_trigger
= "default-off" },
69 { .name
= "soc:green:dsl", .gpio
= 70, .active_low
= 1, .default_trigger
= "default-off" },
70 { .name
= "soc:green:wlan", .gpio
= 71, .active_low
= 1, .default_trigger
= "default-off" },
73 static struct gpio_button
74 p2601hnf1_gpio_buttons
[] /*__initdata*/ = {
75 { .desc
= "reset", .type
= EV_KEY
, .code
= BTN_0
, .threshold
= 3, .gpio
= 53, .active_low
= 1, },
76 { .desc
= "wlan", .type
= EV_KEY
, .code
= BTN_1
, .threshold
= 1, .gpio
= 54, .active_low
= 1, },
79 static struct ltq_eth_data ltq_eth_data
= {
80 .mii_mode
= PHY_INTERFACE_MODE_RMII
,
87 #define P2601HNF1_USB 9
89 ltq_register_gpio_stp();
90 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(p2601hnf1_leds_gpio
), p2601hnf1_leds_gpio
);
91 ltq_register_gpio_buttons(p2601hnf1_gpio_buttons
, ARRAY_SIZE(p2601hnf1_gpio_buttons
));
92 ltq_register_nor(&p2601hnf1_flash_data
);
93 ltq_register_etop(<q_eth_data
);
94 xway_register_dwc(P2601HNF1_USB
);
96 // enable the ethernet ports on the SoC
97 // ltq_w32((ltq_r32(LTQ_GPORT_P0_CTL) & ~(1 << 17)) | (1 << 18), LTQ_GPORT_P0_CTL);
98 // ltq_w32((ltq_r32(LTQ_GPORT_P1_CTL) & ~(1 << 17)) | (1 << 18), LTQ_GPORT_P1_CTL);
99 // ltq_w32((ltq_r32(LTQ_GPORT_P2_CTL) & ~(1 << 17)) | (1 << 18), LTQ_GPORT_P2_CTL);
102 MIPS_MACHINE(LANTIQ_MACH_P2601HNF1
,