2 * Atheros AR71XX/AR724X/AR913X common devices
4 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 * Parts of this file are based on Atheros' 2.6.15 BSP
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/serial_8250.h>
18 #include <linux/clk.h>
19 #include <linux/err.h>
21 #include <asm/mach-ath79/ath79.h>
22 #include <asm/mach-ath79/ar71xx_regs.h>
24 #include "dev-common.h"
26 static struct resource ath79_uart_resources
[] = {
28 .start
= AR71XX_UART_BASE
,
29 .end
= AR71XX_UART_BASE
+ AR71XX_UART_SIZE
- 1,
30 .flags
= IORESOURCE_MEM
,
34 #define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
35 static struct plat_serial8250_port ath79_uart_data
[] = {
37 .mapbase
= AR71XX_UART_BASE
,
38 .irq
= ATH79_MISC_IRQ_UART
,
39 .flags
= AR71XX_UART_FLAGS
,
43 /* terminating entry */
47 static struct platform_device ath79_uart_device
= {
49 .id
= PLAT8250_DEV_PLATFORM
,
50 .resource
= ath79_uart_resources
,
51 .num_resources
= ARRAY_SIZE(ath79_uart_resources
),
53 .platform_data
= ath79_uart_data
57 void __init
ath79_register_uart(void)
61 clk
= clk_get(NULL
, "uart");
63 panic("unable to get UART clock, err=%ld", PTR_ERR(clk
));
65 ath79_uart_data
[0].uartclk
= clk_get_rate(clk
);
66 platform_device_register(&ath79_uart_device
);
69 static struct platform_device ath79_wdt_device
= {
74 void __init
ath79_register_wdt(void)
76 platform_device_register(&ath79_wdt_device
);