2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2012-07-28 22:25:35 +00:00
|
|
|
/*
|
|
|
|
* Xilinx SPI driver
|
|
|
|
*
|
2015-06-26 19:21:27 +00:00
|
|
|
* Supports 8 bit SPI transfers only, with or w/o FIFO
|
2012-07-28 22:25:35 +00:00
|
|
|
*
|
2015-06-26 19:21:27 +00:00
|
|
|
* Based on bfin_spi.c, by way of altera_spi.c
|
2015-06-29 07:45:18 +00:00
|
|
|
* Copyright (c) 2015 Jagan Teki <jteki@openedev.com>
|
2012-07-28 22:25:35 +00:00
|
|
|
* Copyright (c) 2012 Stephan Linz <linz@li-pro.net>
|
2015-06-26 19:21:27 +00:00
|
|
|
* Copyright (c) 2010 Graeme Smecher <graeme.smecher@mail.mcgill.ca>
|
|
|
|
* Copyright (c) 2010 Thomas Chou <thomas@wytron.com.tw>
|
|
|
|
* Copyright (c) 2005-2008 Analog Devices Inc.
|
2012-07-28 22:25:35 +00:00
|
|
|
*/
|
2015-06-26 19:21:27 +00:00
|
|
|
|
2012-07-28 22:25:35 +00:00
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
2015-06-29 07:45:18 +00:00
|
|
|
#include <dm.h>
|
|
|
|
#include <errno.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2012-07-28 22:25:35 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
#include <spi.h>
|
2015-06-26 19:21:37 +00:00
|
|
|
#include <asm/io.h>
|
2018-06-30 02:45:18 +00:00
|
|
|
#include <wait_bit.h>
|
2020-05-10 17:40:13 +00:00
|
|
|
#include <linux/bitops.h>
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-26 19:21:26 +00:00
|
|
|
/*
|
2015-06-26 19:21:27 +00:00
|
|
|
* [0]: http://www.xilinx.com/support/documentation
|
2015-06-26 19:21:26 +00:00
|
|
|
*
|
2015-06-26 19:21:27 +00:00
|
|
|
* Xilinx SPI Register Definitions
|
2015-06-26 19:21:26 +00:00
|
|
|
* [1]: [0]/ip_documentation/xps_spi.pdf
|
|
|
|
* page 8, Register Descriptions
|
|
|
|
* [2]: [0]/ip_documentation/axi_spi_ds742.pdf
|
|
|
|
* page 7, Register Overview Table
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* SPI Control Register (spicr), [1] p9, [2] p8 */
|
2015-10-22 20:09:31 +00:00
|
|
|
#define SPICR_LSB_FIRST BIT(9)
|
|
|
|
#define SPICR_MASTER_INHIBIT BIT(8)
|
|
|
|
#define SPICR_MANUAL_SS BIT(7)
|
|
|
|
#define SPICR_RXFIFO_RESEST BIT(6)
|
|
|
|
#define SPICR_TXFIFO_RESEST BIT(5)
|
|
|
|
#define SPICR_CPHA BIT(4)
|
|
|
|
#define SPICR_CPOL BIT(3)
|
|
|
|
#define SPICR_MASTER_MODE BIT(2)
|
|
|
|
#define SPICR_SPE BIT(1)
|
|
|
|
#define SPICR_LOOP BIT(0)
|
2015-06-26 19:21:26 +00:00
|
|
|
|
|
|
|
/* SPI Status Register (spisr), [1] p11, [2] p10 */
|
2015-10-22 20:09:31 +00:00
|
|
|
#define SPISR_SLAVE_MODE_SELECT BIT(5)
|
|
|
|
#define SPISR_MODF BIT(4)
|
|
|
|
#define SPISR_TX_FULL BIT(3)
|
|
|
|
#define SPISR_TX_EMPTY BIT(2)
|
|
|
|
#define SPISR_RX_FULL BIT(1)
|
|
|
|
#define SPISR_RX_EMPTY BIT(0)
|
2015-06-26 19:21:26 +00:00
|
|
|
|
|
|
|
/* SPI Data Transmit Register (spidtr), [1] p12, [2] p12 */
|
2015-10-22 19:33:44 +00:00
|
|
|
#define SPIDTR_8BIT_MASK GENMASK(7, 0)
|
|
|
|
#define SPIDTR_16BIT_MASK GENMASK(15, 0)
|
|
|
|
#define SPIDTR_32BIT_MASK GENMASK(31, 0)
|
2015-06-26 19:21:26 +00:00
|
|
|
|
|
|
|
/* SPI Data Receive Register (spidrr), [1] p12, [2] p12 */
|
2015-10-22 19:33:44 +00:00
|
|
|
#define SPIDRR_8BIT_MASK GENMASK(7, 0)
|
|
|
|
#define SPIDRR_16BIT_MASK GENMASK(15, 0)
|
|
|
|
#define SPIDRR_32BIT_MASK GENMASK(31, 0)
|
2015-06-26 19:21:26 +00:00
|
|
|
|
|
|
|
/* SPI Slave Select Register (spissr), [1] p13, [2] p13 */
|
|
|
|
#define SPISSR_MASK(cs) (1 << (cs))
|
|
|
|
#define SPISSR_ACT(cs) ~SPISSR_MASK(cs)
|
|
|
|
#define SPISSR_OFF ~0UL
|
|
|
|
|
|
|
|
/* SPI Software Reset Register (ssr) */
|
|
|
|
#define SPISSR_RESET_VALUE 0x0a
|
|
|
|
|
2015-06-26 19:21:27 +00:00
|
|
|
#define XILSPI_MAX_XFER_BITS 8
|
|
|
|
#define XILSPI_SPICR_DFLT_ON (SPICR_MANUAL_SS | SPICR_MASTER_MODE | \
|
|
|
|
SPICR_SPE)
|
|
|
|
#define XILSPI_SPICR_DFLT_OFF (SPICR_MASTER_INHIBIT | SPICR_MANUAL_SS)
|
|
|
|
|
2020-05-18 07:11:00 +00:00
|
|
|
#define XILINX_SPI_IDLE_VAL GENMASK(7, 0)
|
2015-06-26 19:21:27 +00:00
|
|
|
|
2018-06-30 02:45:18 +00:00
|
|
|
#define XILINX_SPISR_TIMEOUT 10000 /* in milliseconds */
|
|
|
|
|
2015-06-26 19:21:27 +00:00
|
|
|
/* xilinx spi register set */
|
2015-06-29 07:45:18 +00:00
|
|
|
struct xilinx_spi_regs {
|
2015-06-26 19:21:27 +00:00
|
|
|
u32 __space0__[7];
|
|
|
|
u32 dgier; /* Device Global Interrupt Enable Register (DGIER) */
|
|
|
|
u32 ipisr; /* IP Interrupt Status Register (IPISR) */
|
|
|
|
u32 __space1__;
|
|
|
|
u32 ipier; /* IP Interrupt Enable Register (IPIER) */
|
|
|
|
u32 __space2__[5];
|
|
|
|
u32 srr; /* Softare Reset Register (SRR) */
|
|
|
|
u32 __space3__[7];
|
|
|
|
u32 spicr; /* SPI Control Register (SPICR) */
|
|
|
|
u32 spisr; /* SPI Status Register (SPISR) */
|
|
|
|
u32 spidtr; /* SPI Data Transmit Register (SPIDTR) */
|
|
|
|
u32 spidrr; /* SPI Data Receive Register (SPIDRR) */
|
|
|
|
u32 spissr; /* SPI Slave Select Register (SPISSR) */
|
|
|
|
u32 spitfor; /* SPI Transmit FIFO Occupancy Register (SPITFOR) */
|
|
|
|
u32 spirfor; /* SPI Receive FIFO Occupancy Register (SPIRFOR) */
|
|
|
|
};
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
/* xilinx spi priv */
|
|
|
|
struct xilinx_spi_priv {
|
|
|
|
struct xilinx_spi_regs *regs;
|
2015-06-26 19:21:26 +00:00
|
|
|
unsigned int freq;
|
|
|
|
unsigned int mode;
|
2018-06-30 02:45:18 +00:00
|
|
|
unsigned int fifo_depth;
|
2018-06-30 02:45:19 +00:00
|
|
|
u8 startup;
|
2015-06-26 19:21:26 +00:00
|
|
|
};
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
static int xilinx_spi_probe(struct udevice *bus)
|
2012-07-28 22:25:35 +00:00
|
|
|
{
|
2015-06-29 07:45:18 +00:00
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2018-06-30 02:45:20 +00:00
|
|
|
priv->regs = (struct xilinx_spi_regs *)dev_read_addr(bus);
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2018-06-30 02:45:20 +00:00
|
|
|
priv->fifo_depth = dev_read_u32_default(bus, "fifo-size", 0);
|
2018-06-30 02:45:18 +00:00
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
writel(SPISSR_RESET_VALUE, ®s->srr);
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
return 0;
|
2012-07-28 22:25:35 +00:00
|
|
|
}
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
static void spi_cs_activate(struct udevice *dev, uint cs)
|
2012-07-28 22:25:35 +00:00
|
|
|
{
|
2015-06-29 07:45:18 +00:00
|
|
|
struct udevice *bus = dev_get_parent(dev);
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
writel(SPISSR_ACT(cs), ®s->spissr);
|
2012-07-28 22:25:35 +00:00
|
|
|
}
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
static void spi_cs_deactivate(struct udevice *dev)
|
2012-07-28 22:25:35 +00:00
|
|
|
{
|
2015-06-29 07:45:18 +00:00
|
|
|
struct udevice *bus = dev_get_parent(dev);
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
writel(SPISSR_OFF, ®s->spissr);
|
2012-07-28 22:25:35 +00:00
|
|
|
}
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
static int xilinx_spi_claim_bus(struct udevice *dev)
|
2012-07-28 22:25:35 +00:00
|
|
|
{
|
2015-06-29 07:45:18 +00:00
|
|
|
struct udevice *bus = dev_get_parent(dev);
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
writel(SPISSR_OFF, ®s->spissr);
|
|
|
|
writel(XILSPI_SPICR_DFLT_ON, ®s->spicr);
|
2012-07-28 22:25:35 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
static int xilinx_spi_release_bus(struct udevice *dev)
|
2012-07-28 22:25:35 +00:00
|
|
|
{
|
2015-06-29 07:45:18 +00:00
|
|
|
struct udevice *bus = dev_get_parent(dev);
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
writel(SPISSR_OFF, ®s->spissr);
|
|
|
|
writel(XILSPI_SPICR_DFLT_OFF, ®s->spicr);
|
|
|
|
|
|
|
|
return 0;
|
2012-07-28 22:25:35 +00:00
|
|
|
}
|
|
|
|
|
2018-06-30 02:45:18 +00:00
|
|
|
static u32 xilinx_spi_fill_txfifo(struct udevice *bus, const u8 *txp,
|
|
|
|
u32 txbytes)
|
|
|
|
{
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
|
|
|
unsigned char d;
|
|
|
|
u32 i = 0;
|
|
|
|
|
|
|
|
while (txbytes && !(readl(®s->spisr) & SPISR_TX_FULL) &&
|
|
|
|
i < priv->fifo_depth) {
|
2020-05-18 07:11:00 +00:00
|
|
|
d = txp ? *txp++ : XILINX_SPI_IDLE_VAL;
|
2018-06-30 02:45:18 +00:00
|
|
|
debug("spi_xfer: tx:%x ", d);
|
|
|
|
/* write out and wait for processing (receive data) */
|
|
|
|
writel(d & SPIDTR_8BIT_MASK, ®s->spidtr);
|
|
|
|
txbytes--;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
static u32 xilinx_spi_read_rxfifo(struct udevice *bus, u8 *rxp, u32 rxbytes)
|
|
|
|
{
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
|
|
|
unsigned char d;
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
while (rxbytes && !(readl(®s->spisr) & SPISR_RX_EMPTY)) {
|
|
|
|
d = readl(®s->spidrr) & SPIDRR_8BIT_MASK;
|
|
|
|
if (rxp)
|
|
|
|
*rxp++ = d;
|
|
|
|
debug("spi_xfer: rx:%x\n", d);
|
|
|
|
rxbytes--;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
debug("Rx_done\n");
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2018-06-30 02:45:19 +00:00
|
|
|
static void xilinx_spi_startup_block(struct udevice *dev, unsigned int bytes,
|
|
|
|
const void *dout, void *din)
|
|
|
|
{
|
|
|
|
struct udevice *bus = dev_get_parent(dev);
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2020-12-03 23:55:23 +00:00
|
|
|
struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
|
2018-06-30 02:45:19 +00:00
|
|
|
const unsigned char *txp = dout;
|
|
|
|
unsigned char *rxp = din;
|
2020-09-24 10:32:15 +00:00
|
|
|
u32 reg;
|
2018-06-30 02:45:19 +00:00
|
|
|
u32 txbytes = bytes;
|
|
|
|
u32 rxbytes = bytes;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This loop runs two times. First time to send the command.
|
|
|
|
* Second time to transfer data. After transferring data,
|
|
|
|
* it sets txp to the initial value for the normal operation.
|
|
|
|
*/
|
|
|
|
for ( ; priv->startup < 2; priv->startup++) {
|
2020-09-24 10:32:15 +00:00
|
|
|
xilinx_spi_fill_txfifo(bus, txp, txbytes);
|
2018-06-30 02:45:19 +00:00
|
|
|
reg = readl(®s->spicr) & ~SPICR_MASTER_INHIBIT;
|
|
|
|
writel(reg, ®s->spicr);
|
2020-09-24 10:32:15 +00:00
|
|
|
xilinx_spi_read_rxfifo(bus, rxp, rxbytes);
|
2018-06-30 02:45:19 +00:00
|
|
|
txp = din;
|
|
|
|
|
|
|
|
if (priv->startup) {
|
|
|
|
spi_cs_deactivate(dev);
|
|
|
|
spi_cs_activate(dev, slave_plat->cs);
|
|
|
|
txp = dout;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-29 07:45:18 +00:00
|
|
|
static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen,
|
|
|
|
const void *dout, void *din, unsigned long flags)
|
2012-07-28 22:25:35 +00:00
|
|
|
{
|
2015-06-29 07:45:18 +00:00
|
|
|
struct udevice *bus = dev_get_parent(dev);
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2020-12-03 23:55:23 +00:00
|
|
|
struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
|
2012-07-28 22:25:35 +00:00
|
|
|
/* assume spi core configured to do 8 bit transfers */
|
|
|
|
unsigned int bytes = bitlen / XILSPI_MAX_XFER_BITS;
|
|
|
|
const unsigned char *txp = dout;
|
|
|
|
unsigned char *rxp = din;
|
2018-06-30 02:45:18 +00:00
|
|
|
u32 txbytes = bytes;
|
|
|
|
u32 rxbytes = bytes;
|
2020-09-23 08:36:47 +00:00
|
|
|
u32 reg, count;
|
2018-06-30 02:45:18 +00:00
|
|
|
int ret;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2015-06-26 19:21:27 +00:00
|
|
|
debug("spi_xfer: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n",
|
2020-12-17 04:20:07 +00:00
|
|
|
dev_seq(bus), slave_plat->cs, bitlen, bytes, flags);
|
2015-06-26 19:21:27 +00:00
|
|
|
|
2012-07-28 22:25:35 +00:00
|
|
|
if (bitlen == 0)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (bitlen % XILSPI_MAX_XFER_BITS) {
|
2015-06-26 19:21:27 +00:00
|
|
|
printf("XILSPI warning: Not a multiple of %d bits\n",
|
|
|
|
XILSPI_MAX_XFER_BITS);
|
2012-07-28 22:25:35 +00:00
|
|
|
flags |= SPI_XFER_END;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SPI_XFER_BEGIN)
|
2015-06-29 07:45:18 +00:00
|
|
|
spi_cs_activate(dev, slave_plat->cs);
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2018-06-30 02:45:19 +00:00
|
|
|
/*
|
|
|
|
* This is the work around for the startup block issue in
|
|
|
|
* the spi controller. SPI clock is passing through STARTUP
|
|
|
|
* block to FLASH. STARTUP block don't provide clock as soon
|
|
|
|
* as QSPI provides command. So first command fails.
|
|
|
|
*/
|
|
|
|
xilinx_spi_startup_block(dev, bytes, dout, din);
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2018-06-30 02:45:18 +00:00
|
|
|
while (txbytes && rxbytes) {
|
|
|
|
count = xilinx_spi_fill_txfifo(bus, txp, txbytes);
|
|
|
|
reg = readl(®s->spicr) & ~SPICR_MASTER_INHIBIT;
|
|
|
|
writel(reg, ®s->spicr);
|
|
|
|
txbytes -= count;
|
|
|
|
if (txp)
|
|
|
|
txp += count;
|
2012-07-28 22:25:35 +00:00
|
|
|
|
2018-06-30 02:45:18 +00:00
|
|
|
ret = wait_for_bit_le32(®s->spisr, SPISR_TX_EMPTY, true,
|
|
|
|
XILINX_SPISR_TIMEOUT, false);
|
|
|
|
if (ret < 0) {
|
2015-06-26 19:21:27 +00:00
|
|
|
printf("XILSPI error: Xfer timeout\n");
|
2018-06-30 02:45:18 +00:00
|
|
|
return ret;
|
2012-07-28 22:25:35 +00:00
|
|
|
}
|
|
|
|
|
2018-06-30 02:45:18 +00:00
|
|
|
debug("txbytes:0x%x,txp:0x%p\n", txbytes, txp);
|
|
|
|
count = xilinx_spi_read_rxfifo(bus, rxp, rxbytes);
|
|
|
|
rxbytes -= count;
|
2012-07-28 22:25:35 +00:00
|
|
|
if (rxp)
|
2018-06-30 02:45:18 +00:00
|
|
|
rxp += count;
|
|
|
|
debug("rxbytes:0x%x rxp:0x%p\n", rxbytes, rxp);
|
2012-07-28 22:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (flags & SPI_XFER_END)
|
2015-06-29 07:45:18 +00:00
|
|
|
spi_cs_deactivate(dev);
|
2012-07-28 22:25:35 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2015-06-29 07:45:18 +00:00
|
|
|
|
|
|
|
static int xilinx_spi_set_speed(struct udevice *bus, uint speed)
|
|
|
|
{
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
|
|
|
|
priv->freq = speed;
|
|
|
|
|
2021-03-17 07:01:50 +00:00
|
|
|
debug("%s: regs=%p, speed=%d\n", __func__, priv->regs, priv->freq);
|
2015-06-29 07:45:18 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int xilinx_spi_set_mode(struct udevice *bus, uint mode)
|
|
|
|
{
|
|
|
|
struct xilinx_spi_priv *priv = dev_get_priv(bus);
|
|
|
|
struct xilinx_spi_regs *regs = priv->regs;
|
2021-03-17 07:01:50 +00:00
|
|
|
u32 spicr;
|
2015-06-29 07:45:18 +00:00
|
|
|
|
|
|
|
spicr = readl(®s->spicr);
|
2015-09-07 19:56:29 +00:00
|
|
|
if (mode & SPI_LSB_FIRST)
|
2015-06-29 07:45:18 +00:00
|
|
|
spicr |= SPICR_LSB_FIRST;
|
2015-09-07 19:56:29 +00:00
|
|
|
if (mode & SPI_CPHA)
|
2015-06-29 07:45:18 +00:00
|
|
|
spicr |= SPICR_CPHA;
|
2015-09-07 19:56:29 +00:00
|
|
|
if (mode & SPI_CPOL)
|
2015-06-29 07:45:18 +00:00
|
|
|
spicr |= SPICR_CPOL;
|
2015-09-07 19:56:29 +00:00
|
|
|
if (mode & SPI_LOOP)
|
2015-06-29 07:45:18 +00:00
|
|
|
spicr |= SPICR_LOOP;
|
|
|
|
|
|
|
|
writel(spicr, ®s->spicr);
|
|
|
|
priv->mode = mode;
|
|
|
|
|
2021-03-17 07:01:50 +00:00
|
|
|
debug("%s: regs=%p, mode=%d\n", __func__, priv->regs, priv->mode);
|
2015-06-29 07:45:18 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct dm_spi_ops xilinx_spi_ops = {
|
|
|
|
.claim_bus = xilinx_spi_claim_bus,
|
|
|
|
.release_bus = xilinx_spi_release_bus,
|
|
|
|
.xfer = xilinx_spi_xfer,
|
|
|
|
.set_speed = xilinx_spi_set_speed,
|
|
|
|
.set_mode = xilinx_spi_set_mode,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct udevice_id xilinx_spi_ids[] = {
|
2015-12-11 11:41:14 +00:00
|
|
|
{ .compatible = "xlnx,xps-spi-2.00.a" },
|
|
|
|
{ .compatible = "xlnx,xps-spi-2.00.b" },
|
2015-06-29 07:45:18 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(xilinx_spi) = {
|
|
|
|
.name = "xilinx_spi",
|
|
|
|
.id = UCLASS_SPI,
|
|
|
|
.of_match = xilinx_spi_ids,
|
|
|
|
.ops = &xilinx_spi_ops,
|
2020-12-03 23:55:17 +00:00
|
|
|
.priv_auto = sizeof(struct xilinx_spi_priv),
|
2015-06-29 07:45:18 +00:00
|
|
|
.probe = xilinx_spi_probe,
|
|
|
|
};
|