All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Dave Bender <codehero@gmail.com>
Cc: linux-spi <linux-spi@vger.kernel.org>
Subject: Re: spi-ar934x: Using GPIO CS issue
Date: Thu, 4 Nov 2021 16:20:09 +0100	[thread overview]
Message-ID: <CAMuHMdW5HERzd=1wxSRAwUnffAMP87uKLuvDt1Wkf-RLHZJopg@mail.gmail.com> (raw)
In-Reply-To: <CAETHaKrQ-UDPjMm_jpNe3P0VzQg7qDLZGaViqXvz+qVuUuZCgg@mail.gmail.com>

Hi Dave,

On Thu, Nov 4, 2021 at 3:58 PM Dave Bender <codehero@gmail.com> wrote:
> On Thu, Nov 4, 2021 at 5:50 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > Does it work if you change GPIO_ACTIVE_LOW to GPIO_ACTIVE_HIGH?
>
>   There is a pullup resistor on that CS line, so that GPIO must be active low.

I do believe you.  But there's been some issues with inverted CS
gpio behavior when switching from board files to DT, so I thought
I'd better ask to try...

>   Digging deeper into the code, it looks like David Bauer made some
> changes that limit the spi driver's CS usage to only the CS0, CS1, CS2
> pins.
>   There is also no bounds checking on the CS value.
>   I don't understand how this driver can even use generic GPIO if it
> forces use of the CS bits on the SPI_IOC register.

OK, that sounds like a reasonable culprit...

>
> static int ar934x_spi_transfer_one_message(struct spi_controller *master,
>              struct spi_message *m)
> {
>    ....
>    ....
>     for (trx_done = 0; trx_done < t->len; trx_done += 4) {
>
>    .....
>       reg = AR934X_SPI_SHIFT_VAL(spi->chip_select, term,
>                trx_cur * 8);
>       iowrite32(reg, sp->base + AR934X_SPI_REG_SHIFT_CTRL);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2021-11-04 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 22:30 spi-ar934x: Using GPIO CS issue Dave Bender
2021-11-04  9:50 ` Geert Uytterhoeven
2021-11-04 14:58   ` Dave Bender
2021-11-04 15:20     ` Geert Uytterhoeven [this message]
2021-11-05 15:49       ` Dave Bender

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdW5HERzd=1wxSRAwUnffAMP87uKLuvDt1Wkf-RLHZJopg@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=codehero@gmail.com \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.