All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Manish Narani <MNARANI@xilinx.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	Michal Simek <michals@xilinx.com>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	git <git@xilinx.com>
Subject: RE: [PATCH 2/2] usb: dwc3: Add driver for Xilinx platforms
Date: Tue, 01 Sep 2020 15:15:11 +0300	[thread overview]
Message-ID: <877dtd7kxc.fsf@kernel.org> (raw)
In-Reply-To: <BYAPR02MB5896669D47783D06F779608BC1520@BYAPR02MB5896.namprd02.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 3001 bytes --]


Hi,

(remember to break your lines at 80-columns)

Manish Narani <MNARANI@xilinx.com> writes:

<snip>

>> > +		goto err;
>> > +	}
>> > +
>> > +	ret = dwc3_xlnx_rst_assert(priv_data->apbrst);
>> > +	if (ret < 0) {
>> > +		dev_err(dev, "%s: %d: Failed to assert reset\n",
>> > +			__func__, __LINE__);
>> 
>> 		dev_err(dev, "Failed to assert APB reset\n");
>> 
>> > +		goto err;
>> > +	}
>> > +
>> > +	ret = phy_init(priv_data->usb3_phy);
>> 
>> dwc3 core should be handling this already
>
> The USB controller used in Xilinx ZynqMP platform uses xilinx GT phy
> which has 4 GT lanes and can used by 4 peripherals at a time.

At the same time or are they mutually exclusive?

> This USB controller uses 1 GT phy lane among the 4 GT lanes. To
> configure the GT lane for USB controller, the below sequence is
> expected.
>
> 1. Assert the USB controller resets.
> 2. Configure the Xilinx GT phy lane for USB controller (phy_init).
> 3. De-assert the USB controller resets and configure PIPE.
> 4. Wait for PLL of the GT lane used by USB to be locked
>    (phy_power_on).

it seems like you need to extend the PHY framework and teach it about
lane configuration.

> The dwc3 core by default does the phy_init() and phy_power_on() but
> the default sequence doesn't work with Xilinx platforms. Because of
> this reason, we have introduced this new driver to support the new
> sequence.

Instead of teaching the relevant framework about your new requirements
;-)

>> > +	if (ret < 0) {
>> > +		dev_err(dev, "%s: %d: Failed to release reset\n",
>> > +			__func__, __LINE__);
>> > +		goto err;
>> > +	}
>> > +
>> > +	/* Set PIPE power present signal */
>> > +	writel(PIPE_POWER_ON, priv_data->regs + PIPE_POWER_OFFSET);
>> > +
>> > +	/* Clear PIPE CLK signal */
>> > +	writel(PIPE_CLK_OFF, priv_data->regs + PIPE_CLK_OFFSET);
>> 
>> shouldn't this be hidden under clk_enable()?
>
> Though its naming suggests something related to clock framework, it is
> a register in the Xilinx USB controller space which configures the
> PIPE clock coming from Serdes.

PIPE clock is a clock. It just so happens that the source is the PHY
itself.

>> > +static int dwc3_xlnx_resume(struct device *dev)
>> > +{
>> > +	struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
>> > +
>> > +	return clk_bulk_enable(priv_data->num_clocks, priv_data->clks);
>> > +}
>> 
>> you have the same implementation for both types of suspend/resume. Maybe
>> extract dwc3_xlnx_{suspend,resume}_common() and just call it from both
>> callbacks?
>
> Going forward we have a plan to add Hibernation handling calls in
> dwc3_xlnx_suspend/resume functions.

at that moment and only at that moment, should you be worried about
splitting them.

> For that reason, these APIs are kept separate. If you insist, I can
> make them common for now and separate them later when I add
> hibernation code.

It would be a little better, no?

cheers

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Manish Narani <MNARANI@xilinx.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	Michal Simek <michals@xilinx.com>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>, git <git@xilinx.com>
Subject: RE: [PATCH 2/2] usb: dwc3: Add driver for Xilinx platforms
Date: Tue, 01 Sep 2020 15:15:11 +0300	[thread overview]
Message-ID: <877dtd7kxc.fsf@kernel.org> (raw)
In-Reply-To: <BYAPR02MB5896669D47783D06F779608BC1520@BYAPR02MB5896.namprd02.prod.outlook.com>


[-- Attachment #1.1: Type: text/plain, Size: 3001 bytes --]


Hi,

(remember to break your lines at 80-columns)

Manish Narani <MNARANI@xilinx.com> writes:

<snip>

>> > +		goto err;
>> > +	}
>> > +
>> > +	ret = dwc3_xlnx_rst_assert(priv_data->apbrst);
>> > +	if (ret < 0) {
>> > +		dev_err(dev, "%s: %d: Failed to assert reset\n",
>> > +			__func__, __LINE__);
>> 
>> 		dev_err(dev, "Failed to assert APB reset\n");
>> 
>> > +		goto err;
>> > +	}
>> > +
>> > +	ret = phy_init(priv_data->usb3_phy);
>> 
>> dwc3 core should be handling this already
>
> The USB controller used in Xilinx ZynqMP platform uses xilinx GT phy
> which has 4 GT lanes and can used by 4 peripherals at a time.

At the same time or are they mutually exclusive?

> This USB controller uses 1 GT phy lane among the 4 GT lanes. To
> configure the GT lane for USB controller, the below sequence is
> expected.
>
> 1. Assert the USB controller resets.
> 2. Configure the Xilinx GT phy lane for USB controller (phy_init).
> 3. De-assert the USB controller resets and configure PIPE.
> 4. Wait for PLL of the GT lane used by USB to be locked
>    (phy_power_on).

it seems like you need to extend the PHY framework and teach it about
lane configuration.

> The dwc3 core by default does the phy_init() and phy_power_on() but
> the default sequence doesn't work with Xilinx platforms. Because of
> this reason, we have introduced this new driver to support the new
> sequence.

Instead of teaching the relevant framework about your new requirements
;-)

>> > +	if (ret < 0) {
>> > +		dev_err(dev, "%s: %d: Failed to release reset\n",
>> > +			__func__, __LINE__);
>> > +		goto err;
>> > +	}
>> > +
>> > +	/* Set PIPE power present signal */
>> > +	writel(PIPE_POWER_ON, priv_data->regs + PIPE_POWER_OFFSET);
>> > +
>> > +	/* Clear PIPE CLK signal */
>> > +	writel(PIPE_CLK_OFF, priv_data->regs + PIPE_CLK_OFFSET);
>> 
>> shouldn't this be hidden under clk_enable()?
>
> Though its naming suggests something related to clock framework, it is
> a register in the Xilinx USB controller space which configures the
> PIPE clock coming from Serdes.

PIPE clock is a clock. It just so happens that the source is the PHY
itself.

>> > +static int dwc3_xlnx_resume(struct device *dev)
>> > +{
>> > +	struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
>> > +
>> > +	return clk_bulk_enable(priv_data->num_clocks, priv_data->clks);
>> > +}
>> 
>> you have the same implementation for both types of suspend/resume. Maybe
>> extract dwc3_xlnx_{suspend,resume}_common() and just call it from both
>> callbacks?
>
> Going forward we have a plan to add Hibernation handling calls in
> dwc3_xlnx_suspend/resume functions.

at that moment and only at that moment, should you be worried about
splitting them.

> For that reason, these APIs are kept separate. If you insist, I can
> make them common for now and separate them later when I add
> hibernation code.

It would be a little better, no?

cheers

-- 
balbi

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-01 12:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 18:43 [PATCH 0/2] Add a separate DWC3 OF driver for Xilinx platforms Manish Narani
2020-08-26 18:43 ` Manish Narani
2020-08-26 18:44 ` [PATCH 1/2] dt-bindings: usb: dwc3-xilinx: Add documentation for Versal DWC3 Controller Manish Narani
2020-08-26 18:44   ` Manish Narani
2020-09-08 23:05   ` Rob Herring
2020-09-08 23:05     ` Rob Herring
2020-09-09 15:46     ` Manish Narani
2020-09-09 15:46       ` Manish Narani
2020-09-09 16:00       ` Rob Herring
2020-09-09 16:00         ` Rob Herring
2020-08-26 18:44 ` [PATCH 2/2] usb: dwc3: Add driver for Xilinx platforms Manish Narani
2020-08-26 18:44   ` Manish Narani
2020-08-26 19:00   ` Randy Dunlap
2020-08-26 19:00     ` Randy Dunlap
2020-08-27  6:31   ` Felipe Balbi
2020-08-27  6:31     ` Felipe Balbi
2020-08-28 11:41     ` Manish Narani
2020-08-28 11:41       ` Manish Narani
2020-09-01 12:15       ` Felipe Balbi [this message]
2020-09-01 12:15         ` Felipe Balbi
2020-09-09  9:14         ` Manish Narani
2020-09-09  9:14           ` Manish Narani
2020-09-09 10:26           ` Felipe Balbi
2020-09-09 10:26             ` Felipe Balbi
2020-08-27  7:42   ` Chunfeng Yun
2020-08-27  7:42     ` Chunfeng Yun
2020-08-27  9:02   ` Philipp Zabel
2020-08-27  9:02     ` Philipp Zabel
2020-08-27 18:46   ` Robin Murphy
2020-08-27 18:46     ` Robin Murphy
2020-08-28 17:53     ` Manish Narani
2020-08-28 17:53       ` Manish Narani
2020-09-01 12:00       ` Robin Murphy
2020-09-01 12:00         ` Robin Murphy

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=877dtd7kxc.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=MNARANI@xilinx.com \
    --cc=devicetree@vger.kernel.org \
    --cc=git@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michals@xilinx.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.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.