]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/linux-mtx-1-2.4.27/14-au1000-eth-link-beat.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / linux-mtx-1-2.4.27 / 14-au1000-eth-link-beat.diff
1 --- linux/drivers/net/au1000_eth.c.orig 2004-11-23 12:01:00.551663672 +0100
2 +++ linux/drivers/net/au1000_eth.c      2004-11-23 12:08:36.795304096 +0100
3 @@ -6,7 +6,9 @@
4   * Copyright 2002 TimeSys Corp.
5   * Author: MontaVista Software, Inc.
6   *             ppopov@mvista.com or source@mvista.com
7 - *
8 + *         Bjoern Riemer 2004
9 + *           riemer@fokus.fraunhofer.de or riemer@riemer-nt.de
10 + *             // fixed the link beat detection with ioctls (SIOCGMIIPHY)
11   * ########################################################################
12   *
13   *  This program is free software; you can distribute it and/or modify it
14 @@ -1383,6 +1385,10 @@
15         aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed);
16         control = MAC_DISABLE_RX_OWN | MAC_RX_ENABLE | MAC_TX_ENABLE;
17  #ifndef CONFIG_CPU_LITTLE_ENDIAN
18 +       /*riemer: fix for startup without cable */
19 +       if (!link) 
20 +               dev->flags &= ~IFF_RUNNING;
21 +
22         control |= MAC_BIG_ENDIAN;
23  #endif
24         if (link && (dev->if_port == IF_PORT_100BASEFX)) {
25 @@ -1841,17 +1847,35 @@
26  
27  static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
28  {
29 -       //u16 *data = (u16 *)&rq->ifr_data;
30 +/*
31 +// This structure is used in all SIOCxMIIxxx ioctl calls 
32 +struct mii_ioctl_data {
33 + 0      u16             phy_id;
34 + 1      u16             reg_num;
35 + 2      u16             val_in;
36 + 3      u16             val_out;
37 +};*/
38 +       u16 *data = (u16 *)&rq->ifr_data;
39 +       struct au1000_private *aup = (struct au1000_private *) dev->priv;
40 +       //struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
41  
42         /* fixme */
43         switch(cmd) { 
44                 case SIOCDEVPRIVATE:    /* Get the address of the PHY in use. */
45 -               //data[0] = PHY_ADDRESS;
46 +               case SIOCGMIIPHY:
47 +                       if (!netif_running(dev))
48 +                               return -EINVAL;
49 +                       data[0] = aup->phy_addr;
50                 case SIOCDEVPRIVATE+1:  /* Read the specified MII register. */
51 -               //data[3] = mdio_read(ioaddr, data[0], data[1]); 
52 +               case SIOCGMIIREG:
53 +                       data[3] =  mdio_read(dev, data[0], data[1]); 
54 +                       //data->val_out = mdio_read(dev,data->phy_id,data->reg_num);
55                 return 0;
56                 case SIOCDEVPRIVATE+2:  /* Write the specified MII register */
57 -               //mdio_write(ioaddr, data[0], data[1], data[2]);
58 +               case SIOCSMIIREG: 
59 +                       if (!capable(CAP_NET_ADMIN))
60 +                               return -EPERM;
61 +                       mdio_write(dev, data[0], data[1],data[2]);
62                 return 0;
63                 default:
64                 return -EOPNOTSUPP;