# How to enable eMMC on CCiMX6UL SBC Pro?

**URL:** <https://forums.digi.com/t/how-to-enable-emmc-on-ccimx6ul-sbc-pro/19055>\
**Category:** Linux\
**Tags:** gpio, cc6ul-sbc, ccimx6ulsbc, emmc\
**Created:** [January 24, 2018, 3:24pm UTC](https://forums.digi.com/t/how-to-enable-emmc-on-ccimx6ul-sbc-pro/19055 "2018-01-24T15:24:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reimu344](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@reimu344](https://forums.digi.com/u/reimu344)\
**Post date:** [January 24, 2018, 3:24pm UTC](https://forums.digi.com/t/how-to-enable-emmc-on-ccimx6ul-sbc-pro/19055/1 "2018-01-24T15:24:16Z")

</div>

I have a ConnectCore iMX6UL SBC Pro board, but I don’t know how to enable the onboard eMMC.

I’m using the default `imx6ul-ccimx6ulsbc.dtsi’ device tree file.

According to the docs, there’s a GPIO for switching between eMMC and microSD card. And it defaults to GPIO5\_IO01 on the SBC Pro. And then the pin in Linux is (5-1)\*32+1 = 129.

Then I tried to export the gpio 129 via the sysfs interface by running `echo 129 &gt; /sys/class/gpio/export', but it says `Device or resource busy’.

What’s more, these lines in the file `/sys/kernel/debug/gpio’ says that gpio 129 is occupied by a unknown driver:  
GPIOs 128-159, platform/20ac000.gpio, 20ac000.gpio:  
gpio-129 (? ) out lo

I booted the kernel with the `init=/bin/ash’ to avoid any userspace programs that are started on boot to occupy this gpio. But it’s still occupied.

So how can I enable the eMMC on this board?

---

<div class="post-metadata">

**Author:** ![LeonidM](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@LeonidM](https://forums.digi.com/u/LeonidM)\
**Post date:** [January 31, 2018, 7:54am UTC](https://forums.digi.com/t/how-to-enable-emmc-on-ccimx6ul-sbc-pro/19055/2 "2018-01-31T07:54:52Z")

</div>

I assume you are trying to use eMMC on cc6ul SBC. Are you aware that it conflicts with uSD which has to be disabled in both U-boot and device tree ? Is this what you are doing? We are not officially supporting this but someone has tried it here and it work. I can provide his procedure on an "as is " basis if you’d like.  
Enable eMMC on CC6UL SBC Pro  
For someone who needs to expand storage size for application, data, logfile or audio/visual images on CC6UL SBC Pro.  
This case provides you one example how to expand rootFS area in eMMC, based on DEY-2.0r4.

Step-by-step  
Follow the steps to enable eMMC and configure partition, format and install firmware.

1. 

```
 Build custom uboot image

```

2. 

```
 Bring up CC6UL SBC Pro with pre-built image

```

3. 

```
 Program new custom uboot image

```

4. 

```
 Create partition and format eMMC

```

uSD and eMMC use same SDIO channel, then after enabling eMMC, uSD slot can NOT be used.

Build custom uboot image  
uSD is enabled as default of DEY.  
GPIO5\_01 signal controls to select either SDIO control signals.  
Signal Name State Device  
GPIO5\_01 Low uSD  
GPIO5\_01 High eMMC

You find the source of CC6UL SBC initialization code.  
ls (your yocto project parent directory)/tmp/work/ccimx6ulsbc-dey-linux-gnueabi/u-boot-dey/2015.04-r0/git/board/digi/ccimx6ulsbc/ccimx6ulsbc.c  
Edit the code to assert GPIO5\_01 (high) in board\_mmc\_init routine.  
int board\_mmc\_init(bd\_t \*bis)  
{  
int i, ret;

/\*

- According to the board\_mmc\_init() the following map is done:
- (U-boot device node) (Physical Port)
- mmc0 USDHC2  
\*/

gpio\_set\_value(IMX\_GPIO\_NR(5,1), 1);  
gpio\_direction\_output(IMX\_GPIO\_NR(5,2), 1);

for (i = 0; i \< CONFIG\_SYS\_FSL\_USDHC\_NUM; i++) {  
swtich(i) {…

You also find the source of CC6UL SBC Pro device tree file.  
ls (your yocto project parent directory)/tmp/work-shared-ccimx6ulsbc/kernel-source/arch/arm/boot/dts/imx6ul-ccimx6ulsbc-id135.dts  
Edit the dts file. Find usdhc2 section and edit as below.  
/\* USDHC2 (microSD, conflicts with eMMC) _/  
//&usdhc2 {  
// pinctrl-assert-gpios = \<&gpio5 1 GPIO\_ACTIVE\_LOW\>;  
// broken-cd; /_ no carrier detect line (use polling) \*/  
// status = “okay”;  
//};

/\* USDHC2 (eMMC, conflicts with microSD) _/  
&usdhc2  
{  
pinctrl-assert-gpios =\<&gpio5 1 GPIO\_ACTIVE\_HIGH\>;  
non-removable;  
// /_  
// \* Comment these two lines for 4-bit data bus or leave uncommented  
// \* for 8-bit data bus  
// \*/  
pinctrl-0= \<&pinctrl\_usdhc2\_8databits\>;  
bus-width= \<8\>;  
status= “okay”;  
};

Then compile u-boot and linux firstly and build images.

bitbake -c compile -f u-boot-dey  
bitbake -c compile -f linux-dey  
bitbake -c deploy linux-dey  
bitbake dey-image-qt

Bring up CC6UL SBC Pro with pre-built image  
Program CC6UL SBC Pro with pre-built image, which is available on Digi CC6UL SBC Pro support page.  
[https://www.digi.com/products/embedded-systems/system-on-modules/connectcore-for-i-mx6ul#productsupport](https://www.digi.com/products/embedded-systems/system-on-modules/connectcore-for-i-mx6ul#productsupport)  
Now uSD is available.

Program new custom uboot image  
Copy new custom uboot image into uSD card.  
Insert uSD card into the slot on CC6UL SBC Pro.  
Program uboot using “update” command into NAND flash on CC6UL module.  
After completion of program, uSD card must be removed ( to prevent from conflict of SDIO communication. )  
uSD and eMMC use same SDIO channel, then after enabling eMMC, uSD slot can NOT be used.

Push Reset buttom or apply power cycle.  
Stop auto-boot and prompt with “=\>” is displayed.  
Confirm eMMC device and size by “mmcinfo” command.

Create partition and format eMMC  
Push Reset buttom or apply power cycle to reboot system.  
Use “fdisk” command to create parition in eMMC.

1. fdisk /dev/mmcblk1  
After creating partition, format each partition by mkfs commands.
2. mkfs.vfat -F 32 /dev/mmcblk1p1
3. mkfs.ext4 /dev/mmcblk1p2  
If your firmware image has no “mkfs.ext4” command, rebuild firmware with following option in local.conf file.  
IMAGE\_INSTALL\_append = " e2fsprogs-mke2fs"

After fomatting, you can find expanded strage area in eMMC.  
Confirm the size by “df” command.
