aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-11-08 23:35:14 -0500
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-11-21 18:43:21 -0500
commit5e47431aabf716c9ad9eacf1a966e1fc1469c809 (patch)
treef2d588fe8e00656b83dc8ee30d17c4777a9b1e9e /arch/arm/mach-shmobile
parent08750617badd03fd95f33921a5213a5632022178 (diff)
fbdev: sh_mipi_dsi: add set_dot_clock() for each platform
Dot clock of SH MIPI are depends on each platform board. This patch adds set_dot_clock() function for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c36
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c25
2 files changed, 56 insertions, 5 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 6993844424c6..15072c51e035 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -321,6 +321,36 @@ static struct resource mipidsi0_resources[] = {
321 }, 321 },
322}; 322};
323 323
324#define DSI0PHYCR 0xe615006c
325static int sh_mipi_set_dot_clock(struct platform_device *pdev,
326 void __iomem *base,
327 int enable)
328{
329 struct clk *pck;
330 int ret;
331
332 pck = clk_get(&pdev->dev, "dsip_clk");
333 if (IS_ERR(pck)) {
334 ret = PTR_ERR(pck);
335 goto sh_mipi_set_dot_clock_pck_err;
336 }
337
338 if (enable) {
339 clk_set_rate(pck, clk_round_rate(pck, 24000000));
340 __raw_writel(0x2a809010, DSI0PHYCR);
341 clk_enable(pck);
342 } else {
343 clk_disable(pck);
344 }
345
346 ret = 0;
347
348 clk_put(pck);
349
350sh_mipi_set_dot_clock_pck_err:
351 return ret;
352}
353
324static struct sh_mipi_dsi_info mipidsi0_info = { 354static struct sh_mipi_dsi_info mipidsi0_info = {
325 .data_format = MIPI_RGB888, 355 .data_format = MIPI_RGB888,
326 .lcd_chan = &lcdc0_info.ch[0], 356 .lcd_chan = &lcdc0_info.ch[0],
@@ -329,6 +359,7 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
329 .clksrc = 1, 359 .clksrc = 1,
330 .flags = SH_MIPI_DSI_HSABM | 360 .flags = SH_MIPI_DSI_HSABM |
331 SH_MIPI_DSI_SYNC_PULSES_MODE, 361 SH_MIPI_DSI_SYNC_PULSES_MODE,
362 .set_dot_clock = sh_mipi_set_dot_clock,
332}; 363};
333 364
334static struct platform_device mipidsi0_device = { 365static struct platform_device mipidsi0_device = {
@@ -476,8 +507,6 @@ static void __init ag5evm_map_io(void)
476 shmobile_setup_console(); 507 shmobile_setup_console();
477} 508}
478 509
479#define DSI0PHYCR 0xe615006c
480
481static void __init ag5evm_init(void) 510static void __init ag5evm_init(void)
482{ 511{
483 sh73a0_pinmux_init(); 512 sh73a0_pinmux_init();
@@ -558,9 +587,6 @@ static void __init ag5evm_init(void)
558 gpio_direction_output(GPIO_PORT235, 0); 587 gpio_direction_output(GPIO_PORT235, 0);
559 lcd_backlight_reset(); 588 lcd_backlight_reset();
560 589
561 /* MIPI-DSI clock setup */
562 __raw_writel(0x2a809010, DSI0PHYCR);
563
564 /* enable SDHI0 on CN15 [SD I/F] */ 590 /* enable SDHI0 on CN15 [SD I/F] */
565 gpio_request(GPIO_FN_SDHICD0, NULL); 591 gpio_request(GPIO_FN_SDHICD0, NULL);
566 gpio_request(GPIO_FN_SDHIWP0, NULL); 592 gpio_request(GPIO_FN_SDHIWP0, NULL);
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index b2e32c8c9e54..73503ed8bde2 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -564,6 +564,30 @@ static struct platform_device keysc_device = {
564}; 564};
565 565
566/* MIPI-DSI */ 566/* MIPI-DSI */
567#define PHYCTRL 0x0070
568static int sh_mipi_set_dot_clock(struct platform_device *pdev,
569 void __iomem *base,
570 int enable)
571{
572 struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
573 void __iomem *phy = base + PHYCTRL;
574
575 if (IS_ERR(pck))
576 return PTR_ERR(pck);
577
578 if (enable) {
579 clk_set_rate(pck, clk_round_rate(pck, 24000000));
580 iowrite32(ioread32(phy) | (0xb << 8), phy);
581 clk_enable(pck);
582 } else {
583 clk_disable(pck);
584 }
585
586 clk_put(pck);
587
588 return 0;
589}
590
567static struct resource mipidsi0_resources[] = { 591static struct resource mipidsi0_resources[] = {
568 [0] = { 592 [0] = {
569 .start = 0xffc60000, 593 .start = 0xffc60000,
@@ -583,6 +607,7 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
583 .lane = 2, 607 .lane = 2,
584 .vsynw_offset = 17, 608 .vsynw_offset = 17,
585 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE, 609 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE,
610 .set_dot_clock = sh_mipi_set_dot_clock,
586}; 611};
587 612
588static struct platform_device mipidsi0_device = { 613static struct platform_device mipidsi0_device = {