aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVladimir Barinov <vladimir.barinov@cogentembedded.com>2013-08-22 16:23:13 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-08-25 06:33:29 -0400
commit4714a0255eee45b87634ab28f8a7e66038f645ba (patch)
treea6c926508ede803325ac8c3ed78c272964779fa1 /arch
parent04e40bdd67afc5ab94d983417f18bb1f20b08eac (diff)
[media] ARM: shmobile: r8a7779: add VIN support
Add VIN clocks and platform devices for R8A7779 SoC; add function to register the VIN platform devices. [Sergei: added 'id' parameter check to r8a7779_add_vin_device(), used '*pdata' in *sizeof* operator there, renamed some variables, annotated vin[0-3]_resources [] and 'vin[0-3]_info' as '__initdata'.] Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c10
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h3
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c37
3 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 10340f5becbb..bd6ad922eb7e 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -112,7 +112,9 @@ static struct clk *main_clks[] = {
112}; 112};
113 113
114enum { MSTP323, MSTP322, MSTP321, MSTP320, 114enum { MSTP323, MSTP322, MSTP321, MSTP320,
115 MSTP120,
115 MSTP116, MSTP115, MSTP114, 116 MSTP116, MSTP115, MSTP114,
117 MSTP110, MSTP109, MSTP108,
116 MSTP103, MSTP101, MSTP100, 118 MSTP103, MSTP101, MSTP100,
117 MSTP030, 119 MSTP030,
118 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 120 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
@@ -125,9 +127,13 @@ static struct clk mstp_clks[MSTP_NR] = {
125 [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */ 127 [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */
126 [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */ 128 [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */
127 [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */ 129 [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */
130 [MSTP120] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 20, 0), /* VIN3 */
128 [MSTP116] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 16, 0), /* PCIe */ 131 [MSTP116] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 16, 0), /* PCIe */
129 [MSTP115] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 15, 0), /* SATA */ 132 [MSTP115] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 15, 0), /* SATA */
130 [MSTP114] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 14, 0), /* Ether */ 133 [MSTP114] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 14, 0), /* Ether */
134 [MSTP110] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 10, 0), /* VIN0 */
135 [MSTP109] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 9, 0), /* VIN1 */
136 [MSTP108] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 8, 0), /* VIN2 */
131 [MSTP103] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 3, 0), /* DU */ 137 [MSTP103] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 3, 0), /* DU */
132 [MSTP101] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 1, 0), /* USB2 */ 138 [MSTP101] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 1, 0), /* USB2 */
133 [MSTP100] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 0, 0), /* USB0/1 */ 139 [MSTP100] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 0, 0), /* USB0/1 */
@@ -162,10 +168,14 @@ static struct clk_lookup lookups[] = {
162 CLKDEV_CON_ID("peripheral_clk", &clkp_clk), 168 CLKDEV_CON_ID("peripheral_clk", &clkp_clk),
163 169
164 /* MSTP32 clocks */ 170 /* MSTP32 clocks */
171 CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
165 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */ 172 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
166 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */ 173 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
167 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */ 174 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
168 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */ 175 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
176 CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
177 CLKDEV_DEV_ID("r8a7779-vin.1", &mstp_clks[MSTP109]), /* VIN1 */
178 CLKDEV_DEV_ID("r8a7779-vin.2", &mstp_clks[MSTP108]), /* VIN2 */
169 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ 179 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
170 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ 180 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
171 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 181 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index fc47073c7ba9..6d2b6417fe2a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -5,6 +5,7 @@
5#include <linux/pm_domain.h> 5#include <linux/pm_domain.h>
6#include <linux/sh_eth.h> 6#include <linux/sh_eth.h>
7#include <linux/platform_data/usb-rcar-phy.h> 7#include <linux/platform_data/usb-rcar-phy.h>
8#include <linux/platform_data/camera-rcar.h>
8 9
9struct platform_device; 10struct platform_device;
10 11
@@ -35,6 +36,8 @@ extern void r8a7779_add_standard_devices(void);
35extern void r8a7779_add_standard_devices_dt(void); 36extern void r8a7779_add_standard_devices_dt(void);
36extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); 37extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata);
37extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata); 38extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata);
39extern void r8a7779_add_vin_device(int idx,
40 struct rcar_vin_platform_data *pdata);
38extern void r8a7779_init_late(void); 41extern void r8a7779_init_late(void);
39extern void r8a7779_clock_init(void); 42extern void r8a7779_clock_init(void);
40extern void r8a7779_pinmux_init(void); 43extern void r8a7779_pinmux_init(void);
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 398687761f50..3d8928895503 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -559,6 +559,33 @@ static struct resource ether_resources[] = {
559 }, 559 },
560}; 560};
561 561
562#define R8A7779_VIN(idx) \
563static struct resource vin##idx##_resources[] __initdata = { \
564 DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
565 DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \
566}; \
567 \
568static struct platform_device_info vin##idx##_info __initdata = { \
569 .parent = &platform_bus, \
570 .name = "r8a7779-vin", \
571 .id = idx, \
572 .res = vin##idx##_resources, \
573 .num_res = ARRAY_SIZE(vin##idx##_resources), \
574 .dma_mask = DMA_BIT_MASK(32), \
575}
576
577R8A7779_VIN(0);
578R8A7779_VIN(1);
579R8A7779_VIN(2);
580R8A7779_VIN(3);
581
582static struct platform_device_info *vin_info_table[] __initdata = {
583 &vin0_info,
584 &vin1_info,
585 &vin2_info,
586 &vin3_info,
587};
588
562static struct platform_device *r8a7779_devices_dt[] __initdata = { 589static struct platform_device *r8a7779_devices_dt[] __initdata = {
563 &scif0_device, 590 &scif0_device,
564 &scif1_device, 591 &scif1_device,
@@ -610,6 +637,16 @@ void __init r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata)
610 pdata, sizeof(*pdata)); 637 pdata, sizeof(*pdata));
611} 638}
612 639
640void __init r8a7779_add_vin_device(int id, struct rcar_vin_platform_data *pdata)
641{
642 BUG_ON(id < 0 || id > 3);
643
644 vin_info_table[id]->data = pdata;
645 vin_info_table[id]->size_data = sizeof(*pdata);
646
647 platform_device_register_full(vin_info_table[id]);
648}
649
613/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 650/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
614void __init __weak r8a7779_register_twd(void) { } 651void __init __weak r8a7779_register_twd(void) { }
615 652