mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 09:54:35 +00:00
spi: npcm_pspi: use ACTIVE_LOW flag for cs gpio and set default max_hz
If cs gpio is requested with ACTIVE_HIGH flag, it will be pulled low(i.e. active). This is not what we expected. Signed-off-by: Jim Liu <JJLIU0@nuvoton.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
This commit is contained in:
parent
41b5c79ea0
commit
9b768bf0e3
1 changed files with 8 additions and 4 deletions
|
@ -40,7 +40,7 @@ static inline void spi_cs_activate(struct udevice *dev)
|
|||
struct udevice *bus = dev->parent;
|
||||
struct npcm_pspi_priv *priv = dev_get_priv(bus);
|
||||
|
||||
dm_gpio_set_value(&priv->cs_gpio, 0);
|
||||
dm_gpio_set_value(&priv->cs_gpio, 1);
|
||||
}
|
||||
|
||||
static inline void spi_cs_deactivate(struct udevice *dev)
|
||||
|
@ -48,7 +48,7 @@ static inline void spi_cs_deactivate(struct udevice *dev)
|
|||
struct udevice *bus = dev->parent;
|
||||
struct npcm_pspi_priv *priv = dev_get_priv(bus);
|
||||
|
||||
dm_gpio_set_value(&priv->cs_gpio, 1);
|
||||
dm_gpio_set_value(&priv->cs_gpio, 0);
|
||||
}
|
||||
|
||||
static inline void npcm_pspi_enable(struct npcm_pspi_priv *priv)
|
||||
|
@ -122,6 +122,9 @@ static int npcm_pspi_xfer(struct udevice *dev, unsigned int bitlen,
|
|||
if (flags & SPI_XFER_END)
|
||||
spi_cs_deactivate(dev);
|
||||
|
||||
debug("npcm_pspi_xfer: slave %s:%s dout %08X din %08X bitlen %u\n",
|
||||
dev->parent->name, dev->name, *(uint *)tx, *(uint *)rx, bitlen);
|
||||
|
||||
npcm_pspi_disable(priv);
|
||||
|
||||
return ret;
|
||||
|
@ -183,6 +186,7 @@ static int npcm_pspi_set_mode(struct udevice *bus, uint mode)
|
|||
val |= pspi_mode;
|
||||
writew(val, priv->base + PSPI_CTL1);
|
||||
|
||||
debug("%s: mode=%u\n", __func__, mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -197,9 +201,9 @@ static int npcm_pspi_probe(struct udevice *bus)
|
|||
return ret;
|
||||
|
||||
priv->base = dev_read_addr_ptr(bus);
|
||||
priv->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0);
|
||||
priv->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 1000000);
|
||||
gpio_request_by_name_nodev(offset_to_ofnode(node), "cs-gpios", 0,
|
||||
&priv->cs_gpio, GPIOD_IS_OUT);
|
||||
&priv->cs_gpio, GPIOD_IS_OUT| GPIOD_ACTIVE_LOW);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue