blob: 071ec4f26600c68497e44305509097276d5250fd [file] [log] [blame]
Chin Liang See70fa4e72013-09-11 11:24:48 -05001/*
Marek Vasut61412722014-09-08 14:08:45 +02002 * Copyright (C) 2013 Altera Corporation <www.altera.com>
Chin Liang See70fa4e72013-09-11 11:24:48 -05003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef _SYSTEM_MANAGER_H_
8#define _SYSTEM_MANAGER_H_
9
10#ifndef __ASSEMBLY__
11
12void sysmgr_pinmux_init(void);
13
14/* declaration for handoff table type */
15extern unsigned long sys_mgr_init_table[CONFIG_HPS_PINMUX_NUM];
16
17#endif
18
Chin Liang Seecca9f452013-12-30 18:26:14 -060019struct socfpga_system_manager {
Marek Vasut61412722014-09-08 14:08:45 +020020 /* System Manager Module */
21 u32 siliconid1; /* 0x00 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060022 u32 siliconid2;
23 u32 _pad_0x8_0xf[2];
Marek Vasut61412722014-09-08 14:08:45 +020024 u32 wddbg; /* 0x10 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060025 u32 bootinfo;
26 u32 hpsinfo;
27 u32 parityinj;
Marek Vasut61412722014-09-08 14:08:45 +020028 /* FPGA Interface Group */
29 u32 fpgaintfgrp_gbl; /* 0x20 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060030 u32 fpgaintfgrp_indiv;
31 u32 fpgaintfgrp_module;
32 u32 _pad_0x2c_0x2f;
Marek Vasut61412722014-09-08 14:08:45 +020033 /* Scan Manager Group */
34 u32 scanmgrgrp_ctrl; /* 0x30 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060035 u32 _pad_0x34_0x3f[3];
Marek Vasut61412722014-09-08 14:08:45 +020036 /* Freeze Control Group */
37 u32 frzctrl_vioctrl; /* 0x40 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060038 u32 _pad_0x44_0x4f[3];
Marek Vasut61412722014-09-08 14:08:45 +020039 u32 frzctrl_hioctrl; /* 0x50 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060040 u32 frzctrl_src;
41 u32 frzctrl_hwctrl;
42 u32 _pad_0x5c_0x5f;
Marek Vasut61412722014-09-08 14:08:45 +020043 /* EMAC Group */
44 u32 emacgrp_ctrl; /* 0x60 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060045 u32 emacgrp_l3master;
46 u32 _pad_0x68_0x6f[2];
Marek Vasut61412722014-09-08 14:08:45 +020047 /* DMA Controller Group */
48 u32 dmagrp_ctrl; /* 0x70 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060049 u32 dmagrp_persecurity;
50 u32 _pad_0x78_0x7f[2];
Marek Vasut61412722014-09-08 14:08:45 +020051 /* Preloader (initial software) Group */
52 u32 iswgrp_handoff[8]; /* 0x80 */
53 u32 _pad_0xa0_0xbf[8]; /* 0xa0 */
54 /* Boot ROM Code Register Group */
55 u32 romcodegrp_ctrl; /* 0xc0 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060056 u32 romcodegrp_cpu1startaddr;
57 u32 romcodegrp_initswstate;
58 u32 romcodegrp_initswlastld;
Marek Vasut61412722014-09-08 14:08:45 +020059 u32 romcodegrp_bootromswstate; /* 0xd0 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060060 u32 __pad_0xd4_0xdf[3];
Marek Vasut61412722014-09-08 14:08:45 +020061 /* Warm Boot from On-Chip RAM Group */
62 u32 romcodegrp_warmramgrp_enable; /* 0xe0 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060063 u32 romcodegrp_warmramgrp_datastart;
64 u32 romcodegrp_warmramgrp_length;
65 u32 romcodegrp_warmramgrp_execution;
Marek Vasut61412722014-09-08 14:08:45 +020066 u32 romcodegrp_warmramgrp_crc; /* 0xf0 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060067 u32 __pad_0xf4_0xff[3];
Marek Vasut61412722014-09-08 14:08:45 +020068 /* Boot ROM Hardware Register Group */
69 u32 romhwgrp_ctrl; /* 0x100 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060070 u32 _pad_0x104_0x107;
Marek Vasut61412722014-09-08 14:08:45 +020071 /* SDMMC Controller Group */
Chin Liang Seecca9f452013-12-30 18:26:14 -060072 u32 sdmmcgrp_ctrl;
73 u32 sdmmcgrp_l3master;
Marek Vasut61412722014-09-08 14:08:45 +020074 /* NAND Flash Controller Register Group */
75 u32 nandgrp_bootstrap; /* 0x110 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060076 u32 nandgrp_l3master;
Marek Vasut61412722014-09-08 14:08:45 +020077 /* USB Controller Group */
Chin Liang Seecca9f452013-12-30 18:26:14 -060078 u32 usbgrp_l3master;
79 u32 _pad_0x11c_0x13f[9];
Marek Vasut61412722014-09-08 14:08:45 +020080 /* ECC Management Register Group */
81 u32 eccgrp_l2; /* 0x140 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060082 u32 eccgrp_ocram;
83 u32 eccgrp_usb0;
84 u32 eccgrp_usb1;
Marek Vasut61412722014-09-08 14:08:45 +020085 u32 eccgrp_emac0; /* 0x150 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060086 u32 eccgrp_emac1;
87 u32 eccgrp_dma;
88 u32 eccgrp_can0;
Marek Vasut61412722014-09-08 14:08:45 +020089 u32 eccgrp_can1; /* 0x160 */
Chin Liang Seecca9f452013-12-30 18:26:14 -060090 u32 eccgrp_nand;
91 u32 eccgrp_qspi;
92 u32 eccgrp_sdmmc;
Marek Vasut61412722014-09-08 14:08:45 +020093 u32 _pad_0x170_0x3ff[164];
94 /* Pin Mux Control Group */
95 u32 emacio[20]; /* 0x400 */
96 u32 flashio[12]; /* 0x450 */
97 u32 generalio[28]; /* 0x480 */
98 u32 _pad_0x4f0_0x4ff[4];
99 u32 mixed1io[22]; /* 0x500 */
100 u32 mixed2io[8]; /* 0x558 */
101 u32 gplinmux[23]; /* 0x578 */
102 u32 gplmux[71]; /* 0x5d4 */
103 u32 nandusefpga; /* 0x6f0 */
104 u32 _pad_0x6f4;
105 u32 rgmii1usefpga; /* 0x6f8 */
106 u32 _pad_0x6fc_0x700[2];
107 u32 i2c0usefpga; /* 0x704 */
108 u32 sdmmcusefpga; /* 0x708 */
109 u32 _pad_0x70c_0x710[2];
110 u32 rgmii0usefpga; /* 0x714 */
111 u32 _pad_0x718_0x720[3];
112 u32 i2c3usefpga; /* 0x724 */
113 u32 i2c2usefpga; /* 0x728 */
114 u32 i2c1usefpga; /* 0x72c */
115 u32 spim1usefpga; /* 0x730 */
116 u32 _pad_0x734;
117 u32 spim0usefpga; /* 0x738 */
Chin Liang Seecca9f452013-12-30 18:26:14 -0600118};
119
Marek Vasut61412722014-09-08 14:08:45 +0200120#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX (1 << 0)
121#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO (1 << 1)
122#define SYSMGR_ECC_OCRAM_EN (1 << 0)
123#define SYSMGR_ECC_OCRAM_SERR (1 << 3)
124#define SYSMGR_ECC_OCRAM_DERR (1 << 4)
125#define SYSMGR_FPGAINTF_USEFPGA 0x1
126#define SYSMGR_FPGAINTF_SPIM0 (1 << 0)
127#define SYSMGR_FPGAINTF_SPIM1 (1 << 1)
128#define SYSMGR_FPGAINTF_EMAC0 (1 << 2)
129#define SYSMGR_FPGAINTF_EMAC1 (1 << 3)
130#define SYSMGR_FPGAINTF_NAND (1 << 4)
131#define SYSMGR_FPGAINTF_SDMMC (1 << 5)
132
133/* FIXME: This is questionable macro. */
134#define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
135 ((((drvsel) << 0) & 0x7) | (((smplsel) << 3) & 0x38))
136
Pavel Machek57d75eb2014-09-08 14:08:45 +0200137/* EMAC Group Bit definitions */
138#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII 0x0
139#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII 0x1
140#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII 0x2
141
142#define SYSMGR_EMACGRP_CTRL_PHYSEL0_LSB 0
143#define SYSMGR_EMACGRP_CTRL_PHYSEL1_LSB 2
144#define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK 0x3
145
Chin Liang See70fa4e72013-09-11 11:24:48 -0500146#endif /* _SYSTEM_MANAGER_H_ */