• Uwe Kleine-König's avatar
    pinctrl: mxs: atomically switch mux and drive strength config · a03efbf9
    Uwe Kleine-König authored
    commit da6c2add upstream.
    
    To set the mux mode of a pin two bits must be set. Up to now this is
    implemented using the following idiom:
    
    	writel(mask, reg + CLR);
    	writel(value, reg + SET);
    
    . This however results in the mux mode being 0 between the two writes.
    
    On my machine there is an IC's reset pin connected to LCD_D20. The
    bootloader configures this pin as GPIO output-high (i.e. not holding the
    IC in reset). When Linux reconfigures the pin to GPIO the short time
    LCD_D20 is muxed as LCD_D20 instead of GPIO_1_20 is enough to confuse
    the connected IC.
    
    The same problem is present for the pin's drive strength setting which is
    reset to low drive strength before using the right value.
    
    So instead of relying on the hardware to modify the register setting
    using two writes implement the bit toggling using read-modify-write.
    
    Fixes: 17723111 ("pinctrl: add pinctrl-mxs support")
    Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Acked-by: default avatarShawn Guo <shawnguo@kernel.org>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    [bwh: Backported to 3.16: adjust filename, context]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    a03efbf9
pinctrl-mxs.c 12.8 KB