From c167037b8ae5bc428f19a4c8eb0366dcd0284a56 Mon Sep 17 00:00:00 2001 From: xjh Date: Wed, 7 May 2014 21:40:35 +0800 Subject: [PATCH] 1. sdmmc support level-2 suspend 2. sdmmc suspend not to removed card --- arch/arm/boot/dts/lcd-wqxga-mipi.dtsi | 26 +++++++++++++++++- arch/arm/boot/dts/rk3288-clocks.dtsi | 4 +-- arch/arm/boot/dts/rk3288-p977.dts | 3 ++- arch/arm/boot/dts/rk3288-tb.dts | 9 +++++-- arch/arm/boot/dts/rk3288.dtsi | 1 + drivers/mmc/host/rk_sdmmc.c | 39 ++++++++++++++++++++++++--- drivers/mmc/host/rk_sdmmc.h | 2 +- 7 files changed, 74 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/lcd-wqxga-mipi.dtsi b/arch/arm/boot/dts/lcd-wqxga-mipi.dtsi index 71e46a7c72f5..815ffbbc3fa8 100755 --- a/arch/arm/boot/dts/lcd-wqxga-mipi.dtsi +++ b/arch/arm/boot/dts/lcd-wqxga-mipi.dtsi @@ -11,24 +11,30 @@ / { /* about mipi */ disp_mipi_init: mipi_dsi_init{ + compatible = "rockchip,mipi_dsi_init"; rockchip,screen_init = <1>; rockchip,dsi_lane = <4>; rockchip,dsi_hs_clk = <950>; rockchip,mipi_dsi_num = <2>; }; disp_mipi_power_ctr: mipi_power_ctr { + compatible = "rockchip,mipi_power_ctr"; mipi_lcd_rst:mipi_lcd_rst{ + compatible = "rockchip,lcd_rst"; rockchip,gpios = <&gpio7 GPIO_B2 GPIO_ACTIVE_HIGH>; rockchip,delay = <100>; }; /*mipi_lcd_en:mipi_lcd_en { + compatible = "rockchip,lcd_en"; rockchip,gpios = <&gpio6 GPIO_A7 GPIO_ACTIVE_HIGH>; rockchip,delay = <10>; };*/ }; disp_mipi_init_cmds: screen-on-cmds { rockchip,cmd_debug = <0>; + compatible = "rockchip,screen-on-cmds"; rockchip,on-cmds1 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x05 0x01>; //set soft reset @@ -36,54 +42,63 @@ }; rockchip,on-cmds2 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x15 0x3a 0x77>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds3 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x39 0x2a 0x00 0x00 0x04 0xff>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds4 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x39 0x2b 0x00 0x00 0x06 0x3f>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds5 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <1>; rockchip,cmd = <0x15 0x35 0x00>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds6 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <1>; rockchip,cmd = <0x39 0x44 0x00 0x00>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds7 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x15 0x51 0xff>; //0xff rockchip,cmd_delay = <0>; }; rockchip,on-cmds8 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x15 0x53 0x24>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds9 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x15 0x51 0xff>; //0xff rockchip,cmd_delay = <0>; }; rockchip,on-cmds10 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x15 0x53 0x24>; @@ -91,12 +106,14 @@ }; rockchip,on-cmds11 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x15 0x55 0x03>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds12 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x05 dcs_exit_sleep_mode>; @@ -104,6 +121,7 @@ }; rockchip,on-cmds13 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x23 0xb0 0x00>; @@ -111,6 +129,7 @@ }; rockchip,on-cmds14 { //video + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x29 0xb3 0x1c>; @@ -118,18 +137,21 @@ }; rockchip,on-cmds15 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x29 0xce 0x7d 0x40 0x48 0x56 0x67 0x78 0x88 0x98 0xa7 0xb5 0xc3 0xd1 0xde 0xe9 0xf2 0xfa 0xff 0x04 0x00>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds16 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x23 0xb0 0x03>; rockchip,cmd_delay = <0>; }; rockchip,on-cmds17 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x39 0x2c >; @@ -137,6 +159,7 @@ }; rockchip,on-cmds18 { + compatible = "rockchip,on-cmds"; rockchip,cmd_type = ; rockchip,dsi_id = <2>; rockchip,cmd = <0x05 dcs_set_display_on>; @@ -147,11 +170,12 @@ disp_timings: display-timings { native-mode = <&timing0>; + compatible = "rockchip,display-timings"; timing0: timing0 { screen-type = ; lvds-format = ; out-face = ; - clock-frequency = <280000000>; + clock-frequency = <120000000>; hactive = <2560>; vactive = <1600>; diff --git a/arch/arm/boot/dts/rk3288-clocks.dtsi b/arch/arm/boot/dts/rk3288-clocks.dtsi index 93612c6bdf2b..b5090ee9a7c6 100755 --- a/arch/arm/boot/dts/rk3288-clocks.dtsi +++ b/arch/arm/boot/dts/rk3288-clocks.dtsi @@ -2636,9 +2636,9 @@ "g_p_alive_niu", "reserved", "reserved", "reserved"; - //rockchip,suspend-clkgating-setting=<0xffff 0xffff>; + rockchip,suspend-clkgating-setting=<0xffff 0xffff>; - rockchip,suspend-clkgating-setting=<0x19fe 0x19fe>; + // rockchip,suspend-clkgating-setting=<0x1801 0x1801>; #clock-cells = <1>; }; diff --git a/arch/arm/boot/dts/rk3288-p977.dts b/arch/arm/boot/dts/rk3288-p977.dts index 53f4b404e6f2..dc8cbbcc243f 100755 --- a/arch/arm/boot/dts/rk3288-p977.dts +++ b/arch/arm/boot/dts/rk3288-p977.dts @@ -199,7 +199,8 @@ supports-sd; broken-cd; card-detect-delay = <200>; - + ignore-pm-notify; + keep-power-in-suspend; vmmc-supply = <&rk808_ldo5_reg>; status = "okay"; diff --git a/arch/arm/boot/dts/rk3288-tb.dts b/arch/arm/boot/dts/rk3288-tb.dts index fcf27607c3c5..5a3e915456a2 100755 --- a/arch/arm/boot/dts/rk3288-tb.dts +++ b/arch/arm/boot/dts/rk3288-tb.dts @@ -1,7 +1,9 @@ /dts-v1/; #include "rk3288.dtsi" -#include "lcd-b101ew05.dtsi" +//#include "lcd-b101ew05.dtsi" +//#include "lcd-ld089wu1-mipi.dtsi" +#include "lcd-wqxga-mipi.dtsi" / { fiq-debugger { @@ -52,7 +54,7 @@ backlight { compatible = "pwm-backlight"; pwms = <&pwm0 0 25000>; - brightness-levels = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255>; + brightness-levels = <255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0>; default-brightness-level = <128>; enable-gpios = <&gpio7 GPIO_A2 GPIO_ACTIVE_HIGH>; }; @@ -221,6 +223,8 @@ supports-highspeed; supports-sd; broken-cd; + ignore-pm-notify; + keep-power-in-suspend; card-detect-delay = <200>; vmmc-supply = <&rk808_ldo5_reg>; status = "okay"; @@ -528,6 +532,7 @@ &fb { rockchip,disp-mode = ; + rockchip,uboot-logo-on = <1>; }; &rk_screen { diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 42e63363665a..a2c715815335 100755 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -283,6 +283,7 @@ pinctrl-names = "default", "idle"; pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; pinctrl-1 = <&sdmmc0_gpio>; + cd-gpios = <&gpio6 GPIO_C6 GPIO_ACTIVE_HIGH>;/*CD GPIO*/ clocks = <&clk_sdmmc>, <&clk_gates8 3>; clock-names = "clk_mmc", "hclk_mmc"; num-slots = <1>; diff --git a/drivers/mmc/host/rk_sdmmc.c b/drivers/mmc/host/rk_sdmmc.c index 680df561759a..3478e4330a00 100755 --- a/drivers/mmc/host/rk_sdmmc.c +++ b/drivers/mmc/host/rk_sdmmc.c @@ -2401,6 +2401,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) if (pending & SDMMC_INT_CD) { mci_writel(host, RINTSTS, SDMMC_INT_CD); + rk_send_wakeup_key(); queue_work(host->card_workqueue, &host->card_work); } @@ -2640,7 +2641,7 @@ static int dw_mci_of_get_wp_gpio(struct device *dev, u8 slot) static void dw_mci_of_get_cd_gpio(struct device *dev, u8 slot, struct mmc_host *mmc) { - struct device_node *np = dw_mci_of_find_slot_node(dev, slot); + struct device_node *np = dev->of_node;//dw_mci_of_find_slot_node(dev, slot); int gpio; if (!np) @@ -2851,8 +2852,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) } slot->wp_gpio = dw_mci_of_get_wp_gpio(host->dev, slot->id); - dw_mci_of_get_cd_gpio(host->dev, slot->id, mmc); - + //dw_mci_of_get_cd_gpio(host->dev, slot->id,mmc); if (mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO) clear_bit(DW_MMC_CARD_PRESENT, &slot->flags); @@ -2870,6 +2870,15 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) printk("%s: Warning : No pinctrl used!\n",mmc_hostname(host->mmc)); else { + host->pins_idle= pinctrl_lookup_state(host->pinctrl,PINCTRL_STATE_IDLE); + if(IS_ERR(host->pins_default)) + printk("%s: Warning : No IDLE pinctrl matched!\n", mmc_hostname(host->mmc)); + else + { + if(pinctrl_select_state(host->pinctrl, host->pins_idle) < 0) + printk("%s: Warning : Idle pinctrl setting failed!\n", mmc_hostname(host->mmc)); + } + host->pins_default = pinctrl_lookup_state(host->pinctrl,PINCTRL_STATE_DEFAULT); if(IS_ERR(host->pins_default)) printk("%s: Warning : No default pinctrl matched!\n", mmc_hostname(host->mmc)); @@ -3369,6 +3378,19 @@ int dw_mci_suspend(struct dw_mci *host) if (host->vmmc) regulator_disable(host->vmmc); + /* Clear the interrupts for the host controller */ + mci_writel(host, RINTSTS, 0xFFFFFFFF); + mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */ + mci_writel(host, CTRL, 0); + + /*only for sdmmc controller*/ + if(host->mmc->restrict_caps & RESTRICT_CARD_TYPE_SD) { + disable_irq(host->irq); + if(pinctrl_select_state(host->pinctrl, host->pins_idle) < 0) + printk("%s: Warning : Idle pinctrl setting failed!\n", mmc_hostname(host->mmc)); + dw_mci_of_get_cd_gpio(host->dev,0,host->mmc); + enable_irq_wake(host->mmc->slot.cd_irq); + } return 0; } EXPORT_SYMBOL(dw_mci_suspend); @@ -3421,6 +3443,17 @@ int dw_mci_resume(struct dw_mci *host) dw_mci_setup_bus(slot, true); } } + + /*only for sdmmc controller*/ + if(host->mmc->restrict_caps & RESTRICT_CARD_TYPE_SD) { + disable_irq_wake(host->mmc->slot.cd_irq); + mmc_gpio_free_cd(host->mmc); + if(pinctrl_select_state(host->pinctrl, host->pins_default) < 0) + printk("%s: Warning : Default pinctrl setting failed!\n", mmc_hostname(host->mmc)); + enable_irq(host->irq); + + } + return 0; } EXPORT_SYMBOL(dw_mci_resume); diff --git a/drivers/mmc/host/rk_sdmmc.h b/drivers/mmc/host/rk_sdmmc.h index 262db2025c3e..01a86fd9df5c 100755 --- a/drivers/mmc/host/rk_sdmmc.h +++ b/drivers/mmc/host/rk_sdmmc.h @@ -258,7 +258,7 @@ static struct sdmmc_reg dw_mci_regs[] = #define mci_writeq(dev, reg, value) \ (*(volatile u64 __force *)((dev)->regs + SDMMC_##reg) = (value)) #endif - +extern void rk_send_wakeup_key(void); extern int dw_mci_probe(struct dw_mci *host); extern void dw_mci_remove(struct dw_mci *host); #ifdef CONFIG_PM -- 2.34.1