Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp450964rwo; Fri, 21 Jul 2023 14:51:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlF9GwvtLrRRdXtd8U8Mw9UcsDyb1NMeYuFPqwgD9UuGz5pSDI5DsT/IoEJKDuT525f/0CeK X-Received: by 2002:a05:6a20:3252:b0:135:9b84:cf43 with SMTP id hm18-20020a056a20325200b001359b84cf43mr3096804pzc.28.1689976290885; Fri, 21 Jul 2023 14:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689976290; cv=none; d=google.com; s=arc-20160816; b=CGLTVmB53OW8l29SjJk4TTeOtsGpT3nW+q8EL6Q1rvtRMaN4mJaEolcuSo40vPE/LD DHefeTfo2BZ2retSZJ2sfh20tgDmjI4YCXFbXSQMXTcVoqwOK/yNclht+3fXWP9ngH8u PmLPyIZ0F0xdFV2/yreqEBd9UlP16wx5NOrtLjbj3xZe68Ondkabtefr0pOdoyDWqgkW sgc39CoXpj+SZbSwFyQACOk/8s7R4ZsWrP9bG04RixfTO5ILuzUeG2lS2vWduNRtH01N 0PH1DdWz/E6GLMU7/Ma1vGjUP+yUpwTNAyBApgdcG0/lXL5nI047jdorFsKB+CWlqATw 94zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:newsgroups:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=+AI3+XsUJI+ulF08I406IDbECh2Ii2X/RJj/A5FZuTo=; fh=OM2y3K+LYGJ7NUXCJNV9sx4JEVr9G+YvEHekOfv8E24=; b=HXo7sz/oZnrIhaP1yMvOF6ys2wT0j6fCPY65cB7cvKqO0X7ukB2fsXK3Q1jrPqHkEA Ww5PVO5woqZFeV5drZ3E5xpLtAelgDV02BrxpFpQtx0nBrW/uu0huDLGv6L3IGT4on5e pYU4/IJnyZ1Or70A2CCfqwUjenB13u/4JHv/7e0MDAQd2DBsY9a0OLXLn2wR3pa+hxNd UNC+pprPL52wUfbhZF2CnZ5Adl+6FltkZI3rd1+gwLWzy9CzBJkxRSdBkEM+qQeQ5QP2 DDLaHirr51Lz71VvIGeC5e53iuMHJd/4z+FB8E0/JRCatijHElx0763E8pWbPYtzoDsx PvIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LPXWIPHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a056a00188a00b0067dd7254cb0si3953221pfh.39.2023.07.21.14.51.18; Fri, 21 Jul 2023 14:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LPXWIPHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229646AbjGUVjz (ORCPT + 99 others); Fri, 21 Jul 2023 17:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjGUVjy (ORCPT ); Fri, 21 Jul 2023 17:39:54 -0400 Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35A58272D for ; Fri, 21 Jul 2023 14:39:52 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id Mxqmq5keRulAmMxqmqA5x4; Fri, 21 Jul 2023 23:39:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689975590; bh=+AI3+XsUJI+ulF08I406IDbECh2Ii2X/RJj/A5FZuTo=; h=Date:Subject:To:References:From:In-Reply-To; b=LPXWIPHiJfZKAb1Aiz4HQrkMhAa1jNbjXrfkxxrPpnnXhkK9QKbc3DTltOhIHc3BU Offx+DFuN9pwJM81Ie9Nhufi7RDelWRMJ260rHjnXSngCS19h6Rg9ZCNJBFaLFGdT0 ET0IJlPORPM7THSVv5+CmKznQYOBewPXjOFDLpD2hHBgiCKfZ4u5cLtRuHhqMRPd3/ Iy2B6Bv7RZu6NUkKHi4Fk0Eit0trLJgUCbY4ibuRl1YTqVipcgqod/VHmbpmZPSv19 pSAij0uQjbXU1NMoYm2X7a1rRYPT+pTN8YYIvKbNqldgvlSuW+QWpn7oVTGrqVICCP Dph9gUBF9Veog== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 21 Jul 2023 23:39:50 +0200 X-ME-IP: 86.243.2.178 Message-ID: Date: Fri, 21 Jul 2023 23:39:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v1 2/5] net: hpe: Add GXP UMAC MDIO Content-Language: fr To: nick.hawkins@hpe.com, verdun@hpe.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Newsgroups: gmane.linux.network,gmane.linux.drivers.devicetree,gmane.linux.kernel References: <20230721212044.59666-1-nick.hawkins@hpe.com> <20230721212044.59666-3-nick.hawkins@hpe.com> From: Christophe JAILLET In-Reply-To: <20230721212044.59666-3-nick.hawkins@hpe.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 21/07/2023 à 23:20, nick.hawkins@hpe.com a écrit : > From: Nick Hawkins > > The GXP contains two Universal Ethernet MACs that can be > connected externally to several physical devices. From an external > interface perspective the BMC provides two SERDES interface connections > capable of either SGMII or 1000Base-X operation. The BMC also provides > a RMII interface for sideband connections to external Ethernet controllers. > > The primary MAC (umac0) can be mapped to either SGMII/1000-BaseX > SERDES interface. The secondary MAC (umac1) can be mapped to only > the second SGMII/1000-Base X Serdes interface or it can be mapped for > RMII sideband. > > The MDIO(mdio0) interface from the primary MAC (umac0) is used for > external PHY status and configuration. The MDIO(mdio1) interface from > the secondary MAC (umac1) is routed to the SGMII/100Base-X IP blocks > on the two SERDES interface connections. > > Signed-off-by: Nick Hawkins > --- [...] > +static int umac_mdio_probe(struct platform_device *pdev) > +{ > + struct resource *res; > + struct mii_bus *bus; > + struct umac_mdio_priv *umac_mdio; > + > + int ret; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) { > + dev_err(&pdev->dev, "fail to get resource\n"); > + return -ENODEV; > + } > + > + bus = devm_mdiobus_alloc_size(&pdev->dev, > + sizeof(struct umac_mdio_priv)); > + if (!bus) { > + dev_err(&pdev->dev, "failed to alloc mii bus\n"); > + return -ENOMEM; > + } > + > + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(&pdev->dev)); > + > + bus->name = dev_name(&pdev->dev); > + bus->read = umac_mdio_read, > + bus->write = umac_mdio_write, > + bus->parent = &pdev->dev; > + umac_mdio = bus->priv; > + umac_mdio->base = devm_ioremap_resource(&pdev->dev, res); > + if (!umac_mdio->base) { > + dev_err(&pdev->dev, "failed to do ioremap\n"); > + return -ENODEV; > + } > + > + platform_set_drvdata(pdev, umac_mdio); > + > + ret = of_mdiobus_register(bus, pdev->dev.of_node); devm_of_mdiobus_register()? This makes the platform_set_drvdata() just above and umac_mdio_remove() useless. CJ > + > + if (ret < 0) { > + dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); > + return ret; > + } > + > + return 0; > +} > + > +static int umac_mdio_remove(struct platform_device *pdev) > +{ > + struct mii_bus *bus = platform_get_drvdata(pdev); > + > + if (bus) > + mdiobus_unregister(bus); > + > + return 0; > +} > + > +static const struct of_device_id umac_mdio_of_matches[] = { > + { .compatible = "hpe,gxp-umac-mdio", }, > + {}, > +}; > +MODULE_DEVICE_TABLE(of, umac_mdio_of_matches); > + > +static struct platform_driver umac_driver = { > + .driver = { > + .name = "gxp-umac-mdio", > + .of_match_table = of_match_ptr(umac_mdio_of_matches), > + }, > + .probe = umac_mdio_probe, > + .remove = umac_mdio_remove, > +}; > + > +module_platform_driver(umac_driver); > + > +MODULE_AUTHOR("Nick Hawkins "); > +MODULE_DESCRIPTION("HPE GXP UMAC MDIO driver"); > +MODULE_LICENSE("GPL");