/* meson_spifc_set_mode() - setups the SPI bus mode @dev: the SPI controller device @mode: desired mode bitfield Return: 0 on success, -ENODEV on error  */
static int meson_spifc_set_mode(struct udevice *dev, uint mode)
/* meson_spifc_set_mode() - setups the SPI bus mode @dev: the SPI controller device @mode: desired mode bitfield Return: 0 on success, -ENODEV on error  */
static int meson_spifc_set_mode(struct udevice *dev, uint mode)
{
	struct meson_spifc_priv *spifc = dev_get_priv(dev);
	if (mode & (SPI_CPHA | SPI_RX_QUAD | SPI_RX_DUAL |
		    SPI_TX_QUAD | SPI_TX_DUAL))
		return -ENODEV;
	regmap_update_bits(spifc->regmap, REG_USER, USER_CLK_NOT_INV,
			   mode & SPI_CPOL ? USER_CLK_NOT_INV : 0);
	regmap_update_bits(spifc->regmap, REG_USER4, USER4_CS_POL_HIGH,
			   mode & SPI_CS_HIGH ? USER4_CS_POL_HIGH : 0);
	return 0;
}