diff --git a/Makefile b/Makefile
index ddf501c314542a24f8e6d6ce351231a16758fd7f..6d5a80cf8236bf81d5a863e36deb51ab697b27d1 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ obj-y += wrc_main.o
 	$(CC) -include $(AUTOCONF) -E -P $*.ld.S -o $@
 
 
-cflags-y =	-ffreestanding -include $(AUTOCONF) -Iinclude -I. -Isoftpll
+cflags-y =	-ffreestanding -include $(AUTOCONF) -Iinclude/std -Iinclude -I. -Isoftpll
 cflags-y +=	-I$(CURDIR)/pp_printf
 
 cflags-$(CONFIG_PTP_NOPOSIX) += \
diff --git a/dev/w1-eeprom.c b/dev/w1-eeprom.c
index 39398704c0b62066f7529a50953785a475926818..aa167cc64f7614f38015732d588569b622407b03 100644
--- a/dev/w1-eeprom.c
+++ b/dev/w1-eeprom.c
@@ -4,9 +4,14 @@
  */
 #include <stdlib.h>
 #include <string.h>
+#include <w1.h>
+
+#ifndef EXTERNAL_W1
 #include <wrc.h>
 #include <shell.h>
-#include <w1.h>
+#else
+#include <unistd.h>
+#endif
 
 #define LSB_ADDR(X) ((X) & 0xFF)
 #define MSB_ADDR(X) (((X) & 0xFF00)>>8)
@@ -138,6 +143,7 @@ int w1_write_eeprom_bus(struct w1_bus *bus,
 	return -1;
 }
 
+#ifndef EXTERNAL_W1
 #define BLEN 32
 
 /* A shell command, for testing write: "w1w <offset> <byte> [<byte> ...]" */
@@ -190,3 +196,5 @@ DEFINE_WRC_COMMAND(w1r) = {
 	.name = "w1r",
 	.exec = cmd_w1_r,
 };
+
+#endif
diff --git a/dev/w1-hw.c b/dev/w1-hw.c
index 5bf645a6da893be1431c65ae56a4104930c23694..b4cca2655c17680319ad48486c39034cf7b17391 100644
--- a/dev/w1-hw.c
+++ b/dev/w1-hw.c
@@ -6,9 +6,9 @@
  *
  * Released according to the GNU GPL, version 2 or any later version.
  */
-#include <wrc.h>
 #include <string.h>
 #include <w1.h>
+#include <board.h>
 #include <hw/sockit_owm_regs.h>
 
 static inline uint32_t __wait_cycle(void *base)
diff --git a/dev/w1.c b/dev/w1.c
index b7d0fd9c5525ebf82983519aff0114e2e753660a..ccea4165f97eaee27be11e8bfc0efd82b9b3d8d9 100644
--- a/dev/w1.c
+++ b/dev/w1.c
@@ -2,11 +2,17 @@
  * Onewire generic interface
  * Alessandro Rubini, 2013 GNU GPL2 or later
  */
-#include <wrc.h>
 #include <string.h>
-#include <shell.h>
 #include <w1.h>
 
+#ifndef EXTERNAL_W1
+#include <wrc.h>
+#include <shell.h>
+#else
+#include <unistd.h>
+#define pp_printf(...) do {} while (0)
+#endif
+
 static const struct w1_ops *ops = &wrpc_w1_ops; /* local shorter name */
 
 void w1_write_byte(struct w1_bus *bus, int byte)
@@ -146,6 +152,8 @@ void w1_match_rom(struct w1_dev *dev)
 	}
 }
 
+#ifndef EXTERNAL_W1
+
 /* A shell command, for checking */
 static int cmd_w1(const char *args[])
 {
@@ -171,3 +179,5 @@ DEFINE_WRC_COMMAND(w1) = {
 	.name = "w1",
 	.exec = cmd_w1,
 };
+
+#endif
diff --git a/include/inttypes.h b/include/std/inttypes.h
similarity index 100%
rename from include/inttypes.h
rename to include/std/inttypes.h
diff --git a/include/stdint.h b/include/std/stdint.h
similarity index 100%
rename from include/stdint.h
rename to include/std/stdint.h
diff --git a/tools/.gitignore b/tools/.gitignore
index bbed0100e052eee9601321150b4fabbbc8200963..7e4b0e0cd46db301b71e334179e3b983e937a2b7 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -4,3 +4,5 @@ genrammif
 wrpc-uart-sw
 wrpc-w1-read
 wrpc-w1-write
+eb-w1-write
+sdb-wrpc.bin
diff --git a/tools/Makefile b/tools/Makefile
index fb3c54a4d780798b29722c1bd3577799b3975d8a..a3d77500b0b80e7985bcfd46e2977164d4b68f4a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,8 +1,18 @@
-CFLAGS = -Wall -ggdb
+EB    ?= no
+SDBFS ?= no
+
+CFLAGS = -Wall -ggdb -DEXTERNAL_W1 -I../include
 LDFLAGS = -lutil
 ALL    = genraminit genramvhd genrammif wrpc-uart-sw
 ALL   += wrpc-w1-read wrpc-w1-write
 
+ifneq ($(EB),no)
+ALL += eb-w1-write
+endif
+ifneq ($(SDBFS),no)
+ALL += sdb-wrpc.bin
+endif
+
 AS		= as
 LD		= ld
 CC		= gcc
@@ -18,14 +28,17 @@ all:	$(ALL)
 %:	%.c
 	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
 
-wrpc-w1-read: wrpc-w1-read.c w1-host/libw1.a
+wrpc-w1-read: wrpc-w1-read.c ../dev/w1.c ../dev/w1-eeprom.c ../dev/w1-hw.c
 	$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
 
-wrpc-w1-write: wrpc-w1-write.c w1-host/libw1.a
+wrpc-w1-write: wrpc-w1-write.c ../dev/w1.c ../dev/w1-eeprom.c ../dev/w1-hw.c
 	$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
-w1-host/libw1.a:
-	$(MAKE) -C w1-host
+
+eb-w1-write: eb-w1-write.c ../dev/w1.c ../dev/w1-eeprom.c eb-w1.c
+	$(CC) $(CFLAGS) -I $(EB) $^ $(LDFLAGS) -o $@ -L $(EB) -letherbone
+
+sdb-wrpc.bin: sdbfs
+	$(SDBFS)/gensdbfs $< $@
 
 clean:
 	rm -f $(ALL) *.o *~
-	$(MAKE) -C w1-host clean
diff --git a/tools/eb-w1-write.c b/tools/eb-w1-write.c
new file mode 100644
index 0000000000000000000000000000000000000000..1daa904b0c8f3bf0e7a0e6ba9fdc8c0dabd1c166
--- /dev/null
+++ b/tools/eb-w1-write.c
@@ -0,0 +1,134 @@
+/*
+ * This work is part of the White Rabbit project
+ *
+ * Copyright (C) 2013 CERN (www.cern.ch)
+ * Author: Wesley W. Terpstra <w.terpstra@gsi.de>
+ * Author: Alessandro Rubini <rubini@gnudd.com>
+ * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
+ *
+ * Released according to the GNU GPL, version 2 or any later version.
+ */
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <etherbone.h>
+
+#include <w1.h>
+
+#define W1_VENDOR	0xce42		/* CERN */
+#define W1_DEVICE	0x779c5443	/* WR-Periph-1Wire */
+
+char *prgname;
+int verbose;
+
+eb_address_t BASE_ONEWIRE;
+eb_device_t device;
+extern struct w1_bus wrpc_w1_bus;
+
+
+static int write_w1(int w1base, int w1len)
+{
+	struct w1_dev *d;
+	uint8_t buf[w1len];
+	int i;
+
+	w1_scan_bus(&wrpc_w1_bus);
+
+	if (verbose) { /* code borrowed from dev/w1.c -- "w1" shell command */
+		for (i = 0; i < W1_MAX_DEVICES; i++) {
+			d = wrpc_w1_bus.devs + i;
+			if (d->rom)
+				fprintf(stderr, "device %i: %08x%08x\n", i,
+					(int)(d->rom >> 32), (int)d->rom);
+		}
+	}
+
+	if (verbose) {
+		fprintf(stderr, "Writing device offset %i (0x%x), len %i\n",
+			w1base, w1base, w1len);
+	}
+
+	if (isatty(fileno(stdin)))
+		fprintf(stderr, "Reading from stdin, please type the data\n");
+	i = fread(buf, 1, w1len, stdin);
+	if (i != w1len) {
+		fprintf(stderr, "%s: read error (%i, expeted %i)\n", prgname,
+			i, w1len);
+		return 1;
+	}
+	i = w1_write_eeprom_bus(&wrpc_w1_bus, w1base, buf, w1len);
+	if (i != w1len) {
+		fprintf(stderr, "Tried to write %i bytes, retval %i\n",
+			w1len, i);
+		return 1;
+	}
+	return 0;
+}
+
+/*
+ * What follows is mostly generic, should be librarized in a way
+ */
+
+
+static int help(void)
+{
+	fprintf(stderr, "%s: Use: \"%s [-v] <device> <addr> <len>\n",
+		prgname, prgname);
+	return 1;
+}
+
+static void die(const char *reason, eb_status_t status)
+{
+	fprintf(stderr, "%s: %s: %s\n", prgname, reason, eb_status(status));
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	int c;
+	eb_status_t status;
+	eb_socket_t socket;
+	struct sdb_device sdb;
+
+	prgname = argv[0];
+
+	while ((c = getopt(argc, argv, "v")) != -1) {
+		switch(c) {
+		case 'v':
+			verbose++;
+			break;
+		default:
+			exit(help());
+		}
+	}
+	if (optind != argc - 3)
+		exit(help());
+
+	if ((status = eb_socket_open(EB_ABI_CODE, 0, EB_DATAX|EB_ADDRX, &socket)) != EB_OK)
+		die("eb_socket_open", status);
+
+	if ((status = eb_device_open(socket, argv[optind], EB_DATAX|EB_ADDRX, 3, &device)) != EB_OK)
+		die(argv[optind], status);
+	
+	/* Find the W1 device */
+	c = 1;
+	if ((status = eb_sdb_find_by_identity(device, W1_VENDOR, W1_DEVICE, &sdb, &c)) != EB_OK)
+		die("eb_sdb_find_by_identity", status);
+	if (c != 1) {
+		fprintf(stderr, "Found %d 1wire controllers on that device\n", c);
+		exit(1);
+	}
+	
+	BASE_ONEWIRE = sdb.sdb_component.addr_first;
+	
+	return write_w1(atoi(argv[optind + 1]), atoi(argv[optind + 2]));
+}
diff --git a/tools/eb-w1.c b/tools/eb-w1.c
new file mode 100644
index 0000000000000000000000000000000000000000..9d634f50084baf7f30424d60e43ae4afaee7bf34
--- /dev/null
+++ b/tools/eb-w1.c
@@ -0,0 +1,75 @@
+/*
+ * This work is part of the White Rabbit project
+ *
+ * Copyright (C) 2013 CERN (www.cern.ch)
+ * Author: Wesley W. Terpstra <w.terpstra@gsi.de>
+ *         Alessandro Rubini <rubini@gnudd.com>
+ *
+ * Released according to the GNU GPL, version 2 or any later version.
+ */
+#include <string.h>
+#include <etherbone.h>
+#include <w1.h>
+#include <hw/sockit_owm_regs.h>
+
+extern eb_address_t BASE_ONEWIRE;
+extern eb_device_t  device;
+
+static inline uint32_t __wait_cycle(eb_device_t device)
+{
+	eb_data_t data;
+	
+	do {
+	    eb_device_read(device, BASE_ONEWIRE, EB_DATA32|EB_BIG_ENDIAN, &data, 0, 0);
+        } while (data & SOCKIT_OWM_CTL_CYC_MSK);
+
+	return data;
+}
+
+static int w1_reset(struct w1_bus *bus)
+{
+	int portnum = bus->detail;
+	uint32_t reg;
+	
+	eb_data_t data =  (portnum << SOCKIT_OWM_CTL_SEL_OFST)
+			    | (SOCKIT_OWM_CTL_CYC_MSK)
+			    | (SOCKIT_OWM_CTL_RST_MSK);
+	eb_device_write(device, BASE_ONEWIRE, EB_DATA32|EB_BIG_ENDIAN, data, 0, 0);
+	reg = __wait_cycle(device);
+	
+	/* return presence-detect pulse (1 if true) */
+	return (reg & SOCKIT_OWM_CTL_DAT_MSK) ? 0 : 1;
+}
+
+static int w1_read_bit(struct w1_bus *bus)
+{
+	int portnum = bus->detail;
+	uint32_t reg;
+
+	eb_data_t data = (portnum << SOCKIT_OWM_CTL_SEL_OFST)
+			    | (SOCKIT_OWM_CTL_CYC_MSK)
+			    | (SOCKIT_OWM_CTL_DAT_MSK);
+        eb_device_write(device, BASE_ONEWIRE, EB_DATA32|EB_BIG_ENDIAN, data, 0, 0);
+	reg = __wait_cycle(device);
+	
+	return (reg & SOCKIT_OWM_CTL_DAT_MSK) ? 1 : 0;
+}
+
+static void w1_write_bit(struct w1_bus *bus, int bit)
+{
+	int portnum = bus->detail;
+	
+	eb_data_t data = (portnum << SOCKIT_OWM_CTL_SEL_OFST)
+			    | (SOCKIT_OWM_CTL_CYC_MSK)
+			    | (bit ? SOCKIT_OWM_CTL_DAT_MSK : 0);
+	eb_device_write(device, BASE_ONEWIRE, EB_DATA32|EB_BIG_ENDIAN, data, 0, 0);
+	__wait_cycle(device);
+}
+
+struct w1_ops wrpc_w1_ops = {
+	.reset = w1_reset,
+	.read_bit = w1_read_bit,
+	.write_bit = w1_write_bit,
+};
+
+struct w1_bus wrpc_w1_bus;
diff --git a/tools/w1-host/Makefile b/tools/w1-host/Makefile
deleted file mode 100644
index 6baa94736bf9cf1e75f5cabe77a2473daa453a4f..0000000000000000000000000000000000000000
--- a/tools/w1-host/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-
-all: libw1.a
-
-libw1.a: w1.o w1-eeprom.o w1-hw.o w1-temp.o
-	ar r $@ $^
-
-clean:
-	rm -f *.o *.a *~
\ No newline at end of file
diff --git a/tools/w1-host/w1-eeprom.c b/tools/w1-host/w1-eeprom.c
deleted file mode 100644
index 2a7514f5a286f39be9b41967d1a2328c471ea918..0000000000000000000000000000000000000000
--- a/tools/w1-host/w1-eeprom.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Eeprom support (family 0x43)
- * Cesar Prados, Alessandro Rubini, 2013. GNU GPL2 or later
- */
-#include <stdlib.h>
-#include <string.h>
-#include "w1.h"
-
-#define LSB_ADDR(X) ((X) & 0xFF)
-#define MSB_ADDR(X) (((X) & 0xFF00)>>8)
-
-static int w1_write_page(struct w1_dev *dev, int offset, const uint8_t *buffer,
-			 int blen)
-{
-	int i, j, es;
-
-	/* First, write scratchpad */
-	w1_match_rom(dev);
-	w1_write_byte(dev->bus, W1_CMDR_W_SPAD);
-	w1_write_byte(dev->bus, LSB_ADDR(offset));
-	w1_write_byte(dev->bus, MSB_ADDR(offset));
-	for(i = 0; i < blen; i++)
-		w1_write_byte(dev->bus, buffer[i]);
-
-	/* Then, read it back, and remember the return E/S */
-	w1_match_rom(dev);
-	w1_write_byte(dev->bus, W1_CMDR_R_SPAD);
-	if (w1_read_byte(dev->bus) != LSB_ADDR(offset))
-		return -1;
-	if (w1_read_byte(dev->bus) != MSB_ADDR(offset))
-		return -2;
-	es = w1_read_byte(dev->bus);
-	for(i = 0; i < blen; i++) {
-		j = w1_read_byte(dev->bus);
-		if (j != buffer[i])
-			return -3;
-	}
-
-	/* Finally, "copy scratchpad" to actually write */
-	w1_match_rom(dev);
-	w1_write_byte(dev->bus, W1_CMDR_C_SPAD);
-	w1_write_byte(dev->bus, LSB_ADDR(offset));
-	w1_write_byte(dev->bus, MSB_ADDR(offset));
-	w1_write_byte(dev->bus, es);
-	usleep(10000); /* 10ms, in theory */
-
-	/* Don't read back, as nothing useful is there (I get 0xf9, why?) */
-	return blen;
-}
-
-int w1_write_eeprom(struct w1_dev *dev, int offset, const uint8_t *buffer,
-		    int blen)
-{
-	int i, page, endpage;
-	int ret = 0;
-
-	/* Split the write into several page-local writes */
-	page = offset / 32;
-	endpage = (offset + blen - 1) / 32;
-
-	/* Traling part of first page */
-	if (offset % 32) {
-		if (endpage != page)
-			i = 32 - (offset % 32);
-		else
-			i = blen;
-		ret += w1_write_page(dev, offset, buffer, i);
-		if (ret < 0)
-			return ret;
-		buffer += i;
-		offset += i;
-		blen -= i;
-	}
-
-	/* Whole pages and leading part of last page */
-	while (blen > 0 ) {
-		i = blen;
-		if (blen > 32)
-			i = 32;
-		i = w1_write_page(dev, offset, buffer, i);
-		if (i < 0)
-			return i;
-		ret += i;
-		buffer += 32;
-		offset += 32;
-		blen -= 32;
-	}
-	return ret;
-}
-
-int w1_read_eeprom(struct w1_dev *dev, int offset, uint8_t *buffer, int blen)
-{
-	int i;
-
-	w1_match_rom(dev);
-	w1_write_byte(dev->bus, W1_CMDR_R_MEMORY);
-
-	w1_write_byte(dev->bus, LSB_ADDR(offset));
-	w1_write_byte(dev->bus, MSB_ADDR(offset));
-
-	/* There is no page-size limit in reading, just go on at will */
-	for(i = 0; i < blen; i++)
-		buffer[i] = w1_read_byte(dev->bus);
-
-	return blen;
-}
-
-
-int w1_read_eeprom_bus(struct w1_bus *bus,
-			    int offset, uint8_t *buffer, int blen)
-{
-	int i, class;
-
-	for (i = 0; i < W1_MAX_DEVICES; i++) {
-		class = w1_class(bus->devs + i);
-		if (class == 0x43)
-			return w1_read_eeprom(bus->devs + i, offset,
-					      buffer, blen);
-	}
-	/* not found */
-	return -1;
-}
-
-int w1_write_eeprom_bus(struct w1_bus *bus,
-			int offset, const uint8_t *buffer, int blen)
-{
-	int i, class;
-
-	for (i = 0; i < W1_MAX_DEVICES; i++) {
-		class = w1_class(bus->devs + i);
-		if (class == 0x43)
-			return w1_write_eeprom(bus->devs + i, offset,
-					       buffer, blen);
-	}
-	/* not found */
-	return -1;
-}
diff --git a/tools/w1-host/w1-hw.c b/tools/w1-host/w1-hw.c
deleted file mode 100644
index 447b19ab656c57d1882f34327702b8e270b84dc0..0000000000000000000000000000000000000000
--- a/tools/w1-host/w1-hw.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This work is part of the White Rabbit project
- *
- * Copyright (C) 2013 CERN (www.cern.ch)
- * Author: Alessandro Rubini <rubini@gnudd.com>
- *
- * Released according to the GNU GPL, version 2 or any later version.
- */
-#include <string.h>
-#include "w1.h"
-#include "../../include/hw/sockit_owm_regs.h"
-
-extern void *BASE_ONEWIRE;
-
-static inline uint32_t __wait_cycle(void *base)
-{
-	uint32_t reg;
-
-	while ((reg = IORD_SOCKIT_OWM_CTL(base)) & SOCKIT_OWM_CTL_CYC_MSK)
-		;
-	return reg;
-}
-
-static int w1_reset(struct w1_bus *bus)
-{
-	int portnum = bus->detail;
-	uint32_t reg;
-
-	IOWR_SOCKIT_OWM_CTL(BASE_ONEWIRE, (portnum << SOCKIT_OWM_CTL_SEL_OFST)
-			    | (SOCKIT_OWM_CTL_CYC_MSK)
-			    | (SOCKIT_OWM_CTL_RST_MSK));
-	reg = __wait_cycle(BASE_ONEWIRE);
-	/* return presence-detect pulse (1 if true) */
-	return (reg & SOCKIT_OWM_CTL_DAT_MSK) ? 0 : 1;
-}
-
-static int w1_read_bit(struct w1_bus *bus)
-{
-	int portnum = bus->detail;
-	uint32_t reg;
-
-	IOWR_SOCKIT_OWM_CTL(BASE_ONEWIRE, (portnum << SOCKIT_OWM_CTL_SEL_OFST)
-			    | (SOCKIT_OWM_CTL_CYC_MSK)
-			    | (SOCKIT_OWM_CTL_DAT_MSK));
-	reg = __wait_cycle(BASE_ONEWIRE);
-	return (reg & SOCKIT_OWM_CTL_DAT_MSK) ? 1 : 0;
-}
-
-static void w1_write_bit(struct w1_bus *bus, int bit)
-{
-	int portnum = bus->detail;
-
-	IOWR_SOCKIT_OWM_CTL(BASE_ONEWIRE, (portnum << SOCKIT_OWM_CTL_SEL_OFST)
-			    | (SOCKIT_OWM_CTL_CYC_MSK)
-			    | (bit ? SOCKIT_OWM_CTL_DAT_MSK : 0));
-	__wait_cycle(BASE_ONEWIRE);
-}
-
-struct w1_ops wrpc_w1_ops = {
-	.reset = w1_reset,
-	.read_bit = w1_read_bit,
-	.write_bit = w1_write_bit,
-};
-
-struct w1_bus wrpc_w1_bus;
diff --git a/tools/w1-host/w1-temp.c b/tools/w1-host/w1-temp.c
deleted file mode 100644
index cd5dbc919d54a5a13febc9ceff98221dd600e988..0000000000000000000000000000000000000000
--- a/tools/w1-host/w1-temp.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Temperature input for DS18S20 (family 0x10)
- * Alessandro Rubini, 2013 GNU GPL2 or later
- */
-#include "w1.h"
-
-int32_t w1_read_temp(struct w1_dev *dev, unsigned long flags)
-{
-	static uint8_t scratchpad[8];
-	int class = w1_class(dev);
-	int32_t res;
-	int16_t cval;
-	int i;
-
-	/* The caller is expected to have checked the class. but still... */
-	switch(class) {
-	case 0x10: case 0x28: case 0x42:
-		break; /* Supported, at least for temperature input */
-	default:
-		return 1<<31; /* very negative */
-	}
-
-	/* If so asked, jump over start-conversion and only collect result */
-	if (flags & W1_FLAG_COLLECT)
-		goto collect;
-
-	w1_match_rom(dev);
-	w1_write_byte(dev->bus, W1_CMDT_CONVERT);
-
-	/* If so asked, don't wait for the conversion to be over */
-	if (flags & W1_FLAG_NOWAIT)
-		return 0;
-
-	while(wrpc_w1_ops.read_bit(dev->bus) == 0)
-		;
-collect:
-	w1_match_rom(dev);
-	w1_write_byte(dev->bus, W1_CMDT_R_SPAD);
-	for (i = 0; i < sizeof(scratchpad); i++)
-		scratchpad[i] = w1_read_byte(dev->bus);
-
-	res = 0;
-	cval = scratchpad[1] << 8 | scratchpad[0];
-
-	switch(class) {
-	case 0x10:
-		/* 18S20: two bytes plus "count remain" value */
-		res = (int32_t)cval << 15; /* 1 decimal points */
-		res -= 0x4000; /* - 0.25 degrees */
-		res |= scratchpad[6] << 12; /* 1/16th of degree each */
-		break;
-
-	case 0x28:
-	case 0x42:
-		/* 18B20 and DS28EA00: only the two bytes */
-		res = (int32_t)cval << 12; /* 4 decimal points */
-		break;
-	}
-	return res;
-}
-
-int32_t w1_read_temp_bus(struct w1_bus *bus, unsigned long flags)
-{
-	int i, class;
-
-	for (i = 0; i < W1_MAX_DEVICES; i++) {
-		class = w1_class(bus->devs + i);
-		switch(class) {
-		case 0x10: case 0x28: case 0x42:
-			return w1_read_temp(bus->devs + i, flags);
-		default:
-			break;
-		}
-	}
-	/* not found */
-	return 1 << 31;
-}
diff --git a/tools/w1-host/w1.c b/tools/w1-host/w1.c
deleted file mode 100644
index 20bb9a2fb56407f48f264d87bbc1122f70ee12be..0000000000000000000000000000000000000000
--- a/tools/w1-host/w1.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Onewire generic interface
- * Alessandro Rubini, 2013 GNU GPL2 or later
- */
-#include <string.h>
-#include "w1.h"
-
-static const struct w1_ops *ops = &wrpc_w1_ops; /* local shorter name */
-
-void w1_write_byte(struct w1_bus *bus, int byte)
-{
-	int i;
-
-	for (i = 1; i < 0x100; i <<= 1)
-		ops->write_bit(bus, byte & i ? 1 : 0);
-}
-
-int w1_read_byte(struct w1_bus *bus)
-{
-	int i, res = 0;
-
-	for (i = 1; i < 0x100; i <<= 1)
-		res |= ops->read_bit(bus) ? i : 0;
-	usleep(100); /* inter-byte, for my eyes only */
-	return res;
-
-}
-
-/* scan_bus requires this di-bit helper */
-enum __bits {B_0, B_1, B_BOTH};
-
-/* return what we get, select it if unambiguous or the one passed */
-static enum __bits __get_dibit(struct w1_bus *bus, int select)
-{
-	int a, b;
-
-	a = ops->read_bit(bus);
-	b = ops->read_bit(bus);
-	if (a != b) {
-		ops->write_bit(bus, a);
-		return a ? B_1 : B_0;
-	}
-	ops->write_bit(bus, select);
-	return B_BOTH;
-}
-
-/*
- * This identifies one. Returns 0 if not found, -1 on error. The current mask
- * is used to return the conflicts we found: on each conflict, we follow
- *  what's already in our id->rom, but remember it for later scans.
- */
-static int __w1_scan_one(struct w1_bus *bus, uint64_t *rom, uint64_t *cmask)
-{
-	uint64_t mask;
-	int select;
-	enum __bits b;
-
-	if (ops->reset(bus) != 1)
-		return -1;
-	w1_write_byte(bus, 0xf0); /* search rom */
-
-	/*
-	 * Send all bits we have (initially, zero).
-	 * On a conflict, follow what we have in rom and possibly mark it.
-	 */
-	*cmask = 0;
-	for (mask = 1; mask; mask <<= 1) {
-		select = *rom & mask;
-		b = __get_dibit(bus, select);
-
-		switch(b) {
-		case B_1:
-			*rom |= mask;
-		case B_0:
-			break;
-		case B_BOTH:
-			/* if we follow 1, it's resolved, else mark it */
-			if (!select)
-				*cmask |= mask;
-			break;
-		}
-	}
-	return 0;
-}
-
-int w1_scan_bus(struct w1_bus *bus)
-{
-	uint64_t mask;
-	uint64_t cmask; /* current */
-	struct w1_dev *d;
-	int i;
-
-	memset(bus->devs, 0, sizeof(bus->devs));
-
-	if (!ops->reset)
-		return 0; /* no devices */
-	for (i = 0, cmask = 0; i < W1_MAX_DEVICES; i++) {
-		d = bus->devs + i;
-		d->bus = bus;
-
-		if (i) { /* Not first: scan conflicts and resolve last */
-			d->rom = bus->devs[i-1].rom;
-			for (mask = (1ULL<<63); mask; mask >>= 1) {
-				/*
-				 * Warning: lm32 compiter treats as signed!
-				 *
-				 * Even if mask is uint64_t, the shift in the
-				 * for loop above is signed, so fix it.
-				 * I prefer not to change the loop, as the
-				 * code is in use elsewhere and I prefer to
-				 * keep differences to a minimum
-				 */
-				if (mask & (1ULL<<62))
-					mask = (1ULL<<62);
-
-				if (cmask & mask)
-					break;
-				d->rom &= ~mask;
-			}
-			if (!mask) {
-				/* no conflicts to solve: done */
-				return i;
-			}
-			d->rom |= mask; /* we'll reply 1 next loop */
-			cmask &= ~mask;
-		}
-		if (__w1_scan_one(bus, &d->rom, &cmask)) {
-			/* error on this one */
-			return i;
-		}
-	}
-	return i;
-}
-
-void w1_match_rom(struct w1_dev *dev)
-{
-	int i;
-
-	ops->reset(dev->bus);
-	w1_write_byte(dev->bus, W1_CMD_MATCH_ROM); /* match rom */
-	for (i = 0; i < 64; i+=8) {
-		w1_write_byte(dev->bus, (int)(dev->rom >> i) );
-	}
-}
diff --git a/tools/w1-host/w1.h b/tools/w1-host/w1.h
deleted file mode 100644
index 5605d110b05528e2e67036fc269e166d9ce746ff..0000000000000000000000000000000000000000
--- a/tools/w1-host/w1.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Onewire generic interface
- * Alessandro Rubini, 2013 GNU GPL2 or later
- */
-#ifndef __BATHOS_W1_H__
-#define __BATHOS_W1_H__
-
-#include <stdint.h>
-
-#define W1_MAX_DEVICES 8 /* we have no alloc */
-
-struct w1_dev {
-	struct w1_bus *bus;
-	uint64_t rom;
-};
-
-static inline int w1_class(struct w1_dev *dev)
-{
-	return dev->rom & 0xff;
-}
-
-
-struct w1_bus {
-	unsigned long detail; /* gpio bit or whatever (driver-specific) */
-	struct w1_dev devs[W1_MAX_DEVICES];
-};
-
-/*
- * The low-level driver is based on this set of operations. We expect to
- * only have one set of such operations in each build. (i.e., no bus-specific
- * operations, to keep the thing simple and small).
- */
-struct w1_ops {
-	int (*reset)(struct w1_bus *bus);	/* returns 1 on "present" */
-	int (*read_bit)(struct w1_bus *bus);
-	void (*write_bit)(struct w1_bus *bus, int bit);
-};
-
-/* Library functions */
-extern int w1_scan_bus(struct w1_bus *bus);
-extern void w1_write_byte(struct w1_bus *bus, int byte);
-extern int w1_read_byte(struct w1_bus *bus);
-extern void w1_match_rom(struct w1_dev *dev);
-
-#define W1_CMD_SEARCH_ROM	0xf0
-#define W1_CMD_READ_ROM		0x33
-#define W1_CMD_MATCH_ROM	0x55
-#define W1_CMD_SKIP_ROM		0xcc
-#define W1_CMD_ASEARCH		0xec
-
-/* commands for specific families */
-#define W1_CMDT_CONVERT		0x44
-#define W1_CMDT_W_SPAD		0x4e
-#define W1_CMDT_R_SPAD		0xbe
-#define W1_CMDT_CP_SPAD		0x48
-#define W1_CMDT_RECALL		0xb8
-#define W1_CMDT_R_PS		0xb4
-/* EEPROM DS28EC20 */
-#define W1_CMDR_W_SPAD		0x0f
-#define W1_CMDR_R_SPAD		0xaa
-#define W1_CMDR_C_SPAD		0x55
-#define W1_CMDR_R_MEMORY	0xf0
-#define W1_CMDR_EXT_R_MEMORY	0xa5
-
-/* Temperature conversion takes time: by default wait, but allow flags */
-#define W1_FLAG_NOWAIT		0x01	/* start conversion only*/
-#define W1_FLAG_COLLECT		0x02	/* don't start, just get output */
-
-/* These functions are dev-specific */
-extern int32_t w1_read_temp(struct w1_dev *dev, unsigned long flags);
-extern int w1_read_eeprom(struct w1_dev *dev,
-			  int offset, uint8_t *buffer, int blen);
-extern int w1_write_eeprom(struct w1_dev *dev,
-			   int offset, const uint8_t *buffer, int blen);
-
-/* These are generic, using the first suitable device in the bus */
-extern int32_t w1_read_temp_bus(struct w1_bus *bus, unsigned long flags);
-extern int w1_read_eeprom_bus(struct w1_bus *bus,
-			    int offset, uint8_t *buffer, int blen);
-extern int w1_write_eeprom_bus(struct w1_bus *bus,
-			     int offset, const uint8_t *buffer, int blen);
-
-extern struct w1_ops wrpc_w1_ops;
-extern struct w1_bus wrpc_w1_bus;
-
-#endif /* __BATHOS_W1_H__ */
diff --git a/tools/wrpc-w1-read.c b/tools/wrpc-w1-read.c
index 05dbbb194611004debe63bb04fc9efca56e489fa..8624f48a669c55476b538287746abc9f56aacba7 100644
--- a/tools/wrpc-w1-read.c
+++ b/tools/wrpc-w1-read.c
@@ -20,7 +20,7 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
-#include "w1-host/w1.h"
+#include <w1.h>
 
 #define SPEC_W1_OFFSET 0x20600 /* from "sdb" on the shell, current gateware */
 
diff --git a/tools/wrpc-w1-write.c b/tools/wrpc-w1-write.c
index 5c9a7834cdbe450019a1972a11c45dffe923ce01..9f789c350a76cd42118921f760aac2cd6f59dd0e 100644
--- a/tools/wrpc-w1-write.c
+++ b/tools/wrpc-w1-write.c
@@ -20,7 +20,7 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
-#include "w1-host/w1.h"
+#include <w1.h>
 
 #define SPEC_W1_OFFSET 0x20600 /* from "sdb" on the shell, current gateware */