[U-Boot] [PATCH v1 2/7] board/ti/am335x: add support for beaglebone NAND cape

Gupta, Pekon
2014-07-21T06:12:46Z

>From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Rini, Tom
>>On Sat, Jul 05, 2014 at 12:35:12AM +0530, Pekon Gupta wrote:

>> Beaglebone Board can be connected to expansion boards to add devices to them.
>> These expansion boards are called 'capes'. This patch adds support for
>> following versions of Beaglebone(AM335x) NAND capes
>> (a) NAND Device with bus-width=16, block-size=128k, page-size=2k, oob-size=64
>> (b) NAND Device with bus-width=16, block-size=256k, page-size=4k, oob-size=224
>> Further information and datasheets can be found at [1] and [2]
>[snip]
>> @@ -377,7 +391,11 @@ void enable_board_pin_mux(struct am335x_baseboard_id *header)
>> configure_module_pin_mux(i2c1_pin_mux);
>> configure_module_pin_mux(mii1_pin_mux);
>> configure_module_pin_mux(mmc0_pin_mux);
>> +#if defined(CONFIG_NAND)
>> + configure_module_pin_mux(nand_pin_mux);
>> +#else
>> configure_module_pin_mux(mmc1_pin_mux);
>> +#endif
>
>The above is the case for Beaglebone Black. Did you test the capes
>there as well? AFAIK the eMMC makes it a bit more tricky (or
>impossible?) to use some of the memory capes.
>
Yes, slightly tricky, but not impossible :-)
On Beaglebone all storage devices (NAND, NOR and eMMC) share GPMC pins.
So this patch gives priority based on configs enabled in board-profile:
#ifdef CONFIG_NAND
/* define NAND pin-mux */
#elseif CONFIG_NOR
/* configure NOR pin-mux */
#else
/* config eMMC pin-mux (default, if no NAND | NOR cape is present) */
#endif

Please refer to following log from beaglebone Black booting from NAND.
U-boot was flashed on NAND using following commands:
/* Flash MLO to NAND */
fatload mmc 0 0x82000000 mlo
nand write 0x82000000 0x0 0x20000
/* Flash u-boot.img to NAND */
fatload mmc 0 0x82000000 u-boot.img
nand write 0x82000000 0xc0000 0x80000

-----------------
U-Boot 2014.07-00013-g838a657-dirty (Jul 21 2014 - 10:27:34)
I2C: ready
DRAM: 512 MiB
NAND: 512 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
Net: <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot: 1 \b\b\b 0
U-Boot#
------------------

*IMPORTANT NOTE*
As Beaglebone board shares the same config as AM335x EVM, so following
changes are required in addition to this patch for Beaglebone NAND cape.
Therefore above image has a 'dirty commit'.
(1) Enable NAND in am335x_beaglebone board profile
(2) Add CONFIG_SYS_NAND_BUSWIDTH_16BIT to board config because:
- AM335x EVM has NAND device with datawidth=8, whereas
- Beaglebone NAND cape has NAND device with data-width=16

diff --git a/boards.cfg b/boards.cfg
-Active arm armv7 am33xx ti am335x am335x_boneblack am335x_evm:SERIAL
+Active arm armv7 am33xx ti am335x am335x_boneblack am335x_evm:SERIAL

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
+#define CONFIG_SYS_NAND_BUSWIDTH_16BIT

with regards, pekon