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.

Looking for help adding a GPIO to custom AM335x board

I thought this would be easy, but after 8 hours of work I still cannot use add a gpio and then use sysfs to control it.

There are existing GPIOs that I can control with sysfs via /sys/class/gpio so I know that I have that part of the process right, but there are some others that are not available, or do not respond.

Background:  I have a custom AM553x (4) board that has a customization of sdk v 7.0 on it.  We then have a distro of Angstrom on top of that.   I want to add control of GPIO0_28 and GPIO3_10.   So at first I thought I could just add these as new nodes in the dts file, as sub nodes under the am33xx_pinmux

		control_default: pinmux_control_default {
			pinctrl-single,pins = <
				0x1A8 (PIN_OUTPUT | MUX_MODE7)	    /* boot 0*/
				0x70 (PIN_OUTPUT | MUX_MODE7)	    /* SELF POWER ON*/
			>;
		};

I compile the dts file and load it on the processor.   I can echo106 > /sys/class/gpio/export, and drive the port high (according to the readback), however the actual pin does not change.   This is no different from what happens when I don't have those lines present in the device tree. What am I missing here?

I have tried many things, most of which just cause the board to fail booting.   Any help is much appreciated.   

  • Hi,

    I will forward this to the SW team.

  • Hi,

    Have you checked if there are no address conflicts for 0x1A8 and  0x70 with other pins in your dts files?

    BR,
    Georgi

  • I do not see any conflicts.   I am using the standard am33xx.dtsi plus my own version which I have pasted below:

    You may see that I was formerly trying to output to pin 100  (0x190) ,  pin 106 (0x1A8) is easier for me to probe but shows the same problem so I switched to that pin temporarily.  Also you will see that I left in some of the things I tried without success surrounded by comments or #if 0. 

    /*
     * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    
    /*
     * AM335x Starter Kit
     * www.ti.com/.../tmdssk3358
     */
    
    /dts-v1/;
    
    #include "am33xx.dtsi"
    #include <dt-bindings/pwm/pwm.h>
    
    / {
    	model = "TI AM335x KV1";
    	compatible = "ti,am335x-evmsk", "ti,am33xx";
    
    	cpus {
    		cpu@0 {
    			cpu0-supply = <&vcc_reg>;
    		};
    	};
    
    	memory {
    		device_type = "memory";
    		reg = <0x80000000 0x08000000>; /* 128 MB */
    	};
    
    	am33xx_pinmux: pinmux@44e10800 {
    		pinctrl-names = "default";
    
    		lcd_pins_default: lcd_pins_default {
    			pinctrl-single,pins = <
    				0x20 0x01	/* gpmc_ad8.lcd_data23, OUTPUT | MODE1 */
    				0x24 0x01	/* gpmc_ad9.lcd_data22, OUTPUT | MODE1 */
    				0x28 0x01	/* gpmc_ad10.lcd_data21, OUTPUT | MODE1 */
    				0x2c 0x01	/* gpmc_ad11.lcd_data20, OUTPUT | MODE1 */
    				0x30 0x01	/* gpmc_ad12.lcd_data19, OUTPUT | MODE1 */
    				0x34 0x01	/* gpmc_ad13.lcd_data18, OUTPUT | MODE1 */
    				0x38 0x01	/* gpmc_ad14.lcd_data17, OUTPUT | MODE1 */
    				0x3c 0x01	/* gpmc_ad15.lcd_data16, OUTPUT | MODE1 */
    				0xa0 0x00	/* lcd_data0.lcd_data0, OUTPUT | MODE0 */
    				0xa4 0x00	/* lcd_data1.lcd_data1, OUTPUT | MODE0 */
    				0xa8 0x00	/* lcd_data2.lcd_data2, OUTPUT | MODE0 */
    				0xac 0x00	/* lcd_data3.lcd_data3, OUTPUT | MODE0 */
    				0xb0 0x00	/* lcd_data4.lcd_data4, OUTPUT | MODE0 */
    				0xb4 0x00	/* lcd_data5.lcd_data5, OUTPUT | MODE0 */
    				0xb8 0x00	/* lcd_data6.lcd_data6, OUTPUT | MODE0 */
    				0xbc 0x00	/* lcd_data7.lcd_data7, OUTPUT | MODE0 */
    				0xc0 0x00	/* lcd_data8.lcd_data8, OUTPUT | MODE0 */
    				0xc4 0x00	/* lcd_data9.lcd_data9, OUTPUT | MODE0 */
    				0xc8 0x00	/* lcd_data10.lcd_data10, OUTPUT | MODE0 */
    				0xcc 0x00	/* lcd_data11.lcd_data11, OUTPUT | MODE0 */
    				0xd0 0x00	/* lcd_data12.lcd_data12, OUTPUT | MODE0 */
    				0xd4 0x00	/* lcd_data13.lcd_data13, OUTPUT | MODE0 */
    				0xd8 0x00	/* lcd_data14.lcd_data14, OUTPUT | MODE0 */
    				0xdc 0x00	/* lcd_data15.lcd_data15, OUTPUT | MODE0 */
    				0xe0 0x00	/* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
    				0xe4 0x00	/* lcd_hsync.lcd_hsync, OUTPUT | MODE0 */
    				0xe8 0x00	/* lcd_pclk.lcd_pclk, OUTPUT | MODE0 */
    				0xec 0x00	/* lcd_ac_bias_en.lcd_ac_bias_en, OUTPUT | MODE0 */
    			>;
    		};
    
    		lcd_pins_sleep: lcd_pins_sleep {
    			pinctrl-single,pins = <
    				0x20 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad8.lcd_data23 */
    				0x24 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad9.lcd_data22 */
    				0x28 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad10.lcd_data21 */
    				0x2c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad11.lcd_data20 */
    				0x30 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad12.lcd_data19 */
    				0x34 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad13.lcd_data18 */
    				0x38 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad14.lcd_data17 */
    				0x3c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad15.lcd_data16 */
    				0xa0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data0.lcd_data0 */
    				0xa4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data1.lcd_data1 */
    				0xa8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data2.lcd_data2 */
    				0xac (PULL_DISABLE | MUX_MODE7)		/* lcd_data3.lcd_data3 */
    				0xb0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data4.lcd_data4 */
    				0xb4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data5.lcd_data5 */
    				0xb8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data6.lcd_data6 */
    				0xbc (PULL_DISABLE | MUX_MODE7)		/* lcd_data7.lcd_data7 */
    				0xc0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data8.lcd_data8 */
    				0xc4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data9.lcd_data9 */
    				0xc8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data10.lcd_data10 */
    				0xcc (PULL_DISABLE | MUX_MODE7)		/* lcd_data11.lcd_data11 */
    				0xd0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data12.lcd_data12 */
    				0xd4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data13.lcd_data13 */
    				0xd8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data14.lcd_data14 */
    				0xdc (PULL_DISABLE | MUX_MODE7)		/* lcd_data15.lcd_data15 */
    				0xe0 (PULL_DISABLE | MUX_MODE7)	    /* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
    				0xe4 (PULL_DISABLE | MUX_MODE7)	    /* lcd_hsync.lcd_hsync */
    				0xe8 (PULL_DISABLE | MUX_MODE7)	    /* lcd_pclk.lcd_pclk */
    				0xec (PULL_DISABLE | MUX_MODE7)	    /* lcd_ac_bias_en.lcd_ac_bias_en */
    			/* works	0x190 (PULL_DISABLE | MUX_MODE7)	    /* geoff's test - does this show up? */
    			>;
    
    		};
    
    		i2c0_pins: pinmux_i2c0_pins {
    			pinctrl-single,pins = <
    				0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
    				0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
    			>;
    		};
    
    		i2c1_pins: pinmux_i2c1_pins {
    			pinctrl-single,pins = <
    				0x180 (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_rxd,i2c1_sda */
    				0x184 (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_txd,i2c1_scl */
    			>;
    		};
    
    		i2c2_pins: pinmux_i2c2_pins {
    			pinctrl-single,pins = <
    				0x178 (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_ctsn,i2c2_sda */
    				0x17c (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_rtsn,i2c2_scl */
    			>;
    		};
    
            spi0_pins: pinmux_spi0_pins {
                pinctrl-single,pins = <
                    0x150 0x30	/* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
                    0x154 0x30	/* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
                    0x158 0x10	/* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
                    0x15c 0x10	/* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
                >;
            };
    
            spi1_pins: pinmux_spi1_pins {
    			pinctrl-single,pins = <
    				0x108 (PIN_INPUT_PULLUP | MUX_MODE2) /* gmii1_col,sp1_clk_mux1 */
    				0x10c (PIN_INPUT_PULLUP | MUX_MODE2)  /* gmii1_crs,spi1_d0_mux1 */
    				0x110 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* gmii1_rxer,spi1_d1_mux1 */
    				0x144 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* rmii1_refclk,spi1_cs0_mux1 */
    			>;
            };
    
            /* Console */
    		uart0_pins: pinmux_uart0_pins {
    			pinctrl-single,pins = <
    				0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
    				0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
    			>;
    		};
    
            /* Bluetooth */
    		uart3_pins: pinmux_uart3_pins {
    			pinctrl-single,pins = <
    				0x134 (PIN_INPUT_PULLUP | MUX_MODE1)	/* gmii1_rxd3.uart3_rxd */
    				0x138 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* gmii1_rxd2.uart3_txd */
    				0x148 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* mdio_data.uart3_ctsn */
    				0x14c (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* mdio_clk.uart3_rtsn */
    			>;
    		};
    
            /* KV2 comms */
    		uart4_pins: pinmux_uart4_pins {
    			pinctrl-single,pins = <
    				0x11c (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* gmii1_txd3.uart4_rxd */
    				0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gmii1_txd2.uart4_txd */
    			>;
    		};
    
    		clkout1_pin: pinmux_clkout1_pin {
    			pinctrl-single,pins = <
    				0x1b0 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)		/* xdma_event_intr0.clkout1 */
    			>;
    		};
    
    		clkout2_pin: pinmux_clkout2_pin {
    			pinctrl-single,pins = <
    				0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)		/* xdma_event_intr1.clkout2 */
    			>;
    		};
    
            /* Backlight */
    		pwm_backlight_pins: backlight_pins {
    			pinctrl-single,pins = <
    				0x90 0x02	/* gpmc_advn_ale,timer4 (BKLT_PWM) */
    			>;
    		};
    
            /* SD card */
    		mmc1_pins_default: pinmux_mmc1_pins {
    			pinctrl-single,pins = <
    				0x0F0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat3.mmc0_dat3 */
    				0x0F4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat2.mmc0_dat2 */
    				0x0F8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat1.mmc0_dat1 */
    				0x0FC (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat0.mmc0_dat0 */
    				0x100 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_clk.mmc0_clk */
    				0x104 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_cmd.mmc0_cmd */
    			>;
    		};
    
    		mmc1_pins_sleep: pinmux_mmc1_pins_sleep {
    			pinctrl-single,pins = <
    				0x0F0 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x0F4 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x0F8 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x0FC (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x100 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x104 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    			>;
    		};
    
    		/* WL18xx WiFi */
    		mmc2_pins: pinmux_mmc2_pins {
    			pinctrl-single,pins = <
    				0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gmii1_txen.gpio3_3 (EN_WLAN) */
    				0x12c (PIN_INPUT | MUX_MODE7) /* gmii1_txclk.gpio3_9 (WL_INT) */
    				0x80 (PIN_INPUT | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
    				0x84 (PIN_INPUT | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
    				0x00 (PIN_INPUT | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
    				0x04 (PIN_INPUT | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
    				0x08 (PIN_INPUT | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
    				0x0c (PIN_INPUT | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
    			>;
    		};
    
    
    
    		kv2_control_default: pinmux_kv2_control_default {
    			pinctrl-single,pins = <
    				/*0x190 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0*/
    				0x1A8 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0*/
    				0x70 (PIN_OUTPUT | MUX_MODE7)	    /* KV1_SELF POWER ON (keeps battery power supplied even when KV2 is off*/
    				/*0x54 (PIN_INPUT | MUX_MODE7)	    /* KV1_WAKE*/
    			>;
    		};
    
    #if 0
    		kv2_control_sleep: pinmux_kv2_control_sleep {
    			pinctrl-single,pins = <
    				/*0x190 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0*/
    				0x1A8 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0*/
    				0x70 (PIN_OUTPUT | MUX_MODE7)	    /* KV1_SELF POWER ON (keeps battery power supplied even when KV2 is off*/
    				/*0x54 (PIN_INPUT | MUX_MODE7)	    /* KV1_WAKE*/
    			>;
    		};
    #endif
    
    	};
    
    	ocp {
    		uart0: serial@44e09000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&uart0_pins>;
    
    			status = "okay";
    		};
    
    		uart3: serial@481a6000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&uart3_pins>;
    
    			status = "okay";
    		};
    
    		uart4: serial@481a8000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&uart4_pins>;
    
    			status = "okay";
    		};
    
    		i2c0: i2c@44e0b000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&i2c0_pins>;
    
    			status = "okay";
    			clock-frequency = <400000>;
    
    			/* GT9137 Touchscreen */
    			goodix@14 {
    				compatible = "goodix,gt91xx";
    				status = "okay";
    
    				/* I2C client driver parameters */
    				reg = <0x14>;
    				interrupt-parent = <&gpio0>;
    				interrupts = <31>;
    
    				/* Goodix driver parameters */
    				interrupt-gpios = <&gpio0 31 0x00>;
    				reset-gpios = <&gpio2 0 0x00>;
    				goodix,product-id = "9137";
    				goodix,panel-coords = <0 0 480 800>;
    				goodix,display-coords = <0 0 480 800>;
    			};
    
    			/* CAT24C256 EEPROM */
    			eeprom@50 {
    				compatible = "at,24c256";
    				reg = <0x50>;
    			};
    		};
    
    		musb: usb@47400000 {
    			status = "okay";
    
    			control@44e10000 {
    				status = "okay";
    			};
    
    			usb-phy@47401300 {
    				status = "okay";
    			};
    
    			usb-phy@47401b00 {
    				status = "okay";
    			};
    
    			usb@47401000 {
    				status = "okay";
    			};
    
    			usb@47401800 {
    				status = "okay";
    				dr_mode = "host";
    			};
    
    			dma-controller@07402000  {
    				status = "okay";
    			};
    		};
    
    		spi1: spi@481a0000 {
    			status = "okay";
    			pinctrl-names = "default";
    			pinctrl-0 = <&spi1_pins>;
    			spi-display {
    				compatible = "kuvee,cordial-spi";
    				spi-max-frequency = <500000>;
    				reg = <0>; /* Chip select 0 */
    			};
    		};
    
    		lcdc: lcdc@0x4830e000 {
    			pinctrl-names = "default", "sleep";
    			pinctrl-0 = <&lcd_pins_default>;
    			pinctrl-1 = <&lcd_pins_sleep>;
    			status = "okay";
    			/* avoid stupid warning */
    			#address-cells = <1>;
    			#size-cells = <1>;
    			panel-info {
    				ac-bias           = <255>;
    				ac-bias-intrpt    = <0>;
    				dma-burst-sz      = <16>;
    				bpp               = <16>;
    				fdd               = <0x80>;
    				tft-alt-mode      = <0>;
    				stn-565-mode      = <0>;
    				mono-8bit-mode    = <0>;
    				sync-edge         = <0>;
    				sync-ctrl         = <1>;
    				raster-order      = <0>;
    				fifo-th           = <0>;
    			};
    			display-timings { /* Cordial CT040BLP32 */
    				480x800 {
    					hactive         = <480>;
    					vactive         = <800>;
    					hback-porch     = <5>;
    					hfront-porch    = <5>;
    					hsync-len       = <5>;
    					vback-porch     = <5>;
    					vfront-porch    = <5>;
    					vsync-len       = <5>;
    					clock-frequency = <16600000>;
    					hsync-active    = <0>;
    					vsync-active    = <0>;
    				};
    			};
    		};
    
    		wlcore {
    			compatible = "wlcore";
    			gpio = <&gpio3 9 0>; /* WL_INT */
    		};
    
    #if 0
    		kv2_control {
    		pinctrl-names = "default", "sleep";
    		pinctrl-0 = <&kv2_control_default>;
    		pinctrl-1 = <&kv2_control_sleep>;
    
    		compatible = "gpio-leds";
    
    		kv2@1 {
    			label = "boot0";
    			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
    			default-state = "off";
    		};
    
    		kv2@2 {
    			label = "self_power_on";
    			/*gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;*/
    			gpios = <&gpio3 10 GPIO_ACTIVE_HIGH>;
    			default-state = "off";
    		};
    
    		};
    #endif
    
    #if 0
    	gpio106: gpio106 {
    	      compatible = "ti,omap4-gpio";
    	      ti,hwmods = "gpio106";
    	      gpio-controller;
    	      #gpio-cells = <2>;
    	      interrupt-controller;
    	      #interrupt-cells = <2>;
    	  };	
    #endif		
    
    	};
    
    	vcc_reg: fixedregulator@0 {
    		compatible = "regulator-fixed";
    		regulator-name = "vcc";
    		regulator-min-microvolt = <1800000>;
    		regulator-max-microvolt = <1800000>;
    		regulator-boot-on;
    		regulator-always-on;
    	};
    
    	backlight {
    		compatible = "kv1-backlight";
    		brightness-levels = <0 1 2 3 4 5 6 7 8 9 10>;
    		default-brightness-level = <10>;
    	};
    };
    
    /* Ambient light sensor */
    &tscadc {
    	status = "okay";
    	adc {
    		ti,adc-channels = <0 1>;
    	};
    };
    
    &gpio0 {
    	ti,no-reset;
    };
    
    /* SD card */
    &mmc1 {
    	status = "okay";
    	bus-width = <4>;
    	pinctrl-names = "default", "sleep";
    	pinctrl-0 = <&mmc1_pins_default>;
    	pinctrl-1 = <&mmc1_pins_sleep>;
    };
    
    /* WL18xx WiFi */
    &mmc2 {
    	status = "okay";
    	ti,non-removable;
    	bus-width = <4>;
    	cap-power-off-card;
    	pinctrl-names = "default";
    	pinctrl-0 = <&mmc2_pins>;
    	ti,non-removable;
        ti,needs-special-hs-handling;
    };
    
    #if 0
    &am33xx_pinmux {
          pinctrl-names = "default";
          pinctrl-0 = <&kv2_control_default>;
          self_power: pinmux_test {
                pinctrl-single,pins = <
                      0x70 (PIN_OUTPUT | MUX_MODE7) /* lcd_data0.gpio2_6 */
                >;
          };
      };
    #endif

  • Still hoping to get some help with this. I've been playing with the new pinmux tool, and it clearly indicates what should be added to the dts file, but it does not tell how to add a node that uses those pins and makes them accessible at the external pins of the processor.
  • You want to add control of GPIO0_28 and GPIO3_10 and use 0x1A8 and 0x70 addresses.

    I verified it with PinMux tool, and it gives different addresses for these pins.

    To add control to gpio edit your device tree as follow:

    1. Add to

    am33xx_pinmux: pinmux@44e10800 {

    the following from pinmux devicetree:

    my_gpio_1_pins_default: my_gpio_1_pins_default {
    
    pinctrl-single,pins = <
    
    0x128 ( PIN_INPUT | MUX_MODE7 ) /* (K17) gmii1_txd0.gpio0[28] */
    
    >;
    
    };
    
    my_gpio_2_pins_default: my_gpio_2_pins_default {
    
    pinctrl-single,pins = <
    
    0x130 ( PIN_INPUT | MUX_MODE7 ) /* (L18) gmii1_rxclk.gpio3[10] */
    
    >;
    
    };

    2. in am335x-evm.dts in ocp {} place gpio nodes as add lines:

    gpio0: gpio@44e07000 {
    
    pinctrl-names = "default";
    
    pinctrl-0 = <&my_gpio_1_pins_default>;
    
    };
    
    gpio3: gpio@481ae000 {
    
    pinctrl-names = "default";
    
    pinctrl-0 = <&my_gpio_2_pins_default>;
    
    };

    Also refer to this thread:

    https://e2e.ti.com/support/arm/sitara_arm/f/791/t/347556

    BR,

    Georgi

  • Thanks much for the response Georgi.

    Your suggestion compiles and to me it looks correct.   However when I try to boot after doing this, the booting fails,  it just cycles the following to the console:

    U-Boot SPL 2014.10-rc2 (May 04 2015 - 14:34:33)
    CPU frequency: 800
    reading args
    spl_load_image_fat_os: error reading image args, err - -1
    reading u-boot.img
    reading u-boot.img
    
    
    U-Boot 2014.10-rc2 (May 04 2015 - 14:34:33)
    
           Watchdog enabled
    I2C:   ready
    DRAM:  128 MiB
    NAND:  0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Error - No Valid Environment Area found
    *** Warning - bad CRC, using default environment
    
    Net:   <ethaddr> not set. Validating first E-fuse MAC
    Phy not found
    cpsw, usb_ether
    Hit any key to stop autoboot:  0
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    reading uEnv.txt
    ** Unable to read file uEnv.txt **
    4086976 bytes read in 288 ms (13.5 MiB/s)
    33665 bytes read in 60 ms (547.9 KiB/s)
    Kernel image @ 0x81000000 [ 0x000000 - 0x3e5cc0 ]
    ## Flattened Device Tree blob at 85000000
       Booting using the fdt blob at 0x85000000
       Loading Device Tree to 86712000, end 8671d380 ... OK
    
    Starting kernel ...
    

    I do know that in the am33xx.dtsi file there is a similar line gpio3 and gpio0, could that be having some kind of effect?

    Geoff

  • No, there is no problem in in gpio name lines.
    Can you share your dts?

    Thanks,
    Georgi

  • Here is the dts file that I created with your suggestions:

    /*
     * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    
    /*
     * AM335x Starter Kit
     * www.ti.com/.../tmdssk3358
     */
    
    /dts-v1/;
    
    #include "am33xx.dtsi"
    #include <dt-bindings/pwm/pwm.h>
    
    / {
    	model = "TI AM335x KV1";
    	compatible = "ti,am335x-evmsk", "ti,am33xx";
    
    	cpus {
    		cpu@0 {
    			cpu0-supply = <&vcc_reg>;
    		};
    	};
    
    	memory {
    		device_type = "memory";
    		reg = <0x80000000 0x08000000>; /* 128 MB */
    	};
    
    	am33xx_pinmux: pinmux@44e10800 {
    		pinctrl-names = "default";
    
    		lcd_pins_default: lcd_pins_default {
    			pinctrl-single,pins = <
    				0x20 0x01	/* gpmc_ad8.lcd_data23, OUTPUT | MODE1 */
    				0x24 0x01	/* gpmc_ad9.lcd_data22, OUTPUT | MODE1 */
    				0x28 0x01	/* gpmc_ad10.lcd_data21, OUTPUT | MODE1 */
    				0x2c 0x01	/* gpmc_ad11.lcd_data20, OUTPUT | MODE1 */
    				0x30 0x01	/* gpmc_ad12.lcd_data19, OUTPUT | MODE1 */
    				0x34 0x01	/* gpmc_ad13.lcd_data18, OUTPUT | MODE1 */
    				0x38 0x01	/* gpmc_ad14.lcd_data17, OUTPUT | MODE1 */
    				0x3c 0x01	/* gpmc_ad15.lcd_data16, OUTPUT | MODE1 */
    				0xa0 0x00	/* lcd_data0.lcd_data0, OUTPUT | MODE0 */
    				0xa4 0x00	/* lcd_data1.lcd_data1, OUTPUT | MODE0 */
    				0xa8 0x00	/* lcd_data2.lcd_data2, OUTPUT | MODE0 */
    				0xac 0x00	/* lcd_data3.lcd_data3, OUTPUT | MODE0 */
    				0xb0 0x00	/* lcd_data4.lcd_data4, OUTPUT | MODE0 */
    				0xb4 0x00	/* lcd_data5.lcd_data5, OUTPUT | MODE0 */
    				0xb8 0x00	/* lcd_data6.lcd_data6, OUTPUT | MODE0 */
    				0xbc 0x00	/* lcd_data7.lcd_data7, OUTPUT | MODE0 */
    				0xc0 0x00	/* lcd_data8.lcd_data8, OUTPUT | MODE0 */
    				0xc4 0x00	/* lcd_data9.lcd_data9, OUTPUT | MODE0 */
    				0xc8 0x00	/* lcd_data10.lcd_data10, OUTPUT | MODE0 */
    				0xcc 0x00	/* lcd_data11.lcd_data11, OUTPUT | MODE0 */
    				0xd0 0x00	/* lcd_data12.lcd_data12, OUTPUT | MODE0 */
    				0xd4 0x00	/* lcd_data13.lcd_data13, OUTPUT | MODE0 */
    				0xd8 0x00	/* lcd_data14.lcd_data14, OUTPUT | MODE0 */
    				0xdc 0x00	/* lcd_data15.lcd_data15, OUTPUT | MODE0 */
    				0xe0 0x00	/* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
    				0xe4 0x00	/* lcd_hsync.lcd_hsync, OUTPUT | MODE0 */
    				0xe8 0x00	/* lcd_pclk.lcd_pclk, OUTPUT | MODE0 */
    				0xec 0x00	/* lcd_ac_bias_en.lcd_ac_bias_en, OUTPUT | MODE0 */
    			>;
    		};
    
    		lcd_pins_sleep: lcd_pins_sleep {
    			pinctrl-single,pins = <
    				0x20 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad8.lcd_data23 */
    				0x24 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad9.lcd_data22 */
    				0x28 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad10.lcd_data21 */
    				0x2c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad11.lcd_data20 */
    				0x30 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad12.lcd_data19 */
    				0x34 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad13.lcd_data18 */
    				0x38 (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad14.lcd_data17 */
    				0x3c (PIN_INPUT_PULLDOWN | MUX_MODE7)	/* gpmc_ad15.lcd_data16 */
    				0xa0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data0.lcd_data0 */
    				0xa4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data1.lcd_data1 */
    				0xa8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data2.lcd_data2 */
    				0xac (PULL_DISABLE | MUX_MODE7)		/* lcd_data3.lcd_data3 */
    				0xb0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data4.lcd_data4 */
    				0xb4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data5.lcd_data5 */
    				0xb8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data6.lcd_data6 */
    				0xbc (PULL_DISABLE | MUX_MODE7)		/* lcd_data7.lcd_data7 */
    				0xc0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data8.lcd_data8 */
    				0xc4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data9.lcd_data9 */
    				0xc8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data10.lcd_data10 */
    				0xcc (PULL_DISABLE | MUX_MODE7)		/* lcd_data11.lcd_data11 */
    				0xd0 (PULL_DISABLE | MUX_MODE7)		/* lcd_data12.lcd_data12 */
    				0xd4 (PULL_DISABLE | MUX_MODE7)		/* lcd_data13.lcd_data13 */
    				0xd8 (PULL_DISABLE | MUX_MODE7)		/* lcd_data14.lcd_data14 */
    				0xdc (PULL_DISABLE | MUX_MODE7)		/* lcd_data15.lcd_data15 */
    				0xe0 (PULL_DISABLE | MUX_MODE7)	    /* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
    				0xe4 (PULL_DISABLE | MUX_MODE7)	    /* lcd_hsync.lcd_hsync */
    				0xe8 (PULL_DISABLE | MUX_MODE7)	    /* lcd_pclk.lcd_pclk */
    				0xec (PULL_DISABLE | MUX_MODE7)	    /* lcd_ac_bias_en.lcd_ac_bias_en */
    				0x130 (PULL_DISABLE | MUX_MODE7)	    /* geoff's test - does this show up? */
    			>;
    
    		};
    
    		i2c0_pins: pinmux_i2c0_pins {
    			pinctrl-single,pins = <
    				0x188 (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_sda.i2c0_sda */
    				0x18c (PIN_INPUT_PULLUP | MUX_MODE0)	/* i2c0_scl.i2c0_scl */
    			>;
    		};
    
    		i2c1_pins: pinmux_i2c1_pins {
    			pinctrl-single,pins = <
    				0x180 (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_rxd,i2c1_sda */
    				0x184 (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_txd,i2c1_scl */
    			>;
    		};
    
    		i2c2_pins: pinmux_i2c2_pins {
    			pinctrl-single,pins = <
    				0x178 (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_ctsn,i2c2_sda */
    				0x17c (PIN_INPUT_PULLUP | MUX_MODE3)	/* uart1_rtsn,i2c2_scl */
    			>;
    		};
    
            spi0_pins: pinmux_spi0_pins {
                pinctrl-single,pins = <
                    0x150 0x30	/* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
                    0x154 0x30	/* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
                    0x158 0x10	/* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
                    0x15c 0x10	/* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
                >;
            };
    
            spi1_pins: pinmux_spi1_pins {
    			pinctrl-single,pins = <
    				0x108 (PIN_INPUT_PULLUP | MUX_MODE2) /* gmii1_col,sp1_clk_mux1 */
    				0x10c (PIN_INPUT_PULLUP | MUX_MODE2)  /* gmii1_crs,spi1_d0_mux1 */
    				0x110 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* gmii1_rxer,spi1_d1_mux1 */
    				0x144 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* rmii1_refclk,spi1_cs0_mux1 */
    			>;
            };
    
            /* Console */
    		uart0_pins: pinmux_uart0_pins {
    			pinctrl-single,pins = <
    				0x170 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart0_rxd.uart0_rxd */
    				0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)	/* uart0_txd.uart0_txd */
    			>;
    		};
    
            /* Bluetooth */
    		uart3_pins: pinmux_uart3_pins {
    			pinctrl-single,pins = <
    				0x134 (PIN_INPUT_PULLUP | MUX_MODE1)	/* gmii1_rxd3.uart3_rxd */
    				0x138 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* gmii1_rxd2.uart3_txd */
    				0x148 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* mdio_data.uart3_ctsn */
    				0x14c (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* mdio_clk.uart3_rtsn */
    			>;
    		};
    
            /* KV2 comms */
    		uart4_pins: pinmux_uart4_pins {
    			pinctrl-single,pins = <
    				0x11c (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* gmii1_txd3.uart4_rxd */
    				0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gmii1_txd2.uart4_txd */
    			>;
    		};
    
    		clkout1_pin: pinmux_clkout1_pin {
    			pinctrl-single,pins = <
    				0x1b0 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)		/* xdma_event_intr0.clkout1 */
    			>;
    		};
    
    		clkout2_pin: pinmux_clkout2_pin {
    			pinctrl-single,pins = <
    				0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3)		/* xdma_event_intr1.clkout2 */
    			>;
    		};
    
            /* Backlight */
    		pwm_backlight_pins: backlight_pins {
    			pinctrl-single,pins = <
    				0x90 0x02	/* gpmc_advn_ale,timer4 (BKLT_PWM) */
    			>;
    		};
    
            /* SD card */
    		mmc1_pins_default: pinmux_mmc1_pins {
    			pinctrl-single,pins = <
    				0x0F0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat3.mmc0_dat3 */
    				0x0F4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat2.mmc0_dat2 */
    				0x0F8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat1.mmc0_dat1 */
    				0x0FC (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat0.mmc0_dat0 */
    				0x100 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_clk.mmc0_clk */
    				0x104 (PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_cmd.mmc0_cmd */
    			>;
    		};
    
    		mmc1_pins_sleep: pinmux_mmc1_pins_sleep {
    			pinctrl-single,pins = <
    				0x0F0 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x0F4 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x0F8 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x0FC (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x100 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    				0x104 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    			>;
    		};
    
    		/* WL18xx WiFi */
    		mmc2_pins: pinmux_mmc2_pins {
    			pinctrl-single,pins = <
    				0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)	/* gmii1_txen.gpio3_3 (EN_WLAN) */
    				0x12c (PIN_INPUT | MUX_MODE7) /* gmii1_txclk.gpio3_9 (WL_INT) */
    				0x80 (PIN_INPUT | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
    				0x84 (PIN_INPUT | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
    				0x00 (PIN_INPUT | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
    				0x04 (PIN_INPUT | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
    				0x08 (PIN_INPUT | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
    				0x0c (PIN_INPUT | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
    			>;
    		};
    
    
    my_gpio_1_pins_default: my_gpio_1_pins_default {
    
    pinctrl-single,pins = <
    
    0x128 ( PIN_INPUT | MUX_MODE7 ) /* (K17) gmii1_txd0.gpio0[28] */
    
    >;
    
    };
    
    my_gpio_2_pins_default: my_gpio_2_pins_default {
    
    pinctrl-single,pins = <
    
    0x130 ( PIN_INPUT | MUX_MODE7 ) /* (L18) gmii1_rxclk.gpio3[10] */
    
    >;
    
    };
    
    #if 0
    		kv2_control_default: pinmux_kv2_control_default {
    			pinctrl-single,pins = <
    				/*0x190 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0 (GPIO3_4)*/
    				0x130 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0 (GPIO 3_10)*/
    				0x128 (PIN_OUTPUT | MUX_MODE7)	    /* KV1_SELF POWER ON GPIO0_28 (keeps battery power supplied even when KV2 is off*/
    				/*0x54 (PIN_INPUT | MUX_MODE7)	    /* KV1_WAKE*/
    			>;
    		};
    
    
    		kv2_control_sleep: pinmux_kv2_control_sleep {
    			pinctrl-single,pins = <
    				/*0x190 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0*/
    				0x1A8 (PIN_OUTPUT | MUX_MODE7)	    /* KV2 boot 0*/
    				0x70 (PIN_OUTPUT | MUX_MODE7)	    /* KV1_SELF POWER ON (keeps battery power supplied even when KV2 is off*/
    				/*0x54 (PIN_INPUT | MUX_MODE7)	    /* KV1_WAKE*/
    			>;
    		};
    #endif
    
    	};
    
    	ocp {
    		uart0: serial@44e09000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&uart0_pins>;
    
    			status = "okay";
    		};
    
    		uart3: serial@481a6000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&uart3_pins>;
    
    			status = "okay";
    		};
    
    		uart4: serial@481a8000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&uart4_pins>;
    
    			status = "okay";
    		};
    
    		i2c0: i2c@44e0b000 {
    			pinctrl-names = "default";
    			pinctrl-0 = <&i2c0_pins>;
    
    			status = "okay";
    			clock-frequency = <400000>;
    
    			/* GT9137 Touchscreen */
    			goodix@14 {
    				compatible = "goodix,gt91xx";
    				status = "okay";
    
    				/* I2C client driver parameters */
    				reg = <0x14>;
    				interrupt-parent = <&gpio0>;
    				interrupts = <31>;
    
    				/* Goodix driver parameters */
    				interrupt-gpios = <&gpio0 31 0x00>;
    				reset-gpios = <&gpio2 0 0x00>;
    				goodix,product-id = "9137";
    				goodix,panel-coords = <0 0 480 800>;
    				goodix,display-coords = <0 0 480 800>;
    			};
    
    			/* CAT24C256 EEPROM */
    			eeprom@50 {
    				compatible = "at,24c256";
    				reg = <0x50>;
    			};
    		};
    
    		musb: usb@47400000 {
    			status = "okay";
    
    			control@44e10000 {
    				status = "okay";
    			};
    
    			usb-phy@47401300 {
    				status = "okay";
    			};
    
    			usb-phy@47401b00 {
    				status = "okay";
    			};
    
    			usb@47401000 {
    				status = "okay";
    			};
    
    			usb@47401800 {
    				status = "okay";
    				dr_mode = "host";
    			};
    
    			dma-controller@07402000  {
    				status = "okay";
    			};
    		};
    
    		spi1: spi@481a0000 {
    			status = "okay";
    			pinctrl-names = "default";
    			pinctrl-0 = <&spi1_pins>;
    			spi-display {
    				compatible = "kuvee,cordial-spi";
    				spi-max-frequency = <500000>;
    				reg = <0>; /* Chip select 0 */
    			};
    		};
    
    		lcdc: lcdc@0x4830e000 {
    			pinctrl-names = "default", "sleep";
    			pinctrl-0 = <&lcd_pins_default>;
    			pinctrl-1 = <&lcd_pins_sleep>;
    			status = "okay";
    			/* avoid stupid warning */
    			#address-cells = <1>;
    			#size-cells = <1>;
    			panel-info {
    				ac-bias           = <255>;
    				ac-bias-intrpt    = <0>;
    				dma-burst-sz      = <16>;
    				bpp               = <16>;
    				fdd               = <0x80>;
    				tft-alt-mode      = <0>;
    				stn-565-mode      = <0>;
    				mono-8bit-mode    = <0>;
    				sync-edge         = <0>;
    				sync-ctrl         = <1>;
    				raster-order      = <0>;
    				fifo-th           = <0>;
    			};
    			display-timings { /* Cordial CT040BLP32 */
    				480x800 {
    					hactive         = <480>;
    					vactive         = <800>;
    					hback-porch     = <5>;
    					hfront-porch    = <5>;
    					hsync-len       = <5>;
    					vback-porch     = <5>;
    					vfront-porch    = <5>;
    					vsync-len       = <5>;
    					clock-frequency = <16600000>;
    					hsync-active    = <0>;
    					vsync-active    = <0>;
    				};
    			};
    		};
    
    		wlcore {
    			compatible = "wlcore";
    			gpio = <&gpio3 9 0>; /* WL_INT */
    		};
    
    gpio0: gpio@44e07000 {
    
    pinctrl-names = "default";
    
    pinctrl-0 = <&my_gpio_1_pins_default>;
    
    };
    
    gpio3: gpio@481ae000 {
    
    pinctrl-names = "default";
    
    pinctrl-0 = <&my_gpio_2_pins_default>;
    
    };
    
    #if 0
    		kv2_control {
    		pinctrl-names = "default", "sleep";
    		pinctrl-0 = <&kv2_control_default>;
    		pinctrl-1 = <&kv2_control_sleep>;
    
    		compatible = "gpio-leds";
    
    		kv2@1 {
    			label = "boot0";
    			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
    			default-state = "off";
    		};
    
    		kv2@2 {
    			label = "self_power_on";
    			/*gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;*/
    			gpios = <&gpio3 10 GPIO_ACTIVE_HIGH>;
    			default-state = "off";
    		};
    
    		};
    #endif
    
    #if 0
    	gpio106: gpio106 {
    	      compatible = "ti,omap4-gpio";
    	      ti,hwmods = "gpio106";
    	      gpio-controller;
    	      #gpio-cells = <2>;
    	      interrupt-controller;
    	      #interrupt-cells = <2>;
    	  };	
    #endif		
    
    	};
    
    	vcc_reg: fixedregulator@0 {
    		compatible = "regulator-fixed";
    		regulator-name = "vcc";
    		regulator-min-microvolt = <1800000>;
    		regulator-max-microvolt = <1800000>;
    		regulator-boot-on;
    		regulator-always-on;
    	};
    
    	backlight {
    		compatible = "kv1-backlight";
    		brightness-levels = <0 1 2 3 4 5 6 7 8 9 10>;
    		default-brightness-level = <10>;
    	};
    
    
    };
    
    
    
      
    /* Ambient light sensor */
    &tscadc {
    	status = "okay";
    	adc {
    		ti,adc-channels = <0 1>;
    	};
    };
    
    &gpio0 {
    	ti,no-reset;
    };
    
    
    /* SD card */
    &mmc1 {
    	status = "okay";
    	bus-width = <4>;
    	pinctrl-names = "default", "sleep";
    	pinctrl-0 = <&mmc1_pins_default>;
    	pinctrl-1 = <&mmc1_pins_sleep>;
    };
    
    /* WL18xx WiFi */
    &mmc2 {
    	status = "okay";
    	ti,non-removable;
    	bus-width = <4>;
    	cap-power-off-card;
    	pinctrl-names = "default";
    	pinctrl-0 = <&mmc2_pins>;
    	ti,non-removable;
        ti,needs-special-hs-handling;
    };
    
    #if 0
    &am33xx_pinmux {
          pinctrl-names = "default";
          pinctrl-0 = <&kv2_control_default>;
          self_power: pinmux_test {
                pinctrl-single,pins = <
                      0x70 (PIN_OUTPUT | MUX_MODE7) /* lcd_data0.gpio2_6 */
                >;
          };
      };
    #endif

  • Also thanks for the link to the other posting - quite useful. Also note I also want these pins to be outputs. I assume that i will just change PIN_INPUT to PIN_OUTPUT to make that happen, but if not, please help me out there too.
  • Try to replace gpio0 and gpio3 nodes from line 408 to line 271 - inside ocp{} before uart nodes;

  • Actually you must not have problems with controlling your GPIOs from sysf, without defining it in your dts, as it is defined in am33xx.dtsi

    What is your purpose for using these gpios?

    add output-low; or output-high; to the gpio# node.

    Refer here to see how to specify GPIO direction as input/output.

    https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt

    BR,

    Georgi

  • Georgi - 

    The purpose of the gpio is to set some bits on external peripherals.   So I need the pins to become totem-pole 1.8 volt outputs.   Both ios need to be outputs that are initialized to low if possible.

    I tried your suggestion of moving the lines up to before uarts in OCP, still the same failure to boot.

    I did try modifying the gpio line, did I implement this correctly?

    		gpio3: gpio@481ae000 {
    
    		pinctrl-names = "default";
    
    		pinctrl-0 = <&my_gpio_2_pins_default>;
    		output-high;
    		};
    

    Either with or without that "output-high" line the system does not boot.

    For reference, here is what it looks like in the am33xx.dtsi file:   the file is exactly the same as in the sdk.

    		gpio3: gpio@481ae000 {
    			compatible = "ti,omap4-gpio";
    			ti,hwmods = "gpio4";
    			clocks = <&l4ls_gclk>, <&gpio3_dbclk>;
    			clock-names = "fck", "dbclk";
    			gpio-controller;
    			#gpio-cells = <2>;
    			interrupt-controller;
    			#interrupt-cells = <1>;
    			reg = <0x481ae000 0x1000>;
    			interrupts = <62>;
    		};
    

    Just as a reminder, we based our design on sdk version 7.

    Geoff

  • System does not boot.
    Can you share your boot log from terminal?
    Does it still stops on "Starting kernel..." ?
  • Here is the boot log:
    U-Boot 2014.10-rc2 (May 04 2015 - 14:34:33) Watchdog enabled I2C: ready DRAM: 128 MiB NAND: 0 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 *** Error - No Valid Environment Area found *** Warning - bad CRC, using default environment Net: <ethaddr> not set. Validating first E-fuse MAC Phy not found cpsw, usb_ether Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device SD/MMC found on device 0 reading uEnv.txt ** Unable to read file uEnv.txt ** 4086976 bytes read in 288 ms (13.5 MiB/s) 33781 bytes read in 60 ms (549.8 KiB/s) Kernel image @ 0x81000000 [ 0x000000 - 0x3e5cc0 ] ## Flattened Device Tree blob at 85000000 Booting using the fdt blob at 0x85000000 Loading Device Tree to 86712000, end 8671d3f4 ... OK Starting kernel ...

    Correct, system does not boot.   I started with our original dts file, and added your lines again just to be sure that I did not make any other mistakes.  

    The only difference in the boot log prior to "Starting kernel ..." in a working config are the three lines:  What I pasted below are the lines in the working boot.

    4086976 bytes read in 293 ms (13.3 MiB/s)
    33541 bytes read in 76 ms (430.7 KiB/s)

     and

     Loading Device Tree to 86712000, end 8671d304 ... OK

    Geoff

  • Sorry for my misunderstanding ,

    if you do not add any  gpio lines in dts, the kernel boots properly?

    Can you try, after it boots,  export gpio 106  and gpio 28? set its directions to output with

    echo "out" > gpio#/direction

    and then change its value?

    What happens?

    Thanks

    Georgi

  • That of course is what I tried before getting into this mess. I'm going to test it again now, but to take advantage of the time difference in our work days, I'll answer with what i saw before, which is that the pins are available for export, and I can change them to outputs, reading back the value I can see the output being set high, but the actual pin output does not change.

    pin 3_10 is the one I use because it just runs out to a test point that I can easily probe.

    So this behavior indicates that the pinmux does not have the pin set up to be an output. Hence fiddling with the dts file to attempt changing that.

    An edit:

    I did retry the test, works as reported.  When I read the pinctrl status, here is what I see:

    root@am335x-evm:/sys/kernel/debug/pinctrl/44e10800.pinmux# cat pinmux-pins|grep
    106
    pin 106 (44e109a8.0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
    root@am335x-evm:/sys/kernel/debug/pinctrl/44e10800.pinmux# cat pins|grep 9a8
    pin 106 (44e109a8.0) 00000027 pinctrl-single

    The pin configuration appears to be, pin mux mode 7 , pullup/down enabled, pulldown, receive mode.   Of course this would not work  to drive an output.    But where are those settings made? 

    I have found that I can change the output of gpio59 (1_27), I am not sure why I can change that but not the ones we have been discussing.

    Best,
    Geoff

  • Hi,

    Surmise there is some conflict with

    /* WL18xx WiFi */
    mmc2_pins: pinmux_mmc2_pins

    Try to export gpios as comment mmc2 nodes in dts.

    BR,
    Georgi
  • if I understand correctly, you suggest that I comment out the mmc2 node and pin definitions.

    I did that without the added pin definition or gpio from you prior comment, the dts builds, system boots, but does not toggle the output

    I also tried with you added pin definition and gpio lines, with that the system does not boot.   

    I'm curious about how the system get the configuration necessary to boot in the first place, since in the .dts file we define the pins for the sd card.  I'm grasping at straws here:  Does uboot need a separate configuration, or does it somehow access the same file that I modify?   Could it somehow be looking at a different file?

    Thanks,
    Geoff

  • Georgi, That did not work, but the following did:

    Inside pin definitions:

    gpio3_pins: pinmux_gpio3_pins {

    pinctrl-single,pins = <

    0x130 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* Set MII1_RX_CLK pin as GPIO3_10 */

    >;

    };

    After OCP

    &gpio3 {

    pinctrl-names = "default";

    pinctrl-0 = <&gpio3_pins>;

    status = "okay";

    }

    Thanks to Yorden, who explained to me how to get the pin number, and followed that with the suggestion in the following post

    Thank you Georgi for your help.   I'm currently testing hardware now.

  • Geoff,

    U-Boot uses a configuration set in the board.c file. One of my suggestions, would be to try to use U-Boot with memset commands to see if you can get that to toggle the ping. This takes away some of the confusion of DT.

    I also wanted to let you know that I tried to recreate your issue, but I wasn't successful. I used a Beaglebone Black with a logic analyzer and was able to see pin GPIO0_7 toggle. It reports the same sysfs feedback as you mentioned in your posts, and I was definitely able to toggle it. This was all with a stock SDK 8 kernel for the BBB and I would expect SDK 7 to behave similarly.

    Reading through your issue, I expected this to be a classic pin mux problem. Just adding the pin mux entry doesn't do anything without a driver to program that information at probe. That's what sent me down the road to do some testing and learned that the default pin muxing seemed to be working in my case with the BBB.

    If you want to try something, you could try to add:

    gpio-ranges = <&pinmux_control_default 0 0 1>

    to your GPIO controller entry in am33xx.dtsi or add it in your board dts as an overlay using a phandle. I wasn't able to try this since it already worked for me, but it is what I was looking to try and might still help you. This should enable the GPIO driver to set up the pin mux. Again, the pin mux that you have worked in my case.

    Sorry, no definitive answers, but I'm hoping something I've mentioned here might help.
  • Thanks RonB,

    I think the phandle was what I was missing (and now I know what it is called, which I'm sure helps too, beats trying to search for &).

    I now have it all working properly (see my previous response on this thread)

    Geoff