1. 08 10月, 2019 1 次提交
    • T
      PCI: imx6: Propagate errors for optional regulators · 1264d2e7
      Thierry Reding 提交于
      [ Upstream commit 2170a09fb4b0f66e06e5bcdcbc98c9ccbf353650 ]
      
      regulator_get_optional() can fail for a number of reasons besides probe
      deferral. It can for example return -ENOMEM if it runs out of memory as
      it tries to allocate data structures. Propagating only -EPROBE_DEFER is
      problematic because it results in these legitimately fatal errors being
      treated as "regulator not specified in DT".
      
      What we really want is to ignore the optional regulators only if they
      have not been specified in DT. regulator_get_optional() returns -ENODEV
      in this case, so that's the special case that we need to handle. So we
      propagate all errors, except -ENODEV, so that real failures will still
      cause the driver to fail probe.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: NAndrew Murray <andrew.murray@arm.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: kernel@pengutronix.de
      Cc: linux-imx@nxp.com
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1264d2e7
  2. 13 2月, 2019 1 次提交
  3. 17 12月, 2018 1 次提交
    • T
      PCI: imx6: Fix link training status detection in link up check · 2a031cab
      Trent Piepho 提交于
      [ Upstream commit 68bc10bf992180f269816ff3d22eb30383138577 ]
      
      This bug was introduced in the interaction for two commits on either
      branch of the merge commit 562df5c8 ("Merge branch
      'pci/host-designware' into next").
      
      Commit 4d107d3b ("PCI: imx6: Move link up check into
      imx6_pcie_wait_for_link()"), changed imx6_pcie_wait_for_link() to poll
      the link status register directly, checking for link up and not
      training, and made imx6_pcie_link_up() only check the link up bit (once,
      not a polling loop).
      
      While commit 886bc5ce ("PCI: designware: Add generic
      dw_pcie_wait_for_link()"), replaced the loop in
      imx6_pcie_wait_for_link() with a call to a new dwc core function, which
      polled imx6_pcie_link_up(), which still checked both link up and not
      training in a loop.
      
      When these two commits were merged, the version of
      imx6_pcie_wait_for_link() from 886bc5ce was kept, which eliminated
      the link training check placed there by 4d107d3b. However, the
      version of imx6_pcie_link_up() from 4d107d3b was kept, which
      eliminated the link training check that had been there and was moved to
      imx6_pcie_wait_for_link().
      
      The result was the link training check got lost for the imx6 driver.
      
      Eliminate imx6_pcie_link_up() so that the default handler,
      dw_pcie_link_up(), is used instead. The default handler has the correct
      code, which checks for link up and also that it still is not training,
      fixing the regression.
      
      Fixes: 562df5c8 ("Merge branch 'pci/host-designware' into next")
      Signed-off-by: NTrent Piepho <tpiepho@impinj.com>
      [lorenzo.pieralisi@arm.com: rewrote the commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Joao Pinto <Joao.Pinto@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2a031cab
  4. 13 7月, 2018 1 次提交
  5. 08 6月, 2018 1 次提交
  6. 14 5月, 2018 1 次提交
  7. 06 3月, 2018 1 次提交
  8. 29 1月, 2018 1 次提交
  9. 04 8月, 2017 2 次提交
  10. 03 7月, 2017 2 次提交
  11. 23 5月, 2017 1 次提交
  12. 28 4月, 2017 1 次提交
    • B
      PCI: Don't allow unbinding host controllers that aren't prepared · a5f40e80
      Brian Norris 提交于
      Many PCI host controller drivers aren't prepared to have their devices
      unbound from them forcefully (e.g., through /sys/.../<driver>/unbind), as
      they don't provide any driver .remove callback, where they'd detach the
      root bus, release resources, etc. Keeping the driver built in (i.e., not a
      loadable module) is not enough; and providing no .remove callback just
      means we don't do any teardown.
      
      To rule out the possibility of unbinding a device via sysfs, we need to set
      the ".suppress_bind_attrs" field.
      
      I found the suspect drivers via the following search:
      
        git grep -l platform_driver $(git grep -L -e '\.remove' -e suppress_bind_attrs drivers/pci/)
      
      Then I inspected them to ensure that
      (a) they set up a PCI bus in their probe() and
      (b) they don't have a remove() callback for undoing the setup
      Suggested-by: NBjorn Helgaas <helgaas@kernel.org>
      Signed-off-by: NBrian Norris <briannorris@chromium.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      a5f40e80
  13. 26 4月, 2017 1 次提交
  14. 05 4月, 2017 4 次提交
  15. 25 2月, 2017 1 次提交
    • G
      PCI: dwc: Fix crashes seen due to missing assignments · c0464062
      Guenter Roeck 提交于
      Fix the following crash, seen in dwc/pci-imx6.
      
        Unable to handle kernel NULL pointer dereference at virtual address 00000070
        pgd = c0004000
        [00000070] *pgd=00000000
        Internal error: Oops: 805 [#1] SMP ARM
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.10.0-09686-g9e314890 #1
        Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
        task: cb850000 task.stack: cb84e000
        PC is at imx6_pcie_probe+0x2f4/0x414
        ...
      
      While at it, fix the same problem in various drivers instead of waiting for
      individual crash reports.
      
      The change in the imx6 driver was tested with qemu. The changes in other
      drivers are based on code inspection and have been compile tested only.
      
      Fixes: 442ec4c0 ("PCI: dwc: all: Split struct pcie_port into host-only and core structures")
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>  # designware-plat
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NKishon Vijay Abraham I <kishon@ti.com>
      c0464062
  16. 22 2月, 2017 3 次提交
    • K
      PCI: dwc: all: Split struct pcie_port into host-only and core structures · 442ec4c0
      Kishon Vijay Abraham I 提交于
      Keep only the host-specific members in struct pcie_port and move the common
      members (i.e common to both host and endpoint) to struct dw_pcie.  This is
      in preparation for adding endpoint mode support to designware driver.
      
      While at that also fix checkpatch warnings.
      Signed-off-by: NKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Jingoo Han <jingoohan1@gmail.com>
      CC: Richard Zhu <hongxing.zhu@nxp.com>
      CC: Lucas Stach <l.stach@pengutronix.de>
      CC: Murali Karicheri <m-karicheri2@ti.com>
      CC: Minghuan Lian <minghuan.Lian@freescale.com>
      CC: Mingkai Hu <mingkai.hu@freescale.com>
      CC: Roy Zang <tie-fei.zang@freescale.com>
      CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      CC: Niklas Cassel <niklas.cassel@axis.com>
      CC: Jesper Nilsson <jesper.nilsson@axis.com>
      CC: Joao Pinto <Joao.Pinto@synopsys.com>
      CC: Zhou Wang <wangzhou1@hisilicon.com>
      CC: Gabriele Paoloni <gabriele.paoloni@huawei.com>
      CC: Stanimir Varbanov <svarbanov@mm-sol.com>
      CC: Pratyush Anand <pratyush.anand@gmail.com>
      442ec4c0
    • K
      PCI: dwc: all: Use platform_set_drvdata() to save private data · 9bcf0a6f
      Kishon Vijay Abraham I 提交于
      Add platform_set_drvdata() in all designware-based drivers to store the
      private data structure of the driver so that dev_set_drvdata() can be used
      to get back private data structure in add_pcie_port/host_init.  This is in
      preparation for splitting struct pcie_port into core and host only
      structures. After the split pcie_port will not be part of the driver's
      private data structure and *container_of* used now to get the private data
      pointer cannot be used.
      Signed-off-by: NKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Jingoo Han <jingoohan1@gmail.com>
      CC: Richard Zhu <hongxing.zhu@nxp.com>
      CC: Lucas Stach <l.stach@pengutronix.de>
      CC: Murali Karicheri <m-karicheri2@ti.com>
      CC: Minghuan Lian <minghuan.Lian@freescale.com>
      CC: Mingkai Hu <mingkai.hu@freescale.com>
      CC: Roy Zang <tie-fei.zang@freescale.com>
      CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      CC: Niklas Cassel <niklas.cassel@axis.com>
      CC: Jesper Nilsson <jesper.nilsson@axis.com>
      CC: Joao Pinto <Joao.Pinto@synopsys.com>
      CC: Zhou Wang <wangzhou1@hisilicon.com>
      CC: Gabriele Paoloni <gabriele.paoloni@huawei.com>
      CC: Stanimir Varbanov <svarbanov@mm-sol.com>
      CC: Pratyush Anand <pratyush.anand@gmail.com>
      9bcf0a6f
    • K
      PCI: Move DesignWare IP support to new drivers/pci/dwc/ directory · 950bf638
      Kishon Vijay Abraham I 提交于
      Group all the PCI drivers that use DesignWare core in dwc directory.
      dwc IP is capable of operating in both host mode and device mode and
      keeping it inside the *host* directory is misleading.
      Signed-off-by: NKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NJingoo Han <jingoohan1@gmail.com>
      Acked-By: NJoao Pinto <jpinto@synopsys.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Minghuan Lian <minghuan.Lian@freescale.com>
      Cc: Mingkai Hu <mingkai.hu@freescale.com>
      Cc: Roy Zang <tie-fei.zang@freescale.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Murali Karicheri <m-karicheri2@ti.com>
      Cc: Pratyush Anand <pratyush.anand@gmail.com>
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      Cc: Gabriele Paoloni <gabriele.paoloni@huawei.com>
      Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
      950bf638
  17. 11 2月, 2017 1 次提交
  18. 31 1月, 2017 1 次提交
  19. 12 1月, 2017 1 次提交
  20. 12 10月, 2016 8 次提交
  21. 24 8月, 2016 1 次提交
    • P
      PCI: imx6: Make explicitly non-modular · f90d8e84
      Paul Gortmaker 提交于
      This code is not being built as a module by anyone:
      
        drivers/pci/host/Kconfig:config PCI_IMX6
        drivers/pci/host/Kconfig:  bool "Freescale i.MX6 PCIe controller"
      
      Remove uses of MODULE_DESCRIPTION(), MODULE_AUTHOR(), MODULE_LICENSE(),
      etc., so that when reading the driver there is no doubt it is builtin-only.
      The information is preserved in comments at the top of the file.
      
      Note that for non-modular code, MODULE_DEVICE_TABLE is a no-op and
      module_init() translates to device_initcall().
      
      [bhelgaas: changelog]
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Richard Zhu <Richard.Zhu@freescale.com>
      CC: Lucas Stach <l.stach@pengutronix.de>
      f90d8e84
  22. 03 5月, 2016 2 次提交
  23. 20 4月, 2016 3 次提交
    • T
      PCI: imx6: Add DT property for link gen, default to Gen1 · a5fcec48
      Tim Harvey 提交于
      Freescale has stated [1] that the LVDS clock source of the IMX6 does not
      pass the PCI Gen2 clock jitter test, therefore unless an external Gen2
      compliant external clock source is present and supplied back to the IMX6
      PCIe core via LVDS CLK1/CLK2 you can not claim Gen2 compliance.
      
      Add a DT property to specify Gen1 vs Gen2 and check this before allowing a
      Gen2 link.
      
      We default to Gen1 if the property is not present because at this time
      there are no IMX6 boards in mainline that 'input' a clock on LVDS
      CLK1/CLK2.
      
      In order to be Gen2 compliant on IMX6 you need to:
      
       - Have a Gen2 compliant external clock generator and route that clock back
         to either LVDS CLK1 or LVDS CLK2 as an input (see IMX6SX-SabreSD
         reference design).
      
       - Specify this clock in the PCIe node in the DT (i.e.,
         IMX6QDL_CLK_LVDS1_IN or IMX6QDL_CLK_LVDS2_IN instead of
         IMX6QDL_CLK_LVDS1_GATE which configures it as a CLK output).
      
      [1] https://community.freescale.com/message/453209Signed-off-by: NTim Harvey <tharvey@gateworks.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      CC: Fabio Estevam <fabio.estevam@freescale.com>
      CC: Zhu Richard <Richard.Zhu@freescale.com>
      CC: Akshay Bhat <akshay.bhat@timesys.com>
      CC: Rob Herring <robh+dt@kernel.org>
      CC: Shawn Guo <shawnguo@kernel.org>
      a5fcec48
    • P
      PCI: imx6: Add reset-gpio-active-high boolean property to DT · 3ea8529a
      Petr Štetiar 提交于
      Currently the reset-gpio DT property which controls the PCI bus device
      reset signal defaults to active-low reset sequence (L=reset state,
      H=operation state) plus the code in reset function isn't GPIO polarity
      aware - it doesn't matter if the defined reset-gpio is active-low or
      active-high, it will always result into active-low reset sequence.
      
      I've tried to fix it properly and change the reset-gpio reset sequence to
      be polarity-aware, but this patch has been accepted and then reverted as it
      has introduced few backward incompatible issues:
      
      1. Some DTBs, for example, imx6qdl-sabresd, don't define reset-gpio
      polarity correctly:
      
        reset-gpio = <&gpio7 12 0>;
      
      which means that it's defined as active-high, but in reality it's
      active-low; thus it wouldn't work without a DTS fix.
      
      2. The logic in the reset function is inverted:
      
      	gpio_set_value_cansleep(imx6_pcie->reset_gpio, 0)
      	msleep(100);
      	gpio_set_value_cansleep(imx6_pcie->reset_gpio, 1);
      
      so even if some of the i.MX6 boards had reset-gpio polarity defined
      correctly in their DTSes, they would stop working.
      
      As we can't break old DTBs, we can't fix them, so we need to introduce this
      new DT reset-gpio-active-high boolean property so we can support boards
      with active-high reset sequence.
      
      This active-high reset sequence is for example needed on Apalis SoMs, where
      GPIO1_IO28, used to PCIe reset is not connected directly to PERST# PCIe
      signal, but it's ORed with RESETBMCU coming off the PMIC, and thus is
      inverted, active-high.
      
      Tested-by: Tim Harvey <tharvey@gateworks.com>	# Gateworks Ventana boards (which have active-low PERST#)
      Signed-off-by: NPetr Štetiar <ynezz@true.cz>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLucas Stach <l.stach@pengutronix.de>
      Acked-by: NRob Herring <robh@kernel.org>
      3ea8529a
    • C
      PCI: imx6: Add initial imx6sx support · e3c06cd0
      Christoph Fritz 提交于
      Add initial PCIe support for the imx6 SoC derivate imx6sx.  PCI MSI support
      is untested as the necessary suspend/resume quirk is not included in this
      patch.
      
      This patch is heavily based on patches by Richard Zhu.
      
      [bhelgaas: factor out refclk enable, fix adjacent typos in imx6q-pcie.txt]
      Signed-off-by: NChristoph Fritz <chf.fritz@googlemail.com>
      Acked-by: NRichard Zhu <Richard.Zhu@freescale.com>
      Acked-by: NLucas Stach <l.stach@pengutronix.de>
      e3c06cd0