diff mbox series

[1/3] net: emaclite: fix broken build

Message ID 20220713135204.233268-2-samuel.obuch@codasip.com
State Changes Requested
Delegated to: Ramon Fried
Headers show
Series [1/3] net: emaclite: fix broken build | expand

Commit Message

Samuel Obuch July 13, 2022, 1:52 p.m. UTC
Function ioremap_nocache seems to be defined only for mips and microblaze
architectures. Therefore, the function call in the emaclite driver causes
this driver to be unusable with other architectures, for example riscv.

Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
---
 drivers/net/xilinx_emaclite.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ramon Fried Aug. 6, 2022, 5:31 p.m. UTC | #1
On Wed, Jul 13, 2022 at 5:02 PM Samuel Obuch <samuel.obuch@codasip.com> wrote:
>
> Function ioremap_nocache seems to be defined only for mips and microblaze
> architectures. Therefore, the function call in the emaclite driver causes
> this driver to be unusable with other architectures, for example riscv.
>
> Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
> ---
>  drivers/net/xilinx_emaclite.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
> index 6c9f1f7c27..5cd88e04fe 100644
> --- a/drivers/net/xilinx_emaclite.c
> +++ b/drivers/net/xilinx_emaclite.c
> @@ -615,8 +615,12 @@ static int emaclite_of_to_plat(struct udevice *dev)
>         int offset = 0;
>
>         pdata->iobase = dev_read_addr(dev);
> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_MIPS)
>         emaclite->regs = (struct emaclite_regs *)ioremap_nocache(pdata->iobase,
>                                                                  0x10000);
> +#else
> +       emaclite->regs = (struct emaclite_regs *)pdata->iobase;
> +#endif
>
>         emaclite->phyaddr = -1;
>
> --
> 2.31.1
>
Hm...
Well, this isn't right,The right solution is to replace
ioremap_nocache() with ioremap().
This way it will work both for MIPS and other architectures.
I can do it myself, you can fix your patch. let me know.
Thanks,
Ramon.
Michal Simek Aug. 8, 2022, 7:35 a.m. UTC | #2
On 8/6/22 19:31, Ramon Fried wrote:
> On Wed, Jul 13, 2022 at 5:02 PM Samuel Obuch <samuel.obuch@codasip.com> wrote:
>>
>> Function ioremap_nocache seems to be defined only for mips and microblaze
>> architectures. Therefore, the function call in the emaclite driver causes
>> this driver to be unusable with other architectures, for example riscv.
>>
>> Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
>> ---
>>   drivers/net/xilinx_emaclite.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
>> index 6c9f1f7c27..5cd88e04fe 100644
>> --- a/drivers/net/xilinx_emaclite.c
>> +++ b/drivers/net/xilinx_emaclite.c
>> @@ -615,8 +615,12 @@ static int emaclite_of_to_plat(struct udevice *dev)
>>          int offset = 0;
>>
>>          pdata->iobase = dev_read_addr(dev);
>> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_MIPS)
>>          emaclite->regs = (struct emaclite_regs *)ioremap_nocache(pdata->iobase,
>>                                                                   0x10000);
>> +#else
>> +       emaclite->regs = (struct emaclite_regs *)pdata->iobase;
>> +#endif
>>
>>          emaclite->phyaddr = -1;
>>
>> --
>> 2.31.1
>>
> Hm...
> Well, this isn't right,The right solution is to replace
> ioremap_nocache() with ioremap().
> This way it will work both for MIPS and other architectures.
> I can do it myself, you can fix your patch. let me know.

Microblaze doesn't define it now. But I agree that using ioremap which has 
implicit nocache is the right way to go.
It means please create the first patch which creates ioremap for microblaze,
Then second to replace ioremap_nocache() in emaclite driver to ioremap. And 
third to remove ioremap_nocache from microblaze io.h.

Thanks,
Michal
Michal Simek Aug. 8, 2022, 7:44 a.m. UTC | #3
Hi,

On 8/8/22 09:35, Michal Simek wrote:
> 
> 
> On 8/6/22 19:31, Ramon Fried wrote:
>> On Wed, Jul 13, 2022 at 5:02 PM Samuel Obuch <samuel.obuch@codasip.com> wrote:
>>>
>>> Function ioremap_nocache seems to be defined only for mips and microblaze
>>> architectures. Therefore, the function call in the emaclite driver causes
>>> this driver to be unusable with other architectures, for example riscv.
>>>
>>> Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
>>> ---
>>>   drivers/net/xilinx_emaclite.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
>>> index 6c9f1f7c27..5cd88e04fe 100644
>>> --- a/drivers/net/xilinx_emaclite.c
>>> +++ b/drivers/net/xilinx_emaclite.c
>>> @@ -615,8 +615,12 @@ static int emaclite_of_to_plat(struct udevice *dev)
>>>          int offset = 0;
>>>
>>>          pdata->iobase = dev_read_addr(dev);
>>> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_MIPS)
>>>          emaclite->regs = (struct emaclite_regs *)ioremap_nocache(pdata->iobase,
>>>                                                                   0x10000);
>>> +#else
>>> +       emaclite->regs = (struct emaclite_regs *)pdata->iobase;
>>> +#endif
>>>
>>>          emaclite->phyaddr = -1;
>>>
>>> -- 
>>> 2.31.1
>>>
>> Hm...
>> Well, this isn't right,The right solution is to replace
>> ioremap_nocache() with ioremap().
>> This way it will work both for MIPS and other architectures.
>> I can do it myself, you can fix your patch. let me know.
> 
> Microblaze doesn't define it now. But I agree that using ioremap which has 
> implicit nocache is the right way to go.
> It means please create the first patch which creates ioremap for microblaze,
> Then second to replace ioremap_nocache() in emaclite driver to ioremap. And 
> third to remove ioremap_nocache from microblaze io.h.

I did closer look when I looked at other patches. You should switch to 
linux/io.h which automatically create ioremap if not defined by architecture.

And ioremap_nocache for microblaze can be removed later.

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 48aee77ab509..3299eefd999f 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -21,7 +21,7 @@
  #include <linux/delay.h>
  #include <linux/errno.h>
  #include <linux/kernel.h>
-#include <asm/io.h>
+#include <linux/io.h>

M
Samuel Obuch Sept. 23, 2022, 9:29 a.m. UTC | #4
Hi, using linux/io.h and ioremap works well for us, thanks. I will update
the patch.

S

On Mon, Aug 8, 2022 at 9:44 AM Michal Simek <michal.simek@amd.com> wrote:

> Hi,
>
> On 8/8/22 09:35, Michal Simek wrote:
> >
> >
> > On 8/6/22 19:31, Ramon Fried wrote:
> >> On Wed, Jul 13, 2022 at 5:02 PM Samuel Obuch <samuel.obuch@codasip.com>
> wrote:
> >>>
> >>> Function ioremap_nocache seems to be defined only for mips and
> microblaze
> >>> architectures. Therefore, the function call in the emaclite driver
> causes
> >>> this driver to be unusable with other architectures, for example riscv.
> >>>
> >>> Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com>
> >>> ---
> >>>   drivers/net/xilinx_emaclite.c | 4 ++++
> >>>   1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/drivers/net/xilinx_emaclite.c
> b/drivers/net/xilinx_emaclite.c
> >>> index 6c9f1f7c27..5cd88e04fe 100644
> >>> --- a/drivers/net/xilinx_emaclite.c
> >>> +++ b/drivers/net/xilinx_emaclite.c
> >>> @@ -615,8 +615,12 @@ static int emaclite_of_to_plat(struct udevice
> *dev)
> >>>          int offset = 0;
> >>>
> >>>          pdata->iobase = dev_read_addr(dev);
> >>> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_MIPS)
> >>>          emaclite->regs = (struct emaclite_regs
> *)ioremap_nocache(pdata->iobase,
> >>>
> 0x10000);
> >>> +#else
> >>> +       emaclite->regs = (struct emaclite_regs *)pdata->iobase;
> >>> +#endif
> >>>
> >>>          emaclite->phyaddr = -1;
> >>>
> >>> --
> >>> 2.31.1
> >>>
> >> Hm...
> >> Well, this isn't right,The right solution is to replace
> >> ioremap_nocache() with ioremap().
> >> This way it will work both for MIPS and other architectures.
> >> I can do it myself, you can fix your patch. let me know.
> >
> > Microblaze doesn't define it now. But I agree that using ioremap which
> has
> > implicit nocache is the right way to go.
> > It means please create the first patch which creates ioremap for
> microblaze,
> > Then second to replace ioremap_nocache() in emaclite driver to ioremap.
> And
> > third to remove ioremap_nocache from microblaze io.h.
>
> I did closer look when I looked at other patches. You should switch to
> linux/io.h which automatically create ioremap if not defined by
> architecture.
>
> And ioremap_nocache for microblaze can be removed later.
>
> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
> index 48aee77ab509..3299eefd999f 100644
> --- a/drivers/net/xilinx_emaclite.c
> +++ b/drivers/net/xilinx_emaclite.c
> @@ -21,7 +21,7 @@
>   #include <linux/delay.h>
>   #include <linux/errno.h>
>   #include <linux/kernel.h>
> -#include <asm/io.h>
> +#include <linux/io.h>
>
> M
>
diff mbox series

Patch

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 6c9f1f7c27..5cd88e04fe 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -615,8 +615,12 @@  static int emaclite_of_to_plat(struct udevice *dev)
 	int offset = 0;
 
 	pdata->iobase = dev_read_addr(dev);
+#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_MIPS)
 	emaclite->regs = (struct emaclite_regs *)ioremap_nocache(pdata->iobase,
 								 0x10000);
+#else
+	emaclite->regs = (struct emaclite_regs *)pdata->iobase;
+#endif
 
 	emaclite->phyaddr = -1;