lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 21 Oct 2016 10:28:23 +0200
From:   Neil Armstrong <narmstrong@...libre.com>
To:     Joachim Eastwood <manabian@...il.com>
Cc:     "peppe.cavallaro" <peppe.cavallaro@...com>,
        alexandre.torgue@...com, devicetree <devicetree@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        linux-oxnas@...ts.tuxfamily.org,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [RFC PATCH] net: stmmac: Add OXNAS Glue Driver

On 10/20/2016 06:26 PM, Joachim Eastwood wrote:
> Hi Neil,
> 
> On 20 October 2016 at 17:54, Neil Armstrong <narmstrong@...libre.com> wrote:
>> Add Synopsys Designware MAC Glue layer for the Oxford Semiconductor OX820.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@...libre.com>
>> ---
>>  .../devicetree/bindings/net/oxnas-dwmac.txt        |  44 ++++++
>>  drivers/net/ethernet/stmicro/stmmac/Kconfig        |  11 ++
>>  drivers/net/ethernet/stmicro/stmmac/Makefile       |   1 +
>>  drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c  | 173 +++++++++++++++++++++
>>  4 files changed, 229 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/net/oxnas-dwmac.txt
>>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
> <snip>
>> +
>> +static int oxnas_dwmac_probe(struct platform_device *pdev)
>> +{
>> +       struct plat_stmmacenet_data *plat_dat;
>> +       struct stmmac_resources stmmac_res;
>> +       struct device_node *sysctrl;
>> +       struct oxnas_dwmac *dwmac;
>> +       int ret;
>> +
>> +       sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0);
>> +       if (!sysctrl) {
>> +               dev_err(&pdev->dev, "failed to get sys-ctrl node\n");
>> +               return -EINVAL;
>> +       }
>> +
>> +       ret = stmmac_get_platform_resources(pdev, &stmmac_res);
>> +       if (ret)
>> +               return ret;
>> +
>> +       plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
>> +       if (IS_ERR(plat_dat))
>> +               return PTR_ERR(plat_dat);
>> +
>> +       dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
>> +       if (!dwmac)
>> +               return -ENOMEM;
>> +
>> +       dwmac->regmap = syscon_node_to_regmap(sysctrl);
>> +       if (IS_ERR(dwmac->regmap)) {
>> +               dev_err(&pdev->dev, "failed to have sysctrl regmap\n");
>> +               return PTR_ERR(dwmac->regmap);
>> +       }
>> +
>> +       dwmac->clk = devm_clk_get(&pdev->dev, "gmac");
>> +       if (IS_ERR(dwmac->clk))
>> +               return PTR_ERR(dwmac->clk);
>> +
>> +       plat_dat->bsp_priv = dwmac;
>> +       plat_dat->init = oxnas_dwmac_init;
>> +       plat_dat->exit = oxnas_dwmac_exit;
> 
> Please do not use the init/exit callbacks. Implement proper driver
> callbacks instead. I.e: PM resume/suspend and driver remove.
> 
> Shouldn't you call oxnas_dwmac_init() from probe as well?
> As it is now it will only be called during PM resume and that can't be right.
> 
> 
>> +
>> +       return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
> 
> If stmmac_dvr_probe() fails you should disable your clocks.
> 
> 
> regards,
> Joachim Eastwood
> 

Hi Joachim,

Thanks for the hints, stm32 glue does that and I will sync on it.

Neil

Powered by blists - more mailing lists