km/spi: add weak functions to kirkwood_spi driver (DM part)

The weak functions, known from the legacy code, are added to the DM part
as well. For this purpose, the release operation first needs to be
implemented. KM Kirkwood boards will overwrite those weak functions to
change the MPP configuration when claiming/releasing the bus, because the
hardware pins are shared between the SPI NOR and NAND devices.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
Pascal Linder 2019-06-18 08:41:01 +02:00 committed by Stefan Roese
parent c0fed3ac25
commit f169653483

View File

@ -338,6 +338,11 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,
return _spi_xfer(plat->spireg, bitlen, dout, din, flags);
}
__attribute__((weak)) int mvebu_board_spi_claim_bus(struct udevice *dev)
{
return 0;
}
static int mvebu_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
@ -348,9 +353,19 @@ static int mvebu_spi_claim_bus(struct udevice *dev)
KWSPI_CS_MASK << KWSPI_CS_SHIFT,
spi_chip_select(dev) << KWSPI_CS_SHIFT);
return mvebu_board_spi_claim_bus(dev);
}
__attribute__((weak)) int mvebu_board_spi_release_bus(struct udevice *dev)
{
return 0;
}
static int mvebu_spi_release_bus(struct udevice *dev)
{
return mvebu_board_spi_release_bus(dev);
}
static int mvebu_spi_probe(struct udevice *bus)
{
struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
@ -377,6 +392,7 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
static const struct dm_spi_ops mvebu_spi_ops = {
.claim_bus = mvebu_spi_claim_bus,
.release_bus = mvebu_spi_release_bus,
.xfer = mvebu_spi_xfer,
.set_speed = mvebu_spi_set_speed,
.set_mode = mvebu_spi_set_mode,