diff mbox series

[U-Boot,v6,1/5] driver: net: ti: cpsw-mdio: use phys_addr_t for mdio_base addr

Message ID 20190709050037.8239-2-j-keerthy@ti.com
State Accepted
Commit 45e8c055cc351399bd3cd10dacee91e82201b070
Delegated to: Joe Hershberger
Headers show
Series net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver | expand

Commit Message

Keerthy July 9, 2019, 5 a.m. UTC
Use phys_addr_t for mdio_base address to avoid build
warnings on arm64 and dra7. Cast it to uintprt_t before
assigning to regs.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v6:

  * Added Joe's Ack.

 drivers/net/ti/cpsw_mdio.c | 4 ++--
 drivers/net/ti/cpsw_mdio.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Alex Kiernan July 9, 2019, 12:59 p.m. UTC | #1
On Tue, Jul 9, 2019 at 6:01 AM Keerthy <j-keerthy@ti.com> wrote:
>
> Use phys_addr_t for mdio_base address to avoid build
> warnings on arm64 and dra7. Cast it to uintprt_t before
> assigning to regs.
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v6:
>
>   * Added Joe's Ack.
>
>  drivers/net/ti/cpsw_mdio.c | 4 ++--
>  drivers/net/ti/cpsw_mdio.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c
> index 70f547e6d7..6e8f652011 100644
> --- a/drivers/net/ti/cpsw_mdio.c
> +++ b/drivers/net/ti/cpsw_mdio.c
> @@ -125,7 +125,7 @@ u32 cpsw_mdio_get_alive(struct mii_dev *bus)
>         return val & GENMASK(15, 0);
>  }
>
> -struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
> +struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,
>                                u32 bus_freq, int fck_freq)
>  {
>         struct cpsw_mdio *cpsw_mdio;
> @@ -144,7 +144,7 @@ struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
>                 return NULL;
>         }
>
> -       cpsw_mdio->regs = (struct cpsw_mdio_regs *)mdio_base;
> +       cpsw_mdio->regs = (struct cpsw_mdio_regs *)(uintptr_t)mdio_base;
>

I'm missing something... the (uintptr_t) cast - is that a narrowing cast?
Keerthy July 10, 2019, 4:07 a.m. UTC | #2
On 09/07/19 6:29 PM, Alex Kiernan wrote:
> On Tue, Jul 9, 2019 at 6:01 AM Keerthy <j-keerthy@ti.com> wrote:
>>
>> Use phys_addr_t for mdio_base address to avoid build
>> warnings on arm64 and dra7. Cast it to uintprt_t before
>> assigning to regs.
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
>> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v6:
>>
>>    * Added Joe's Ack.
>>
>>   drivers/net/ti/cpsw_mdio.c | 4 ++--
>>   drivers/net/ti/cpsw_mdio.h | 2 +-
>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c
>> index 70f547e6d7..6e8f652011 100644
>> --- a/drivers/net/ti/cpsw_mdio.c
>> +++ b/drivers/net/ti/cpsw_mdio.c
>> @@ -125,7 +125,7 @@ u32 cpsw_mdio_get_alive(struct mii_dev *bus)
>>          return val & GENMASK(15, 0);
>>   }
>>
>> -struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
>> +struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,
>>                                 u32 bus_freq, int fck_freq)
>>   {
>>          struct cpsw_mdio *cpsw_mdio;
>> @@ -144,7 +144,7 @@ struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
>>                  return NULL;
>>          }
>>
>> -       cpsw_mdio->regs = (struct cpsw_mdio_regs *)mdio_base;
>> +       cpsw_mdio->regs = (struct cpsw_mdio_regs *)(uintptr_t)mdio_base;
>>
> 
> I'm missing something... the (uintptr_t) cast - is that a narrowing cast?

Now the cpsw_mdio is used by both 32 bit and 64 bit SoCs. Hence 
uintptr_t cast helps obscure the type of a pointer.

>
Joe Hershberger July 15, 2019, 10:51 p.m. UTC | #3
Hi Keerthy,

https://patchwork.ozlabs.org/patch/1129505/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c
index 70f547e6d7..6e8f652011 100644
--- a/drivers/net/ti/cpsw_mdio.c
+++ b/drivers/net/ti/cpsw_mdio.c
@@ -125,7 +125,7 @@  u32 cpsw_mdio_get_alive(struct mii_dev *bus)
 	return val & GENMASK(15, 0);
 }
 
-struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
+struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,
 			       u32 bus_freq, int fck_freq)
 {
 	struct cpsw_mdio *cpsw_mdio;
@@ -144,7 +144,7 @@  struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
 		return NULL;
 	}
 
-	cpsw_mdio->regs = (struct cpsw_mdio_regs *)mdio_base;
+	cpsw_mdio->regs = (struct cpsw_mdio_regs *)(uintptr_t)mdio_base;
 
 	if (!bus_freq || !fck_freq)
 		cpsw_mdio->div = CPSW_MDIO_DIV_DEF;
diff --git a/drivers/net/ti/cpsw_mdio.h b/drivers/net/ti/cpsw_mdio.h
index 4a76d4e5c5..dbf4a2dcac 100644
--- a/drivers/net/ti/cpsw_mdio.h
+++ b/drivers/net/ti/cpsw_mdio.h
@@ -10,7 +10,7 @@ 
 
 struct cpsw_mdio;
 
-struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
+struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,
 			       u32 bus_freq, int fck_freq);
 void cpsw_mdio_free(struct mii_dev *bus);
 u32 cpsw_mdio_get_alive(struct mii_dev *bus);