Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/arm/olimexino_stm32/olimexino_stm32.dts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ uext_serial: &usart1 {};

&spi2 {
status = "okay";
cs-gpios = <&gpiod 2 0>;
cs-gpios = <&gpiod 2 GPIO_ACTIVE_HIGH>;

sdhc0: sdhc@0 {
compatible = "zephyr,mmc-spi-slot";
Expand Down
2 changes: 1 addition & 1 deletion samples/subsys/fs/fat_fs/nrf52840_blip.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

&spi1 {
status = "okay";
cs-gpios = <&gpio0 17 0>;
cs-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;

sdhc0: sdhc@0 {
compatible = "zephyr,mmc-spi-slot";
Expand Down
7 changes: 5 additions & 2 deletions subsys/disk/disk_access_spi_sdhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct sdhc_spi_data {
struct spi_config cfg;
struct device *cs;
u32_t pin;
Copy link
Contributor

@pabigot pabigot Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could switch to gpio_pin_t and save some space.

gpio_devicetree_flags_t flags;

bool high_capacity;
u32_t sector_count;
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down