1. 04 Jul, 2017 1 commit
  2. 02 Jul, 2017 31 commits
  3. 28 Jun, 2017 8 commits
    • Lorenzo Pieralisi's avatar
      ARM/PCI: Convert PCI scan API to pci_scan_root_bus_bridge() · 97ad2bdc
      Lorenzo Pieralisi authored
      
      
      The introduction of pci_scan_root_bus_bridge() provides a PCI core API to
      scan a PCI root bus backed by an already initialized struct pci_host_bridge
      object, which simplifies the bus scan interface and makes the PCI scan root
      bus interface easier to generalize as members are added to the struct
      pci_host_bridge.
      
      Convert ARM bios32 code to pci_scan_root_bus_bridge() to improve the PCI
      root bus scanning interface.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      [bhelgaas: fold in warning fix from Arnd Bergmann <arnd@arndb.de>:
      http://lkml.kernel.org/r/20170621215323.3921382-1-arnd@arndb.de]
      [bhelgaas: set bridge->ops for mv78xx0]
      [bhelgaas: fold in fixes from Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>:
      http://lkml.kernel.org/r/20170701135457.GB8977@red-moon
      
      ]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Andrew Lunn <andrew@lunn.ch>
      97ad2bdc
    • Lorenzo Pieralisi's avatar
      PCI: Make pci_register_host_bridge() PCI core internal · cea9bc0b
      Lorenzo Pieralisi authored
      
      
      With the introduction of pci_scan_root_bus_bridge() there is no need to
      export pci_register_host_bridge() to other kernel subsystems other than the
      PCI compilation unit that needs it.
      
      Make pci_register_host_bridge() static to its compilation unit and convert
      the existing drivers usage over to pci_scan_root_bus_bridge().
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      cea9bc0b
    • Lorenzo Pieralisi's avatar
      PCI: Add pci_scan_root_bus_bridge() interface · 1228c4b6
      Lorenzo Pieralisi authored
      
      
      The current pci_scan_root_bus() interface is made up of two main code
      paths:
      
        - pci_create_root_bus()
        - pci_scan_child_bus()
      
      pci_create_root_bus() is a wrapper function that allows to create a struct
      pci_host_bridge structure, initialize it with the passed parameters and
      register it with the kernel.
      
      As the struct pci_host_bridge require additional struct members,
      pci_create_root_bus() parameters list has grown in time, making it unwieldy
      to add further parameters to it in case the struct pci_host_bridge gains
      more members fields to augment its functionality.
      
      Since PCI core code provides functions to allocate struct pci_host_bridge,
      instead of forcing the pci_create_root_bus() interface to add new
      parameters to cater for new struct pci_host_bridge functionality, it is
      more suitable to add an interface in PCI core code to scan a PCI bus
      straight from a struct pci_host_bridge created and customized by each
      specific PCI host controller driver.
      
      Add a pci_scan_root_bus_bridge() function to allow PCI host controller
      drivers to create and initialize struct pci_host_bridge and scan the
      resulting bus.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      1228c4b6
    • Lorenzo Pieralisi's avatar
      PCI: tegra: Fix host bridge memory leakage · 792abc6e
      Lorenzo Pieralisi authored
      
      
      When probing the PCI host controller driver, if an error occurs, the probe
      function code does not free memory allocated for the struct pci_host_bridge
      resulting in memory leakage.
      
      Move the struct pci_host_bridge allocation over to the respective devm
      interface to fix the issue.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      792abc6e
    • Lorenzo Pieralisi's avatar
      PCI: faraday: Fix host bridge memory leakage · 9aa17a77
      Lorenzo Pieralisi authored
      
      
      When probing the PCI host controller driver, if an error occurs, the probe
      function code does not free memory allocated for the struct pci_host_bridge
      resulting in memory leakage.
      
      Move the struct pci_host_bridge allocation over to the respective devm
      interface to fix the issue.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      9aa17a77
    • Lorenzo Pieralisi's avatar
      PCI: Add devm_pci_alloc_host_bridge() interface · 5c3f18cc
      Lorenzo Pieralisi authored
      
      
      Struct pci_host_bridge can be allocated by PCI host bridge drivers which
      usually allocate and map memory through devm managed interfaces.
      
      Add a devm version for the pci_alloc_host_bridge() interface to simplify
      PCI host controller driver porting and simplify the driver failure paths.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      5c3f18cc
    • Lorenzo Pieralisi's avatar
      PCI: Add pci_free_host_bridge() interface · dff79b91
      Lorenzo Pieralisi authored
      Commit a52d1443
      
       ("PCI: Export host bridge registration interface")
      exported the pci_alloc_host_bridge() interface so that PCI host controllers
      drivers can make use of it.
      
      Introduce pci_alloc_host_bridge() kernel counterpart to free the host
      bridge data structures, pci_free_host_bridge(), export it and update kernel
      functions releasing host bridge objects allocated memory to make use of it.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      dff79b91
    • Lorenzo Pieralisi's avatar
      PCI: Initialize bridge release function at bridge allocation · a1c0050a
      Lorenzo Pieralisi authored
      
      
      The introduction of pci_register_host_bridge() kernel interface allows PCI
      host controller drivers to create the struct pci_host_bridge object,
      initialize it and register it with the kernel so that its corresponding PCI
      bus can be scanned and its devices probed.
      
      The host bridge device release function pci_release_host_bridge_dev() is a
      static function common for all struct pci_host_bridge allocated objects, so
      in its current form cannot be used by PCI host bridge controllers drivers
      to initialize the allocated struct pci_host_bridge, which leaves struct
      pci_host_bridge devices release function uninitialized.
      
      Since pci_release_host_bridge_dev() is a function common to all PCI host
      bridge objects, initialize it in pci_alloc_host_bridge() (ie common host
      bridge allocation interface) so that all struct pci_host_bridge objects
      have their release function initialized by default at allocation time,
      removing the need for exporting the common pci_release_host_bridge_dev()
      function to other compilation units.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      a1c0050a