您的位置:首页 > 其它

最新版华为HG255D硬件定义

2012-09-17 20:47 99 查看
上一修订版

最新修订版

下一修订版

Blame

修订日志


source:backfire/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg255d.c@407

查看修订版:

访问:

trunk

修订版 407, 5.4 KB 由lintel在6个月前签入
(diff)
Ramips:

*更新HG255D GPIO定义

1/*
2* HuaWei HG255D board support by lintel
3*
4* Copyright (C) 2011 lintel<lintel.huang@gmail.com>
5*
6* This program is free software; you can redistribute it and/or modify it
7* under the terms of the GNU General Public License version 2 as published
8* by the Free Software Foundation.
9*/
10
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h>
15#include <linux/mtd/physmap.h>
16#include <linux/leds.h>
17#include <linux/gpio_keys.h>
18#include <linux/input.h>
19
20#include <asm/mach-ralink/machine.h>
21#include <asm/mach-ralink/dev-gpio-buttons.h>
22#include <asm/mach-ralink/dev-gpio-leds.h>
23#include <asm/mach-ralink/rt305x.h>
24#include <asm/mach-ralink/rt305x_regs.h>
25
26#include "devices.h"
27
28#define HG255D_MTD_PARTITIONS 3 // 1 bootform 0x20000 ,2 bootform 0x40000,3 bootform 0x50000
29/*
30Note:
31GPIO [6:3] is share with SPI interface,so,if use for gpio,must disable the SPI.
32see datasheet Page NO.37.
33*/
34#define HG255D_GPIO_BUTTON_RESET 4
35#define HG255D_GPIO_BUTTON_WPS 10
36#define HG255D_GPIO_BUTTON_WLAN 0
37
38#define HG255D_GPIO_LED_POWER 8
39#define HG255D_GPIO_LED_USB 9
40#define HG255D_GPIO_LED_INTERNET 13
41#define HG255D_GPIO_LED_WLAN 14
42#define HG255D_GPIO_LED_WPS 12
43#define HG255D_GPIO_LED_VOICE 5
44
45
46#define HG255D_BUTTONS_POLL_INTERVAL 20
47
48#define BLOCK_SZ_128K 0x00020000
49
50
51#ifdef CONFIG_MTD_PARTITIONS
52#if (HG255D_MTD_PARTITIONS == 1)
53static struct mtd_partition hg255d_partitions[] = {
54
55{
56.name = "u-boot",
57.offset = 0,
58.size = 0x020000,
59// .mask_flags = MTD_WRITEABLE,
60}, {
61.name = "kernel",
62.offset = 0x0020000,
63.size = 0x0100000,
64}, {
65.name = "rootfs",
66.offset = 0x0120000,
67.size = 0x06e0000,
68}, {
69.name = "firmware",
70.offset = 0x0020000,
71.size = 0x07e0000,
72}, {
73.name = "factory",
74.offset = 0x0fa0000,
75.size = 0x0020000,
76// .mask_flags = MTD_WRITEABLE,
77}, {
78.name = "fullflash",
79.offset = 0x000000,
80.size = 0x01000000,
81}
82};
83#elif (HG255D_MTD_PARTITIONS == 2)
84static struct mtd_partition hg255d_partitions[] = {
85
86
87{
88.name = "u-boot",
89.offset = 0,
90.size = 0x040000,
91// .mask_flags = MTD_WRITEABLE,
92}, {
93.name = "kernel",
94.offset = 0x040000,
95.size = 0x100000,
96}, {
97.name = "rootfs",
98.offset = 0x140000,
99.size = 0x600000,
100}, {
101.name = "firmware",
102.offset = 0x040000,
103.size = 0xe60000,
104}, {
105.name = "factory",
106.offset = 0x0fa0000,
107.size = 0x0020000,
108// .mask_flags = MTD_WRITEABLE,
109}, {
110.name = "fullflash",
111.offset = 0x000000,
112.size = 0xfa0000,
113
114}
115
116};
117
118#elif (HG255D_MTD_PARTITIONS == 3)
119static struct mtd_partition hg255d_partitions[] = {
120
121{
122.name = "u-boot",
123.offset = 0,
124.size = 0x040000,
125// .mask_flags = MTD_WRITEABLE,
126}, {
127.name = "kernel",
128.offset = 0x0050000,
129.size = 0x0100000,
130}, {
131.name = "rootfs",
132.offset = 0x0150000,
133.size = 0x0e50000,
134}, {
135.name = "firmware",
136.offset = 0x0040000,
137.size = 0x0f60000,
138}, {
139.name = "factory",
140.offset = 0x0fa0000,
141.size = 0x0020000,
142// .mask_flags = MTD_WRITEABLE,
143}, {
144.name = "fullflash",
145.offset = 0x000000,
146.size = 0x01000000,
147}
148};
149
150#endif /* CONFIG_MTD_PARTITIONS */
151#endif /* CONFIG_MTD_PARTITIONS */
152
153static struct physmap_flash_data hg255d_flash_data = {
154#ifdef CONFIG_MTD_PARTITIONS
155.nr_parts = ARRAY_SIZE(hg255d_partitions),
156.parts = hg255d_partitions,
157#endif
158};
159
160static struct gpio_led hg255d_led_pins[] = {
161{
162.name = "hg255d:power",
163.gpio = HG255D_GPIO_LED_POWER,
164.active_low = 1,
165.default_trigger= "default-on",
166}, {
167.name = "hg255d:internet",
168.gpio = HG255D_GPIO_LED_INTERNET,
169.active_low = 1,
170}, {
171.name = "hg255d:wlan",
172.gpio = HG255D_GPIO_LED_WLAN,
173.active_low = 1,
174}, {
175.name = "hg255d:usb",
176.gpio = HG255D_GPIO_LED_USB,
177.active_low = 1,
178}, {
179.name = "hg255d:wps",
180.gpio = HG255D_GPIO_LED_WPS,
181.active_low = 1,
182}
183};
184
185static struct gpio_led_platform_data hg255d_led_data = {
186.leds = hg255d_led_pins,
187.num_leds = ARRAY_SIZE(hg255d_led_pins),
188};
189
190static struct platform_device hg255d_leds = {
191.name = "leds-gpio",
192.id = -1,
193.dev = {
194.platform_data = &hg255d_led_data,
195}
196};
197
198
199static struct gpio_keys_button hg255d_buttons[] = {
200{
201.desc = "BTN_0",
202.type = EV_KEY,
203.code = BTN_0,
204.gpio = HG255D_GPIO_BUTTON_WLAN,
205.active_low = 1,
206.debounce_interval = 100,
207}, {
208.desc = "BTN_1",
209.type = EV_KEY,
210.code = BTN_1,
211.gpio = HG255D_GPIO_BUTTON_WPS,
212.active_low = 1,
213.debounce_interval = 100,
214}
215
216};
217
218
219static struct gpio_keys_platform_data hg255d_button_data = {
220.buttons = hg255d_buttons,
221.nbuttons = ARRAY_SIZE(hg255d_buttons),
222};
223
224static struct platform_device hg255d_button_device = {
225.name = "gpio-keys",
226.id = -1,
227.num_resources = 0,
228.dev = {
229.platform_data = &hg255d_button_data,
230}
231};
232
233
234static void __init hg255d_init(void)
235{
236rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
237
238rt305x_register_flash(0, &hg255d_flash_data);
239
240//ramips_register_gpio_leds(-1, ARRAY_SIZE(hg255d_leds_gpio),
241// hg255d_leds_gpio);
242platform_device_register(&hg255d_leds);
243
244//ramips_register_gpio_buttons(-1, HG255D_BUTTONS_POLL_INTERVAL,
245// ARRAY_SIZE(hg255d_gpio_buttons),
246// hg255d_gpio_buttons);
247platform_device_register(&hg255d_button_device);
248
249rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
250rt305x_register_ethernet();
251rt305x_register_wifi();
252rt305x_register_wdt();
253rt305x_register_usb();
254rt305x_register_gpiodev();
255}
256
257MIPS_MACHINE(RAMIPS_MACH_HG255D, "HG255D", "HuaWei HG255D",
258hg255d_init);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐