Skip to content

Commit b1b99b0

Browse files
1000001101000arndb
authored andcommitted
ARM: mv78xx0: fix entries for gpios, buttons and usb ports
Original code was largely copy-pasted from the reference board code, correct values to reflect the hardware actually present in the TS-WXL. Signed-off-by: Jeremy J. Peper <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 4b01f73 commit b1b99b0

File tree

1 file changed

+51
-15
lines changed

1 file changed

+51
-15
lines changed

arch/arm/mach-mv78xx0/buffalo-wxl-setup.c

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@
1414
#include <linux/mv643xx_eth.h>
1515
#include <linux/ethtool.h>
1616
#include <linux/i2c.h>
17+
#include <linux/gpio.h>
18+
#include <linux/gpio_keys.h>
19+
#include <linux/input.h>
1720
#include <asm/mach-types.h>
1821
#include <asm/mach/arch.h>
1922
#include "mv78xx0.h"
2023
#include "common.h"
2124
#include "mpp.h"
2225

2326

27+
#define TSWXL_AUTO_SWITCH 15
28+
#define TSWXL_USB_POWER1 30
29+
#define TSWXL_USB_POWER2 31
30+
31+
2432
/* This arch has 2 Giga Ethernet */
2533

2634
static struct mv643xx_eth_platform_data db78x00_ge00_data = {
@@ -57,9 +65,9 @@ static unsigned int wxl_mpp_config[] __initdata = {
5765
MPP10_GE1_RXD2,
5866
MPP11_GE1_RXD3,
5967
MPP12_GPIO,
60-
MPP13_SYSRST_OUTn,
61-
MPP14_SATA1_ACTn,
62-
MPP15_SATA0_ACTn,
68+
MPP13_GPIO,
69+
MPP14_GPIO,
70+
MPP15_GPIO,
6371
MPP16_GPIO,
6472
MPP17_GPIO,
6573
MPP18_GPIO,
@@ -73,7 +81,7 @@ static unsigned int wxl_mpp_config[] __initdata = {
7381
MPP26_UA2_CTSn,
7482
MPP27_UA2_RTSn,
7583
MPP28_GPIO,
76-
MPP29_SYSRST_OUTn,
84+
MPP29_GPIO,
7785
MPP30_GPIO,
7886
MPP31_GPIO,
7987
MPP32_GPIO,
@@ -84,19 +92,41 @@ static unsigned int wxl_mpp_config[] __initdata = {
8492
MPP37_GPIO,
8593
MPP38_GPIO,
8694
MPP39_GPIO,
87-
MPP40_UNUSED,
88-
MPP41_UNUSED,
89-
MPP42_UNUSED,
90-
MPP43_UNUSED,
91-
MPP44_UNUSED,
92-
MPP45_UNUSED,
93-
MPP46_UNUSED,
94-
MPP47_UNUSED,
95-
MPP48_SATA1_ACTn,
96-
MPP49_SATA0_ACTn,
95+
MPP40_GPIO,
96+
MPP41_GPIO,
97+
MPP42_GPIO,
98+
MPP43_GPIO,
99+
MPP44_GPIO,
100+
MPP45_GPIO,
101+
MPP46_GPIO,
102+
MPP47_GPIO,
103+
MPP48_GPIO,
104+
MPP49_GPIO,
97105
0
98106
};
99107

108+
static struct gpio_keys_button tswxl_buttons[] = {
109+
{
110+
.code = KEY_OPTION,
111+
.gpio = TSWXL_AUTO_SWITCH,
112+
.desc = "Power-auto Switch",
113+
.active_low = 1,
114+
}
115+
};
116+
117+
static struct gpio_keys_platform_data tswxl_button_data = {
118+
.buttons = tswxl_buttons,
119+
.nbuttons = ARRAY_SIZE(tswxl_buttons),
120+
};
121+
122+
static struct platform_device tswxl_button_device = {
123+
.name = "gpio-keys",
124+
.id = -1,
125+
.num_resources = 0,
126+
.dev = {
127+
.platform_data = &tswxl_button_data,
128+
},
129+
};
100130

101131
static void __init wxl_init(void)
102132
{
@@ -111,7 +141,6 @@ static void __init wxl_init(void)
111141
*/
112142
mv78xx0_ehci0_init();
113143
mv78xx0_ehci1_init();
114-
mv78xx0_ehci2_init();
115144
mv78xx0_ge00_init(&db78x00_ge00_data);
116145
mv78xx0_ge01_init(&db78x00_ge01_data);
117146
mv78xx0_sata_init(&db78x00_sata_data);
@@ -123,6 +152,13 @@ static void __init wxl_init(void)
123152
mv78xx0_crypto_init();
124153
mv78xx0_i2c_init();
125154
i2c_register_board_info(0, &db78x00_i2c_rtc, 1);
155+
156+
//enable both usb ports
157+
gpio_direction_output(TSWXL_USB_POWER1, 1);
158+
gpio_direction_output(TSWXL_USB_POWER2, 1);
159+
160+
//enable rear switch
161+
platform_device_register(&tswxl_button_device);
126162
}
127163

128164
static int __init wxl_pci_init(void)

0 commit comments

Comments
 (0)