[lantiq]
[openwrt/svn-archive/archive.git] / target / linux / lantiq / files-3.0 / arch / mips / lantiq / xway / mach-gigasx76x.c
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) 2011 Andrej Vlašić
7 * Copyright (C) 2011 Luka Perkov
8 *
9 */
10
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/leds.h>
14 #include <linux/gpio.h>
15 #include <linux/gpio_buttons.h>
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/partitions.h>
18 #include <linux/mtd/physmap.h>
19 #include <linux/input.h>
20 #include <linux/ath5k_platform.h>
21 #include <linux/pci.h>
22 #include <linux/phy.h>
23
24 #include <irq.h>
25
26 #include <lantiq_soc.h>
27 #include <lantiq_platform.h>
28
29 #include "../machtypes.h"
30 #include "../dev-leds-gpio.h"
31 #include "devices.h"
32 #include "dev-dwc_otg.h"
33
34 static struct mtd_partition gigasx76x_partitions[] =
35 {
36 {
37 .name = "secondary_env",
38 .offset = 0xe000,
39 .size = 0x2000,
40 },
41 {
42 .name = "secondary_boot",
43 .offset = 0x10000,
44 .size = 0x10000,
45 },
46 {
47 .name = "uboot",
48 .offset = 0x20000,
49 .size = 0x30000,
50 },
51 {
52 .name = "linux",
53 .offset = 0x50000,
54 .size = 0x7a0000,
55 },
56 {
57 .name = "board_config",
58 .offset = 0x7f0000,
59 .size = 0x10000,
60 },
61 };
62
63 static struct gpio_led
64 gigasx76x_leds_gpio[] __initdata = {
65 { .name = "soc:green:usb", .gpio = 202, },
66 { .name = "soc:green:wlan", .gpio = 203, },
67 { .name = "soc:green:phone2", .gpio = 204, },
68 { .name = "soc:green:phone1", .gpio = 205, },
69 { .name = "soc:green:line", .gpio = 206, },
70 { .name = "soc:green:online", .gpio = 207, },
71 };
72
73
74 static struct physmap_flash_data gigasx76x_flash_data = {
75 .nr_parts = ARRAY_SIZE(gigasx76x_partitions),
76 .parts = gigasx76x_partitions,
77 };
78
79 static struct ltq_pci_data ltq_pci_data = {
80 .clock = PCI_CLOCK_INT,
81 .gpio = PCI_GNT1 | PCI_REQ1,
82 .irq = {
83 [14] = INT_NUM_IM0_IRL0 + 22,
84 },
85 };
86
87 static struct ltq_eth_data ltq_eth_data = {
88 .mii_mode = PHY_INTERFACE_MODE_MII,
89 };
90
91 static void __init
92 gigasx76x_init(void)
93 {
94 #define GIGASX76X_USB 29
95
96 ltq_register_gpio_stp();
97 ltq_register_nor(&gigasx76x_flash_data);
98 ltq_register_pci(&ltq_pci_data);
99 ltq_register_etop(&ltq_eth_data);
100 xway_register_dwc(GIGASX76X_USB);
101 ltq_register_tapi();
102 ltq_register_madwifi_eep();
103 ltq_add_device_leds_gpio(-1, ARRAY_SIZE(gigasx76x_leds_gpio), gigasx76x_leds_gpio);
104 }
105
106 MIPS_MACHINE(LANTIQ_MACH_GIGASX76X,
107 "GIGASX76X",
108 "GIGASX76X - Gigaset SX761,SX762,SX763",
109 gigasx76x_init);