From c37aa3ee2851bf399df13f0679f2d05c00918111 Mon Sep 17 00:00:00 2001 From: Maxime Bizon Date: Fri, 4 Nov 2011 19:09:26 +0100 Subject: [PATCH] --- yaml --- r: 284737 b: refs/heads/master c: 455a503f4cd4971b26e431904d98fdf5beea1075 h: refs/heads/master i: 284735: 1476b7182a28e715739226e12f147b8d6caddc5b v: v3 --- [refs] | 2 +- trunk/arch/mips/ath79/Kconfig | 38 +- trunk/arch/mips/ath79/Makefile | 5 +- trunk/arch/mips/ath79/clock.c | 55 -- trunk/arch/mips/ath79/common.c | 5 - trunk/arch/mips/ath79/dev-ar913x-wmac.c | 60 ++ .../ath79/{dev-usb.h => dev-ar913x-wmac.h} | 10 +- trunk/arch/mips/ath79/dev-common.c | 38 +- trunk/arch/mips/ath79/dev-usb.c | 197 ----- trunk/arch/mips/ath79/dev-wmac.c | 109 --- trunk/arch/mips/ath79/dev-wmac.h | 17 - trunk/arch/mips/ath79/early_printk.c | 76 +- trunk/arch/mips/ath79/gpio.c | 2 - trunk/arch/mips/ath79/irq.c | 17 +- trunk/arch/mips/ath79/mach-ap121.c | 92 --- trunk/arch/mips/ath79/mach-ap81.c | 6 +- trunk/arch/mips/ath79/mach-pb44.c | 2 - trunk/arch/mips/ath79/mach-ubnt-xm.c | 119 --- trunk/arch/mips/ath79/machtypes.h | 2 - trunk/arch/mips/ath79/setup.c | 20 +- .../mips/include/asm/mach-ath79/ar71xx_regs.h | 81 +-- .../mips/include/asm/mach-ath79/ar933x_uart.h | 67 -- .../asm/mach-ath79/ar933x_uart_platform.h | 18 - .../arch/mips/include/asm/mach-ath79/ath79.h | 11 +- trunk/arch/mips/include/asm/mach-ath79/irq.h | 8 +- .../mips/include/asm/mach-ath79/pci-ath724x.h | 21 - .../mips/include/asm/mach-bcm63xx/ioremap.h | 38 + trunk/arch/mips/pci/Makefile | 1 - trunk/arch/mips/pci/pci-ath724x.c | 174 ----- trunk/drivers/tty/serial/Kconfig | 23 - trunk/drivers/tty/serial/Makefile | 1 - trunk/drivers/tty/serial/ar933x_uart.c | 688 ------------------ trunk/drivers/usb/host/Kconfig | 2 +- trunk/drivers/usb/host/ehci-ath79.c | 4 - trunk/include/linux/serial_core.h | 4 - 35 files changed, 130 insertions(+), 1883 deletions(-) create mode 100644 trunk/arch/mips/ath79/dev-ar913x-wmac.c rename trunk/arch/mips/ath79/{dev-usb.h => dev-ar913x-wmac.h} (61%) delete mode 100644 trunk/arch/mips/ath79/dev-usb.c delete mode 100644 trunk/arch/mips/ath79/dev-wmac.c delete mode 100644 trunk/arch/mips/ath79/dev-wmac.h delete mode 100644 trunk/arch/mips/ath79/mach-ap121.c delete mode 100644 trunk/arch/mips/ath79/mach-ubnt-xm.c delete mode 100644 trunk/arch/mips/include/asm/mach-ath79/ar933x_uart.h delete mode 100644 trunk/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h delete mode 100644 trunk/arch/mips/include/asm/mach-ath79/pci-ath724x.h create mode 100644 trunk/arch/mips/include/asm/mach-bcm63xx/ioremap.h delete mode 100644 trunk/arch/mips/pci/pci-ath724x.c delete mode 100644 trunk/drivers/tty/serial/ar933x_uart.c diff --git a/[refs] b/[refs] index 2bc989ad1e75..89ae16f3449b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b606d5ae905f5e560021298307ab7b9ef69a60f1 +refs/heads/master: 455a503f4cd4971b26e431904d98fdf5beea1075 diff --git a/trunk/arch/mips/ath79/Kconfig b/trunk/arch/mips/ath79/Kconfig index e0fae8f4442b..47707410582c 100644 --- a/trunk/arch/mips/ath79/Kconfig +++ b/trunk/arch/mips/ath79/Kconfig @@ -2,26 +2,13 @@ if ATH79 menu "Atheros AR71XX/AR724X/AR913X machine selection" -config ATH79_MACH_AP121 - bool "Atheros AP121 reference board" - select SOC_AR933X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_SPI - select ATH79_DEV_USB - select ATH79_DEV_WMAC - help - Say 'Y' here if you want your kernel to support the - Atheros AP121 reference board. - config ATH79_MACH_AP81 bool "Atheros AP81 reference board" select SOC_AR913X + select ATH79_DEV_AR913X_WMAC select ATH79_DEV_GPIO_BUTTONS select ATH79_DEV_LEDS_GPIO select ATH79_DEV_SPI - select ATH79_DEV_USB - select ATH79_DEV_WMAC help Say 'Y' here if you want your kernel to support the Atheros AP81 reference board. @@ -32,21 +19,10 @@ config ATH79_MACH_PB44 select ATH79_DEV_GPIO_BUTTONS select ATH79_DEV_LEDS_GPIO select ATH79_DEV_SPI - select ATH79_DEV_USB help Say 'Y' here if you want your kernel to support the Atheros PB44 reference board. -config ATH79_MACH_UBNT_XM - bool "Ubiquiti Networks XM (rev 1.0) board" - select SOC_AR724X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_SPI - help - Say 'Y' here if you want your kernel to support the - Ubiquiti Networks XM (rev 1.0) board. - endmenu config SOC_AR71XX @@ -57,15 +33,14 @@ config SOC_AR71XX config SOC_AR724X select USB_ARCH_HAS_EHCI select USB_ARCH_HAS_OHCI - select HW_HAS_PCI def_bool n config SOC_AR913X select USB_ARCH_HAS_EHCI def_bool n -config SOC_AR933X - select USB_ARCH_HAS_EHCI +config ATH79_DEV_AR913X_WMAC + depends on SOC_AR913X def_bool n config ATH79_DEV_GPIO_BUTTONS @@ -77,11 +52,4 @@ config ATH79_DEV_LEDS_GPIO config ATH79_DEV_SPI def_bool n -config ATH79_DEV_USB - def_bool n - -config ATH79_DEV_WMAC - depends on (SOC_AR913X || SOC_AR933X) - def_bool n - endif diff --git a/trunk/arch/mips/ath79/Makefile b/trunk/arch/mips/ath79/Makefile index 3b911e09dbec..c33d4653007c 100644 --- a/trunk/arch/mips/ath79/Makefile +++ b/trunk/arch/mips/ath79/Makefile @@ -16,16 +16,13 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o # Devices # obj-y += dev-common.o +obj-$(CONFIG_ATH79_DEV_AR913X_WMAC) += dev-ar913x-wmac.o obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o -obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o -obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o # # Machines # -obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o -obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o diff --git a/trunk/arch/mips/ath79/clock.c b/trunk/arch/mips/ath79/clock.c index 54d0eb4db987..680bde99a26c 100644 --- a/trunk/arch/mips/ath79/clock.c +++ b/trunk/arch/mips/ath79/clock.c @@ -110,59 +110,6 @@ static void __init ar913x_clocks_init(void) ath79_uart_clk.rate = ath79_ahb_clk.rate; } -static void __init ar933x_clocks_init(void) -{ - u32 clock_ctrl; - u32 cpu_config; - u32 freq; - u32 t; - - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - if (t & AR933X_BOOTSTRAP_REF_CLK_40) - ath79_ref_clk.rate = (40 * 1000 * 1000); - else - ath79_ref_clk.rate = (25 * 1000 * 1000); - - clock_ctrl = ath79_pll_rr(AR933X_PLL_CLOCK_CTRL_REG); - if (clock_ctrl & AR933X_PLL_CLOCK_CTRL_BYPASS) { - ath79_cpu_clk.rate = ath79_ref_clk.rate; - ath79_ahb_clk.rate = ath79_ref_clk.rate; - ath79_ddr_clk.rate = ath79_ref_clk.rate; - } else { - cpu_config = ath79_pll_rr(AR933X_PLL_CPU_CONFIG_REG); - - t = (cpu_config >> AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT) & - AR933X_PLL_CPU_CONFIG_REFDIV_MASK; - freq = ath79_ref_clk.rate / t; - - t = (cpu_config >> AR933X_PLL_CPU_CONFIG_NINT_SHIFT) & - AR933X_PLL_CPU_CONFIG_NINT_MASK; - freq *= t; - - t = (cpu_config >> AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - AR933X_PLL_CPU_CONFIG_OUTDIV_MASK; - if (t == 0) - t = 1; - - freq >>= t; - - t = ((clock_ctrl >> AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT) & - AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK) + 1; - ath79_cpu_clk.rate = freq / t; - - t = ((clock_ctrl >> AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT) & - AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK) + 1; - ath79_ddr_clk.rate = freq / t; - - t = ((clock_ctrl >> AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT) & - AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK) + 1; - ath79_ahb_clk.rate = freq / t; - } - - ath79_wdt_clk.rate = ath79_ref_clk.rate; - ath79_uart_clk.rate = ath79_ref_clk.rate; -} - void __init ath79_clocks_init(void) { if (soc_is_ar71xx()) @@ -171,8 +118,6 @@ void __init ath79_clocks_init(void) ar724x_clocks_init(); else if (soc_is_ar913x()) ar913x_clocks_init(); - else if (soc_is_ar933x()) - ar933x_clocks_init(); else BUG(); diff --git a/trunk/arch/mips/ath79/common.c b/trunk/arch/mips/ath79/common.c index f0fda982b965..58f60e722a03 100644 --- a/trunk/arch/mips/ath79/common.c +++ b/trunk/arch/mips/ath79/common.c @@ -30,7 +30,6 @@ u32 ath79_ddr_freq; EXPORT_SYMBOL_GPL(ath79_ddr_freq); enum ath79_soc_type ath79_soc; -unsigned int ath79_soc_rev; void __iomem *ath79_pll_base; void __iomem *ath79_reset_base; @@ -65,8 +64,6 @@ void ath79_device_reset_set(u32 mask) reg = AR724X_RESET_REG_RESET_MODULE; else if (soc_is_ar913x()) reg = AR913X_RESET_REG_RESET_MODULE; - else if (soc_is_ar933x()) - reg = AR933X_RESET_REG_RESET_MODULE; else BUG(); @@ -89,8 +86,6 @@ void ath79_device_reset_clear(u32 mask) reg = AR724X_RESET_REG_RESET_MODULE; else if (soc_is_ar913x()) reg = AR913X_RESET_REG_RESET_MODULE; - else if (soc_is_ar933x()) - reg = AR933X_RESET_REG_RESET_MODULE; else BUG(); diff --git a/trunk/arch/mips/ath79/dev-ar913x-wmac.c b/trunk/arch/mips/ath79/dev-ar913x-wmac.c new file mode 100644 index 000000000000..48f425a5ba28 --- /dev/null +++ b/trunk/arch/mips/ath79/dev-ar913x-wmac.c @@ -0,0 +1,60 @@ +/* + * Atheros AR913X SoC built-in WMAC device support + * + * Copyright (C) 2008-2010 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 "dev-ar913x-wmac.h" + +static struct ath9k_platform_data ar913x_wmac_data; + +static struct resource ar913x_wmac_resources[] = { + { + .start = AR913X_WMAC_BASE, + .end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, { + .start = ATH79_CPU_IRQ_IP2, + .end = ATH79_CPU_IRQ_IP2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device ar913x_wmac_device = { + .name = "ath9k", + .id = -1, + .resource = ar913x_wmac_resources, + .num_resources = ARRAY_SIZE(ar913x_wmac_resources), + .dev = { + .platform_data = &ar913x_wmac_data, + }, +}; + +void __init ath79_register_ar913x_wmac(u8 *cal_data) +{ + if (cal_data) + memcpy(ar913x_wmac_data.eeprom_data, cal_data, + sizeof(ar913x_wmac_data.eeprom_data)); + + /* reset the WMAC */ + ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); + mdelay(10); + + ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); + mdelay(10); + + platform_device_register(&ar913x_wmac_device); +} diff --git a/trunk/arch/mips/ath79/dev-usb.h b/trunk/arch/mips/ath79/dev-ar913x-wmac.h similarity index 61% rename from trunk/arch/mips/ath79/dev-usb.h rename to trunk/arch/mips/ath79/dev-ar913x-wmac.h index 4b86a69ca080..579d562bbda8 100644 --- a/trunk/arch/mips/ath79/dev-usb.h +++ b/trunk/arch/mips/ath79/dev-ar913x-wmac.h @@ -1,5 +1,5 @@ /* - * Atheros AR71XX/AR724X/AR913X USB Host Controller support + * Atheros AR913X SoC built-in WMAC device support * * Copyright (C) 2008-2010 Gabor Juhos * Copyright (C) 2008 Imre Kaloz @@ -9,9 +9,9 @@ * by the Free Software Foundation. */ -#ifndef _ATH79_DEV_USB_H -#define _ATH79_DEV_USB_H +#ifndef _ATH79_DEV_AR913X_WMAC_H +#define _ATH79_DEV_AR913X_WMAC_H -void ath79_register_usb(void); +void ath79_register_ar913x_wmac(u8 *cal_data); -#endif /* _ATH79_DEV_USB_H */ +#endif /* _ATH79_DEV_AR913X_WMAC_H */ diff --git a/trunk/arch/mips/ath79/dev-common.c b/trunk/arch/mips/ath79/dev-common.c index f4956f809072..3b82e325bebf 100644 --- a/trunk/arch/mips/ath79/dev-common.c +++ b/trunk/arch/mips/ath79/dev-common.c @@ -20,7 +20,6 @@ #include #include -#include #include "common.h" #include "dev-common.h" @@ -55,30 +54,6 @@ static struct platform_device ath79_uart_device = { }, }; -static struct resource ar933x_uart_resources[] = { - { - .start = AR933X_UART_BASE, - .end = AR933X_UART_BASE + AR71XX_UART_SIZE - 1, - .flags = IORESOURCE_MEM, - }, - { - .start = ATH79_MISC_IRQ_UART, - .end = ATH79_MISC_IRQ_UART, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct ar933x_uart_platform_data ar933x_uart_data; -static struct platform_device ar933x_uart_device = { - .name = "ar933x-uart", - .id = -1, - .resource = ar933x_uart_resources, - .num_resources = ARRAY_SIZE(ar933x_uart_resources), - .dev = { - .platform_data = &ar933x_uart_data, - }, -}; - void __init ath79_register_uart(void) { struct clk *clk; @@ -87,17 +62,8 @@ void __init ath79_register_uart(void) if (IS_ERR(clk)) panic("unable to get UART clock, err=%ld", PTR_ERR(clk)); - if (soc_is_ar71xx() || - soc_is_ar724x() || - soc_is_ar913x()) { - ath79_uart_data[0].uartclk = clk_get_rate(clk); - platform_device_register(&ath79_uart_device); - } else if (soc_is_ar933x()) { - ar933x_uart_data.uartclk = clk_get_rate(clk); - platform_device_register(&ar933x_uart_device); - } else { - BUG(); - } + ath79_uart_data[0].uartclk = clk_get_rate(clk); + platform_device_register(&ath79_uart_device); } static struct platform_device ath79_wdt_device = { diff --git a/trunk/arch/mips/ath79/dev-usb.c b/trunk/arch/mips/ath79/dev-usb.c deleted file mode 100644 index 002d6d2afe04..000000000000 --- a/trunk/arch/mips/ath79/dev-usb.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Atheros AR7XXX/AR9XXX USB Host Controller device - * - * Copyright (C) 2008-2011 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Parts of this file are based on Atheros' 2.6.15 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 "common.h" -#include "dev-usb.h" - -static struct resource ath79_ohci_resources[] = { - [0] = { - /* .start and .end fields are filled dynamically */ - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = ATH79_MISC_IRQ_OHCI, - .end = ATH79_MISC_IRQ_OHCI, - .flags = IORESOURCE_IRQ, - }, -}; - -static u64 ath79_ohci_dmamask = DMA_BIT_MASK(32); -static struct platform_device ath79_ohci_device = { - .name = "ath79-ohci", - .id = -1, - .resource = ath79_ohci_resources, - .num_resources = ARRAY_SIZE(ath79_ohci_resources), - .dev = { - .dma_mask = &ath79_ohci_dmamask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; - -static struct resource ath79_ehci_resources[] = { - [0] = { - /* .start and .end fields are filled dynamically */ - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = ATH79_CPU_IRQ_USB, - .end = ATH79_CPU_IRQ_USB, - .flags = IORESOURCE_IRQ, - }, -}; - -static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32); -static struct platform_device ath79_ehci_device = { - .name = "ath79-ehci", - .id = -1, - .resource = ath79_ehci_resources, - .num_resources = ARRAY_SIZE(ath79_ehci_resources), - .dev = { - .dma_mask = &ath79_ehci_dmamask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; - -#define AR71XX_USB_RESET_MASK (AR71XX_RESET_USB_HOST | \ - AR71XX_RESET_USB_PHY | \ - AR71XX_RESET_USB_OHCI_DLL) - -static void __init ath79_usb_setup(void) -{ - void __iomem *usb_ctrl_base; - - ath79_device_reset_set(AR71XX_USB_RESET_MASK); - mdelay(1000); - ath79_device_reset_clear(AR71XX_USB_RESET_MASK); - - usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE); - - /* Turning on the Buff and Desc swap bits */ - __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG); - - /* WAR for HW bug. Here it adjusts the duration between two SOFS */ - __raw_writel(0x20c00, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ); - - iounmap(usb_ctrl_base); - - mdelay(900); - - ath79_ohci_resources[0].start = AR71XX_OHCI_BASE; - ath79_ohci_resources[0].end = AR71XX_OHCI_BASE + AR71XX_OHCI_SIZE - 1; - platform_device_register(&ath79_ohci_device); - - ath79_ehci_resources[0].start = AR71XX_EHCI_BASE; - ath79_ehci_resources[0].end = AR71XX_EHCI_BASE + AR71XX_EHCI_SIZE - 1; - ath79_ehci_device.name = "ar71xx-ehci"; - platform_device_register(&ath79_ehci_device); -} - -static void __init ar7240_usb_setup(void) -{ - void __iomem *usb_ctrl_base; - - ath79_device_reset_clear(AR7240_RESET_OHCI_DLL); - ath79_device_reset_set(AR7240_RESET_USB_HOST); - - mdelay(1000); - - ath79_device_reset_set(AR7240_RESET_OHCI_DLL); - ath79_device_reset_clear(AR7240_RESET_USB_HOST); - - usb_ctrl_base = ioremap(AR7240_USB_CTRL_BASE, AR7240_USB_CTRL_SIZE); - - /* WAR for HW bug. Here it adjusts the duration between two SOFS */ - __raw_writel(0x3, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ); - - iounmap(usb_ctrl_base); - - ath79_ohci_resources[0].start = AR7240_OHCI_BASE; - ath79_ohci_resources[0].end = AR7240_OHCI_BASE + AR7240_OHCI_SIZE - 1; - platform_device_register(&ath79_ohci_device); -} - -static void __init ar724x_usb_setup(void) -{ - ath79_device_reset_set(AR724X_RESET_USBSUS_OVERRIDE); - mdelay(10); - - ath79_device_reset_clear(AR724X_RESET_USB_HOST); - mdelay(10); - - ath79_device_reset_clear(AR724X_RESET_USB_PHY); - mdelay(10); - - ath79_ehci_resources[0].start = AR724X_EHCI_BASE; - ath79_ehci_resources[0].end = AR724X_EHCI_BASE + AR724X_EHCI_SIZE - 1; - ath79_ehci_device.name = "ar724x-ehci"; - platform_device_register(&ath79_ehci_device); -} - -static void __init ar913x_usb_setup(void) -{ - ath79_device_reset_set(AR913X_RESET_USBSUS_OVERRIDE); - mdelay(10); - - ath79_device_reset_clear(AR913X_RESET_USB_HOST); - mdelay(10); - - ath79_device_reset_clear(AR913X_RESET_USB_PHY); - mdelay(10); - - ath79_ehci_resources[0].start = AR913X_EHCI_BASE; - ath79_ehci_resources[0].end = AR913X_EHCI_BASE + AR913X_EHCI_SIZE - 1; - ath79_ehci_device.name = "ar913x-ehci"; - platform_device_register(&ath79_ehci_device); -} - -static void __init ar933x_usb_setup(void) -{ - ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE); - mdelay(10); - - ath79_device_reset_clear(AR933X_RESET_USB_HOST); - mdelay(10); - - ath79_device_reset_clear(AR933X_RESET_USB_PHY); - mdelay(10); - - ath79_ehci_resources[0].start = AR933X_EHCI_BASE; - ath79_ehci_resources[0].end = AR933X_EHCI_BASE + AR933X_EHCI_SIZE - 1; - ath79_ehci_device.name = "ar933x-ehci"; - platform_device_register(&ath79_ehci_device); -} - -void __init ath79_register_usb(void) -{ - if (soc_is_ar71xx()) - ath79_usb_setup(); - else if (soc_is_ar7240()) - ar7240_usb_setup(); - else if (soc_is_ar7241() || soc_is_ar7242()) - ar724x_usb_setup(); - else if (soc_is_ar913x()) - ar913x_usb_setup(); - else if (soc_is_ar933x()) - ar933x_usb_setup(); - else - BUG(); -} diff --git a/trunk/arch/mips/ath79/dev-wmac.c b/trunk/arch/mips/ath79/dev-wmac.c deleted file mode 100644 index 24f546985b69..000000000000 --- a/trunk/arch/mips/ath79/dev-wmac.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Atheros AR913X/AR933X SoC built-in WMAC device support - * - * 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 "dev-wmac.h" - -static struct ath9k_platform_data ath79_wmac_data; - -static struct resource ath79_wmac_resources[] = { - { - /* .start and .end fields are filled dynamically */ - .flags = IORESOURCE_MEM, - }, { - .start = ATH79_CPU_IRQ_IP2, - .end = ATH79_CPU_IRQ_IP2, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device ath79_wmac_device = { - .name = "ath9k", - .id = -1, - .resource = ath79_wmac_resources, - .num_resources = ARRAY_SIZE(ath79_wmac_resources), - .dev = { - .platform_data = &ath79_wmac_data, - }, -}; - -static void __init ar913x_wmac_setup(void) -{ - /* reset the WMAC */ - ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); - mdelay(10); - - ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); - mdelay(10); - - ath79_wmac_resources[0].start = AR913X_WMAC_BASE; - ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; -} - - -static int ar933x_wmac_reset(void) -{ - ath79_device_reset_clear(AR933X_RESET_WMAC); - ath79_device_reset_set(AR933X_RESET_WMAC); - - return 0; -} - -static int ar933x_r1_get_wmac_revision(void) -{ - return ath79_soc_rev; -} - -static void __init ar933x_wmac_setup(void) -{ - u32 t; - - ar933x_wmac_reset(); - - ath79_wmac_device.name = "ar933x_wmac"; - - ath79_wmac_resources[0].start = AR933X_WMAC_BASE; - ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1; - - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - if (t & AR933X_BOOTSTRAP_REF_CLK_40) - ath79_wmac_data.is_clk_25mhz = false; - else - ath79_wmac_data.is_clk_25mhz = true; - - if (ath79_soc_rev == 1) - ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision; - - ath79_wmac_data.external_reset = ar933x_wmac_reset; -} - -void __init ath79_register_wmac(u8 *cal_data) -{ - if (soc_is_ar913x()) - ar913x_wmac_setup(); - if (soc_is_ar933x()) - ar933x_wmac_setup(); - else - BUG(); - - if (cal_data) - memcpy(ath79_wmac_data.eeprom_data, cal_data, - sizeof(ath79_wmac_data.eeprom_data)); - - platform_device_register(&ath79_wmac_device); -} diff --git a/trunk/arch/mips/ath79/dev-wmac.h b/trunk/arch/mips/ath79/dev-wmac.h deleted file mode 100644 index c9cd8709f090..000000000000 --- a/trunk/arch/mips/ath79/dev-wmac.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Atheros AR913X/AR933X SoC built-in WMAC device support - * - * 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 _ATH79_DEV_WMAC_H -#define _ATH79_DEV_WMAC_H - -void ath79_register_wmac(u8 *cal_data); - -#endif /* _ATH79_DEV_WMAC_H */ diff --git a/trunk/arch/mips/ath79/early_printk.c b/trunk/arch/mips/ath79/early_printk.c index 6a51ced7a293..7499b0e9df26 100644 --- a/trunk/arch/mips/ath79/early_printk.c +++ b/trunk/arch/mips/ath79/early_printk.c @@ -1,7 +1,7 @@ /* - * Atheros AR7XXX/AR9XXX SoC early printk support + * Atheros AR71XX/AR724X/AR913X SoC early printk support * - * Copyright (C) 2008-2011 Gabor Juhos + * Copyright (C) 2008-2010 Gabor Juhos * Copyright (C) 2008 Imre Kaloz * * This program is free software; you can redistribute it and/or modify it @@ -10,85 +10,27 @@ */ #include -#include #include #include -#include #include -#include -static void (*_prom_putchar) (unsigned char); - -static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val) +static inline void prom_wait_thre(void __iomem *base) { - u32 t; + u32 lsr; do { - t = __raw_readl(reg); - if ((t & mask) == val) + lsr = __raw_readl(base + UART_LSR * 4); + if (lsr & UART_LSR_THRE) break; } while (1); } -static void prom_putchar_ar71xx(unsigned char ch) +void prom_putchar(unsigned char ch) { void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE)); - prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); + prom_wait_thre(base); __raw_writel(ch, base + UART_TX * 4); - prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); -} - -static void prom_putchar_ar933x(unsigned char ch) -{ - void __iomem *base = (void __iomem *)(KSEG1ADDR(AR933X_UART_BASE)); - - prom_putchar_wait(base + AR933X_UART_DATA_REG, AR933X_UART_DATA_TX_CSR, - AR933X_UART_DATA_TX_CSR); - __raw_writel(AR933X_UART_DATA_TX_CSR | ch, base + AR933X_UART_DATA_REG); - prom_putchar_wait(base + AR933X_UART_DATA_REG, AR933X_UART_DATA_TX_CSR, - AR933X_UART_DATA_TX_CSR); -} - -static void prom_putchar_dummy(unsigned char ch) -{ - /* nothing to do */ -} - -static void prom_putchar_init(void) -{ - void __iomem *base; - u32 id; - - base = (void __iomem *)(KSEG1ADDR(AR71XX_RESET_BASE)); - id = __raw_readl(base + AR71XX_RESET_REG_REV_ID); - id &= REV_ID_MAJOR_MASK; - - switch (id) { - case REV_ID_MAJOR_AR71XX: - case REV_ID_MAJOR_AR7240: - case REV_ID_MAJOR_AR7241: - case REV_ID_MAJOR_AR7242: - case REV_ID_MAJOR_AR913X: - _prom_putchar = prom_putchar_ar71xx; - break; - - case REV_ID_MAJOR_AR9330: - case REV_ID_MAJOR_AR9331: - _prom_putchar = prom_putchar_ar933x; - break; - - default: - _prom_putchar = prom_putchar_dummy; - break; - } -} - -void prom_putchar(unsigned char ch) -{ - if (!_prom_putchar) - prom_putchar_init(); - - _prom_putchar(ch); + prom_wait_thre(base); } diff --git a/trunk/arch/mips/ath79/gpio.c b/trunk/arch/mips/ath79/gpio.c index a2f8ca630ed6..a0c426b82123 100644 --- a/trunk/arch/mips/ath79/gpio.c +++ b/trunk/arch/mips/ath79/gpio.c @@ -153,8 +153,6 @@ void __init ath79_gpio_init(void) ath79_gpio_count = AR724X_GPIO_COUNT; else if (soc_is_ar913x()) ath79_gpio_count = AR913X_GPIO_COUNT; - else if (soc_is_ar933x()) - ath79_gpio_count = AR933X_GPIO_COUNT; else BUG(); diff --git a/trunk/arch/mips/ath79/irq.c b/trunk/arch/mips/ath79/irq.c index 1b073de44680..ac610d5fe3ba 100644 --- a/trunk/arch/mips/ath79/irq.c +++ b/trunk/arch/mips/ath79/irq.c @@ -46,15 +46,6 @@ static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) else if (pending & MISC_INT_TIMER) generic_handle_irq(ATH79_MISC_IRQ_TIMER); - else if (pending & MISC_INT_TIMER2) - generic_handle_irq(ATH79_MISC_IRQ_TIMER2); - - else if (pending & MISC_INT_TIMER3) - generic_handle_irq(ATH79_MISC_IRQ_TIMER3); - - else if (pending & MISC_INT_TIMER4) - generic_handle_irq(ATH79_MISC_IRQ_TIMER4); - else if (pending & MISC_INT_OHCI) generic_handle_irq(ATH79_MISC_IRQ_OHCI); @@ -67,9 +58,6 @@ static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) else if (pending & MISC_INT_WDOG) generic_handle_irq(ATH79_MISC_IRQ_WDOG); - else if (pending & MISC_INT_ETHSW) - generic_handle_irq(ATH79_MISC_IRQ_ETHSW); - else spurious_interrupt(); } @@ -129,7 +117,7 @@ static void __init ath79_misc_irq_init(void) if (soc_is_ar71xx() || soc_is_ar913x()) ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; - else if (soc_is_ar724x() || soc_is_ar933x()) + else if (soc_is_ar724x()) ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; else BUG(); @@ -186,9 +174,6 @@ void __init arch_init_irq(void) } else if (soc_is_ar913x()) { ath79_ip2_flush_reg = AR913X_DDR_REG_FLUSH_WMAC; ath79_ip3_flush_reg = AR913X_DDR_REG_FLUSH_USB; - } else if (soc_is_ar933x()) { - ath79_ip2_flush_reg = AR933X_DDR_REG_FLUSH_WMAC; - ath79_ip3_flush_reg = AR933X_DDR_REG_FLUSH_USB; } else BUG(); diff --git a/trunk/arch/mips/ath79/mach-ap121.c b/trunk/arch/mips/ath79/mach-ap121.c deleted file mode 100644 index 4c20200d7c72..000000000000 --- a/trunk/arch/mips/ath79/mach-ap121.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Atheros AP121 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 "machtypes.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define AP121_GPIO_LED_WLAN 0 -#define AP121_GPIO_LED_USB 1 - -#define AP121_GPIO_BTN_JUMPSTART 11 -#define AP121_GPIO_BTN_RESET 12 - -#define AP121_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL) - -#define AP121_CAL_DATA_ADDR 0x1fff1000 - -static struct gpio_led ap121_leds_gpio[] __initdata = { - { - .name = "ap121:green:usb", - .gpio = AP121_GPIO_LED_USB, - .active_low = 0, - }, - { - .name = "ap121:green:wlan", - .gpio = AP121_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ap121_gpio_keys[] __initdata = { - { - .desc = "jumpstart button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP121_GPIO_BTN_JUMPSTART, - .active_low = 1, - }, - { - .desc = "reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP121_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct spi_board_info ap121_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "mx25l1606e", - } -}; - -static struct ath79_spi_platform_data ap121_spi_data = { - .bus_num = 0, - .num_chipselect = 1, -}; - -static void __init ap121_setup(void) -{ - u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio), - ap121_leds_gpio); - ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap121_gpio_keys), - ap121_gpio_keys); - - ath79_register_spi(&ap121_spi_data, ap121_spi_info, - ARRAY_SIZE(ap121_spi_info)); - ath79_register_usb(); - ath79_register_wmac(cal_data); -} - -MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board", - ap121_setup); diff --git a/trunk/arch/mips/ath79/mach-ap81.c b/trunk/arch/mips/ath79/mach-ap81.c index abe19836331c..eee4c121deb4 100644 --- a/trunk/arch/mips/ath79/mach-ap81.c +++ b/trunk/arch/mips/ath79/mach-ap81.c @@ -10,11 +10,10 @@ */ #include "machtypes.h" -#include "dev-wmac.h" +#include "dev-ar913x-wmac.h" #include "dev-gpio-buttons.h" #include "dev-leds-gpio.h" #include "dev-spi.h" -#include "dev-usb.h" #define AP81_GPIO_LED_STATUS 1 #define AP81_GPIO_LED_AOSS 3 @@ -92,8 +91,7 @@ static void __init ap81_setup(void) ap81_gpio_keys); ath79_register_spi(&ap81_spi_data, ap81_spi_info, ARRAY_SIZE(ap81_spi_info)); - ath79_register_wmac(cal_data); - ath79_register_usb(); + ath79_register_ar913x_wmac(cal_data); } MIPS_MACHINE(ATH79_MACH_AP81, "AP81", "Atheros AP81 reference board", diff --git a/trunk/arch/mips/ath79/mach-pb44.c b/trunk/arch/mips/ath79/mach-pb44.c index fe9701a32291..ec7b7a135d53 100644 --- a/trunk/arch/mips/ath79/mach-pb44.c +++ b/trunk/arch/mips/ath79/mach-pb44.c @@ -18,7 +18,6 @@ #include "dev-gpio-buttons.h" #include "dev-leds-gpio.h" #include "dev-spi.h" -#include "dev-usb.h" #define PB44_GPIO_I2C_SCL 0 #define PB44_GPIO_I2C_SDA 1 @@ -113,7 +112,6 @@ static void __init pb44_init(void) pb44_gpio_keys); ath79_register_spi(&pb44_spi_data, pb44_spi_info, ARRAY_SIZE(pb44_spi_info)); - ath79_register_usb(); } MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board", diff --git a/trunk/arch/mips/ath79/mach-ubnt-xm.c b/trunk/arch/mips/ath79/mach-ubnt-xm.c deleted file mode 100644 index 3c311a539347..000000000000 --- a/trunk/arch/mips/ath79/mach-ubnt-xm.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Ubiquiti Networks XM (rev 1.0) board support - * - * Copyright (C) 2011 René Bolldorf - * - * Derived from: mach-pb44.c - * - * 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 - -#ifdef CONFIG_PCI -#include -#include -#endif /* CONFIG_PCI */ - -#include "machtypes.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" - -#define UBNT_XM_GPIO_LED_L1 0 -#define UBNT_XM_GPIO_LED_L2 1 -#define UBNT_XM_GPIO_LED_L3 11 -#define UBNT_XM_GPIO_LED_L4 7 - -#define UBNT_XM_GPIO_BTN_RESET 12 - -#define UBNT_XM_KEYS_POLL_INTERVAL 20 -#define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) - -#define UBNT_XM_PCI_IRQ 48 -#define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000) - -static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { - { - .name = "ubnt-xm:red:link1", - .gpio = UBNT_XM_GPIO_LED_L1, - .active_low = 0, - }, { - .name = "ubnt-xm:orange:link2", - .gpio = UBNT_XM_GPIO_LED_L2, - .active_low = 0, - }, { - .name = "ubnt-xm:green:link3", - .gpio = UBNT_XM_GPIO_LED_L3, - .active_low = 0, - }, { - .name = "ubnt-xm:green:link4", - .gpio = UBNT_XM_GPIO_LED_L4, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, - .gpio = UBNT_XM_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct spi_board_info ubnt_xm_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "mx25l6405d", - } -}; - -static struct ath79_spi_platform_data ubnt_xm_spi_data = { - .bus_num = 0, - .num_chipselect = 1, -}; - -#ifdef CONFIG_PCI -static struct ath9k_platform_data ubnt_xm_eeprom_data; - -static struct ath724x_pci_data ubnt_xm_pci_data[] = { - { - .irq = UBNT_XM_PCI_IRQ, - .pdata = &ubnt_xm_eeprom_data, - }, -}; -#endif /* CONFIG_PCI */ - -static void __init ubnt_xm_init(void) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio), - ubnt_xm_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); - - ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info, - ARRAY_SIZE(ubnt_xm_spi_info)); - -#ifdef CONFIG_PCI - memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, - sizeof(ubnt_xm_eeprom_data.eeprom_data)); - - ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data)); -#endif /* CONFIG_PCI */ - -} - -MIPS_MACHINE(ATH79_MACH_UBNT_XM, - "UBNT-XM", - "Ubiquiti Networks XM (rev 1.0) board", - ubnt_xm_init); diff --git a/trunk/arch/mips/ath79/machtypes.h b/trunk/arch/mips/ath79/machtypes.h index 9a1f3826626e..3940fe470b2d 100644 --- a/trunk/arch/mips/ath79/machtypes.h +++ b/trunk/arch/mips/ath79/machtypes.h @@ -16,10 +16,8 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, - ATH79_MACH_AP121, /* Atheros AP121 reference board */ ATH79_MACH_AP81, /* Atheros AP81 reference board */ ATH79_MACH_PB44, /* Atheros PB44 reference board */ - ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ }; #endif /* _ATH79_MACHTYPE_H */ diff --git a/trunk/arch/mips/ath79/setup.c b/trunk/arch/mips/ath79/setup.c index 61bf3397251a..159b42f106b0 100644 --- a/trunk/arch/mips/ath79/setup.c +++ b/trunk/arch/mips/ath79/setup.c @@ -101,31 +101,19 @@ static void __init ath79_detect_sys_type(void) case REV_ID_MAJOR_AR7240: ath79_soc = ATH79_SOC_AR7240; chip = "7240"; - rev = id & AR724X_REV_ID_REVISION_MASK; + rev = (id & AR724X_REV_ID_REVISION_MASK); break; case REV_ID_MAJOR_AR7241: ath79_soc = ATH79_SOC_AR7241; chip = "7241"; - rev = id & AR724X_REV_ID_REVISION_MASK; + rev = (id & AR724X_REV_ID_REVISION_MASK); break; case REV_ID_MAJOR_AR7242: ath79_soc = ATH79_SOC_AR7242; chip = "7242"; - rev = id & AR724X_REV_ID_REVISION_MASK; - break; - - case REV_ID_MAJOR_AR9330: - ath79_soc = ATH79_SOC_AR9330; - chip = "9330"; - rev = id & AR933X_REV_ID_REVISION_MASK; - break; - - case REV_ID_MAJOR_AR9331: - ath79_soc = ATH79_SOC_AR9331; - chip = "9331"; - rev = id & AR933X_REV_ID_REVISION_MASK; + rev = (id & AR724X_REV_ID_REVISION_MASK); break; case REV_ID_MAJOR_AR913X: @@ -149,8 +137,6 @@ static void __init ath79_detect_sys_type(void) panic("ath79: unknown SoC, id:0x%08x\n", id); } - ath79_soc_rev = rev; - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); pr_info("SoC: %s\n", ath79_sys_type); } diff --git a/trunk/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/trunk/arch/mips/include/asm/mach-ath79/ar71xx_regs.h index 2f0becb4ec8f..cda1c8070b27 100644 --- a/trunk/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/trunk/arch/mips/include/asm/mach-ath79/ar71xx_regs.h @@ -20,10 +20,6 @@ #include #define AR71XX_APB_BASE 0x18000000 -#define AR71XX_EHCI_BASE 0x1b000000 -#define AR71XX_EHCI_SIZE 0x1000 -#define AR71XX_OHCI_BASE 0x1c000000 -#define AR71XX_OHCI_SIZE 0x1000 #define AR71XX_SPI_BASE 0x1f000000 #define AR71XX_SPI_SIZE 0x01000000 @@ -31,8 +27,6 @@ #define AR71XX_DDR_CTRL_SIZE 0x100 #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000) #define AR71XX_UART_SIZE 0x100 -#define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000) -#define AR71XX_USB_CTRL_SIZE 0x100 #define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000) #define AR71XX_GPIO_SIZE 0x100 #define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000) @@ -40,26 +34,9 @@ #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) #define AR71XX_RESET_SIZE 0x100 -#define AR7240_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000) -#define AR7240_USB_CTRL_SIZE 0x100 -#define AR7240_OHCI_BASE 0x1b000000 -#define AR7240_OHCI_SIZE 0x1000 - -#define AR724X_EHCI_BASE 0x1b000000 -#define AR724X_EHCI_SIZE 0x1000 - -#define AR913X_EHCI_BASE 0x1b000000 -#define AR913X_EHCI_SIZE 0x1000 #define AR913X_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000) #define AR913X_WMAC_SIZE 0x30000 -#define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000) -#define AR933X_UART_SIZE 0x14 -#define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -#define AR933X_WMAC_SIZE 0x20000 -#define AR933X_EHCI_BASE 0x1b000000 -#define AR933X_EHCI_SIZE 0x1000 - /* * DDR_CTRL block */ @@ -86,11 +63,6 @@ #define AR913X_DDR_REG_FLUSH_USB 0x84 #define AR913X_DDR_REG_FLUSH_WMAC 0x88 -#define AR933X_DDR_REG_FLUSH_GE0 0x7c -#define AR933X_DDR_REG_FLUSH_GE1 0x80 -#define AR933X_DDR_REG_FLUSH_USB 0x84 -#define AR933X_DDR_REG_FLUSH_WMAC 0x88 - /* * PLL block */ @@ -132,30 +104,6 @@ #define AR913X_AHB_DIV_SHIFT 19 #define AR913X_AHB_DIV_MASK 0x1 -#define AR933X_PLL_CPU_CONFIG_REG 0x00 -#define AR933X_PLL_CLOCK_CTRL_REG 0x08 - -#define AR933X_PLL_CPU_CONFIG_NINT_SHIFT 10 -#define AR933X_PLL_CPU_CONFIG_NINT_MASK 0x3f -#define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT 16 -#define AR933X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -#define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT 23 -#define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 - -#define AR933X_PLL_CLOCK_CTRL_BYPASS BIT(2) -#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT 5 -#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK 0x3 -#define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT 10 -#define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK 0x3 -#define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT 15 -#define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK 0x7 - -/* - * USB_CONFIG block - */ -#define AR71XX_USB_CTRL_REG_FLADJ 0x00 -#define AR71XX_USB_CTRL_REG_CONFIG 0x04 - /* * RESET block */ @@ -182,13 +130,6 @@ #define AR724X_RESET_REG_RESET_MODULE 0x1c -#define AR933X_RESET_REG_RESET_MODULE 0x1c -#define AR933X_RESET_REG_BOOTSTRAP 0xac - -#define MISC_INT_ETHSW BIT(12) -#define MISC_INT_TIMER4 BIT(10) -#define MISC_INT_TIMER3 BIT(9) -#define MISC_INT_TIMER2 BIT(8) #define MISC_INT_DMA BIT(7) #define MISC_INT_OHCI BIT(6) #define MISC_INT_PERFC BIT(5) @@ -217,29 +158,14 @@ #define AR71XX_RESET_PCI_BUS BIT(1) #define AR71XX_RESET_PCI_CORE BIT(0) -#define AR7240_RESET_USB_HOST BIT(5) -#define AR7240_RESET_OHCI_DLL BIT(3) - #define AR724X_RESET_GE1_MDIO BIT(23) #define AR724X_RESET_GE0_MDIO BIT(22) #define AR724X_RESET_PCIE_PHY_SERIAL BIT(10) #define AR724X_RESET_PCIE_PHY BIT(7) #define AR724X_RESET_PCIE BIT(6) -#define AR724X_RESET_USB_HOST BIT(5) -#define AR724X_RESET_USB_PHY BIT(4) -#define AR724X_RESET_USBSUS_OVERRIDE BIT(3) +#define AR724X_RESET_OHCI_DLL BIT(3) #define AR913X_RESET_AMBA2WMAC BIT(22) -#define AR913X_RESET_USBSUS_OVERRIDE BIT(10) -#define AR913X_RESET_USB_HOST BIT(5) -#define AR913X_RESET_USB_PHY BIT(4) - -#define AR933X_RESET_WMAC BIT(11) -#define AR933X_RESET_USB_HOST BIT(5) -#define AR933X_RESET_USB_PHY BIT(4) -#define AR933X_RESET_USBSUS_OVERRIDE BIT(3) - -#define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) #define REV_ID_MAJOR_MASK 0xfff0 #define REV_ID_MAJOR_AR71XX 0x00a0 @@ -247,8 +173,6 @@ #define REV_ID_MAJOR_AR7240 0x00c0 #define REV_ID_MAJOR_AR7241 0x0100 #define REV_ID_MAJOR_AR7242 0x1100 -#define REV_ID_MAJOR_AR9330 0x0110 -#define REV_ID_MAJOR_AR9331 0x1110 #define AR71XX_REV_ID_MINOR_MASK 0x3 #define AR71XX_REV_ID_MINOR_AR7130 0x0 @@ -263,8 +187,6 @@ #define AR913X_REV_ID_REVISION_MASK 0x3 #define AR913X_REV_ID_REVISION_SHIFT 2 -#define AR933X_REV_ID_REVISION_MASK 0x3 - #define AR724X_REV_ID_REVISION_MASK 0x3 /* @@ -307,6 +229,5 @@ #define AR71XX_GPIO_COUNT 16 #define AR724X_GPIO_COUNT 18 #define AR913X_GPIO_COUNT 22 -#define AR933X_GPIO_COUNT 30 #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/trunk/arch/mips/include/asm/mach-ath79/ar933x_uart.h b/trunk/arch/mips/include/asm/mach-ath79/ar933x_uart.h deleted file mode 100644 index 52730555937f..000000000000 --- a/trunk/arch/mips/include/asm/mach-ath79/ar933x_uart.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Atheros AR933X UART 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 __AR933X_UART_H -#define __AR933X_UART_H - -#define AR933X_UART_REGS_SIZE 20 -#define AR933X_UART_FIFO_SIZE 16 - -#define AR933X_UART_DATA_REG 0x00 -#define AR933X_UART_CS_REG 0x04 -#define AR933X_UART_CLOCK_REG 0x08 -#define AR933X_UART_INT_REG 0x0c -#define AR933X_UART_INT_EN_REG 0x10 - -#define AR933X_UART_DATA_TX_RX_MASK 0xff -#define AR933X_UART_DATA_RX_CSR BIT(8) -#define AR933X_UART_DATA_TX_CSR BIT(9) - -#define AR933X_UART_CS_PARITY_S 0 -#define AR933X_UART_CS_PARITY_M 0x3 -#define AR933X_UART_CS_PARITY_NONE 0 -#define AR933X_UART_CS_PARITY_ODD 1 -#define AR933X_UART_CS_PARITY_EVEN 2 -#define AR933X_UART_CS_IF_MODE_S 2 -#define AR933X_UART_CS_IF_MODE_M 0x3 -#define AR933X_UART_CS_IF_MODE_NONE 0 -#define AR933X_UART_CS_IF_MODE_DTE 1 -#define AR933X_UART_CS_IF_MODE_DCE 2 -#define AR933X_UART_CS_FLOW_CTRL_S 4 -#define AR933X_UART_CS_FLOW_CTRL_M 0x3 -#define AR933X_UART_CS_DMA_EN BIT(6) -#define AR933X_UART_CS_TX_READY_ORIDE BIT(7) -#define AR933X_UART_CS_RX_READY_ORIDE BIT(8) -#define AR933X_UART_CS_TX_READY BIT(9) -#define AR933X_UART_CS_RX_BREAK BIT(10) -#define AR933X_UART_CS_TX_BREAK BIT(11) -#define AR933X_UART_CS_HOST_INT BIT(12) -#define AR933X_UART_CS_HOST_INT_EN BIT(13) -#define AR933X_UART_CS_TX_BUSY BIT(14) -#define AR933X_UART_CS_RX_BUSY BIT(15) - -#define AR933X_UART_CLOCK_STEP_M 0xffff -#define AR933X_UART_CLOCK_SCALE_M 0xfff -#define AR933X_UART_CLOCK_SCALE_S 16 -#define AR933X_UART_CLOCK_STEP_M 0xffff - -#define AR933X_UART_INT_RX_VALID BIT(0) -#define AR933X_UART_INT_TX_READY BIT(1) -#define AR933X_UART_INT_RX_FRAMING_ERR BIT(2) -#define AR933X_UART_INT_RX_OFLOW_ERR BIT(3) -#define AR933X_UART_INT_TX_OFLOW_ERR BIT(4) -#define AR933X_UART_INT_RX_PARITY_ERR BIT(5) -#define AR933X_UART_INT_RX_BREAK_ON BIT(6) -#define AR933X_UART_INT_RX_BREAK_OFF BIT(7) -#define AR933X_UART_INT_RX_FULL BIT(8) -#define AR933X_UART_INT_TX_EMPTY BIT(9) -#define AR933X_UART_INT_ALLINTS 0x3ff - -#endif /* __AR933X_UART_H */ diff --git a/trunk/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h b/trunk/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h deleted file mode 100644 index 6cb30f2b7198..000000000000 --- a/trunk/arch/mips/include/asm/mach-ath79/ar933x_uart_platform.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Platform data definition for Atheros AR933X UART - * - * 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 _AR933X_UART_PLATFORM_H -#define _AR933X_UART_PLATFORM_H - -struct ar933x_uart_platform_data { - unsigned uartclk; -}; - -#endif /* _AR933X_UART_PLATFORM_H */ diff --git a/trunk/arch/mips/include/asm/mach-ath79/ath79.h b/trunk/arch/mips/include/asm/mach-ath79/ath79.h index 6d0c6c9d5622..6a9f168506fe 100644 --- a/trunk/arch/mips/include/asm/mach-ath79/ath79.h +++ b/trunk/arch/mips/include/asm/mach-ath79/ath79.h @@ -26,13 +26,10 @@ enum ath79_soc_type { ATH79_SOC_AR7241, ATH79_SOC_AR7242, ATH79_SOC_AR9130, - ATH79_SOC_AR9132, - ATH79_SOC_AR9330, - ATH79_SOC_AR9331, + ATH79_SOC_AR9132 }; extern enum ath79_soc_type ath79_soc; -extern unsigned int ath79_soc_rev; static inline int soc_is_ar71xx(void) { @@ -69,12 +66,6 @@ static inline int soc_is_ar913x(void) ath79_soc == ATH79_SOC_AR9132); } -static inline int soc_is_ar933x(void) -{ - return (ath79_soc == ATH79_SOC_AR9330 || - ath79_soc == ATH79_SOC_AR9331); -} - extern void __iomem *ath79_ddr_base; extern void __iomem *ath79_pll_base; extern void __iomem *ath79_reset_base; diff --git a/trunk/arch/mips/include/asm/mach-ath79/irq.h b/trunk/arch/mips/include/asm/mach-ath79/irq.h index 519958fe4e3c..189bc6eb9c10 100644 --- a/trunk/arch/mips/include/asm/mach-ath79/irq.h +++ b/trunk/arch/mips/include/asm/mach-ath79/irq.h @@ -10,10 +10,10 @@ #define __ASM_MACH_ATH79_IRQ_H #define MIPS_CPU_IRQ_BASE 0 -#define NR_IRQS 40 +#define NR_IRQS 16 #define ATH79_MISC_IRQ_BASE 8 -#define ATH79_MISC_IRQ_COUNT 32 +#define ATH79_MISC_IRQ_COUNT 8 #define ATH79_CPU_IRQ_IP2 (MIPS_CPU_IRQ_BASE + 2) #define ATH79_CPU_IRQ_USB (MIPS_CPU_IRQ_BASE + 3) @@ -30,10 +30,6 @@ #define ATH79_MISC_IRQ_PERFC (ATH79_MISC_IRQ_BASE + 5) #define ATH79_MISC_IRQ_OHCI (ATH79_MISC_IRQ_BASE + 6) #define ATH79_MISC_IRQ_DMA (ATH79_MISC_IRQ_BASE + 7) -#define ATH79_MISC_IRQ_TIMER2 (ATH79_MISC_IRQ_BASE + 8) -#define ATH79_MISC_IRQ_TIMER3 (ATH79_MISC_IRQ_BASE + 9) -#define ATH79_MISC_IRQ_TIMER4 (ATH79_MISC_IRQ_BASE + 10) -#define ATH79_MISC_IRQ_ETHSW (ATH79_MISC_IRQ_BASE + 12) #include_next diff --git a/trunk/arch/mips/include/asm/mach-ath79/pci-ath724x.h b/trunk/arch/mips/include/asm/mach-ath79/pci-ath724x.h deleted file mode 100644 index 454885fa30c3..000000000000 --- a/trunk/arch/mips/include/asm/mach-ath79/pci-ath724x.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Atheros 724x PCI support - * - * Copyright (C) 2011 René Bolldorf - * - * 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_ATH79_PCI_ATH724X_H -#define __ASM_MACH_ATH79_PCI_ATH724X_H - -struct ath724x_pci_data { - int irq; - void *pdata; -}; - -void ath724x_pci_add_data(struct ath724x_pci_data *data, int size); - -#endif /* __ASM_MACH_ATH79_PCI_ATH724X_H */ diff --git a/trunk/arch/mips/include/asm/mach-bcm63xx/ioremap.h b/trunk/arch/mips/include/asm/mach-bcm63xx/ioremap.h new file mode 100644 index 000000000000..e3fe04dc50bd --- /dev/null +++ b/trunk/arch/mips/include/asm/mach-bcm63xx/ioremap.h @@ -0,0 +1,38 @@ +#ifndef BCM63XX_IOREMAP_H_ +#define BCM63XX_IOREMAP_H_ + +#include + +static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size) +{ + return phys_addr; +} + +static inline int is_bcm63xx_internal_registers(phys_t offset) +{ + switch (bcm63xx_get_cpu_id()) { + case BCM6338_CPU_ID: + case BCM6345_CPU_ID: + case BCM6348_CPU_ID: + case BCM6358_CPU_ID: + if (offset >= 0xfff00000) + return 1; + break; + } + return 0; +} + +static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size, + unsigned long flags) +{ + if (is_bcm63xx_internal_registers(offset)) + return (void __iomem *)offset; + return NULL; +} + +static inline int plat_iounmap(const volatile void __iomem *addr) +{ + return is_bcm63xx_internal_registers((unsigned long)addr); +} + +#endif /* BCM63XX_IOREMAP_H_ */ diff --git a/trunk/arch/mips/pci/Makefile b/trunk/arch/mips/pci/Makefile index 19cfe044e7dc..bb82cbdbc62a 100644 --- a/trunk/arch/mips/pci/Makefile +++ b/trunk/arch/mips/pci/Makefile @@ -19,7 +19,6 @@ obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ ops-bcm63xx.o obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o -obj-$(CONFIG_SOC_AR724X) += pci-ath724x.o # # These are still pretty much in the old state, watch, go blind. diff --git a/trunk/arch/mips/pci/pci-ath724x.c b/trunk/arch/mips/pci/pci-ath724x.c deleted file mode 100644 index a4dd24a4130b..000000000000 --- a/trunk/arch/mips/pci/pci-ath724x.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Atheros 724x PCI support - * - * Copyright (C) 2011 René Bolldorf - * - * 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 - -#define reg_read(_phys) (*(unsigned int *) KSEG1ADDR(_phys)) -#define reg_write(_phys, _val) ((*(unsigned int *) KSEG1ADDR(_phys)) = (_val)) - -#define ATH724X_PCI_DEV_BASE 0x14000000 -#define ATH724X_PCI_MEM_BASE 0x10000000 -#define ATH724X_PCI_MEM_SIZE 0x08000000 - -static DEFINE_SPINLOCK(ath724x_pci_lock); -static struct ath724x_pci_data *pci_data; -static int pci_data_size; - -static int ath724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, - int size, uint32_t *value) -{ - unsigned long flags, addr, tval, mask; - - if (devfn) - return PCIBIOS_DEVICE_NOT_FOUND; - - if (where & (size - 1)) - return PCIBIOS_BAD_REGISTER_NUMBER; - - spin_lock_irqsave(&ath724x_pci_lock, flags); - - switch (size) { - case 1: - addr = where & ~3; - mask = 0xff000000 >> ((where % 4) * 8); - tval = reg_read(ATH724X_PCI_DEV_BASE + addr); - tval = tval & ~mask; - *value = (tval >> ((4 - (where % 4))*8)); - break; - case 2: - addr = where & ~3; - mask = 0xffff0000 >> ((where % 4)*8); - tval = reg_read(ATH724X_PCI_DEV_BASE + addr); - tval = tval & ~mask; - *value = (tval >> ((4 - (where % 4))*8)); - break; - case 4: - *value = reg_read(ATH724X_PCI_DEV_BASE + where); - break; - default: - spin_unlock_irqrestore(&ath724x_pci_lock, flags); - - return PCIBIOS_BAD_REGISTER_NUMBER; - } - - spin_unlock_irqrestore(&ath724x_pci_lock, flags); - - return PCIBIOS_SUCCESSFUL; -} - -static int ath724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, - int size, uint32_t value) -{ - unsigned long flags, tval, addr, mask; - - if (devfn) - return PCIBIOS_DEVICE_NOT_FOUND; - - if (where & (size - 1)) - return PCIBIOS_BAD_REGISTER_NUMBER; - - spin_lock_irqsave(&ath724x_pci_lock, flags); - - switch (size) { - case 1: - addr = (ATH724X_PCI_DEV_BASE + where) & ~3; - mask = 0xff000000 >> ((where % 4)*8); - tval = reg_read(addr); - tval = tval & ~mask; - tval |= (value << ((4 - (where % 4))*8)) & mask; - reg_write(addr, tval); - break; - case 2: - addr = (ATH724X_PCI_DEV_BASE + where) & ~3; - mask = 0xffff0000 >> ((where % 4)*8); - tval = reg_read(addr); - tval = tval & ~mask; - tval |= (value << ((4 - (where % 4))*8)) & mask; - reg_write(addr, tval); - break; - case 4: - reg_write((ATH724X_PCI_DEV_BASE + where), value); - break; - default: - spin_unlock_irqrestore(&ath724x_pci_lock, flags); - - return PCIBIOS_BAD_REGISTER_NUMBER; - } - - spin_unlock_irqrestore(&ath724x_pci_lock, flags); - - return PCIBIOS_SUCCESSFUL; -} - -static struct pci_ops ath724x_pci_ops = { - .read = ath724x_pci_read, - .write = ath724x_pci_write, -}; - -static struct resource ath724x_io_resource = { - .name = "PCI IO space", - .start = 0, - .end = 0, - .flags = IORESOURCE_IO, -}; - -static struct resource ath724x_mem_resource = { - .name = "PCI memory space", - .start = ATH724X_PCI_MEM_BASE, - .end = ATH724X_PCI_MEM_BASE + ATH724X_PCI_MEM_SIZE - 1, - .flags = IORESOURCE_MEM, -}; - -static struct pci_controller ath724x_pci_controller = { - .pci_ops = &ath724x_pci_ops, - .io_resource = &ath724x_io_resource, - .mem_resource = &ath724x_mem_resource, -}; - -void ath724x_pci_add_data(struct ath724x_pci_data *data, int size) -{ - pci_data = data; - pci_data_size = size; -} - -int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) -{ - unsigned int devfn = dev->devfn; - int irq = -1; - - if (devfn > pci_data_size - 1) - return irq; - - irq = pci_data[devfn].irq; - - return irq; -} - -int pcibios_plat_dev_init(struct pci_dev *dev) -{ - unsigned int devfn = dev->devfn; - - if (devfn > pci_data_size - 1) - return PCIBIOS_DEVICE_NOT_FOUND; - - dev->dev.platform_data = pci_data[devfn].pdata; - - return PCIBIOS_SUCCESSFUL; -} - -static int __init ath724x_pcibios_init(void) -{ - register_pci_controller(&ath724x_pci_controller); - - return PCIBIOS_SUCCESSFUL; -} - -arch_initcall(ath724x_pcibios_init); diff --git a/trunk/drivers/tty/serial/Kconfig b/trunk/drivers/tty/serial/Kconfig index 95a0f5fe7d42..925a1e547a83 100644 --- a/trunk/drivers/tty/serial/Kconfig +++ b/trunk/drivers/tty/serial/Kconfig @@ -1610,27 +1610,4 @@ config SERIAL_XILINX_PS_UART_CONSOLE help Enable a Xilinx PS UART port to be the system console. -config SERIAL_AR933X - bool "AR933X serial port support" - depends on SOC_AR933X - select SERIAL_CORE - help - If you have an Atheros AR933X SOC based board and want to use the - built-in UART of the SoC, say Y to this option. - -config SERIAL_AR933X_CONSOLE - bool "Console on AR933X serial port" - depends on SERIAL_AR933X=y - select SERIAL_CORE_CONSOLE - help - Enable a built-in UART port of the AR933X to be the system console. - -config SERIAL_AR933X_NR_UARTS - int "Maximum number of AR933X serial ports" - depends on SERIAL_AR933X - default "2" - help - Set this to the number of serial ports you want the driver - to support. - endmenu diff --git a/trunk/drivers/tty/serial/Makefile b/trunk/drivers/tty/serial/Makefile index 76811cc58591..e10cf5b54b6d 100644 --- a/trunk/drivers/tty/serial/Makefile +++ b/trunk/drivers/tty/serial/Makefile @@ -94,4 +94,3 @@ obj-$(CONFIG_SERIAL_MSM_SMD) += msm_smd_tty.o obj-$(CONFIG_SERIAL_MXS_AUART) += mxs-auart.o obj-$(CONFIG_SERIAL_LANTIQ) += lantiq.o obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o -obj-$(CONFIG_SERIAL_AR933X) += ar933x_uart.o diff --git a/trunk/drivers/tty/serial/ar933x_uart.c b/trunk/drivers/tty/serial/ar933x_uart.c deleted file mode 100644 index e4f60e2b87f3..000000000000 --- a/trunk/drivers/tty/serial/ar933x_uart.c +++ /dev/null @@ -1,688 +0,0 @@ -/* - * Atheros AR933X SoC built-in UART driver - * - * Copyright (C) 2011 Gabor Juhos - * - * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. - * - * 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 -#include - -#include -#include - -#define DRIVER_NAME "ar933x-uart" - -#define AR933X_DUMMY_STATUS_RD 0x01 - -static struct uart_driver ar933x_uart_driver; - -struct ar933x_uart_port { - struct uart_port port; - unsigned int ier; /* shadow Interrupt Enable Register */ -}; - -static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up, - int offset) -{ - return readl(up->port.membase + offset); -} - -static inline void ar933x_uart_write(struct ar933x_uart_port *up, - int offset, unsigned int value) -{ - writel(value, up->port.membase + offset); -} - -static inline void ar933x_uart_rmw(struct ar933x_uart_port *up, - unsigned int offset, - unsigned int mask, - unsigned int val) -{ - unsigned int t; - - t = ar933x_uart_read(up, offset); - t &= ~mask; - t |= val; - ar933x_uart_write(up, offset, t); -} - -static inline void ar933x_uart_rmw_set(struct ar933x_uart_port *up, - unsigned int offset, - unsigned int val) -{ - ar933x_uart_rmw(up, offset, 0, val); -} - -static inline void ar933x_uart_rmw_clear(struct ar933x_uart_port *up, - unsigned int offset, - unsigned int val) -{ - ar933x_uart_rmw(up, offset, val, 0); -} - -static inline void ar933x_uart_start_tx_interrupt(struct ar933x_uart_port *up) -{ - up->ier |= AR933X_UART_INT_TX_EMPTY; - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier); -} - -static inline void ar933x_uart_stop_tx_interrupt(struct ar933x_uart_port *up) -{ - up->ier &= ~AR933X_UART_INT_TX_EMPTY; - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier); -} - -static inline void ar933x_uart_putc(struct ar933x_uart_port *up, int ch) -{ - unsigned int rdata; - - rdata = ch & AR933X_UART_DATA_TX_RX_MASK; - rdata |= AR933X_UART_DATA_TX_CSR; - ar933x_uart_write(up, AR933X_UART_DATA_REG, rdata); -} - -static unsigned int ar933x_uart_tx_empty(struct uart_port *port) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - unsigned long flags; - unsigned int rdata; - - spin_lock_irqsave(&up->port.lock, flags); - rdata = ar933x_uart_read(up, AR933X_UART_DATA_REG); - spin_unlock_irqrestore(&up->port.lock, flags); - - return (rdata & AR933X_UART_DATA_TX_CSR) ? 0 : TIOCSER_TEMT; -} - -static unsigned int ar933x_uart_get_mctrl(struct uart_port *port) -{ - return TIOCM_CAR; -} - -static void ar933x_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) -{ -} - -static void ar933x_uart_start_tx(struct uart_port *port) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - - ar933x_uart_start_tx_interrupt(up); -} - -static void ar933x_uart_stop_tx(struct uart_port *port) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - - ar933x_uart_stop_tx_interrupt(up); -} - -static void ar933x_uart_stop_rx(struct uart_port *port) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - - up->ier &= ~AR933X_UART_INT_RX_VALID; - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier); -} - -static void ar933x_uart_break_ctl(struct uart_port *port, int break_state) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - unsigned long flags; - - spin_lock_irqsave(&up->port.lock, flags); - if (break_state == -1) - ar933x_uart_rmw_set(up, AR933X_UART_CS_REG, - AR933X_UART_CS_TX_BREAK); - else - ar933x_uart_rmw_clear(up, AR933X_UART_CS_REG, - AR933X_UART_CS_TX_BREAK); - spin_unlock_irqrestore(&up->port.lock, flags); -} - -static void ar933x_uart_enable_ms(struct uart_port *port) -{ -} - -static void ar933x_uart_set_termios(struct uart_port *port, - struct ktermios *new, - struct ktermios *old) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - unsigned int cs; - unsigned long flags; - unsigned int baud, scale; - - /* Only CS8 is supported */ - new->c_cflag &= ~CSIZE; - new->c_cflag |= CS8; - - /* Only one stop bit is supported */ - new->c_cflag &= ~CSTOPB; - - cs = 0; - if (new->c_cflag & PARENB) { - if (!(new->c_cflag & PARODD)) - cs |= AR933X_UART_CS_PARITY_EVEN; - else - cs |= AR933X_UART_CS_PARITY_ODD; - } else { - cs |= AR933X_UART_CS_PARITY_NONE; - } - - /* Mark/space parity is not supported */ - new->c_cflag &= ~CMSPAR; - - baud = uart_get_baud_rate(port, new, old, 0, port->uartclk / 16); - scale = (port->uartclk / (16 * baud)) - 1; - - /* - * Ok, we're now changing the port state. Do it with - * interrupts disabled. - */ - spin_lock_irqsave(&up->port.lock, flags); - - /* Update the per-port timeout. */ - uart_update_timeout(port, new->c_cflag, baud); - - up->port.ignore_status_mask = 0; - - /* ignore all characters if CREAD is not set */ - if ((new->c_cflag & CREAD) == 0) - up->port.ignore_status_mask |= AR933X_DUMMY_STATUS_RD; - - ar933x_uart_write(up, AR933X_UART_CLOCK_REG, - scale << AR933X_UART_CLOCK_SCALE_S | 8192); - - /* setup configuration register */ - ar933x_uart_rmw(up, AR933X_UART_CS_REG, AR933X_UART_CS_PARITY_M, cs); - - /* enable host interrupt */ - ar933x_uart_rmw_set(up, AR933X_UART_CS_REG, - AR933X_UART_CS_HOST_INT_EN); - - spin_unlock_irqrestore(&up->port.lock, flags); - - if (tty_termios_baud_rate(new)) - tty_termios_encode_baud_rate(new, baud, baud); -} - -static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) -{ - struct tty_struct *tty; - int max_count = 256; - - tty = tty_port_tty_get(&up->port.state->port); - do { - unsigned int rdata; - unsigned char ch; - - rdata = ar933x_uart_read(up, AR933X_UART_DATA_REG); - if ((rdata & AR933X_UART_DATA_RX_CSR) == 0) - break; - - /* remove the character from the FIFO */ - ar933x_uart_write(up, AR933X_UART_DATA_REG, - AR933X_UART_DATA_RX_CSR); - - if (!tty) { - /* discard the data if no tty available */ - continue; - } - - up->port.icount.rx++; - ch = rdata & AR933X_UART_DATA_TX_RX_MASK; - - if (uart_handle_sysrq_char(&up->port, ch)) - continue; - - if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0) - tty_insert_flip_char(tty, ch, TTY_NORMAL); - } while (max_count-- > 0); - - if (tty) { - tty_flip_buffer_push(tty); - tty_kref_put(tty); - } -} - -static void ar933x_uart_tx_chars(struct ar933x_uart_port *up) -{ - struct circ_buf *xmit = &up->port.state->xmit; - int count; - - if (uart_tx_stopped(&up->port)) - return; - - count = up->port.fifosize; - do { - unsigned int rdata; - - rdata = ar933x_uart_read(up, AR933X_UART_DATA_REG); - if ((rdata & AR933X_UART_DATA_TX_CSR) == 0) - break; - - if (up->port.x_char) { - ar933x_uart_putc(up, up->port.x_char); - up->port.icount.tx++; - up->port.x_char = 0; - continue; - } - - if (uart_circ_empty(xmit)) - break; - - ar933x_uart_putc(up, xmit->buf[xmit->tail]); - - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - up->port.icount.tx++; - } while (--count > 0); - - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) - uart_write_wakeup(&up->port); - - if (!uart_circ_empty(xmit)) - ar933x_uart_start_tx_interrupt(up); -} - -static irqreturn_t ar933x_uart_interrupt(int irq, void *dev_id) -{ - struct ar933x_uart_port *up = dev_id; - unsigned int status; - - status = ar933x_uart_read(up, AR933X_UART_CS_REG); - if ((status & AR933X_UART_CS_HOST_INT) == 0) - return IRQ_NONE; - - spin_lock(&up->port.lock); - - status = ar933x_uart_read(up, AR933X_UART_INT_REG); - status &= ar933x_uart_read(up, AR933X_UART_INT_EN_REG); - - if (status & AR933X_UART_INT_RX_VALID) { - ar933x_uart_write(up, AR933X_UART_INT_REG, - AR933X_UART_INT_RX_VALID); - ar933x_uart_rx_chars(up); - } - - if (status & AR933X_UART_INT_TX_EMPTY) { - ar933x_uart_write(up, AR933X_UART_INT_REG, - AR933X_UART_INT_TX_EMPTY); - ar933x_uart_stop_tx_interrupt(up); - ar933x_uart_tx_chars(up); - } - - spin_unlock(&up->port.lock); - - return IRQ_HANDLED; -} - -static int ar933x_uart_startup(struct uart_port *port) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - unsigned long flags; - int ret; - - ret = request_irq(up->port.irq, ar933x_uart_interrupt, - up->port.irqflags, dev_name(up->port.dev), up); - if (ret) - return ret; - - spin_lock_irqsave(&up->port.lock, flags); - - /* Enable HOST interrupts */ - ar933x_uart_rmw_set(up, AR933X_UART_CS_REG, - AR933X_UART_CS_HOST_INT_EN); - - /* Enable RX interrupts */ - up->ier = AR933X_UART_INT_RX_VALID; - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier); - - spin_unlock_irqrestore(&up->port.lock, flags); - - return 0; -} - -static void ar933x_uart_shutdown(struct uart_port *port) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - - /* Disable all interrupts */ - up->ier = 0; - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier); - - /* Disable break condition */ - ar933x_uart_rmw_clear(up, AR933X_UART_CS_REG, - AR933X_UART_CS_TX_BREAK); - - free_irq(up->port.irq, up); -} - -static const char *ar933x_uart_type(struct uart_port *port) -{ - return (port->type == PORT_AR933X) ? "AR933X UART" : NULL; -} - -static void ar933x_uart_release_port(struct uart_port *port) -{ - /* Nothing to release ... */ -} - -static int ar933x_uart_request_port(struct uart_port *port) -{ - /* UARTs always present */ - return 0; -} - -static void ar933x_uart_config_port(struct uart_port *port, int flags) -{ - if (flags & UART_CONFIG_TYPE) - port->type = PORT_AR933X; -} - -static int ar933x_uart_verify_port(struct uart_port *port, - struct serial_struct *ser) -{ - if (ser->type != PORT_UNKNOWN && - ser->type != PORT_AR933X) - return -EINVAL; - - if (ser->irq < 0 || ser->irq >= NR_IRQS) - return -EINVAL; - - if (ser->baud_base < 28800) - return -EINVAL; - - return 0; -} - -static struct uart_ops ar933x_uart_ops = { - .tx_empty = ar933x_uart_tx_empty, - .set_mctrl = ar933x_uart_set_mctrl, - .get_mctrl = ar933x_uart_get_mctrl, - .stop_tx = ar933x_uart_stop_tx, - .start_tx = ar933x_uart_start_tx, - .stop_rx = ar933x_uart_stop_rx, - .enable_ms = ar933x_uart_enable_ms, - .break_ctl = ar933x_uart_break_ctl, - .startup = ar933x_uart_startup, - .shutdown = ar933x_uart_shutdown, - .set_termios = ar933x_uart_set_termios, - .type = ar933x_uart_type, - .release_port = ar933x_uart_release_port, - .request_port = ar933x_uart_request_port, - .config_port = ar933x_uart_config_port, - .verify_port = ar933x_uart_verify_port, -}; - -#ifdef CONFIG_SERIAL_AR933X_CONSOLE - -static struct ar933x_uart_port * -ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS]; - -static void ar933x_uart_wait_xmitr(struct ar933x_uart_port *up) -{ - unsigned int status; - unsigned int timeout = 60000; - - /* Wait up to 60ms for the character(s) to be sent. */ - do { - status = ar933x_uart_read(up, AR933X_UART_DATA_REG); - if (--timeout == 0) - break; - udelay(1); - } while ((status & AR933X_UART_DATA_TX_CSR) == 0); -} - -static void ar933x_uart_console_putchar(struct uart_port *port, int ch) -{ - struct ar933x_uart_port *up = (struct ar933x_uart_port *) port; - - ar933x_uart_wait_xmitr(up); - ar933x_uart_putc(up, ch); -} - -static void ar933x_uart_console_write(struct console *co, const char *s, - unsigned int count) -{ - struct ar933x_uart_port *up = ar933x_console_ports[co->index]; - unsigned long flags; - unsigned int int_en; - int locked = 1; - - local_irq_save(flags); - - if (up->port.sysrq) - locked = 0; - else if (oops_in_progress) - locked = spin_trylock(&up->port.lock); - else - spin_lock(&up->port.lock); - - /* - * First save the IER then disable the interrupts - */ - int_en = ar933x_uart_read(up, AR933X_UART_INT_EN_REG); - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, 0); - - uart_console_write(&up->port, s, count, ar933x_uart_console_putchar); - - /* - * Finally, wait for transmitter to become empty - * and restore the IER - */ - ar933x_uart_wait_xmitr(up); - ar933x_uart_write(up, AR933X_UART_INT_EN_REG, int_en); - - ar933x_uart_write(up, AR933X_UART_INT_REG, AR933X_UART_INT_ALLINTS); - - if (locked) - spin_unlock(&up->port.lock); - - local_irq_restore(flags); -} - -static int ar933x_uart_console_setup(struct console *co, char *options) -{ - struct ar933x_uart_port *up; - int baud = 115200; - int bits = 8; - int parity = 'n'; - int flow = 'n'; - - if (co->index < 0 || co->index >= CONFIG_SERIAL_AR933X_NR_UARTS) - return -EINVAL; - - up = ar933x_console_ports[co->index]; - if (!up) - return -ENODEV; - - if (options) - uart_parse_options(options, &baud, &parity, &bits, &flow); - - return uart_set_options(&up->port, co, baud, parity, bits, flow); -} - -static struct console ar933x_uart_console = { - .name = "ttyATH", - .write = ar933x_uart_console_write, - .device = uart_console_device, - .setup = ar933x_uart_console_setup, - .flags = CON_PRINTBUFFER, - .index = -1, - .data = &ar933x_uart_driver, -}; - -static void ar933x_uart_add_console_port(struct ar933x_uart_port *up) -{ - ar933x_console_ports[up->port.line] = up; -} - -#define AR933X_SERIAL_CONSOLE (&ar933x_uart_console) - -#else - -static inline void ar933x_uart_add_console_port(struct ar933x_uart_port *up) {} - -#define AR933X_SERIAL_CONSOLE NULL - -#endif /* CONFIG_SERIAL_AR933X_CONSOLE */ - -static struct uart_driver ar933x_uart_driver = { - .owner = THIS_MODULE, - .driver_name = DRIVER_NAME, - .dev_name = "ttyATH", - .nr = CONFIG_SERIAL_AR933X_NR_UARTS, - .cons = AR933X_SERIAL_CONSOLE, -}; - -static int __devinit ar933x_uart_probe(struct platform_device *pdev) -{ - struct ar933x_uart_platform_data *pdata; - struct ar933x_uart_port *up; - struct uart_port *port; - struct resource *mem_res; - struct resource *irq_res; - int id; - int ret; - - pdata = pdev->dev.platform_data; - if (!pdata) - return -EINVAL; - - id = pdev->id; - if (id == -1) - id = 0; - - if (id > CONFIG_SERIAL_AR933X_NR_UARTS) - return -EINVAL; - - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem_res) { - dev_err(&pdev->dev, "no MEM resource\n"); - return -EINVAL; - } - - irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq_res) { - dev_err(&pdev->dev, "no IRQ resource\n"); - return -EINVAL; - } - - up = kzalloc(sizeof(struct ar933x_uart_port), GFP_KERNEL); - if (!up) - return -ENOMEM; - - port = &up->port; - port->mapbase = mem_res->start; - - port->membase = ioremap(mem_res->start, AR933X_UART_REGS_SIZE); - if (!port->membase) { - ret = -ENOMEM; - goto err_free_up; - } - - port->line = id; - port->irq = irq_res->start; - port->dev = &pdev->dev; - port->type = PORT_AR933X; - port->iotype = UPIO_MEM32; - port->uartclk = pdata->uartclk; - - port->regshift = 2; - port->fifosize = AR933X_UART_FIFO_SIZE; - port->ops = &ar933x_uart_ops; - - ar933x_uart_add_console_port(up); - - ret = uart_add_one_port(&ar933x_uart_driver, &up->port); - if (ret) - goto err_unmap; - - platform_set_drvdata(pdev, up); - return 0; - -err_unmap: - iounmap(up->port.membase); -err_free_up: - kfree(up); - return ret; -} - -static int __devexit ar933x_uart_remove(struct platform_device *pdev) -{ - struct ar933x_uart_port *up; - - up = platform_get_drvdata(pdev); - platform_set_drvdata(pdev, NULL); - - if (up) { - uart_remove_one_port(&ar933x_uart_driver, &up->port); - iounmap(up->port.membase); - kfree(up); - } - - return 0; -} - -static struct platform_driver ar933x_uart_platform_driver = { - .probe = ar933x_uart_probe, - .remove = __devexit_p(ar933x_uart_remove), - .driver = { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init ar933x_uart_init(void) -{ - int ret; - - ar933x_uart_driver.nr = CONFIG_SERIAL_AR933X_NR_UARTS; - ret = uart_register_driver(&ar933x_uart_driver); - if (ret) - goto err_out; - - ret = platform_driver_register(&ar933x_uart_platform_driver); - if (ret) - goto err_unregister_uart_driver; - - return 0; - -err_unregister_uart_driver: - uart_unregister_driver(&ar933x_uart_driver); -err_out: - return ret; -} - -static void __exit ar933x_uart_exit(void) -{ - platform_driver_unregister(&ar933x_uart_platform_driver); - uart_unregister_driver(&ar933x_uart_driver); -} - -module_init(ar933x_uart_init); -module_exit(ar933x_uart_exit); - -MODULE_DESCRIPTION("Atheros AR933X UART driver"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" DRIVER_NAME); diff --git a/trunk/drivers/usb/host/Kconfig b/trunk/drivers/usb/host/Kconfig index 8b094b4f6531..060e0e2b1ae6 100644 --- a/trunk/drivers/usb/host/Kconfig +++ b/trunk/drivers/usb/host/Kconfig @@ -210,7 +210,7 @@ config USB_CNS3XXX_EHCI config USB_EHCI_ATH79 bool "EHCI support for AR7XXX/AR9XXX SoCs" - depends on USB_EHCI_HCD && (SOC_AR71XX || SOC_AR724X || SOC_AR913X || SOC_AR933X) + depends on USB_EHCI_HCD && (SOC_AR71XX || SOC_AR724X || SOC_AR913X) select USB_EHCI_ROOT_HUB_TT default y ---help--- diff --git a/trunk/drivers/usb/host/ehci-ath79.c b/trunk/drivers/usb/host/ehci-ath79.c index f1424f9bc363..afb6743cf094 100644 --- a/trunk/drivers/usb/host/ehci-ath79.c +++ b/trunk/drivers/usb/host/ehci-ath79.c @@ -32,10 +32,6 @@ static const struct platform_device_id ehci_ath79_id_table[] = { .name = "ar913x-ehci", .driver_data = EHCI_ATH79_IP_V2, }, - { - .name = "ar933x-ehci", - .driver_data = EHCI_ATH79_IP_V2, - }, { /* terminating entry */ }, diff --git a/trunk/include/linux/serial_core.h b/trunk/include/linux/serial_core.h index 3c35fb2f688f..eadf33d0abba 100644 --- a/trunk/include/linux/serial_core.h +++ b/trunk/include/linux/serial_core.h @@ -207,10 +207,6 @@ /* Xilinx PSS UART */ #define PORT_XUARTPS 98 -/* Atheros AR933X SoC */ -#define PORT_AR933X 99 - - #ifdef __KERNEL__ #include