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