diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2012-06-14 15:21:04 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-06-30 22:37:41 +0200 |
commit | dc069093c6c8b6823fecb3860829f4f134e545f8 (patch) | |
tree | 87dc759b7a9fd036d0c97a6a0ef692df9f400214 /arch/arm/mach-mxs | |
parent | 51f4b6926a5c794cc51052f46df5208bd6a17f99 (diff) | |
download | barebox-dc069093c6c8b6823fecb3860829f4f134e545f8.tar.gz barebox-dc069093c6c8b6823fecb3860829f4f134e545f8.tar.xz |
arm: mxs: use consistent naming for #defines for ocotp
Will the code more readable, especially since future additions are
planned.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r-- | arch/arm/mach-mxs/ocotp.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c index 7f9107a239..f18d0663f5 100644 --- a/arch/arm/mach-mxs/ocotp.c +++ b/arch/arm/mach-mxs/ocotp.c @@ -28,11 +28,12 @@ #define DRIVERNAME "ocotp" -#define OCOTP_WORD_OFFSET 0x20 +#define OCOTP_CTRL 0x0 +# define OCOTP_CTRL_BUSY (1 << 8) +# define OCOTP_CTRL_ERROR (1 << 9) +# define OCOTP_CTRL_RD_BANK_OPEN (1 << 12) -#define BM_OCOTP_CTRL_BUSY (1 << 8) -#define BM_OCOTP_CTRL_ERROR (1 << 9) -#define BM_OCOTP_CTRL_RD_BANK_OPEN (1 << 12) +#define OCOTP_WORD_OFFSET 0x20 struct ocotp_priv { struct cdev cdev; @@ -44,7 +45,7 @@ static int mxs_ocotp_wait_busy(struct ocotp_priv *priv) uint64_t start = get_time_ns(); /* check both BUSY and ERROR cleared */ - while (readl(priv->base) & (BM_OCOTP_CTRL_BUSY | BM_OCOTP_CTRL_ERROR)) + while (readl(priv->base + OCOTP_CTRL) & (OCOTP_CTRL_BUSY | OCOTP_CTRL_ERROR)) if (is_timeout(start, MSECOND)) return -ETIMEDOUT; @@ -65,13 +66,13 @@ static ssize_t mxs_ocotp_cdev_read(struct cdev *cdev, void *buf, size_t count, */ /* try to clear ERROR bit */ - writel(BM_OCOTP_CTRL_ERROR, base + BIT_CLR); + writel(OCOTP_CTRL_ERROR, base + OCOTP_CTRL + BIT_CLR); if (mxs_ocotp_wait_busy(priv)) return -ETIMEDOUT; /* open OCOTP banks for read */ - writel(BM_OCOTP_CTRL_RD_BANK_OPEN, base + BIT_SET); + writel(OCOTP_CTRL_RD_BANK_OPEN, base + OCOTP_CTRL + BIT_SET); /* approximately wait 32 hclk cycles */ udelay(1); @@ -86,7 +87,7 @@ static ssize_t mxs_ocotp_cdev_read(struct cdev *cdev, void *buf, size_t count, (((i + offset) & 0xfc) << 2) + ((i + offset) & 3)); /* close banks for power saving */ - writel(BM_OCOTP_CTRL_RD_BANK_OPEN, base + BIT_CLR); + writel(OCOTP_CTRL_RD_BANK_OPEN, base + OCOTP_CTRL + BIT_CLR); return size; } |