Lines Matching full:ecc

3  * JZ47xx ECC common code
18 * ingenic_ecc_calculate() - calculate ECC for a data buffer
19 * @ecc: ECC device.
20 * @params: ECC parameters.
22 * @ecc_code: output buffer with ECC.
24 * Return: 0 on success, -ETIMEDOUT if timed out while waiting for ECC
27 int ingenic_ecc_calculate(struct ingenic_ecc *ecc, in ingenic_ecc_calculate() argument
31 return ecc->ops->calculate(ecc, params, buf, ecc_code); in ingenic_ecc_calculate()
36 * @ecc: ECC device.
37 * @params: ECC parameters.
39 * @ecc_code: ECC read from the chip.
41 * Given the raw data and the ECC read from the NAND device, detects and
47 int ingenic_ecc_correct(struct ingenic_ecc *ecc, in ingenic_ecc_correct() argument
51 return ecc->ops->correct(ecc, params, buf, ecc_code); in ingenic_ecc_correct()
55 * ingenic_ecc_get() - get the ECC controller device
56 * @np: ECC device tree node.
58 * Gets the ECC controller device from the specified device tree node. The
68 struct ingenic_ecc *ecc; in ingenic_ecc_get() local
76 ecc = platform_get_drvdata(pdev); in ingenic_ecc_get()
77 clk_prepare_enable(ecc->clk); in ingenic_ecc_get()
79 return ecc; in ingenic_ecc_get()
83 * of_ingenic_ecc_get() - get the ECC controller from a DT node
84 * @of_node: the node that contains an ecc-engine property.
86 * Get the ecc-engine property from the given device tree
94 struct ingenic_ecc *ecc = NULL; in of_ingenic_ecc_get() local
97 np = of_parse_phandle(of_node, "ecc-engine", 0); in of_ingenic_ecc_get()
100 * If the ecc-engine property is not found, check for the deprecated in of_ingenic_ecc_get()
107 ecc = ingenic_ecc_get(np); in of_ingenic_ecc_get()
110 return ecc; in of_ingenic_ecc_get()
114 * ingenic_ecc_release() - release the ECC controller device
115 * @ecc: ECC device.
117 void ingenic_ecc_release(struct ingenic_ecc *ecc) in ingenic_ecc_release() argument
119 clk_disable_unprepare(ecc->clk); in ingenic_ecc_release()
120 put_device(ecc->dev); in ingenic_ecc_release()
126 struct ingenic_ecc *ecc; in ingenic_ecc_probe() local
129 ecc = devm_kzalloc(dev, sizeof(*ecc), GFP_KERNEL); in ingenic_ecc_probe()
130 if (!ecc) in ingenic_ecc_probe()
133 ecc->ops = device_get_match_data(dev); in ingenic_ecc_probe()
134 if (!ecc->ops) in ingenic_ecc_probe()
138 ecc->base = devm_ioremap_resource(dev, res); in ingenic_ecc_probe()
139 if (IS_ERR(ecc->base)) in ingenic_ecc_probe()
140 return PTR_ERR(ecc->base); in ingenic_ecc_probe()
142 ecc->ops->disable(ecc); in ingenic_ecc_probe()
144 ecc->clk = devm_clk_get(dev, NULL); in ingenic_ecc_probe()
145 if (IS_ERR(ecc->clk)) { in ingenic_ecc_probe()
146 dev_err(dev, "failed to get clock: %ld\n", PTR_ERR(ecc->clk)); in ingenic_ecc_probe()
147 return PTR_ERR(ecc->clk); in ingenic_ecc_probe()
150 mutex_init(&ecc->lock); in ingenic_ecc_probe()
152 ecc->dev = dev; in ingenic_ecc_probe()
153 platform_set_drvdata(pdev, ecc); in ingenic_ecc_probe()