generic: ar8216: use usleep_range in ar8216_mii_{read,write}
[openwrt.git] / target / linux / generic / patches-2.6.39 / 106-alix_platform_gpio_keys_button.patch
1 --- a/arch/x86/platform/geode/alix.c
2 +++ b/arch/x86/platform/geode/alix.c
3 @@ -6,6 +6,7 @@
4 *
5 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
6 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
7 + * and Philip Prindeville <philipp@redfish-solutions.com>
8 *
9 * TODO: There are large similarities with leds-net5501.c
10 * by Alessandro Zummo <a.zummo@towertech.it>
11 @@ -23,14 +24,48 @@
12 #include <linux/leds.h>
13 #include <linux/platform_device.h>
14 #include <linux/gpio.h>
15 +#include <linux/input.h>
16 +#include <linux/gpio_keys.h>
17
18 #include <asm/geode.h>
19
20 +#define BIOS_SIGNATURE_TINYBIOS 0x000f0000
21 +#define BIOS_SIGNATURE_COREBOOT 0x00000050
22 +#define BIOS_REGION_SIZE 0x00010000
23 +
24 +static int model = 0;
25 +
26 static int force = 0;
27 module_param(force, bool, 0444);
28 /* FIXME: Award bios is not automatically detected as Alix platform */
29 MODULE_PARM_DESC(force, "Force detection as ALIX.2/ALIX.3 platform");
30
31 +static struct gpio_keys_button alix_gpio_buttons[] = {
32 + {
33 + .code = KEY_RESTART,
34 + .gpio = 24,
35 + .active_low = 1,
36 + .desc = "Reset button",
37 + .type = EV_KEY,
38 + .wakeup = 0,
39 + .debounce_interval = 100,
40 + .can_disable = 0,
41 + }
42 +};
43 +static struct gpio_keys_platform_data alix_buttons_data = {
44 + .buttons = alix_gpio_buttons,
45 + .nbuttons = ARRAY_SIZE(alix_gpio_buttons),
46 + .poll_interval = 20,
47 +};
48 +
49 +static struct platform_device alix_buttons_dev = {
50 + .name = "gpio-keys-polled",
51 + .id = 1,
52 + .dev = {
53 + .platform_data = &alix_buttons_data,
54 + }
55 +};
56 +
57 static struct gpio_led alix_leds[] = {
58 {
59 .name = "alix:1",
60 @@ -63,17 +98,22 @@ static struct platform_device alix_leds_
61 .dev.platform_data = &alix_leds_data,
62 };
63
64 +static struct __initdata platform_device *alix_devs[] = {
65 + &alix_buttons_dev,
66 + &alix_leds_dev,
67 +};
68 +
69 static void __init register_alix(void)
70 {
71 /* Setup LED control through leds-gpio driver */
72 - platform_device_register(&alix_leds_dev);
73 + platform_add_devices(alix_devs, ARRAY_SIZE(alix_devs));
74 }
75
76 static int __init alix_present(unsigned long bios_phys,
77 const char *alix_sig,
78 size_t alix_sig_len)
79 {
80 - const size_t bios_len = 0x00010000;
81 + const size_t bios_len = BIOS_REGION_SIZE;
82 const char *bios_virt;
83 const char *scan_end;
84 const char *p;
85 @@ -108,7 +148,9 @@ static int __init alix_present(unsigned
86 *a = '\0';
87
88 tail = p + alix_sig_len;
89 - if ((tail[0] == '2' || tail[0] == '3')) {
90 + if ((tail[0] == '2' || tail[0] == '3' || tail[0] == '6')) {
91 + model = tail[0] - '0';
92 +
93 printk(KERN_INFO
94 "%s: system is recognized as \"%s\"\n",
95 KBUILD_MODNAME, name);
96 @@ -127,8 +169,8 @@ static int __init alix_init(void)
97 if (!is_geode())
98 return 0;
99
100 - if (alix_present(0xf0000, tinybios_sig, sizeof(tinybios_sig) - 1) ||
101 - alix_present(0x500, coreboot_sig, sizeof(coreboot_sig) - 1))
102 + if (alix_present(BIOS_SIGNATURE_TINYBIOS, tinybios_sig, sizeof(tinybios_sig) - 1) ||
103 + alix_present(BIOS_SIGNATURE_COREBOOT, coreboot_sig, sizeof(coreboot_sig) - 1))
104 register_alix();
105
106 return 0;
This page took 0.042277 seconds and 5 git commands to generate.