Commit d675652038004436ce812fbdc53f61a3fee2b187
Committed by
guoyin.chen
1 parent
34da3001c0
Exists in
smarc-imx_v2015.04_4.1.15_1.0.0_ga
and in
1 other branch
MLK-12102 mmc: fsl: introduce wp_enable
Introudce wp_enable. If want to check WPSPL, then in board code, need to set wp_enable to 1. Take i.MX6UL for example, to some boards, they do not use WP singal, so they does not configure USDHC1_WP_SELECT_INPUT, and its default value is 0(GPIO1_IO02). However GPIO1_IO02 is muxed for i2c usage and SION bit set. So USDHC controller can always get wp signal and WPSPL shows write protect and blocks driver continuing. This is not what we want to see, so add wp_enable, and if set to 0, just omit the WPSPL checking and this does not effect normal working of usdhc controller. Suggested-by: Ye.Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Showing 2 changed files with 8 additions and 4 deletions Side-by-side Diff
drivers/mmc/fsl_esdhc.c
... | ... | @@ -212,9 +212,12 @@ |
212 | 212 | #endif |
213 | 213 | if (wml_value > WML_WR_WML_MAX) |
214 | 214 | wml_value = WML_WR_WML_MAX_VAL; |
215 | - if ((esdhc_read32(®s->prsstat) & PRSSTAT_WPSPL) == 0) { | |
216 | - printf("\nThe SD card is locked. Can not write to a locked card.\n\n"); | |
217 | - return TIMEOUT; | |
215 | + | |
216 | + if (cfg->wp_enable) { | |
217 | + if ((esdhc_read32(®s->prsstat) & PRSSTAT_WPSPL) == 0) { | |
218 | + printf("\nThe SD card is locked. Can not write to a locked card.\n\n"); | |
219 | + return TIMEOUT; | |
220 | + } | |
218 | 221 | } |
219 | 222 | |
220 | 223 | esdhc_clrsetbits32(®s->wml, WML_WR_WML_MASK, |
include/fsl_esdhc.h
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | * FSL SD/MMC Defines |
3 | 3 | *------------------------------------------------------------------- |
4 | 4 | * |
5 | - * Copyright 2007-2008, 2010-2013 Freescale Semiconductor, Inc. | |
5 | + * Copyright 2007-2008, 2010-2015 Freescale Semiconductor, Inc. | |
6 | 6 | * |
7 | 7 | * SPDX-License-Identifier: GPL-2.0+ |
8 | 8 | */ |
... | ... | @@ -168,6 +168,7 @@ |
168 | 168 | u32 esdhc_base; |
169 | 169 | u32 sdhc_clk; |
170 | 170 | u8 max_bus_width; |
171 | + u8 wp_enable; | |
171 | 172 | struct mmc_config cfg; |
172 | 173 | }; |
173 | 174 |