[uClinux-dev] [PATCH] fec cleanup : else + icr
Greg Ungerer
gerg at snapgear.com
Mon Mar 26 19:35:32 EST 2007
Hi Philippe,
Philippe De Muyter wrote:
> Some cleanup :
> - Indent all the `else' the same way.
> - Improve the readability of mii_do_cmd.
> - On the MCF5272, there is no need to read the ICR before writing it :
> the bit 4n+3 is a write-enable for the bits 4n,4n+1 and 4n+2.
>
> Signed-off-by: Philippe De Muyter <phdm at macqel.be>
>
> diff -r f8b279fd0eab drivers/net/fec.c
> --- a/drivers/net/fec.c Mon Mar 19 20:20:56 2007 -0700
> +++ b/drivers/net/fec.c Mon Mar 26 17:20:42 2007 +0200
[snip]
> @@ -770,14 +768,11 @@ mii_queue(struct net_device *dev, int re
>
> static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c)
> {
> - int k;
> -
> if(!c)
> return;
>
> - for(k = 0; (c+k)->mii_data != mk_mii_end; k++) {
> - mii_queue(dev, (c+k)->mii_data, (c+k)->funct);
> - }
This looks odd, why is this change needed?
Regards
Greg
> + for ( ; c->mii_data != mk_mii_end; c++)
> + mii_queue(dev, c->mii_data, c->funct);
> }
>
> static void mii_parse_sr(uint mii_reg, struct net_device *dev)
> @@ -794,7 +789,6 @@ static void mii_parse_sr(uint mii_reg, s
> status |= PHY_STAT_FAULT;
> if (mii_reg & 0x0020)
> status |= PHY_STAT_ANC;
> -
> *s = status;
> }
>
> @@ -1241,7 +1235,6 @@ mii_link_interrupt(int irq, void * dev_i
> #endif
>
> #if defined(CONFIG_M5272)
> -
> /*
> * Code specific to Coldfire 5272 setup.
> */
> @@ -1270,7 +1263,7 @@ static void __inline__ fec_request_intrs
> icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3);
> *icrp = 0x00000ddd;
> icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
> - *icrp = (*icrp & 0x70777777) | 0x0d000000;
> + *icrp = 0x0d000000;
> }
>
> static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
> @@ -1332,7 +1325,7 @@ static void __inline__ fec_disable_phy_i
> {
> volatile unsigned long *icrp;
> icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
> - *icrp = (*icrp & 0x70777777) | 0x08000000;
> + *icrp = 0x08000000;
> }
>
> static void __inline__ fec_phy_ack_intr(void)
> @@ -1340,7 +1333,7 @@ static void __inline__ fec_phy_ack_intr(
> volatile unsigned long *icrp;
> /* Acknowledge the interrupt */
> icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
> - *icrp = (*icrp & 0x77777777) | 0x08000000;
> + *icrp = 0x0d000000;
> }
>
> static void __inline__ fec_localhw_setup(void)
> @@ -1997,8 +1990,7 @@ static void mii_relink(struct net_device
> & (PHY_STAT_100FDX | PHY_STAT_10FDX))
> duplex = 1;
> fec_restart(dev, duplex);
> - }
> - else
> + } else
> fec_stop(dev);
>
> #if 0
> @@ -2096,8 +2088,7 @@ mii_discover_phy(uint mii_reg, struct ne
> fep->phy_id = phytype << 16;
> mii_queue(dev, mk_mii_read(MII_REG_PHYIR2),
> mii_discover_phy3);
> - }
> - else {
> + } else {
> fep->phy_addr++;
> mii_queue(dev, mk_mii_read(MII_REG_PHYIR1),
> mii_discover_phy);
> @@ -2558,8 +2549,7 @@ fec_restart(struct net_device *dev, int
> if (duplex) {
> fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;/* MII enable */
> fecp->fec_x_cntrl = 0x04; /* FD enable */
> - }
> - else {
> + } else {
> /* MII enable|No Rcv on Xmit */
> fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x06;
> fecp->fec_x_cntrl = 0x00;
>
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>
--
------------------------------------------------------------------------
Greg Ungerer -- Chief Software Dude EMAIL: gerg at snapgear.com
Secure Computing Corporation PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
More information about the uClinux-dev
mailing list