mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
spi: rockchip-sfc: Support ACPI
Change-Id: I84178e0945737945398d16ee59e4808a42cf1a99 Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
* Jon Lin <Jon.lin@rock-chips.com>
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/completion.h>
|
||||
@@ -626,7 +627,7 @@ static int rockchip_sfc_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (unlikely(mem->spi->max_speed_hz != sfc->frequency)) {
|
||||
if (unlikely(mem->spi->max_speed_hz != sfc->frequency) && !has_acpi_companion(sfc->dev)) {
|
||||
ret = clk_set_rate(sfc->clk, mem->spi->max_speed_hz);
|
||||
if (ret)
|
||||
goto out;
|
||||
@@ -729,18 +730,28 @@ static int rockchip_sfc_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(sfc->regbase))
|
||||
return PTR_ERR(sfc->regbase);
|
||||
|
||||
sfc->clk = devm_clk_get(&pdev->dev, "clk_sfc");
|
||||
if (!has_acpi_companion(&pdev->dev))
|
||||
sfc->clk = devm_clk_get(&pdev->dev, "clk_sfc");
|
||||
if (IS_ERR(sfc->clk)) {
|
||||
dev_err(&pdev->dev, "Failed to get sfc interface clk\n");
|
||||
return PTR_ERR(sfc->clk);
|
||||
}
|
||||
|
||||
sfc->hclk = devm_clk_get(&pdev->dev, "hclk_sfc");
|
||||
if (!has_acpi_companion(&pdev->dev))
|
||||
sfc->hclk = devm_clk_get(&pdev->dev, "hclk_sfc");
|
||||
if (IS_ERR(sfc->hclk)) {
|
||||
dev_err(&pdev->dev, "Failed to get sfc ahb clk\n");
|
||||
return PTR_ERR(sfc->hclk);
|
||||
}
|
||||
|
||||
if (has_acpi_companion(&pdev->dev)) {
|
||||
ret = device_property_read_u32(&pdev->dev, "clock-frequency", &sfc->frequency);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to find clock-frequency in ACPI\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
sfc->use_dma = !of_property_read_bool(sfc->dev->of_node,
|
||||
"rockchip,sfc-no-dma");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user