| 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify it |
| 3 | * under the terms of the GNU General Public License version 2 as published |
| 4 | * by the Free Software Foundation. |
| 5 | * |
| 6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
| 7 | */ |
| 8 | |
| 9 | #include <linux/init.h> |
| 10 | #include <linux/platform_device.h> |
| 11 | #include <linux/mtd/mtd.h> |
| 12 | #include <linux/mtd/partitions.h> |
| 13 | #include <linux/mtd/physmap.h> |
| 14 | #include <linux/input.h> |
| 15 | #include <linux/phy.h> |
| 16 | #include <linux/spi/spi_gpio.h> |
| 17 | #include <linux/spi/flash.h> |
| 18 | |
| 19 | #include <lantiq_soc.h> |
| 20 | #include <irq.h> |
| 21 | |
| 22 | #include "../machtypes.h" |
| 23 | #include "devices.h" |
| 24 | #include "dev-ifxhcd.h" |
| 25 | #include "dev-gpio-leds.h" |
| 26 | #include "dev-gpio-buttons.h" |
| 27 | |
| 28 | static struct mtd_partition fritz7320_partitions[] = { |
| 29 | { |
| 30 | .name = "urlader", |
| 31 | .offset = 0x0, |
| 32 | .size = 0x20000, |
| 33 | }, |
| 34 | { |
| 35 | .name = "linux", |
| 36 | .offset = 0x20000, |
| 37 | .size = 0xf60000, |
| 38 | }, |
| 39 | { |
| 40 | .name = "tffs (1)", |
| 41 | .offset = 0xf80000, |
| 42 | .size = 0x40000, |
| 43 | }, |
| 44 | { |
| 45 | .name = "tffs (2)", |
| 46 | .offset = 0xfc0000, |
| 47 | .size = 0x40000, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static struct physmap_flash_data fritz7320_flash_data = { |
| 52 | .nr_parts = ARRAY_SIZE(fritz7320_partitions), |
| 53 | .parts = fritz7320_partitions, |
| 54 | }; |
| 55 | |
| 56 | static struct gpio_led |
| 57 | fritz7320_gpio_leds[] __initdata = { |
| 58 | { .name = "soc:green:power", .gpio = 44, .active_low = 1, .default_trigger = "default-on" }, |
| 59 | { .name = "soc:green:internet", .gpio = 47, .active_low = 1, .default_trigger = "default-on" }, |
| 60 | { .name = "soc:green:dect", .gpio = 38, .active_low = 1, .default_trigger = "default-on" }, |
| 61 | { .name = "soc:green:wlan", .gpio = 37, .active_low = 1, .default_trigger = "default-on" }, |
| 62 | { .name = "soc:green:dual1", .gpio = 35, .active_low = 1, .default_trigger = "default-on" }, |
| 63 | { .name = "soc:red:dual2", .gpio = 45, .active_low = 1, .default_trigger = "default-on" }, |
| 64 | }; |
| 65 | |
| 66 | static struct gpio_keys_button |
| 67 | fritz7320_gpio_keys[] __initdata = { |
| 68 | { |
| 69 | .desc = "wifi", |
| 70 | .type = EV_KEY, |
| 71 | .code = BTN_0, |
| 72 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
| 73 | .gpio = 1, |
| 74 | .active_low = 1, |
| 75 | }, |
| 76 | { |
| 77 | .desc = "dect", |
| 78 | .type = EV_KEY, |
| 79 | .code = BTN_1, |
| 80 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
| 81 | .gpio = 2, |
| 82 | .active_low = 1, |
| 83 | }, |
| 84 | }; |
| 85 | |
| 86 | static struct ltq_pci_data ltq_pci_data = { |
| 87 | .clock = PCI_CLOCK_INT, |
| 88 | .gpio = PCI_GNT1 | PCI_REQ1, |
| 89 | .irq = { |
| 90 | [14] = INT_NUM_IM0_IRL0 + 22, |
| 91 | }, |
| 92 | }; |
| 93 | |
| 94 | static struct ltq_eth_data ltq_eth_data = { |
| 95 | .mii_mode = PHY_INTERFACE_MODE_RMII, |
| 96 | }; |
| 97 | |
| 98 | static int usb_pins[2] = { 50, 51 }; |
| 99 | |
| 100 | static void __init |
| 101 | fritz7320_init(void) |
| 102 | { |
| 103 | ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, |
| 104 | ARRAY_SIZE(fritz7320_gpio_keys), fritz7320_gpio_keys); |
| 105 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(fritz7320_gpio_leds), fritz7320_gpio_leds); |
| 106 | ltq_register_pci(<q_pci_data); |
| 107 | ltq_register_etop(<q_eth_data); |
| 108 | ltq_register_nor(&fritz7320_flash_data); |
| 109 | xway_register_hcd(usb_pins); |
| 110 | } |
| 111 | |
| 112 | MIPS_MACHINE(LANTIQ_MACH_FRITZ7320, |
| 113 | "FRITZ7320", |
| 114 | "FRITZ!BOX 7320", |
| 115 | fritz7320_init); |
| 116 | |