]> git.itanic.dy.fi Git - linux-stable/commitdiff
ata: libahci_platform: Parse ports-implemented property in resources getter
authorSerge Semin <Sergey.Semin@baikalelectronics.ru>
Fri, 9 Sep 2022 19:36:07 +0000 (22:36 +0300)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Fri, 16 Sep 2022 16:39:30 +0000 (01:39 +0900)
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>
drivers/ata/ahci_mtk.c
drivers/ata/ahci_platform.c
drivers/ata/ahci_st.c
drivers/ata/libahci_platform.c

index 1f6c85fde9830ac1334fa4991dcb009a09d6897e..c056378e3e721ed4600cc6845afcfb1dea073edf 100644 (file)
@@ -118,8 +118,6 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv,
                                   SYS_CFG_SATA_EN);
        }
 
-       of_property_read_u32(np, "ports-implemented", &hpriv->force_port_map);
-
        return 0;
 }
 
index 28a8de5b48b979c9b733d2e35e5025357d7ee58a..9b56490ecbc30b9c5972aed277ca8a8c8c0e4d55 100644 (file)
@@ -56,9 +56,6 @@ static int ahci_probe(struct platform_device *pdev)
        if (rc)
                return rc;
 
-       of_property_read_u32(dev->of_node,
-                            "ports-implemented", &hpriv->force_port_map);
-
        if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
                hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
 
index 7526653c843b32261b8f7f3d4e263ce01c58b9b5..068621099c00d563a325a23d2a550875826253b4 100644 (file)
@@ -168,9 +168,6 @@ static int st_ahci_probe(struct platform_device *pdev)
 
        st_ahci_configure_oob(hpriv->mmio);
 
-       of_property_read_u32(dev->of_node,
-                            "ports-implemented", &hpriv->force_port_map);
-
        err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info,
                                      &ahci_platform_sht);
        if (err) {
index bacb974c1b16f734386929b029d23c99f5bbc46f..085f99b2eb5a486a0f18c3f1a0783a04dd3bfdb8 100644 (file)
@@ -485,6 +485,9 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
                goto err_out;
        }
 
+       of_property_read_u32(dev->of_node,
+                            "ports-implemented", &hpriv->force_port_map);
+
        if (child_nodes) {
                for_each_child_of_node(dev->of_node, child) {
                        u32 port;