Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1216447pxv; Fri, 23 Jul 2021 02:58:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrI0aUpO5rIJioW43rK1II5vHvr/gT+Lr9RT8leTjt5Gj7PUR8MxkdixCtHxCtAtRXRwuD X-Received: by 2002:a05:6e02:1d15:: with SMTP id i21mr2979470ila.307.1627034314046; Fri, 23 Jul 2021 02:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627034314; cv=none; d=google.com; s=arc-20160816; b=tO8UKkQoyYnmHsBMzDyGF5SQpWJl28Fda3xlH1LHn5MYBkjx878MlhDcveFQN8Uyy+ udAq98QW43CyraIwPOTF4cXAVde8G2nH+ftdrl+qKvVgcnqMeHiTN3u/Ie+gVK2iltdc fNycQL0spXm/tKuaK923pQHyX1k5ka1vX8HN6O0sLy+1xobvE5rbEk5qP1pTIxfVujns M9hehfZdTzqKu1wbXGcP8Hd1ErglGBeIMgyufNhxnArNT/2A82aj77UJ+iCMKGtq6X+t H9i/+EdS+0cLqqD88m2lqfv9VnyQ8nomUiub6GtpcfFa/K5z8rBJSUU3UFj5pUPWGYFS nv4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1bbyf9wEbZ38VDjiofzmlZm9MieG09qKdTHuQhixjL4=; b=J2bJI9nkBxJbqEjxvKXNUJfaVUNOyn9Cr6BPZDW7eNQHWLpyj32eEwx0OawnVXD1tv cXAKeh6yE8IAXP7+nlBDqL5340AAIu5FlPchPLmkWk3aApxuQas03Z1xh3zAuDO9dX4A T/fqW1vmYsD6xvlKJOySPp8YcYBuwpVrV5xuHrXNJjJINDS2IZznQkZhXwzE20qZgCw7 ymTwtl5EQC9T12AzYaGW9v5BItCgeSinnW7Dxy1rZRoX2e3KCvrbEv8etnMwhpE/F4ns WUDKNF+PDfT6SZ5yVJSddbqpIb2KbRqBB0aT/2y60DaXFVMnTNdLCaAURdg4gZKkVDcv hZrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vd49lfeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si22321014jat.45.2021.07.23.02.58.23; Fri, 23 Jul 2021 02:58:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vd49lfeY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231195AbhGWJRE (ORCPT + 99 others); Fri, 23 Jul 2021 05:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbhGWJRE (ORCPT ); Fri, 23 Jul 2021 05:17:04 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC7CC06175F for ; Fri, 23 Jul 2021 02:57:36 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id f18so1115726lfu.10 for ; Fri, 23 Jul 2021 02:57:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1bbyf9wEbZ38VDjiofzmlZm9MieG09qKdTHuQhixjL4=; b=Vd49lfeYHO7m8XFZBEcLvBP7vdwYvtGHQ0mTtY12Lafze1aKNSrYjq+4UxV9IEgKTg 6dvGLMIsFwKXRJN8nUJgbqPzBC2rGlUxx/ta66Tes7KL1y23WsmQpST7Thz+FcRMtOgl wpkcWb614X7JXBglHNWwQwuSZMYIxBP4rJT9cU283px3ORyh9oLT+eHGeIvEO9IblTiM Nt4EGcEtV+J0e8jAr6WYnyGHMtFZ9aShHurpKEDB3/YmRtxQssxRDiityIR37tYDQsoP vnYrEfUvEkfWpKOsBXyVgEYm6qKv+vXmYbjIBYU2ZBpTB9IEfEheF6Ic9QCifSKH/dZL kKQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1bbyf9wEbZ38VDjiofzmlZm9MieG09qKdTHuQhixjL4=; b=EZKHjtY0BQDQCGlNCjuSz+5bzQ1xiFhYcHX0Ylx9hYa2eUjb0aZbpZKJbS6Q5Hndd7 daK+gJSuqGnS4vpMuvLqHl14OyAIh1rIdQswp7wL5JKS/PD+50FEJouLf3ST4Dqfr+FO phLXZi8CliKxWdlN8Dz/HXzT2nLSKVZF/rPVdUe7zOf5oCHI+/OrxulvdxQMQwxEHGeM jF5wGOF5D0P2mdXLVizJ9sjOJkhX0gSfY5xgCj1+v6/fA6/xZh9nNHz5oRlHhjjFJYOC PmuJO3Xu2mAAYozxgD4TU7HOGmIGie4OZx7XPRO8QcvwxYHSfW7BEyVvUUTdbzscpGs3 oZ/A== X-Gm-Message-State: AOAM532c0ZfuomPJi/KAYWDW5PaX6SGnxa7pAbeWVypvhWYzlWrJ2FfI b8+2Kg6ZJvU+4h68nDo+BYd9wTHT7yk57JykkGxBbQ== X-Received: by 2002:a05:6512:3f1f:: with SMTP id y31mr2585008lfa.29.1627034255015; Fri, 23 Jul 2021 02:57:35 -0700 (PDT) MIME-Version: 1.0 References: <20210712100317.23298-1-steven_lee@aspeedtech.com> <20210712100317.23298-6-steven_lee@aspeedtech.com> In-Reply-To: <20210712100317.23298-6-steven_lee@aspeedtech.com> From: Linus Walleij Date: Fri, 23 Jul 2021 11:57:24 +0200 Message-ID: Subject: Re: [PATCH v6 5/9] gpio: gpio-aspeed-sgpio: Add AST2600 sgpio support To: Steven Lee Cc: Bartosz Golaszewski , Rob Herring , Joel Stanley , Andrew Jeffery , "open list:GPIO SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , open list , Hongwei Zhang , Ryan Chen , Billy Tsai Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 12, 2021 at 12:04 PM Steven Lee wrote: > The maximum number of gpio pins of SoC is hardcoded as 80 and the gpio pin > count mask for GPIO Configuration register is hardcode as GENMASK(9,6). > However, AST2600 has 2 sgpio master interfaces, one of them supports up > to 128 gpio pins and pin count mask of GPIO Configuration Register is 5 > bits. > > The patch adds ast2600 compatibles, removes MAX_NR_HW_SGPIO and > corresponding design to make the gpio input/output pin base are determined > by ngpios. > The patch also removed hardcoded pin mask and adds ast2400, ast2500, > ast2600 platform data that include gpio pin count mask for GPIO > Configuration Register. > > The original pin order is as follows: > (suppose MAX_NR_HW_SGPIO is 80 and ngpios is 10 as well) > Input: > 0 1 2 3 ... 9 > Output: > 80 81 82 ... 89 > > The new pin order is as follows: > Input: > 0 2 4 6 ... 18 > Output: > 1 3 5 7 ... 19 > > SGPIO pin id and input/output pin mapping is as follows: > SGPIO0(0,1), SGPIO1(2,3), ..., SGPIO79(158,159) > > For example: > Access SGPIO5(10,11) > Get SGPIO pin 5 (suppose sgpio chip id is 2) > gpioget 2 10 > > Set SGPIO pin 5 (suppose sgpio chip id is 2) > gpioset 2 11=1 > gpioset 2 11=0 > > Signed-off-by: Steven Lee Nice use of match data. This is exactly how it shall be done. Reviewed-by: Linus Walleij Yours, Linus Walleij