PLATFORM:LINUX 3.14 AM437X
Deivce: ds28e01
compatible = "w1-gpio";
pinctrl-names = "default";
pinctrl-0 = <&dallas_w1_pins>;
status = "okay";
/* 1-wire test pin GPIO4_0*/
gpios = <&gpio4 0 0>;
#if 0
/* enno 1-wire ds28e01 USB1_DRVVBUS.GPIO3_13*/
gpios = <&gpio3 13 0>;
#endif
};
STEP2:
/* 1-wire test pin */
dallas_w1_pins: pinmux_dallas_w1_pins {
pinctrl-single,pins = <0x1B0 (PIN_INPUT | INPUT_EN | MUX_MODE7) >;/* AE17= GPIO4_0 = cam0_hd.GPIO4_0,MODE7 TLD437X TEST */
};
#if 0
/* 1-wire ds28e01 USB1_DRVVBUS.GPIO3_13 */
dallas_w1_pins: pinmux_dallas_w1_pins {
pinctrl-single,pins = <0x2C4 (PIN_INPUT | INPUT_EN | MUX_MODE7) >;/* F25 = GPIO3_13/gpio0_25 = USB1_DRVVBUS.GPIO3_13, MODE7 not use*/
};
#endif
2.修改步骤
1.make menuconfig
-> Device Drivers
-> Dallas's 1-wire support
-> 1-wire Bus Masters
< > Matrox G400 transport layer for 1-wire
< > DS2490 USB <-> W1 transport layer for 1-wire
< > Maxim DS2482 I2C to 1-Wire bridge
< > Maxim DS1WM 1-wire busmaster
<M> GPIO 1-wire busmaster
< > OMAP HDQ driver
即.config
CONFIG_W1_MASTER_GPIO=M
2.修改kernel
路径:xxxx/kernel/drivers/w1/w1_family.h
第40行添加:#define W1_FAMILY_DS28E01 0x2F
$insmod w1-gpio.ko
$insmod w1_ds28e04.ko
3.确认挂载成功
$cd /sys/bus/w1/devices
$ls
note1:
如果有设备,则挂载成功,/sys/bus/w1/devices文件下除了w1_bus_master1文件,还有其他的
例如:2f-00000123e80e
2f---------------->family (2 Bytes)
00000123e80e ----->id (12 Bytes)
如果没有相应family的驱动,则添加默认驱动
*debug内核调试信息:w1_master_driver w1_bus_master1: Family 2f for 2f.00000123e80e.09 is not registered
*解决方法:添加ds28e01 family的驱动,添加0x2f
09---------------->crc (2 Bytes)
2f.00000123e80e.09->1-wire 64 Bits地址
参考:
http://linux-sunxi.org/1-Wire
sha1加密驱动:
http://blog.csdn.net/wangjasonlinux/article/details/8993408
Deivce: ds28e01
1.设备树
STEP1:
onewire {compatible = "w1-gpio";
pinctrl-names = "default";
pinctrl-0 = <&dallas_w1_pins>;
status = "okay";
/* 1-wire test pin GPIO4_0*/
gpios = <&gpio4 0 0>;
#if 0
/* enno 1-wire ds28e01 USB1_DRVVBUS.GPIO3_13*/
gpios = <&gpio3 13 0>;
#endif
};
STEP2:
/* 1-wire test pin */
dallas_w1_pins: pinmux_dallas_w1_pins {
pinctrl-single,pins = <0x1B0 (PIN_INPUT | INPUT_EN | MUX_MODE7) >;/* AE17= GPIO4_0 = cam0_hd.GPIO4_0,MODE7 TLD437X TEST */
};
#if 0
/* 1-wire ds28e01 USB1_DRVVBUS.GPIO3_13 */
dallas_w1_pins: pinmux_dallas_w1_pins {
pinctrl-single,pins = <0x2C4 (PIN_INPUT | INPUT_EN | MUX_MODE7) >;/* F25 = GPIO3_13/gpio0_25 = USB1_DRVVBUS.GPIO3_13, MODE7 not use*/
};
#endif
2.修改步骤
1.make menuconfig
-> Device Drivers
-> Dallas's 1-wire support
-> 1-wire Bus Masters
< > Matrox G400 transport layer for 1-wire
< > DS2490 USB <-> W1 transport layer for 1-wire
< > Maxim DS2482 I2C to 1-Wire bridge
< > Maxim DS1WM 1-wire busmaster
<M> GPIO 1-wire busmaster
< > OMAP HDQ driver
即.config
CONFIG_W1_MASTER_GPIO=M
2.修改kernel
路径:xxxx/kernel/drivers/w1/w1_family.h
第40行添加:#define W1_FAMILY_DS28E01 0x2F
$insmod w1-gpio.ko
$insmod w1_ds28e04.ko
3.确认挂载成功
$cd /sys/bus/w1/devices
$ls
note1:
如果有设备,则挂载成功,/sys/bus/w1/devices文件下除了w1_bus_master1文件,还有其他的
例如:2f-00000123e80e
2f---------------->family (2 Bytes)
00000123e80e ----->id (12 Bytes)
如果没有相应family的驱动,则添加默认驱动
*debug内核调试信息:w1_master_driver w1_bus_master1: Family 2f for 2f.00000123e80e.09 is not registered
*解决方法:添加ds28e01 family的驱动,添加0x2f
09---------------->crc (2 Bytes)
2f.00000123e80e.09->1-wire 64 Bits地址
参考:
http://linux-sunxi.org/1-Wire
sha1加密驱动:
http://blog.csdn.net/wangjasonlinux/article/details/8993408