Re: [PATCH V5] can: usb: f81604: add Fintek F81604 support
From: Vincent MAILHOL
Date: Thu Apr 20 2023 - 08:18:34 EST
On Tue. 20 Apr. 2023 at 21:02, Vincent MAILHOL
<mailhol.vincent@xxxxxxxxxx> wrote:
> Hi Peter,
>
> Here are my comments. Now, it is mostly nitpicks. I guess that this is
> the final round.
>
> On Thu. 20 avr. 2023 at 11:44, Ji-Ze Hong (Peter Hong)
> <peter_hong@xxxxxxxxxxxxx> wrote:
> >
> > This patch adds support for Fintek USB to 2CAN controller.
> >
> > Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@xxxxxxxxxxxxx>
> > ---
(...)
> > diff --git a/drivers/net/can/usb/f81604.c b/drivers/net/can/usb/f81604.c
> > new file mode 100644
> > index 000000000000..ea0ff08ca186
> > --- /dev/null
> > +++ b/drivers/net/can/usb/f81604.c
> > @@ -0,0 +1,1205 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/* Fintek F81604 USB-to-2CAN controller driver.
> > + *
> > + * Copyright (C) 2023 Ji-Ze Hong (Peter Hong) <peter_hong@xxxxxxxxxxxxx>
> > + */
> > +#include <linux/bitfield.h>
> > +#include <linux/netdevice.h>
> > +#include <linux/units.h>
> > +#include <linux/usb.h>
> > +
> > +#include <linux/can.h>
> > +#include <linux/can/dev.h>
> > +#include <linux/can/error.h>
> > +#include <linux/can/platform/sja1000.h>
> > +
> > +#include <asm-generic/unaligned.h>
> > +
> > +/* vendor and product id */
> > +#define F81604_VENDOR_ID 0x2c42
> > +#define F81604_PRODUCT_ID 0x1709
> > +#define F81604_CAN_CLOCK (12 * MEGA)
> > +#define F81604_MAX_DEV 2
> > +#define F81604_SET_DEVICE_RETRY 10
> > +
> > +#define F81604_USB_TIMEOUT 2000
> > +#define F81604_SET_GET_REGISTER 0xA0
> > +#define F81604_PORT_OFFSET 0x1000
> > +
> > +#define F81604_DATA_SIZE 14
> > +#define F81604_MAX_RX_URBS 4
> > +
> > +#define F81604_CMD_DATA 0x00
> > +
> > +#define F81604_DLC_LEN_MASK 0x0f
For consistency with the other definitions also use GENMASK here.