adds 3.3 patches and files
[openwrt/openwrt.git] / target / linux / lantiq / files-3.3 / arch / mips / lantiq / xway / mach-netgear.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) 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.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-dwc_otg.h"
25
26 static struct ltq_pci_data ltq_pci_data = {
27 .clock = PCI_CLOCK_INT,
28 .gpio = PCI_GNT1 | PCI_REQ1,
29 .irq = {
30 [14] = INT_NUM_IM0_IRL0 + 22,
31 },
32 };
33
34 static struct ltq_eth_data ltq_eth_data = {
35 .mii_mode = PHY_INTERFACE_MODE_MII,
36 };
37
38 static struct mtd_partition easy98000_nor_partitions[] =
39 {
40 {
41 .name = "uboot",
42 .offset = 0x0,
43 .size = 0x40000,
44 },
45 {
46 .name = "uboot_env",
47 .offset = 0x40000,
48 .size = 0x40000, /* 2 sectors for redundant env. */
49 },
50 {
51 .name = "linux",
52 .offset = 0x80000,
53 .size = 0xF80000, /* map only 16 MiB */
54 },
55 };
56
57 static struct flash_platform_data easy98000_spi_flash_platform_data = {
58 .name = "sflash",
59 .parts = easy98000_nor_partitions,
60 .nr_parts = ARRAY_SIZE(easy98000_nor_partitions)
61 };
62
63 static struct spi_board_info spi_info __initdata = {
64 .modalias = "m25p80",
65 .bus_num = 0,
66 .chip_select = 3,
67 .max_speed_hz = 10 * 1000 * 1000,
68 .mode = SPI_MODE_3,
69 .platform_data = &easy98000_spi_flash_platform_data
70 };
71
72 struct ltq_spi_platform_data ltq_spi_data = {
73 .num_chipselect = 4,
74 };
75
76 static void __init dgn3500_init(void)
77 {
78 ltq_register_pci(&ltq_pci_data);
79 ltq_register_etop(&ltq_eth_data);
80 ltq_register_spi(&ltq_spi_data, &spi_info, 1);
81 /* The usb power is always enabled, protected by a fuse */
82 xway_register_dwc(-1);
83 }
84
85 MIPS_MACHINE(LANTIQ_MACH_DGN3500B,
86 "DGN3500B",
87 "Netgear DGN3500B",
88 dgn3500_init);