Re: [linux-sunxi] Re: [PATCH 3/6] phy: Add driver to support individual USB PHYs on sun9i

2014-11-05 Thread Maxime Ripard
Hi Stefan,

Please keep me in Cc.

On Wed, Nov 05, 2014 at 08:27:41AM -0500, Stefan Monnier wrote:
> > Until some new SoC part of the sun9i family comes up, and it will just
> > add to the confusion.
> 
> Maybe, but then again maybe not.  It depends whether such a new member
> ever shows up, and whether it has a hardware that's compatible enough
> that the code doesn't need to be changed (seems unlikely).

Yeah, and in all cases, we won't be wrong. While if a new SoCs comes
out which is part of the sun9i (let's say A842), you'll have to select
an option that states that it is for the A80.

The list will be confusing for the user and/or a pain to maintain for
us.

> > Such a person would know that the A80 is part of the sun9i family if
> > it has some knowledge of the Allwinner SocS.  And if they don't, A80 or
> > sun9i or both won't make any kind of difference.
> 
> Actually, I'm fairly familiar with Allwinner's family of SoCs, but
> I kind of lost track of which Ann corresponds to which sunXi.  If I got
> a board, all the documentation would tell me that it's got an A80 on
> board, but not that it has a sun9i thingy on board.  So there's a good
> chance that a user knows "A80" but not "sun9i".

Good thing we do have a wiki page just for that then.

http://linux-sunxi.org/Allwinner_SoC_Family#Comparison_table

> And last I heard the sunXi designations are a bit unreliable since
> Allwinner renumbered them differently (is the A20 a sun7i or a sun8i).

It might have been both to Allwinner. It's always been sun7i for us.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


[linux-sunxi] Re: [PATCH 3/6] phy: Add driver to support individual USB PHYs on sun9i

2014-11-05 Thread Stefan Monnier
> Until some new SoC part of the sun9i family comes up, and it will just
> add to the confusion.

Maybe, but then again maybe not.  It depends whether such a new member
ever shows up, and whether it has a hardware that's compatible enough
that the code doesn't need to be changed (seems unlikely).

> Such a person would know that the A80 is part of the sun9i family if
> it has some knowledge of the Allwinner SocS.  And if they don't, A80 or
> sun9i or both won't make any kind of difference.

Actually, I'm fairly familiar with Allwinner's family of SoCs, but
I kind of lost track of which Ann corresponds to which sunXi.  If I got
a board, all the documentation would tell me that it's got an A80 on
board, but not that it has a sun9i thingy on board.  So there's a good
chance that a user knows "A80" but not "sun9i".
And last I heard the sunXi designations are a bit unreliable since
Allwinner renumbered them differently (is the A20 a sun7i or a sun8i).


Stefan

-- 
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.


[linux-sunxi] Re: [PATCH 3/6] phy: Add driver to support individual USB PHYs on sun9i

2014-11-05 Thread Chen-Yu Tsai
On Wed, Nov 5, 2014 at 1:03 AM, Maxime Ripard
 wrote:
> On Tue, Nov 04, 2014 at 12:07:16PM +0800, Chen-Yu Tsai wrote:
>> Unlike previous Allwinner SoCs, there is no central PHY control block
>> on the A80. Also, OTG support is completely split off into a different
>> controller.
>>
>> This adds a new driver to support the regular USB PHYs.
>>
>> Signed-off-by: Chen-Yu Tsai 
>> ---
>>  .../devicetree/bindings/phy/sun9i-usb-phy.txt  |  34 +++
>>  drivers/phy/Kconfig|  12 ++
>>  drivers/phy/Makefile   |   1 +
>>  drivers/phy/phy-sun9i-usb.c| 227 
>> +
>>  4 files changed, 274 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt
>>  create mode 100644 drivers/phy/phy-sun9i-usb.c
>>
>> diff --git a/Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt 
>> b/Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt
>> new file mode 100644
>> index 000..27a6067
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt
>> @@ -0,0 +1,34 @@
>> +Allwinner sun9i USB PHY
>> +---
>> +
>> +Required properties:
>> +- compatible : should be one of
>> +  * allwinner,sun9i-a80-usb-phy
>> +- reg : a list of offset + length pairs
>> +- #phy-cells : from the generic phy bindings, must be 0
>> +- clocks : phandle + clock specifier for the phy clocks
>> +- clock-names :
>> +  * "phy" for normal USB
>> +  * "hsic_480M", "hsic_12M" for HSIC
>
> Do you need all of them? phy and one of the hsic one?

It would be either "phy" or the hsic ones, depending on the
value of the "phy_type" property. I will make it clearer.

>> +- resets : a list of phandle + reset specifier pairs
>> +- reset-names :
>> +  * "phy" for normal USB
>> +  * "hsic" for HSIC
>> +- phy_type : "hsic" for HSIC usage;
>> +  other values or absence of this property indicates normal USB
>> +
>> +It is recommended to list all clocks and resets available.
>> +The driver will only use those matching the phy_type.
>> +
>> +Example:
>> + usbphy1: phy@00a01800 {
>> + compatible = "allwinner,sun9i-a80-usb-phy";
>> + reg = <0x00a01800 0x4>;
>> + clocks = <&usb_phy_clk 2>, <&usb_phy_clk 10>,
>> +<&usb_phy_clk 3>;
>> + clock-names = "hsic_480M", "hsic_12M", "phy";
>> + resets = <&usb_phy_clk 18>, <&usb_phy_clk 19>;
>> + reset-names = "hsic", "phy";
>> + status = "disabled";
>> + #phy-cells = <0>;
>> + };
>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
>> index 2a436e6..f5b7fbb 100644
>> --- a/drivers/phy/Kconfig
>> +++ b/drivers/phy/Kconfig
>> @@ -153,6 +153,18 @@ config PHY_SUN4I_USB
>> This driver controls the entire USB PHY block, both the USB OTG
>> parts, as well as the 2 regular USB 2 host PHYs.
>>
>> +config PHY_SUN9I_USB
>> + tristate "Allwinner sun9i SoC USB PHY driver"
>> + depends on ARCH_SUNXI && HAS_IOMEM && OF
>> + depends on RESET_CONTROLLER
>> + select USB_PHY
>> + select GENERIC_PHY
>> + help
>> +   Enable this to support the transceiver that is part of Allwinner
>> +   sun9i SoCs.
>> +
>> +   This driver controls each individual USB 2 host PHY.
>> +
>>  config PHY_SAMSUNG_USB2
>>   tristate "Samsung USB 2.0 PHY driver"
>>   depends on HAS_IOMEM
>> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
>> index c4590fc..c3977dc 100644
>> --- a/drivers/phy/Makefile
>> +++ b/drivers/phy/Makefile
>> @@ -17,6 +17,7 @@ obj-$(CONFIG_TWL4030_USB)   += phy-twl4030-usb.o
>>  obj-$(CONFIG_PHY_EXYNOS5250_SATA)+= phy-exynos5250-sata.o
>>  obj-$(CONFIG_PHY_HIX5HD2_SATA)   += phy-hix5hd2-sata.o
>>  obj-$(CONFIG_PHY_SUN4I_USB)  += phy-sun4i-usb.o
>> +obj-$(CONFIG_PHY_SUN9I_USB)  += phy-sun9i-usb.o
>>  obj-$(CONFIG_PHY_SAMSUNG_USB2)   += phy-exynos-usb2.o
>>  phy-exynos-usb2-y+= phy-samsung-usb2.o
>>  phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4210_USB2)+= 
>> phy-exynos4210-usb2.o
>> diff --git a/drivers/phy/phy-sun9i-usb.c b/drivers/phy/phy-sun9i-usb.c
>> new file mode 100644
>> index 000..f9085d9
>> --- /dev/null
>> +++ b/drivers/phy/phy-sun9i-usb.c
>> @@ -0,0 +1,227 @@
>> +/*
>> + * Allwinner sun9i USB phy driver
>> + *
>> + * Copyright (C) 2014 Chen-Yu Tsai 
>> + *
>> + * Based on phy-sun9i.c from
>
> I doubt this is the file you were thinking of :)

This is what happens when you do a global replace. :|

>> + * Hans de Goede 
>> + *
>> + * and code from
>> + * Allwinner Technology Co., Ltd. 
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in t

[linux-sunxi] Re: [PATCH 3/6] phy: Add driver to support individual USB PHYs on sun9i

2014-11-04 Thread Maxime Ripard
On Tue, Nov 04, 2014 at 12:07:16PM +0800, Chen-Yu Tsai wrote:
> Unlike previous Allwinner SoCs, there is no central PHY control block
> on the A80. Also, OTG support is completely split off into a different
> controller.
> 
> This adds a new driver to support the regular USB PHYs.
> 
> Signed-off-by: Chen-Yu Tsai 
> ---
>  .../devicetree/bindings/phy/sun9i-usb-phy.txt  |  34 +++
>  drivers/phy/Kconfig|  12 ++
>  drivers/phy/Makefile   |   1 +
>  drivers/phy/phy-sun9i-usb.c| 227 
> +
>  4 files changed, 274 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt
>  create mode 100644 drivers/phy/phy-sun9i-usb.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt 
> b/Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt
> new file mode 100644
> index 000..27a6067
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/sun9i-usb-phy.txt
> @@ -0,0 +1,34 @@
> +Allwinner sun9i USB PHY
> +---
> +
> +Required properties:
> +- compatible : should be one of
> +  * allwinner,sun9i-a80-usb-phy
> +- reg : a list of offset + length pairs
> +- #phy-cells : from the generic phy bindings, must be 0
> +- clocks : phandle + clock specifier for the phy clocks
> +- clock-names :
> +  * "phy" for normal USB
> +  * "hsic_480M", "hsic_12M" for HSIC

Do you need all of them? phy and one of the hsic one?

> +- resets : a list of phandle + reset specifier pairs
> +- reset-names :
> +  * "phy" for normal USB
> +  * "hsic" for HSIC
> +- phy_type : "hsic" for HSIC usage;
> +  other values or absence of this property indicates normal USB
> +
> +It is recommended to list all clocks and resets available.
> +The driver will only use those matching the phy_type.
> +
> +Example:
> + usbphy1: phy@00a01800 {
> + compatible = "allwinner,sun9i-a80-usb-phy";
> + reg = <0x00a01800 0x4>;
> + clocks = <&usb_phy_clk 2>, <&usb_phy_clk 10>,
> +<&usb_phy_clk 3>;
> + clock-names = "hsic_480M", "hsic_12M", "phy";
> + resets = <&usb_phy_clk 18>, <&usb_phy_clk 19>;
> + reset-names = "hsic", "phy";
> + status = "disabled";
> + #phy-cells = <0>;
> + };
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 2a436e6..f5b7fbb 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -153,6 +153,18 @@ config PHY_SUN4I_USB
> This driver controls the entire USB PHY block, both the USB OTG
> parts, as well as the 2 regular USB 2 host PHYs.
>  
> +config PHY_SUN9I_USB
> + tristate "Allwinner sun9i SoC USB PHY driver"
> + depends on ARCH_SUNXI && HAS_IOMEM && OF
> + depends on RESET_CONTROLLER
> + select USB_PHY
> + select GENERIC_PHY
> + help
> +   Enable this to support the transceiver that is part of Allwinner
> +   sun9i SoCs.
> +
> +   This driver controls each individual USB 2 host PHY.
> +
>  config PHY_SAMSUNG_USB2
>   tristate "Samsung USB 2.0 PHY driver"
>   depends on HAS_IOMEM
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index c4590fc..c3977dc 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -17,6 +17,7 @@ obj-$(CONFIG_TWL4030_USB)   += phy-twl4030-usb.o
>  obj-$(CONFIG_PHY_EXYNOS5250_SATA)+= phy-exynos5250-sata.o
>  obj-$(CONFIG_PHY_HIX5HD2_SATA)   += phy-hix5hd2-sata.o
>  obj-$(CONFIG_PHY_SUN4I_USB)  += phy-sun4i-usb.o
> +obj-$(CONFIG_PHY_SUN9I_USB)  += phy-sun9i-usb.o
>  obj-$(CONFIG_PHY_SAMSUNG_USB2)   += phy-exynos-usb2.o
>  phy-exynos-usb2-y+= phy-samsung-usb2.o
>  phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4210_USB2)+= phy-exynos4210-usb2.o
> diff --git a/drivers/phy/phy-sun9i-usb.c b/drivers/phy/phy-sun9i-usb.c
> new file mode 100644
> index 000..f9085d9
> --- /dev/null
> +++ b/drivers/phy/phy-sun9i-usb.c
> @@ -0,0 +1,227 @@
> +/*
> + * Allwinner sun9i USB phy driver
> + *
> + * Copyright (C) 2014 Chen-Yu Tsai 
> + *
> + * Based on phy-sun9i.c from

I doubt this is the file you were thinking of :)

> + * Hans de Goede 
> + *
> + * and code from
> + * Allwinner Technology Co., Ltd. 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +