From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfKBA-0000GY-Ee for barebox@lists.infradead.org; Fri, 04 Jan 2019 07:46:06 +0000 Date: Fri, 4 Jan 2019 08:46:01 +0100 From: Sascha Hauer Message-ID: <20190104074601.ufpltid5d6itawxe@pengutronix.de> References: <20190102202611.6530-1-sam@ravnborg.org> <20190102202611.6530-3-sam@ravnborg.org> <20190103054647.GA4625@ravnborg.org> <20190103195318.GA26647@ravnborg.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190103195318.GA26647@ravnborg.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v1 2/3] lib: bootstrap: detect SD card before mounting To: Sam Ravnborg Cc: Andrey Smirnov , Barebox List On Thu, Jan 03, 2019 at 08:53:18PM +0100, Sam Ravnborg wrote: > Hi Andreay. > > > > > To support bootstrap from SD card run a detect all before > > > > mounting the SD card. > > > > > > > > Signed-off-by: Sam Ravnborg > > > > --- > > > > lib/bootstrap/disk.c | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/lib/bootstrap/disk.c b/lib/bootstrap/disk.c > > > > index fd016166e..77be95c2f 100644 > > > > --- a/lib/bootstrap/disk.c > > > > +++ b/lib/bootstrap/disk.c > > > > @@ -21,6 +21,8 @@ void* bootstrap_read_disk(const char *dev, const char *fstype) > > > > size_t len; > > > > const char *path = "/"; > > > > > > > > + device_detect_all(); > > > > + > > > > > > Can device_detect_by_name(dev) be used here instead? > > > > dev equals "disk0.0" when we call bootstrap_read_disk(). > > Calling device_detect_by_name("disk0.0") did not work, and then > > the easy solution with device_detect_all() worked. > > > > I could pass the dev name to bootstrap_read_disk() but > > this would make the caller less general which is why I ended > > up with the more brutal solution. > > I ended up with following code in arch/arm/boards/at91sam9263ek/init.c: > #if defined(CONFIG_MCI_ATMEL) > static struct atmel_mci_platform_data __initdata ek_mci_data = { > .devname = "disk0", > .bus_width = 4, > .detect_pin = AT91_PIN_PE18, > .wp_pin = AT91_PIN_PE19, > }; > > When I specify "devname=disk0", then I could use > detect_by_name(dev) in bootstrap_read_disk(). > No too pretty, but preferable compared to > running a loop detecting all devices. There are two other possibilities. First there is CONFIG_MCI_STARTUP which causes the SD cards to be detected during host registration. Another possibility would be to call device_detect_by_name() from board code (where you implicitly know which hardware device to probe) Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox