Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Mar 2018 20:34:00 +0100
From:      Milan Obuch <freebsd-arm@dino.sk>
To:        freebsd-arm@freebsd.org
Subject:   GENERIC-MMCCAM/SDIO on Allwinner?
Message-ID:  <20180311203400.134f10cf@zeta.dino.sk>

next in thread | raw e-mail | index | archive | help
Hi,

I saw there is GENERIC-MMCCAM kernel config file now, which should make
posible to try SDIO on arm boards, so I decided to try it on my
Allwinner H2+ based Orange Pi Zero. It did not work, there was no disk
found for root file system. Examining console output, I found no
mention of aw_mmc device.

I read wiki at https://wiki.freebsd.org/SDIO and looked over another
boards device drivers, and came with following modification to
/usr/sys/arm/allwinner/files.allwinner

--- files.allwinner.orig	2018-03-11 08:23:34.971413000 +0100
+++ files.allwinner	2018-03-11 08:28:56.972933000 +0100
@@ -10,7 +10,7 @@
 arm/allwinner/aw_gpio.c			optional	gpio
 arm/allwinner/aw_if_dwc.c		optional	dwc
 arm/allwinner/aw_machdep.c		standard
-arm/allwinner/aw_mmc.c			optional	mmc
+arm/allwinner/aw_mmc.c			optional	mmc | mmccam
 arm/allwinner/aw_mp.c			optional	smp
 arm/allwinner/aw_nmi.c			optional	intrng
 arm/allwinner/aw_rsb.c			optional	rsb | p2wi

and /usr/sys/arm/allwinner/aw_mmc.c

--- aw_mmc.c.orig	2018-03-11 08:25:05.979124000 +0100
+++ aw_mmc.c	2018-03-11 08:25:56.993269000 +0100
@@ -52,6 +52,8 @@
 #include <dev/extres/hwreset/hwreset.h>
 #include <dev/extres/regulator/regulator.h>
 
+#include "opt_mmccam.h"
+
 #define	AW_MMC_MEMRES		0
 #define	AW_MMC_IRQRES		1
 #define	AW_MMC_RESSZ		2
@@ -1062,4 +1064,6 @@
 
 DRIVER_MODULE(aw_mmc, simplebus, aw_mmc_driver, aw_mmc_devclass, NULL,
     NULL);
+#ifndef MMCCAM
 MMC_DECLARE_BRIDGE(aw_mmc);
+#endif

This makes kernel with aw_mmc device, but it does not work either, in
console output was just

aw_mmc0: <Allwinner Integrated MMC/SD controller> mem 0x1c0f000-0x1c0ffff irq 5 on simplebus0
aw_mmc0: vmmc-supply regulator found
aw_mmc0: attaching MMC child failed!
device_attach: aw_mmc0 attach returned 6
aw_mmc0: <Allwinner Integrated MMC/SD controller> mem 0x1c10000-0x1c10fff irq 6 on simplebus0
aw_mmc0: cannot reset the controller
device_attach: aw_mmc0 attach returned 6

(there are two devices in dtb, first one is for SD card with root
filesystem, second one is for wifi/bluetooth device). This makes
actually sense - there is no device mmc in MMCCAM kernel config files,
however, I am no step nearer now to usable SDIO on Allwinner SoC.

With some more look over sources I realised aw_mmc is not the same as
drivers for devices with working MMCCAM according wiki mentioned above
- in aw_mmc method table, we have just device, bus and MMC bridge
interface, whereas others have SDHCI interface in addition. And naming
suggests it too - aw_mmc vs. ti_sdhci and bcm2835_sdhci...

All this together, it looks like aw_mmc needs some rework in order to
be able to move to MMCCAM framework. Did anybody something more already
which could be shared?

regards,
Milan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180311203400.134f10cf>