Hi Igor,
Thanks for the input. I made below changes :
in u-boot:
#define USDHC_WP_PAD_CTRL (NO_PAD_CTL(1 << 31))
#define USDHC1_WP_GPIO (IMX_GPIO_NR(4, 25))
static iomux_v3_cfg_t usdhc1_wp_pads[] = {
(MX6_PAD_CSI_DATA04__GPIO4_IO25 | MUX_PAD_CTRL(NO_PAD_CTRL)),
};
imx_iomux_v3_setup_multiple_pads(usdhc1_wp_pads, ARRAY_SIZE(usdhc1_wp_pads));
gpio_direction_input(USDHC1_WP_GPIO);
ret = gpio_get_value(USDHC1_WP_GPIO);
has been added to pad changes to the wp pin.
in DTB:
&usdhc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usdhc1>;
gpio-controller;
#gpio-cells = <2>;
cd-gpios = <&gpio2 21 0>;
#gpio-cells = <2>;
wp-gpios = <&gpio4 25 0>;
input;
no-1-8-v;
keep-power-in-suspend;
enable-sdio-wakeup;
status = "okay";
};
pinctrl_usdhc1: usdhc1grp {
fsl,pins = <
MX6UL_PAD_SD1_CMD__USDHC1_CMD 0x17059
MX6UL_PAD_SD1_CLK__USDHC1_CLK 0x17059
MX6UL_PAD_CSI_DATA04__GPIO4_IO25 0x80000000
MX6UL_PAD_SD1_DATA0__USDHC1_DATA0 0x17059
MX6UL_PAD_SD1_DATA1__USDHC1_DATA1 0x17059
MX6UL_PAD_SD1_DATA2__USDHC1_DATA2 0x17059
MX6UL_PAD_SD1_DATA3__USDHC1_DATA3 0x17059
>;
};
But now the problem is, I'm able to see
1. The SD card is write protected either write protected from bootup [if the pin is set to high], or
2. not write protected from boot up [if the pin is low]. in such case, even after bootup, if the pin is changed to high, write protect is not getting applied. i'm still able to write to the SD card.
Am I missing something? or some changes still needed? or is it expected behaviour? can we apply write protection to uSDHC during run time? Kindly clarify. Thanks.
BR,
Anantha R