News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

TE0729 eMMC + SD-Card

Started by chris_est, December 07, 2016, 04:48:18 PM

Previous topic - Next topic

chris_est

Hi,
is there a supported mode in Linux to use eMMC and the SD-Card at the same time on the TE0729 Zynq Board ?
We want to use eMMC as rootfs and enable the user to an insert SD-Card for extra storage.
Is this possible on the TE0729 design ? I guess the SEL_SD signal needs to be controlled by Linux in some way.

Oleksandr Kiyenko

Hello,

Think that it not possible with normal SD/eMMC driver. Only way to use SEL_SD is to select SD/eMMC before mount.

Best regards
Oleksandr Kiyenko

Antti Lukats

full dynamic use of both is not supported. It may be possible to switch from one to another one time, but forcing the driver to be unloaded, change select and load the driver again, but this is not for dynamic operation.

chris_est

Thank you for clearing that up! We will use the second sdchi port using EMIO Pins for the SD-Card.

I understand to use eMMC as rootfs, the FSBL needs to be loaded from QSPI-Flash.
Booting from QSPI+SD works fine, but how to configure booting QSPI+eMMC ? Is there a special option in petalinux to enable this ?

Antti Lukats

yesno

eMMC is NOT supported as primary boot, this is why the FSBL has to be loaded from SPI in case of emmc.
From FSBL all the rest can be loaded from eMMC, with special setting in FSBL.
or you can load FSBL and uboot from SPI, and let uboot to continue from eMMC all is possible.
fsbl+bit+uboot+kernel from spi and then rootfs from emmc is also possible.

chris_est

I am currently using the BOOT.BIN image (FSBL, bit, u-boot) from SPI.
It was flashed using the instructions from your wiki: https://wiki.trenz-electronic.de/display/PD/SPI+Flash+Usage
From there I continue to boot using "run netboot" (tftp) to get kernel + rootfs.

Can you show me how to boot rootfs or kenel+rootfs from eMMC instead of tftp ?

Also I don't know what is the best way to get the rootfs onto the eMMC ?
Can u-boot fetch an image from the network (maybe ftp?) and write it to eMMC ?

Antti Lukats

as said there are many options, all of them are explained by Xilinx and/or uboot and linux documents.

if you load fsbl+bit+uboot+kernel from spi flash, then the rootfs can be on emmc, for this there is petalinux option in the menuconfig.

chris_est

Hi,

I am returning to this issue after a while as i am still struggling to get eMMC to work.
What i get so far is that eMMC is supported by the ZYNQ as secondary boot device and should work out of the box.

But the TE0729 Zynq board has an external port expander (U15 on the PCB) controlled by the SEL_SD signal (it switches between SD-Card and eMMC). SEL_SD is connected to MIO48 on the Zynq but i can not get this pin to change.

I guess the FSBL (ps7_init ?) has to be changed to set MIO48 = '1' to get the eMMC instead of the SD-Card ?

Antti Lukats

Correct. You need to change the SD Card mux in FSBL.

chris_est

Can you tell me how to specifically change the MIO48 or point me to the Xilinx docs ?
I could not find a usable doc from Xilinx which describes the FSBL MIO config.

Antti Lukats

FSBL does not have much MIO config fpr GPIO (only for USB reset) you need to access the GPIO via registers or via the GPIO driver from the FSBL. This is done very frequently in FSBL.

chris_est

It works now! For future reference, here is how I did it:

Based on the info here https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart#PetaLinuxKICKstart-PetalinuxConfiguration.1 this file was changed: <petalinux-project-dir>/components/bootloader/zynq_fsbl/fsbl_hooks.c with hints from here: https://forums.xilinx.com/t5/Xcell-Daily-Blog/Driving-the-Zynq-SoC-s-GPIO-Adam-Taylor-s-MicroZed-Chronicles/ba-p/389611

At the beginning of the file add this:

#include "xgpiops.h"


The FsblHookBeforeHandoff() function now looks like this:

u32 FsblHookBeforeHandoff(void)
{
        u32 Status;

        Status = XST_SUCCESS;

        /*
         * User logic to be added here.
         * Errors to be stored in the status variable and returned
         */
        fsbl_printf(DEBUG_INFO,"In FsblHookBeforeHandoff function \r\n");

        // set MIO48=1 to use eMMC memory on TE0729 PCB
        XGpioPs Gpio;
        XGpioPs_Config *GPIOConfigPtr;

        //GPIO Initilization
        GPIOConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
        Status = XGpioPs_CfgInitialize(&Gpio, GPIOConfigPtr, GPIOConfigPtr->BaseAddr);
        if (Status != XST_SUCCESS) {
                return XST_FAILURE;
        }

        const int sel_sd_pin = 48;
        XGpioPs_SetDirectionPin(&Gpio, sel_sd_pin, 1);
        XGpioPs_SetOutputEnablePin(&Gpio, sel_sd_pin, 1);
        XGpioPs_WritePin(&Gpio, sel_sd_pin, 0x1);

        return (Status);
}


After petalinux-build and booting u-boot the SEL_SD pin was high and mmcinfo shows eMMC info:


Device: sdhci@e0100000
Manufacturer ID: fe
OEM: 14e
Name: MMC04
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.4.1
High Capacity: Yes
Capacity: 3.5 GiB
Bus Width: 4-bit
Erase Group Size: 512 KiB
HC WP Group Size: 4 MiB
User Capacity: 3.5 GiB
Boot Capacity: 16 MiB ENH
RPMB Capacity: 128 KiB ENH