All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Rob Herring <robh+dt@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sandeep Maheswaram <sanm@codeaurora.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Felipe Balbi <balbi@kernel.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Doug Anderson <dianders@chromium.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux USB List <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Manu Gautam <mgautam@codeaurora.org>
Subject: Re: [PATCH] driver core:Export the symbol device_is_bound
Date: Thu, 18 Jun 2020 14:45:16 -0700	[thread overview]
Message-ID: <20200618214516.GG4525@google.com> (raw)
In-Reply-To: <CAL_Jsq+5NCvvpKd-69QvgqK6wzbc53=MTt-TcVop23hjT6Rs_g@mail.gmail.com>

On Thu, Jun 18, 2020 at 11:33:49AM -0600, Rob Herring wrote:
> On Thu, Jun 18, 2020 at 10:51 AM Matthias Kaehlcke <mka@chromium.org> wrote:
> >
> > On Thu, Jun 18, 2020 at 05:58:20PM +0200, Greg Kroah-Hartman wrote:
> > > On Thu, Jun 18, 2020 at 08:45:55AM -0700, Matthias Kaehlcke wrote:
> > > > Hi Greg,
> > > >
> > > > On Thu, Jun 18, 2020 at 10:14:43AM +0200, Greg Kroah-Hartman wrote:
> > > > > On Wed, Jun 03, 2020 at 12:09:52AM +0530, Sandeep Maheswaram wrote:
> > > > > > Export the symbol device_is_bound so that it can be used by the modules.
> > > > >
> > > > > What modules need this?
> > > >
> > > > drivers/usb/dwc3/dwc3-qcom.c (and probably other dwc3 'wrappers').
> > >
> > > Why wasn't that said here?  No context is not good :(
> >
> > Agreed, this patch should probably have been part of a series to establish
> > the context.
> >
> > > > Short summary: QCOM dwc3 support is split in two drivers, the core dwc3
> > > > driver and the QCOM specific parts. dwc3-qcom is probed first (through
> > > > a DT entry or ACPI), dwc3_qcom_probe() then calls of_platform_populate()
> > > > to probe the core part. After a successful return from _populate() the
> > > > driver assumes that the core device is fully initialized. However the
> > > > latter is not correct, the driver core doesn't propagate errors from
> > > > probe() to platform_populate(). The dwc3-qcom driver would use
> > > > device_is_bound() to make sure the core device was probed successfully.
> > >
> > > why does the dwc3-qcom driver care?
> >
> > Currently the dwc3-qcom driver uses the core device to determine if the
> > controller is used in peripheral mode and it runtime resumes the XHCI
> > device when it sees a wakeup interrupt.
> >
> > The WIP patch to add interconnect support relies on the core driver
> > to determine the max speed of the controller.
> >
> > > And why is the driver split in a way that requires such "broken"
> > > structures?  Why can't that be fixed instead?
> >
> > It seems determining the mode could be easily changed by getting it through
> > the pdev, as in st_dwc3_probe(). Not sure about the other two parts,
> > determining the maximum speed can involve evaluating hardware registers,
> > which currently are 'owned' by the core driver.
> >
> > Manu or Sandeep who know the hardware and the driver better than me might
> > have ideas on how to improve things.
> 
> We never should have had this split either in the DT binding nor
> driver(s) as if the SoC wrapper crap and licensed IP block are
> independent things. The thing to do here is either make the DWC3 code
> a library which drivers call (e.g. SDHCI) or add hooks into the DWC3
> driver for platform specifics (e.g. Designware PCI). Neither is a
> simple solution though.

Sounds reasonable, but as you say it's likely not a short term
solution. If someone ever picked it up maybe they could create a
new driver (with plenty of copied code from the current driver)
and start with supporting a single platform (with multi-platform
support in the driver architecture). Other drivers could then be
migrated one by one by folks who have the hardware to test.
Duplicate code is definitely not desirable, but it's probably
more feasible than migrating all the drivers in one big bang.

I guess for now we are stuck with the race in the dwc3-qcom
driver ...

      reply	other threads:[~2020-06-18 21:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 18:39 [PATCH] driver core:Export the symbol device_is_bound Sandeep Maheswaram
2020-06-16 20:48 ` Matthias Kaehlcke
2020-06-18  8:14 ` Greg Kroah-Hartman
2020-06-18 15:45   ` Matthias Kaehlcke
2020-06-18 15:58     ` Greg Kroah-Hartman
2020-06-18 16:51       ` Matthias Kaehlcke
2020-06-18 17:33         ` Rob Herring
2020-06-18 21:45           ` Matthias Kaehlcke [this message]

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=20200618214516.GG4525@google.com \
    --to=mka@chromium.org \
    --cc=agross@kernel.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mgautam@codeaurora.org \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sanm@codeaurora.org \
    --cc=swboyd@chromium.org \
    /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.