devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	David Summers
	<beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>,
	Jaehoon Chung
	<jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 1/3 v2] ARM: dts: rk3288-tinker.dtsi: Fix SD card detection
Date: Mon, 25 Feb 2019 23:20:08 +0100	[thread overview]
Message-ID: <19889336.iz2VfdP0Nf@diego> (raw)
In-Reply-To: <CAD=FV=XEPKpDVLdpCVB9eMzJNE8C5Pr=fRgRmJXgxzrDFJ39mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Am Montag, 25. Februar 2019, 22:18:28 CET schrieb Doug Anderson:
> Hi,
> On Mon, Feb 25, 2019 at 1:11 PM David Summers
> 
> <beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org> wrote:
> > On 25/02/2019 17:13, Doug Anderson wrote:
> > > Hi,
> > > 
> > > On Fri, Feb 22, 2019 at 10:48 AM David Summers
> > > 
> > > <beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org> wrote:
> > >> The Problem:
> > >> 
> > >> On ASUS Tinker Board S, when booting from the eMMC, and there is no
> > >> card sd slot, then there are constant errors.
> > >> 
> > >> Cause:
> > >> 
> > >> Thanks must go to Robin Murphy @ ARM for idenifying the problem. The
> > >> rk808 on the Tinker Board and Tinker Board S has many regulators, one
> > >> vccio_sd powers the IO for the sd card. Unfortunatly this is also used
> > >> in the card detect. Now when no card is install, the regulator is
> > >> powered down. This means that the card detect floats, and this means
> > >> random card detection.
> > > 
> > > Yeah, this is broken on a lot of SoCs that use dw_mmc.  :(  Really the
> > > card detect line needs to be on a different rail and this is why all
> > > boards I've worked on recently have a the card detect going to a GPIO
> > > instead of the dw_mmc CD.
> > > 
> > > IIRC Rockchip moved the Card Detect to a different rail on newer SoCs
> > > (like rk3399) but we still used a GPIO even there since we didn't like
> > > the default/automatic muxing of JTAG and SD signals.
> > > 
> > > The one board I was involved in that did it wrong (where we discovered
> > > this issue) was exynos5250-snow.  You can see some discussion about
> > > the issue at:
> > > 
> > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/282474
> > > .html
> > > 
> > > In that discussion I'm pretty sure that Ulf suggested that a better
> > > way to go was to use something like "broken-cd" which I think was
> > > supposed to switch us to use polling.  AKA periodically the SD card
> > > would be powered on and we'd check for a card, then we'd power
> > > everything off.  ...but that was never implemented for snow at least
> > > so there may be something more than just adding the property.  You can
> > > read through the whole thread for more details.
> > > 
> > > 
> > > IIRC leaving the IO rail always on like you're proposing can also work
> > > OK but there may be some corner cases, especially if you are trying to
> > > reach UHS speeds and/or if the bootloader ever tries to use UHS
> > > speeds.  It's almost certainly busted if the bootloader did UHS since
> > > it will leave the line at ~1.8 V and the kernel will expect it to be
> > > at ~3.3 V.  ...but maybe you rely on the bootloader not doing UHS and
> > > maybe things are generally OK if not?  There may also be cases where
> > > you can't properly power down / reset a card because the card may be
> > > drawing power through the IO lines when you power off its main lines.
> > > That's not good for the card and can also put it in a bad state.  I
> > > haven't done all the research here so this may be a bit of FUD--it's
> > > just a vague recollection from many years ago.
> > > 
> > > 
> > > ...so to make a long story short, a better solution is to allow the IO
> > > lines to be powered off but then poll for the card periodically.
> > > 
> > >> The Solution:
> > >> 
> > >> Make sure that the sd IO is always powered, this means card detection
> > >> is always active, which is what should be done on a board with an sd
> > >> slot, which both the Tinker Board and Tinker Board S are. Hence change
> > >> is made to the .dtsi which takes effect on all Tinker Boards as
> > >> required.
> > >> 
> > >> The change also adds "regulator-boot-on" the Tinker Board boot from
> > >> uboot, and the sd card is always one option. Hence the IO must be
> > >> powered in uboot, and so setting this flag.
> > >> 
> > >> Also removed is "disable-wp" the micro sd card which are used have no
> > >> write  protection, so the concept doesn't mean anything, and the
> > >> Tinker Boards work without this. Hence it is removed to simply.
> > > 
> > > As others have said, please leave disable-wp.  There's no way for the
> > > kernel to know if you have a SD or uSD slot and the only difference
> > > between the two (electrically) is that there's no write protect for
> > > micro SD.
> > > 
> > > 
> > > Also: please CC dw_mmc people on future patches in this area.
> > > 
> > > $ ./scripts/get_maintainer.pl -f drivers/mmc/host/dw_mmc.c
> > > Jaehoon Chung <jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> (maintainer:SYNOPSYS DESIGNWARE
> > > MMC/SD/SDIO DRIVER)
> > > Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> (maintainer:MULTIMEDIA CARD
> > > (MMC), SECURE DIGITAL (SD) AND...)
> > > linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org (open list:SYNOPSYS DESIGNWARE MMC/SD/SDIO
> > > DRIVER)
> > > 
> > > -Doug
> > 
> > I think the possible problem is that without this we were getting a lot
> > of errors. Now as the errors happen when the sd io is power down, and so
> > CD floats; then the IO will be powered back up gain - to access the
> > card, only to find no card.
> 
> I definitely haven't thought through all the consequences of adding
> polling.  ...but given that the problem is really common with SoCs
> using dw_mmc it's probably worth it to figure out out something sane.
> In theory you could have some code that knows that the card detect
> becomes reliable once the IOs are powered on...
> 
> > So this means the power line goes up and down a lot. Now if we have
> > broken-cd, and polling has to be used, doesn't this also have to power
> > up the IO so it can poll, and the poll puts a bit more load on the
> > processor.
> > 
> > So question is which is better? To keep the IO powered up, or to have it
> > going up and down?
> > 
> > Anyway I'm happy with either solution. So if we can agree which is best,
> > I'll do the patch for that.
> 
> I don't know which is better.  ...but I wouldn't expect that turning
> on regulators and checking a GPIO ever second or so would burn much
> power.

and should also save actual power if the regulator isn't running all
the time :-)

  parent reply	other threads:[~2019-02-25 22:20 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-17 12:15 [PATCH 0/3] ARM: dts: rk3288 Tinker Board (S) updates David Summers
2019-02-17 12:15 ` [PATCH 1/3] ARM: dts: rk3288 Tinker Board (S) sdcard changes David Summers
2019-02-17 14:00   ` Robin Murphy
2019-02-17 15:19     ` David Summers
2019-02-18 11:54       ` Robin Murphy
2019-02-19 20:13         ` David Summers
     [not found]   ` <20190217121513.22965-2-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-17 20:29     ` Stefan Wahren
     [not found]       ` <1660942499.343639.1550435365757-uEpKuDZ350hmhno068Nerg@public.gmane.org>
2019-02-18 20:08         ` David Summers
2019-02-22 18:47     ` [PATCH 1/3 v2] ARM: dts: rk3288-tinker.dtsi: Fix SD card detection David Summers
     [not found]       ` <20190222184708.32004-1-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-24 19:26         ` Jonas Karlman
     [not found]           ` <AM3PR03MB096656098C6CB4712C73C095AC790-XQTXrJX/giFAc9da7WRX18eAHadYHfrlvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-02-24 19:35             ` David Summers
     [not found]               ` <5387a001-1036-bb5c-e781-18e87ca6e7bd-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-24 19:56                 ` Jonas Karlman
     [not found]                   ` <AM3PR03MB09663F32FC40000E42C1A722AC790-XQTXrJX/giFAc9da7WRX18eAHadYHfrlvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-02-24 20:10                     ` David Summers
     [not found]                       ` <e1f1a93e-505b-bf53-a253-5c1ddaeaebf8-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-24 22:54                         ` Heiko Stübner
2019-02-25  8:59                           ` Jonas Karlman
2019-02-25 21:00                           ` David Summers
     [not found]                             ` <31863095-94b5-5fec-0293-b30172426b93-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-25 21:14                               ` Doug Anderson
2019-02-25 17:13         ` Doug Anderson
     [not found]           ` <CAD=FV=UkQ7pEan4aGezvQZZjBc0gDJ1R7YRbN1Lbv9HBVQRgHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-25 21:11             ` David Summers
     [not found]               ` <9e90c5dd-7b1e-9e53-81ac-fb3b515215ca-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-25 21:18                 ` Doug Anderson
     [not found]                   ` <CAD=FV=XEPKpDVLdpCVB9eMzJNE8C5Pr=fRgRmJXgxzrDFJ39mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-25 22:20                     ` Heiko Stübner [this message]
2019-02-26 14:46                       ` Robin Murphy
     [not found]                         ` <108411d8-9607-d92d-e546-d0c85bcabc51-5wv7dgnIgG8@public.gmane.org>
2019-02-26 16:43                           ` Doug Anderson
     [not found]                             ` <CAD=FV=X0rRPkEim1sHS9EqDCLiWPO7e5Vu-0gAcX7YZ_omeKPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-27 13:48                               ` Robin Murphy
2019-03-03 11:08         ` David Summers
2019-02-17 12:15 ` [PATCH 2/3] ARM: dts: rk3288 Tinker Board (S) add wi-fi David Summers
     [not found]   ` <20190217121513.22965-3-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-17 14:32     ` Tony McKahan
2019-02-17 15:55       ` David Summers
     [not found]         ` <4ef63671-f58d-3b16-9055-09e69314a0e6-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-17 17:32           ` Tony McKahan
2019-02-17 21:19           ` Stefan Wahren
     [not found]       ` <CAERgokmpHQb2czJdx++qFoogFRmkvXZm=4BNOsVuCz-ZvgTEaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-17 19:03         ` David Summers
2019-02-17 20:43     ` Stefan Wahren
2019-02-18 12:30       ` Robin Murphy
     [not found]       ` <1528638260.343699.1550436208775-uEpKuDZ350hmhno068Nerg@public.gmane.org>
2019-02-18 20:26         ` David Summers
2019-02-18 21:48           ` Stefan Wahren
2019-03-03 19:40   ` David Summers
     [not found]     ` <9df2e318-a459-bded-2971-90a6722e1a4f-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-03-03 22:12       ` Tony McKahan
2019-02-17 12:15 ` [PATCH 3/3] ARM: dts: rk3288 Tinker Board (S) add bluetooth David Summers
     [not found]   ` <20190217121513.22965-4-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-02-17 13:31     ` Tony McKahan
2019-02-17 21:05     ` Stefan Wahren
2019-02-18 20:47       ` David Summers
2019-02-18 21:40         ` Stefan Wahren
2019-03-03 20:15   ` David Summers
2019-02-23 19:42 ` [PATCH 0/3] ARM: dts: rk3288 Tinker Board (S) updates David Summers
2019-03-09 15:36 ` [PATCH v3 1/3] arm: dts: rk3288-tinker.dtsi: Fix SD card detection David Summers
2019-03-09 15:39 ` David Summers
     [not found]   ` <20190309153923.22806-1-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-03-09 15:39     ` [PATCH v3 2/3] arm: dts: rk3288-tinker.dtsi: Enable WiFi David Summers
2019-03-11 22:18       ` Robin Murphy
     [not found]         ` <383c9884-4885-34e1-9ef7-96e936bb211d-5wv7dgnIgG8@public.gmane.org>
2019-03-12 20:41           ` David Summers
     [not found]             ` <c91db9a2-4283-0ea5-949e-ed190a7a8083-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-03-12 20:55               ` Heiko Stübner
     [not found]       ` <20190309153923.22806-2-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-03-12 14:18         ` Heiko Stuebner
2019-03-12 14:21           ` Stefan Wahren
2019-03-13 10:50         ` Heiko Stübner
2019-03-09 15:39     ` [PATCH v3 3/3] arm: dts: rk3288-tinker.dtsi: Add outline Bluetooth support David Summers
2019-03-11 16:41       ` Marcel Holtmann
2019-03-11 20:48         ` David Summers
     [not found]       ` <20190309153923.22806-3-beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-03-13 10:56         ` Heiko Stübner
2019-03-13 19:57           ` David Summers
2019-03-13 20:02           ` David Summers
2019-03-12 14:08     ` [PATCH v3 1/3] arm: dts: rk3288-tinker.dtsi: Fix SD card detection Heiko Stuebner
2019-03-12 14:17       ` Robin Murphy
2019-03-12 14:22     ` Heiko Stuebner
2019-03-12 20:34       ` David Summers
     [not found]         ` <4a1ad220-103d-543e-56d1-3c6d6ad906ec-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org>
2019-03-12 20:52           ` Heiko Stübner
2019-03-12 21:04             ` Jonas Karlman
2019-03-13 10:40     ` Heiko Stübner

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=19889336.iz2VfdP0Nf@diego \
    --to=heiko-4mtyjxux2i+zqb+pc5nmwq@public.gmane.org \
    --cc=beagleboard-8lkWs+DogrrqRUWtDFdff/XRex20P6io@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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 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).