Eim configuration in Device Tree - imx6

Hello ,
We are still working on the Toradex IMX6 and Torizon OS.

We are trying to load our FPGA (xilinx Artix7) via the EIM bus. After checking, the EIM registers are not configured correctly and we are getting an error:

[    1.542652] imx-weim 21b8000.weim: Invalid 'ranges' configuration
[    1.542693] imx-weim: probe of 21b8000.weim failed with error -22

Here is our EIM node:

&weim {
    status = "okay";

    #address-cells = <2>;
    #size-cells = <1>;

    ranges = <0 0 0x08000000 0x02000000>;  /* Map CS0: 32 MB */

    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_weim_common>;

    fpga_prog: fpga_programmer@0,0 {
        compatible = "xlnx,fpga-xc7a-selectmap";
        pinctrl-names = "default", "device";
        pinctrl-0 = <&pinctrl_weim_prog>;

        reg = <0 0 0x02000000>;

        fsl,weim-cs-timing = <0x0061A081 0x00001002
                              0x0D022011 0x00000000
                              0x0D0B2000 0x00000000>;

        prog-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
        init-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
        done-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
        csi-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
        rdwr-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
    };
};

I’ve tried different configurations, but I always get the same error.

Do you have any idea what my mistake is? And how can I correct it?
Tks & Regards

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


I can help troubleshoot this EIM bus configuration issue. To provide the most accurate guidance, could you please specify which exact version of Torizon OS you are running? You can use the tdx-info command to get detailed information about your system configuration: tdx-info.

EIM Bus Configuration Analysis

Based on the available documentation for the External EIM Bus on Colibri iMX6(1), the error you’re encountering suggests an issue with the ranges property configuration in your device tree node.

Common Configuration Issues

The “Invalid ‘ranges’ configuration” error typically occurs when:

  1. Address mapping conflicts - The memory range specified conflicts with existing mappings
  2. Incorrect address format - The ranges property format doesn’t match the expected structure
  3. Memory region overlap - The specified region overlaps with reserved memory areas

Recommended Troubleshooting Steps

1. Verify Memory Mapping

Check that your memory range 0x08000000 with size 0x02000000 (32MB) doesn’t conflict with existing system memory mappings.

2. Review Device Tree Structure

Ensure your device tree follows the correct format for EIM bus configuration. The documentation shows that EIM base address should be properly defined(1).

3. Check Pin Configuration

Verify that your pinctrl_weim_common and pinctrl_weim_prog pin control groups are correctly defined and don’t conflict with other peripheral pin assignments.

4. Validate CS Timing Parameters

Review your fsl,weim-cs-timing parameters to ensure they match your FPGA’s timing requirements and are within acceptable ranges.

Additional Information Needed

To provide more specific guidance, please share:

  • Complete device tree overlay or modification
  • Pin control group definitions (pinctrl_weim_common, pinctrl_weim_prog)
  • Any other EIM-related configurations in your system

The EIM bus configuration can be complex and hardware-specific, so having your complete setup details will help identify the exact cause of the configuration error.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @slou26,

I am not very experienced with EIM driver integration. Usually our partners support our customers for such topics. Nevertheless, I took a look at our device tree files for Colibri iMX6DL (and also device tree for other imx6 based SOMs from other vendors) in the mainline kernel to see how the weim node is configured. In our deivce tree file for colibri imx6dl - /linux/arch/arm/boot/dts/nxp/imx/imx6dl-colibri-eval-v3.dts, this is how it is defiend:

&weim {
        status = "okay";

        /* weim memory map: 32MB on CS0, CS1, CS2 and CS3 */
        ranges = <0 0 0x08000000 0x02000000
                  1 0 0x0a000000 0x02000000
                  2 0 0x0c000000 0x02000000
                  3 0 0x0e000000 0x02000000>;

        /* SRAM on Colibri nEXT_CS0 */
        sram@0,0 {
                compatible = "cypress,cy7c1019dv33-10zsxi", "mtd-ram";
                reg = <0 0 0x00010000>;
                #address-cells = <1>;
                #size-cells = <1>;
                bank-width = <2>;
                fsl,weim-cs-timing = <0x00010081 0x00000000 0x04000000
                                      0x00000000 0x04000040 0x00000000>;
        };

        /* SRAM on Colibri nEXT_CS1 */
        sram@1,0 {
                compatible = "cypress,cy7c1019dv33-10zsxi", "mtd-ram";
                reg = <1 0 0x00010000>;
                #address-cells = <1>;
                #size-cells = <1>;
                bank-width = <2>;
                fsl,weim-cs-timing = <0x00010081 0x00000000 0x04000000
                                      0x00000000 0x04000040 0x00000000>;
        };
};

Also I looked in the driver code (linux/drivers/bus/imx-weim.c) to see where this error is thrown from. I see three situations (two of them with goto err and one if it does not get into the last for loop) in the following function:

static int imx_weim_gpr_setup(struct platform_device *pdev)
{
        struct device_node *np = pdev->dev.of_node;
        struct of_range_parser parser;
        struct of_range range;
        struct regmap *gpr;
        u32 gprvals[4] = {
                05,     /* CS0(128M) CS1(0M)  CS2(0M)  CS3(0M)  */
                033,    /* CS0(64M)  CS1(64M) CS2(0M)  CS3(0M)  */
                0113,   /* CS0(64M)  CS1(32M) CS2(32M) CS3(0M)  */
                01111,  /* CS0(32M)  CS1(32M) CS2(32M) CS3(32M) */
        };
        u32 gprval = 0;
        u32 val;
        int cs = 0;
        int i = 0;

        gpr = syscon_regmap_lookup_by_phandle(np, "fsl,weim-cs-gpr");
        if (IS_ERR(gpr)) {
                dev_dbg(&pdev->dev, "failed to find weim-cs-gpr\n");
                return 0;
        }

        if (of_range_parser_init(&parser, np))
                goto err;

        for_each_of_range(&parser, &range) {
                cs = range.bus_addr >> 32;
                val = (range.size / SZ_32M) | 1;
                gprval |= val << cs * 3;
                i++;
        }

        if (i == 0)
                goto err;

        for (i = 0; i < ARRAY_SIZE(gprvals); i++) {
                if (gprval == gprvals[i]) {
                        /* Found it. Set up IOMUXC_GPR1[11:0] with it. */
                        regmap_update_bits(gpr, IOMUXC_GPR1, 0xfff, gprval);
                        return 0;
                }
        }

err:
        dev_err(&pdev->dev, "Invalid 'ranges' configuration\n");
        return -EINVAL;
}

So my suggestion would be to take a look at what causes these errors in the driver function.
I also found in your node that you added:
pinctrl-names = "default", "device";
Not sure why you have device here, could you try with default only?