Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 12/15] ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT
From: Mark Rutland @ 2013-01-25 10:08 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359080013-29189-13-git-send-email-horms+renesas@verge.net.au>

On Fri, Jan 25, 2013 at 02:13:30AM +0000, Simon Horman wrote:
> This allows the GIC interrupt controller of the sh73a0 SoC to be
> initialised using a flattened device tree blob.
> 
> It does not allow the INTC interrupt controller which is also present on
> the sh73a0 SoC to be enabled via device tree.  Nor does it handle sharing
> of interrupts between the GIC and INTC interrupt controllers.
> 
> This limits the usefulness of this code to applications which only wish to
> access devices which use interrupts that can be handled by the GIC
> interrupt controller. Other applications should, for now, continue using
> non-device tree initialisation of the sh72a0 interrupt controllers.
> 
> Includes update to use irqchip_init() by Thierry Reding
> 
> Cc: Thierry Reding <thierry.reding@avionic-design.de>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>  arch/arm/boot/dts/sh73a0.dtsi                |   33 ++++++++++++++++++++++++++
>  arch/arm/mach-shmobile/include/mach/common.h |    1 +
>  arch/arm/mach-shmobile/intc-sh73a0.c         |    9 +++++++
>  3 files changed, 43 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sh73a0.dtsi
> 
> diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
> new file mode 100644
> index 0000000..7dae1f4
> --- /dev/null
> +++ b/arch/arm/boot/dts/sh73a0.dtsi
> @@ -0,0 +1,33 @@
> +/*
> + * Device Tree Source for the SH73A0 SoC
> + *
> + * Copyright (C) 2012 Renesas Solutions Corp.
> + *
> + * This file is licensed under the terms of the GNU General Public License
> + * version 2.  This program is licensed "as is" without any warranty of any
> + * kind, whether express or implied.
> + */
> +
> +/include/ "skeleton.dtsi"
> +
> +/ {
> +	compatible = "renesas,sh73a0";
> +
> +	cpus {
> +		cpu at 0 {
> +			compatible = "arm,cortex-a9";
> +		};
> +		cpu at 1 {
> +			compatible = "arm,cortex-a9";
> +		};
> +	};

It would be good the have reg and device_type properties set for the cpu nodes,
so they're guaranteed to work with the logical map.

[...]

Thanks,
Mark.

^ permalink raw reply

* [GIT PULL] i.MX SoC updates for v3.9
From: Sascha Hauer @ 2013-01-25 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd, Olof,

Please pull the following (mostly clock relates) updates for v3.9.

Sascha

The following changes since commit a49f0d1ea3ec94fc7cf33a7c36a16343b74bd565:

  Linux 3.8-rc1 (2012-12-21 17:19:00 -0800)

are available in the git repository at:

  git://git.pengutronix.de/git/imx/linux-2.6.git tags/imx-soc

for you to fetch changes up to 3ea8098572280d16163a429e0f8dfd90492a5934:

  ARM: clk-imx35: Fix build warnings with W=1 (2013-01-25 11:12:38 +0100)

----------------------------------------------------------------
ARM i.MX SoC updates for next

Mostly clock related updates, most notably the conversion of
i.MX31 to a DT based lookup.

----------------------------------------------------------------
Fabio Estevam (4):
      ARM: Let CONFIG_MACH_IMX31_DT be built by default
      ARM: clk-imx31: Add dummy clock
      ARM: mx31: Replace clk_register_clkdev with clock DT lookup
      ARM: clk-imx35: Fix build warnings with W=1

Gwenhael Goavec-Merou (1):
      ARM: imx27: add a clock gate to activate SPLL clock

 .../devicetree/bindings/clock/imx31-clock.txt      |   91 ++++++++++++++++++++
 arch/arm/boot/dts/imx31.dtsi                       |   17 ++++
 arch/arm/configs/imx_v6_v7_defconfig               |    1 +
 arch/arm/mach-imx/clk-imx27.c                      |    7 +-
 arch/arm/mach-imx/clk-imx31.c                      |   15 +++-
 arch/arm/mach-imx/clk-imx35.c                      |    4 +-
 arch/arm/mach-imx/imx31-dt.c                       |   17 +---
 7 files changed, 129 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx31-clock.txt
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply

* [PATCH 1/3] pinctrl: add ethernet pin groups to r8a7740
From: Laurent Pinchart @ 2013-01-25 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359043653-11374-2-git-send-email-g.liakhovetski@gmx.de>

Hi Guennadi,

Thanks for the patch.

On Thursday 24 January 2013 17:07:31 Guennadi Liakhovetski wrote:
> r8a7740 SoCs have an integrated gigabit ethernet MAC. This patch adds two
> pin groups: base for 100mbps and additional pins for the gigabit mode.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c |   31 +++++++++++++++++++++++++++++++
> 1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index 4c92af8..d7f69dd 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -2052,6 +2052,29 @@ static const unsigned int mmc0_ctrl_1_mux[] = {
>  	MMC1_CMD_PORT104_MARK, MMC1_CLK_PORT103_MARK,
>  };
> 
> +static const unsigned int eth_base_pins[] = {
> +	203, 204, 205, 206, 207,
> +	183, 184,
> +	185, 186, 187, 188,
> +	171, 170, 169, 168,
> +	161, 163, 164, 174,
> +};
> +static const unsigned int eth_base_mux[] = {
> +	ET_TX_ER_MARK, ET_RX_ER_MARK, ET_CRS_MARK, ET_MDC_MARK, ET_MDIO_MARK,
> +	ET_TX_EN_MARK, ET_TX_CLK_MARK,
> +	ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
> +	ET_ETXD0_MARK, ET_ETXD1_MARK, ET_ETXD2_MARK, ET_ETXD3_MARK,
> +	ET_RX_DV_MARK, ET_COL_MARK, ET_PHY_INT_MARK, ET_RX_CLK_MARK,
> +};
> +static const unsigned int eth_gbit_pins[] = {
> +	189, 190, 191, 192,
> +	167, 166, 173, 172,
> +};
> +static const unsigned int eth_gbit_mux[] = {
> +	ET_ERXD4_MARK, ET_ERXD5_MARK, ET_ERXD6_MARK, ET_ERXD7_MARK,
> +	ET_ETXD4_MARK, ET_ETXD5_MARK, ET_ETXD6_MARK, ET_ETXD7_MARK,
> +};
> +
>  static const struct sh_pfc_pin_group pinmux_groups[] = {
>  	SH_PFC_PIN_GROUP(lcd0_data8),
>  	SH_PFC_PIN_GROUP(lcd0_data9),
> @@ -2100,6 +2123,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] =
> { SH_PFC_PIN_GROUP(mmc0_data4_1),
>  	SH_PFC_PIN_GROUP(mmc0_data8_1),
>  	SH_PFC_PIN_GROUP(mmc0_ctrl_1),
> +	SH_PFC_PIN_GROUP(eth_base),
> +	SH_PFC_PIN_GROUP(eth_gbit),
>  };
> 
>  static const char * const lcd0_groups[] = {
> @@ -2167,6 +2192,11 @@ static const char * const mmc0_groups[] = {
>  	"mmc0_ctrl_1",
>  };
> 
> +static const char * const eth_groups[] = {
> +	"eth_base",
> +	"eth_gbit",
> +};
> +

What about calling the groups mdio (for management), mii, gmii and rmii ? You 
can duplicate common pins in mii and gmii.

The WOL, GTK_CLK and LINK pins are missing BTW.

>  static const struct sh_pfc_function pinmux_functions[] = {
>  	SH_PFC_FUNCTION(lcd0),
>  	SH_PFC_FUNCTION(lcd1),
> @@ -2174,6 +2204,7 @@ static const struct sh_pfc_function pinmux_functions[]
> = { SH_PFC_FUNCTION(sdhi1),
>  	SH_PFC_FUNCTION(sdhi2),
>  	SH_PFC_FUNCTION(mmc0),
> +	SH_PFC_FUNCTION(eth),
>  };
> 
>  #define PINMUX_FN_BASE	ARRAY_SIZE(pinmux_pins)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
From: Laurent Pinchart @ 2013-01-25 10:21 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359043653-11374-3-git-send-email-g.liakhovetski@gmx.de>

Hi Guennadi,

On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> a binding and code to parse it, request the GPIO and take the PHY out of
> reset.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Cc: devicetree-discuss at lists.ozlabs.org
> Cc: netdev at vger.kernel.org
> ---
>  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
>  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
>  2 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> 100644
> --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> @@ -12,6 +12,7 @@ Required properties:
>  - interrupts:                   Interrupt mapping for the sh_eth interrupt
>                                  sources (vector id).
>  - phy-mode:              String, operation mode of the PHY interface.
> +- phy-reset-gpios:              PHY reset GPIO tuple

If you can't have more than one GPIO here, what about calling it phy-reset-
gpio ?

>  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
>  - sh-eth,register-type:         String, register type of sh_eth.
>                                  Please select "gigabit", "fast-sh4" or
> @@ -37,6 +38,7 @@ Example (armadillo800eva):
>  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
>  		interrupts = <0x500>;
>  		phy-mode = "mii";
> +		phy-reset-gpios = <&gpio 18 0>;
>  		sh-eth,edmac-endian = "little";
>  		sh-eth,register-type = "gigabit";
>  		sh-eth,phy-id = <0>;
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -20,6 +20,7 @@
>   *  the file called "COPYING".
>   */
> 
> +#include <linux/gpio.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> @@ -33,6 +34,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> +#include <linux/of_gpio.h>
>  #include <linux/of_platform.h>
>  #include <linux/of_address.h>
>  #include <linux/of_irq.h>
> @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
>  static struct sh_eth_plat_data *
>  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>  {
> -	int ret;
> +	int ret, gpio;
>  	const char *of_str;
>  	struct device_node *np = dev->of_node;
>  	struct sh_eth_plat_data *pdata;
> +	enum of_gpio_flags flags;
> 
>  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
>  					GFP_KERNEL);
> @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> *ndev) else
>  		pdata->needs_init = 0;
> 
> +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));

You could use devm_gpio_request_one() here.

Is there no need to reset the phy at runtime ?

> +
>  #ifdef CONFIG_OF_NET
>  	if (!is_valid_ether_addr(ndev->dev_addr)) {
>  		const char *macaddr = of_get_mac_address(np);
-- 
Regards,

Laurent Pinchart

^ permalink raw reply

* [PATCH 12/15] ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT
From: Mark Rutland @ 2013-01-25 10:22 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359086133-23357-13-git-send-email-horms+renesas@verge.net.au>

On Fri, Jan 25, 2013 at 03:55:30AM +0000, Simon Horman wrote:
> This allows the GIC interrupt controller of the sh73a0 SoC to be
> initialised using a flattened device tree blob.
> 
> It does not allow the INTC interrupt controller which is also present on
> the sh73a0 SoC to be enabled via device tree.  Nor does it handle sharing
> of interrupts between the GIC and INTC interrupt controllers.
> 
> This limits the usefulness of this code to applications which only wish to
> access devices which use interrupts that can be handled by the GIC
> interrupt controller. Other applications should, for now, continue using
> non-device tree initialisation of the sh72a0 interrupt controllers.
> 
> Includes update to use irqchip_init() by Thierry Reding
> 
> Cc: Thierry Reding <thierry.reding@avionic-design.de>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>  arch/arm/boot/dts/sh73a0.dtsi                |   33 ++++++++++++++++++++++++++
>  arch/arm/mach-shmobile/include/mach/common.h |    1 +
>  arch/arm/mach-shmobile/intc-sh73a0.c         |    9 +++++++
>  3 files changed, 43 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sh73a0.dtsi
> 
> diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
> new file mode 100644
> index 0000000..7dae1f4
> --- /dev/null
> +++ b/arch/arm/boot/dts/sh73a0.dtsi
> @@ -0,0 +1,33 @@
> +/*
> + * Device Tree Source for the SH73A0 SoC
> + *
> + * Copyright (C) 2012 Renesas Solutions Corp.
> + *
> + * This file is licensed under the terms of the GNU General Public License
> + * version 2.  This program is licensed "as is" without any warranty of any
> + * kind, whether express or implied.
> + */
> +
> +/include/ "skeleton.dtsi"
> +
> +/ {
> +	compatible = "renesas,sh73a0";
> +
> +	cpus {
> +		cpu at 0 {
> +			compatible = "arm,cortex-a9";
> +		};
> +		cpu at 1 {
> +			compatible = "arm,cortex-a9";
> +		};

I replied to v1, not realising you'd posted a v2:

It would be good to have the reg and device_type properties set here for the
logical map.

[...]

Thanks,
Mark.

^ permalink raw reply

* [PATCH v4 0/4] usb: musb/dwc3: add driver for control module
From: Kishon Vijay Abraham I @ 2013-01-25 10:23 UTC (permalink / raw)
  To: linux-arm-kernel

Added a new driver for the usb part of control module. This has an API
to power on the USB2 phy and an API to write to the mailbox depending on
whether MUSB has to act in host mode or in device mode.
Also added an API to power on usb3 phy (omap5).

Writing to control module registers for doing the above task which was
previously done in omap glue and in omap-usb2 phy is removed.

Changes from v3:
* Changed property names from "ti,has_mailbox" to "ti,has-mailbox" and 
  "ctrl_module" to "ctrl-module"
* Fixed a compiler warning.

Changes from v2:
* removed "ti,has_mailbox" and added "ti,type" to differentiate whether the
  control module has usb mailbox or usb3 phy power. omap4 has usb mailbox 
  in control module to notify events to the musb core and omap5 has usb3
  phy power register to power on usb3 phy.

* Added an API to power on USB3 PHY needed for OMAP5.

Changes from v1:
* renamed get_omap_control_dev to omap_get_control_dev

* created and exported a single API (omap_control_usb_set_mode) to change
  the usb mode

* Before writing to the otghs_control regster, the value from
  otghs_control regster is read and only the appropriate bits are set.

* In omap_init_control_usb, the indentation is now reduced as per Felipe's
  suggestion.

Changes from RFC:
* Used "#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)" instead of 
  "#if (defined(CONFIG_OMAP_CONTROL_USB) || \
				defined(CONFIG_OMAP_CONTROL_USB_MODULE))"

* return "-EADDRNOTAVAIL" if devm_request_and_ioremap fails.

* Removed the dt data from this patch series (I'll send that as a separate
series).

* added "ctrl_module" binding to usb otg glue and usb phy in the Documentaion.
  This binding is not planned to be used until an actual requirement for
  it arises.

This series was developed on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv

I've kept this patch series and all the patch series to follow in a single branch
git://gitorious.org/linux-usb/linux-usb.git omap5-with-palmas
(changes up to 23b4dfa2ab7052569cd88acc6383c4b1a8e8a482)

Did basic enumeration testing in omap4 panda, omap3 beagle and omap5 evm.

Kishon Vijay Abraham I (4):
  drivers: usb: phy: add a new driver for usb part of control module
  ARM: OMAP: devices: create device for usb part of control module
  ARM: OMAP2: MUSB: Specify omap4 has mailbox
  drivers: usb: start using the control module driver

 Documentation/devicetree/bindings/usb/omap-usb.txt |   34 ++-
 Documentation/devicetree/bindings/usb/usb-phy.txt  |   12 +-
 arch/arm/mach-omap2/devices.c                      |   45 +++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |   13 -
 arch/arm/mach-omap2/usb-musb.c                     |    3 +
 drivers/usb/musb/Kconfig                           |    1 +
 drivers/usb/musb/omap2430.c                        |   68 ++---
 drivers/usb/musb/omap2430.h                        |    9 -
 drivers/usb/phy/Kconfig                            |   11 +
 drivers/usb/phy/Makefile                           |    1 +
 drivers/usb/phy/omap-control-usb.c                 |  295 ++++++++++++++++++++
 drivers/usb/phy/omap-usb2.c                        |   41 +--
 include/linux/usb/musb.h                           |    2 +
 include/linux/usb/omap_control_usb.h               |   92 ++++++
 include/linux/usb/omap_usb.h                       |    4 +-
 15 files changed, 522 insertions(+), 109 deletions(-)
 create mode 100644 drivers/usb/phy/omap-control-usb.c
 create mode 100644 include/linux/usb/omap_control_usb.h

-- 
1.7.9.5

^ permalink raw reply

* [PATCH v4 1/4] drivers: usb: phy: add a new driver for usb part of control module
From: Kishon Vijay Abraham I @ 2013-01-25 10:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109440-2195-1-git-send-email-kishon@ti.com>

Added a new driver for the usb part of control module. This has an API
to power on the USB2 phy and an API to write to the mailbox depending on
whether MUSB has to act in host mode or in device mode.

Writing to control module registers for doing the above task which was
previously done in omap glue and in omap-usb2 phy will be removed.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |   30 +-
 Documentation/devicetree/bindings/usb/usb-phy.txt  |    5 +
 drivers/usb/phy/Kconfig                            |   10 +
 drivers/usb/phy/Makefile                           |    1 +
 drivers/usb/phy/omap-control-usb.c                 |  295 ++++++++++++++++++++
 include/linux/usb/omap_control_usb.h               |   92 ++++++
 6 files changed, 432 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/phy/omap-control-usb.c
 create mode 100644 include/linux/usb/omap_control_usb.h

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 29a043e..2d8c6c4 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -1,4 +1,4 @@
-OMAP GLUE
+OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
 
 OMAP MUSB GLUE
  - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
@@ -16,6 +16,10 @@ OMAP MUSB GLUE
  - power : Should be "50". This signifies the controller can supply upto
    100mA when operating in host mode.
 
+Optional properties:
+ - ctrl-module : phandle of the control module this glue uses to write to
+   mailbox
+
 SOC specific device node entry
 usb_otg_hs: usb_otg_hs at 4a0ab000 {
 	compatible = "ti,omap4-musb";
@@ -23,6 +27,7 @@ usb_otg_hs: usb_otg_hs at 4a0ab000 {
 	multipoint = <1>;
 	num_eps = <16>;
 	ram_bits = <12>;
+	ctrl-module = <&omap_control_usb>;
 };
 
 Board specific device node entry
@@ -31,3 +36,26 @@ Board specific device node entry
 	mode = <3>;
 	power = <50>;
 };
+
+OMAP CONTROL USB
+
+Required properties:
+ - compatible: Should be "ti,omap-control-usb"
+ - reg : Address and length of the register set for the device. It contains
+   the address of "control_dev_conf" and "otghs_control" or "phy_power_usb"
+   depending upon omap4 or omap5.
+ - reg-names: The names of the register addresses corresponding to the registers
+   filled in "reg".
+ - ti,type: This is used to differentiate whether the control module has
+   usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
+   notify events to the musb core and omap5 has usb3 phy power register to
+   power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
+   phy power.
+
+omap_control_usb: omap-control-usb at 4a002300 {
+	compatible = "ti,omap-control-usb";
+	reg = <0x4a002300 0x4>,
+	      <0x4a00233c 0x4>;
+	reg-names = "control_dev_conf", "otghs_control";
+	ti,type = <1>;
+};
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 80d4148..2466b6f 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -8,10 +8,15 @@ Required properties:
 add the address of control module dev conf register until a driver for
 control module is added
 
+Optional properties:
+ - ctrl-module : phandle of the control module used by PHY driver to power on
+   the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb2phy at 4a0ad080 {
 	compatible = "ti,omap-usb2";
 	reg = <0x4a0ad080 0x58>,
 	      <0x4a002300 0x4>;
+	ctrl-module = <&omap_control_usb>;
 };
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 36a85b6..65b6a80 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -14,6 +14,16 @@ config OMAP_USB2
 	  The USB OTG controller communicates with the comparator using this
 	  driver.
 
+config OMAP_CONTROL_USB
+	tristate "OMAP CONTROL USB Driver"
+	depends on ARCH_OMAP2PLUS
+	help
+	  Enable this to add support for the USB part present in the control
+	  module. This driver has API to power on the USB2 PHY and to write to
+	  the mailbox. The mailbox is present only in omap4 and the register to
+	  power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an
+	  additional register to power on USB3 PHY.
+
 config USB_ISP1301
 	tristate "NXP ISP1301 USB transceiver support"
 	depends on USB || USB_GADGET
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index ec304f6..ee97767 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -5,6 +5,7 @@
 ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_OMAP_USB2)			+= omap-usb2.o
+obj-$(CONFIG_OMAP_CONTROL_USB)		+= omap-control-usb.o
 obj-$(CONFIG_USB_ISP1301)		+= isp1301.o
 obj-$(CONFIG_MV_U3D_PHY)		+= mv_u3d_phy.o
 obj-$(CONFIG_USB_EHCI_TEGRA)	+= tegra_usb_phy.o
diff --git a/drivers/usb/phy/omap-control-usb.c b/drivers/usb/phy/omap-control-usb.c
new file mode 100644
index 0000000..e9b529f
--- /dev/null
+++ b/drivers/usb/phy/omap-control-usb.c
@@ -0,0 +1,295 @@
+/*
+ * omap-control-usb.c - The USB part of control module.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ *
+ * Author: Kishon Vijay Abraham I <kishon@ti.com>
+ *
+ * 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 <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/usb/omap_control_usb.h>
+
+static struct omap_control_usb *control_usb;
+
+/**
+ * omap_get_control_dev - returns the device pointer for this control device
+ *
+ * This API should be called to get the device pointer for this control
+ * module device. This device pointer should be used for called other
+ * exported API's in this driver.
+ *
+ * To be used by PHY driver and glue driver.
+ */
+struct device *omap_get_control_dev(void)
+{
+	if (!control_usb)
+		return ERR_PTR(-ENODEV);
+
+	return control_usb->dev;
+}
+EXPORT_SYMBOL_GPL(omap_get_control_dev);
+
+/**
+ * omap_control_usb3_phy_power - power on/off the serializer using control
+ *	module
+ * @dev: the control module device
+ * @on: 0 to off and 1 to on based on powering on or off the PHY
+ *
+ * usb3 PHY driver should call this API to power on or off the PHY.
+ */
+void omap_control_usb3_phy_power(struct device *dev, bool on)
+{
+	u32 val;
+	unsigned long rate;
+	struct omap_control_usb	*control_usb = dev_get_drvdata(dev);
+
+	if (control_usb->type != OMAP_CTRL_DEV_TYPE2)
+		return;
+
+	rate = clk_get_rate(control_usb->sys_clk);
+	rate = rate/1000000;
+
+	val = readl(control_usb->phy_power);
+
+	if (on) {
+		val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
+			OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
+		val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
+			OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+		val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
+	} else {
+		val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
+		val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
+			OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+	}
+
+	writel(val, control_usb->phy_power);
+}
+EXPORT_SYMBOL_GPL(omap_control_usb3_phy_power);
+
+/**
+ * omap_control_usb_phy_power - power on/off the phy using control module reg
+ * @dev: the control module device
+ * @on: 0 or 1, based on powering on or off the PHY
+ */
+void omap_control_usb_phy_power(struct device *dev, int on)
+{
+	u32 val;
+	struct omap_control_usb	*control_usb = dev_get_drvdata(dev);
+
+	val = readl(control_usb->dev_conf);
+
+	if (on)
+		val &= ~OMAP_CTRL_DEV_PHY_PD;
+	else
+		val |= OMAP_CTRL_DEV_PHY_PD;
+
+	writel(val, control_usb->dev_conf);
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
+
+/**
+ * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
+ * @ctrl_usb: struct omap_control_usb *
+ *
+ * Writes to the mailbox register to notify the usb core that a usb
+ * device has been connected.
+ */
+static void omap_control_usb_host_mode(struct omap_control_usb *ctrl_usb)
+{
+	u32 val;
+
+	val = readl(ctrl_usb->otghs_control);
+	val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND);
+	val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID;
+	writel(val, ctrl_usb->otghs_control);
+}
+
+/**
+ * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
+ * impedance
+ * @ctrl_usb: struct omap_control_usb *
+ *
+ * Writes to the mailbox register to notify the usb core that it has been
+ * connected to a usb host.
+ */
+static void omap_control_usb_device_mode(struct omap_control_usb *ctrl_usb)
+{
+	u32 val;
+
+	val = readl(ctrl_usb->otghs_control);
+	val &= ~OMAP_CTRL_DEV_SESSEND;
+	val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID |
+		OMAP_CTRL_DEV_VBUSVALID;
+	writel(val, ctrl_usb->otghs_control);
+}
+
+/**
+ * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
+ * impedance
+ * @ctrl_usb: struct omap_control_usb *
+ *
+ * Writes to the mailbox register to notify the usb core it's now in
+ * disconnected state.
+ */
+static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb)
+{
+	u32 val;
+
+	val = readl(ctrl_usb->otghs_control);
+	val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID);
+	val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND;
+	writel(val, ctrl_usb->otghs_control);
+}
+
+/**
+ * omap_control_usb_set_mode - Calls to functions to set USB in one of host mode
+ * or device mode or to denote disconnected state
+ * @dev: the control module device
+ * @mode: The mode to which usb should be configured
+ *
+ * This is an API to write to the mailbox register to notify the usb core that
+ * a usb device has been connected.
+ */
+void omap_control_usb_set_mode(struct device *dev,
+	enum omap_control_usb_mode mode)
+{
+	struct omap_control_usb	*ctrl_usb;
+
+	if (IS_ERR(dev) || control_usb->type != OMAP_CTRL_DEV_TYPE1)
+		return;
+
+	ctrl_usb = dev_get_drvdata(dev);
+
+	switch (mode) {
+	case USB_MODE_HOST:
+		omap_control_usb_host_mode(ctrl_usb);
+		break;
+	case USB_MODE_DEVICE:
+		omap_control_usb_device_mode(ctrl_usb);
+		break;
+	case USB_MODE_DISCONNECT:
+		omap_control_usb_set_sessionend(ctrl_usb);
+		break;
+	default:
+		dev_vdbg(dev, "invalid omap control usb mode\n");
+	}
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
+
+static int omap_control_usb_probe(struct platform_device *pdev)
+{
+	struct resource	*res;
+	struct device_node *np = pdev->dev.of_node;
+	struct omap_control_usb_platform_data *pdata = pdev->dev.platform_data;
+
+	control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
+		GFP_KERNEL);
+	if (!control_usb) {
+		dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
+		return -ENOMEM;
+	}
+
+	if (np) {
+		of_property_read_u32(np, "ti,type", &control_usb->type);
+	} else if (pdata) {
+		control_usb->type = pdata->type;
+	} else {
+		dev_err(&pdev->dev, "no pdata present\n");
+		return -EINVAL;
+	}
+
+	control_usb->dev	= &pdev->dev;
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+		"control_dev_conf");
+	control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res);
+	if (!control_usb->dev_conf) {
+		dev_err(&pdev->dev, "Failed to obtain io memory\n");
+		return -EADDRNOTAVAIL;
+	}
+
+	if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+			"otghs_control");
+		control_usb->otghs_control = devm_request_and_ioremap(
+			&pdev->dev, res);
+		if (!control_usb->otghs_control) {
+			dev_err(&pdev->dev, "Failed to obtain io memory\n");
+			return -EADDRNOTAVAIL;
+		}
+	}
+
+	if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+			"phy_power_usb");
+		control_usb->phy_power = devm_request_and_ioremap(
+			&pdev->dev, res);
+		if (!control_usb->phy_power) {
+			dev_dbg(&pdev->dev, "Failed to obtain io memory\n");
+			return -EADDRNOTAVAIL;
+		}
+
+		control_usb->sys_clk = devm_clk_get(control_usb->dev,
+			"sys_clkin");
+		if (IS_ERR(control_usb->sys_clk)) {
+			pr_err("%s: unable to get sys_clkin\n", __func__);
+			return -EINVAL;
+		}
+	}
+
+
+	dev_set_drvdata(control_usb->dev, control_usb);
+
+	return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id omap_control_usb_id_table[] = {
+	{ .compatible = "ti,omap-control-usb" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
+#endif
+
+static struct platform_driver omap_control_usb_driver = {
+	.probe		= omap_control_usb_probe,
+	.driver		= {
+		.name	= "omap-control-usb",
+		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(omap_control_usb_id_table),
+	},
+};
+
+static int __init omap_control_usb_init(void)
+{
+	return platform_driver_register(&omap_control_usb_driver);
+}
+subsys_initcall(omap_control_usb_init);
+
+static void __exit omap_control_usb_exit(void)
+{
+	platform_driver_unregister(&omap_control_usb_driver);
+}
+module_exit(omap_control_usb_exit);
+
+MODULE_ALIAS("platform: omap_control_usb");
+MODULE_AUTHOR("Texas Instruments Inc.");
+MODULE_DESCRIPTION("OMAP Control Module USB Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
new file mode 100644
index 0000000..84c90aa
--- /dev/null
+++ b/include/linux/usb/omap_control_usb.h
@@ -0,0 +1,92 @@
+/*
+ * omap_control_usb.h - Header file for the USB part of control module.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ *
+ * Author: Kishon Vijay Abraham I <kishon@ti.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __OMAP_CONTROL_USB_H__
+#define __OMAP_CONTROL_USB_H__
+
+struct omap_control_usb {
+	struct device *dev;
+
+	u32 __iomem *dev_conf;
+	u32 __iomem *otghs_control;
+	u32 __iomem *phy_power;
+
+	struct clk *sys_clk;
+
+	u32 type;
+};
+
+struct omap_control_usb_platform_data {
+	u8 type;
+};
+
+enum omap_control_usb_mode {
+	USB_MODE_UNDEFINED = 0,
+	USB_MODE_HOST,
+	USB_MODE_DEVICE,
+	USB_MODE_DISCONNECT,
+};
+
+/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
+#define	OMAP_CTRL_DEV_TYPE1		0x1
+#define	OMAP_CTRL_DEV_TYPE2		0x2
+
+#define	OMAP_CTRL_DEV_PHY_PD		BIT(0)
+
+#define	OMAP_CTRL_DEV_AVALID		BIT(0)
+#define	OMAP_CTRL_DEV_BVALID		BIT(1)
+#define	OMAP_CTRL_DEV_VBUSVALID		BIT(2)
+#define	OMAP_CTRL_DEV_SESSEND		BIT(3)
+#define	OMAP_CTRL_DEV_IDDIG		BIT(4)
+
+#define	OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK	0x003FC000
+#define	OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT	0xE
+
+#define	OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK	0xFFC00000
+#define	OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT	0x16
+
+#define	OMAP_CTRL_USB3_PHY_TX_RX_POWERON	0x3
+#define	OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF	0x0
+
+#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
+extern struct device *omap_get_control_dev(void);
+extern void omap_control_usb_phy_power(struct device *dev, int on);
+extern void omap_control_usb3_phy_power(struct device *dev, bool on);
+extern void omap_control_usb_set_mode(struct device *dev,
+	enum omap_control_usb_mode mode);
+#else
+static inline struct device *omap_get_control_dev()
+{
+	return ERR_PTR(-ENODEV);
+}
+
+static inline void omap_control_usb_phy_power(struct device *dev, int on)
+{
+}
+
+static inline void omap_control_usb3_phy_power(struct device *dev, int on)
+{
+}
+
+static inline void omap_control_usb_set_mode(struct device *dev,
+	enum omap_control_usb_mode mode)
+{
+}
+#endif
+
+#endif	/* __OMAP_CONTROL_USB_H__ */
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v4 2/4] ARM: OMAP: devices: create device for usb part of control module
From: Kishon Vijay Abraham I @ 2013-01-25 10:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109440-2195-1-git-send-email-kishon@ti.com>

A seperate driver has been added to handle the usb part of control
module. A device for the above driver is created here, using the register
address information to be used by the driver for powering on the PHY and
for writing to the mailbox.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/mach-omap2/devices.c |   45 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5e304d0..6a450a3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -20,6 +20,7 @@
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/omap4-keypad.h>
 #include <linux/platform_data/omap_ocp2scp.h>
+#include <linux/usb/omap_control_usb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -254,6 +255,49 @@ static inline void omap_init_camera(void)
 #endif
 }
 
+#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
+static struct omap_control_usb_platform_data omap4_control_usb_pdata = {
+	.type = 1,
+};
+
+struct resource omap4_control_usb_res[] = {
+	{
+		.name	= "control_dev_conf",
+		.start	= 0x4a002300,
+		.end	= 0x4a002303,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "otghs_control",
+		.start	= 0x4a00233c,
+		.end	= 0x4a00233f,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device omap4_control_usb = {
+	.name		= "omap-control-usb",
+	.id		= -1,
+	.dev = {
+		.platform_data = &omap4_control_usb_pdata,
+	},
+	.num_resources = 2,
+	.resource = omap4_control_usb_res,
+};
+
+static inline void __init omap_init_control_usb(void)
+{
+	if (!cpu_is_omap44xx())
+		return;
+
+	if (platform_device_register(&omap4_control_usb))
+		pr_err("Error registering omap_control_usb device\n");
+}
+
+#else
+static inline void omap_init_control_usb(void) { }
+#endif /* CONFIG_OMAP_CONTROL_USB */
+
 int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 			*sdp4430_keypad_data, struct omap_board_data *bdata)
 {
@@ -721,6 +765,7 @@ static int __init omap2_init_devices(void)
 	omap_init_mbox();
 	/* If dtb is there, the devices will be created dynamically */
 	if (!of_have_populated_dt()) {
+		omap_init_control_usb();
 		omap_init_dmic();
 		omap_init_mcpdm();
 		omap_init_mcspi();
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v4 3/4] ARM: OMAP2: MUSB: Specify omap4 has mailbox
From: Kishon Vijay Abraham I @ 2013-01-25 10:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109440-2195-1-git-send-email-kishon@ti.com>

Added has_mailbox to the musb platform data to specify that omap uses
an external mailbox (in control module) to communicate with the musb
core during device connect and disconnect.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/mach-omap2/usb-musb.c |    3 +++
 include/linux/usb/musb.h       |    2 ++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 7b33b37..9d27e3f 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -85,6 +85,9 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
 	musb_plat.mode = board_data->mode;
 	musb_plat.extvbus = board_data->extvbus;
 
+	if (cpu_is_omap44xx())
+		musb_plat.has_mailbox = true;
+
 	if (soc_is_am35xx()) {
 		oh_name = "am35x_otg_hs";
 		name = "musb-am35x";
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index eb50525..053c268 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,6 +99,8 @@ struct musb_hdrc_platform_data {
 	/* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
 	u8		mode;
 
+	u8		has_mailbox:1;
+
 	/* for clk_get() */
 	const char	*clock;
 
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v4 4/4] drivers: usb: start using the control module driver
From: Kishon Vijay Abraham I @ 2013-01-25 10:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109440-2195-1-git-send-email-kishon@ti.com>

Start using the control module driver for powering on the PHY and for
writing to the mailbox instead of writing to the control module
registers on their own.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |    4 ++
 Documentation/devicetree/bindings/usb/usb-phy.txt  |    7 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |   13 ----
 drivers/usb/musb/Kconfig                           |    1 +
 drivers/usb/musb/omap2430.c                        |   68 +++++++-------------
 drivers/usb/musb/omap2430.h                        |    9 ---
 drivers/usb/phy/Kconfig                            |    1 +
 drivers/usb/phy/omap-usb2.c                        |   41 +++---------
 include/linux/usb/omap_usb.h                       |    4 +-
 9 files changed, 40 insertions(+), 108 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 2d8c6c4..704b684 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -3,6 +3,9 @@ OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
 OMAP MUSB GLUE
  - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
  - ti,hwmods : must be "usb_otg_hs"
+ - ti,has-mailbox : to specify that omap uses an external mailbox
+   (in control module) to communicate with the musb core during device connect
+   and disconnect.
  - multipoint : Should be "1" indicating the musb controller supports
    multipoint. This is a MUSB configuration-specific setting.
  - num_eps : Specifies the number of endpoints. This is also a
@@ -24,6 +27,7 @@ SOC specific device node entry
 usb_otg_hs: usb_otg_hs at 4a0ab000 {
 	compatible = "ti,omap4-musb";
 	ti,hwmods = "usb_otg_hs";
+	ti,has-mailbox;
 	multipoint = <1>;
 	num_eps = <16>;
 	ram_bits = <12>;
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 2466b6f..48761a2 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -4,9 +4,7 @@ OMAP USB2 PHY
 
 Required properties:
  - compatible: Should be "ti,omap-usb2"
- - reg : Address and length of the register set for the device. Also
-add the address of control module dev conf register until a driver for
-control module is added
+ - reg : Address and length of the register set for the device.
 
 Optional properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -16,7 +14,6 @@ This is usually a subnode of ocp2scp to which it is connected.
 
 usb2phy at 4a0ad080 {
 	compatible = "ti,omap-usb2";
-	reg = <0x4a0ad080 0x58>,
-	      <0x4a002300 0x4>;
+	reg = <0x4a0ad080 0x58>;
 	ctrl-module = <&omap_control_usb>;
 };
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 129d508..103f4ba 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2698,13 +2698,6 @@ static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
 		.end		= 0x4a0ae000,
 		.flags		= IORESOURCE_MEM,
 	},
-	{
-		/* XXX: Remove this once control module driver is in place */
-		.name		= "ctrl_dev",
-		.start		= 0x4a002300,
-		.end		= 0x4a002303,
-		.flags		= IORESOURCE_MEM,
-	},
 	{ }
 };
 
@@ -6152,12 +6145,6 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
 		.pa_end		= 0x4a0ab7ff,
 		.flags		= ADDR_TYPE_RT
 	},
-	{
-		/* XXX: Remove this once control module driver is in place */
-		.pa_start	= 0x4a00233c,
-		.pa_end		= 0x4a00233f,
-		.flags		= ADDR_TYPE_RT
-	},
 	{ }
 };
 
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 23a0b7f..de6e5ce 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC
 	select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX)
 	select TWL4030_USB if MACH_OMAP_3430SDP
 	select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
+	select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
 	select USB_OTG_UTILS
 	help
 	  Say Y here if your system has a dual role high speed USB
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index da00af4..88a601b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -37,6 +37,7 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/usb/musb-omap.h>
+#include <linux/usb/omap_control_usb.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
@@ -46,7 +47,7 @@ struct omap2430_glue {
 	struct platform_device	*musb;
 	enum omap_musb_vbus_id_status status;
 	struct work_struct	omap_musb_mailbox_work;
-	u32 __iomem		*control_otghs;
+	struct device		*control_otghs;
 };
 #define glue_to_musb(g)		platform_get_drvdata(g->musb)
 
@@ -54,26 +55,6 @@ struct omap2430_glue		*_glue;
 
 static struct timer_list musb_idle_timer;
 
-/**
- * omap4_usb_phy_mailbox - write to usb otg mailbox
- * @glue: struct omap2430_glue *
- * @val: the value to be written to the mailbox
- *
- * On detection of a device (ID pin is grounded), this API should be called
- * to set AVALID, VBUSVALID and ID pin is grounded.
- *
- * When OMAP is connected to a host (OMAP in device mode), this API
- * is called to set AVALID, VBUSVALID and ID pin in high impedance.
- *
- * XXX: This function will be removed once we have a seperate driver for
- * control module
- */
-static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
-{
-	if (glue->control_otghs)
-		writel(val, glue->control_otghs);
-}
-
 static void musb_do_idle(unsigned long _musb)
 {
 	struct musb	*musb = (void *)_musb;
@@ -269,7 +250,6 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
-	u32 val;
 	struct musb *musb = glue_to_musb(glue);
 	struct device *dev = musb->controller;
 	struct musb_hdrc_platform_data *pdata = dev->platform_data;
@@ -285,8 +265,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_ID;
 		if (musb->gadget_driver) {
 			pm_runtime_get_sync(dev);
-			val = AVALID | VBUSVALID;
-			omap4_usb_phy_mailbox(glue, val);
+			omap_control_usb_set_mode(glue->control_otghs,
+				USB_MODE_HOST);
 			omap2430_musb_set_vbus(musb, 1);
 		}
 		break;
@@ -299,8 +279,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_VBUS;
 		if (musb->gadget_driver)
 			pm_runtime_get_sync(dev);
-		val = IDDIG | AVALID | VBUSVALID;
-		omap4_usb_phy_mailbox(glue, val);
+		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
 		break;
 
 	case OMAP_MUSB_ID_FLOAT:
@@ -317,8 +296,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 			if (musb->xceiv->otg->set_vbus)
 				otg_set_vbus(musb->xceiv->otg, 0);
 		}
-		val = SESSEND | IDDIG;
-		omap4_usb_phy_mailbox(glue, val);
+		omap_control_usb_set_mode(glue->control_otghs,
+			USB_MODE_DISCONNECT);
 		break;
 	default:
 		dev_dbg(dev, "ID float\n");
@@ -415,7 +394,6 @@ err1:
 static void omap2430_musb_enable(struct musb *musb)
 {
 	u8		devctl;
-	u32		val;
 	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
 	struct device *dev = musb->controller;
 	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
@@ -425,8 +403,7 @@ static void omap2430_musb_enable(struct musb *musb)
 	switch (glue->status) {
 
 	case OMAP_MUSB_ID_GROUND:
-		val = AVALID | VBUSVALID;
-		omap4_usb_phy_mailbox(glue, val);
+		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
 		if (data->interface_type != MUSB_INTERFACE_UTMI)
 			break;
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -445,8 +422,7 @@ static void omap2430_musb_enable(struct musb *musb)
 		break;
 
 	case OMAP_MUSB_VBUS_VALID:
-		val = IDDIG | AVALID | VBUSVALID;
-		omap4_usb_phy_mailbox(glue, val);
+		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
 		break;
 
 	default:
@@ -456,14 +432,12 @@ static void omap2430_musb_enable(struct musb *musb)
 
 static void omap2430_musb_disable(struct musb *musb)
 {
-	u32 val;
 	struct device *dev = musb->controller;
 	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
 
-	if (glue->status != OMAP_MUSB_UNKNOWN) {
-		val = SESSEND | IDDIG;
-		omap4_usb_phy_mailbox(glue, val);
-	}
+	if (glue->status != OMAP_MUSB_UNKNOWN)
+		omap_control_usb_set_mode(glue->control_otghs,
+			USB_MODE_DISCONNECT);
 }
 
 static int omap2430_musb_exit(struct musb *musb)
@@ -498,7 +472,6 @@ static int omap2430_probe(struct platform_device *pdev)
 	struct omap2430_glue		*glue;
 	struct device_node		*np = pdev->dev.of_node;
 	struct musb_hdrc_config		*config;
-	struct resource			*res;
 	int				ret = -ENOMEM;
 
 	glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
@@ -521,12 +494,6 @@ static int omap2430_probe(struct platform_device *pdev)
 	glue->musb			= musb;
 	glue->status			= OMAP_MUSB_UNKNOWN;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-
-	glue->control_otghs = devm_request_and_ioremap(&pdev->dev, res);
-	if (glue->control_otghs == NULL)
-		dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
-
 	if (np) {
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata) {
@@ -558,11 +525,22 @@ static int omap2430_probe(struct platform_device *pdev)
 		of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
 		of_property_read_u32(np, "power", (u32 *)&pdata->power);
 		config->multipoint = of_property_read_bool(np, "multipoint");
+		pdata->has_mailbox = of_property_read_bool(np,
+		    "ti,has-mailbox");
 
 		pdata->board_data	= data;
 		pdata->config		= config;
 	}
 
+	if (pdata->has_mailbox) {
+		glue->control_otghs = omap_get_control_dev();
+		if (IS_ERR(glue->control_otghs)) {
+			dev_vdbg(&pdev->dev, "Failed to get control device\n");
+			return -ENODEV;
+		}
+	} else {
+		glue->control_otghs = ERR_PTR(-ENODEV);
+	}
 	pdata->platform_ops		= &omap2430_ops;
 
 	platform_set_drvdata(pdev, glue);
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index 8ef6566..1b5e83a 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -49,13 +49,4 @@
 #define OTG_FORCESTDBY		0x414
 #	define	ENABLEFORCE		(1 << 0)
 
-/*
- * Control Module bit definitions
- * XXX: Will be removed once we have a driver for control module.
- */
-#define	AVALID				BIT(0)
-#define	BVALID				BIT(1)
-#define	VBUSVALID			BIT(2)
-#define	SESSEND				BIT(3)
-#define	IDDIG				BIT(4)
 #endif	/* __MUSB_OMAP243X_H__ */
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 65b6a80..fe6f616 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -8,6 +8,7 @@ config OMAP_USB2
 	tristate "OMAP USB2 PHY Driver"
 	depends on ARCH_OMAP2PLUS
 	select USB_OTG_UTILS
+	select OMAP_CONTROL_USB
 	help
 	  Enable this to support the transceiver that is part of SOC. This
 	  driver takes care of all the PHY functionality apart from comparator.
diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
index 26ae8f4..c2b4c8e 100644
--- a/drivers/usb/phy/omap-usb2.c
+++ b/drivers/usb/phy/omap-usb2.c
@@ -27,6 +27,7 @@
 #include <linux/err.h>
 #include <linux/pm_runtime.h>
 #include <linux/delay.h>
+#include <linux/usb/omap_control_usb.h>
 
 /**
  * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -52,29 +53,6 @@ int omap_usb2_set_comparator(struct phy_companion *comparator)
 }
 EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
 
-/**
- * omap_usb_phy_power - power on/off the phy using control module reg
- * @phy: struct omap_usb *
- * @on: 0 or 1, based on powering on or off the PHY
- *
- * XXX: Remove this function once control module driver gets merged
- */
-static void omap_usb_phy_power(struct omap_usb *phy, int on)
-{
-	u32 val;
-
-	if (on) {
-		val = readl(phy->control_dev);
-		if (val & PHY_PD) {
-			writel(~PHY_PD, phy->control_dev);
-			/* XXX: add proper documentation for this delay */
-			mdelay(200);
-		}
-	} else {
-		writel(PHY_PD, phy->control_dev);
-	}
-}
-
 static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
 {
 	struct omap_usb *phy = phy_to_omapusb(otg->phy);
@@ -124,7 +102,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
 	struct omap_usb *phy = phy_to_omapusb(x);
 
 	if (suspend && !phy->is_suspended) {
-		omap_usb_phy_power(phy, 0);
+		omap_control_usb_phy_power(phy->control_dev, 0);
 		pm_runtime_put_sync(phy->dev);
 		phy->is_suspended = 1;
 	} else if (!suspend && phy->is_suspended) {
@@ -134,7 +112,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
 									ret);
 			return ret;
 		}
-		omap_usb_phy_power(phy, 1);
+		omap_control_usb_phy_power(phy->control_dev, 1);
 		phy->is_suspended = 0;
 	}
 
@@ -145,7 +123,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 {
 	struct omap_usb			*phy;
 	struct usb_otg			*otg;
-	struct resource			*res;
 
 	phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
 	if (!phy) {
@@ -166,16 +143,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	phy->phy.set_suspend	= omap_usb2_suspend;
 	phy->phy.otg		= otg;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-
-	phy->control_dev = devm_request_and_ioremap(&pdev->dev, res);
-	if (phy->control_dev == NULL) {
-		dev_err(&pdev->dev, "Failed to obtain io memory\n");
-		return -ENXIO;
+	phy->control_dev = omap_get_control_dev();
+	if (IS_ERR(phy->control_dev)) {
+		dev_dbg(&pdev->dev, "Failed to get control device\n");
+		return -ENODEV;
 	}
 
 	phy->is_suspended	= 1;
-	omap_usb_phy_power(phy, 0);
+	omap_control_usb_phy_power(phy->control_dev, 0);
 
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
index 0ea17f8..3db9b53 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/usb/omap_usb.h
@@ -25,13 +25,11 @@ struct omap_usb {
 	struct usb_phy		phy;
 	struct phy_companion	*comparator;
 	struct device		*dev;
-	u32 __iomem		*control_dev;
+	struct device		*control_dev;
 	struct clk		*wkupclk;
 	u8			is_suspended:1;
 };
 
-#define	PHY_PD	0x1
-
 #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
 
 #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB
From: Kishon Vijay Abraham I @ 2013-01-25 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series adds dt data to get MUSB working in omap4 and omap3.
Long time back a patch series with the same title was sent but only
a part of it got merged. The rest of it wasn't merged because of
adding omap control usb data to glue and usb phy.

Now there exists a separate driver for control usb and hence added a
separate dt node for control usb.

Changes from v2:
* Changed property names from "ti,has_mailbox" to "ti,has-mailbox",
  "ctrl_module" to "ctrl-module", "usb_phy" to "usb-phy"

Changes from v1:
* "ti,has_mailbox" property is removed and "ti,type" property is added
  and filled with value "1" to specify it has a mailbox

This series was developed on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv
+ "usb: musb: add driver for control module" patch series

Did basic enumeration testing in omap4 panda, omap4 sdp and omap3 beagle.

Kishon Vijay Abraham I (3):
  ARM: dts: omap: Add omap control usb data
  ARM: dts: omap: Add omap-usb2 dt data
  ARM: dts: omap: Add usb_otg and glue data

 Documentation/devicetree/bindings/usb/omap-usb.txt |    2 ++
 arch/arm/boot/dts/omap3-beagle-xm.dts              |    6 +++++
 arch/arm/boot/dts/omap3-evm.dts                    |    6 +++++
 arch/arm/boot/dts/omap3-overo.dtsi                 |    6 +++++
 arch/arm/boot/dts/omap3.dtsi                       |   12 +++++++++
 arch/arm/boot/dts/omap4-panda.dts                  |    6 +++++
 arch/arm/boot/dts/omap4-sdp.dts                    |    6 +++++
 arch/arm/boot/dts/omap4.dtsi                       |   26 ++++++++++++++++++++
 arch/arm/boot/dts/twl4030.dtsi                     |    2 +-
 9 files changed, 71 insertions(+), 1 deletion(-)

-- 
1.7.9.5

^ permalink raw reply

* [PATCH v3 1/3] ARM: dts: omap: Add omap control usb data
From: Kishon Vijay Abraham I @ 2013-01-25 10:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109615-2410-1-git-send-email-kishon@ti.com>

Add omap control usb data in omap4 device tree file. This will have the
register address of registers to power on the PHY and to write to
mailbox. The information about this data node is available @
Documentation/devicetree/bindings/usb/omap-usb.txt

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79..ffc7352 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,13 @@
 			ti,hwmods = "timer11";
 			ti,timer-pwm;
 		};
+
+		omap_control_usb: omap-control-usb at 4a002300 {
+			compatible = "ti,omap-control-usb";
+			reg = <0x4a002300 0x4>,
+			      <0x4a00233c 0x4>;
+			reg-names = "control_dev_conf", "otghs_control";
+			ti,type = <1>;
+		};
 	};
 };
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v3 2/3] ARM: dts: omap: Add omap-usb2 dt data
From: Kishon Vijay Abraham I @ 2013-01-25 10:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109615-2410-1-git-send-email-kishon@ti.com>

Add omap-usb2 data node in omap4 device tree file. Since omap-usb2 is
connected to ocp2scp, omap-usb2 dt data is added as a child node
of ocp2scp. The information about this data node is availabe @
Documentation/devicetree/bindings/usb/usb-phy.txt

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index ffc7352..c829d7e 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -438,6 +438,11 @@
 			#size-cells = <1>;
 			ranges;
 			ti,hwmods = "ocp2scp_usb_phy";
+			usb2_phy: usb2phy at 4a0ad080 {
+				compatible = "ti,omap-usb2";
+				reg = <0x4a0ad080 0x58>;
+				ctrl-module = <&omap_control_usb>;
+			};
 		};
 
 		timer1: timer at 4a318000 {
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v3 3/3] ARM: dts: omap: Add usb_otg and glue data
From: Kishon Vijay Abraham I @ 2013-01-25 10:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109615-2410-1-git-send-email-kishon@ti.com>

Add usb otg data node in omap4/omap3 device tree file. Also update
the node with board specific setting in omapx-<board>.dts file.
The dt data specifies among others the interface type (ULPI or UTMI), mode
which is mostly OTG, power that specifies the amount of power this can supply
when in host mode.
The information about usb otg node is available @
Documentation/devicetree/bindings/usb/omap-usb.txt

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |    2 ++
 arch/arm/boot/dts/omap3-beagle-xm.dts              |    6 ++++++
 arch/arm/boot/dts/omap3-evm.dts                    |    6 ++++++
 arch/arm/boot/dts/omap3-overo.dtsi                 |    6 ++++++
 arch/arm/boot/dts/omap3.dtsi                       |   12 ++++++++++++
 arch/arm/boot/dts/omap4-panda.dts                  |    6 ++++++
 arch/arm/boot/dts/omap4-sdp.dts                    |    6 ++++++
 arch/arm/boot/dts/omap4.dtsi                       |   13 +++++++++++++
 arch/arm/boot/dts/twl4030.dtsi                     |    2 +-
 9 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index b36df59..b892f58 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -18,6 +18,7 @@ OMAP MUSB GLUE
    represents PERIPHERAL.
  - power : Should be "50". This signifies the controller can supply upto
    100mA when operating in host mode.
+ - usb-phy : the phandle for the PHY device
 
 Optional properties:
  - ctrl-module : phandle of the control module this glue uses to write to
@@ -32,6 +33,7 @@ usb_otg_hs: usb_otg_hs at 4a0ab000 {
 	num_eps = <16>;
 	ram_bits = <12>;
 	ctrl-module = <&omap_control_usb>;
+	usb-phy = <&usb2_phy>;
 };
 
 Board specific device node entry
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index 3705a81..cb07583 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -107,3 +107,9 @@
 	 */
 	ti,pulldowns = <0x03a1c4>;
 };
+
+&usb_otg_hs {
+	interface_type = <0>;
+	mode = <3>;
+	power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index e8ba1c2..afb9ba9 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -59,3 +59,9 @@
 &twl_gpio {
 	ti,use-leds;
 };
+
+&usb_otg_hs {
+	interface_type = <0>;
+	mode = <3>;
+	power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap3-overo.dtsi b/arch/arm/boot/dts/omap3-overo.dtsi
index 89808ce..4b3d157 100644
--- a/arch/arm/boot/dts/omap3-overo.dtsi
+++ b/arch/arm/boot/dts/omap3-overo.dtsi
@@ -55,3 +55,9 @@
 &twl_gpio {
 	ti,use-leds;
 };
+
+&usb_otg_hs {
+	interface_type = <0>;
+	mode = <3>;
+	power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1acc261..176561b 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -397,5 +397,17 @@
 			ti,timer-alwon;
 			ti,timer-secure;
 		};
+
+		usb_otg_hs: usb_otg_hs at 480ab000 {
+			compatible = "ti,omap3-musb";
+			reg = <0x480ab000 0x1000>;
+			interrupts = <0 92 0x4>, <0 93 0x4>;
+			interrupt-names = "mc", "dma";
+			ti,hwmods = "usb_otg_hs";
+			usb-phy = <&usb2_phy>;
+			multipoint = <1>;
+			num_eps = <16>;
+			ram_bits = <12>;
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 4122efe..612c9bb 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -206,3 +206,9 @@
 &twl_usb_comparator {
 	usb-supply = <&vusb>;
 };
+
+&usb_otg_hs {
+	interface_type = <1>;
+	mode = <3>;
+	power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 43e5258..582d7ee 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -428,3 +428,9 @@
 &twl_usb_comparator {
 	usb-supply = <&vusb>;
 };
+
+&usb_otg_hs {
+	interface_type = <1>;
+	mode = <3>;
+	power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index c829d7e..ab817a2 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -542,5 +542,18 @@
 			reg-names = "control_dev_conf", "otghs_control";
 			ti,type = <1>;
 		};
+
+		usb_otg_hs: usb_otg_hs at 4a0ab000 {
+			compatible = "ti,omap4-musb";
+			reg = <0x4a0ab000 0x7ff>;
+			interrupts = <0 92 0x4>, <0 93 0x4>;
+			interrupt-names = "mc", "dma";
+			ti,hwmods = "usb_otg_hs";
+			usb-phy = <&usb2_phy>;
+			multipoint = <1>;
+			num_eps = <16>;
+			ram_bits = <12>;
+			ti,has-mailbox;
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index ed0bc95..398d2c3 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -67,7 +67,7 @@
 		#interrupt-cells = <1>;
 	};
 
-	twl4030-usb {
+	usb2_phy: twl4030-usb {
 		compatible = "ti,twl4030-usb";
 		interrupts = <10>, <4>;
 		usb1v5-supply = <&vusb1v5>;
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v4 4/4] drivers: usb: start using the control module driver
From: Felipe Balbi @ 2013-01-25 10:27 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109440-2195-5-git-send-email-kishon@ti.com>

Hi,

On Fri, Jan 25, 2013 at 03:54:00PM +0530, Kishon Vijay Abraham I wrote:
> Start using the control module driver for powering on the PHY and for
> writing to the mailbox instead of writing to the control module
> registers on their own.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/usb/omap-usb.txt |    4 ++
>  Documentation/devicetree/bindings/usb/usb-phy.txt  |    7 +-
>  arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |   13 ----

I'm taking this patch but I'm leaving out the omap_hwmod_44xx_data.c
change just to kill dependency. Can you send that single change as a
separate patch which Tony can queue ?

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130125/f9714c65/attachment.sig>

^ permalink raw reply

* [PATCH] ARM: davinci: da850: add RTC driver DT entries
From: Sekhar Nori @ 2013-01-25 10:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359094430-14724-1-git-send-email-mrugesh.mk@ti.com>

On 1/25/2013 11:43 AM, Mrugesh Katepallewar wrote:
> Add RTC DT entries in da850 dts file.
> 
> Signed-off-by: Mrugesh Katepallewar <mrugesh.mk@ti.com>
> ---
> Applies on top of v3.8-rc4 of linus tree.
> 
> Tested on da850-evm device.
> 
> Test Procedure:
> date [YYYY.]MM.DD-hh:mm[:ss]
> hwclock -w
> reset board and check system time.
> 
> :100644 100644 37dc5a3... b16efd4... M	arch/arm/boot/dts/da850-evm.dts
> :100644 100644 640ab75... a8eb1b1... M	arch/arm/boot/dts/da850.dtsi
>  arch/arm/boot/dts/da850-evm.dts |    3 +++
>  arch/arm/boot/dts/da850.dtsi    |    8 ++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
> index 37dc5a3..b16efd4 100644
> --- a/arch/arm/boot/dts/da850-evm.dts
> +++ b/arch/arm/boot/dts/da850-evm.dts
> @@ -24,5 +24,8 @@
>  		serial2: serial at 1d0d000 {
>  			status = "okay";
>  		};
> +		rtc at 1c23000 {
> +			status = "okay";
> +		};
>  	};
>  };
> diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
> index 640ab75..a8eb1b1 100644
> --- a/arch/arm/boot/dts/da850.dtsi
> +++ b/arch/arm/boot/dts/da850.dtsi
> @@ -56,5 +56,13 @@
>  			interrupt-parent = <&intc>;
>  			status = "disabled";
>  		};
> +		rtc at 1c23000 {
> +			compatible = "ti,da830-rtc";
> +			reg = <0x23000 0x1000>;
> +			interrupts = <19
> +				      19>;

Why two interrupts of the same number? If there is only one interrupt
line then only one should be specified, no?

Thanks,
Sekhar

^ permalink raw reply

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
From: Guennadi Liakhovetski @ 2013-01-25 10:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <7921225.sfO3PIeLVS@avalon>

Hi Laurent

On Fri, 25 Jan 2013, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> > a binding and code to parse it, request the GPIO and take the PHY out of
> > reset.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: devicetree-discuss at lists.ozlabs.org
> > Cc: netdev at vger.kernel.org
> > ---
> >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> >  2 files changed, 10 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> > b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> > 100644
> > --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> > +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> > @@ -12,6 +12,7 @@ Required properties:
> >  - interrupts:                   Interrupt mapping for the sh_eth interrupt
> >                                  sources (vector id).
> >  - phy-mode:              String, operation mode of the PHY interface.
> > +- phy-reset-gpios:              PHY reset GPIO tuple
> 
> If you can't have more than one GPIO here, what about calling it phy-reset-
> gpio ?

>From Documentation/devicetree/bindings/gpio/gpio.txt:

<quote>
GPIO properties should be named "[<name>-]gpios".
</quote>

> >  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
> >  - sh-eth,register-type:         String, register type of sh_eth.
> >                                  Please select "gigabit", "fast-sh4" or
> > @@ -37,6 +38,7 @@ Example (armadillo800eva):
> >  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
> >  		interrupts = <0x500>;
> >  		phy-mode = "mii";
> > +		phy-reset-gpios = <&gpio 18 0>;
> >  		sh-eth,edmac-endian = "little";
> >  		sh-eth,register-type = "gigabit";
> >  		sh-eth,phy-id = <0>;
> > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > +++ b/drivers/net/ethernet/renesas/sh_eth.c
> > @@ -20,6 +20,7 @@
> >   *  the file called "COPYING".
> >   */
> > 
> > +#include <linux/gpio.h>
> >  #include <linux/init.h>
> >  #include <linux/module.h>
> >  #include <linux/kernel.h>
> > @@ -33,6 +34,7 @@
> >  #include <linux/netdevice.h>
> >  #include <linux/of.h>
> >  #include <linux/of_device.h>
> > +#include <linux/of_gpio.h>
> >  #include <linux/of_platform.h>
> >  #include <linux/of_address.h>
> >  #include <linux/of_irq.h>
> > @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
> >  static struct sh_eth_plat_data *
> >  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
> >  {
> > -	int ret;
> > +	int ret, gpio;
> >  	const char *of_str;
> >  	struct device_node *np = dev->of_node;
> >  	struct sh_eth_plat_data *pdata;
> > +	enum of_gpio_flags flags;
> > 
> >  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
> >  					GFP_KERNEL);
> > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> > *ndev) else
> >  		pdata->needs_init = 0;
> > 
> > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> 
> You could use devm_gpio_request_one() here.

Yes, but then the flag would look uglier, something like

		devm_gpio_request_one(dev, gpio, flags & 
			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH : 
			GPIOF_OUT_INIT_LOW);

Does it really look like an improvement? :)

> Is there no need to reset the phy at runtime ?

No idea, I'm not developing the driver, I'm just porting one specific 
feature from one API to another with no functional changes (apart from 
postponing setting the GPIO).

Thanks
Guennadi

> > +
> >  #ifdef CONFIG_OF_NET
> >  	if (!is_valid_ether_addr(ndev->dev_addr)) {
> >  		const char *macaddr = of_get_mac_address(np);
> -- 
> Regards,
> 
> Laurent Pinchart
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply

* arm: Kernel failures when several memory banks are used with starting address above 128MB
From: Michal Simek @ 2013-01-25 10:36 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.02.1301221528050.6300@xanadu.home>

Hi Nicolas,

2013/1/22 Nicolas Pitre <nicolas.pitre@linaro.org>:
> On Tue, 22 Jan 2013, Michal Simek wrote:
>
>> Hi,
>>
>> I have a question regarding to the case where DTS specify one memory bank
>> for example <0x0 0x40000000> with CONFIG_ARM_PATCH_PHYS_VIRT=y
>> where the kernel can be loaded at a 16MB boundary.
>> I was testing it on the 3.8-rc4 on arm zynq.
>>
>> 1. If the kernel is loaded within 0 - 127MB memory then the kernel can
>> work with the whole
>> 1GB memory. It shows that the memory in front of the kernel is also
>> available for the kernel.
>>
>> 2. If the kernel is loaded on the higher addresses then it fails by
>> these error messages.
>> "Ignoring RAM at 00000000-3fffffff (vmalloc region overlap).
>> Memory policy: ECC disabled, Data cache writeback
>> Kernel panic - not syncing: ERROR: Failed to allocate 0x1000 bytes below 0x0."
>>
>> 3. If I use several memory banks solution
>> for example
>> reg = <0 0x10000000 0x10000000 0x30000000>;
>> and the kernel is loaded to 0x10008000 then the first memory bank is
>> ignored and kernel will boot.
>> "Ignoring RAM at 00000000-0fffffff (vmalloc region overlap)." with
>> 768MB of memory.
>>
>> 4. The next interesting example is description with 3 memory banks.
>> reg = <0 0x10000000 0x10000000 0x20000000 0x30000000 0x10000000>;
>> which behaves as point 3. It means the first 128MB is ignored and only
>> 768MB of ram is available.
>>
>>
>> The real question is how the kernel should behave for these situations.
>> I would expect that if the kernel is within one memory bank
>> then it will use this whole bank
>> Or
>> I would expect that the memory which is in front of the kernel start address
>> will be simple ignored and the kernel will find out which memory bank
>> is used and will use it.
>> Not just caused kernel panic.
>> Or
>> Is there any expectation that you have to run the relocatable kernel
>> in the first 128MB of the memory
>> or changing DTS depending on the kernel position where it is loaded?
>
> There are two kernel config symbols influencing this:
>
> config AUTO_ZRELADDR
>         bool "Auto calculation of the decompressed kernel image address"
>         depends on !ZBOOT_ROM && !ARCH_U300
>         help
>           ZRELADDR is the physical address where the decompressed kernel
>           image will be placed. If AUTO_ZRELADDR is selected, the address
>           will be determined at run-time by masking the current IP with
>           0xf8000000. This assumes the zImage being placed in the first 128MB
>           from start of memory.
>
> config ARM_PATCH_PHYS_VIRT
>         bool "Patch physical to virtual translations at runtime" if EMBEDDED
>         default y
>         depends on !XIP_KERNEL && MMU
>         depends on !ARCH_REALVIEW || !SPARSEMEM
>         help
>           Patch phys-to-virt and virt-to-phys translation functions at
>           boot and module load time according to the position of the
>           kernel in system memory.
>
>           This can only be used with non-XIP MMU kernels where the base
>           of physical memory is at a 16MB boundary.
>
>           Only disable this option if you know that you do not require
>           this feature (eg, building a kernel for a single machine) and
>           you need to shrink the kernel to the minimal size.

ok. This is on zynq platform which enables ARCH_MULTIPLATFORM.
It means that both these options are enabled by default and


> Of course, the kernel must be loaded at some address within the provided
> RAM information in DT as well.  If you cannot meet those restrictions
> then the corresponding features have to be disabled in your build.

Does it mean what Russel mention that within means from ram start address
+ 16MB (from my test that limit is 128MB - but maybe memory tests can
find some bugs
but the kernel boots)

The fact is that I can't disabled these options because of
ARCH_MULTIPLATFORM option.
I am running AMP which means on the second ARM runs rtos.
Rtos on the second cpu needs to access vectors started at 0x0 that's
why I need to move
the kernel to higher addresses.

As I see from the exynos4210-origen.dts they use 4 memory banks
        memory {
                reg = <0x40000000 0x10000000
                       0x50000000 0x10000000
                       0x60000000 0x10000000
                       0x70000000 0x10000000>;
        };

I expect that kernel starting address is 0x40000000 (+0x8000) and
everything works as expected
but if they will try to use( without changing dts which describe exact
and real hardware configuration)
0x50000000 starting address than kernel won't boot.
What it is interesting on this is that Linux can work with all memory
banks which are in DTS
on higher addresses than starting address but can't work with memory
banks which are on lower addresses.

That's why I have created these patches (it is just c&p just to see
what I am talking about)
which ensure that kernel will boot not failed in these two cases.

Case 1:
The kernel starting address is at 0x10008000
dts memory reg = <0x0 0x40000000>;
which ensure that kernel will work only with 0x10000000 - 0x40000000
address space
Kernel bootlog will contain: "Change memory bank to 10000000-3fffffff"

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 9f06102..377d600 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -936,7 +936,26 @@ void __init sanity_check_meminfo(void)
                if (bank->start > ULONG_MAX)
                        highmem = 1;

+               if (bank->start < __pa(PAGE_OFFSET) &&
+                       __pa(PAGE_OFFSET) <= (bank->start + bank->size - 1)) {
+                               int offset = __pa(PAGE_OFFSET) - bank->start;
+                               bank->start += offset;
+                               bank->size -= offset;
+                               pr_crit("Change memory bank to %.8llx-%.8llx\n",
+                                       (unsigned long long)bank->start,
+                                       (unsigned long long)bank->start +
+                                                               bank->size - 1);
+               }
+


Case 2:
In two bank solution with the kernel starting address at 0x10008000
will be the first bank ignored
which ensure that HIGHMEM will work and kernel will boot
reg = <0x0 0x10000000 0x10000000 0x30000000>;
Kernel bootlog will contain: "Ignoring RAM at 00000000-0fffffff
(CONFIG_HIGHMEM)."


diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 048a199..377d600 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -948,6 +948,14 @@ void __init sanity_check_meminfo(void)
                }

 #ifdef CONFIG_HIGHMEM
+               if (__va(bank->start + bank->size - 1) < (void *)PAGE_OFFSET) {
+                       pr_notice("Ignoring RAM@%.8llx-%.8llx "
+                               "(CONFIG_HIGHMEM).\n",
+                               (unsigned long long)bank->start,
+                               (unsigned long long)bank->start +
bank->size - 1);
+                       continue;
+               }
+
                if (__va(bank->start) >= vmalloc_min ||
                    __va(bank->start) < (void *)PAGE_OFFSET)
                        highmem = 1;


Also these two patches ensure that kernel can be placed to any memory location
and will work with the rest of memory which is defined in the dts
without changing
dts to reflect different loading address.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian

^ permalink raw reply related

* [PATCH v3 1/8] pinctrl: add SDHI and MMCIF pin groups to r8a7740
From: Linus Walleij @ 2013-01-25 10:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1358959071-2873-2-git-send-email-g.liakhovetski@gmx.de>

On Wed, Jan 23, 2013 at 5:37 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:

> Add pin groups for the first two SDHI interfaces and two alternative pin
> groups for the MMCIF interface on the r8a7740 SoC.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

The series:
Acked-by: Linus Walleij <linus.walleij@linaro.org>

(For those not already ACKed.)

Yours,
Linus Walleij

^ permalink raw reply

* [PATCH 2/6] ARM: davinci: da850: add DT node for I2C0
From: Sekhar Nori @ 2013-01-25 10:50 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359027324-14534-1-git-send-email-manishv.b@ti.com>

On 1/24/2013 5:05 PM, Vishwanathrao Badarkhe, Manish wrote:
> Add I2C0 device tree node information to da850-evm.
> Also, add I2C0 pin muxing information in da850-evm.
> 
> Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
> ---
> Depends on patch 
> http://comments.gmane.org/gmane.linux.davinci/25993
> 
>  arch/arm/boot/dts/da850-evm.dts |   15 +++++++++++++++
>  arch/arm/boot/dts/da850.dtsi    |   10 ++++++++++
>  2 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
> index 8cac9d2..3d8290a 100755
> --- a/arch/arm/boot/dts/da850-evm.dts
> +++ b/arch/arm/boot/dts/da850-evm.dts
> @@ -27,5 +27,20 @@
>  		serial2: serial at 1d0d000 {
>  			status = "okay";
>  		};
> +		i2c0 at 1c22000 {

This should be
		i2c0: i2c at 1c22000

to follow the convention elsewhere in file.

> +			status = "okay";
> +		};
> +	};
> +};
> +&pmx_core {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <
> +		&i2c0_pins
> +	>;
> +
> +	i2c0_pins: pinmux_i2c0_pins{
> +		pinctrl-single,bits = <
> +			0x10 0x00002200 0x0000ff00	/* I2C0_SDA,I2C0_SCL */
> +		>;

This should go into the dtsi file. See the discussion on NAND DT support
submitted by Anil Kumar.

Thanks,
Sekhar

PS: You are using an old address for Kevin Hilman. The MAINTAINERS file
has been updated for a long time now. Liam's address is also wrong but I
don't have his updated e-mail.

^ permalink raw reply

* [PATCH v4 1/4] drivers: usb: phy: add a new driver for usb part of control module
From: Mark Rutland @ 2013-01-25 11:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359109440-2195-2-git-send-email-kishon@ti.com>

On Fri, Jan 25, 2013 at 10:23:57AM +0000, Kishon Vijay Abraham I wrote:
> Added a new driver for the usb part of control module. This has an API
> to power on the USB2 phy and an API to write to the mailbox depending on
> whether MUSB has to act in host mode or in device mode.
> 
> Writing to control module registers for doing the above task which was
> previously done in omap glue and in omap-usb2 phy will be removed.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/usb/omap-usb.txt |   30 +-
>  Documentation/devicetree/bindings/usb/usb-phy.txt  |    5 +
>  drivers/usb/phy/Kconfig                            |   10 +
>  drivers/usb/phy/Makefile                           |    1 +
>  drivers/usb/phy/omap-control-usb.c                 |  295 ++++++++++++++++++++
>  include/linux/usb/omap_control_usb.h               |   92 ++++++
>  6 files changed, 432 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/usb/phy/omap-control-usb.c
>  create mode 100644 include/linux/usb/omap_control_usb.h
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> index 29a043e..2d8c6c4 100644
> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> @@ -1,4 +1,4 @@
> -OMAP GLUE
> +OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
> 
>  OMAP MUSB GLUE
>   - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
> @@ -16,6 +16,10 @@ OMAP MUSB GLUE
>   - power : Should be "50". This signifies the controller can supply upto
>     100mA when operating in host mode.
> 
> +Optional properties:
> + - ctrl-module : phandle of the control module this glue uses to write to
> +   mailbox
> +
>  SOC specific device node entry
>  usb_otg_hs: usb_otg_hs at 4a0ab000 {
>         compatible = "ti,omap4-musb";
> @@ -23,6 +27,7 @@ usb_otg_hs: usb_otg_hs at 4a0ab000 {
>         multipoint = <1>;
>         num_eps = <16>;
>         ram_bits = <12>;
> +       ctrl-module = <&omap_control_usb>;
>  };
> 
>  Board specific device node entry
> @@ -31,3 +36,26 @@ Board specific device node entry
>         mode = <3>;
>         power = <50>;
>  };
> +
> +OMAP CONTROL USB
> +
> +Required properties:
> + - compatible: Should be "ti,omap-control-usb"
> + - reg : Address and length of the register set for the device. It contains
> +   the address of "control_dev_conf" and "otghs_control" or "phy_power_usb"

Could you not use '-' over '_' here?

> +   depending upon omap4 or omap5.
> + - reg-names: The names of the register addresses corresponding to the registers
> +   filled in "reg".
> + - ti,type: This is used to differentiate whether the control module has
> +   usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
> +   notify events to the musb core and omap5 has usb3 phy power register to
> +   power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
> +   phy power.

Why not make this a string property, perhaps values "mailbox" or "register"?

That way it's easy for humans and code to verify the dts, and easy to expand
arbitrarily in future if necessary. It also means you're not leaking
kernel-side constants as an ABI.

> +
> +omap_control_usb: omap-control-usb at 4a002300 {
> +       compatible = "ti,omap-control-usb";
> +       reg = <0x4a002300 0x4>,
> +             <0x4a00233c 0x4>;
> +       reg-names = "control_dev_conf", "otghs_control";
> +       ti,type = <1>;
> +};

[...]

> +static int omap_control_usb_probe(struct platform_device *pdev)
> +{
> +       struct resource *res;
> +       struct device_node *np = pdev->dev.of_node;
> +       struct omap_control_usb_platform_data *pdata = pdev->dev.platform_data;
> +
> +       control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
> +               GFP_KERNEL);
> +       if (!control_usb) {
> +               dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
> +               return -ENOMEM;
> +       }
> +
> +       if (np) {
> +               of_property_read_u32(np, "ti,type", &control_usb->type);
> +       } else if (pdata) {
> +               control_usb->type = pdata->type;
> +       } else {
> +               dev_err(&pdev->dev, "no pdata present\n");
> +               return -EINVAL;
> +       }

Please do some sanity checking here on type. What if it's not
OMAP_CTRL_DEV_TYPE1 or OMAP_CTRL_DEV_TYPE2?

What if the values for OMAP_CTRL_DEV_TYPE{1,2} change? The binding will be
broken.

If you change ti,type to a string, the parsing also becomes sanity checking:

if (np) {
	char *type;
	if (of_property_read_string(np, "ti,type", &type) != 0)
		return -EINVAL;

	if (strcmp(type, "mailbox") == 0)
		control_usb->type = OMAP_CTRL_DEV_TYPE1;
	else if (strcmp(type, "register") == 0)
		control_usb->type = OMAP_CTRL_DEV_TYPE2;
	else
		return -EINVAL;
} else {
	... pdata case ...
}

Also, TYPE1 and TYPE2 aren't very descriptive. These could probably be better
named.

> +
> +       control_usb->dev        = &pdev->dev;
> +
> +       res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> +               "control_dev_conf");
> +       control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res);
> +       if (!control_usb->dev_conf) {
> +               dev_err(&pdev->dev, "Failed to obtain io memory\n");
> +               return -EADDRNOTAVAIL;
> +       }
> +
> +       if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
> +               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> +                       "otghs_control");
> +               control_usb->otghs_control = devm_request_and_ioremap(
> +                       &pdev->dev, res);
> +               if (!control_usb->otghs_control) {
> +                       dev_err(&pdev->dev, "Failed to obtain io memory\n");
> +                       return -EADDRNOTAVAIL;
> +               }
> +       }
> +
> +       if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
> +               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> +                       "phy_power_usb");
> +               control_usb->phy_power = devm_request_and_ioremap(
> +                       &pdev->dev, res);
> +               if (!control_usb->phy_power) {
> +                       dev_dbg(&pdev->dev, "Failed to obtain io memory\n");
> +                       return -EADDRNOTAVAIL;
> +               }
> +
> +               control_usb->sys_clk = devm_clk_get(control_usb->dev,
> +                       "sys_clkin");
> +               if (IS_ERR(control_usb->sys_clk)) {
> +                       pr_err("%s: unable to get sys_clkin\n", __func__);
> +                       return -EINVAL;
> +               }
> +       }
> +
> +
> +       dev_set_drvdata(control_usb->dev, control_usb);
> +
> +       return 0;
> +}

[...]

Thanks,
Mark.

^ permalink raw reply

* [PATCH] ARM: davinci: da850: add RTC driver DT entries
From: Katepallewar, Mrugesh @ 2013-01-25 11:04 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <51025FAE.3060503@ti.com>

On Fri, Jan 25, 2013 at 16:04:22, Nori, Sekhar wrote:
> On 1/25/2013 11:43 AM, Mrugesh Katepallewar wrote:
> > Add RTC DT entries in da850 dts file.
> > 
> > Signed-off-by: Mrugesh Katepallewar <mrugesh.mk@ti.com>
> > ---
> > Applies on top of v3.8-rc4 of linus tree.
> > 
> > Tested on da850-evm device.
> > 
> > Test Procedure:
> > date [YYYY.]MM.DD-hh:mm[:ss]
> > hwclock -w
> > reset board and check system time.
> > 
> > :100644 100644 37dc5a3... b16efd4... M	arch/arm/boot/dts/da850-evm.dts
> > :100644 100644 640ab75... a8eb1b1... M	arch/arm/boot/dts/da850.dtsi
> >  arch/arm/boot/dts/da850-evm.dts |    3 +++
> >  arch/arm/boot/dts/da850.dtsi    |    8 ++++++++
> >  2 files changed, 11 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/da850-evm.dts 
> > b/arch/arm/boot/dts/da850-evm.dts index 37dc5a3..b16efd4 100644
> > --- a/arch/arm/boot/dts/da850-evm.dts
> > +++ b/arch/arm/boot/dts/da850-evm.dts
> > @@ -24,5 +24,8 @@
> >  		serial2: serial at 1d0d000 {
> >  			status = "okay";
> >  		};
> > +		rtc at 1c23000 {
> > +			status = "okay";
> > +		};
> >  	};
> >  };
> > diff --git a/arch/arm/boot/dts/da850.dtsi 
> > b/arch/arm/boot/dts/da850.dtsi index 640ab75..a8eb1b1 100644
> > --- a/arch/arm/boot/dts/da850.dtsi
> > +++ b/arch/arm/boot/dts/da850.dtsi
> > @@ -56,5 +56,13 @@
> >  			interrupt-parent = <&intc>;
> >  			status = "disabled";
> >  		};
> > +		rtc at 1c23000 {
> > +			compatible = "ti,da830-rtc";
> > +			reg = <0x23000 0x1000>;
> > +			interrupts = <19
> > +				      19>;
> 
> Why two interrupts of the same number? If there is only one interrupt line then only one should be specified, no?
We are using common OMAP RTC driver for da850 and other ti SoC's (e.g.am33xx). I have seen in am33xx.dtsi rtc timer
and alarm interrupts are different. So, two interrupt numbers are expected from RTC DT node.
> 
> Thanks,
> Sekhar
> 


Regards, 
Mrugesh

^ permalink raw reply

* [PATCH v4 1/4] drivers: usb: phy: add a new driver for usb part of control module
From: Felipe Balbi @ 2013-01-25 11:11 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20130125110141.GK3075@e106331-lin.cambridge.arm.com>

On Fri, Jan 25, 2013 at 11:01:41AM +0000, Mark Rutland wrote:
> On Fri, Jan 25, 2013 at 10:23:57AM +0000, Kishon Vijay Abraham I wrote:
> > Added a new driver for the usb part of control module. This has an API
> > to power on the USB2 phy and an API to write to the mailbox depending on
> > whether MUSB has to act in host mode or in device mode.
> > 
> > Writing to control module registers for doing the above task which was
> > previously done in omap glue and in omap-usb2 phy will be removed.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > ---
> >  Documentation/devicetree/bindings/usb/omap-usb.txt |   30 +-
> >  Documentation/devicetree/bindings/usb/usb-phy.txt  |    5 +
> >  drivers/usb/phy/Kconfig                            |   10 +
> >  drivers/usb/phy/Makefile                           |    1 +
> >  drivers/usb/phy/omap-control-usb.c                 |  295 ++++++++++++++++++++
> >  include/linux/usb/omap_control_usb.h               |   92 ++++++
> >  6 files changed, 432 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/usb/phy/omap-control-usb.c
> >  create mode 100644 include/linux/usb/omap_control_usb.h
> > 
> > diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> > index 29a043e..2d8c6c4 100644
> > --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
> > +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> > @@ -1,4 +1,4 @@
> > -OMAP GLUE
> > +OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
> > 
> >  OMAP MUSB GLUE
> >   - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
> > @@ -16,6 +16,10 @@ OMAP MUSB GLUE
> >   - power : Should be "50". This signifies the controller can supply upto
> >     100mA when operating in host mode.
> > 
> > +Optional properties:
> > + - ctrl-module : phandle of the control module this glue uses to write to
> > +   mailbox
> > +
> >  SOC specific device node entry
> >  usb_otg_hs: usb_otg_hs at 4a0ab000 {
> >         compatible = "ti,omap4-musb";
> > @@ -23,6 +27,7 @@ usb_otg_hs: usb_otg_hs at 4a0ab000 {
> >         multipoint = <1>;
> >         num_eps = <16>;
> >         ram_bits = <12>;
> > +       ctrl-module = <&omap_control_usb>;
> >  };
> > 
> >  Board specific device node entry
> > @@ -31,3 +36,26 @@ Board specific device node entry
> >         mode = <3>;
> >         power = <50>;
> >  };
> > +
> > +OMAP CONTROL USB
> > +
> > +Required properties:
> > + - compatible: Should be "ti,omap-control-usb"
> > + - reg : Address and length of the register set for the device. It contains
> > +   the address of "control_dev_conf" and "otghs_control" or "phy_power_usb"
> 
> Could you not use '-' over '_' here?

that's part of omap hwmod.

> > +   depending upon omap4 or omap5.
> > + - reg-names: The names of the register addresses corresponding to the registers
> > +   filled in "reg".
> > + - ti,type: This is used to differentiate whether the control module has
> > +   usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
> > +   notify events to the musb core and omap5 has usb3 phy power register to
> > +   power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
> > +   phy power.
> 
> Why not make this a string property, perhaps values "mailbox" or "register"?

NAK.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130125/801829f3/attachment.sig>

^ permalink raw reply

* [PATCH v2 0/6] ARM: dts: omap: add dt data for dwc3
From: Kishon Vijay Abraham I @ 2013-01-25 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series adds dt data to get dwc3 working in omap5.

Changes from v1:
* rename "ctrl_module" to "ctrl-module" and "usb_phy" to "usb-phy"

This patch series is developed on
git://github.com/rrnayak/linux.git omap5-3.8-rc4-base-palmas

This is the last series of the series of patches.
I've kept everything in a single branch
git://gitorious.org/linux-usb/linux-usb.git omap5-with-palmas
(changes up to 23b4dfa2ab7052569cd88acc6383c4b1a8e8a482)

Did enumeration testing on omap5 evm.

Kishon Vijay Abraham I (6):
  ARM: dts: omap5: Add omap control usb data
  ARM: dts: omap5: Add ocp2scp data
  ARM: dts: omap5: Add omap-usb3 and omap-usb2 dt data
  ARM: dts: omap5: add dwc3 omap dt data
  ARM: dts: omap5: add dwc3 core dt data
  ARM: dts: palmas: update dt data for palmas-usb

 arch/arm/boot/dts/omap5.dtsi  |   48 +++++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/palmas.dtsi |    4 ++--
 2 files changed, 50 insertions(+), 2 deletions(-)

-- 
1.7.9.5

^ permalink raw reply

* [PATCH v2 1/6] ARM: dts: omap5: Add omap control usb data
From: Kishon Vijay Abraham I @ 2013-01-25 11:11 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1359112312-6918-1-git-send-email-kishon@ti.com>

Add omap control usb data in omap5 device tree file. This will have the
register address of registers to power on the USB2 PHY and USB3 PHY. The
information for the node added here is available in
Documentation/devicetree/bindings/usb/omap-usb.txt

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 7a78d1b..edc7464 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -504,5 +504,13 @@
 			hw-caps-ll-interface;
 			hw-caps-temp-alert;
 		};
+
+		omap_control_usb: omap-control-usb at 4a002300 {
+			compatible = "ti,omap-control-usb";
+			reg = <0x4a002300 0x4>,
+			      <0x4a002370 0x4>;
+			reg-names = "control_dev_conf", "phy_power_usb";
+			ti,type = <2>;
+		};
 	};
 };
-- 
1.7.9.5

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox