lkml.org 
[lkml]   [2018]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 1/5] spi: spi-mem: Add driver for NXP FlexSPI controller
On Mon,  8 Oct 2018 16:41:39 +0530
Yogesh Gaur <yogeshnarayan.gaur@nxp.com> wrote:

> +/* Registers used by the driver */
> +#define FSPI_MCR0 0x00
> +#define FSPI_MCR0_AHB_TIMEOUT_MASK GENMASK(31, 24)
> +#define FSPI_MCR0_IP_TIMEOUT_MASK GENMASK(23, 16)

You never mask the IP_TIMEOUT val, so you don't need a _MASK macro
here. Just define

#define FSPI_MCR0_IP_TIMEOUT(x) ((x) < 16)

The same goes for any field that you don't need to mask.

The only case you might need a mask def is when you have the following
pattern:

val = readl(reg);
val &= ~XXXX_MASK;
val |= XXXX(new_field_val);
writel(val, reg);

> +#define FSPI_MCR0_LEARN_EN_MASK BIT(15)
> +#define FSPI_MCR0_SCRFRUN_EN_MASK BIT(14)
> +#define FSPI_MCR0_OCTCOMB_EN_MASK BIT(13)

Drop the _MASK suffix for any single-bit field:

#define FSPI_MCR0_OCTCOMB_EN BIT(13)

\
 
 \ /
  Last update: 2018-10-08 21:11    [W:0.817 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site