Message ID | 20230721221552.1973203-6-contact@jookia.org (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | Add support for Allwinner D1 CAN controllers | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Series has a cover letter |
conchuod/tree_selection | success | Guessed tree name to be for-next at HEAD 471aba2e4760 |
conchuod/fixes_present | success | Fixes tag not required for -next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 4 and now 4 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 9 this patch: 9 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 9 this patch: 9 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 3 this patch: 3 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 45 lines checked |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | No Fixes tag |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
Hi John, On Sat, Jul 22, 2023 at 12:18 AM John Watts <contact@jookia.org> wrote: > The controllers present in the D1 are extremely similar to the R40 > and require the same reset quirks, but An extra quirk is needed to support > receiving packets. > > Signed-off-by: John Watts <contact@jookia.org> Thanks for your patch, which is now commit 8abb95250ae6af2d ("can: sun4i_can: Add support for the Allwinner D1") in linux-can-next/master. > --- a/drivers/net/can/Kconfig > +++ b/drivers/net/can/Kconfig > @@ -185,10 +185,10 @@ config CAN_SLCAN > > config CAN_SUN4I > tristate "Allwinner A10 CAN controller" > - depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST > + depends on MACH_SUN4I || MACH_SUN7I || RISCV || COMPILE_TEST This makes this question pop up when configuring a kernel for any RISC-V platform, not just for Allwinner RISC-V platforms. In comparison, drivers/clk/sunxi-ng/Kconfig does have some depends on MACH_SUN<foo>I || RISCV || COMPILE_TEST but these are gated by ARCH_SUNXI at the top of the file. I'm not sure what's the best way to fix this: - Replace RISCV by ARCH_SUNXI? This would expose it on more ARM sun<foo>i platforms, making the MACH_SUN4I || MACH_SUN7I superfluous? - Replace RISCV by RISCV && ARCH_SUNXI? Thanks for your comments! > help > Say Y here if you want to use CAN controller found on Allwinner > - A10/A20 SoCs. > + A10/A20/D1 SoCs. > > To compile this driver as a module, choose M here: the module will > be called sun4i_can. Gr{oetje,eeting}s, Geert
On Tue, Aug 22, 2023 at 02:30:16PM +0200, Geert Uytterhoeven wrote: > Hi John, > > This makes this question pop up when configuring a kernel for any RISC-V > platform, not just for Allwinner RISC-V platforms. Oh dear. > In comparison, drivers/clk/sunxi-ng/Kconfig does have some > > depends on MACH_SUN<foo>I || RISCV || COMPILE_TEST > > but these are gated by ARCH_SUNXI at the top of the file. Ah, that is what I copied. > I'm not sure what's the best way to fix this: > - Replace RISCV by ARCH_SUNXI? > This would expose it on more ARM sun<foo>i platforms, making the > MACH_SUN4I || MACH_SUN7I superfluous? > - Replace RISCV by RISCV && ARCH_SUNXI? I'm not sure what the best approach here is. Just having it require ARCH_SUNXI would make sense to me but I'm not too sure why where's so many different MACH here in the first place. > Thanks for your comments! > > > help > > Say Y here if you want to use CAN controller found on Allwinner > > - A10/A20 SoCs. > > + A10/A20/D1 SoCs. > > > > To compile this driver as a module, choose M here: the module will > > be called sun4i_can. > > Gr{oetje,eeting}s, > > Geert John.
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index a5c5036dfb94..e626de33e735 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig @@ -185,10 +185,10 @@ config CAN_SLCAN config CAN_SUN4I tristate "Allwinner A10 CAN controller" - depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST + depends on MACH_SUN4I || MACH_SUN7I || RISCV || COMPILE_TEST help Say Y here if you want to use CAN controller found on Allwinner - A10/A20 SoCs. + A10/A20/D1 SoCs. To compile this driver as a module, choose M here: the module will be called sun4i_can. diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 1f90fe6dbb8b..c508a328e38d 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -91,6 +91,8 @@ #define SUN4I_REG_BUF12_ADDR 0x0070 /* CAN Tx/Rx Buffer 12 */ #define SUN4I_REG_ACPC_ADDR 0x0040 /* CAN Acceptance Code 0 */ #define SUN4I_REG_ACPM_ADDR 0x0044 /* CAN Acceptance Mask 0 */ +#define SUN4I_REG_ACPC_ADDR_D1 0x0028 /* CAN Acceptance Code 0 on the D1 */ +#define SUN4I_REG_ACPM_ADDR_D1 0x002C /* CAN Acceptance Mask 0 on the D1 */ #define SUN4I_REG_RBUF_RBACK_START_ADDR 0x0180 /* CAN transmit buffer start */ #define SUN4I_REG_RBUF_RBACK_END_ADDR 0x01b0 /* CAN transmit buffer end */ @@ -779,6 +781,11 @@ static const struct sun4ican_quirks sun4ican_quirks_r40 = { .acp_offset = 0, }; +static const struct sun4ican_quirks sun4ican_quirks_d1 = { + .has_reset = true, + .acp_offset = (SUN4I_REG_ACPC_ADDR_D1 - SUN4I_REG_ACPC_ADDR), +}; + static const struct of_device_id sun4ican_of_match[] = { { .compatible = "allwinner,sun4i-a10-can", @@ -789,6 +796,9 @@ static const struct of_device_id sun4ican_of_match[] = { }, { .compatible = "allwinner,sun8i-r40-can", .data = &sun4ican_quirks_r40 + }, { + .compatible = "allwinner,sun20i-d1-can", + .data = &sun4ican_quirks_d1 }, { /* sentinel */ }, @@ -913,4 +923,4 @@ module_platform_driver(sun4i_can_driver); MODULE_AUTHOR("Peter Chen <xingkongcp@gmail.com>"); MODULE_AUTHOR("Gerhard Bertelsmann <info@gerhard-bertelsmann.de>"); MODULE_LICENSE("Dual BSD/GPL"); -MODULE_DESCRIPTION("CAN driver for Allwinner SoCs (A10/A20)"); +MODULE_DESCRIPTION("CAN driver for Allwinner SoCs (A10/A20/D1)");
The controllers present in the D1 are extremely similar to the R40 and require the same reset quirks, but An extra quirk is needed to support receiving packets. Signed-off-by: John Watts <contact@jookia.org> --- drivers/net/can/Kconfig | 4 ++-- drivers/net/can/sun4i_can.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-)