Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp9452rwb; Wed, 17 Aug 2022 21:29:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR4usC7Z8OiGyYKzS37DYnBo6VZLbxywzLE4ZeAWhFzi/dlhg7yE5qOz9YZgBVP92sKS8wkF X-Received: by 2002:a17:902:6b07:b0:172:a76d:7cc5 with SMTP id o7-20020a1709026b0700b00172a76d7cc5mr1061706plk.128.1660796951216; Wed, 17 Aug 2022 21:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660796951; cv=none; d=google.com; s=arc-20160816; b=YV12/OA01rSQ47NhufuhZ6fMTe+QT0sNgajZBi1QLxFqYWyfMR0B7oMyQucgS4I6ze QAQd24M9RLIBQALL/+q7YzcG0kTyaYdsNf90zchvC/TbXLaEb+UhUFvB27moCL1iVZQR 45CUFBDIOr08SfvOTPIII0ur3N3DIMVrNM9SP9Dzis+UnDwwRVG8rLRmvZrM2IFDo9Dl +Mika7VnsKfdYc0osI9oUPX7g4dQKxAzttJ9mri/VZxTSGAm20/MkqG5zNkdOUofawIu iRHtt8nHLVWNtsQrQGJZ6zb4h6ERxaLcmLRKlZ6PJIaLLm4qwSm8XbqQo/3sYL5iM3Vr CSrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OBJV2nhA1m9/wANwwnv2RKvRXTJWsxwd63aHFcrIoW8=; b=WSFzBuOCHLrnFlOcyfjQ96weBl7zeGSZ+SOuN11X5oHHl/FBUHBTZng3wudy44PLb8 zChqe26vSsv7Me2RkmX+vhWHeKeU+9M6+sHEoTvOfVvlFfmYnaCD1rFny/M8K3UiKC6X GMiHFYniQbd1R5vMZpPbdqy4z16uC0owIjajHcVub/6Xk10NCZiwsc7IfSqNkxs71s9L 4gVOJptZGytf0DEVZob/r/Uag4SKheGYD9ejj8k7O9sf8DrUW5/DwNW06YOUpGzKObfu glS1qK8wGqN88XTPvgQxRqJExgMkgfiMitd3Bu1WXwmqJEzM4D45ZKtM4hYJfBnGsRRV 9IEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=bMNqdhcz; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a170902db0400b00163f5028fe7si405686plx.365.2022.08.17.21.28.38; Wed, 17 Aug 2022 21:29:11 -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=@quicinc.com header.s=qcppdkim1 header.b=bMNqdhcz; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243212AbiHRERv (ORCPT + 99 others); Thu, 18 Aug 2022 00:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242756AbiHRERd (ORCPT ); Thu, 18 Aug 2022 00:17:33 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F220396FC5; Wed, 17 Aug 2022 21:17:29 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27HMKLuH002112; Thu, 18 Aug 2022 04:17:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=OBJV2nhA1m9/wANwwnv2RKvRXTJWsxwd63aHFcrIoW8=; b=bMNqdhczbtGGSDLhB9xX92lLRxerUDcX8wUkliJ9GgCwmE9kDdfjvA6Jb4dYHKxCw0hk BkuBqTS5MWe64Y3w0gIIIxX/G9PGWVjsQXx48xJuSNV/FW319xqfp2RXsSZD2W4OX+Bh 6BQ2Kz4rAPqAXvrgL05SXvMw2YcI3p338qBK0Yl37ctr0fK0CtXa7wTuK8NbP1LOEUkQ 42kpVM7J82d38BND3qbHMclWuo5X1s230hk9RqEw7rewx6TNnD7yo2FhKbpylNX4UCTm 2Q7aXe5OapwdWyFtTXDhIbwGuHO6HtOqT5PFh2FH8xSV9iMO48+v0uocr8Gxsd+FvWTj mQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3j181xhcq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 04:17:22 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 27I4HJvb018166 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 04:17:21 GMT Received: from hyd-lnxbld559.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 17 Aug 2022 07:58:26 -0700 From: Akhil P Oommen To: freedreno , , , Rob Clark , Bjorn Andersson , "Stephen Boyd" , Dmitry Baryshkov CC: Douglas Anderson , , Akhil P Oommen , Andy Gross , Konrad Dybcio , Michael Turquette , Stephen Boyd , , Subject: [PATCH v2 2/5] clk: qcom: Allow custom reset ops Date: Wed, 17 Aug 2022 20:27:51 +0530 Message-ID: <20220817202609.v2.2.I75baff799a363bbb960376539e3a0f737377c3f1@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1660748274-39239-1-git-send-email-quic_akhilpo@quicinc.com> References: <1660748274-39239-1-git-send-email-quic_akhilpo@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: jnLXMnw74qtZ4uh9EG--B08m1J7W-B9Q X-Proofpoint-ORIG-GUID: jnLXMnw74qtZ4uh9EG--B08m1J7W-B9Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_02,2022-08-16_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208180014 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Allow soc specific clk drivers to specify a custom reset operation. We will use this in an upcoming patch to allow gpucc driver to specify a differet reset operation for cx_gdsc. Signed-off-by: Akhil P Oommen --- Changes in v2: - Return error when a particular custom reset op is not implemented. (Dmitry) drivers/clk/qcom/reset.c | 27 +++++++++++++++++++++++++++ drivers/clk/qcom/reset.h | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index 819d194..b7ae4a3 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -13,6 +13,21 @@ static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) { + struct qcom_reset_controller *rst; + const struct qcom_reset_map *map; + + rst = to_qcom_reset_controller(rcdev); + map = &rst->reset_map[id]; + + if (map->ops && map->ops->reset) + return map->ops->reset(map->priv); + /* + * If custom ops is implemented but just not this callback, return + * error + */ + else if (map->ops) + return -EOPNOTSUPP; + rcdev->ops->assert(rcdev, id); udelay(1); rcdev->ops->deassert(rcdev, id); @@ -28,6 +43,12 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) rst = to_qcom_reset_controller(rcdev); map = &rst->reset_map[id]; + + if (map->ops && map->ops->assert) + return map->ops->assert(map->priv); + else if (map->ops) + return -EOPNOTSUPP; + mask = BIT(map->bit); return regmap_update_bits(rst->regmap, map->reg, mask, mask); @@ -42,6 +63,12 @@ qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) rst = to_qcom_reset_controller(rcdev); map = &rst->reset_map[id]; + + if (map->ops && map->ops->deassert) + return map->ops->deassert(map->priv); + else if (map->ops) + return -EOPNOTSUPP; + mask = BIT(map->bit); return regmap_update_bits(rst->regmap, map->reg, mask, 0); diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h index 2a08b5e..d4213b4 100644 --- a/drivers/clk/qcom/reset.h +++ b/drivers/clk/qcom/reset.h @@ -8,9 +8,17 @@ #include +struct qcom_reset_ops { + int (*reset)(void *priv); + int (*assert)(void *priv); + int (*deassert)(void *priv); +}; + struct qcom_reset_map { unsigned int reg; u8 bit; + struct qcom_reset_ops *ops; + void *priv; }; struct regmap; -- 2.7.4