From: hayashi.kunihiko@socionext.com (Kunihiko Hayashi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] phy: socionext: add USB3 PHY driver for UniPhier SoC
Date: Wed, 11 Jul 2018 21:05:14 +0900 [thread overview]
Message-ID: <20180711210514.BB32.4A936039@socionext.com> (raw)
In-Reply-To: <20180709202319.1091.4A936039@socionext.com>
On Mon, 9 Jul 2018 20:23:19 +0900 <hayashi.kunihiko@socionext.com> wrote:
> Hi Kishon,
> Thank you for your comments.
>
> On Mon, 9 Jul 2018 10:49:50 +0530 <kishon@ti.com> wrote:
>
> > Hi,
> >
> > On Friday 29 June 2018 02:08 PM, Kunihiko Hayashi wrote:
> > > Add a driver for PHY interface built into USB3 controller
> > > implemented in UniPhier SoCs.
> > > This driver supports High-Speed PHY and Super-Speed PHY.
> > >
> > > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> > > Signed-off-by: Motoya Tanigawa <tanigawa.motoya@socionext.com>
> > > Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > > ---
> > > drivers/phy/Kconfig | 1 +
> > > drivers/phy/Makefile | 1 +
> > > drivers/phy/socionext/Kconfig | 12 +
> > > drivers/phy/socionext/Makefile | 6 +
> > > drivers/phy/socionext/phy-uniphier-usb3hs.c | 422 ++++++++++++++++++++++++++++
> > > drivers/phy/socionext/phy-uniphier-usb3ss.c | 369 ++++++++++++++++++++++++
> > > 6 files changed, 811 insertions(+)
> > > create mode 100644 drivers/phy/socionext/Kconfig
> > > create mode 100644 drivers/phy/socionext/Makefile
> > > create mode 100644 drivers/phy/socionext/phy-uniphier-usb3hs.c
> > > create mode 100644 drivers/phy/socionext/phy-uniphier-usb3ss.c
>
> (snip...)
>
> > > --- /dev/null
> > > +++ b/drivers/phy/socionext/phy-uniphier-usb3hs.c
> > > @@ -0,0 +1,422 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * phy-uniphier-usb3hs.c - HS-PHY driver for Socionext UniPhier USB3 controller
> > > + * Copyright 2015-2018 Socionext Inc.
> > > + * Author:
> > > + * Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> > > + * Contributors:
> > > + * Motoya Tanigawa <tanigawa.motoya@socionext.com>
> > > + * Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > > + */
> > > +
> > > +#include <linux/bitfield.h>
> > > +#include <linux/bitops.h>
> > > +#include <linux/clk.h>
> > > +#include <linux/io.h>
> > > +#include <linux/mfd/syscon.h>
> > > +#include <linux/module.h>
> > > +#include <linux/nvmem-consumer.h>
> > > +#include <linux/of.h>
> > > +#include <linux/of_platform.h>
> > > +#include <linux/phy/phy.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/reset.h>
> > > +#include <linux/slab.h>
> > > +
> > > +#define HSPHY_CFG0 0x0
> > > +#define HSPHY_CFG0_HS_I_MASK GENMASK(31, 28)
> > > +#define HSPHY_CFG0_HSDISC_MASK GENMASK(27, 26)
> > > +#define HSPHY_CFG0_SWING_MASK GENMASK(17, 16)
> > > +#define HSPHY_CFG0_SEL_T_MASK GENMASK(15, 12)
> > > +#define HSPHY_CFG0_RTERM_MASK GENMASK(7, 6)
> > > +#define HSPHY_CFG0_TRIMMASK (HSPHY_CFG0_HS_I_MASK \
> > > + | HSPHY_CFG0_SEL_T_MASK \
> > > + | HSPHY_CFG0_RTERM_MASK)
> > > +
> > > +#define HSPHY_CFG1 0x4
> > > +#define HSPHY_CFG1_DAT_EN BIT(29)
> > > +#define HSPHY_CFG1_ADR_EN BIT(28)
> > > +#define HSPHY_CFG1_ADR_MASK GENMASK(27, 16)
> > > +#define HSPHY_CFG1_DAT_MASK GENMASK(23, 16)
> > > +
> > > +#define MAX_CLKS 3
> > > +#define MAX_RSTS 2
> > > +#define MAX_PHY_PARAMS 1
> > > +
> > > +struct uniphier_u3hsphy_param {
> > > + u32 addr;
> > > + u32 mask;
> > > + u32 val;
> > > +};
> >
> > I'd like to avoid configure the PHY this way, since it's impossible to know
> > which register is being configured.
>
This way might be misunderstood.
These HS-PHY and SS-PHY have "internal" registers, which are not memory-mapped.
And to access these internal registers, we need to specify the number
corresponding to the register.
The "addr" in "uniphier_u3hsphy_param" is just the number of the register.
The "mask" shows a bitfield of the register, that means one of PHY parameters.
The "value" shows a parameter value to set to the bitfield.
> I see.
> In order to know which register is set, I'll add definitions for address
> and mask.
> And I think the driver might have functions for each SoC to configure
> the registers instead of uniphier_u3hsphy_param.
Then, I think it's sufficient to define a macro with a meaningful label for
each bitfield, and PHY parameters are expressed like that.
{ 10, FOO_BAR_MODE, 0x2 }, /* set 2 to FOO_BAR_MODE in register 10 */
In this case, we need to shift "value" according to "mask".
Thank you,
---
Best Regards,
Kunihiko Hayashi
WARNING: multiple messages have this Message-ID (diff)
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu@linaro.org>,
Jassi Brar <jaswinder.singh@linaro.org>
Subject: Re: [PATCH 2/4] phy: socionext: add USB3 PHY driver for UniPhier SoC
Date: Wed, 11 Jul 2018 21:05:14 +0900 [thread overview]
Message-ID: <20180711210514.BB32.4A936039@socionext.com> (raw)
In-Reply-To: <20180709202319.1091.4A936039@socionext.com>
On Mon, 9 Jul 2018 20:23:19 +0900 <hayashi.kunihiko@socionext.com> wrote:
> Hi Kishon,
> Thank you for your comments.
>
> On Mon, 9 Jul 2018 10:49:50 +0530 <kishon@ti.com> wrote:
>
> > Hi,
> >
> > On Friday 29 June 2018 02:08 PM, Kunihiko Hayashi wrote:
> > > Add a driver for PHY interface built into USB3 controller
> > > implemented in UniPhier SoCs.
> > > This driver supports High-Speed PHY and Super-Speed PHY.
> > >
> > > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> > > Signed-off-by: Motoya Tanigawa <tanigawa.motoya@socionext.com>
> > > Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > > ---
> > > drivers/phy/Kconfig | 1 +
> > > drivers/phy/Makefile | 1 +
> > > drivers/phy/socionext/Kconfig | 12 +
> > > drivers/phy/socionext/Makefile | 6 +
> > > drivers/phy/socionext/phy-uniphier-usb3hs.c | 422 ++++++++++++++++++++++++++++
> > > drivers/phy/socionext/phy-uniphier-usb3ss.c | 369 ++++++++++++++++++++++++
> > > 6 files changed, 811 insertions(+)
> > > create mode 100644 drivers/phy/socionext/Kconfig
> > > create mode 100644 drivers/phy/socionext/Makefile
> > > create mode 100644 drivers/phy/socionext/phy-uniphier-usb3hs.c
> > > create mode 100644 drivers/phy/socionext/phy-uniphier-usb3ss.c
>
> (snip...)
>
> > > --- /dev/null
> > > +++ b/drivers/phy/socionext/phy-uniphier-usb3hs.c
> > > @@ -0,0 +1,422 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * phy-uniphier-usb3hs.c - HS-PHY driver for Socionext UniPhier USB3 controller
> > > + * Copyright 2015-2018 Socionext Inc.
> > > + * Author:
> > > + * Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> > > + * Contributors:
> > > + * Motoya Tanigawa <tanigawa.motoya@socionext.com>
> > > + * Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > > + */
> > > +
> > > +#include <linux/bitfield.h>
> > > +#include <linux/bitops.h>
> > > +#include <linux/clk.h>
> > > +#include <linux/io.h>
> > > +#include <linux/mfd/syscon.h>
> > > +#include <linux/module.h>
> > > +#include <linux/nvmem-consumer.h>
> > > +#include <linux/of.h>
> > > +#include <linux/of_platform.h>
> > > +#include <linux/phy/phy.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/reset.h>
> > > +#include <linux/slab.h>
> > > +
> > > +#define HSPHY_CFG0 0x0
> > > +#define HSPHY_CFG0_HS_I_MASK GENMASK(31, 28)
> > > +#define HSPHY_CFG0_HSDISC_MASK GENMASK(27, 26)
> > > +#define HSPHY_CFG0_SWING_MASK GENMASK(17, 16)
> > > +#define HSPHY_CFG0_SEL_T_MASK GENMASK(15, 12)
> > > +#define HSPHY_CFG0_RTERM_MASK GENMASK(7, 6)
> > > +#define HSPHY_CFG0_TRIMMASK (HSPHY_CFG0_HS_I_MASK \
> > > + | HSPHY_CFG0_SEL_T_MASK \
> > > + | HSPHY_CFG0_RTERM_MASK)
> > > +
> > > +#define HSPHY_CFG1 0x4
> > > +#define HSPHY_CFG1_DAT_EN BIT(29)
> > > +#define HSPHY_CFG1_ADR_EN BIT(28)
> > > +#define HSPHY_CFG1_ADR_MASK GENMASK(27, 16)
> > > +#define HSPHY_CFG1_DAT_MASK GENMASK(23, 16)
> > > +
> > > +#define MAX_CLKS 3
> > > +#define MAX_RSTS 2
> > > +#define MAX_PHY_PARAMS 1
> > > +
> > > +struct uniphier_u3hsphy_param {
> > > + u32 addr;
> > > + u32 mask;
> > > + u32 val;
> > > +};
> >
> > I'd like to avoid configure the PHY this way, since it's impossible to know
> > which register is being configured.
>
This way might be misunderstood.
These HS-PHY and SS-PHY have "internal" registers, which are not memory-mapped.
And to access these internal registers, we need to specify the number
corresponding to the register.
The "addr" in "uniphier_u3hsphy_param" is just the number of the register.
The "mask" shows a bitfield of the register, that means one of PHY parameters.
The "value" shows a parameter value to set to the bitfield.
> I see.
> In order to know which register is set, I'll add definitions for address
> and mask.
> And I think the driver might have functions for each SoC to configure
> the registers instead of uniphier_u3hsphy_param.
Then, I think it's sufficient to define a macro with a meaningful label for
each bitfield, and PHY parameters are expressed like that.
{ 10, FOO_BAR_MODE, 0x2 }, /* set 2 to FOO_BAR_MODE in register 10 */
In this case, we need to shift "value" according to "mask".
Thank you,
---
Best Regards,
Kunihiko Hayashi
WARNING: multiple messages have this Message-ID (diff)
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
Masami Hiramatsu <masami.hiramatsu@linaro.org>,
Jassi Brar <jaswinder.singh@linaro.org>
Subject: Re: [PATCH 2/4] phy: socionext: add USB3 PHY driver for UniPhier SoC
Date: Wed, 11 Jul 2018 21:05:14 +0900 [thread overview]
Message-ID: <20180711210514.BB32.4A936039@socionext.com> (raw)
In-Reply-To: <20180709202319.1091.4A936039@socionext.com>
On Mon, 9 Jul 2018 20:23:19 +0900 <hayashi.kunihiko@socionext.com> wrote:
> Hi Kishon,
> Thank you for your comments.
>
> On Mon, 9 Jul 2018 10:49:50 +0530 <kishon@ti.com> wrote:
>
> > Hi,
> >
> > On Friday 29 June 2018 02:08 PM, Kunihiko Hayashi wrote:
> > > Add a driver for PHY interface built into USB3 controller
> > > implemented in UniPhier SoCs.
> > > This driver supports High-Speed PHY and Super-Speed PHY.
> > >
> > > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> > > Signed-off-by: Motoya Tanigawa <tanigawa.motoya@socionext.com>
> > > Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > > ---
> > > drivers/phy/Kconfig | 1 +
> > > drivers/phy/Makefile | 1 +
> > > drivers/phy/socionext/Kconfig | 12 +
> > > drivers/phy/socionext/Makefile | 6 +
> > > drivers/phy/socionext/phy-uniphier-usb3hs.c | 422 ++++++++++++++++++++++++++++
> > > drivers/phy/socionext/phy-uniphier-usb3ss.c | 369 ++++++++++++++++++++++++
> > > 6 files changed, 811 insertions(+)
> > > create mode 100644 drivers/phy/socionext/Kconfig
> > > create mode 100644 drivers/phy/socionext/Makefile
> > > create mode 100644 drivers/phy/socionext/phy-uniphier-usb3hs.c
> > > create mode 100644 drivers/phy/socionext/phy-uniphier-usb3ss.c
>
> (snip...)
>
> > > --- /dev/null
> > > +++ b/drivers/phy/socionext/phy-uniphier-usb3hs.c
> > > @@ -0,0 +1,422 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * phy-uniphier-usb3hs.c - HS-PHY driver for Socionext UniPhier USB3 controller
> > > + * Copyright 2015-2018 Socionext Inc.
> > > + * Author:
> > > + * Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> > > + * Contributors:
> > > + * Motoya Tanigawa <tanigawa.motoya@socionext.com>
> > > + * Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > > + */
> > > +
> > > +#include <linux/bitfield.h>
> > > +#include <linux/bitops.h>
> > > +#include <linux/clk.h>
> > > +#include <linux/io.h>
> > > +#include <linux/mfd/syscon.h>
> > > +#include <linux/module.h>
> > > +#include <linux/nvmem-consumer.h>
> > > +#include <linux/of.h>
> > > +#include <linux/of_platform.h>
> > > +#include <linux/phy/phy.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/reset.h>
> > > +#include <linux/slab.h>
> > > +
> > > +#define HSPHY_CFG0 0x0
> > > +#define HSPHY_CFG0_HS_I_MASK GENMASK(31, 28)
> > > +#define HSPHY_CFG0_HSDISC_MASK GENMASK(27, 26)
> > > +#define HSPHY_CFG0_SWING_MASK GENMASK(17, 16)
> > > +#define HSPHY_CFG0_SEL_T_MASK GENMASK(15, 12)
> > > +#define HSPHY_CFG0_RTERM_MASK GENMASK(7, 6)
> > > +#define HSPHY_CFG0_TRIMMASK (HSPHY_CFG0_HS_I_MASK \
> > > + | HSPHY_CFG0_SEL_T_MASK \
> > > + | HSPHY_CFG0_RTERM_MASK)
> > > +
> > > +#define HSPHY_CFG1 0x4
> > > +#define HSPHY_CFG1_DAT_EN BIT(29)
> > > +#define HSPHY_CFG1_ADR_EN BIT(28)
> > > +#define HSPHY_CFG1_ADR_MASK GENMASK(27, 16)
> > > +#define HSPHY_CFG1_DAT_MASK GENMASK(23, 16)
> > > +
> > > +#define MAX_CLKS 3
> > > +#define MAX_RSTS 2
> > > +#define MAX_PHY_PARAMS 1
> > > +
> > > +struct uniphier_u3hsphy_param {
> > > + u32 addr;
> > > + u32 mask;
> > > + u32 val;
> > > +};
> >
> > I'd like to avoid configure the PHY this way, since it's impossible to know
> > which register is being configured.
>
This way might be misunderstood.
These HS-PHY and SS-PHY have "internal" registers, which are not memory-mapped.
And to access these internal registers, we need to specify the number
corresponding to the register.
The "addr" in "uniphier_u3hsphy_param" is just the number of the register.
The "mask" shows a bitfield of the register, that means one of PHY parameters.
The "value" shows a parameter value to set to the bitfield.
> I see.
> In order to know which register is set, I'll add definitions for address
> and mask.
> And I think the driver might have functions for each SoC to configure
> the registers instead of uniphier_u3hsphy_param.
Then, I think it's sufficient to define a macro with a meaningful label for
each bitfield, and PHY parameters are expressed like that.
{ 10, FOO_BAR_MODE, 0x2 }, /* set 2 to FOO_BAR_MODE in register 10 */
In this case, we need to shift "value" according to "mask".
Thank you,
---
Best Regards,
Kunihiko Hayashi
next prev parent reply other threads:[~2018-07-11 12:05 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 8:38 [PATCH 0/4] phy: socionext: add new UniPhier USB PHY driver support Kunihiko Hayashi
2018-06-29 8:38 ` Kunihiko Hayashi
2018-06-29 8:38 ` [PATCH 1/4] dt-bindings: phy: add DT bindings for UniPhier USB3 PHY driver Kunihiko Hayashi
2018-06-29 8:38 ` Kunihiko Hayashi
2018-07-16 20:50 ` Rob Herring
2018-07-16 20:50 ` Rob Herring
2018-07-17 10:55 ` Kunihiko Hayashi
2018-07-17 10:55 ` Kunihiko Hayashi
2018-07-17 10:55 ` Kunihiko Hayashi
2018-07-17 14:16 ` Rob Herring
2018-07-17 14:16 ` Rob Herring
2018-07-24 11:10 ` Kunihiko Hayashi
2018-07-24 11:10 ` Kunihiko Hayashi
2018-08-14 16:30 ` Rob Herring
2018-06-29 8:38 ` [PATCH 2/4] phy: socionext: add USB3 PHY driver for UniPhier SoC Kunihiko Hayashi
2018-06-29 8:38 ` Kunihiko Hayashi
2018-07-09 5:19 ` Kishon Vijay Abraham I
2018-07-09 5:19 ` Kishon Vijay Abraham I
2018-07-09 5:19 ` Kishon Vijay Abraham I
2018-07-09 11:23 ` Kunihiko Hayashi
2018-07-09 11:23 ` Kunihiko Hayashi
2018-07-09 11:23 ` Kunihiko Hayashi
2018-07-11 12:05 ` Kunihiko Hayashi [this message]
2018-07-11 12:05 ` Kunihiko Hayashi
2018-07-11 12:05 ` Kunihiko Hayashi
2018-07-13 7:15 ` Kishon Vijay Abraham I
2018-07-13 7:15 ` Kishon Vijay Abraham I
2018-07-13 7:15 ` Kishon Vijay Abraham I
2018-07-17 11:27 ` Kunihiko Hayashi
2018-07-17 11:27 ` Kunihiko Hayashi
2018-07-17 11:27 ` Kunihiko Hayashi
2018-07-24 4:01 ` Kishon Vijay Abraham I
2018-07-24 4:01 ` Kishon Vijay Abraham I
2018-07-24 4:01 ` Kishon Vijay Abraham I
2018-07-24 11:02 ` Kunihiko Hayashi
2018-07-24 11:02 ` Kunihiko Hayashi
2018-07-24 11:02 ` Kunihiko Hayashi
2018-06-29 8:39 ` [PATCH 3/4] dt-bindings: phy: add DT bindings for UniPhier USB2 PHY driver Kunihiko Hayashi
2018-06-29 8:39 ` Kunihiko Hayashi
2018-06-29 8:39 ` [PATCH 4/4] phy: socionext: add USB2 PHY driver for UniPhier SoC Kunihiko Hayashi
2018-06-29 8:39 ` Kunihiko Hayashi
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=20180711210514.BB32.4A936039@socionext.com \
--to=hayashi.kunihiko@socionext.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.