2 * arch/arm/mach-kirkwood/nsa-310-setup.c
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/gpio.h>
14 #include <linux/i2c.h>
15 #include <mach/kirkwood.h>
20 #define NSA310_GPIO_USB_POWER_OFF 21
21 #define NSA310_GPIO_POWER_OFF 48
23 static unsigned int nsa310_mpp_config[] __initdata = {
24 MPP12_GPIO, /* led esata green */
25 MPP13_GPIO, /* led esata red */
26 MPP15_GPIO, /* led usb green */
27 MPP16_GPIO, /* led usb red */
28 MPP21_GPIO, /* control usb power off */
29 MPP28_GPIO, /* led sys green */
30 MPP29_GPIO, /* led sys red */
31 MPP36_GPIO, /* key reset */
32 MPP37_GPIO, /* key copy */
33 MPP39_GPIO, /* led copy green */
34 MPP40_GPIO, /* led copy red */
35 MPP41_GPIO, /* led hdd green */
36 MPP42_GPIO, /* led hdd red */
38 MPP46_GPIO, /* key power */
39 MPP48_GPIO, /* control power off */
43 static struct i2c_board_info __initdata nsa310_i2c_info[] = {
44 { I2C_BOARD_INFO("adt7476", 0x2e) },
47 static void nsa310_power_off(void)
49 gpio_set_value(NSA310_GPIO_POWER_OFF, 1);
52 static int __init nsa310_gpio_request(unsigned int gpio, unsigned long flags,
57 err = gpio_request_one(gpio, flags, label);
59 pr_err("NSA-310: can't setup GPIO%u (%s), err=%d\n",
65 static void __init nsa310_gpio_init(void)
69 err = nsa310_gpio_request(NSA310_GPIO_POWER_OFF, GPIOF_OUT_INIT_LOW,
72 pm_power_off = nsa310_power_off;
74 nsa310_gpio_request(NSA310_GPIO_USB_POWER_OFF, GPIOF_OUT_INIT_LOW,
78 void __init nsa310_init(void)
80 kirkwood_mpp_conf(nsa310_mpp_config);
84 i2c_register_board_info(0, ARRAY_AND_SIZE(nsa310_i2c_info));
87 static int __init nsa310_pci_init(void)
89 if (of_machine_is_compatible("zyxel,nsa310"))
90 kirkwood_pcie_init(KW_PCIE0);
95 subsys_initcall(nsa310_pci_init);