Re: [PATCH 3/5] spi: spi-qpic: Add qpic spi nand driver support

From: Md Sadre Alam
Date: Tue Feb 20 2024 - 07:15:22 EST




On 2/15/2024 11:27 PM, Konrad Dybcio wrote:
On 15.02.2024 14:48, Md Sadre Alam wrote:
Add qpic spi nand driver support. The spi nand
driver currently supported the below commands.

-- RESET
-- READ ID
-- SET FEATURE
-- GET FEATURE
-- READ PAGE
-- WRITE PAGE
-- ERASE PAGE

Co-developed-by: Sricharan Ramabadhran <quic_srichara@xxxxxxxxxxx>
Signed-off-by: Sricharan Ramabadhran <quic_srichara@xxxxxxxxxxx>
Co-developed-by: Varadarajan Narayanan <quic_varada@xxxxxxxxxxx>
Signed-off-by: Varadarajan Narayanan <quic_varada@xxxxxxxxxxx>
Signed-off-by: Md Sadre Alam <quic_mdalam@xxxxxxxxxxx>
---

[...]

+void snandc_set_reg(struct qcom_nand_controller *snandc, int offset, u32 val)
+{
+ struct nandc_regs *regs = snandc->regs;
+ __le32 *reg;
+
+ reg = offset_to_nandc_reg(regs, offset);
+
+ if (reg)
+ *reg = cpu_to_le32(val);

if (WARN_ON(!reg))
return;

instead?

This would be tragic..

will fix this in next patch.


[...]

+
+ ecc_cfg->cfg0 = (cwperpage - 1) << CW_PER_PAGE
+ | ecc_cfg->cw_data << UD_SIZE_BYTES
+ | 1 << DISABLE_STATUS_AFTER_WRITE
+ | 3 << NUM_ADDR_CYCLES
+ | ecc_cfg->ecc_bytes_hw << ECC_PARITY_SIZE_BYTES_RS
+ | 0 << STATUS_BFR_READ
+ | 1 << SET_RD_MODE_AFTER_STATUS
+ | ecc_cfg->spare_bytes << SPARE_SIZE_BYTES;

Let me introduce you to FIELD_PREP/GET and GENMASK().. Many assignments
in this file could use these.

Ok

Konrad

Thanks for reviewing, will fix all the comments in next patch.

Regards,
Alam.