Changing Location of SD card detect pin [SOLVED]

Moderators: Oren.R, Eran.M

schluecj
Posts: 9
Joined: Fri Sep 16, 2016 6:47 pm

Changing Location of SD card detect pin [SOLVED]

Postby schluecj » Mon Aug 21, 2017 1:26 pm

I am working on a project that is using the Variscite i.MX 6 dual SOM and have a need to move the SD card detect pin from the current position of GPIO4[1]4 to GPIO1[09] because I need to use the second can Tx. I am having some difficulties getting the system to boot from the SD card and I am hoping someone can see what step I am missing and let me know what else I need to change to get this to work.

Currently the system starts and makes it through u-boot to starting the kernel. The system then gives a kernel panic indicating
VFS: Cannot open root device "mmcblk1p2" or unknown-block(179,34): error -30
Please append a correct "root=" boot option; here are the available partitions:
0100 65536 ram0 (driver?)
0101 65536 ram1 (driver?)
0102 65536 ram2 (driver?)
0103 65536 ram3 (driver?)
0104 65536 ram4 (driver?)
0105 65536 ram5 (driver?)
0106 65536 ram6 (driver?)
0107 65536 ram7 (driver?)
0108 65536 ram8 (driver?)
0109 65536 ram9 (driver?)
010a 65536 ram10 (driver?)
010b 65536 ram11 (driver?)
010c 65536 ram12 (driver?)
010d 65536 ram13 (driver?)
010e 65536 ram14 (driver?)
010f 65536 ram15 (driver?)
1f00 2048 mtdblock0 (driver?)
1f01 2048 mtdblock1 (driver?)
1f02 8192 mtdblock2 (driver?)
1f03 512000 mtdblock3 (driver?)
b300 7634944 mmcblk0 driver: mmcblk
b318 512 mmcblk0rpmb (driver?)
b310 4096 mmcblk0boot1 (driver?)
b308 4096 mmcblk0boot0 (driver?)
b320 7761920 mmcblk1 driver: mmcblk
b321 8192 mmcblk1p1 0276633a-01
b322 2150400 mmcblk1p2 0276633a-02
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,34)


Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw video=mxcfb0:dev=ldb video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off

The u-boot version is from varascite (git://github.com/varigit/uboot-imx.git)
SRCBRANCH= "imx_v2015.04_4.1.15_1.1.0_ga_var01"
SRCREV = "f8b449392656231021897a67bdce689985e608c1"

The kernel being used is the Krogoth-imx-4.1.15-var01 (git://github.com/varigit/linux-2.6-imx.git)
SRCBRANCH="imx-rel_imx_4.1.15_2.0.0_ga-var01"
SRCREV = "bc0cd16ca18f305b8ebae955aa5d87ef38463dfd"

The following is what I have currently done.

1. Modified u-boot to use the new card detect pin. Prior to this modification u-boot would indicate that there was no card present.

Code: Select all

--- a/board/variscite/mx6var_som/mx6var_som.c
+++ b/board/variscite/mx6var_som/mx6var_som.c
@@ -474,7 +474,7 @@ static iomux_v3_cfg_t const usdhc2_cd_pad[][1*2] = {
    },
    {
       /* Non-DART */
-      IOMUX_PADS(PAD_KEY_COL4__GPIO4_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+      IOMUX_PADS(PAD_GPIO_9__GPIO_IO09 | MUX_PAD_CTRL(NO_PAD_CTRL)),
    }
 };
 
@@ -540,7 +540,7 @@ static int usdhc2_cd_gpio[] = {
    /* DART */
    IMX_GPIO_NR(1, 6),
    /* Non-DART */
-   IMX_GPIO_NR(4, 14)
+   IMX_GPIO_NR(1, 9)
 };
 
 int board_mmc_getcd(struct mmc *mmc)



2. Modified the device tree to change the card detect location. Prior to this change the system would stop at the message Waiting for root device /dev/mmcblk1p2

Code: Select all

--- a/arch/arm/boot/dts/imx6qdl-var-som.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-var-som.dtsi
@@ -324,7 +324,7 @@
             /* for Bluetooth/wifi enable */
             MX6QDL_PAD_SD3_DAT6__GPIO6_IO18      0x1b0b1
             /* SDMMC2 CD/WP */
-            MX6QDL_PAD_KEY_COL4__GPIO4_IO14      0x80000000
+            MX6QDL_PAD_GPIO9__GPIO1_IO09      0x80000000
             MX6QDL_PAD_KEY_ROW4__GPIO4_IO15      0x80000000
             /* USBOTG ID pin */
             /*MX6QDL_PAD_GPIO_4__GPIO1_IO04      0x80000000*/
@@ -740,7 +740,7 @@
 &usdhc2 {   /* uSDHC2, MMC/SD card */
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_usdhc2_2>;
-   cd-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>;
+   cd-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
    wp-gpios = <&gpio4 15 GPIO_ACTIVE_HIGH>;
    no-1-8-v;
    keep-power-in-suspend;


My issue appears related to this change because if I hold GPIO4[14] to ground while booting the system boots with no issues.

I believe my issue is on the kernel side and not in u-boot but I am not sure at this point so any direction as to where to look would be fantastic.

Thanks
- John

Eran.M
Posts: 140
Joined: Tue Jan 26, 2016 10:49 am

Re: Changing Location of SD card detect pin

Postby Eran.M » Mon Aug 21, 2017 3:13 pm

Hi John.
You have a typo in the device tree:
MX6QDL_PAD_GPIO9__GPIO1_IO09
should be:
MX6QDL_PAD_GPIO_9__GPIO1_IO09

Regards,
Eran

schluecj
Posts: 9
Joined: Fri Sep 16, 2016 6:47 pm

Re: Changing Location of SD card detect pin

Postby schluecj » Mon Aug 21, 2017 3:56 pm

Thanks for pointing that out. I had to fix that to get the compile to work properly as well, just neglected to update the patch that I copied from for the post. Even with that correction I am unable to get the system to startup, the same issues as described in the original post are present.

- John

varigigi
Posts: 52
Joined: Tue Nov 01, 2016 10:25 am

Re: Changing Location of SD card detect pin

Postby varigigi » Mon Aug 21, 2017 7:36 pm

Hi John,
could you please confirm with a probe that your card-detect (GPIO1_IO09) signal is low when you insert the card in the slot?
Could you please share a full boot log from uboot to kernel?

Thanks
BR
Pier

schluecj
Posts: 9
Joined: Fri Sep 16, 2016 6:47 pm

Re: Changing Location of SD card detect pin

Postby schluecj » Mon Aug 21, 2017 8:04 pm

Thanks for the help.

I have confirmed at the SOM header the card detect pin (GPIO1_IO09 / Pin 68) is low when the SD card is present and high when the SD card is not present. I am attaching the current boot log.
Attachments
BootSequenceFull_KernelPanic.log
(17.72 KiB) Downloaded 245 times

Eran.M
Posts: 140
Joined: Tue Jan 26, 2016 10:49 am

Re: Changing Location of SD card detect pin

Postby Eran.M » Mon Aug 21, 2017 8:18 pm

Please also attach a full diff between your device tree files and the ones from our git.

varigigi
Posts: 52
Joined: Tue Nov 01, 2016 10:25 am

Re: Changing Location of SD card detect pin

Postby varigigi » Mon Aug 21, 2017 8:31 pm

Hi John,
according your boot log, the SD card is correctly recognized and the partitions are available.
Around line 284 I can see:
mmcblk1: mmc1:aaaa SL08G 7.40 GiB (ro)
mmcblk1: p1 p2

Strangely, the SD seem to be ReadOnly "(ro)" and mmcblk1p2 is not recognized as a mountable rootfs.

For a comparison, could you please share the full bootlog holding GPIO4[14] to ground while booting.

Thanks
BR
Pier

schluecj
Posts: 9
Joined: Fri Sep 16, 2016 6:47 pm

Re: Changing Location of SD card detect pin

Postby schluecj » Mon Aug 21, 2017 8:32 pm

The file 0001-Changes-to-suport-FA-carrier-board-in-uboot.patch is the only one currently being applied to the uboot source.

The file 001-krogroth-display-touchscree-support.patch and 002-Changes-for-moving-the-location-of-the-SD-Card.patch are the two patches being applied to the linux source.
Attachments
002-Changes-for-moving-the-location-of-the-SD-Card.txt
(722 Bytes) Downloaded 257 times
0001-Changes-to-support-FA-carrier-board-in-uboot.txt
(530 Bytes) Downloaded 259 times
001-krogoth-display-touchscreen-support.txt
(1.42 KiB) Downloaded 268 times

Eran.M
Posts: 140
Joined: Tue Jan 26, 2016 10:49 am

Re: Changing Location of SD card detect pin

Postby Eran.M » Mon Aug 21, 2017 8:39 pm

You wrote that you've used gpio4_14 for can2 tx - I don't see that in the files you've attached.
What about gpio4_15 which is used for SD card write protect? Did you by any chance use it also for can2 rx?

schluecj
Posts: 9
Joined: Fri Sep 16, 2016 6:47 pm

Re: Changing Location of SD card detect pin

Postby schluecj » Mon Aug 21, 2017 8:49 pm

Log from a successful boot with the old card detect pin grounded.

In regards to the use of the two pins for CAN Tx/Rx, the intention is to use both those pins GPIO4-14 & 15 for that purpose. At the moment I am trying to take small steps in getting the board configured so I have not even attempted to get the CAN working, I was just trying to get a successful boot from the SD card. The pins are connected currently to the corresponding Tx and Rx pins on a SN65HVD232 (3.3V Can Transceiver) so when I am grounding GPIO14 I am also grounding out the Tx line of that chip.
Attachments
BootSequence_GPIO4_14_grounded.log
(20.97 KiB) Downloaded 245 times


Return to “Yocto”

Who is online

Users browsing this forum: No registered users and 3 guests