652 struct delayed_work thread; |
652 struct delayed_work thread; |
653 |
653 |
654 struct mii_if_info mii; |
654 struct mii_if_info mii; |
655 unsigned int regs_len; |
655 unsigned int regs_len; |
656 unsigned long fifo_copy_timeout; |
656 unsigned long fifo_copy_timeout; |
657 |
657 |
658 ec_device_t *ecdev; |
658 ec_device_t *ecdev; |
659 }; |
659 }; |
660 |
660 |
661 MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); |
661 MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); |
662 MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver"); |
662 MODULE_DESCRIPTION("RealTek RTL-8139 EtherCAT driver"); |
1064 tp->mii.mdio_write = mdio_write; |
1064 tp->mii.mdio_write = mdio_write; |
1065 tp->mii.phy_id_mask = 0x3f; |
1065 tp->mii.phy_id_mask = 0x3f; |
1066 tp->mii.reg_num_mask = 0x1f; |
1066 tp->mii.reg_num_mask = 0x1f; |
1067 |
1067 |
1068 /* dev is fully set up and ready to use now */ |
1068 /* dev is fully set up and ready to use now */ |
1069 |
1069 |
1070 // offer device to EtherCAT master module |
1070 // offer device to EtherCAT master module |
1071 tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE); |
1071 tp->ecdev = ecdev_offer(dev, ec_poll, THIS_MODULE); |
1072 |
1072 |
1073 if (!tp->ecdev) { |
1073 if (!tp->ecdev) { |
1074 DPRINTK("about to register device named %s (%p)...\n", dev->name, dev); |
1074 DPRINTK("about to register device named %s (%p)...\n", dev->name, dev); |
1143 |
1143 |
1144 /* Put the chip into low-power mode. */ |
1144 /* Put the chip into low-power mode. */ |
1145 if (rtl_chip_info[tp->chipset].flags & HasHltClk) |
1145 if (rtl_chip_info[tp->chipset].flags & HasHltClk) |
1146 RTL_W8 (HltClk, 'H'); /* 'R' would leave the clock running. */ |
1146 RTL_W8 (HltClk, 'H'); /* 'R' would leave the clock running. */ |
1147 |
1147 |
1148 if (tp->ecdev && ecdev_open(tp->ecdev)) { |
1148 if (tp->ecdev) { |
1149 ecdev_withdraw(tp->ecdev); |
1149 i = ecdev_open(tp->ecdev); |
1150 goto err_out; |
1150 if (i) { |
|
1151 ecdev_withdraw(tp->ecdev); |
|
1152 goto err_out; |
|
1153 } |
1151 } |
1154 } |
1152 |
1155 |
1153 return 0; |
1156 return 0; |
1154 |
1157 |
1155 err_out: |
1158 err_out: |
1809 |
1812 |
1810 if (tp->ecdev) { |
1813 if (tp->ecdev) { |
1811 wmb(); |
1814 wmb(); |
1812 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1815 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1813 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1816 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1814 |
1817 |
1815 dev->trans_start = jiffies; |
1818 dev->trans_start = jiffies; |
1816 |
1819 |
1817 tp->cur_tx++; |
1820 tp->cur_tx++; |
1818 } else { |
1821 } else { |
1819 spin_lock_irqsave(&tp->lock, flags); |
1822 spin_lock_irqsave(&tp->lock, flags); |
1820 wmb(); |
1823 wmb(); |
1821 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1824 RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1822 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1825 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1823 |
1826 |
1824 dev->trans_start = jiffies; |
1827 dev->trans_start = jiffies; |
1825 |
1828 |
1826 tp->cur_tx++; |
1829 tp->cur_tx++; |
1827 |
1830 |
1828 if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) |
1831 if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) |
1829 netif_stop_queue (dev); |
1832 netif_stop_queue (dev); |
1830 spin_unlock_irqrestore(&tp->lock, flags); |
1833 spin_unlock_irqrestore(&tp->lock, flags); |
1831 |
1834 |
1832 if (netif_msg_tx_queued(tp)) |
1835 if (netif_msg_tx_queued(tp)) |
1833 printk (KERN_DEBUG "%s: Queued Tx packet size %u to slot %d.\n", |
1836 printk (KERN_DEBUG "%s: Queued Tx packet size %u to slot %d.\n", |
1834 dev->name, len, entry); |
1837 dev->name, len, entry); |
1835 } |
1838 } |
1836 |
1839 |