| 1 | /* |
| 2 | * arch/arm/mach-kirkwood/iconnect-setup.c |
| 3 | * |
| 4 | * Iomega iConnect Wireless |
| 5 | * |
| 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. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/irq.h> |
| 15 | #include <linux/mtd/partitions.h> |
| 16 | #include <linux/mv643xx_eth.h> |
| 17 | #include <linux/ethtool.h> |
| 18 | #include <linux/gpio.h> |
| 19 | #include <linux/gpio_keys.h> |
| 20 | #include <linux/input.h> |
| 21 | #include <linux/leds.h> |
| 22 | #include <asm/mach-types.h> |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <mach/kirkwood.h> |
| 25 | #include "common.h" |
| 26 | #include "mpp.h" |
| 27 | |
| 28 | static struct mtd_partition iconnect_nand_parts[] = { |
| 29 | { |
| 30 | .name = "u-boot", |
| 31 | .offset = 0, |
| 32 | .size = SZ_1M |
| 33 | }, { |
| 34 | .name = "uImage", |
| 35 | .offset = MTDPART_OFS_NXTBLK, |
| 36 | .size = SZ_1M + SZ_2M |
| 37 | }, { |
| 38 | .name = "rootfs", |
| 39 | .offset = MTDPART_OFS_NXTBLK, |
| 40 | .size = SZ_32M, |
| 41 | }, { |
| 42 | .name = "data", |
| 43 | .offset = MTDPART_OFS_NXTBLK, |
| 44 | .size = MTDPART_SIZ_FULL |
| 45 | }, |
| 46 | }; |
| 47 | |
| 48 | static struct mv643xx_eth_platform_data iconnect_ge00_data = { |
| 49 | .phy_addr = MV643XX_ETH_PHY_ADDR(11), |
| 50 | }; |
| 51 | |
| 52 | static struct gpio_led iconnect_led_pins[] = { |
| 53 | { |
| 54 | .name = "iconnect:blue:power", |
| 55 | .default_trigger = "default-on", |
| 56 | .gpio = 42, |
| 57 | }, |
| 58 | { |
| 59 | .name = "iconnect:red:power", |
| 60 | .gpio = 43, |
| 61 | }, |
| 62 | { |
| 63 | .name = "iconnect:blue:usb1", |
| 64 | .gpio = 44, |
| 65 | }, |
| 66 | { |
| 67 | .name = "iconnect:blue:usb2", |
| 68 | .gpio = 45, |
| 69 | }, |
| 70 | { |
| 71 | .name = "iconnect:blue:usb3", |
| 72 | .gpio = 46, |
| 73 | }, |
| 74 | { |
| 75 | .name = "iconnect:blue:usb4", |
| 76 | .gpio = 47, |
| 77 | }, |
| 78 | { |
| 79 | .name = "iconnect:blue:otb", |
| 80 | .gpio = 48, |
| 81 | }, |
| 82 | }; |
| 83 | |
| 84 | static struct gpio_led_platform_data iconnect_led_data = { |
| 85 | .leds = iconnect_led_pins, |
| 86 | .num_leds = ARRAY_SIZE(iconnect_led_pins), |
| 87 | }; |
| 88 | |
| 89 | static struct platform_device iconnect_leds = { |
| 90 | .name = "leds-gpio", |
| 91 | .id = -1, |
| 92 | .dev = { |
| 93 | .platform_data = &iconnect_led_data, |
| 94 | } |
| 95 | }; |
| 96 | |
| 97 | #define ICONNECT_GPIO_KEY_RESET 12 |
| 98 | #define ICONNECT_GPIO_KEY_OTB 35 |
| 99 | |
| 100 | #define ICONNECT_SW_RESET 0x00 |
| 101 | #define ICONNECT_SW_OTB 0x01 |
| 102 | |
| 103 | static struct gpio_keys_button iconnect_buttons[] = { |
| 104 | { |
| 105 | .type = EV_SW, |
| 106 | .code = ICONNECT_SW_RESET, |
| 107 | .gpio = ICONNECT_GPIO_KEY_RESET, |
| 108 | .desc = "Reset Button", |
| 109 | .active_low = 1, |
| 110 | .debounce_interval = 100, |
| 111 | }, |
| 112 | { |
| 113 | .type = EV_SW, |
| 114 | .code = ICONNECT_SW_OTB, |
| 115 | .gpio = ICONNECT_GPIO_KEY_OTB, |
| 116 | .desc = "OTB Button", |
| 117 | .active_low = 1, |
| 118 | .debounce_interval = 100, |
| 119 | }, |
| 120 | }; |
| 121 | |
| 122 | static struct gpio_keys_platform_data iconnect_button_data = { |
| 123 | .buttons = iconnect_buttons, |
| 124 | .nbuttons = ARRAY_SIZE(iconnect_buttons), |
| 125 | }; |
| 126 | |
| 127 | static struct platform_device iconnect_button_device = { |
| 128 | .name = "gpio-keys", |
| 129 | .id = -1, |
| 130 | .num_resources = 0, |
| 131 | .dev = { |
| 132 | .platform_data = &iconnect_button_data, |
| 133 | }, |
| 134 | }; |
| 135 | |
| 136 | static unsigned int iconnect_mpp_config[] __initdata = { |
| 137 | MPP12_GPIO, /*Input for reset button*/ |
| 138 | MPP35_GPIO, /*Input for OTB button*/ |
| 139 | MPP42_GPIO, |
| 140 | MPP43_GPIO, |
| 141 | MPP44_GPIO, |
| 142 | MPP45_GPIO, |
| 143 | MPP46_GPIO, |
| 144 | MPP47_GPIO, |
| 145 | MPP48_GPIO, |
| 146 | 0 |
| 147 | }; |
| 148 | |
| 149 | static void __init iconnect_init(void) |
| 150 | { |
| 151 | u32 dev, rev; |
| 152 | |
| 153 | /* |
| 154 | * Basic setup. Needs to be called early. |
| 155 | */ |
| 156 | kirkwood_init(); |
| 157 | kirkwood_mpp_conf(iconnect_mpp_config); |
| 158 | |
| 159 | kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25); |
| 160 | kirkwood_ehci_init(); |
| 161 | |
| 162 | kirkwood_ge00_init(&iconnect_ge00_data); |
| 163 | kirkwood_pcie_id(&dev, &rev); |
| 164 | |
| 165 | kirkwood_uart0_init(); |
| 166 | kirkwood_i2c_init(); |
| 167 | |
| 168 | platform_device_register(&iconnect_leds); |
| 169 | platform_device_register(&iconnect_button_device); |
| 170 | } |
| 171 | |
| 172 | static int __init iconnect_pci_init(void) |
| 173 | { |
| 174 | if (machine_is_iconnect()) |
| 175 | kirkwood_pcie_init(KW_PCIE0); |
| 176 | |
| 177 | return 0; |
| 178 | } |
| 179 | subsys_initcall(iconnect_pci_init); |
| 180 | |
| 181 | |
| 182 | MACHINE_START(ICONNECT, "Iomega iConnect Wireless") |
| 183 | .atag_offset = 0x100, |
| 184 | .init_machine = iconnect_init, |
| 185 | .map_io = kirkwood_map_io, |
| 186 | .init_early = kirkwood_init_early, |
| 187 | .init_irq = kirkwood_init_irq, |
| 188 | .timer = &kirkwood_timer, |
| 189 | .restart = kirkwood_restart, |
| 190 | MACHINE_END |
| 191 | |