58
58
#define LTQ_SPI_CLC_DISR BIT(0) /* Disable request bit */
59
59
60
60
#define LTQ_SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */
61
- #define LTQ_SPI_ID_TXFS_M (0x3F << LTQ_SPI_ID_TXFS_S)
62
61
#define LTQ_SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */
63
- #define LTQ_SPI_ID_RXFS_M (0x3F << LTQ_SPI_ID_RXFS_S)
64
62
#define LTQ_SPI_ID_MOD_S 8 /* Module ID */
65
63
#define LTQ_SPI_ID_MOD_M (0xff << LTQ_SPI_ID_MOD_S)
66
64
#define LTQ_SPI_ID_CFG_S 5 /* DMA interface support */
123
121
LTQ_SPI_WHBSTATE_CLRTUE)
124
122
125
123
#define LTQ_SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */
126
- #define LTQ_SPI_RXFCON_RXFITL_M (0x3F << LTQ_SPI_RXFCON_RXFITL_S)
127
124
#define LTQ_SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */
128
125
#define LTQ_SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */
129
126
130
127
#define LTQ_SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */
131
- #define LTQ_SPI_TXFCON_TXFITL_M (0x3F << LTQ_SPI_TXFCON_TXFITL_S)
132
128
#define LTQ_SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */
133
129
#define LTQ_SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */
134
130
135
131
#define LTQ_SPI_FSTAT_RXFFL_S 0
136
- #define LTQ_SPI_FSTAT_RXFFL_M (0x3f << LTQ_SPI_FSTAT_RXFFL_S)
137
132
#define LTQ_SPI_FSTAT_TXFFL_S 8
138
- #define LTQ_SPI_FSTAT_TXFFL_M (0x3f << LTQ_SPI_FSTAT_TXFFL_S)
139
133
140
134
#define LTQ_SPI_GPOCON_ISCSBN_S 8
141
135
#define LTQ_SPI_GPOCON_INVOUTN_S 0
@@ -161,6 +155,7 @@ struct lantiq_ssc_hwcfg {
161
155
unsigned int irncr ;
162
156
unsigned int irnicr ;
163
157
bool irq_ack ;
158
+ u32 fifo_size_mask ;
164
159
};
165
160
166
161
struct lantiq_ssc_spi {
@@ -210,16 +205,18 @@ static void lantiq_ssc_maskl(const struct lantiq_ssc_spi *spi, u32 clr,
210
205
211
206
static unsigned int tx_fifo_level (const struct lantiq_ssc_spi * spi )
212
207
{
208
+ const struct lantiq_ssc_hwcfg * hwcfg = spi -> hwcfg ;
213
209
u32 fstat = lantiq_ssc_readl (spi , LTQ_SPI_FSTAT );
214
210
215
- return (fstat & LTQ_SPI_FSTAT_TXFFL_M ) >> LTQ_SPI_FSTAT_TXFFL_S ;
211
+ return (fstat >> LTQ_SPI_FSTAT_TXFFL_S ) & hwcfg -> fifo_size_mask ;
216
212
}
217
213
218
214
static unsigned int rx_fifo_level (const struct lantiq_ssc_spi * spi )
219
215
{
216
+ const struct lantiq_ssc_hwcfg * hwcfg = spi -> hwcfg ;
220
217
u32 fstat = lantiq_ssc_readl (spi , LTQ_SPI_FSTAT );
221
218
222
- return fstat & LTQ_SPI_FSTAT_RXFFL_M ;
219
+ return ( fstat >> LTQ_SPI_FSTAT_RXFFL_S ) & hwcfg -> fifo_size_mask ;
223
220
}
224
221
225
222
static unsigned int tx_fifo_free (const struct lantiq_ssc_spi * spi )
@@ -807,6 +804,7 @@ static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = {
807
804
.irnen_t = LTQ_SPI_IRNEN_T_XWAY ,
808
805
.irnicr = 0xF8 ,
809
806
.irncr = 0xFC ,
807
+ .fifo_size_mask = GENMASK (5 , 0 ),
810
808
.irq_ack = false,
811
809
};
812
810
@@ -815,6 +813,7 @@ static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = {
815
813
.irnen_t = LTQ_SPI_IRNEN_T_XRX ,
816
814
.irnicr = 0xF8 ,
817
815
.irncr = 0xFC ,
816
+ .fifo_size_mask = GENMASK (5 , 0 ),
818
817
.irq_ack = false,
819
818
};
820
819
@@ -941,8 +940,8 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
941
940
INIT_WORK (& spi -> work , lantiq_ssc_bussy_work );
942
941
943
942
id = lantiq_ssc_readl (spi , LTQ_SPI_ID );
944
- spi -> tx_fifo_size = (id & LTQ_SPI_ID_TXFS_M ) >> LTQ_SPI_ID_TXFS_S ;
945
- spi -> rx_fifo_size = (id & LTQ_SPI_ID_RXFS_M ) >> LTQ_SPI_ID_RXFS_S ;
943
+ spi -> tx_fifo_size = (id >> LTQ_SPI_ID_TXFS_S ) & hwcfg -> fifo_size_mask ;
944
+ spi -> rx_fifo_size = (id >> LTQ_SPI_ID_RXFS_S ) & hwcfg -> fifo_size_mask ;
946
945
supports_dma = (id & LTQ_SPI_ID_CFG_M ) >> LTQ_SPI_ID_CFG_S ;
947
946
revision = id & LTQ_SPI_ID_REV_M ;
948
947
0 commit comments