Commit 10f91676 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Lee Jones
Browse files

mfd: atmel-hlcdc: Return in case of error



For HLCDC timing engine configurations bit ATMEL_HLCDC_SIP of
ATMEL_HLCDC_SR needs to be polled before applying new config. In case of
timeout there is no indicator about this, so, return in case of timeout
and also print a message about this.

Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 4b1ca3a4
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -40,10 +40,17 @@ static int regmap_atmel_hlcdc_reg_write(void *context, unsigned int reg,

	if (reg <= ATMEL_HLCDC_DIS) {
		u32 status;
		int ret;

		readl_poll_timeout_atomic(hregmap->regs + ATMEL_HLCDC_SR,
					  status, !(status & ATMEL_HLCDC_SIP),
		ret = readl_poll_timeout_atomic(hregmap->regs + ATMEL_HLCDC_SR,
						status,
						!(status & ATMEL_HLCDC_SIP),
						1, 100);
		if (ret) {
			dev_err(hregmap->dev,
				"Timeout! Clock domain synchronization is in progress!\n");
			return ret;
		}
	}

	writel(val, hregmap->regs + reg);