From 4310b3e54253b7feb830bde533b5f56cb535a37f Mon Sep 17 00:00:00 2001 From: xbw Date: Tue, 13 Sep 2011 15:21:33 +0800 Subject: [PATCH 1/4] fix bug:It did not respond with the removal of card at the first time if you reboot device with card present. --- drivers/mmc/host/rk29_sdmmc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index 650ef1d264cf..c9ed1c8522cb 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -3046,7 +3046,14 @@ static int rk29_sdmmc_probe(struct platform_device *pdev) if(RK29_CTRL_SDMMC_ID== host->pdev->id) { - clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + if(rk29_sdmmc_get_cd(host->mmc)) + { + set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + } + else + { + clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + } } From 5d4081964ec7cc2288f75d3cf5949bd2daa2737e Mon Sep 17 00:00:00 2001 From: xbw Date: Wed, 21 Sep 2011 14:25:53 +0800 Subject: [PATCH 2/4] add the feature of write-protect for sdcard --- arch/arm/mach-rk29/board-rk29-ddr3sdk.c | 13 +++++++++ arch/arm/mach-rk29/include/mach/board.h | 1 + drivers/mmc/host/Kconfig | 13 +++++++++ drivers/mmc/host/rk29_sdmmc.c | 39 ++++++++++++++++++++++--- 4 files changed, 62 insertions(+), 4 deletions(-) mode change 100644 => 100755 arch/arm/mach-rk29/include/mach/board.h mode change 100644 => 100755 drivers/mmc/host/Kconfig diff --git a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c index 7e8c3ce90ed8..6976859a2105 100755 --- a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c +++ b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c @@ -1869,6 +1869,12 @@ struct rk29_sdmmc_platform_data default_sdmmc0_data = { #endif .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO .enable_sd_wakeup = 0, + +#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) + .write_prt = RK29_PIN6_PB0,//According to your own project to set the value of write-protect-pin. +#else + .write_prt = INVALID_GPIO, +#endif }; #endif #ifdef CONFIG_SDMMC1_RK29 @@ -1912,6 +1918,13 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { #if 0 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N, #endif + +#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) + .write_prt = RK29_PIN6_PB0,//According to your own project to set the value of write-protect-pin. +#else + .write_prt = INVALID_GPIO, +#endif + }; #endif diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h old mode 100644 new mode 100755 index c97306d4af19..efd21ecc328e --- a/arch/arm/mach-rk29/include/mach/board.h +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -143,6 +143,7 @@ struct rk29_sdmmc_platform_data { int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id); int detect_irq; int enable_sd_wakeup; + int write_prt; }; struct rk29_i2c_platform_data { int bus_num; diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig old mode 100644 new mode 100755 index c5886cdd7201..85df780a5e0a --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -24,6 +24,13 @@ if SDMMC_RK29 depends on ARCH_RK29 help This supports the use of the SDMMC0 controller on Rk29 processors. + + config SDMMC0_RK29_WRITE_PROTECT + bool "Write-protect for SDMMC0" + depends on SDMMC0_RK29 + help + You will add the feature of write-protect for sdmmc-card if you say Yes. + Please note that this feature requires hardware support. # config EMMC_RK29 # tristate "RK29 EMMC controller support(sdmmc)" # default y @@ -36,6 +43,12 @@ if SDMMC_RK29 depends on ARCH_RK29 help This supports the use of the SDMMC1 controller on Rk29 processors. + config SDMMC1_RK29_WRITE_PROTECT + bool "Write-protect for SDMMC1" + depends on SDMMC1_RK29 + help + You will add the feature of write-protect for sdio-card if you say Yes. + Please note that this feature requires hardware support. endif config MMC_ARMMMCI diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index c9ed1c8522cb..ca13c9553815 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -61,7 +61,7 @@ int debug_level = 7; #define xbwprintk(n, arg...) #endif -#define RK29_SDMMC_ERROR_FLAGS (SDMMC_INT_FRUN /*| SDMMC_INT_RTO*/ | SDMMC_INT_HLE ) +#define RK29_SDMMC_ERROR_FLAGS (SDMMC_INT_FRUN | SDMMC_INT_HLE ) #define RK29_SDMMC_INTMASK_USEDMA (SDMMC_INT_CMD_DONE | SDMMC_INT_DTO | RK29_SDMMC_ERROR_FLAGS | SDMMC_INT_CD) #define RK29_SDMMC_INTMASK_USEIO (SDMMC_INT_CMD_DONE | SDMMC_INT_DTO | RK29_SDMMC_ERROR_FLAGS | SDMMC_INT_CD| SDMMC_INT_TXDR | SDMMC_INT_RXDR ) @@ -72,7 +72,7 @@ int debug_level = 7; #define RK29_SDMMC_WAIT_DTO_INTERNVAL 1500 //The time interval from the CMD_DONE_INT to DTO_INT #define RK29_SDMMC_REMOVAL_DELAY 2000 //The time interval from the CD_INT to detect_timer react. -#define RK29_SDMMC_VERSION "Ver.2.07 The last modify date is 2011-09-09,modifyed by XBW." +#define RK29_SDMMC_VERSION "Ver.2.08 The last modify date is 2011-09-21,modifyed by XBW." #define RK29_CTRL_SDMMC_ID 0 //mainly used by SDMMC #define RK29_CTRL_SDIO1_ID 1 //mainly used by sdio-wifi @@ -197,10 +197,16 @@ struct rk29_sdmmc { unsigned int oldstatus; unsigned int complete_done; unsigned int retryfunc; + #ifdef CONFIG_PM int gpio_irq; int gpio_det; #endif + +#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) || defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) + int write_protect; +#endif + }; @@ -2074,10 +2080,26 @@ out: static int rk29_sdmmc_get_ro(struct mmc_host *mmc) { - struct rk29_sdmmc *host = mmc_priv(mmc); + struct rk29_sdmmc *host = mmc_priv(mmc); + +#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) || defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) + int ret; + + if(INVALID_GPIO == host->write_protect) + ret = 0;//no write-protect + else + ret = gpio_get_value(host->write_protect)?0:1; + + xbwprintk(7,"%s..%d.. write_prt_pin=%d, get_ro=%d ===xbw[%s]===\n",\ + __FUNCTION__, __LINE__,host->write_protect, ret, host->dma_name); + + return ret; + +#else u32 wrtprt = rk29_sdmmc_read(host->regs, SDMMC_WRTPRT); - + return (wrtprt & SDMMC_WRITE_PROTECT)?1:0; +#endif } @@ -3027,6 +3049,15 @@ static int rk29_sdmmc_probe(struct platform_device *pdev) host->dma_addr = regs->start + SDMMC_DATA; } +#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) || defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) + host->write_protect = pdata->write_prt; + if(INVALID_GPIO != host->write_protect) + { + gpio_direction_input(host->write_protect); + } + +#endif + rk29_sdmmc_hw_init(host); ret = request_irq(irq, rk29_sdmmc_interrupt, 0, dev_name(&pdev->dev), host); From 5cce5b4334cb5c8b4c78913776a71a1fcbe25b93 Mon Sep 17 00:00:00 2001 From: huangdesheng Date: Wed, 21 Sep 2011 15:08:34 +0800 Subject: [PATCH 3/4] add compose_layer_count in fb --- drivers/video/rk29_fb.c | 10 +++++++++- include/linux/fb.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/video/rk29_fb.c b/drivers/video/rk29_fb.c index 7eff5a019a7e..497bed843afb 100755 --- a/drivers/video/rk29_fb.c +++ b/drivers/video/rk29_fb.c @@ -272,7 +272,7 @@ static u32 last_yuv_phy[2] = {0,0}; #endif int fb0_first_buff_bits = 32; int fb0_second_buff_bits = 32; - +int fb_compose_layer_count = 0; static BLOCKING_NOTIFIER_HEAD(rk29fb_notifier_list); int rk29fb_register_notifier(struct notifier_block *nb) { @@ -1735,6 +1735,14 @@ static int fb0_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { return fb0_first_buff_bits; } + case FBIOSET_COMPOSE_LAYER_COUNTS: + fb_compose_layer_count = arg; + break; + + case FBIOGET_COMPOSE_LAYER_COUNTS: + + return fb_compose_layer_count; + case FBIOPUT_FBPHYADD: return info->fix.smem_start; case FBIOGET_OVERLAY_STATE: diff --git a/include/linux/fb.h b/include/linux/fb.h index 4463d75862ea..c3a17a72f8b6 100755 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -49,6 +49,8 @@ struct dentry; #define FBIOGET_SCREEN_STATE 0X4620 #define FBIOGET_16OR32 0X4621 #define FBIOGET_IDLEFBUff_16OR32 0X4622 +#define FBIOSET_COMPOSE_LAYER_COUNTS 0X4623 +#define FBIOGET_COMPOSE_LAYER_COUNTS 0X4624 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ From abaf233b4a5743f3979a7ad0c9b6ff07c6bab8be Mon Sep 17 00:00:00 2001 From: xbw Date: Thu, 22 Sep 2011 12:25:13 +0800 Subject: [PATCH 4/4] Revert "add the feature of write-protect for sdcard" This reverts commit 5d4081964ec7cc2288f75d3cf5949bd2daa2737e. --- arch/arm/mach-rk29/board-rk29-ddr3sdk.c | 13 --------- arch/arm/mach-rk29/include/mach/board.h | 1 - drivers/mmc/host/Kconfig | 13 --------- drivers/mmc/host/rk29_sdmmc.c | 39 +++---------------------- 4 files changed, 4 insertions(+), 62 deletions(-) mode change 100755 => 100644 arch/arm/mach-rk29/include/mach/board.h mode change 100755 => 100644 drivers/mmc/host/Kconfig diff --git a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c index 6976859a2105..7e8c3ce90ed8 100755 --- a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c +++ b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c @@ -1869,12 +1869,6 @@ struct rk29_sdmmc_platform_data default_sdmmc0_data = { #endif .detect_irq = RK29_PIN2_PA2, // INVALID_GPIO .enable_sd_wakeup = 0, - -#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) - .write_prt = RK29_PIN6_PB0,//According to your own project to set the value of write-protect-pin. -#else - .write_prt = INVALID_GPIO, -#endif }; #endif #ifdef CONFIG_SDMMC1_RK29 @@ -1918,13 +1912,6 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { #if 0 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N, #endif - -#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) - .write_prt = RK29_PIN6_PB0,//According to your own project to set the value of write-protect-pin. -#else - .write_prt = INVALID_GPIO, -#endif - }; #endif diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h old mode 100755 new mode 100644 index efd21ecc328e..c97306d4af19 --- a/arch/arm/mach-rk29/include/mach/board.h +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -143,7 +143,6 @@ struct rk29_sdmmc_platform_data { int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id); int detect_irq; int enable_sd_wakeup; - int write_prt; }; struct rk29_i2c_platform_data { int bus_num; diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig old mode 100755 new mode 100644 index 85df780a5e0a..c5886cdd7201 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -24,13 +24,6 @@ if SDMMC_RK29 depends on ARCH_RK29 help This supports the use of the SDMMC0 controller on Rk29 processors. - - config SDMMC0_RK29_WRITE_PROTECT - bool "Write-protect for SDMMC0" - depends on SDMMC0_RK29 - help - You will add the feature of write-protect for sdmmc-card if you say Yes. - Please note that this feature requires hardware support. # config EMMC_RK29 # tristate "RK29 EMMC controller support(sdmmc)" # default y @@ -43,12 +36,6 @@ if SDMMC_RK29 depends on ARCH_RK29 help This supports the use of the SDMMC1 controller on Rk29 processors. - config SDMMC1_RK29_WRITE_PROTECT - bool "Write-protect for SDMMC1" - depends on SDMMC1_RK29 - help - You will add the feature of write-protect for sdio-card if you say Yes. - Please note that this feature requires hardware support. endif config MMC_ARMMMCI diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index ca13c9553815..c9ed1c8522cb 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -61,7 +61,7 @@ int debug_level = 7; #define xbwprintk(n, arg...) #endif -#define RK29_SDMMC_ERROR_FLAGS (SDMMC_INT_FRUN | SDMMC_INT_HLE ) +#define RK29_SDMMC_ERROR_FLAGS (SDMMC_INT_FRUN /*| SDMMC_INT_RTO*/ | SDMMC_INT_HLE ) #define RK29_SDMMC_INTMASK_USEDMA (SDMMC_INT_CMD_DONE | SDMMC_INT_DTO | RK29_SDMMC_ERROR_FLAGS | SDMMC_INT_CD) #define RK29_SDMMC_INTMASK_USEIO (SDMMC_INT_CMD_DONE | SDMMC_INT_DTO | RK29_SDMMC_ERROR_FLAGS | SDMMC_INT_CD| SDMMC_INT_TXDR | SDMMC_INT_RXDR ) @@ -72,7 +72,7 @@ int debug_level = 7; #define RK29_SDMMC_WAIT_DTO_INTERNVAL 1500 //The time interval from the CMD_DONE_INT to DTO_INT #define RK29_SDMMC_REMOVAL_DELAY 2000 //The time interval from the CD_INT to detect_timer react. -#define RK29_SDMMC_VERSION "Ver.2.08 The last modify date is 2011-09-21,modifyed by XBW." +#define RK29_SDMMC_VERSION "Ver.2.07 The last modify date is 2011-09-09,modifyed by XBW." #define RK29_CTRL_SDMMC_ID 0 //mainly used by SDMMC #define RK29_CTRL_SDIO1_ID 1 //mainly used by sdio-wifi @@ -197,16 +197,10 @@ struct rk29_sdmmc { unsigned int oldstatus; unsigned int complete_done; unsigned int retryfunc; - #ifdef CONFIG_PM int gpio_irq; int gpio_det; #endif - -#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) || defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) - int write_protect; -#endif - }; @@ -2080,26 +2074,10 @@ out: static int rk29_sdmmc_get_ro(struct mmc_host *mmc) { - struct rk29_sdmmc *host = mmc_priv(mmc); - -#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) || defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) - int ret; - - if(INVALID_GPIO == host->write_protect) - ret = 0;//no write-protect - else - ret = gpio_get_value(host->write_protect)?0:1; - - xbwprintk(7,"%s..%d.. write_prt_pin=%d, get_ro=%d ===xbw[%s]===\n",\ - __FUNCTION__, __LINE__,host->write_protect, ret, host->dma_name); - - return ret; - -#else + struct rk29_sdmmc *host = mmc_priv(mmc); u32 wrtprt = rk29_sdmmc_read(host->regs, SDMMC_WRTPRT); - + return (wrtprt & SDMMC_WRITE_PROTECT)?1:0; -#endif } @@ -3049,15 +3027,6 @@ static int rk29_sdmmc_probe(struct platform_device *pdev) host->dma_addr = regs->start + SDMMC_DATA; } -#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) || defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) - host->write_protect = pdata->write_prt; - if(INVALID_GPIO != host->write_protect) - { - gpio_direction_input(host->write_protect); - } - -#endif - rk29_sdmmc_hw_init(host); ret = request_irq(irq, rk29_sdmmc_interrupt, 0, dev_name(&pdev->dev), host);