Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1459551pxb; Sun, 22 Aug 2021 18:09:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWqa7Jt7CJoiOfFtTU6D4em2nRaQrqhaMDVwBrVpqKd+9JZPrMjRszxZkLOUb7uup4lctq X-Received: by 2002:a17:906:bfcc:: with SMTP id us12mr2561022ejb.428.1629680995959; Sun, 22 Aug 2021 18:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629680995; cv=none; d=google.com; s=arc-20160816; b=JRrg6P1gCHYW9CGiMbbz2WSGltWHbhaCESzF7ooN+3z2pezhm/VHRTMjjSwrCcEuw/ aKiRqA1Do3S7Pw4FgxUG1tI29ljLa12OAe7UVimQ7MQW3b1OZobK4DY7b9isM3u+VmH2 zO4QGzH9iR2eDjfhRyYzpOB16gkTXg6SUuKTf+sk1iKqejZvkYydNniLfVGjkPyRn0dH W4o3PA+Xw9pusv5ayMNp607byIaxd7JWX74wjB+S2Eu9QDCHMsw/9XOIb2lTA5gCd4BU ybGsCBMuhQkkpK1WxxmF31MW0VFtBc2cIobaXasGOEmRLhb6rrotgK6UMvEMU4zE85S9 m+nw== 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=DiGtvvH8NkIVd4hqCUiszMleyUhfYfWw1b6ZDZbLUkE=; b=f6JCr9nhSn4xutXAGbfaTuJTnkNCB7ZuiUEgLBF/Hn9eU8kFegdoBvp6iUDTJxRhMv +tOB+ahVvV3GMy2D7rlOeciFVUbb7oqaSwm/oTOUDN0DfadiliwSbYHNmjbOAvNIzSpX ofr1yC4vGIHjWpZrW44BmL7xcL9/NcEi5FzMfv8xSV6rw8hvURjuIHFs6vHmU0mTjS4K 0h8961Dl5pfsr5qTrzX/jRlYrJes+yptUCZ11OIAcgpPSgqP8pZ8zK/eaRxlGDgCbcWX MZn9UZZ9eNrmaHn6SdELAK7PPJ4bMNL1VGnqtKsPNp/EqchKJM/NK9BiRhrYyrs+m/f5 U72g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=uhWvv9wn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si13336507ejw.357.2021.08.22.18.09.33; Sun, 22 Aug 2021 18:09:55 -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=fail header.i=@pensando.io header.s=google header.b=uhWvv9wn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232005AbhHWBGr (ORCPT + 99 others); Sun, 22 Aug 2021 21:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233963AbhHWBGq (ORCPT ); Sun, 22 Aug 2021 21:06:46 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1366FC061760 for ; Sun, 22 Aug 2021 18:06:05 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id me10so5051451ejb.11 for ; Sun, 22 Aug 2021 18:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DiGtvvH8NkIVd4hqCUiszMleyUhfYfWw1b6ZDZbLUkE=; b=uhWvv9wnJvdEuINozK+RdVuTibj+UvYVWqnvk3DidpO+D6vtOAXbizZtIoU+1RzTmr neD6qgJ86ggq3V1tinDW/48juLqA91oBDkn/NB65JOJLHe8ghFOwkQ1zgaxlQMH9WODi rt9SNazJrbwjf3VFwt6U5hKEGhpmSs7w4dXX8sSJt472vdiwC3vAF5s/p3iinYjxtwBl a9cj3j653TZKo2jXSHjebMJ7KoKkwr3MDOz9cwalouCmaCPDQmETbtb4GGf4v7OOCExP B2zmwqQPZYp77TN2JzvGf7JzCIuJYxdNvTcTfjBdZOlLi5LS1YiO9oc0f/v1VUpM86FM Bj+w== 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=DiGtvvH8NkIVd4hqCUiszMleyUhfYfWw1b6ZDZbLUkE=; b=JbIPfZzGjXw/3fAupnWq+lKQqg4P3180JKW7q1rt4+CP8RuC3evwZndHYFQAaM4+PO 3d1l/zIKSGBVuas8ay54MMpBNzeen1JydXu79Y44Fyazve4PC6Yu+We5P024dvkkvMpq w3UAJkpyUwTPpx+unHm+Y4aJE0ofnBWeWZT43hkE/vu1GzzzVej5ppvtfWN7rDdmeIz2 YRscHcu+lG18fYWhb1wdRLcv8lurxpyzg229dd0LIHzMOEyVMwAW1/Y2/sCyNBtv7lKB 5m3h9QzU2jSW4zYLm7+YkSrN6Rz5iLaM1KTqRWF4KgJdDoC2xNUtMS8Dj+XS4eJ18WzV Eyiw== X-Gm-Message-State: AOAM530Jm2qBdQzKyv3QAdtGewyTxFUXQqBw681OGXjoR2lKeyqSIpKn PUmPOHBv1po+gph81OxEMiUpXjrFv8OTw7oagAFc8A== X-Received: by 2002:a17:906:2f15:: with SMTP id v21mr21088372eji.444.1629680763004; Sun, 22 Aug 2021 18:06:03 -0700 (PDT) MIME-Version: 1.0 References: <20210304034141.7062-1-brad@pensando.io> <20210304034141.7062-2-brad@pensando.io> <20210304091025.ny52qjm7wbfvmjgl@mobilestation> In-Reply-To: From: Brad Larson Date: Sun, 22 Aug 2021 18:05:52 -0700 Message-ID: Subject: Re: [PATCH 1/8] gpio: Add Elba SoC gpio driver for spi cs control To: Linus Walleij Cc: Serge Semin , Linux ARM , Arnd Bergmann , Bartosz Golaszewski , Mark Brown , Adrian Hunter , Ulf Hansson , Olof Johansson , "open list:GPIO SUBSYSTEM" , linux-spi , linux-mmc , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On Thu, Mar 4, 2021 at 5:38 AM Linus Walleij wrote: > > On Thu, Mar 4, 2021 at 10:10 AM Serge Semin wrote: > > On Thu, Mar 04, 2021 at 09:29:33AM +0100, Linus Walleij wrote: > > > > > + * pin: 3 2 | 1 0 > > > > + * bit: 7------6------5------4----|---3------2------1------0 > > > > + * cs1 cs1_ovr cs0 cs0_ovr | cs1 cs1_ovr cs0 cs0_ovr > > > > + * ssi1 | ssi0 > > > > + */ > > > > +#define SPICS_PIN_SHIFT(pin) (2 * (pin)) > > > > +#define SPICS_MASK(pin) (0x3 << SPICS_PIN_SHIFT(pin)) > > > > +#define SPICS_SET(pin, val) ((((val) << 1) | 0x1) << SPICS_PIN_SHIFT(pin)) > > > > > > > > So 2 bits per GPIO line in one register? (Nice doc!) > > > > I suppose the first bit is the CS-pin-override flag. So when it's set > > the output is directly driven by the second bit, otherwise the > > corresponding DW APB SPI controller drives it. That's how the > > multiplexing is implemented here. > > If these output lines are so tightly coupled to the SPI block > and will not be used for any other GPO (general purpose output) > I think it makes more sense to bundle the handling into the > DW SPI driver, and activate it based on the Elba compatible > string (if of_is_compatible(...)). > > I am a bit cautious because it has happened in the past that > people repurpose CS lines who were originally for SPI CS > to all kind of other purposes, such as a power-on LED and > in that case it needs to be a separate GPIO driver. So the > author needs to have a good idea about what is a realistic > use case here. The gpio pins being used for the Elba SoC SPI CS are dedicated to this function. Are you recommending that the code in drivers/gpio/gpio-elba-spics.c be integrated into drivers/spi/spi-dw-mmio.c? Regards, Brad