Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp969259rdh; Fri, 27 Oct 2023 00:17:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPBKuveqeQ0KGDZW1SQ4FOnMovtURw8mMj8GRKJR4McrAkGQLVyiFFH3EHe353vGK2wijG X-Received: by 2002:a25:c091:0:b0:d9a:4c1f:b580 with SMTP id c139-20020a25c091000000b00d9a4c1fb580mr1573775ybf.58.1698391055464; Fri, 27 Oct 2023 00:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698391055; cv=none; d=google.com; s=arc-20160816; b=fdrSixzsiHu52+EZbmNmh6pFNAcIt46QdPDtVogWUjKBZzNVmM+52ghotht7s2//EU xU2BGiYWsD7jwbseir3+wCDzro26g195p3mrjBPWSezFIkPJLC6Y58lRbDfuyl1/+kfU zjG+rddTVe83kHAkJ6XbTYraNz5Sy1fWQZuNW0c96g6/LIB7IooWzpA5uC4VvrgD2xl5 8dnj2Rugc1oV38pCUbSYWUFFcyL8FOxSDmnDGcqPqizx/X4rNcNbmYjrMDn9mvgISPlF CIiUBrOnpGGzKUgxp7TP7T/BQHvekXbzri0d+C333UUGmPO6X1CuFzBIarozG3s8x1Wz FvWA== 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; bh=wrG9l8E4Y8mPMys8dyD0xYCn8mGkly5hLazPEmHNg68=; fh=8fAFyFmOyqu536u901Eez8r3VqG3E27QOxhWT2Nd7u0=; b=LYz1hHdNDXpIc5/0mAcjDLM+DCeq3wS7cDwERUgL9XTO0U2+AhaHiDZSaEhVDDIegk SFikXOiQ8fmteyI/aJgxqSQc0ESnHRheFH6cv9nDBgBwc5LS53mSHPL73wYAnCM5uuOT iKNqoYRdBm2ar7SqlwLh1nVEXeHtOIXKimgr1PUOFkQ1QAUg1LLoVWrxMmIU/K8qYba8 Dt1DH9NOeVVD0ZpKYjImmTOzoe2bnOVvRDKph83H+NX6R9vlI60djUx0A2hruN3NLVZv vp+apRhmGDXxXbzr1NVNAwcjg3rpjTzk3yhjZlH22l0RayCBgf7jQsmc26Ryh/Q1aXrC vo0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n184-20020a25dac1000000b00d9adecded1bsi2006885ybf.627.2023.10.27.00.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 00:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DE605828B8EA; Fri, 27 Oct 2023 00:16:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231233AbjJ0HQi (ORCPT + 99 others); Fri, 27 Oct 2023 03:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbjJ0HQ1 (ORCPT ); Fri, 27 Oct 2023 03:16:27 -0400 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD626D62 for ; Fri, 27 Oct 2023 00:16:17 -0700 (PDT) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 39R7EooH002942; Fri, 27 Oct 2023 15:14:50 +0800 (+08) (envelope-from linhua.xu@unisoc.com) Received: from SHDLP.spreadtrum.com (shmbx04.spreadtrum.com [10.0.1.214]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4SGv241rf0z2L6nms; Fri, 27 Oct 2023 15:10:20 +0800 (CST) Received: from xm9614pcu.spreadtrum.com (10.13.2.29) by shmbx04.spreadtrum.com (10.0.1.214) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 27 Oct 2023 15:14:49 +0800 From: Linhua Xu To: Linus Walleij CC: Orson Zhai , Baolin Wang , Chunyan Zhang , , , Andy Shevchenko , lh xu , Linhua Xu , Zhirong Qiu , Xiongpeng Wu Subject: [PATCH V3 4/6] pinctrl: sprd: Increase the range of register values Date: Fri, 27 Oct 2023 15:14:24 +0800 Message-ID: <20231027071426.17724-5-Linhua.xu@unisoc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231027071426.17724-1-Linhua.xu@unisoc.com> References: <20231027071426.17724-1-Linhua.xu@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.13.2.29] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To shmbx04.spreadtrum.com (10.0.1.214) X-MAIL: SHSQR01.spreadtrum.com 39R7EooH002942 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 27 Oct 2023 00:16:51 -0700 (PDT) From: Linhua Xu As the UNISOC pin controller version iterates, more registers are required to meet new functional requirements. Thus modify them. Signed-off-by: Linhua Xu --- drivers/pinctrl/sprd/pinctrl-sprd.h | 44 +++++++++++++++++------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.h b/drivers/pinctrl/sprd/pinctrl-sprd.h index 23bced4665f1..a6ba75313da0 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.h +++ b/drivers/pinctrl/sprd/pinctrl-sprd.h @@ -7,30 +7,38 @@ #ifndef __PINCTRL_SPRD_H__ #define __PINCTRL_SPRD_H__ +#include + struct platform_device; -#define NUM_OFFSET (20) -#define TYPE_OFFSET (16) -#define BIT_OFFSET (8) -#define WIDTH_OFFSET (4) +#define NUM_OFFSET 22 +#define TYPE_OFFSET 18 +#define BIT_OFFSET 10 +#define WIDTH_OFFSET 6 + +#define NUM_MASK GENMASK(10, 0) +#define TYPE_MASK GENMASK(3, 0) +#define BIT_MASK GENMASK(7, 0) +#define WIDTH_MASK GENMASK(3, 0) +#define REG_MASK GENMASK(5, 0) -#define SPRD_PIN_INFO(num, type, offset, width, reg) \ - (((num) & 0xFFF) << NUM_OFFSET | \ - ((type) & 0xF) << TYPE_OFFSET | \ - ((offset) & 0xFF) << BIT_OFFSET | \ - ((width) & 0xF) << WIDTH_OFFSET | \ - ((reg) & 0xF)) +#define SPRD_PIN_INFO(num, type, offset, width, reg) \ + (((num) & NUM_MASK) << NUM_OFFSET | \ + ((type) & TYPE_MASK) << TYPE_OFFSET | \ + ((offset) & BIT_MASK) << BIT_OFFSET | \ + ((width) & WIDTH_MASK) << WIDTH_OFFSET | \ + ((reg) & REG_MASK)) #define SPRD_PINCTRL_PIN(pin) SPRD_PINCTRL_PIN_DATA(pin, #pin) -#define SPRD_PINCTRL_PIN_DATA(a, b) \ - { \ - .name = b, \ - .num = (((a) >> NUM_OFFSET) & 0xfff), \ - .type = (((a) >> TYPE_OFFSET) & 0xf), \ - .bit_offset = (((a) >> BIT_OFFSET) & 0xff), \ - .bit_width = ((a) >> WIDTH_OFFSET & 0xf), \ - .reg = ((a) & 0xf) \ +#define SPRD_PINCTRL_PIN_DATA(a, b) \ + { \ + .name = b, \ + .num = (((a) >> NUM_OFFSET) & NUM_MASK), \ + .type = (((a) >> TYPE_OFFSET) & TYPE_MASK), \ + .bit_offset = (((a) & BIT_OFFSET) & BIT_MASK), \ + .bit_width = (((a) & WIDTH_OFFSET) & WIDTH_MASK), \ + .reg = ((a) & REG_MASK) \ } enum pin_type { -- 2.17.1