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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181029100828.GA19103@Red>
Date:   Mon, 29 Oct 2018 11:08:28 +0100
From:   Corentin Labbe <clabbe.montjoie@...il.com>
To:     Biao Huang <biao.huang@...iatek.com>
Cc:     davem@...emloft.net, robh+dt@...nel.org, mark.rutland@....com,
        devicetree@...r.kernel.org, nelson.chang@...iatek.com,
        andrew@...n.ch, netdev@...r.kernel.org, sean.wang@...iatek.com,
        liguo.zhang@...iatek.com, linux-kernel@...r.kernel.org,
        matthias.bgg@...il.com, joabreu@...opsys.com,
        linux-mediatek@...ts.infradead.org, honghui.zhang@...iatek.com,
        yt.shen@...iatek.com, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/2] net:stmmac: dwmac-mediatek: add support for mt2712

Hello
I have some minor comments below

On Mon, Oct 29, 2018 at 11:04:53AM +0800, Biao Huang wrote:
> Add Ethernet support for MediaTek SoCs from the mt2712 family
> 
> Signed-off-by: Biao Huang <biao.huang@...iatek.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        |    8 +
>  drivers/net/ethernet/stmicro/stmmac/Makefile       |    1 +
>  .../net/ethernet/stmicro/stmmac/dwmac-mediatek.c   |  364 ++++++++++++++++++++
>  3 files changed, 373 insertions(+)
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index edf2036..76d779e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -75,6 +75,14 @@ config DWMAC_LPC18XX
>  	---help---
>  	  Support for NXP LPC18xx/43xx DWMAC Ethernet.
>  
> +config DWMAC_MEDIATEK
> +	tristate "MediaTek MT27xx GMAC support"
> +	depends on OF

You should add something like && (COMPILE_TEST || ARCH_MEDIATEK)

[...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> new file mode 100644
> index 0000000..9ccf3a5
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> @@ -0,0 +1,364 @@
> +// SPDX-License-Identifier: GPL-2.0
> +//
> +// Copyright (c) 2018 MediaTek Inc.

Only SPDX can use the // comment style, the rest should use /**/


[...]
> +static int mt2712_set_interface(struct mediatek_dwmac_plat_data *plat)
> +{
> +	int rmii_rxc = plat->rmii_rxc ? RMII_CLK_SRC_RXC : 0;
> +	u32 intf_val = 0;
> +
> +	/* select phy interface in top control domain */
> +	switch (plat->phy_mode) {
> +	case PHY_INTERFACE_MODE_MII:
> +		intf_val |= PHY_INTF_MII_GMII;
> +		break;
> +	case PHY_INTERFACE_MODE_RMII:
> +		intf_val |= PHY_INTF_RMII;
> +		intf_val |= rmii_rxc;
> +		break;
> +	case PHY_INTERFACE_MODE_RGMII:
> +	case PHY_INTERFACE_MODE_RGMII_TXID:
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +		intf_val |= PHY_INTF_RGMII;
> +		break;
> +	default:
> +		pr_err("phy interface not support\n");

I think you could use dev_err() instead.
And I think it is better spelled "not supported".


[...]
> +static int mediatek_dwmac_probe(struct platform_device *pdev)
> +{
> +	int ret = 0;
> +	struct plat_stmmacenet_data *plat_dat;
> +	struct stmmac_resources stmmac_res;
> +	struct mediatek_dwmac_plat_data *priv_plat;
> +
> +	priv_plat = devm_kzalloc(&pdev->dev, sizeof(*priv_plat), GFP_KERNEL);
> +	if (!priv_plat)
> +		return -ENOMEM;
> +
> +	priv_plat->variant = of_device_get_match_data(&pdev->dev);
> +	if (!priv_plat->variant) {
> +		dev_err(&pdev->dev, "Missing dwmac-mediatek variant\n");
> +		return -EINVAL;
> +	}
> +
> +	priv_plat->dev = &pdev->dev;
> +	priv_plat->np = pdev->dev.of_node;
> +	priv_plat->phy_mode = of_get_phy_mode(priv_plat->np);
> +
> +	ret = mediatek_dwmac_config_dt(priv_plat);
> +	if (ret)
> +		return ret;
> +
> +	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);
> +
> +	plat_dat->interface = priv_plat->phy_mode;
> +	/* clk_csr_i = 250-300MHz & MDC = clk_csr_i/124 */
> +	plat_dat->clk_csr = 5;
> +	plat_dat->has_gmac4 = 1;
> +	plat_dat->has_gmac = 0;
> +	plat_dat->pmt = 0;
> +	plat_dat->maxmtu = 1500;

ETH_DATA_LEN ?

Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ