| 1 | From d9215f4c69b414f589eeeff002af7ef58b96b172 Mon Sep 17 00:00:00 2001 |
| 2 | From: Gabor Juhos <juhosg@openwrt.org> |
| 3 | Date: Mon, 20 Jun 2011 19:26:12 +0200 |
| 4 | Subject: [PATCH 15/27] MIPS: ath79: register UART device for the AR933X SoCs |
| 5 | |
| 6 | The AR933X SoCs does not have a 8250 compatible UART, they |
| 7 | are using a different UART core. Register a different platform |
| 8 | device for the different UART. |
| 9 | |
| 10 | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> |
| 11 | Cc: linux-mips@linux-mips.org |
| 12 | Cc: Kathy Giori <kgiori@qca.qualcomm.com> |
| 13 | Cc: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com> |
| 14 | Patchwork: https://patchwork.linux-mips.org/patch/2528/ |
| 15 | Signed-off-by: Ralf Baechle <ralf@linux-mips.org> |
| 16 | --- |
| 17 | arch/mips/ath79/dev-common.c | 38 ++++++++++++++++++++++++++++++++++++-- |
| 18 | 1 files changed, 36 insertions(+), 2 deletions(-) |
| 19 | |
| 20 | --- a/arch/mips/ath79/dev-common.c |
| 21 | +++ b/arch/mips/ath79/dev-common.c |
| 22 | @@ -20,6 +20,7 @@ |
| 23 | |
| 24 | #include <asm/mach-ath79/ath79.h> |
| 25 | #include <asm/mach-ath79/ar71xx_regs.h> |
| 26 | +#include <asm/mach-ath79/ar933x_uart_platform.h> |
| 27 | #include "common.h" |
| 28 | #include "dev-common.h" |
| 29 | |
| 30 | @@ -54,6 +55,30 @@ static struct platform_device ath79_uart |
| 31 | }, |
| 32 | }; |
| 33 | |
| 34 | +static struct resource ar933x_uart_resources[] = { |
| 35 | + { |
| 36 | + .start = AR933X_UART_BASE, |
| 37 | + .end = AR933X_UART_BASE + AR71XX_UART_SIZE - 1, |
| 38 | + .flags = IORESOURCE_MEM, |
| 39 | + }, |
| 40 | + { |
| 41 | + .start = ATH79_MISC_IRQ_UART, |
| 42 | + .end = ATH79_MISC_IRQ_UART, |
| 43 | + .flags = IORESOURCE_IRQ, |
| 44 | + }, |
| 45 | +}; |
| 46 | + |
| 47 | +static struct ar933x_uart_platform_data ar933x_uart_data; |
| 48 | +static struct platform_device ar933x_uart_device = { |
| 49 | + .name = "ar933x-uart", |
| 50 | + .id = -1, |
| 51 | + .resource = ar933x_uart_resources, |
| 52 | + .num_resources = ARRAY_SIZE(ar933x_uart_resources), |
| 53 | + .dev = { |
| 54 | + .platform_data = &ar933x_uart_data, |
| 55 | + }, |
| 56 | +}; |
| 57 | + |
| 58 | void __init ath79_register_uart(void) |
| 59 | { |
| 60 | struct clk *clk; |
| 61 | @@ -62,8 +87,17 @@ void __init ath79_register_uart(void) |
| 62 | if (IS_ERR(clk)) |
| 63 | panic("unable to get UART clock, err=%ld", PTR_ERR(clk)); |
| 64 | |
| 65 | - ath79_uart_data[0].uartclk = clk_get_rate(clk); |
| 66 | - platform_device_register(&ath79_uart_device); |
| 67 | + if (soc_is_ar71xx() || |
| 68 | + soc_is_ar724x() || |
| 69 | + soc_is_ar913x()) { |
| 70 | + ath79_uart_data[0].uartclk = clk_get_rate(clk); |
| 71 | + platform_device_register(&ath79_uart_device); |
| 72 | + } else if (soc_is_ar933x()) { |
| 73 | + ar933x_uart_data.uartclk = clk_get_rate(clk); |
| 74 | + platform_device_register(&ar933x_uart_device); |
| 75 | + } else { |
| 76 | + BUG(); |
| 77 | + } |
| 78 | } |
| 79 | |
| 80 | static struct platform_device ath79_wdt_device = { |
| 81 | |