Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7904050rdb; Thu, 4 Jan 2024 11:14:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFd5tqruHwBE6LNTE6Y6NhP16/WlP3OAFjCQ5LEdTaNUYWvcJcZqNB5YU0GeycCUNYq1jr8 X-Received: by 2002:a17:902:edcd:b0:1d4:a179:e68b with SMTP id q13-20020a170902edcd00b001d4a179e68bmr733588plk.19.1704395647590; Thu, 04 Jan 2024 11:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704395647; cv=none; d=google.com; s=arc-20160816; b=jrrIWV1O11ZsveghWAw53z/q95up0KzmVrsTILv8ZR6XwQzCuZFrUrpE5bvyvwGd2K eWq6Kl2t8h3apLSmszrcI4k5tu7se/16WCVqu+k0k2xndTRG5uG1AIpewjXVZhEzGy55 wVgrrtIolHDQ/waFIk20Nx7b5F5WXUbv6ghxtHsZIHp1epnnuwDi+wdKygws0FwBToJW QHnQR3imuAcVKYJlesztKRP7uWIpsRd4ruEhQ5W2eVMiLxpoWSFzQdCku4BZowt5McAk 2lBoejEvTjAqYI+5jWtwwFnxgGzUbdsRnkNmvqVgrMhchc3PP5M2soViWCaaHZLUxwo3 WXFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=04Sj92+QLWqEQ6y2Wbd70hX6tL6uLlbH/Urgy/yOj4k=; fh=0jFD0s5/EyLFHtSYGFAtLLJHOmgWaNNhrz56andMF90=; b=uH2T/DIkBemmr7UMcV7NhAgZJ40j9vU9qc0bx1B+6zdj9Ms6ssTbMfmS/ZmvTPmsdq PQP9U6GzUxiQQ63BwlSdrPlBed9cVxP/NM1qoaJ2TT9r8eTdRxBdVVECFts7oSCrgcY7 pGExlkzzi/QUNweyAwId4GaMKbdChEYj75vDKSCsoXuV2OaF+NS8xh1tZFJbsW/Jr028 0Wd2U9cKx63v2yck3Pb3juiq1iG9G1OFeMbWQwsHnV06WPXGxoJKvS0CFJyuYAO4QyYS bvd7fBWw7wHfsy+Cs6MjloSfZhlWsOAqLtr7ou0gzqVH1eWRal72VWErzXGIA1y3uLbV PutA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VBp8jDrF; spf=pass (google.com: domain of linux-kernel+bounces-17134-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17134-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n14-20020a170903110e00b001d473729a69si15458787plh.511.2024.01.04.11.14.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 11:14:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17134-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VBp8jDrF; spf=pass (google.com: domain of linux-kernel+bounces-17134-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17134-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2B7CAB213EF for ; Thu, 4 Jan 2024 19:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E0CC2C194; Thu, 4 Jan 2024 19:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VBp8jDrF" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E981B2C18C for ; Thu, 4 Jan 2024 19:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-50e80d40a41so996507e87.1 for ; Thu, 04 Jan 2024 11:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704395573; x=1705000373; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=04Sj92+QLWqEQ6y2Wbd70hX6tL6uLlbH/Urgy/yOj4k=; b=VBp8jDrFkqzX5/kscWpep8v25Oi6831bBl+MxbIByHBZMifWUZDrrscrUOUoqf4jWZ 9L7WguU80AHzYnrDGy4qEkGjpRMvp/r1O/VoIqXGPbwpcpcejA8fzljn55viFIoX7swA 62iaZLxxx3S9tCgsxYk2NaCy6fWmaAXczb1bwSHW+gx8iO9cyayXEvyrgKlAbHOzXDUG ZZS0IcB+L2GOGCrgQ/RkaY5pUsRO160zWY7t4eoOS0gkJQoH7vWU1JK0xHTFqCDPkUNT /0s/ZVKHKCN6RWnQZvlJlj+M2vUUfBAr1Nab77ZntZtCJEeUEtheZMDGmd2rgy48RoZC NPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704395573; x=1705000373; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=04Sj92+QLWqEQ6y2Wbd70hX6tL6uLlbH/Urgy/yOj4k=; b=gS4pG2vv4NkxREOwbC755kFaq+fzgZ+ja2ktP8ocdRIujUGo5IiPW1nK87FR4Bd1q5 PXq86jz54xXf6t55FoQIL/zJpPcIi+K4kUI5mQpemcqS1uhP8snZNIHQ8dbKSUyL2jME JxqZLmmezHsgycfuw4UIbUNDIArRIY7Bd7OR+2RDshcVhfmdRXPn9JUhUJlJyUU5ouwT ljMEZN3wLmOBYYazfsQaNGYJ+ZbkxZuBLLGNUXbF+Zoe2ycq2VebZBvXyRPiVOWSSDug 4TeAETGjAcQcAZF2mvVOrLQ7w28HzGq3ZAcNjapAD758PMN4EyqVmNX2jVrlLjNku+nO 7bIg== X-Gm-Message-State: AOJu0YyRn6hcPCCtN0JAjV7q+3EB9+FBuWa7HZlTR6uJTall7IaX4bTD /P3gzwIeNEBAHqdTqwfEvG8AnPqYxO0B7A== X-Received: by 2002:a05:6512:3c84:b0:50e:8983:8743 with SMTP id h4-20020a0565123c8400b0050e89838743mr734425lfv.87.1704395572914; Thu, 04 Jan 2024 11:12:52 -0800 (PST) Received: from linaro.org ([79.115.23.25]) by smtp.gmail.com with ESMTPSA id zr16-20020a170907711000b00a26af4d96c6sm13068108ejb.4.2024.01.04.11.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 11:12:52 -0800 (PST) Date: Thu, 4 Jan 2024 21:12:51 +0200 From: Abel Vesa To: Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] phy: qualcomm: eusb2-repeater: Fix the regfields for multiple instances Message-ID: References: <20240104-phy-qcom-eusb2-repeater-fixes-v1-0-047b7b6b8333@linaro.org> <20240104-phy-qcom-eusb2-repeater-fixes-v1-1-047b7b6b8333@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240104-phy-qcom-eusb2-repeater-fixes-v1-1-047b7b6b8333@linaro.org> On 24-01-04 16:52:11, Abel Vesa wrote: > The global regmap fields offsets currently get incremented with the base > address of the repeater. This issue doesn't get noticed unless the probe > defers or there are multiple repeaters on that platform. So instead of > incrementing the global ones, copy them for each instance of the > repeater. > > Fixes: 4ba2e52718c0 ("phy: qualcomm: phy-qcom-eusb2-repeater: Use regmap_fields") > Signed-off-by: Abel Vesa > --- > drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > index a623f092b11f..5f5862a68b73 100644 > --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c > @@ -101,6 +101,7 @@ struct eusb2_repeater { > struct regmap_field *regs[F_NUM_FIELDS]; > struct phy *phy; > struct regulator_bulk_data *vregs; > + struct reg_field *regfields; > const struct eusb2_repeater_cfg *cfg; > enum phy_mode mode; > }; > @@ -140,8 +141,8 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr) > > static int eusb2_repeater_init(struct phy *phy) > { > - struct reg_field *regfields = eusb2_repeater_tune_reg_fields; > struct eusb2_repeater *rptr = phy_get_drvdata(phy); > + struct reg_field *regfields = rptr->regfields; Oups, this is not needed. Will drop after I get some more comments on this. > struct device_node *np = rptr->dev->of_node; > u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 }; > u8 override; > @@ -262,15 +263,21 @@ static int eusb2_repeater_probe(struct platform_device *pdev) > if (!regmap) > return -ENODEV; > > + rptr->regfields = devm_kmemdup(dev, eusb2_repeater_tune_reg_fields, > + sizeof(eusb2_repeater_tune_reg_fields), > + GFP_KERNEL); > + if (!rptr->regfields) > + return -ENOMEM; > + > ret = of_property_read_u32(np, "reg", &res); > if (ret < 0) > return ret; > > for (i = 0; i < F_NUM_FIELDS; i++) > - eusb2_repeater_tune_reg_fields[i].reg += res; > + rptr->regfields[i].reg += res; > > ret = devm_regmap_field_bulk_alloc(dev, regmap, rptr->regs, > - eusb2_repeater_tune_reg_fields, > + rptr->regfields, > F_NUM_FIELDS); > if (ret) > return ret; > > -- > 2.34.1 >