ARM: msm: 8064: fix the SDC3 WP switch
Commit 48fc326d (msm: 8064: Disable write-protect for MTP/LIQUID) while attempting to disable the wp gpio switch on MTP and LIQUID accidentially set the wp gpio switch to zero. Zero is a valid gpio number and therefore it was not really disabled. Instead EINVAL should be used. In addition commit c9fd7de5 (IFC6410: BSP: Initial support for Inforce IFC6410 Single Board Computer (SBC)) added support for ifc6410 and used the same code as commit 48fc326d for (not) disabling the wp gpio switch on ifc6410. It was wrong in all terms, see the code: --------------cut------------------------- if (!machine_is_apq8064_cdp()) { apq8064_sdc3_pdata->wpswitch_gpio = 0; apq8064_sdc3_pdata->is_wpswitch_active_low = false; } if (!machine_is_apq8064_ifc6410()) { apq8064_sdc3_pdata->wpswitch_gpio = 0; apq8064_sdc3_pdata->is_wpswitch_active_low = false; } -------------cut-------------------------- The second if clause has no effect as the first if clause has ran already, moreover, it has a negative effect of setting the wpswitch_gpio to zero also on CDP board! That means that on all boards (including CDP) the wpswitch_gpio is set to zero (which is a valid gpio) and not disabled. Fix the above problem(s) by removing the second if clause and replacing 0 in the first if clause with -EINVAL. Also, remove the is_wpswitch_active_low setting as once we have EINVAL in wpswitch_gpio, the is_wpswitch_active_low is never parsed. Signed-off-by:Igor Grinberg <grinberg@compulab.co.il>
Loading
Please sign in to comment