Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4825663imm; Mon, 14 May 2018 13:53:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoHibHp24oTG5fM4tmtifT/cPvMu6FsQyxY0qUMPrGhiJh3OxwTQg0olRoBbXfAkO3+rWMb X-Received: by 2002:a17:902:6b8b:: with SMTP id p11-v6mr11098967plk.212.1526331239922; Mon, 14 May 2018 13:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526331239; cv=none; d=google.com; s=arc-20160816; b=d3p/BujcF75QnfbDPQOmNpODHOLayqTJorZPM4wij67WhGxkY0/QlLF1949HIhq0fd z1tw1miBkQgm3FNwlNEUYeWq7xWjLw4IvUtekTO7q/VFZ1/1i6AhtG4F32afIdVQzfOH HhfsO3XdaVz9XcdLMTncqC/ylMgJvTE7GiVokvlzjr7eZFnwTtOilxku1DDiIk/dFJh6 nYdIDRIVm4lzi5nIzA9EegxSf2tJR5F07ysz1tPwKE3xy8RFdkOA3l8Rr3K6W+YlZxDm AqHgBRI91wW2JFiGXx4ssK/D51dGw45FikrUpVwZimeAUxqwf/DAkttziPYmZH6ly90x MrPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=o6oKlTV0ZSFdN1HSa1jb+7Vcc9kymBVzW2eicFTjQV4=; b=yG637VNjRqtZFc2gE30gFcft2UUQPL2hdPAVeNs1ZVRWtia2w1L5hCD6WGkUFM8G5/ cisYFzvD+iM3d/2x8nshiJmtV0hNoplD+CniSxbNKZXHm85+pUfH0+ivJXb2jHWC2FqZ j3QdGSnqmBAo8I8PPLL8OG6xAuhPuIQ6YzQpmpRek2GYRXjR9dOy976ZtInCXuLG5ZK9 X/uxlT45Xnb+4GYcyoeXUOqjTNloGXIDsp96SiPMjVDUKJ2mgC4bmk9ZkV1Tmbb8Uy2a hw5qO1Q6ZNThYHaUA6g6Gxndh2noiJz//jKmwhffcFsSG7akkuLRShmLivPUHxF1qZ5q vBhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hBfNVd3a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9-v6si10933360plk.94.2018.05.14.13.53.45; Mon, 14 May 2018 13:53:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hBfNVd3a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbeENUwL (ORCPT + 99 others); Mon, 14 May 2018 16:52:11 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36005 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeENUwI (ORCPT ); Mon, 14 May 2018 16:52:08 -0400 Received: by mail-wm0-f65.google.com with SMTP id n10-v6so17561732wmc.1; Mon, 14 May 2018 13:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=o6oKlTV0ZSFdN1HSa1jb+7Vcc9kymBVzW2eicFTjQV4=; b=hBfNVd3aJGxvme+zJ1aSLCylm4N1ZVzzJW8VXWE7QnPUKMKrmpKOKJRVDmgZOEQY2Q jflvvfGv5NXvQrd/l4jeKOr577Ino9poudAzQbh/sNhzUuXb+rVg1e+HF5vDf22x+jG0 Wbu1A+QwI1kRhursf51mkjYESsumzcrPTevto6OniXZkajhn3pL2RkwmayaZ89TdG0X6 oaRoBo4o0O2Qsr2aHOa0/hb5pTVGACl+PHTIFwRzrvSUlD+I1bwWR/Y9Jg7oHGhBtVJE 3v5SwV8K2XBa7MlJsPSdIuYiFYrFiNPKnp8B3+XfK8ZXt9YhEwBTOMeBk0o7x1+WRftB B2mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=o6oKlTV0ZSFdN1HSa1jb+7Vcc9kymBVzW2eicFTjQV4=; b=nJVfBqbITMvHQnMkShW/ve25D2JgbWE07oqTB6PzNwOR7TMk97iyq2klOa8adYbz+K Nwyo58NwBorf5g6tChqpKfUj/inie5JFIf1C0AGaOfwGRLOMxnPW/bRcjKvFvKhK2fv3 hGrQUmY39/fbp27QhouFvdAtGFlLlpj8vyfwS2iMiirbWfw3YhHaxKuXCM1Wellm5pIk 2PFOWqfe5Fa6A0GE/FMINMBCjdU99G4c8o8ShP9w04j9Lb/omOPzif2f0XnDoVXQIcni 2XpyJoa+RtOK4Tul2V8SJsM32gGt1B5uOlVtnl8KaQry7VQ20seCNTXcVsCuYXZCFitg osAg== X-Gm-Message-State: ALKqPweplsJwRsjhrPm2iNr16CYOc9yelGBvi6XCJvysE97kY5eU1lPH lRCJ2P6gBl2VfTRifS/AtrWlZ2lB X-Received: by 2002:aa7:c6d0:: with SMTP id b16-v6mr14261044eds.302.1526331127178; Mon, 14 May 2018 13:52:07 -0700 (PDT) Received: from [10.69.41.93] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id h51-v6sm5522208eda.88.2018.05.14.13.52.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 May 2018 13:52:06 -0700 (PDT) Subject: Re: [PATCH net-next v3 2/7] net: phy: mscc-miim: Add MDIO driver To: Alexandre Belloni , "David S . Miller" Cc: Allan Nielsen , razvan.stefanescu@nxp.com, po.liu@nxp.com, Thomas Petazzoni , Andrew Lunn , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org References: <20180514200500.2953-1-alexandre.belloni@bootlin.com> <20180514200500.2953-3-alexandre.belloni@bootlin.com> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80nRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaUBn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WU11Nr9i/qoV8QCo12MQEo244RRA6VMud06y/E449rWZFSTwGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: Date: Mon, 14 May 2018 13:52:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180514200500.2953-3-alexandre.belloni@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/14/2018 01:04 PM, Alexandre Belloni wrote: > Add a driver for the Microsemi MII Management controller (MIIM) found on > Microsemi SoCs. > On Ocelot, there are two controllers, one is connected to the internal > PHYs, the other one can communicate with external PHYs. > > Reviewed-by: Andrew Lunn > Signed-off-by: Alexandre Belloni Nothing critical, so: Reviewed-by: Florian Fainelli [snip] > +static int mscc_miim_reset(struct mii_bus *bus) > +{ > + struct mscc_miim_dev *miim = bus->priv; > + > + if (miim->phy_regs) { > + writel(0, miim->phy_regs + MSCC_PHY_REG_PHY_CFG); > + writel(0x1ff, miim->phy_regs + MSCC_PHY_REG_PHY_CFG); > + mdelay(500); Can this become an msleep() in the future? > + } > + > + return 0; > +} > + > +static int mscc_miim_probe(struct platform_device *pdev) > +{ > + struct resource *res; > + struct mii_bus *bus; > + struct mscc_miim_dev *dev; > + int ret; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) > + return -ENODEV; > + > + bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev)); > + if (!bus) > + return -ENOMEM; > + > + bus->name = "mscc_miim"; > + bus->read = mscc_miim_read; > + bus->write = mscc_miim_write; > + bus->reset = mscc_miim_reset; > + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev)); > + bus->parent = &pdev->dev; > + > + dev = bus->priv; > + dev->regs = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(dev->regs)) { > + dev_err(&pdev->dev, "Unable to map MIIM registers\n"); > + return PTR_ERR(dev->regs); > + } > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > + if (res) { > + dev->phy_regs = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(dev->phy_regs)) { > + dev_err(&pdev->dev, "Unable to map internal phy registers\n"); > + return PTR_ERR(dev->phy_regs); > + } > + } > + > + if (pdev->dev.of_node) > + ret = of_mdiobus_register(bus, pdev->dev.of_node); > + else > + ret = mdiobus_register(bus); There are other drivers doing that, we should probably make that the standard behavior of of_mdiobus_register(), like before, candidate for another patch. -- Florian