diff options
Diffstat (limited to 'drivers/net/sk98lin')
-rw-r--r-- | drivers/net/sk98lin/h/skdrv2nd.h | 2 | ||||
-rw-r--r-- | drivers/net/sk98lin/skdim.c | 4 | ||||
-rw-r--r-- | drivers/net/sk98lin/skethtool.c | 26 | ||||
-rw-r--r-- | drivers/net/sk98lin/skge.c | 58 |
4 files changed, 85 insertions, 5 deletions
diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h index 778d9e618ebd..3fa67171e832 100644 --- a/drivers/net/sk98lin/h/skdrv2nd.h +++ b/drivers/net/sk98lin/h/skdrv2nd.h | |||
@@ -160,7 +160,7 @@ struct s_IOCTL { | |||
160 | 160 | ||
161 | /* | 161 | /* |
162 | ** Interim definition of SK_DRV_TIMER placed in this file until | 162 | ** Interim definition of SK_DRV_TIMER placed in this file until |
163 | ** common modules have boon finallized | 163 | ** common modules have been finalized |
164 | */ | 164 | */ |
165 | #define SK_DRV_TIMER 11 | 165 | #define SK_DRV_TIMER 11 |
166 | #define SK_DRV_MODERATION_TIMER 1 | 166 | #define SK_DRV_MODERATION_TIMER 1 |
diff --git a/drivers/net/sk98lin/skdim.c b/drivers/net/sk98lin/skdim.c index 07c1b4c8699d..37ce03fb8de3 100644 --- a/drivers/net/sk98lin/skdim.c +++ b/drivers/net/sk98lin/skdim.c | |||
@@ -252,7 +252,7 @@ SkDimEnableModerationIfNeeded(SK_AC *pAC) { | |||
252 | 252 | ||
253 | /******************************************************************************* | 253 | /******************************************************************************* |
254 | ** Function : SkDimDisplayModerationSettings | 254 | ** Function : SkDimDisplayModerationSettings |
255 | ** Description : Displays the current settings regaring interrupt moderation | 255 | ** Description : Displays the current settings regarding interrupt moderation |
256 | ** Programmer : Ralph Roesler | 256 | ** Programmer : Ralph Roesler |
257 | ** Last Modified: 22-mar-03 | 257 | ** Last Modified: 22-mar-03 |
258 | ** Returns : void (!) | 258 | ** Returns : void (!) |
@@ -510,7 +510,7 @@ EnableIntMod(SK_AC *pAC) { | |||
510 | 510 | ||
511 | /******************************************************************************* | 511 | /******************************************************************************* |
512 | ** Function : DisableIntMod() | 512 | ** Function : DisableIntMod() |
513 | ** Description : Disbles the interrupt moderation independent of what inter- | 513 | ** Description : Disables the interrupt moderation independent of what inter- |
514 | ** rupts are running or not | 514 | ** rupts are running or not |
515 | ** Programmer : Ralph Roesler | 515 | ** Programmer : Ralph Roesler |
516 | ** Last Modified: 23-mar-03 | 516 | ** Last Modified: 23-mar-03 |
diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c index e5cb5b548b88..36460694eb82 100644 --- a/drivers/net/sk98lin/skethtool.c +++ b/drivers/net/sk98lin/skethtool.c | |||
@@ -581,6 +581,30 @@ static int setRxCsum(struct net_device *dev, u32 data) | |||
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
583 | 583 | ||
584 | static int getRegsLen(struct net_device *dev) | ||
585 | { | ||
586 | return 0x4000; | ||
587 | } | ||
588 | |||
589 | /* | ||
590 | * Returns copy of whole control register region | ||
591 | * Note: skip RAM address register because accessing it will | ||
592 | * cause bus hangs! | ||
593 | */ | ||
594 | static void getRegs(struct net_device *dev, struct ethtool_regs *regs, | ||
595 | void *p) | ||
596 | { | ||
597 | DEV_NET *pNet = netdev_priv(dev); | ||
598 | const void __iomem *io = pNet->pAC->IoBase; | ||
599 | |||
600 | regs->version = 1; | ||
601 | memset(p, 0, regs->len); | ||
602 | memcpy_fromio(p, io, B3_RAM_ADDR); | ||
603 | |||
604 | memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, | ||
605 | regs->len - B3_RI_WTO_R1); | ||
606 | } | ||
607 | |||
584 | const struct ethtool_ops SkGeEthtoolOps = { | 608 | const struct ethtool_ops SkGeEthtoolOps = { |
585 | .get_settings = getSettings, | 609 | .get_settings = getSettings, |
586 | .set_settings = setSettings, | 610 | .set_settings = setSettings, |
@@ -599,4 +623,6 @@ const struct ethtool_ops SkGeEthtoolOps = { | |||
599 | .set_tx_csum = setTxCsum, | 623 | .set_tx_csum = setTxCsum, |
600 | .get_rx_csum = getRxCsum, | 624 | .get_rx_csum = getRxCsum, |
601 | .set_rx_csum = setRxCsum, | 625 | .set_rx_csum = setRxCsum, |
626 | .get_regs = getRegs, | ||
627 | .get_regs_len = getRegsLen, | ||
602 | }; | 628 | }; |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index d4913c3de2a1..12cbfd190dd7 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -113,6 +113,7 @@ | |||
113 | #include <linux/init.h> | 113 | #include <linux/init.h> |
114 | #include <linux/dma-mapping.h> | 114 | #include <linux/dma-mapping.h> |
115 | #include <linux/ip.h> | 115 | #include <linux/ip.h> |
116 | #include <linux/mii.h> | ||
116 | 117 | ||
117 | #include "h/skdrv1st.h" | 118 | #include "h/skdrv1st.h" |
118 | #include "h/skdrv2nd.h" | 119 | #include "h/skdrv2nd.h" |
@@ -1561,7 +1562,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ | |||
1561 | 1562 | ||
1562 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { | 1563 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { |
1563 | u16 hdrlen = pMessage->h.raw - pMessage->data; | 1564 | u16 hdrlen = pMessage->h.raw - pMessage->data; |
1564 | u16 offset = hdrlen + pMessage->csum; | 1565 | u16 offset = hdrlen + pMessage->csum_offset; |
1565 | 1566 | ||
1566 | if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && | 1567 | if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && |
1567 | (pAC->GIni.GIChipRev == 0) && | 1568 | (pAC->GIni.GIChipRev == 0) && |
@@ -1680,7 +1681,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ | |||
1680 | */ | 1681 | */ |
1681 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { | 1682 | if (pMessage->ip_summed == CHECKSUM_PARTIAL) { |
1682 | u16 hdrlen = pMessage->h.raw - pMessage->data; | 1683 | u16 hdrlen = pMessage->h.raw - pMessage->data; |
1683 | u16 offset = hdrlen + pMessage->csum; | 1684 | u16 offset = hdrlen + pMessage->csum_offset; |
1684 | 1685 | ||
1685 | Control = BMU_STFWD; | 1686 | Control = BMU_STFWD; |
1686 | 1687 | ||
@@ -2843,6 +2844,56 @@ unsigned long Flags; /* for spin lock */ | |||
2843 | return(&pAC->stats); | 2844 | return(&pAC->stats); |
2844 | } /* SkGeStats */ | 2845 | } /* SkGeStats */ |
2845 | 2846 | ||
2847 | /* | ||
2848 | * Basic MII register access | ||
2849 | */ | ||
2850 | static int SkGeMiiIoctl(struct net_device *dev, | ||
2851 | struct mii_ioctl_data *data, int cmd) | ||
2852 | { | ||
2853 | DEV_NET *pNet = netdev_priv(dev); | ||
2854 | SK_AC *pAC = pNet->pAC; | ||
2855 | SK_IOC IoC = pAC->IoBase; | ||
2856 | int Port = pNet->PortNr; | ||
2857 | SK_GEPORT *pPrt = &pAC->GIni.GP[Port]; | ||
2858 | unsigned long Flags; | ||
2859 | int err = 0; | ||
2860 | int reg = data->reg_num & 0x1f; | ||
2861 | SK_U16 val = data->val_in; | ||
2862 | |||
2863 | if (!netif_running(dev)) | ||
2864 | return -ENODEV; /* Phy still in reset */ | ||
2865 | |||
2866 | spin_lock_irqsave(&pAC->SlowPathLock, Flags); | ||
2867 | switch(cmd) { | ||
2868 | case SIOCGMIIPHY: | ||
2869 | data->phy_id = pPrt->PhyAddr; | ||
2870 | |||
2871 | /* fallthru */ | ||
2872 | case SIOCGMIIREG: | ||
2873 | if (pAC->GIni.GIGenesis) | ||
2874 | SkXmPhyRead(pAC, IoC, Port, reg, &val); | ||
2875 | else | ||
2876 | SkGmPhyRead(pAC, IoC, Port, reg, &val); | ||
2877 | |||
2878 | data->val_out = val; | ||
2879 | break; | ||
2880 | |||
2881 | case SIOCSMIIREG: | ||
2882 | if (!capable(CAP_NET_ADMIN)) | ||
2883 | err = -EPERM; | ||
2884 | |||
2885 | else if (pAC->GIni.GIGenesis) | ||
2886 | SkXmPhyWrite(pAC, IoC, Port, reg, val); | ||
2887 | else | ||
2888 | SkGmPhyWrite(pAC, IoC, Port, reg, val); | ||
2889 | break; | ||
2890 | default: | ||
2891 | err = -EOPNOTSUPP; | ||
2892 | } | ||
2893 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | ||
2894 | return err; | ||
2895 | } | ||
2896 | |||
2846 | 2897 | ||
2847 | /***************************************************************************** | 2898 | /***************************************************************************** |
2848 | * | 2899 | * |
@@ -2876,6 +2927,9 @@ int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32); | |||
2876 | pNet = netdev_priv(dev); | 2927 | pNet = netdev_priv(dev); |
2877 | pAC = pNet->pAC; | 2928 | pAC = pNet->pAC; |
2878 | 2929 | ||
2930 | if (cmd == SIOCGMIIPHY || cmd == SIOCSMIIREG || cmd == SIOCGMIIREG) | ||
2931 | return SkGeMiiIoctl(dev, if_mii(rq), cmd); | ||
2932 | |||
2879 | if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) { | 2933 | if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) { |
2880 | return -EFAULT; | 2934 | return -EFAULT; |
2881 | } | 2935 | } |