linux platform device 驱动insert:failed to claim resource 4

原因是:

/* 寄存器物理地址 */
#define CCM_CCGR1_BASE				(0X020C406C)	
#define SW_MUX_GPIO1_IO03_BASE		(0X020E0068)
#define SW_PAD_GPIO1_IO03_BASE		(0X020E02F4)
#define GPIO1_DR_BASE				(0X0209C000)
#define GPIO1_GDIR_BASE				(0X0209C004)

struct resource namematch_device_res [] =
{
    [0] = {.start = CCM_CCGR1_BASE,.end = CCM_CCGR1_BASE + 4,.name = "reg1", .flags = IORESOURCE_MEM},
    [1] = {.start = SW_MUX_GPIO1_IO03_BASE,.end = SW_MUX_GPIO1_IO03_BASE + 4,.name = "reg2", .flags = IORESOURCE_MEM},
    [2] = {.start = SW_PAD_GPIO1_IO03_BASE,.end = SW_PAD_GPIO1_IO03_BASE + 4,.name = "reg3", .flags = IORESOURCE_MEM},
    [3] = {.start = GPIO1_DR_BASE,.end = GPIO1_DR_BASE + 4,.name = "reg4", .flags = IORESOURCE_MEM},
    [4] = {.start = GPIO1_GDIR_BASE,.end = GPIO1_GDIR_BASE + 4,.name = "reg5", .flags = IORESOURCE_MEM}
};

这里 第4号resource 的起始地址 start 与 第3号的 .end 重合了, 所以在这里是不能有交叠重合的;

解决方法:
修改第3个resource的end地址值为

end = GPIO1_DR_BASE + 0x4 -1

也就是

/* 寄存器物理地址 */
#define CCM_CCGR1_BASE				(0X020C406C)	
#define SW_MUX_GPIO1_IO03_BASE		(0X020E0068)
#define SW_PAD_GPIO1_IO03_BASE		(0X020E02F4)
#define GPIO1_DR_BASE				(0X0209C000)
#define GPIO1_GDIR_BASE				(0X0209C004)

struct resource namematch_device_res [] =
{
    [0] = {.start = CCM_CCGR1_BASE,.end = CCM_CCGR1_BASE + 4,.name = "reg1", .flags = IORESOURCE_MEM},
    [1] = {.start = SW_MUX_GPIO1_IO03_BASE,.end = SW_MUX_GPIO1_IO03_BASE + 4,.name = "reg2", .flags = IORESOURCE_MEM},
    [2] = {.start = SW_PAD_GPIO1_IO03_BASE,.end = SW_PAD_GPIO1_IO03_BASE + 4,.name = "reg3", .flags = IORESOURCE_MEM},
    [3] = {.start = GPIO1_DR_BASE,.end = GPIO1_DR_BASE + 0x4 -1,.name = "reg4", .flags = IORESOURCE_MEM},
    [4] = {.start = GPIO1_GDIR_BASE,.end = GPIO1_GDIR_BASE + 4,.name = "reg5", .flags = IORESOURCE_MEM}
};

问题解决!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值