aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-03-20 21:34:10 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-03-21 03:24:01 -0400
commit8f9c60f2e29717155227f225b557d3f1fda442bd (patch)
tree293b53e20f8092f55d76a25877b6c99c7adf3334
parentf363afc168e772a6034ea97b7b213a1b47b8f376 (diff)
fbdev: sh_mipi_dsi: add extra phyctrl for sh_mipi_dsi_info
sh_mipi uses some clocks, but the method of setup depends on CPU. Current SuperH (like sh73a0) can control all of these clocks by CPG (Clock Pulse Generator). It means we can control it by clock framework only. But on sh7372, it needs CPG settings AND sh_mipi PHYCTRL::PLLDS, and only sh7372 has PHYCTRL::PLLDS. But on current sh_mipi driver, PHYCTRL::PLLDS of sh7372 was overwrote since the callback timing of clock setting was changed by c2658b70f06108361aa5024798f9c1bf47c73374 (fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()). To solve this issue, this patch adds extra .phyctrl. This patch adds detail explanation for unclear mipi settings and fixup wrong PHYCTRL::PLLDS value for ap4evb (0xb -> 0x6). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c12
-rw-r--r--drivers/video/sh_mipi_dsi.c2
-rw-r--r--include/video/sh_mipi_dsi.h1
3 files changed, 11 insertions, 4 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 82483d5f200c..581ec66eef96 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -486,20 +486,25 @@ static struct platform_device keysc_device = {
486}; 486};
487 487
488/* MIPI-DSI */ 488/* MIPI-DSI */
489#define PHYCTRL 0x0070
490static int sh_mipi_set_dot_clock(struct platform_device *pdev, 489static int sh_mipi_set_dot_clock(struct platform_device *pdev,
491 void __iomem *base, 490 void __iomem *base,
492 int enable) 491 int enable)
493{ 492{
494 struct clk *pck = clk_get(&pdev->dev, "dsip_clk"); 493 struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
495 void __iomem *phy = base + PHYCTRL;
496 494
497 if (IS_ERR(pck)) 495 if (IS_ERR(pck))
498 return PTR_ERR(pck); 496 return PTR_ERR(pck);
499 497
500 if (enable) { 498 if (enable) {
499 /*
500 * DSIPCLK = 24MHz
501 * D-PHY = DSIPCLK * ((0x6*2)+1) = 312MHz (see .phyctrl)
502 * HsByteCLK = D-PHY/8 = 39MHz
503 *
504 * X * Y * FPS =
505 * (544+72+600+16) * (961+8+8+2) * 30 = 36.1MHz
506 */
501 clk_set_rate(pck, clk_round_rate(pck, 24000000)); 507 clk_set_rate(pck, clk_round_rate(pck, 24000000));
502 iowrite32(ioread32(phy) | (0xb << 8), phy);
503 clk_enable(pck); 508 clk_enable(pck);
504 } else { 509 } else {
505 clk_disable(pck); 510 clk_disable(pck);
@@ -530,6 +535,7 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
530 .lcd_chan = &lcdc_info.ch[0], 535 .lcd_chan = &lcdc_info.ch[0],
531 .lane = 2, 536 .lane = 2,
532 .vsynw_offset = 17, 537 .vsynw_offset = 17,
538 .phyctrl = 0x6 << 8,
533 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE | 539 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE |
534 SH_MIPI_DSI_HSbyteCLK, 540 SH_MIPI_DSI_HSbyteCLK,
535 .set_dot_clock = sh_mipi_set_dot_clock, 541 .set_dot_clock = sh_mipi_set_dot_clock,
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index 42ad0f707e88..4c6b84488561 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -273,7 +273,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
273 iowrite32(0x00000001, base + PHYCTRL); 273 iowrite32(0x00000001, base + PHYCTRL);
274 udelay(200); 274 udelay(200);
275 /* Deassert resets, power on */ 275 /* Deassert resets, power on */
276 iowrite32(0x03070001, base + PHYCTRL); 276 iowrite32(0x03070001 | pdata->phyctrl, base + PHYCTRL);
277 277
278 /* 278 /*
279 * Default = ULPS enable | 279 * Default = ULPS enable |
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 434d56b4a1a5..06c67fbc4eee 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -51,6 +51,7 @@ struct sh_mipi_dsi_info {
51 int lane; 51 int lane;
52 unsigned long flags; 52 unsigned long flags;
53 u32 clksrc; 53 u32 clksrc;
54 u32 phyctrl; /* for extra setting */
54 unsigned int vsynw_offset; 55 unsigned int vsynw_offset;
55 int (*set_dot_clock)(struct platform_device *pdev, 56 int (*set_dot_clock)(struct platform_device *pdev,
56 void __iomem *base, 57 void __iomem *base,