f6d7a2e0a52e2f8102eda53a0064dfc82c62c319
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-pb44.c
1 /*
2 * Atheros PB44 board support
3 *
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11 #include <linux/init.h>
12 #include <linux/bitops.h>
13 #include <linux/input.h>
14 #include <linux/platform_device.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17
18 #include <asm/mips_machine.h>
19 #include <asm/mach-ar71xx/ar71xx.h>
20 #include <asm/mach-ar71xx/pci.h>
21
22 #include "devices.h"
23
24 static struct spi_board_info pb44_spi_info[] = {
25 {
26 .bus_num = 0,
27 .chip_select = 0,
28 .max_speed_hz = 25000000,
29 .modalias = "m25p80",
30 }
31 };
32
33 static struct ar71xx_pci_irq pb44_pci_irqs[] __initdata = {
34 {
35 .slot = 0,
36 .pin = 1,
37 .irq = AR71XX_PCI_IRQ_DEV0,
38 }, {
39 .slot = 1,
40 .pin = 1,
41 .irq = AR71XX_PCI_IRQ_DEV1,
42 }, {
43 .slot = 2,
44 .pin = 1,
45 .irq = AR71XX_PCI_IRQ_DEV2,
46 }
47 };
48
49 #define PB44_WAN_PHYMASK BIT(1)
50 #define PB44_LAN_PHYMASK 0
51 #define PB44_MDIO_PHYMASK (PB44_LAN_PHYMASK | PB44_WAN_PHYMASK)
52
53 static void __init pb44_init(void)
54 {
55 ar71xx_add_device_spi(NULL, pb44_spi_info,
56 ARRAY_SIZE(pb44_spi_info));
57
58 ar71xx_add_device_mdio(~PB44_MDIO_PHYMASK);
59
60 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
61 ar71xx_eth0_data.phy_mask = PB44_WAN_PHYMASK;
62
63 ar71xx_add_device_eth(0);
64
65 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
66 ar71xx_eth1_data.phy_mask = PB44_WAN_PHYMASK;
67 ar71xx_eth1_data.speed = SPEED_1000;
68 ar71xx_eth1_data.duplex = DUPLEX_FULL;
69
70 ar71xx_add_device_eth(1);
71
72 ar71xx_add_device_usb();
73
74 ar71xx_pci_init(ARRAY_SIZE(pb44_pci_irqs), pb44_pci_irqs);
75
76 /* TODO: GPIO LEDs & buttons */
77 }
78
79 MIPS_MACHINE(AR71XX_MACH_PB44, "Atheros PB44", pb44_init);