diff options
author | Jon Mason <jon.mason@exar.com> | 2010-11-10 23:26:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-11 12:30:22 -0500 |
commit | e7935c9669c27c5d530bff634c0c15f7a602d697 (patch) | |
tree | 5f2d6eded542d81bc7cae1a012ee5a0bbbe3d7ec /drivers/net/vxge/vxge-main.c | |
parent | c3150eac9f2e5f770b09d371f7716540219a46f6 (diff) |
vxge: Titan1A detection
Detect if the adapter is Titan or Titan1A, and tune the driver for this
hardware. Also, remove unnecessary function __vxge_hw_device_id_get.
Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Ram Vepa <ram.vepa@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge/vxge-main.c')
-rw-r--r-- | drivers/net/vxge/vxge-main.c | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index ea303a2af3aa..b8806a15bcaf 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -2012,8 +2012,23 @@ static int vxge_open_vpaths(struct vxgedev *vdev) | |||
2012 | 2012 | ||
2013 | for (i = 0; i < vdev->no_of_vpath; i++) { | 2013 | for (i = 0; i < vdev->no_of_vpath; i++) { |
2014 | vpath = &vdev->vpaths[i]; | 2014 | vpath = &vdev->vpaths[i]; |
2015 | |||
2016 | vxge_assert(vpath->is_configured); | 2015 | vxge_assert(vpath->is_configured); |
2016 | |||
2017 | if (!vdev->titan1) { | ||
2018 | struct vxge_hw_vp_config *vcfg; | ||
2019 | vcfg = &vdev->devh->config.vp_config[vpath->device_id]; | ||
2020 | |||
2021 | vcfg->rti.urange_a = RTI_T1A_RX_URANGE_A; | ||
2022 | vcfg->rti.urange_b = RTI_T1A_RX_URANGE_B; | ||
2023 | vcfg->rti.urange_c = RTI_T1A_RX_URANGE_C; | ||
2024 | vcfg->tti.uec_a = TTI_T1A_TX_UFC_A; | ||
2025 | vcfg->tti.uec_b = TTI_T1A_TX_UFC_B; | ||
2026 | vcfg->tti.uec_c = TTI_T1A_TX_UFC_C(vdev->mtu); | ||
2027 | vcfg->tti.uec_d = TTI_T1A_TX_UFC_D(vdev->mtu); | ||
2028 | vcfg->tti.ltimer_val = VXGE_T1A_TTI_LTIMER_VAL; | ||
2029 | vcfg->tti.rtimer_val = VXGE_T1A_TTI_RTIMER_VAL; | ||
2030 | } | ||
2031 | |||
2017 | attr.vp_id = vpath->device_id; | 2032 | attr.vp_id = vpath->device_id; |
2018 | attr.fifo_attr.callback = vxge_xmit_compl; | 2033 | attr.fifo_attr.callback = vxge_xmit_compl; |
2019 | attr.fifo_attr.txdl_term = vxge_tx_term; | 2034 | attr.fifo_attr.txdl_term = vxge_tx_term; |
@@ -2710,9 +2725,10 @@ vxge_open(struct net_device *dev) | |||
2710 | vxge_os_timer(vdev->vp_reset_timer, | 2725 | vxge_os_timer(vdev->vp_reset_timer, |
2711 | vxge_poll_vp_reset, vdev, (HZ/2)); | 2726 | vxge_poll_vp_reset, vdev, (HZ/2)); |
2712 | 2727 | ||
2713 | if (vdev->vp_lockup_timer.function == NULL) | 2728 | /* There is no need to check for RxD leak and RxD lookup on Titan1A */ |
2714 | vxge_os_timer(vdev->vp_lockup_timer, | 2729 | if (vdev->titan1 && vdev->vp_lockup_timer.function == NULL) |
2715 | vxge_poll_vp_lockup, vdev, (HZ/2)); | 2730 | vxge_os_timer(vdev->vp_lockup_timer, vxge_poll_vp_lockup, vdev, |
2731 | HZ / 2); | ||
2716 | 2732 | ||
2717 | set_bit(__VXGE_STATE_CARD_UP, &vdev->state); | 2733 | set_bit(__VXGE_STATE_CARD_UP, &vdev->state); |
2718 | 2734 | ||
@@ -2844,7 +2860,9 @@ static int do_vxge_close(struct net_device *dev, int do_io) | |||
2844 | 2860 | ||
2845 | smp_wmb(); | 2861 | smp_wmb(); |
2846 | } | 2862 | } |
2847 | del_timer_sync(&vdev->vp_lockup_timer); | 2863 | |
2864 | if (vdev->titan1) | ||
2865 | del_timer_sync(&vdev->vp_lockup_timer); | ||
2848 | 2866 | ||
2849 | del_timer_sync(&vdev->vp_reset_timer); | 2867 | del_timer_sync(&vdev->vp_reset_timer); |
2850 | 2868 | ||
@@ -3262,6 +3280,19 @@ static const struct net_device_ops vxge_netdev_ops = { | |||
3262 | #endif | 3280 | #endif |
3263 | }; | 3281 | }; |
3264 | 3282 | ||
3283 | static int __devinit vxge_device_revision(struct vxgedev *vdev) | ||
3284 | { | ||
3285 | int ret; | ||
3286 | u8 revision; | ||
3287 | |||
3288 | ret = pci_read_config_byte(vdev->pdev, PCI_REVISION_ID, &revision); | ||
3289 | if (ret) | ||
3290 | return -EIO; | ||
3291 | |||
3292 | vdev->titan1 = (revision == VXGE_HW_TITAN1_PCI_REVISION); | ||
3293 | return 0; | ||
3294 | } | ||
3295 | |||
3265 | static int __devinit vxge_device_register(struct __vxge_hw_device *hldev, | 3296 | static int __devinit vxge_device_register(struct __vxge_hw_device *hldev, |
3266 | struct vxge_config *config, | 3297 | struct vxge_config *config, |
3267 | int high_dma, int no_of_vpath, | 3298 | int high_dma, int no_of_vpath, |
@@ -3302,6 +3333,10 @@ static int __devinit vxge_device_register(struct __vxge_hw_device *hldev, | |||
3302 | vdev->rx_csum = 1; /* Enable Rx CSUM by default. */ | 3333 | vdev->rx_csum = 1; /* Enable Rx CSUM by default. */ |
3303 | vdev->rx_hwts = 0; | 3334 | vdev->rx_hwts = 0; |
3304 | 3335 | ||
3336 | ret = vxge_device_revision(vdev); | ||
3337 | if (ret < 0) | ||
3338 | goto _out1; | ||
3339 | |||
3305 | SET_NETDEV_DEV(ndev, &vdev->pdev->dev); | 3340 | SET_NETDEV_DEV(ndev, &vdev->pdev->dev); |
3306 | 3341 | ||
3307 | ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | | 3342 | ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | |