imxcspireg.h revision 1.3 1 1.3 andvar /* $NetBSD: imxcspireg.h,v 1.3 2023/08/01 21:26:27 andvar Exp $ */
2 1.1 hkenken
3 1.1 hkenken /*
4 1.1 hkenken * Copyright (c) 2014 Genetec Corporation. All rights reserved.
5 1.1 hkenken * Written by Hashimoto Kenichi for Genetec Corporation.
6 1.1 hkenken *
7 1.1 hkenken * Redistribution and use in source and binary forms, with or without
8 1.1 hkenken * modification, are permitted provided that the following conditions
9 1.1 hkenken * are met:
10 1.1 hkenken * 1. Redistributions of source code must retain the above copyright
11 1.1 hkenken * notice, this list of conditions and the following disclaimer.
12 1.1 hkenken * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 hkenken * notice, this list of conditions and the following disclaimer in the
14 1.1 hkenken * documentation and/or other materials provided with the distribution.
15 1.1 hkenken *
16 1.1 hkenken * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
17 1.1 hkenken * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1 hkenken * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1 hkenken * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
20 1.1 hkenken * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.1 hkenken * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.1 hkenken * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.1 hkenken * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.1 hkenken * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.1 hkenken * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.1 hkenken * POSSIBILITY OF SUCH DAMAGE.
27 1.1 hkenken */
28 1.1 hkenken
29 1.1 hkenken #ifndef _ARM_IMX_IMXCSPIREG_H_
30 1.1 hkenken #define _ARM_IMX_IMXCSPIREG_H_
31 1.1 hkenken
32 1.1 hkenken #define CSPI_RXDATA 0x00
33 1.1 hkenken #define CSPI_TXDATA 0x04
34 1.1 hkenken #define CSPI_CONREG 0x08
35 1.2 hkenken #define CSPI_IMX31_CON_CS __BITS(25, 24)
36 1.2 hkenken #define CSPI_IMX31_CON_DRCTL __BITS(21, 20)
37 1.2 hkenken #define CSPI_IMX31_CON_BITCOUNT __BITS(12, 8)
38 1.2 hkenken #define CSPI_IMX35_CON_CS __BITS(13, 12)
39 1.2 hkenken #define CSPI_IMX35_CON_DRCTL __BITS( 9, 8)
40 1.2 hkenken #define CSPI_IMX35_CON_BITCOUNT __BITS(31, 20)
41 1.1 hkenken #define CSPI_CON_DIV __BITS(18, 16)
42 1.1 hkenken #define CSPI_CON_SSPOL __BIT(7) /* SPI SS Polarity Select */
43 1.1 hkenken #define CSPI_CON_SSCTL __BIT(6) /* In master mode, this bit
44 1.1 hkenken * selects the output wave form
45 1.1 hkenken * for the SS signal.
46 1.1 hkenken */
47 1.1 hkenken #define CSPI_CON_PHA __BIT(5) /* PHA */
48 1.1 hkenken #define CSPI_CON_POL __BIT(4) /* POL */
49 1.1 hkenken #define CSPI_CON_SMC __BIT(3) /* SMC */
50 1.1 hkenken #define CSPI_CON_XCH __BIT(2) /* XCH */
51 1.1 hkenken #define CSPI_CON_MODE __BIT(1) /* MODE */
52 1.1 hkenken #define CSPI_CON_ENABLE __BIT(0) /* EN */
53 1.1 hkenken #define CSPI_INTREG 0x0c
54 1.3 andvar #define CSPI_INTR_ALL_EN 0x000001ff /* All Interrupts Enabled */
55 1.2 hkenken #define CSPI_IMX31_INTR_TC_EN __BIT(8) /* TX Complete */
56 1.2 hkenken #define CSPI_IMX31_INTR_BO_EN __BIT(7) /* Bit Counter Overflow */
57 1.2 hkenken #define CSPI_IMX35_INTR_TC_EN __BIT(7) /* TX Complete */
58 1.1 hkenken #define CSPI_INTR_RO_EN __BIT(6) /* RXFIFO Overflow */
59 1.1 hkenken #define CSPI_INTR_RF_EN __BIT(5) /* RXFIFO Full */
60 1.1 hkenken #define CSPI_INTR_RH_EN __BIT(4) /* RXFIFO Half Full */
61 1.1 hkenken #define CSPI_INTR_RR_EN __BIT(3) /* RXFIFO Ready */
62 1.1 hkenken #define CSPI_INTR_TF_EN __BIT(2) /* TXFIFO Full */
63 1.1 hkenken #define CSPI_INTR_TH_EN __BIT(1) /* TXFIFO Half Empty */
64 1.1 hkenken #define CSPI_INTR_TE_EN __BIT(0) /* TXFIFO Empty */
65 1.1 hkenken #define CSPI_DMAREG 0x10
66 1.1 hkenken #define CSPI_STATREG 0x14
67 1.2 hkenken #define CSPI_IMX31_STAT_CLR_TC __BIT(8) /* Clear TC of status register */
68 1.2 hkenken #define CSPI_IMX31_STAT_CLR_BO __BIT(7) /* Clear BO of status register */
69 1.2 hkenken #define CSPI_IMX31_STAT_CLR (CSPI_IMX31_STAT_CLR_TC | CSPI_IMX31_STAT_CLR_BO)
70 1.2 hkenken #define CSPI_IMX35_STAT_CLR_TC __BIT(7) /* Clear TC of status register */
71 1.2 hkenken #define CSPI_IMX35_STAT_CLR CSPI_IMX35_STAT_CLR_TC
72 1.1 hkenken #define CSPI_STAT_RO __BIT(6) /* RXFIFO Overflow */
73 1.1 hkenken #define CSPI_STAT_RF __BIT(5) /* RXFIFO Full */
74 1.1 hkenken #define CSPI_STAT_RH __BIT(4) /* RXFIFO Half Full */
75 1.1 hkenken #define CSPI_STAT_RR __BIT(3) /* RXFIFO Ready */
76 1.1 hkenken #define CSPI_STAT_TF __BIT(2) /* TXFIFO Full */
77 1.1 hkenken #define CSPI_STAT_TH __BIT(1) /* TXFIFO Half Empty */
78 1.1 hkenken #define CSPI_STAT_TE __BIT(0) /* TXFIFO Empty */
79 1.1 hkenken #define CSPI_PERIODREG 0x18
80 1.1 hkenken #define CSPI_TESTREG 0x1c
81 1.1 hkenken
82 1.1 hkenken #define SPI_SIZE 0x100
83 1.1 hkenken
84 1.1 hkenken #endif /* _ARM_IMX_IMXCSPIREG_H_ */
85