Received: by 2002:a05:7412:a9a3:b0:f9:93eb:408e with SMTP id o35csp48172rdh; Wed, 20 Dec 2023 22:27:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhQyIJdb4pFgqafovEAhQ7wnfCTC4S7FFaTcdBZ0ZhLdkk4vlye2NnB50iGgYmRBx5+QE0 X-Received: by 2002:a05:6a20:9383:b0:18c:b464:ec5b with SMTP id x3-20020a056a20938300b0018cb464ec5bmr993704pzh.61.1703140056890; Wed, 20 Dec 2023 22:27:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703140056; cv=none; d=google.com; s=arc-20160816; b=oI447kVJ4Sq/KzYlr90GirVkgW23dS503cXFTujtWUCjXaU/GY+9qcw7Y0C3WeA86u wrsqoptRauNfA6W65JMSu05+JEl2yojrhzjIQAvFJPB4G+SfzjWB6al9wLSBGz7cW17l q/fSxtuRKN1fv/x/hIervZm8M4F8/l5XlP7lDgVPaGND95JdwkGbJ2ZvItDjC8YkBFCv VaOfewWI1cDz+IYCY0QGlQxKolrCRLahEL7m1bRR2Sdu8MO74fx8wDm3BSGfn9R3cgn3 nNMRfRRv48u77IIR8byM8DKyS7ET48deYTU2tmfRf0nklCCWsnQVQPGyoImFuuSYebtT 3I2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=bUYlaraZvgnaRvFqkhplZceJUCJIoSDu2V8+PBmaGqw=; fh=DsXVqLCcXu/qXHnTjg2pPKLTD2WDt+XEzEw7e46pA/s=; b=bCUQAGA/ZHfRyqlyS8IgJrBUW6+4v7V2aq/Y5ccXpu4J6aZQG6+xYVL53O3KL8KjQA azXBd8LBeSk2Vhpi5P/fbenQXbIFedj+rL9yrcsACX4NVVOOXPxZSrPkrpJ+zNGcSv0I AwCI9xBfRvKfH+S249Hvpd3Nr6XDOJsq8yO/PyAbNx0Lnj9lFIyRKBlslaPs4eDaeO49 NDYlldYApwWHxe8oOEWPzlUOS60ztDLJiXSJwzCmPOizSWNLo40OkaXJPzKzPQUsI4jx 8Wsukque+uFMzR+R357GdR2XqFEZrjmzB7pFSCpw+bYZg4mDT3y1TO2/2QuARDW1gE7E UlxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EsSFWHsP; spf=pass (google.com: domain of linux-kernel+bounces-7890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i6-20020a17090aee8600b0028ba7dcc1d1si1107973pjz.67.2023.12.20.22.27.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 22:27:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EsSFWHsP; spf=pass (google.com: domain of linux-kernel+bounces-7890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8D6DB28683E for ; Thu, 21 Dec 2023 06:27:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BC48B674; Thu, 21 Dec 2023 06:27:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EsSFWHsP" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 5EAFBB64A; Thu, 21 Dec 2023 06:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2cc5ee69960so3710621fa.0; Wed, 20 Dec 2023 22:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703140045; x=1703744845; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bUYlaraZvgnaRvFqkhplZceJUCJIoSDu2V8+PBmaGqw=; b=EsSFWHsPnf+kXl/Hy67PcxREhy+BXSRmaiiyK5+3XezWyLjU9ElUkSdVBwONlbPrCz r5kwZnMMdp2aw6iS4HE3ojc8NK+j169S1hzj3PzXnGfAuN22BzRVjlu3dffyA0MwrQF7 YnHAmVnLANfOVe8cqRJBjTtevPTUzfJMyIOpZ/dapyq4dJQBWu5X/m1DO8c2cmn5jhoy 9qGZsC2sV9xBm0KReS+z6hLNPYse9IH3yUltG2CsItNgc6APJjT45SIaOkJTH9IqWAv/ 6v6nWBJlbOBUlYw00UwNlrsrddqzDbgjLuwGNMuV5L1vPenvHe1E6soXmcTg0puf7gSD f5iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703140045; x=1703744845; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bUYlaraZvgnaRvFqkhplZceJUCJIoSDu2V8+PBmaGqw=; b=WTHuZt1x5Fsab+tB20vS8LI06aM27tmpeG3Av4U4l6KDwvY4KRazuSJlZflgFieGr9 R+IzT/LS4QJp+eB6WL2Xp/3QNgT/GAo8y1OFpzPcgVDrNevAaR8QF1leaxE/yJF2CX5d T1AC7FuHE+7kdTYrXE0CasCE+5QEq9EfPw0Z/9mUY8nWp5JCRN0wphY/4qVkgJOw1wI1 RgTFmpUxwT+p77MiopHgqf/VodUbCfKD8hm1G+2k4kqzaE1poAkK4ZPsj4BxpTPuI7WY nX3pgBiXBFYiU94YlJEjTyMcwuu3JcKao+5Q52xc3oMMjAiUpOeTq4fr6pJ/Ff/RaB4e SeWA== X-Gm-Message-State: AOJu0YywH/X3nUe/7CnoWLFsl73VpRkjfybm7KpELlVNTI6VbgjRs3gu mA2bBmM2lD4ITrgk3gVFPQsX1YdhBjeJ6VaKzejkH3KZjQ5BNg== X-Received: by 2002:a2e:9106:0:b0:2cc:778a:f67e with SMTP id m6-20020a2e9106000000b002cc778af67emr1769164ljg.46.1703140045023; Wed, 20 Dec 2023 22:27:25 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231212065147.3475413-1-jim.t90615@gmail.com> <20231212065147.3475413-4-jim.t90615@gmail.com> In-Reply-To: From: Jim Liu Date: Thu, 21 Dec 2023 14:27:13 +0800 Message-ID: Subject: Re: [PATCH v9 3/3] gpio: nuvoton: Add Nuvoton NPCM sgpio driver To: Andy Shevchenko Cc: JJLIU0@nuvoton.com, KWLIU@nuvoton.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Content-Type: text/plain; charset="UTF-8" Hi Andy Thanks for your comments. I will modify it in the next version. But some description as below > > +static int npcm_sgpio_init_port(struct npcm_sgpio *gpio) > > +{ > > + u8 in_port, out_port, set_port, reg; > > + > > + in_port = GPIO_BANK(gpio->nin_sgpio); > > + if (GPIO_BIT(gpio->nin_sgpio) > 0) > > + in_port += 1; > > This is strange... So, you are telling that offsets start from 1 and not 0? > > > + out_port = GPIO_BANK(gpio->nout_sgpio); > > + if (GPIO_BIT(gpio->nout_sgpio) > 0) > > + out_port += 1; > > Ditto. > Yes, if the customer has defined the in/out pins the offsets start from 1. The NPCM_IOXCFG2_PORT register is the set number of in/out ports. NPCM_IOXCFG2_PORT register define as below: 0~3 bit is the number of input ports 4~7 bit is the number of output ports Each module can support 8 input ports and 8 output ports. > ... > > > + set_port = ((out_port & NPCM_IOXCFG2_PORT) << 4) | (in_port & NPCM_IOXCFG2_PORT); > > Outer parentheses are redundant. > > ... > Best regards, Jim