aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2018-03-01 13:10:16 -0500
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2018-03-07 12:30:06 -0500
commitb6eb7102ad6dc7ae35c23b517809f5ae5aa5ccdd (patch)
tree179b0673c27f13626d7c54a19df4462b71edbd74
parentfe9ac01324a40e2aaf5782a1fb7038247a89c585 (diff)
drm: rcar-du: lvds: Add R8A77970 support
Add support for the R-Car V3M (R8A77970) SoC to the LVDS encoder driver. Note that there are some differences with the other R-Car gen3 SoCs, e.g. LVDPLLCR has the same layout as in the R-Car gen2 SoCs. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_lvds.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index 1247e26a0559..3d2d3bbd1342 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -32,6 +32,9 @@ enum rcar_lvds_mode {
32}; 32};
33 33
34#define RCAR_LVDS_QUIRK_LANES (1 << 0) /* LVDS lanes 1 and 3 inverted */ 34#define RCAR_LVDS_QUIRK_LANES (1 << 0) /* LVDS lanes 1 and 3 inverted */
35#define RCAR_LVDS_QUIRK_GEN2_PLLCR (1 << 1) /* LVDPLLCR has gen2 layout */
36#define RCAR_LVDS_QUIRK_GEN3_LVEN (1 << 2) /* LVEN bit needs to be set */
37 /* on R8A77970/R8A7799x */
35 38
36struct rcar_lvds_device_info { 39struct rcar_lvds_device_info {
37 unsigned int gen; 40 unsigned int gen;
@@ -191,7 +194,7 @@ static void rcar_lvds_enable(struct drm_bridge *bridge)
191 rcar_lvds_write(lvds, LVDCHCR, lvdhcr); 194 rcar_lvds_write(lvds, LVDCHCR, lvdhcr);
192 195
193 /* PLL clock configuration. */ 196 /* PLL clock configuration. */
194 if (lvds->info->gen < 3) 197 if (lvds->info->quirks & RCAR_LVDS_QUIRK_GEN2_PLLCR)
195 lvdpllcr = rcar_lvds_lvdpllcr_gen2(mode->clock); 198 lvdpllcr = rcar_lvds_lvdpllcr_gen2(mode->clock);
196 else 199 else
197 lvdpllcr = rcar_lvds_lvdpllcr_gen3(mode->clock); 200 lvdpllcr = rcar_lvds_lvdpllcr_gen3(mode->clock);
@@ -224,6 +227,12 @@ static void rcar_lvds_enable(struct drm_bridge *bridge)
224 rcar_lvds_write(lvds, LVDCR0, lvdcr0); 227 rcar_lvds_write(lvds, LVDCR0, lvdcr0);
225 } 228 }
226 229
230 if (lvds->info->quirks & RCAR_LVDS_QUIRK_GEN3_LVEN) {
231 /* Turn on the LVDS PHY. */
232 lvdcr0 |= LVDCR0_LVEN;
233 rcar_lvds_write(lvds, LVDCR0, lvdcr0);
234 }
235
227 /* Wait for the startup delay. */ 236 /* Wait for the startup delay. */
228 usleep_range(100, 150); 237 usleep_range(100, 150);
229 238
@@ -485,17 +494,23 @@ static int rcar_lvds_remove(struct platform_device *pdev)
485 494
486static const struct rcar_lvds_device_info rcar_lvds_gen2_info = { 495static const struct rcar_lvds_device_info rcar_lvds_gen2_info = {
487 .gen = 2, 496 .gen = 2,
497 .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR,
488}; 498};
489 499
490static const struct rcar_lvds_device_info rcar_lvds_r8a7790_info = { 500static const struct rcar_lvds_device_info rcar_lvds_r8a7790_info = {
491 .gen = 2, 501 .gen = 2,
492 .quirks = RCAR_LVDS_QUIRK_LANES, 502 .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR | RCAR_LVDS_QUIRK_LANES,
493}; 503};
494 504
495static const struct rcar_lvds_device_info rcar_lvds_gen3_info = { 505static const struct rcar_lvds_device_info rcar_lvds_gen3_info = {
496 .gen = 3, 506 .gen = 3,
497}; 507};
498 508
509static const struct rcar_lvds_device_info rcar_lvds_r8a77970_info = {
510 .gen = 3,
511 .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR | RCAR_LVDS_QUIRK_GEN3_LVEN,
512};
513
499static const struct of_device_id rcar_lvds_of_table[] = { 514static const struct of_device_id rcar_lvds_of_table[] = {
500 { .compatible = "renesas,r8a7743-lvds", .data = &rcar_lvds_gen2_info }, 515 { .compatible = "renesas,r8a7743-lvds", .data = &rcar_lvds_gen2_info },
501 { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_r8a7790_info }, 516 { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_r8a7790_info },
@@ -503,6 +518,7 @@ static const struct of_device_id rcar_lvds_of_table[] = {
503 { .compatible = "renesas,r8a7793-lvds", .data = &rcar_lvds_gen2_info }, 518 { .compatible = "renesas,r8a7793-lvds", .data = &rcar_lvds_gen2_info },
504 { .compatible = "renesas,r8a7795-lvds", .data = &rcar_lvds_gen3_info }, 519 { .compatible = "renesas,r8a7795-lvds", .data = &rcar_lvds_gen3_info },
505 { .compatible = "renesas,r8a7796-lvds", .data = &rcar_lvds_gen3_info }, 520 { .compatible = "renesas,r8a7796-lvds", .data = &rcar_lvds_gen3_info },
521 { .compatible = "renesas,r8a77970-lvds", .data = &rcar_lvds_r8a77970_info },
506 { } 522 { }
507}; 523};
508 524