diff mbox

mmc does not work in qemu n900

Message ID 201501301523.34410@pali (mailing list archive)
State New, archived
Headers show

Commit Message

Pali Rohár Jan. 30, 2015, 2:23 p.m. UTC
On Tuesday 27 January 2015 10:17:39 Pali Rohár wrote:
> On Tuesday 27 January 2015 00:21:04 Aaro Koskinen wrote:
> > Hi,
> > 
> > On Mon, Jan 26, 2015 at 10:04:59PM +0100, Pali Rohár wrote:
> > > problem? Why any of these two patches fix problem when mmc
> > > is not detected by kernel in qemu (machine n900)?
> > > Detection of mmc fails because function
> > > mmc_send_op_cond() without one of above patches fails.
> > 
> > Has it ever worked? It could be just that QEMU's emulation
> > is broken. Since the kernel works on actual HW, you
> > probably should contact QEMU maintainers.
> > 
> > I don't see n900 in Debian's QEMU. There's n800 and n810 but
> > I couldn't boot any of my kernels with those...
> > 
> > A.
> 
> It worked with stock Nokia kernel (2.6.28).
> 
> N900 qemu support is not in upstream qemu project, but in
> linaro qemu version. You can find it e.g. in ubuntu:
> http://packages.ubuntu.com/source/precise-updates/qemu-linaro

Here is another alternative patch which enable internal eMMC 
support in qemu n900:

 
It just disable SDIO and SD code. It looks like using some SDIO 
or SD commands on mmc controller in qemu cause problems...

Any idea?

Comments

Pali Rohár Feb. 7, 2015, 11:02 p.m. UTC | #1
On Friday 30 January 2015 15:23:34 Pali Rohár wrote:
> On Tuesday 27 January 2015 10:17:39 Pali Rohár wrote:
> > On Tuesday 27 January 2015 00:21:04 Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Mon, Jan 26, 2015 at 10:04:59PM +0100, Pali Rohár wrote:
> > > > problem? Why any of these two patches fix problem when
> > > > mmc is not detected by kernel in qemu (machine n900)?
> > > > Detection of mmc fails because function
> > > > mmc_send_op_cond() without one of above patches fails.
> > > 
> > > Has it ever worked? It could be just that QEMU's emulation
> > > is broken. Since the kernel works on actual HW, you
> > > probably should contact QEMU maintainers.
> > > 
> > > I don't see n900 in Debian's QEMU. There's n800 and n810
> > > but I couldn't boot any of my kernels with those...
> > > 
> > > A.
> > 
> > It worked with stock Nokia kernel (2.6.28).
> > 
> > N900 qemu support is not in upstream qemu project, but in
> > linaro qemu version. You can find it e.g. in ubuntu:
> > http://packages.ubuntu.com/source/precise-updates/qemu-linar
> > o
> 
> Here is another alternative patch which enable internal eMMC
> support in qemu n900:
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9584bff..225df49 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2330,13 +2330,13 @@ static int mmc_rescan_try_freq(struct
> mmc_host *host, unsigned freq)
>  	sdio_reset(host);
>  	mmc_go_idle(host);
> 
> -	mmc_send_if_cond(host, host->ocr_avail);
> -
> -	/* Order's important: probe SDIO, then SD, then MMC */
> -	if (!mmc_attach_sdio(host))
> -		return 0;
> -	if (!mmc_attach_sd(host))
> -		return 0;
> +//	mmc_send_if_cond(host, host->ocr_avail);
> +//
> +//	/* Order's important: probe SDIO, then SD, then MMC */
> +//	if (!mmc_attach_sdio(host))
> +//		return 0;
> +//	if (!mmc_attach_sd(host))
> +//		return 0;
>  	if (!mmc_attach_mmc(host))
>  		return 0;
> 
> It just disable SDIO and SD code. It looks like using some
> SDIO or SD commands on mmc controller in qemu cause
> problems...
> 
> Any idea?

Pavel, see this email thread:
http://www.spinics.net/lists/linux-mmc/msg30424.html

You had problem with mounting mmc device as rootfs on (real) 
Nokia N900. Can you test one of those 3 patches which I sent to 
this email thread? If it change something for your kernel or 
userspace? I would like to know if I found another bug in qemu or 
same as you had...
Pali Rohár Dec. 14, 2016, 9:25 p.m. UTC | #2
On Friday 30 January 2015 15:23:34 Pali Rohár wrote:
> On Tuesday 27 January 2015 10:17:39 Pali Rohár wrote:
> > On Tuesday 27 January 2015 00:21:04 Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Mon, Jan 26, 2015 at 10:04:59PM +0100, Pali Rohár wrote:
> > > > problem? Why any of these two patches fix problem when mmc
> > > > is not detected by kernel in qemu (machine n900)?
> > > > Detection of mmc fails because function
> > > > mmc_send_op_cond() without one of above patches fails.
> > > 
> > > Has it ever worked? It could be just that QEMU's emulation
> > > is broken. Since the kernel works on actual HW, you
> > > probably should contact QEMU maintainers.
> > > 
> > > I don't see n900 in Debian's QEMU. There's n800 and n810 but
> > > I couldn't boot any of my kernels with those...
> > > 
> > > A.
> > 
> > It worked with stock Nokia kernel (2.6.28).
> > 
> > N900 qemu support is not in upstream qemu project, but in
> > linaro qemu version. You can find it e.g. in ubuntu:
> > http://packages.ubuntu.com/source/precise-updates/qemu-linaro
> 
> Here is another alternative patch which enable internal eMMC
> support in qemu n900:
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9584bff..225df49 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2330,13 +2330,13 @@ static int mmc_rescan_try_freq(struct
> mmc_host *host, unsigned freq)
>  	sdio_reset(host);
>  	mmc_go_idle(host);
> 
> -	mmc_send_if_cond(host, host->ocr_avail);
> -
> -	/* Order's important: probe SDIO, then SD, then MMC */
> -	if (!mmc_attach_sdio(host))
> -		return 0;
> -	if (!mmc_attach_sd(host))
> -		return 0;
> +//	mmc_send_if_cond(host, host->ocr_avail);
> +//
> +//	/* Order's important: probe SDIO, then SD, then MMC */
> +//	if (!mmc_attach_sdio(host))
> +//		return 0;
> +//	if (!mmc_attach_sd(host))
> +//		return 0;
>  	if (!mmc_attach_mmc(host))
>  		return 0;
> 
> It just disable SDIO and SD code. It looks like using some SDIO
> or SD commands on mmc controller in qemu cause problems...
> 
> Any idea?

Now there are DT flags no-sdio and no-sd which skips mmc_attach_sdio() 
and mmc_attach_sd() calls. Same result as my commented code above...

I will send patch for Nokia N900 which will disable SDIO and SD.
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 9584bff..225df49 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2330,13 +2330,13 @@  static int mmc_rescan_try_freq(struct 
mmc_host *host, unsigned freq)
 	sdio_reset(host);
 	mmc_go_idle(host);
 
-	mmc_send_if_cond(host, host->ocr_avail);
-
-	/* Order's important: probe SDIO, then SD, then MMC */
-	if (!mmc_attach_sdio(host))
-		return 0;
-	if (!mmc_attach_sd(host))
-		return 0;
+//	mmc_send_if_cond(host, host->ocr_avail);
+//
+//	/* Order's important: probe SDIO, then SD, then MMC */
+//	if (!mmc_attach_sdio(host))
+//		return 0;
+//	if (!mmc_attach_sd(host))
+//		return 0;
 	if (!mmc_attach_mmc(host))
 		return 0;