Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1457919pxb; Sun, 22 Aug 2021 18:06:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3lg8soSVz30MNHoKk7l0q1112GoxuUcIr1AXv8zXYm6c0T2osYnPZoDYPJG5tR9yTU8gs X-Received: by 2002:a92:444e:: with SMTP id a14mr13801328ilm.152.1629680784796; Sun, 22 Aug 2021 18:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629680784; cv=none; d=google.com; s=arc-20160816; b=m4ppO3DiIo85wK6sHuJ6DxeRh/gxsoc38naROH15fa3rFv+RhE8PgXBUXPbN6YIUrt b0tmiqTSqstINae35oNSi7kRff80GvoFhVzFbqyMH/lexAk6ZY0W/wsj0J1XSePjweSh 24s+uFN4RCPTy8s1NE/Ug2TjxjBVgmVworgLuBWMDsrEAvnOtNHvh/9/7qvDQQg6aaMX 8trwztPAcSsRvcqUzuO4oEzIzwfnVgX3++KHJkgGSk8G5R2tiju+uDJIPauEE1qsMt0n G5oO0SoPeRr2LZ6D+FCfDa/CqSNJuLUVHxby2V2i0vQXuxkLit0RWIhsbtegxzUDZA9N BIOA== 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=9I+jvIuGkrYC7w12Jy77CUvwauedMrIdRwXtD/swi0U=; b=qRkn9sHvCagGnN1/3RjD1x1F3OJmmDRCQY8fGTzF/f6f34L7rIBz7Nq06XvKcLdtKp F0BmyCVLt4DIDQ8tPm7nHImNwKJ6GGZe3eTlyciF6rNxUiCxiWrntM+TLPhnZfm30G31 /JcqtmF58u2LkC6Rn1t1v9azWG4MCj+HNLScor8OMgrVvwPikpekz6OlHizzBIJB7zcF UGJGdyEB5uTDg/m0OE2J8LCvETMi0hLgSJ9Yk1vhyBL7Gai2kyRl+TlNPkmYkeOE2u1o P+i0h+l0/DOj5frhfn0H6X3Icj9OWPeOyQzg2lQXOUedcnzxySgOPPeOeToIuaaWahql gD2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=PJ2lRFHH; 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 q74si7203644iod.9.2021.08.22.18.06.12; Sun, 22 Aug 2021 18:06:24 -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=PJ2lRFHH; 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 S232908AbhHWBF7 (ORCPT + 99 others); Sun, 22 Aug 2021 21:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232261AbhHWBF6 (ORCPT ); Sun, 22 Aug 2021 21:05:58 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D753C061757 for ; Sun, 22 Aug 2021 18:05:17 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id r19so23589052eds.13 for ; Sun, 22 Aug 2021 18:05:17 -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=9I+jvIuGkrYC7w12Jy77CUvwauedMrIdRwXtD/swi0U=; b=PJ2lRFHHDJGTdGZgqkx8nm0C86/LsPvaA1plQiLWFsazUABz8Yc1GKrNB1BQebP/Rm PZOTpqcjJA3c63TrlvEaSd9Nl4IAAmXXx22NUFr+a1YUH4v/xU8kJS3YhojZFgciqq6c 3pF3A5e3/flNGz5+xe0wFzOD8qTt9bGjHTA5wa1Fvx0NjEcMhjV1lOqg+y5AZpMs8uRO UL8MO/ANO9YNVs/zhJP5dQVnCSFKf/lKw7h+zDwmT/AUdweiArEVhlAbseZHAVwKbAqR Gxm//N0qMKiEZdmqBeDtkOLbvh1vfHMW8t3PCN9jiSrZYrm7JleLO/JDGMNpXYlaCBj2 WZ7w== 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=9I+jvIuGkrYC7w12Jy77CUvwauedMrIdRwXtD/swi0U=; b=mxZh+4BSbshu5DUIG2SQ2pht4xZvlRKLXSKOAsDAnu48w0oL2q/gnDapSbdsnKIkYN Pfw7bXuJ8L7vzNFNY/uapO46NTQNObiPLkxEVZEIvplYxXLQvIS8GqqEV7ywoLG4oW/V 8ziIk4ztmqekR4zaPm+hEJJ/4U2LQ47mQdS8pNQtAPniz6JeYZoz/q20YBGkMfcqEvYO QTZLf5WrZf4a/VzSbnpExZ59GcSu2KPfJngSzspD1r51Fr5toOdRkvoMjK2Wj1+gJcwn QdpLqdRyKuDimyQghZLCeSETYA7N7RDlDIFzkE9LnfFDfTxJRIlI5zVL8PwrhN5L0x7+ Ieag== X-Gm-Message-State: AOAM530rLsWU4L2s6nGll7kRsU+mJVk6z+1OPtnSCzMt772b5clqEw4D o2AXXhNw3XFzRbWdxc3aOqEy7MWm32HfPCXAH2gAVQ== X-Received: by 2002:aa7:c894:: with SMTP id p20mr34410895eds.42.1629680715488; Sun, 22 Aug 2021 18:05:15 -0700 (PDT) MIME-Version: 1.0 References: <20210304034141.7062-1-brad@pensando.io> <20210304034141.7062-2-brad@pensando.io> In-Reply-To: From: Brad Larson Date: Sun, 22 Aug 2021 18:05:04 -0700 Message-ID: Subject: Re: [PATCH 1/8] gpio: Add Elba SoC gpio driver for spi cs control To: Linus Walleij Cc: Linux ARM , Arnd Bergmann , Bartosz Golaszewski , Mark Brown , Serge Semin , 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 12:29 AM Linus Walleij wrote: > On Thu, Mar 4, 2021 at 4:42 AM Brad Larson wrote: > > > This GPIO driver is for the Pensando Elba SoC which > > provides control of four chip selects on two SPI busses. [...] > > +#include > > Use this in new drivers: > #include The updated patchset will use linux/gpio/driver.h > > + * 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!) > > > +struct elba_spics_priv { > > + void __iomem *base; > > + spinlock_t lock; > > + struct gpio_chip chip; > > +}; > > + > > +static int elba_spics_get_value(struct gpio_chip *chip, unsigned int pin) > > +{ > > + return -ENXIO; > > +} > > Write a comment that the chip only supports output mode, > because it repurposes SPI CS pins as generic GPIO out, > maybe at the top of the file? The top of the file will look like this in the updated patchset. * Pensando Elba ASIC SPI chip select driver. The SoC supports output * direction only as it uses a generic GPIO pin for SPI CS. > I suppose these systems also actually (ab)use the SPI cs > for things that are not really SPI CS? Because otherwise > this could just be part of the SPI driver (native chip select). The SPI cs are not used for any other purpose, we needed four chip selects and native DW supports two. > > +static const struct of_device_id ebla_spics_of_match[] = { > > + { .compatible = "pensando,elba-spics" }, > > Have you documented this? Yes as part of patchset v2: [PATCH v2 11/13] dt-bindings: gpio: Add Pensando Elba SoC support which documents "pensando,elba-spics" in new file bindings/gpio/pensando,elba-spics.yaml. Regards, Brad