Merge branch 'rmobile/urgent' into rmobile-fixes-for-linus
[linux-2.6-block.git] / arch / arm / mach-shmobile / board-ag5evm.c
index 75596948029cffac1e267d9368aca20f30bbadf0..9245f21c29d1557278a6d0659dfcfc5001e1fba8 100644 (file)
@@ -160,19 +160,12 @@ static struct resource sh_mmcif_resources[] = {
        },
 };
 
-static struct sh_mmcif_dma sh_mmcif_dma = {
-       .chan_priv_rx   = {
-               .slave_id       = SHDMA_SLAVE_MMCIF_RX,
-       },
-       .chan_priv_tx   = {
-               .slave_id       = SHDMA_SLAVE_MMCIF_TX,
-       },
-};
 static struct sh_mmcif_plat_data sh_mmcif_platdata = {
        .sup_pclk       = 0,
        .ocr            = MMC_VDD_165_195,
        .caps           = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
-       .dma            = &sh_mmcif_dma,
+       .slave_id_tx    = SHDMA_SLAVE_MMCIF_TX,
+       .slave_id_rx    = SHDMA_SLAVE_MMCIF_RX,
 };
 
 static struct platform_device mmc_device = {
@@ -272,7 +265,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
                .flags = LCDC_FLAGS_DWPOL,
                .lcd_size_cfg.width = 44,
                .lcd_size_cfg.height = 79,
-               .bpp = 16,
+               .fourcc = V4L2_PIX_FMT_RGB565,
                .lcd_cfg = lcdc0_modes,
                .num_cfg = ARRAY_SIZE(lcdc0_modes),
                .board_cfg = {
@@ -322,12 +315,54 @@ static struct resource mipidsi0_resources[] = {
        },
 };
 
+static int sh_mipi_set_dot_clock(struct platform_device *pdev,
+                                void __iomem *base,
+                                int enable)
+{
+       struct clk *pck, *phy;
+       int ret;
+
+       pck = clk_get(&pdev->dev, "dsip_clk");
+       if (IS_ERR(pck)) {
+               ret = PTR_ERR(pck);
+               goto sh_mipi_set_dot_clock_pck_err;
+       }
+
+       phy = clk_get(&pdev->dev, "dsiphy_clk");
+       if (IS_ERR(phy)) {
+               ret = PTR_ERR(phy);
+               goto sh_mipi_set_dot_clock_phy_err;
+       }
+
+       if (enable) {
+               clk_set_rate(pck, clk_round_rate(pck,  24000000));
+               clk_set_rate(phy, clk_round_rate(pck, 510000000));
+               clk_enable(pck);
+               clk_enable(phy);
+       } else {
+               clk_disable(pck);
+               clk_disable(phy);
+       }
+
+       ret = 0;
+
+       clk_put(phy);
+sh_mipi_set_dot_clock_phy_err:
+       clk_put(pck);
+sh_mipi_set_dot_clock_pck_err:
+       return ret;
+}
+
 static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
        .lcd_chan       = &lcdc0_info.ch[0],
+       .lane           = 2,
        .vsynw_offset   = 20,
        .clksrc         = 1,
-       .flags          = SH_MIPI_DSI_HSABM,
+       .flags          = SH_MIPI_DSI_HSABM             |
+                         SH_MIPI_DSI_SYNC_PULSES_MODE  |
+                         SH_MIPI_DSI_HSbyteCLK,
+       .set_dot_clock  = sh_mipi_set_dot_clock,
 };
 
 static struct platform_device mipidsi0_device = {
@@ -473,8 +508,6 @@ static void __init ag5evm_map_io(void)
        shmobile_setup_console();
 }
 
-#define DSI0PHYCR      0xe615006c
-
 static void __init ag5evm_init(void)
 {
        sh73a0_pinmux_init();
@@ -555,9 +588,6 @@ static void __init ag5evm_init(void)
        gpio_direction_output(GPIO_PORT235, 0);
        lcd_backlight_reset();
 
-       /* MIPI-DSI clock setup */
-       __raw_writel(0x2a809010, DSI0PHYCR);
-
        /* enable SDHI0 on CN15 [SD I/F] */
        gpio_request(GPIO_FN_SDHICD0, NULL);
        gpio_request(GPIO_FN_SDHIWP0, NULL);