firmware: qcom_scm: Always try to consume all three clocks
The code for handling more than 1 clock is a bit messy and requires one to add new, SoC-specific compatibles if one wants to attach a clock. Switch devm_clk_get to devm_clk_get_optional to prevent throwing it from throwing errors when the clock is absent and defer checking the clock requirements to dt schema. This lets us get rid of compatibles that aren't necessary for backwards compatibility *and* will hopefully prevent the addition of meaningless new compatibles. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230623-topic-scm_cleanup-v2-1-9db8c583138d@linaro.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
parent
7dc3ea5ea8
commit
5130464a14
@ -26,10 +26,6 @@
|
||||
static bool download_mode = IS_ENABLED(CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT);
|
||||
module_param(download_mode, bool, 0);
|
||||
|
||||
#define SCM_HAS_CORE_CLK BIT(0)
|
||||
#define SCM_HAS_IFACE_CLK BIT(1)
|
||||
#define SCM_HAS_BUS_CLK BIT(2)
|
||||
|
||||
struct qcom_scm {
|
||||
struct device *dev;
|
||||
struct clk *core_clk;
|
||||
@ -1405,7 +1401,6 @@ out:
|
||||
static int qcom_scm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct qcom_scm *scm;
|
||||
unsigned long clks;
|
||||
int irq, ret;
|
||||
|
||||
scm = devm_kzalloc(&pdev->dev, sizeof(*scm), GFP_KERNEL);
|
||||
@ -1418,50 +1413,27 @@ static int qcom_scm_probe(struct platform_device *pdev)
|
||||
|
||||
mutex_init(&scm->scm_bw_lock);
|
||||
|
||||
clks = (unsigned long)of_device_get_match_data(&pdev->dev);
|
||||
|
||||
scm->path = devm_of_icc_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(scm->path))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(scm->path),
|
||||
"failed to acquire interconnect path\n");
|
||||
|
||||
scm->core_clk = devm_clk_get(&pdev->dev, "core");
|
||||
scm->core_clk = devm_clk_get_optional(&pdev->dev, "core");
|
||||
if (IS_ERR(scm->core_clk)) {
|
||||
if (PTR_ERR(scm->core_clk) == -EPROBE_DEFER)
|
||||
return PTR_ERR(scm->core_clk);
|
||||
|
||||
if (clks & SCM_HAS_CORE_CLK) {
|
||||
dev_err(&pdev->dev, "failed to acquire core clk\n");
|
||||
return PTR_ERR(scm->core_clk);
|
||||
}
|
||||
|
||||
scm->core_clk = NULL;
|
||||
}
|
||||
|
||||
scm->iface_clk = devm_clk_get(&pdev->dev, "iface");
|
||||
scm->iface_clk = devm_clk_get_optional(&pdev->dev, "iface");
|
||||
if (IS_ERR(scm->iface_clk)) {
|
||||
if (PTR_ERR(scm->iface_clk) == -EPROBE_DEFER)
|
||||
return PTR_ERR(scm->iface_clk);
|
||||
|
||||
if (clks & SCM_HAS_IFACE_CLK) {
|
||||
dev_err(&pdev->dev, "failed to acquire iface clk\n");
|
||||
return PTR_ERR(scm->iface_clk);
|
||||
}
|
||||
|
||||
scm->iface_clk = NULL;
|
||||
}
|
||||
|
||||
scm->bus_clk = devm_clk_get(&pdev->dev, "bus");
|
||||
scm->bus_clk = devm_clk_get_optional(&pdev->dev, "bus");
|
||||
if (IS_ERR(scm->bus_clk)) {
|
||||
if (PTR_ERR(scm->bus_clk) == -EPROBE_DEFER)
|
||||
return PTR_ERR(scm->bus_clk);
|
||||
|
||||
if (clks & SCM_HAS_BUS_CLK) {
|
||||
dev_err(&pdev->dev, "failed to acquire bus clk\n");
|
||||
return PTR_ERR(scm->bus_clk);
|
||||
}
|
||||
|
||||
scm->bus_clk = NULL;
|
||||
}
|
||||
|
||||
scm->reset.ops = &qcom_scm_pas_reset_ops;
|
||||
@ -1512,38 +1484,19 @@ static void qcom_scm_shutdown(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
static const struct of_device_id qcom_scm_dt_match[] = {
|
||||
{ .compatible = "qcom,scm-apq8064",
|
||||
/* FIXME: This should have .data = (void *) SCM_HAS_CORE_CLK */
|
||||
},
|
||||
{ .compatible = "qcom,scm-apq8084", .data = (void *)(SCM_HAS_CORE_CLK |
|
||||
SCM_HAS_IFACE_CLK |
|
||||
SCM_HAS_BUS_CLK)
|
||||
},
|
||||
{ .compatible = "qcom,scm-apq8064" },
|
||||
{ .compatible = "qcom,scm-apq8084" },
|
||||
{ .compatible = "qcom,scm-ipq4019" },
|
||||
{ .compatible = "qcom,scm-mdm9607", .data = (void *)(SCM_HAS_CORE_CLK |
|
||||
SCM_HAS_IFACE_CLK |
|
||||
SCM_HAS_BUS_CLK) },
|
||||
{ .compatible = "qcom,scm-msm8660", .data = (void *) SCM_HAS_CORE_CLK },
|
||||
{ .compatible = "qcom,scm-msm8960", .data = (void *) SCM_HAS_CORE_CLK },
|
||||
{ .compatible = "qcom,scm-msm8916", .data = (void *)(SCM_HAS_CORE_CLK |
|
||||
SCM_HAS_IFACE_CLK |
|
||||
SCM_HAS_BUS_CLK)
|
||||
},
|
||||
{ .compatible = "qcom,scm-msm8953", .data = (void *)(SCM_HAS_CORE_CLK |
|
||||
SCM_HAS_IFACE_CLK |
|
||||
SCM_HAS_BUS_CLK)
|
||||
},
|
||||
{ .compatible = "qcom,scm-msm8974", .data = (void *)(SCM_HAS_CORE_CLK |
|
||||
SCM_HAS_IFACE_CLK |
|
||||
SCM_HAS_BUS_CLK)
|
||||
},
|
||||
{ .compatible = "qcom,scm-msm8976", .data = (void *)(SCM_HAS_CORE_CLK |
|
||||
SCM_HAS_IFACE_CLK |
|
||||
SCM_HAS_BUS_CLK)
|
||||
},
|
||||
{ .compatible = "qcom,scm-mdm9607" },
|
||||
{ .compatible = "qcom,scm-msm8660" },
|
||||
{ .compatible = "qcom,scm-msm8960" },
|
||||
{ .compatible = "qcom,scm-msm8916" },
|
||||
{ .compatible = "qcom,scm-msm8953" },
|
||||
{ .compatible = "qcom,scm-msm8974" },
|
||||
{ .compatible = "qcom,scm-msm8976" },
|
||||
{ .compatible = "qcom,scm-msm8994" },
|
||||
{ .compatible = "qcom,scm-msm8996" },
|
||||
{ .compatible = "qcom,scm-sm6375", .data = (void *)SCM_HAS_CORE_CLK },
|
||||
{ .compatible = "qcom,scm-sm6375" },
|
||||
{ .compatible = "qcom,scm" },
|
||||
{}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user