merge
This commit is contained in:
commit
fef51b5a26
|
|
@ -29,7 +29,7 @@
|
|||
#include "../ecdev.h"
|
||||
|
||||
#define DRV_EXTRAVERSION "-ec"
|
||||
#define DRV_VERSION "0.14" DRV_EXTRAVERSION
|
||||
#define DRV_VERSION "0.15" DRV_EXTRAVERSION
|
||||
#define DRV_DESCRIPTION "Beckhoff CCAT Ethernet/EtherCAT Network Driver"
|
||||
|
||||
#undef pr_fmt
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ static int ccat_dma_init(struct ccat_dma_mem *const dma, size_t channel,
|
|||
iowrite32((u32) phys | ((phys_hi) > 0), ioaddr);
|
||||
iowrite32(phys_hi, ioaddr + 4);
|
||||
|
||||
pr_debug
|
||||
pr_info
|
||||
("DMA%llu mem initialized\n base: 0x%p\n start: 0x%p\n phys: 0x%09llx\n pci addr: 0x%01x%08x\n size: %llu |%llx bytes.\n",
|
||||
(u64) channel, dma->base, fifo->dma.start, (u64) dma->phys,
|
||||
ioread32(ioaddr + 4), ioread32(ioaddr),
|
||||
|
|
@ -749,12 +749,14 @@ static void poll_link(struct ccat_eth_priv *const priv)
|
|||
static void poll_rx(struct ccat_eth_priv *const priv)
|
||||
{
|
||||
struct ccat_eth_fifo *const fifo = &priv->rx_fifo;
|
||||
const size_t len = fifo->ops->ready(fifo);
|
||||
size_t rx_per_poll = FIFO_LENGTH / 2;
|
||||
size_t len = fifo->ops->ready(fifo);
|
||||
|
||||
if (len) {
|
||||
while (len && --rx_per_poll) {
|
||||
priv->receive(priv, len);
|
||||
fifo->ops->add(fifo);
|
||||
ccat_eth_fifo_inc(fifo);
|
||||
len = fifo->ops->ready(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,8 +212,13 @@ int ec_gen_device_create_socket(
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
|
||||
ret = sock_create_kern(&init_net, PF_PACKET, SOCK_RAW,
|
||||
htons(ETH_P_ETHERCAT), &dev->socket);
|
||||
#else
|
||||
ret = sock_create_kern(PF_PACKET, SOCK_RAW, htons(ETH_P_ETHERCAT),
|
||||
&dev->socket);
|
||||
#endif
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "Failed to create socket (ret = %i).\n", ret);
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -232,8 +232,9 @@ int ecrt_slave_config_pdos(ec_slave_config_t *sc,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
|
||||
|
||||
if (sync_info->n_pdos && sync_info->pdos) {
|
||||
ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
|
||||
|
||||
for (j = 0; j < sync_info->n_pdos; j++) {
|
||||
pdo_info = &sync_info->pdos[j];
|
||||
|
|
@ -243,9 +244,9 @@ int ecrt_slave_config_pdos(ec_slave_config_t *sc,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (pdo_info->n_entries && pdo_info->entries) {
|
||||
ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
|
||||
ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
|
||||
|
||||
if (pdo_info->n_entries && pdo_info->entries) {
|
||||
for (k = 0; k < pdo_info->n_entries; k++) {
|
||||
entry_info = &pdo_info->entries[k];
|
||||
|
||||
|
|
|
|||
|
|
@ -1365,6 +1365,7 @@ void ec_fsm_slave_config_state_dc_sync_check(
|
|||
uint32_t abs_sync_diff;
|
||||
unsigned long diff_ms;
|
||||
ec_sync_signal_t *sync0 = &config->dc_sync[0];
|
||||
ec_sync_signal_t *sync1 = &config->dc_sync[1];
|
||||
u64 start_time;
|
||||
|
||||
if (!config) { // config removed in the meantime
|
||||
|
|
@ -1420,19 +1421,19 @@ void ec_fsm_slave_config_state_dc_sync_check(
|
|||
// find correct phase
|
||||
if (master->has_app_time) {
|
||||
u64 diff, start;
|
||||
u32 remainder;
|
||||
u32 remainder, cycle;
|
||||
|
||||
diff = start_time - master->app_start_time;
|
||||
remainder = do_div(diff, sync0->cycle_time);
|
||||
cycle = sync0->cycle_time + sync1->cycle_time;
|
||||
remainder = do_div(diff, cycle);
|
||||
|
||||
start = start_time +
|
||||
sync0->cycle_time - remainder + sync0->shift_time;
|
||||
start = start_time + cycle - remainder + sync0->shift_time;
|
||||
|
||||
EC_SLAVE_DBG(slave, 1, "app_start_time=%llu\n",
|
||||
master->app_start_time);
|
||||
EC_SLAVE_DBG(slave, 1, " app_time=%llu\n", master->app_time);
|
||||
EC_SLAVE_DBG(slave, 1, " start_time=%llu\n", start_time);
|
||||
EC_SLAVE_DBG(slave, 1, " cycle_time=%u\n", sync0->cycle_time);
|
||||
EC_SLAVE_DBG(slave, 1, " cycle=%u\n", cycle);
|
||||
EC_SLAVE_DBG(slave, 1, " shift_time=%i\n", sync0->shift_time);
|
||||
EC_SLAVE_DBG(slave, 1, " remainder=%u\n", remainder);
|
||||
EC_SLAVE_DBG(slave, 1, " start=%llu\n", start);
|
||||
|
|
|
|||
|
|
@ -702,8 +702,9 @@ int ecrt_slave_config_pdos(ec_slave_config_t *sc,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
|
||||
|
||||
if (sync_info->n_pdos && sync_info->pdos) {
|
||||
ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
|
||||
|
||||
for (j = 0; j < sync_info->n_pdos; j++) {
|
||||
pdo_info = &sync_info->pdos[j];
|
||||
|
|
@ -713,9 +714,9 @@ int ecrt_slave_config_pdos(ec_slave_config_t *sc,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (pdo_info->n_entries && pdo_info->entries) {
|
||||
ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
|
||||
ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
|
||||
|
||||
if (pdo_info->n_entries && pdo_info->entries) {
|
||||
for (k = 0; k < pdo_info->n_entries; k++) {
|
||||
entry_info = &pdo_info->entries[k];
|
||||
|
||||
|
|
|
|||
|
|
@ -337,7 +337,11 @@ void ec_tty_wakeup(unsigned long data)
|
|||
to_recv = ec_tty_rx_size(tty);
|
||||
if (to_recv && tty->tty) {
|
||||
unsigned char *cbuf;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
||||
int space = tty_prepare_flip_string(tty->tty->port, &cbuf, to_recv);
|
||||
#else
|
||||
int space = tty_prepare_flip_string(tty->tty, &cbuf, to_recv);
|
||||
#endif
|
||||
|
||||
if (space < to_recv) {
|
||||
printk(KERN_WARNING PFX "Insufficient space to_recv=%d space=%d\n",
|
||||
|
|
@ -362,7 +366,11 @@ void ec_tty_wakeup(unsigned long data)
|
|||
tty->rx_read_idx =
|
||||
(tty->rx_read_idx + 1) % EC_TTY_RX_BUFFER_SIZE;
|
||||
}
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
||||
tty_flip_buffer_push(tty->tty->port);
|
||||
#else
|
||||
tty_flip_buffer_push(tty->tty);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue