Skip to content

Commit e395313

Browse files
Jon Linbroonie
authored andcommitted
spi: rockchip-sfc: Support ACPI
Compatible with ACPI. Signed-off-by: Jon Lin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 2c55f67 commit e395313

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/spi/spi-rockchip-sfc.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ static int rockchip_sfc_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op
491491
u32 len = op->data.nbytes;
492492
int ret;
493493

494-
if (unlikely(mem->spi->max_speed_hz != sfc->frequency)) {
494+
if (unlikely(mem->spi->max_speed_hz != sfc->frequency) && !has_acpi_companion(sfc->dev)) {
495495
ret = clk_set_rate(sfc->clk, mem->spi->max_speed_hz);
496496
if (ret)
497497
return ret;
@@ -579,16 +579,24 @@ static int rockchip_sfc_probe(struct platform_device *pdev)
579579
if (IS_ERR(sfc->regbase))
580580
return PTR_ERR(sfc->regbase);
581581

582-
sfc->clk = devm_clk_get(&pdev->dev, "clk_sfc");
582+
if (!has_acpi_companion(&pdev->dev))
583+
sfc->clk = devm_clk_get(&pdev->dev, "clk_sfc");
583584
if (IS_ERR(sfc->clk))
584585
return dev_err_probe(&pdev->dev, PTR_ERR(sfc->clk),
585586
"Failed to get sfc interface clk\n");
586587

587-
sfc->hclk = devm_clk_get(&pdev->dev, "hclk_sfc");
588+
if (!has_acpi_companion(&pdev->dev))
589+
sfc->hclk = devm_clk_get(&pdev->dev, "hclk_sfc");
588590
if (IS_ERR(sfc->hclk))
589591
return dev_err_probe(&pdev->dev, PTR_ERR(sfc->hclk),
590592
"Failed to get sfc ahb clk\n");
591593

594+
if (has_acpi_companion(&pdev->dev)) {
595+
ret = device_property_read_u32(&pdev->dev, "clock-frequency", &sfc->frequency);
596+
if (ret)
597+
return dev_err_probe(&pdev->dev, ret, "Failed to find clock-frequency\n");
598+
}
599+
592600
sfc->use_dma = !of_property_read_bool(sfc->dev->of_node, "rockchip,sfc-no-dma");
593601

594602
if (sfc->use_dma) {

0 commit comments

Comments
 (0)