This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3351: GPIO pins fail with XIP in boot sequence

Part Number: AM3351

Good afternoon,

I'm using a custom AM3351 board with MMC0 SD card boot, and was originally using the boot sequence

MMC0 -> SPI0 -> UART0 -> USB0

I've seen changed my boot sequence as it sometimes failed to boot from MMC0 and would hang on USB0. My new boot sequence is XIP [MUX MODE2] -> UART0 -> EMAC1 -> MMC0. However, with the new boot sequence I'm not able to use GPIO2[22] and GPIO2[23]. It appears that the XIP boot is perhaps re-assigning these pins so that I'm no long able to toggle them as gpio-leds. I know that there is some overlap between these GPIO and XIP pins. I'm very much confused because in my device tree I'm setting them as outputs, active high, and enabled, but they are output low after boot. If I change the boot sequence to remove XIP boot, then it works perfectly.

Please let me know if you have any suggestions.

In my device tree

leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&usb_hub_pins>;
reset_led {
label = "hub_reset";
gpios = <&gpio2 24 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
heartbeat_led {
label = "heartbeat";
gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
default-state = "on";
};
audio_codec_enable {
label = "audio_codec_enable";
gpios = <&gpio2 16 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
audio_amp_enable {
label = "audio_amp_enable";
gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
default-state = "off";
};
audio_gain_0 {
label = "audio_gain_0";
gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
audio_gain_1 {
label = "audio_gain_1";
gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
fan_enable {
label = "fan_enable";
gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
battery_charge_enable {
label = "battery_charge_enable";
gpios = <&gpio2 22 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
battery_backup_enable {
label = "battery_backup_enable";
gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
default-state = "off";
};

};

gpio_pins: gpio_pins {
pinctrl-single,pins = <
0x88 ( PIN_INPUT | MUX_MODE7 ) /* (U17) gpmc_csn3.gpio2[0] */
0x8c ( PIN_INPUT | MUX_MODE7 ) /* (V16) gpmc_clk.gpio2[1] */
0x90 ( PIN_INPUT | MUX_MODE7 ) /* (V10) gpmc_advn_ale.gpio2[2] */
0x94 ( PIN_INPUT | MUX_MODE7 ) /* (W9) gpmc_oen_ren.gpio2[3] */
0x98 ( PIN_INPUT | MUX_MODE7 ) /* (U8) gpmc_wen.gpio2[4] */
0x9c ( PIN_INPUT | MUX_MODE7 ) /* (V8) gpmc_be0n_cle.gpio2[5] */
0xa0 ( PIN_INPUT | MUX_MODE7 ) /* (U1) lcd_data0.gpio2[6] */
0xa4 ( PIN_INPUT | MUX_MODE7 ) /* (U2) lcd_data1.gpio2[7] */
0xa8 ( PIN_INPUT | MUX_MODE7 ) /* (V1) lcd_data2.gpio2[8] */
0xac ( PIN_INPUT | MUX_MODE7 ) /* (V2) lcd_data3.gpio2[9] */
0xb0 ( PIN_INPUT | MUX_MODE7 ) /* (W2) lcd_data4.gpio2[10] */
0xb4 ( PIN_INPUT | MUX_MODE7 ) /* (W3) lcd_data5.gpio2[11] */
0xb8 ( PIN_INPUT | MUX_MODE7 ) /* (V3) lcd_data6.gpio2[12] */
0xbc ( PIN_INPUT | MUX_MODE7 ) /* (U3) lcd_data7.gpio2[13] */
0xc0 ( PIN_INPUT | MUX_MODE7 ) /* (V4) lcd_data8.gpio2[14] */
0xc4 ( PIN_INPUT | MUX_MODE7 ) /* (W4) lcd_data9.gpio2[15] */
0xc8 ( PIN_INPUT | MUX_MODE7 ) /* (U5) lcd_data10.gpio2[16] */
0xcc ( PIN_INPUT | MUX_MODE7 ) /* (V5) lcd_data11.gpio2[17] */
0x138 ( PIN_INPUT | MUX_MODE7 ) /* (N16) gmii1_rxd2.gpio2[19] */
0x13c ( PIN_INPUT | MUX_MODE7 ) /* (P19) gmii1_rxd1.gpio2[20] */
0xe0 ( PIN_OUTPUT | MUX_MODE7 ) /* (U7) lcd_vsync.gpio2[22] */
0xe4 ( PIN_OUTPUT | MUX_MODE7 ) /* (T7) lcd_hsync.gpio2[23] */
0xec ( PIN_INPUT | MUX_MODE7 ) /* (W7) lcd_ac_bias_en.gpio2[25] */
>;
};

  • Yes, these pins are reconfigured for XIP boot by the ROM code. What you can do is configure them for GPIO early in the SPL stage of U-boot.
  • Thanks for the quick reply. Will it not be sufficient to define these as outputs in my device tree?

    Also is there any way that we can make this change from Linux userspace?

    Do you have an examples of how to make the change in SPL code or userspace?

  • Hello Chris,

    Please, check this thread.

    Best regards,
    Kemal

  • Thanks Kemal and Biser for your reply.

    I tried explicitly setting the mux mode to 7 but it appears to be overwritten. It shows that it changed to 0xF but when I read it again, it returns to 0x9. Is there somewhere that I need to disable XIP? Any ideas why I'm not able to set this register?

    root@am335x-evm:~# devmem2 0x44E108E0
    /dev/mem opened.
    Memory mapped at address 0xb6f97000.
    Read at address 0x44E108E0 (0xb6f978e0): 0x00000009

    root@am335x-evm:~# devmem2 0x44E108E0 w 0x0000000F
    /dev/mem opened.
    Memory mapped at address 0xb6f0b000.
    Read at address 0x44E108E0 (0xb6f0b8e0): 0x00000009
    Write at address 0x44E108E0 (0xb6f0b8e0): 0x0000000F, readback 0x0000000F

    root@am335x-evm:~# devmem2 0x44E108E0
    /dev/mem opened.
    Memory mapped at address 0xb6f8a000.
    Read at address 0x44E108E0 (0xb6f8a8e0): 0x00000009
  • We are booting from DDR memory on MMC0. We are using boot sequence setup SYSBOOT[4:0] 11010. The device sequence is XIP[MUX2] (LCD), UART0, SPI0, MMC0. We have found that there are a couple of I/Os that don't seem to be set up correctly by the device tree after boot. We have a suspicion that the issue may be due to the set up of boot devices, expressly the XIP. The pins that don't seem to configure correctly for our application are LCD_VSYNC and LCD_HSYNC in XIP boot mode. We're suspicious that we may need to configure the pin mux for those pins, and/or disable the LCD module and re-configure those pins for them to work properly in our system. Does anyone have experience in issues like this? Thanks for any help.

  • I was able to successfully set the pinmux in U-boot code. It wouldn't work using the device tree or devmem2 command in Linux userspace. Any ideas why it needs to be set in U-boot in this case?

    Thanks,

    Chris