All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raviteja Garimella <raviteja.garimella@broadcom.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>, Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Jon Mason <jonmason@broadcom.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 2/3] phy:phy-bcm-ns2-usbdrd:Broadcom USB DRD Phy driver for Northstar2
Date: Fri, 2 Jun 2017 17:36:56 +0530	[thread overview]
Message-ID: <CAEHZuqMVE+c-AWMK5wfJhJrYVwYT-Yi8=9q5WqcvySDJRb9eHQ@mail.gmail.com> (raw)
In-Reply-To: <c72092cd-5501-56e5-26b6-f6f073cce74b@ti.com>

Hi,

On Fri, Jun 2, 2017 at 5:26 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Hi,
>
> On Friday 02 June 2017 05:21 PM, Raviteja Garimella wrote:
>> Hi,
>>
>> On Fri, Jun 2, 2017 at 5:18 PM, Raviteja Garimella
>> <raviteja.garimella@broadcom.com> wrote:
>>> Hi Kishon,
>>>
>>> On Fri, Jun 2, 2017 at 3:59 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>>> Hi,
>>>>
>>>> On Wednesday 31 May 2017 03:42 PM, Raviteja Garimella wrote:
>>>>> This is driver for USB DRD Phy used in Broadcom's Northstar2
>>>>> SoC. The phy can be configured to be in Device mode or Host
>>>>> mode based on the type of cable connected to the port. The
>>>>> driver registers to  extcon framework to get appropriate
>>>>> connect events for Host/Device cables connect/disconnect
>>>>> states based on VBUS and ID interrupts.
>>>>>
>>>>> Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com>
>>>>> ---
>>>>>  drivers/phy/Kconfig              |  13 ++
>>>>>  drivers/phy/Makefile             |   1 +
>>>>>  drivers/phy/phy-bcm-ns2-usbdrd.c | 466 +++++++++++++++++++++++++++++++++++++++
>>>>>  3 files changed, 480 insertions(+)
>>>>>  create mode 100644 drivers/phy/phy-bcm-ns2-usbdrd.c
>>>>>
>>>>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
>>>>> index afaf7b6..8028da7 100644
>>>>> --- a/drivers/phy/Kconfig
>>>>> +++ b/drivers/phy/Kconfig
>>>>> @@ -507,6 +507,19 @@ config PHY_CYGNUS_PCIE
>>>>>         Enable this to support the Broadcom Cygnus PCIe PHY.
>>>>>         If unsure, say N.
>>>>>
>>>>> +config PHY_NS2_USB_DRD
>>>>> +     tristate "Broadcom Northstar2 USB DRD PHY support"
>>>>> +     depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST)
>>>>> +     select GENERIC_PHY
>>>>> +     select EXTCON
>>>>> +     default ARCH_BCM_IPROC
>>>>> +     help
>>>>> +       Enable this to support the Broadcom Northstar2 USB DRD PHY.
>>>>> +       This driver initializes the PHY in either HOST or DEVICE mode.
>>>>> +       The host or device configuration is read from device tree.
>>>>> +
>>>>> +       If unsure, say N.
>>>>> +
>>>>>  source "drivers/phy/tegra/Kconfig"
>>>>>
>>>>>  config PHY_NS2_PCIE
>>>>> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
>>>>> index f8047b4..e5fbb0e 100644
>>>>> --- a/drivers/phy/Makefile
>>>>> +++ b/drivers/phy/Makefile
>>>>> @@ -61,6 +61,7 @@ obj-$(CONFIG_PHY_TUSB1210)          += phy-tusb1210.o
>>>>>  obj-$(CONFIG_PHY_BRCM_SATA)          += phy-brcm-sata.o
>>>>>  obj-$(CONFIG_PHY_PISTACHIO_USB)              += phy-pistachio-usb.o
>>>>>  obj-$(CONFIG_PHY_CYGNUS_PCIE)                += phy-bcm-cygnus-pcie.o
>>>>> +obj-$(CONFIG_PHY_NS2_USB_DRD)                += phy-bcm-ns2-usbdrd.o
>>>>>  obj-$(CONFIG_ARCH_TEGRA) += tegra/
>>>>>  obj-$(CONFIG_PHY_NS2_PCIE)           += phy-bcm-ns2-pcie.o
>>>>>  obj-$(CONFIG_PHY_MESON8B_USB2)               += phy-meson8b-usb2.o
>>>>> diff --git a/drivers/phy/phy-bcm-ns2-usbdrd.c b/drivers/phy/phy-bcm-ns2-usbdrd.c
>>>>> new file mode 100644
>>>>> index 0000000..8e05c70
>>>>> --- /dev/null
>>>>> +++ b/drivers/phy/phy-bcm-ns2-usbdrd.c
>>>>> @@ -0,0 +1,466 @@
>>>>> +/*
>>>>> + * Copyright (C) 2017 Broadcom
>>>>> + *
>>>>> + * 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 version 2.
>>>>> + *
>>>>> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
>>>>> + * kind, whether express or implied; without even the implied warranty
>>>>> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>>>> + * GNU General Public License for more details.
>>>>> + */
>>>>> +
>>>>> +#include <linux/delay.h>
>>>>> +#include <linux/extcon.h>
>>>>> +#include <linux/gpio.h>
>>>>> +#include <linux/gpio/consumer.h>
>>>>> +#include <linux/init.h>
>>>>> +#include <linux/interrupt.h>
>>>>> +#include <linux/io.h>
>>>>> +#include <linux/irq.h>
>>>>> +#include <linux/mfd/syscon.h>
>>>>> +#include <linux/module.h>
>>>>> +#include <linux/of.h>
>>>>> +#include <linux/of_address.h>
>>>>> +#include <linux/phy/phy.h>
>>>>> +#include <linux/platform_device.h>
>>>>> +#include <linux/regmap.h>
>>>>> +#include <linux/slab.h>
>>>>> +#include <linux/workqueue.h>
>>>>> +
>>>>> +#define ICFG_DRD_AFE         0x0
>>>>> +#define ICFG_MISC_STAT               0x18
>>>>> +#define ICFG_DRD_P0CTL               0x1C
>>>>> +#define ICFG_STRAP_CTRL              0x20
>>>>> +#define ICFG_FSM_CTRL                0x24
>>>>> +
>>>>> +#define ICFG_DEV_BIT         BIT(2)
>>>>> +#define IDM_RST_BIT          BIT(0)
>>>>> +#define AFE_CORERDY_VDDC     BIT(18)
>>>>> +#define PHY_PLL_RESETB               BIT(15)
>>>>> +#define PHY_RESETB           BIT(14)
>>>>> +#define PHY_PLL_LOCK         BIT(0)
>>>>> +
>>>>> +#define DRD_DEV_MODE         BIT(20)
>>>>> +#define OHCI_OVRCUR_POL              BIT(11)
>>>>> +#define ICFG_OFF_MODE                BIT(6)
>>>>> +#define PLL_LOCK_RETRY               1000
>>>>> +
>>>>> +#define EVT_DEVICE           0
>>>>> +#define EVT_HOST             1
>>>>> +
>>>>> +#define DRD_HOST_MODE                (BIT(2) | BIT(3))
>>>>> +#define DRD_DEVICE_MODE              (BIT(4) | BIT(5))
>>>>> +#define DRD_HOST_VAL         0x803
>>>>> +#define DRD_DEV_VAL          0x807
>>>>> +#define GPIO_DELAY           20
>>>>> +
>>>>> +struct ns2_phy_data;
>>>>> +struct ns2_phy_driver {
>>>>> +     void __iomem *icfgdrd_regs;
>>>>> +     void __iomem *idmdrd_rst_ctrl;
>>>>> +     void __iomem *crmu_usb2_ctrl;
>>>>> +     void __iomem *usb2h_strap_reg;
>>>>> +     struct ns2_phy_data *data;
>>>>> +     struct extcon_specific_cable_nb extcon_dev;
>>>>> +     struct extcon_specific_cable_nb extcon_host;
>>>>
>>>> The above two members are not used in the driver.
>>>
>>> Missed out to remove them. Will do.
>>>
>>>>> +     struct extcon_dev *edev;
>>>>
>>>> Does USB DRD driver waits for extcon events? If not using extcon here is bogus.
>>>
>>> DRD driver uses extcon events to disconnect/connect gadget driver runtime.
>>
>> I meant USB Device controller driver. It's not capable of DRD.
>
> all right. Btw which USB controller driver uses this?

Synopsys UDC driver currently in drivers/usb/gadget/amd5536udc.c and
drivers/usb/gadget/amd556udc_pci.c
As of 4.12.rc1 first patch (out of 6) that splits the old driver
that's PCI based is applied by the maintainer.
Rest of the patches that includes renaming the driver based on
synopsys IP and platform driver support
are to be merged yet.

>
> -Kishon

WARNING: multiple messages have this Message-ID (diff)
From: raviteja.garimella@broadcom.com (Raviteja Garimella)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 2/3] phy:phy-bcm-ns2-usbdrd:Broadcom USB DRD Phy driver for Northstar2
Date: Fri, 2 Jun 2017 17:36:56 +0530	[thread overview]
Message-ID: <CAEHZuqMVE+c-AWMK5wfJhJrYVwYT-Yi8=9q5WqcvySDJRb9eHQ@mail.gmail.com> (raw)
In-Reply-To: <c72092cd-5501-56e5-26b6-f6f073cce74b@ti.com>

Hi,

On Fri, Jun 2, 2017 at 5:26 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Hi,
>
> On Friday 02 June 2017 05:21 PM, Raviteja Garimella wrote:
>> Hi,
>>
>> On Fri, Jun 2, 2017 at 5:18 PM, Raviteja Garimella
>> <raviteja.garimella@broadcom.com> wrote:
>>> Hi Kishon,
>>>
>>> On Fri, Jun 2, 2017 at 3:59 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>>> Hi,
>>>>
>>>> On Wednesday 31 May 2017 03:42 PM, Raviteja Garimella wrote:
>>>>> This is driver for USB DRD Phy used in Broadcom's Northstar2
>>>>> SoC. The phy can be configured to be in Device mode or Host
>>>>> mode based on the type of cable connected to the port. The
>>>>> driver registers to  extcon framework to get appropriate
>>>>> connect events for Host/Device cables connect/disconnect
>>>>> states based on VBUS and ID interrupts.
>>>>>
>>>>> Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com>
>>>>> ---
>>>>>  drivers/phy/Kconfig              |  13 ++
>>>>>  drivers/phy/Makefile             |   1 +
>>>>>  drivers/phy/phy-bcm-ns2-usbdrd.c | 466 +++++++++++++++++++++++++++++++++++++++
>>>>>  3 files changed, 480 insertions(+)
>>>>>  create mode 100644 drivers/phy/phy-bcm-ns2-usbdrd.c
>>>>>
>>>>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
>>>>> index afaf7b6..8028da7 100644
>>>>> --- a/drivers/phy/Kconfig
>>>>> +++ b/drivers/phy/Kconfig
>>>>> @@ -507,6 +507,19 @@ config PHY_CYGNUS_PCIE
>>>>>         Enable this to support the Broadcom Cygnus PCIe PHY.
>>>>>         If unsure, say N.
>>>>>
>>>>> +config PHY_NS2_USB_DRD
>>>>> +     tristate "Broadcom Northstar2 USB DRD PHY support"
>>>>> +     depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST)
>>>>> +     select GENERIC_PHY
>>>>> +     select EXTCON
>>>>> +     default ARCH_BCM_IPROC
>>>>> +     help
>>>>> +       Enable this to support the Broadcom Northstar2 USB DRD PHY.
>>>>> +       This driver initializes the PHY in either HOST or DEVICE mode.
>>>>> +       The host or device configuration is read from device tree.
>>>>> +
>>>>> +       If unsure, say N.
>>>>> +
>>>>>  source "drivers/phy/tegra/Kconfig"
>>>>>
>>>>>  config PHY_NS2_PCIE
>>>>> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
>>>>> index f8047b4..e5fbb0e 100644
>>>>> --- a/drivers/phy/Makefile
>>>>> +++ b/drivers/phy/Makefile
>>>>> @@ -61,6 +61,7 @@ obj-$(CONFIG_PHY_TUSB1210)          += phy-tusb1210.o
>>>>>  obj-$(CONFIG_PHY_BRCM_SATA)          += phy-brcm-sata.o
>>>>>  obj-$(CONFIG_PHY_PISTACHIO_USB)              += phy-pistachio-usb.o
>>>>>  obj-$(CONFIG_PHY_CYGNUS_PCIE)                += phy-bcm-cygnus-pcie.o
>>>>> +obj-$(CONFIG_PHY_NS2_USB_DRD)                += phy-bcm-ns2-usbdrd.o
>>>>>  obj-$(CONFIG_ARCH_TEGRA) += tegra/
>>>>>  obj-$(CONFIG_PHY_NS2_PCIE)           += phy-bcm-ns2-pcie.o
>>>>>  obj-$(CONFIG_PHY_MESON8B_USB2)               += phy-meson8b-usb2.o
>>>>> diff --git a/drivers/phy/phy-bcm-ns2-usbdrd.c b/drivers/phy/phy-bcm-ns2-usbdrd.c
>>>>> new file mode 100644
>>>>> index 0000000..8e05c70
>>>>> --- /dev/null
>>>>> +++ b/drivers/phy/phy-bcm-ns2-usbdrd.c
>>>>> @@ -0,0 +1,466 @@
>>>>> +/*
>>>>> + * Copyright (C) 2017 Broadcom
>>>>> + *
>>>>> + * 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 version 2.
>>>>> + *
>>>>> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
>>>>> + * kind, whether express or implied; without even the implied warranty
>>>>> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>>>> + * GNU General Public License for more details.
>>>>> + */
>>>>> +
>>>>> +#include <linux/delay.h>
>>>>> +#include <linux/extcon.h>
>>>>> +#include <linux/gpio.h>
>>>>> +#include <linux/gpio/consumer.h>
>>>>> +#include <linux/init.h>
>>>>> +#include <linux/interrupt.h>
>>>>> +#include <linux/io.h>
>>>>> +#include <linux/irq.h>
>>>>> +#include <linux/mfd/syscon.h>
>>>>> +#include <linux/module.h>
>>>>> +#include <linux/of.h>
>>>>> +#include <linux/of_address.h>
>>>>> +#include <linux/phy/phy.h>
>>>>> +#include <linux/platform_device.h>
>>>>> +#include <linux/regmap.h>
>>>>> +#include <linux/slab.h>
>>>>> +#include <linux/workqueue.h>
>>>>> +
>>>>> +#define ICFG_DRD_AFE         0x0
>>>>> +#define ICFG_MISC_STAT               0x18
>>>>> +#define ICFG_DRD_P0CTL               0x1C
>>>>> +#define ICFG_STRAP_CTRL              0x20
>>>>> +#define ICFG_FSM_CTRL                0x24
>>>>> +
>>>>> +#define ICFG_DEV_BIT         BIT(2)
>>>>> +#define IDM_RST_BIT          BIT(0)
>>>>> +#define AFE_CORERDY_VDDC     BIT(18)
>>>>> +#define PHY_PLL_RESETB               BIT(15)
>>>>> +#define PHY_RESETB           BIT(14)
>>>>> +#define PHY_PLL_LOCK         BIT(0)
>>>>> +
>>>>> +#define DRD_DEV_MODE         BIT(20)
>>>>> +#define OHCI_OVRCUR_POL              BIT(11)
>>>>> +#define ICFG_OFF_MODE                BIT(6)
>>>>> +#define PLL_LOCK_RETRY               1000
>>>>> +
>>>>> +#define EVT_DEVICE           0
>>>>> +#define EVT_HOST             1
>>>>> +
>>>>> +#define DRD_HOST_MODE                (BIT(2) | BIT(3))
>>>>> +#define DRD_DEVICE_MODE              (BIT(4) | BIT(5))
>>>>> +#define DRD_HOST_VAL         0x803
>>>>> +#define DRD_DEV_VAL          0x807
>>>>> +#define GPIO_DELAY           20
>>>>> +
>>>>> +struct ns2_phy_data;
>>>>> +struct ns2_phy_driver {
>>>>> +     void __iomem *icfgdrd_regs;
>>>>> +     void __iomem *idmdrd_rst_ctrl;
>>>>> +     void __iomem *crmu_usb2_ctrl;
>>>>> +     void __iomem *usb2h_strap_reg;
>>>>> +     struct ns2_phy_data *data;
>>>>> +     struct extcon_specific_cable_nb extcon_dev;
>>>>> +     struct extcon_specific_cable_nb extcon_host;
>>>>
>>>> The above two members are not used in the driver.
>>>
>>> Missed out to remove them. Will do.
>>>
>>>>> +     struct extcon_dev *edev;
>>>>
>>>> Does USB DRD driver waits for extcon events? If not using extcon here is bogus.
>>>
>>> DRD driver uses extcon events to disconnect/connect gadget driver runtime.
>>
>> I meant USB Device controller driver. It's not capable of DRD.
>
> all right. Btw which USB controller driver uses this?

Synopsys UDC driver currently in drivers/usb/gadget/amd5536udc.c and
drivers/usb/gadget/amd556udc_pci.c
As of 4.12.rc1 first patch (out of 6) that splits the old driver
that's PCI based is applied by the maintainer.
Rest of the patches that includes renaming the driver based on
synopsys IP and platform driver support
are to be merged yet.

>
> -Kishon

  reply	other threads:[~2017-06-02 12:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 10:12 [PATCH v6 0/3] Support for USB DRD Phy driver for NS2 Raviteja Garimella
2017-05-31 10:12 ` Raviteja Garimella
2017-05-31 10:12 ` [PATCH v6 1/3] dt-bindings:phy:Add DT bindings documentation for NS2 USB DRD phy Raviteja Garimella
2017-05-31 10:12   ` Raviteja Garimella
2017-05-31 10:12   ` Raviteja Garimella
2017-05-31 10:12 ` [PATCH v6 2/3] phy:phy-bcm-ns2-usbdrd:Broadcom USB DRD Phy driver for Northstar2 Raviteja Garimella
2017-05-31 10:12   ` Raviteja Garimella
2017-06-02 10:29   ` Kishon Vijay Abraham I
2017-06-02 10:29     ` Kishon Vijay Abraham I
2017-06-02 10:29     ` Kishon Vijay Abraham I
2017-06-02 11:48     ` Raviteja Garimella
2017-06-02 11:48       ` Raviteja Garimella
2017-06-02 11:48       ` Raviteja Garimella
2017-06-02 11:51       ` Raviteja Garimella
2017-06-02 11:51         ` Raviteja Garimella
2017-06-02 11:51         ` Raviteja Garimella
2017-06-02 11:56         ` Kishon Vijay Abraham I
2017-06-02 11:56           ` Kishon Vijay Abraham I
2017-06-02 11:56           ` Kishon Vijay Abraham I
2017-06-02 12:06           ` Raviteja Garimella [this message]
2017-06-02 12:06             ` Raviteja Garimella
2017-05-31 10:12 ` [PATCH v6 3/3] arm64: dts: NS2: Add USB DRD PHY device tree node Raviteja Garimella
2017-05-31 10:12   ` Raviteja Garimella
2017-05-31 10:12   ` Raviteja Garimella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEHZuqMVE+c-AWMK5wfJhJrYVwYT-Yi8=9q5WqcvySDJRb9eHQ@mail.gmail.com' \
    --to=raviteja.garimella@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jonmason@broadcom.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rjui@broadcom.com \
    --cc=robh+dt@kernel.org \
    --cc=sbranden@broadcom.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.