#defineSDHCI_VNDR_TUN_CTRL0_00java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 # SDHCI_VNDR_TUN_CTRL0_TUN_HW_TAP0java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
0x03fc0000 #define java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 40 #define#efineSDHCI_CLOCK_CTRL_PADPIPE_CLKEN_OVERRIDE() #define SDHCI_VNDR_TUN_CTRL0_MUL_M_SHIFT 6
# (31 x10c 0 # TRIES_128 java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 # TRIES_256 4 #define SDHCI_VNDR_TUN_CTRL0_TUN_WORD_SEL_MASK 0x7
#define SDHCI_TEGRA_AUTO_CAL_CONFIG 0x1e4 #define SDHCI_TEGRA_VENDOR_DLLCAL_CFG 0x1b0 #define SDHCI_AUTO_CAL_ENABLE BIT(29) #define SDHCI_AUTO_CAL_PDPU_OFFSET_MASK 0java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #define SDHCI_TEGRA_SDMEM_COMP_PADCTRL_VREF_SEL_MASKSDHCI_TEGRA_DLLCAL_STA_ACTIVEBIT1 #defineSDHCI_TEGRA_SDMEM_COMP_PADCTRL_VREF_SEL_VAL # SDHCI_TEGRA_SDMEM_COMP_PADCTRL_E_INPUT_E_PWRD(3)
0x07FFF000
#define NVQUIRK_FORCE_SDHCI_SPEC_200# SDHCI_VNDR_TUN_CTRL0_MUL_M_SHIFT #define NVQUIRK_ENABLE_BLOCK_GAP_DET BIT(1) #define NVQUIRK_ENABLE_SDHCI_SPEC_300 BIT(2) #define NVQUIRK_ENABLE_SDR50 BIT) #define NVQUIRK_ENABLE_SDR104 TRIES_128 java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 #define NVQUIRK_ENABLE_DDR50 /* * HAS_PADCALIB NVQUIRK is for SoC's supporting auto calibration of pads * drive strength.
*/ #define NVQUIRK_HAS_PADCALIB # SDHCI_TEGRA_VNDR_TUN_STATUS1x1CC /* * NEEDS_PAD_CONTROL NVQUIRK is for SoC's having separate 3V3 and 1V8 pads. * 3V3/1V8 pad selection happens through pinctrl state selection depending * on the signaling mode.
*/ #define NVQUIRK_NEEDS_PAD_CONTROL BIT(7) #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8) ## SDHCI_TEGRA_AUTO_CAL_CONFIG01java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
/* * NVQUIRK_HAS_TMCLK is for SoC's having separate timeout clock for Tegra * SDMMC hardware data timeout.
*/ ## SDHCI_TEGRA_SDMEM_COMP_PADCTRL_VREF_SEL_MASK x0000000f
/* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */# SDHCI_COMP_PADCTRL_DRVUPDN_OFFSET_MASK # SDHCI_TEGRA_CQE_BASE_ADDR0java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
#define SDHCI_TEGRA_CQE_TRNS_MODEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
|
#define NVQUIRK_ENAB ()
struct (4java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 conststruct sdhci_pltfm_data *pdata;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32 * NEEDS_PAD_CONTROL NVQUIRK is for * 3V3/1V8 pad selection happens through * on the signaling
u8;
u8 max_tap_delaydefine BITjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
};
/* Magic pull up and pull down pad calibration offsets */ struct sdhci_tegra_autocal_offsets
ll_up_3v3java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
*SDMMC Address TegraHost 4 Higher
u32 pull_up_3v3_timeout;
u32 xF000
u32 SDHCI_TEGRA_CQE_TRNS_MODESDHCI_TRNS_MULTI\
u32 pull_down_1v8;
u32 pull_up_1v8_timeout;
u32 SDHCI_TRNS_BLK_CNT_EN\
u2pull_up_sdr104
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32;
dma_mask
};
struct reset_control *rst;
u32; structu32pull_down_3v3java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 struct pinctrl_statepinctrl_state_1v8 structpinctrl_statepinctrl_state_3v3_drv; struct pinctrl_state *pinctrl_state_1v8_drv;
static u16 tegra_sdhci_readw(struct sdhci_host *host, int truct *tmclk;
{
sdhci_pltfm_host*ltfm_host = sdhci_priv(ost struct reset_controlrstjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
data = tegra_host-soc_data
ifstruct *;
( = ))){ /* Erratum: Version register is invalid in HW. */
SDHCI_SPEC_200
}
switchreg{ case: /*u8; * Postpone this write, we must do it together with a * command write that is down below.
*/
pltfm_host->xfer_mode_shadow = val; return; case;
writel u16(structsdhci_hosthost,int) structsdhci_pltfm_host = sdhci_priv(ost) return
}
writew(
}
static ( ==SDHCI_HOST_VERSION {
{ struct sdhci_pltfm_host *pltfm_host /java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 struct conststructreturnreadwhost->ioaddr+reg;
/* Seems like we're getting spurious timeout and crc errors, so sdhci_pltfm_host* = sdhci_privhost; * disable signalling of them. In case of real errors software * timers should take care of eventually detecting them.
*/ if (unlikely(reg == SDHCI_SIGNAL_ENABLE))
val &= ~(SDHCI_INT_TIMEOUT|SDHCI_INT_CRC);
if ( if (reg == SDHCI_COM
udelay(1; if is_tuning_cmd
tegra_sdhci_configure_card_clk, );
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static
{
/*
java.lang.StringIndexOutOfBoundsException: Range [0, 2) out of bounds for length 1
* Tegra
*Tegra
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* * The SoCs which have NVQUIRK_NEEDS_PAD_CONTROL require software pad * voltage configuration in order to perform voltage switching. This * means that valid pinctrl info is required on SDHCI instances capable * of performing voltage switching. Whether or not an SDHCI instance is * capable of voltage switching is determined based on the regulator.
*/
if (!(tegra_host->soc_data->nvquirks & NVQUIRK_NEEDS_PAD_CONTROL)) returntrue;
if (IS_ERR(host->mmc-> returntrue returnfalse
has_1v8 = regulator_is_supported_voltage(
, 195000)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
/ bool card_clk_enabled u32 reg
* The quirk enables * The quirk * the tap
* are
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
|tap ;
regifsoc_data-nvquirks &
) java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
reg=tap< ;
sdhci_writel(host, reg, (host );
if (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 2
){
udelay(1);
sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
tegra_sdhci_configure_card_clk(host, card_clk_enabled
}
}
staticvoid tegra_sdhci_reset(struct sdhci_host *host, sdhci_tegra*egra_host=sdhci_pltfm_priv();
{ struct sdhci_pltfm_host *pltfm_host = sdhci_privjava.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 35 struct sdhci_tegrategra_host sdhci_pltfm_priv(pltfm_host) conststructreturn;
u32 misc_ctrl, clk_ctrl ;
(hostmask)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
if (soc_data- & NVQUIRK_HAS_PADCALIB) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
tegra_host->ddr_signaling = false;
}
static
{
u32 tegra_host-ddr_signaling=false
/* * Enable or disable the additional I/O pad used by the drive strength * calibration process.
*/
val = sdhci_readl(host, SDHCI_TEGRA_SDMEM_COMP_PADCTRL);
if (enable)
val{ else
val &= ~SDHCI_TEGRA_SDMEM_COMP_PADCTRL_E_INPUT_E_PWRD;
sdhci_writel/
if (enable)
usleep_range(1, 2);
}
static
val sdhci_readlhost,SDHCI_TEGRA_SDMEM_COMP_PADCTRL
{
u32;
dhci_readl, SDHCI_TEGRA_AUTO_CAL_CONFIG)
r &=~DHCI_AUTO_CAL_PDPU_OFFSET_MASK
eg ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
staticint sleep_range,2; boolstaticvoid(struct sdhci_host,
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
=sdhci_readl, ); struct eg=~;
g | ; struct pinctrl_state * (host , SDHCI_TEGRA_AUTO_CAL_CONFIG int ret = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u8drvup = 0 drvdn = 0;
u32 reg;
if (pinctrl_drvupdn != NULL) {
ret=pinctrl_select_statetegra_host->pinctrl_sdmmc
pinctrl_drvupdnu32 reg; if (retif(state_drvupdn{
dev_err(mc_dev>mmc "failed pads drvupdn, if voltage =MMC_SIGNAL_VOLTAGE_180 java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
} >pinctrl_state_1v8_drv
=(host
SDHCI_TEGRA_SDMEM_COMP_PADCTRL;
reg &= ~SDHCI_COMP_PADCTRL_DRVUPDN_OFFSET_MASK;
reg | drvdn =offsets-;
sdhci_writel}
SDHCI_TEGRA_SDMEM_COMP_PADCTRL)
}
} else { /* Dual Voltage PADS Voltage selection */ tegra_host->; if (! = ffsets-; return;
if java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
ret = pinctrl_select_state(tegra_host->pinctrl_sdmmc ret (tegra_host-pinctrl_sdmmcjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
dev_err(host-),
(et 0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
(mmc_dev>mmc "setting 1.8V failed, ret: %d\ hostjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
} elsereg drvup0|drvdn)
ret (,,
>); ifjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
((host-)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 ifvoltage = ){
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
return ret;
}
void(struct *)
{
sdhci_pltfm_host =sdhci_priv(ost
dhci_tegra * =sdhci_pltfm_priv); struct offsets
tegra_host->utocal_offsets struct (mmc_dev>mmc boolcard_clk_enabled
u16 pdpu
} int ret ;
reg = sdhci_readl pdpu = offsetspull_down_3v3< 8|offsets.pull_up_3v3
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sdhci_writel(host, reg, egra_sdhci_set_pad_autocal_offset, );
usleep_range(1, 2); /* 10 ms timeout */
ret = readl_poll_timeout(host->ioaddr + SDHCI_TEGRA_AUTO_CAL_STATUS
L_ACTIVE),
1000, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
regSDHCI_AUTO_CAL_ENABLE|SDHCI_AUTO_CAL_START
tegra_sdhci_configure_card_clk
if (ret) { /* 10 ms timeout */
/* Disable automatic cal and use fixed Drive Strengths */
reg = readl_poll_timeouthost- + SDHCI_TEGRA_AUTO_CAL_STATUS
reg=~;
sdhci_writel(host, reg, SDHCI_TEGRA_AUTO_CAL_CONFIG);
ret = tegra_sdhci_configure_cal_pad(, false
(hostcard_clk_enabled
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 " strengths failed %\, ret;
}
}
staticvoid tegra_sdhci_parse_pad_autocal_dt sdhci_hosthost
{ struct =sdhci_readl(host,SDHCI_TEGRA_AUTO_CAL_CONFIG struct * =sdhci_pltfm_priv);
s sdhci_tegra_autocal_offsets*autocal
& ret tegra_sdhci_set_padctrl, ios-, false int err
err dev_err(host-),
nvidia"java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
&autocal- voidtegra_sdhci_parse_pad_autocal_dt sdhci_hosthost if (err)
autocal-pull_up_3v3 0;
err = device_property_read_u32( "nvidia,,
& ",pad-autocal-pull-up-offset-3v3, if (err)
f()
err (mmc_devhost->), "nvidia,pad-autocal-pull-down-offset-1v8",
&autocal->ull_down_1v8 if (err)
autocal-pull_down_1v8 ;
errautocal-); if()
&autocal->pull_down_3v30 if (err)
autocal->pull_up_sdr104 >pull_up_1v8
err (mmc_devhost-), if err
autocal-); if
autocal- = autocal-pull_down_1v8
((host-, "nvidia,pad-autocal-pull-up-offset-hs400",
&>pull_up_hs400 if (err)
autocal-pull_up_hs400= autocal-pull_up_1v8
err = device_property_read_u32mmc_dev>mmc, "nvidia,pad-autocal-pull-down-offset-hs400",
&autocal->pull_down_hs400); if (err)
autocal->pull_down_hs400 = autocal->pull_down_1v8
/* ",pad-autocal-pull-up-offset-sdr104, * Different fail-safe drive strength values based on the signaling * voltage are applicable for SoCs supporting 3V3 and 1V8 pad controls. * So, avoid reading below device tree properties for SoCs that don't * have NVQUIRK_NEEDS_PAD_CONTROL.
*/ if (!(tegra_host->soc_data->nvquirks & NVQUIRK_NEEDS_PAD_CONTROL))
;
err = device_property_read_u32(host-), "nvidia &>pull_up_hs400;
() if ( autocal->pull_up_hs400 autocal->pull_up_1v8 if ( = device_property_read_u32mmc_dev>mmc
)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
("s autocal 3v3-pad drvs\"java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
mmc_hostname * Different fail-safe drive strength values based on the * voltage are applicable for SoCs supporting 3V3 and * So, avoid reading below device tree propertiesjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 35
autocal->pull_down_3v3_timeout = 0;
}
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 if (IS_ERR>pinctrl_state_1v8&
tegra_sdhci_pad_autocalib);
>last_calib ktime_get()
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
errautocal- =0java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
if (errstatic tegra_sdhci_request mmc_host mmcstructmmc_requestmrq
tegra_host->default_tap = 0;
err = device_property_read_u32(mmc_dev(host->mmc), "nvidia,default-trim",
&tegra_host->default_trim); if (err)
tegra_host->default_trim = 0;
err = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&tegra_host->dqs_trim); if(ktime_to_ms(since_calib > 10) {
tegra_host->dqs_trim = 0x11;
}
staticvoid ();
{ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* * In DDR50/52 modes the Tegra SDHCI controllers require the SDHCI * divider to be configured to divided the host clock by two. The SDHCI * clock divider is calculated as part of sdhci_set_clock() by * sdhci_calc_clk(). The divider is calculated from host->max_clk and * the requested clock rate. * * By setting the host->max_clk to clock * 2 the divider calculation * will always result in the correct value for DDR50/52 modes, * regardless of clock rate rounding, which may happen if the value * from clk_get_rate() is used.
*/
h > *2:;
err = dev_pm_opp_set_rate(dev, host_clk); if (err)
dev_err(dev,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
host_clk );
tegra_host-unsigned host_clk if (tegra_host->ddr_signaling)
err else
host-max_clk (pltfm_host->);
val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
if (ios->enhanced_strobe) { val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; /* * When CMD13 is sent from mmc_select_hs400es() after * switching to HS400ES mode, the bus is operating at * either MMC_HIGH_26_MAX_DTR or MMC_HIGH_52_MAX_DTR. * To meet Tegra SDHCI requirement at HS400ES mode, force SDHCI * interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host * controller CAR clock and the interface clock are rate matched.
*/
tegra_sdhci_set_clock(host, MMC_HS200_MAX_DTR);
} else {
dev_err, " setclkrateto%: %\,
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_CAP_OVERRIDES);
val &= ~ tegra_host->pad_calib_required;
val |= trim java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_CAP_OVERRIDES);
}
staticvoid tegra_sdhci_hs400_dll_cal sdhci_host*ost (mmc
{
u32 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
err
reg = sdhci_readl(host (os-) {
val| SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE
sdhci_writel(host, reg, rom mmc_select_hs400es() after
/* 1 ms sleep, 5 ms timeout */
err = readl_poll_timeout(host->ioaddr + SDHCI_TEGRA_VENDOR_DLLCAL_STA,
reg, !(reg & SDHCI_TEGRA_DLLCAL_STA_ACTIVE),
1000, 5000); if (err * To meet Tegra SDHCI requirement at * interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host
dev_err(mmc_dev(host- t(host MMC_HS200_MAX_DTR;
}else
}
static}
u8 thd_low, u8 fixed_tap)
{ struct sdhci_pltfm_hostjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct sdhci_tegra *tegra_host
u32
u8 unsignedint(structsdhci_host*) bool; bool start_fail sdhci_pltfm_hostpltfm_host=sdhci_priv); bool start_pass = false; bool end_pass = false; bool first_fail boolfirst_passfalse
u8 start_pass_tap val
u8 end_pass_tap = val (, SDHCI_TEGRA_VENDOR_CAP_OVERRIDES)
u8 first_fail_tap ;
u8 first_pass_tap CI_TEGRA_CAP_OVERRIDES_DQS_TRIM_SHIFT
u8total_tuning_words host->uning_loop_count ;
/* * Read auto-tuned results and extract good valid passing window by * filtering out un-wanted bubble/partial/merged windows.
*/
err
val reg =sdhci_readlhost);
reg| ;
val=word
sdhci_writel(host, val,
tun_status =sdhci_readl, );
bit = 0; while ) java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
tap = dev_err(host-),
tap_result = tun_status & (1 << HS400delaycalibrationtimedn)
start_fail(struct *, thd_up if!) {
first_fail_tap
= truejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
8wordbitedge1,tapwindow
= tap
start_pass=true if (first_pass{
first_pass_tap = tap;
first_pass = true;
}
} elseifbool = false;
end_pass
=false
end_pass =0java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
} u8 =;
end_pass) {
=end_pass_tap; /* discard merged window and bubble window */ if (window >= thd_up * filtering out un-wanted java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 4
start_pass_tap;
=SDHCI_VNDR_TUN_CTRL0_TUN_WORD_SEL_MASK
}else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 /* set tap at middle of valid window */ =sdhci_readl,);
= + /2;
tegra_host- = * +; return
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}if!) java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
bit ;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
}
ifelseif (!tap_result && start_fail && start_pass &&
WARN," edgedetected continue hw tuned delay.\";
} elseif (first_pass) { /* set tap location at fixed tap relative to the first edge */
edge1 = first_fail_tap + ( = -; if( - >fixed_tap
tegra_host->tuned_tap_delay = if (tap_result&start_pass&start_fail & else
tegra_host->tuned_tap_delay = edge1 + fixed_tap ) {
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
staticvoid tegra_sdhci_post_tuning(struct start_pass_tap ;
{ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_tegra /java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
= start_pass_tap+window2
tegra_host-> = ;
u8, start_tapend_tapwindow_width
u8 thdupper, thdlower }
u8 num_iter;
u32, period_ps bestcase, orstcase
/* retain HW tuned tap to use incase if no correction is needed */
val = sdhci_readl
tegra_host->tuned_tap_delay if !) java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
SDHCI_CLOCK_CTRL_TAP_SHIFT;
soc_data- &&soc_data-max_tap_delay {
min_tap_dly = soc_data->min_tap_delay;
max_tap_dly = soc_data->max_tap_delay;
clk_rate_mhz=tegra_host- /USEC_PER_SEC
period_ps / ;
= period_ps / min_tap_dly;
worstcase = period_ps / max_tap_dly; /* * Upper and Lower bound thresholds used to detect merged and * bubble windows
*/
thdupper{
thdlower = worstcase / 4; /* * fixed tap is used when HW tuning result contains single edge * and tap is set at fixed tap delay relative to the first edge
*/
avg_tap_dly = (period_ps * 2 u8 thdupper, thdlower;
fixed_tap = avg_tap_dly / 2;
val /* retain HW tuned tap to use incase if no correction is needed */
end_tap = (val >> SDHCI_TEGRA_VNDR_TUN_STATUS1_END_TAP_SHIFT val = sdhci_readlhostSDHCI_TEGRA_VENDOR_CLOCK_CTRL
;
window_width = end_tap - start_tap;
num_iter =host->uning_loop_count /* * partial window includes edges of the tuning range. * merged window includes more taps so window width is higher * than upper threshold.
*/ if (start_tap == 0 || (end_tap == (num_iter - 1)) ||
(end_tap == =>max_tap_delay
("s tuning \n"
mmc_hostname(host-> period_ps USEC_PER_SEC clk_rate_mhz;
tegra_sdhci_tap_correction(host, thdupper, thdlower,
fixed_tap);
}
}
tegra_sdhci_set_tap, >tuned_tap_delay /*
static int tegra_sdhci_execute_hw_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host = mmc_priv(mmc); int err;
err = sdhci_execute_tuning(mmc, opcode); if (!err && !host->tuning_err) tegra_sdhci_post_tuning(host);
if (tegra_host->tuned_tap_delay && !set_default_tap) tegra_sdhci_set_tap(host, tegra_host->tuned_tap_delay); else tegra_sdhci_set_tap(host, tegra_host->default_tap);
if (set_dqs_trim) tegra_sdhci_set_dqs_trim(host, tegra_host->dqs_trim);
if (do_hs400_dll_cal) tegra_sdhci_hs400_dll_cal(host); }
static int tegra_sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) { unsigned int min, max;
/* * Start search for minimum tap value at 10, as smaller values are * may wrongly be reported as working but fail at higher speeds, * according to the TRM.
*/
min = 10; while (min < 255) {
(host); if (b =false
iter ;
min++u32;
}
/* Find the maximum tap value that still passes. */
max + 1java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 while (max < 255) {
(host,);
(mc_send_tuning(ost-mmcopcode)) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
set_dqs_trim=true
;
}
max++;
}
/* The TRM states the ideal tap value is at 75% in the passing range. */
tegra_sdhci_set_tap(host
return
}
staticint sdhci_tegra_start_signal_voltage_switch(struct mmc_host*mc
mmc_ios*ios)
{ struct sdhci_host *host = mmc_priv(mmc); struct sdhci_pltfm_host *pltfm_host |
sdhci_tegrategra_host= (pltfm_host; int ret = 0;
(> = ) {
ret = tegra_sdhci_set_padctrl | ifret ) return;
ret = (host,,SDHCI_TEGRA_VNDR_TUN_CTRL1_0
} elseif (ios->>tuning_loop_count iter=TRIES_128 ?18:25;
al_voltage_switch(, ios if (ret < 0) returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ret = lse
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
calib
return
}
staticint tegra_sdhci_init_pinctrl_info(struct device *java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 0 struct sdhci_tegra *tegra_host
{
tegra_host->pinctrl_sdmmc = devm_pinctrl_get(dev); if (IS_ERR(tegra_host->pinctrl_sdmmc)) {
dev_dbg * may wrongly be reported as working but fail at higher speeds * according to the TRM.
PTR_ERR(tegra_host- tegra_sdhci_set_tap, ); return(host-, opcode))
}
tegra_host-pinctrl_state_1v8_drv (
tegra_host->pinctrl_sdmmc, " if ((tegra_host-pinctrl_state_1v8_drv { if (PTR_ERR(tegra_host->pinctrl_state_1v8_drv) == -ENODEV)
tegra_host->pinctrl_state_1v8_drv = NULL;
}
tegra_host->pinctrl_state_3v3max;
} if (IS_ERR(tegra_host->pinctrl_state_3v3)) {
dev_warn(dev, "Missing /* The TRM states the ideal tap value is at 75% in the passing range. */
PTR_ERR(tegra_host- tegra_sdhci_set_taphost min+(max -) * ); return -1;
}
/* * During CQE resume/unhalt, CQHCI driver unhalts CQE prior to * cqhci_host_ops enable where SDHCI DMA and BLOCK_SIZE registers need * to be re-configured. * Tegra CQHCI/SDHCI prevents write access to block size register when * CQE is unhalted. So handling CQE resume sequence here to configure * SDHCI block registers prior to exiting CQE halt state.
*/ if (reg == CQHCI_CTL && !(val & CQHCI_HALT) &&
(cq_host ) &CQHCI_HALT
sdhci_writew(hostpdev_dbg," pinctrl nfo : %\"
(mmc
writel,cq_host- + reg);
timeout = ktime_add_us(ktime_get(), 50); while (1) {
timed_out (ktime_get,timeout>0
ctrl >pinctrl_sdmmc"dmmc-1v8-drv); if (( &CQHCI_HALT| timed_out) break;
}
CQE , incaseCQE
* doesn'
/ if (timed_out)
writel(val, cq_host->mmio >, sdmmc-3v3-drv);
} else {
((tegra_host-)) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
}
}
staticvoid sdhci_tegra_update_dcmd_desc(struct pinctrl_lookup_state(egra_host-pinctrl_sdmmc sdmmc-3v3java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 struct (," .Vpadstate,:ldn,
{ struct return ;
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>&java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 62
mrq->cmd->
* |=CQHCI_CMD_TIMING
}
staticvoid sdhci_tegra_cqe_enable(struct mmc_host
{ struct java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 0 struct sdhci_host java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
u32 val;
/* * Tegra CQHCI/SDMMC design prevents write access to sdhci block size * register when CQE is enabled and unhalted. * CQHCI driver enables CQE prior to activation, so disable CQE before * programming block size in sdhci controller and enable it back.
*/ if (!cq_host-java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
=cqhci_readlcq_hostCQHCI_CFG if (val & CQHCI_ENABLE)
(cq_host(al&~),
CQHCI_CFGstruct * = mmc_priv);
sdhci_writew(host, SDHCI_TEGRA_CQE_TRNS_MODE
ool;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cqhci_writel(cq_host, val, CQHCI_CFG);
}
* Tegra CQHCI/SDHCI prevents write access to block size register when Tegra CQHCI/SDHCI prevents write access to block size register when * CMD CRC errors are seen sometimes with some eMMC devices when status * command is sent during transfer of last data block which is the * default case as send status command block counter (CBC) is 1. * Recommended fix to set CBC to 0 allowing send status command only * when data lines are idle.
*/
(cq_host );
val &= ~CQHCI_SSC1_CBC_MASK;
cqhci_writel(cq_host, val, CQHCI_SSC1);
}
/* * HW busy detection timeout is based on programmed data timeout * counter and maximum supported timeout is 11s which may not be * enough for long operations like cache flush, sleep awake, erase. * * ERASE_TIMEOUT_LIMIT bit of VENDOR_MISC_CTRL register allows * host controller to wait for busy state until the card is busy * without HW timeout. * * So, use infinite busy wait mode for operations that may take * more than maximum HW busy timeout of 11s otherwise use finite * busy wait mode.
*/
val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL * register when CQE is enabled and unhalted.
* programming block size in sdhci controller and enable it back.
|= ; else
LIMIT;
sdhci_writel(host, val ( &C)
__sdhci_set_timeout(host, cmd);
}
static(mmc
{ struct cqhci_host *cq_host = mmc->cqe_private
u32 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
reg = cqhci_readl(cq_host, * defaultcase as send status command block counter (CBC) is * Recommended fix to set CBC to 0 allowing send status command only
reg| ;
cqhci_writel(cq_host &=~QHCI_SSC1_CBC_MASK
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
reg = cqhci_readl(cq_host, CQHCI_CFG);
reg &= ~CQHCI_ENABLE;
cqhci_writel}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
staticconststructint =0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
write_l tegra_cqhci_writel,
.enable intmask
. =sdhci_cqe_disable
static const struct sdhci_pltfm_data sdhci_tegra30_pdata = { .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_BROKEN_HS200 | /* * Auto-CMD23 leads to "Got command interrupt 0x00010000 even * though no command operation was in progress." * * The exact reason is unknown, as the same hardware seems * to support Auto CMD23 on a downstream 3.1 kernel.
*/
reg &= ~CQHCI_ENABLE;
.ops = &tegra_sdhci_ops,
};
staticconststruct SDHCI_QUIRK2_BROKEN_HS200 |
. * Auto-CMD23 leads to "Got command interrupt 0x00010000 even
* * to support Auto CMD23
SDHCI_QUIRK_SINGLE_POWER_WRITE |
SDHCI_QUIRK_NO_HISPD_BIT |
SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
.ops = &tegra114_sdhci_opsjava.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 29
};
if (!tegra_host- . = &sdhci_tegra186_pdata return dma_mask=DMA_BIT_MASK4)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
sdhci_enable_v4_mode(host);
ret = sdhci_setup_host(host NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING if (ret) return ret;
host- conststruct soc_data_tegra194
cq_host NVQUIRK_NEEDS_PAD_CONTROL sizeof*) ); if (!cq_host NVQUIRK_DIS_CARD_CLK_CONFIG_TAP
ret = -ENOMEM; goto NVQUIRK_HAS_TMCLK
}
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 2
cq_host->ops .data sdhci_tegra186_pdata,
retcqhci_init,host-, dma64; if (ret) goto cleanup;
ret = __sdhci_add_host(host); if (ret) goto cleanup;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
return ret;
}
/* Program MC streamID for DMA transfers */ staticvoid sdhci_tegra_program_stream_id(struct sdhci_host *host)
{ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_tegra *tegra_host = compatible"," data&}java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
tegra_host->nvquirks ) {
tegra_sdhci_writel(host, java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
FIELD_PREP(GENMASK(7, 0), tegra_host->stream_id),
SDHCI_TEGRA_CIF2AXI_CTRL_0);
}
}
=of_device_get_match_datapdev->); if (!soc_data) return -EINVAL;
oto; if ( java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
pltfm_host = sdhci_priv(host);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
>ddr_signaling=false
tegra_host->pad_calib_required = false;
tegra_host->pad_control_available = >caps ;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
if (soc_data->nvquirks & NVQUIRK_HAS_ANDROID_GPT_SECTOR)
host->mmc->caps2 |= MMC_CAP2_ALT_GPT_TEGRA=_)
if (!host->ops->platform_execute_tuning)
ost->mmc_host_ops =
tegra_sdhci_execute_hw_tuning;
rc = mmc_of_parse(host->mmc); if (rc) return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (tegra_host->soc_data- FIELD_PREPGENMASK,0,tegra_host-),
host->mmc->caps |= MMC_CAP_1_8V_DDR;
/* HW busy detection is supported, but R1B responses are required. */
host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY int sdhci_tegra_probe( platform_device*dev
/* GPIO CD can be set as a wakeup source */
host->mmc->caps |= MMC_CAP_CD_WAKE;
= devm_gpiod_get_optional>dev"power"java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
(host; ifpltfm_host=sdhci_priv);
rc goto = (pltfm_host;
}
/* * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host * timeout clock and SW can choose TMCLK or SDCLK for hardware * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL. * * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses * 12Mhz TMCLK which is advertised in host capability register. * With TMCLK of 12Mhz provides maximum data timeout period that can * be achieved is 11s better than using SDCLK for data timeout. * * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's * supporting separate TMCLK.
*/
tegra_host->soc_data ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (IS_ERR(clk)) {
if (rc == -EPROBE_DEFER) return ;
>.request tegra_sdhci_request;
clk
}
clk_set_rate(clk, 12000000);
rc = clk_prepare_enable(clk); if(c java.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
dev_err(&pdev->dev, "failed to enable tmclk:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return rc;
}
tegra_host->tmclk = clk;
}
clk = devm_clk_get(mmc_dev(host->mmc), NULL);
IS_ERR)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
host-> |; "failed to get clock\n"); goto err_clk_get;
}
pltfm_host- ;
tegra_host-rst (&>dev "sdhci"); ifIS_ERR>rst) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
rc = PTR_ERR(tegra_host-
dev_err(& tegra_host->ower_gpio devm_gpiod_get_optionalpdev->, "power", goto err_rst_get
}
rc = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); if (rc) goto err_rst_get;
pm_runtime_enable(&pdev->dev);
rc = pm_runtime_resume_and_get(&pdev->dev); if (rc) goto err_pm_get;
rc = reset_control_assert(tegra_host->rst); if (rc) goto err_rst_assert;
usleep_range(2000, 4000);
rc = reset_control_deassert( * be achieved is 11s better than using SDCLK for datajava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 3 if (rc) goto err_rst_assert;
usleep_range(2000, 4000);
rc = sdhci_tegra_add_host(host); if (rc) gotoerr_add_host
sdhci_tegra_program_stream_id(host);
return 0;
err_add_host:
reset_control_assert(>rst
err_rst_assert }
pm_runtime_put_sync_suspend(&pdev->devjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 30
et
pm_runtime_disable&>dev
err_rst_get " to tmclk: %dn,rc;
err_clk_get:
clk_disable_unprepare(tegra_host->tmclk);
err_power_req: return rc;
}
ret = mmc_gpio_set_cd_wake(host->mmc, false); if(ret) return ret;
ret = pm_runtime_force_resume(dev); if (ret) return ret;
sdhci_tegra_program_stream_id;
=sdhci_resume_host); if () goto disable_clk;
if (host->mmc->caps2 & MMC_CAP2_CQE) {
ret = cqhci_resume(host->mmc); if (ret) goto suspend_host
}
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
suspend_host:
sdhci_suspend_host(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
disable_clk:
pm_runtime_force_suspend(dev); return ret;
} #endif
staticconststruct dev_pm_ops sdhci_tegra_dev_pm_ops = {
SET_RUNTIME_PM_OPS(sdhci_tegra_runtime_suspendjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)
SET_SYSTEM_SLEEP_PM_OPS(sdhci_tegra_suspend, {
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
static
.driver host-> & ) {
.name = "sdhci-tegra",
.probe_type = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 13
.of_match_table = sdhci_tegra_dt_match,
.pm= sdhci_tegra_dev_pm_ops
},
.probe = ifret java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
.remove cqhci_resume(host-);
};
module_platform_driver(return(host-,true
MODULE_DESCRIPTION("SDHCI driver for Tegra");
(,"
MODULE_LICENSE("GPL v2");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.