[U-Boot] [PATCH 1/5] mmc: uniphier-sd: Factor out register IO
Masahiro Yamada
yamada.masahiro at socionext.com
Thu Aug 3 12:36:49 UTC 2017
Hi Marek,
Very sorry for my late reply.
I agree we should share the driver
to avoid code duplication.
I tested the series on my board and working.
Basically, I'd say "go for it".
A little minor comments below.
2017-07-22 6:24 GMT+09:00 Marek Vasut <marek.vasut at gmail.com>:
> This patch prepares the driver to support controller(s) with registers
> at locations shifted by constant. Pull out the readl()/writel() from
> the driver into separate functions, where the adjustment of the register
> offset can be easily contained.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> ---
> drivers/mmc/uniphier-sd.c | 115 +++++++++++++++++++++++++---------------------
> 1 file changed, 63 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
> index e272b14153..70090522bd 100644
> --- a/drivers/mmc/uniphier-sd.c
> +++ b/drivers/mmc/uniphier-sd.c
> @@ -134,6 +134,17 @@ struct uniphier_sd_priv {
> #define UNIPHIER_SD_CAP_DIV1024 BIT(2) /* divisor 1024 is available */
> };
>
> +static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, const u32 reg)
"const" is unneeded here.
Also, could you use "unsigned int" or "int" for reg?
> +{
> + return readl(priv->regbase + reg);
> +}
> +
> +static void uniphier_sd_writel(struct uniphier_sd_priv *priv,
> + const u32 val, const u32 reg)
Same here. Please drop "const".
Please use "unsigned int" or "int" for reg
It is OK to use u32 for val.
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list