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.

66AK2G12: Problem about enabling MII reference clock (25 MHz) to CLKOUT (H23 pin)

Part Number: 66AK2G12

Hi,

I am trying to enable 25 MHz clock signal on H23 pin as MII reference clock for 2 Ethernet PHYs. The PHYs will be be driven by PRU0. 

I have used the clock tree tool ver. 1.0.0.3 to evaluate the value to insert in proper registers. In this way I set the following registers:

BOOTCFG_ETHERNET_CLKCTL (0x02620698) = 0x6

BOOTCFG_ETHERNET_CFG (0x02620E20) = 0x0

BOOTCFG_NSS_PLL_CTL0 (0x02620358) =  0x7C083E42

When using k2g_evm board, I see with oscilloscope the proper clock waveforms (50 MHz with BOOTCFG_ETHERNET_CLKCTL = 0x4 and 25 MHz with BOOTCFG_ETHERNET_CLKCTL = 0x6) but with my custom board the H23 is fixed at 3V3.

I have set  the H23 pin in mux-k2g.h as below

{ 136, MODE(1) } // CLKOUT pin

Consider that respect to k2g_evm board, I don't use the EMAC pins but 2 interfaces from PRU0 to obtain Ethernet ports. At this point one difference respect to k2g_evm is that mdio and netcp nodes are not listed in my dts file. See below my one

// SPDX-License-Identifier: GPL-2.0+
/*
 * Device Tree Source for K2G Industrial Communication Engine EVM
 *
 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
 */
/dts-v1/;

#include "keystone-k2g.dtsi"


/ {
	compatible = "ti,k2g-ice", "ti,k2g", "ti,keystone";
	model = "Texas Instruments K2G SoC - Hitachi Propulsion Controller (HPC) board";

	chosen {
		stdout-path = &uart0;
	};

	memory@80000000 {
		device_type = "memory";
		reg = <0x80000000 0x10000000>;
	};
};

&i2c2 {
	status = "okay";
	rtc@68 {
		compatible = "dallas,ds3232";
		reg = <0x68>;
	};
};

&keystone_usb0 {
	status = "okay";
};

&usb0_phy {
	status = "okay";
	compatible = "nop-phy";
};

&usb0 {
	dr_mode = "peripheral";
	status = "okay";
};


&i2c1 {
	status = "okay";
};

&qspi {
	status = "okay";

	flash0: m25p80@0 {
		compatible = "s25fl512s","spi-flash","n25q512ax3";
		reg = <0>;
		spi-tx-bus-width = <1>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <96000000>;
		#address-cells = <1>;
		#size-cells = <1>;
		cdns,tshsl-ns = <392>;
		cdns,tsd2d-ns = <392>;
		cdns,tchsh-ns = <100>;
		cdns,tslch-ns = <100>;
		block-size = <18>;

		partition@0 {
			label = "MLO";
			reg = <0x00000000 0x00100000>;
		};
		partition@1 {
			label = "u-boot.img";
			reg = <0x00100000 0x00100000>;
		};
		partition@2 {
			label = "fdt";
			reg = <0x00200000 0x00040000>;
		};
		partition@3 {
			label = "skern-k2g.bin";
			reg = <0x00240000 0x00010000>;
		};
		partition@4 {
			label = "ti-sci-firmware";
			reg = <0x00250000 0x00010000>;
		};
		partition@5 {
			label = "k2-fw-initrd.cpio.gz";
			reg = <0x00260000 0x00020000>;
		};
		partition@6 {
			label = "kernel";
			reg = <0x00280000 0x00800000>;
		};
		partition@7 {
			label = "file-system";
			reg = <0x00A80000 0x03580000>;
		};
	};
};

&spi0 {
	status = "okay";

	spi0_nor: flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "spi-flash";
		spi-max-frequency = <50000000>;
		m25p,fast-read;
		reg = <0>;

		partition@0 {
			label = "u-boot-spl";
			reg = <0x0 0x80000>;
			read-only;
		};

		partition@1 {
			label = "misc";
			reg = <0x80000 0xf80000>;
		};
	};
};

&spi1 {
	status = "okay";

	spi1_nor: flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "spi-flash";
		spi-max-frequency = <50000000>;
		m25p,fast-read;
		reg = <0>;

		partition@0 {
			label = "u-boot-spl";
			reg = <0x0 0x80000>;
			read-only;
		};

		partition@1 {
			label = "misc";
			reg = <0x80000 0xf80000>;
		};
	};
};

Could be it the reason that don't allow to enable 25 MHz on H23 pin or there is an another explanation?

Regards

Graziano

  • Hi again,

    just to inform you better about my problem, I am using a sdk ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08, the input frequency at bootstrap is 24 MHz, and the ARM is set to 600 MHz as operating frequency, while the k2g_evm board works at 1 GHz. In any case both the boards (custom and k2g_evm) have the register BOOTCFG_NSS_PLL_CTL0 (0x02620358) set to 0x7C083E42 that should drive NSS PLL output to 1 GHz as described in Figure 11-913 in K2G TRM. That output should be divided by a 20 factor allowing 50 MHz or 25 MHz according to value set in BOOTCFG_ETHERNET_CLKCTL. I wait for your feedback regarding this issue, and I am available to give all the information needed to solve the problem.

    Regards 

    Graziano

  • Hi,

    Could you please attach a diagram or schematic snippet how the PHYs are attached to the processor?

    Also please indicate how the registers were set? Was this in code or with devmem2.

    Best Regards,

    Schuyler

  • Hi,

    I have attached the zip where you can find the snapshots regarding the links between k2g processor and the PHY. My project requires 2 Ethernet ports and I have chosen to use the PRU0 that can provide 2 Ethernet ports (EMAC pins not used and PRU1 is used for GPIO). The PHYs are defined to be used in MII mode, therefore they require an external 25 MHz clock signal that shall drive PHYs XI pins. As you can see in dedicated snapshot, my idea was to use the H23 pin of K2G that is splitten in 2 lines through a buffer.    

    snapshot k2g-phy links.zip

    Please let me know if you require more details about the schematics.

    Regarding the code, I have said that I am working with ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08. The output of NSS PLL that shall be at 1 GHz is defined in u-boot/board/<my_vendor>/<my_board>/board_k2g.c

    static struct pll_init_data nss_pll_config[MAX_SYSCLK] = {
    	[SYSCLK_19MHz] = {NSS_PLL, 625, 6, 2},
    	[SYSCLK_24MHz] = {NSS_PLL, 250, 3, 2},
    	[SYSCLK_25MHz] = {NSS_PLL, 80, 1, 2},
    	[SYSCLK_26MHz] = {NSS_PLL, 1000, 13, 2},
    };

    My input clock to K2G is 24 MHz, therefore the multiplication and divider factors are : 250, 3, 2. These numbers, applied to clock tree tool give 0x7C083E42 as value for the register BOOTCFG_NSS_PLL_CTL0 (0x02620358) that drive the NSS_PLL to 1 GHz. In u-boot shell I have verified that register has that value with command md 0x02620358 1. At this point I have forced the BOOTCFG_ETHERNET_CLKCTL to 0x6 value with command mw 0x02620698 0x6 but the only effect is that I see an 3,3V fixed on lines driven by H23. Just to be sure I have seen the pad configuration register for H23 with command md 0x02621220 1 and the result confirms that the pad is set to MODE 1 (Secondary function: CLKOUT) and no pull up/down. In u-boot/board/<my_vendor>/<my_board>/mux_k2g.h I have set H23 ball (padconfig136) in this way:

    { 136,	MODE(1) },						/* QSPI_CSn1.CLKOUT */

     

    Then I have tried to set BOOTCFG_ETHERNET_CLKCTL = 0x6 in code before u-boot shell rise up, for example in /u-boot/net/eth-uclass.c in function eth_initialize() insert the line below:

    	__raw_writel(0x6,KS2_DEVICE_STATE_CTRL_BASE + 0x698);

    but no improvement.

    Consider that I do the same steps with k2g_evm board where I have used the same u-boot SDK and I am able to drive 25 MHz from H23 pin. 

    The effective difference between my custom board (HPC) and k2g_evm is related to u-boot dts regading the MDIO and netcp nodes.

    Below you can do the comparison with attached files.

    dts comparison.zip

    In this u-boot dts version of my board I have also introduced for trial the node regarding the PR0  but I think is not reasonable because the PRUs needs firmware loaded from operating system (tested on k2g-ice and worked with OS running) and therefore not useful in u-boot.

    I would suppose that BOOTCFG_ETHERNET_CLKCTL configuration is distinct to dts setting but I could be wrong.

    I hope my explanation could be useful  in order to understand better the issue.

    Thank you for your support.

    Regards

    Graziano

  • Hi,

    I am conducting some tests on k2g_evm in order to replicate this issue also on this board. Effectively if you comment mdio and netcp node from keystone_k2g_evm.dts you can see the same behaviour as my custom board.

    At this point I don't understand how these modules can influence the behaviour of H23 pin that is related to BOOTCFG_ETHERNET_CLKCTL and BOOTCFG_NSS_PLL_CTL0/1 registers according to TRM.

    I hope it can help you.

    Regards

    Graziano

  • Hi again,

    at the end I have found the reason of this issue and applied a solution that effectively works and does not give problem at the moment. Making a comparison with k2g_evm (with mdio and netcp enabled in dts file) I have noted that NSS power module and clock module are enabled while these modules are disabled on my board. The registers to check are PDSTAT2 (0x02350208) and MDSTAT3 (0x0235080C). At this point I have added the following codes in /u-boot/<myvendor>/<myboard>/board_k2g.c:

    psc_enable_module(KS2_LPSC_NSS);
    
    __raw_writel(0x6,KS2_DEVICE_STATE_CTRL_BASE + 0x698);

    that enable NSS module and set BOOTCFG_ETHERNET_CLKCTL at 25MHz.

    My idea about that issue: it seems that mdio/netcp nodes defined in dts enable the NSS power/clock module automatically. If they are skipped in dts, a psc_enable_module() should be done in code if NSS functionalities are required as my case. Please let me know if my understading is correct or not. It is very importat to undestand better how the configuration of u-boot/kernel works about this processor in order to manage properly its features. 

    Regard

    Graziano 

  • Hi,

    I am glad to hear it is working. I will need to confer with colleagues. 

    Best Regards,

    Schuyler