|  | @@ -265,3 +265,177 @@ 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,
 | 
	
		
			
				|  |  | +	.channel	= LCDC_CHAN_MAINLCD,
 | 
	
		
			
				|  |  | +	.lane		= 2,
 | 
	
		
			
				|  |  | +	.vsynw_offset	= 20,
 | 
	
		
			
				|  |  | +	.clksrc		= 1,
 | 
	
		
			
				|  |  | +	.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 = {
 | 
	
		
			
				|  |  | +	.name           = "sh-mipi-dsi",
 | 
	
		
			
				|  |  | +	.num_resources  = ARRAY_SIZE(mipidsi0_resources),
 | 
	
		
			
				|  |  | +	.resource       = mipidsi0_resources,
 | 
	
		
			
				|  |  | +	.id             = 0,
 | 
	
		
			
				|  |  | +	.dev	= {
 | 
	
		
			
				|  |  | +		.platform_data	= &mipidsi0_info,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static unsigned char lcd_backlight_seq[3][2] = {
 | 
	
		
			
				|  |  | +	{ 0x04, 0x07 },
 | 
	
		
			
				|  |  | +	{ 0x23, 0x80 },
 | 
	
		
			
				|  |  | +	{ 0x03, 0x01 },
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static int lcd_backlight_set_brightness(int brightness)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	struct i2c_adapter *adap;
 | 
	
		
			
				|  |  | +	struct i2c_msg msg;
 | 
	
		
			
				|  |  | +	unsigned int i;
 | 
	
		
			
				|  |  | +	int ret;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if (brightness == 0) {
 | 
	
		
			
				|  |  | +		/* Reset the chip */
 | 
	
		
			
				|  |  | +		gpio_set_value(GPIO_PORT235, 0);
 | 
	
		
			
				|  |  | +		mdelay(24);
 | 
	
		
			
				|  |  | +		gpio_set_value(GPIO_PORT235, 1);
 | 
	
		
			
				|  |  | +		return 0;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	adap = i2c_get_adapter(1);
 | 
	
		
			
				|  |  | +	if (adap == NULL)
 | 
	
		
			
				|  |  | +		return -ENODEV;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
 | 
	
		
			
				|  |  | +		msg.addr = 0x6d;
 | 
	
		
			
				|  |  | +		msg.buf = &lcd_backlight_seq[i][0];
 | 
	
		
			
				|  |  | +		msg.len = 2;
 | 
	
		
			
				|  |  | +		msg.flags = 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		ret = i2c_transfer(adap, &msg, 1);
 | 
	
		
			
				|  |  | +		if (ret < 0)
 | 
	
		
			
				|  |  | +			break;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	i2c_put_adapter(adap);
 | 
	
		
			
				|  |  | +	return ret < 0 ? ret : 0;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* LCDC0 */
 | 
	
		
			
				|  |  | +static const struct fb_videomode lcdc0_modes[] = {
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		.name		= "R63302(QHD)",
 | 
	
		
			
				|  |  | +		.xres		= 544,
 | 
	
		
			
				|  |  | +		.yres		= 961,
 | 
	
		
			
				|  |  | +		.left_margin	= 72,
 | 
	
		
			
				|  |  | +		.right_margin	= 600,
 | 
	
		
			
				|  |  | +		.hsync_len	= 16,
 | 
	
		
			
				|  |  | +		.upper_margin	= 8,
 | 
	
		
			
				|  |  | +		.lower_margin	= 8,
 | 
	
		
			
				|  |  | +		.vsync_len	= 2,
 | 
	
		
			
				|  |  | +		.sync		= FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct sh_mobile_lcdc_info lcdc0_info = {
 | 
	
		
			
				|  |  | +	.clock_source = LCDC_CLK_PERIPHERAL,
 | 
	
		
			
				|  |  | +	.ch[0] = {
 | 
	
		
			
				|  |  | +		.chan = LCDC_CHAN_MAINLCD,
 | 
	
		
			
				|  |  | +		.interface_type = RGB24,
 | 
	
		
			
				|  |  | +		.clock_divider = 1,
 | 
	
		
			
				|  |  | +		.flags = LCDC_FLAGS_DWPOL,
 | 
	
		
			
				|  |  | +		.fourcc = V4L2_PIX_FMT_RGB565,
 | 
	
		
			
				|  |  | +		.lcd_modes = lcdc0_modes,
 | 
	
		
			
				|  |  | +		.num_modes = ARRAY_SIZE(lcdc0_modes),
 | 
	
		
			
				|  |  | +		.panel_cfg = {
 | 
	
		
			
				|  |  | +			.width = 44,
 | 
	
		
			
				|  |  | +			.height = 79,
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		.bl_info = {
 | 
	
		
			
				|  |  | +			.name = "sh_mobile_lcdc_bl",
 | 
	
		
			
				|  |  | +			.max_brightness = 1,
 | 
	
		
			
				|  |  | +			.set_brightness = lcd_backlight_set_brightness,
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		.tx_dev = &mipidsi0_device,
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource lcdc0_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.name	= "LCDC0",
 | 
	
		
			
				|  |  | +		.start	= 0xfe940000, /* P4-only space */
 | 
	
		
			
				|  |  | +		.end	= 0xfe943fff,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= intcs_evt2irq(0x580),
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device lcdc0_device = {
 | 
	
		
			
				|  |  | +	.name		= "sh_mobile_lcdc_fb",
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(lcdc0_resources),
 | 
	
		
			
				|  |  | +	.resource	= lcdc0_resources,
 | 
	
		
			
				|  |  | +	.id             = 0,
 | 
	
		
			
				|  |  | +	.dev	= {
 | 
	
		
			
				|  |  | +		.platform_data	= &lcdc0_info,
 | 
	
		
			
				|  |  | +		.coherent_dma_mask = ~0,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Fixed 2.8V regulators to be used by SDHI0 */
 | 
	
		
			
				|  |  | +static struct regulator_consumer_supply fixed2v8_power_consumers[] =
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
 | 
	
		
			
				|  |  | +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* SDHI0 */
 | 
	
		
			
				|  |  | +static struct sh_mobile_sdhi_info sdhi0_info = {
 | 
	
		
			
				|  |  | +	.dma_slave_tx	= SHDMA_SLAVE_SDHI0_TX,
 | 
	
		
			
				|  |  | +	.dma_slave_rx	= SHDMA_SLAVE_SDHI0_RX,
 | 
	
		
			
				|  |  | +	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
 | 
	
		
			
				|  |  | +	.tmio_caps	= MMC_CAP_SD_HIGHSPEED,
 | 
	
		
			
				|  |  | +	.tmio_ocr_mask	= MMC_VDD_27_28 | MMC_VDD_28_29,
 | 
	
		
			
				|  |  | +	.cd_gpio	= GPIO_PORT251,
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource sdhi0_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.name	= "SDHI0",
 | 
	
		
			
				|  |  | +		.start	= 0xee100000,
 | 
	
		
			
				|  |  | +		.end	= 0xee1000ff,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.name	= SH_MOBILE_SDHI_IRQ_CARD_DETECT,
 | 
	
		
			
				|  |  | +		.start	= gic_spi(83),
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[2] = {
 | 
	
		
			
				|  |  | +		.name	= SH_MOBILE_SDHI_IRQ_SDCARD,
 | 
	
		
			
				|  |  | +		.start	= gic_spi(84),
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[3] = {
 | 
	
		
			
				|  |  | +		.name	= SH_MOBILE_SDHI_IRQ_SDIO,
 | 
	
		
			
				|  |  | +		.start	= gic_spi(85),
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device sdhi0_device = {
 | 
	
		
			
				|  |  | +	.name		= "sh_mobile_sdhi",
 | 
	
		
			
				|  |  | +	.id		= 0,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(sdhi0_resources),
 | 
	
		
			
				|  |  | +	.resource	= sdhi0_resources,
 | 
	
		
			
				|  |  | +	.dev	= {
 |