lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200107182400.GG5885@atomide.com>
Date:   Tue, 7 Jan 2020 10:24:00 -0800
From:   Tony Lindgren <tony@...mide.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Lee Jones <lee.jones@...aro.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Mark Brown <broonie@...nel.org>,
        Sebastian Reichel <sre@...nel.org>, linux-omap@...r.kernel.org
Subject: Re: [PATCH] mfd: motorola-cpcap: Do not hardcode SPI mode flags

* Linus Walleij <linus.walleij@...aro.org> [200107 09:58]:
> On Thu, Dec 19, 2019 at 6:04 PM Tony Lindgren <tony@...mide.com> wrote:
> 
> > * Linus Walleij <linus.walleij@...aro.org> [700101 00:00]:
> > > The current use of mode flags to us SPI_MODE_0 and
> > > SPI_CS_HIGH is fragile: it overwrites anything already
> > > assigned by the SPI core. Change it thusly:
> > >
> > > - Just |= the SPI_MODE_0 so we keep other flags
> > > - Assign ^= SPI_CS_HIGH since we might be active high
> > >   already, and that is usually the case with GPIOs used
> > >   for chip select, even if they are in practice active low.
> > >
> > > Add a comment clarifying why ^= SPI_CS_HIGH is the right
> > > choice here.
> >
> > Looks like this breaks booting for droid4 with a cpcap
> > PMIC, probably as regulators won't work. There's no GPIO
> > controller involved in this case for the chip select, the
> > pins are directly controlled by the spi-omap2-mcspi.c
> > driver.
> >
> > From the pin muxing setup we see there's a pull-down on
> > mcspi1_cs0 pin meaning it's active high:
> >
> > /* 0x4a100138 mcspi1_cs0.mcspi1_cs0 ae23 */
> > OMAP4_IOPAD(0x138, PIN_INPUT_PULLDOWN | MUX_MODE0)
> >
> > My guess a similar issue is with similar patches for
> > all non-gpio spi controllers?
> >
> > Let me know if you want me to test some other changes,
> > or if this patch depends on some other changes.
> 
> So this must mean that something else is setting SPI_CS_HIGH
> for this driver, such as the device tree, right?

Hmm yes we have "spi-cs-high" property set in the dts.

But looking at drivers/spi/spi-omap2-mcspi.c, it also
provides an option to use a GPIO for chip select in
omap2_mcspi_setup(). That does not seem to be used though
based on a quick grep though.

> And the |= SPI_CS_HIGH assignment in the driver is just
> surplus and we should just delete this code instead.
> 
> Would that be right?

Sorry I don't know, maybe. If you have some test patch to
try I can easily test.

Regards,

Tony

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ