Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: libahci_platform: Parse ports-implemented property in resources getter

The ports-implemented property is mainly used on the OF-based platforms
with no ports mapping initialized by a bootloader/BIOS firmware. Seeing
the same of_property_read_u32()-based pattern has already been implemented
in the generic AHCI LLDD (glue) driver and in the Mediatek, St AHCI
drivers let's move the property read procedure to the generic
ahci_platform_get_resources() method. Thus we'll have the forced ports
mapping feature supported for each OF-based platform which requires that,
and stop re-implementing the same pattern in there a bit simplifying the
code.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

authored by

Serge Semin and committed by
Damien Le Moal
3f74cd04 3c132ea6

+3 -8
-2
drivers/ata/ahci_mtk.c
··· 118 118 SYS_CFG_SATA_EN); 119 119 } 120 120 121 - of_property_read_u32(np, "ports-implemented", &hpriv->force_port_map); 122 - 123 121 return 0; 124 122 } 125 123
-3
drivers/ata/ahci_platform.c
··· 56 56 if (rc) 57 57 return rc; 58 58 59 - of_property_read_u32(dev->of_node, 60 - "ports-implemented", &hpriv->force_port_map); 61 - 62 59 if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) 63 60 hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; 64 61
-3
drivers/ata/ahci_st.c
··· 168 168 169 169 st_ahci_configure_oob(hpriv->mmio); 170 170 171 - of_property_read_u32(dev->of_node, 172 - "ports-implemented", &hpriv->force_port_map); 173 - 174 171 err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, 175 172 &ahci_platform_sht); 176 173 if (err) {
+3
drivers/ata/libahci_platform.c
··· 485 485 goto err_out; 486 486 } 487 487 488 + of_property_read_u32(dev->of_node, 489 + "ports-implemented", &hpriv->force_port_map); 490 + 488 491 if (child_nodes) { 489 492 for_each_child_of_node(dev->of_node, child) { 490 493 u32 port;