cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
87 Views
Registered: ‎09-13-2019

AXI GPIO probe deferral in driver, but works via sysfs

Jump to solution

Hi all,

I'm trying to adapt Avnet's "EMBV + PYTHON-1300-C Vivado HLS Reference Design" to a custom board with Zynq 7020. The design itself is based on Xilinx's Zynq Base TRD 2015.4 with added functionality to work with Python1300 camera sensor.

The hardware is working fine. I've tested with a bare-metal application. Now I'm trying to implement video pipeline example on Linux.

Kernel version: 4.0.0-xilinx (comes with PetaLinux 2015.4)

I have created an AXI GPIO module for some control pins (power on/off, etc.). Linux driver for camera sensor requests these GPIOs in probe function. However, I see the message "probe deferral" and it repeats 3 times. On the other hand I can access these GPIOs via sysfs and they work fine.

Here is the related kernel output:

of_get_named_gpiod_flags: parsed 'regv18-gpios' property of node '/amba_pl/onsemi_vita_cam@43c00000[0]' - status (-517)
PYTHON1300_RXIF 43c00000.onsemi_vita_cam: failed to parse regv18-gpios DT property
platform 43c00000.onsemi_vita_cam: Driver PYTHON1300_RXIF requests probe deferral

 

Device tree entry for AXI GPIO (automatically generated from Vivado design):

axi_gpio_0: gpio@41200000 {
	#gpio-cells = <3>;
	clock-names = "s_axi_aclk";
	clocks = <&clkc 15>;
	compatible = "xlnx,xps-gpio-1.00.a";
	gpio-controller ;
	reg = <0x41200000 0x10000>;
	xlnx,all-inputs = <0x0>;
	xlnx,all-inputs-2 = <0x0>;
	xlnx,all-outputs = <0x1>;
	xlnx,all-outputs-2 = <0x0>;
	xlnx,dout-default = <0x00000000>;
	xlnx,dout-default-2 = <0x00000000>;
	xlnx,gpio-width = <0x5>;
	xlnx,gpio2-width = <0x20>;
	xlnx,interrupt-present = <0x0>;
	xlnx,is-dual = <0x0>;
	xlnx,tri-default = <0xFFFFFFFF>;
	xlnx,tri-default-2 = <0xFFFFFFFF>;
};

 

Device tree entry for camera interface:

&onsemi_vita_cam_0 {
	compatible = "xlnx,v-python1300-rxif-3.1";
	clocks = <&clkc 16>;

	regv18-gpios  = <&axi_gpio_0 4 0 GPIO_ACTIVE_HIGH>;
	regv33-gpios  = <&axi_gpio_0 3 0 GPIO_ACTIVE_HIGH>;
	regvpix-gpios = <&axi_gpio_0 2 0 GPIO_ACTIVE_HIGH>;
	cam-oe-gpios  = <&axi_gpio_0 1 0 GPIO_ACTIVE_HIGH>;
	spi-oe-gpios  = <&axi_gpio_0 0 0 GPIO_ACTIVE_HIGH>;

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

		port@0 {
			reg = <0>;
			xlnx,video-format = <XVIP_VF_MONO_SENSOR>;
			xlnx,cfa-pattern = "rggb";
			xlnx,video-width = <8>;
			python_rxif_sink: endpoint {
				remote-endpoint = <&python_sensor_source>;
			};
		};
	
		port@1 {
			reg = <1>;
			xlnx,video-format = <XVIP_VF_MONO_SENSOR>;
			xlnx,cfa-pattern = "rggb";
			xlnx,video-width = <8>;
			python_rxif_source: endpoint {
				remote-endpoint = <&vcap_python_in>;
			};
		};
	};
};

 

Driver probe function for GPIOs:

static int xpython1300_rxif_parse_gpios(struct xpython1300_rxif_device *xpython1300_rxif)
{
	static const char * const prop_names[] = {
		"regv18-gpios", "regv33-gpios", "regvpix-gpios",
	};

	struct device *dev = xpython1300_rxif->xvip.dev;
	struct device_node *node = xpython1300_rxif->xvip.dev->of_node;
	int ret, i;

	for (i = 0; i < GPIO_NUM; i++) {
		enum of_gpio_flags of_flags;

		ret = of_get_named_gpio_flags(node, prop_names[i], 0, &of_flags);
		if (ret < 0) {
			dev_err(dev, "failed to parse %s DT property\n", prop_names[i]);
			return ret/*-EINVAL*/;
		}

		xpython1300_rxif->gpio[i].gpio = ret;
		xpython1300_rxif->gpio[i].level = (of_flags & OF_GPIO_ACTIVE_LOW) ? 0:1;
		dev_dbg(dev, "of_flags 0x%x level 0x%x\n", of_flags, xpython1300_rxif->gpio[i].level);
	}
	return 0;
}

 

As I said, when the function is called, of_get_named_gpio_flags returns "probe deferral". After that kernel tries 2 more times, but the result is the same. However, I can access these GPIOs via sysfs and control them.

What could be the reason for this?

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
52 Views
Registered: ‎09-13-2019

Ok, I think I've found what the issue is. The problem, as is the case for most of the issues like this, was version mismatch.

I'm using 2018.1 for Vivado and PetaLinux. But I needed to use external kernel source, which comes with PetaLinux 2015.4.

In the automatically generated "pl.dtsi" file, #gpio-cells property is set to 3. However, documentation (kernel 4.0.0) says that it should be 2. I've changed that and now it works.

&axi_gpio_0 {
	#gpio-cells = <2>;
};

 

Of course, better solution is to use the versions that match!

Cheers.

View solution in original post

0 Kudos
1 Reply
Highlighted
Observer
Observer
53 Views
Registered: ‎09-13-2019

Ok, I think I've found what the issue is. The problem, as is the case for most of the issues like this, was version mismatch.

I'm using 2018.1 for Vivado and PetaLinux. But I needed to use external kernel source, which comes with PetaLinux 2015.4.

In the automatically generated "pl.dtsi" file, #gpio-cells property is set to 3. However, documentation (kernel 4.0.0) says that it should be 2. I've changed that and now it works.

&axi_gpio_0 {
	#gpio-cells = <2>;
};

 

Of course, better solution is to use the versions that match!

Cheers.

View solution in original post

0 Kudos