Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4041094pxf; Mon, 29 Mar 2021 19:47:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfcM5BePxaRL6CxCftWcoZPN26TgnOUc094ZdYKgtQSMpCxx9a0WV8Od+PKASJvaiMVSqU X-Received: by 2002:aa7:cb0a:: with SMTP id s10mr31051800edt.36.1617072419860; Mon, 29 Mar 2021 19:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617072419; cv=none; d=google.com; s=arc-20160816; b=y/NF25mRbxA4v5BOvR+6gpY6ZJ4RHJ9ycq820yHg4nhkwRjc1jgJA6PbpyXxHADrOy GT4HTphmwHN2reNJx9PvSzaBGdQT2SGqAm1kQSquMsaaafUyAv8v6Q/5U7v+Qz+h2ifz Ig8cKIk4xwp/ZsJuTaL4UThYbMe2R+t59cGPAFc9GSdklDmAd3v+q01pILu1l+zuanD6 Yy62ulXQC4JrHSF7uVLKWwDd5QlC80odaFwZ3FaEAQCDLrhYj8AsoTyorZYpw9v//P7V LFBzmNdajhk/ublocynsU4OEG3fvEKiZBCxQh3kf9/LGXDD6Z+imaTlFtgCnDvUdBS9A 5UYg== 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=32flZyp3WozO8lIXzXD7USfpYU9mLvWV/46KDv96M4c=; b=hRB/x8D1uRHHSLVMoyUmCY0llf6Gg0illKNI7d3VXRaA4tPTy70d5yKbQz/eKw36WG N3sYLj3im/VEKYebV2ilRIa6Qv7VuUP89sNJsVPEG9CG24b5waRnd3Og5dg6Ydna/skq 2VWDrCaJvMKTbZKCe8pUs81lEsBX+ZlgEdTcvsP9cJfk4F6cnofBbKWkYlKNoByJZ9C2 qnR+eIAui4qNw7Yb4arcuK1tfILm6yIJo2SVlXmcvkmu8I0tnTpPmCQujvZA/4HuUWz0 G9E0KBnhQdxMAPHoez4sHzWJd23JQY2fdjdeqtfFhhPe4qsCwyn/25HXcULjho6L7hdK jpaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=36V+7DKZ; 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 l15si13586463edb.89.2021.03.29.19.46.37; Mon, 29 Mar 2021 19:46:59 -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=36V+7DKZ; 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 S229763AbhC3CpD (ORCPT + 99 others); Mon, 29 Mar 2021 22:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbhC3CpA (ORCPT ); Mon, 29 Mar 2021 22:45:00 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31C64C061764 for ; Mon, 29 Mar 2021 19:45:00 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id u21so22424115ejo.13 for ; Mon, 29 Mar 2021 19:45:00 -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=32flZyp3WozO8lIXzXD7USfpYU9mLvWV/46KDv96M4c=; b=36V+7DKZW42b+x00xPJJkQ8AdCNvVhNdB2easokmT3xnPDOzIFk5JQfPcoYrQS0FV7 y/lY+UMQMHN7AHc6oKpD3jP2jNpFBziZjFVGC/U/ZxWB8Nw3JT2/l2kO5KErGODjmf4D KdNgdRiPBNzzpsoE+P6Y68vkcoaGtCL5Tadh1FV4ach/gvSIbVFBFxL7f4SisSq2dfbf kEq6hPyyYmsKQfurZV3/Q3EbHNdvjkZHHPE1L42miViRjss8i0BAyk4AMnWo2tJNX/U2 yIGysaj0uxLor2j3g06meF5dZf40fCbiysm/DCE6JjWtdJt7jAhyqrAPN7DKnebIeFoG ip9Q== 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=32flZyp3WozO8lIXzXD7USfpYU9mLvWV/46KDv96M4c=; b=MwEatNRE9nEh457RBSB87aYPoneFydGk9bqbUbj8pNxS9XsGXvqnQpSTvYC11kIM8K M16yALtJNqqZAZautygFJqvNj4TM/5f+nprPdshcqAhxjgTr8Ku6ua3OvVs0u6pBNUw2 eW/juFBLvByJ7VAI52AAH4llZkKX6/8P5kinxUKrQHxRiyOo8zpsnQN3eJPZWKnYvxFR UtxTk+zjr7+gyYdOAuI82ivMeY2kr+ZJjL7fZbBH7/LYFvycWabRRYwynjQOozCmsctp cWNP//mFQdrsxH7lbSYSZ/NNyrs2ZM9QXSkLTCkEInAfrJGjvIJVRQhJCsTYm5goo/0J Iy0Q== X-Gm-Message-State: AOAM531TmprYsfzFmNt7bTZ8da34LpqpvdA8KbgdHoQJqp8giIZvI+GK vNXK/WT+m0FJ8Kx8ybTj+bI9AYYAVBy4clyb6+71XQ== X-Received: by 2002:a17:906:ecaa:: with SMTP id qh10mr31367400ejb.425.1617072298792; Mon, 29 Mar 2021 19:44:58 -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: Mon, 29 Mar 2021 19:44:48 -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 On Thu, Mar 4, 2021 at 12:29 AM Linus Walleij wrote: > > Hi Brad, > > thanks for your patch! > > 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. > > > > Signed-off-by: Brad Larson > (...) > > > +#include > > Use this in new drivers: > #include > > > + * 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? > I'll add a comment regarding gpio pin mode. Yes output only mode as SPI chip-selects. > 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). > > > +static const struct of_device_id ebla_spics_of_match[] = { > > + { .compatible = "pensando,elba-spics" }, > > Have you documented this? Yes in Documentation/devicetree/bindings, I'll double check the content for completeness. The SPI CS isn't used for something else, the integrated DesignWare IP doesn't support 4 chip-selects on two spi busses. > > Other than that this is a nice and complete driver. > > Yours, > Linus Walleij Thanks for the review!