Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp928015ybt; Wed, 24 Jun 2020 15:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwywFNEB8j2SB33ZQueSE3zHU6SY45d6Rg5A9CmeMTulmQFYppUdWvL61NaqvB0bko6B2JR X-Received: by 2002:a05:6402:c06:: with SMTP id co6mr9337156edb.142.1593036305008; Wed, 24 Jun 2020 15:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593036305; cv=none; d=google.com; s=arc-20160816; b=Kauaj6Zli9+Br1BGRS+EjAckmnUDCCzJpvS3vuLDiEHmWfkm1b7jqWnN+mbpeBKKnM vzxbZk3Z0n9v9yTnmI/SzdB4iXkbdlcDozIHxY6byJG4LKQtkQZg/ffb8tsj4WitLnCc Jw3zWII7qZjkVOl6LQ2FIYVKqLFxgftPrYS+SvRpC/XReT/c7IWminNlePOBX+MN0SJU /5q0ql3c1u5vbLyHGsNiIkUUAAuGhdkJi4cEt4X3zqfAs60odgjUH5RegIalK5Gp0p0Z 3hjU3Am4O5JJDeLCDeUEUHaVG3yJ3EFzTOugpLSGfIE0mVckJbP9MxiU/h/o5Ftk9qyg 5jQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cctIVZOWmYSoVOUqVgS0D6RWurd0mB6Zd0WrB5mBEf0=; b=Put+L63F7AkJz01no8lgTUPxiReSAHWp9w3MvIslbpu5Vslg5nOO37SEeLYzu0PnVS d9vCc2uak4Ru9qQ2c3vFCs4Mw5ynMEs5Rk8FZHg0P//dTQ25GuIISEBTh6itqecIHMjf kHuJHYt78jS0rmgR4yNMixmYGOEJHlTn9Y2PsNctrGAkrjPvsJdURZ5Pj4kATmQ7QqWF t5oDUNBHGEEoKyjtfVLJ9ITogec5xwlQJbCgOIUslVJpmx64LS1MsjmHf61e+0tkC1iD 08qgXQPugavBj/Ynqvfc7QtrZzQV+Ey2lTORAgEjPkbqS5+GDu43n3jDyxUdLHqA1R9r 0Xyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=f0fHUh57; 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 op10si7669186ejb.149.2020.06.24.15.04.42; Wed, 24 Jun 2020 15:05:04 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=f0fHUh57; 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 S2390213AbgFXVPC (ORCPT + 99 others); Wed, 24 Jun 2020 17:15:02 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:35394 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389905AbgFXVPB (ORCPT ); Wed, 24 Jun 2020 17:15:01 -0400 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 59C3B2A8; Wed, 24 Jun 2020 23:14:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593033299; bh=O456LASQn9kO/3hkrQBpyo1bbr1iLz/VwItz+lFwffU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f0fHUh57lgRqR9IpMOjXoZK3Twxsd/ZWfJQm+2hA0sVIRWeRIZO2MX/jELjW3RNyB 48IdhD2OXlfK0afif8c8zY3u1PFxQqTpmuh4UmFp5AcXqSCujRE6aH5TSRlMhQAE45 eYSABfTxAZhVCiHfU3S95gmqFKjCyWcVj3buK2/M= Date: Thu, 25 Jun 2020 00:14:58 +0300 From: Laurent Pinchart To: Vinod Koul Cc: linux-kernel@vger.kernel.org, Kishon Vijay Abraham I , Anurag Kumar Vulisha , Michal Simek Subject: Re: [PATCH v8 2/3] phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver Message-ID: <20200624211458.GA29023@pendragon.ideasonboard.com> References: <20200513172239.26444-1-laurent.pinchart@ideasonboard.com> <20200513172239.26444-3-laurent.pinchart@ideasonboard.com> <20200624151121.GF2324254@vkoul-mobl> <20200624163927.GF5980@pendragon.ideasonboard.com> <20200624172635.GI2324254@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200624172635.GI2324254@vkoul-mobl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vinod, On Wed, Jun 24, 2020 at 10:56:35PM +0530, Vinod Koul wrote: > On 24-06-20, 19:39, Laurent Pinchart wrote: > > > > > +/* Number of GT lanes */ > > > > +#define NUM_LANES 4 > > > > > > Should this be coded in driver like this? Maybe future versions of > > > hardware will have more lanes..? Why not describe this in DT? > > > > This macro is used to avoid hardcoding 4 in the driver, to make sure > > that all the code that deal with the number of lanes use a consistent > > value and is readable. There's no foreseen new version of the IP that > > would have more lane, so I don't think this should go in DT. Otherwise > > we'd have to encode there pretty much any parameter that could one day > > possibly change in a different universe :-) > > > > Let's also note that even when parameters change between IP versions, it > > doesn't always make sense to specify them explicitly in DT. It's totally > > fine to have a table of parameter values in the driver, indexed by > > compatible string. Whether to set a parameter explicitly in DT or handle > > it in the driver usually depends on how frequently that parameter can > > change, if it can vary between different integrations of the same IP > > version, ... > > > > In this specific case, as there's no foreseen change, we can't really > > tell how it would change if it did one day. I thus think hardcoding the > > parameter in the driver is fine, and in the worst case, we can add a > > parameter in DT later and default to 4 if not specified. Same reasoning > > for CONTROLLERS_PER_LANE. > > yeah not every parameter can be coded and we should use compatible as > well, but I would disagree with no future revision planned. It will > happen not now, but sometime in year or so :) Been around devices has > taught me that only constant thing is change in hardware! I don't dispute it will not happen, my point is that, without a new revision planned, we don't have enough information to tell which option would be best to support future revisions. As I know we won't be blocked (both compat string matching and adding new optional properties with appropriate defaults will be viable options), I'm not concerned. > Yes but this is not a deal breaker atm, will leave upto you > > > > > + > > > > +/* SIOU SATA control register */ > > > > +#define SATA_CONTROL_OFFSET 0x0100 > > > > + > > > > +/* Total number of controllers */ > > > > +#define CONTROLLERS_PER_LANE 5 > > > > > > Same question for this as well.. > > > > > > > +/* > > > > + * I/O Accessors > > > > + */ > > > > + > > > > +static inline u32 xpsgtr_read(struct xpsgtr_dev *gtr_dev, u32 reg) > > > > +{ > > > > + return readl(gtr_dev->serdes + reg); > > > > +} > > > > + > > > > +static inline void xpsgtr_write(struct xpsgtr_dev *gtr_dev, u32 reg, u32 value) > > > > +{ > > > > + writel(value, gtr_dev->serdes + reg); > > > > +} > > > > + > > > > +static inline void xpsgtr_clr_set(struct xpsgtr_dev *gtr_dev, u32 reg, > > > > + u32 clr, u32 set) > > > > > > wouldn't it be apt to rename this to xpsgtr_modify() and with args as > > > value and mask, somehow I find that more simpler... > > > > "modify" sounds more vague to me. I've also kept xpsgtr_clr_set() as > > that's what the original author used. > > yeah maybe that was a wrong choice of term, I guess update looks best. > We really are missing update api in kernel! I see regmap does provide > _update_bits() api > > > > Also, please align second line with opening brace of preceding line > > > > It is aligned, the first line is affected by the + and > in the mail, > > while the second line uses tabs and thus isn't. > > ok -- Regards, Laurent Pinchart