Skip to content

Commit 3156e1b

Browse files
Richard Zhufloatious
authored andcommitted
ata: ahci_imx: AHB clock rate setting is not required on i.MX8QM AHCI SATA
i.MX8QM AHCI SATA doesn't need set AHB clock rate to config the vendor specified TIMER1MS register. Set AHB clock rate only for i.MX53 and i.MX6Q. Signed-off-by: Richard Zhu <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
1 parent 4147e9d commit 3156e1b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

drivers/ata/ahci_imx.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -872,12 +872,6 @@ static int imx_ahci_probe(struct platform_device *pdev)
872872
return PTR_ERR(imxpriv->sata_ref_clk);
873873
}
874874

875-
imxpriv->ahb_clk = devm_clk_get(dev, "ahb");
876-
if (IS_ERR(imxpriv->ahb_clk)) {
877-
dev_err(dev, "can't get ahb clock.\n");
878-
return PTR_ERR(imxpriv->ahb_clk);
879-
}
880-
881875
if (imxpriv->type == AHCI_IMX6Q || imxpriv->type == AHCI_IMX6QP) {
882876
u32 reg_value;
883877

@@ -937,11 +931,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
937931
goto disable_clk;
938932

939933
/*
940-
* Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL,
941-
* and IP vendor specific register IMX_TIMER1MS.
942-
* Configure CAP_SSS (support stagered spin up).
943-
* Implement the port0.
944-
* Get the ahb clock rate, and configure the TIMER1MS register.
934+
* Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL.
935+
* Set CAP_SSS (support stagered spin up) and Implement the port0.
945936
*/
946937
reg_val = readl(hpriv->mmio + HOST_CAP);
947938
if (!(reg_val & HOST_CAP_SSS)) {
@@ -954,8 +945,19 @@ static int imx_ahci_probe(struct platform_device *pdev)
954945
writel(reg_val, hpriv->mmio + HOST_PORTS_IMPL);
955946
}
956947

957-
reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
958-
writel(reg_val, hpriv->mmio + IMX_TIMER1MS);
948+
if (imxpriv->type != AHCI_IMX8QM) {
949+
/*
950+
* Get AHB clock rate and configure the vendor specified
951+
* TIMER1MS register on i.MX53, i.MX6Q and i.MX6QP only.
952+
*/
953+
imxpriv->ahb_clk = devm_clk_get(dev, "ahb");
954+
if (IS_ERR(imxpriv->ahb_clk)) {
955+
dev_err(dev, "Failed to get ahb clock\n");
956+
goto disable_sata;
957+
}
958+
reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
959+
writel(reg_val, hpriv->mmio + IMX_TIMER1MS);
960+
}
959961

960962
ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info,
961963
&ahci_platform_sht);

0 commit comments

Comments
 (0)