Message ID | 20200514062836.190194-1-vkoul@kernel.org (mailing list archive) |
---|---|
State | Mainlined |
Commit | fd4a5177382230d39e0d95632d98103fb2938383 |
Headers | show |
Series | net: stmmac: fix num_por initialization | expand |
On Thu, May 14, 2020 at 11:59 AM Vinod Koul <vkoul@kernel.org> wrote: > > Driver missed initializing num_por which is por values that driver Nit: s/is/is one of the/ ? > configures to hardware. In order to get this values, add a new structure Nit: s/this/these > ethqos_emac_driver_data which holds por and num_por values and populate > that in driver probe. > > Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") > Reported-by: Rahul Ankushrao Kawadgave <rahulak@qti.qualcomm.com> > Signed-off-by: Vinod Koul <vkoul@kernel.org> Otherwise, Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> > --- > .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index e0a5fe83d8e0..bfc4a92f1d92 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -75,6 +75,11 @@ struct ethqos_emac_por { > unsigned int value; > }; > > +struct ethqos_emac_driver_data { > + const struct ethqos_emac_por *por; > + unsigned int num_por; > +}; > + > struct qcom_ethqos { > struct platform_device *pdev; > void __iomem *rgmii_base; > @@ -171,6 +176,11 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = { > { .offset = RGMII_IO_MACRO_CONFIG2, .value = 0x00002060 }, > }; > > +static const struct ethqos_emac_driver_data emac_v2_3_0_data = { > + .por = emac_v2_3_0_por, > + .num_por = ARRAY_SIZE(emac_v2_3_0_por), > +}; > + > static int ethqos_dll_configure(struct qcom_ethqos *ethqos) > { > unsigned int val; > @@ -442,6 +452,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > struct device_node *np = pdev->dev.of_node; > struct plat_stmmacenet_data *plat_dat; > struct stmmac_resources stmmac_res; > + const struct ethqos_emac_driver_data *data; > struct qcom_ethqos *ethqos; > struct resource *res; > int ret; > @@ -471,7 +482,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > goto err_mem; > } > > - ethqos->por = of_device_get_match_data(&pdev->dev); > + data = of_device_get_match_data(&pdev->dev); > + ethqos->por = data->por; > + ethqos->num_por = data->num_por; > > ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); > if (IS_ERR(ethqos->rgmii_clk)) { > @@ -526,7 +539,7 @@ static int qcom_ethqos_remove(struct platform_device *pdev) > } > > static const struct of_device_id qcom_ethqos_match[] = { > - { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_por}, > + { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, > { } > }; > MODULE_DEVICE_TABLE(of, qcom_ethqos_match); > -- > 2.25.4 >
From: Vinod Koul <vkoul@kernel.org> Date: Thu, 14 May 2020 11:58:36 +0530 > Driver missed initializing num_por which is por values that driver > configures to hardware. In order to get this values, add a new structure > ethqos_emac_driver_data which holds por and num_por values and populate > that in driver probe. > > Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") > Reported-by: Rahul Ankushrao Kawadgave <rahulak@qti.qualcomm.com> > Signed-off-by: Vinod Koul <vkoul@kernel.org> Applied and queued up for -stable, thanks.
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index e0a5fe83d8e0..bfc4a92f1d92 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -75,6 +75,11 @@ struct ethqos_emac_por { unsigned int value; }; +struct ethqos_emac_driver_data { + const struct ethqos_emac_por *por; + unsigned int num_por; +}; + struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; @@ -171,6 +176,11 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = { { .offset = RGMII_IO_MACRO_CONFIG2, .value = 0x00002060 }, }; +static const struct ethqos_emac_driver_data emac_v2_3_0_data = { + .por = emac_v2_3_0_por, + .num_por = ARRAY_SIZE(emac_v2_3_0_por), +}; + static int ethqos_dll_configure(struct qcom_ethqos *ethqos) { unsigned int val; @@ -442,6 +452,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; + const struct ethqos_emac_driver_data *data; struct qcom_ethqos *ethqos; struct resource *res; int ret; @@ -471,7 +482,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev) goto err_mem; } - ethqos->por = of_device_get_match_data(&pdev->dev); + data = of_device_get_match_data(&pdev->dev); + ethqos->por = data->por; + ethqos->num_por = data->num_por; ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); if (IS_ERR(ethqos->rgmii_clk)) { @@ -526,7 +539,7 @@ static int qcom_ethqos_remove(struct platform_device *pdev) } static const struct of_device_id qcom_ethqos_match[] = { - { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_por}, + { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, { } }; MODULE_DEVICE_TABLE(of, qcom_ethqos_match);
Driver missed initializing num_por which is por values that driver configures to hardware. In order to get this values, add a new structure ethqos_emac_driver_data which holds por and num_por values and populate that in driver probe. Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") Reported-by: Rahul Ankushrao Kawadgave <rahulak@qti.qualcomm.com> Signed-off-by: Vinod Koul <vkoul@kernel.org> --- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)