Skip to content

Commit

Permalink
ata: libahci_platform: Parse ports-implemented property in resources …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Serge Semin authored and Damien Le Moal committed Sep 16, 2022
1 parent 3c132ea commit 3f74cd0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions drivers/ata/ahci_mtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 0 additions & 3 deletions drivers/ata/ahci_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions drivers/ata/ahci_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions drivers/ata/libahci_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3f74cd0

Please sign in to comment.