Message ID | 20181217115143.18373-3-anup@brainfault.org |
---|---|
State | Superseded |
Delegated to: | Andes |
Headers | show |
Series | Ethernet support for QEMU sifive_u machine | expand |
On Mon, Dec 17, 2018 at 7:52 PM Anup Patel <anup@brainfault.org> wrote: > > From: Anup Patel <anup.patel@wdc.com> > > This patch does following fixes in MACB ethernet driver > for using it on RISC-V systems (particularly QEMU sifive_u > machine): > 1. asm/arch/clk.h is not available on RISC-V port so include > it only for non-RISC-V systems. > 2. Don't fail in macb_enable_clk() if clk_enable() returns > -ENOSYS because we get -ENOSYS for fixed-rate clocks. > > Signed-off-by: Anup Patel <anup.patel@wdc.com> > --- > drivers/net/macb.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> But please see comments below: > diff --git a/drivers/net/macb.c b/drivers/net/macb.c > index 94c89c762b..9a06b523cc 100644 > --- a/drivers/net/macb.c > +++ b/drivers/net/macb.c > @@ -38,7 +38,9 @@ > #include <linux/mii.h> > #include <asm/io.h> > #include <asm/dma-mapping.h> > +#ifndef CONFIG_RISCV > #include <asm/arch/clk.h> > +#endif > #include <linux/errno.h> > > #include "macb.h" > @@ -1066,7 +1068,7 @@ static int macb_enable_clk(struct udevice *dev) > */ > #ifndef CONFIG_MACB_ZYNQ I suspect this "#ifndef CONFIG_MACB_ZYNQ" can be removed per the comments below, with the adding check of (ret != -ENOSYS). /* * Zynq clock driver didn't support for enable or disable * clock. Hence, clk_enable() didn't apply for Zynq */ Someone else who has access to Zynq targets need to confirm. > ret = clk_enable(&clk); > - if (ret) > + if (ret && ret != -ENOSYS) > return ret; > #endif > > -- Regards, Bin
On Tue, Dec 18, 2018 at 3:15 PM Bin Meng <bmeng.cn@gmail.com> wrote: > > On Mon, Dec 17, 2018 at 7:52 PM Anup Patel <anup@brainfault.org> wrote: > > > > From: Anup Patel <anup.patel@wdc.com> > > > > This patch does following fixes in MACB ethernet driver > > for using it on RISC-V systems (particularly QEMU sifive_u > > machine): > > 1. asm/arch/clk.h is not available on RISC-V port so include > > it only for non-RISC-V systems. > > 2. Don't fail in macb_enable_clk() if clk_enable() returns > > -ENOSYS because we get -ENOSYS for fixed-rate clocks. > > > > Signed-off-by: Anup Patel <anup.patel@wdc.com> > > --- > > drivers/net/macb.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> > > But please see comments below: > > > diff --git a/drivers/net/macb.c b/drivers/net/macb.c > > index 94c89c762b..9a06b523cc 100644 > > --- a/drivers/net/macb.c > > +++ b/drivers/net/macb.c > > @@ -38,7 +38,9 @@ > > #include <linux/mii.h> > > #include <asm/io.h> > > #include <asm/dma-mapping.h> > > +#ifndef CONFIG_RISCV > > #include <asm/arch/clk.h> > > +#endif > > #include <linux/errno.h> > > > > #include "macb.h" > > @@ -1066,7 +1068,7 @@ static int macb_enable_clk(struct udevice *dev) > > */ > > #ifndef CONFIG_MACB_ZYNQ > > I suspect this "#ifndef CONFIG_MACB_ZYNQ" can be removed per the > comments below, with the adding check of (ret != -ENOSYS). > > /* > * Zynq clock driver didn't support for enable or disable > * clock. Hence, clk_enable() didn't apply for Zynq > */ > > Someone else who has access to Zynq targets need to confirm. I think let someone with Zynq SOC based board remove this. Regards, Anup
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 94c89c762b..9a06b523cc 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -38,7 +38,9 @@ #include <linux/mii.h> #include <asm/io.h> #include <asm/dma-mapping.h> +#ifndef CONFIG_RISCV #include <asm/arch/clk.h> +#endif #include <linux/errno.h> #include "macb.h" @@ -1066,7 +1068,7 @@ static int macb_enable_clk(struct udevice *dev) */ #ifndef CONFIG_MACB_ZYNQ ret = clk_enable(&clk); - if (ret) + if (ret && ret != -ENOSYS) return ret; #endif