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.

Linux/PROCESSOR-SDK-AM335X: device tree overlay

Part Number: PROCESSOR-SDK-AM335X

Tool/software: Linux

I had a lot of device tree overlays when I was developing against the linux kernel 4.9.78-ti-r94, using a Debian strecth distro. Those overlays took care of PRU, LCD display and encoders pin muxing. I managed the loading of these overlays through a uEnv.txt file located at /boot/uEnv.txt under the filesystem partition. 

But now, I migrated to the TI SDK 05.02.00.10, which uses linux kernel 4.14.79-gbde58ab01e and an Arago 2018.10 distro. I would like to know how these pin muxing stuff is dealt with in this particular kernel and distro. I noticed that even the device tree compiler (dtc) is missing, so I have no clue about how to compile my previous .dts files into .dtbo files and how to load these .dtbo files into the kernel at boot time.

Regards,

Bruno.

  • Hi Bruno,

    Refer to the below e2e thread regarding AM57x pinmux:

    e2e.ti.com/.../771905

    Regards,
    Pavel
  • Hi Pavel,

    I found the related threads somehow confusing. However, I managed to do what I wanted.

    The U-Boot bootloader that ships with the SDK loads the am335x-boneblack.dtb binary at boot time, by default. So, I needed to actually change this .dtb binary.

    In order to do so, I edited the am335x-boneblack.dts file, under <SDK_PATH>/<KERNEL_SOURCE_PATH>/arch/arm/boot/dts. I edited it in a way that I would emulate what the device tree overlays do: overwrite some properties, create some nodes, and etc. Also, I needed to edit am335x-boneblack-common.dtsi, because the .dts file included this .dtsi file, which did some LCD pinmuxing that would conflict with my own.

    After editing the .dts and .dtsi files, I compiled them to generate my desired .dtb binary. From within the kernel root directory, I did the following:

    // Clean kernel source
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
    
    // Configure kernel
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am335x-evm_defconfig
    
    // Compile device tree binary
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x-boneblack.dtb

    The compiled binary will be placed at <SDK_PATH>/<KERNEL_SOURCE_PATH>/arch/arm/boot/dts. Then, I copied this .dtb file into the target rootfs filesystem partition, under the /boot folder (not the boot partition):

    scp <SDK-PATH>/<KERNEL-PATH>/arch/arm/boot/dts/am335x-boneblack.dtb root@am335x-evm.local:/boot/

    Some linking is necessary:

    rm devicetree-zImage-am335x-boneblack.dtb
    ln -fs am335x-boneblack.dtb devicetree-zImage-am335x-boneblack.dtb

    Then, I rebooted the board and it booted just fine into the Matrix application. I'm attaching the .dts and .dtsi files I actually modified, in case anyone finds it interesting (I had to change the extensions to be able to upload them in this forum).

    .dts file:

    /*
     * 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.
     */
    /dts-v1/;
    
    #include "am33xx.dtsi"
    #include "am335x-bone-common.dtsi"
    #include "am335x-boneblack-common.dtsi"
    
    &sgx {
    	status = "okay";
    };
    
    / {
    	model = "TI AM335x BeagleBone Black";
    	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
    	panel {
    		status = "okay";
    		compatible = "ti,tilcdc,panel";
    		pinctrl-names = "default";
    		pinctrl-0 = <&lcd_pins>;
    		panel-info {
    			ac-bias           = <255>;		/* AC Bias Pin Frequency */
    			ac-bias-intrpt    = <0>;		/* AC Bias Pin Transitions per Interrupt */
    			dma-burst-sz      = <16>;		/* DMA burst size */
    			bpp               = <24>;		/* Bits per pixel */
    			fdd               = <0x80>;		/* FIFO DMA Request Delay */
    			sync-edge         = <0>;		/* Horizontal and Vertical Sync Edge: 0=rising 1=falling */
    			sync-ctrl         = <0>;		/* Horizontal and Vertical Sync: Control: 0=ignore */
    			raster-order      = <1>;		/* Raster Data Order Select: 1=Most-to-least 0=Least-to-most */
    			fifo-th           = <0>;		/* DMA FIFO threshold */
    		};
    		display-timings {
    			native-mode = <&timing>;
    			timing: 800x480 {
    				clock-frequency = <33300000>;	/* Clock de dados */
                    		hactive         = <800>;	/* Resolução */
                    		vactive         = <480>;	/* Resolução */
                 			hfront-porch    = <16 210 354>; /* Timing (ver datasheet IL16122) */
                    		hback-porch     = <46>;		/* Timing (ver datasheet IL16122) */		
                    		hsync-len       = <1 20 40>;	/* Timing (ver datasheet IL16122) */
                    		vback-porch     = <23>;		/* Timing (ver datasheet IL16122) */
                  			vfront-porch    = <7 22 47>;	/* Timing (ver datasheet IL16122) */
                    		vsync-len       = <1 10	20>;	/* Timing (ver datasheet IL16122) */
                    		hsync-active    = <0>;		/* 'Hsync' ativo na borda de descida */
                    		vsync-active    = <0>;		/* 'Vsync' ativo na borda de descida */
                    		de-active       = <1>;		/* 'Data Enable' ativo em alto */
                    		pixelclk-active = <0>;		/* 'Data Clock' ativo na borda de descida */
    			};
    		};
    	};
    };
    
    &am33xx_pinmux {
    	lcd_pins: pinmux_lcd_pins {
    		pinctrl-single,pins = <	0xA0 0x8	/* lcd: lcd_data0 */
    					0xA4 0x8 	/* lcd: lcd_data1 */
    					0xA8 0x8 	/* lcd: lcd_data2 */
    					0xAC 0x8 	/* lcd: lcd_data3 */
    					0xB0 0x8 	/* lcd: lcd_data4 */
    					0xB4 0x8 	/* lcd: lcd_data5 */
    					0xB8 0x8 	/* lcd: lcd_data6 */
    					0xBC 0x8 	/* lcd: lcd_data7 */
    					0xC0 0x8 	/* lcd: lcd_data8 */
    					0xC4 0x8 	/* lcd: lcd_data9 */
    					0xC8 0x8 	/* lcd: lcd_data10 */
    					0xCC 0x8 	/* lcd: lcd_data11 */
    					0xD0 0x8 	/* lcd: lcd_data12 */
    					0xD4 0x8 	/* lcd: lcd_data13 */
    					0xD8 0x8 	/* lcd: lcd_data14 */
    					0xDC 0x8 	/* lcd: lcd_data15 */
    
    					0x3C 0x9 	/* lcd: lcd_data16 */
    					0x38 0x9 	/* lcd: lcd_data17 */
    					0x34 0x9 	/* lcd: lcd_data18 */
    					0x30 0x9 	/* lcd: lcd_data19 */
    					0x2C 0x9 	/* lcd: lcd_data20 */
    					0x28 0x9 	/* lcd: lcd_data21 */
    					0x24 0x9 	/* lcd: lcd_data22 */
    					0x20 0x9 	/* lcd: lcd_data23 */
    
    					0xE0 0x8 	/* lcd: lcd_vsync */
    					0xE4 0x8 	/* lcd: lcd_hsync */
    					0xE8 0x8 	/* lcd: lcd_pclk */
    					0xEC 0x8	/* lcd: lcd_data_enable */
    		>;
    	};
    };
    
    &lcdc {
    	status = "okay";
    	blue-and-red-wiring = "crossed";
    };
    
    &cpu0_opp_table {
    	/*
    	 * All PG 2.0 silicon may not support 1GHz but some of the early
    	 * BeagleBone Blacks have PG 2.0 silicon which is guaranteed
    	 * to support 1GHz OPP so enable it for PG 2.0 on this board.
    	 */
    	oppnitro-1000000000 {
    		opp-supported-hw = <0x06 0x0100>;
    	};
    };
    

    .dtsi file:

    /*
     * 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.
     */
    
    #include <dt-bindings/display/tda998x.h>
    
    &ldo3_reg {
    	regulator-min-microvolt = <1800000>;
    	regulator-max-microvolt = <1800000>;
    	regulator-always-on;
    };
    
    &mmc1 {
    	vmmc-supply = <&vmmcsd_fixed>;
    };
    
    &mmc2 {
    	vmmc-supply = <&vmmcsd_fixed>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&emmc_pins>;
    	bus-width = <8>;
    	status = "okay";
    };
    
    &am33xx_pinmux {
    	mcasp0_pins: mcasp0_pins {
    		pinctrl-single,pins = <
    			AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
    			AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/
    			AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */
    			AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */
    			AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.GPIO1_27 */
    		>;
    	};
    };
    
    &rtc {
    	system-power-controller;
    };
    
    &mcasp0	{
    	#sound-dai-cells = <0>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcasp0_pins>;
    	status = "okay";
    	op-mode = <0>;	/* MCASP_IIS_MODE */
    	tdm-slots = <2>;
    	serial-dir = <	/* 0: INACTIVE, 1: TX, 2: RX */
    			0 0 1 0
    		>;
    	tx-num-evt = <32>;
    	rx-num-evt = <32>;
    };
    
    / {
    	clk_mcasp0_fixed: clk_mcasp0_fixed {
    		#clock-cells = <0>;
    		compatible = "fixed-clock";
    		clock-frequency = <24576000>;
    	};
    
    	clk_mcasp0: clk_mcasp0 {
    		#clock-cells = <0>;
    		compatible = "gpio-gate-clock";
    		clocks = <&clk_mcasp0_fixed>;
    		enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
    	};
    
    	sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "TI BeagleBone Black";
    		simple-audio-card,format = "i2s";
    		simple-audio-card,bitclock-master = <&dailink0_master>;
    		simple-audio-card,frame-master = <&dailink0_master>;
    
    		dailink0_master: simple-audio-card,cpu {
    			sound-dai = <&mcasp0>;
    			clocks = <&clk_mcasp0>;
    		};
    	};
    };
    

    Regards,

    Bruno.

  • Bruno,

    My reference was for AM57x device, while you are on AM335x device, sorry about that.

    Glad to see you have fix your issue and thank you for sharing the solution.

    Regards,
    Pavel