t113_can增加驱动

1 基于太极派的SDK添加

//设备树添加
	can0: can@2504000 {
		compatible = "allwinner,sun20i-d1-can";
		reg = <0x0 0x02504000 0x0 0x400>;
		interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&ccu CLK_BUS_CAN0>;
		resets = <&ccu RST_BUS_CAN0>;
		pinctrl-names = "default";
		pinctrl-0 = <&can0_pins>;
		status = "okay";
	};

	can1: can@2504400 {
		compatible = "allwinner,sun20i-d1-can";
		reg = <0x0 0x02504400 0x0 0x400>;
		interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&ccu CLK_BUS_CAN1>;
		resets = <&ccu RST_BUS_CAN1>;
		pinctrl-names = "default";
		pinctrl-0 = <&can1_pins>;
		status = "disabled";
	};
	
//驱动放置 kernel/linux-5.4_d1_t113/drivers/net/can/sun4i_can.c



//添加 Makefile 编译
obj-$(CONFIG_CAN_SUN8I)		+= sun4i_can.o

//添加 Kconfig 配置

config CAN_SUN8I
	tristate "Allwinner CAN controller"
	depends on ARCH_SUNXI
	---help---
	  Say Y here if you want to use CAN controller found on Allwinner
	  A10/A20/D1/T113 SoCs.

	  To compile this driver as a module, choose M here: the module will
	  be called sun4i_can.

1 替换ccu-sun8iw20.c增加CAN的时钟; 否则不能设置CAN的波特兰,也就是CAN的时钟没打开

t113-s3打开can失败,感觉象是没打开can时钟? / 全志 SOC / WhyCan Forum(哇酷开发者社区)

static SUNXI_CCU_GATE(bus_can0_clk, "bus-can0", "apb1", 0x92c, BIT(0), 0);
static SUNXI_CCU_GATE(bus_can1_clk, "bus-can1", "apb1", 0x92c, BIT(1), 0);
  &bus_can0_clk.common,
  &bus_can1_clk.common,

2 在 sun8iw20-ccu.h 添加, 否则会报错

T113-s3 CAN linux 下已调通 | 全志在线开发者论坛
#define CLK_BUS_CAN0 73
#define CLK_BUS_CAN1 74

#define RST_BUS_CAN0 28
#define RST_BUS_CAN1 29

3 make kernal_menuconfig

打开CAN驱动

然后make , pack进去;

4 启动日志 ifconfig -a 

5 设置波特率-- 需要用新的IP工具iproute2

如果用老的IP工具就会有问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值