[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] i2c pass-through in mpsoc



Hi,

On 25/10/17 08:18, Jesús Lázaro wrote:
> On 24/10/17 16:05, Julien Grall wrote:

....

> I have added the compatibility for pd-i2c1 (compatible =
> "xlnx,zynqmp-genpd";) but the result is the same. I do not know if it
> should be there or not, I was following the example by Xilinx for the
> gem and it is not there.

So it looks like the I2C driver misses its clock (see below).

It requires a power-domain, which points to pd-i2c1, and that looks
fine. But that also means that it's not optional, so you need the
compatible in the pd-i2c1 node.

> What I mean by the node name is that the same kernel+rootfs, if launched
> normally (with its own devicetree) recognizes the i2c. When launched by
> Dom0, the only difference is the devicetree and does not load it.
> 
> The resulting deviceetree for Dom0, when inside Xen is:
> 
> #########################################################
> /dts-v1/;
> 
> / {
>         compatible = "xen,xenvm-4.8", "xen,xenvm";
>         model = "XENVM-4.8";
>         interrupt-parent = <0xfde8>;
>         #address-cells = <0x2>;
>         #size-cells = <0x2>;
> 
>         passthrough {
>                 compatible = "simple-bus";
>                 ranges;
>                 #address-cells = <0x2>;
>                 #size-cells = <0x2>;
> 
>                 misc_clk {
>                         compatible = "fixed-clock";
>                         #clock-cells = <0x0>;
>                         phandle = <0x2>;
>                         clock-frequency = <0x7735940>;
>                         linux,phandle = <0x2>;
>                 };

So you have a 125 MHz oscillator(?) here, using phandle 2.

> 
>                 i2c@ff030000 {
>                         power-domains = <0x1>;

Just for checking again: Failing to provide a working power-domain is
fatal to the device probe process, AFAIK. So are you positive that the
PD is working?

>                         compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
>                         clocks = <0x3 0x3e>;

And here it references clock 62 in phandle 3, which I can't find
anywhere. The only clock you have is fixed clock, with #clock-cells = 0,
so it can't be referenced like above.
So I guess there must be another clock (divider, PLL?), which takes the
oscillator as an input and provides a clock 62.

So either you are missing the clock node or are not showing it here? And
is there any debug output from the driver? From a brief look I see that
the probe should complain about missing properties. The only thing that
can fail silently is the MMIO mapping.
In general it might be helpful to add pr_info() calls to understand
where it's failing.

>                         status = "okay";
>                         #address-cells = <0x1>;
>                         interrupts = <0x0 0x12 0x4>;
>                         #size-cells = <0x0>;
>                         reg = <0x0 0xff030000 0x0 0x1000>;
>                         clock-frequency = <0x61a80>;

That is the 400KHz I2C bus *output* frequency, in case you wonder. So
it's no substitute to the input frequency.

>                 };
> 
>                 pd-i2c1 {
>                         compatible = "xlnx,zynqmp-genpd";

I can't find this compatible in the Linux tree. Do you have a driver for
that? Does it probe?

>                         phandle = <0x1>;
>                         pd-id = <0x26>;
>                         linux,phandle = <0x1>;
>                         #power-domain-cells = <0x0>;

>                 };
>         };
> 
>         memory@40000000 {
>                 device_type = "memory";
>                 reg = <0x0 0x40000000 0x0 0x10000000>;
>         };
> 
>         psci {
>                 compatible = "arm,psci-0.2", "arm,psci";
>                 cpu_on = <0x2>;
>                 cpu_off = <0x1>;
>                 method = "hvc";
>         };
> 
>         interrupt-controller@3001000 {
>                 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
>                 #interrupt-cells = <0x3>;
>                 #address-cells = <0x0>;
>                 phandle = <0xfde8>;
>                 reg = <0x0 0x3001000 0x0 0x1000 0x0 0x3002000 0x0 0x2000>;
>                 linux,phandle = <0xfde8>;
>                 interrupt-controller;
>         };
> 
>         chosen {
>                 bootargs = "console=hvc0 rdinit=/sbin/init";
>         };
> 
>         timer {
>                 compatible = "arm,armv8-timer";
>                 interrupt-parent = <0xfde8>;
>                 interrupts = <0x1 0xd 0xf08 0x1 0xe 0xf08 0x1 0xb 0xf08>;
>         };
> 
>         cpus {
>                 #address-cells = <0x1>;
>                 #size-cells = <0x0>;
> 
>                 cpu@0 {
>                         compatible = "arm,armv8";
>                         device_type = "cpu";
>                         enable-method = "psci";
>                         reg = <0x0>;
>                 };
>         };
> 
>         hypervisor {
>                 compatible = "xen,xen-4.8", "xen,xen";
>                 interrupt-parent = <0xfde8>;
>                 interrupts = <0x1 0xf 0xf08>;
>                 reg = <0x0 0x38000000 0x0 0x1000000>;
>         };
> };
> #########################################################
> 
> 
> I have also tried to change the i2c clocks part to <0x2 0x2> to match
> the misc clock phandle, but the result is the same.

That doesn't help, because phandle 2 is a fixed clock with
#clock-cells = <0>, so it doesn't take an argument.
You need some clock with #clock-cells = <1>, or replace that clock
specifier with a single <0x2> (though I doubt that this works correctly,
unless the clock is already enabled).

Cheers,
Andre.

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
https://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.