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.

AM625: SK_EVM - How to add UART PRU to .dtsi?

Part Number: AM625
Other Parts Discussed in Thread: SYSCONFIG

- I have a Starter Kit Evaluation Module XAM6254ATCGGAALW

I need to configure the UART peripheral of the PRU through the .dtsi file.

Currently, the PRU part looks like this:

	pruss: pruss@30040000 {
		compatible = "ti,am625-pruss";
		reg = <0x00 0x30040000 0x00 0x80000>;
		power-domains = <&k3_pds 81 TI_SCI_PD_EXCLUSIVE>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x0 0x00 0x30040000 0x80000>;

		pruss_mem: memories@0 {
			reg = <0x0 0x2000>,
			      <0x2000 0x2000>,
			      <0x10000 0x10000>;
			reg-names = "dram0", "dram1", "shrdram2";
		};

		pruss_cfg: cfg@26000 {
			compatible = "ti,pruss-cfg", "syscon";
			reg = <0x26000 0x200>;
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = <0x0 0x26000 0x2000>;

			clocks {
				#address-cells = <1>;
				#size-cells = <0>;

				pruss_coreclk_mux: coreclk-mux@3c {
					reg = <0x3c>;
					#clock-cells = <0>;
					clocks = <&k3_clks 81 0>,  /* pruss_core_clk */
						 <&k3_clks 81 20>; /* pruss_iclk */
					assigned-clocks = <&pruss_coreclk_mux>;
					assigned-clock-parents = <&k3_clks 81 20>;
				};

				pruss_iepclk_mux: iepclk-mux@30 {
					reg = <0x30>;
					#clock-cells = <0>;
					clocks = <&k3_clks 81 3>,	/* pruss_iep_clk */
						 <&pruss_coreclk_mux>;	/* pruss_coreclk_mux */
					assigned-clocks = <&pruss_iepclk_mux>;
					assigned-clock-parents = <&pruss_coreclk_mux>;
				};
			};
		};

		pruss_intc: interrupt-controller@20000 {
			compatible = "ti,pruss-intc";
			reg = <0x20000 0x2000>;
			interrupt-controller;
			#interrupt-cells = <3>;
			interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host_intr0", "host_intr1",
					  "host_intr2", "host_intr3",
					  "host_intr4", "host_intr5",
					  "host_intr6", "host_intr7";
		};

		pru0: pru@34000 {
			compatible = "ti,am625-pru";
			reg = <0x34000 0x3000>,
			      <0x22000 0x100>,
			      <0x22400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "am62x-pru0-fw";
			interrupt-parent = <&pruss_intc>;
			interrupts = <16 2 2>;
			interrupt-names = "vring";
		};

		pru1: pru@38000 {
			compatible = "ti,am625-pru";
			reg = <0x38000 0x3000>,
			      <0x24000 0x100>,
			      <0x24400 0x100>;
			reg-names = "iram", "control", "debug";
			firmware-name = "am62x-pru1-fw";
			interrupt-parent = <&pruss_intc>;
			interrupts = <18 3 3>;
			interrupt-names = "vring";
		};
	};
};

Is it necessary to do this configuration in the .dtsi and build the firmware to be able to use uart with baremetal in code composer?

Would the setup be something like this?

pruss_uart: serial@28000 
{
        compatible = "ti,pruss-uart";
        reg = <0x28000 0x38>;
        interrupt-parent = <&pruss_intc>;
        status = "disabled";
};

If not, what would it look like?

- I also need to set up the multiplexing of the pins. I need to do this through .dtsi as well.

How do I do it?

Most of the TX/RX of the UART of the PRU interfere with the MII pins of the ethernet ports, so I separated the pins I want and their BALL in such a way as not to intervene:

My package is ALW, so it would be E15 and C15. How can I set them to function 6 and be UART TX/RX from PRU?

  • Hello Rafael,

    It will take me a day or so to circle hack here. In the meantime, I would look at the SysConfig pinmux tool for how to set the pinmux settings.

    Regards,

    Nick

  • Hello Rafael,

    I'll start the conversation now, but we'll have to continue our chat in early April once I'm back from vacation.

    Is the PRU core going to be interacting with Linux at all, or does it just need to be initialized? Are you going to have Linux side code (e.g., userspace application, custom kernel driver) that is interacting with the PRU cores?

    Linux driver usecase

    If you are writing your own custom Linux driver, then you could use that driver's devicetree node to do the pinmuxing, set up RPMsg interrupts, request ownership of the PRU subsystem, etc. But it will be a bit more involved.

    PRU running independently usecase

    If you are just kicking off the PRU cores to run on their own without any interaction with Linux code, my instinct is that should be pretty easy. Just enable the PRU subsystem in the Linux devicetree file, and add the PRU's pinmux settings to an existing set of pinmux settings.

    Pinmux settings are not applied unless they are associated with a driver, and then they are applied during runtime when that devicetree node is probed. Linux doesn't check that the pinmux settings it is applying are specific to the driver, so you can add those PRU pinmux configs to any existing pinmux configs. Just make sure that you delete any conflicting pinmux settings!

    Once the PRU firmware is up and running, I would expect that the PRU itself could initialize the PRU subsystem hardware UART - without checking, I think the entire PRU subsystem should be clocked already, so the PRU would not need to worry about doing any SysFW calls to enable clock domains.

    Regards,

    Nick