|
rk3288移植spi(fpc1020)数据传输和设备树配置问题
发表于 2018-8-7 14:15:16
浏览:9019
|
回复:0
打印
只看该作者
[复制链接]
楼主
各位大神,请指教spi(fpc1020)android驱动移植过程中设备树配置和数据传输过程是否有错误的地方,问题应该在哪,怎么解决?请指点!
下面是设备树配置在spi0里面的配置:
&spi0 {
status = "okay";
max-freq = <48000000>;
fpc1020@00 {
compatible = "fpc,fpc1020";
reg = <0>;
spi-max-frequency = <24000000>;
//spi-cpha;
//spi-cpol;
poll_mode = <0>;
type = <0>;
enable_dma = <0>;
fpc,gpio_reset = <&gpio8 GPIO_A6 GPIO_ACTIVE_LOW>;
fpc,gpio_irq = <&gpio8 GPIO_A7 IRQ_TYPE_LEVEL_HIGH>;
fpc,gpio_cs = <>;
status = "okay";
};
};
下面是fpc驱动程序读取设备树参数和数据的子函数:
static int __devinit fpc1020_get_of_pdata(struct device *dev,
struct fpc1020_platform_data *pdata)
{
const struct device_node *node = dev->of_node;
/* required properties */
const void *irq_prop = of_get_property(node, "fpc,gpio_irq", NULL);
const void *rst_prop = of_get_property(node, "fpc,gpio_reset", NULL);
const void *cs_prop = of_get_property(node, "fpc,gpio_cs", NULL);
/* optional properties */
const void *vddtx_prop = of_get_property(node, "fpc,vddtx_mv", NULL);
const void *boost_prop =
of_get_property(node, "fpc,txout_boost_enable", NULL);
if (node == NULL) {
dev_err(dev, "%s: Could not find OF device node\n", __func__);
goto of_err;
}
if (!irq_prop || !rst_prop || !cs_prop) {
dev_err(dev, "%s: Missing OF property\n", __func__);
goto of_err;
}
pdata->irq_gpio = be32_to_cpup(irq_prop);
pdata->reset_gpio = be32_to_cpup(rst_prop);
pdata->cs_gpio = be32_to_cpup(cs_prop);
pdata->external_supply_mv =
(vddtx_prop != NULL) ? be32_to_cpup(vddtx_prop) : 0;
pdata->txout_boost = (boost_prop != NULL) ? 1 : 0;
return 0;
of_err:
pdata->reset_gpio = -EINVAL;
pdata->irq_gpio = -EINVAL;
pdata->cs_gpio = -EINVAL;
pdata->external_supply_mv = 0;
pdata->txout_boost = 0;
return -ENODEV;
}
原本我用的是 fpc,gpio_reset = <&gpio8 GPIO_A6 GPIO_ACTIVE_LOW>;管脚号应该是262,但是打印出来的log却是fpc1020 spi0.0: Assign HW reset -> GPIO151 151 很明显不对,是大小端函数处理错误吗?还是管脚地址传输错误了?读取设备节点的属性函数用的对吗?还是用其他函数呢?望高人指点呀! |
|