Commit cf4084cb authored by Pavel Pisa's avatar Pavel Pisa

driver: correct more problems reported by checkpatch.pl.

Signed-off-by: Pavel Pisa's avatarPavel Pisa <pisa@cmp.felk.cvut.cz>
parent 178425cc
...@@ -65,8 +65,7 @@ static bool pci_use_second = 1; ...@@ -65,8 +65,7 @@ static bool pci_use_second = 1;
module_param(pci_use_second, bool, 0444); module_param(pci_use_second, bool, 0444);
MODULE_PARM_DESC(pci_use_second, "Use the second CAN core on PCIe card. Default: 1 (yes)"); MODULE_PARM_DESC(pci_use_second, "Use the second CAN core on PCIe card. Default: 1 (yes)");
/* /* TX buffer rotation:
* TX buffer rotation:
* - when a buffer transitions to empty state, rotate order and priorities * - when a buffer transitions to empty state, rotate order and priorities
* - if more buffers seem to transition at the same time, rotate * - if more buffers seem to transition at the same time, rotate
* by the number of buffers * by the number of buffers
...@@ -108,15 +107,13 @@ static int ctucan_reset(struct net_device *ndev) ...@@ -108,15 +107,13 @@ static int ctucan_reset(struct net_device *ndev)
for (i = 0; i < 100; ++i) { for (i = 0; i < 100; ++i) {
if (ctu_can_fd_check_access(&priv->p)) if (ctu_can_fd_check_access(&priv->p))
return 0; return 0;
udelay(100); usleep_range(100, 200);
} }
netdev_warn(ndev, "device did not leave reset\n"); netdev_warn(ndev, "device did not leave reset\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
/** /**
* ctucan_set_bittiming - CAN set bit timing routine * ctucan_set_bittiming - CAN set bit timing routine
* @ndev: Pointer to net_device structure * @ndev: Pointer to net_device structure
...@@ -143,7 +140,6 @@ static int ctucan_set_bittiming(struct net_device *ndev) ...@@ -143,7 +140,6 @@ static int ctucan_set_bittiming(struct net_device *ndev)
return 0; return 0;
} }
/** /**
* ctucan_set_data_bittiming - CAN set data bit timing routine * ctucan_set_data_bittiming - CAN set data bit timing routine
* @ndev: Pointer to net_device structure * @ndev: Pointer to net_device structure
...@@ -196,7 +192,6 @@ static int ctucan_chip_start(struct net_device *ndev) ...@@ -196,7 +192,6 @@ static int ctucan_chip_start(struct net_device *ndev)
priv->txb_tail = 0; priv->txb_tail = 0;
priv->p.write_reg(&priv->p, CTU_CAN_FD_TX_PRIORITY, priv->txb_prio); priv->p.write_reg(&priv->p, CTU_CAN_FD_TX_PRIORITY, priv->txb_prio);
err = ctucan_set_bittiming(ndev); err = ctucan_set_bittiming(ndev);
if (err < 0) if (err < 0)
return err; return err;
...@@ -205,7 +200,6 @@ static int ctucan_chip_start(struct net_device *ndev) ...@@ -205,7 +200,6 @@ static int ctucan_chip_start(struct net_device *ndev)
if (err < 0) if (err < 0)
return err; return err;
/* Enable interrupts */ /* Enable interrupts */
int_ena.u32 = 0; int_ena.u32 = 0;
int_ena.s.rbnei = 1; int_ena.s.rbnei = 1;
...@@ -279,7 +273,6 @@ static int ctucan_do_set_mode(struct net_device *ndev, enum can_mode mode) ...@@ -279,7 +273,6 @@ static int ctucan_do_set_mode(struct net_device *ndev, enum can_mode mode)
return ret; return ret;
} }
/** /**
* ctucan_start_xmit - Starts the transmission * ctucan_start_xmit - Starts the transmission
* @skb: sk_buff pointer that contains data to be Txed * @skb: sk_buff pointer that contains data to be Txed
...@@ -302,7 +295,6 @@ static int ctucan_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -302,7 +295,6 @@ static int ctucan_start_xmit(struct sk_buff *skb, struct net_device *ndev)
if (can_dropped_invalid_skb(ndev, skb)) if (can_dropped_invalid_skb(ndev, skb))
return NETDEV_TX_OK; return NETDEV_TX_OK;
/* Check if the TX buffer is full */ /* Check if the TX buffer is full */
if (unlikely(!CTU_CAN_FD_TXTNF(ctu_can_get_status(&priv->p)))) { if (unlikely(!CTU_CAN_FD_TXTNF(ctu_can_get_status(&priv->p)))) {
netif_stop_queue(ndev); netif_stop_queue(ndev);
...@@ -357,7 +349,7 @@ static int ctucan_rx(struct net_device *ndev) ...@@ -357,7 +349,7 @@ static int ctucan_rx(struct net_device *ndev)
if (ffw.s.fdf == FD_CAN) if (ffw.s.fdf == FD_CAN)
skb = alloc_canfd_skb(ndev, &cf); skb = alloc_canfd_skb(ndev, &cf);
else else
skb = alloc_can_skb(ndev, (struct can_frame **) &cf); skb = alloc_can_skb(ndev, (struct can_frame **)&cf);
if (unlikely(!skb)) { if (unlikely(!skb)) {
int i; int i;
...@@ -403,8 +395,7 @@ static void ctucan_err_interrupt(struct net_device *ndev, ...@@ -403,8 +395,7 @@ static void ctucan_err_interrupt(struct net_device *ndev,
skb = alloc_can_err_skb(ndev, &cf); skb = alloc_can_err_skb(ndev, &cf);
/* /* EWI: error warning
* EWI: error warning
* DOI: RX overrun * DOI: RX overrun
* EPI: error passive or bus off * EPI: error passive or bus off
* ALI: arbitration lost (just informative) * ALI: arbitration lost (just informative)
...@@ -577,7 +568,7 @@ static void ctucan_rotate_txb_prio(struct net_device *ndev) ...@@ -577,7 +568,7 @@ static void ctucan_rotate_txb_prio(struct net_device *ndev)
u32 prio = priv->txb_prio; u32 prio = priv->txb_prio;
u32 nbuffersm1 = priv->txb_mask; /* nbuffers - 1 */ u32 nbuffersm1 = priv->txb_mask; /* nbuffers - 1 */
prio = (prio << 4) | ((prio >> (nbuffersm1*4)) & 0xF); prio = (prio << 4) | ((prio >> (nbuffersm1 * 4)) & 0xF);
netdev_dbg(ndev, "%s: from 0x%08x to 0x%08x", netdev_dbg(ndev, "%s: from 0x%08x to 0x%08x",
__func__, priv->txb_prio, prio); __func__, priv->txb_prio, prio);
priv->txb_prio = prio; priv->txb_prio = prio;
...@@ -599,15 +590,13 @@ static void ctucan_tx_interrupt(struct net_device *ndev) ...@@ -599,15 +590,13 @@ static void ctucan_tx_interrupt(struct net_device *ndev)
netdev_dbg(ndev, "%s", __func__); netdev_dbg(ndev, "%s", __func__);
/* /* read tx_status
* read tx_status
* if txb[n].finished (bit 2) * if txb[n].finished (bit 2)
* if ok -> echo * if ok -> echo
* if error / aborted -> ?? (find how to handle oneshot mode) * if error / aborted -> ?? (find how to handle oneshot mode)
* txb_tail++ * txb_tail++
*/ */
icr.u32 = 0; icr.u32 = 0;
icr.s.txbhci = 1; icr.s.txbhci = 1;
do { do {
...@@ -805,12 +794,6 @@ static int ctucan_open(struct net_device *ndev) ...@@ -805,12 +794,6 @@ static int ctucan_open(struct net_device *ndev)
return ret; return ret;
} }
/*
* ret = ctucan_reset(ndev);
* if (ret < 0)
* goto err;
*/
ret = request_irq(ndev->irq, ctucan_interrupt, priv->irq_flags, ret = request_irq(ndev->irq, ctucan_interrupt, priv->irq_flags,
ndev->name, ndev); ndev->name, ndev);
if (ret < 0) { if (ret < 0) {
...@@ -943,12 +926,10 @@ static __maybe_unused int ctucan_resume(struct device *dev) ...@@ -943,12 +926,10 @@ static __maybe_unused int ctucan_resume(struct device *dev)
return 0; return 0;
} }
static const struct dev_pm_ops ctucan_dev_pm_ops = { static const struct dev_pm_ops ctucan_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(ctucan_suspend, ctucan_resume) SET_SYSTEM_SLEEP_PM_OPS(ctucan_suspend, ctucan_resume)
}; };
/** /**
* ctucan_probe_common - Device type independent registration call * ctucan_probe_common - Device type independent registration call
* *
...@@ -981,7 +962,7 @@ static int ctucan_probe_common(struct device *dev, void __iomem *addr, ...@@ -981,7 +962,7 @@ static int ctucan_probe_common(struct device *dev, void __iomem *addr,
priv = netdev_priv(ndev); priv = netdev_priv(ndev);
INIT_LIST_HEAD(&priv->peers_on_pdev); INIT_LIST_HEAD(&priv->peers_on_pdev);
priv->txb_mask = ntxbufs-1; priv->txb_mask = ntxbufs - 1;
priv->dev = dev; priv->dev = dev;
priv->can.bittiming_const = &ctu_can_fd_bit_timing_max; priv->can.bittiming_const = &ctu_can_fd_bit_timing_max;
priv->can.data_bittiming_const = &ctu_can_fd_bit_timing_data_max; priv->can.data_bittiming_const = &ctu_can_fd_bit_timing_data_max;
...@@ -1125,7 +1106,7 @@ static int ctucan_platform_probe(struct platform_device *pdev) ...@@ -1125,7 +1106,7 @@ static int ctucan_platform_probe(struct platform_device *pdev)
} }
/* /*
ret = of_property_read_u32(pdev->dev.of_node, "tx-fifo-depth", &tx_max); ret = of_property_read_u32(pdev->dev.of_node, "tntxbufs", &ntxbufs);
if (ret < 0) if (ret < 0)
goto err; goto err;
*/ */
...@@ -1162,7 +1143,6 @@ static int ctucan_platform_remove(struct platform_device *pdev) ...@@ -1162,7 +1143,6 @@ static int ctucan_platform_remove(struct platform_device *pdev)
return 0; return 0;
} }
/* Match table for OF platform binding */ /* Match table for OF platform binding */
static const struct of_device_id ctucan_of_match[] = { static const struct of_device_id ctucan_of_match[] = {
{ .compatible = "ctu,canfd-2", }, { .compatible = "ctu,canfd-2", },
...@@ -1191,7 +1171,8 @@ module_platform_driver(ctucanfd_driver); ...@@ -1191,7 +1171,8 @@ module_platform_driver(ctucanfd_driver);
#ifndef PCI_DEVICE_DATA #ifndef PCI_DEVICE_DATA
#define PCI_DEVICE_DATA(vend, dev, data) \ #define PCI_DEVICE_DATA(vend, dev, data) \
.vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, \ .vendor = PCI_VENDOR_ID_##vend, \
.device = PCI_DEVICE_ID_##vend##_##dev, \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \
.driver_data = (kernel_ulong_t)(data) .driver_data = (kernel_ulong_t)(data)
#endif #endif
...@@ -1409,10 +1390,8 @@ static void ctucan_pci_remove(struct pci_dev *pdev) ...@@ -1409,10 +1390,8 @@ static void ctucan_pci_remove(struct pci_dev *pdev)
if (bdata->cra_base) if (bdata->cra_base)
iowrite32(0, (char *)bdata->cra_base + CYCLONE_IV_CRA_A2P_IE); iowrite32(0, (char *)bdata->cra_base + CYCLONE_IV_CRA_A2P_IE);
while ((priv = list_first_entry_or_null(&bdata->ndev_list_head, while ((priv = list_first_entry_or_null(&bdata->ndev_list_head,
struct ctucan_priv, peers_on_pdev)) != NULL) { struct ctucan_priv, peers_on_pdev)) != NULL) {
ndev = priv->can.dev; ndev = priv->can.dev;
unregister_candev(ndev); unregister_candev(ndev);
...@@ -1448,6 +1427,7 @@ static const struct pci_device_id ctucan_pci_tbl[] = { ...@@ -1448,6 +1427,7 @@ static const struct pci_device_id ctucan_pci_tbl[] = {
CTUCAN_WITH_CTUCAN_ID)}, CTUCAN_WITH_CTUCAN_ID)},
{}, {},
}; };
static struct pci_driver ctucan_pci_driver = { static struct pci_driver ctucan_pci_driver = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.id_table = ctucan_pci_tbl, .id_table = ctucan_pci_tbl,
......
...@@ -74,8 +74,6 @@ static void ctu_can_fd_write_txt_buf(struct ctucanfd_priv *priv, ...@@ -74,8 +74,6 @@ static void ctu_can_fd_write_txt_buf(struct ctucanfd_priv *priv,
priv->write_reg(priv, buf_base + offset, val); priv->write_reg(priv, buf_base + offset, val);
} }
static inline union ctu_can_fd_identifier_w ctu_can_fd_id_to_hwid(canid_t id) static inline union ctu_can_fd_identifier_w ctu_can_fd_id_to_hwid(canid_t id)
{ {
union ctu_can_fd_identifier_w hwid; union ctu_can_fd_identifier_w hwid;
...@@ -87,8 +85,9 @@ static inline union ctu_can_fd_identifier_w ctu_can_fd_id_to_hwid(canid_t id) ...@@ -87,8 +85,9 @@ static inline union ctu_can_fd_identifier_w ctu_can_fd_id_to_hwid(canid_t id)
/* getting lowest 18 bits, replace with sth nicer... */ /* getting lowest 18 bits, replace with sth nicer... */
hwid.s.identifier_ext = (id & 0x3FFFF); hwid.s.identifier_ext = (id & 0x3FFFF);
} else } else {
hwid.s.identifier_base = id & CAN_SFF_MASK; hwid.s.identifier_base = id & CAN_SFF_MASK;
}
return hwid; return hwid;
} }
...@@ -104,19 +103,17 @@ static inline void ctu_can_fd_hwid_to_id(union ctu_can_fd_identifier_w hwid, ...@@ -104,19 +103,17 @@ static inline void ctu_can_fd_hwid_to_id(union ctu_can_fd_identifier_w hwid,
*id |= CAN_EFF_FLAG; *id |= CAN_EFF_FLAG;
*id |= hwid.s.identifier_base << 18; *id |= hwid.s.identifier_base << 18;
*id |= hwid.s.identifier_ext; *id |= hwid.s.identifier_ext;
} else } else {
*id = hwid.s.identifier_base; *id = hwid.s.identifier_base;
}
} }
// TODO: use can_len2dlc
static bool ctu_can_fd_len_to_dlc(u8 len, u8 *dlc) static bool ctu_can_fd_len_to_dlc(u8 len, u8 *dlc)
{ {
*dlc = can_len2dlc(len); *dlc = can_len2dlc(len);
return true; return true;
} }
bool ctu_can_fd_check_access(struct ctucanfd_priv *priv) bool ctu_can_fd_check_access(struct ctucanfd_priv *priv)
{ {
union ctu_can_fd_device_id_version reg; union ctu_can_fd_device_id_version reg;
...@@ -279,14 +276,14 @@ void ctu_can_fd_set_mode(struct ctucanfd_priv *priv, ...@@ -279,14 +276,14 @@ void ctu_can_fd_set_mode(struct ctucanfd_priv *priv,
if (mode->mask & CAN_CTRLMODE_BERR_REPORTING) { if (mode->mask & CAN_CTRLMODE_BERR_REPORTING) {
union ctu_can_fd_int_stat ena, mask; union ctu_can_fd_int_stat ena, mask;
ena.u32 = mask.u32 = 0; ena.u32 = 0;
mask.u32 = 0;
ena.s.bei = !!(mode->flags & CAN_CTRLMODE_ONE_SHOT); ena.s.bei = !!(mode->flags & CAN_CTRLMODE_ONE_SHOT);
mask.s.bei = 1; mask.s.bei = 1;
ctu_can_fd_int_ena(priv, ena, mask); ctu_can_fd_int_ena(priv, ena, mask);
} }
} }
const struct can_bittiming_const ctu_can_fd_bit_timing_max = { const struct can_bittiming_const ctu_can_fd_bit_timing_max = {
.name = "ctu_can_fd", .name = "ctu_can_fd",
.tseg1_min = 2, .tseg1_min = 2,
...@@ -316,8 +313,7 @@ void ctu_can_fd_set_nom_bittiming(struct ctucanfd_priv *priv, ...@@ -316,8 +313,7 @@ void ctu_can_fd_set_nom_bittiming(struct ctucanfd_priv *priv,
{ {
union ctu_can_fd_btr btr; union ctu_can_fd_btr btr;
/* /* The timing calculation functions have only constraints on tseg1,
* The timing calculation functions have only constraints on tseg1,
* which is prop_seg + phase1_seg combined. tseg1 is then split in half * which is prop_seg + phase1_seg combined. tseg1 is then split in half
* and stored into prog_seg and phase_seg1. In CTU CAN FD, PROP is * and stored into prog_seg and phase_seg1. In CTU CAN FD, PROP is
* 7 bits wide but PH1 only 6, so we must re-distribute the values here. * 7 bits wide but PH1 only 6, so we must re-distribute the values here.
...@@ -347,8 +343,7 @@ void ctu_can_fd_set_data_bittiming(struct ctucanfd_priv *priv, ...@@ -347,8 +343,7 @@ void ctu_can_fd_set_data_bittiming(struct ctucanfd_priv *priv,
{ {
union ctu_can_fd_btr_fd btr_fd; union ctu_can_fd_btr_fd btr_fd;
/* /* The timing calculation functions have only constraints on tseg1,
* The timing calculation functions have only constraints on tseg1,
* which is prop_seg + phase1_seg combined. tseg1 is then split in half * which is prop_seg + phase1_seg combined. tseg1 is then split in half
* and stored into prog_seg and phase_seg1. In CTU CAN FD, PROP_FD is * and stored into prog_seg and phase_seg1. In CTU CAN FD, PROP_FD is
* 6 bits wide but PH1_FD only 5, so we must re-distribute the values * 6 bits wide but PH1_FD only 5, so we must re-distribute the values
...@@ -410,10 +405,11 @@ enum can_state ctu_can_fd_read_error_state(struct ctucanfd_priv *priv) ...@@ -410,10 +405,11 @@ enum can_state ctu_can_fd_read_error_state(struct ctucanfd_priv *priv)
return CAN_STATE_ERROR_ACTIVE; return CAN_STATE_ERROR_ACTIVE;
else else
return CAN_STATE_ERROR_WARNING; return CAN_STATE_ERROR_WARNING;
} else if (reg.s.erp) } else if (reg.s.erp) {
return CAN_STATE_ERROR_PASSIVE; return CAN_STATE_ERROR_PASSIVE;
else if (reg.s.bof) } else if (reg.s.bof) {
return CAN_STATE_BUS_OFF; return CAN_STATE_BUS_OFF;
}
WARN(true, "Invalid error state"); WARN(true, "Invalid error state");
return CAN_STATE_ERROR_PASSIVE; return CAN_STATE_ERROR_PASSIVE;
} }
...@@ -435,7 +431,6 @@ void ctu_can_fd_set_err_ctrs(struct ctucanfd_priv *priv, ...@@ -435,7 +431,6 @@ void ctu_can_fd_set_err_ctrs(struct ctucanfd_priv *priv,
priv->write_reg(priv, CTU_CAN_FD_CTR_PRES, reg.u32); priv->write_reg(priv, CTU_CAN_FD_CTR_PRES, reg.u32);
} }
bool ctu_can_fd_get_mask_filter_support(struct ctucanfd_priv *priv, u8 fnum) bool ctu_can_fd_get_mask_filter_support(struct ctucanfd_priv *priv, u8 fnum)
{ {
union ctu_can_fd_filter_control_filter_status reg; union ctu_can_fd_filter_control_filter_status reg;
...@@ -585,8 +580,9 @@ void ctu_can_fd_read_rx_frame_ffw(struct ctucanfd_priv *priv, ...@@ -585,8 +580,9 @@ void ctu_can_fd_read_rx_frame_ffw(struct ctucanfd_priv *priv,
cf->flags |= CANFD_BRS; cf->flags |= CANFD_BRS;
if (ffw.s.esi_rsv == ESI_ERR_PASIVE) if (ffw.s.esi_rsv == ESI_ERR_PASIVE)
cf->flags |= CANFD_ESI; cf->flags |= CANFD_ESI;
} else if (ffw.s.rtr == RTR_FRAME) } else if (ffw.s.rtr == RTR_FRAME) {
cf->can_id |= CAN_RTR_FLAG; cf->can_id |= CAN_RTR_FLAG;
}
/* DLC */ /* DLC */
if (ffw.s.dlc <= 8) { if (ffw.s.dlc <= 8) {
...@@ -598,7 +594,7 @@ void ctu_can_fd_read_rx_frame_ffw(struct ctucanfd_priv *priv, ...@@ -598,7 +594,7 @@ void ctu_can_fd_read_rx_frame_ffw(struct ctucanfd_priv *priv,
cf->len = 8; cf->len = 8;
} }
ide = (enum ctu_can_fd_frame_form_w_ide) ffw.s.ide; ide = (enum ctu_can_fd_frame_form_w_ide)ffw.s.ide;
ctu_can_fd_hwid_to_id(idw, &cf->can_id, ide); ctu_can_fd_hwid_to_id(idw, &cf->can_id, ide);
/* Timestamp */ /* Timestamp */
...@@ -636,7 +632,7 @@ enum ctu_can_fd_tx_status_tx1s ctu_can_fd_get_tx_status(struct ctucanfd_priv ...@@ -636,7 +632,7 @@ enum ctu_can_fd_tx_status_tx1s ctu_can_fd_get_tx_status(struct ctucanfd_priv
default: default:
status = ~0; status = ~0;
} }
return (enum ctu_can_fd_tx_status_tx1s) status; return (enum ctu_can_fd_tx_status_tx1s)status;
} }
bool ctu_can_fd_is_txt_buf_accessible(struct ctucanfd_priv *priv, u8 buf) bool ctu_can_fd_is_txt_buf_accessible(struct ctucanfd_priv *priv, u8 buf)
...@@ -644,8 +640,8 @@ bool ctu_can_fd_is_txt_buf_accessible(struct ctucanfd_priv *priv, u8 buf) ...@@ -644,8 +640,8 @@ bool ctu_can_fd_is_txt_buf_accessible(struct ctucanfd_priv *priv, u8 buf)
enum ctu_can_fd_tx_status_tx1s buf_status; enum ctu_can_fd_tx_status_tx1s buf_status;
buf_status = ctu_can_fd_get_tx_status(priv, buf); buf_status = ctu_can_fd_get_tx_status(priv, buf);
if (buf_status == TXT_RDY || buf_status == TXT_TRAN if (buf_status == TXT_RDY || buf_status == TXT_TRAN ||
|| buf_status == TXT_ABTP) buf_status == TXT_ABTP)
return false; return false;
return true; return true;
...@@ -784,11 +780,11 @@ u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv) ...@@ -784,11 +780,11 @@ u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv)
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW); ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
ts_high_2.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH); ts_high_2.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
if (ts_high.u32 != ts_high_2.u32){ if (ts_high.u32 != ts_high_2.u32) {
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW); ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
} }
return (( (u64) ts_high_2.u32) << 32) | ( (u64) ts_low.u32); return (((u64)ts_high_2.u32) << 32) | ((u64)ts_low.u32);
} }
// TODO: AL_CAPTURE and ERROR_CAPTURE // TODO: AL_CAPTURE and ERROR_CAPTURE
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
/* /*
MJ TODO: MJ TODO:
+ move small functions to *.h, make them inline + consider move of more small functions to *.h, make them inline
+ either pass union arguments by value or just as u32; + either pass union arguments by value or just as u32;
this way they are forced on stack instead of passing in register this way they are forced on stack instead of passing in register
+ one level of pointer indirection, which sucks performance-wise + one level of pointer indirection, which sucks performance-wise
...@@ -96,7 +96,6 @@ ...@@ -96,7 +96,6 @@
// True if RX Buffer is not empty // True if RX Buffer is not empty
#define CTU_CAN_FD_RX_BUF_NEMPTY(stat) (!!(stat).s.rxne) #define CTU_CAN_FD_RX_BUF_NEMPTY(stat) (!!(stat).s.rxne)
/* /*
* Interrupt macros -> pass "ctu_can_fd_int_sts" result * Interrupt macros -> pass "ctu_can_fd_int_sts" result
*/ */
...@@ -159,7 +158,6 @@ u32 ctu_can_fd_read32(struct ctucanfd_priv *priv, ...@@ -159,7 +158,6 @@ u32 ctu_can_fd_read32(struct ctucanfd_priv *priv,
u32 ctu_can_fd_read32_be(struct ctucanfd_priv *priv, u32 ctu_can_fd_read32_be(struct ctucanfd_priv *priv,
enum ctu_can_fd_can_registers reg); enum ctu_can_fd_can_registers reg);
/* /*
* Checks whether the core is mapped correctly at it's base address. * Checks whether the core is mapped correctly at it's base address.
* *
...@@ -171,7 +169,6 @@ u32 ctu_can_fd_read32_be(struct ctucanfd_priv *priv, ...@@ -171,7 +169,6 @@ u32 ctu_can_fd_read32_be(struct ctucanfd_priv *priv,
*/ */
bool ctu_can_fd_check_access(struct ctucanfd_priv *priv); bool ctu_can_fd_check_access(struct ctucanfd_priv *priv);
/* /*
* Returns version of CTU CAN FD IP Core. * Returns version of CTU CAN FD IP Core.
* *
...@@ -183,7 +180,6 @@ bool ctu_can_fd_check_access(struct ctucanfd_priv *priv); ...@@ -183,7 +180,6 @@ bool ctu_can_fd_check_access(struct ctucanfd_priv *priv);
*/ */
u32 ctu_can_fd_get_version(struct ctucanfd_priv *priv); u32 ctu_can_fd_get_version(struct ctucanfd_priv *priv);
/* /*
* Enables/disables the operation of CTU CAN FD Core. If disabled, the Core will * Enables/disables the operation of CTU CAN FD Core. If disabled, the Core will
* never start transmitting on the CAN bus, nor receiving. * never start transmitting on the CAN bus, nor receiving.
...@@ -194,7 +190,6 @@ u32 ctu_can_fd_get_version(struct ctucanfd_priv *priv); ...@@ -194,7 +190,6 @@ u32 ctu_can_fd_get_version(struct ctucanfd_priv *priv);
*/ */
void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable); void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable);
/* /*
* Resets the CTU CAN FD Core. * Resets the CTU CAN FD Core.
* NOTE: After resetting, you must wait until ctu_can_fd_check_access() * NOTE: After resetting, you must wait until ctu_can_fd_check_access()
...@@ -205,7 +200,6 @@ void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable); ...@@ -205,7 +200,6 @@ void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable);
*/ */
void ctu_can_fd_reset(struct ctucanfd_priv *priv); void ctu_can_fd_reset(struct ctucanfd_priv *priv);
/* /*
* Configures CTU CAN FD Core to limit the amount of retransmit attempts after * Configures CTU CAN FD Core to limit the amount of retransmit attempts after
* occurence of error (Error frame, Arbitration lost). If retransmit limit is * occurence of error (Error frame, Arbitration lost). If retransmit limit is
...@@ -223,7 +217,6 @@ void ctu_can_fd_reset(struct ctucanfd_priv *priv); ...@@ -223,7 +217,6 @@ void ctu_can_fd_reset(struct ctucanfd_priv *priv);
bool ctu_can_fd_set_ret_limit(struct ctucanfd_priv *priv, bool enable, bool ctu_can_fd_set_ret_limit(struct ctucanfd_priv *priv, bool enable,
u8 limit); u8 limit);
/* /*
* Configures CTU CAN FD Core for special operating modes by access to MODE * Configures CTU CAN FD Core for special operating modes by access to MODE
* register. Following flags from "mode" are not configured by this function: * register. Following flags from "mode" are not configured by this function:
...@@ -251,7 +244,6 @@ bool ctu_can_fd_set_ret_limit(struct ctucanfd_priv *priv, bool enable, ...@@ -251,7 +244,6 @@ bool ctu_can_fd_set_ret_limit(struct ctucanfd_priv *priv, bool enable,
void ctu_can_fd_set_mode_reg(struct ctucanfd_priv *priv, void ctu_can_fd_set_mode_reg(struct ctucanfd_priv *priv,
const struct can_ctrlmode *mode); const struct can_ctrlmode *mode);
/* /*
* Gives command to CTU CAN FD Core to erase and reset the RX FIFO. This * Gives command to CTU CAN FD Core to erase and reset the RX FIFO. This
* action is finished immediately and does not need waiting. * action is finished immediately and does not need waiting.
...@@ -261,7 +253,6 @@ void ctu_can_fd_set_mode_reg(struct ctucanfd_priv *priv, ...@@ -261,7 +253,6 @@ void ctu_can_fd_set_mode_reg(struct ctucanfd_priv *priv,
*/ */
void ctu_can_fd_rel_rx_buf(struct ctucanfd_priv *priv); void ctu_can_fd_rel_rx_buf(struct ctucanfd_priv *priv);
/* /*
* Gives command to CTU CAN FD Core to clear the Data overrun flag on * Gives command to CTU CAN FD Core to clear the Data overrun flag on
* the RX FIFO Buffer. * the RX FIFO Buffer.
...@@ -271,7 +262,6 @@ void ctu_can_fd_rel_rx_buf(struct ctucanfd_priv *priv); ...@@ -271,7 +262,6 @@ void ctu_can_fd_rel_rx_buf(struct ctucanfd_priv *priv);
*/ */
void ctu_can_fd_clr_overrun_flag(struct ctucanfd_priv *priv); void ctu_can_fd_clr_overrun_flag(struct ctucanfd_priv *priv);
/* /*
* Gives command to CTU CAN FD Core to abort the transmission immediately. * Gives command to CTU CAN FD Core to abort the transmission immediately.
* This action will most likely result in transmission of Error frame. * This action will most likely result in transmission of Error frame.
...@@ -281,7 +271,6 @@ void ctu_can_fd_clr_overrun_flag(struct ctucanfd_priv *priv); ...@@ -281,7 +271,6 @@ void ctu_can_fd_clr_overrun_flag(struct ctucanfd_priv *priv);
*/ */
void ctu_can_fd_abort_tx(struct ctucanfd_priv *priv); void ctu_can_fd_abort_tx(struct ctucanfd_priv *priv);
/*