[U-Boot] [PATCH v2 0/3] ARM: omap3: beagle, evm: synchronize common setup

Derald D. Woods woods.technical at gmail.com
Sun Feb 25 18:54:46 UTC 2018


On Sat, Feb 24, 2018 at 01:39:45PM -0600, Derald Woods wrote:
> On Sat, Feb 24, 2018 at 02:12:32PM -0500, Tom Rini wrote:
> > On Sat, Feb 24, 2018 at 09:29:02AM -0600, Derald D. Woods wrote:
> > > On Sat, Feb 24, 2018 at 09:35:43AM -0500, Tom Rini wrote:
> > > > On Sat, Feb 24, 2018 at 08:09:39AM -0600, Derald D. Woods wrote:
> > > >
> > > > > This short series is an attempt to make this set of boards use the same
> > > > > default configuration items where possible. This was prompted by an
> > > > > investigation into enabling SERIAL_SEARCH_ALL on omap3_evm. This feature
> > > > > now works for omap3_evm after this series.
> > > > >
> > > > > The series changes the default NAND layout of MTDPARTS_DEFAULT and
> > > > > uses ENV_IS_IN_FAT. More detail is provided with the patches. As most
> > > > > things are configurable now, this should not be an issue. I am trying
> > > > > to get simple defaults that just boot and expose the common core
> > > > > features. This will make future testing and maintenance a bit more
> > > > > predictable, as there will be a very similar comparable set of boards.
> > > >
> > > > I was thinking, wouldn't we want to update the beagle code now to do env
> > > > in NAND on beagleboard and env on FAT on xM?  We could provide a new
> > > > env_get_location() to return the right location based on board.  Thanks!
> > > >
> > >
> > > I thought of that too. xM can never use NAND. So FAT is always right for
> > > it. Regular BeagleBoard(3530) can have the environment in either location.
> > > Configuration can simply handle the user preference. I did not see a
> > > reason to add any more logic into an already heavy board file. The Overo
> > > boards are equally heavy with board type logic. For now, my thinking
> > > was to allow configuration do the work.
> >
> > OK, but on the other hand, xM must have an SD card inserted and vanilla
> > does not require an SD card.  So now those users need to put in an SD
> > card.  Now, I honestly don't know how big a deal that is really, so I
> > won't nak the patches.  But I do think it would be the best user
> > experience to have classic continue to work as-is and xM to finally get
> > functional env.
> >
> 
> I will try to add the 'env_get_location'. So let's hold until I can push a
> 'v3' of the series.
> 
> The possible env locations:
> 
> ENVL_FAT
> ENVL_MMC
> ENVL_NAND
> ENVL_UBI
> 
> If those make sense, 'env_get_location' priority will select one of them.
> 

Using 'env_get_location' is not working with this diff:

---8<------------------------------------------------------------------
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 1d55264733..22e6af7bb8 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -33,6 +33,7 @@
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/musb.h>
+#include <environment.h>
 #include "beagle.h"
 #include <command.h>
 
@@ -332,6 +333,34 @@ static struct musb_hdrc_platform_data musb_plat = {
 };
 #endif
 
+#if defined(CONFIG_SPL_BUILD) && \
+       defined(CONFIG_ENV_IS_IN_NAND) && \
+       defined(CONFIG_ENV_IS_IN_FAT)
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+       switch (prio) {
+       case 0:
+               return ENVL_FAT;
+       case 1:
+               switch (get_board_revision()) {
+               case REVISION_AXBX:
+               case REVISION_CX:
+               case REVISION_C4:
+                       return ENVL_NAND;
+               case REVISION_XM_AB:
+               case REVISION_XM_C:
+               default:
+                       return ENVL_FAT;
+               }
+               break;
+       default:
+               break;
+       }
+
+       return ENVL_UNKNOWN;
+}
+#endif /* CONFIG_SPL_BUILD && CONFIG_ENV_IS_IN_{NAND,FAT} */
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
---8<-------------------------------------------------------------------

Additionally, it will not boot without using '#if defined(CONFIG_SPL_BUILD)'.
When booting on BeagleBoard-xM, I get the following:

---8<-------------------------------------------------------------------
U-Boot SPL 2018.03-rc3-00033-g881e2514dd-dirty (Feb 25 2018 - 12:26:00 -0600)
Trying to boot from MMC1
spl_load_image_fat_os: error reading image args, err - -2


U-Boot 2018.03-rc3-00033-g881e2514dd-dirty (Feb 25 2018 - 12:26:00 -0600)

OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 1 GHz
Model: TI OMAP3 BeagleBoard xM
OMAP3 Beagle board + LPDDR/NAND
I2C:   ready
DRAM:  256 MiB
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Failed (-5)
Loading Environment from NAND... *** Warning - readenv() failed, using default environment

Failed (-5)
Beagle xM Rev C
No EEPROM on expansion board
OMAP die ID: 46da00029ff800000168300f15027017
Net:   usb_ether
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 1 Ethernet Device(s) found
Hit any key to stop autoboot:  0 
BeagleBoard-xM # env save
Saving Environment to NAND... Failed (1)
Saving Environment to NAND... Failed (1)
Saving Environment to NAND... Failed (1)
Saving Environment to NAND... Failed (1)
Saving Environment to NAND... Failed (1)
Saving Environment to NAND... Failed (1)
...
---8<-------------------------------------------------------------------

The configuration mix for 'env_get_location' needs some documentation
and examples. The only other user is "board/sunxi/board.c". I do not
have that board. This seems to be a path that is not ready to use right
now. This should be handled on a separate series.

I will send a 'v3' of the series to leave CONFIG_ENV_IS_IN_NAND as the
default. All other changes will remain. I will take a look at
'env_get_location' again at some later time. Right now I just want to
have my three OMAP3 boards booting with similar setups.

As always, I am open to suggestions.

Derald


More information about the U-Boot mailing list