xref: /openbmc/u-boot/arch/arm/mach-at91/include/mach/sama5d3_smc.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
2af930827SMasahiro Yamada /*
3af930827SMasahiro Yamada  * Copyright (C) 2012 Atmel Corporation.
4af930827SMasahiro Yamada  *
5af930827SMasahiro Yamada  * Static Memory Controllers (SMC) - System peripherals registers.
6af930827SMasahiro Yamada  * Based on SAMA5D3 datasheet.
7af930827SMasahiro Yamada  */
8af930827SMasahiro Yamada 
9af930827SMasahiro Yamada #ifndef SAMA5D3_SMC_H
10af930827SMasahiro Yamada #define SAMA5D3_SMC_H
11af930827SMasahiro Yamada 
12af930827SMasahiro Yamada #ifdef __ASSEMBLY__
13af930827SMasahiro Yamada #define AT91_ASM_SMC_SETUP0	(ATMEL_BASE_SMC + 0x600)
14af930827SMasahiro Yamada #define AT91_ASM_SMC_PULSE0	(ATMEL_BASE_SMC + 0x604)
15af930827SMasahiro Yamada #define AT91_ASM_SMC_CYCLE0	(ATMEL_BASE_SMC + 0x608)
16af930827SMasahiro Yamada #define AT91_ASM_SMC_TIMINGS0	(ATMEL_BASE_SMC + 0x60c)
17af930827SMasahiro Yamada #define AT91_ASM_SMC_MODE0	(ATMEL_BASE_SMC + 0x610)
18af930827SMasahiro Yamada #else
19af930827SMasahiro Yamada struct at91_cs {
20af930827SMasahiro Yamada 	u32	setup;		/* 0x600 SMC Setup Register */
21af930827SMasahiro Yamada 	u32	pulse;		/* 0x604 SMC Pulse Register */
22af930827SMasahiro Yamada 	u32	cycle;		/* 0x608 SMC Cycle Register */
23af930827SMasahiro Yamada 	u32	timings;	/* 0x60C SMC Cycle Register */
24af930827SMasahiro Yamada 	u32	mode;		/* 0x610 SMC Mode Register */
25af930827SMasahiro Yamada };
26af930827SMasahiro Yamada 
27af930827SMasahiro Yamada struct at91_smc {
28af930827SMasahiro Yamada 	u32 reserved[384];
29af930827SMasahiro Yamada 	struct at91_cs cs[4];
30af930827SMasahiro Yamada };
31af930827SMasahiro Yamada #endif /*  __ASSEMBLY__ */
32af930827SMasahiro Yamada 
33af930827SMasahiro Yamada #define AT91_SMC_SETUP_NWE(x)		(x & 0x3f)
34af930827SMasahiro Yamada #define AT91_SMC_SETUP_NCS_WR(x)	((x & 0x3f) << 8)
35af930827SMasahiro Yamada #define AT91_SMC_SETUP_NRD(x)		((x & 0x3f) << 16)
36af930827SMasahiro Yamada #define AT91_SMC_SETUP_NCS_RD(x)	((x & 0x3f) << 24)
37af930827SMasahiro Yamada 
38af930827SMasahiro Yamada #define AT91_SMC_PULSE_NWE(x)		(x & 0x3f)
39af930827SMasahiro Yamada #define AT91_SMC_PULSE_NCS_WR(x)	((x & 0x3f) << 8)
40af930827SMasahiro Yamada #define AT91_SMC_PULSE_NRD(x)		((x & 0x3f) << 16)
41af930827SMasahiro Yamada #define AT91_SMC_PULSE_NCS_RD(x)	((x & 0x3f) << 24)
42af930827SMasahiro Yamada 
43af930827SMasahiro Yamada #define AT91_SMC_CYCLE_NWE(x)		(x & 0x1ff)
44af930827SMasahiro Yamada #define AT91_SMC_CYCLE_NRD(x)		((x & 0x1ff) << 16)
45af930827SMasahiro Yamada 
46af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_TCLR(x)	(x & 0xf)
47af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_TADL(x)	((x & 0xf) << 4)
48af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_TAR(x)		((x & 0xf) << 8)
49af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_OCMS(x)	((x & 0x1) << 12)
50af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_TRR(x)		((x & 0xf) << 16)
51af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_TWB(x)		((x & 0xf) << 24)
52af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_RBNSEL(x)	((x & 0xf) << 28)
53af930827SMasahiro Yamada #define AT91_SMC_TIMINGS_NFSEL(x)	((x & 0x1) << 31)
54af930827SMasahiro Yamada 
55af930827SMasahiro Yamada #define AT91_SMC_MODE_RM_NCS		0x00000000
56af930827SMasahiro Yamada #define AT91_SMC_MODE_RM_NRD		0x00000001
57af930827SMasahiro Yamada #define AT91_SMC_MODE_WM_NCS		0x00000000
58af930827SMasahiro Yamada #define AT91_SMC_MODE_WM_NWE		0x00000002
59af930827SMasahiro Yamada 
60af930827SMasahiro Yamada #define AT91_SMC_MODE_EXNW_DISABLE	0x00000000
61af930827SMasahiro Yamada #define AT91_SMC_MODE_EXNW_FROZEN	0x00000020
62af930827SMasahiro Yamada #define AT91_SMC_MODE_EXNW_READY	0x00000030
63af930827SMasahiro Yamada 
64af930827SMasahiro Yamada #define AT91_SMC_MODE_BAT		0x00000100
65af930827SMasahiro Yamada #define AT91_SMC_MODE_DBW_8		0x00000000
66af930827SMasahiro Yamada #define AT91_SMC_MODE_DBW_16		0x00001000
67af930827SMasahiro Yamada #define AT91_SMC_MODE_DBW_32		0x00002000
68af930827SMasahiro Yamada #define AT91_SMC_MODE_TDF_CYCLE(x)	((x & 0xf) << 16)
69af930827SMasahiro Yamada #define AT91_SMC_MODE_TDF		0x00100000
70af930827SMasahiro Yamada #define AT91_SMC_MODE_PMEN		0x01000000
71af930827SMasahiro Yamada #define AT91_SMC_MODE_PS_4		0x00000000
72af930827SMasahiro Yamada #define AT91_SMC_MODE_PS_8		0x10000000
73af930827SMasahiro Yamada #define AT91_SMC_MODE_PS_16		0x20000000
74af930827SMasahiro Yamada #define AT91_SMC_MODE_PS_32		0x30000000
75af930827SMasahiro Yamada 
76af930827SMasahiro Yamada #endif
77