From 3456a4958ec2ecb2b2e35b1f37039fb28274f182 Mon Sep 17 00:00:00 2001 From: Scott Sweeny Date: Wed, 1 Sep 2010 12:02:01 -0400 Subject: Freescale board patch for MPC5125_TWR board --- cpu/mpc512x/iopin.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'cpu/mpc512x/iopin.c') diff --git a/cpu/mpc512x/iopin.c b/cpu/mpc512x/iopin.c index 78f4fa1e8c..4067eb2141 100644 --- a/cpu/mpc512x/iopin.c +++ b/cpu/mpc512x/iopin.c @@ -24,26 +24,41 @@ #include #include #include +#include void iopin_initialize(iopin_t *ioregs_init, int len) { short i, j, p; - u_long *reg; immap_t *im = (immap_t *)CONFIG_SYS_IMMR; +#ifdef CONFIG_ADS5125 + u_char *reg; +#else + u_long *reg; +#endif - reg = (u_long *)&(im->io_ctrl.regs[0]); - + reg = &im->io_ctrl.regs[0]; if (sizeof(ioregs_init) == 0) return; for (i = 0; i < len; i++) { +#ifdef CONFIG_ADS5125 + for (p = 0, j = ioregs_init[i].p_offset; + p < ioregs_init[i].nr_pins; p++, j++) { + if (ioregs_init[i].bit_or) + setbits(8, &(reg[j]), ioregs_init[i].val); + else + out_8(®[j], ioregs_init[i].val); + } +#else for (p = 0, j = ioregs_init[i].p_offset / sizeof(u_long); p < ioregs_init[i].nr_pins; p++, j++) { if (ioregs_init[i].bit_or) - reg[j] |= ioregs_init[i].val; + setbits(be32, &(reg[j]), ioregs_init[i].val); else - reg[j] = ioregs_init[i].val; + out_be32(®[j], ioregs_init[i].val); } +#endif } + return; } -- cgit v1.2.3