All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Robin Murphy <robin.murphy@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: heiko@sntech.de, linux-pci@vger.kernel.org,
	shawn.lin@rock-chips.com, lgirdwood@gmail.com,
	linux-rockchip@lists.infradead.org, broonie@kernel.org,
	bhelgaas@google.com, andrew.murray@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] PCI: rockchip: Make some regulators non-optional
Date: Sat, 7 Nov 2020 20:54:26 +0800	[thread overview]
Message-ID: <b96b1149-d2fd-c131-c329-3e1c0cf3689d@suse.com> (raw)
In-Reply-To: <4885f7f6-f71e-7d07-6096-7eb061001815@arm.com>



On 2020/11/7 下午8:47, Robin Murphy wrote:
> On 2020-11-07 11:36, Qu Wenruo wrote:
>>
>>
>> On 2019/11/21 上午1:05, Lorenzo Pieralisi wrote:
>>> On Sat, Nov 16, 2019 at 12:54:19PM +0000, Robin Murphy wrote:
>>>> The 0V9 and 1V8 supplies power the PCIe block in the SoC itself, and
>>>> are thus fundamental to PCIe being usable at all. As such, it makes
>>>> sense to treat them as non-optional and rely on dummy regulators if
>>>> not explicitly described.
>>>>
>>>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>>>> ---
>>>>   drivers/pci/controller/pcie-rockchip-host.c | 69
>>>> ++++++++-------------
>>>>   1 file changed, 25 insertions(+), 44 deletions(-)
>>>
>>> Applied to pci/rockchip, thanks.
>>
>> Sorry, this commit is cause regression for RK3399 boards unable to
>> detect the controller anymore.
>>
>> The 1v8 (and 0v9) is causing -517 and reject the controller
>> initialization.
> 
> That's -EPROBE_DEFER, which must mean that a regulator *is* described,
> but you're missing the relevant driver - that's an issue with your
> config/initrd. Being optional should only change the behaviour if the
> supply is totally absent (i.e. you get -ENODEV instead of a dummy
> regulator), so I don't see that it would make any difference in this
> situation anyway :/
> 
>> I'm not a PCI guy, but a quick google search shows these two voltages
>> are not related to PCIE core functionality, especially considering the
>> controller used in RK3399 are mostly to provide NVME support.
> 
> Unlike the 12V and 3V3 supplies to the slot, these supplies are to the
> PCIE_AVDD_0V9 and PCIE_AVDD_1V8 pins on the SoC itself, which the
> datasheet describe as "Supply voltage for PCIE". Having power is kind of
> important for the I/O circuits on all the signal pins to work.
> 
> Now it's almost certainly true that these supplies technically belong to
> the phy rather than the controller, but it's a bit late to change the
> bindings for the sake of semantics.
> 
>> This bug makes all RK3399 users who put root fs into NVME driver unable
>> to boot the device.
>>
>> I really hope some one could test the patch before affecting the end
>> users or at least try to understand how most users would use the PCIE
>> interface for.
> 
> I *am* that end user in this case - I use an M.2 NVME on my board, which
> prompted me to take a look at the regulator handling here in the first
> place, to see if it might be possible to shut up the annoying message
> about a 12V supply that is entirely irrelevant to a board without a
> full-size PCIe slot. I use a mainline-based distro, so I've been running
> this change for nearly a year since it landed in v5.5, and I'm sure many
> others have too. I've not heard of any other complaints in that time...

Sorry for the wrong wording, thank you for your contribution first.

It really makes RK3399 the primary testing bed for 64K page size, and
save me a lot of time.

I'm wondering how the -EPROBE_DEFER happens.
I have only tested two kernel versions, v5.9-rc4 and v5.10-rc2.
The config works for rc4, unless something big changed in rc2, it
shouldn't change much, right?

The 1v8 and 0v9 is just alwayson regulator, IMHO it doesn't really need
special driver.
Or does it?

Thanks,
Qu

> 
> Robin.
> 
>>
>> Thanks,
>> Qu
>>
>>>
>>> Lorenzo
>>>
>>>> diff --git a/drivers/pci/controller/pcie-rockchip-host.c
>>>> b/drivers/pci/controller/pcie-rockchip-host.c
>>>> index ef8e677ce9d1..68525f8ac4d9 100644
>>>> --- a/drivers/pci/controller/pcie-rockchip-host.c
>>>> +++ b/drivers/pci/controller/pcie-rockchip-host.c
>>>> @@ -620,19 +620,13 @@ static int rockchip_pcie_parse_host_dt(struct
>>>> rockchip_pcie *rockchip)
>>>>           dev_info(dev, "no vpcie3v3 regulator found\n");
>>>>       }
>>>>   -    rockchip->vpcie1v8 = devm_regulator_get_optional(dev,
>>>> "vpcie1v8");
>>>> -    if (IS_ERR(rockchip->vpcie1v8)) {
>>>> -        if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV)
>>>> -            return PTR_ERR(rockchip->vpcie1v8);
>>>> -        dev_info(dev, "no vpcie1v8 regulator found\n");
>>>> -    }
>>>> +    rockchip->vpcie1v8 = devm_regulator_get(dev, "vpcie1v8");
>>>> +    if (IS_ERR(rockchip->vpcie1v8))
>>>> +        return PTR_ERR(rockchip->vpcie1v8);
>>>>   -    rockchip->vpcie0v9 = devm_regulator_get_optional(dev,
>>>> "vpcie0v9");
>>>> -    if (IS_ERR(rockchip->vpcie0v9)) {
>>>> -        if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV)
>>>> -            return PTR_ERR(rockchip->vpcie0v9);
>>>> -        dev_info(dev, "no vpcie0v9 regulator found\n");
>>>> -    }
>>>> +    rockchip->vpcie0v9 = devm_regulator_get(dev, "vpcie0v9");
>>>> +    if (IS_ERR(rockchip->vpcie0v9))
>>>> +        return PTR_ERR(rockchip->vpcie0v9);
>>>>         return 0;
>>>>   }
>>>> @@ -658,27 +652,22 @@ static int rockchip_pcie_set_vpcie(struct
>>>> rockchip_pcie *rockchip)
>>>>           }
>>>>       }
>>>>   -    if (!IS_ERR(rockchip->vpcie1v8)) {
>>>> -        err = regulator_enable(rockchip->vpcie1v8);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie1v8 regulator\n");
>>>> -            goto err_disable_3v3;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie1v8);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie1v8 regulator\n");
>>>> +        goto err_disable_3v3;
>>>>       }
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9)) {
>>>> -        err = regulator_enable(rockchip->vpcie0v9);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> -            goto err_disable_1v8;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie0v9);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> +        goto err_disable_1v8;
>>>>       }
>>>>         return 0;
>>>>     err_disable_1v8:
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>>   err_disable_3v3:
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> @@ -897,8 +886,7 @@ static int __maybe_unused
>>>> rockchip_pcie_suspend_noirq(struct device *dev)
>>>>         rockchip_pcie_disable_clocks(rockchip);
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>         return ret;
>>>>   }
>>>> @@ -908,12 +896,10 @@ static int __maybe_unused
>>>> rockchip_pcie_resume_noirq(struct device *dev)
>>>>       struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
>>>>       int err;
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9)) {
>>>> -        err = regulator_enable(rockchip->vpcie0v9);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> -            return err;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie0v9);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> +        return err;
>>>>       }
>>>>         err = rockchip_pcie_enable_clocks(rockchip);
>>>> @@ -939,8 +925,7 @@ static int __maybe_unused
>>>> rockchip_pcie_resume_noirq(struct device *dev)
>>>>   err_pcie_resume:
>>>>       rockchip_pcie_disable_clocks(rockchip);
>>>>   err_disable_0v9:
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>       return err;
>>>>   }
>>>>   @@ -1081,10 +1066,8 @@ static int rockchip_pcie_probe(struct
>>>> platform_device *pdev)
>>>>           regulator_disable(rockchip->vpcie12v);
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>   err_set_vpcie:
>>>>       rockchip_pcie_disable_clocks(rockchip);
>>>>       return err;
>>>> @@ -1108,10 +1091,8 @@ static int rockchip_pcie_remove(struct
>>>> platform_device *pdev)
>>>>           regulator_disable(rockchip->vpcie12v);
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>         return 0;
>>>>   }
>>>> -- 
>>>> 2.17.1
>>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>
>>
> 


WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo <wqu@suse.com>
To: Robin Murphy <robin.murphy@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: heiko@sntech.de, linux-pci@vger.kernel.org,
	shawn.lin@rock-chips.com, lgirdwood@gmail.com,
	linux-rockchip@lists.infradead.org, broonie@kernel.org,
	bhelgaas@google.com, andrew.murray@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] PCI: rockchip: Make some regulators non-optional
Date: Sat, 7 Nov 2020 20:54:26 +0800	[thread overview]
Message-ID: <b96b1149-d2fd-c131-c329-3e1c0cf3689d@suse.com> (raw)
In-Reply-To: <4885f7f6-f71e-7d07-6096-7eb061001815@arm.com>



On 2020/11/7 下午8:47, Robin Murphy wrote:
> On 2020-11-07 11:36, Qu Wenruo wrote:
>>
>>
>> On 2019/11/21 上午1:05, Lorenzo Pieralisi wrote:
>>> On Sat, Nov 16, 2019 at 12:54:19PM +0000, Robin Murphy wrote:
>>>> The 0V9 and 1V8 supplies power the PCIe block in the SoC itself, and
>>>> are thus fundamental to PCIe being usable at all. As such, it makes
>>>> sense to treat them as non-optional and rely on dummy regulators if
>>>> not explicitly described.
>>>>
>>>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>>>> ---
>>>>   drivers/pci/controller/pcie-rockchip-host.c | 69
>>>> ++++++++-------------
>>>>   1 file changed, 25 insertions(+), 44 deletions(-)
>>>
>>> Applied to pci/rockchip, thanks.
>>
>> Sorry, this commit is cause regression for RK3399 boards unable to
>> detect the controller anymore.
>>
>> The 1v8 (and 0v9) is causing -517 and reject the controller
>> initialization.
> 
> That's -EPROBE_DEFER, which must mean that a regulator *is* described,
> but you're missing the relevant driver - that's an issue with your
> config/initrd. Being optional should only change the behaviour if the
> supply is totally absent (i.e. you get -ENODEV instead of a dummy
> regulator), so I don't see that it would make any difference in this
> situation anyway :/
> 
>> I'm not a PCI guy, but a quick google search shows these two voltages
>> are not related to PCIE core functionality, especially considering the
>> controller used in RK3399 are mostly to provide NVME support.
> 
> Unlike the 12V and 3V3 supplies to the slot, these supplies are to the
> PCIE_AVDD_0V9 and PCIE_AVDD_1V8 pins on the SoC itself, which the
> datasheet describe as "Supply voltage for PCIE". Having power is kind of
> important for the I/O circuits on all the signal pins to work.
> 
> Now it's almost certainly true that these supplies technically belong to
> the phy rather than the controller, but it's a bit late to change the
> bindings for the sake of semantics.
> 
>> This bug makes all RK3399 users who put root fs into NVME driver unable
>> to boot the device.
>>
>> I really hope some one could test the patch before affecting the end
>> users or at least try to understand how most users would use the PCIE
>> interface for.
> 
> I *am* that end user in this case - I use an M.2 NVME on my board, which
> prompted me to take a look at the regulator handling here in the first
> place, to see if it might be possible to shut up the annoying message
> about a 12V supply that is entirely irrelevant to a board without a
> full-size PCIe slot. I use a mainline-based distro, so I've been running
> this change for nearly a year since it landed in v5.5, and I'm sure many
> others have too. I've not heard of any other complaints in that time...

Sorry for the wrong wording, thank you for your contribution first.

It really makes RK3399 the primary testing bed for 64K page size, and
save me a lot of time.

I'm wondering how the -EPROBE_DEFER happens.
I have only tested two kernel versions, v5.9-rc4 and v5.10-rc2.
The config works for rc4, unless something big changed in rc2, it
shouldn't change much, right?

The 1v8 and 0v9 is just alwayson regulator, IMHO it doesn't really need
special driver.
Or does it?

Thanks,
Qu

> 
> Robin.
> 
>>
>> Thanks,
>> Qu
>>
>>>
>>> Lorenzo
>>>
>>>> diff --git a/drivers/pci/controller/pcie-rockchip-host.c
>>>> b/drivers/pci/controller/pcie-rockchip-host.c
>>>> index ef8e677ce9d1..68525f8ac4d9 100644
>>>> --- a/drivers/pci/controller/pcie-rockchip-host.c
>>>> +++ b/drivers/pci/controller/pcie-rockchip-host.c
>>>> @@ -620,19 +620,13 @@ static int rockchip_pcie_parse_host_dt(struct
>>>> rockchip_pcie *rockchip)
>>>>           dev_info(dev, "no vpcie3v3 regulator found\n");
>>>>       }
>>>>   -    rockchip->vpcie1v8 = devm_regulator_get_optional(dev,
>>>> "vpcie1v8");
>>>> -    if (IS_ERR(rockchip->vpcie1v8)) {
>>>> -        if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV)
>>>> -            return PTR_ERR(rockchip->vpcie1v8);
>>>> -        dev_info(dev, "no vpcie1v8 regulator found\n");
>>>> -    }
>>>> +    rockchip->vpcie1v8 = devm_regulator_get(dev, "vpcie1v8");
>>>> +    if (IS_ERR(rockchip->vpcie1v8))
>>>> +        return PTR_ERR(rockchip->vpcie1v8);
>>>>   -    rockchip->vpcie0v9 = devm_regulator_get_optional(dev,
>>>> "vpcie0v9");
>>>> -    if (IS_ERR(rockchip->vpcie0v9)) {
>>>> -        if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV)
>>>> -            return PTR_ERR(rockchip->vpcie0v9);
>>>> -        dev_info(dev, "no vpcie0v9 regulator found\n");
>>>> -    }
>>>> +    rockchip->vpcie0v9 = devm_regulator_get(dev, "vpcie0v9");
>>>> +    if (IS_ERR(rockchip->vpcie0v9))
>>>> +        return PTR_ERR(rockchip->vpcie0v9);
>>>>         return 0;
>>>>   }
>>>> @@ -658,27 +652,22 @@ static int rockchip_pcie_set_vpcie(struct
>>>> rockchip_pcie *rockchip)
>>>>           }
>>>>       }
>>>>   -    if (!IS_ERR(rockchip->vpcie1v8)) {
>>>> -        err = regulator_enable(rockchip->vpcie1v8);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie1v8 regulator\n");
>>>> -            goto err_disable_3v3;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie1v8);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie1v8 regulator\n");
>>>> +        goto err_disable_3v3;
>>>>       }
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9)) {
>>>> -        err = regulator_enable(rockchip->vpcie0v9);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> -            goto err_disable_1v8;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie0v9);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> +        goto err_disable_1v8;
>>>>       }
>>>>         return 0;
>>>>     err_disable_1v8:
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>>   err_disable_3v3:
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> @@ -897,8 +886,7 @@ static int __maybe_unused
>>>> rockchip_pcie_suspend_noirq(struct device *dev)
>>>>         rockchip_pcie_disable_clocks(rockchip);
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>         return ret;
>>>>   }
>>>> @@ -908,12 +896,10 @@ static int __maybe_unused
>>>> rockchip_pcie_resume_noirq(struct device *dev)
>>>>       struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
>>>>       int err;
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9)) {
>>>> -        err = regulator_enable(rockchip->vpcie0v9);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> -            return err;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie0v9);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> +        return err;
>>>>       }
>>>>         err = rockchip_pcie_enable_clocks(rockchip);
>>>> @@ -939,8 +925,7 @@ static int __maybe_unused
>>>> rockchip_pcie_resume_noirq(struct device *dev)
>>>>   err_pcie_resume:
>>>>       rockchip_pcie_disable_clocks(rockchip);
>>>>   err_disable_0v9:
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>       return err;
>>>>   }
>>>>   @@ -1081,10 +1066,8 @@ static int rockchip_pcie_probe(struct
>>>> platform_device *pdev)
>>>>           regulator_disable(rockchip->vpcie12v);
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>   err_set_vpcie:
>>>>       rockchip_pcie_disable_clocks(rockchip);
>>>>       return err;
>>>> @@ -1108,10 +1091,8 @@ static int rockchip_pcie_remove(struct
>>>> platform_device *pdev)
>>>>           regulator_disable(rockchip->vpcie12v);
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>         return 0;
>>>>   }
>>>> -- 
>>>> 2.17.1
>>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>
>>
> 


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo <wqu@suse.com>
To: Robin Murphy <robin.murphy@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: heiko@sntech.de, linux-pci@vger.kernel.org,
	shawn.lin@rock-chips.com, lgirdwood@gmail.com,
	linux-rockchip@lists.infradead.org, broonie@kernel.org,
	bhelgaas@google.com, andrew.murray@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] PCI: rockchip: Make some regulators non-optional
Date: Sat, 7 Nov 2020 20:54:26 +0800	[thread overview]
Message-ID: <b96b1149-d2fd-c131-c329-3e1c0cf3689d@suse.com> (raw)
In-Reply-To: <4885f7f6-f71e-7d07-6096-7eb061001815@arm.com>



On 2020/11/7 下午8:47, Robin Murphy wrote:
> On 2020-11-07 11:36, Qu Wenruo wrote:
>>
>>
>> On 2019/11/21 上午1:05, Lorenzo Pieralisi wrote:
>>> On Sat, Nov 16, 2019 at 12:54:19PM +0000, Robin Murphy wrote:
>>>> The 0V9 and 1V8 supplies power the PCIe block in the SoC itself, and
>>>> are thus fundamental to PCIe being usable at all. As such, it makes
>>>> sense to treat them as non-optional and rely on dummy regulators if
>>>> not explicitly described.
>>>>
>>>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>>>> ---
>>>>   drivers/pci/controller/pcie-rockchip-host.c | 69
>>>> ++++++++-------------
>>>>   1 file changed, 25 insertions(+), 44 deletions(-)
>>>
>>> Applied to pci/rockchip, thanks.
>>
>> Sorry, this commit is cause regression for RK3399 boards unable to
>> detect the controller anymore.
>>
>> The 1v8 (and 0v9) is causing -517 and reject the controller
>> initialization.
> 
> That's -EPROBE_DEFER, which must mean that a regulator *is* described,
> but you're missing the relevant driver - that's an issue with your
> config/initrd. Being optional should only change the behaviour if the
> supply is totally absent (i.e. you get -ENODEV instead of a dummy
> regulator), so I don't see that it would make any difference in this
> situation anyway :/
> 
>> I'm not a PCI guy, but a quick google search shows these two voltages
>> are not related to PCIE core functionality, especially considering the
>> controller used in RK3399 are mostly to provide NVME support.
> 
> Unlike the 12V and 3V3 supplies to the slot, these supplies are to the
> PCIE_AVDD_0V9 and PCIE_AVDD_1V8 pins on the SoC itself, which the
> datasheet describe as "Supply voltage for PCIE". Having power is kind of
> important for the I/O circuits on all the signal pins to work.
> 
> Now it's almost certainly true that these supplies technically belong to
> the phy rather than the controller, but it's a bit late to change the
> bindings for the sake of semantics.
> 
>> This bug makes all RK3399 users who put root fs into NVME driver unable
>> to boot the device.
>>
>> I really hope some one could test the patch before affecting the end
>> users or at least try to understand how most users would use the PCIE
>> interface for.
> 
> I *am* that end user in this case - I use an M.2 NVME on my board, which
> prompted me to take a look at the regulator handling here in the first
> place, to see if it might be possible to shut up the annoying message
> about a 12V supply that is entirely irrelevant to a board without a
> full-size PCIe slot. I use a mainline-based distro, so I've been running
> this change for nearly a year since it landed in v5.5, and I'm sure many
> others have too. I've not heard of any other complaints in that time...

Sorry for the wrong wording, thank you for your contribution first.

It really makes RK3399 the primary testing bed for 64K page size, and
save me a lot of time.

I'm wondering how the -EPROBE_DEFER happens.
I have only tested two kernel versions, v5.9-rc4 and v5.10-rc2.
The config works for rc4, unless something big changed in rc2, it
shouldn't change much, right?

The 1v8 and 0v9 is just alwayson regulator, IMHO it doesn't really need
special driver.
Or does it?

Thanks,
Qu

> 
> Robin.
> 
>>
>> Thanks,
>> Qu
>>
>>>
>>> Lorenzo
>>>
>>>> diff --git a/drivers/pci/controller/pcie-rockchip-host.c
>>>> b/drivers/pci/controller/pcie-rockchip-host.c
>>>> index ef8e677ce9d1..68525f8ac4d9 100644
>>>> --- a/drivers/pci/controller/pcie-rockchip-host.c
>>>> +++ b/drivers/pci/controller/pcie-rockchip-host.c
>>>> @@ -620,19 +620,13 @@ static int rockchip_pcie_parse_host_dt(struct
>>>> rockchip_pcie *rockchip)
>>>>           dev_info(dev, "no vpcie3v3 regulator found\n");
>>>>       }
>>>>   -    rockchip->vpcie1v8 = devm_regulator_get_optional(dev,
>>>> "vpcie1v8");
>>>> -    if (IS_ERR(rockchip->vpcie1v8)) {
>>>> -        if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV)
>>>> -            return PTR_ERR(rockchip->vpcie1v8);
>>>> -        dev_info(dev, "no vpcie1v8 regulator found\n");
>>>> -    }
>>>> +    rockchip->vpcie1v8 = devm_regulator_get(dev, "vpcie1v8");
>>>> +    if (IS_ERR(rockchip->vpcie1v8))
>>>> +        return PTR_ERR(rockchip->vpcie1v8);
>>>>   -    rockchip->vpcie0v9 = devm_regulator_get_optional(dev,
>>>> "vpcie0v9");
>>>> -    if (IS_ERR(rockchip->vpcie0v9)) {
>>>> -        if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV)
>>>> -            return PTR_ERR(rockchip->vpcie0v9);
>>>> -        dev_info(dev, "no vpcie0v9 regulator found\n");
>>>> -    }
>>>> +    rockchip->vpcie0v9 = devm_regulator_get(dev, "vpcie0v9");
>>>> +    if (IS_ERR(rockchip->vpcie0v9))
>>>> +        return PTR_ERR(rockchip->vpcie0v9);
>>>>         return 0;
>>>>   }
>>>> @@ -658,27 +652,22 @@ static int rockchip_pcie_set_vpcie(struct
>>>> rockchip_pcie *rockchip)
>>>>           }
>>>>       }
>>>>   -    if (!IS_ERR(rockchip->vpcie1v8)) {
>>>> -        err = regulator_enable(rockchip->vpcie1v8);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie1v8 regulator\n");
>>>> -            goto err_disable_3v3;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie1v8);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie1v8 regulator\n");
>>>> +        goto err_disable_3v3;
>>>>       }
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9)) {
>>>> -        err = regulator_enable(rockchip->vpcie0v9);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> -            goto err_disable_1v8;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie0v9);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> +        goto err_disable_1v8;
>>>>       }
>>>>         return 0;
>>>>     err_disable_1v8:
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>>   err_disable_3v3:
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> @@ -897,8 +886,7 @@ static int __maybe_unused
>>>> rockchip_pcie_suspend_noirq(struct device *dev)
>>>>         rockchip_pcie_disable_clocks(rockchip);
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>         return ret;
>>>>   }
>>>> @@ -908,12 +896,10 @@ static int __maybe_unused
>>>> rockchip_pcie_resume_noirq(struct device *dev)
>>>>       struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
>>>>       int err;
>>>>   -    if (!IS_ERR(rockchip->vpcie0v9)) {
>>>> -        err = regulator_enable(rockchip->vpcie0v9);
>>>> -        if (err) {
>>>> -            dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> -            return err;
>>>> -        }
>>>> +    err = regulator_enable(rockchip->vpcie0v9);
>>>> +    if (err) {
>>>> +        dev_err(dev, "fail to enable vpcie0v9 regulator\n");
>>>> +        return err;
>>>>       }
>>>>         err = rockchip_pcie_enable_clocks(rockchip);
>>>> @@ -939,8 +925,7 @@ static int __maybe_unused
>>>> rockchip_pcie_resume_noirq(struct device *dev)
>>>>   err_pcie_resume:
>>>>       rockchip_pcie_disable_clocks(rockchip);
>>>>   err_disable_0v9:
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>       return err;
>>>>   }
>>>>   @@ -1081,10 +1066,8 @@ static int rockchip_pcie_probe(struct
>>>> platform_device *pdev)
>>>>           regulator_disable(rockchip->vpcie12v);
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>   err_set_vpcie:
>>>>       rockchip_pcie_disable_clocks(rockchip);
>>>>       return err;
>>>> @@ -1108,10 +1091,8 @@ static int rockchip_pcie_remove(struct
>>>> platform_device *pdev)
>>>>           regulator_disable(rockchip->vpcie12v);
>>>>       if (!IS_ERR(rockchip->vpcie3v3))
>>>>           regulator_disable(rockchip->vpcie3v3);
>>>> -    if (!IS_ERR(rockchip->vpcie1v8))
>>>> -        regulator_disable(rockchip->vpcie1v8);
>>>> -    if (!IS_ERR(rockchip->vpcie0v9))
>>>> -        regulator_disable(rockchip->vpcie0v9);
>>>> +    regulator_disable(rockchip->vpcie1v8);
>>>> +    regulator_disable(rockchip->vpcie0v9);
>>>>         return 0;
>>>>   }
>>>> -- 
>>>> 2.17.1
>>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>
>>
> 


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

  reply	other threads:[~2020-11-07 12:54 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16 12:54 [PATCH 1/2] PCI: rockchip: Make some regulators non-optional Robin Murphy
2019-11-16 12:54 ` Robin Murphy
2019-11-16 12:54 ` Robin Murphy
2019-11-16 12:54 ` [PATCH 2/2] PCI: rockchip: Simplify optional regulator handling Robin Murphy
2019-11-16 12:54   ` Robin Murphy
2019-11-16 12:54   ` Robin Murphy
2019-11-18 11:59   ` Mark Brown
2019-11-18 11:59     ` Mark Brown
2019-11-18 12:20     ` Robin Murphy
2019-11-18 12:20       ` Robin Murphy
2019-11-18 12:20       ` Robin Murphy
2019-11-18 12:39       ` Andrew Murray
2019-11-18 12:39         ` Andrew Murray
2019-11-18 12:39         ` Andrew Murray
2019-11-18 13:10         ` Robin Murphy
2019-11-18 13:10           ` Robin Murphy
2019-11-18 13:10           ` Robin Murphy
2019-11-18 13:17           ` Andrew Murray
2019-11-18 13:17             ` Andrew Murray
2019-11-18 13:17             ` Andrew Murray
2019-11-18 14:24     ` Bjorn Helgaas
2019-11-18 14:24       ` Bjorn Helgaas
2019-11-18 14:24       ` Bjorn Helgaas
2019-11-18 18:15       ` Lorenzo Pieralisi
2019-11-18 18:15         ` Lorenzo Pieralisi
2019-11-18 18:15         ` Lorenzo Pieralisi
2019-11-18 18:38         ` Mark Brown
2019-11-18 18:38           ` Mark Brown
2019-11-18 11:57 ` [PATCH 1/2] PCI: rockchip: Make some regulators non-optional Mark Brown
2019-11-18 11:57   ` Mark Brown
2019-11-18 12:28 ` Andrew Murray
2019-11-18 12:28   ` Andrew Murray
2019-11-18 12:28   ` Andrew Murray
2019-11-20 17:05 ` Lorenzo Pieralisi
2019-11-20 17:05   ` Lorenzo Pieralisi
2019-11-20 17:05   ` Lorenzo Pieralisi
2020-11-07 11:36   ` Qu Wenruo
2020-11-07 11:36     ` Qu Wenruo
2020-11-07 11:36     ` Qu Wenruo
2020-11-07 11:57     ` Qu Wenruo
2020-11-07 11:57       ` Qu Wenruo
2020-11-07 11:57       ` Qu Wenruo
2020-11-07 12:47     ` Robin Murphy
2020-11-07 12:47       ` Robin Murphy
2020-11-07 12:47       ` Robin Murphy
2020-11-07 12:54       ` Qu Wenruo [this message]
2020-11-07 12:54         ` Qu Wenruo
2020-11-07 12:54         ` Qu Wenruo
2020-11-07 13:30         ` Qu Wenruo
2020-11-07 13:30           ` Qu Wenruo
2020-11-07 13:30           ` Qu Wenruo
2020-11-09 12:00           ` Robin Murphy
2020-11-09 12:00             ` Robin Murphy
2020-11-09 12:00             ` Robin Murphy
2020-11-09 12:38             ` Qu Wenruo
2020-11-09 12:38               ` Qu Wenruo
2020-11-09 12:38               ` Qu Wenruo

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=b96b1149-d2fd-c131-c329-3e1c0cf3689d@suse.com \
    --to=wqu@suse.com \
    --cc=andrew.murray@arm.com \
    --cc=bhelgaas@google.com \
    --cc=broonie@kernel.org \
    --cc=heiko@sntech.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=shawn.lin@rock-chips.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.