Thanks Michal,

I will test proposed solution and will post the results.
But in general I prefer to get full USB OTG functionality.

For the moment:
root@egpr:~# cat /boot/config-4.5.2-sunxi | grep CONFIG_USB_MUSB_HOST
# CONFIG_USB_MUSB_HOST is not set

and:

                usb@01c13000 {
                        compatible = "allwinner,sun4i-a10-musb";
                        reg = <0x1c13000 0x400>;
                        clocks = <0x3 0x0>;
                        interrupts = <0x0 0x26 0x4>;
                        interrupt-names = "mc";
                        phys = <0x23 0x0>;
                        phy-names = "usb";
                        extcon = <0x23 0x0>;
                        allwinner,sram = <0x24 0x1>;
                        status = "okay";
                        dr_mode = "host";
                };

                phy@01c13400 {
                        #phy-cells = <0x1>;
                        compatible = "allwinner,sun7i-a20-usb-phy";
                        reg = <0x1c13400 0x10 0x1c14800 0x4 0x1c1c800 0x4>;
                        reg-names = "phy_ctrl", "pmu1", "pmu2";
                        clocks = <0x25 0x8>;
                        clock-names = "usb_phy";
                        resets = <0x25 0x0 0x25 0x1 0x25 0x2>;
                        reset-names = "usb0_reset", "usb1_reset", 
"usb2_reset";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x26 0x27>;
                        usb0_id_det-gpio = <0x1e 0x7 0x4 0x0>;
                        usb0_vbus_det-gpio = <0x1e 0x7 0x5 0x0>;
                        usb0_vbus-supply = <0x28>;
                        usb1_vbus-supply = <0x29>;
                        usb2_vbus-supply = <0x2a>;
                        linux,phandle = <0x23>;
                        phandle = <0x23>;
                };


                pinctrl@01c20800 {
...
                        usb0_id_detect_pin@0 {
                                allwinner,pins = "PH4";
                                allwinner,function = "gpio_in";
                                allwinner,drive = <0x0>;
                                allwinner,pull = <0x1>;
                                linux,phandle = <0x26>;
                                phandle = <0x26>;
                        };

                        usb0_vbus_detect_pin@0 {
                                allwinner,pins = "PH5";
                                allwinner,function = "gpio_in";
                                allwinner,drive = <0x0>;
                                allwinner,pull = <0x2>;
                                linux,phandle = <0x27>;
                                phandle = <0x27>;
                        };
                };
...
        usb0-vbus {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <0x3d>;
                regulator-name = "usb0-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                enable-active-high;
                gpio = <0x1e 0x2 0x11 0x0>;
                status = "okay";
                linux,phandle = <0x28>;
                phandle = <0x28>;
        };


sorry for the above code but I have used re-compiled dtb file for testing 
purposes.

Best regards
Chris

On Wednesday, May 4, 2016 at 1:26:14 PM UTC+3, Michal Suchanek wrote:
>
> On 14 September 2015 at 22:25, Maxime Ripard 
> <maxime...@free-electrons.com <javascript:>> wrote: 
> > On Thu, Sep 10, 2015 at 08:38:38PM +0200, Hans de Goede wrote: 
> >> Hi, 
> >> 
> >> On 10-09-15 20:30, Maxime Ripard wrote: 
> >> >On Thu, Sep 10, 2015 at 08:23:23PM +0200, Hans de Goede wrote: 
> >> >>Hi, 
> >> >> 
> >> >>On 04-09-15 08:43, Olliver Schinagl wrote: 
> >> >>>Hey Hans, 
> >> >>> 
> >> >>>On 07-08-15 10:45, Olliver Schinagl wrote: 
> >> >>>><snip> 
> >> >>>>>If you change the dr_mode to host then you _must_ also remove any 
> id_det and vbus_det 
> >> >>>>>gpio settings from the usb_phy node in the dts, as the sun4i phy 
> code detects 
> >> >>>>>host vs otg mode by checking for the presence of these. 
> >> >>>>Yes, this fixes it and makes it work. Thanks. 
> >> >>>> 
> >> >>>I've been going back to this and am wondering if this is something I 
> can look into to fix properly? E.g. if the dts sets dr_mode = host, can we 
> simply ignore the pins and treat them as unset? 
> >> >> 
> >> >>AFAIK you cannot unset something in dts. The only solution I 
> >> >>can comeup with is to add a dr_mode argument to the phy like 
> >> >>we already have for the otg controller itself. 
> >> >> 
> >> >>This is something which we likely need to do anyways to add 
> >> >>support for peripheral only mode, which we seem to need for 
> >> >>some "hdmi sticks". 
> >> > 
> >> >I haven't really followed the rest of the discussion, so sorry if you 
> >> >already talked about that, but why can't you just set the dr_mode to 
> >> >peripheral in such a case? 
> >> 
> >> This is about the usbphy code not the musb-controller code, which are 
> >> 2 different dts nodes, atm only the musb-controller node has a 
> >> dr_mode property, and the phy code decides between host-only 
> >> and otg mode based on whether an id pin is assigned or not. 
> >> 
> >> My proposal is to get rid of the id-pin hack to determine the mode 
> >> and add a dr_mode property to the usbphy dts node. 
> > 
> > I agree that we should get rid of that hack, especially since a lack 
> > of an ID pin might also be used on a peripheral-only device. 
> > 
> > However, we already have that information in the musb node, and 
> > duplicating the info seems error prone. We already have a custom 
> > function, maybe that's a case for another one, and that would allow to 
> > handle "hard" cases more easily (like CONFIG_USB_MUSB_HOST selected, 
> > with the otg node set to otg). 
> > 
>
> Hello, 
>
> was this solved somehow? 
>
> What problem is there with referencing the phy node? 
>
> Just like pinmux setting nodes and whatnot it can be named and 
> referenced by name. 
>
> Thanks 
>
> Michal 
>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to