aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-01-18 04:42:20 -0500
committerVineet Gupta <vgupta@synopsys.com>2013-02-15 12:45:55 -0500
commitee36d1722112f33725ec1a7fc02f6c46e630fd27 (patch)
tree280390c8cb2a375a01a68d5e9724cbf740685052
parentc121c5063c0674fad6811f0b0d86ec3bc6eecbbd (diff)
ARC: [plat-arcfpga] Static platform device for CONFIG_SERIAL_ARC
N.B. This is old style of hardcoding platform device specific info in code and it's instantiation thererof using platform_add_devices(). Subsequent patches replace this with DeviceTree based runtime probe. This patch has been retained just as an example of "don't-do-this" for newer kernel ports. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--arch/arc/include/asm/irq.h1
-rw-r--r--arch/arc/plat-arcfpga/include/plat/irq.h27
-rw-r--r--arch/arc/plat-arcfpga/include/plat/memmap.h31
-rw-r--r--arch/arc/plat-arcfpga/platform.c108
4 files changed, 167 insertions, 0 deletions
diff --git a/arch/arc/include/asm/irq.h b/arch/arc/include/asm/irq.h
index 514b30287445..c91b2e4344a1 100644
--- a/arch/arc/include/asm/irq.h
+++ b/arch/arc/include/asm/irq.h
@@ -13,6 +13,7 @@
13#define TIMER0_IRQ 3 13#define TIMER0_IRQ 3
14#define TIMER1_IRQ 4 14#define TIMER1_IRQ 4
15 15
16#include <plat/irq.h> /* Board Specific IRQ assignments */
16#include <asm-generic/irq.h> 17#include <asm-generic/irq.h>
17 18
18extern void __init arc_init_IRQ(void); 19extern void __init arc_init_IRQ(void);
diff --git a/arch/arc/plat-arcfpga/include/plat/irq.h b/arch/arc/plat-arcfpga/include/plat/irq.h
new file mode 100644
index 000000000000..b34e08734c65
--- /dev/null
+++ b/arch/arc/plat-arcfpga/include/plat/irq.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * vineetg: Feb 2009
9 * -For AA4 board, IRQ assignments to peripherals
10 */
11
12#ifndef __PLAT_IRQ_H
13#define __PLAT_IRQ_H
14
15#define NR_IRQS 16
16
17#define UART0_IRQ 5
18#define UART1_IRQ 10
19#define UART2_IRQ 11
20
21#define VMAC_IRQ 6
22
23#define IDE_IRQ 13
24#define PCI_IRQ 14
25#define PS2_IRQ 15
26
27#endif
diff --git a/arch/arc/plat-arcfpga/include/plat/memmap.h b/arch/arc/plat-arcfpga/include/plat/memmap.h
new file mode 100644
index 000000000000..1663f3388085
--- /dev/null
+++ b/arch/arc/plat-arcfpga/include/plat/memmap.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * vineetg: Feb 2009
9 * -For AA4 board, System Memory Map for Peripherals etc
10 */
11
12#ifndef __PLAT_MEMMAP_H
13#define __PLAT_MEMMAP_H
14
15#define UART0_BASE 0xC0FC1000
16#define UART1_BASE 0xC0FC1100
17
18#define VMAC_REG_BASEADDR 0xC0FC2000
19
20#define IDE_CONTROLLER_BASE 0xC0FC9000
21
22#define AHB_PCI_HOST_BRG_BASE 0xC0FD0000
23
24#define PGU_BASEADDR 0xC0FC8000
25#define VLCK_ADDR 0xC0FCF028
26
27#define BVCI_LAT_UNIT_BASE 0xC0FED000
28
29#define PS2_BASE_ADDR 0xC0FCC000
30
31#endif
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c
index 7b5dcab5becb..5388b31e2ead 100644
--- a/arch/arc/plat-arcfpga/platform.c
+++ b/arch/arc/plat-arcfpga/platform.c
@@ -10,7 +10,102 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/device.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/console.h>
16#include <asm/setup.h>
17#include <asm/irq.h>
18#include <asm/clk.h>
19#include <plat/memmap.h>
20
21/*----------------------- Platform Devices -----------------------------*/
22
23#if defined(CONFIG_SERIAL_ARC) || defined(CONFIG_SERIAL_ARC_MODULE)
24
25static unsigned long arc_uart_info[] = {
26 CONFIG_ARC_SERIAL_BAUD, /* uart->baud */
27 -1, /* uart->port.uartclk */
28 -1, /* uart->is_emulated (runtime @running_on_hw) */
29 0
30};
31
32#define ARC_UART_DEV(n) \
33 \
34static struct resource arc_uart##n##_res[] = { \
35 { \
36 .start = UART##n##_BASE, \
37 .end = UART##n##_BASE + 0xFF, \
38 .flags = IORESOURCE_MEM, \
39 }, \
40 { \
41 .start = UART##n##_IRQ, \
42 .end = UART##n##_IRQ, \
43 .flags = IORESOURCE_IRQ, \
44 }, \
45}; \
46 \
47static struct platform_device arc_uart##n##_dev = { \
48 .name = "arc-uart", \
49 .id = n, \
50 .num_resources = ARRAY_SIZE(arc_uart##n##_res), \
51 .resource = arc_uart##n##_res, \
52 .dev = { \
53 .platform_data = &arc_uart_info, \
54 }, \
55}
56
57ARC_UART_DEV(0);
58#if CONFIG_SERIAL_ARC_NR_PORTS > 1
59ARC_UART_DEV(1);
60#endif
61
62static struct platform_device *fpga_early_devs[] __initdata = {
63#if defined(CONFIG_SERIAL_ARC_CONSOLE)
64 &arc_uart0_dev,
65#endif
66};
67
68static void arc_fpga_serial_init(void)
69{
70 arc_uart_info[1] = arc_get_core_freq();
71
72 /* To let driver workaround ISS bug: baudh Reg can't be set to 0 */
73 arc_uart_info[2] = !running_on_hw;
74
75 early_platform_add_devices(fpga_early_devs,
76 ARRAY_SIZE(fpga_early_devs));
77
78 /*
79 * ARC console driver registers itself as an early platform driver
80 * of class "earlyprintk".
81 * Install it here, followed by probe of devices.
82 * The installation here doesn't require earlyprintk in command line
83 * To do so however, replace the lines below with
84 * parse_early_param();
85 * early_platform_driver_probe("earlyprintk", 1, 1);
86 * ^^
87 */
88 early_platform_driver_register_all("earlyprintk");
89 early_platform_driver_probe("earlyprintk", 1, 0);
90
91 /*
92 * This is to make sure that arc uart would be preferred console
93 * despite one/more of following:
94 * -command line lacked "console=ttyARC0" or
95 * -CONFIG_VT_CONSOLE was enabled (for no reason whatsoever)
96 * Note that this needs to be done after above early console is reg,
97 * otherwise the early console never gets a chance to run.
98 */
99 add_preferred_console("ttyARC", 0, "115200");
100}
101
102#else
103
104static void arc_fpga_serial_init(void)
105{
106}
107
108#endif /* CONFIG_SERIAL_ARC */
14 109
15/* 110/*
16 * Early Platform Initialization called from setup_arch() 111 * Early Platform Initialization called from setup_arch()
@@ -18,12 +113,25 @@
18void __init arc_platform_early_init(void) 113void __init arc_platform_early_init(void)
19{ 114{
20 pr_info("[plat-arcfpga]: registering early dev resources\n"); 115 pr_info("[plat-arcfpga]: registering early dev resources\n");
116
117 arc_fpga_serial_init();
21} 118}
22 119
120static struct platform_device *fpga_devs[] __initdata = {
121#if defined(CONFIG_SERIAL_ARC) || defined(CONFIG_SERIAL_ARC_MODULE)
122 &arc_uart0_dev,
123#if CONFIG_SERIAL_ARC_NR_PORTS > 1
124 &arc_uart1_dev,
125#endif
126#endif
127};
128
23int __init fpga_plat_init(void) 129int __init fpga_plat_init(void)
24{ 130{
25 pr_info("[plat-arcfpga]: registering device resources\n"); 131 pr_info("[plat-arcfpga]: registering device resources\n");
26 132
133 platform_add_devices(fpga_devs, ARRAY_SIZE(fpga_devs));
134
27 return 0; 135 return 0;
28} 136}
29arch_initcall(fpga_plat_init); 137arch_initcall(fpga_plat_init);