From: Shawn Lin <shawn.lin@rock-chips.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
shawn.lin@rock-chips.com, Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org,
Brian Norris <briannorris@chromium.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/2] phy-rockchip-pcie: add set_mode callback
Date: Thu, 13 Jul 2017 10:27:51 +0800 [thread overview]
Message-ID: <623ab689-e848-a7b1-4e13-20e53b7ff11e@rock-chips.com> (raw)
In-Reply-To: <cea27b15-2c2d-a4a9-76f8-f4798c152101@ti.com>
Hi Kishon,
On 2017/7/11 12:45, Kishon Vijay Abraham I wrote:
> Hi,
>
> On Friday 16 June 2017 01:47 PM, Shawn Lin wrote:
>> phy_mode was added for switching USB mode purposely as
>> well as phy_set_mode API. However other types of PHY could
>> also have some miscellaneous setting/modes need to be
>> handled. This patch is gonna support this callback for
>> phy-rockchip-pcie and do some power-saving work there.
>> Note that we just stuff in some other values other that the
>> existing phy_mode and convert it in the coressponding driver
>> instead, otherwise we should extend the phy_mode again which
>> it doesn't make sense to add in new driver's specificed value.
>> Overall it looks fine to me as the controller's driver and the
>> phy's driver are paired so that the caller and the consumer should
>> be able to keep the value(mode) in consistent.
>
> I really don't prefer using an API other that what it is intended for. We have
> to come up with a better way for handling this.
okay.
>
> IIUC this patch sets unused lanes in idle mode? If yes, then can't we model
> each lane as a separate phy, so that we can power-on/power-off each lane
> independently.
I will have a try and see how far I will go.
Thanks.
>
> Thanks
> Kishon
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>> drivers/phy/rockchip/phy-rockchip-pcie.c | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c
>> index 6904633..9ffad15 100644
>> --- a/drivers/phy/rockchip/phy-rockchip-pcie.c
>> +++ b/drivers/phy/rockchip/phy-rockchip-pcie.c
>> @@ -255,11 +255,33 @@ static int rockchip_pcie_phy_exit(struct phy *phy)
>> return 0;
>> }
>>
>> +static int rockchip_pcie_phy_set_mode(struct phy *phy, enum phy_mode mode)
>> +{
>> + struct rockchip_pcie_phy *rk_phy = phy_get_drvdata(phy);
>> + u8 map = (u8)mode;
>> + int i;
>> +
>> + for (i = 0; i < PHY_MAX_LANE_NUM; i++) {
>> + if (map & BIT(i))
>> + continue;
>> +
>> + dev_dbg(&phy->dev, "idling lane %d\n", i);
>> + regmap_write(rk_phy->reg_base,
>> + rk_phy->phy_data->pcie_laneoff,
>> + HIWORD_UPDATE(PHY_LANE_IDLE_OFF,
>> + PHY_LANE_IDLE_MASK,
>> + PHY_LANE_IDLE_A_SHIFT + i));
>> + }
>> +
>> + return 0;
>> +}
>> +
>> static const struct phy_ops ops = {
>> .init = rockchip_pcie_phy_init,
>> .exit = rockchip_pcie_phy_exit,
>> .power_on = rockchip_pcie_phy_power_on,
>> .power_off = rockchip_pcie_phy_power_off,
>> + .set_mode = rockchip_pcie_phy_set_mode,
>> .owner = THIS_MODULE,
>> };
>>
>>
>
>
>
prev parent reply other threads:[~2017-07-13 2:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 8:17 [PATCH 1/2] phy-rockchip-pcie: add set_mode callback Shawn Lin
2017-06-16 8:17 ` [PATCH 2/2] PCI: rockchip: do some post-cleanup work for phy Shawn Lin
2017-07-05 7:18 ` [PATCH 1/2] phy-rockchip-pcie: add set_mode callback Shawn Lin
2017-07-10 20:39 ` Bjorn Helgaas
[not found] ` <1497601068-181656-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-07-11 4:45 ` Kishon Vijay Abraham I
2017-07-11 5:20 ` Brian Norris
2017-07-17 21:03 ` Brian Norris
2017-07-13 2:27 ` Shawn Lin [this message]
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=623ab689-e848-a7b1-4e13-20e53b7ff11e@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=bhelgaas@google.com \
--cc=briannorris@chromium.org \
--cc=heiko@sntech.de \
--cc=kishon@ti.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox