u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
To: u-boot@lists.denx.de
Subject: [PATCH v7 8/8] drivers: net: macb: add fu740 support
Date: Wed, 5 May 2021 09:45:46 +0100	[thread overview]
Message-ID: <CADWks+Y=6mz9QJ6vaFvaWCH8r5eeDa_ZczeKXhApuL2k875Kqg@mail.gmail.com> (raw)
In-Reply-To: <CAJivOr6B1cwKayykftmN2BzeLSnrGwDoxpOp_XtZmibv64xohQ@mail.gmail.com>

On Wed, May 5, 2021 at 4:15 AM Green Wan <green.wan@sifive.com> wrote:
>
> Hi Dimitri,
>
> Thanks for looking into this.
>
> On Tue, May 4, 2021 at 5:33 PM Dimitri John Ledkov
> <dimitri.ledkov@canonical.com> wrote:
> >
> > Hi,
> >
> > On Thu, Apr 22, 2021 at 10:15 AM Green Wan <green.wan@sifive.com> wrote:
> > >
> > > From: David Abdurachmanov <david.abdurachmanov@sifive.com>
> > >
> > > Add fu740 support to macb ethernet driver
> > >
> > > There is a PLL HW quirk in FU740. The VSC8541XMV-02 specification
> > > requires 125 +/-0.0125 Mhz. But the most close value can be output
> > > by PLL is 125.125 MHz and out of VSC8541XMV-02 spec.
> > >
> >
> > In the Linux kernel driver for this
> > drivers/net/ethernet/cadence/macb_main.c it is not marked as
> > compatible with "sifive,fu740-c000-gem" and it does not have a similar
> > fix (and appears to use 125.0 MHz).
> > Should a similar fix be contributed to the Linux kernel?
>
> You're right. We also notice some refinement should be made here.
> We're working on the way to solve it.
>
> >
> > As otherwise at the moment, one cannot pass the dtb from u-boot to
> > linux, as that leads to loss of network since the kernel doesn't know
> > about "sifive,fu740-c000-gem". If linux kernel contribution is not
> > forthcoming, would it be possible to have u-boot dtb to be compatible
> > with _both_  "sifive,fu540-c000-gem" and "sifive,fu740-c000-gem" on
> > unmatched boards, such that if one (mistakenly) uses u-boots dtb with
> > vanilla linux kernel networking still works? And then adjust the test
> > to check for "sifive,fu740-c000-gem" compatible string first.
> >
>
> Not sure whether I get it correct. I think the best case is to have
> Linux driver support both compatible string.

That is my desired outcome too. Please just do that.

> And I'm a bit reluctant
> to handle incorrect DTB passed situations. It might end up with
> propagating issues and harder to trace back the root cause. I'll check
> with colleagues and see if we can resolve that concern.
>

Writing / handling / handing-over incorrect DTB is not nice.

> Thanks,
>
> > > Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
> > > Signed-off-by: Green Wan <green.wan@sifive.com>
> > > Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
> > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> > > ---
> > >  drivers/net/macb.c | 13 ++++++++++++-
> > >  1 file changed, 12 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > > index 57ea45e2dc..bf70525c54 100644
> > > --- a/drivers/net/macb.c
> > > +++ b/drivers/net/macb.c
> > > @@ -591,8 +591,17 @@ static int macb_sifive_clk_init(struct udevice *dev, ulong rate)
> > >          * 0 = GMII mode. Use 125 MHz gemgxlclk from PRCI in TX logic
> > >          *     and output clock on GMII output signal GTX_CLK
> > >          * 1 = MII mode. Use MII input signal TX_CLK in TX logic
> > > +        *
> > > +        * FU740 have a PLL HW quirk. The 125.125 Mhz is actually out of
> > > +        * VSC8541XMV-02 specification. The tolerance level is +/-100ppm.
> > > +        * Which means the range should be in between 125MHz +/-0.0125.
> > > +        * But the most close value can be output by PLL is 125.125 MHz.
> > >          */
> > > -       writel(rate != 125000000, gemgxl_regs);
> > > +       if (device_is_compatible(dev, "sifive,fu540-c000-gem"))
> > > +               writel(rate != 125000000, gemgxl_regs);
> > > +       else if (device_is_compatible(dev, "sifive,fu740-c000-gem"))
> > > +               writel(rate != 125125000, gemgxl_regs);
> > > +
> > >         return 0;
> > >  }
> > >
> > > @@ -1507,6 +1516,8 @@ static const struct udevice_id macb_eth_ids[] = {
> > >         { .compatible = "cdns,zynq-gem" },
> > >         { .compatible = "sifive,fu540-c000-gem",
> > >           .data = (ulong)&sifive_config },
> > > +       { .compatible = "sifive,fu740-c000-gem",
> > > +         .data = (ulong)&sifive_config },
> > >         { .compatible = "microchip,mpfs-mss-gem",
> > >           .data = (ulong)&microchip_config },
> > >         { }
> > > --
> > > 2.31.0
> > >
> >
> >
> > --
> > Regards,
> >
> > Dimitri.



-- 
Regards,

Dimitri.

  reply	other threads:[~2021-05-05  8:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  9:11 [PATCH v7 0/8] Add FU740 chip and HiFive Unmatched board support Green Wan
2021-04-22  9:11 ` [PATCH v7 1/8] riscv: cpu: fu740: Add support for cpu fu740 Green Wan
     [not found]   ` <CADWks+bKP1zF_ffZ6kE4qbrtG3wbCs5_7UA7MQOymnmTMicsxQ@mail.gmail.com>
2021-05-04 10:04     ` Dimitri John Ledkov
2021-04-22  9:11 ` [PATCH v7 2/8] drivers: clk: add fu740 support Green Wan
     [not found]   ` <CADWks+a=RMyzgSGp4JH-DjyKqgse0HUJgkaxwgcMh8kYD0BWWA@mail.gmail.com>
2021-05-04 10:05     ` Dimitri John Ledkov
2021-05-05  3:17     ` Green Wan
2021-04-22  9:11 ` [PATCH v7 3/8] drivers: ram: sifive: rename fu540_ddr and " Green Wan
2021-04-22  9:11 ` [PATCH v7 4/8] drivers: pci: add pcie support for fu740 Green Wan
2021-05-03 13:08   ` Neil Armstrong
2021-05-04  1:53     ` Green Wan
2021-04-22  9:11 ` [PATCH v7 5/8] riscv: dts: add fu740 support Green Wan
2021-04-22  9:11 ` [PATCH v7 6/8] riscv: dts: add SiFive Unmatched board support Green Wan
2021-04-22  9:11 ` [PATCH v7 7/8] board: sifive: add HiFive " Green Wan
2021-04-22  9:11 ` [PATCH v7 8/8] drivers: net: macb: add fu740 support Green Wan
     [not found]   ` <CADWks+arqeOw7AuuVv_2V4buyvXmk_99hjvHU=LZ7Fki4NC4Fw@mail.gmail.com>
2021-05-04 10:04     ` Dimitri John Ledkov
2021-05-05  3:15     ` Green Wan
2021-05-05  8:45       ` Dimitri John Ledkov [this message]
2021-09-27  9:56   ` Bin Meng
2021-04-23  3:40 ` [PATCH v7 0/8] Add FU740 chip and HiFive Unmatched board support Palmer Dabbelt
2021-04-23  4:01   ` Palmer Dabbelt
2021-04-29 11:11 ` Green Wan
2021-04-29 12:27   ` Bin Meng
2021-05-03  2:14     ` Green Wan
     [not found]     ` <752D002CFF5D0F4FA35C0100F1D73F3FE5E9B483@ATCPCS12.andestech.com>
2021-05-03  2:34       ` Rick Chen
2021-05-03  3:35         ` Green Wan
2021-05-03  3:42           ` Rick Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADWks+Y=6mz9QJ6vaFvaWCH8r5eeDa_ZczeKXhApuL2k875Kqg@mail.gmail.com' \
    --to=dimitri.ledkov@canonical.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).