From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pali =?utf-8?B?Um9ow6Fy?= Date: Tue, 6 Oct 2020 13:02:12 +0200 Subject: [PATCH v2] arm: mvebu: Espressobin: Set environment variable fdtfile In-Reply-To: <267f1dff-f64f-d42f-9cef-24dfe8c32371@gmail.com> References: <20200905120744.634300-1-a.heider@gmail.com> <20200911043510.488790-1-a.heider@gmail.com> <20200925074609.n64pvzfhyfbuf6xl@pali> <50079647-7698-a9ab-f9b9-a4d389dad556@gmail.com> <20201002104920.tw54m6dmmner64ni@pali> <1702adff-6eee-ed4b-6db3-c4ee858b60cc@gmail.com> <20201003085001.q7b3sthteei5wgb6@pali> <267f1dff-f64f-d42f-9cef-24dfe8c32371@gmail.com> Message-ID: <20201006110212.ezulkroopckio4up@pali> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday 05 October 2020 18:20:17 Andre Heider wrote: > On 03/10/2020 10:50, Pali Roh?r wrote: > > On Saturday 03 October 2020 09:17:35 Andre Heider wrote: > > > On 02/10/2020 12:49, Pali Roh?r wrote: > > > > On Saturday 26 September 2020 11:09:59 Andre Heider wrote: > > > > > On 25/09/2020 09:46, Pali Roh?r wrote: > > > > > > On Friday 11 September 2020 06:35:10 Andre Heider wrote: > > > > > ... > > > > > > > +#ifdef CONFIG_BOARD_LATE_INIT > > > > > > > +int board_late_init(void) > > > > > > > +{ > > > > > > > + bool ddr4, emmc; > > > > > > > + > > > > > > > + if (env_get("fdtfile")) > > > > > > > + return 0; > > > > > > > + > > > > > > > + if (!of_machine_is_compatible("globalscale,espressobin")) > > > > > > > + return 0; > > > > > > > + > > > > > > > + /* If the memory controller has been configured for DDR4, we're running on v7 */ > > > > > > > + ddr4 = ((readl(A3700_CH0_MC_CTRL2_REG) >> A3700_MC_CTRL2_SDRAM_TYPE_OFFS) > > > > > > > + & A3700_MC_CTRL2_SDRAM_TYPE_MASK) == A3700_MC_CTRL2_SDRAM_TYPE_DDR4; > > > > > > > + > > > > > > > + emmc = of_machine_is_compatible("globalscale,espressobin-emmc"); > > > > > > > > > > > > Maybe stupid question, but are not we able to detect if eMMC is > > > > > > connected or not at runtime? That could simplify setup and avoid usage > > > > > > of additional special DTS file for eMMC in U-Boot. > > > > > > > > > > At some point I wondered about the same. > > > > > > > > > > IIRC armbian just enables it and uses one u-boot binary everywhere. A > > > > > non-existing chip won't get detected, so that shouldn't be a problem. > > > > > > > > > > But I think it has more to do with enabling/powering up hardware blocks, > > > > > which is not wanted or may even problematic. > > > > > > > > In U-Boot such functionality may be implemented in board_fix_fdt() > > > > function which allows U-Boot to modify its Device tree prior using it. > > > > > > > > You have already wrote code which is doing V5 vs V7 detection, so > > > > detecting eMMC is the last thing which is missing to have just one > > > > U-Boot DTS file and therefore only one U-Boot binary for Espressobin. > > > > > > That implies setting status=okay for the emmc node, which then powers up > > > that block. I don't know if that might be problematic. Can we just do that? > > > > No. I mean to detect presence of eMMC in board_fix_fdt() and then set > > tatus=okay only if check passed. > > Yes, but how do you detect the emmc then? Enabling it in u-boot's dts and > calling mmc_init() on it would be the easy way, but open coding all the > required parts to do that with status=disabled could get rather big and/or > unmaintanable (I didn't check what exactly would be required)? Hm... seems that it would be really easier to enable eMMC in U-Boot DTS, let U-Boot to try initialize eMMC and in case it fails, then disable eMMC drivers &?devices and disable it also in FTB blob. For powering up eMMC there is function comphy_emmc_power_up(), so it would be needed to write power_down equivalent. And for xenon_sdhci.c would be needed to write .remove callback (for disabling eMMC). > > > > > The emmc detection would also add some delay to the boot process. > > > > > > At least it should be powered down if no emmc chip has been detected, but I > > > didn't check if that happens right now. > > > > > > Regards, > > > Andre >