Lines Matching +full:dcache +full:- +full:alignment

3  * SPDX-License-Identifier: Apache-2.0
26 #define CDNSMMC_ADDRESS_MASK (CONFIG_SDHC_BUFFER_ALIGNMENT - 1)
59 return -ENXIO; in sdhc_cdns_write_phy_reg()
71 return -ETIMEDOUT; in sdhc_cdns_wait_ics()
93 return -ETIMEDOUT; in sdhc_cdns_card_present()
117 * with input value- mode sd_ds,
128 sdhc_cdns_combo_phy_reg->cp_clk_wr_delay = 0; in cdns_sdhc_set_sdmmc_params()
129 sdhc_cdns_combo_phy_reg->cp_clk_wrdqs_delay = 0; in cdns_sdhc_set_sdmmc_params()
130 sdhc_cdns_combo_phy_reg->cp_data_select_oe_end = 1; in cdns_sdhc_set_sdmmc_params()
131 sdhc_cdns_combo_phy_reg->cp_dll_bypass_mode = 1; in cdns_sdhc_set_sdmmc_params()
132 sdhc_cdns_combo_phy_reg->cp_dll_locked_mode = 3; in cdns_sdhc_set_sdmmc_params()
133 sdhc_cdns_combo_phy_reg->cp_dll_start_point = 4; in cdns_sdhc_set_sdmmc_params()
134 sdhc_cdns_combo_phy_reg->cp_gate_cfg_always_on = 1; in cdns_sdhc_set_sdmmc_params()
135 sdhc_cdns_combo_phy_reg->cp_io_mask_always_on = 0; in cdns_sdhc_set_sdmmc_params()
136 sdhc_cdns_combo_phy_reg->cp_io_mask_end = 2; in cdns_sdhc_set_sdmmc_params()
137 sdhc_cdns_combo_phy_reg->cp_io_mask_start = 0; in cdns_sdhc_set_sdmmc_params()
138 sdhc_cdns_combo_phy_reg->cp_rd_del_sel = 52; in cdns_sdhc_set_sdmmc_params()
139 sdhc_cdns_combo_phy_reg->cp_read_dqs_cmd_delay = 0; in cdns_sdhc_set_sdmmc_params()
140 sdhc_cdns_combo_phy_reg->cp_read_dqs_delay = 0; in cdns_sdhc_set_sdmmc_params()
141 sdhc_cdns_combo_phy_reg->cp_sw_half_cycle_shift = 0; in cdns_sdhc_set_sdmmc_params()
142 sdhc_cdns_combo_phy_reg->cp_sync_method = 1; in cdns_sdhc_set_sdmmc_params()
143 sdhc_cdns_combo_phy_reg->cp_underrun_suppress = 1; in cdns_sdhc_set_sdmmc_params()
144 sdhc_cdns_combo_phy_reg->cp_use_ext_lpbk_dqs = 1; in cdns_sdhc_set_sdmmc_params()
145 sdhc_cdns_combo_phy_reg->cp_use_lpbk_dqs = 1; in cdns_sdhc_set_sdmmc_params()
146 sdhc_cdns_combo_phy_reg->cp_use_phony_dqs = 1; in cdns_sdhc_set_sdmmc_params()
147 sdhc_cdns_combo_phy_reg->cp_use_phony_dqs_cmd = 1; in cdns_sdhc_set_sdmmc_params()
149 sdhc_cdns_sdmmc_reg->sdhc_extended_rd_mode = 1; in cdns_sdhc_set_sdmmc_params()
150 sdhc_cdns_sdmmc_reg->sdhc_extended_wr_mode = 1; in cdns_sdhc_set_sdmmc_params()
151 sdhc_cdns_sdmmc_reg->sdhc_hcsdclkadj = 6; in cdns_sdhc_set_sdmmc_params()
152 sdhc_cdns_sdmmc_reg->sdhc_idelay_val = 1; in cdns_sdhc_set_sdmmc_params()
153 sdhc_cdns_sdmmc_reg->sdhc_rdcmd_en = 1; in cdns_sdhc_set_sdmmc_params()
154 sdhc_cdns_sdmmc_reg->sdhc_rddata_en = 1; in cdns_sdhc_set_sdmmc_params()
155 sdhc_cdns_sdmmc_reg->sdhc_rw_compensate = 10; in cdns_sdhc_set_sdmmc_params()
156 sdhc_cdns_sdmmc_reg->sdhc_sdcfsh = 0; in cdns_sdhc_set_sdmmc_params()
157 sdhc_cdns_sdmmc_reg->sdhc_sdcfsl = 1; in cdns_sdhc_set_sdmmc_params()
158 sdhc_cdns_sdmmc_reg->sdhc_wrcmd0_dly = 1; in cdns_sdhc_set_sdmmc_params()
159 sdhc_cdns_sdmmc_reg->sdhc_wrcmd0_sdclk_dly = 0; in cdns_sdhc_set_sdmmc_params()
160 sdhc_cdns_sdmmc_reg->sdhc_wrcmd1_dly = 0; in cdns_sdhc_set_sdmmc_params()
161 sdhc_cdns_sdmmc_reg->sdhc_wrcmd1_sdclk_dly = 0; in cdns_sdhc_set_sdmmc_params()
162 sdhc_cdns_sdmmc_reg->sdhc_wrdata0_dly = 1; in cdns_sdhc_set_sdmmc_params()
163 sdhc_cdns_sdmmc_reg->sdhc_wrdata0_sdclk_dly = 0; in cdns_sdhc_set_sdmmc_params()
164 sdhc_cdns_sdmmc_reg->sdhc_wrdata1_dly = 0; in cdns_sdhc_set_sdmmc_params()
165 sdhc_cdns_sdmmc_reg->sdhc_wrdata1_sdclk_dly = 0; in cdns_sdhc_set_sdmmc_params()
179 value = (CP_USE_EXT_LPBK_DQS(sdhc_cdns_combo_phy_reg->cp_use_ext_lpbk_dqs)) in sdhc_cdns_program_phy_reg()
180 | (CP_USE_LPBK_DQS(sdhc_cdns_combo_phy_reg->cp_use_lpbk_dqs)) in sdhc_cdns_program_phy_reg()
181 | (CP_USE_PHONY_DQS(sdhc_cdns_combo_phy_reg->cp_use_phony_dqs)) in sdhc_cdns_program_phy_reg()
182 | (CP_USE_PHONY_DQS_CMD(sdhc_cdns_combo_phy_reg->cp_use_phony_dqs_cmd)); in sdhc_cdns_program_phy_reg()
195 value = (CP_SYNC_METHOD(sdhc_cdns_combo_phy_reg->cp_sync_method)) in sdhc_cdns_program_phy_reg()
196 | (CP_SW_HALF_CYCLE_SHIFT(sdhc_cdns_combo_phy_reg->cp_sw_half_cycle_shift)) in sdhc_cdns_program_phy_reg()
197 | (CP_RD_DEL_SEL(sdhc_cdns_combo_phy_reg->cp_rd_del_sel)) in sdhc_cdns_program_phy_reg()
198 | (CP_UNDERRUN_SUPPRESS(sdhc_cdns_combo_phy_reg->cp_underrun_suppress)) in sdhc_cdns_program_phy_reg()
199 | (CP_GATE_CFG_ALWAYS_ON(sdhc_cdns_combo_phy_reg->cp_gate_cfg_always_on)); in sdhc_cdns_program_phy_reg()
205 return -ret; in sdhc_cdns_program_phy_reg()
212 value = (CP_DLL_BYPASS_MODE(sdhc_cdns_combo_phy_reg->cp_dll_bypass_mode)) in sdhc_cdns_program_phy_reg()
213 | (CP_DLL_START_POINT(sdhc_cdns_combo_phy_reg->cp_dll_start_point)); in sdhc_cdns_program_phy_reg()
226 value = (CP_READ_DQS_CMD_DELAY(sdhc_cdns_combo_phy_reg->cp_read_dqs_cmd_delay)) in sdhc_cdns_program_phy_reg()
227 | (CP_CLK_WRDQS_DELAY(sdhc_cdns_combo_phy_reg->cp_clk_wrdqs_delay)) in sdhc_cdns_program_phy_reg()
228 | (CP_CLK_WR_DELAY(sdhc_cdns_combo_phy_reg->cp_clk_wr_delay)) in sdhc_cdns_program_phy_reg()
229 | (CP_READ_DQS_DELAY(sdhc_cdns_combo_phy_reg->cp_read_dqs_delay)); in sdhc_cdns_program_phy_reg()
263 sdhc_cdns_combo_phy_reg->cp_io_mask_end = 0U; in sdhc_cdns_program_phy_reg()
264 value = (CP_IO_MASK_ALWAYS_ON(sdhc_cdns_combo_phy_reg->cp_io_mask_always_on)) in sdhc_cdns_program_phy_reg()
265 | (CP_IO_MASK_END(sdhc_cdns_combo_phy_reg->cp_io_mask_end)) in sdhc_cdns_program_phy_reg()
266 | (CP_IO_MASK_START(sdhc_cdns_combo_phy_reg->cp_io_mask_start)) in sdhc_cdns_program_phy_reg()
267 | (CP_DATA_SELECT_OE_END(sdhc_cdns_combo_phy_reg->cp_data_select_oe_end)); in sdhc_cdns_program_phy_reg()
285 LOG_ERR("%s: error in invalidate dcache with ret %d", __func__, ret); in sdhc_cdns_cache_invd()
300 uint32_t size = data->blocks * data->block_size; in sdhc_cdns_prepare()
308 desc_cnt = (size + (SDMMC_DMA_MAX_BUFFER_SIZE) - 1) / in sdhc_cdns_prepare()
316 return -EINVAL; in sdhc_cdns_prepare()
321 * descriptor for contiguous desc alignment in sdhc_cdns_prepare()
329 desc->attr = ADMA_DESC_ATTR_VALID | ADMA_DESC_TRANSFER_DATA; in sdhc_cdns_prepare()
330 desc->reserved = 0; in sdhc_cdns_prepare()
331 desc->len = MAX_64KB_PAGE; in sdhc_cdns_prepare()
332 desc->addr_lo = (dma_buff & 0xffffffff) + (SDMMC_DMA_MAX_BUFFER_SIZE * i); in sdhc_cdns_prepare()
333 desc->addr_hi = (dma_buff >> 32) & 0xffffffff; in sdhc_cdns_prepare()
334 size -= SDMMC_DMA_MAX_BUFFER_SIZE; in sdhc_cdns_prepare()
339 desc->attr = ADMA_DESC_ATTR_VALID | ADMA_DESC_TRANSFER_DATA | in sdhc_cdns_prepare()
341 desc->reserved = 0; in sdhc_cdns_prepare()
342 desc->len = size; in sdhc_cdns_prepare()
343 desc->addr_lo = (dma_buff & 0xffffffff) + (SDMMC_DMA_MAX_BUFFER_SIZE * i); in sdhc_cdns_prepare()
344 desc->addr_hi = (dma_buff >> 32) & 0xffffffff; in sdhc_cdns_prepare()
351 sys_write32((data->block_size << CDNS_SRS01_BLK_SIZE | in sdhc_cdns_prepare()
352 data->blocks << CDNS_SRS01_BLK_COUNT_CT | in sdhc_cdns_prepare()
436 value = (CDNS_HRS09_RDDATA_EN(sdhc_cdns_sdmmc_reg->sdhc_rddata_en)) in sdhc_cdns_init_hrs_io()
437 | (CDNS_HRS09_RDCMD_EN(sdhc_cdns_sdmmc_reg->sdhc_rdcmd_en)) in sdhc_cdns_init_hrs_io()
438 | (CDNS_HRS09_EXTENDED_WR(sdhc_cdns_sdmmc_reg->sdhc_extended_wr_mode)) in sdhc_cdns_init_hrs_io()
439 | (CDNS_HRS09_EXT_RD_MODE(sdhc_cdns_sdmmc_reg->sdhc_extended_rd_mode)); in sdhc_cdns_init_hrs_io()
446 value = (SDHC_HRS10_HCSDCLKADJ(sdhc_cdns_sdmmc_reg->sdhc_hcsdclkadj)); in sdhc_cdns_init_hrs_io()
453 value = (CDNS_HRS16_WRDATA1_SDCLK_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrdata1_sdclk_dly)) in sdhc_cdns_init_hrs_io()
454 | (CDNS_HRS16_WRDATA0_SDCLK_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrdata0_sdclk_dly)) in sdhc_cdns_init_hrs_io()
455 | (CDNS_HRS16_WRCMD1_SDCLK_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrcmd1_sdclk_dly)) in sdhc_cdns_init_hrs_io()
456 | (CDNS_HRS16_WRCMD0_SDCLK_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrcmd0_sdclk_dly)) in sdhc_cdns_init_hrs_io()
457 | (CDNS_HRS16_WRDATA1_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrdata1_dly)) in sdhc_cdns_init_hrs_io()
458 | (CDNS_HRS16_WRDATA0_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrdata0_dly)) in sdhc_cdns_init_hrs_io()
459 | (CDNS_HRS16_WRCMD1_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrcmd1_dly)) in sdhc_cdns_init_hrs_io()
460 | (CDNS_HRS16_WRCMD0_DLY(sdhc_cdns_sdmmc_reg->sdhc_wrcmd0_dly)); in sdhc_cdns_init_hrs_io()
467 value = (CDNS_HRS07_RW_COMPENSATE(sdhc_cdns_sdmmc_reg->sdhc_rw_compensate)) in sdhc_cdns_init_hrs_io()
468 | (CDNS_HRS07_IDELAY_VAL(sdhc_cdns_sdmmc_reg->sdhc_idelay_val)); in sdhc_cdns_init_hrs_io()
483 if ((cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_DS) || in sdhc_cdns_set_clk()
484 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_UHS_SDR12) || in sdhc_cdns_set_clk()
485 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_SDR_BC)) { in sdhc_cdns_set_clk()
487 } else if ((cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_HS) || in sdhc_cdns_set_clk()
488 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_UHS_SDR25) || in sdhc_cdns_set_clk()
489 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_UHS_DDR50) || in sdhc_cdns_set_clk()
490 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_SDR)) { in sdhc_cdns_set_clk()
492 } else if ((cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_UHS_SDR50) || in sdhc_cdns_set_clk()
493 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_DDR) || in sdhc_cdns_set_clk()
494 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_HS400) || in sdhc_cdns_set_clk()
495 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_HS400ES)) { in sdhc_cdns_set_clk()
497 } else if ((cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_UHS_SDR104) || in sdhc_cdns_set_clk()
498 (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_HS200)) { in sdhc_cdns_set_clk()
544 return -ETIMEDOUT; in sdhc_cdns_reset()
572 return -ETIMEDOUT; in sdhc_cdns_init()
601 cmd_indx = (cmd->cmd_idx) << CDNS_SRS03_COM_IDX; in sdhc_cdns_send_cmd()
604 switch (cmd->cmd_idx) { in sdhc_cdns_send_cmd()
642 switch (cmd->cmd_idx) { in sdhc_cdns_send_cmd()
676 switch (cmd->resp_type) { in sdhc_cdns_send_cmd()
694 if ((cmd->cmd_idx == SD_WRITE_SINGLE_BLOCK) || (cmd->cmd_idx in sdhc_cdns_send_cmd()
718 sys_write32(cmd->cmd_arg, cdns_params.reg_base + SDHC_CDNS_SRS02); in sdhc_cdns_send_cmd()
728 return -ETIMEDOUT; in sdhc_cdns_send_cmd()
735 return -EIO; in sdhc_cdns_send_cmd()
739 cmd->resp_data[0] = sys_read32(cdns_params.reg_base + SDHC_CDNS_SRS04); in sdhc_cdns_send_cmd()
741 cmd->resp_data[1] = sys_read32(cdns_params.reg_base + SDHC_CDNS_SRS05); in sdhc_cdns_send_cmd()
742 cmd->resp_data[2] = sys_read32(cdns_params.reg_base + SDHC_CDNS_SRS06); in sdhc_cdns_send_cmd()
743 cmd->resp_data[3] = sys_read32(cdns_params.reg_base + SDHC_CDNS_SRS07); in sdhc_cdns_send_cmd()
745 /* 136-bit: RTS=01b, Response field R[127:8] - RESP3[23:0], in sdhc_cdns_send_cmd()
751 cmd->resp_data[3] = ((cmd->resp_data[3] << 8) | ((cmd->resp_data[2] >> 24) in sdhc_cdns_send_cmd()
753 cmd->resp_data[2] = ((cmd->resp_data[2] << 8) | ((cmd->resp_data[1] >> 24) in sdhc_cdns_send_cmd()
755 cmd->resp_data[1] = ((cmd->resp_data[1] << 8) | ((cmd->resp_data[0] >> 24) in sdhc_cdns_send_cmd()
757 cmd->resp_data[0] = (cmd->resp_data[0] << 8); in sdhc_cdns_send_cmd()
779 ((params->reg_base & MMC_BLOCK_MASK) == 0) && in sdhc_cdns_sdmmc_init()
780 ((params->desc_size & MMC_BLOCK_MASK) == 0) && in sdhc_cdns_sdmmc_init()
781 ((params->reg_phy & MMC_BLOCK_MASK) == 0) && in sdhc_cdns_sdmmc_init()
782 (params->desc_size > 0) && in sdhc_cdns_sdmmc_init()
783 (params->clk_rate > 0) && in sdhc_cdns_sdmmc_init()
784 ((params->bus_width == MMC_BUS_WIDTH_1) || in sdhc_cdns_sdmmc_init()
785 (params->bus_width == MMC_BUS_WIDTH_4) || in sdhc_cdns_sdmmc_init()
786 (params->bus_width == MMC_BUS_WIDTH_8))); in sdhc_cdns_sdmmc_init()
789 cdns_params.cdn_sdmmc_dev_type = info->cdn_sdmmc_dev_type; in sdhc_cdns_sdmmc_init()