Hi Dilip, On Tue, Sep 3, 2019 at 12:20 PM Dilip Kota <eswara.kota@xxxxxxxxxxxxxxx> wrote: > > Hi Martin, > > On 8/29/2019 10:54 AM, Chuan Hua, Lei wrote: > > > On 8/29/2019 3:36 AM, Martin Blumenstingl wrote: > > On Wed, Aug 28, 2019 at 5:35 AM Chuan Hua, Lei > <chuanhua.lei@xxxxxxxxxxxxxxx> wrote: > [...] > > +static int intel_pcie_ep_rst_init(struct intel_pcie_port *lpp) > +{ > + struct device *dev = lpp->pci->dev; > + int ret = 0; > + > + lpp->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); > + if (IS_ERR(lpp->reset_gpio)) { > + ret = PTR_ERR(lpp->reset_gpio); > + if (ret != -EPROBE_DEFER) > + dev_err(dev, "failed to request PCIe GPIO: %d\n", ret); > + return ret; > + } > + /* Make initial reset last for 100ms */ > + msleep(100); > > why is there lpp->rst_interval when you hardcode 100ms here? > > There are different purpose. rst_interval is purely for asserted reset > pulse. > > Here 100ms is to make sure the initial state keeps at least 100ms, then we > can reset. > > my interpretation is that it totally depends on the board design or > the bootloader setup. > > Partially, you are right. However, we should not add some dependency > here from > bootloader and board. rst_interval is just to make sure the pulse (low > active or high active) > lasts the specified the time. > > +Cc Kishon > > he recently added support for a GPIO reset line to the > pcie-cadence-host.c [0] and I believe he's also maintaining > pci-keystone.c which are both using a 100uS delay (instead of 100ms). > I don't know the PCIe spec so maybe Kishon can comment on the values > that should be used according to the spec. > if there's then a reason why values other than the ones from the spec > are needed then there should be a comment explaining why different > values are needed (what problem does it solve). > > spec doesn't guide this part. It is a board or SoC specific setting. > 100us also should work. spec only requirs reset duration should last > 100ms. The idea is that before reset assert and deassert, make sure the > default deassert status keeps some time. We take this value from > hardware suggestion long time back. We can reduce this value to 100us, > but we need to test on the board. > > OK. I don't know how other PCI controller drivers manage this. if the > PCI maintainers are happy with this then I am as well > maybe it's worth changing the comment to indicate that this delay was > suggested by the hardware team (so it's clear that this is not coming > from the PCI spec) > > Dilip will change to 100us delay and run the test. I also need to run some tests for old boards(XRX350/550/PRX300) to confirm this has no impact on function. > > I have tested 100us on the target and it is working fine. > Along with this change, i have validated below changes and test is successful. > Enabling the A/B/C/D interrupts during the initialization instead of in map_irq() > Calling dw_pcie_setup_rc() function during initialization. > > I will push these changes in the next patch version. great, thank you for working on simplifying the code! > And, regarding [1]: > I have checked the code for using regmap; Helper functions especially update_bits() cannot be avoided(it is required while configuring pcie RC registers too). and LGM is little endian. > Switching to regmap() is not bringing any gain. OK, if it doesn't help you for LGM then no need to switch to regmap now I can still do it afterwards when adding support for other SoCs > Regarding [2]: > PCIE_SPEED2STR() is quite different from the pcie_link_gen_to_str(). > PCIE_SPEED2STR() expects a encoded value defined in pcie_link_speed[] array in probe.c, whereas pcie_link_gen_to_str() is a direct mapping to the register bits value. > pcie_link_gen_to_str() is pretty much simple and straight forward. > > And, any of the pcie controller drivers are using neither PCIE_SPEED2STR() nor pcie_link_speed[]. OK, I see - thank you for following up the PCI maintainers need to decide whether pcie_link_status_show is acceptable (instead of using lspci) - that's the only place where pcie_link_gen_to_str is used Martin