Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2384011imn; Tue, 2 Aug 2022 00:12:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tqgpo43Got2Eb7zp5YByttSup3ZuKoufNawGDt7SSAB/fdzqBXxGuo5RQVFA/hXxICuvKO X-Received: by 2002:a05:6a00:1ac7:b0:52b:37ac:442c with SMTP id f7-20020a056a001ac700b0052b37ac442cmr19520963pfv.76.1659424370297; Tue, 02 Aug 2022 00:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659424370; cv=none; d=google.com; s=arc-20160816; b=PbJSDo2tYbkkkLUuPvOikHdEF9VLVJR4R+DQ7b+sU4zgOpn6M3syIq/dJ6QCpvqWxl 7udrdmE47U1vaexyiCpzaS7UUrPdMIwTpYDVmafuLxdEmzCFoAUxLCh1TAZFO/wv6chN D35jLULPniNYloPwvAU0dPxoixFmMBsKeBUOnALsqkQzF7joVQFfJUl3bS06hcIiye1y 5d9tGkSemfjdGULhu29jEtGb7JnYnNaSHORaTGwrzZpe2ctawO4fW82v25/UqPGzefqV FRzmI5RDKwiNBaUMz5IXD/IgTGgLOW7qPi9aHjFcgH4viNms/gRLZJ/VbZjuzGG+qYKM thqw== 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:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=YyBYmLXFn5IFerrIXB88rk828Nzxi3yZBlN5vWZi/gM=; b=XT4owES6lQUE5/nT2GX7AHNfeGdk7jj+qv7FyWD7wI2ojf2Bkdkbk6vNOc9gxJtSY3 fGlsQ/l18DkoAHRrhyRLpbmfBTunP63D+Sv7JZeZMefSj12Cr9pD14kKUvrf7Uc/3oFy MVaFAif1NxdjMipFZvcgLCFe2W/dgvecIKVLgJM3Y1BFiEIxFUnVnD2V3c4R0xcIqmNl TTX1UZjZV6KLhyEl6pRtebwXPp1jCR5F0BzC0tYE6O78dqC6dEIRk0CT1rTiKxSp6Urk D5ZHH2xWZeX9tSZrwT1piPGT7ixg6nrW9m3bG6NfX2qdIpKnK/1F/HclaWzvUawdhpZz Jatg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cqShYtc7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a17090332cd00b0016eea30627esi6107184plr.565.2022.08.02.00.12.36; Tue, 02 Aug 2022 00:12:50 -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=@linaro.org header.s=google header.b=cqShYtc7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235866AbiHBHHK (ORCPT + 99 others); Tue, 2 Aug 2022 03:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235681AbiHBHGm (ORCPT ); Tue, 2 Aug 2022 03:06:42 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74DFB491F4 for ; Tue, 2 Aug 2022 00:06:35 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id s14so14673406ljh.0 for ; Tue, 02 Aug 2022 00:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=YyBYmLXFn5IFerrIXB88rk828Nzxi3yZBlN5vWZi/gM=; b=cqShYtc7B4W7+q0vK7VkTMRnsYgBNGzLw6e2P8pZuRkHXrMnlMerLmoE/2weJs4sSA ocXKFpxuWtWtb1fhSYbnxLu9yBchBRsggPdcY+GsiMqQxQzl00PcrID3nMwsn5j9ljUn Q2q45sZ0s6MZWe2aMQmOCqU3abPyz7zyeyliIBvgJZlj/OJ2VmjEBuPNg2NKYSZqJV2f Ba5lIM6m2qZ7Q8GEkOJJ7xmwxGbFeEGtWqzPlCAIjZVbwXph3xyaIznRTbSr/mrwh18N idKySTQiWRH+Y6UU3DZwyzzDiy5UABGQzp8uHK8B+9SG0ZaLpx4iZXISVU0aDf2GPW/L sVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=YyBYmLXFn5IFerrIXB88rk828Nzxi3yZBlN5vWZi/gM=; b=1fq48MLZfnTseHIiNGn0xjU5HUWZnvJosAlVv38Gcqrij0X1NOBAM/k/WPQqZkm1O1 EV1GoNvzK3mAiReMbQ4TSkTYGqCdf3WDQVk0UiEojO5r30Bk2Tuzo3bngqeCbqzCO0KQ x0rlHOIRRTrej0hYxJFrF4fpbvAU0O7PCcfz2uRQ8ADSHEE1i0wYECQWWKScqk5IYYCq NCwVLJ2hqA9PRQFDFFUZYTseCx6A9TzORCjIJZFPEz+rTHsC6zb9ueCLYvIbsX32royD rRMzZzUwqqybeTLkrM00tQPMTCTI6aT3f4/QWiu4onisj+PJcBV4QegCCoQLheV+meEU Nz4Q== X-Gm-Message-State: AJIora8iCZQZjwia0y67DthscFTV6M063MvNm2imwAKSWP2aF9UBQW/f 8odRfNoaIz80rREZv6+d/1isCA== X-Received: by 2002:a2e:bd0a:0:b0:25d:d2a3:7366 with SMTP id n10-20020a2ebd0a000000b0025dd2a37366mr6103917ljq.35.1659423993628; Tue, 02 Aug 2022 00:06:33 -0700 (PDT) Received: from [192.168.1.211] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id e1-20020a05651236c100b0048afa5daaf3sm629717lfs.123.2022.08.02.00.06.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Aug 2022 00:06:33 -0700 (PDT) Message-ID: <43d19449-cf06-2302-b536-4ade5f79c5fd@linaro.org> Date: Tue, 2 Aug 2022 10:06:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 2/5] clk: qcom: Allow custom reset ops Content-Language: en-GB To: Akhil P Oommen , freedreno , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Bjorn Andersson , Stephen Boyd Cc: Douglas Anderson , Andy Gross , Konrad Dybcio , Michael Turquette , Philipp Zabel , Stephen Boyd , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org References: <1659172664-10345-1-git-send-email-quic_akhilpo@quicinc.com> <20220730144713.2.I4b69f984a97535179acd9637426a1331f84f6646@changeid> From: Dmitry Baryshkov In-Reply-To: <20220730144713.2.I4b69f984a97535179acd9637426a1331f84f6646@changeid> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On 30/07/2022 12:17, Akhil P Oommen wrote: > Add support to allow soc specific clk drivers to specify a custom reset > operation. A consumer-driver of the reset framework can call > "reset_control_reset()" api to trigger this. > > Signed-off-by: Akhil P Oommen > --- > > drivers/clk/qcom/reset.c | 6 ++++++ > drivers/clk/qcom/reset.h | 2 ++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c > index 819d194..4782bf1 100644 > --- a/drivers/clk/qcom/reset.c > +++ b/drivers/clk/qcom/reset.c > @@ -13,6 +13,12 @@ > > static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) > { > + struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev); > + const struct qcom_reset_map *map = &rst->reset_map[id]; > + > + if (map->op) > + return map->op(map); This looks like a hack. For example, assert() and deassert() would still follow the usual pattern of updating the bits. Please at least make them return -EOPNOTSUP if map->op is defined. A slightly better solution would be to make qcom_reset implementation optional (and depending on desc->num_resets being greater than 0). Then you can register your own reset controller implementation from the gpucc driver. > + > rcdev->ops->assert(rcdev, id); > udelay(1); > rcdev->ops->deassert(rcdev, id); > diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h > index 2a08b5e..295deeb 100644 > --- a/drivers/clk/qcom/reset.h > +++ b/drivers/clk/qcom/reset.h > @@ -11,6 +11,8 @@ > struct qcom_reset_map { > unsigned int reg; > u8 bit; > + int (*op)(const struct qcom_reset_map *map); > + void *priv; > }; > > struct regmap; -- With best wishes Dmitry