disk: Convert sdhc spi driver to new gpio api

Converts the sdhc spi driver to the new gpio api. Updates device trees
for the olimexino_stm32 and nrf52840_blip boards to set appropriate
active high/low polarity for the spi chip select pin.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
Maureen Helm 2020-01-14 13:58:54 -06:00 committed by Carles Cufí
commit 2b5f78a88f
3 changed files with 7 additions and 4 deletions

View file

@ -28,6 +28,7 @@ struct sdhc_spi_data {
struct spi_config cfg;
struct device *cs;
u32_t pin;
gpio_devicetree_flags_t flags;
bool high_capacity;
u32_t sector_count;
@ -71,7 +72,7 @@ static int sdhc_spi_trace(struct sdhc_spi_data *data, int dir, int err,
/* Asserts or deasserts chip select */
static void sdhc_spi_set_cs(struct sdhc_spi_data *data, int value)
{
gpio_pin_write(data->cs, data->pin, value);
gpio_pin_set(data->cs, data->pin, value);
}
/* Receives a fixed number of bytes */
@ -775,10 +776,12 @@ static int sdhc_spi_init(struct device *dev)
__ASSERT_NO_MSG(data->cs != NULL);
data->pin = DT_INST_0_ZEPHYR_MMC_SPI_SLOT_CS_GPIOS_PIN;
data->flags = DT_INST_0_ZEPHYR_MMC_SPI_SLOT_CS_GPIOS_FLAGS;
disk_spi_sdhc_init(dev);
return gpio_pin_configure(data->cs, data->pin, GPIO_DIR_OUT);
return gpio_pin_configure(data->cs, data->pin,
GPIO_OUTPUT_INACTIVE | data->flags);
}
static int disk_spi_sdhc_access_status(struct disk_info *disk)