Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13051c5c authored by Gabor Juhos's avatar Gabor Juhos Committed by Ralf Baechle
Browse files

MIPS: ath79: register UART device for the AR933X SoCs



The AR933X SoCs does not have a 8250 compatible UART, they
are using a different UART core. Register a different platform
device for the different UART.

Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: Kathy Giori <kgiori@qca.qualcomm.com>
Cc: "Luis R.  Rodriguez" <rodrigue@qca.qualcomm.com>
Patchwork: https://patchwork.linux-mips.org/patch/2528/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent d57f341b
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include <asm/mach-ath79/ar933x_uart_platform.h>
#include "common.h"
#include "dev-common.h"

@@ -54,6 +55,30 @@ 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;
@@ -62,8 +87,17 @@ 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();
	}
}

static struct platform_device ath79_wdt_device = {