Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/storage/sdmmc_t210.h
1476 views
1
/*
2
* Copyright (c) 2018 naehrwert
3
* Copyright (c) 2018-2025 CTCaer
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms and conditions of the GNU General Public License,
7
* version 2, as published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef _SDMMC_T210_H_
19
#define _SDMMC_T210_H_
20
21
#include <assert.h>
22
#include <utils/types.h>
23
24
#define SDHCI_TEGRA_TUNING_TAP_HW_UPDATED BIT(17)
25
#define SDHCI_TEGRA_DLLCAL_CALIBRATE BIT(31)
26
#define SDHCI_TEGRA_DLLCAL_ACTIVE BIT(31)
27
#define SDHCI_TEGRA_PADCTRL_E_INPUT_PWRD BIT(31)
28
#define SDHCI_TEGRA_PADCTRL_VREF_SEL_MASK 0xF
29
#define SDHCI_TEGRA_AUTOCAL_SLW_OVERRIDE BIT(28)
30
#define SDHCI_TEGRA_AUTOCAL_ENABLE BIT(29)
31
#define SDHCI_TEGRA_AUTOCAL_START BIT(31)
32
#define SDHCI_TEGRA_AUTOCAL_ACTIVE BIT(31)
33
34
typedef struct _t210_sdmmc_t
35
{
36
/* 0x00 */ vu32 sysad; // sdma system address.
37
/* 0x04 */ vu16 blksize;
38
/* 0x06 */ vu16 blkcnt;
39
/* 0x08 */ vu32 argument;
40
/* 0x0C */ vu16 trnmod;
41
/* 0x0E */ vu16 cmdreg;
42
/* 0x10 */ vu32 rspreg[4];
43
/* 0x20 */ vu32 bdata; // Buffer data port.
44
/* 0x24 */ vu32 prnsts;
45
/* 0x28 */ vu8 hostctl;
46
/* 0x29 */ vu8 pwrcon;
47
/* 0x2A */ vu8 blkgap;
48
/* 0x2B */ vu8 wakcon;
49
/* 0x2C */ vu16 clkcon;
50
/* 0x2E */ vu8 timeoutcon;
51
/* 0x2F */ vu8 swrst;
52
/* 0x30 */ vu16 norintsts; // Normal interrupt status.
53
/* 0x32 */ vu16 errintsts; // Error interrupt status.
54
/* 0x34 */ vu16 norintstsen; // Enable irq status.
55
/* 0x36 */ vu16 errintstsen; // Enable irq status.
56
/* 0x38 */ vu16 norintsigen; // Enable irq signal to LIC/GIC.
57
/* 0x3A */ vu16 errintsigen; // Enable irq signal to LIC/GIC.
58
/* 0x3C */ vu16 acmd12errsts;
59
/* 0x3E */ vu16 hostctl2;
60
61
// CAP0: 0x376CD08C.
62
// 12 MHz timeout clock. 208 MHz max base clock. 512B max block length. 8-bit support.
63
// ADMA2 support. HS25 support. SDMA support. No suspend/resume support. 3.3/3.0/1.8V support.
64
// 64bit addressing for V3/V4 support. Async IRQ support. All report as removable.
65
/* 0x40 */ vu32 capareg;
66
// CAP1: 0x10002F73.
67
// SDR50/SDR104 support. No DDR50 support. Drive A/B/C/D support.
68
// Timer re-tuning info from other source. SDR50 requires re-tuning.
69
// Tuning uses timer and transfers should be 4MB limited.
70
// ADMA3 not supported. 1.8V VDD2 supported.
71
/* 0x44 */ vu32 capareg_hi;
72
73
/* 0x48 */ vu32 maxcurr; // Get information by another method. Can be overriden via maxcurrover and maxcurrover_hi.
74
/* 0x4C */ vu32 maxcurr_hi;
75
/* 0x50 */ vu16 setacmd12err; // Force error in acmd12errsts.
76
/* 0x52 */ vu16 setinterr;
77
/* 0x54 */ vu8 admaerr;
78
/* 0x55 */ vu8 rsvd1[3]; // 55-57 reserved.
79
/* 0x58 */ vu32 admaaddr;
80
/* 0x5C */ vu32 admaaddr_hi;
81
/* 0x60 */ vu16 presets[11];
82
/* 0x76 */ vu16 rsvd2;
83
/* 0x78 */ vu32 adma3addr;
84
/* 0x7C */ vu32 adma3addr_hi;
85
/* 0x80 */ vu8 uhs2[124]; // 80-FB UHS-II.
86
/* 0xFC */ vu16 slotintsts;
87
/* 0xFE */ vu16 hcver; // 0x303 (4.00).
88
89
/* UHS-II range. Used for Vendor registers here */
90
/* 0x100 */ vu32 venclkctl;
91
/* 0x104 */ vu32 vensysswctl;
92
/* 0x108 */ vu32 venerrintsts;
93
/* 0x10C */ vu32 vencapover;
94
/* 0x110 */ vu32 venbootctl;
95
/* 0x114 */ vu32 venbootacktout;
96
/* 0x118 */ vu32 venbootdattout;
97
/* 0x11C */ vu32 vendebouncecnt;
98
/* 0x120 */ vu32 venmiscctl;
99
/* 0x124 */ vu32 maxcurrover;
100
/* 0x128 */ vu32 maxcurrover_hi;
101
/* 0x12C */ vu32 unk0[32]; // 0x12C
102
/* 0x1AC */ vu32 veniotrimctl;
103
/* 0x1B0 */ vu32 vendllcalcfg;
104
/* 0x1B4 */ vu32 vendllctl0;
105
/* 0x1B8 */ vu32 vendllctl1;
106
/* 0x1BC */ vu32 vendllcalcfgsts;
107
/* 0x1C0 */ vu32 ventunctl0;
108
/* 0x1C4 */ vu32 ventunctl1;
109
/* 0x1C8 */ vu32 ventunsts0;
110
/* 0x1CC */ vu32 ventunsts1;
111
/* 0x1D0 */ vu32 venclkgatehystcnt;
112
/* 0x1D4 */ vu32 venpresetval0;
113
/* 0x1D8 */ vu32 venpresetval1;
114
/* 0x1DC */ vu32 venpresetval2;
115
/* 0x1E0 */ vu32 sdmemcmppadctl;
116
/* 0x1E4 */ vu32 autocalcfg;
117
/* 0x1E8 */ vu32 autocalintval;
118
/* 0x1EC */ vu32 autocalsts;
119
/* 0x1F0 */ vu32 iospare;
120
/* 0x1F4 */ vu32 mcciffifoctl;
121
/* 0x1F8 */ vu32 timeoutwcoal;
122
} t210_sdmmc_t;
123
124
static_assert(sizeof(t210_sdmmc_t) == 0x1FC, "T210 SDMMC REG size is wrong!");
125
126
#endif
127
128