From ed292123bc5c9a242273ad5e9251da05fc7377c6 Mon Sep 17 00:00:00 2001 From: blogic Date: Wed, 3 Apr 2013 09:58:44 +0000 Subject: [ramips] move files to files-3.7 Signed-off-by: John Crispin git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36161 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files-3.7/arch/mips/ralink/rt288x/Kconfig | 36 ++++ .../files-3.7/arch/mips/ralink/rt288x/Makefile | 21 ++ .../files-3.7/arch/mips/ralink/rt288x/clock.c | 99 ++++++++++ .../files-3.7/arch/mips/ralink/rt288x/common.h | 16 ++ .../files-3.7/arch/mips/ralink/rt288x/devices.c | 211 +++++++++++++++++++++ .../files-3.7/arch/mips/ralink/rt288x/devices.h | 28 +++ .../arch/mips/ralink/rt288x/early_printk.c | 30 +++ .../ramips/files-3.7/arch/mips/ralink/rt288x/irq.c | 81 ++++++++ .../arch/mips/ralink/rt288x/mach-br6524n.c | 74 ++++++++ .../arch/mips/ralink/rt288x/mach-f5d8235-v1.c | 106 +++++++++++ .../arch/mips/ralink/rt288x/mach-rt-n15.c | 99 ++++++++++ .../arch/mips/ralink/rt288x/mach-v11st-fe.c | 75 ++++++++ .../arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c | 102 ++++++++++ .../arch/mips/ralink/rt288x/mach-wzr-agl300nh.c | 77 ++++++++ .../files-3.7/arch/mips/ralink/rt288x/rt288x.c | 153 +++++++++++++++ .../files-3.7/arch/mips/ralink/rt288x/setup.c | 88 +++++++++ 16 files changed, 1296 insertions(+) create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Kconfig create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Makefile create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/clock.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/common.h create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.h create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/early_printk.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/irq.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-br6524n.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-f5d8235-v1.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-rt-n15.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-v11st-fe.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/rt288x.c create mode 100644 target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/setup.c (limited to 'target/linux/ramips/files-3.7/arch/mips/ralink/rt288x') diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Kconfig b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Kconfig new file mode 100644 index 000000000..739561c64 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Kconfig @@ -0,0 +1,36 @@ +if RALINK_RT288X + +menu "Ralink RT288x machine selection" + +config RT288X_MACH_F5D8235_V1 + bool "Belkin F5D8235 V1 board support" + select RALINK_DEV_GPIO_LEDS + +config RT288X_MACH_BR6524N + bool "Edimax BR6524N support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT288X_MACH_RT_N15 + bool "Asus RT-N15 board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT288X_MACH_V11ST_FE + bool "Ralink V11ST-FE board support" + select HW_HAS_PCI + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT288X_MACH_WLI_TX4_AG300N + bool "Buffalo WLI-TX4-AG300N board support" + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + +config RT288X_MACH_WZR_AGL300NH + bool "Buffalo WZR-AGL300NH board support" + select RALINK_DEV_GPIO_LEDS + +endmenu + +endif diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Makefile b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Makefile new file mode 100644 index 000000000..eb60c5d10 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/Makefile @@ -0,0 +1,21 @@ +# +# Makefile for the Ralink RT288x SoC specific parts of the kernel +# +# Copyright (C) 2010 Joonas Lahtinen +# Copyright (C) 2008-2009 Gabor Juhos +# Copyright (C) 2008 Imre Kaloz +# +# 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 rt288x.o devices.o clock.o + +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + +obj-$(CONFIG_RT288X_MACH_F5D8235_V1) += mach-f5d8235-v1.o +obj-$(CONFIG_RT288X_MACH_BR6524N) += mach-br6524n.o +obj-$(CONFIG_RT288X_MACH_RT_N15) += mach-rt-n15.o +obj-$(CONFIG_RT288X_MACH_V11ST_FE) += mach-v11st-fe.o +obj-$(CONFIG_RT288X_MACH_WLI_TX4_AG300N) += mach-wli-tx4-ag300n.o +obj-$(CONFIG_RT288X_MACH_WZR_AGL300NH) += mach-wzr-agl300nh.o diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/clock.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/clock.c new file mode 100644 index 000000000..36d754dbf --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/clock.c @@ -0,0 +1,99 @@ +/* + * Ralink RT288X clock API + * + * Copyright (C) 2011 Gabor Juhos + * + * 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 +#include +#include +#include +#include + +#include +#include +#include +#include "common.h" + +struct clk { + unsigned long rate; +}; + +static struct clk rt288x_cpu_clk; +static struct clk rt288x_sys_clk; +static struct clk rt288x_wdt_clk; +static struct clk rt288x_uart_clk; + +void __init rt288x_clocks_init(void) +{ + u32 t; + + t = rt288x_sysc_rr(SYSC_REG_SYSTEM_CONFIG); + t = ((t >> SYSTEM_CONFIG_CPUCLK_SHIFT) & SYSTEM_CONFIG_CPUCLK_MASK); + + switch (t) { + case SYSTEM_CONFIG_CPUCLK_250: + rt288x_cpu_clk.rate = 250000000; + break; + case SYSTEM_CONFIG_CPUCLK_266: + rt288x_cpu_clk.rate = 266666667; + break; + case SYSTEM_CONFIG_CPUCLK_280: + rt288x_cpu_clk.rate = 280000000; + break; + case SYSTEM_CONFIG_CPUCLK_300: + rt288x_cpu_clk.rate = 300000000; + break; + } + + rt288x_sys_clk.rate = rt288x_cpu_clk.rate / 2; + rt288x_uart_clk.rate = rt288x_sys_clk.rate; + rt288x_wdt_clk.rate = rt288x_sys_clk.rate; +} + +/* + * Linux clock API + */ +struct clk *clk_get(struct device *dev, const char *id) +{ + if (!strcmp(id, "sys")) + return &rt288x_sys_clk; + + if (!strcmp(id, "cpu")) + return &rt288x_cpu_clk; + + if (!strcmp(id, "wdt")) + return &rt288x_wdt_clk; + + if (!strcmp(id, "uart")) + return &rt288x_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-3.7/arch/mips/ralink/rt288x/common.h b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/common.h new file mode 100644 index 000000000..f2415c58b --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/common.h @@ -0,0 +1,16 @@ +/* + * Ralink RT288X SoC common defines + * + * Copyright (C) 2011 Gabor Juhos + * + * 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 _RT288X_COMMON_H +#define _RT288X_COMMON_H + +void rt288x_clocks_init(void); + +#endif /* _RT288X_COMMON_H */ \ No newline at end of file diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.c new file mode 100644 index 000000000..196810a30 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.c @@ -0,0 +1,211 @@ +/* + * Ralink RT288x SoC platform device registration + * + * Copyright (C) 2008-2011 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "devices.h" + +static struct resource rt288x_flash0_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = KSEG1ADDR(RT2880_FLASH0_BASE), + .end = KSEG1ADDR(RT2880_FLASH0_BASE) + + RT2880_FLASH0_SIZE - 1, + }, +}; + +struct physmap_flash_data rt288x_flash0_data; +static struct platform_device rt288x_flash0_device = { + .name = "physmap-flash", + .resource = rt288x_flash0_resources, + .num_resources = ARRAY_SIZE(rt288x_flash0_resources), + .dev = { + .platform_data = &rt288x_flash0_data, + }, +}; + +static struct resource rt288x_flash1_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = KSEG1ADDR(RT2880_FLASH1_BASE), + .end = KSEG1ADDR(RT2880_FLASH1_BASE) + + RT2880_FLASH1_SIZE - 1, + }, +}; + +struct physmap_flash_data rt288x_flash1_data; +static struct platform_device rt288x_flash1_device = { + .name = "physmap-flash", + .resource = rt288x_flash1_resources, + .num_resources = ARRAY_SIZE(rt288x_flash1_resources), + .dev = { + .platform_data = &rt288x_flash1_data, + }, +}; + +static int rt288x_flash_instance __initdata; +void __init rt288x_register_flash(unsigned int id) +{ + struct platform_device *pdev; + struct physmap_flash_data *pdata; + u32 t; + int reg; + + switch (id) { + case 0: + pdev = &rt288x_flash0_device; + reg = MEMC_REG_FLASH_CFG0; + break; + case 1: + pdev = &rt288x_flash1_device; + reg = MEMC_REG_FLASH_CFG1; + break; + default: + return; + } + + t = rt288x_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 "RT288x: flash bank%u witdh is invalid\n", id); + return; + } + + pdev->id = rt288x_flash_instance; + + platform_device_register(pdev); + rt288x_flash_instance++; +} + +static struct resource rt288x_wifi_resources[] = { + { + .start = RT2880_WMAC_BASE, + .end = RT2880_WMAC_BASE + 0x3FFFF, + .flags = IORESOURCE_MEM, + }, { + .start = RT288X_CPU_IRQ_WNIC, + .end = RT288X_CPU_IRQ_WNIC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct rt2x00_platform_data rt288x_wifi_data; +static struct platform_device rt288x_wifi_device = { + .name = "rt2800_wmac", + .resource = rt288x_wifi_resources, + .num_resources = ARRAY_SIZE(rt288x_wifi_resources), + .dev = { + .platform_data = &rt288x_wifi_data, + } +}; + +void __init rt288x_register_wifi(void) +{ + rt288x_wifi_data.eeprom_file_name = "soc_wmac.eeprom"; + platform_device_register(&rt288x_wifi_device); +} + +static void rt288x_fe_reset(void) +{ + rt288x_sysc_wr(RT2880_RESET_FE, SYSC_REG_RESET_CTRL); +} + +static struct resource rt288x_eth_resources[] = { + { + .start = RT2880_FE_BASE, + .end = RT2880_FE_BASE + PAGE_SIZE - 1, + .flags = IORESOURCE_MEM, + }, { + .start = RT288X_CPU_IRQ_FE, + .end = RT288X_CPU_IRQ_FE, + .flags = IORESOURCE_IRQ, + }, +}; + +struct ramips_eth_platform_data rt288x_eth_data; +static struct platform_device rt288x_eth_device = { + .name = "ramips_eth", + .resource = rt288x_eth_resources, + .num_resources = ARRAY_SIZE(rt288x_eth_resources), + .dev = { + .platform_data = &rt288x_eth_data, + } +}; + +void __init rt288x_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)); + + rt288x_eth_data.sys_freq = clk_get_rate(clk); + rt288x_eth_data.reset_fe = rt288x_fe_reset; + rt288x_eth_data.min_pkt_len = 64; + + if (!is_valid_ether_addr(rt288x_eth_data.mac)) + random_ether_addr(rt288x_eth_data.mac); + + platform_device_register(&rt288x_eth_device); +} + +static struct resource rt288x_wdt_resources[] = { + { + .start = RT2880_TIMER_BASE, + .end = RT2880_TIMER_BASE + RT2880_TIMER_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device rt288x_wdt_device = { + .name = "ramips-wdt", + .id = -1, + .resource = rt288x_wdt_resources, + .num_resources = ARRAY_SIZE(rt288x_wdt_resources), +}; + +void __init rt288x_register_wdt(void) +{ + u32 t; + + /* enable WDT reset output on pin SRAM_CS_N */ + t = rt288x_sysc_rr(SYSC_REG_CLKCFG); + t |= CLKCFG_SRAM_CS_N_WDT; + rt288x_sysc_wr(t, SYSC_REG_CLKCFG); + + platform_device_register(&rt288x_wdt_device); +} diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.h b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.h new file mode 100644 index 000000000..d097e5d90 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/devices.h @@ -0,0 +1,28 @@ +/* + * Ralink RT288x SoC specific platform definitions + * + * Copyright (C) 2008-2011 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 __ASM_MACH_RT288X_PLATFORM_H +#define __ASM_MACH_RT288X_PLATFORM_H + +struct physmap_flash_data; + +extern struct physmap_flash_data rt288x_flash0_data; +extern struct physmap_flash_data rt288x_flash1_data; +void rt288x_register_flash(unsigned int id); + +void rt288x_register_wifi(void); + +extern struct ramips_eth_platform_data rt288x_eth_data; +void rt288x_register_ethernet(void); + +void rt288x_register_wdt(void); + +#endif /* __ASM_MACH_RT288X_PLATFORM_H */ diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/early_printk.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/early_printk.c new file mode 100644 index 000000000..9fd7adb54 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/early_printk.c @@ -0,0 +1,30 @@ +/* + * Ralink RT288x SoC early printk support + * + * Copyright (C) 2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 +#include + +#include + +#include + +#define UART_READ(r) \ + __raw_readl((void __iomem *)(KSEG1ADDR(RT2880_UART1_BASE) + 4 * (r))) + +#define UART_WRITE(r, v) \ + __raw_writel((v), (void __iomem *)(KSEG1ADDR(RT2880_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-3.7/arch/mips/ralink/rt288x/irq.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/irq.c new file mode 100644 index 000000000..5465a4560 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/irq.c @@ -0,0 +1,81 @@ +/* + * Ralink RT288x SoC specific interrupt handling + * + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 +#include +#include +#include + +#include +#include + +#include +#include +#include + +static void rt288x_intc_irq_dispatch(void) +{ + u32 pending; + + pending = ramips_intc_get_status(); + + if (pending & RT2880_INTC_INT_TIMER0) + do_IRQ(RT2880_INTC_IRQ_TIMER0); + + else if (pending & RT2880_INTC_INT_TIMER1) + do_IRQ(RT2880_INTC_IRQ_TIMER1); + + else if (pending & RT2880_INTC_INT_UART0) + do_IRQ(RT2880_INTC_IRQ_UART0); + + else if (pending & RT2880_INTC_INT_PCM) + do_IRQ(RT2880_INTC_IRQ_PCM); + + else if (pending & RT2880_INTC_INT_UART1) + do_IRQ(RT2880_INTC_IRQ_UART1); + + /* 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(RT288X_CPU_IRQ_COUNTER); + + else if (pending & STATUSF_IP4) + do_IRQ(RT288X_CPU_IRQ_PCI); + + else if (pending & STATUSF_IP5) + do_IRQ(RT288X_CPU_IRQ_FE); + + else if (pending & STATUSF_IP6) + do_IRQ(RT288X_CPU_IRQ_WNIC); + + else if (pending & STATUSF_IP2) + rt288x_intc_irq_dispatch(); + + else + spurious_interrupt(); +} + +void __init arch_init_irq(void) +{ + mips_cpu_irq_init(); + ramips_intc_irq_init(RT2880_INTC_BASE, RT288X_CPU_IRQ_INTC, + RT288X_INTC_IRQ_BASE); +} diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-br6524n.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-br6524n.c new file mode 100644 index 000000000..ff4746cda --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-br6524n.c @@ -0,0 +1,74 @@ +/* + * Edimax BR6524N board support + * + * Copyright (C) 2012 Florian Fainelli + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "devices.h" + +#define BR6524N_GPIO_STATUS_LED 12 +#define BR6524N_GPIO_BUTTON_WPS 0 + +#define BR6524N_KEYS_POLL_INTERVAL 20 +#define BR6524N_KEYS_DEBOUNCE_INTERVAL (3 * BR6524N_KEYS_POLL_INTERVAL) + +static struct gpio_led br6524n_leds_gpio[] __initdata = { + { + .name = "br6524n:green:status", + .gpio = BR6524N_GPIO_STATUS_LED, + .active_low = 1, + } +}; + +static struct gpio_keys_button br6524n_gpio_buttons[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = BR6524N_KEYS_DEBOUNCE_INTERVAL, + .gpio = BR6524N_GPIO_BUTTON_WPS, + } +}; + +static void __init br6524n_fe_init(void) +{ + rt288x_gpio_init(RT2880_GPIO_MODE_UART0); + + rt288x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(br6524n_leds_gpio), + br6524n_leds_gpio); + + ramips_register_gpio_buttons(-1, BR6524N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(br6524n_gpio_buttons), + br6524n_gpio_buttons); + + rt288x_register_wifi(); + + /* Board is connected to an IC+ IP175C Fast Ethernet switch */ + rt288x_eth_data.speed = SPEED_100; + rt288x_eth_data.duplex = DUPLEX_FULL; + rt288x_eth_data.tx_fc = 1; + rt288x_eth_data.rx_fc = 1; + rt288x_eth_data.phy_mask = BIT(0); + rt288x_register_ethernet(); + + rt288x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_BR6524N, "BR6524N", "Edimax BR6524N", br6524n_fe_init); diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-f5d8235-v1.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-f5d8235-v1.c new file mode 100644 index 000000000..7679572bb --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-f5d8235-v1.c @@ -0,0 +1,106 @@ +/* + * Belkin F5D825 V1 board support + * + * Copyright (C) 2011 Cezary Jackiewicz + * + * 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 +#include + +#include +#include +#include +#include +#include + +#include "devices.h" + +#include +#include + +#include + +#define F5D8235_GPIO_RTL8366_SCK 2 +#define F5D8235_GPIO_RTL8366_SDA 1 + +#define F5D8235_GPIO_LED_USB_BLUE 7 +#define F5D8235_GPIO_LED_USB_ORANGE 8 +#define F5D8235_GPIO_BUTTON_WPS 0 +#define F5D8235_GPIO_BUTTON_RESET 9 + +#define F5D8235_KEYS_POLL_INTERVAL 20 +#define F5D8235_KEYS_DEBOUNCE_INTERVAL (3 * F5D8235_KEYS_POLL_INTERVAL) + +static struct rtl8366_platform_data f5d8235_rtl8366s_data = { + .gpio_sda = F5D8235_GPIO_RTL8366_SDA, + .gpio_sck = F5D8235_GPIO_RTL8366_SCK, +}; + +static struct platform_device f5d8235_rtl8366s_device = { + .name = RTL8366S_DRIVER_NAME, + .id = -1, + .dev = { + .platform_data = &f5d8235_rtl8366s_data, + } +}; + +static struct gpio_led f5d8235_leds_gpio[] __initdata = { + { + .name = "f5d8235-v1:blue:storage", + .gpio = F5D8235_GPIO_LED_USB_BLUE, + .active_low = 1, + },{ + .name = "f5d8235-v1:orange:storage", + .gpio = F5D8235_GPIO_LED_USB_ORANGE, + .active_low = 1, + } +}; + +static struct gpio_keys_button f5d8235_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = F5D8235_KEYS_DEBOUNCE_INTERVAL, + .gpio = F5D8235_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = F5D8235_KEYS_DEBOUNCE_INTERVAL, + .gpio = F5D8235_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static void __init f5d8235_init(void) +{ + rt288x_gpio_init(RT2880_GPIO_MODE_UART0 | RT2880_GPIO_MODE_I2C); + + rt288x_register_flash(0); + rt288x_register_wifi(); + rt288x_register_wdt(); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235_leds_gpio), + f5d8235_leds_gpio); + + ramips_register_gpio_buttons(-1, F5D8235_KEYS_POLL_INTERVAL, + ARRAY_SIZE(f5d8235_gpio_buttons), + f5d8235_gpio_buttons); + + platform_device_register(&f5d8235_rtl8366s_device); + + rt288x_eth_data.speed = SPEED_1000; + rt288x_eth_data.duplex = DUPLEX_FULL; + rt288x_eth_data.tx_fc = 1; + rt288x_eth_data.rx_fc = 1; + rt288x_register_ethernet(); +} + +MIPS_MACHINE(RAMIPS_MACH_F5D8235_V1, "F5D8235_V1", + "Belkin F5D8235 v1", f5d8235_init); diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-rt-n15.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-rt-n15.c new file mode 100644 index 000000000..1085b82f9 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-rt-n15.c @@ -0,0 +1,99 @@ +/* + * Asus RT-N15 board support + * + * Copyright (C) 2009-2010 Gabor Juhos + * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "devices.h" + +#define RT_N15_GPIO_LED_POWER 11 +#define RT_N15_GPIO_BUTTON_WPS 0 +#define RT_N15_GPIO_BUTTON_RESET 12 + +#define RT_N15_GPIO_RTL8366_SCK 2 +#define RT_N15_GPIO_RTL8366_SDA 1 + +#define RT_N15_KEYS_POLL_INTERVAL 20 +#define RT_N15_KEYS_DEBOUNCE_INTERVAL (3 * RT_N15_KEYS_POLL_INTERVAL) + +static struct gpio_led rt_n15_leds_gpio[] __initdata = { + { + .name = "rt-n15:blue:power", + .gpio = RT_N15_GPIO_LED_POWER, + .active_low = 1, + } +}; + +static struct gpio_keys_button rt_n15_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = RT_N15_KEYS_DEBOUNCE_INTERVAL, + .gpio = RT_N15_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = RT_N15_KEYS_DEBOUNCE_INTERVAL, + .gpio = RT_N15_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct rtl8366_platform_data rt_n15_rtl8366s_data = { + .gpio_sda = RT_N15_GPIO_RTL8366_SDA, + .gpio_sck = RT_N15_GPIO_RTL8366_SCK, +}; + +static struct platform_device rt_n15_rtl8366s_device = { + .name = RTL8366S_DRIVER_NAME, + .id = -1, + .dev = { + .platform_data = &rt_n15_rtl8366s_data, + } +}; + +static void __init rt_n15_init(void) +{ + rt288x_gpio_init(RT2880_GPIO_MODE_UART0 | RT2880_GPIO_MODE_I2C); + + rt288x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(rt_n15_leds_gpio), + rt_n15_leds_gpio); + + ramips_register_gpio_buttons(-1, RT_N15_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rt_n15_gpio_buttons), + rt_n15_gpio_buttons); + + platform_device_register(&rt_n15_rtl8366s_device); + + rt288x_register_wifi(); + + rt288x_eth_data.speed = SPEED_1000; + rt288x_eth_data.duplex = DUPLEX_FULL; + rt288x_eth_data.tx_fc = 1; + rt288x_eth_data.rx_fc = 1; + rt288x_register_ethernet(); + rt288x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_RT_N15, "RT-N15", "Asus RT-N15", rt_n15_init); diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-v11st-fe.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-v11st-fe.c new file mode 100644 index 000000000..667fe92dc --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-v11st-fe.c @@ -0,0 +1,75 @@ +/* + * Ralink V11ST-FE board support + * + * Copyright (C) 2012 Florian Fainelli + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "devices.h" + +#define V11ST_FE_GPIO_STATUS_LED 12 +#define V11ST_FE_GPIO_BUTTON_WPS 0 + +#define V11ST_FE_KEYS_POLL_INTERVAL 20 +#define V11ST_FE_KEYS_DEBOUNCE_INTERVAL (3 * V11ST_FE_KEYS_POLL_INTERVAL) + +static struct gpio_led v11st_fe_leds_gpio[] __initdata = { + { + .name = "v11st-fe:green:status", + .gpio = V11ST_FE_GPIO_STATUS_LED, + .active_low = 1, + } +}; + +static struct gpio_keys_button v11st_fe_gpio_buttons[] __initdata = { + { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = V11ST_FE_KEYS_DEBOUNCE_INTERVAL, + .gpio = V11ST_FE_GPIO_BUTTON_WPS, + } +}; + +static void __init rt_v11st_fe_init(void) +{ + rt288x_gpio_init(RT2880_GPIO_MODE_UART0); + + rt288x_register_flash(0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(v11st_fe_leds_gpio), + v11st_fe_leds_gpio); + + ramips_register_gpio_buttons(-1, V11ST_FE_KEYS_POLL_INTERVAL, + ARRAY_SIZE(v11st_fe_gpio_buttons), + v11st_fe_gpio_buttons); + + rt288x_register_wifi(); + + /* Board is connected to an IC+ IP175C Fast Ethernet switch */ + rt288x_eth_data.speed = SPEED_100; + rt288x_eth_data.duplex = DUPLEX_FULL; + rt288x_eth_data.tx_fc = 1; + rt288x_eth_data.rx_fc = 1; + rt288x_eth_data.phy_mask = BIT(0); + rt288x_register_ethernet(); + + rt288x_register_wdt(); + rt288x_register_pci(); +} + +MIPS_MACHINE(RAMIPS_MACH_V11ST_FE, "V11ST-FE", "Ralink V11ST-FE", rt_v11st_fe_init); diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c new file mode 100644 index 000000000..02fac0b3c --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c @@ -0,0 +1,102 @@ +/* + * Buffalo WLI-TX4-AG300N board support + * + * Copyright (C) 2011 Gabor Juhos + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "devices.h" + +#define WLI_TX4_AG300N_GPIO_LED_DIAG 10 +#define WLI_TX4_AG300N_GPIO_LED_POWER 12 +#define WLI_TX4_AG300N_GPIO_LED_SECURITY 13 + +#define WLI_TX4_AG300N_GPIO_BUTTON_AOSS 0 +#define WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH 8 +#define WLI_TX4_AG300N_GPIO_BUTTON_RESET 9 + +#define WLI_TX4_AG300N_KEYS_POLL_INTERVAL 20 +#define WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLI_TX4_AG300N_KEYS_POLL_INTERVAL) + +static struct gpio_led wli_tx4_ag300n_leds_gpio[] __initdata = { + { + .name = "buffalo:blue:power", + .gpio = WLI_TX4_AG300N_GPIO_LED_POWER, + .active_low = 1, + }, + { + .name = "buffalo:red:diag", + .gpio = WLI_TX4_AG300N_GPIO_LED_DIAG, + .active_low = 1, + }, + { + .name = "buffalo:blue:security", + .gpio = WLI_TX4_AG300N_GPIO_LED_SECURITY, + .active_low = 0, + }, +}; + +static struct gpio_keys_button wli_tx4_ag300n_gpio_buttons[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WLI_TX4_AG300N_GPIO_BUTTON_RESET, + .active_low = 1, + }, + { + .desc = "AOSS button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WLI_TX4_AG300N_GPIO_BUTTON_AOSS, + .active_low = 1, + }, + { + .desc = "Bandwidth switch", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL, + .gpio = WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH, + .active_low = 0, + }, +}; + +static void __init wli_tx4_ag300n_init(void) +{ + rt288x_gpio_init(RT2880_GPIO_MODE_UART0); + + ramips_register_gpio_leds(-1, ARRAY_SIZE(wli_tx4_ag300n_leds_gpio), + wli_tx4_ag300n_leds_gpio); + ramips_register_gpio_buttons(-1, WLI_TX4_AG300N_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wli_tx4_ag300n_gpio_buttons), + wli_tx4_ag300n_gpio_buttons); + + rt288x_register_flash(0); + rt288x_register_wifi(); + rt288x_register_wdt(); + + rt288x_eth_data.speed = SPEED_100; + rt288x_eth_data.duplex = DUPLEX_FULL; + rt288x_eth_data.tx_fc = 1; + rt288x_eth_data.rx_fc = 1; + rt288x_register_ethernet(); +} + +MIPS_MACHINE(RAMIPS_MACH_WLI_TX4_AG300N, "WLI-TX4-AG300N", + "Buffalo WLI-TX4-AG300N", wli_tx4_ag300n_init); diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c new file mode 100644 index 000000000..6bd7a4542 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c @@ -0,0 +1,77 @@ +/* + * Buffalo WZR-AGL300NH board support + * + * Copyright (C) 2010 Joonas Lahtinen + * + * 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 +#include +#include +#include +#include + +#include +#include +#include + +#include "devices.h" + +/* + * MTD layout from stock firmware: + * mtd0: 00030000 00010000 "uboot" + * mtd1: 00010000 00010000 "uboot_environ" + * mtd2: 00010000 00010000 "factory_default" + * mtd3: 000b0000 00010000 "linux" + * mtd4: 002f0000 00010000 "rootfs" + * mtd5: 00010000 00010000 "user_property" + */ + +static struct mtd_partition wzr_agl300nh_partitions[] = { + { + .name = "uboot", + .offset = 0, + .size = 0x030000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "uboot_environ", + .offset = 0x030000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "factory_default", + .offset = 0x040000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "linux", + .offset = 0x050000, + .size = 0x0b0000, + }, { + .name = "rootfs", + .offset = 0x100000, + .size = 0x2f0000, + }, { + .name = "user_property", + .offset = 0x3f0000, + .size = 0x010000, + } +}; + +static void __init wzr_agl300nh_init(void) +{ + rt288x_gpio_init(RT2880_GPIO_MODE_UART0); + + rt288x_flash0_data.nr_parts = ARRAY_SIZE(wzr_agl300nh_partitions); + rt288x_flash0_data.parts = wzr_agl300nh_partitions; + rt288x_register_flash(0); + + rt288x_register_wifi(); + rt288x_register_wdt(); +} + +MIPS_MACHINE(RAMIPS_MACH_WZR_AGL300NH, "WZR-AGL300NH", + "Buffalo WZR-AGL300NH", wzr_agl300nh_init); diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/rt288x.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/rt288x.c new file mode 100644 index 000000000..c51ad98b3 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/rt288x.c @@ -0,0 +1,153 @@ +/* + * Ralink RT288x SoC specific setup + * + * Copyright (C) 2008-2011 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 +#include +#include + +#include +#include +#include +#include + +void __iomem * rt288x_sysc_base; +void __iomem * rt288x_memc_base; + +void __init ramips_soc_prom_init(void) +{ + void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT2880_SYSC_BASE); + u32 n0; + u32 n1; + u32 id; + + n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); + n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); + id = __raw_readl(sysc + SYSC_REG_CHIP_ID); + + snprintf(ramips_sys_type, RAMIPS_SYS_TYPE_LEN, + "Ralink %c%c%c%c%c%c%c%c id:%u rev:%u", + (char) (n0 & 0xff), (char) ((n0 >> 8) & 0xff), + (char) ((n0 >> 16) & 0xff), (char) ((n0 >> 24) & 0xff), + (char) (n1 & 0xff), (char) ((n1 >> 8) & 0xff), + (char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff), + (id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK, + (id & CHIP_ID_REV_MASK)); + + ramips_mem_base = RT2880_SDRAM_BASE; + ramips_mem_size_min = RT288X_MEM_SIZE_MIN; + ramips_mem_size_max = RT288X_MEM_SIZE_MAX; +} + +static struct ramips_gpio_chip rt288x_gpio_chips[] = { + { + .chip = { + .label = "RT288X-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 = RT2880_PIO_BASE, + .map_size = RT2880_PIO_SIZE, + }, + { + .chip = { + .label = "RT288X-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 = RT2880_PIO_BASE, + .map_size = RT2880_PIO_SIZE, + }, + { + .chip = { + .label = "RT288X-GPIO2", + .base = 40, + .ngpio = 32, + }, + .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 = RT2880_PIO_BASE, + .map_size = RT2880_PIO_SIZE, + }, +}; + +static struct ramips_gpio_data rt288x_gpio_data = { + .chips = rt288x_gpio_chips, + .num_chips = ARRAY_SIZE(rt288x_gpio_chips), +}; + +static void rt288x_gpio_reserve(int first, int last) +{ + for (; first <= last; first++) + gpio_request(first, "reserved"); +} + +void __init rt288x_gpio_init(u32 mode) +{ + rt288x_sysc_wr(mode, SYSC_REG_GPIO_MODE); + + ramips_gpio_init(&rt288x_gpio_data); + if ((mode & RT2880_GPIO_MODE_I2C) == 0) + rt288x_gpio_reserve(1, 2); + + if ((mode & RT2880_GPIO_MODE_SPI) == 0) + rt288x_gpio_reserve(3, 6); + + if ((mode & RT2880_GPIO_MODE_UART0) == 0) + rt288x_gpio_reserve(7, 14); + + if ((mode & RT2880_GPIO_MODE_JTAG) == 0) + rt288x_gpio_reserve(17, 21); + + if ((mode & RT2880_GPIO_MODE_MDIO) == 0) + rt288x_gpio_reserve(22, 23); + + if ((mode & RT2880_GPIO_MODE_SDRAM) == 0) + rt288x_gpio_reserve(24, 39); + + if ((mode & RT2880_GPIO_MODE_PCI) == 0) + rt288x_gpio_reserve(40, 71); +} diff --git a/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/setup.c b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/setup.c new file mode 100644 index 000000000..be474b529 --- /dev/null +++ b/target/linux/ramips/files-3.7/arch/mips/ralink/rt288x/setup.c @@ -0,0 +1,88 @@ +/* + * Ralink RT288x SoC specific setup + * + * Copyright (C) 2008 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include "common.h" + +static void rt288x_restart(char *command) +{ + rt288x_sysc_wr(RT2880_RESET_SYSTEM, SYSC_REG_RESET_CTRL); + while (1) + if (cpu_wait) + cpu_wait(); +} + +static void rt288x_halt(void) +{ + while (1) + cpu_wait(); +} + +unsigned int __cpuinit get_c0_compare_irq(void) +{ + return CP0_LEGACY_COMPARE_IRQ; +} + +void __init ramips_soc_setup(void) +{ + struct clk *clk; + + rt288x_sysc_base = ioremap_nocache(RT2880_SYSC_BASE, RT2880_SYSC_SIZE); + rt288x_memc_base = ioremap_nocache(RT2880_MEMC_BASE, RT2880_MEMC_SIZE); + + rt288x_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 = rt288x_restart; + _machine_halt = rt288x_halt; + pm_power_off = rt288x_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, RT2880_UART0_BASE, clk_get_rate(clk), + RT2880_INTC_IRQ_UART0); + ramips_early_serial_setup(1, RT2880_UART1_BASE, clk_get_rate(clk), + RT2880_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; +} -- cgit v1.2.3