From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 07 May 2025 00:25:31 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uCQjD-002vzv-2d for lore@lore.pengutronix.de; Wed, 07 May 2025 00:25:31 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uCQjC-0007QN-NJ for lore@pengutronix.de; Wed, 07 May 2025 00:25:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9FNO3Vs30q+5i50vd5BKxztQ0gJ/2RNoY9omByVINfg=; b=GHaLry5o/lv1J94WjM0ET3uIBK BDiwpFmAzEKUGAprDGicrZbMMYPSDzKbpRc2CmMeUFQ+1n3rBMavgJ+2RmlmkbCHV4LQa6LPE+00x nY7QZ/GzjBp60S08pEMbLjFcWNvattCiKgAOMVyQdMk4jCa53qxaSpprhDIuZ40djsF7QRe6YWwgm kB0HEl4brbaxI8dpV60vBh1Qyzxx/nmjIRkgWROxGUBQmPzQwbzuus4suEdn4PJESESuFjpgxz/nR H4JxDXxgK8T+avGv+AEYy4G5191kfpdCRQ0Cg3njQ1BgjtetYhQc78p9V2mT9YQmKi0BYqCxKMuyu CHsYSU7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uCQiT-0000000DZef-0wxd; Tue, 06 May 2025 22:24:45 +0000 Received: from mout.kundenserver.de ([212.227.126.134]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uCLiG-0000000CnHB-3fra for barebox@lists.infradead.org; Tue, 06 May 2025 17:04:14 +0000 Received: from InfinityCube ([95.91.233.51]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MEUaQ-1uE3sY47DO-0048tH; Tue, 06 May 2025 19:04:09 +0200 Date: Tue, 6 May 2025 19:04:03 +0200 From: Johannes Roith To: Sascha Hauer Cc: barebox@lists.infradead.org, a.fatoum@pengutronix.de Message-ID: References: <20250428172001.6708-1-johannes@gnu-linux.rocks> <3761c82f-78ec-42ea-bf4a-d8ecbdced01d@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:IEC8dY7lzAxtLBn5BX8SMDpEdCCsFbstuwAZBthIbhWyZoR/X6m IAnNvtqgip60gZBQiC+O+Nml7vgvDDvvASPx9WUAjHXeoU39TuZaB/CI9yIM4F6JoxSTuFG vZA8+33Fe7kdJiISdxUq2uAlNcJdXjhOAMkmLiObwJUTX5Vd34Wsh7QNZk5fkWpzPv7fCnO hoHGpR59tflkRXEqiQjKA== UI-OutboundReport: notjunk:1;M01:P0:wBaQEuE2lDE=;LYvIVvMrNuQ4AgwffGkV7acIhKA rGz4fYmoLMJg98uE9lwcuMFszhNSQ+FL+RHAG/qzGuYqcR1ycueaoVN/mMiRhbW9f2et1X8BY jMpq4WAQhTd9WucMKy3ulpnHiKRFx/tONHYXbChvg3r+/48+JzZZmmiK6bEaqpWSv2sxeN9DO pQk95WFKRvrlNdgrFveD+90MnJPIAxqES7w4XQ0IXXAONV+9gOH0f3cApGZ/btWvQq1lPJf34 6lVM+GvTH23N+ysGLDj+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/yo+N0gSbV9k28kovBp+4UTTkrhzT1rjhvD9GEdvaBRa3V9c3Ov7atiEk5csYwR6 UKsSGvJvWhGqThjpqM2f9FhPSKw/Go5aNava+EbMqVZ9akaSenaEG0dN2z X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250506_100413_207145_11390FED X-CRM114-Status: GOOD ( 68.35 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-5.8 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: Re: Porting Cora Z7 Board to barebox X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) Hi Sascha, thanks for the fast reply. Am Mon, May 05, 2025 at 09:39:41AM +0200 schrieb Sascha Hauer: > On Thu, May 01, 2025 at 02:16:39PM +0200, Johannes Roith wrote: > > Hi, > > > > thanks for the fast replies. > > > > Am Tue, Apr 29, 2025 at 11:49:40AM +0200 schrieb Ahmad Fatoum: > > > Hi, > > > > > > On 4/29/25 10:34, Sascha Hauer wrote: > > > > In case of the Zedboard you could take start_avnet_zedboard.pbl. This > > > > contains all necessary components including device tree and barebox > > > > proper. > > > > > > > > However, this binary is linked to 0x0 and the FSBL will likely load it > > > > there. I don't know where the FSBL itself is located. > > > > Can I change the address to which barebox is linked to? E.g. in Vitis > > the application is linked to 0x10000 and the FSBL starting this > > application to 0x0. > > First of all the barebox binary is relocatable, you can start it at any > address. > > You could change the address by adjusting ARCH_TEXT_BASE, but why would > you? From the output below it seems your binary just starts fine from > address 0x0. The Zynq-7000 has a processor system (PS) with a Cortex-A9 and a programmable logic (PL) which is basically a FPGA. With barebox I can't load a bitstream to the FPGA. Or does barebox provides an interface for loading FPGAs? My idea was to use Xilinx FSBL which loads the bitstream to the FPGA and then loads an ELF file. The problem is, if the ELF file is linked to address 0x0 like the FSBL, the FSBL overwrites its code when loading the ELF file and crashes. But if I write a small application which is loaded by the FSBL I can read start_dt_2nd.pblb from the mmc, put it somewhere in DRAM memory and jump to it. This should start the barebox proper, right? I set ARCH_TEXT_BASE to 0x1000_0000 as you suggested and create a Xilinx Boot Image with start_dt_2nd.pbl inside, but the ELF file seems still be linked for 0x0. The FSBL loaded the FPGA but barebox never booted, so I guess the FSBL overwrote itself. > > > > > > > The good news is, I can boot barebox (PBL and proper) now and sometimes > > also can Linux. Here is the output of my barebox: > > > > Digilent Cora Z7 PBL > > uncompress.c: memory at 0x00000000, size 0x20000000 > > mmu: enabling MMU, ttb @ 0x1ffd0000 > > endmem = 0x20000000 > > arm_mem_scratch = 0x1fff8000+0x00008000 > > arm_mem_stack = 0x1ffe9000+0x0000f000 > > arm_mem_ttb = 0x1ffd0000+0x00010000 > > arm_mem_barebox_image = 0x1fe00000+0x00200000 > > arm_mem_early_malloc = 0x1fde0000+0x00020000 > > membase = 0x00000000+0x20000000 > > uncompress.c: uncompressing barebox binary at 0x00006270 (size 0x00029c0c) to 0x1fe00000 (uncompressed size: 0x0006c0e8) > > uncompress.c: jumping to uncompressed image at 0x1fe00000 > > > > > > barebox 2025.04.0-00215-gdacb19ae3252-dirty #11 Wed Apr 30 22:22:15 CEST 2025 > > > > > > Board: Digilent Cora Z7 > > ERROR: could not get clock /axi/dma-controller@f8003000:apb_pclk(0) > > ERROR: could not get clock /axi/etb@f8801000:apb_pclk(0) > > ERROR: could not get clock /axi/tpiu@f8803000:apb_pclk(0) > > ERROR: could not get clock /axi/funnel@f8804000:apb_pclk(0) > > ERROR: could not get clock /axi/ptm@f889c000:apb_pclk(0) > > ERROR: could not get clock /axi/ptm@f889d000:apb_pclk(0) > > mdio_bus: miibus0: probed > > macb e000b000.ethernet@e000b000.of: Cadence GEM at 0xe000b000 > > arasan-sdhci e0100000.mmc@e0100000.of: registered as mmc0 > > malloc space: 0x17e00000 -> 0x1fdfffff (size 128 MiB) > > arasan-sdhci e0100000.mmc@e0100000.of: error while transferring data for command 6 > > arasan-sdhci e0100000.mmc@e0100000.of: state = 0x01f70202 , interrupt = 0x00208000 > > mmc0: Card's startup fails with -74 > > barebox-environment chosen:environment-sd.of: probe failed: No such file or directory > > environment load /dev/env0: No such file or directory > > Maybe you have to create the partition. > > > > > > Do you know what to do about the "could not get clock errors"? Do I have > > to take care about them or just ignore them? > > We don't have drivers for any of the devices that you fail to get a > clock for, so that is not a problem. > > Anyway, the clocks are registered by the clock driver, so normally they > should be found. > > Do you have BAREBOX_DEEP_PROBE_ENABLE() in your board file? If not, > please add it. It makes sure the clock driver is probed once we need a > clock. Thanks, adding BAREBOX_DEEP_PROBE_ENABLE() fixed it. Now the errors do no longer appear. > > > > > The more critical error comes from the SD card. Every second boot I am > > getting the errors shown above, sometimes the card is started correctly. > > > > Also when barebox can startup the mmc0, when starting the Linux Kernel > > sometimes the rootfs on /dev/mmcblk0p2 is not found and the SD Card is > > not detected. So, there seems to be something wrong with the SD Card > > interface... > > You found out yourself, but yes, rootwait is needed to boot from SD/eMMC > cards. > > > > > In lowlevel.c I am setting the clock divider for the sdio0 interface to 10 > > and the Source for generated clock is IO PLL. Therefore, the sdio IP > > should get a 100 MHz input clock. IS this correct? Do you know which > > clockrate the driver expects? > > > > Or do you have any other idea what could case the error? > > > > In case I can fix the remaining errors I would like to bring the changes > > upstream and send a patch. Here I also have some questions: > > > > I added the following files and folder: > > > > arch/arm/boards/digilent-cora/ > > arch/arm/dts/zynq-cora.dts > > dts/src/arm/xilinx/zynq-cora.dts > > > > arch/arm/boards/digilent-cora/ is a copy of arch/arm/boards/avnet-zed/ > > with my changes applied. In the Copyright, should I keep the existing > > name and just add mine as a second author? > > I'd say in this case just replace the original author with your name. > You would likely have come up with the same file if you had written it > yourself. OK, thanks. > > > > > If I understand it correctly, the files in dts/src are imported from the > > Linux kernel git repo, right? > > Yes, right. > > > In this case I should try to bring my > > modified device tree mainline to Linux first and then commit my changes > > to barebox? Or is there another file location I can drop my device tree > > temporarily until it is available in Linux? > > We thought about creating a an extra directory for dts files which are > pending upstream, but we are not there yet. > > Best practice is to separate the barebox specific dts stuff from the > about-to-be-upstreamed stuff and put both files into arch/arm/dts. > With this we can just drop the non-barebox specific file once it's in > Linux upstream without losing the barebox specific changes. > Currently both files are named zynq-cora.dts. What would be a good name for the DT which will be replaced when upstreamed to Linux? zynq-cora-linux.dts? > > > > And a last question: How can I change the default boot method in barebox > > from net to mmc0? > > nv boot.default="mmc0". See https://www.barebox.org/doc/latest/user/variables.html > and the output of the "magicvar" command Ok, it now tries to boot from mmc0, but I am getting an error: Board: Digilent Cora Z7 deep-probe: supported due to xlnx,zynq-cora mdio_bus: miibus0: probed macb e000b000.ethernet@e000b000.of: Cadence GEM at 0xe000b000 arasan-sdhci e0100000.mmc@e0100000.of: registered as mmc0 malloc space: 0x17e00000 -> 0x1fdfffff (size 128 MiB) mmc0: detected SD card version 2.0 mmc0: registered mmc0 Hit any to stop autoboot: 3 barebox@Digilent Cora Z7:/ boot Nothing bootable found on 'mmc0' Nothing bootable found barebox@Digilent Cora Z7:/ nv allow_color: true autoboot_timeout: 3 boot.default: mmc0 linux.bootargs.console: console=ttyPS1,115200 root=/dev/mmcblk0p2 rootwait user: none I have an SD card with a FAT32 and an EXT4 partition. On the FAT32 I have the zImage of the Linux kernel. Am I missing something here? > > Regards, > Sascha > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | Best regard, Johannes