* terms of the GNU Public License, Version 2, incorporated
  * herein by reference.
  *
- * Copyright 2004-2011 Freescale Semiconductor, Inc.
+ * Copyright 2004-2011, 2013 Freescale Semiconductor, Inc.
  * (C) Copyright 2003, Motorola, Inc.
  * author Andy Fleming
  *
 #endif
 #ifdef CONFIG_MPC85XX_FEC
        {
-               .regs = (tsec_t *)(TSEC_BASE_ADDR + 0x2000),
+               .regs = TSEC_GET_REGS(2, 0x2000),
                .devname = CONFIG_MPC85XX_FEC_NAME,
                .phyaddr = FEC_PHY_ADDR,
                .flags = FEC_FLAGS,
  * those we don't care about (unless zero is bad, in which case,
  * choose a more appropriate value)
  */
-static void init_registers(tsec_t *regs)
+static void init_registers(struct tsec __iomem *regs)
 {
        /* Clear IEVENT */
        out_be32(®s->ievent, IEVENT_INIT_CLEAR);
  */
 static void adjust_link(struct tsec_private *priv, struct phy_device *phydev)
 {
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
        u32 ecntrl, maccfg2;
 
        if (!phydev->link) {
 void redundant_init(struct eth_device *dev)
 {
        struct tsec_private *priv = dev->priv;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
        uint t, count = 0;
        int fail = 1;
        static const u8 pkt[] = {
 {
        int i;
        struct tsec_private *priv = (struct tsec_private *)dev->priv;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
 
        /* reset the indices to zero */
        rxIdx = 0;
        int i;
        int result = 0;
        struct tsec_private *priv = (struct tsec_private *)dev->priv;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
 
        /* Find an empty buffer descriptor */
        for (i = 0; rtx.txbd[txIdx].status & TXBD_READY; i++) {
 {
        int length;
        struct tsec_private *priv = (struct tsec_private *)dev->priv;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
 
        while (!(rtx.rxbd[rxIdx].status & RXBD_EMPTY)) {
 
 static void tsec_halt(struct eth_device *dev)
 {
        struct tsec_private *priv = (struct tsec_private *)dev->priv;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
 
        clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS);
        setbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS);
        char tmpbuf[MAC_ADDR_LEN];
        int i;
        struct tsec_private *priv = (struct tsec_private *)dev->priv;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
        int ret;
 
        /* Make sure the controller is stopped */
 
 static phy_interface_t tsec_get_interface(struct tsec_private *priv)
 {
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
        u32 ecntrl;
 
        ecntrl = in_be32(®s->ecntrl);
 {
        struct tsec_private *priv = (struct tsec_private *)dev->priv;
        struct phy_device *phydev;
-       tsec_t *regs = priv->regs;
+       struct tsec __iomem *regs = priv->regs;
        u32 supported = (SUPPORTED_10baseT_Half |
                        SUPPORTED_10baseT_Full |
                        SUPPORTED_100baseT_Half |
 {
        struct fsl_pq_mdio_info info;
 
-       info.regs = (struct tsec_mii_mng *)CONFIG_SYS_MDIO_BASE_ADDR;
+       info.regs = TSEC_GET_MDIO_REGS_BASE(1);
        info.name = DEFAULT_MII_NAME;
 
        fsl_pq_mdio_init(bis, &info);
 
  *  terms of the GNU Public License, Version 2, incorporated
  *  herein by reference.
  *
- * Copyright 2004, 2007, 2009, 2011  Freescale Semiconductor, Inc.
+ * Copyright 2004, 2007, 2009, 2011, 2013 Freescale Semiconductor, Inc.
  * (C) Copyright 2003, Motorola, Inc.
  * maintained by Xianghua Xiao (x.xiao@motorola.com)
  * author Andy Fleming
 
 #define CONFIG_SYS_MDIO_BASE_ADDR (MDIO_BASE_ADDR + 0x520)
 
+#define TSEC_GET_REGS(num, offset) \
+       (struct tsec __iomem *)\
+       (TSEC_BASE_ADDR + (((num) - 1) * (offset)))
+
+#define TSEC_GET_REGS_BASE(num) \
+       TSEC_GET_REGS((num), TSEC_SIZE)
+
+#define TSEC_GET_MDIO_REGS(num, offset) \
+       (struct tsec_mii_mng __iomem *)\
+       (CONFIG_SYS_MDIO_BASE_ADDR  + ((num) - 1) * (offset))
+
+#define TSEC_GET_MDIO_REGS_BASE(num) \
+       TSEC_GET_MDIO_REGS((num), TSEC_MDIO_OFFSET)
+
 #define DEFAULT_MII_NAME "FSL_MDIO"
 
 #define STD_TSEC_INFO(num) \
 {                      \
-       .regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)), \
-       .miiregs_sgmii = (struct tsec_mii_mng *)(CONFIG_SYS_MDIO_BASE_ADDR \
-                                        + (num - 1) * TSEC_MDIO_OFFSET), \
+       .regs = TSEC_GET_REGS_BASE(num), \
+       .miiregs_sgmii = TSEC_GET_MDIO_REGS_BASE(num), \
        .devname = CONFIG_TSEC##num##_NAME, \
        .phyaddr = TSEC##num##_PHY_ADDR, \
        .flags = TSEC##num##_FLAGS, \
 
 #define SET_STD_TSEC_INFO(x, num) \
 {                      \
-       x.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)); \
-       x.miiregs_sgmii = (struct tsec_mii_mng *)(CONFIG_SYS_MDIO_BASE_ADDR \
-                                         + (num - 1) * TSEC_MDIO_OFFSET); \
+       x.regs = TSEC_GET_REGS_BASE(num); \
+       x.miiregs_sgmii = TSEC_GET_MDIO_REGS_BASE(num); \
        x.devname = CONFIG_TSEC##num##_NAME; \
        x.phyaddr = TSEC##num##_PHY_ADDR; \
        x.flags = TSEC##num##_FLAGS;\
        uint    res2[24];
 } tsec_hash_t;
 
-typedef struct tsec
-{
+struct tsec {
        /* General Control and Status Registers (0x2_n000) */
        uint    res000[4];
 
 
        /* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */
        uint    resc00[256];
-} tsec_t;
+};
 
 #define TSEC_GIGABIT (1 << 0)
 
 #define TSEC_SGMII     (1 << 2)        /* MAC-PHY interface uses SGMII */
 
 struct tsec_private {
-       tsec_t *regs;
-       struct tsec_mii_mng *phyregs_sgmii;
+       struct tsec __iomem *regs;
+       struct tsec_mii_mng __iomem *phyregs_sgmii;
        struct phy_device *phydev;
        phy_interface_t interface;
        struct mii_dev *bus;
 };
 
 struct tsec_info_struct {
-       tsec_t *regs;
-       struct tsec_mii_mng *miiregs_sgmii;
+       struct tsec __iomem *regs;
+       struct tsec_mii_mng __iomem *miiregs_sgmii;
        char *devname;
        char *mii_devname;
        phy_interface_t interface;