Hi, this extends the one wire master DS2482 driver to support other interfacing modes and adds a slave one wire DS28E05 EEPROM driver. This allows the one wire master DS2482 driver to support the OverDrive interface mode which is required for it to talk to the DS28E05 slave chip.
These patches are against the recent 4.13.0-rc6 mainline kernel and compile against it. The code was tested against the recent Debian stable 4.9 kernel. The code did require some changes between the two kernels to compile but are functionally the same.
Hopefully it is useful for some other people wanting to use these or similar chips.
Thanks
Andrew Worsley
PATCH 1/2 Extend 1W master driver DS2482 with module option to support PPM/SPU/1WS features
Extend the one wire DS2482 master driver with a module option that allows support for PPM/SPU/1WS interface modes to be requested. This allows support of chips that require one or more of these features such as the DS28E05.
--- drivers/w1/masters/ds2482.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/w1/masters/ds2482.c +8 -4
@@ -70,6 +70,8 @@ MODULE_PARM_DESC(active_pullup, "Active pullup (apply to all buses): " \#define DS2482_REG_CFG_PPM 0x02/* presence pulse masking */ #define DS2482_REG_CFG_APU 0x01/* active pull-up */ +/* extra configurations - e.g. 1WS */ +int extra_config;/** * Write and verify codes for the CHANNEL_SELECT command (DS2482-800 only).
@@ -403,7 +405,7 @@ static u8 ds2482_w1_reset_bus(void *data)/* If the chip did reset since detect, re-config it */ if (err &DS2482_REG_STS_RST )ds2482_send_cmd_data (pdev,DS2482_CMD_WRITE_CONFIG , -ds2482_calculate_config (0x00 )); +ds2482_calculate_config (extra_config)); }mutex_unlock (&pdev->access_lock);
@@ -429,8 +431,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay)ds2482_wait_1wire_idle (pdev);/* note: it seems like both SPU and APU have to be set! */ retval =ds2482_send_cmd_data (pdev,DS2482_CMD_WRITE_CONFIG , -ds2482_calculate_config (DS2482_REG_CFG_SPU | -DS2482_REG_CFG_APU )); +ds2482_calculate_config (extra_config|DS2482_REG_CFG_SPU |DS2482_REG_CFG_APU ));ds2482_wait_1wire_idle (pdev); }
@@ -483,7 +484,7 @@ static int ds2482_probe(struct i2c_client *client,/* Set all config items to 0 (off) */ ds2482_send_cmd_data (data,DS2482_CMD_WRITE_CONFIG , -ds2482_calculate_config (0x00 )); +ds2482_calculate_config (extra_config));mutex_init (&data->access_lock);
@@ -558,4 +559,7 @@ module_i2c_driver(ds2482_driver);MODULE_AUTHOR ("Ben Gardner <[email protected]>" );MODULE_DESCRIPTION ("DS2482 driver" ); +module_param (extra_config, int,S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (extra_config,"Extra Configuration settings 1=APU,2=PPM,3=SPU,8=1WS" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.11.0
PATCH 2/2 Add 1w slave driver for DS28E05 EEPROM
In reply to Andrew WorsleyAdd a one wire driver for the DS28E05 one wire slave chip. This chip requires OverDrive support to talk to it.
--- drivers/w1/slaves/Kconfig | 8 ++ drivers/w1/slaves/Makefile | 1 + drivers/w1/slaves/w1_ds2805.c | 313 ++++++++++++++++++++++++++++++++++++++++++ drivers/w1/w1.c | 2 + 4 files changed, 324 insertions(+) create mode 100644 drivers/w1/slaves/w1_ds2805.c
drivers/w1/slaves/Kconfig +8 -0
@@ -65,6 +65,14 @@ config W1_SLAVE_DS2423 Say Y here if you want to use a 1-wire counter family device (DS2423). +config W1_SLAVE_DS2805 + tristate "112-byte EEPROM support (DS28E05)" + help + Say Y here if you want to use a 1-wire + is a 112-byte user-programmable EEPROM is + organized as 7 pages of 16 bytes each with 64bit + unique number. Requires OverDrive Speed to talk to. + config W1_SLAVE_DS2431 tristate "1kb EEPROM family support (DS2431)" help
drivers/w1/slaves/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_W1_SLAVE_DS2413) += w1_ds2413.o obj-$(CONFIG_W1_SLAVE_DS2406) += w1_ds2406.o obj-$(CONFIG_W1_SLAVE_DS2423) += w1_ds2423.o obj-$(CONFIG_W1_SLAVE_DS2431) += w1_ds2431.o +obj-$(CONFIG_W1_SLAVE_DS2805) += w1_ds2805.o obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o obj-$(CONFIG_W1_SLAVE_DS2438) += w1_ds2438.o obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o
drivers/w1/slaves/w1_ds2805.c new file +313 -0
313 lines not on this page · raw message
drivers/w1/w1.c +2 -0
@@ -729,6 +729,8 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)atomic_set (&sl->refcnt,1 );atomic_inc (&sl->master->refcnt); dev->slave_count++; +dev_info (&dev->dev,"Attaching one wire slave %02x.%012llx crc %02x\n" , + rn->family, (unsigned long long )rn->id, rn->crc);/* slave modules need to be loaded in a context with unlocked mutex */ mutex_unlock (&dev->mutex);
Signature · 1 line
2.11.0