linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: linux-arm-kernel@lists.infradead.org,
	Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org,
	Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Subject: [BUG] vf610-zii-dev-rev-b SPI fails at boot
Date: Thu, 21 Feb 2019 15:24:59 +0000	[thread overview]
Message-ID: <20190221152459.axrjce7yqkjmedgl@shell.armlinux.org.uk> (raw)

While booting 4.20 on the ZII development revision B board, I notice 
this in the kernel logs:

spi spi0.1: setup: unsupported mode bits 4
spi_gpio spi0: can't setup spi0.1, status -22
spi_master spi0: spi_device register error /spi0/at93c46d@1
spi_master spi0: Failed to create SPI device for /spi0/at93c46d@1

This is for the at93c46d@1 device attached to spi-gpio (see
arch/arm/boot/dts/vf610-zii-dev-rev-b.dts around line 330).  This
is declared with "spi-cs-high;" in DT.  It appears to be complaining
about the SPI_CS_HIGH flag.

It appears this warning comes from drivers/spi/spi.c around lines
2828-2847 due to:

	bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD);

and it looks like spi-gpio sets:

	master->mode_bits = SPI_3WIRE | SPI_CPHA | SPI_CPOL;

but then goes on to set:

	spi_gpio->bitbang.flags = SPI_CS_HIGH;

However, this is ignored by bitbang if master->mode_bits has already
been set:

	if (!master->mode_bits)
		master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags;

It looks like this commit introduced for v4.19 broke the driver:

commit 4b859db2c60692560afbfef1b030d0ddef57b7ee
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Sat Jul 28 10:19:14 2018 +0200

by setting master->mode_bits - prior to this, bitbang would have set
the mode bits itself.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

             reply	other threads:[~2019-02-21 15:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 15:24 Russell King - ARM Linux admin [this message]
2019-02-21 15:59 ` [PATCH] spi: spi-gpio: fix SPI_CS_HIGH capability Russell King
2019-02-21 16:14   ` Fabio Estevam
2019-02-21 19:21     ` Jonathan Neuschäfer

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=20190221152459.axrjce7yqkjmedgl@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).