2 * Atheros PB44 board support
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
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.
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 #include <linux/i2c.h>
18 #include <linux/i2c-gpio.h>
19 #include <linux/i2c/pcf857x.h>
21 #include <asm/mips_machine.h>
22 #include <asm/mach-ar71xx/ar71xx.h>
23 #include <asm/mach-ar71xx/pci.h>
27 #define PB44_GPIO_I2C_SCL 0
28 #define PB44_GPIO_I2C_SDA 1
30 #define PB44_GPIO_EXP_BASE 16
32 static struct spi_board_info pb44_spi_info[] = {
36 .max_speed_hz = 25000000,
41 static struct ar71xx_pci_irq pb44_pci_irqs[] __initdata = {
45 .irq = AR71XX_PCI_IRQ_DEV0,
49 .irq = AR71XX_PCI_IRQ_DEV1,
53 .irq = AR71XX_PCI_IRQ_DEV2,
57 static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
58 .sda_pin = PB44_GPIO_I2C_SDA,
59 .scl_pin = PB44_GPIO_I2C_SCL,
62 static struct platform_device pb44_i2c_gpio_device = {
66 .platform_data = &pb44_i2c_gpio_data,
70 static struct pcf857x_platform_data pb44_pcf857x_data = {
71 .gpio_base = PB44_GPIO_EXP_BASE,
74 static struct i2c_board_info pb44_i2c_board_info[] __initdata = {
76 I2C_BOARD_INFO("pcf8575", 0x20),
77 .platform_data = &pb44_pcf857x_data,
81 #define PB44_WAN_PHYMASK BIT(0)
82 #define PB44_LAN_PHYMASK 0
83 #define PB44_MDIO_PHYMASK (PB44_LAN_PHYMASK | PB44_WAN_PHYMASK)
85 static void __init pb44_init(void)
87 ar71xx_add_device_spi(NULL, pb44_spi_info,
88 ARRAY_SIZE(pb44_spi_info));
90 ar71xx_add_device_mdio(~PB44_MDIO_PHYMASK);
92 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
93 ar71xx_eth0_data.phy_mask = PB44_WAN_PHYMASK;
95 ar71xx_add_device_eth(0);
97 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
98 ar71xx_eth1_data.phy_mask = PB44_LAN_PHYMASK;
99 ar71xx_eth1_data.speed = SPEED_1000;
100 ar71xx_eth1_data.duplex = DUPLEX_FULL;
102 ar71xx_add_device_eth(1);
104 ar71xx_add_device_usb();
106 ar71xx_pci_init(ARRAY_SIZE(pb44_pci_irqs), pb44_pci_irqs);
108 i2c_register_board_info(0, pb44_i2c_board_info,
109 ARRAY_SIZE(pb44_i2c_board_info));
111 platform_device_register(&pb44_i2c_gpio_device);
113 /* TODO: GPIO LEDs & buttons */
116 MIPS_MACHINE(AR71XX_MACH_PB44, "Atheros PB44", pb44_init);