reinit on main kernel

This commit is contained in:
Mario Hüttel 2017-04-26 13:08:59 +02:00
parent eebb77c20f
commit 420dd4d414
4 changed files with 6 additions and 1626 deletions

View File

@ -3,4 +3,3 @@
#
obj-$(CONFIG_CAN_M_CAN) += m_can.o
obj-$(CONFIG_CAN_M_CAN) += m_can_v321.o

View File

@ -32,9 +32,6 @@
/* message ram configuration data length */
#define MRAM_CFG_LEN 8
/* enable Debug */
#define M_CAN_DEBUG_ENABLE 1
/* registers definition */
enum m_can_reg {
M_CAN_CREL = 0x0,
@ -294,17 +291,6 @@ struct m_can_priv {
struct mram_cfg mcfg[MRAM_CFG_NUM];
};
/* debugging function */
static void m_can_debug(const char* format, ...) {
#ifdef M_CAN_DEBUG_ENABLE
va_list args;
va_start(args, format);
vprintk(format, args);
va_end(args);
#endif
}
static inline u32 m_can_read(const struct m_can_priv *priv, enum m_can_reg reg)
{
return readl(priv->base + reg);
@ -744,7 +730,7 @@ static int m_can_poll(struct napi_struct *napi, int quota)
work_done += m_can_do_rx_poll(dev, (quota - work_done));
if (work_done < quota) {
napi_complete(napi);
napi_complete_done(napi, work_done);
m_can_enable_all_interrupts(priv);
}
@ -758,6 +744,7 @@ static irqreturn_t m_can_isr(int irq, void *dev_id)
struct m_can_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
u32 ir;
ir = m_can_read(priv, M_CAN_IR);
if (!ir)
return IRQ_NONE;
@ -895,7 +882,7 @@ static void m_can_chip_config(struct net_device *dev)
cccr |= CCCR_TEST;
test |= TEST_LBCK;
}
// TODO: Check
if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT;
@ -968,7 +955,7 @@ static struct net_device *alloc_m_can_dev(void)
priv->can.do_get_berr_counter = m_can_get_berr_counter;
/* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.0.1 */
priv->can.ctrlmode = CAN_CTRLMODE_FD_NON_ISO;
can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO);
/* CAN_CTRLMODE_FD_NON_ISO can not be changed with M_CAN IP v3.0.1 */
priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
@ -1090,19 +1077,16 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
cccr = m_can_read(priv, M_CAN_CCCR);
cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT);
if (can_is_canfd_skb(skb)) {
m_can_debug(KERN_INFO "Frame is a CAN FD frame\n");
m_can_debug("BRS active: %s", (cf->flags & CANFD_BRS ? "yes" : "no"));
if (cf->flags & CANFD_BRS)
cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT;
else
cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT;
} else {
cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT;
m_can_debug(KERN_INFO "Frame is a normal CAN frame\n");
}
m_can_write(priv, M_CAN_CCCR, cccr);
}
m_can_debug(KERN_INFO "Sending Frame\n");
/* enable first TX buffer to start transfer */
m_can_write(priv, M_CAN_TXBTIE, 0x1);
m_can_write(priv, M_CAN_TXBAR, 0x1);
@ -1207,7 +1191,7 @@ static int m_can_plat_probe(struct platform_device *pdev)
hclk = devm_clk_get(&pdev->dev, "hclk");
cclk = devm_clk_get(&pdev->dev, "cclk");
if (IS_ERR(hclk) || IS_ERR(cclk)) {
dev_err(&pdev->dev, "no clock found\n");
dev_err(&pdev->dev, "no clock find\n");
return -ENODEV;
}

File diff suppressed because it is too large Load Diff