Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2854756ybt; Mon, 22 Jun 2020 08:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSuH5BNTelYE2SdL1x6eLLq9HsycEi63SeTJ0tyE0XmdcoypGzu8m4CHauQ1AGudEThGuK X-Received: by 2002:a17:906:d8bc:: with SMTP id qc28mr17196308ejb.167.1592840321143; Mon, 22 Jun 2020 08:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592840321; cv=none; d=google.com; s=arc-20160816; b=HtYES20ggGACVj2mewq8HXUqcwBhj5BEWKdzwADeMBJZ5fu/ad0bnfRhzw3qzqqMet C4uEMq+2MzSfCEPm1gcOwIOEMuwj80ViMKBRDtBR4mEoJG4ocTbwHSIp06xRRTIo4Ex1 JtlT7+XhGa4PJF3ZVUv9y7sMSOWXgNaFFDktX8qa3zKJA5jQutgn0WDfHZ3qWSiF1Z4V TLz+50+xeIMjhj4zldAfvw8TsUtNndk/EAJlB4hjUSlALxDPlbWCR6AnymbKD0VP1A3k ktnEbInPCFoN7KfQoBk0dG2xocVviHIKs1vnnmpxMfvr8HKLdATyY2uxCIvZs59aYw+X svUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:cc:from:to:subject :references:in-reply-to:content-transfer-encoding:mime-version; bh=hOmEPOItw0JDlwocfUH8wJw55cY5g0uU4l2msbL1eLY=; b=B7r7VFEifIqsJgOrAkvUS4VPUfTJvbNZ9pz9FfLcP6TA05Kvbb1EPmCQqKtbgS8Mzc T0tAkllyyYYT9+2+TdlJqhqR/CC06ZB5FBdomoF7GKZz5eFMGoyqJO+Z/NRL+QxZ0fzi ZnLlJl0nyWgsjmqz4cvITweRVIsmPLMKBwk8dzm0Xw4ox3bwuIriUS09pjPAkx2d/SG/ DpYblpDLh8b3HAD/gtrjErtt13fFAmL65pGx0OHeJdF//Xb7lwD4DbuepcAECVxpvg3u zTlbpIuE+23LtY7LAOJ+JpfQbwn3s7rabAFUI5j9ZEhaZyHH1NlYI9cPWcwbbL/W5FOe KHTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn1si9665789edb.500.2020.06.22.08.38.18; Mon, 22 Jun 2020 08:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729346AbgFVPgD convert rfc822-to-8bit (ORCPT + 99 others); Mon, 22 Jun 2020 11:36:03 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:26739 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729150AbgFVPgC (ORCPT ); Mon, 22 Jun 2020 11:36:02 -0400 X-Originating-IP: 90.76.143.236 Received: from localhost (lfbn-tou-1-1075-236.w90-76.abo.wanadoo.fr [90.76.143.236]) (Authenticated sender: antoine.tenart@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 04959240002; Mon, 22 Jun 2020 15:35:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT In-Reply-To: <7520915d32e185d2ca29f085b988d55e@0leil.net> References: <20200619122300.2510533-1-antoine.tenart@bootlin.com> <20200619122300.2510533-7-antoine.tenart@bootlin.com> <7520915d32e185d2ca29f085b988d55e@0leil.net> Subject: Re: [PATCH net-next v3 6/8] net: phy: mscc: timestamping and PHC support To: Quentin Schulz From: Antoine Tenart Cc: davem@davemloft.net, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, richardcochran@gmail.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, allan.nielsen@microchip.com Message-ID: <159284015920.1456598.1495380569655598691@kwain> Date: Mon, 22 Jun 2020 17:35:59 +0200 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, Quoting Quentin Schulz (2020-06-21 19:35:20) > On 2020-06-19 14:22, Antoine Tenart wrote: > [...] > > @@ -999,9 +1553,35 @@ int vsc8584_ptp_probe(struct phy_device *phydev) > > if (!vsc8531->ptp) > > return -ENOMEM; > > > > + mutex_init(&vsc8531->phc_lock); > > mutex_init(&vsc8531->ts_lock); > > > > + /* Retrieve the shared load/save GPIO. Request it as non exclusive as > > + * the same GPIO can be requested by all the PHYs of the same > > package. > > + * Ths GPIO must be used with the phc_lock taken (the lock is shared > > Typo + wrong lock named in the comment, instead: > > * This GPIO must be used with the gpio_lock taken (the lock is shared > > Though technically both are taken when access to the GPIO is requested > AFAICT. That's right, thanks for pointing this out! I'll fix it for v4. > Also on another note, maybe we could actually make vsc8531->base_addr > be a part of vsc85xx_shared_private structure. > > We would still need to compute it to pass it to devm_phy_package_join > but it can easily be returned by vsc8584_get_base_addr instead of the > current void and it'd put all the things used for all PHYs in the > package at the same place. We actually do not use directly the base_addr anymore from within the driver, thanks to the shared package conversion. We're now using __phy_package_write/__phy_package_read which are using the base address. So the move could be to remove it from the vsc8531_private. If we were to do it, we would need to find a clean solution: it's still part of a structure as multiple values are computed in vsc8584_get_base_addr, and it's a lot easier and cleaner to have them all in the same struct. Also, that have nothing to do with the current series :) Thanks, Antoine -- Antoine Ténart, Bootlin Embedded Linux and Kernel engineering https://bootlin.com