1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 2a8919371SHaikun.Wang@freescale.com /* 3a8919371SHaikun.Wang@freescale.com * Freescale DSPI Module Defines 4a8919371SHaikun.Wang@freescale.com * 5a8919371SHaikun.Wang@freescale.com * Copyright (C) 2004-2007, 2015 Freescale Semiconductor, Inc. 6a8919371SHaikun.Wang@freescale.com * TsiChung Liew (Tsi-Chung.Liew@freescale.com) 7a8919371SHaikun.Wang@freescale.com * Chao Fu (B44548@freesacle.com) 8a8919371SHaikun.Wang@freescale.com * Haikun Wang (B53464@freescale.com) 9a8919371SHaikun.Wang@freescale.com */ 10a8919371SHaikun.Wang@freescale.com 11a8919371SHaikun.Wang@freescale.com #ifndef _FSL_DSPI_H_ 12a8919371SHaikun.Wang@freescale.com #define _FSL_DSPI_H_ 13a8919371SHaikun.Wang@freescale.com 14a8919371SHaikun.Wang@freescale.com /* DMA Serial Peripheral Interface (DSPI) */ 15a8919371SHaikun.Wang@freescale.com struct dspi { 16a8919371SHaikun.Wang@freescale.com u32 mcr; /* 0x00 */ 17a8919371SHaikun.Wang@freescale.com u32 resv0; /* 0x04 */ 18a8919371SHaikun.Wang@freescale.com u32 tcr; /* 0x08 */ 19a8919371SHaikun.Wang@freescale.com u32 ctar[8]; /* 0x0C - 0x28 */ 20a8919371SHaikun.Wang@freescale.com u32 sr; /* 0x2C */ 21a8919371SHaikun.Wang@freescale.com u32 irsr; /* 0x30 */ 22a8919371SHaikun.Wang@freescale.com u32 tfr; /* 0x34 - PUSHR */ 23a8919371SHaikun.Wang@freescale.com u32 rfr; /* 0x38 - POPR */ 24a8919371SHaikun.Wang@freescale.com #ifdef CONFIG_MCF547x_8x 25a8919371SHaikun.Wang@freescale.com u32 tfdr[4]; /* 0x3C */ 26a8919371SHaikun.Wang@freescale.com u8 resv2[0x30]; /* 0x40 */ 27a8919371SHaikun.Wang@freescale.com u32 rfdr[4]; /* 0x7C */ 28a8919371SHaikun.Wang@freescale.com #else 29a8919371SHaikun.Wang@freescale.com u32 tfdr[16]; /* 0x3C */ 30a8919371SHaikun.Wang@freescale.com u32 rfdr[16]; /* 0x7C */ 31a8919371SHaikun.Wang@freescale.com #endif 32a8919371SHaikun.Wang@freescale.com }; 33a8919371SHaikun.Wang@freescale.com 34a8919371SHaikun.Wang@freescale.com /* Module configuration */ 35a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_MSTR 0x80000000 36a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSCK 0x40000000 37a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_DCONF(x) (((x) & 0x03) << 28) 38a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_FRZ 0x08000000 39a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_MTFE 0x04000000 40a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_PCSSE 0x02000000 41a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_ROOE 0x01000000 42a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_PCSIS(x) (1 << (16 + (x))) 43a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_PCSIS_MASK (0xff << 16) 44a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS7 0x00800000 45a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS6 0x00400000 46a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS5 0x00200000 47a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS4 0x00100000 48a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS3 0x00080000 49a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS2 0x00040000 50a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS1 0x00020000 51a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CSIS0 0x00010000 52a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_DOZE 0x00008000 53a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_MDIS 0x00004000 54a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_DTXF 0x00002000 55a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_DRXF 0x00001000 56a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CTXF 0x00000800 57a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_CRXF 0x00000400 58a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_SMPL_PT(x) (((x) & 0x03) << 8) 59a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_FCPCS 0x00000001 60a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_PES 0x00000001 61a8919371SHaikun.Wang@freescale.com #define DSPI_MCR_HALT 0x00000001 62a8919371SHaikun.Wang@freescale.com 63a8919371SHaikun.Wang@freescale.com /* Transfer count */ 64a8919371SHaikun.Wang@freescale.com #define DSPI_TCR_SPI_TCNT(x) (((x) & 0x0000FFFF) << 16) 65a8919371SHaikun.Wang@freescale.com 66a8919371SHaikun.Wang@freescale.com /* Clock and transfer attributes */ 67a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR(x) (0x0c + (x * 4)) 68a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_DBR 0x80000000 69a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_TRSZ(x) (((x) & 0x0F) << 27) 70a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_CPOL 0x04000000 71a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_CPHA 0x02000000 72a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_LSBFE 0x01000000 73a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PCSSCK(x) (((x) & 0x03) << 22) 74a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PCSSCK_7CLK 0x00A00000 75a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PCSSCK_5CLK 0x00800000 76a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PCSSCK_3CLK 0x00400000 77a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PCSSCK_1CLK 0x00000000 78a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PASC(x) (((x) & 0x03) << 20) 79a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PASC_7CLK 0x00300000 80a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PASC_5CLK 0x00200000 81a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PASC_3CLK 0x00100000 82a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PASC_1CLK 0x00000000 83a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PDT(x) (((x) & 0x03) << 18) 84a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PDT_7CLK 0x000A0000 85a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PDT_5CLK 0x00080000 86a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PDT_3CLK 0x00040000 87a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PDT_1CLK 0x00000000 88a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PBR(x) (((x) & 0x03) << 16) 89a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PBR_7CLK 0x00030000 90a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PBR_5CLK 0x00020000 91a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PBR_3CLK 0x00010000 92a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_PBR_1CLK 0x00000000 93a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_CSSCK(x) (((x) & 0x0F) << 12) 94a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_ASC(x) (((x) & 0x0F) << 8) 95a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_DT(x) (((x) & 0x0F) << 4) 96a8919371SHaikun.Wang@freescale.com #define DSPI_CTAR_BR(x) ((x) & 0x0F) 97a8919371SHaikun.Wang@freescale.com 98a8919371SHaikun.Wang@freescale.com /* Status */ 99a8919371SHaikun.Wang@freescale.com #define DSPI_SR_TCF 0x80000000 100a8919371SHaikun.Wang@freescale.com #define DSPI_SR_TXRXS 0x40000000 101a8919371SHaikun.Wang@freescale.com #define DSPI_SR_EOQF 0x10000000 102a8919371SHaikun.Wang@freescale.com #define DSPI_SR_TFUF 0x08000000 103a8919371SHaikun.Wang@freescale.com #define DSPI_SR_TFFF 0x02000000 104a8919371SHaikun.Wang@freescale.com #define DSPI_SR_RFOF 0x00080000 105a8919371SHaikun.Wang@freescale.com #define DSPI_SR_RFDF 0x00020000 106a8919371SHaikun.Wang@freescale.com #define DSPI_SR_TXCTR(x) (((x) & 0x0000F000) >> 12) 107a8919371SHaikun.Wang@freescale.com #define DSPI_SR_TXPTR(x) (((x) & 0x00000F00) >> 8) 108a8919371SHaikun.Wang@freescale.com #define DSPI_SR_RXCTR(x) (((x) & 0x000000F0) >> 4) 109a8919371SHaikun.Wang@freescale.com #define DSPI_SR_RXPTR(x) ((x) & 0x0000000F) 110a8919371SHaikun.Wang@freescale.com 111a8919371SHaikun.Wang@freescale.com /* DMA/interrupt request selct and enable */ 112a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_TCFE 0x80000000 113a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_EOQFE 0x10000000 114a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_TFUFE 0x08000000 115a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_TFFFE 0x02000000 116a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_TFFFS 0x01000000 117a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_RFOFE 0x00080000 118a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_RFDFE 0x00020000 119a8919371SHaikun.Wang@freescale.com #define DSPI_IRSR_RFDFS 0x00010000 120a8919371SHaikun.Wang@freescale.com 121a8919371SHaikun.Wang@freescale.com /* Transfer control - 32-bit access */ 122a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_PCS(x) (((1 << x) & 0x0000003f) << 16) 123a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CONT 0x80000000 124a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CTAS(x) (((x) & 0x07) << 28) 125a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_EOQ 0x08000000 126a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CTCNT 0x04000000 127a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS7 0x00800000 128a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS6 0x00400000 129a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS5 0x00200000 130a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS4 0x00100000 131a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS3 0x00080000 132a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS2 0x00040000 133a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS1 0x00020000 134a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_CS0 0x00010000 135a8919371SHaikun.Wang@freescale.com 136a8919371SHaikun.Wang@freescale.com /* Transfer Fifo */ 137a8919371SHaikun.Wang@freescale.com #define DSPI_TFR_TXDATA(x) ((x) & 0x0000FFFF) 138a8919371SHaikun.Wang@freescale.com 139a8919371SHaikun.Wang@freescale.com /* Bit definitions and macros for DRFR */ 140a8919371SHaikun.Wang@freescale.com #define DSPI_RFR_RXDATA(x) ((x) & 0x0000FFFF) 141a8919371SHaikun.Wang@freescale.com 142a8919371SHaikun.Wang@freescale.com /* Bit definitions and macros for DTFDR group */ 143a8919371SHaikun.Wang@freescale.com #define DSPI_TFDR_TXDATA(x) ((x) & 0x0000FFFF) 144a8919371SHaikun.Wang@freescale.com #define DSPI_TFDR_TXCMD(x) (((x) & 0x0000FFFF) << 16) 145a8919371SHaikun.Wang@freescale.com 146a8919371SHaikun.Wang@freescale.com /* Bit definitions and macros for DRFDR group */ 147a8919371SHaikun.Wang@freescale.com #define DSPI_RFDR_RXDATA(x) ((x) & 0x0000FFFF) 148a8919371SHaikun.Wang@freescale.com 149a8919371SHaikun.Wang@freescale.com #endif /* _FSL_DSPI_H_ */ 150