/* just to ensure we do once only when speed or chip select change */
priv->qspi_calibrated_hz = hz;
- priv->qspi_calibrated_cs = spi_chip_select(bus);
+ priv->qspi_calibrated_cs = priv->cs;
return 0;
}
*/
if (priv->previous_hz != hz ||
priv->qspi_calibrated_hz != hz ||
- priv->qspi_calibrated_cs != spi_chip_select(bus)) {
+ priv->qspi_calibrated_cs != priv->cs) {
err = spi_calibration(bus, hz);
if (err)
return err;
static int cadence_spi_child_pre_probe(struct udevice *bus)
{
struct spi_slave *slave = dev_get_parent_priv(bus);
+ struct cadence_spi_priv *priv = dev_get_priv(bus->parent);
slave->bytemode = SPI_4BYTE_MODE;
+ slave->option = priv->is_dual;
return 0;
}
priv->regbase = plat->regbase;
priv->ahbbase = plat->ahbbase;
+ priv->is_dual = plat->is_dual;
xilinx_pm_request(PM_REQUEST_NODE, DEV_OSPI, PM_CAPABILITY_ACCESS,
PM_MAX_QOS, PM_REQUEST_ACK_NO, NULL);
int err = 0;
u32 mode;
+ if (spi->flags & SPI_XFER_U_PAGE)
+ priv->cs = CQSPI_CS1;
+ else
+ priv->cs = CQSPI_CS0;
+
/* Set Chip select */
- cadence_qspi_apb_chipselect(base, spi_chip_select(spi->dev),
- plat->is_decoded_cs);
+ cadence_qspi_apb_chipselect(base, priv->cs, plat->is_decoded_cs);
if (op->data.dir == SPI_MEM_DATA_IN && op->data.buf.in) {
if (!op->addr.nbytes)
plat->max_hz = ofnode_read_u32_default(subnode, "spi-max-frequency",
500000);
+ if (dev_read_u32_default(bus, "is-stacked", -1) == 1)
+ plat->is_dual = CQSPI_DUAL_STACKED_FLASH;
+ else
+ plat->is_dual = CQSPI_SINGLE_FLASH;
+
/* Read other parameters from DT */
plat->page_size = ofnode_read_u32_default(subnode, "page-size", 256);
plat->block_size = ofnode_read_u32_default(subnode, "block-size", 16);
#define CQSPI_DECODER_MAX_CS 16
#define CQSPI_READ_CAPTURE_MAX_DELAY 16
+#define CQSPI_SINGLE_FLASH 0
+#define CQSPI_DUAL_STACKED_FLASH 1
+
+#define CQSPI_CS0 0
+#define CQSPI_CS1 1
+
#define CQSPI_REG_POLL_US 1 /* 1us */
#define CQSPI_REG_RETRY 10000
#define CQSPI_POLL_IDLE_RETRY 3
u32 tchsh_ns;
u32 tslch_ns;
bool is_dma;
+ int is_dual;
};
struct cadence_spi_priv {
u8 cmd_buf[32];
size_t data_len;
+ int is_dual;
int qspi_is_init;
+ unsigned int cs;
unsigned int qspi_calibrated_hz;
unsigned int qspi_calibrated_cs;
unsigned int previous_hz;