set 3.3.6 as default
[openwrt/openwrt.git] / target / linux / lantiq / files-3.3 / arch / mips / lantiq / xway / mach-p2601hnf1.c
1 /*
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.
5 *
6 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7 */
8
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>
22
23 #include <lantiq_soc.h>
24 #include <lantiq_platform.h>
25
26 #include "../machtypes.h"
27 #include "devices.h"
28 #include "../dev-gpio-leds.h"
29 #include "dev-dwc_otg.h"
30
31
32 static struct mtd_partition p2601hnf1_partitions[] __initdata =
33 {
34 {
35 .name = "uboot",
36 .offset = 0x0,
37 .size = 0x20000,
38 },
39 /* {
40 .name = "uboot_env",
41 .offset = 0x20000,
42 .size = 0x20000,
43 },
44 */ {
45 .name = "linux",
46 .offset = 0x020000,
47 .size = 0xfc0000,
48 },
49 {
50 .name = "board_config",
51 .offset = 0xfe0000,
52 .size = 0x20000,
53 },
54 };
55
56 static struct physmap_flash_data p2601hnf1_flash_data __initdata = {
57 .nr_parts = ARRAY_SIZE(p2601hnf1_partitions),
58 .parts = p2601hnf1_partitions,
59 };
60
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" },
71 };
72
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, },
77 };
78
79 static struct ltq_eth_data ltq_eth_data = {
80 .mii_mode = PHY_INTERFACE_MODE_RMII,
81 };
82
83 static void __init
84 p2601hnf1_init(void)
85 {
86
87 #define P2601HNF1_USB 9
88
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(&ltq_eth_data);
94 xway_register_dwc(P2601HNF1_USB);
95
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);
100 }
101
102 MIPS_MACHINE(LANTIQ_MACH_P2601HNF1,
103 "P2601HNF1",
104 "ZyXEL P-2601HN-F1",
105 p2601hnf1_init);
106