diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-10-05 10:12:53 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-10-05 10:12:53 +0000 |
commit | 5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch) | |
tree | 1229a11f725bfa58aa7c57a76898553bb5f6654a /target/linux/ramips/files/arch/mips/ralink/rt305x | |
download | openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip |
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files/arch/mips/ralink/rt305x')
46 files changed, 4400 insertions, 0 deletions
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig new file mode 100644 index 000000000..945639b97 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig @@ -0,0 +1,184 @@ +if RALINK_RT305X + +menu "Ralink RT350x machine selection" + +config RT305X_MACH_CARAMBOLA + bool "8devices Carambola dev board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_3G_6200N + bool "Edimax 3G-6200N board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WR6202 + bool "Accton WR6202" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_ALL0256N + bool "Allnet ALL0256N support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_ALL5002 + bool "Allnet ALL5002 support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_W502U + bool "ALFA Networks W502U board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_ARGUS_ATP52B + bool "Argus ATP-52B support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_RT_G32_REVB + bool "Asus RT-G32 revB board support" + select RALINK_DEV_GPIO_BUTTONS + +config RT305X_MACH_RT_N10_PLUS + bool "Asus RT-N10+ board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WL_330N + bool "Asus WL-330N board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WL_330N3G + bool "Asus WL-330N3G board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_HW550_3G + bool "Aztech HW550-3G support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_F5D8235_V2 + bool "Belkin F5D8235 v2 support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WHR_G300N + bool "Buffalo WHR-G300N support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_DIR_300_REVB + bool "D-Link DIR-300 revB board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_DIR_615_H1 + bool "D-Link DIR-615 H1 board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_DAP_1350 + bool "D-Link DAP-1350 board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_ESR_9753 + bool "EnGenius ESR-9753 support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_FONERA20N + bool "La Fonera20N board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_FREESTATION5 + bool "ARC FreeStation5" + +config RT305X_MACH_MOFI3500_3GN + bool "MoFi Network MOFI3500-3GN support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WR512_3GN + bool "SH-WR512NU/WS-WR512N1-like 3GN router" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_UR_336UN + bool "UR-336UN Wireless N router" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_NW718 + bool "Netcore NW718" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_BC2 + bool "NexAira BC2" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_OMNI_EMB + bool "Omnima MiniEMBWiFi" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_PSR_680W + bool "Petatel PSR-680W Wireless 3G Router support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_PWH2004 + bool "Prolink PWH2004 / Abocom WR5205 support (32M RAM, 8M flash)" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_V22RW_2X2 + bool "Ralink AP-RT3052-V22RW-2X2 board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_W306R_V20 + bool "Tenda W306R V2.0 board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WL341V3 + bool "Sitecom WL-341 v3 board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WL351 + bool "Sitecom WL-351 support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_SL_R7205 + bool "Skyline SL-R7205 Wireless 3G Router support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_WCR150GN + bool "Sparklan WCR-150GN support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_NBG_419N + bool "ZyXEL NBG-419N support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT305X_MACH_XDX_RN502J + bool "Unknown board XDX-RN502J" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +endmenu + +endif diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile new file mode 100644 index 000000000..c7c27cb74 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile @@ -0,0 +1,49 @@ +# +# Makefile for the Ralink RT305x SoC specific parts of the kernel +# +# Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. + +obj-y := irq.o setup.o devices.o rt305x.o clock.o + +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + +obj-$(CONFIG_RT305X_MACH_3G_6200N) += mach-3g-6200n.o +obj-$(CONFIG_RT305X_MACH_ARGUS_ATP52B) += mach-argus-atp52b.o +obj-$(CONFIG_RT305X_MACH_BC2) += mach-bc2.o +obj-$(CONFIG_RT305X_MACH_ALL0256N) += mach-all0256n.o +obj-$(CONFIG_RT305X_MACH_ALL5002) += mach-all5002.o +obj-$(CONFIG_RT305X_MACH_CARAMBOLA) += mach-carambola.o +obj-$(CONFIG_RT305X_MACH_DIR_300_REVB) += mach-dir-300-revb.o +obj-$(CONFIG_RT305X_MACH_DIR_615_H1) += mach-dir-615-h1.o +obj-$(CONFIG_RT305X_MACH_DAP_1350) += mach-dap-1350.o +obj-$(CONFIG_RT305X_MACH_ESR_9753) += mach-esr-9753.o +obj-$(CONFIG_RT305X_MACH_F5D8235_V2) += mach-f5d8235-v2.o +obj-$(CONFIG_RT305X_MACH_FONERA20N) += mach-fonera20n.o +obj-$(CONFIG_RT305X_MACH_FREESTATION5) += mach-freestation5.o +obj-$(CONFIG_RT305X_MACH_HW550_3G) += mach-hw550-3g.o +obj-$(CONFIG_RT305X_MACH_MOFI3500_3GN) += mach-mofi3500-3gn.o +obj-$(CONFIG_RT305X_MACH_NBG_419N) += mach-nbg-419n.o +obj-$(CONFIG_RT305X_MACH_NW718) += mach-nw718.o +obj-$(CONFIG_RT305X_MACH_OMNI_EMB) += mach-omni-emb.o +obj-$(CONFIG_RT305X_MACH_PSR_680W) += mach-psr-680w.o +obj-$(CONFIG_RT305X_MACH_PWH2004) += mach-pwh2004.o +obj-$(CONFIG_RT305X_MACH_RT_G32_REVB) += mach-rt-g32-revb.o +obj-$(CONFIG_RT305X_MACH_RT_N10_PLUS) += mach-rt-n10-plus.o +obj-$(CONFIG_RT305X_MACH_SL_R7205) += mach-sl-r7205.o +obj-$(CONFIG_RT305X_MACH_V22RW_2X2) += mach-v22rw-2x2.o +obj-$(CONFIG_RT305X_MACH_W306R_V20) += mach-w306r-v20.o +obj-$(CONFIG_RT305X_MACH_W502U) += mach-w502u.o +obj-$(CONFIG_RT305X_MACH_WCR150GN) += mach-wcr150gn.o +obj-$(CONFIG_RT305X_MACH_WHR_G300N) += mach-whr-g300n.o +obj-$(CONFIG_RT305X_MACH_WR512_3GN) += mach-wr512-3gn.o +obj-$(CONFIG_RT305X_MACH_UR_336UN) += mach-ur-336un.o +obj-$(CONFIG_RT305X_MACH_WL_330N) += mach-wl-330n.o +obj-$(CONFIG_RT305X_MACH_WL_330N3G) += mach-wl-330n3g.o +obj-$(CONFIG_RT305X_MACH_WL341V3) += mach-wl341v3.o +obj-$(CONFIG_RT305X_MACH_WL351) += mach-wl351.o +obj-$(CONFIG_RT305X_MACH_WR6202) += mach-wr6202.o +obj-$(CONFIG_RT305X_MACH_XDX_RN502J) += mach-xdx-rn502j.o diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/clock.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/clock.c new file mode 100644 index 000000000..c46a1747b --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/clock.c @@ -0,0 +1,133 @@ +/* + * Ralink RT305X clock API + * + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/err.h> +#include <linux/clk.h> + +#include <asm/mach-ralink/common.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> +#include "common.h" + +struct clk { + unsigned long rate; +}; + +static struct clk rt305x_cpu_clk; +static struct clk rt305x_sys_clk; +static struct clk rt305x_wdt_clk; +static struct clk rt305x_uart_clk; + +void __init rt305x_clocks_init(void) +{ + u32 t; + + t = rt305x_sysc_rr(SYSC_REG_SYSTEM_CONFIG); + + if (soc_is_rt305x() || soc_is_rt3350()) { + t = (t >> RT305X_SYSCFG_CPUCLK_SHIFT) & + RT305X_SYSCFG_CPUCLK_MASK; + switch (t) { + case RT305X_SYSCFG_CPUCLK_LOW: + rt305x_cpu_clk.rate = 320000000; + break; + case RT305X_SYSCFG_CPUCLK_HIGH: + rt305x_cpu_clk.rate = 384000000; + break; + } + rt305x_sys_clk.rate = rt305x_cpu_clk.rate / 3; + rt305x_uart_clk.rate = rt305x_sys_clk.rate; + rt305x_wdt_clk.rate = rt305x_sys_clk.rate; + } else if (soc_is_rt3352()) { + t = (t >> RT3352_SYSCFG0_CPUCLK_SHIFT) & + RT3352_SYSCFG0_CPUCLK_MASK; + switch (t) { + case RT3352_SYSCFG0_CPUCLK_LOW: + rt305x_cpu_clk.rate = 384000000; + break; + case RT3352_SYSCFG0_CPUCLK_HIGH: + rt305x_cpu_clk.rate = 400000000; + break; + } + rt305x_sys_clk.rate = rt305x_cpu_clk.rate / 3; + rt305x_uart_clk.rate = 40000000; + rt305x_wdt_clk.rate = rt305x_sys_clk.rate; + } else if (soc_is_rt5350()) { + t = (t >> RT5350_SYSCFG0_CPUCLK_SHIFT) & + RT5350_SYSCFG0_CPUCLK_MASK; + switch (t) { + case RT5350_SYSCFG0_CPUCLK_360: + rt305x_cpu_clk.rate = 360000000; + rt305x_sys_clk.rate = rt305x_cpu_clk.rate / 3; + break; + case RT5350_SYSCFG0_CPUCLK_320: + rt305x_cpu_clk.rate = 320000000; + rt305x_sys_clk.rate = rt305x_cpu_clk.rate / 4; + break; + case RT5350_SYSCFG0_CPUCLK_300: + rt305x_cpu_clk.rate = 300000000; + rt305x_sys_clk.rate = rt305x_cpu_clk.rate / 3; + break; + default: + BUG(); + } + rt305x_uart_clk.rate = 40000000; + rt305x_wdt_clk.rate = rt305x_sys_clk.rate; + } else { + BUG(); + } + +} + +/* + * Linux clock API + */ +struct clk *clk_get(struct device *dev, const char *id) +{ + if (!strcmp(id, "sys")) + return &rt305x_sys_clk; + + if (!strcmp(id, "cpu")) + return &rt305x_cpu_clk; + + if (!strcmp(id, "wdt")) + return &rt305x_wdt_clk; + + if (!strcmp(id, "uart")) + return &rt305x_uart_clk; + + return ERR_PTR(-ENOENT); +} +EXPORT_SYMBOL(clk_get); + +int clk_enable(struct clk *clk) +{ + return 0; +} +EXPORT_SYMBOL(clk_enable); + +void clk_disable(struct clk *clk) +{ +} +EXPORT_SYMBOL(clk_disable); + +unsigned long clk_get_rate(struct clk *clk) +{ + return clk->rate; +} +EXPORT_SYMBOL(clk_get_rate); + +void clk_put(struct clk *clk) +{ +} +EXPORT_SYMBOL(clk_put); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/common.h b/target/linux/ramips/files/arch/mips/ralink/rt305x/common.h new file mode 100644 index 000000000..48ac43e81 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/common.h @@ -0,0 +1,16 @@ +/* + * Ralink RT305x SoC common defines + * + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#ifndef _RT305X_COMMON_H +#define _RT305X_COMMON_H + +void rt305x_clocks_init(void); + +#endif /* _RT305X_COMMON_H */
\ No newline at end of file diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c new file mode 100644 index 000000000..92ae56d3b --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c @@ -0,0 +1,413 @@ +/* + * Ralink RT305x SoC platform device registration + * + * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/physmap.h> +#include <linux/spi/spi.h> +#include <linux/rt2x00_platform.h> +#include <linux/delay.h> +#include <linux/dma-mapping.h> + +#include <asm/addrspace.h> + +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> +#include "devices.h" + +#include <ramips_eth_platform.h> +#include <rt305x_esw_platform.h> +#include <rt3883_ehci_platform.h> +#include <rt3883_ohci_platform.h> + +static struct resource rt305x_flash0_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = KSEG1ADDR(RT305X_FLASH0_BASE), + .end = KSEG1ADDR(RT305X_FLASH0_BASE) + + RT305X_FLASH0_SIZE - 1, + }, +}; + +struct physmap_flash_data rt305x_flash0_data; +static struct platform_device rt305x_flash0_device = { + .name = "physmap-flash", + .resource = rt305x_flash0_resources, + .num_resources = ARRAY_SIZE(rt305x_flash0_resources), + .dev = { + .platform_data = &rt305x_flash0_data, + }, +}; + +static struct resource rt305x_flash1_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = KSEG1ADDR(RT305X_FLASH1_BASE), + .end = KSEG1ADDR(RT305X_FLASH1_BASE) + + RT305X_FLASH1_SIZE - 1, + }, +}; + +struct physmap_flash_data rt305x_flash1_data; +static struct platform_device rt305x_flash1_device = { + .name = "physmap-flash", + .resource = rt305x_flash1_resources, + .num_resources = ARRAY_SIZE(rt305x_flash1_resources), + .dev = { + .platform_data = &rt305x_flash1_data, + }, +}; + +static int rt305x_flash_instance __initdata; +void __init rt305x_register_flash(unsigned int id) +{ + struct platform_device *pdev; + struct physmap_flash_data *pdata; + u32 t; + int reg; + + switch (id) { + case 0: + pdev = &rt305x_flash0_device; + reg = MEMC_REG_FLASH_CFG0; + break; + case 1: + pdev = &rt305x_flash1_device; + reg = MEMC_REG_FLASH_CFG1; + break; + default: + return; + } + + t = rt305x_memc_rr(reg); + t = (t >> FLASH_CFG_WIDTH_SHIFT) & FLASH_CFG_WIDTH_MASK; + + pdata = pdev->dev.platform_data; + switch (t) { + case FLASH_CFG_WIDTH_8BIT: + pdata->width = 1; + break; + case FLASH_CFG_WIDTH_16BIT: + pdata->width = 2; + break; + case FLASH_CFG_WIDTH_32BIT: + pdata->width = 4; + break; + default: + printk(KERN_ERR "RT305x: flash bank%u witdh is invalid\n", id); + return; + } + + pdev->id = rt305x_flash_instance; + + platform_device_register(pdev); + rt305x_flash_instance++; +} + +static void rt305x_fe_reset(void) +{ + rt305x_sysc_wr(RT305X_RESET_FE, SYSC_REG_RESET_CTRL); + rt305x_sysc_wr(0, SYSC_REG_RESET_CTRL); +} + +static struct resource rt305x_eth_resources[] = { + { + .start = RT305X_FE_BASE, + .end = RT305X_FE_BASE + PAGE_SIZE - 1, + .flags = IORESOURCE_MEM, + }, { + .start = RT305X_CPU_IRQ_FE, + .end = RT305X_CPU_IRQ_FE, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct ramips_eth_platform_data ramips_eth_data = { + .mac = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }, + .reset_fe = rt305x_fe_reset, + .min_pkt_len = 64, +}; + +static struct platform_device rt305x_eth_device = { + .name = "ramips_eth", + .resource = rt305x_eth_resources, + .num_resources = ARRAY_SIZE(rt305x_eth_resources), + .dev = { + .platform_data = &ramips_eth_data, + } +}; + +static struct resource rt305x_esw_resources[] = { + { + .start = RT305X_SWITCH_BASE, + .end = RT305X_SWITCH_BASE + PAGE_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +struct rt305x_esw_platform_data rt305x_esw_data = { + /* All ports are LAN ports. */ + .vlan_config = RT305X_ESW_VLAN_CONFIG_NONE, + .reg_initval_fct2 = 0x00d6500c, + /* + * ext phy base addr 31, enable port 5 polling, rx/tx clock skew 1, + * turbo mii off, rgmi 3.3v off + * port5: disabled + * port6: enabled, gige, full-duplex, rx/tx-flow-control + */ + .reg_initval_fpa2 = 0x3f502b28, +}; + +static struct platform_device rt305x_esw_device = { + .name = "rt305x-esw", + .resource = rt305x_esw_resources, + .num_resources = ARRAY_SIZE(rt305x_esw_resources), + .dev = { + .platform_data = &rt305x_esw_data, + } +}; + +void __init rt305x_register_ethernet(void) +{ + struct clk *clk; + + clk = clk_get(NULL, "sys"); + if (IS_ERR(clk)) + panic("unable to get SYS clock, err=%ld", PTR_ERR(clk)); + + ramips_eth_data.sys_freq = clk_get_rate(clk); + + platform_device_register(&rt305x_esw_device); + platform_device_register(&rt305x_eth_device); +} + +static struct resource rt305x_wifi_resources[] = { + { + .start = RT305X_WMAC_BASE, + .end = RT305X_WMAC_BASE + 0x3FFFF, + .flags = IORESOURCE_MEM, + }, { + .start = RT305X_CPU_IRQ_WNIC, + .end = RT305X_CPU_IRQ_WNIC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct rt2x00_platform_data rt305x_wifi_data; +static struct platform_device rt305x_wifi_device = { + .name = "rt2800_wmac", + .resource = rt305x_wifi_resources, + .num_resources = ARRAY_SIZE(rt305x_wifi_resources), + .dev = { + .platform_data = &rt305x_wifi_data, + } +}; + +void __init rt305x_register_wifi(void) +{ + rt305x_wifi_data.eeprom_file_name = "RT305X.eeprom"; + platform_device_register(&rt305x_wifi_device); +} + +static struct resource rt305x_wdt_resources[] = { + { + .start = RT305X_TIMER_BASE, + .end = RT305X_TIMER_BASE + RT305X_TIMER_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device rt305x_wdt_device = { + .name = "ramips-wdt", + .id = -1, + .resource = rt305x_wdt_resources, + .num_resources = ARRAY_SIZE(rt305x_wdt_resources), +}; + +void __init rt305x_register_wdt(void) +{ + u32 t; + + /* enable WDT reset output on pin SRAM_CS_N */ + t = rt305x_sysc_rr(SYSC_REG_SYSTEM_CONFIG); + t |= RT305X_SYSCFG_SRAM_CS0_MODE_WDT << + RT305X_SYSCFG_SRAM_CS0_MODE_SHIFT; + rt305x_sysc_wr(t, SYSC_REG_SYSTEM_CONFIG); + + platform_device_register(&rt305x_wdt_device); +} + +static struct resource rt305x_spi_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = RT305X_SPI_BASE, + .end = RT305X_SPI_BASE + RT305X_SPI_SIZE - 1, + }, +}; + +static struct platform_device rt305x_spi_device = { + .name = "ramips-spi", + .id = 0, + .resource = rt305x_spi_resources, + .num_resources = ARRAY_SIZE(rt305x_spi_resources), +}; + +void __init rt305x_register_spi(struct spi_board_info *info, int n) +{ + spi_register_board_info(info, n); + platform_device_register(&rt305x_spi_device); +} + +static struct resource rt305x_dwc_otg_resources[] = { + { + .start = RT305X_OTG_BASE, + .end = RT305X_OTG_BASE + 0x3FFFF, + .flags = IORESOURCE_MEM, + }, { + .start = RT305X_INTC_IRQ_OTG, + .end = RT305X_INTC_IRQ_OTG, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device rt305x_dwc_otg_device = { + .name = "dwc_otg", + .resource = rt305x_dwc_otg_resources, + .num_resources = ARRAY_SIZE(rt305x_dwc_otg_resources), + .dev = { + .platform_data = NULL, + } +}; + +static atomic_t rt3352_usb_use_count = ATOMIC_INIT(0); + +static void rt3352_usb_host_start(void) +{ + u32 t; + + if (atomic_inc_return(&rt3352_usb_use_count) != 1) + return; + + t = rt305x_sysc_rr(RT3352_SYSC_REG_USB_PS); + + /* enable clock for port0's and port1's phys */ + t = rt305x_sysc_rr(RT3352_SYSC_REG_CLKCFG1); + t = t | RT3352_CLKCFG1_UPHY0_CLK_EN | RT3352_CLKCFG1_UPHY1_CLK_EN; + rt305x_sysc_wr(t, RT3352_SYSC_REG_CLKCFG1); + mdelay(500); + + /* pull USBHOST and USBDEV out from reset */ + t = rt305x_sysc_rr(RT3352_SYSC_REG_RSTCTRL); + t &= ~(RT3352_RSTCTRL_UHST | RT3352_RSTCTRL_UDEV); + rt305x_sysc_wr(t, RT3352_SYSC_REG_RSTCTRL); + mdelay(500); + + /* enable host mode */ + t = rt305x_sysc_rr(RT3352_SYSC_REG_SYSCFG1); + t |= RT3352_SYSCFG1_USB0_HOST_MODE; + rt305x_sysc_wr(t, RT3352_SYSC_REG_SYSCFG1); + + t = rt305x_sysc_rr(RT3352_SYSC_REG_USB_PS); +} + +static void rt3352_usb_host_stop(void) +{ + u32 t; + + if (atomic_dec_return(&rt3352_usb_use_count) != 0) + return; + + /* put USBHOST and USBDEV into reset */ + t = rt305x_sysc_rr(RT3352_SYSC_REG_RSTCTRL); + t |= RT3352_RSTCTRL_UHST | RT3352_RSTCTRL_UDEV; + rt305x_sysc_wr(t, RT3352_SYSC_REG_RSTCTRL); + udelay(10000); + + /* disable clock for port0's and port1's phys*/ + t = rt305x_sysc_rr(RT3352_SYSC_REG_CLKCFG1); + t &= ~(RT3352_CLKCFG1_UPHY0_CLK_EN | RT3352_CLKCFG1_UPHY1_CLK_EN); + rt305x_sysc_wr(t, RT3352_SYSC_REG_CLKCFG1); + udelay(10000); +} + +static struct rt3883_ehci_platform_data rt3352_ehci_data = { + .start_hw = rt3352_usb_host_start, + .stop_hw = rt3352_usb_host_stop, +}; + +static struct resource rt3352_ehci_resources[] = { + { + .start = RT3352_EHCI_BASE, + .end = RT3352_EHCI_BASE + RT3352_EHCI_SIZE - 1, + .flags = IORESOURCE_MEM, + }, { + .start = RT305X_INTC_IRQ_OTG, + .end = RT305X_INTC_IRQ_OTG, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 rt3352_ehci_dmamask = DMA_BIT_MASK(32); +static struct platform_device rt3352_ehci_device = { + .name = "rt3883-ehci", + .id = -1, + .resource = rt3352_ehci_resources, + .num_resources = ARRAY_SIZE(rt3352_ehci_resources), + .dev = { + .dma_mask = &rt3352_ehci_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &rt3352_ehci_data, + }, +}; + +static struct resource rt3352_ohci_resources[] = { + { + .start = RT3352_OHCI_BASE, + .end = RT3352_OHCI_BASE + RT3352_OHCI_SIZE - 1, + .flags = IORESOURCE_MEM, + }, { + .start = RT305X_INTC_IRQ_OTG, + .end = RT305X_INTC_IRQ_OTG, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct rt3883_ohci_platform_data rt3352_ohci_data = { + .start_hw = rt3352_usb_host_start, + .stop_hw = rt3352_usb_host_stop, +}; + +static u64 rt3352_ohci_dmamask = DMA_BIT_MASK(32); +static struct platform_device rt3352_ohci_device = { + .name = "rt3883-ohci", + .id = -1, + .resource = rt3352_ohci_resources, + .num_resources = ARRAY_SIZE(rt3352_ohci_resources), + .dev = { + .dma_mask = &rt3352_ohci_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &rt3352_ohci_data, + }, +}; + +void __init rt305x_register_usb(void) +{ + if (soc_is_rt305x() || soc_is_rt3350()) { + platform_device_register(&rt305x_dwc_otg_device); + } else if (soc_is_rt3352() || soc_is_rt5350()) { + platform_device_register(&rt3352_ehci_device); + platform_device_register(&rt3352_ohci_device); + } else { + BUG(); + } +} diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h new file mode 100644 index 000000000..22c9ce423 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h @@ -0,0 +1,32 @@ +/* + * Ralink RT305x SoC specific platform device definitions + * + * Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#ifndef __RT305X_DEVICES_H +#define __RT305X_DEVICES_H + +#include <asm/mach-ralink/rt305x_esw_platform.h> + +struct physmap_flash_data; +struct spi_board_info; + +extern struct physmap_flash_data rt305x_flash0_data; +extern struct physmap_flash_data rt305x_flash1_data; + +extern struct rt305x_esw_platform_data rt305x_esw_data; + +void rt305x_register_flash(unsigned int id); +void rt305x_register_ethernet(void); +void rt305x_register_wifi(void); +void rt305x_register_wdt(void); +void rt305x_register_spi(struct spi_board_info *info, int n); +void rt305x_register_usb(void); + +#endif /* __RT305X_DEVICES_H */ + diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/early_printk.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/early_printk.c new file mode 100644 index 000000000..602df863e --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/early_printk.c @@ -0,0 +1,29 @@ +/* + * Ralink RT305x SoC early printk support + * + * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/io.h> +#include <linux/serial_reg.h> + +#include <asm/addrspace.h> + +#include <asm/mach-ralink/rt305x_regs.h> + +#define UART_READ(r) \ + __raw_readl((void __iomem *)(KSEG1ADDR(RT305X_UART1_BASE) + 4 * (r))) + +#define UART_WRITE(r, v) \ + __raw_writel((v), (void __iomem *)(KSEG1ADDR(RT305X_UART1_BASE) + 4 * (r))) + +void prom_putchar(unsigned char ch) +{ + while (((UART_READ(UART_REG_LSR)) & UART_LSR_THRE) == 0); + UART_WRITE(UART_REG_TX, ch); + while (((UART_READ(UART_REG_LSR)) & UART_LSR_THRE) == 0); +} diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/irq.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/irq.c new file mode 100644 index 000000000..fcac2dd86 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/irq.c @@ -0,0 +1,82 @@ +/* + * Ralink RT305x SoC specific interrupt handling + * + * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> + +#include <asm/irq_cpu.h> +#include <asm/mipsregs.h> + +#include <asm/mach-ralink/common.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +static void rt305x_intc_irq_dispatch(void) +{ + u32 pending; + + pending = ramips_intc_get_status(); + + if (pending & RT305X_INTC_INT_TIMER0) + do_IRQ(RT305X_INTC_IRQ_TIMER0); + + else if (pending & RT305X_INTC_INT_TIMER1) + do_IRQ(RT305X_INTC_IRQ_TIMER1); + + else if (pending & RT305X_INTC_INT_UART0) + do_IRQ(RT305X_INTC_IRQ_UART0); + + else if (pending & RT305X_INTC_INT_UART1) + do_IRQ(RT305X_INTC_IRQ_UART1); + + else if (pending & RT305X_INTC_INT_PERFC) + do_IRQ(RT305X_INTC_IRQ_PERFC); + + else if (pending & RT305X_INTC_INT_OTG) + do_IRQ(RT305X_INTC_IRQ_OTG); + + /* TODO: handle PIO interrupts as well */ + + else + spurious_interrupt(); +} + +asmlinkage void plat_irq_dispatch(void) +{ + unsigned long pending; + + pending = read_c0_status() & read_c0_cause() & ST0_IM; + + if (pending & STATUSF_IP7) + do_IRQ(RT305X_CPU_IRQ_COUNTER); + + else if (pending & STATUSF_IP5) + do_IRQ(RT305X_CPU_IRQ_FE); + + else if (pending & STATUSF_IP6) + do_IRQ(RT305X_CPU_IRQ_WNIC); + + else if (pending & STATUSF_IP2) + rt305x_intc_irq_dispatch(); + + else + spurious_interrupt(); +} + +void __init arch_init_irq(void) +{ + mips_cpu_irq_init(); + ramips_intc_irq_init(RT305X_INTC_BASE, RT305X_CPU_IRQ_INTC, + RT305X_INTC_IRQ_BASE); + + cp0_perfcount_irq = RT305X_INTC_IRQ_PERFC; +} diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c new file mode 100644 index 000000000..ade4fe900 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-3g-6200n.c @@ -0,0 +1,86 @@ +/* + * Edimax 3g-6200n board support + * + * Copyright (C) 2011 Andrzej Hajda <andrzej.hajda@wp.pl> + * Copyright (C) 2012 Lukasz Golebiowski <lgolebio@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define EDIMAX_GPIO_BUTTON_WPS 12 +#define EDIMAX_GPIO_BTN_0 13 /* Wifi on/off switch button */ + +#define EDIMAX_GPIO_LED_POWER 9 +#define EDIMAX_GPIO_LED_WLAN 14 +#define EDIMAX_GPIO_LED_3G 7 + +#define EDIMAX_KEYS_POLL_INTERVAL 20 +#define EDIMAX_KEYS_DEBOUNCE_INTERVAL (3 * EDIMAX_KEYS_POLL_INTERVAL) + +static struct gpio_led edimax_leds_gpio[] __initdata = { + { + .name = "edimax:green:power", + .gpio = EDIMAX_GPIO_LED_POWER, + .active_low = 1, + }, { + .name = "edimax:amber:wlan", + .gpio = EDIMAX_GPIO_LED_WLAN, + .active_low = 1, + }, { + .name = "edimax:blue:3g", + .gpio = EDIMAX_GPIO_LED_3G, + .active_low = 1, + } +}; + +static struct gpio_keys_button edimax_gpio_buttons[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = EDIMAX_KEYS_DEBOUNCE_INTERVAL, + .gpio = EDIMAX_GPIO_BUTTON_WPS, + .active_low = 1, + }, { + .desc = "wlanswitch", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = EDIMAX_KEYS_DEBOUNCE_INTERVAL, + .gpio = EDIMAX_GPIO_BTN_0, + .active_low = 1, + } +}; + +static void __init edimax_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(edimax_leds_gpio), + edimax_leds_gpio); + ramips_register_gpio_buttons(-1, EDIMAX_KEYS_POLL_INTERVAL, + ARRAY_SIZE(edimax_gpio_buttons), + edimax_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_3G_6200N, "3G-6200N", "Edimax 3g-6200n", + edimax_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c new file mode 100644 index 000000000..7f5e00b41 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c @@ -0,0 +1,90 @@ +/* + * Allnet ALL0256N board support + * + * Copyright (C) 2012 Daniel Golle <dgolle@allnet.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define ALL0256N_GPIO_BUTTON_RESET 0 +#define ALL0256N_GPIO_LED_RSSI_LOW 14 +#define ALL0256N_GPIO_LED_RSSI_MED 12 +#define ALL0256N_GPIO_LED_RSSI_HIGH 13 +#define ALL0256N_KEYS_POLL_INTERVAL 20 +#define ALL0256N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0256N_KEYS_POLL_INTERVAL) + +const struct flash_platform_data all0256n_flash = { + .type = "mx25l3205d", +}; + +struct spi_board_info all0256n_spi_slave_info[] __initdata = { + { + .modalias = "m25p80", + .platform_data = &all0256n_flash, + .irq = -1, + .max_speed_hz = 10000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static struct gpio_keys_button all0256n_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = ALL0256N_KEYS_DEBOUNCE_INTERVAL, + .gpio = ALL0256N_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static struct gpio_led all0256n_leds_gpio[] __initdata = { + { + .name = "all0256n:green:rssilow", + .gpio = ALL0256N_GPIO_LED_RSSI_LOW, + .active_low = 1, + }, { + .name = "all0256n:green:rssimed", + .gpio = ALL0256N_GPIO_LED_RSSI_MED, + .active_low = 1, + }, { + .name = "all0256n:green:rssihigh", + .gpio = ALL0256N_GPIO_LED_RSSI_HIGH, + .active_low = 1, + } +}; + +static void __init all0256n_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + rt305x_register_spi(all0256n_spi_slave_info, + ARRAY_SIZE(all0256n_spi_slave_info)); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(all0256n_leds_gpio), + all0256n_leds_gpio); + ramips_register_gpio_buttons(-1, ALL0256N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(all0256n_gpio_buttons), + all0256n_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_ALL0256N, "ALL0256N", "Allnet ALL0256N", + all0256n_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all5002.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all5002.c new file mode 100644 index 000000000..151671acb --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all5002.c @@ -0,0 +1,61 @@ +/* + * Allnet ALL5002 + * + * Copyright (C) 2012 Daniel Golle <dgolle@allnet.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +// #define ALL5002_GPIO_BUTTON_RESET 0 +// #define ALL5002_GPIO_LED_RSSI_LOW 14 +// #define ALL5002_GPIO_LED_RSSI_MED 12 +// #define ALL5002_GPIO_LED_RSSI_HIGH 13 +// #define ALL5002_BUTTONS_POLL_INTERVAL 20 + +const struct flash_platform_data all5002_flash = { + .type = "mx25l25635e", +}; + +struct spi_board_info all5002_spi_slave_info[] __initdata = { + { + .modalias = "m25p80", + .platform_data = &all5002_flash, + .irq = -1, + .max_speed_hz = 10000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static void __init all5002_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + rt305x_register_spi(all5002_spi_slave_info, + ARRAY_SIZE(all5002_spi_slave_info)); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_ALL5002, "ALL5002", "Allnet ALL5002", + all5002_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c new file mode 100644 index 000000000..b683485d7 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c @@ -0,0 +1,81 @@ +/* + * Argus ATP-52B router support + * http://www.argus-co.com/english/productsview.php?id=70&cid=81 + * + * Copyright (C) 2011 Roman Yeryomin <roman@advem.lv> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define ARGUS_ATP52B_GPIO_LED_RUN 9 +#define ARGUS_ATP52B_GPIO_LED_NET 13 +#define ARGUS_ATP52B_GPIO_BUTTON_WPS 0 +#define ARGUS_ATP52B_GPIO_BUTTON_RESET 10 +#define ARGUS_ATP52B_KEYS_POLL_INTERVAL 20 +#define ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL (3 * ARGUS_ATP52B_KEYS_POLL_INTERVAL) + +static struct gpio_led argus_atp52b_leds_gpio[] __initdata = { + { + .name = "argus-atp52b:green:run", + .gpio = ARGUS_ATP52B_GPIO_LED_RUN, + .active_low = 1, + }, + { + .name = "argus-atp52b:amber:net", + .gpio = ARGUS_ATP52B_GPIO_LED_NET, + .active_low = 1, + } +}; + +static struct gpio_keys_button argus_atp52b_gpio_buttons[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL, + .gpio = ARGUS_ATP52B_GPIO_BUTTON_WPS, + .active_low = 1, + }, + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL, + .gpio = ARGUS_ATP52B_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static void __init argus_atp52b_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(argus_atp52b_leds_gpio), + argus_atp52b_leds_gpio); + ramips_register_gpio_buttons(-1, ARGUS_ATP52B_KEYS_POLL_INTERVAL, + ARRAY_SIZE(argus_atp52b_gpio_buttons), + argus_atp52b_gpio_buttons); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_ARGUS_ATP52B, "ARGUS_ATP52B", "Argus ATP-52B", + argus_atp52b_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c new file mode 100644 index 000000000..7a2148851 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c @@ -0,0 +1,70 @@ +/* + * NexAira BC2 board support + * + * Copyright (C) 2011 Adam J. Porter <porter.adam@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define BC2_GPIO_BUTTON_RESET 17 +#define BC2_GPIO_LED_USB 20 + +#define BC2_KEYS_POLL_INTERVAL 20 +#define BC2_KEYS_DEBOUNCE_INTERVAL (3 * BC2_KEYS_POLL_INTERVAL) + +static struct gpio_led bc2_leds_gpio[] __initdata = { + { + .name = "bc2:blue:usb", + .gpio = BC2_GPIO_LED_USB, + .active_low = 1, + } +}; + +static struct gpio_keys_button bc2_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = BC2_KEYS_DEBOUNCE_INTERVAL, + .gpio = BC2_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static void __init bc2_init(void) +{ + rt305x_gpio_init((RT305X_GPIO_MODE_GPIO << + RT305X_GPIO_MODE_UART0_SHIFT) | + RT305X_GPIO_MODE_JTAG); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(bc2_leds_gpio), + bc2_leds_gpio); + + ramips_register_gpio_buttons(-1, BC2_KEYS_POLL_INTERVAL, + ARRAY_SIZE(bc2_gpio_buttons), + bc2_gpio_buttons); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_BC2, "BC2", "NexAira BC2", + bc2_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c new file mode 100644 index 000000000..c24527a7b --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c @@ -0,0 +1,42 @@ +/* + * 8devices Carambola dev board support + * + * Copyright (C) 2012 Tobias Diedrich <ranma+openwrt@tdiedrich.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +static void __init carambola_init(void) +{ + /* Ugh, inverted logic... + * This actually puts the pins into GPIO mode rather I2C, SPI, ... */ + rt305x_gpio_init(RT305X_GPIO_MODE_UART0(RT305X_GPIO_MODE_GPIO) | + RT305X_GPIO_MODE_I2C | + RT305X_GPIO_MODE_SPI | + RT305X_GPIO_MODE_JTAG | + RT305X_GPIO_MODE_MDIO); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_CARAMBOLA, "CARAMBOLA", "8devices Carambola", + carambola_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dap-1350.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dap-1350.c new file mode 100644 index 000000000..42d3ebe7b --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dap-1350.c @@ -0,0 +1,94 @@ +/* + * D-Link DAP-1350 board support + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define DAP_1350_GPIO_LED_POWER_BLUE 8 +#define DAP_1350_GPIO_LED_POWER_RED 9 +#define DAP_1350_GPIO_LED_WPS 14 + +#define DAP_1350_GPIO_BUTTON_WPS 0 /* active low */ +#define DAP_1350_GPIO_BUTTON_RESET 10 /* active low */ +#define DAP_1350_GPIO_SWITCH_MODE_AP 7 /* active low */ +#define DAP_1350_GPIO_SWITCH_MODE_RT 11 /* active low */ + +#define DAP_1350_KEYS_POLL_INTERVAL 20 +#define DAP_1350_KEYS_DEBOUNCE_INTERVAL (3 * DAP_1350_KEYS_POLL_INTERVAL) + +static struct gpio_led dap_1350_leds_gpio[] __initdata = { + { + .name = "d-link:blue:power", + .gpio = DAP_1350_GPIO_LED_POWER_BLUE, + .active_low = 1, + }, { + .name = "d-link:red:power", + .gpio = DAP_1350_GPIO_LED_POWER_RED, + .active_low = 1, + }, { + .name = "d-link:blue:wps", + .gpio = DAP_1350_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button dap_1350_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = DAP_1350_KEYS_DEBOUNCE_INTERVAL, + .gpio = DAP_1350_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = DAP_1350_KEYS_DEBOUNCE_INTERVAL, + .gpio = DAP_1350_GPIO_BUTTON_WPS, + .active_low = 1, + }, { + .desc = "rt", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = DAP_1350_KEYS_DEBOUNCE_INTERVAL, + .gpio = DAP_1350_GPIO_SWITCH_MODE_RT, + .active_low = 1, + }, { + .desc = "ap", + .type = EV_KEY, + .code = BTN_1, + .debounce_interval = DAP_1350_KEYS_DEBOUNCE_INTERVAL, + .gpio = DAP_1350_GPIO_SWITCH_MODE_AP, + .active_low = 1, + } +}; + +static void __init dap_1350_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(dap_1350_leds_gpio), + dap_1350_leds_gpio); + ramips_register_gpio_buttons(-1, DAP_1350_KEYS_POLL_INTERVAL, + ARRAY_SIZE(dap_1350_gpio_buttons), + dap_1350_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_DAP_1350, "DAP-1350", "D-Link DAP-1350", + dap_1350_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c new file mode 100644 index 000000000..3ae1b7852 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c @@ -0,0 +1,155 @@ +/* + * D-Link DIR-300 rev B board support + * + * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define DIR_300B_GPIO_LED_STATUS_AMBER 8 +#define DIR_300B_GPIO_LED_STATUS_GREEN 9 +#define DIR_300B_GPIO_LED_WPS 13 +/* + * NOTE: The wan led is also connected to the switch, both + * switch and gpio must be active to make it light up + */ +#define DIR_300B_GPIO_LED_WAN_GREEN 12 +#define DIR_300B_GPIO_LED_WAN_AMBER 14 + +/* + * NOTE: the WPS led in DIR-620 consists of two antiparallel leds, + * so they can't be lit simultaneously + */ +#define DIR_620_GPIO_LED_WPS_AMBER 11 + +#define DIR_300B_GPIO_BUTTON_WPS 0 /* active low */ +#define DIR_300B_GPIO_BUTTON_RESET 10 /* active low */ + +#define DIR_300B_KEYS_POLL_INTERVAL 20 +#define DIR_300B_KEYS_DEBOUNCE_INTERVAL (3 * DIR_300B_KEYS_POLL_INTERVAL) + +static struct gpio_led dir_300b_leds_gpio[] __initdata = { + { + .name = "d-link:amber:status", + .gpio = DIR_300B_GPIO_LED_STATUS_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:status", + .gpio = DIR_300B_GPIO_LED_STATUS_GREEN, + .active_low = 1, + }, { + .name = "d-link:amber:wan", + .gpio = DIR_300B_GPIO_LED_WAN_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:wan", + .gpio = DIR_300B_GPIO_LED_WAN_GREEN, + .active_low = 1, + }, { + .name = "d-link:blue:wps", + .gpio = DIR_300B_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button dir_300b_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = DIR_300B_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_300B_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = DIR_300B_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_300B_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct gpio_led dir_620_leds_gpio[] __initdata = { + { + .name = "d-link:amber:status", + .gpio = DIR_300B_GPIO_LED_STATUS_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:status", + .gpio = DIR_300B_GPIO_LED_STATUS_GREEN, + .active_low = 1, + }, { + .name = "d-link:amber:wan", + .gpio = DIR_300B_GPIO_LED_WAN_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:wan", + .gpio = DIR_300B_GPIO_LED_WAN_GREEN, + .active_low = 1, + }, { + .name = "d-link:blue:wps", + .gpio = DIR_300B_GPIO_LED_WPS, + }, { + .name = "d-link:amber:wps", + .gpio = DIR_620_GPIO_LED_WPS_AMBER, + } +}; + +static void __init dir_common_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_buttons(-1, DIR_300B_KEYS_POLL_INTERVAL, + ARRAY_SIZE(dir_300b_gpio_buttons), + dir_300b_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +static void __init dir_300b_init(void) +{ + dir_common_init(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_300b_leds_gpio), + dir_300b_leds_gpio); +} + +static void __init dir_620a1_init(void) +{ + dir_common_init(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_620_leds_gpio), + dir_620_leds_gpio); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_DIR_300_B1, "DIR-300-B1", "D-Link DIR-300 B1", + dir_300b_init); + +MIPS_MACHINE(RAMIPS_MACH_DIR_600_B1, "DIR-600-B1", "D-Link DIR-600 B1", + dir_300b_init); + +MIPS_MACHINE(RAMIPS_MACH_DIR_600_B2, "DIR-600-B2", "D-Link DIR-600 B2", + dir_300b_init); + +MIPS_MACHINE(RAMIPS_MACH_DIR_615_D, "DIR-615-D", "D-Link DIR-615 D", + dir_300b_init); + +MIPS_MACHINE(RAMIPS_MACH_DIR_620_A1, "DIR-620-A1", "D-Link DIR-620 A1", + dir_620a1_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-615-h1.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-615-h1.c new file mode 100644 index 000000000..dbfe4aa92 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-615-h1.c @@ -0,0 +1,112 @@ +/* + * D-Link DIR-615 H1 + * + * Copyright (C) 2012 Mikko Hissa <mikko.hissa@uta.fi> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define DIR_615_H1_GPIO_LED_WAN_AMBER 12 /* active low */ +#define DIR_615_H1_GPIO_LED_WAN_GREEN 13 /* active low */ +#define DIR_615_H1_GPIO_LED_WPS_BLUE 14 /* active low */ + +#define DIR_615_H1_GPIO_LED_STATUS_AMBER 7 +#define DIR_615_H1_GPIO_LED_STATUS_GREEN 9 + +#define DIR_615_H1_GPIO_BUTTON_RESET 10 /* active low */ +#define DIR_615_H1_GPIO_BUTTON_WPS 0 /* active low */ + +#define DIR_615_H1_KEYS_POLL_INTERVAL 20 +#define DIR_615_H1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_615_H1_KEYS_POLL_INTERVAL) + +static struct gpio_led dir_615_h1_leds_gpio[] __initdata = { + { + .name = "d-link:amber:status", + .gpio = DIR_615_H1_GPIO_LED_STATUS_AMBER, + }, { + .name = "d-link:green:status", + .gpio = DIR_615_H1_GPIO_LED_STATUS_GREEN, + }, { + .name = "d-link:amber:wan", + .gpio = DIR_615_H1_GPIO_LED_WAN_AMBER, + .active_low = 1, + }, { + .name = "d-link:green:wan", + .gpio = DIR_615_H1_GPIO_LED_WAN_GREEN, + .active_low = 1, + }, { + .name = "d-link:blue:wps", + .gpio = DIR_615_H1_GPIO_LED_WPS_BLUE, + .active_low = 1, + } +}; + +static struct gpio_keys_button dir_615_h1_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = DIR_615_H1_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_615_H1_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = DIR_615_H1_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_615_H1_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +const struct flash_platform_data dir615h1_flash = { + .type = "mx25l3205d", +}; + +struct spi_board_info dir615h1_spi_slave_info[] __initdata = { + { + .modalias = "m25p80", + .platform_data = &dir615h1_flash, + .irq = -1, + .max_speed_hz = 10000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static void __init dir615h1_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + rt305x_register_spi(dir615h1_spi_slave_info, + ARRAY_SIZE(dir615h1_spi_slave_info)); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_615_h1_leds_gpio), + dir_615_h1_leds_gpio); + ramips_register_gpio_buttons(-1, DIR_615_H1_KEYS_POLL_INTERVAL, + ARRAY_SIZE(dir_615_h1_gpio_buttons), + dir_615_h1_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_DIR_615_H1, "DIR-615-H1", "D-Link DIR-615 H1", + dir615h1_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c new file mode 100644 index 000000000..d5f65df5e --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c @@ -0,0 +1,81 @@ +/* + * Senao / EnGenius ESR-9753 board support + * + * Copyright (C) 2011 Artur Wronowski <arteqw@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define ESR_9753_GPIO_LED_POWER 8 +#define ESR_9753_GPIO_LED_WPS 14 + +#define ESR_9753_GPIO_BUTTON_WPS 0 /* active low */ +#define ESR_9753_GPIO_BUTTON_RESET 10 /* active low */ + +#define ESR_9753_KEYS_POLL_INTERVAL 20 +#define ESR_9753_KEYS_DEBOUNCE_INTERVAL (3 * ESR_9753_KEYS_POLL_INTERVAL) + +static struct gpio_led esr_9753_leds_gpio[] __initdata = { + { + .name = "esr-9753:orange:power", + .gpio = ESR_9753_GPIO_LED_POWER, + .active_low = 1, + }, { + .name = "esr-9753:orange:wps", + .gpio = ESR_9753_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button esr_9753_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = ESR_9753_KEYS_DEBOUNCE_INTERVAL, + .gpio = ESR_9753_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = ESR_9753_KEYS_DEBOUNCE_INTERVAL, + .gpio = ESR_9753_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init esr_9753_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(esr_9753_leds_gpio), + esr_9753_leds_gpio); + + ramips_register_gpio_buttons(-1, ESR_9753_KEYS_POLL_INTERVAL, + ARRAY_SIZE(esr_9753_gpio_buttons), + esr_9753_gpio_buttons); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_ESR_9753, "ESR-9753", "Senao / EnGenius ESR-9753", + esr_9753_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c new file mode 100644 index 000000000..073fc75a6 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c @@ -0,0 +1,108 @@ +/* + * Belkin F5D8235 v2 board support + * + * Copyright (C) 2010 Roman Yeryomin <roman@advem.lv> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <linux/rtl8366.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define F5D8235_V2_GPIO_LED_INTERNET_BLUE 5 +#define F5D8235_V2_GPIO_LED_INTERNET_AMBER 6 +#define F5D8235_V2_GPIO_LED_MODEM_BLUE 11 +#define F5D8235_V2_GPIO_LED_MODEM_AMBER 8 +#define F5D8235_V2_GPIO_LED_ROUTER 9 +#define F5D8235_V2_GPIO_LED_STORAGE_BLUE 23 +#define F5D8235_V2_GPIO_LED_STORAGE_AMBER 22 +#define F5D8235_V2_GPIO_LED_SECURITY_BLUE 13 +#define F5D8235_V2_GPIO_LED_SECURITY_AMBER 12 + +static struct gpio_led f5d8235v2_leds_gpio[] __initdata = { + { + .name = "f5d8235v2:blue:internet", + .gpio = F5D8235_V2_GPIO_LED_INTERNET_BLUE, + .active_low = 1, + }, { + .name = "f5d8235v2:amber:internet", + .gpio = F5D8235_V2_GPIO_LED_INTERNET_AMBER, + .active_low = 1, + }, { + .name = "f5d8235v2:blue:modem", + .gpio = F5D8235_V2_GPIO_LED_MODEM_BLUE, + .active_low = 1, + }, { + .name = "f5d8235v2:amber:modem", + .gpio = F5D8235_V2_GPIO_LED_MODEM_AMBER, + .active_low = 1, + }, { + .name = "f5d8235v2:blue:router", + .gpio = F5D8235_V2_GPIO_LED_ROUTER, + .active_low = 1, + }, { + .name = "f5d8235v2:blue:storage", + .gpio = F5D8235_V2_GPIO_LED_STORAGE_BLUE, + .active_low = 1, + }, { + .name = "f5d8235v2:amber:storage", + .gpio = F5D8235_V2_GPIO_LED_STORAGE_AMBER, + .active_low = 1, + }, { + .name = "f5d8235v2:blue:security", + .gpio = F5D8235_V2_GPIO_LED_SECURITY_BLUE, + .active_low = 1, + }, { + .name = "f5d8235v2:amber:security", + .gpio = F5D8235_V2_GPIO_LED_SECURITY_AMBER, + .active_low = 1, + } +}; + +static struct rtl8366_platform_data f5d8235v2_switch_data = { + .gpio_sda = RT305X_GPIO_I2C_SD, + .gpio_sck = RT305X_GPIO_I2C_SCLK, +}; + +static struct platform_device f5d8235v2_switch = { + .name = RTL8366RB_DRIVER_NAME, + .id = -1, + .dev = { + .platform_data = &f5d8235v2_switch_data, + } +}; + +static void __init f5d8235v2_init(void) +{ + rt305x_gpio_init((RT305X_GPIO_MODE_GPIO << + RT305X_GPIO_MODE_UART0_SHIFT) | + RT305X_GPIO_MODE_I2C | + RT305X_GPIO_MODE_SPI | + RT305X_GPIO_MODE_MDIO); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235v2_leds_gpio), + f5d8235v2_leds_gpio); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE; + rt305x_register_ethernet(); + platform_device_register(&f5d8235v2_switch); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_F5D8235_V2, "F5D8235_V2", "Belkin F5D8235 v2", + f5d8235v2_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c new file mode 100644 index 000000000..a433e40e9 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c @@ -0,0 +1,87 @@ +/* + * La Fonera20N board support + * + * Copyright (C) 2009 John Crispin <blogic@openwrt.org> + * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define FONERA20N_GPIO_BUTTON_RESET 12 +#define FONERA20N_GPIO_SWITCH 13 +#define FONERA20N_GPIO_LED_WIFI 7 +#define FONERA20N_GPIO_LED_POWER 9 +#define FONERA20N_GPIO_LED_USB 14 + +#define FONERA20N_KEYS_POLL_INTERVAL 20 +#define FONERA20N_KEYS_DEBOUNCE_INTERVAL (3 * FONERA20N_KEYS_POLL_INTERVAL) + +static struct gpio_led fonera20n_leds_gpio[] __initdata = { + { + .name = "fonera20n:orange:wifi", + .gpio = FONERA20N_GPIO_LED_WIFI, + .active_low = 1, + }, { + .name = "fonera20n:green:power", + .gpio = FONERA20N_GPIO_LED_POWER, + .active_low = 1, + }, { + .name = "fonera20n:orange:usb", + .gpio = FONERA20N_GPIO_LED_USB, + .active_low = 1, + } +}; + +static struct gpio_keys_button fonera20n_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = FONERA20N_KEYS_DEBOUNCE_INTERVAL, + .gpio = FONERA20N_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "switch", + .type = EV_KEY, + .code = BTN_1, + .debounce_interval = FONERA20N_KEYS_DEBOUNCE_INTERVAL, + .gpio = FONERA20N_GPIO_SWITCH, + .active_low = 1, + } +}; + +static void __init fonera20n_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(fonera20n_leds_gpio), + fonera20n_leds_gpio); + + ramips_register_gpio_buttons(-1, FONERA20N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(fonera20n_gpio_buttons), + fonera20n_gpio_buttons); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_FONERA20N, "FONERA20N", "La Fonera 2.0N", + fonera20n_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-freestation5.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-freestation5.c new file mode 100644 index 000000000..b868244cc --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-freestation5.c @@ -0,0 +1,34 @@ +/* + * ARC FreeStation2/5 board support + * + * Copyright (C) 2009 John Crispin <blogic@openwrt.org> + * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2012 Pau Escrich <p4u@dabax.net> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +static void __init freestation5_init(void) +{ + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_FREESTATION5, "FREESTATION5", "ARC FreeStation5", + freestation5_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c new file mode 100644 index 000000000..b274b917d --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c @@ -0,0 +1,105 @@ +/* + * Aztech HW550-3G board support + * + * Copyright (C) 2011 Layne Edwards <ledwards76@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define HW550_3G_GPIO_LED_USB 8 +#define HW550_3G_GPIO_LED_3G 11 +#define HW550_3G_GPIO_LED_STATUS 12 +#define HW550_3G_GPIO_LED_WPS 14 + +#define HW550_3G_GPIO_BUTTON_RESET 10 +#define HW550_3G_GPIO_BUTTON_CONNECT 7 +#define HW550_3G_GPIO_BUTTON_WPS 0 + +#define HW550_3G_KEYS_POLL_INTERVAL 20 +#define HW550_3G_KEYS_DEBOUNCE_INTERVAL (3 * HW550_3G_KEYS_POLL_INTERVAL) + +static struct gpio_led hw550_3g_leds_gpio[] __initdata = { + { + .name = "hw550-3g:green:usb", + .gpio = HW550_3G_GPIO_LED_USB, + .active_low = 1, + }, { + .name = "hw550-3g:green:3g", + .gpio = HW550_3G_GPIO_LED_3G, + .active_low = 1, + }, { + .name = "hw550-3g:green:status", + .gpio = HW550_3G_GPIO_LED_STATUS, + .active_low = 1, + }, { + .name = "hw550-3g:green:wps", + .gpio = HW550_3G_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button hw550_3g_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = HW550_3G_KEYS_DEBOUNCE_INTERVAL, + .gpio = HW550_3G_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "connect", + .type = EV_KEY, + .code = KEY_CONNECT, + .debounce_interval = HW550_3G_KEYS_DEBOUNCE_INTERVAL, + .gpio = HW550_3G_GPIO_BUTTON_CONNECT, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = HW550_3G_KEYS_DEBOUNCE_INTERVAL, + .gpio = HW550_3G_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +#define HW550_3G_GPIO_MODE \ + ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \ + RT305X_GPIO_MODE_MDIO) + +static void __init hw550_3g_init(void) +{ + rt305x_gpio_init(HW550_3G_GPIO_MODE); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(hw550_3g_leds_gpio), + hw550_3g_leds_gpio); + ramips_register_gpio_buttons(-1, HW550_3G_KEYS_POLL_INTERVAL, + ARRAY_SIZE(hw550_3g_gpio_buttons), + hw550_3g_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_HW550_3G, "HW550-3G", "Aztech HW550-3G", + hw550_3g_init); + +MIPS_MACHINE(RAMIPS_MACH_ALL0239_3G, "ALL0239-3G", "Allnet ALL0239-3G", + hw550_3g_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c new file mode 100644 index 000000000..38d217a4f --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c @@ -0,0 +1,102 @@ +/* + * MoFi Network MOFI3500-3GN board support + * + * Copyright (C) 2011 Layne Edwards <ledwards76@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define MOFI3500_3GN_GPIO_LED_USB 8 +#define MOFI3500_3GN_GPIO_LED_3G 11 +#define MOFI3500_3GN_GPIO_LED_STATUS 12 +#define MOFI3500_3GN_GPIO_LED_WPS 14 + +#define MOFI3500_3GN_GPIO_BUTTON_RESET 10 +#define MOFI3500_3GN_GPIO_BUTTON_CONNECT 7 +#define MOFI3500_3GN_GPIO_BUTTON_WPS 0 + +#define MOFI3500_3GN_KEYS_POLL_INTERVAL 20 +#define MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL (3 * MOFI3500_3GN_KEYS_POLL_INTERVAL) + +static struct gpio_led mofi3500_3gn_leds_gpio[] __initdata = { + { + .name = "mofi3500-3gn:green:usb", + .gpio = MOFI3500_3GN_GPIO_LED_USB, + .active_low = 1, + }, { + .name = "mofi3500-3gn:green:3g", + .gpio = MOFI3500_3GN_GPIO_LED_3G, + .active_low = 1, + }, { + .name = "mofi3500-3gn:green:status", + .gpio = MOFI3500_3GN_GPIO_LED_STATUS, + .active_low = 1, + }, { + .name = "mofi3500-3gn:green:wps", + .gpio = MOFI3500_3GN_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button mofi3500_3gn_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = MOFI3500_3GN_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "connect", + .type = EV_KEY, + .code = KEY_CONNECT, + .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = MOFI3500_3GN_GPIO_BUTTON_CONNECT, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = MOFI3500_3GN_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +#define MOFI3500_3GN_GPIO_MODE \ + ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \ + RT305X_GPIO_MODE_MDIO) + +static void __init mofi3500_3gn_init(void) +{ + rt305x_gpio_init(MOFI3500_3GN_GPIO_MODE); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(mofi3500_3gn_leds_gpio), + mofi3500_3gn_leds_gpio); + ramips_register_gpio_buttons(-1, MOFI3500_3GN_KEYS_POLL_INTERVAL, + ARRAY_SIZE(mofi3500_3gn_gpio_buttons), + mofi3500_3gn_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_MOFI3500_3GN, "MOFI3500-3GN", "MoFi Network MOFI3500-3GN", + mofi3500_3gn_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c new file mode 100644 index 000000000..856520368 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c @@ -0,0 +1,78 @@ +/* + * ZyXEL NBG-419N board support + * + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define NBG_419N_GPIO_LED_POWER 9 +#define NBG_419N_GPIO_LED_WPS 14 + +#define NBG_419N_GPIO_BUTTON_WPS 0 /* active low */ +#define NBG_419N_GPIO_BUTTON_RESET 10 /* active low */ + +#define NBG_419N_KEYS_POLL_INTERVAL 20 +#define NBG_419N_KEYS_DEBOUNCE_INTERVAL (3 * NBG_419N_KEYS_POLL_INTERVAL) + +static struct gpio_led nbg_419n_leds_gpio[] __initdata = { + { + .name = "nbg-419n:green:power", + .gpio = NBG_419N_GPIO_LED_POWER, + .active_low = 1, + }, { + .name = "nbg-419n:green:wps", + .gpio = NBG_419N_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button nbg_419n_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = NBG_419N_KEYS_DEBOUNCE_INTERVAL, + .gpio = NBG_419N_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = NBG_419N_KEYS_DEBOUNCE_INTERVAL, + .gpio = NBG_419N_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init nbg_419n_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(nbg_419n_leds_gpio), + nbg_419n_leds_gpio); + ramips_register_gpio_buttons(-1, NBG_419N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(nbg_419n_gpio_buttons), + nbg_419n_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_NBG_419N, "NBG-419N", "ZyXEL NBG-419N", nbg_419n_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c new file mode 100644 index 000000000..3c9d04790 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c @@ -0,0 +1,95 @@ +/* + * Netcore NW718 board support + * + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/spi/spi.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define NW718_GPIO_LED_USB 8 +#define NW718_GPIO_LED_CPU 13 +#define NW718_GPIO_LED_WPS 14 + +#define NW718_GPIO_BUTTON_WPS 0 +#define NW718_GPIO_BUTTON_RESET 10 + +#define NW718_GPIO_SPI_CS0 3 + +#define NW718_KEYS_POLL_INTERVAL 20 +#define NW718_KEYS_DEBOUNCE_INTERVAL (3 * NW718_KEYS_POLL_INTERVAL) + +static struct gpio_led nw718_leds_gpio[] __initdata = { + { + .name = "nw718:amber:cpu", + .gpio = NW718_GPIO_LED_CPU, + .active_low = 1, + }, { + .name = "nw718:amber:usb", + .gpio = NW718_GPIO_LED_USB, + .active_low = 1, + }, { + .name = "nw718:amber:wps", + .gpio = NW718_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button nw718_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = NW718_KEYS_DEBOUNCE_INTERVAL, + .gpio = NW718_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = NW718_KEYS_DEBOUNCE_INTERVAL, + .gpio = NW718_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct spi_board_info nw718_spi_info[] = { + { + .bus_num = 0, + .chip_select = 0, + .max_speed_hz = 25000000, + .modalias = "m25p80", + } +}; + +static void __init nw718_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_I2C | + RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(nw718_leds_gpio), + nw718_leds_gpio); + ramips_register_gpio_buttons(-1, NW718_KEYS_POLL_INTERVAL, + ARRAY_SIZE(nw718_gpio_buttons), + nw718_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_spi(nw718_spi_info, ARRAY_SIZE(nw718_spi_info)); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_WHR_G300N, "NW718", "Netcore NW718", nw718_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c new file mode 100644 index 000000000..930ac3028 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c @@ -0,0 +1,74 @@ +/* + * Omnima MiniEMBWiFi board support + * + * Copyright (C) 2011 Johnathan Boyce <jon.boyce@globalreach.eu.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/gpio.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define OMNI_EMB_GPIO_BUTTON_RESET 12 /* active low */ + +#define OMNI_EMB_KEYS_POLL_INTERVAL 20 +#define OMNI_EMB_KEYS_DEBOUNCE_INTERVAL (3 * OMNI_EMB_KEYS_POLL_INTERVAL) + +#define OMNI_EMB_GPIO_LED_STATUS 9 +#define OMNI_EMB_GPIO_LED_WLAN 14 + +static struct gpio_led omni_emb_leds_gpio[] __initdata = { + { + .name = "emb:green:status", + .gpio = OMNI_EMB_GPIO_LED_STATUS, + .active_low = 1, + }, { + .name = "emb:green:wlan", + .gpio = OMNI_EMB_GPIO_LED_WLAN, + .active_low = 1, + } +}; + +static struct gpio_keys_button omni_emb_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = OMNI_EMB_KEYS_DEBOUNCE_INTERVAL, + .gpio = OMNI_EMB_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static void __init omni_emb_init(void) +{ + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(omni_emb_leds_gpio), + omni_emb_leds_gpio); + ramips_register_gpio_buttons(-1, OMNI_EMB_KEYS_POLL_INTERVAL, + ARRAY_SIZE(omni_emb_gpio_buttons), + omni_emb_gpio_buttons); + + rt305x_register_flash(0); + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_OMNI_EMB, "OMNI-EMB", "Omnima MiniEMBWiFi", + omni_emb_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-psr-680w.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-psr-680w.c new file mode 100644 index 000000000..a6d10f7cb --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-psr-680w.c @@ -0,0 +1,73 @@ +/* + * Petatel PSR-680W Wireless 3G Router support + * + * Copyright (C) 2012 Dmitry Shmygov <shmygov@rambler.ru> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define PSR_680W_GPIO_BUTTON_RESET 0 /* active low */ + +#define PSR_680W_GPIO_LED_STATUS 19 + +#define PSR_680W_KEYS_POLL_INTERVAL 20 +#define PSR_680W_KEYS_DEBOUNCE_INTERVAL (3 * PSR_680W_KEYS_POLL_INTERVAL) + + +static struct gpio_led psr_680w_leds_gpio[] __initdata = { + { + .name = "psr-680w:red:wan", + .gpio = PSR_680W_GPIO_LED_STATUS, + .active_low = 1, + } +}; + +static struct gpio_keys_button psr_680w_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = PSR_680W_KEYS_DEBOUNCE_INTERVAL, + .gpio = PSR_680W_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static void __init psr_680w_init(void) +{ + rt305x_gpio_init((RT305X_GPIO_MODE_I2S_UARTF << RT305X_GPIO_MODE_UART0_SHIFT) | + RT305X_GPIO_MODE_SPI | + RT305X_GPIO_MODE_JTAG | + RT305X_GPIO_MODE_MDIO | + RT305X_GPIO_MODE_RGMII); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(psr_680w_leds_gpio), + psr_680w_leds_gpio); + ramips_register_gpio_buttons(-1, PSR_680W_KEYS_POLL_INTERVAL, + ARRAY_SIZE(psr_680w_gpio_buttons), + psr_680w_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_PSR_680W, "PSR-680W", + "Petatel PSR-680W Wireless 3G Router", + psr_680w_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c new file mode 100644 index 000000000..5baf32a49 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c @@ -0,0 +1,69 @@ +/* + * Prolink PWH2004 support (or Abocom WR5205) + * + * Copyright (C) 2010 Esa Hyytia <esa@netlab.tkk.fi> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define PWH2004_GPIO_BUTTON_WPS 12 +#define PWH2004_GPIO_LED_POWER 9 +#define PWH2004_GPIO_LED_WIFI 14 +#define PWH2004_KEYS_POLL_INTERVAL 20 +#define PWH2004_KEYS_DEBOUNCE_INTERVAL (3 * PWH2004_KEYS_POLL_INTERVAL) + +static struct gpio_led pwh2004_leds_gpio[] __initdata = { + { + .name = "pwh2004:red:wifi", + .gpio = PWH2004_GPIO_LED_WIFI, + .active_low = 1, + }, { + .name = "pwh2004:green:power", + .gpio = PWH2004_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static struct gpio_keys_button pwh2004_gpio_buttons[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = PWH2004_KEYS_DEBOUNCE_INTERVAL, + .gpio = PWH2004_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init pwh2004_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(pwh2004_leds_gpio), + pwh2004_leds_gpio); + ramips_register_gpio_buttons(-1, PWH2004_KEYS_POLL_INTERVAL, + ARRAY_SIZE(pwh2004_gpio_buttons), + pwh2004_gpio_buttons); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_PWH2004, "PWH2004", "Prolink PWH2004", + pwh2004_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c new file mode 100644 index 000000000..2f0f71087 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c @@ -0,0 +1,78 @@ +/* + * Asus RT-G32 rev B board support + * + * Copyright (C) 2011 Sergiy <piratfm@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define RT_G32B_GPIO_BUTTON_WPS 0 /* active low */ +#define RT_G32B_GPIO_BUTTON_RESET 10 /* active low */ + +#define RT_G32B_KEYS_POLL_INTERVAL 20 +#define RT_G32B_KEYS_DEBOUNCE_INTERVAL (3 * RT_G32B_KEYS_POLL_INTERVAL) + +const struct flash_platform_data rt_g32b_flash = { + .type = "mx25l3205d", +}; + +struct spi_board_info __initdata rt_g32b_spi_slave_info[] = { + { + .modalias = "m25p80", + .platform_data = &rt_g32b_flash, + .irq = -1, + .max_speed_hz = 10000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static struct gpio_keys_button rt_g32b_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = RT_G32B_KEYS_DEBOUNCE_INTERVAL, + .gpio = RT_G32B_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = RT_G32B_KEYS_DEBOUNCE_INTERVAL, + .gpio = RT_G32B_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init rt_g32b_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + rt305x_register_spi(rt_g32b_spi_slave_info, + ARRAY_SIZE(rt_g32b_spi_slave_info)); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_buttons(-1, RT_G32B_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rt_g32b_gpio_buttons), + rt_g32b_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_RT_G32_B1, "RT-G32-B1", "Asus RT-G32 B1", + rt_g32b_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-n10-plus.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-n10-plus.c new file mode 100644 index 000000000..5b496d4ea --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-n10-plus.c @@ -0,0 +1,74 @@ +/* + * ASUS RT-N10+ board support + * + * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define RT_N10_PLUS_GPIO_LED_WPS 14 + +#define RT_N10_PLUS_GPIO_BUTTON_WPS 0 /* active low */ +#define RT_N10_PLUS_GPIO_BUTTON_RESET 10 /* active low */ + +#define RT_N10_PLUS_KEYS_POLL_INTERVAL 20 +#define RT_N10_PLUS_KEYS_DEBOUNCE_INTERVAL (3 * RT_N10_PLUS_KEYS_POLL_INTERVAL) + +static struct gpio_led rt_n10_plus_leds_gpio[] __initdata = { + { + .name = "asus:green:wps", + .gpio = RT_N10_PLUS_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button rt_n10_plus_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = RT_N10_PLUS_KEYS_DEBOUNCE_INTERVAL, + .gpio = RT_N10_PLUS_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = RT_N10_PLUS_KEYS_DEBOUNCE_INTERVAL, + .gpio = RT_N10_PLUS_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init rt_n10_plus_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(rt_n10_plus_leds_gpio), + rt_n10_plus_leds_gpio); + ramips_register_gpio_buttons(-1, RT_N10_PLUS_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rt_n10_plus_gpio_buttons), + rt_n10_plus_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_RT_N10_PLUS, "RT-N10-PLUS", "Asus RT-N10+", + rt_n10_plus_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c new file mode 100644 index 000000000..31f002c9a --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c @@ -0,0 +1,76 @@ +/* + * Skyline SL-R7205 Wireless 3G Router support + * + * Copyright (C) 2012 Haipoh Teoh <hpteoh@ceedtec.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define SL_R7205_GPIO_BUTTON_WPS 0 +#define SL_R7205_GPIO_BUTTON_RESET 10 /* active low */ + +#define SL_R7205_GPIO_LED_WIFI 7 + +#define SL_R7205_KEYS_POLL_INTERVAL 20 +#define SL_R7205_KEYS_DEBOUNCE_INTERVAL (3 * SL_R7205_KEYS_POLL_INTERVAL) + +static struct gpio_led sl_r7205_leds_gpio[] __initdata = { + { + .name = "sl-r7205:green:wifi", + .gpio = SL_R7205_GPIO_LED_WIFI, + .active_low = 1, + } +}; + +static struct gpio_keys_button sl_r7205_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = SL_R7205_KEYS_DEBOUNCE_INTERVAL, + .gpio = SL_R7205_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = SL_R7205_KEYS_DEBOUNCE_INTERVAL, + .gpio = SL_R7205_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init sl_r7205_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(sl_r7205_leds_gpio), + sl_r7205_leds_gpio); + ramips_register_gpio_buttons(-1, SL_R7205_KEYS_POLL_INTERVAL, + ARRAY_SIZE(sl_r7205_gpio_buttons), + sl_r7205_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_SL_R7205, "SL-R7205", + "Skyline SL-R7205 Wireless 3G Router", + sl_r7205_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-ur-336un.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-ur-336un.c new file mode 100644 index 000000000..0ff264957 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-ur-336un.c @@ -0,0 +1,92 @@ +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + + +#define UR_336UN_GPIO_LED_3G 9 +#define UR_336UN_GPIO_LED_GATEWAY 11 +#define UR_336UN_GPIO_LED_AP 12 +#define UR_336UN_GPIO_LED_STATION 13 +#define UR_336UN_GPIO_LED_WPS 14 + +#define UR_336UN_GPIO_BUTTON_RESET 10 +#define UR_336UN_GPIO_BUTTON_CONNECT 7 +#define UR_336UN_GPIO_BUTTON_WPS 0 +#define UR_336UN_GPIO_BUTTON_WPS2 8 + +#define UR_336UN_KEYS_POLL_INTERVAL 20 +#define UR_336UN_KEYS_DEBOUNCE_INTERVAL (3 * UR_336UN_KEYS_POLL_INTERVAL) + +static struct gpio_led UR_336UN_leds_gpio[] __initdata = { + { + .name = "ur336:green:3g", + .gpio = UR_336UN_GPIO_LED_3G, + .active_low = 1, + }, { + .name = "ur336:green:gateway", + .gpio = UR_336UN_GPIO_LED_GATEWAY, + .active_low = 1, + }, { + .name = "ur336:green:ap", + .gpio = UR_336UN_GPIO_LED_AP, + .active_low = 1, + }, { + .name = "ur336:green:wps", + .gpio = UR_336UN_GPIO_LED_WPS, + .active_low = 1, + }, { + .name = "ur336:green:station", + .gpio = UR_336UN_GPIO_LED_STATION, + .active_low = 1, + } +}; + +static struct gpio_keys_button UR_336UN_gpio_buttons[] __initdata = { + { + .desc = "reset_wps", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = UR_336UN_KEYS_DEBOUNCE_INTERVAL, + .gpio = UR_336UN_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "mode", + .type = EV_KEY, + .code = KEY_M, + .debounce_interval = UR_336UN_KEYS_DEBOUNCE_INTERVAL, + .gpio = UR_336UN_GPIO_BUTTON_CONNECT, + .active_low = 1, + } +}; + +#define UR_336UN_GPIO_MODE \ + ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \ + RT305X_GPIO_MODE_MDIO) + +static void __init UR_336UN_init(void) +{ + rt305x_gpio_init(UR_336UN_GPIO_MODE); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(UR_336UN_leds_gpio), + UR_336UN_leds_gpio); + ramips_register_gpio_buttons(-1, UR_336UN_KEYS_POLL_INTERVAL, + ARRAY_SIZE(UR_336UN_gpio_buttons), + UR_336UN_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_UR_336UN, "UR-336UN", "UR-336UN Wireless N router", + UR_336UN_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c new file mode 100644 index 000000000..7f43dabdc --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c @@ -0,0 +1,79 @@ +/* + * Ralink AP-RT3052-V22RW-2X2 board support + * + * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define V22RW_2X2_GPIO_BUTTON_WPS 0 +#define V22RW_2X2_GPIO_BUTTON_SWRST 10 +#define V22RW_2X2_GPIO_LED_SECURITY 13 +#define V22RW_2X2_GPIO_LED_WPS 14 + +#define V22RW_2X2_KEYS_POLL_INTERVAL 20 +#define V22RW_2X2_KEYS_DEBOUNCE_INTERVAL (3 * V22RW_2X2_KEYS_POLL_INTERVAL) + +static struct gpio_led v22rw_2x2_leds_gpio[] __initdata = { + { + .name = "v22rw-2x2:green:security", + .gpio = V22RW_2X2_GPIO_LED_SECURITY, + .active_low = 1, + }, { + .name = "v22rw-2x2:red:wps", + .gpio = V22RW_2X2_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button v22rw_2x2_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = V22RW_2X2_KEYS_DEBOUNCE_INTERVAL, + .gpio = V22RW_2X2_GPIO_BUTTON_SWRST, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = V22RW_2X2_KEYS_DEBOUNCE_INTERVAL, + .gpio = V22RW_2X2_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init v22rw_2x2_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(v22rw_2x2_leds_gpio), + v22rw_2x2_leds_gpio); + ramips_register_gpio_buttons(-1, V22RW_2X2_KEYS_POLL_INTERVAL, + ARRAY_SIZE(v22rw_2x2_gpio_buttons), + v22rw_2x2_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_V22RW_2X2, "V22RW-2X2", "Ralink AP-RT3052-V22RW-2X2", + v22rw_2x2_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w306r-v20.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w306r-v20.c new file mode 100644 index 000000000..7c8eb867c --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w306r-v20.c @@ -0,0 +1,72 @@ +/* + * Tenda W306R V2.0 board support + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/ethtool.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> +#include <asm/mach-ralink/ramips_eth_platform.h> + +#include "devices.h" + +#define W306R_V20_GPIO_LED_SYS 9 +#define W306R_V20_GPIO_LED_WPS 13 + +#define W306R_V20_GPIO_BUTTON_RESET 10 + +#define W306R_V20_KEYS_POLL_INTERVAL 20 +#define W306R_V20_KEYS_DEBOUNCE_INTERVAL (3 * W306R_V20_KEYS_POLL_INTERVAL) + +static struct gpio_led w306r_v20_leds_gpio[] __initdata = { + { + .name = "w306r-v20:green:sys", + .gpio = W306R_V20_GPIO_LED_SYS, + .active_low = 1, + }, { + .name = "w306r-v20:green:wps", + .gpio = W306R_V20_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_keys_button w306r_v20_gpio_buttons[] __initdata = { + { + .desc = "RESET/WPS", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = W306R_V20_KEYS_DEBOUNCE_INTERVAL, + .gpio = W306R_V20_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static void __init w306r_v20_init(void) +{ + rt305x_register_flash(0); + + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(w306r_v20_leds_gpio), + w306r_v20_leds_gpio); + ramips_register_gpio_buttons(-1, W306R_V20_KEYS_POLL_INTERVAL, + ARRAY_SIZE(w306r_v20_gpio_buttons), + w306r_v20_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_W306R_V20, "W306R_V20", "Tenda W306R V2.0", + w306r_v20_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c new file mode 100644 index 000000000..6633ca028 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c @@ -0,0 +1,83 @@ +/* + * ALFA Networks W502U board support + * + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define W502U_GPIO_LED_USB 13 +#define W502U_GPIO_LED_WPS 14 + +#define W502U_GPIO_BUTTON_WPS 0 +#define W502U_GPIO_BUTTON_RESET 10 + +#define W502U_KEYS_POLL_INTERVAL 20 +#define W502U_KEYS_DEBOUNCE_INTERVAL (3 * W502U_KEYS_POLL_INTERVAL) + +static struct gpio_led w502u_leds_gpio[] __initdata = { + { + .name = "alfa:blue:usb", + .gpio = W502U_GPIO_LED_USB, + .active_low = 1, + }, + { + .name = "alfa:blue:wps", + .gpio = W502U_GPIO_LED_WPS, + .active_low = 1, + }, +}; + +static struct gpio_keys_button w502u_gpio_buttons[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL, + .gpio = W502U_GPIO_BUTTON_RESET, + .active_low = 1, + }, + { + .desc = "WPS button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL, + .gpio = W502U_GPIO_BUTTON_WPS, + .active_low = 1, + }, +}; + +static void __init w502u_init(void) +{ + rt305x_gpio_init((RT305X_GPIO_MODE_GPIO << + RT305X_GPIO_MODE_UART0_SHIFT)); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(w502u_leds_gpio), + w502u_leds_gpio); + ramips_register_gpio_buttons(-1, W502U_KEYS_POLL_INTERVAL, + ARRAY_SIZE(w502u_gpio_buttons), + w502u_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_W502U, "W502U", "ALFA Networks W502U", + w502u_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c new file mode 100644 index 000000000..dec1a7bb5 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c @@ -0,0 +1,80 @@ +/* + * Sparklan WCR-150GN board support + * + * Copyright (C) 2010 Roman Yeryomin <roman@advem.lv> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WCR150GN_GPIO_LED_USER 12 +#define WCR150GN_GPIO_LED_POWER 8 +#define WCR150GN_GPIO_BUTTON_WPS 10 +#define WCR150GN_GPIO_BUTTON_RESET 0 +#define WCR150GN_KEYS_POLL_INTERVAL 20 +#define WCR150GN_KEYS_DEBOUNCE_INTERVAL (3 * WCR150GN_KEYS_POLL_INTERVAL) + +static struct gpio_led wcr150gn_leds_gpio[] __initdata = { + { + .name = "wcr150gn:amber:user", + .gpio = WCR150GN_GPIO_LED_USER, + .active_low = 1, + }, + { + .name = "wcr150gn:amber:power", + .gpio = WCR150GN_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static struct gpio_keys_button wcr150gn_gpio_buttons[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WCR150GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = WCR150GN_GPIO_BUTTON_WPS, + .active_low = 1, + }, + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WCR150GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = WCR150GN_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static void __init wcr150gn_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(wcr150gn_leds_gpio), + wcr150gn_leds_gpio); + ramips_register_gpio_buttons(-1, WCR150GN_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wcr150gn_gpio_buttons), + wcr150gn_gpio_buttons); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_WCR150GN, "WCR150GN", "Sparklan WCR-150GN", + wcr150gn_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c new file mode 100644 index 000000000..e5adb1909 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c @@ -0,0 +1,100 @@ +/* + * Buffalo WHR-G300N board support + * + * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WHR_G300N_GPIO_LED_DIAG 7 +#define WHR_G300N_GPIO_LED_ROUTER 9 +#define WHR_G300N_GPIO_LED_SECURITY 14 + +#define WHR_G300N_GPIO_BUTTON_AOSS 0 /* active low */ +#define WHR_G300N_GPIO_BUTTON_RESET 10 /* active low */ +#define WHR_G300N_GPIO_BUTTON_ROUTER_ON 8 /* active low */ +#define WHR_G300N_GPIO_BUTTON_ROUTER_OFF 11 /* active low */ + +#define WHR_G300N_KEYS_POLL_INTERVAL 20 +#define WHR_G300N_KEYS_DEBOUNCE_INTERVAL (3 * WHR_G300N_KEYS_POLL_INTERVAL) + +static struct gpio_led whr_g300n_leds_gpio[] __initdata = { + { + .name = "whr-g300n:red:diag", + .gpio = WHR_G300N_GPIO_LED_DIAG, + .active_low = 1, + }, { + .name = "whr-g300n:green:router", + .gpio = WHR_G300N_GPIO_LED_ROUTER, + .active_low = 1, + }, { + .name = "whr-g300n:amber:security", + .gpio = WHR_G300N_GPIO_LED_SECURITY, + .active_low = 1, + } +}; + +static struct gpio_keys_button whr_g300n_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WHR_G300N_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "aoss", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WHR_G300N_GPIO_BUTTON_AOSS, + .active_low = 1, + }, { + .desc = "router-off", + .type = EV_KEY, + .code = BTN_2, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WHR_G300N_GPIO_BUTTON_ROUTER_OFF, + .active_low = 1, + }, { + .desc = "router-on", + .type = EV_KEY, + .code = BTN_3, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WHR_G300N_GPIO_BUTTON_ROUTER_ON, + .active_low = 1, + } +}; + +static void __init whr_g300n_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(whr_g300n_leds_gpio), + whr_g300n_leds_gpio); + ramips_register_gpio_buttons(-1, WHR_G300N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(whr_g300n_gpio_buttons), + whr_g300n_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_WHR_G300N, "WHR-G300N", "Buffalo WHR-G300N", + whr_g300n_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl-330n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl-330n.c new file mode 100644 index 000000000..b548dfee1 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl-330n.c @@ -0,0 +1,94 @@ +/* + * Asus WL_330N board support + * + * Copyright (C) 2012 Frederic Leroy <fredo@starox.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WL_330N_GPIO_BUTTON_RESET 10 +#define WL_330N_GPIO_BUTTON_WPS 0 +#define WL_330N_GPIO_LED_LINK 9 +#define WL_330N_GPIO_LED_POWER 11 +#define WL_330N_KEYS_POLL_INTERVAL 20 +#define WL_330N_KEYS_DEBOUNCE_INTERVAL (3 * WL_330N_KEYS_POLL_INTERVAL) + +const struct flash_platform_data wl_330n_flash = { + .type = "mx25l3205d", +}; + +struct spi_board_info wl_330n_spi_slave_info[] __initdata = { + { + .modalias = "m25p80", + .platform_data = &wl_330n_flash, + .irq = -1, + .max_speed_hz = 10000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static struct gpio_keys_button wl_330n_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WL_330N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL_330N_GPIO_BUTTON_RESET, + .active_low = 1, + }, + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WL_330N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL_330N_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct gpio_led wl_330n_leds_gpio[] __initdata = { + { + .name = "asus:blue:link", + .gpio = WL_330N_GPIO_LED_LINK, + .active_low = 1, + }, { + .name = "asus:blue:power", + .gpio = WL_330N_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static void __init wl_330n_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + rt305x_register_spi(wl_330n_spi_slave_info, + ARRAY_SIZE(wl_330n_spi_slave_info)); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(wl_330n_leds_gpio), + wl_330n_leds_gpio); + ramips_register_gpio_buttons(-1, WL_330N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wl_330n_gpio_buttons), + wl_330n_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_WL_330N, "WL_330N", "Asus WL-330N", + wl_330n_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl-330n3g.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl-330n3g.c new file mode 100644 index 000000000..599b9a9ad --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl-330n3g.c @@ -0,0 +1,100 @@ +/* + * Asus WL_330N3G board support + * + * Copyright (C) 2012 Frederic Leroy <fredo@starox.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WL_330N3G_GPIO_BUTTON_RESET 10 +#define WL_330N3G_GPIO_BUTTON_WPS 0 +#define WL_330N3G_GPIO_LED_3G_BLUE 9 +#define WL_330N3G_GPIO_LED_3G_RED 13 +#define WL_330N3G_GPIO_LED_POWER 11 +#define WL_330N3G_KEYS_POLL_INTERVAL 20 +#define WL_330N3G_KEYS_DEBOUNCE_INTERVAL (3 * WL_330N3G_KEYS_POLL_INTERVAL) + +const struct flash_platform_data wl_330n3g_flash = { + .type = "mx25l3205d", +}; + +struct spi_board_info wl_330n3g_spi_slave_info[] __initdata = { + { + .modalias = "m25p80", + .platform_data = &wl_330n3g_flash, + .irq = -1, + .max_speed_hz = 10000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +static struct gpio_keys_button wl_330n3g_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WL_330N3G_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL_330N3G_GPIO_BUTTON_RESET, + .active_low = 1, + }, + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WL_330N3G_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL_330N3G_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct gpio_led wl_330n3g_leds_gpio[] __initdata = { + { + .name = "asus:blue:3g", + .gpio = WL_330N3G_GPIO_LED_3G_BLUE, + .active_low = 1, + }, { + .name = "asus:red:3g", + .gpio = WL_330N3G_GPIO_LED_3G_RED, + .active_low = 1, + }, { + .name = "asus:blue:power", + .gpio = WL_330N3G_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static void __init wl_330n3g_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + rt305x_register_spi(wl_330n3g_spi_slave_info, + ARRAY_SIZE(wl_330n3g_spi_slave_info)); + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(wl_330n3g_leds_gpio), + wl_330n3g_leds_gpio); + ramips_register_gpio_buttons(-1, WL_330N3G_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wl_330n3g_gpio_buttons), + wl_330n3g_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_usb(); + rt305x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_WL_330N3G, "WL_330N3G", "Asus WL-330N3G", + wl_330n3g_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c new file mode 100644 index 000000000..2cd1d5e47 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c @@ -0,0 +1,105 @@ +/* + * Sitecom WL341v3 board support + * + * Copyright (C) 2012 Marco Antonio Mauro <marcus90@gmail.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WL341V3_GPIO_LED_FIRST_AMBER 9 +#define WL341V3_GPIO_LED_FIRST_BLUE 13 +#define WL341V3_GPIO_LED_THIRD_AMBER 11 +#define WL341V3_GPIO_LED_THIRD_BLUE 14 +#define WL341V3_GPIO_LED_FOURTH_BLUE 10 +#define WL341V3_GPIO_LED_FIFTH_AMBER 12 +#define WL341V3_GPIO_LED_FIFTH_BLUE 8 + +#define WL341V3_GPIO_BUTTON_WPS 5 /* active low */ +#define WL341V3_GPIO_BUTTON_RESET 7 /* active low */ + +#define WL341V3_KEYS_POLL_INTERVAL 20 +#define WL341V3_KEYS_DEBOUNCE_INTERVAL (3 * WL341V3_KEYS_POLL_INTERVAL) + +static struct gpio_led wl341v3_leds_gpio[] __initdata = { + { + .name = "wl341v3:amber:first", + .gpio = WL341V3_GPIO_LED_FIRST_AMBER, + .active_low = 1, + }, { + .name = "wl341v3:blue:first", + .gpio = WL341V3_GPIO_LED_FIRST_BLUE, + .active_low = 1, + }, { + .name = "wl341v3:amber:third", + .gpio = WL341V3_GPIO_LED_THIRD_AMBER, + .active_low = 1, + }, { + .name = "wl341v3:blue:third", + .gpio = WL341V3_GPIO_LED_THIRD_BLUE, + .active_low = 1, + }, { + .name = "wl341v3:blue:fourth", + .gpio = WL341V3_GPIO_LED_FOURTH_BLUE, + .active_low = 1, + }, { + .name = "wl341v3:amber:fifth", + .gpio = WL341V3_GPIO_LED_FIFTH_AMBER, + .active_low = 1, + }, { + .name = "wl341v3:blue:fifth", + .gpio = WL341V3_GPIO_LED_FIFTH_BLUE, + .active_low = 1, + } +}; + +static struct gpio_keys_button wl341v3_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL341V3_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL341V3_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init wl341v3_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio), + wl341v3_leds_gpio); + ramips_register_gpio_buttons(-1, WL341V3_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wl341v3_gpio_buttons), + wl341v3_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_WL341V3, "WL341V3", "Sitecom WL-341 v3", + wl341v3_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c new file mode 100644 index 000000000..8c0caadb1 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c @@ -0,0 +1,118 @@ +/* + * Sitecom WL-351 v1 002 board support + * + * Copyright (C) 2011 Tobias Diedrich <ranma+openwrt@tdiedrich.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> + +#include <linux/rtl8366.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WL351_GPIO_LED_POWER_AMBER 8 +#define WL351_GPIO_LED_UNPOPULATED_AMBER 12 +#define WL351_GPIO_LED_UNPOPULATED_BLUE 13 + +#define WL351_GPIO_BUTTON_RESET 10 +#define WL351_GPIO_BUTTON_WPS 0 + +#define WL351_KEYS_POLL_INTERVAL 20 +#define WL351_KEYS_DEBOUNCE_INTERVAL (3 * WL351_KEYS_POLL_INTERVAL) + +static struct gpio_led wl351_leds_gpio[] __initdata = { + { + .name = "wl-351:amber:power", + .gpio = WL351_GPIO_LED_POWER_AMBER, + .active_low = 1, + }, { + .name = "wl-351:amber:unpopulated", + .gpio = WL351_GPIO_LED_UNPOPULATED_AMBER, + .active_low = 1, + }, { + .name = "wl-351:blue:unpopulated", + .gpio = WL351_GPIO_LED_UNPOPULATED_BLUE, + .active_low = 1, + } +}; + + +static struct gpio_keys_button wl351_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WL351_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL351_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WL351_KEYS_DEBOUNCE_INTERVAL, + .gpio = WL351_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct rtl8366_platform_data wl351_switch_data = { + .gpio_sda = RT305X_GPIO_I2C_SD, + .gpio_sck = RT305X_GPIO_I2C_SCLK, +}; + +static struct platform_device wl351_switch = { + .name = RTL8366RB_DRIVER_NAME, + .id = -1, + .dev = { + .platform_data = &wl351_switch_data, + } +}; + +static void __init wl351_init(void) +{ + rt305x_gpio_init((RT305X_GPIO_MODE_GPIO << + RT305X_GPIO_MODE_UART0_SHIFT) | + RT305X_GPIO_MODE_I2C | + RT305X_GPIO_MODE_SPI | + RT305X_GPIO_MODE_MDIO); + + rt305x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(wl351_leds_gpio), + wl351_leds_gpio); + ramips_register_gpio_buttons(-1, WL351_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wl351_gpio_buttons), + wl351_gpio_buttons); + /* External RTL8366RB. */ + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE; + rt305x_esw_data.reg_initval_fct2 = 0x0002500c; + /* + * ext phy base addr 31, rx/tx clock skew 0, + * turbo mii off, rgmi 3.3v off, port 5 polling off + * port5: enabled, gige, full-duplex, rx/tx-flow-control + * port6: enabled, gige, full-duplex, rx/tx-flow-control + */ + rt305x_esw_data.reg_initval_fpa2 = 0x1f003fff; + rt305x_register_ethernet(); + platform_device_register(&wl351_switch); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_WL351, "WL-351", "Sitecom WL-351 v1 002", + wl351_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c new file mode 100644 index 000000000..eed752353 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c @@ -0,0 +1,110 @@ +/* + * Unbranded router from DX board support + * Also known as *WR512*-3GN by local vendors + * e.g. WS-WR512N1, Sin Hon SH-WR512NU, and etc + * (http://www.dealextreme.com/p/portable-wireless-n-3g-router-cdma2000-evdo-td-scdma-hspa-wcdma-45639) + * This router is also known to be rebranded and sold by a number of local + * vendors in several countries. + * + * Copyright (C) 2011 Andrew Andrianov <necromant@necromant.ath.cx> + * Based on MOFI3500-3N code by + * Copyright (C) 2011 Layne Edwards <ledwards76@gmail.com> + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + + +#define WR512_3GN_GPIO_LED_3G 9 +#define WR512_3GN_GPIO_LED_GATEWAY 11 +#define WR512_3GN_GPIO_LED_AP 12 +#define WR512_3GN_GPIO_LED_STATION 13 +#define WR512_3GN_GPIO_LED_WPS 14 + +#define WR512_3GN_GPIO_BUTTON_RESET 10 +#define WR512_3GN_GPIO_BUTTON_CONNECT 7 +#define WR512_3GN_GPIO_BUTTON_WPS 0 +#define WR512_3GN_GPIO_BUTTON_WPS2 8 + +#define WR512_3GN_KEYS_POLL_INTERVAL 20 +#define WR512_3GN_KEYS_DEBOUNCE_INTERVAL (3 * WR512_3GN_KEYS_POLL_INTERVAL) + +static struct gpio_led wr512_3gn_leds_gpio[] __initdata = { + { + .name = "wr512:green:3g", + .gpio = WR512_3GN_GPIO_LED_3G, + .active_low = 1, + }, { + .name = "wr512:green:gateway", + .gpio = WR512_3GN_GPIO_LED_GATEWAY, + .active_low = 1, + }, { + .name = "wr512:green:ap", + .gpio = WR512_3GN_GPIO_LED_AP, + .active_low = 1, + }, { + .name = "wr512:green:wps", + .gpio = WR512_3GN_GPIO_LED_WPS, + .active_low = 1, + }, { + .name = "wr512:green:station", + .gpio = WR512_3GN_GPIO_LED_STATION, + .active_low = 1, + } +}; + +static struct gpio_keys_button wr512_3gn_gpio_buttons[] __initdata = { + { + .desc = "reset_wps", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WR512_3GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = WR512_3GN_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "mode", + .type = EV_KEY, + .code = KEY_M, + .debounce_interval = WR512_3GN_KEYS_DEBOUNCE_INTERVAL, + .gpio = WR512_3GN_GPIO_BUTTON_CONNECT, + .active_low = 1, + } +}; + +#define WR512_3GN_GPIO_MODE \ + ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \ + RT305X_GPIO_MODE_MDIO) + +static void __init wr512_3gn_init(void) +{ + rt305x_gpio_init(WR512_3GN_GPIO_MODE); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(wr512_3gn_leds_gpio), + wr512_3gn_leds_gpio); + ramips_register_gpio_buttons(-1, WR512_3GN_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wr512_3gn_gpio_buttons), + wr512_3gn_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_WR512_3GN, "WR512-3GN", "WR512-3GN-like router", + wr512_3gn_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c new file mode 100644 index 000000000..591d9ceb5 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c @@ -0,0 +1,90 @@ +/* + * AWB WR6202 board support + * + * Copyright (C) 2012 Johnathan Boyce<jon.boyce@globalreach.eu.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include<linux/init.h> +#include<linux/platform_device.h> +#include<linux/gpio.h> + +#include<asm/mach-ralink/machine.h> +#include<asm/mach-ralink/dev-gpio-buttons.h> +#include<asm/mach-ralink/dev-gpio-leds.h> +#include<asm/mach-ralink/rt305x.h> +#include<asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define WR6202_GPIO_BUTTON_RESET 10 /* active low */ +#define WR6202_GPIO_BUTTON_WPS 0 /* active low */ + +#define WR6202_KEYS_POLL_INTERVAL 20 +#define WR6202_KEYS_DEBOUNCE_INTERVAL (3 * WR6202_KEYS_POLL_INTERVAL) + +#define WR6202_GPIO_USB_POWER 11 + +#define WR6202_GPIO_LED_3G 13 +#define WR6202_GPIO_LED_WPS 14 + +static struct gpio_led wr6202_leds_gpio[] __initdata = { + { + .name = "wr6202:blue:wps", + .gpio = WR6202_GPIO_LED_WPS, + .active_low = 1, + }, { + .name = "wr6202:blue:3g", + .gpio = WR6202_GPIO_LED_3G, + .active_low = 1, + } +}; + +static struct gpio_keys_button wr6202_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WR6202_KEYS_DEBOUNCE_INTERVAL, + .gpio = WR6202_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WR6202_KEYS_DEBOUNCE_INTERVAL, + .gpio = WR6202_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init wr6202_init(void) +{ + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + + rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(wr6202_leds_gpio), + wr6202_leds_gpio); + ramips_register_gpio_buttons(-1, WR6202_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wr6202_gpio_buttons), + wr6202_gpio_buttons); + + /* Power to the USB port is controlled by GPIO line */ + gpio_request(WR6202_GPIO_USB_POWER, "WR6202_GPIO_USB_POWER"); + gpio_direction_output(WR6202_GPIO_USB_POWER, 0); + gpio_free(WR6202_GPIO_USB_POWER); + + rt305x_register_flash(0); + + rt305x_register_ethernet(); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_WR6202, "WR6202", "AWB WR6202", + wr6202_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-xdx-rn502j.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-xdx-rn502j.c new file mode 100644 index 000000000..f7ef35326 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-xdx-rn502j.c @@ -0,0 +1,79 @@ +/* + * Unknown router name/model, PCB marked with XDX-RN502J + * + * Copyright (C) 2011 Bruno Schwander bruno@tinkerbox.org + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/platform_device.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define XDXRN502J_GPIO_BUTTON_RESET 12 +#define XDXRN502J_GPIO_LED_WIFI 7 +#define XDXRN502J_GPIO_LED_POWER 9 + +#define XDXRN502J_BUTTONS_POLL_INTERVAL 20 +#define XDXRN502J_BUTTONS_DEBOUNCE_INTERVAL (3 * XDXRN502J_BUTTONS_POLL_INTERVAL) + + +static struct gpio_led xdxrn502j_leds_gpio[] __initdata = { + { + .name = "xdxrn502j:green:wifi", + .gpio = XDXRN502J_GPIO_LED_WIFI, + .active_low = 1, + }, { + .name = "xdxrn502j:green:power", + .gpio = XDXRN502J_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static struct gpio_keys_button xdxrn502j_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = XDXRN502J_BUTTONS_DEBOUNCE_INTERVAL, + .gpio = XDXRN502J_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +#define XDXRN502J_GPIO_MODE \ + ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \ + RT305X_GPIO_MODE_MDIO) + +static void __init xdxrn502j_init(void) +{ + rt305x_gpio_init(XDXRN502J_GPIO_MODE); + + rt305x_register_flash(0); + + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; + rt305x_register_ethernet(); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(xdxrn502j_leds_gpio), + xdxrn502j_leds_gpio); + + ramips_register_gpio_buttons(-1, XDXRN502J_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(xdxrn502j_gpio_buttons), + xdxrn502j_gpio_buttons); + + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_usb(); +} + +MIPS_MACHINE(RAMIPS_MACH_XDXRN502J, "XDXRN502J", "XDX RN502J", + xdxrn502j_init); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c new file mode 100644 index 000000000..8a7a58b7d --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c @@ -0,0 +1,247 @@ +/* + * Ralink RT305x SoC specific setup + * + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> + * + * Parts of this file are based on Ralink's 2.6.21 BSP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/module.h> + +#include <asm/mipsregs.h> + +#include <asm/mach-ralink/common.h> +#include <asm/mach-ralink/ramips_gpio.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +void __iomem * rt305x_sysc_base; +void __iomem * rt305x_memc_base; +enum rt305x_soc_type rt305x_soc; + +static unsigned long rt5350_get_mem_size(void) +{ + void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); + unsigned long ret; + u32 t; + + t = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG); + t = (t >> RT5350_SYSCFG0_DRAM_SIZE_SHIFT) & + RT5350_SYSCFG0_DRAM_SIZE_MASK; + + switch (t) { + case RT5350_SYSCFG0_DRAM_SIZE_2M: + ret = 2 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_8M: + ret = 8 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_16M: + ret = 16 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_32M: + ret = 32 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_64M: + ret = 64 * 1024 * 1024; + break; + default: + panic("rt5350: invalid DRAM size: %u", t); + break; + } + + return ret; +} + +void __init ramips_soc_prom_init(void) +{ + void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); + const char *name = "unknown"; + u32 n0; + u32 n1; + u32 id; + + n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); + n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); + + if (n0 == RT3052_CHIP_NAME0 && n1 == RT3052_CHIP_NAME1) { + unsigned long icache_sets; + + icache_sets = (read_c0_config1() >> 22) & 7; + if (icache_sets == 1) { + rt305x_soc = RT305X_SOC_RT3050; + name = "RT3050"; + } else { + rt305x_soc = RT305X_SOC_RT3052; + name = "RT3052"; + } + } else if (n0 == RT3350_CHIP_NAME0 && n1 == RT3350_CHIP_NAME1) { + rt305x_soc = RT305X_SOC_RT3350; + name = "RT3350"; + } else if (n0 == RT3352_CHIP_NAME0 && n1 == RT3352_CHIP_NAME1) { + rt305x_soc = RT305X_SOC_RT3352; + name = "RT3352"; + } else if (n0 == RT5350_CHIP_NAME0 && n1 == RT5350_CHIP_NAME1) { + rt305x_soc = RT305X_SOC_RT5350; + name = "RT5350"; + } else { + panic("rt305x: unknown SoC, n0:%08x n1:%08x\n", n0, n1); + } + + id = __raw_readl(sysc + SYSC_REG_CHIP_ID); + + snprintf(ramips_sys_type, RAMIPS_SYS_TYPE_LEN, + "Ralink %s id:%u rev:%u", + name, + (id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK, + (id & CHIP_ID_REV_MASK)); + + ramips_mem_base = RT305X_SDRAM_BASE; + + if (soc_is_rt5350()) { + ramips_get_mem_size = rt5350_get_mem_size; + } else if (soc_is_rt305x() || soc_is_rt3350() ) { + ramips_mem_size_min = RT305X_MEM_SIZE_MIN; + ramips_mem_size_max = RT305X_MEM_SIZE_MAX; + } else if (soc_is_rt3352()) { + ramips_mem_size_min = RT3352_MEM_SIZE_MIN; + ramips_mem_size_max = RT3352_MEM_SIZE_MAX; + } else { + BUG(); + } +} + +static struct ramips_gpio_chip rt305x_gpio_chips[] = { + { + .chip = { + .label = "RT305X-GPIO0", + .base = 0, + .ngpio = 24, + }, + .regs = { + [RAMIPS_GPIO_REG_INT] = 0x00, + [RAMIPS_GPIO_REG_EDGE] = 0x04, + [RAMIPS_GPIO_REG_RENA] = 0x08, + [RAMIPS_GPIO_REG_FENA] = 0x0c, + [RAMIPS_GPIO_REG_DATA] = 0x20, + [RAMIPS_GPIO_REG_DIR] = 0x24, + [RAMIPS_GPIO_REG_POL] = 0x28, + [RAMIPS_GPIO_REG_SET] = 0x2c, + [RAMIPS_GPIO_REG_RESET] = 0x30, + [RAMIPS_GPIO_REG_TOGGLE] = 0x34, + }, + .map_base = RT305X_PIO_BASE, + .map_size = RT305X_PIO_SIZE, + }, + { + .chip = { + .label = "RT305X-GPIO1", + .base = 24, + .ngpio = 16, + }, + .regs = { + [RAMIPS_GPIO_REG_INT] = 0x38, + [RAMIPS_GPIO_REG_EDGE] = 0x3c, + [RAMIPS_GPIO_REG_RENA] = 0x40, + [RAMIPS_GPIO_REG_FENA] = 0x44, + [RAMIPS_GPIO_REG_DATA] = 0x48, + [RAMIPS_GPIO_REG_DIR] = 0x4c, + [RAMIPS_GPIO_REG_POL] = 0x50, + [RAMIPS_GPIO_REG_SET] = 0x54, + [RAMIPS_GPIO_REG_RESET] = 0x58, + [RAMIPS_GPIO_REG_TOGGLE] = 0x5c, + }, + .map_base = RT305X_PIO_BASE, + .map_size = RT305X_PIO_SIZE, + }, + { + .chip = { + .label = "RT305X-GPIO2", + .base = 40, + .ngpio = 12, + }, + .regs = { + [RAMIPS_GPIO_REG_INT] = 0x60, + [RAMIPS_GPIO_REG_EDGE] = 0x64, + [RAMIPS_GPIO_REG_RENA] = 0x68, + [RAMIPS_GPIO_REG_FENA] = 0x6c, + [RAMIPS_GPIO_REG_DATA] = 0x70, + [RAMIPS_GPIO_REG_DIR] = 0x74, + [RAMIPS_GPIO_REG_POL] = 0x78, + [RAMIPS_GPIO_REG_SET] = 0x7c, + [RAMIPS_GPIO_REG_RESET] = 0x80, + [RAMIPS_GPIO_REG_TOGGLE] = 0x84, + }, + .map_base = RT305X_PIO_BASE, + .map_size = RT305X_PIO_SIZE, + }, +}; + +static struct ramips_gpio_data rt305x_gpio_data = { + .chips = rt305x_gpio_chips, + .num_chips = ARRAY_SIZE(rt305x_gpio_chips), +}; + +static void rt305x_gpio_reserve(int first, int last) +{ + for (; first <= last; first++) + gpio_request(first, "reserved"); +} + +void __init rt305x_gpio_init(u32 mode) +{ + u32 t; + + rt305x_sysc_wr(mode, SYSC_REG_GPIO_MODE); + + ramips_gpio_init(&rt305x_gpio_data); + if ((mode & RT305X_GPIO_MODE_I2C) == 0) + rt305x_gpio_reserve(RT305X_GPIO_I2C_SD, RT305X_GPIO_I2C_SCLK); + + if ((mode & RT305X_GPIO_MODE_SPI) == 0) + rt305x_gpio_reserve(RT305X_GPIO_SPI_EN, RT305X_GPIO_SPI_CLK); + + t = mode >> RT305X_GPIO_MODE_UART0_SHIFT; + t &= RT305X_GPIO_MODE_UART0_MASK; + switch (t) { + case RT305X_GPIO_MODE_UARTF: + case RT305X_GPIO_MODE_PCM_UARTF: + case RT305X_GPIO_MODE_PCM_I2S: + case RT305X_GPIO_MODE_I2S_UARTF: + rt305x_gpio_reserve(RT305X_GPIO_7, RT305X_GPIO_14); + break; + case RT305X_GPIO_MODE_PCM_GPIO: + rt305x_gpio_reserve(RT305X_GPIO_10, RT305X_GPIO_14); + break; + case RT305X_GPIO_MODE_GPIO_UARTF: + case RT305X_GPIO_MODE_GPIO_I2S: + rt305x_gpio_reserve(RT305X_GPIO_7, RT305X_GPIO_10); + break; + } + + if ((mode & RT305X_GPIO_MODE_UART1) == 0) + rt305x_gpio_reserve(RT305X_GPIO_UART1_TXD, + RT305X_GPIO_UART1_RXD); + + if ((mode & RT305X_GPIO_MODE_JTAG) == 0) + rt305x_gpio_reserve(RT305X_GPIO_JTAG_TDO, RT305X_GPIO_JTAG_TDI); + + if ((mode & RT305X_GPIO_MODE_MDIO) == 0) + rt305x_gpio_reserve(RT305X_GPIO_MDIO_MDC, + RT305X_GPIO_MDIO_MDIO); + + if ((mode & RT305X_GPIO_MODE_SDRAM) == 0) + rt305x_gpio_reserve(RT305X_GPIO_SDRAM_MD16, + RT305X_GPIO_SDRAM_MD31); + + if ((mode & RT305X_GPIO_MODE_RGMII) == 0) + rt305x_gpio_reserve(RT305X_GPIO_GE0_TXD0, + RT305X_GPIO_GE0_RXCLK); +} diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/setup.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/setup.c new file mode 100644 index 000000000..5a069db45 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/setup.c @@ -0,0 +1,88 @@ +/* + * Ralink RT305x SoC specific setup + * + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> + * + * Parts of this file are based on Ralink's 2.6.21 BSP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/err.h> +#include <linux/clk.h> + +#include <asm/mips_machine.h> +#include <asm/reboot.h> +#include <asm/time.h> + +#include <asm/mach-ralink/common.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> +#include "common.h" + +static void rt305x_restart(char *command) +{ + rt305x_sysc_wr(RT305X_RESET_SYSTEM, SYSC_REG_RESET_CTRL); + while (1) + if (cpu_wait) + cpu_wait(); +} + +static void rt305x_halt(void) +{ + while (1) + if (cpu_wait) + cpu_wait(); +} + +unsigned int __cpuinit get_c0_compare_irq(void) +{ + return CP0_LEGACY_COMPARE_IRQ; +} + +void __init ramips_soc_setup(void) +{ + struct clk *clk; + + rt305x_sysc_base = ioremap_nocache(RT305X_SYSC_BASE, PAGE_SIZE); + rt305x_memc_base = ioremap_nocache(RT305X_MEMC_BASE, PAGE_SIZE); + + rt305x_clocks_init(); + + clk = clk_get(NULL, "cpu"); + if (IS_ERR(clk)) + panic("unable to get CPU clock, err=%ld", PTR_ERR(clk)); + + printk(KERN_INFO "%s running at %lu.%02lu MHz\n", ramips_sys_type, + clk_get_rate(clk) / 1000000, + (clk_get_rate(clk) % 1000000) * 100 / 1000000); + + _machine_restart = rt305x_restart; + _machine_halt = rt305x_halt; + pm_power_off = rt305x_halt; + + clk = clk_get(NULL, "uart"); + if (IS_ERR(clk)) + panic("unable to get UART clock, err=%ld", PTR_ERR(clk)); + + ramips_early_serial_setup(0, RT305X_UART0_BASE, clk_get_rate(clk), + RT305X_INTC_IRQ_UART0); + ramips_early_serial_setup(1, RT305X_UART1_BASE, clk_get_rate(clk), + RT305X_INTC_IRQ_UART1); +} + +void __init plat_time_init(void) +{ + struct clk *clk; + + clk = clk_get(NULL, "cpu"); + if (IS_ERR(clk)) + panic("unable to get CPU clock, err=%ld", PTR_ERR(clk)); + + mips_hpt_frequency = clk_get_rate(clk) / 2; +} |