summaryrefslogtreecommitdiff
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2017-07-06 08:33:13 (GMT)
committerTom Rini <trini@konsulko.com>2017-07-08 19:55:32 (GMT)
commitba3da7348ac9aaa1cc0a9ccbc8b3c9367d87ca4b (patch)
tree50826c7ee7fa776c1b94e9af8183d673f4dc311b /arch/powerpc/include
parentd79496657e3d8e856152e7652ade6597f6bdf73c (diff)
downloadu-boot-fsl-qoriq-ba3da7348ac9aaa1cc0a9ccbc8b3c9367d87ca4b.tar.xz
powerpc, 8xx: Use IO accessors to access IO memory
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/iopin_8xx.h369
1 files changed, 241 insertions, 128 deletions
diff --git a/arch/powerpc/include/asm/iopin_8xx.h b/arch/powerpc/include/asm/iopin_8xx.h
index 8db0fa2..beca988 100644
--- a/arch/powerpc/include/asm/iopin_8xx.h
+++ b/arch/powerpc/include/asm/iopin_8xx.h
@@ -12,6 +12,7 @@
#include <linux/types.h>
#include <asm/8xx_immap.h>
+#include <asm/io.h>
#ifdef __KERNEL__
@@ -29,54 +30,72 @@ typedef struct {
static __inline__ void
iopin_set_high(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat;
- *datp |= (1 << (15 - iopin->pin));
+ ushort __iomem *datp = &immap->im_ioport.iop_padat;
+
+ setbits_be16(datp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat;
- *datp |= (1 << (31 - iopin->pin));
+ uint __iomem *datp = &immap->im_cpm.cp_pbdat;
+
+ setbits_be32(datp, 1 << (31 - iopin->pin));
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat;
- *datp |= (1 << (15 - iopin->pin));
+ ushort __iomem *datp = &immap->im_ioport.iop_pcdat;
+
+ setbits_be16(datp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat;
- *datp |= (1 << (15 - iopin->pin));
+ ushort __iomem *datp = &immap->im_ioport.iop_pddat;
+
+ setbits_be16(datp, 1 << (15 - iopin->pin));
}
}
static __inline__ void
iopin_set_low(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat;
- *datp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *datp = &immap->im_ioport.iop_padat;
+
+ clrbits_be16(datp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat;
- *datp &= ~(1 << (31 - iopin->pin));
+ uint __iomem *datp = &immap->im_cpm.cp_pbdat;
+
+ clrbits_be32(datp, 1 << (31 - iopin->pin));
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat;
- *datp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *datp = &immap->im_ioport.iop_pcdat;
+
+ clrbits_be16(datp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat;
- *datp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *datp = &immap->im_ioport.iop_pddat;
+
+ clrbits_be16(datp, 1 << (15 - iopin->pin));
}
}
static __inline__ uint
iopin_is_high(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat;
- return (*datp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *datp = &immap->im_ioport.iop_padat;
+
+ return (in_be16(datp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat;
- return (*datp >> (31 - iopin->pin)) & 1;
+ uint __iomem *datp = &immap->im_cpm.cp_pbdat;
+
+ return (in_be32(datp) >> (31 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat;
- return (*datp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *datp = &immap->im_ioport.iop_pcdat;
+
+ return (in_be16(datp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat;
- return (*datp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *datp = &immap->im_ioport.iop_pddat;
+
+ return (in_be16(datp) >> (15 - iopin->pin)) & 1;
}
return 0;
}
@@ -84,18 +103,24 @@ iopin_is_high(iopin_t *iopin)
static __inline__ uint
iopin_is_low(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat;
- return ((*datp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *datp = &immap->im_ioport.iop_padat;
+
+ return ((in_be16(datp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat;
- return ((*datp >> (31 - iopin->pin)) & 1) ^ 1;
+ uint __iomem *datp = &immap->im_cpm.cp_pbdat;
+
+ return ((in_be32(datp) >> (31 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat;
- return ((*datp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *datp = &immap->im_ioport.iop_pcdat;
+
+ return ((in_be16(datp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat;
- return ((*datp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *datp = &immap->im_ioport.iop_pddat;
+
+ return ((in_be16(datp) >> (15 - iopin->pin)) & 1) ^ 1;
}
return 0;
}
@@ -103,54 +128,72 @@ iopin_is_low(iopin_t *iopin)
static __inline__ void
iopin_set_out(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir;
- *dirp |= (1 << (15 - iopin->pin));
+ ushort __iomem *dirp = &immap->im_ioport.iop_padir;
+
+ setbits_be16(dirp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir;
- *dirp |= (1 << (31 - iopin->pin));
+ uint __iomem *dirp = &immap->im_cpm.cp_pbdir;
+
+ setbits_be32(dirp, 1 << (31 - iopin->pin));
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir;
- *dirp |= (1 << (15 - iopin->pin));
+ ushort __iomem *dirp = &immap->im_ioport.iop_pcdir;
+
+ setbits_be16(dirp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir;
- *dirp |= (1 << (15 - iopin->pin));
+ ushort __iomem *dirp = &immap->im_ioport.iop_pddir;
+
+ setbits_be16(dirp, 1 << (15 - iopin->pin));
}
}
static __inline__ void
iopin_set_in(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir;
- *dirp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *dirp = &immap->im_ioport.iop_padir;
+
+ clrbits_be16(dirp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir;
- *dirp &= ~(1 << (31 - iopin->pin));
+ uint __iomem *dirp = &immap->im_cpm.cp_pbdir;
+
+ clrbits_be32(dirp, 1 << (31 - iopin->pin));
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir;
- *dirp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *dirp = &immap->im_ioport.iop_pcdir;
+
+ clrbits_be16(dirp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir;
- *dirp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *dirp = &immap->im_ioport.iop_pddir;
+
+ clrbits_be16(dirp, 1 << (15 - iopin->pin));
}
}
static __inline__ uint
iopin_is_out(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir;
- return (*dirp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *dirp = &immap->im_ioport.iop_padir;
+
+ return (in_be16(dirp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir;
- return (*dirp >> (31 - iopin->pin)) & 1;
+ uint __iomem *dirp = &immap->im_cpm.cp_pbdir;
+
+ return (in_be32(dirp) >> (31 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir;
- return (*dirp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *dirp = &immap->im_ioport.iop_pcdir;
+
+ return (in_be16(dirp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir;
- return (*dirp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *dirp = &immap->im_ioport.iop_pddir;
+
+ return (in_be16(dirp) >> (15 - iopin->pin)) & 1;
}
return 0;
}
@@ -158,18 +201,24 @@ iopin_is_out(iopin_t *iopin)
static __inline__ uint
iopin_is_in(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir;
- return ((*dirp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *dirp = &immap->im_ioport.iop_padir;
+
+ return ((in_be16(dirp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir;
- return ((*dirp >> (31 - iopin->pin)) & 1) ^ 1;
+ uint __iomem *dirp = &immap->im_cpm.cp_pbdir;
+
+ return ((in_be32(dirp) >> (31 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir;
- return ((*dirp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *dirp = &immap->im_ioport.iop_pcdir;
+
+ return ((in_be16(dirp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir;
- return ((*dirp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *dirp = &immap->im_ioport.iop_pddir;
+
+ return ((in_be16(dirp) >> (15 - iopin->pin)) & 1) ^ 1;
}
return 0;
}
@@ -177,36 +226,48 @@ iopin_is_in(iopin_t *iopin)
static __inline__ void
iopin_set_odr(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr;
- *odrp |= (1 << (15 - iopin->pin));
+ ushort __iomem *odrp = &immap->im_ioport.iop_paodr;
+
+ setbits_be16(odrp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr;
- *odrp |= (1 << (31 - iopin->pin));
+ ushort __iomem *odrp = &immap->im_cpm.cp_pbodr;
+
+ setbits_be16(odrp, 1 << (31 - iopin->pin));
}
}
static __inline__ void
iopin_set_act(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr;
- *odrp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *odrp = &immap->im_ioport.iop_paodr;
+
+ clrbits_be16(odrp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr;
- *odrp &= ~(1 << (31 - iopin->pin));
+ ushort __iomem *odrp = &immap->im_cpm.cp_pbodr;
+
+ clrbits_be16(odrp, 1 << (31 - iopin->pin));
}
}
static __inline__ uint
iopin_is_odr(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr;
- return (*odrp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *odrp = &immap->im_ioport.iop_paodr;
+
+ return (in_be16(odrp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr;
- return (*odrp >> (31 - iopin->pin)) & 1;
+ ushort __iomem *odrp = &immap->im_cpm.cp_pbodr;
+
+ return (in_be16(odrp) >> (31 - iopin->pin)) & 1;
}
return 0;
}
@@ -214,12 +275,16 @@ iopin_is_odr(iopin_t *iopin)
static __inline__ uint
iopin_is_act(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr;
- return ((*odrp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *odrp = &immap->im_ioport.iop_paodr;
+
+ return ((in_be16(odrp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr;
- return ((*odrp >> (31 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *odrp = &immap->im_cpm.cp_pbodr;
+
+ return ((in_be16(odrp) >> (31 - iopin->pin)) & 1) ^ 1;
}
return 0;
}
@@ -227,54 +292,72 @@ iopin_is_act(iopin_t *iopin)
static __inline__ void
iopin_set_ded(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar;
- *parp |= (1 << (15 - iopin->pin));
+ ushort __iomem *parp = &immap->im_ioport.iop_papar;
+
+ setbits_be16(parp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar;
- *parp |= (1 << (31 - iopin->pin));
+ uint __iomem *parp = &immap->im_cpm.cp_pbpar;
+
+ setbits_be32(parp, 1 << (31 - iopin->pin));
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar;
- *parp |= (1 << (15 - iopin->pin));
+ ushort __iomem *parp = &immap->im_ioport.iop_pcpar;
+
+ setbits_be16(parp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar;
- *parp |= (1 << (15 - iopin->pin));
+ ushort __iomem *parp = &immap->im_ioport.iop_pdpar;
+
+ setbits_be16(parp, 1 << (15 - iopin->pin));
}
}
static __inline__ void
iopin_set_gen(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar;
- *parp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *parp = &immap->im_ioport.iop_papar;
+
+ clrbits_be16(parp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar;
- *parp &= ~(1 << (31 - iopin->pin));
+ uint __iomem *parp = &immap->im_cpm.cp_pbpar;
+
+ clrbits_be32(parp, 1 << (31 - iopin->pin));
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar;
- *parp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *parp = &immap->im_ioport.iop_pcpar;
+
+ clrbits_be16(parp, 1 << (15 - iopin->pin));
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar;
- *parp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *parp = &immap->im_ioport.iop_pdpar;
+
+ clrbits_be16(parp, 1 << (15 - iopin->pin));
}
}
static __inline__ uint
iopin_is_ded(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar;
- return (*parp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *parp = &immap->im_ioport.iop_papar;
+
+ return (in_be16(parp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar;
- return (*parp >> (31 - iopin->pin)) & 1;
+ uint __iomem *parp = &immap->im_cpm.cp_pbpar;
+
+ return (in_be32(parp) >> (31 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar;
- return (*parp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *parp = &immap->im_ioport.iop_pcpar;
+
+ return (in_be16(parp) >> (15 - iopin->pin)) & 1;
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar;
- return (*parp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *parp = &immap->im_ioport.iop_pdpar;
+
+ return (in_be16(parp) >> (15 - iopin->pin)) & 1;
}
return 0;
}
@@ -282,18 +365,24 @@ iopin_is_ded(iopin_t *iopin)
static __inline__ uint
iopin_is_gen(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTA) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar;
- return ((*parp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *parp = &immap->im_ioport.iop_papar;
+
+ return ((in_be16(parp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTB) {
- volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar;
- return ((*parp >> (31 - iopin->pin)) & 1) ^ 1;
+ uint __iomem *parp = &immap->im_cpm.cp_pbpar;
+
+ return ((in_be32(parp) >> (31 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTC) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar;
- return ((*parp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *parp = &immap->im_ioport.iop_pcpar;
+
+ return ((in_be16(parp) >> (15 - iopin->pin)) & 1) ^ 1;
} else if (iopin->port == IOPIN_PORTD) {
- volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar;
- return ((*parp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *parp = &immap->im_ioport.iop_pdpar;
+
+ return ((in_be16(parp) >> (15 - iopin->pin)) & 1) ^ 1;
}
return 0;
}
@@ -301,27 +390,36 @@ iopin_is_gen(iopin_t *iopin)
static __inline__ void
iopin_set_opt2(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso;
- *sorp |= (1 << (15 - iopin->pin));
+ ushort __iomem *sorp = &immap->im_ioport.iop_pcso;
+
+ setbits_be16(sorp, 1 << (15 - iopin->pin));
}
}
static __inline__ void
iopin_set_opt1(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso;
- *sorp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *sorp = &immap->im_ioport.iop_pcso;
+
+ clrbits_be16(sorp, 1 << (15 - iopin->pin));
}
}
static __inline__ uint
iopin_is_opt2(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso;
- return (*sorp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *sorp = &immap->im_ioport.iop_pcso;
+
+ return (in_be16(sorp) >> (15 - iopin->pin)) & 1;
}
return 0;
}
@@ -329,9 +427,12 @@ iopin_is_opt2(iopin_t *iopin)
static __inline__ uint
iopin_is_opt1(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso;
- return ((*sorp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *sorp = &immap->im_ioport.iop_pcso;
+
+ return ((in_be16(sorp) >> (15 - iopin->pin)) & 1) ^ 1;
}
return 0;
}
@@ -339,27 +440,36 @@ iopin_is_opt1(iopin_t *iopin)
static __inline__ void
iopin_set_falledge(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint;
- *intp |= (1 << (15 - iopin->pin));
+ ushort __iomem *intp = &immap->im_ioport.iop_pcint;
+
+ setbits_be16(intp, 1 << (15 - iopin->pin));
}
}
static __inline__ void
iopin_set_anyedge(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint;
- *intp &= ~(1 << (15 - iopin->pin));
+ ushort __iomem *intp = &immap->im_ioport.iop_pcint;
+
+ clrbits_be16(intp, 1 << (15 - iopin->pin));
}
}
static __inline__ uint
iopin_is_falledge(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint;
- return (*intp >> (15 - iopin->pin)) & 1;
+ ushort __iomem *intp = &immap->im_ioport.iop_pcint;
+
+ return (in_be16(intp) >> (15 - iopin->pin)) & 1;
}
return 0;
}
@@ -367,9 +477,12 @@ iopin_is_falledge(iopin_t *iopin)
static __inline__ uint
iopin_is_anyedge(iopin_t *iopin)
{
+ immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
+
if (iopin->port == IOPIN_PORTC) {
- volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint;
- return ((*intp >> (15 - iopin->pin)) & 1) ^ 1;
+ ushort __iomem *intp = &immap->im_ioport.iop_pcint;
+
+ return ((in_be16(intp) >> (15 - iopin->pin)) & 1) ^ 1;
}
return 0;
}