All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: Mark Kettenis <kettenis@openbsd.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	 Oliver Graute <oliver.graute@kococonnector.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	 Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Priyanka Jain <priyanka.jain@nxp.com>,
	Leo Liang <ycliang@andestech.com>,
	Padmarao Begari <padmarao.begari@microchip.com>,
	 Michael Walle <michael@walle.cc>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	 Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Bin Meng <bin.meng@windriver.com>,
	 Asherah Connor <ashe@kivikakk.ee>,
	Michal Simek <michal.simek@xilinx.com>,
	 Wasim Khan <wasim.khan@nxp.com>, Heiko Schocher <hs@denx.de>,
	 Igor Opaniuk <igor.opaniuk@foundries.io>, Ye Li <ye.li@nxp.com>,
	Stefan Roese <sr@denx.de>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Weijie Gao <weijie.gao@mediatek.com>,
	 Vabhav Sharma <vabhav.sharma@nxp.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Pratyush Yadav <p.yadav@ti.com>
Subject: Re: [PATCH 3/5] misc: Add Apple DART driver
Date: Mon, 27 Sep 2021 14:14:54 -0600	[thread overview]
Message-ID: <CAPnjgZ0_nhMQOPZPCuMOi2eiprYgNJ0Gs3xNbWz+EeF_o5U5Rw@mail.gmail.com> (raw)
In-Reply-To: <561488006734eda7@bloch.sibelius.xs4all.nl>

Hi Mark,

On Sun, 26 Sept 2021 at 14:53, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>
> > From: Simon Glass <sjg@chromium.org>
> > Date: Mon, 20 Sep 2021 19:11:25 -0600
>
> Hi Simon,
>
> > [..]
> >
> > > > > +static int apple_dart_bind(struct udevice *dev)
> > > > > +{
> > > > > +       void *base;
> > > > > +       int sid, i;
> > > > > +
> > > > > +       base = dev_read_addr_ptr(dev);
> > > > > +       if (!base)
> > > > > +               return -EINVAL;
> > > > > +
> > > > > +       u32 params2 = readl(base + DART_PARAMS2);
> > > > > +       if (params2 & DART_PARAMS2_BYPASS_SUPPORT) {
> > > > > +               for (sid = 0; sid < 16; sid++) {
> > > > > +                       writel(DART_TCR_BYPASS_DART | DART_TCR_BYPASS_DAPF,
> > > > > +                              base + DART_TCR(sid));
> > > > > +                       for (i = 0; i < 4; i++)
> > > > > +                               writel(0, base + DART_TTBR(sid, i));
> > > > > +               }
> > > > > +       }
> > > >
> > > > Not allowed hardware access in bind(). Can this more to probe() ?
> > >
> > > Well, I need to make sure that this happens before other drivers get
> > > probed (in particular the xhci-dwc3 driver).  Is there a better
> > > mechanism to achieve that?
> >
> > If those drivers have something in the DT indicating that they need
> > this, then you can add a uclass_get_device_by_phandle() in those
> > drivers.
>
> Yes, there is an "iommus" property that points at the IOMMU.  This is
> a standard property and I think it would make sense to have the core
> device probing code handle it in a way similar to how "power-domains"
> is handled.  That way we don't have to add IOMMU hooks into each and
> every driver.

OK.

>
> > If not, then you can probe all the DART devices with uclass_probe_all().
> >
> > Having said that, I see you are using UCLASS_MISC. I suspect this
> > should have its own UCLASS_IOMMU.
>
> So here is a proof-of-concept diff to add UCLASS_IOMMU.  This
> deliberately does not yet introduce driver ops yet; coming up with
> something sensible there needs a bit more thought.  For USB support
> all I need is for the probe function to put the IOMMU in bypass mode,
> so that is what's implemented here.
>
> Does this look reasonable?  I'll split this up eventually into a
> commit that adds UCLASS_IOMMU and a commit that adds the apple_dart
> driver.

Yes from a quick look. Remember for the IOMMU uclass to add a sandbox
test, even though for now it will only probe the driver since there
are no ops.

Also you don't need the #if in iommu-uclass.c as the linked will
garbage-collect it.

Regards,
Simon

  reply	other threads:[~2021-09-27 20:15 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18 13:54 [PATCH 0/5] Apple M1 Support Mark Kettenis
2021-09-18 13:54 ` [PATCH 1/5] arm: apple: Add initial support for Apple's M1 SoC Mark Kettenis
2021-09-19  1:04   ` Bin Meng
2021-09-19  1:17     ` Bin Meng
2021-09-19 20:33       ` Mark Kettenis
2021-09-21 12:42         ` Tom Rini
2021-09-21 15:53           ` Bin Meng
2021-09-21 16:04             ` Tom Rini
2021-09-21 16:08             ` Mark Kettenis
2021-09-25 13:27               ` Simon Glass
2021-09-19 20:05     ` Mark Kettenis
2021-09-20  3:15   ` Simon Glass
2021-09-20  8:49     ` Mark Kettenis
2021-09-21  1:11       ` Simon Glass
2021-09-18 13:54 ` [PATCH 2/5] serial: s5p: Add Apple M1 support Mark Kettenis
2021-09-19  1:11   ` Bin Meng
2021-09-19 20:30     ` Mark Kettenis
2021-09-20  3:15   ` Simon Glass
2021-09-25 13:27     ` Simon Glass
2021-10-02 22:15     ` Mark Kettenis
2021-10-03  2:01       ` Simon Glass
2021-09-18 13:54 ` [PATCH 3/5] misc: Add Apple DART driver Mark Kettenis
2021-09-20  3:16   ` Simon Glass
2021-09-20  8:33     ` Mark Kettenis
2021-09-21  1:11       ` Simon Glass
2021-09-25 13:27         ` Simon Glass
2021-09-26 20:53         ` Mark Kettenis
2021-09-27 20:14           ` Simon Glass [this message]
2021-09-18 13:54 ` [PATCH 4/5] arm: dts: apple: Add preliminary device trees Mark Kettenis
2021-09-20  3:16   ` Simon Glass
2021-09-25 13:27     ` Simon Glass
2021-09-18 13:54 ` [PATCH 5/5] doc: board: apple: Add Apple M1 documentation Mark Kettenis
2021-09-19  1:22   ` Bin Meng
2021-09-20  3:16   ` Simon Glass
2021-09-25 13:27     ` Simon Glass
2021-09-20  8:45   ` Igor Opaniuk
2021-09-25  1:20 ` [PATCH 0/5] Apple M1 Support Simon Glass
2021-09-25  8:11   ` Mark Kettenis
2021-09-25 13:27     ` Simon Glass
2021-09-25 13:52       ` Mark Kettenis
2021-09-25 14:42         ` Simon Glass
2021-09-25 16:45           ` Mark Kettenis
2021-09-26 15:53             ` Simon Glass
2021-09-28  3:46               ` Simon Glass
2021-09-28  7:36                 ` Mark Kettenis
2021-09-28 12:07                   ` Simon Glass

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=CAPnjgZ0_nhMQOPZPCuMOi2eiprYgNJ0Gs3xNbWz+EeF_o5U5Rw@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ashe@kivikakk.ee \
    --cc=bin.meng@windriver.com \
    --cc=hs@denx.de \
    --cc=igor.opaniuk@foundries.io \
    --cc=kettenis@openbsd.org \
    --cc=kishon@ti.com \
    --cc=mark.kettenis@xs4all.nl \
    --cc=masami.hiramatsu@linaro.org \
    --cc=michael@walle.cc \
    --cc=michal.simek@xilinx.com \
    --cc=oliver.graute@kococonnector.com \
    --cc=p.yadav@ti.com \
    --cc=padmarao.begari@microchip.com \
    --cc=priyanka.jain@nxp.com \
    --cc=sr@denx.de \
    --cc=stephan@gerhold.net \
    --cc=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=vabhav.sharma@nxp.com \
    --cc=wasim.khan@nxp.com \
    --cc=weijie.gao@mediatek.com \
    --cc=xypron.glpk@gmx.de \
    --cc=ycliang@andestech.com \
    --cc=ye.li@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.