memory: mtk-smi: Use of_device_get_match_data helper
Replace custom code with generic helper to retrieve driver data. Signed-off-by: Honghui Zhang <honghui.zhang@mediatek.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Родитель
520eccdfe1
Коммит
75487860a8
|
@ -240,20 +240,15 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct device_node *smi_node;
|
struct device_node *smi_node;
|
||||||
struct platform_device *smi_pdev;
|
struct platform_device *smi_pdev;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
|
|
||||||
if (!dev->pm_domain)
|
if (!dev->pm_domain)
|
||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
|
|
||||||
of_id = of_match_node(mtk_smi_larb_of_ids, pdev->dev.of_node);
|
|
||||||
if (!of_id)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL);
|
larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL);
|
||||||
if (!larb)
|
if (!larb)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
larb->larb_gen = of_id->data;
|
larb->larb_gen = of_device_get_match_data(dev);
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
larb->base = devm_ioremap_resource(dev, res);
|
larb->base = devm_ioremap_resource(dev, res);
|
||||||
if (IS_ERR(larb->base))
|
if (IS_ERR(larb->base))
|
||||||
|
@ -319,7 +314,6 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct mtk_smi *common;
|
struct mtk_smi *common;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
enum mtk_smi_gen smi_gen;
|
enum mtk_smi_gen smi_gen;
|
||||||
|
|
||||||
if (!dev->pm_domain)
|
if (!dev->pm_domain)
|
||||||
|
@ -338,17 +332,13 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(common->clk_smi))
|
if (IS_ERR(common->clk_smi))
|
||||||
return PTR_ERR(common->clk_smi);
|
return PTR_ERR(common->clk_smi);
|
||||||
|
|
||||||
of_id = of_match_node(mtk_smi_common_of_ids, pdev->dev.of_node);
|
|
||||||
if (!of_id)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for mtk smi gen 1, we need to get the ao(always on) base to config
|
* for mtk smi gen 1, we need to get the ao(always on) base to config
|
||||||
* m4u port, and we need to enable the aync clock for transform the smi
|
* m4u port, and we need to enable the aync clock for transform the smi
|
||||||
* clock into emi clock domain, but for mtk smi gen2, there's no smi ao
|
* clock into emi clock domain, but for mtk smi gen2, there's no smi ao
|
||||||
* base.
|
* base.
|
||||||
*/
|
*/
|
||||||
smi_gen = (enum mtk_smi_gen)of_id->data;
|
smi_gen = (enum mtk_smi_gen)of_device_get_match_data(dev);
|
||||||
if (smi_gen == MTK_SMI_GEN1) {
|
if (smi_gen == MTK_SMI_GEN1) {
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
common->smi_ao_base = devm_ioremap_resource(dev, res);
|
common->smi_ao_base = devm_ioremap_resource(dev, res);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче