diff options
author | Magnus Damm <damm@opensource.se> | 2013-03-25 21:34:33 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-04-01 21:58:20 -0400 |
commit | e481a528901d0cd18b5b5fcbdc55207ea3b6ef68 (patch) | |
tree | 6a97da7668c7e914f3b5a71c13cceecf7e6cc7dc /arch/arm/mach-shmobile | |
parent | eccf0607e450f5c6ca2af5d826d9308e8cdb6848 (diff) |
ARM: shmobile: r8a73a4 SCIF support V3
V3 of SCIF serial port support for the r8a73a4 SoC.
This is done by adding platform devices for SCIFA0
-> SCIFA1 as well as SCIFB0 -> SCIFB3 together with
clock bindings. DT device description is excluded at
this point since such bindings are still under
development.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a73a4.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a73a4.c | 43 |
2 files changed, 57 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c index 15d479dbb132..037713bdff3f 100644 --- a/arch/arm/mach-shmobile/clock-r8a73a4.c +++ b/arch/arm/mach-shmobile/clock-r8a73a4.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #define CPG_LEN 0x270 | 28 | #define CPG_LEN 0x270 |
29 | 29 | ||
30 | #define MPCKCR 0xe6150080 | 30 | #define MPCKCR 0xe6150080 |
31 | #define SMSTPCR2 0xe6150138 | ||
31 | 32 | ||
32 | static struct clk_mapping cpg_mapping = { | 33 | static struct clk_mapping cpg_mapping = { |
33 | .phys = CPG_BASE, | 34 | .phys = CPG_BASE, |
@@ -55,11 +56,23 @@ static struct clk *main_clks[] = { | |||
55 | &extal2_clk, | 56 | &extal2_clk, |
56 | }; | 57 | }; |
57 | 58 | ||
58 | enum { MSTP_NR }; | 59 | enum { MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP_NR }; |
59 | static struct clk mstp_clks[MSTP_NR] = { | 60 | static struct clk mstp_clks[MSTP_NR] = { |
61 | [MSTP204] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ | ||
62 | [MSTP203] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ | ||
63 | [MSTP206] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 6, 0), /* SCIFB0 */ | ||
64 | [MSTP207] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ | ||
65 | [MSTP216] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ | ||
66 | [MSTP217] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 17, 0), /* SCIFB3 */ | ||
60 | }; | 67 | }; |
61 | 68 | ||
62 | static struct clk_lookup lookups[] = { | 69 | static struct clk_lookup lookups[] = { |
70 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), | ||
71 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), | ||
72 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), | ||
73 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), | ||
74 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), | ||
75 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), | ||
63 | }; | 76 | }; |
64 | 77 | ||
65 | void __init r8a73a4_clock_init(void) | 78 | void __init r8a73a4_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c index 69156bce76f7..746a3dc4474d 100644 --- a/arch/arm/mach-shmobile/setup-r8a73a4.c +++ b/arch/arm/mach-shmobile/setup-r8a73a4.c | |||
@@ -21,13 +21,56 @@ | |||
21 | #include <linux/irqchip.h> | 21 | #include <linux/irqchip.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/of_platform.h> | 23 | #include <linux/of_platform.h> |
24 | #include <linux/serial_sci.h> | ||
24 | #include <mach/common.h> | 25 | #include <mach/common.h> |
25 | #include <mach/irqs.h> | 26 | #include <mach/irqs.h> |
26 | #include <mach/r8a73a4.h> | 27 | #include <mach/r8a73a4.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | 29 | ||
30 | #define SCIF_COMMON(scif_type, baseaddr, irq) \ | ||
31 | .type = scif_type, \ | ||
32 | .mapbase = baseaddr, \ | ||
33 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ | ||
34 | .scbrr_algo_id = SCBRR_ALGO_4, \ | ||
35 | .irqs = SCIx_IRQ_MUXED(irq) | ||
36 | |||
37 | #define SCIFA_DATA(index, baseaddr, irq) \ | ||
38 | [index] = { \ | ||
39 | SCIF_COMMON(PORT_SCIFA, baseaddr, irq), \ | ||
40 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \ | ||
41 | } | ||
42 | |||
43 | #define SCIFB_DATA(index, baseaddr, irq) \ | ||
44 | [index] = { \ | ||
45 | SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \ | ||
46 | .scscr = SCSCR_RE | SCSCR_TE, \ | ||
47 | } | ||
48 | |||
49 | enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFB3 }; | ||
50 | |||
51 | static const struct plat_sci_port scif[] = { | ||
52 | SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ | ||
53 | SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ | ||
54 | SCIFB_DATA(SCIFB0, 0xe6c50000, gic_spi(145)), /* SCIFB0 */ | ||
55 | SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ | ||
56 | SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ | ||
57 | SCIFB_DATA(SCIFB3, 0xe6cf0000, gic_spi(151)), /* SCIFB3 */ | ||
58 | }; | ||
59 | |||
60 | static inline void r8a73a4_register_scif(int idx) | ||
61 | { | ||
62 | platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx], | ||
63 | sizeof(struct plat_sci_port)); | ||
64 | } | ||
65 | |||
29 | void __init r8a73a4_add_standard_devices(void) | 66 | void __init r8a73a4_add_standard_devices(void) |
30 | { | 67 | { |
68 | r8a73a4_register_scif(SCIFA0); | ||
69 | r8a73a4_register_scif(SCIFA1); | ||
70 | r8a73a4_register_scif(SCIFB0); | ||
71 | r8a73a4_register_scif(SCIFB1); | ||
72 | r8a73a4_register_scif(SCIFB2); | ||
73 | r8a73a4_register_scif(SCIFB3); | ||
31 | } | 74 | } |
32 | 75 | ||
33 | #ifdef CONFIG_USE_OF | 76 | #ifdef CONFIG_USE_OF |