mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
PATCH 1/2 mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
Pass the entire source data pointer to tmio_sd_addr_is_dmaable() so we don't have to apply casts throughout the code.
--- drivers/mmc/tmio-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/tmio-common.c +4 -2
@@ -372,8 +372,10 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) }/* check if the address is DMA'able */ -static bool tmio_sd_addr_is_dmaable (unsigned long addr) +static bool tmio_sd_addr_is_dmaable (const char *src) { +uintptr_t addr = (uintptr_t )src; +if (!IS_ALIGNED (addr,TMIO_SD_DMA_MINALIGN ))return false;
@@ -486,7 +488,7 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,if (data) {/* use DMA if the HW supports it and the buffer is aligned */ if (priv->caps &TMIO_SD_CAP_DMA_INTERNAL && -tmio_sd_addr_is_dmaable ((long )data->src)) +tmio_sd_addr_is_dmaable (data->src)) ret =tmio_sd_dma_xfer (dev, data);else ret =tmio_sd_pio_xfer (dev, data);
Signature · 1 line
2.18.0
PATCH 2/2 mmc: tmio: Limit DMA to 32bit on R-Car Gen3
The internal DMAC on Gen3 is 32bit only, limit the DMA address range to 32bit.
--- drivers/mmc/tmio-common.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mmc/tmio-common.c +6 -0
@@ -379,6 +379,12 @@ static bool tmio_sd_addr_is_dmaable(const char *src)if (!IS_ALIGNED (addr,TMIO_SD_DMA_MINALIGN ))return false; +#if defined(CONFIG_RCAR_GEN3 ) +/* Gen3 DMA has 32bit limit */ +if (addr >>32 ) +return false; +#endif +#if defined(CONFIG_ARCH_UNIPHIER ) && !defined(CONFIG_ARM64 ) && \ defined(CONFIG_SPL_BUILD )/*
Signature · 1 line
2.18.0
PATCH 1/2 mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
In reply to Marek VasutHi Marek,
Quoted 2 lines · Marek Vasut
Pass the entire source data pointer to
tmio_sd_addr_is_dmaable()
This statement sounds like
the current code is passing the pointer address only partially. Is it right?
Quoted 1 line
so we don't have to apply casts throughout the code.
I do not understand this either
since I see a cast in your code too.
In the previous code, the caller casts src->address when it passes it to tmio_sd_addr_is_dmaable().
In the new code, 'src' is casted
in tmio_sd_addr_is_dmaable().
To me, you just moved the location of casting. What is the difference (i.e. benefit)?
If you want to change this code, I am fine. But, I'd like to know the reason.
At least, I am so confused with your commit description.
Quoted 38 lines
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mmc/tmio-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mmc/tmio-common.c +4
-3@@ -372,8 +372,10 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) }/* check if the address is DMA'able */ -static bool tmio_sd_addr_is_dmaable (unsigned long addr) +static bool tmio_sd_addr_is_dmaable (const char *src) { +uintptr_t addr = (uintptr_t )src; +if (!IS_ALIGNED (addr,TMIO_SD_DMA_MINALIGN ))return false;@@ -486,7 +488,7 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,if (data) {/* use DMA if the HW supports it and the buffer is aligned */ if (priv->caps &TMIO_SD_CAP_DMA_INTERNAL && -tmio_sd_addr_is_dmaable ((long )data->src)) +tmio_sd_addr_is_dmaable (data->src)) ret =tmio_sd_dma_xfer (dev, data);else ret =tmio_sd_pio_xfer (dev, data); --2.18.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/2 mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
Quoted 1 line · Masahiro Yamada
Hi Marek,
Hi,
Quoted 8 lines · Marek Vasut
Quoted 2 lines
Pass the entire source data pointer to
tmio_sd_addr_is_dmaable()This statement sounds like
the current code is passing the pointer address only partially. Is it right?
With this change it is.
Quoted 4 lines
Quoted 1 line
so we don't have to apply casts throughout the code.
I do not understand this either
since I see a cast in your code too.
There is a cast, but it's isolated to this function.
Quoted 8 lines
In the previous code, the caller casts
src->addresswhen it passes it totmio_sd_addr_is_dmaable().In the new code, 'src' is casted
intmio_sd_addr_is_dmaable().To me, you just moved the location of casting. What is the difference (i.e. benefit)?
I moved the cast from the code into the function, which I think is cleaner.
Quoted 51 lines
If you want to change this code, I am fine. But, I'd like to know the reason.
At least, I am so confused with your commit description.
Quoted 38 lines
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mmc/tmio-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mmc/tmio-common.c +4
-3@@ -372,8 +372,10 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) }/* check if the address is DMA'able */ -static bool tmio_sd_addr_is_dmaable (unsigned long addr) +static bool tmio_sd_addr_is_dmaable (const char *src) { +uintptr_t addr = (uintptr_t )src; +if (!IS_ALIGNED (addr,TMIO_SD_DMA_MINALIGN ))return false;@@ -486,7 +488,7 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,if (data) {/* use DMA if the HW supports it and the buffer is aligned */ if (priv->caps &TMIO_SD_CAP_DMA_INTERNAL && -tmio_sd_addr_is_dmaable ((long )data->src)) +tmio_sd_addr_is_dmaable (data->src)) ret =tmio_sd_dma_xfer (dev, data);else ret =tmio_sd_pio_xfer (dev, data); --2.18.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/2 mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
Quoted 8 lines · Marek Vasut
Quoted 1 line · Masahiro Yamada
Hi Marek,
Hi,
Quoted 2 lines · Marek Vasut
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Pass the entire source data pointer to
tmio_sd_addr_is_dmaable()This statement sounds like
the current code is passing the pointer address only partially. Is it right?With this change it is.
Is anything wrong with my code?
How about your patch title
"mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()" ?
Does it mean my code is not passing full address?
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
so we don't have to apply casts throughout the code.
I do not understand this either
since I see a cast in your code too.There is a cast, but it's isolated to this function.
Quoted 3 lines
In the previous code, the caller casts
src->addresswhen it passes it totmio_sd_addr_is_dmaable().
Quoted 7 lines
Quoted 5 lines
In the new code, 'src' is casted
intmio_sd_addr_is_dmaable().To me, you just moved the location of casting.
What is the difference (i.e. benefit)?I moved the cast from the code into the function, which I think is cleaner.
I do not think so.
If you like this patch, just go for it.
But, I believe you need to update the patch title and description since this is just a matter of personal preference.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/2 mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
Quoted 12 lines · Masahiro Yamada
Quoted 11 lines · Marek Vasut
Quoted 1 line · Masahiro Yamada
Hi Marek,
Hi,
Quoted 5 lines · Marek Vasut
Quoted 2 lines
Pass the entire source data pointer to
tmio_sd_addr_is_dmaable()
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This statement sounds like
the current code is passing the pointer address only partially. Is it right?With this change it is.
Is anything wrong with my code?
Don't think so.
Quoted 4 lines
How about your patch title
"mmc: tmio: Pass full address totmio_sd_addr_is_dmaable()" ?Does it mean my code is not passing full address?
Could use a rephrasing, yeah
Quoted 13 lines
Quoted 13 lines
Quoted 4 lines
Quoted 1 line
so we don't have to apply casts throughout the code.
I do not understand this either
since I see a cast in your code too.There is a cast, but it's isolated to this function.
Quoted 6 lines
In the previous code, the caller casts
src->addresswhen it passes it totmio_sd_addr_is_dmaable().In the new code, 'src' is casted
intmio_sd_addr_is_dmaable().
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
To me, you just moved the location of casting.
What is the difference (i.e. benefit)?I moved the cast from the code into the function, which I think is cleaner.
I do not think so.
So would you prefer to see stuff like
function foo(long bar)
{...}
foo((cast)baz);
...
foo((cast)quux);
In the code :)
Quoted 6 lines
If you like this patch, just go for it.
But, I believe you need to update the patch title and description since this is just a matter of personal preference.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/2 mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
Quoted 57 lines · Marek Vasut
Quoted 12 lines · Masahiro Yamada
Quoted 11 lines · Marek Vasut
Quoted 1 line · Masahiro Yamada
Hi Marek,
Hi,
Quoted 5 lines · Marek Vasut
Quoted 2 lines
Pass the entire source data pointer to
tmio_sd_addr_is_dmaable()Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This statement sounds like
the current code is passing the pointer address only partially. Is it right?With this change it is.
Is anything wrong with my code?
Don't think so.
Quoted 4 lines
How about your patch title
"mmc: tmio: Pass full address totmio_sd_addr_is_dmaable()" ?Does it mean my code is not passing full address?
Could use a rephrasing, yeah
Quoted 13 lines
Quoted 13 lines
Quoted 4 lines
Quoted 1 line
so we don't have to apply casts throughout the code.
I do not understand this either
since I see a cast in your code too.There is a cast, but it's isolated to this function.
Quoted 6 lines
In the previous code, the caller casts
src->addresswhen it passes it totmio_sd_addr_is_dmaable().In the new code, 'src' is casted
intmio_sd_addr_is_dmaable().Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
To me, you just moved the location of casting.
What is the difference (i.e. benefit)?I moved the cast from the code into the function, which I think is cleaner.
I do not think so.
So would you prefer to see stuff like
function foo(long bar)
{...}
Quoted 7 lines
foo((cast)baz);
...
foo((cast)quux);
In the code :)
It is a hypothetical situation.
If there were multiple function calls,
I would agree with you.
Signature · 2 lines
Best Regards Masahiro Yamada