linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: "Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"Mike Rapoport" <rppt@linux.ibm.com>,
	"David Sterba" <dsterba@suse.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"Petr Mladek" <pmladek@suse.com>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Kefeng Wang" <wangkefeng.wang@huawei.com>,
	"Yangtao Li" <tiny.windzz@gmail.com>,
	"Alexios Zavras" <alexios.zavras@intel.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Allison Randal" <allison@lohutok.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"John Stultz" <john.stultz@linaro.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH v2 04/11] mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card
Date: Thu, 31 Oct 2019 17:23:40 +0100	[thread overview]
Message-ID: <CAPDyKFr3oh9HcExn4Sx0Cd2e0oBTsxz+L4tDvypRFP8=hQP=cg@mail.gmail.com> (raw)
In-Reply-To: <607E3AE4-65BF-4003-86BE-C70646D53D09@goldelico.com>

On Wed, 30 Oct 2019 at 18:25, H. Nikolaus Schaller <hns@goldelico.com> wrote:
>
> Hi Ulf,
>
> > Am 30.10.2019 um 16:51 schrieb Ulf Hansson <ulf.hansson@linaro.org>:
> >
> >> +
> >> +               np = of_get_compatible_child(np, "ti,wl1251");
> >> +               if (np) {
> >> +                       /*
> >> +                        * We have TI wl1251 attached to MMC3. Pass this information to
> >> +                        * SDIO core because it can't be probed by normal methods.
> >> +                        */
> >> +
> >> +                       dev_info(host->dev, "found wl1251\n");
> >> +                       card->quirks |= MMC_QUIRK_NONSTD_SDIO;
> >> +                       card->cccr.wide_bus = 1;
> >> +                       card->cis.vendor = 0x104c;
> >> +                       card->cis.device = 0x9066;
> >> +                       card->cis.blksize = 512;
> >> +                       card->cis.max_dtr = 24000000;
> >> +                       card->ocr = 0x80;
> >
> > These things should really be figured out by the mmc core during SDIO
> > card initialization itself, not via the host ops ->init_card()
> > callback. That is just poor hack, which in the long run should go
> > away.
>
> Yes, I agree.
>
> But I am just the poor guy who is trying to fix really broken code with
> as low effort as possible.

I see. Thanks for looking at this mess!

In general, as long as we improve the code, I am happy to move forward.

However, my main concern at this point, is to make sure we get the DT
bindings and the DTS files updated correctly. We don't want to come
back to this again.

>
> I don't even have a significant clue what this code is exactly doing and what
> the magic values mean. They were setup by pandora_wl1251_init_card() in the
> same way so that I have just moved the code here and make it called in (almost)
> the same situation.

Okay!

>
> > Moreover, I think we should add a subnode to the host node in the DT,
> > to describe the embedded SDIO card, rather than parsing the subnode
> > for the SDIO func - as that seems wrong to me.
>
> You mean a second subnode?
>
> The wl1251 is the child node of the mmc node and describes the SDIO card.
> We just check if it is a wl1251 or e.g. wl1837 or something else or even
> no child.

The reason why I brought this up, was because there are sometimes
cases where an SDIO card is shared between more than one SDIO func.
WiFi+Bluetooth for example, but if I am correct, that is not the case
for wl1251?

That said, I am happy to continue with your approach.

>
> > To add a subnode for the SDIO card, we already have a binding that I
> > think we should extend. Please have a look at
> > Documentation/devicetree/bindings/mmc/mmc-card.txt.
> >
> > If you want an example of how to implement this for your case, do a
> > git grep "broken-hpi" in the driver/mmc/core/, I think it will tell
> > you more of what I have in mind.
>
> So while I agree that it should be improved in the long run, we should
> IMHO fix the hack first (broken since v4.9!), even if it remains a hack
> for now. Improving this part seems to be quite independent and focussed
> on the mmc subsystem, while the other patches involve other subsystems.

I agree.

>
> Maybe should we make a REVISIT note in the code? Or add something to
> the commit message about the idea how it should be done right?

Just add a note that we should move this DT parsing of the subnode to
the mmc core, but that we are leaving that as a future improvement.
That's good enough. Then I can have a look as a second step, and when
I get some time, to move this to the mmc core.

However, there is one thing I would like you to add to the series. That is:

In the struct omap_hsmmc_platform_data, there is an ->init_card()
callback. Beyond the changes of this series, there is no longer any
users of that, unless I am mistaken. Going forward, let's make sure it
doesn't get used again, so can you please remove it!?

[...]

Kind regards
Uffe

  reply	other threads:[~2019-10-31 16:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-19 18:41 [PATCH v2 00/11] OpenPandora: make wl1251 connected to mmc3 sdio port of OpenPandora work again H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 01/11] Documentation: dt: wireless: update wl1251 for sdio H. Nikolaus Schaller
2019-10-25 21:13   ` Rob Herring
2019-10-26  8:24     ` H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 02/11] net: wireless: ti: wl1251 add device tree support H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 03/11] DTS: ARM: pandora-common: define wl1251 as child node of mmc3 H. Nikolaus Schaller
2019-10-30 16:44   ` Ulf Hansson
2019-10-30 17:24     ` H. Nikolaus Schaller
     [not found]       ` <D9A82904-35BE-41F2-A308-9A49606428B1-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
2019-10-31 16:59         ` Ulf Hansson
2019-10-19 18:41 ` [PATCH v2 04/11] mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card H. Nikolaus Schaller
2019-10-30 15:51   ` Ulf Hansson
2019-10-30 17:24     ` H. Nikolaus Schaller
2019-10-31 16:23       ` Ulf Hansson [this message]
2019-10-19 18:41 ` [PATCH v2 05/11] omap: pdata-quirks: revert pandora specific gpiod additions H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 06/11] omap: pdata-quirks: remove openpandora quirks for mmc3 and wl1251 H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 07/11] omap: remove old hsmmc.[ch] and in Makefile H. Nikolaus Schaller
     [not found]   ` <9bd4c0bb0df26523d7f5265cdb06d86d63dafba8.1571510481.git.hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
2019-10-21 14:30     ` Tony Lindgren
2019-10-21 17:07       ` H. Nikolaus Schaller
2019-10-21 17:11         ` Tony Lindgren
     [not found]           ` <20191021171104.GY5610-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2019-10-22  6:58             ` Ulf Hansson
2019-10-19 18:41 ` [PATCH v2 08/11] mmc: sdio: fix wl1251 vendor id H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 09/11] mmc: core: fix wl1251 sdio quirks H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 10/11] net: wireless: ti: wl1251 use new SDIO_VENDOR_ID_TI_WL1251 definition H. Nikolaus Schaller
2019-10-19 18:41 ` [PATCH v2 11/11] net: wireless: ti: remove local VENDOR_ID and DEVICE_ID definitions H. Nikolaus Schaller

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='CAPDyKFr3oh9HcExn4Sx0Cd2e0oBTsxz+L4tDvypRFP8=hQP=cg@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=alexios.zavras@intel.com \
    --cc=allison@lohutok.net \
    --cc=bcousson@baylibre.com \
    --cc=bhelgaas@google.com \
    --cc=dsterba@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hns@goldelico.com \
    --cc=john.stultz@linaro.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pmladek@suse.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robh+dt@kernel.org \
    --cc=rppt@linux.ibm.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=tiny.windzz@gmail.com \
    --cc=tony@atomide.com \
    --cc=wangkefeng.wang@huawei.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 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).