Re: [U-Boot] [PATCH] mmc: uniphier-sd: Update the file to match V3 patchset
On 09/27/2017 03:05 AM, Marek Vasut wrote: > Old version of the uniphier-sd 64bit IO support patchset V1 was > applied by the maintainer, update the uniphier-sd.c with the > changes from the V3 of the patchset. > > Signed-off-by: Marek Vasut> Cc: Masahiro Yamada > Cc: Jaehoon Chung Applied to u-boot-mmc. Thanks! > --- > drivers/mmc/uniphier-sd.c | 83 > --- > 1 file changed, 42 insertions(+), 41 deletions(-) > > diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c > index 0786ad0d5f..3c52161067 100644 > --- a/drivers/mmc/uniphier-sd.c > +++ b/drivers/mmc/uniphier-sd.c > @@ -135,7 +135,7 @@ struct uniphier_sd_priv { > #define UNIPHIER_SD_CAP_64BITBIT(3) /* Controller is 64bit > */ > }; > > -static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, const u32 reg) > +static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > return readq(priv->regbase + (reg << 1)); > @@ -144,7 +144,7 @@ static u64 uniphier_sd_readq(struct uniphier_sd_priv > *priv, const u32 reg) > } > > static void uniphier_sd_writeq(struct uniphier_sd_priv *priv, > -const u64 val, const u32 reg) > +u64 val, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > writeq(val, priv->regbase + (reg << 1)); > @@ -152,7 +152,7 @@ static void uniphier_sd_writeq(struct uniphier_sd_priv > *priv, > writeq(val, priv->regbase + reg); > } > > -static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, const u32 reg) > +static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > return readl(priv->regbase + (reg << 1)); > @@ -161,7 +161,7 @@ static u32 uniphier_sd_readl(struct uniphier_sd_priv > *priv, const u32 reg) > } > > static void uniphier_sd_writel(struct uniphier_sd_priv *priv, > -const u32 val, const u32 reg) > +u32 val, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > writel(val, priv->regbase + (reg << 1)); > @@ -246,7 +246,7 @@ static int uniphier_sd_wait_for_irq(struct udevice *dev, > unsigned int reg, > return 0; > } > > -static int uniphier_sd_pio_read_one_block(struct udevice *dev, u32 **pbuf, > +static int uniphier_sd_pio_read_one_block(struct udevice *dev, char *pbuf, > uint blocksize) > { > struct uniphier_sd_priv *priv = dev_get_priv(dev); > @@ -264,36 +264,33 @@ static int uniphier_sd_pio_read_one_block(struct > udevice *dev, u32 **pbuf, >*/ > uniphier_sd_writel(priv, 0, UNIPHIER_SD_INFO2); > > - if (likely(IS_ALIGNED((unsigned long)*pbuf, 4))) { > - if (priv->caps & UNIPHIER_SD_CAP_64BIT) { > + if (priv->caps & UNIPHIER_SD_CAP_64BIT) { > + u64 *buf = (u64 *)pbuf; > + if (likely(IS_ALIGNED((uintptr_t)buf, 8))) { > for (i = 0; i < blocksize / 8; i++) { > - u64 data; > - data = uniphier_sd_readq(priv, > - UNIPHIER_SD_BUF); > - *(*pbuf)++ = data; > - *(*pbuf)++ = data >> 32; > + *buf++ = uniphier_sd_readq(priv, > +UNIPHIER_SD_BUF); > } > } else { > - for (i = 0; i < blocksize / 4; i++) { > - u32 data; > - data = uniphier_sd_readl(priv, UNIPHIER_SD_BUF); > - *(*pbuf)++ = data; > - } > - } > - } else { > - if (priv->caps & UNIPHIER_SD_CAP_64BIT) { > for (i = 0; i < blocksize / 8; i++) { > u64 data; > data = uniphier_sd_readq(priv, >UNIPHIER_SD_BUF); > - put_unaligned(data, (*pbuf)++); > - put_unaligned(data >> 32, (*pbuf)++); > + put_unaligned(data, buf++); > + } > + } > + } else { > + u32 *buf = (u32 *)pbuf; > + if (likely(IS_ALIGNED((uintptr_t)buf, 4))) { > + for (i = 0; i < blocksize / 4; i++) { > + *buf++ = uniphier_sd_readl(priv, > +UNIPHIER_SD_BUF); > } > } else { > for (i = 0;
Re: [U-Boot] [PATCH] mmc: uniphier-sd: Update the file to match V3 patchset
2017-09-27 3:05 GMT+09:00 Marek Vasut: > Old version of the uniphier-sd 64bit IO support patchset V1 was > applied by the maintainer, update the uniphier-sd.c with the > changes from the V3 of the patchset. > > Signed-off-by: Marek Vasut > Cc: Masahiro Yamada > Cc: Jaehoon Chung > --- Acked-by: Masahiro Yamada -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] mmc: uniphier-sd: Update the file to match V3 patchset
On 09/27/2017 03:05 AM, Marek Vasut wrote: > Old version of the uniphier-sd 64bit IO support patchset V1 was > applied by the maintainer, update the uniphier-sd.c with the > changes from the V3 of the patchset. > > Signed-off-by: Marek Vasut> Cc: Masahiro Yamada > Cc: Jaehoon Chung Sorry for it, I just picked from patchwork in my box. Thanks for sending this patch. Next time, i will do more carefully. Best Regards, Jaehoon Chung > --- > drivers/mmc/uniphier-sd.c | 83 > --- > 1 file changed, 42 insertions(+), 41 deletions(-) > > diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c > index 0786ad0d5f..3c52161067 100644 > --- a/drivers/mmc/uniphier-sd.c > +++ b/drivers/mmc/uniphier-sd.c > @@ -135,7 +135,7 @@ struct uniphier_sd_priv { > #define UNIPHIER_SD_CAP_64BITBIT(3) /* Controller is 64bit > */ > }; > > -static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, const u32 reg) > +static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > return readq(priv->regbase + (reg << 1)); > @@ -144,7 +144,7 @@ static u64 uniphier_sd_readq(struct uniphier_sd_priv > *priv, const u32 reg) > } > > static void uniphier_sd_writeq(struct uniphier_sd_priv *priv, > -const u64 val, const u32 reg) > +u64 val, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > writeq(val, priv->regbase + (reg << 1)); > @@ -152,7 +152,7 @@ static void uniphier_sd_writeq(struct uniphier_sd_priv > *priv, > writeq(val, priv->regbase + reg); > } > > -static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, const u32 reg) > +static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > return readl(priv->regbase + (reg << 1)); > @@ -161,7 +161,7 @@ static u32 uniphier_sd_readl(struct uniphier_sd_priv > *priv, const u32 reg) > } > > static void uniphier_sd_writel(struct uniphier_sd_priv *priv, > -const u32 val, const u32 reg) > +u32 val, unsigned int reg) > { > if (priv->caps & UNIPHIER_SD_CAP_64BIT) > writel(val, priv->regbase + (reg << 1)); > @@ -246,7 +246,7 @@ static int uniphier_sd_wait_for_irq(struct udevice *dev, > unsigned int reg, > return 0; > } > > -static int uniphier_sd_pio_read_one_block(struct udevice *dev, u32 **pbuf, > +static int uniphier_sd_pio_read_one_block(struct udevice *dev, char *pbuf, > uint blocksize) > { > struct uniphier_sd_priv *priv = dev_get_priv(dev); > @@ -264,36 +264,33 @@ static int uniphier_sd_pio_read_one_block(struct > udevice *dev, u32 **pbuf, >*/ > uniphier_sd_writel(priv, 0, UNIPHIER_SD_INFO2); > > - if (likely(IS_ALIGNED((unsigned long)*pbuf, 4))) { > - if (priv->caps & UNIPHIER_SD_CAP_64BIT) { > + if (priv->caps & UNIPHIER_SD_CAP_64BIT) { > + u64 *buf = (u64 *)pbuf; > + if (likely(IS_ALIGNED((uintptr_t)buf, 8))) { > for (i = 0; i < blocksize / 8; i++) { > - u64 data; > - data = uniphier_sd_readq(priv, > - UNIPHIER_SD_BUF); > - *(*pbuf)++ = data; > - *(*pbuf)++ = data >> 32; > + *buf++ = uniphier_sd_readq(priv, > +UNIPHIER_SD_BUF); > } > } else { > - for (i = 0; i < blocksize / 4; i++) { > - u32 data; > - data = uniphier_sd_readl(priv, UNIPHIER_SD_BUF); > - *(*pbuf)++ = data; > - } > - } > - } else { > - if (priv->caps & UNIPHIER_SD_CAP_64BIT) { > for (i = 0; i < blocksize / 8; i++) { > u64 data; > data = uniphier_sd_readq(priv, >UNIPHIER_SD_BUF); > - put_unaligned(data, (*pbuf)++); > - put_unaligned(data >> 32, (*pbuf)++); > + put_unaligned(data, buf++); > + } > + } > + } else { > + u32 *buf = (u32 *)pbuf; > + if (likely(IS_ALIGNED((uintptr_t)buf, 4))) { > + for (i = 0; i < blocksize / 4; i++) { > + *buf++ = uniphier_sd_readl(priv, > +
[U-Boot] [PATCH] mmc: uniphier-sd: Update the file to match V3 patchset
Old version of the uniphier-sd 64bit IO support patchset V1 was applied by the maintainer, update the uniphier-sd.c with the changes from the V3 of the patchset. Signed-off-by: Marek VasutCc: Masahiro Yamada Cc: Jaehoon Chung --- drivers/mmc/uniphier-sd.c | 83 --- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index 0786ad0d5f..3c52161067 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -135,7 +135,7 @@ struct uniphier_sd_priv { #define UNIPHIER_SD_CAP_64BIT BIT(3) /* Controller is 64bit */ }; -static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, const u32 reg) +static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, unsigned int reg) { if (priv->caps & UNIPHIER_SD_CAP_64BIT) return readq(priv->regbase + (reg << 1)); @@ -144,7 +144,7 @@ static u64 uniphier_sd_readq(struct uniphier_sd_priv *priv, const u32 reg) } static void uniphier_sd_writeq(struct uniphier_sd_priv *priv, - const u64 val, const u32 reg) + u64 val, unsigned int reg) { if (priv->caps & UNIPHIER_SD_CAP_64BIT) writeq(val, priv->regbase + (reg << 1)); @@ -152,7 +152,7 @@ static void uniphier_sd_writeq(struct uniphier_sd_priv *priv, writeq(val, priv->regbase + reg); } -static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, const u32 reg) +static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, unsigned int reg) { if (priv->caps & UNIPHIER_SD_CAP_64BIT) return readl(priv->regbase + (reg << 1)); @@ -161,7 +161,7 @@ static u32 uniphier_sd_readl(struct uniphier_sd_priv *priv, const u32 reg) } static void uniphier_sd_writel(struct uniphier_sd_priv *priv, - const u32 val, const u32 reg) + u32 val, unsigned int reg) { if (priv->caps & UNIPHIER_SD_CAP_64BIT) writel(val, priv->regbase + (reg << 1)); @@ -246,7 +246,7 @@ static int uniphier_sd_wait_for_irq(struct udevice *dev, unsigned int reg, return 0; } -static int uniphier_sd_pio_read_one_block(struct udevice *dev, u32 **pbuf, +static int uniphier_sd_pio_read_one_block(struct udevice *dev, char *pbuf, uint blocksize) { struct uniphier_sd_priv *priv = dev_get_priv(dev); @@ -264,36 +264,33 @@ static int uniphier_sd_pio_read_one_block(struct udevice *dev, u32 **pbuf, */ uniphier_sd_writel(priv, 0, UNIPHIER_SD_INFO2); - if (likely(IS_ALIGNED((unsigned long)*pbuf, 4))) { - if (priv->caps & UNIPHIER_SD_CAP_64BIT) { + if (priv->caps & UNIPHIER_SD_CAP_64BIT) { + u64 *buf = (u64 *)pbuf; + if (likely(IS_ALIGNED((uintptr_t)buf, 8))) { for (i = 0; i < blocksize / 8; i++) { - u64 data; - data = uniphier_sd_readq(priv, -UNIPHIER_SD_BUF); - *(*pbuf)++ = data; - *(*pbuf)++ = data >> 32; + *buf++ = uniphier_sd_readq(priv, + UNIPHIER_SD_BUF); } } else { - for (i = 0; i < blocksize / 4; i++) { - u32 data; - data = uniphier_sd_readl(priv, UNIPHIER_SD_BUF); - *(*pbuf)++ = data; - } - } - } else { - if (priv->caps & UNIPHIER_SD_CAP_64BIT) { for (i = 0; i < blocksize / 8; i++) { u64 data; data = uniphier_sd_readq(priv, UNIPHIER_SD_BUF); - put_unaligned(data, (*pbuf)++); - put_unaligned(data >> 32, (*pbuf)++); + put_unaligned(data, buf++); + } + } + } else { + u32 *buf = (u32 *)pbuf; + if (likely(IS_ALIGNED((uintptr_t)buf, 4))) { + for (i = 0; i < blocksize / 4; i++) { + *buf++ = uniphier_sd_readl(priv, + UNIPHIER_SD_BUF); } } else { for (i = 0; i < blocksize / 4; i++) { u32 data; data = uniphier_sd_readl(priv, UNIPHIER_SD_BUF); -