Lines Matching +full:am3352 +full:- +full:gpmc

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/
8 #define DRIVER_NAME "omap-elm"
50 /* ELM_ERROR_LOCATION_0-15 Registers */
87 writel(val, info->elm_base + offset); in elm_write_reg()
92 return readl(info->elm_base + offset); in elm_read_reg()
96 * elm_config - Configure ELM module
110 dev_err(dev, "Unable to configure elm - device not probed?\n"); in elm_config()
111 return -EPROBE_DEFER; in elm_config()
115 dev_err(dev, "unsupported config ecc-size=%d\n", ecc_step_size); in elm_config()
116 return -EINVAL; in elm_config()
120 dev_err(dev, "unsupported config ecc-step=%d\n", ecc_steps); in elm_config()
121 return -EINVAL; in elm_config()
126 info->bch_type = bch_type; in elm_config()
127 info->ecc_steps = ecc_steps; in elm_config()
128 info->ecc_syndrome_size = ecc_syndrome_size; in elm_config()
135 * elm_configure_page_mode - Enable/Disable page mode
157 * elm_load_syndrome - Load ELM syndrome reg
170 for (i = 0; i < info->ecc_steps; i++) { in elm_load_syndrome()
177 switch (info->bch_type) { in elm_load_syndrome()
179 /* syndrome fragment 0 = ecc[9-12B] */ in elm_load_syndrome()
183 /* syndrome fragment 1 = ecc[5-8B] */ in elm_load_syndrome()
188 /* syndrome fragment 2 = ecc[1-4B] */ in elm_load_syndrome()
199 /* syndrome fragment 0 = ecc[20-52b] bits */ in elm_load_syndrome()
204 /* syndrome fragment 1 = ecc[0-20b] bits */ in elm_load_syndrome()
237 ecc += info->ecc_syndrome_size; in elm_load_syndrome()
242 * elm_start_processing - start elm syndrome processing
260 for (i = 0; i < info->ecc_steps; i++) { in elm_start_processing()
272 * elm_error_correction - locate correctable error position
289 for (i = 0; i < info->ecc_steps; i++) { in elm_error_correction()
329 * elm_decode_bch_error_page - Locate error position
331 * @ecc_calc: calculated ECC bytes from GPMC
355 wait_for_completion(&info->elm_completion); in elm_decode_bch_error_page()
375 complete(&info->elm_completion); in elm_isr()
388 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in elm_probe()
390 return -ENOMEM; in elm_probe()
392 info->dev = &pdev->dev; in elm_probe()
398 info->elm_base = devm_platform_ioremap_resource(pdev, 0); in elm_probe()
399 if (IS_ERR(info->elm_base)) in elm_probe()
400 return PTR_ERR(info->elm_base); in elm_probe()
402 ret = devm_request_irq(&pdev->dev, irq, elm_isr, 0, in elm_probe()
403 pdev->name, info); in elm_probe()
405 dev_err(&pdev->dev, "failure requesting %d\n", irq); in elm_probe()
409 pm_runtime_enable(&pdev->dev); in elm_probe()
410 if (pm_runtime_get_sync(&pdev->dev) < 0) { in elm_probe()
411 ret = -EINVAL; in elm_probe()
412 pm_runtime_put_sync(&pdev->dev); in elm_probe()
413 pm_runtime_disable(&pdev->dev); in elm_probe()
414 dev_err(&pdev->dev, "can't enable clock\n"); in elm_probe()
418 init_completion(&info->elm_completion); in elm_probe()
419 INIT_LIST_HEAD(&info->list); in elm_probe()
420 list_add(&info->list, &elm_devices); in elm_probe()
427 pm_runtime_put_sync(&pdev->dev); in elm_remove()
428 pm_runtime_disable(&pdev->dev); in elm_remove()
435 * saves ELM configurations to preserve them across Hardware powered-down
439 struct elm_registers *regs = &info->elm_regs; in elm_context_save()
440 enum bch_ecc bch_type = info->bch_type; in elm_context_save()
443 regs->elm_irqenable = elm_read_reg(info, ELM_IRQENABLE); in elm_context_save()
444 regs->elm_sysconfig = elm_read_reg(info, ELM_SYSCONFIG); in elm_context_save()
445 regs->elm_location_config = elm_read_reg(info, ELM_LOCATION_CONFIG); in elm_context_save()
446 regs->elm_page_ctrl = elm_read_reg(info, ELM_PAGE_CTRL); in elm_context_save()
451 regs->elm_syndrome_fragment_6[i] = elm_read_reg(info, in elm_context_save()
453 regs->elm_syndrome_fragment_5[i] = elm_read_reg(info, in elm_context_save()
455 regs->elm_syndrome_fragment_4[i] = elm_read_reg(info, in elm_context_save()
459 regs->elm_syndrome_fragment_3[i] = elm_read_reg(info, in elm_context_save()
461 regs->elm_syndrome_fragment_2[i] = elm_read_reg(info, in elm_context_save()
465 regs->elm_syndrome_fragment_1[i] = elm_read_reg(info, in elm_context_save()
467 regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, in elm_context_save()
471 return -EINVAL; in elm_context_save()
475 regs->elm_syndrome_fragment_6[i] = elm_read_reg(info, in elm_context_save()
483 * writes configurations saved duing power-down back into ELM registers
487 struct elm_registers *regs = &info->elm_regs; in elm_context_restore()
488 enum bch_ecc bch_type = info->bch_type; in elm_context_restore()
491 elm_write_reg(info, ELM_IRQENABLE, regs->elm_irqenable); in elm_context_restore()
492 elm_write_reg(info, ELM_SYSCONFIG, regs->elm_sysconfig); in elm_context_restore()
493 elm_write_reg(info, ELM_LOCATION_CONFIG, regs->elm_location_config); in elm_context_restore()
494 elm_write_reg(info, ELM_PAGE_CTRL, regs->elm_page_ctrl); in elm_context_restore()
500 regs->elm_syndrome_fragment_6[i]); in elm_context_restore()
502 regs->elm_syndrome_fragment_5[i]); in elm_context_restore()
504 regs->elm_syndrome_fragment_4[i]); in elm_context_restore()
508 regs->elm_syndrome_fragment_3[i]); in elm_context_restore()
510 regs->elm_syndrome_fragment_2[i]); in elm_context_restore()
514 regs->elm_syndrome_fragment_1[i]); in elm_context_restore()
516 regs->elm_syndrome_fragment_0[i]); in elm_context_restore()
519 return -EINVAL; in elm_context_restore()
523 regs->elm_syndrome_fragment_6[i] & in elm_context_restore()
550 { .compatible = "ti,am3352-elm" },
551 { .compatible = "ti,am64-elm" },