From: Pascal Linder Date: Tue, 18 Jun 2019 06:41:01 +0000 (+0200) Subject: km/spi: add weak functions to kirkwood_spi driver (DM part) X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=f1696534838e45623c276658b4b7c9331181d60c;p=u-boot.git 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 Signed-off-by: Holger Brunck Signed-off-by: Stefan Roese --- diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c index 5dd1ad67cf..881a775003 100644 --- a/drivers/spi/kirkwood_spi.c +++ b/drivers/spi/kirkwood_spi.c @@ -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,