*
  **************************************************************************/
 
-static unsigned int irq_mod_ticks(unsigned int usecs, unsigned int resolution)
+static unsigned int irq_mod_ticks(unsigned int usecs, unsigned int quantum_ns)
 {
        if (usecs == 0)
                return 0;
-       if (usecs < resolution)
+       if (usecs * 1000 < quantum_ns)
                return 1; /* never round down to 0 */
-       return usecs / resolution;
+       return usecs * 1000 / quantum_ns;
 }
 
 /* Set interrupt moderation parameters */
                            bool rx_may_override_tx)
 {
        struct efx_channel *channel;
-       unsigned tx_ticks = irq_mod_ticks(tx_usecs, EFX_IRQ_MOD_RESOLUTION);
-       unsigned rx_ticks = irq_mod_ticks(rx_usecs, EFX_IRQ_MOD_RESOLUTION);
+       unsigned int irq_mod_max = DIV_ROUND_UP(efx->type->timer_period_max *
+                                               efx->timer_quantum_ns,
+                                               1000);
+       unsigned int tx_ticks;
+       unsigned int rx_ticks;
 
        EFX_ASSERT_RESET_SERIALISED(efx);
 
-       if (tx_ticks > EFX_IRQ_MOD_MAX || rx_ticks > EFX_IRQ_MOD_MAX)
+       if (tx_usecs > irq_mod_max || rx_usecs > irq_mod_max)
                return -EINVAL;
 
+       tx_ticks = irq_mod_ticks(tx_usecs, efx->timer_quantum_ns);
+       rx_ticks = irq_mod_ticks(rx_usecs, efx->timer_quantum_ns);
+
        if (tx_ticks != rx_ticks && efx->tx_channel_offset == 0 &&
            !rx_may_override_tx) {
                netif_err(efx, drv, efx->net_dev, "Channels are shared. "
 void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs,
                            unsigned int *rx_usecs, bool *rx_adaptive)
 {
+       /* We must round up when converting ticks to microseconds
+        * because we round down when converting the other way.
+        */
+
        *rx_adaptive = efx->irq_rx_adaptive;
-       *rx_usecs = efx->irq_rx_moderation * EFX_IRQ_MOD_RESOLUTION;
+       *rx_usecs = DIV_ROUND_UP(efx->irq_rx_moderation *
+                                efx->timer_quantum_ns,
+                                1000);
 
        /* If channels are shared between RX and TX, so is IRQ
         * moderation.  Otherwise, IRQ moderation is the same for all
        if (efx->tx_channel_offset == 0)
                *tx_usecs = *rx_usecs;
        else
-               *tx_usecs =
+               *tx_usecs = DIV_ROUND_UP(
                        efx->channel[efx->tx_channel_offset]->irq_moderation *
-                       EFX_IRQ_MOD_RESOLUTION;
+                       efx->timer_quantum_ns,
+                       1000);
 }
 
 /**************************************************************************
 
        efx_dword_t timer_cmd;
        struct efx_nic *efx = channel->efx;
 
-       BUILD_BUG_ON(EFX_IRQ_MOD_MAX > (1 << FRF_AB_TC_TIMER_VAL_WIDTH));
-
        /* Set timer register */
        if (channel->irq_moderation) {
                EFX_POPULATE_DWORD_2(timer_cmd,
                goto fail5;
        }
 
+       efx->timer_quantum_ns = 4968; /* 621 cycles */
+
        /* Initialise I2C adapter */
        board = falcon_board(efx);
        board->i2c_adap.owner = THIS_MODULE;
        .rx_buffer_padding = 0x24,
        .max_interrupt_mode = EFX_INT_MODE_MSI,
        .phys_addr_channels = 4,
+       .timer_period_max =  1 << FRF_AB_TC_TIMER_VAL_WIDTH,
        .tx_dc_base = 0x130000,
        .rx_dc_base = 0x100000,
        .offload_features = NETIF_F_IP_CSUM,
        .phys_addr_channels = 32, /* Hardware limit is 64, but the legacy
                                   * interrupt handler only supports 32
                                   * channels */
+       .timer_period_max =  1 << FRF_AB_TC_TIMER_VAL_WIDTH,
        .tx_dc_base = 0x130000,
        .rx_dc_base = 0x100000,
        .offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE,
 
  * @membase_phys: Memory BAR value as physical address
  * @membase: Memory BAR value
  * @interrupt_mode: Interrupt mode
+ * @timer_quantum_ns: Interrupt timer quantum, in nanoseconds
  * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
  * @irq_rx_moderation: IRQ moderation time for RX event queues
  * @msg_enable: Log message enable flags
        void __iomem *membase;
 
        enum efx_int_mode interrupt_mode;
+       unsigned int timer_quantum_ns;
        bool irq_rx_adaptive;
        unsigned int irq_rx_moderation;
        u32 msg_enable;
  *     from &enum efx_init_mode.
  * @phys_addr_channels: Number of channels with physically addressed
  *     descriptors
+ * @timer_period_max: Maximum period of interrupt timer (in ticks)
  * @tx_dc_base: Base address in SRAM of TX queue descriptor caches
  * @rx_dc_base: Base address in SRAM of RX queue descriptor caches
  * @offload_features: net_device feature flags for protocol offload
        unsigned int rx_buffer_padding;
        unsigned int max_interrupt_mode;
        unsigned int phys_addr_channels;
+       unsigned int timer_period_max;
        unsigned int tx_dc_base;
        unsigned int rx_dc_base;
        netdev_features_t offload_features;
 
 extern irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id);
 extern void falcon_irq_ack_a1(struct efx_nic *efx);
 
-#define EFX_IRQ_MOD_RESOLUTION 5
-#define EFX_IRQ_MOD_MAX                0x1000
-
 /* Global Resources */
 extern int efx_nic_flush_queues(struct efx_nic *efx);
 extern void falcon_start_nic_stats(struct efx_nic *efx);
 
 {
        efx_dword_t timer_cmd;
 
-       BUILD_BUG_ON(EFX_IRQ_MOD_MAX > (1 << FRF_CZ_TC_TIMER_VAL_WIDTH));
-
        if (channel->irq_moderation)
                EFX_POPULATE_DWORD_2(timer_cmd,
                                     FRF_CZ_TC_TIMER_MODE,
 
 static int siena_probe_nvconfig(struct efx_nic *efx)
 {
-       return efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, NULL);
+       u32 caps = 0;
+       int rc;
+
+       rc = efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, &caps);
+
+       efx->timer_quantum_ns =
+               (caps & (1 << MC_CMD_CAPABILITIES_TURBO_ACTIVE_LBN)) ?
+               3072 : 6144; /* 768 cycles */
+       return rc;
 }
 
 static int siena_probe_nic(struct efx_nic *efx)
        .phys_addr_channels = 32, /* Hardware limit is 64, but the legacy
                                   * interrupt handler only supports 32
                                   * channels */
+       .timer_period_max = 1 << FRF_CZ_TC_TIMER_VAL_WIDTH,
        .tx_dc_base = 0x88000,
        .rx_dc_base = 0x68000,
        .offload_features = (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |