Re: [PATCH linux-next 2/2] mfd: flexcom: add a driver for Atmel Flexible Serial Communication Unit
From: Alexandre Belloni
Date: Mon Jun 15 2015 - 13:51:22 EST
Hi,
On 15/06/2015 at 18:38:05 +0200, Cyrille Pitchen wrote :
> + err = of_property_read_string(pdev->dev.of_node,
> + "atmel,flexcom-mode", &mode);
> + if (err)
> + return err;
> +
> + if (!strcmp(mode, "usart"))
> + mr = FX_MR_USART;
> + else if (!strcmp(mode, "spi"))
> + mr = FX_MR_SPI;
> + else if (!strcmp(mode, "twi") || !strcmp(mode, "i2c"))
> + mr = FX_MR_TWI;
> + else
> + return -EINVAL;
> +
> + clk_prepare_enable(clk);
> + version = __raw_readl(map + FX_VERSION);
> + __raw_writel(mr, map + FX_MR);
> + clk_disable_unprepare(clk);
> +
> + dev_info(&pdev->dev, "version: %#x\n", version);
> +
I would also print the selected mode for debugging convenience,
especially if this is used with device tree overlays.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/