From 8399be545a01b05549902a96778b9b3983a6b4ec Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 18 Jun 2015 18:21:15 +0000 Subject: ar71xx: add support for compex wpj531 tftpboot 0x80500000 openwrt-ar71xx-generic-wpj531-16M-squashfs-sysupgrade.bin erase 0x9f030000 +$filesize erase 0x9f680000 +1 cp.b $fileaddr 0x9f030000 $filesize Signed-off-by: Christian Mehlis SVN-Revision: 46045 --- .../ar71xx/files/arch/mips/ath79/mach-wpj531.c | 136 +++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c (limited to 'target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c') diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c new file mode 100644 index 0000000000..bc13d7019f --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c @@ -0,0 +1,136 @@ +/* + * Compex WPJ531 board support + * + * Copyright (c) 2012 Qualcomm Atheros + * Copyright (c) 2012 Gabor Juhos + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include +#include +#include + +#include + +#include "pci.h" +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-gpio-buttons.h" +#include "dev-eth.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define WPJ531_GPIO_LED_SIG1 14 +#define WPJ531_GPIO_LED_SIG2 15 +#define WPJ531_GPIO_LED_SIG3 22 +#define WPJ531_GPIO_LED_SIG4 23 +#define WPJ531_GPIO_BUZZER 4 + +#define WPJ531_GPIO_BTN_RESET 17 + +#define WPJ531_KEYS_POLL_INTERVAL 20 /* msecs */ +#define WPJ531_KEYS_DEBOUNCE_INTERVAL (3 * WPJ531_KEYS_POLL_INTERVAL) + +#define WPJ531_MAC0_OFFSET 0x10 +#define WPJ531_MAC1_OFFSET 0x18 +#define WPJ531_WMAC_CALDATA_OFFSET 0x1000 +#define WPJ531_PCIE_CALDATA_OFFSET 0x5000 + +#define WPJ531_ART_SIZE 0x8000 + +static struct gpio_led wpj531_leds_gpio[] __initdata = { + { + .name = "wpj531:red:sig1", + .gpio = WPJ531_GPIO_LED_SIG1, + .active_low = 1, + }, + { + .name = "wpj531:yellow:sig2", + .gpio = WPJ531_GPIO_LED_SIG2, + .active_low = 1, + }, + { + .name = "wpj531:green:sig3", + .gpio = WPJ531_GPIO_LED_SIG3, + .active_low = 1, + }, + { + .name = "wpj531:green:sig4", + .gpio = WPJ531_GPIO_LED_SIG4, + .active_low = 1, + }, + { + .name = "wpj531:buzzer", + .gpio = WPJ531_GPIO_BUZZER, + .active_low = 0, + } +}; + +static struct gpio_keys_button wpj531_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WPJ531_KEYS_DEBOUNCE_INTERVAL, + .gpio = WPJ531_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static void __init common_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + u8 tmpmac[ETH_ALEN]; + + ath79_register_m25p80(NULL); + + ath79_setup_ar933x_phy4_switch(false, false); + + ath79_register_mdio(0, 0x0); + + /* LAN */ + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_register_eth(0); + + /* WAN */ + ath79_switch_data.phy4_mii_en = 1; + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); + ath79_register_eth(1); + + ath79_register_wmac(ee, tmpmac); + + ath79_register_pci(); +} + +static void __init wpj531_setup(void) +{ + common_setup(); + + ath79_register_leds_gpio(-1, + ARRAY_SIZE(wpj531_leds_gpio), + wpj531_leds_gpio); + + ath79_register_gpio_keys_polled(-1, + WPJ531_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wpj531_gpio_keys), + wpj531_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_WPJ531, "WPJ531", "Compex WPJ531", wpj531_setup); -- cgit v1.2.3