
The GLOBAL_BOOT_MODE_ADDR for i.MX28 is taken from an U-Boot patch for the MX28EVK: http://repository.timesys.com/buildsources/u/u-boot/u-boot-2009.08/u-boot-20...
It could be 0x0001a7f0 too: /* The global boot mode will be detected by ROM code and * a boot mode value will be stored at fixed address: * TO1.0 addr 0x0001a7f0 * TO1.2 addr 0x00019BF0 */ #ifndef MX28_EVK_TO1_0 #define GLOBAL_BOOT_MODE_ADDR 0x00019BF0 #else #define GLOBAL_BOOT_MODE_ADDR 0x0001a7f0 #endif Probably depending on the silicon spin, so perhaps we want to make a CONFIG_ for older silicon.
And the numbers read at this address don't match the numbers read from the boot mode GPIO pin. Only the lowest 4 bits represent the actual boot device and below the definitions: #define BOOT_MODE_USB0 0x0 #define BOOT_MODE_I2C0 0x1 #define BOOT_MODE_SPI2 0x2 #define BOOT_MODE_SPI3 0x3 #define BOOT_MODE_GPMI 0x4 #define BOOT_MODE_rsvd1 0x5 #define BOOT_MODE_JTAG 0x6 #define BOOT_MODE_rsvd3 0x7 #define BOOT_MODE_SPI3_EE 0x8 #define BOOT_MODE_SSP0 0x9 #define BOOT_MODE_SSP1 0xa #define BOOT_MODE_rsvd4 0xb #define BOOT_MODE_rsvd5 0xc #define BOOT_MODE_rsvd6 0xd #define BOOT_MODE_rsvd7 0xe #define BOOT_MODE_TEST 0xf Higher bits have other purposes. On my board, for example, a value of 0x14 is reported when booting from NAND flash.
Having said all of this, I think your way is definitely the way to go.