mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Johannes Roith <johannes@gnu-linux.rocks>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] Added support for Digilent Cora Z7 board
Date: Mon, 19 May 2025 06:39:09 +0200	[thread overview]
Message-ID: <131a50c8-e87c-44c2-8cce-32726570c072@pengutronix.de> (raw)
In-Reply-To: <aCoZWQzb8NbSTXtw@Precision-T3610>

Hi,

On 18.05.25 19:31, Johannes Roith wrote:
> Am Fri, May 16, 2025 at 10:05:49PM +0200 schrieb Ahmad Fatoum:
>>> +static void cora_z7_ps7_init(void)
>>> +{
>>> +	/*
>>> +	 * Read OCM mapping configuration, if only the upper 64 KByte are
>>> +	 * mapped to the high address, it's very likely that we just got control
>>> +	 * from the BootROM. If the mapping is changed something other than the
>>> +	 * BootROM was running before us. Skip PS7 init to avoid cutting the
>>> +	 * branch we are sitting on in that case.
>>> +	 */
>>> +	if ((readl(0xf8000910) & 0xf) != 0x8)
>>
>> Please use a macro for the address and wrap it in IOMEM().
>> Eventually, we will want to enforce addresses to be pointers, so it would
>> be cool for new code to already use the correct types. If you want type
>> checking, just add
>>
>> #include <linux/io.h> at the top of your includes.
>>
> 
> So, it should look like this, right:
> 
> void __iomem *ocm_config = IOMEM(OCM_CFG);

Or just #define OCM_CFG IOMEM(0xf8000910).

> Hmm, good question. In theory most of the code is generic or could be
> implemted in functions in mach-zynq and the lowlevel board just calls
> these functions with the correct arguments, e.g. the DDR init. But
> that way it is quite time consuming to implement. This here is basically
> just copy paste from a Vitis generated code adopted to the coding style of
> barebox.

Ok. If the code is generated anyways, then it's fine to duplicate it IMO.
You could also keep the generated code in a separate file and define
some macros to make changes to it minimal, but this is fine too.

>>> +config MACH_CORA_Z7
>>> +	bool "Digilent Cora Z7"
>>> +	select ARCH_ZYNQ7000
>>
>> Can you enable this in zynq_defconfig?
> 
> Yes, it is selectable in the config.

Add it to the defconfigs (arch/arm/configs) that enable CONFIG_MACH_ZEDBOARD.

Cheers,
Ahmad

-- 
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 |



      reply	other threads:[~2025-05-19  4:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16 17:18 Johannes Roith
2025-05-16 20:05 ` Ahmad Fatoum
2025-05-18 17:31   ` Johannes Roith
2025-05-19  4:39     ` Ahmad Fatoum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=131a50c8-e87c-44c2-8cce-32726570c072@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=johannes@gnu-linux.rocks \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox