Skip to content
  1. Jan 24, 2018
  2. Jan 23, 2018
  3. Jan 22, 2018
    • David S. Miller's avatar
      Merge branch 'mvpp2-Armada-7k-8k-PP2-ACPI-support' · d1b1110f
      David S. Miller authored
      Marcin Wojtas says:
      
      ====================
      Armada 7k/8k PP2 ACPI support
      
      I quickly resend the series, thanks to Antoine Tenart's remark,
      who spotted !CONFIG_ACPI compilation issue after introducing
      the new fwnode_irq_get() routine. Please see the details in the changelog
      below and the 3/7 commit log.
      
      mvpp2 driver can work with the ACPI representation, as exposed
      on a public branch:
      https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/marvell-armada-wip
      It was compiled together with the most recent Tianocore EDK2 revision.
      Please refer to the firmware build instruction on MacchiatoBin board:
      http://wiki.macchiatobin.net/tiki-index.php?page=Build+from+source+-+UEFI+EDK+II
      
      ACPI representation of PP2 controllers (withouth PHY support) can
      be viewed in the github:
      * MacchiatoBin:
      https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/71ae395da1661374b0f07d1602afb1eee56e9794/Platforms/Marvell/Armada/AcpiTables/Armada80x0McBin/Dsdt.asl#L201
      
      * Armada 7040 DB:
      https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/71ae395da1661374b0f07d1602afb1eee56e9794/Platforms/Marvell/Armada/AcpiTables/Armada70x0/Dsdt.asl#L131
      
      
      
      I will appreciate any comments or remarks.
      
      Best regards,
      Marcin
      
      Changelog:
      v3 -> v4:
      * 3/7
          - add new macro (ACPI_HANDLE_FWNODE) and fix
            compilation with !CONFIG_ACPI
          - extend commit log and mention usability of fwnode_irq_get
            for the child nodes as well
      
      v2 -> v3:
      * 1/7, 2/7
          - Add Rafael's Acked-by's
      * 3/7, 4/7
          - New patches
      * 6/7, 7/7
          - Update driver with new helper routines usage
          - Improve commit log.
      
      v1 -> v2:
      * Remove MDIO patches
      * Use PP2 ports only with link interrupts
      * Release second region resources in mvpp2 driver (code moved from
        mvmdio), as explained in details in 5/5 commit message.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1b1110f
    • Marcin Wojtas's avatar
      net: mvpp2: enable ACPI support in the driver · a75edc7c
      Marcin Wojtas authored
      
      
      This patch introduces an alternative way of obtaining resources - via
      ACPI tables provided by firmware. Enabling coexistence with the DT
      support, in addition to the OF_*->device_*/fwnode_* API replacement,
      required following steps to be taken:
      
      * Add mvpp2_acpi_match table
      * Omit clock configuration and obtain tclk from the property - in ACPI
        world, the firmware is responsible for clock maintenance.
      * Disable comphy and syscon handling as they are not available for ACPI.
      * Modify way of obtaining interrupts - use newly introduced
        fwnode_irq_get() routine
      * Until proper MDIO bus and PHY handling with ACPI is established in the
        kernel, use only link interrupts feature in the driver. For the RGMII
        port it results in depending on GMAC settings done during firmware
        stage.
      * When booting with ACPI MVPP2_QDIST_MULTI_MODE is picked by
        default, as there is no need to keep any kind of the backward
        compatibility.
      
      Moreover, a memory region used by mvmdio driver is usually placed in
      the middle of the address space of the PP2 network controller.
      The MDIO base address is obtained without requesting memory region
      (by devm_ioremap() call) in mvmdio.c, later overlapping resources are
      requested by the network driver, which is responsible for avoiding
      a concurrent access.
      
      In case the MDIO memory region is declared in the ACPI, it can
      already appear as 'in-use' in the OS. Because it is overlapped by second
      region of the network controller, make sure it is released, before
      requesting it again. The care is taken by mvpp2 driver to avoid
      concurrent access to this memory region.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a75edc7c
    • Marcin Wojtas's avatar
      net: mvpp2: use device_*/fwnode_* APIs instead of of_* · 24812221
      Marcin Wojtas authored
      
      
      OF functions can be used only for the driver using DT.
      As a preparation for introducing ACPI support in mvpp2
      driver, use struct fwnode_handle in order to obtain
      properties from the hardware description.
      
      This patch replaces of_* function with device_*/fwnode_*
      where possible in the mvpp2.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24812221
    • Marcin Wojtas's avatar
      net: mvpp2: simplify maintaining enabled ports' list · bf147153
      Marcin Wojtas authored
      
      
      'port_count' field of the mvpp2 structure holds an overall amount
      of available ports, based on DT nodes status. In order to be prepared
      to support other HW description, obtain the value by incrementing it
      upon each successful port initialization. This allowed for simplifying
      port indexing in the controller's private array, whose size is now not
      dynamically allocated, but fixed to MVPP2_MAX_PORTS.
      
      This patch simplifies creating and filling list of enabled ports and
      is a part of the preparation for adding ACPI support in the mvpp2 driver.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf147153
    • Marcin Wojtas's avatar
      device property: Allow iterating over available child fwnodes · 3395de96
      Marcin Wojtas authored
      
      
      Implement a new helper function fwnode_get_next_available_child_node(),
      which enables obtaining next enabled child fwnode, which
      works on a similar basis to OF's of_get_next_available_child().
      
      This commit also introduces a macro, thanks to which it is
      possible to iterate over the available fwnodes, using the
      new function described above.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3395de96
    • Marcin Wojtas's avatar
      device property: Introduce fwnode_irq_get() · 7c6c57f2
      Marcin Wojtas authored
      
      
      Until now there were two very similar functions allowing
      to get Linux IRQ number from ACPI handle (acpi_irq_get())
      and OF node (of_irq_get()). The first one appeared to be used
      only as a subroutine of platform_irq_get(), which (in the generic
      code) limited IRQ obtaining from _CRS method only to nodes
      associated to kernel's struct platform_device.
      
      This patch introduces a new helper routine - fwnode_irq_get(),
      which allows to get the IRQ number directly from the fwnode
      to be used as common for OF/ACPI worlds. It is usable not
      only for the parents fwnodes, but also for the child nodes
      comprising their own _CRS methods with interrupts description.
      
      In order to be able o satisfy compilation with !CONFIG_ACPI
      and also simplify the new code, introduce a helper macro
      (ACPI_HANDLE_FWNODE), with which it is possible to reach
      an ACPI handle directly from its fwnode.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7c6c57f2