public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Colin Foster <colin.foster@in-advantage.com>
To: Roger Quadros <rogerq@kernel.org>
Cc: Michael Trimarchi <michael@amarulasolutions.com>,
	Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	u-boot@lists.denx.de
Subject: Re: U-Boot OMAP GPMC ECC change
Date: Sat, 20 May 2023 10:27:55 -0700	[thread overview]
Message-ID: <ZGkDG5PhBlRRfYGm@euler> (raw)
In-Reply-To: <f2ed26e6-9600-4a11-c037-fef3ad933151@kernel.org>

On Fri, May 19, 2023 at 03:41:34PM +0300, Roger Quadros wrote:
> Hi Colin,
> 
> On 19/05/2023 02:19, Colin Foster wrote:
> > Hi Roger,
> > 
> >> Can you please share your spl/u-boot.cfg?
> > 
> > Attached
> 
> Couple of questions there
> 
> 1) CONFIG_MTDPARTS_DEFAULT "mtdparts=nandflash:0x20000(xload_raw),0x180000(u-boot),0x180000(u-boot-2),0x1fce0000(main)"
> Is this correct and matches with what kernel sees?
> I couldn't see the NAND partition table in the Kernel Device tree patch.

Yes, this is correct. I intentionally left my MTD Partitions out of the
kernel patch, since I don't want any changes I might make to the flash
partitions to require further patches. I'm currently at this structure
(SPL, 2x U-Boot, and main UBI with A/B partitions and 2x U-Boot Envs)

The SD Boot version of U-Boot doesn't use NAND, so it might have a stale
partition layout that I'll need to remove / modify.

> 
> 2)
> #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000
> #define CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND 0x1a0000
> 
> These don't seem to match what you have defined in MTDPARTS_DEFAULT.
> Which one is correct?

This matches the above partition layout. 0x180000 + 0x20000 = 0x1a0000.

It wasn't until recently I realized I needed to remove
CONFIG_SPL_RAW_IMAGE_SUPPORT in order for this fallback to succeed.

> 
> How do you flash the MLO and u-boot image to NAND?

I boot to from SD card, then run a commissioning script that contains:

```
echo "Erasing MLO partition $MLO_PART"
flash_erase $MLO_PART 0 0

echo "Programming MLO partition"
nandwrite -a -p $MLO_PART $MLO_FILE

echo "Erasing U-Boot partition $U_BOOT_PART"
flash_erase $U_BOOT_PART 0 0

echo "Programming U-Boot partition"
nandwrite -a -p $U_BOOT_PART $U_BOOT_FILE

echo "Erasing U-Boot redundant partition $U_BOOT_PART_REDUND"
flash_erase $U_BOOT_PART_REDUND 0 0

echo "Programming U-Boot redund partition"
nandwrite -a -p $U_BOOT_PART_REDUND $U_BOOT_FILE

echo "Clearing UBI partition"
flash_erase $UBI_PART 0 0

echo "Formatting UBI partition"
ubiformat $UBI_PART -y
ubiattach -p $UBI_PART

echo "Making UBI volumes"
ubimkvol /dev/ubi0 -N env1 -s 0x40000
ubimkvol /dev/ubi0 -N env2 -s 0x40000
ubimkvol /dev/ubi0 -N rootfs-a -s 0xc000000
ubimkvol /dev/ubi0 -N rootfs-b -s 0xc000000

echo "Writing rootfs partitions"
ubiupdatevol /dev/ubi0_2 $ROOTFS_FILE
ubiupdatevol /dev/ubi0_3 $ROOTFS_FILE
```

For all these tests I've been manually running the flash_erase /
nandwrite process for the SPL / U-Boot partitions.

> 
> I tried on AM335x-EVM and it works fine both before and after commit 04fcd25873.
> 
> Once change I had to do was to increase the u-boot partition size
> as u-boot image does not fit in original partition size.
> 
> -----boot log follows-----
> 
> U-Boot SPL 2023.01-rc4-00381-g04fcd25873-dirty (May 19 2023 - 15:10:15 +0300)
> Trying to boot from NAND
> 
> 
> U-Boot 2023.01-rc4-00381-g04fcd25873-dirty (May 19 2023 - 15:10:15 +0300)
> 
> CPU  : AM335X-GP rev 1.0
> Model: TI AM335x EVM
> DRAM:  512 MiB
> Core:  156 devices, 17 uclasses, devicetree: separate
> WDT:   Started wdt@44e35000 with servicing every 1000ms (60s timeout)
> NAND:  256 MiB
> MMC:   OMAP SD/MMC: 0
> Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... 
> <ethaddr> not set. Validating first E-fuse MAC
> Net:   eth2: ethernet@4a100000, eth3: usb_ether
> Hit any key to stop autoboot:  0 
> => 
> 
> => mtd
> 
> device nand0 <nand.0>, # parts = 10
>  #: name                size            offset          mask_flags
>  0: NAND.SPL            0x00020000      0x00000000      0
>  1: NAND.SPL.backup1    0x00020000      0x00020000      0
>  2: NAND.SPL.backup2    0x00020000      0x00040000      0
>  3: NAND.SPL.backup3    0x00020000      0x00060000      0

I need to go back to the 4460 datasheet. I looked and don't remember
seeing anything about an SPL search. I'd sleep better at night knowing
that when the day comes I need to update the SPL, I can do so with some
redundancy. Sorry - I'm getting off topic.

I'll be back with hardware on Monday to keep looking at this.

>  4: NAND.u-boot-spl-os  0x00040000      0x00080000      0
>  5: NAND.u-boot         0x00200000      0x000c0000      0
>  6: NAND.u-boot-env     0x00020000      0x002c0000      0
>  7: NAND.u-boot-env.backup10x00020000   0x002e0000      0
>  8: NAND.kernel         0x00700000      0x00300000      0
>  9: NAND.file-system    0x0f600000      0x00a00000      0
> 
> 
> -- 
> cheers,
> -roger

  reply	other threads:[~2023-05-20 17:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 15:31 U-Boot OMAP GPMC ECC change Colin Foster
2023-05-10  9:42 ` Roger Quadros
2023-05-10 15:38   ` Colin Foster
2023-05-12 11:53     ` Roger Quadros
2023-05-12 16:05       ` Colin Foster
2023-05-13  5:59         ` Roger Quadros
2023-05-17 13:30         ` Roger Quadros
2023-05-17 19:39           ` Colin Foster
2023-05-18 10:55             ` Roger Quadros
2023-05-18 23:19               ` Colin Foster
2023-05-19 12:41                 ` Roger Quadros
2023-05-20 17:27                   ` Colin Foster [this message]
2023-06-26  5:03                     ` Michael Nazzareno Trimarchi
2023-06-27  5:42                       ` Colin Foster

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=ZGkDG5PhBlRRfYGm@euler \
    --to=colin.foster@in-advantage.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=michael@amarulasolutions.com \
    --cc=rogerq@kernel.org \
    --cc=u-boot@lists.denx.de \
    /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