1 // SPDX-License-Identifier: GPL-2.0+
3 * Texas Instruments' K3 DDRSS driver
5 * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
12 #include <dm/device_compat.h>
13 #include <fdt_support.h>
18 #include <power-domain.h>
20 #include <power/regulator.h>
22 #include "lpddr4_obj_if.h"
23 #include "lpddr4_if.h"
24 #include "lpddr4_structs_if.h"
25 #include "lpddr4_ctl_regs.h"
29 #define CTRLMMR_DDR4_FSP_CLKCHNG_REQ_OFFS 0x80
30 #define CTRLMMR_DDR4_FSP_CLKCHNG_ACK_OFFS 0xc0
32 #define DDRSS_V2A_CTL_REG 0x0020
33 #define DDRSS_ECC_CTRL_REG 0x0120
35 #define DDRSS_ECC_CTRL_REG_ECC_EN BIT(0)
36 #define DDRSS_ECC_CTRL_REG_RMW_EN BIT(1)
37 #define DDRSS_ECC_CTRL_REG_ECC_CK BIT(2)
38 #define DDRSS_ECC_CTRL_REG_WR_ALLOC BIT(4)
40 #define DDRSS_ECC_R0_STR_ADDR_REG 0x0130
41 #define DDRSS_ECC_R0_END_ADDR_REG 0x0134
42 #define DDRSS_ECC_R1_STR_ADDR_REG 0x0138
43 #define DDRSS_ECC_R1_END_ADDR_REG 0x013c
44 #define DDRSS_ECC_R2_STR_ADDR_REG 0x0140
45 #define DDRSS_ECC_R2_END_ADDR_REG 0x0144
46 #define DDRSS_ECC_1B_ERR_CNT_REG 0x0150
48 #define SINGLE_DDR_SUBSYSTEM 0x1
49 #define MULTI_DDR_SUBSYSTEM 0x2
51 #define MULTI_DDR_CFG0 0x00114100
52 #define MULTI_DDR_CFG1 0x00114104
53 #define DDR_CFG_LOAD 0x00114110
89 struct k3_ddrss_data {
113 enum intrlv_gran gran;
114 enum intrlv_size size;
115 enum ecc_enable enable;
116 enum emif_config config;
117 enum emif_active active;
120 #define K3_DDRSS_MAX_ECC_REGIONS 3
122 struct k3_ddrss_ecc_region {
127 struct k3_ddrss_desc {
129 void __iomem *ddrss_ss_cfg;
130 void __iomem *ddrss_ctrl_mmr;
131 void __iomem *ddrss_ctl_cfg;
132 struct power_domain ddrcfg_pwrdmn;
133 struct power_domain ddrdata_pwrdmn;
141 struct udevice *vtt_supply;
143 lpddr4_obj *driverdt;
144 lpddr4_config config;
145 lpddr4_privatedata pd;
146 struct k3_ddrss_ecc_region ecc_regions[K3_DDRSS_MAX_ECC_REGIONS];
147 u64 ecc_reserved_space;
152 u32 ctl_regs[LPDDR4_INTR_CTL_REG_COUNT];
153 u16 ctl_regs_offs[LPDDR4_INTR_CTL_REG_COUNT];
154 u32 pi_regs[LPDDR4_INTR_PHY_INDEP_REG_COUNT];
155 u16 pi_regs_offs[LPDDR4_INTR_PHY_INDEP_REG_COUNT];
156 u32 phy_regs[LPDDR4_INTR_PHY_REG_COUNT];
157 u16 phy_regs_offs[LPDDR4_INTR_PHY_REG_COUNT];
160 #define TH_MACRO_EXP(fld, str) (fld##str)
162 #define TH_FLD_MASK(fld) TH_MACRO_EXP(fld, _MASK)
163 #define TH_FLD_SHIFT(fld) TH_MACRO_EXP(fld, _SHIFT)
164 #define TH_FLD_WIDTH(fld) TH_MACRO_EXP(fld, _WIDTH)
165 #define TH_FLD_WOCLR(fld) TH_MACRO_EXP(fld, _WOCLR)
166 #define TH_FLD_WOSET(fld) TH_MACRO_EXP(fld, _WOSET)
169 #define xstr(s) str(s)
175 #define DENALI_CTL_0_DRAM_CLASS_DDR4 0xA
176 #define DENALI_CTL_0_DRAM_CLASS_LPDDR4 0xB
178 #define TH_OFFSET_FROM_REG(REG, SHIFT, offset) do {\
179 char *i, *pstr = xstr(REG); offset = 0;\
180 for (i = &pstr[SHIFT]; *i != '\0'; ++i) {\
181 offset = offset * 10 + (*i - '0'); } \
184 static u32 k3_lpddr4_read_ddr_type(const lpddr4_privatedata *pd)
190 struct k3_ddrss_desc *ddrss = (struct k3_ddrss_desc *)pd->ddr_instance;
192 TH_OFFSET_FROM_REG(LPDDR4__DRAM_CLASS__REG, CTL_SHIFT, offset);
193 status = ddrss->driverdt->readreg(pd, LPDDR4_CTL_REGS, offset, ®val);
195 printf("%s: Failed to read DRAM_CLASS\n", __func__);
199 dram_class = ((regval & TH_FLD_MASK(LPDDR4__DRAM_CLASS__FLD)) >>
200 TH_FLD_SHIFT(LPDDR4__DRAM_CLASS__FLD));
204 static void k3_lpddr4_freq_update(struct k3_ddrss_desc *ddrss)
206 unsigned int req_type, counter;
208 for (counter = 0; counter < ddrss->ddr_fhs_cnt; counter++) {
209 if (wait_for_bit_le32(ddrss->ddrss_ctrl_mmr +
210 CTRLMMR_DDR4_FSP_CLKCHNG_REQ_OFFS + ddrss->instance * 0x10, 0x80,
211 true, 10000, false)) {
212 printf("Timeout during frequency handshake\n");
216 req_type = readl(ddrss->ddrss_ctrl_mmr +
217 CTRLMMR_DDR4_FSP_CLKCHNG_REQ_OFFS + ddrss->instance * 0x10) & 0x03;
219 debug("%s: received freq change req: req type = %d, req no. = %d, instance = %d\n",
220 __func__, req_type, counter, ddrss->instance);
223 clk_set_rate(&ddrss->ddr_clk, ddrss->ddr_freq1);
224 else if (req_type == 2)
225 clk_set_rate(&ddrss->ddr_clk, ddrss->ddr_freq2);
226 else if (req_type == 0)
227 clk_set_rate(&ddrss->ddr_clk, ddrss->ddr_freq0);
229 printf("%s: Invalid freq request type\n", __func__);
231 writel(0x1, ddrss->ddrss_ctrl_mmr +
232 CTRLMMR_DDR4_FSP_CLKCHNG_ACK_OFFS + ddrss->instance * 0x10);
233 if (wait_for_bit_le32(ddrss->ddrss_ctrl_mmr +
234 CTRLMMR_DDR4_FSP_CLKCHNG_REQ_OFFS + ddrss->instance * 0x10, 0x80,
236 printf("Timeout during frequency handshake\n");
239 writel(0x0, ddrss->ddrss_ctrl_mmr +
240 CTRLMMR_DDR4_FSP_CLKCHNG_ACK_OFFS + ddrss->instance * 0x10);
244 static void k3_lpddr4_ack_freq_upd_req(const lpddr4_privatedata *pd)
246 struct k3_ddrss_desc *ddrss = (struct k3_ddrss_desc *)pd->ddr_instance;
248 debug("--->>> LPDDR4 Initialization is in progress ... <<<---\n");
250 switch (ddrss->dram_class) {
251 case DENALI_CTL_0_DRAM_CLASS_DDR4:
253 case DENALI_CTL_0_DRAM_CLASS_LPDDR4:
254 k3_lpddr4_freq_update(ddrss);
257 printf("Unrecognized dram_class cannot update frequency!\n");
261 static int k3_ddrss_init_freq(struct k3_ddrss_desc *ddrss)
264 lpddr4_privatedata *pd = &ddrss->pd;
266 ddrss->dram_class = k3_lpddr4_read_ddr_type(pd);
268 switch (ddrss->dram_class) {
269 case DENALI_CTL_0_DRAM_CLASS_DDR4:
270 /* Set to ddr_freq1 from DT for DDR4 */
271 ret = clk_set_rate(&ddrss->ddr_clk, ddrss->ddr_freq1);
273 case DENALI_CTL_0_DRAM_CLASS_LPDDR4:
274 ret = clk_set_rate(&ddrss->ddr_clk, ddrss->ddr_freq0);
278 printf("Unrecognized dram_class cannot init frequency!\n");
282 dev_err(ddrss->dev, "ddr clk init failed: %d\n", ret);
289 static void k3_lpddr4_info_handler(const lpddr4_privatedata *pd,
290 lpddr4_infotype infotype)
292 if (infotype == LPDDR4_DRV_SOC_PLL_UPDATE)
293 k3_lpddr4_ack_freq_upd_req(pd);
296 static int k3_ddrss_power_on(struct k3_ddrss_desc *ddrss)
300 debug("%s(ddrss=%p)\n", __func__, ddrss);
302 ret = power_domain_on(&ddrss->ddrcfg_pwrdmn);
304 dev_err(ddrss->dev, "power_domain_on() failed: %d\n", ret);
308 ret = power_domain_on(&ddrss->ddrdata_pwrdmn);
310 dev_err(ddrss->dev, "power_domain_on() failed: %d\n", ret);
314 ret = device_get_supply_regulator(ddrss->dev, "vtt-supply",
317 dev_dbg(ddrss->dev, "vtt-supply not found.\n");
319 ret = regulator_set_value(ddrss->vtt_supply, 3300000);
322 dev_dbg(ddrss->dev, "VTT regulator enabled, volt = %d\n",
323 regulator_get_value(ddrss->vtt_supply));
329 static int k3_ddrss_ofdata_to_priv(struct udevice *dev)
331 struct k3_ddrss_desc *ddrss = dev_get_priv(dev);
332 struct k3_ddrss_data *ddrss_data = (struct k3_ddrss_data *)dev_get_driver_data(dev);
336 debug("%s(dev=%p)\n", __func__, dev);
338 reg = dev_read_addr_name_ptr(dev, "cfg");
340 dev_err(dev, "No reg property for DDRSS wrapper logic\n");
343 ddrss->ddrss_ctl_cfg = reg;
345 reg = dev_read_addr_name_ptr(dev, "ctrl_mmr_lp4");
347 dev_err(dev, "No reg property for CTRL MMR\n");
350 ddrss->ddrss_ctrl_mmr = reg;
352 reg = dev_read_addr_name_ptr(dev, "ss_cfg");
354 dev_dbg(dev, "No reg property for SS Config region, but this is optional so continuing.\n");
355 ddrss->ddrss_ss_cfg = reg;
357 ret = power_domain_get_by_index(dev, &ddrss->ddrcfg_pwrdmn, 0);
359 dev_err(dev, "power_domain_get() failed: %d\n", ret);
363 ret = power_domain_get_by_index(dev, &ddrss->ddrdata_pwrdmn, 1);
365 dev_err(dev, "power_domain_get() failed: %d\n", ret);
369 ret = clk_get_by_index(dev, 0, &ddrss->ddr_clk);
371 dev_err(dev, "clk get failed%d\n", ret);
373 ret = clk_get_by_index(dev, 1, &ddrss->osc_clk);
375 dev_err(dev, "clk get failed for osc clk %d\n", ret);
377 /* Reading instance number for multi ddr subystems */
378 if (ddrss_data->flags & MULTI_DDR_SUBSYSTEM) {
379 ret = dev_read_u32(dev, "instance", &ddrss->instance);
381 dev_err(dev, "missing instance property");
388 ret = dev_read_u32(dev, "ti,ddr-freq0", &ddrss->ddr_freq0);
390 ddrss->ddr_freq0 = clk_get_rate(&ddrss->osc_clk);
392 "ddr freq0 not populated, using bypass frequency.\n");
395 ret = dev_read_u32(dev, "ti,ddr-freq1", &ddrss->ddr_freq1);
397 dev_err(dev, "ddr freq1 not populated %d\n", ret);
399 ret = dev_read_u32(dev, "ti,ddr-freq2", &ddrss->ddr_freq2);
401 dev_err(dev, "ddr freq2 not populated %d\n", ret);
403 ret = dev_read_u32(dev, "ti,ddr-fhs-cnt", &ddrss->ddr_fhs_cnt);
405 dev_err(dev, "ddr fhs cnt not populated %d\n", ret);
407 ddrss->ti_ecc_enabled = dev_read_bool(dev, "ti,ecc-enable");
412 void k3_lpddr4_probe(struct k3_ddrss_desc *ddrss)
416 lpddr4_config *config = &ddrss->config;
418 status = ddrss->driverdt->probe(config, &configsize);
420 if ((status != 0) || (configsize != sizeof(lpddr4_privatedata))
421 || (configsize > SRAM_MAX)) {
422 printf("%s: FAIL\n", __func__);
425 debug("%s: PASS\n", __func__);
429 void k3_lpddr4_init(struct k3_ddrss_desc *ddrss)
432 lpddr4_config *config = &ddrss->config;
433 lpddr4_obj *driverdt = ddrss->driverdt;
434 lpddr4_privatedata *pd = &ddrss->pd;
436 if ((sizeof(*pd) != sizeof(lpddr4_privatedata)) || (sizeof(*pd) > SRAM_MAX)) {
437 printf("%s: FAIL\n", __func__);
441 config->ctlbase = (struct lpddr4_ctlregs_s *)ddrss->ddrss_ctl_cfg;
442 config->infohandler = (lpddr4_infocallback) k3_lpddr4_info_handler;
444 status = driverdt->init(pd, config);
446 /* linking ddr instance to lpddr4 */
447 pd->ddr_instance = (void *)ddrss;
450 (pd->ctlbase != (struct lpddr4_ctlregs_s *)config->ctlbase) ||
451 (pd->ctlinterrupthandler != config->ctlinterrupthandler) ||
452 (pd->phyindepinterrupthandler != config->phyindepinterrupthandler)) {
453 printf("%s: FAIL\n", __func__);
456 debug("%s: PASS\n", __func__);
460 void populate_data_array_from_dt(struct k3_ddrss_desc *ddrss,
461 struct reginitdata *reginit_data)
465 ret = dev_read_u32_array(ddrss->dev, "ti,ctl-data",
466 (u32 *)reginit_data->ctl_regs,
467 LPDDR4_INTR_CTL_REG_COUNT);
469 printf("Error reading ctrl data %d\n", ret);
471 for (i = 0; i < LPDDR4_INTR_CTL_REG_COUNT; i++)
472 reginit_data->ctl_regs_offs[i] = i;
474 ret = dev_read_u32_array(ddrss->dev, "ti,pi-data",
475 (u32 *)reginit_data->pi_regs,
476 LPDDR4_INTR_PHY_INDEP_REG_COUNT);
478 printf("Error reading PI data\n");
480 for (i = 0; i < LPDDR4_INTR_PHY_INDEP_REG_COUNT; i++)
481 reginit_data->pi_regs_offs[i] = i;
483 ret = dev_read_u32_array(ddrss->dev, "ti,phy-data",
484 (u32 *)reginit_data->phy_regs,
485 LPDDR4_INTR_PHY_REG_COUNT);
487 printf("Error reading PHY data %d\n", ret);
489 for (i = 0; i < LPDDR4_INTR_PHY_REG_COUNT; i++)
490 reginit_data->phy_regs_offs[i] = i;
493 void k3_lpddr4_hardware_reg_init(struct k3_ddrss_desc *ddrss)
496 struct reginitdata reginitdata;
497 lpddr4_obj *driverdt = ddrss->driverdt;
498 lpddr4_privatedata *pd = &ddrss->pd;
500 populate_data_array_from_dt(ddrss, ®initdata);
502 status = driverdt->writectlconfig(pd, reginitdata.ctl_regs,
503 reginitdata.ctl_regs_offs,
504 LPDDR4_INTR_CTL_REG_COUNT);
506 status = driverdt->writephyindepconfig(pd, reginitdata.pi_regs,
507 reginitdata.pi_regs_offs,
508 LPDDR4_INTR_PHY_INDEP_REG_COUNT);
510 status = driverdt->writephyconfig(pd, reginitdata.phy_regs,
511 reginitdata.phy_regs_offs,
512 LPDDR4_INTR_PHY_REG_COUNT);
514 printf("%s: FAIL\n", __func__);
519 void k3_lpddr4_start(struct k3_ddrss_desc *ddrss)
524 lpddr4_obj *driverdt = ddrss->driverdt;
525 lpddr4_privatedata *pd = &ddrss->pd;
527 TH_OFFSET_FROM_REG(LPDDR4__START__REG, CTL_SHIFT, offset);
529 status = driverdt->readreg(pd, LPDDR4_CTL_REGS, offset, ®val);
530 if ((status > 0U) || ((regval & TH_FLD_MASK(LPDDR4__START__FLD)) != 0U)) {
531 printf("%s: Pre start FAIL\n", __func__);
535 status = driverdt->start(pd);
537 printf("%s: FAIL\n", __func__);
541 status = driverdt->readreg(pd, LPDDR4_CTL_REGS, offset, ®val);
542 if ((status > 0U) || ((regval & TH_FLD_MASK(LPDDR4__START__FLD)) != 1U)) {
543 printf("%s: Post start FAIL\n", __func__);
546 debug("%s: Post start PASS\n", __func__);
550 static void k3_ddrss_set_ecc_range_r0(u32 base, u32 start_address, u32 size)
552 writel((start_address) >> 16, base + DDRSS_ECC_R0_STR_ADDR_REG);
553 writel((start_address + size - 1) >> 16, base + DDRSS_ECC_R0_END_ADDR_REG);
556 static void k3_ddrss_preload_ecc_mem_region(u32 *addr, u32 size, u32 word)
560 printf("ECC is enabled, priming DDR which will take several seconds.\n");
562 for (i = 0; i < (size / 4); i++)
566 static void k3_ddrss_lpddr4_ecc_calc_reserved_mem(struct k3_ddrss_desc *ddrss)
568 fdtdec_setup_mem_size_base_lowest();
570 ddrss->ecc_reserved_space = gd->ram_size;
571 do_div(ddrss->ecc_reserved_space, 9);
573 /* Round to clean number */
574 ddrss->ecc_reserved_space = 1ull << (fls(ddrss->ecc_reserved_space));
577 static void k3_ddrss_lpddr4_ecc_init(struct k3_ddrss_desc *ddrss)
579 u32 ecc_region_start = ddrss->ecc_regions[0].start;
580 u32 ecc_range = ddrss->ecc_regions[0].range;
581 u32 base = (u32)ddrss->ddrss_ss_cfg;
584 /* Only Program region 0 which covers full ddr space */
585 k3_ddrss_set_ecc_range_r0(base, ecc_region_start - gd->ram_base, ecc_range);
587 /* Enable ECC, RMW, WR_ALLOC */
588 writel(DDRSS_ECC_CTRL_REG_ECC_EN | DDRSS_ECC_CTRL_REG_RMW_EN |
589 DDRSS_ECC_CTRL_REG_WR_ALLOC, base + DDRSS_ECC_CTRL_REG);
591 /* Preload ECC Mem region with 0's */
592 k3_ddrss_preload_ecc_mem_region((u32 *)ecc_region_start, ecc_range,
595 /* Clear Error Count Register */
596 writel(0x1, base + DDRSS_ECC_1B_ERR_CNT_REG);
598 /* Enable ECC Check */
599 val = readl(base + DDRSS_ECC_CTRL_REG);
600 val |= DDRSS_ECC_CTRL_REG_ECC_CK;
601 writel(val, base + DDRSS_ECC_CTRL_REG);
604 static int k3_ddrss_probe(struct udevice *dev)
607 struct k3_ddrss_desc *ddrss = dev_get_priv(dev);
609 debug("%s(dev=%p)\n", __func__, dev);
611 ret = k3_ddrss_ofdata_to_priv(dev);
616 ret = k3_ddrss_power_on(ddrss);
620 #ifdef CONFIG_K3_AM64_DDRSS
621 /* AM64x supports only up to 2 GB SDRAM */
622 writel(0x000001EF, ddrss->ddrss_ss_cfg + DDRSS_V2A_CTL_REG);
623 writel(0x0, ddrss->ddrss_ss_cfg + DDRSS_ECC_CTRL_REG);
626 ddrss->driverdt = lpddr4_getinstance();
628 k3_lpddr4_probe(ddrss);
629 k3_lpddr4_init(ddrss);
630 k3_lpddr4_hardware_reg_init(ddrss);
632 ret = k3_ddrss_init_freq(ddrss);
636 k3_lpddr4_start(ddrss);
638 if (ddrss->ti_ecc_enabled) {
639 if (!ddrss->ddrss_ss_cfg) {
640 printf("%s: ss_cfg is required if ecc is enabled but not provided.",
645 k3_ddrss_lpddr4_ecc_calc_reserved_mem(ddrss);
647 /* Always configure one region that covers full DDR space */
648 ddrss->ecc_regions[0].start = gd->ram_base;
649 ddrss->ecc_regions[0].range = gd->ram_size - ddrss->ecc_reserved_space;
650 k3_ddrss_lpddr4_ecc_init(ddrss);
656 int k3_ddrss_ddr_fdt_fixup(struct udevice *dev, void *blob, struct bd_info *bd)
658 struct k3_ddrss_desc *ddrss = dev_get_priv(dev);
659 u64 start[CONFIG_NR_DRAM_BANKS];
660 u64 size[CONFIG_NR_DRAM_BANKS];
663 if (ddrss->ecc_reserved_space == 0)
666 for (bank = CONFIG_NR_DRAM_BANKS - 1; bank >= 0; bank--) {
667 if (ddrss->ecc_reserved_space > bd->bi_dram[bank].size) {
668 ddrss->ecc_reserved_space -= bd->bi_dram[bank].size;
669 bd->bi_dram[bank].size = 0;
671 bd->bi_dram[bank].size -= ddrss->ecc_reserved_space;
676 for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
677 start[bank] = bd->bi_dram[bank].start;
678 size[bank] = bd->bi_dram[bank].size;
681 return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
684 static int k3_ddrss_get_info(struct udevice *dev, struct ram_info *info)
689 static struct ram_ops k3_ddrss_ops = {
690 .get_info = k3_ddrss_get_info,
693 static const struct k3_ddrss_data k3_data = {
694 .flags = SINGLE_DDR_SUBSYSTEM,
697 static const struct k3_ddrss_data j721s2_data = {
698 .flags = MULTI_DDR_SUBSYSTEM,
701 static const struct udevice_id k3_ddrss_ids[] = {
702 {.compatible = "ti,am62a-ddrss", .data = (ulong)&k3_data, },
703 {.compatible = "ti,am64-ddrss", .data = (ulong)&k3_data, },
704 {.compatible = "ti,j721e-ddrss", .data = (ulong)&k3_data, },
705 {.compatible = "ti,j721s2-ddrss", .data = (ulong)&j721s2_data, },
709 U_BOOT_DRIVER(k3_ddrss) = {
712 .of_match = k3_ddrss_ids,
713 .ops = &k3_ddrss_ops,
714 .probe = k3_ddrss_probe,
715 .priv_auto = sizeof(struct k3_ddrss_desc),
718 static int k3_msmc_set_config(struct k3_msmc *msmc)
723 ddr_cfg0 |= msmc->gran << 24;
724 ddr_cfg0 |= msmc->size << 16;
725 /* heartbeat_per, bit[4:0] setting to 3 is advisable */
728 /* Program MULTI_DDR_CFG0 */
729 writel(ddr_cfg0, MULTI_DDR_CFG0);
731 ddr_cfg1 |= msmc->enable << 16;
732 ddr_cfg1 |= msmc->config << 8;
733 ddr_cfg1 |= msmc->active;
735 /* Program MULTI_DDR_CFG1 */
736 writel(ddr_cfg1, MULTI_DDR_CFG1);
738 /* Program DDR_CFG_LOAD */
739 writel(0x60000000, DDR_CFG_LOAD);
744 static int k3_msmc_probe(struct udevice *dev)
746 struct k3_msmc *msmc = dev_get_priv(dev);
749 /* Read the granular size from DT */
750 ret = dev_read_u32(dev, "intrlv-gran", &msmc->gran);
752 dev_err(dev, "missing intrlv-gran property");
756 /* Read the interleave region from DT */
757 ret = dev_read_u32(dev, "intrlv-size", &msmc->size);
759 dev_err(dev, "missing intrlv-size property");
763 /* Read ECC enable config */
764 ret = dev_read_u32(dev, "ecc-enable", &msmc->enable);
766 dev_err(dev, "missing ecc-enable property");
770 /* Read EMIF configuration */
771 ret = dev_read_u32(dev, "emif-config", &msmc->config);
773 dev_err(dev, "missing emif-config property");
777 /* Read EMIF active */
778 ret = dev_read_u32(dev, "emif-active", &msmc->active);
780 dev_err(dev, "missing emif-active property");
784 ret = k3_msmc_set_config(msmc);
786 dev_err(dev, "error setting msmc config");
793 static const struct udevice_id k3_msmc_ids[] = {
794 { .compatible = "ti,j721s2-msmc"},
798 U_BOOT_DRIVER(k3_msmc) = {
800 .of_match = k3_msmc_ids,
802 .probe = k3_msmc_probe,
803 .priv_auto = sizeof(struct k3_msmc),
804 .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF,