int mcffec_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, u16 value) { #ifdef MII_DEBUG printf("miiphy_write(0x%x) @ 0x%x = 0x%04x\n", reg, addr, value); #endif mii_send(mk_mii_write(addr, reg, value)); return 0; }
static void mpc885ads_scc_phy_init(char phy_addr) { volatile immap_t *immap; volatile fec_t *fecp; bd_t *bd; bd = (bd_t *) __res; immap = (immap_t *) IMAP_ADDR; /* pointer to internal registers */ fecp = &(immap->im_cpm.cp_fec); /* Enable MII pins of the FEC1 */ setbits16(&immap->im_ioport.iop_pdpar, 0x0080); clrbits16(&immap->im_ioport.iop_pddir, 0x0080); /* Set MII speed to 2.5 MHz */ out_be32(&fecp->fec_mii_speed, ((((bd->bi_intfreq + 4999999) / 2500000) / 2) & 0x3F) << 1); /* Enable FEC pin MUX */ setbits32(&fecp->fec_ecntrl, MII_ECNTRL_PINMUX); setbits32(&fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); out_be32(&fecp->fec_mii_data, mk_mii_write(MII_BMCR, BMCR_ISOLATE, phy_addr)); udelay(100); out_be32(&fecp->fec_mii_data, mk_mii_write(MII_ADVERTISE, ADVERTISE_10HALF | ADVERTISE_CSMA, phy_addr)); udelay(100); /* Disable FEC MII settings */ clrbits32(&fecp->fec_ecntrl, MII_ECNTRL_PINMUX); clrbits32(&fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); out_be32(&fecp->fec_mii_speed, 0); }
int mcffec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { #ifdef MII_DEBUG printf("miiphy_write(0x%x) @ 0x%x = ", reg, addr); #endif mii_send(mk_mii_write(addr, reg, value)); #ifdef MII_DEBUG printf("0x%04x\n", value); #endif return 0; }
int mcffec_miiphy_write(char *devname, unsigned char addr, unsigned char reg, unsigned short value) { short rdreg; /* register working value */ #ifdef MII_DEBUG printf("miiphy_write(0x%x) @ 0x%x = ", reg, addr); #endif rdreg = mii_send(mk_mii_write(addr, reg, value)); #ifdef MII_DEBUG printf("0x%04x\n", value); #endif return 0; }
static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val) { struct fec_info* fec = bus->priv; struct fec __iomem *fecp = fec->fecp; int i; /* this must never happen */ BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0); /* Add PHY address to register command. */ out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val)); for (i = 0; i < FEC_MII_LOOPS; i++) if ((in_be32(&fecp->fec_ievent) & FEC_ENET_MII) != 0) break; if (i < FEC_MII_LOOPS) out_be32(&fecp->fec_ievent, FEC_ENET_MII); return 0; }
static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val) { struct fec_info* fec = bus->priv; fec_t __iomem *fecp = fec->fecp; int i; BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0); out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val)); for (i = 0; i < FEC_MII_LOOPS; i++) if ((in_be32(&fecp->fec_ievent) & FEC_ENET_MII) != 0) break; if (i < FEC_MII_LOOPS) out_be32(&fecp->fec_ievent, FEC_ENET_MII); return 0; }