xref: /openbmc/linux/include/soc/at91/sama7-ddr.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1d8c7983fSClaudiu Beznea /* SPDX-License-Identifier: GPL-2.0-only */
2d8c7983fSClaudiu Beznea /*
3d8c7983fSClaudiu Beznea  * Microchip SAMA7 UDDR Controller and DDR3 PHY Controller registers offsets
4d8c7983fSClaudiu Beznea  * and bit definitions.
5d8c7983fSClaudiu Beznea  *
6d8c7983fSClaudiu Beznea  * Copyright (C) [2020] Microchip Technology Inc. and its subsidiaries
7d8c7983fSClaudiu Beznea  *
8d8c7983fSClaudiu Beznea  * Author: Claudu Beznea <claudiu.beznea@microchip.com>
9d8c7983fSClaudiu Beznea  */
10d8c7983fSClaudiu Beznea 
11d8c7983fSClaudiu Beznea #ifndef __SAMA7_DDR_H__
12d8c7983fSClaudiu Beznea #define __SAMA7_DDR_H__
13d8c7983fSClaudiu Beznea 
14d8c7983fSClaudiu Beznea /* DDR3PHY */
15d8c7983fSClaudiu Beznea #define DDR3PHY_PIR				(0x04)		/* DDR3PHY PHY Initialization Register	*/
16d8c7983fSClaudiu Beznea #define	DDR3PHY_PIR_DLLBYP			(1 << 17)	/* DLL Bypass */
17d8c7983fSClaudiu Beznea #define		DDR3PHY_PIR_ITMSRST		(1 << 4)	/* Interface Timing Module Soft Reset */
18d8c7983fSClaudiu Beznea #define	DDR3PHY_PIR_DLLLOCK			(1 << 2)	/* DLL Lock */
19d8c7983fSClaudiu Beznea #define		DDR3PHY_PIR_DLLSRST		(1 << 1)	/* DLL Soft Rest */
20d8c7983fSClaudiu Beznea #define	DDR3PHY_PIR_INIT			(1 << 0)	/* Initialization Trigger */
21d8c7983fSClaudiu Beznea 
22d8c7983fSClaudiu Beznea #define DDR3PHY_PGCR				(0x08)		/* DDR3PHY PHY General Configuration Register */
23d8c7983fSClaudiu Beznea #define		DDR3PHY_PGCR_CKDV1		(1 << 13)	/* CK# Disable Value */
24d8c7983fSClaudiu Beznea #define		DDR3PHY_PGCR_CKDV0		(1 << 12)	/* CK Disable Value */
25d8c7983fSClaudiu Beznea 
26d8c7983fSClaudiu Beznea #define	DDR3PHY_PGSR				(0x0C)		/* DDR3PHY PHY General Status Register */
27d8c7983fSClaudiu Beznea #define		DDR3PHY_PGSR_IDONE		(1 << 0)	/* Initialization Done */
28d8c7983fSClaudiu Beznea 
29*cef8cdc0SClaudiu Beznea #define	DDR3PHY_ACDLLCR				(0x14)		/* DDR3PHY AC DLL Control Register */
30*cef8cdc0SClaudiu Beznea #define		DDR3PHY_ACDLLCR_DLLSRST		(1 << 30)	/* DLL Soft Reset */
31*cef8cdc0SClaudiu Beznea 
32d8c7983fSClaudiu Beznea #define DDR3PHY_ACIOCR				(0x24)		/* DDR3PHY AC I/O Configuration Register */
33d8c7983fSClaudiu Beznea #define		DDR3PHY_ACIOCR_CSPDD_CS0	(1 << 18)	/* CS#[0] Power Down Driver */
34d8c7983fSClaudiu Beznea #define		DDR3PHY_ACIOCR_CKPDD_CK0	(1 << 8)	/* CK[0] Power Down Driver */
35d8c7983fSClaudiu Beznea #define		DDR3PHY_ACIORC_ACPDD		(1 << 3)	/* AC Power Down Driver */
36d8c7983fSClaudiu Beznea 
37d8c7983fSClaudiu Beznea #define DDR3PHY_DXCCR				(0x28)		/* DDR3PHY DATX8 Common Configuration Register */
38d8c7983fSClaudiu Beznea #define		DDR3PHY_DXCCR_DXPDR		(1 << 3)	/* Data Power Down Receiver */
39d8c7983fSClaudiu Beznea 
40d8c7983fSClaudiu Beznea #define DDR3PHY_DSGCR				(0x2C)		/* DDR3PHY DDR System General Configuration Register */
41d8c7983fSClaudiu Beznea #define		DDR3PHY_DSGCR_ODTPDD_ODT0	(1 << 20)	/* ODT[0] Power Down Driver */
42d8c7983fSClaudiu Beznea 
43d8c7983fSClaudiu Beznea #define DDR3PHY_ZQ0SR0				(0x188)		/* ZQ status register 0 */
447a94b83aSClaudiu Beznea #define DDR3PHY_ZQ0SR0_PDO_OFF			(0)		/* Pull-down output impedance select offset */
457a94b83aSClaudiu Beznea #define DDR3PHY_ZQ0SR0_PUO_OFF			(5)		/* Pull-up output impedance select offset */
467a94b83aSClaudiu Beznea #define DDR3PHY_ZQ0SR0_PDODT_OFF		(10)		/* Pull-down on-die termination impedance select offset */
477a94b83aSClaudiu Beznea #define DDR3PHY_ZQ0SRO_PUODT_OFF		(15)		/* Pull-up on-die termination impedance select offset */
48d8c7983fSClaudiu Beznea 
49a02875c4SClaudiu Beznea #define	DDR3PHY_DX0DLLCR			(0x1CC)		/* DDR3PHY DATX8 DLL Control Register */
50a02875c4SClaudiu Beznea #define	DDR3PHY_DX1DLLCR			(0x20C)		/* DDR3PHY DATX8 DLL Control Register */
51a02875c4SClaudiu Beznea #define		DDR3PHY_DXDLLCR_DLLDIS		(1 << 31)	/* DLL Disable */
52a02875c4SClaudiu Beznea 
53d8c7983fSClaudiu Beznea /* UDDRC */
54d8c7983fSClaudiu Beznea #define UDDRC_STAT				(0x04)		/* UDDRC Operating Mode Status Register */
55d8c7983fSClaudiu Beznea #define		UDDRC_STAT_SELFREF_TYPE_DIS	(0x0 << 4)	/* SDRAM is not in Self-refresh */
56d8c7983fSClaudiu Beznea #define		UDDRC_STAT_SELFREF_TYPE_PHY	(0x1 << 4)	/* SDRAM is in Self-refresh, which was caused by PHY Master Request */
57d8c7983fSClaudiu Beznea #define		UDDRC_STAT_SELFREF_TYPE_SW	(0x2 << 4)	/* SDRAM is in Self-refresh, which was not caused solely under Automatic Self-refresh control */
58d8c7983fSClaudiu Beznea #define		UDDRC_STAT_SELFREF_TYPE_AUTO	(0x3 << 4)	/* SDRAM is in Self-refresh, which was caused by Automatic Self-refresh only */
59d8c7983fSClaudiu Beznea #define		UDDRC_STAT_SELFREF_TYPE_MSK	(0x3 << 4)	/* Self-refresh type mask */
60d8c7983fSClaudiu Beznea #define		UDDRC_STAT_OPMODE_INIT		(0x0 << 0)	/* Init */
61d8c7983fSClaudiu Beznea #define		UDDRC_STAT_OPMODE_NORMAL	(0x1 << 0)	/* Normal */
62d8c7983fSClaudiu Beznea #define		UDDRC_STAT_OPMODE_PWRDOWN	(0x2 << 0)	/* Power-down */
63d8c7983fSClaudiu Beznea #define		UDDRC_STAT_OPMODE_SELF_REFRESH	(0x3 << 0)	/* Self-refresh */
64d8c7983fSClaudiu Beznea #define		UDDRC_STAT_OPMODE_MSK		(0x7 << 0)	/* Operating mode mask */
65d8c7983fSClaudiu Beznea 
66d8c7983fSClaudiu Beznea #define UDDRC_PWRCTL				(0x30)		/* UDDRC Low Power Control Register */
679584e726SClaudiu Beznea #define		UDDRC_PWRCTL_SELFREF_EN		(1 << 0)	/* Automatic self-refresh */
689a0775c9SClaudiu Beznea #define		UDDRC_PWRCTL_SELFREF_SW		(1 << 5)	/* Software self-refresh */
69d8c7983fSClaudiu Beznea 
70d8c7983fSClaudiu Beznea #define UDDRC_DFIMISC				(0x1B0)		/* UDDRC DFI Miscellaneous Control Register */
71d8c7983fSClaudiu Beznea #define		UDDRC_DFIMISC_DFI_INIT_COMPLETE_EN (1 << 0)	/* PHY initialization complete enable signal */
72d8c7983fSClaudiu Beznea 
73d8c7983fSClaudiu Beznea #define UDDRC_SWCTRL				(0x320)		/* UDDRC Software Register Programming Control Enable */
74d8c7983fSClaudiu Beznea #define		UDDRC_SWCTRL_SW_DONE		(1 << 0)	/* Enable quasi-dynamic register programming outside reset */
75d8c7983fSClaudiu Beznea 
76d8c7983fSClaudiu Beznea #define UDDRC_SWSTAT				(0x324)		/* UDDRC Software Register Programming Control Status */
77d8c7983fSClaudiu Beznea #define		UDDRC_SWSTAT_SW_DONE_ACK	(1 << 0)	/* Register programming done */
78d8c7983fSClaudiu Beznea 
79d8c7983fSClaudiu Beznea #define UDDRC_PSTAT				(0x3FC)		/* UDDRC Port Status Register */
80d8c7983fSClaudiu Beznea #define	UDDRC_PSTAT_ALL_PORTS			(0x1F001F)	/* Read + writes outstanding transactions on all ports */
81d8c7983fSClaudiu Beznea 
82d8c7983fSClaudiu Beznea #define UDDRC_PCTRL_0				(0x490)		/* UDDRC Port 0 Control Register */
83d8c7983fSClaudiu Beznea #define UDDRC_PCTRL_1				(0x540)		/* UDDRC Port 1 Control Register */
84d8c7983fSClaudiu Beznea #define UDDRC_PCTRL_2				(0x5F0)		/* UDDRC Port 2 Control Register */
85d8c7983fSClaudiu Beznea #define UDDRC_PCTRL_3				(0x6A0)		/* UDDRC Port 3 Control Register */
86d8c7983fSClaudiu Beznea #define UDDRC_PCTRL_4				(0x750)		/* UDDRC Port 4 Control Register */
87d8c7983fSClaudiu Beznea 
88d8c7983fSClaudiu Beznea #endif /* __SAMA7_DDR_H__ */
89