mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: barebox@lists.infradead.org
Subject: Re: [PATCH 0/3] mtd: nand: atmel: legacy: fix boot on USB-A9G20
Date: Tue, 21 Mar 2023 17:48:38 +0100	[thread overview]
Message-ID: <ZBnf5oobkyenS+VT@ravnborg.org> (raw)
In-Reply-To: <9bece774-8296-4880-89dc-a33dfcd512f7@thorsis.com>

Hi Alexander.

On Tue, Mar 21, 2023 at 10:44:25AM +0100, Alexander Dahl wrote:
> Hello Sascha,
> 
> Am Tue, Mar 21, 2023 at 09:58:48AM +0100 schrieb Sascha Hauer:
> > Hi Wolfram,
> > 
> > Nice to hear from you here ;)
> > 
> > On Sun, Mar 19, 2023 at 10:28:07PM +0100, Wolfram Sang wrote:
> > > Hi Sam,
> > > 
> > > > It is only a few weeks ago I argued that there was no users of the older
> > > > at91sam* boards, and then you prove me wrong here.
> > > 
> > > At your service ;)
> > > 
> > > > I will try to remember that you may be able to test should someone
> > > > decide to move the barebox support for qil_a9g20 to DT and add PBL
> > > > support in the process.
> > > 
> > > I am still new to at91 and barebox, but AFAICS the PBL support is only
> > > for MCI currently?
> > 
> > As of 4e410f3e68280 PBL is always used on AT91.
> > 
> > I have no idea how the SDRAM setup is done on the USB-A9G20. There seems
> > to be SDRAM setup code for the USB-A9263, but not for the USB-A9G20. Is
> > there some AT91Bootstrap required?
> 
> I can not speak for this particular board, but for others with the
> same SoC (AT91SAM9G20).  The vendor approach is to setup the SDRAM
> (and maybe more) in at91bootstrap, however those old SoCs are not
> supported in recent version 4.x of that anymore, 3.x should work, I
> never tried that for sam9g20 (we still use 1.x for those SoCs).
> at91bootstrap then usually loads U-Boot from flash to SDRAM and starts
> U-Boot.
> 
> You can do the same init in U-Boot SPL as well without the "real"
> at91bootstrap, I think I saw that for other boards with similar SoCs.
> And from what I saw here, barebox has the concept of multiple stages
> as well, right?  So SDRAM must be initialized there in the very first
> stage after ROM code running from (tiny) internal SRAM, equivalent to
> what at91bootstrap does, before relocating to SDRAM.  There's no magic
> thing the ROM code can do for you on that platform.

When I added support to skov-arm9cpu to use barebox as replacement for
at91bootstrap the sdram init looked like this [1]:

static void sam9263_sdramc_init(unsigned int mck)
{
+       const struct at91sam9_sdramc_config config =
+       {
+               .sdramc = IOMEM(AT91SAM9263_BASE_SDRAMC0),
+               .mr = 0,
+               .tr = (mck * 7) / 1000000, // TODO 140 versus 0x13c (316)?
+               .cr = AT91_SDRAMC_NC_10 | AT91_SDRAMC_NR_13 | AT91_SDRAMC_CAS_2
+                     | AT91_SDRAMC_NB_4 | AT91_SDRAMC_DBW_32
+                     | AT91_SDRAMC_TWR_2 | AT91_SDRAMC_TRC_7
+                     | AT91_SDRAMC_TRP_2 | AT91_SDRAMC_TRCD_2
+                     | AT91_SDRAMC_TRAS_5 | AT91_SDRAMC_TXSR_8,
+               .lpr = 0,
+               .mdr = AT91_SDRAMC_MD_SDRAM,
+       };
+
+       /* Define PDC[31:16] as DATA[31:16] */
+       at91_mux_gpio_disable(IOMEM(AT91SAM9263_BASE_PIOD), 0xffff0000);
+       /* No pull-up for D[31:16] */
+       at91_mux_set_pullup(IOMEM(AT91SAM9263_BASE_PIOD), 0xffff0000, true);
+       /* PD16 to PD31 are pheripheral A */
+       at91_mux_set_A_periph(IOMEM(AT91SAM9263_BASE_PIOD), 0xffff0000);
}

On my too long todo list is to complete this work and upstream this for
both this and the at91sam9263ek board.

Anyway - DT support is the first step. Replacing at91bootstrap can
always come later.

[1] https://lore.barebox.org/barebox/20220628203849.2785611-1-sam@ravnborg.org/

	Sam



  reply	other threads:[~2023-03-21 16:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 15:49 Wolfram Sang
2023-03-19 15:49 ` [PATCH 1/3] mtd: nand: atmel: legacy: add 'algo' to use Wolfram Sang
2023-03-19 15:49 ` [PATCH 2/3] mtd: nand: atmel: legacy: use proper ecc_shift Wolfram Sang
2023-03-19 15:49 ` [PATCH 3/3] mtd: nand: atmel: legacy: remove superfluous code Wolfram Sang
2023-03-19 18:51 ` [PATCH 0/3] mtd: nand: atmel: legacy: fix boot on USB-A9G20 Sam Ravnborg
2023-03-19 21:28   ` Wolfram Sang
2023-03-21  8:58     ` Sascha Hauer
2023-03-21  9:44       ` Alexander Dahl
2023-03-21 16:48         ` Sam Ravnborg [this message]
2023-03-21 17:20       ` Wolfram Sang
2023-03-21 19:02         ` Sam Ravnborg
2023-03-21 20:53           ` Sam Ravnborg
2023-03-21 21:42             ` Wolfram Sang
2023-03-22  7:37               ` Sascha Hauer
2023-04-27 17:25           ` Wolfram Sang
2023-04-27 17:26       ` Wolfram Sang
2023-03-22  7:41 ` Sascha Hauer

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=ZBnf5oobkyenS+VT@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=barebox@lists.infradead.org \
    /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