aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-ag5evm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/board-ag5evm.c')
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c157
1 files changed, 80 insertions, 77 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 25eb88a923e..52b5e64eb6b 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -213,6 +213,84 @@ static struct platform_device irda_device = {
213 .num_resources = ARRAY_SIZE(irda_resources), 213 .num_resources = ARRAY_SIZE(irda_resources),
214}; 214};
215 215
216/* MIPI-DSI */
217static struct resource mipidsi0_resources[] = {
218 [0] = {
219 .name = "DSI0",
220 .start = 0xfeab0000,
221 .end = 0xfeab3fff,
222 .flags = IORESOURCE_MEM,
223 },
224 [1] = {
225 .name = "DSI0",
226 .start = 0xfeab4000,
227 .end = 0xfeab7fff,
228 .flags = IORESOURCE_MEM,
229 },
230};
231
232static int sh_mipi_set_dot_clock(struct platform_device *pdev,
233 void __iomem *base,
234 int enable)
235{
236 struct clk *pck, *phy;
237 int ret;
238
239 pck = clk_get(&pdev->dev, "dsip_clk");
240 if (IS_ERR(pck)) {
241 ret = PTR_ERR(pck);
242 goto sh_mipi_set_dot_clock_pck_err;
243 }
244
245 phy = clk_get(&pdev->dev, "dsiphy_clk");
246 if (IS_ERR(phy)) {
247 ret = PTR_ERR(phy);
248 goto sh_mipi_set_dot_clock_phy_err;
249 }
250
251 if (enable) {
252 clk_set_rate(pck, clk_round_rate(pck, 24000000));
253 clk_set_rate(phy, clk_round_rate(pck, 510000000));
254 clk_enable(pck);
255 clk_enable(phy);
256 } else {
257 clk_disable(pck);
258 clk_disable(phy);
259 }
260
261 ret = 0;
262
263 clk_put(phy);
264sh_mipi_set_dot_clock_phy_err:
265 clk_put(pck);
266sh_mipi_set_dot_clock_pck_err:
267 return ret;
268}
269
270static struct sh_mobile_lcdc_info lcdc0_info;
271
272static struct sh_mipi_dsi_info mipidsi0_info = {
273 .data_format = MIPI_RGB888,
274 .lcd_chan = &lcdc0_info.ch[0],
275 .lane = 2,
276 .vsynw_offset = 20,
277 .clksrc = 1,
278 .flags = SH_MIPI_DSI_HSABM |
279 SH_MIPI_DSI_SYNC_PULSES_MODE |
280 SH_MIPI_DSI_HSbyteCLK,
281 .set_dot_clock = sh_mipi_set_dot_clock,
282};
283
284static struct platform_device mipidsi0_device = {
285 .name = "sh-mipi-dsi",
286 .num_resources = ARRAY_SIZE(mipidsi0_resources),
287 .resource = mipidsi0_resources,
288 .id = 0,
289 .dev = {
290 .platform_data = &mipidsi0_info,
291 },
292};
293
216static unsigned char lcd_backlight_seq[3][2] = { 294static unsigned char lcd_backlight_seq[3][2] = {
217 { 0x04, 0x07 }, 295 { 0x04, 0x07 },
218 { 0x23, 0x80 }, 296 { 0x23, 0x80 },
@@ -275,6 +353,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
275 .display_on = lcd_backlight_on, 353 .display_on = lcd_backlight_on,
276 .display_off = lcd_backlight_reset, 354 .display_off = lcd_backlight_reset,
277 }, 355 },
356 .tx_dev = &mipidsi0_device,
278 } 357 }
279}; 358};
280 359
@@ -302,82 +381,6 @@ static struct platform_device lcdc0_device = {
302 }, 381 },
303}; 382};
304 383
305/* MIPI-DSI */
306static struct resource mipidsi0_resources[] = {
307 [0] = {
308 .name = "DSI0",
309 .start = 0xfeab0000,
310 .end = 0xfeab3fff,
311 .flags = IORESOURCE_MEM,
312 },
313 [1] = {
314 .name = "DSI0",
315 .start = 0xfeab4000,
316 .end = 0xfeab7fff,
317 .flags = IORESOURCE_MEM,
318 },
319};
320
321static int sh_mipi_set_dot_clock(struct platform_device *pdev,
322 void __iomem *base,
323 int enable)
324{
325 struct clk *pck, *phy;
326 int ret;
327
328 pck = clk_get(&pdev->dev, "dsip_clk");
329 if (IS_ERR(pck)) {
330 ret = PTR_ERR(pck);
331 goto sh_mipi_set_dot_clock_pck_err;
332 }
333
334 phy = clk_get(&pdev->dev, "dsiphy_clk");
335 if (IS_ERR(phy)) {
336 ret = PTR_ERR(phy);
337 goto sh_mipi_set_dot_clock_phy_err;
338 }
339
340 if (enable) {
341 clk_set_rate(pck, clk_round_rate(pck, 24000000));
342 clk_set_rate(phy, clk_round_rate(pck, 510000000));
343 clk_enable(pck);
344 clk_enable(phy);
345 } else {
346 clk_disable(pck);
347 clk_disable(phy);
348 }
349
350 ret = 0;
351
352 clk_put(phy);
353sh_mipi_set_dot_clock_phy_err:
354 clk_put(pck);
355sh_mipi_set_dot_clock_pck_err:
356 return ret;
357}
358
359static struct sh_mipi_dsi_info mipidsi0_info = {
360 .data_format = MIPI_RGB888,
361 .lcd_chan = &lcdc0_info.ch[0],
362 .lane = 2,
363 .vsynw_offset = 20,
364 .clksrc = 1,
365 .flags = SH_MIPI_DSI_HSABM |
366 SH_MIPI_DSI_SYNC_PULSES_MODE |
367 SH_MIPI_DSI_HSbyteCLK,
368 .set_dot_clock = sh_mipi_set_dot_clock,
369};
370
371static struct platform_device mipidsi0_device = {
372 .name = "sh-mipi-dsi",
373 .num_resources = ARRAY_SIZE(mipidsi0_resources),
374 .resource = mipidsi0_resources,
375 .id = 0,
376 .dev = {
377 .platform_data = &mipidsi0_info,
378 },
379};
380
381/* Fixed 2.8V regulators to be used by SDHI0 */ 384/* Fixed 2.8V regulators to be used by SDHI0 */
382static struct regulator_consumer_supply fixed2v8_power_consumers[] = 385static struct regulator_consumer_supply fixed2v8_power_consumers[] =
383{ 386{
@@ -531,8 +534,8 @@ static struct platform_device *ag5evm_devices[] __initdata = {
531 &fsi_device, 534 &fsi_device,
532 &mmc_device, 535 &mmc_device,
533 &irda_device, 536 &irda_device,
534 &lcdc0_device,
535 &mipidsi0_device, 537 &mipidsi0_device,
538 &lcdc0_device,
536 &sdhi0_device, 539 &sdhi0_device,
537 &sdhi1_device, 540 &sdhi1_device,
538}; 541};