@@ -44,6 +44,7 @@ static_assert(CQSPI_MAX_CHIPSELECT <= SPI_CS_CNT_MAX);
44
44
#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR BIT(5)
45
45
#define CQSPI_RD_NO_IRQ BIT(6)
46
46
#define CQSPI_DMA_SET_MASK BIT(7)
47
+ #define CQSPI_SUPPORT_DEVICE_RESET BIT(8)
47
48
48
49
/* Capabilities */
49
50
#define CQSPI_SUPPORTS_OCTAL BIT(0)
@@ -110,7 +111,7 @@ struct cqspi_st {
110
111
111
112
struct cqspi_driver_platdata {
112
113
u32 hwcaps_mask ;
113
- u8 quirks ;
114
+ u16 quirks ;
114
115
int (* indirect_read_dma )(struct cqspi_flash_pdata * f_pdata ,
115
116
u_char * rxbuf , loff_t from_addr , size_t n_rx );
116
117
u32 (* get_dma_status )(struct cqspi_st * cqspi );
@@ -145,6 +146,8 @@ struct cqspi_driver_platdata {
145
146
#define CQSPI_REG_CONFIG_IDLE_LSB 31
146
147
#define CQSPI_REG_CONFIG_CHIPSELECT_MASK 0xF
147
148
#define CQSPI_REG_CONFIG_BAUD_MASK 0xF
149
+ #define CQSPI_REG_CONFIG_RESET_PIN_FLD_MASK BIT(5)
150
+ #define CQSPI_REG_CONFIG_RESET_CFG_FLD_MASK BIT(6)
148
151
149
152
#define CQSPI_REG_RD_INSTR 0x04
150
153
#define CQSPI_REG_RD_INSTR_OPCODE_LSB 0
@@ -831,6 +834,25 @@ static int cqspi_indirect_read_execute(struct cqspi_flash_pdata *f_pdata,
831
834
return ret ;
832
835
}
833
836
837
+ static void cqspi_device_reset (struct cqspi_st * cqspi )
838
+ {
839
+ u32 reg ;
840
+
841
+ reg = readl (cqspi -> iobase + CQSPI_REG_CONFIG );
842
+ reg |= CQSPI_REG_CONFIG_RESET_CFG_FLD_MASK ;
843
+ writel (reg , cqspi -> iobase + CQSPI_REG_CONFIG );
844
+ /*
845
+ * NOTE: Delay timing implementation is derived from
846
+ * spi_nor_hw_reset()
847
+ */
848
+ writel (reg & ~CQSPI_REG_CONFIG_RESET_PIN_FLD_MASK , cqspi -> iobase + CQSPI_REG_CONFIG );
849
+ usleep_range (1 , 5 );
850
+ writel (reg | CQSPI_REG_CONFIG_RESET_PIN_FLD_MASK , cqspi -> iobase + CQSPI_REG_CONFIG );
851
+ usleep_range (100 , 150 );
852
+ writel (reg & ~CQSPI_REG_CONFIG_RESET_PIN_FLD_MASK , cqspi -> iobase + CQSPI_REG_CONFIG );
853
+ usleep_range (1000 , 1200 );
854
+ }
855
+
834
856
static void cqspi_controller_enable (struct cqspi_st * cqspi , bool enable )
835
857
{
836
858
void __iomem * reg_base = cqspi -> iobase ;
@@ -1912,6 +1934,9 @@ static int cqspi_probe(struct platform_device *pdev)
1912
1934
1913
1935
host -> num_chipselect = cqspi -> num_chipselect ;
1914
1936
1937
+ if (ddata -> quirks & CQSPI_SUPPORT_DEVICE_RESET )
1938
+ cqspi_device_reset (cqspi );
1939
+
1915
1940
if (cqspi -> use_direct_mode ) {
1916
1941
ret = cqspi_request_mmap_dma (cqspi );
1917
1942
if (ret == - EPROBE_DEFER )
@@ -2054,6 +2079,15 @@ static const struct cqspi_driver_platdata versal_ospi = {
2054
2079
.get_dma_status = cqspi_get_versal_dma_status ,
2055
2080
};
2056
2081
2082
+ static const struct cqspi_driver_platdata versal2_ospi = {
2083
+ .hwcaps_mask = CQSPI_SUPPORTS_OCTAL ,
2084
+ .quirks = CQSPI_DISABLE_DAC_MODE | CQSPI_SUPPORT_EXTERNAL_DMA
2085
+ | CQSPI_DMA_SET_MASK
2086
+ | CQSPI_SUPPORT_DEVICE_RESET ,
2087
+ .indirect_read_dma = cqspi_versal_indirect_read_dma ,
2088
+ .get_dma_status = cqspi_get_versal_dma_status ,
2089
+ };
2090
+
2057
2091
static const struct cqspi_driver_platdata jh7110_qspi = {
2058
2092
.quirks = CQSPI_DISABLE_DAC_MODE ,
2059
2093
.jh7110_clk_init = cqspi_jh7110_clk_init ,
@@ -2106,6 +2140,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
2106
2140
.compatible = "mobileye,eyeq5-ospi" ,
2107
2141
.data = & mobileye_eyeq5_ospi ,
2108
2142
},
2143
+ {
2144
+ .compatible = "amd,versal2-ospi" ,
2145
+ .data = & versal2_ospi ,
2146
+ },
2109
2147
{ /* end of table */ }
2110
2148
};
2111
2149
0 commit comments