From 9f38f9bf76bad22b8e81c7e21c4b438c2aae278d Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Fri, 10 Dec 2010 19:55:28 +0000 Subject: [PATCH] ar71xx: add missing files for the JA76PF board SVN-Revision: 24444 --- .../base-files/etc/defconfig/ja76pf/network | 26 +++++ .../files/arch/mips/ar71xx/mach-ja76pf.c | 96 +++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 target/linux/ar71xx/base-files/etc/defconfig/ja76pf/network create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c diff --git a/target/linux/ar71xx/base-files/etc/defconfig/ja76pf/network b/target/linux/ar71xx/base-files/etc/defconfig/ja76pf/network new file mode 100644 index 00000000000..b60053f0190 --- /dev/null +++ b/target/linux/ar71xx/base-files/etc/defconfig/ja76pf/network @@ -0,0 +1,26 @@ +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option type bridge + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth1 + option proto dhcp + +config switch + option name eth0 + option reset 1 + option enable_vlan 1 + +config switch_vlan + option device eth0 + option vlan 1 + option ports "0 1 2 3 4" diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c new file mode 100644 index 00000000000..d39de3c4d03 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c @@ -0,0 +1,96 @@ +/* + * jjPlus JA76PF board support + */ + +#include +#include +#include +#include + +#include "machtype.h" +#include "devices.h" +#include "dev-m25p80.h" +#include "dev-gpio-buttons.h" +#include "dev-pb42-pci.h" +#include "dev-usb.h" +#include "dev-leds-gpio.h" + +#define JA76PF_BUTTONS_POLL_INTERVAL 20 + +#define JA76PF_GPIO_I2C_SCL 0 +#define JA76PF_GPIO_I2C_SDA 1 +#define JA76PF_GPIO_LED_1 5 +#define JA76PF_GPIO_LED_2 4 +#define JA76PF_GPIO_BTN_RESET 11 + +static struct gpio_led ja76pf_leds_gpio[] __initdata = { + { + .name = "ja76pf:green:led1", + .gpio = JA76PF_GPIO_LED_1, + .active_low = 1, + }, { + .name = "ja76pf:green:led2", + .gpio = JA76PF_GPIO_LED_2, + .active_low = 1, + } +}; + +static struct gpio_button ja76pf_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .threshold = 3, + .gpio = JA76PF_GPIO_BTN_RESET, + .active_low = 1, + } +}; + +static struct i2c_gpio_platform_data ja76pf_i2c_gpio_data = { + .sda_pin = JA76PF_GPIO_I2C_SDA, + .scl_pin = JA76PF_GPIO_I2C_SCL, +}; + +static struct platform_device ja76pf_i2c_gpio_device = { + .name = "i2c-gpio", + .id = 0, + .dev = { + .platform_data = &ja76pf_i2c_gpio_data, + } +}; + +#define JA76PF_WAN_PHYMASK (1 << 4) +#define JA76PF_LAN_PHYMASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 < 3)) +#define JA76PF_MDIO_PHYMASK (JA76PF_LAN_PHYMASK | JA76PF_WAN_PHYMASK) + +static void __init ja76pf_init(void) +{ + ar71xx_add_device_m25p80(NULL); + + ar71xx_add_device_mdio(~JA76PF_MDIO_PHYMASK); + + ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth0_data.phy_mask = JA76PF_LAN_PHYMASK; + + ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth1_data.phy_mask = JA76PF_WAN_PHYMASK; + ar71xx_eth1_data.speed = SPEED_1000; + ar71xx_eth1_data.duplex = DUPLEX_FULL; + + ar71xx_add_device_eth(0); + ar71xx_add_device_eth(1); + + platform_device_register(&ja76pf_i2c_gpio_device); + + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ja76pf_leds_gpio), + ja76pf_leds_gpio); + + ar71xx_add_device_gpio_buttons(-1, JA76PF_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(ja76pf_gpio_buttons), + ja76pf_gpio_buttons); + + ar71xx_add_device_usb(); + pb42_pci_init(); +} + +MIPS_MACHINE(AR71XX_MACH_JA76PF, "JA76PF", "jjPlus JA76PF", ja76pf_init); -- 2.30.2