diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-rz/configs/linux-3.8.13.config buildroot-2013.08.1-ckb-20150123-1-new/board/ckb/ckb-rz/configs/linux-3.8.13.config
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-rz/configs/linux-3.8.13.config	2014-07-02 14:47:19.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-new/board/ckb/ckb-rz/configs/linux-3.8.13.config	2015-10-20 10:25:53.459581900 +0900
***************
*** 337,344 ****
  CONFIG_CKB_LCD_SUPPORT=y
  CONFIG_CKB_LCD_02=y
  # CONFIG_VISIONX_KTM050AL02 is not set
! CONFIG_CKB_LVDS_SUPPORT=y
! # CONFIG_DISPLAY_LVDS_RESOLUTIONS is not set
  CONFIG_CKB_EASY_SWITCH_MODE=y
  # CONFIG_CKB_DYNAMIC_DEBUG is not set
  CONFIG_CKB_TSC2007_TOUCH_PANEL=y
--- 337,343 ----
  CONFIG_CKB_LCD_SUPPORT=y
  CONFIG_CKB_LCD_02=y
  # CONFIG_VISIONX_KTM050AL02 is not set
! # CONFIG_CKB_LVDS_SUPPORT is not set
  CONFIG_CKB_EASY_SWITCH_MODE=y
  # CONFIG_CKB_DYNAMIC_DEBUG is not set
  CONFIG_CKB_TSC2007_TOUCH_PANEL=y
***************
*** 1669,1675 ****
  # CONFIG_VIDEO_OUTPUT_CONTROL is not set
  CONFIG_FB=y
  # CONFIG_FIRMWARE_EDID is not set
! CONFIG_FB_DDC=y
  # CONFIG_FB_BOOT_VESA_SUPPORT is not set
  # CONFIG_FB_CFB_FILLRECT is not set
  # CONFIG_FB_CFB_COPYAREA is not set
--- 1668,1674 ----
  # CONFIG_VIDEO_OUTPUT_CONTROL is not set
  CONFIG_FB=y
  # CONFIG_FIRMWARE_EDID is not set
! # CONFIG_FB_DDC is not set
  # CONFIG_FB_BOOT_VESA_SUPPORT is not set
  # CONFIG_FB_CFB_FILLRECT is not set
  # CONFIG_FB_CFB_COPYAREA is not set
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-rz/patches/linux-3.8.13-005-20151020-RevD.patch buildroot-2013.08.1-ckb-20150123-1-new/board/ckb/ckb-rz/patches/linux-3.8.13-005-20151020-RevD.patch
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-rz/patches/linux-3.8.13-005-20151020-RevD.patch	1970-01-01 09:00:00.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-new/board/ckb/ckb-rz/patches/linux-3.8.13-005-20151020-RevD.patch	2015-10-20 13:17:59.414095545 +0900
***************
*** 0 ****
--- 1,313 ----
+ diff -crN linux-3.8.13/arch/arm/mach-shmobile/board-ckbrza1h.c linux-3.8.13-RevD/arch/arm/mach-shmobile/board-ckbrza1h.c
+ *** linux-3.8.13/arch/arm/mach-shmobile/board-ckbrza1h.c	2015-10-20 13:11:23.794099097 +0900
+ --- linux-3.8.13-RevD/arch/arm/mach-shmobile/board-ckbrza1h.c	2015-10-20 13:15:39.384357700 +0900
+ ***************
+ *** 73,78 ****
+ --- 73,79 ----
+   #define CMJ100_WLAN_IRQ			P2_13
+   #define CMJ100_WLAN_EN			P3_9
+   #define CMJ100_X_RST			P8_12
+ + #define CMJ100_REVD_X_RST		P4_9
+   #endif
+   
+   #define MMCSD_CD_PIN			P4_8
+ ***************
+ *** 102,107 ****
+ --- 103,110 ----
+   unsigned long FB_DATA_VADDRESS = 0;
+   unsigned long FB_MAP_SIZE = 0;
+   
+ + unsigned char g_rev = 'A';
+ + 
+   static struct mtd_partition spibsc0_flash_partitions[] = {
+   	{
+   		.name		= "U-Boot",
+ ***************
+ *** 285,291 ****
+   	.reg_start = 0xFCFF7A30,
+   	.reg_end = 0xFCFF7A5C,
+   	.connect_poll_interval = 500,					/* 500 ms */
+ - 	.hplug_status =  &lvds_hplug_status,
+   };
+   
+   struct platform_device ckb_lvds_device = {
+ --- 288,293 ----
+ ***************
+ *** 342,353 ****
+   
+   static struct platform_device *ckbrza1h_devices[] __initdata = {
+   	&sdhi0_device,
+ - #if defined(CONFIG_SUPPORT_CMJ100)
+ - 	&sdhi1_device,
+ - #endif
+ - #ifdef CONFIG_CKB_LVDS_SUPPORT
+ - 	&ckb_lvds_device,
+ - #endif
+   	&bsc_device,
+   #ifdef CONFIG_CKB_EXT1_CN_CS2
+   	&ckb_CS2_device,
+ --- 344,349 ----
+ ***************
+ *** 485,503 ****
+   	rza1_pfc_pin_assign(P3_15, ALT7, DIR_PIPC);
+   
+   #if defined(CONFIG_SUPPORT_CMJ100)
+ ! 	rza1_pfc_pin_assign(CMJ100_X_RST, PMODE, DIR_OUT);
+   
+ ! 	if (gpio_request(CMJ100_X_RST, "CMJ100_RST") ||
+ ! 			gpio_direction_output(CMJ100_X_RST, 0))
+ ! 		pr_warning("Error initializing the CMJ100_RST GPIO %d\n",
+ ! 					CMJ100_X_RST);
+   	
+ ! 	udelay(5);
+ ! 	gpio_set_value(CMJ100_X_RST, 1);
+ ! 	udelay(100);
+ ! 	gpio_set_value(CMJ100_X_RST, 0);
+ ! 	udelay(5);
+ ! 	gpio_free(CMJ100_X_RST);
+   #endif		
+   
+   #ifdef CONFIG_SUPPORT_CMJ100
+ --- 481,517 ----
+   	rza1_pfc_pin_assign(P3_15, ALT7, DIR_PIPC);
+   
+   #if defined(CONFIG_SUPPORT_CMJ100)
+ ! 	if(g_rev >= 'D')
+ ! 	{
+ ! 		rza1_pfc_pin_assign(CMJ100_REVD_X_RST, PMODE, DIR_OUT);
+ ! 		if (gpio_request(CMJ100_REVD_X_RST, "CMJ100_RST") ||
+ ! 				gpio_direction_output(CMJ100_REVD_X_RST, 1))
+ ! 			pr_warning("Error initializing the CMJ100_RST GPIO %d\n",
+ ! 						CMJ100_REVD_X_RST);
+ ! 	
+ ! 		udelay(5);
+ ! 		gpio_set_value(CMJ100_REVD_X_RST, 0);
+ ! 		udelay(100);
+ ! 		gpio_set_value(CMJ100_REVD_X_RST, 1);
+ ! 		udelay(5);
+ ! 		gpio_free(CMJ100_REVD_X_RST);
+ ! 	}
+ ! 	else
+ ! 	{
+ ! 		rza1_pfc_pin_assign(CMJ100_X_RST, PMODE, DIR_OUT);
+   
+ ! 		if (gpio_request(CMJ100_X_RST, "CMJ100_RST") ||
+ ! 				gpio_direction_output(CMJ100_X_RST, 0))
+ ! 			pr_warning("Error initializing the CMJ100_RST GPIO %d\n",
+ ! 						CMJ100_X_RST);
+   	
+ ! 		udelay(5);
+ ! 		gpio_set_value(CMJ100_X_RST, 1);
+ ! 		udelay(100);
+ ! 		gpio_set_value(CMJ100_X_RST, 0);
+ ! 		udelay(5);
+ ! 		gpio_free(CMJ100_X_RST);
+ ! 	}
+   #endif		
+   
+   #ifdef CONFIG_SUPPORT_CMJ100
+ ***************
+ *** 1729,1734 ****
+ --- 1743,1788 ----
+   
+   }
+   
+ + #define BOARD_REV_OFFSET 40
+ + unsigned char board_rev_header[2] = {0xA5, 0xDE};
+ + unsigned char read_board_rev(void)
+ + {
+ + 	size_t len;
+ + 	int addr;
+ + 	int i;
+ + 	unsigned char val;
+ + 
+ + 	printk("Reading board revision from EEPROM\n");
+ + 	if(!g_at24i2c_mem_acc)
+ + 	{
+ + 		printk("No EEPROM device found, using default board revision\n");
+ + 		return 'C';
+ + 	}
+ + 	if(!g_at24i2c_mem_acc->read)
+ + 	{
+ + _read_fail:
+ + 		printk("Unable to read board revision, using default\n");
+ + 		return 'C';
+ + 	}
+ + 	len = 3;
+ + 	addr = BOARD_REV_OFFSET;
+ + 	/* read data in bytes */
+ + 	for(i=0; i<2; i++)
+ + 	{
+ + 		if(g_at24i2c_mem_acc->read(g_at24i2c_mem_acc, &val, addr+i, 1) != 1)
+ + 			goto _read_fail;
+ + 		if(val != board_rev_header[i])
+ + 		{
+ + 			printk("Board revision not found, using default\n");
+ + 			return 'C';
+ + 		}
+ + 	}
+ + 	if(g_at24i2c_mem_acc->read(g_at24i2c_mem_acc, &val, addr+i, 1) != 1)
+ + 			goto _read_fail;
+ + 	
+ + 	return val;
+ + }
+ + 
+   void __init ckbrza1h_init(void)
+   {
+   	/* map the address for interrupt controller (only 48 bits) */
+ ***************
+ *** 1746,1753 ****
+   	ckbrza1h_init_spi();
+   #endif
+   	board_init_led();
+ - 	
+ - 	ckbrza1h_init_sdio();
+   
+   	ckbrza1h_init_mmc();
+   
+ --- 1800,1805 ----
+ ***************
+ *** 1755,1764 ****
+   	ckbrza1h_init_lcd();
+   #endif
+   
+ - #ifdef CONFIG_CKB_LVDS_SUPPORT
+ - 	setup_lvds_hplug_pin();
+ - #endif
+ - 
+   #if defined(CONFIG_FB_VDC5)
+   	vdc5fb_setup();
+   #endif
+ --- 1807,1812 ----
+ ***************
+ *** 1843,1848 ****
+ --- 1891,1925 ----
+   static int __late_init_calls(void)
+   {
+   	rskrza1_init_sh_eth();
+ + 
+ + 
+ + 	/* read EEPROM to determine the board version */
+ + 	g_rev = read_board_rev();
+ + 	printk("Board revision: %c", g_rev);
+ + 			
+ + 	if(g_rev >= 'D')
+ + 	{
+ + 		/* Revision D tweaks */
+ + #ifdef CONFIG_CKB_LVDS_SUPPORT
+ + 		lvds_data.hplug_status = NULL;
+ + #endif
+ + 	}
+ + 	else
+ + 	{
+ + #ifdef CONFIG_CKB_LVDS_SUPPORT
+ + 		setup_lvds_hplug_pin();
+ + 		lvds_data.hplug_status =  &lvds_hplug_status;
+ + #endif
+ + 	}
+ + 
+ + 	ckbrza1h_init_sdio();
+ + 
+ + #if defined(CONFIG_SUPPORT_CMJ100)
+ + 	platform_device_register(&sdhi1_device);
+ + #endif
+ + #ifdef CONFIG_CKB_LVDS_SUPPORT
+ + 	platform_device_register(&ckb_lvds_device);
+ + #endif
+   	return 0;
+   }
+   late_initcall(__late_init_calls);
+ diff -crN linux-3.8.13/drivers/video/renesas/lvds/ckb_lvds.c linux-3.8.13-RevD/drivers/video/renesas/lvds/ckb_lvds.c
+ *** linux-3.8.13/drivers/video/renesas/lvds/ckb_lvds.c	2015-10-20 13:10:21.782099653 +0900
+ --- linux-3.8.13-RevD/drivers/video/renesas/lvds/ckb_lvds.c	2015-10-20 13:16:16.221464600 +0900
+ ***************
+ *** 292,300 ****
+   	if(!ckb_lvds_dev)
+   		return 1;
+   
+ ! 	if(!(*ckb_lvds_dev->plat_data->hplug_status)())
+   	{
+ ! 		return 1;				/* device not connected */
+   	}
+   	adapter = i2c_get_adapter(ckb_lvds_dev->plat_data->i2c_port);
+   	if (!adapter) {
+ --- 292,303 ----
+   	if(!ckb_lvds_dev)
+   		return 1;
+   
+ ! 	if(ckb_lvds_dev->plat_data->hplug_status)
+   	{
+ ! 		if(!(*ckb_lvds_dev->plat_data->hplug_status)())
+ ! 		{
+ ! 			return 1;				/* device not connected */
+ ! 		}
+   	}
+   	adapter = i2c_get_adapter(ckb_lvds_dev->plat_data->i2c_port);
+   	if (!adapter) {
+ ***************
+ *** 304,309 ****
+ --- 307,315 ----
+   	edid = get_edid(adapter);
+   	if(!edid)
+   	{
+ + 		if(!ckb_lvds_dev->plat_data->hplug_status)
+ + 			return 1;		/* treat like the device is not connected */
+ + 
+   		pr_err("Couldn't read EDID from device on adapter i2c%u\n", ckb_lvds_dev->plat_data->i2c_port);
+   		return 2;
+   	}
+ ***************
+ *** 484,491 ****
+   		goto _out;
+   	}
+   
+ ! 	connector_plugged = (*dev_priv->plat_data->hplug_status)();
+ ! 	
+   #ifdef _TEST_HDMI_BY_DICONNECTING
+   	static int first_plugged = 0;
+   #endif
+ --- 490,519 ----
+   		goto _out;
+   	}
+   
+ ! 	if(!dev_priv->plat_data->hplug_status)
+ ! 	{
+ ! 		struct i2c_adapter *adapter;
+ ! 		u8 *edid;
+ ! 		adapter = i2c_get_adapter(dev_priv->plat_data->i2c_port);
+ ! 		if(!adapter)
+ ! 		{
+ ! 			 /* failed to get I2C adapter; treat like the device is not connected */
+ ! 			connector_plugged = 0;
+ ! 		}
+ ! 		else
+ ! 		{
+ ! 			edid = get_edid(adapter);
+ ! 			if(!edid)
+ ! 				/* Couldn't read EDID from device; treat like the device is not connected */
+ ! 				connector_plugged = 0;
+ ! 			else
+ ! 				connector_plugged = 1;
+ ! 		}
+ ! 	}
+ ! 	else
+ ! 	{
+ ! 		connector_plugged = (*dev_priv->plat_data->hplug_status)();
+ ! 	}
+   #ifdef _TEST_HDMI_BY_DICONNECTING
+   	static int first_plugged = 0;
+   #endif
+ ***************
+ *** 602,607 ****
+ --- 630,640 ----
+   		goto error_timer;
+   	}
+   
+ + 	if(!ckb_lvds_dev->plat_data->hplug_status)
+ + 	{
+ + 		printk("Warning: CKB LVDS Hotplug GPIO not specified\n");
+ + 	}
+ + 
+   	printk("CKB LVDS driver with max resolution %dx%d\n",
+   				ckb_lvds_dev->plat_data->max_xres, ckb_lvds_dev->plat_data->max_yres);
+   	
