[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d1c80d3f-3b70-4630-8f7d-b00983b487dd@linaro.org>
Date: Thu, 15 Feb 2024 18:57:50 +0100
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Md Sadre Alam <quic_mdalam@...cinc.com>, andersson@...nel.org,
broonie@...nel.org, robh@...nel.org, krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org, miquel.raynal@...tlin.com, richard@....at,
vigneshr@...com, manivannan.sadhasivam@...aro.org,
linux-arm-msm@...r.kernel.org, linux-spi@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mtd@...ts.infradead.org
Cc: quic_srichara@...cinc.com, quic_varada@...cinc.com
Subject: Re: [PATCH 3/5] spi: spi-qpic: Add qpic spi nand driver support
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@...cinc.com>
> Signed-off-by: Sricharan Ramabadhran <quic_srichara@...cinc.com>
> Co-developed-by: Varadarajan Narayanan <quic_varada@...cinc.com>
> Signed-off-by: Varadarajan Narayanan <quic_varada@...cinc.com>
> Signed-off-by: Md Sadre Alam <quic_mdalam@...cinc.com>
> ---
[...]
> +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..
[...]
> +
> + 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.
Konrad
Powered by blists - more mailing lists