From owner-freebsd-arm@freebsd.org Sun Mar 11 19:39:13 2018 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39A5BF49304 for ; Sun, 11 Mar 2018 19:39:13 +0000 (UTC) (envelope-from freebsd-arm@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9003A7AE8D for ; Sun, 11 Mar 2018 19:39:11 +0000 (UTC) (envelope-from freebsd-arm@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Sun, 11 Mar 2018 20:34:01 +0100 id 00DD6046.5AA584A9.000041F5 Date: Sun, 11 Mar 2018 20:34:00 +0100 From: Milan Obuch To: freebsd-arm@freebsd.org Subject: GENERIC-MMCCAM/SDIO on Allwinner? Message-ID: <20180311203400.134f10cf@zeta.dino.sk> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; i386-portbld-freebsd10.4) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Mar 2018 19:39:13 -0000 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 #include +#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: 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: 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