summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorPascal Linder <pascal.linder@edu.hefr.ch>2019-06-18 08:41:02 +0200
committerStefan Roese <sr@denx.de>2019-07-11 10:58:03 +0200
commit53c3050d0dd3f885c35f5c44293c86a9b199c5ca (patch)
treed110bd463b8498ad5ed3a5ff312c71098cf58a2f /board
parentf1696534838e45623c276658b4b7c9331181d60c (diff)
km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards
As the SPI NOR and NAND devices share the same hardware pins, the MPP configuration has to be changed when claiming/releasing the bus. The current configuration is saved when claiming and restored when releasing. Furthermore, a general-purpose output is used to switch the chip-select signal. This is now also implemented for the DM part of the kirkwood_spi driver. 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>
Diffstat (limited to 'board')
-rw-r--r--board/keymile/km_arm/km_arm.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index ea03be9eb3..7087cc520f 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -322,6 +322,37 @@ void board_spi_release_bus(struct spi_slave *slave)
kw_gpio_set_value(KM_FLASH_GPIO_PIN, 1);
}
+static const u32 spi_mpp_config[] = {
+ MPP1_SPI_MOSI,
+ MPP2_SPI_SCK,
+ MPP3_SPI_MISO,
+ 0
+};
+
+static u32 spi_mpp_backup[4];
+
+int mvebu_board_spi_claim_bus(struct udevice *dev)
+{
+ spi_mpp_backup[3] = 0;
+
+ /* set new spi mpp config and save current one */
+ kirkwood_mpp_conf(spi_mpp_config, spi_mpp_backup);
+
+ kw_gpio_set_value(KM_FLASH_GPIO_PIN, 0);
+
+ return 0;
+}
+
+int mvebu_board_spi_release_bus(struct udevice *dev)
+{
+ /* restore saved mpp config */
+ kirkwood_mpp_conf(spi_mpp_backup, NULL);
+
+ kw_gpio_set_value(KM_FLASH_GPIO_PIN, 1);
+
+ return 0;
+}
+
#if (defined(CONFIG_KM_PIGGY4_88E6061))
#define PHY_LED_SEL_REG 0x18