aboutsummaryrefslogtreecommitdiff
path: root/arch/arc/plat-arcfpga
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-01-18 15:12:21 +0530
committerVineet Gupta <vgupta@synopsys.com>2013-02-15 23:15:57 +0530
commitabe11ddea1d759f9995a9a4636c28c9b40856ca8 (patch)
tree53085d131ecbe7a810f9feadcba571f49a2e9465 /arch/arc/plat-arcfpga
parent450dd430bf45ab212a91acfb9bed2528d17f30cd (diff)
ARC: [plat-arcfpga]: Enabling DeviceTree for Angel4 board
* arc-uart platform device now populated dynamically, using of_platform_populate() - applies to any other device whatsoever. * uart in turn requires incore arc-intc to be also present in DT * A irq-domain needs to be instantiated for IRQ requests by DT probed device (e.g. arc-uart) TODO: switch over to linear irq domain once all devs have been transitioned to DT Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arc/plat-arcfpga')
-rw-r--r--arch/arc/plat-arcfpga/platform.c97
1 files changed, 46 insertions, 51 deletions
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c
index 5388b31e2ead..33bcac8bd6b8 100644
--- a/arch/arc/plat-arcfpga/platform.c
+++ b/arch/arc/plat-arcfpga/platform.c
@@ -13,6 +13,7 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/console.h>
+#include <linux/of_platform.h>
#include <asm/setup.h>
#include <asm/irq.h>
#include <asm/clk.h>
@@ -20,58 +21,56 @@
/*----------------------- Platform Devices -----------------------------*/
-#if defined(CONFIG_SERIAL_ARC) || defined(CONFIG_SERIAL_ARC_MODULE)
-
static unsigned long arc_uart_info[] = {
- CONFIG_ARC_SERIAL_BAUD, /* uart->baud */
- -1, /* uart->port.uartclk */
- -1, /* uart->is_emulated (runtime @running_on_hw) */
+ 0, /* uart->is_emulated (runtime @running_on_hw) */
+ 0, /* uart->port.uartclk */
+ 0, /* uart->baud */
0
};
-#define ARC_UART_DEV(n) \
- \
-static struct resource arc_uart##n##_res[] = { \
- { \
- .start = UART##n##_BASE, \
- .end = UART##n##_BASE + 0xFF, \
- .flags = IORESOURCE_MEM, \
- }, \
- { \
- .start = UART##n##_IRQ, \
- .end = UART##n##_IRQ, \
- .flags = IORESOURCE_IRQ, \
- }, \
-}; \
- \
-static struct platform_device arc_uart##n##_dev = { \
- .name = "arc-uart", \
- .id = n, \
- .num_resources = ARRAY_SIZE(arc_uart##n##_res), \
- .resource = arc_uart##n##_res, \
- .dev = { \
- .platform_data = &arc_uart_info, \
- }, \
-}
+#if defined(CONFIG_SERIAL_ARC_CONSOLE)
+/*
+ * static platform data - but only for early serial
+ * TBD: derive this from a special DT node
+ */
+static struct resource arc_uart0_res[] = {
+ {
+ .start = UART0_BASE,
+ .end = UART0_BASE + 0xFF,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = UART0_IRQ,
+ .end = UART0_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
-ARC_UART_DEV(0);
-#if CONFIG_SERIAL_ARC_NR_PORTS > 1
-ARC_UART_DEV(1);
-#endif
+static struct platform_device arc_uart0_dev = {
+ .name = "arc-uart",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(arc_uart0_res),
+ .resource = arc_uart0_res,
+ .dev = {
+ .platform_data = &arc_uart_info,
+ },
+};
static struct platform_device *fpga_early_devs[] __initdata = {
-#if defined(CONFIG_SERIAL_ARC_CONSOLE)
&arc_uart0_dev,
-#endif
};
+#endif
static void arc_fpga_serial_init(void)
{
+ /* To let driver workaround ISS bug: baudh Reg can't be set to 0 */
+ arc_uart_info[0] = !running_on_hw;
+
arc_uart_info[1] = arc_get_core_freq();
- /* To let driver workaround ISS bug: baudh Reg can't be set to 0 */
- arc_uart_info[2] = !running_on_hw;
+ arc_uart_info[2] = CONFIG_ARC_SERIAL_BAUD;
+#if defined(CONFIG_SERIAL_ARC_CONSOLE)
early_platform_add_devices(fpga_early_devs,
ARRAY_SIZE(fpga_early_devs));
@@ -97,16 +96,9 @@ static void arc_fpga_serial_init(void)
* otherwise the early console never gets a chance to run.
*/
add_preferred_console("ttyARC", 0, "115200");
+#endif
}
-#else
-
-static void arc_fpga_serial_init(void)
-{
-}
-
-#endif /* CONFIG_SERIAL_ARC */
-
/*
* Early Platform Initialization called from setup_arch()
*/
@@ -117,20 +109,23 @@ void __init arc_platform_early_init(void)
arc_fpga_serial_init();
}
-static struct platform_device *fpga_devs[] __initdata = {
+static struct of_dev_auxdata plat_auxdata_lookup[] __initdata = {
#if defined(CONFIG_SERIAL_ARC) || defined(CONFIG_SERIAL_ARC_MODULE)
- &arc_uart0_dev,
-#if CONFIG_SERIAL_ARC_NR_PORTS > 1
- &arc_uart1_dev,
-#endif
+ OF_DEV_AUXDATA("snps,arc-uart", UART0_BASE, "arc-uart", arc_uart_info),
#endif
+ {}
};
int __init fpga_plat_init(void)
{
pr_info("[plat-arcfpga]: registering device resources\n");
- platform_add_devices(fpga_devs, ARRAY_SIZE(fpga_devs));
+ /*
+ * Traverses flattened DeviceTree - registering platform devices
+ * complete with their resources
+ */
+ of_platform_populate(NULL, of_default_bus_match_table,
+ plat_auxdata_lookup, NULL);
return 0;
}