imx6ul Repurpose TAMPERx as GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6ul Repurpose TAMPERx as GPIO

1,920 Views
ryanshuttlewort
Contributor IV

Hello all.

I have been trying to reuse the imx6ul TAMPERx lines as GPIO but have been unsuccessful.  I am able to reconfigure other pads as GPIOs and leds without issue.  I am new to this so I am likely missing something...

For example I can do the following crude experiment:

pinctrl_hog_1: hoggrp-1 {

      fsl,pins = <

        MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY    0x30b0

        MX6UL_PAD_UART1_RTS_B__GPIO1_IO19 0x17059 /* SD1 CD */

        MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT  0x17059 /* SD1 VSELECT */

        MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059 /* SD1 RESET */

        MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00      0x17059

        MX6UL_PAD_LCD_DATA00__GPIO3_IO05        0x17059

      >;

    };

After the above device tree entry I can then manipulate GPIO3_IO5 via the file system with 'echo "1|0" > /sys/class/gpio/gpio69/value' but not 'echo "1|0" > /sys/class/gpio/gpio128/value' etc.  I have tried this will the other TAMPER lines as well.

I have also tried leds:

pinctrl_gpio_leds: gpio_leds {

    fsl,pins = <

        MX6UL_PAD_LCD_DATA01__GPIO3_IO06        0x17059

        MX6UL_PAD_LCD_DATA02__GPIO3_IO07        0x17059

        MX6UL_PAD_LCD_DATA03__GPIO3_IO08        0x17059

    >;

};

leds {

    compatible = "gpio-leds";

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_gpio_leds>;

    led0: led0 {

        label = "myled0";

        gpios = <&gpio3 6 GPIO_ACTIVE_HIGH>;

        default-state = "off";

    };

    led1: led1 {

        label = "myled1";

        gpios = <&gpio3 7 GPIO_ACTIVE_HIGH>;

        default-state = "off";

    };

    led2: led2 {

        label = "myled2";

        gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>;

        default-state = "off";

    };

};

The above device tree entry works, but replacing the gpios with appropriate TAMPER entries fails.

I have examined the TAMPER_PIN_DISABLE fuses via u-boot and it appears that the TAMPER lines should be usable as GPIOs:

=> fuse read 0 3

Reading bank 0:

Word 0x00000003: 7031000c

0x7031000c => '0b111 0000 0011 0001 0000 0000 0000 1100"

From another forum comment:

"Definition of TAMPER_PIN_DISABLE[1:0] are as following :

        00 - enabled, TAMPER0-9 used as TAMPER detection pins.

        01 - disabled TAMPER2-4 and TAMPER7-9 used as GPIO.

        10 - disabled TAMPER0-1 and TAMPER5-6 used as GPIO.

        11 - disabled TAMPER0-9 used as GPIO.

   So, for the mentioned U-boot command, If bit [21:20] is 11, then all the ten tamper pins are programmed to GPIO mode."

Any suggestions as to what I am doing wrong?

Thanks.

Labels (3)
0 Kudos
4 Replies

648 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ryan

could you try other ways to use these pins as gpios, like

toggle them from uboot or linux with memtool.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

648 Views
ryanshuttlewort
Contributor IV

Hello Igor, thanks for the reply.

I have had some success with GPIO in that I found conflicting assignments to the TAMPER pins in the device tree that were preventing the pins from being exported but I still have a couple of stubborn tamper pins that I can't manipulate through sysfs.  I have had no success at all with the tamper pins and the device-tree led declaration though I am able to create leds with other pins like the LCD data lines.

I am able to manipulate the tamper lines by direct manipulation of the registers as you suggested.  Both form u-boot and Linux via the devmem2 utility so the issue is due to software, not fuses etc.

0 Kudos

648 Views
ihermida
Contributor II

Hi,

I am having the same issue. I am trying to set all the tamper as GPIOs without success.

Reading the fuse settings seems to be correct to set it as GPIO assuming that the fuse bank is (0 3).

=> fuse read 0 3

Word 0x00000003: 703100d1

But I can not change the IOMUX to set them as gpios (ALT5).

=> mw.l 0x20e001c 0x5 1

=> mw.l 0x20e0020 0x5 9

=>

=> md.l 0x20e001c 1                              ----------------- TAMPER 0

020e001c: 00000000                               ....

=> md.l 0x20e0020 9                             ------------------ TAMPER 1 to 9

020e0020: 00000000 00000000 00000000 00000000    ................

020e0030: 00000000 00000000 00000000 00000000    ................

020e0040: 00000000

My explanation for that is that the fuse that we are reading is incorrect and should not be (0 3), if not I do not know what I am doing wrong. The HRM says that the fuse address is "0x430[21:20]", page 214.

tamper_pins.png

Can anyone point me to how set all the tamper pins as gpios?

0 Kudos

648 Views
ihermida
Contributor II

Solved. There is no need to configure the IOMUX if the TAMPER_PIN_DISABLE[1:0] fuse is programmed, so you can use them directly as gpios.

For instance, in uboot modify the GPIO5_DR (0x20ac000) and the GPIO5_GDIR(0x20ac004) to play with the data and direction. In that case we use the GPIO5 pins 0 and 9 (10 0000 0001 = 201)

"""

=> md.l 20ac004 1

020ac004: 00000000                               ....

=> mw.l 20ac004 201

=> md.l 20ac004 1

020ac004: 00000201                               ....

=> md.l 20ac000 1

020ac000: 00000818                               ....

=> mw.l 20ac000 201

=> md.l 20ac000 1

020ac000: 00000a19                               ....

=> mw.l 20ac000 0

=> md.l 20ac000 1

020ac000: 00000818                               ....

"""

And in linux just use the gpio sysfs to export and set that gpio

0 Kudos