From: Jesse Taube <mr.bossman075@gmail.com>
To: Giulio Benetti <giulio.benetti@benettiengineering.com>,
Samuel Holland <samuel@sholland.org>,
Andre Przywara <andre.przywara@arm.com>
Cc: u-boot@lists.denx.de, jagan@amarulasolutions.com,
hdegoede@redhat.com, sjg@chromium.org, icenowy@aosc.io,
marek.behun@nic.cz, festevam@denx.de, narmstrong@baylibre.com,
tharvey@gateworks.com, christianshewitt@gmail.com,
pbrobinson@gmail.com, jernej.skrabec@gmail.com, hs@denx.de,
arnaud.ferraris@gmail.com, thirtythreeforty@gmail.com,
Chris Morgan <macroalpha82@gmail.com>
Subject: Re: [PATCH 09/11] sunxi: Add support for SUNIV architecture
Date: Sat, 29 Jan 2022 16:23:20 -0500 [thread overview]
Message-ID: <e9732d92-fa5e-16a2-9a1f-e7cc867bf157@gmail.com> (raw)
In-Reply-To: <51e9bff7-9eba-75fb-1839-e5f8fa108159@benettiengineering.com>
On 1/29/22 16:21, Giulio Benetti wrote:
> On 29/01/22 22:19, Jesse Taube wrote:
>>
>>
>> On 1/29/22 16:05, Jesse Taube wrote:
>>>
>>>
>>> On 1/29/22 15:59, Samuel Holland wrote:
>>>> On 1/29/22 5:51 AM, Andre Przywara wrote:
>>>>> On Fri, 28 Jan 2022 22:21:28 -0500
>>>>> Jesse Taube <mr.bossman075@gmail.com> wrote:
>>>>>> On 1/26/22 09:38, Jesse Taube wrote:
>>>>>>> On 1/26/22 09:13, Andre Przywara wrote:
>>>>>>>> On Tue, 4 Jan 2022 19:35:06 -0500
>>>>>>>> Jesse Taube <mr.bossman075@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> u32 spl_boot_device(void)
>>>>>>>>> {
>>>>>>>>> return sunxi_get_boot_device();
>>>>>>>>> }
>>>>>>>>> +#else
>>>>>>>>> +/*
>>>>>>>>> + * suniv BROM do not pass the boot media type to SPL, so we try with the
>>>>>>>>> + * boot sequence in BROM: mmc0->spinor->fail.
>>>>>>>>> + */
>>>>>>>>> +void board_boot_order(u32 *spl_boot_list)
>>>>>>>>> +{
>>>>>>>>> + /*
>>>>>>>>> + * See the comments above in sunxi_get_boot_device() for information
>>>>>>>>> + * about FEL boot.
>>>>>>>>> + */
>>>>>>>>> + if (!is_boot0_magic(SPL_ADDR + 4)) {
>>>>>>>>> + spl_boot_list[0] = BOOT_DEVICE_BOARD;
>>>>>>>>> + return;
>>>>>>>>> + }
>>>>>>>>> +
>>>>>>>>> + spl_boot_list[0] = BOOT_DEVICE_MMC1;
>>>>>>>>
>>>>>>>> So does that mean that it tries MMC first, even when booted via SPI? So if
>>>>>>>> there is a *non*-bootable microSD card in, it will read something from
>>>>>>>> sector 80, and will execute that if this is a FIT or legacy image?
>>>>>>> yes
>>>>>> Uh sorry to bother you again but I cant seem to find a way to find where
>>>>>> the bootrom got the spl. I could check other periphirals like pinmux. I
>>>>>> could also just have it configured at build. Are both these options
>>>>>> okay? I will try to find a way to find the boot device at runtime first.
>>>>>
>>>>> Don't bother for this version, it's fine as it is now, we can refine
>>>>> this later. It's only a problem if there is a non-valid SPL, but a
>>>>> valid U-Boot proper legacy image on the SD card.
>>>>> I don't want to have a build time option, we try to keep a single image
>>>>> for all boot sources.
>>>>> So eventually I'd prefer the pinmux/clock check, since that's cheaper.
>>>>> The alternative would be to read the SPL (again), check for a valid
>>>>> header and verify the checksum. You can look at this for inspiration:
>>>>> https://patchwork.ozlabs.org/project/uboot/patch/20210712100651.6912-3-andre.przywara@arm.com/
>>>>
>>>> I checked the boot ROM code (thanks Jesse!), and indeed it does not report where
>>>> it loaded SPL from, or make any other changes to the loaded eGON image. The boot
>>>> ROM also completely cleans up its clock and pinctrl changes, regardless of the
>>>> success/failure of a specific boot device.
>>>>
>>>> There's a function which loads some value to r2, but that gets called before the
>>>> "load eGON from storage" functions, so r2 will be clobbered.
>>>>
>>>> So as far as I can tell, the only way to determine the boot device, other than
>>>> reimplementing the BROM in SPL, is to look at the return address on the top of
>>>> the BROM's stack. These are the possible values (in order of execution):
>>>>
>>>> 0xffff40f8: mmc0
>>>> 0xffff4114: spi0 NAND
>>>> 0xffff4130: spi0 NOR
>>>> 0xffff4150: mmc1
>>>
>>> If i save it in save_boot_params it does change when in a different boot
>>> device. Ill look into it more.
>>> the sp is also a good idea.
>> Sry Im just dumb. it does change but it is because it doesn't clean the
>> registers.
>> Thanks sam, looking at the stack is the best option.
>
> I've been too late :-)
Im sorry only by a couple of seconds.
> So happy assembly coding Jesse!
Its very difficult :( I'm not used to how it works yet.
Thanks,
Jesse Taube
>
> Best regards
next prev parent reply other threads:[~2022-01-29 21:23 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-05 0:34 [PATCH 00/11] Add support for SUNIV and F1C100s Jesse Taube
2022-01-05 0:34 ` [PATCH 01/11] arm: arm926ej-s: start.S: port save_boot_params support from armv7 code Jesse Taube
2022-01-21 1:57 ` Andre Przywara
2022-01-05 0:34 ` [PATCH 02/11] arm: arm926ej-s: add sunxi code Jesse Taube
2022-01-21 2:25 ` Andre Przywara
2022-01-21 3:16 ` Jesse Taube
2022-01-24 1:45 ` Andre Przywara
2022-01-05 0:35 ` [PATCH 03/11] dt-bindings: clock: Add initial suniv headers Jesse Taube
2022-01-21 1:57 ` Andre Przywara
2022-01-05 0:35 ` [PATCH 04/11] dt-bindings: reset: " Jesse Taube
2022-01-21 1:58 ` Andre Przywara
2022-01-05 0:35 ` [PATCH 05/11] ARM: sunxi: Add support for F1C100s Jesse Taube
2022-01-26 2:05 ` Andre Przywara
2022-01-26 4:53 ` Jesse Taube
2022-01-26 10:08 ` Andre Przywara
2022-01-05 0:35 ` [PATCH 06/11] sunxi: Add F1C100s DRAM initial support Jesse Taube
2022-01-05 0:35 ` [PATCH 07/11] sunxi: board: Add support for SUNIV Jesse Taube
2022-01-21 1:58 ` Andre Przywara
2022-01-05 0:35 ` [PATCH 08/11] configs: sunxi: Add common SUNIV header Jesse Taube
2022-01-26 2:07 ` Andre Przywara
2022-01-05 0:35 ` [PATCH 09/11] sunxi: Add support for SUNIV architecture Jesse Taube
2022-01-26 14:13 ` Andre Przywara
2022-01-26 14:38 ` Jesse Taube
2022-01-29 3:21 ` Jesse Taube
2022-01-29 11:51 ` Andre Przywara
2022-01-29 19:24 ` Jesse Taube
2022-01-29 20:44 ` Giulio Benetti
2022-01-29 20:59 ` Samuel Holland
2022-01-29 21:05 ` Jesse Taube
2022-01-29 21:18 ` Giulio Benetti
2022-01-29 21:19 ` Jesse Taube
2022-01-29 21:21 ` Giulio Benetti
2022-01-29 21:23 ` Jesse Taube [this message]
2022-01-05 0:35 ` [PATCH 10/11] ARM: dts: suniv: Add device tree files for F1C100s Jesse Taube
2022-01-21 1:59 ` Andre Przywara
2022-01-21 2:12 ` Jesse Taube
2022-01-05 0:35 ` [PATCH 11/11] configs: sunxi: Add support for Lichee Pi Nano Jesse Taube
2022-01-26 14:13 ` Andre Przywara
2022-01-26 14:48 ` Jesse Taube
2022-01-05 11:36 ` [PATCH 00/11] Add support for SUNIV and F1C100s Icenowy Zheng
2022-01-05 12:14 ` Andre Przywara
2022-01-05 12:54 ` Jesse Taube
2022-01-05 16:00 ` Giulio Benetti
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=e9732d92-fa5e-16a2-9a1f-e7cc867bf157@gmail.com \
--to=mr.bossman075@gmail.com \
--cc=andre.przywara@arm.com \
--cc=arnaud.ferraris@gmail.com \
--cc=christianshewitt@gmail.com \
--cc=festevam@denx.de \
--cc=giulio.benetti@benettiengineering.com \
--cc=hdegoede@redhat.com \
--cc=hs@denx.de \
--cc=icenowy@aosc.io \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=macroalpha82@gmail.com \
--cc=marek.behun@nic.cz \
--cc=narmstrong@baylibre.com \
--cc=pbrobinson@gmail.com \
--cc=samuel@sholland.org \
--cc=sjg@chromium.org \
--cc=tharvey@gateworks.com \
--cc=thirtythreeforty@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.