mtd: rawnand: gpmi: Introduce GPMI_IS_MXS() macro

Introduce a GPMI_IS_MXS() macro to take into account the cases
when mx23 or mx28 are used, which helps readability.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
Fabio Estevam 2019-02-07 08:50:54 -02:00 committed by Miquel Raynal
parent 981d1aa069
commit f67ed1461e
3 changed files with 4 additions and 5 deletions

View File

@ -157,8 +157,7 @@ int gpmi_init(struct gpmi_nand_data *this)
* Reset BCH here, too. We got failures otherwise :( * Reset BCH here, too. We got failures otherwise :(
* See later BCH reset for explanation of MX23 and MX28 handling * See later BCH reset for explanation of MX23 and MX28 handling
*/ */
ret = gpmi_reset_block(r->bch_regs, ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MXS(this));
GPMI_IS_MX23(this) || GPMI_IS_MX28(this));
if (ret) if (ret)
goto err_out; goto err_out;
@ -266,8 +265,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
* chip, otherwise it will lock up. So we skip resetting BCH on the MX23. * chip, otherwise it will lock up. So we skip resetting BCH on the MX23.
* and MX28. * and MX28.
*/ */
ret = gpmi_reset_block(r->bch_regs, ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MXS(this));
GPMI_IS_MX23(this) || GPMI_IS_MX28(this));
if (ret) if (ret)
goto err_out; goto err_out;

View File

@ -171,7 +171,7 @@ static inline bool gpmi_check_ecc(struct gpmi_nand_data *this)
struct bch_geometry *geo = &this->bch_geometry; struct bch_geometry *geo = &this->bch_geometry;
/* Do the sanity check. */ /* Do the sanity check. */
if (GPMI_IS_MX23(this) || GPMI_IS_MX28(this)) { if (GPMI_IS_MXS(this)) {
/* The mx23/mx28 only support the GF13. */ /* The mx23/mx28 only support the GF13. */
if (geo->gf_len == 14) if (geo->gf_len == 14)
return false; return false;

View File

@ -207,4 +207,5 @@ void gpmi_copy_bits(u8 *dst, size_t dst_bit_off,
#define GPMI_IS_MX6(x) (GPMI_IS_MX6Q(x) || GPMI_IS_MX6SX(x) || \ #define GPMI_IS_MX6(x) (GPMI_IS_MX6Q(x) || GPMI_IS_MX6SX(x) || \
GPMI_IS_MX7D(x)) GPMI_IS_MX7D(x))
#define GPMI_IS_MXS(x) (GPMI_IS_MX23(x) || GPMI_IS_MX28(x))
#endif #endif