2019-08-31 08:27:37

by Thomas Bogendoerfer

[permalink] [raw]
Subject: [PATCH v3 0/2] W1 drivers for devices used in SGI systems

These patches add two W1 drivers. One is a driver for the W1 master in
SGI ASICs, which is used in various machine starting with SGI Origin systems.
The other is a W1 slave driver for Dallas/Maxim EPROM devices used
in the same type of SGI machines.

Changes in v3:
- dropped include of asm/sn/types.h which isn't needed at all

Changes in v2:
- added documentation about dev_id field in include/linux/w1.h
- use PTR_ERR_OR_ZERO

Thomas Bogendoerfer (2):
w1: add 1-wire master driver for IP block found in SGI ASICs
w1: add DS2501, DS2502, DS2505 EPROM device driver

drivers/w1/masters/Kconfig | 9 ++
drivers/w1/masters/Makefile | 1 +
drivers/w1/masters/sgi_w1.c | 130 ++++++++++++++++
drivers/w1/slaves/Kconfig | 6 +
drivers/w1/slaves/Makefile | 1 +
drivers/w1/slaves/w1_ds250x.c | 290 +++++++++++++++++++++++++++++++++++
include/linux/platform_data/sgi-w1.h | 13 ++
include/linux/w1.h | 5 +
8 files changed, 455 insertions(+)
create mode 100644 drivers/w1/masters/sgi_w1.c
create mode 100644 drivers/w1/slaves/w1_ds250x.c
create mode 100644 include/linux/platform_data/sgi-w1.h

--
2.13.7


2019-08-31 08:27:53

by Thomas Bogendoerfer

[permalink] [raw]
Subject: [PATCH v3 2/2] w1: add DS2501, DS2502, DS2505 EPROM device driver

Add a 1-Wire slave driver to support DS250x EPROM deivces. This
slave driver attaches the devices to the NVMEM subsystem for
an easy in-kernel usage.

Signed-off-by: Thomas Bogendoerfer <[email protected]>
---
drivers/w1/slaves/Kconfig | 6 +
drivers/w1/slaves/Makefile | 1 +
drivers/w1/slaves/w1_ds250x.c | 290 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 297 insertions(+)
create mode 100644 drivers/w1/slaves/w1_ds250x.c

diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig
index 37aaad26b373..ebed495b9e69 100644
--- a/drivers/w1/slaves/Kconfig
+++ b/drivers/w1/slaves/Kconfig
@@ -101,6 +101,12 @@ config W1_SLAVE_DS2438
Say Y here if you want to use a 1-wire
DS2438 Smart Battery Monitor device support

+config W1_SLAVE_DS250X
+ tristate "512b/1kb/16kb EPROM family support"
+ help
+ Say Y here if you want to use a 1-wire
+ 512b/1kb/16kb EPROM family device (DS250x).
+
config W1_SLAVE_DS2780
tristate "Dallas 2780 battery monitor chip"
help
diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile
index eab29f151413..8e9655eaa478 100644
--- a/drivers/w1/slaves/Makefile
+++ b/drivers/w1/slaves/Makefile
@@ -14,6 +14,7 @@ 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_DS250X) += w1_ds250x.o
obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o
obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o
obj-$(CONFIG_W1_SLAVE_DS28E04) += w1_ds28e04.o
diff --git a/drivers/w1/slaves/w1_ds250x.c b/drivers/w1/slaves/w1_ds250x.c
new file mode 100644
index 000000000000..e507117444d8
--- /dev/null
+++ b/drivers/w1/slaves/w1_ds250x.c
@@ -0,0 +1,290 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * w1_ds250x.c - w1 family 09/0b/89/91 (DS250x) driver
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/device.h>
+#include <linux/types.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/crc16.h>
+
+#include <linux/w1.h>
+#include <linux/nvmem-provider.h>
+
+#define W1_DS2501_UNW_FAMILY 0x91
+#define W1_DS2501_SIZE 64
+
+#define W1_DS2502_FAMILY 0x09
+#define W1_DS2502_UNW_FAMILY 0x89
+#define W1_DS2502_SIZE 128
+
+#define W1_DS2505_FAMILY 0x0b
+#define W1_DS2505_SIZE 2048
+
+#define W1_PAGE_SIZE 32
+
+#define W1_EXT_READ_MEMORY 0xA5
+#define W1_READ_DATA_CRC 0xC3
+
+#define OFF2PG(off) ((off) / W1_PAGE_SIZE)
+
+#define CRC16_INIT 0
+#define CRC16_VALID 0xb001
+
+struct w1_eprom_data {
+ size_t size;
+ int (*read)(struct w1_slave *sl, int pageno);
+ u8 eprom[W1_DS2505_SIZE];
+ DECLARE_BITMAP(page_present, W1_DS2505_SIZE / W1_PAGE_SIZE);
+ char nvmem_name[64];
+};
+
+static int w1_ds2502_read_page(struct w1_slave *sl, int pageno)
+{
+ struct w1_eprom_data *data = sl->family_data;
+ int pgoff = pageno * W1_PAGE_SIZE;
+ int ret = -EIO;
+ u8 buf[3];
+ u8 crc8;
+
+ if (test_bit(pageno, data->page_present))
+ return 0; /* page already present */
+
+ mutex_lock(&sl->master->bus_mutex);
+
+ if (w1_reset_select_slave(sl))
+ goto err;
+
+ buf[0] = W1_READ_DATA_CRC;
+ buf[1] = pgoff & 0xff;
+ buf[2] = pgoff >> 8;
+ w1_write_block(sl->master, buf, 3);
+
+ crc8 = w1_read_8(sl->master);
+ if (w1_calc_crc8(buf, 3) != crc8)
+ goto err;
+
+ w1_read_block(sl->master, &data->eprom[pgoff], W1_PAGE_SIZE);
+
+ crc8 = w1_read_8(sl->master);
+ if (w1_calc_crc8(&data->eprom[pgoff], W1_PAGE_SIZE) != crc8)
+ goto err;
+
+ set_bit(pageno, data->page_present); /* mark page present */
+ ret = 0;
+err:
+ mutex_unlock(&sl->master->bus_mutex);
+ return ret;
+}
+
+static int w1_ds2505_read_page(struct w1_slave *sl, int pageno)
+{
+ struct w1_eprom_data *data = sl->family_data;
+ int redir_retries = 16;
+ int pgoff, epoff;
+ int ret = -EIO;
+ u8 buf[6];
+ u8 redir;
+ u16 crc;
+
+ if (test_bit(pageno, data->page_present))
+ return 0; /* page already present */
+
+ epoff = pgoff = pageno * W1_PAGE_SIZE;
+ mutex_lock(&sl->master->bus_mutex);
+
+retry:
+ if (w1_reset_select_slave(sl))
+ goto err;
+
+ buf[0] = W1_EXT_READ_MEMORY;
+ buf[1] = pgoff & 0xff;
+ buf[2] = pgoff >> 8;
+ w1_write_block(sl->master, buf, 3);
+ w1_read_block(sl->master, buf + 3, 3); /* redir, crc16 */
+ redir = buf[3];
+ crc = crc16(CRC16_INIT, buf, 6);
+
+ if (crc != CRC16_VALID)
+ goto err;
+
+
+ if (redir != 0xff) {
+ redir_retries--;
+ if (redir_retries < 0)
+ goto err;
+
+ pgoff = (redir ^ 0xff) * W1_PAGE_SIZE;
+ goto retry;
+ }
+
+ w1_read_block(sl->master, &data->eprom[epoff], W1_PAGE_SIZE);
+ w1_read_block(sl->master, buf, 2); /* crc16 */
+ crc = crc16(CRC16_INIT, &data->eprom[epoff], W1_PAGE_SIZE);
+ crc = crc16(crc, buf, 2);
+
+ if (crc != CRC16_VALID)
+ goto err;
+
+ set_bit(pageno, data->page_present);
+ ret = 0;
+err:
+ mutex_unlock(&sl->master->bus_mutex);
+ return ret;
+}
+
+static int w1_nvmem_read(void *priv, unsigned int off, void *buf, size_t count)
+{
+ struct w1_slave *sl = priv;
+ struct w1_eprom_data *data = sl->family_data;
+ size_t eprom_size = data->size;
+ int ret;
+ int i;
+
+ if (off > eprom_size)
+ return -EINVAL;
+
+ if ((off + count) > eprom_size)
+ count = eprom_size - off;
+
+ i = OFF2PG(off);
+ do {
+ ret = data->read(sl, i++);
+ if (ret < 0)
+ return ret;
+ } while (i < OFF2PG(off + count));
+
+ memcpy(buf, &data->eprom[off], count);
+ return 0;
+}
+
+static int w1_eprom_add_slave(struct w1_slave *sl)
+{
+ struct w1_eprom_data *data;
+ struct nvmem_device *nvmem;
+ struct nvmem_config nvmem_cfg = {
+ .dev = &sl->dev,
+ .reg_read = w1_nvmem_read,
+ .type = NVMEM_TYPE_OTP,
+ .read_only = true,
+ .word_size = 1,
+ .priv = sl,
+ .id = -1
+ };
+
+ data = devm_kzalloc(&sl->dev, sizeof(struct w1_eprom_data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ sl->family_data = data;
+ switch (sl->family->fid) {
+ case W1_DS2501_UNW_FAMILY:
+ data->size = W1_DS2501_SIZE;
+ data->read = w1_ds2502_read_page;
+ break;
+ case W1_DS2502_FAMILY:
+ case W1_DS2502_UNW_FAMILY:
+ data->size = W1_DS2502_SIZE;
+ data->read = w1_ds2502_read_page;
+ break;
+ case W1_DS2505_FAMILY:
+ data->size = W1_DS2505_SIZE;
+ data->read = w1_ds2505_read_page;
+ break;
+ }
+
+ if (sl->master->bus_master->dev_id)
+ snprintf(data->nvmem_name, sizeof(data->nvmem_name),
+ "%s-%02x-%012llx",
+ sl->master->bus_master->dev_id, sl->reg_num.family,
+ (unsigned long long)sl->reg_num.id);
+ else
+ snprintf(data->nvmem_name, sizeof(data->nvmem_name),
+ "%02x-%012llx",
+ sl->reg_num.family,
+ (unsigned long long)sl->reg_num.id);
+
+ nvmem_cfg.name = data->nvmem_name;
+ nvmem_cfg.size = data->size;
+
+ nvmem = devm_nvmem_register(&sl->dev, &nvmem_cfg);
+ return PTR_ERR_OR_ZERO(nvmem);
+}
+
+static struct w1_family_ops w1_eprom_fops = {
+ .add_slave = w1_eprom_add_slave,
+};
+
+static struct w1_family w1_family_09 = {
+ .fid = W1_DS2502_FAMILY,
+ .fops = &w1_eprom_fops,
+};
+
+static struct w1_family w1_family_0b = {
+ .fid = W1_DS2505_FAMILY,
+ .fops = &w1_eprom_fops,
+};
+
+static struct w1_family w1_family_89 = {
+ .fid = W1_DS2502_UNW_FAMILY,
+ .fops = &w1_eprom_fops,
+};
+
+static struct w1_family w1_family_91 = {
+ .fid = W1_DS2501_UNW_FAMILY,
+ .fops = &w1_eprom_fops,
+};
+
+static int __init w1_ds250x_init(void)
+{
+ int err;
+
+ err = w1_register_family(&w1_family_09);
+ if (err)
+ return err;
+
+ err = w1_register_family(&w1_family_0b);
+ if (err)
+ goto err_0b;
+
+ err = w1_register_family(&w1_family_89);
+ if (err)
+ goto err_89;
+
+ err = w1_register_family(&w1_family_91);
+ if (err)
+ goto err_91;
+
+ return 0;
+
+err_91:
+ w1_unregister_family(&w1_family_89);
+err_89:
+ w1_unregister_family(&w1_family_0b);
+err_0b:
+ w1_unregister_family(&w1_family_09);
+ return err;
+}
+
+static void __exit w1_ds250x_exit(void)
+{
+ w1_unregister_family(&w1_family_09);
+ w1_unregister_family(&w1_family_0b);
+ w1_unregister_family(&w1_family_89);
+ w1_unregister_family(&w1_family_91);
+}
+
+module_init(w1_ds250x_init);
+module_exit(w1_ds250x_exit);
+
+MODULE_AUTHOR("Thomas Bogendoerfer <[email protected]>");
+MODULE_DESCRIPTION("w1 family driver for DS250x Add Only Memory");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("w1-family-" __stringify(W1_DS2502_FAMILY));
+MODULE_ALIAS("w1-family-" __stringify(W1_DS2505_FAMILY));
+MODULE_ALIAS("w1-family-" __stringify(W1_DS2501_UNW_FAMILY));
+MODULE_ALIAS("w1-family-" __stringify(W1_DS2502_UNW_FAMILY));
--
2.13.7

2019-08-31 08:28:17

by Thomas Bogendoerfer

[permalink] [raw]
Subject: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

Starting with SGI Origin machines nearly every new SGI ASIC contains
an 1-Wire master. They are used for attaching One-Wire prom devices,
which contain information about part numbers, revision numbers,
serial number etc. and MAC addresses for ethernet interfaces.
This patch adds a master driver to support this IP block.
It also adds an extra field dev_id to struct w1_bus_master, which
could be in used in slave drivers for creating unique device names.

Signed-off-by: Thomas Bogendoerfer <[email protected]>
---
drivers/w1/masters/Kconfig | 9 +++
drivers/w1/masters/Makefile | 1 +
drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
include/linux/platform_data/sgi-w1.h | 13 ++++
include/linux/w1.h | 5 ++
5 files changed, 158 insertions(+)
create mode 100644 drivers/w1/masters/sgi_w1.c
create mode 100644 include/linux/platform_data/sgi-w1.h

diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
index 7ae260577901..24b9a8e05f64 100644
--- a/drivers/w1/masters/Kconfig
+++ b/drivers/w1/masters/Kconfig
@@ -65,5 +65,14 @@ config HDQ_MASTER_OMAP
Say Y here if you want support for the 1-wire or HDQ Interface
on an OMAP processor.

+config W1_MASTER_SGI
+ tristate "SGI ASIC driver"
+ help
+ Say Y here if you want support for your 1-wire devices using
+ SGI ASIC 1-Wire interface
+
+ This support is also available as a module. If so, the module
+ will be called sgi_w1.
+
endmenu

diff --git a/drivers/w1/masters/Makefile b/drivers/w1/masters/Makefile
index 18954cae4256..dae629b7ab49 100644
--- a/drivers/w1/masters/Makefile
+++ b/drivers/w1/masters/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_W1_MASTER_MXC) += mxc_w1.o
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.o
obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
+obj-$(CONFIG_W1_MASTER_SGI) += sgi_w1.o
diff --git a/drivers/w1/masters/sgi_w1.c b/drivers/w1/masters/sgi_w1.c
new file mode 100644
index 000000000000..1b2d96b945be
--- /dev/null
+++ b/drivers/w1/masters/sgi_w1.c
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * sgi_w1.c - w1 master driver for one wire support in SGI ASICs
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/sgi-w1.h>
+
+#include <linux/w1.h>
+
+#define MCR_RD_DATA BIT(0)
+#define MCR_DONE BIT(1)
+
+#define MCR_PACK(pulse, sample) (((pulse) << 10) | ((sample) << 2))
+
+struct sgi_w1_device {
+ u32 __iomem *mcr;
+ struct w1_bus_master bus_master;
+ char dev_id[64];
+};
+
+static u8 sgi_w1_wait(u32 __iomem *mcr)
+{
+ u32 mcr_val;
+
+ do {
+ mcr_val = readl(mcr);
+ } while (!(mcr_val & MCR_DONE));
+
+ return (mcr_val & MCR_RD_DATA) ? 1 : 0;
+}
+
+/*
+ * this is the low level routine to
+ * reset the device on the One Wire interface
+ * on the hardware
+ */
+static u8 sgi_w1_reset_bus(void *data)
+{
+ struct sgi_w1_device *dev = data;
+ u8 ret;
+
+ writel(MCR_PACK(520, 65), dev->mcr);
+ ret = sgi_w1_wait(dev->mcr);
+ udelay(500); /* recovery time */
+ return ret;
+}
+
+/*
+ * this is the low level routine to read/write a bit on the One Wire
+ * interface on the hardware. It does write 0 if parameter bit is set
+ * to 0, otherwise a write 1/read.
+ */
+static u8 sgi_w1_touch_bit(void *data, u8 bit)
+{
+ struct sgi_w1_device *dev = data;
+ u8 ret;
+
+ if (bit)
+ writel(MCR_PACK(6, 13), dev->mcr);
+ else
+ writel(MCR_PACK(80, 30), dev->mcr);
+
+ ret = sgi_w1_wait(dev->mcr);
+ if (bit)
+ udelay(100); /* recovery */
+ return ret;
+}
+
+static int sgi_w1_probe(struct platform_device *pdev)
+{
+ struct sgi_w1_device *sdev;
+ struct sgi_w1_platform_data *pdata;
+ struct resource *res;
+
+ sdev = devm_kzalloc(&pdev->dev, sizeof(struct sgi_w1_device),
+ GFP_KERNEL);
+ if (!sdev)
+ return -ENOMEM;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ sdev->mcr = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(sdev->mcr))
+ return PTR_ERR(sdev->mcr);
+
+ sdev->bus_master.data = sdev;
+ sdev->bus_master.reset_bus = sgi_w1_reset_bus;
+ sdev->bus_master.touch_bit = sgi_w1_touch_bit;
+
+ pdata = dev_get_platdata(&pdev->dev);
+ if (pdata) {
+ strlcpy(sdev->dev_id, pdata->dev_id, sizeof(sdev->dev_id));
+ sdev->bus_master.dev_id = sdev->dev_id;
+ }
+
+ platform_set_drvdata(pdev, sdev);
+
+ return w1_add_master_device(&sdev->bus_master);
+}
+
+/*
+ * disassociate the w1 device from the driver
+ */
+static int sgi_w1_remove(struct platform_device *pdev)
+{
+ struct sgi_w1_device *sdev = platform_get_drvdata(pdev);
+
+ w1_remove_master_device(&sdev->bus_master);
+
+ return 0;
+}
+
+static struct platform_driver sgi_w1_driver = {
+ .driver = {
+ .name = "sgi_w1",
+ },
+ .probe = sgi_w1_probe,
+ .remove = sgi_w1_remove,
+};
+module_platform_driver(sgi_w1_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Thomas Bogendoerfer");
+MODULE_DESCRIPTION("Driver for One-Wire IP in SGI ASICs");
diff --git a/include/linux/platform_data/sgi-w1.h b/include/linux/platform_data/sgi-w1.h
new file mode 100644
index 000000000000..e28c8a90ff84
--- /dev/null
+++ b/include/linux/platform_data/sgi-w1.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * SGI One-Wire (W1) IP
+ */
+
+#ifndef PLATFORM_DATA_SGI_W1_H
+#define PLATFORM_DATA_SGI_W1_H
+
+struct sgi_w1_platform_data {
+ char dev_id[64];
+};
+
+#endif /* PLATFORM_DATA_SGI_W1_H */
diff --git a/include/linux/w1.h b/include/linux/w1.h
index e0b5156f78fd..7da0c7588e04 100644
--- a/include/linux/w1.h
+++ b/include/linux/w1.h
@@ -118,6 +118,9 @@ typedef void (*w1_slave_found_callback)(struct w1_master *, u64);
* w1_master* is passed to the slave found callback.
* u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
*
+ * @dev_id: Optional device id string, which w1 slaves could use for
+ * creating names, which then give a connection to the w1 master
+ *
* Note: read_bit and write_bit are very low level functions and should only
* be used with hardware that doesn't really support 1-wire operations,
* like a parallel/serial port.
@@ -150,6 +153,8 @@ struct w1_bus_master {

void (*search)(void *, struct w1_master *,
u8, w1_slave_found_callback);
+
+ char *dev_id;
};

/**
--
2.13.7

2019-09-01 12:51:16

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] W1 drivers for devices used in SGI systems

On Sat, Aug 31, 2019 at 10:26:20AM +0200, Thomas Bogendoerfer wrote:
> These patches add two W1 drivers. One is a driver for the W1 master in
> SGI ASICs, which is used in various machine starting with SGI Origin systems.
> The other is a W1 slave driver for Dallas/Maxim EPROM devices used
> in the same type of SGI machines.
> [..]

Greg,

I've posted this the first time end of may, asked maintainer about
status, reposted it and so on. So far no feedback from the W1
subsystem maintainer. I have other patchsets needing this changes,
so I'm asking you, if you could take these patches for 5.4 ?

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

2019-09-04 11:49:52

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

On Sat, Aug 31, 2019 at 10:26:21AM +0200, Thomas Bogendoerfer wrote:
> Starting with SGI Origin machines nearly every new SGI ASIC contains
> an 1-Wire master. They are used for attaching One-Wire prom devices,
> which contain information about part numbers, revision numbers,
> serial number etc. and MAC addresses for ethernet interfaces.
> This patch adds a master driver to support this IP block.
> It also adds an extra field dev_id to struct w1_bus_master, which
> could be in used in slave drivers for creating unique device names.
>
> Signed-off-by: Thomas Bogendoerfer <[email protected]>
> ---
> drivers/w1/masters/Kconfig | 9 +++
> drivers/w1/masters/Makefile | 1 +
> drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
> include/linux/platform_data/sgi-w1.h | 13 ++++

Why platform data? I thought that was the "old way", and the "proper
way" now is to use device tree?

thanks,

greg k-h

2019-09-04 12:04:21

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

On Wed, 4 Sep 2019 13:48:37 +0200
Greg Kroah-Hartman <[email protected]> wrote:

> On Sat, Aug 31, 2019 at 10:26:21AM +0200, Thomas Bogendoerfer wrote:
> > Starting with SGI Origin machines nearly every new SGI ASIC contains
> > an 1-Wire master. They are used for attaching One-Wire prom devices,
> > which contain information about part numbers, revision numbers,
> > serial number etc. and MAC addresses for ethernet interfaces.
> > This patch adds a master driver to support this IP block.
> > It also adds an extra field dev_id to struct w1_bus_master, which
> > could be in used in slave drivers for creating unique device names.
> >
> > Signed-off-by: Thomas Bogendoerfer <[email protected]>
> > ---
> > drivers/w1/masters/Kconfig | 9 +++
> > drivers/w1/masters/Makefile | 1 +
> > drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
> > include/linux/platform_data/sgi-w1.h | 13 ++++
>
> Why platform data? I thought that was the "old way", and the "proper
> way" now is to use device tree?

this machine is old and doesn't have device tree at all.

Thomas.

--
SUSE Software Solutions Germany GmbH
HRB 247165 (AG M?nchen)
Gesch?ftsf?hrer: Felix Imend?rffer

2019-09-04 12:07:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

On Wed, Sep 04, 2019 at 02:01:34PM +0200, Thomas Bogendoerfer wrote:
> On Wed, 4 Sep 2019 13:48:37 +0200
> Greg Kroah-Hartman <[email protected]> wrote:
>
> > On Sat, Aug 31, 2019 at 10:26:21AM +0200, Thomas Bogendoerfer wrote:
> > > Starting with SGI Origin machines nearly every new SGI ASIC contains
> > > an 1-Wire master. They are used for attaching One-Wire prom devices,
> > > which contain information about part numbers, revision numbers,
> > > serial number etc. and MAC addresses for ethernet interfaces.
> > > This patch adds a master driver to support this IP block.
> > > It also adds an extra field dev_id to struct w1_bus_master, which
> > > could be in used in slave drivers for creating unique device names.
> > >
> > > Signed-off-by: Thomas Bogendoerfer <[email protected]>
> > > ---
> > > drivers/w1/masters/Kconfig | 9 +++
> > > drivers/w1/masters/Makefile | 1 +
> > > drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
> > > include/linux/platform_data/sgi-w1.h | 13 ++++
> >
> > Why platform data? I thought that was the "old way", and the "proper
> > way" now is to use device tree?
>
> this machine is old and doesn't have device tree at all.

Your text says "every new SGI ASIC". So new devices are being made for
old systems?

confused,

greg k-h

2019-09-04 12:17:42

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

On Wed, 4 Sep 2019 14:06:46 +0200
Greg Kroah-Hartman <[email protected]> wrote:

> On Wed, Sep 04, 2019 at 02:01:34PM +0200, Thomas Bogendoerfer wrote:
> > On Wed, 4 Sep 2019 13:48:37 +0200
> > Greg Kroah-Hartman <[email protected]> wrote:
> >
> > > On Sat, Aug 31, 2019 at 10:26:21AM +0200, Thomas Bogendoerfer wrote:
> > > > Starting with SGI Origin machines nearly every new SGI ASIC contains
> > > > an 1-Wire master. They are used for attaching One-Wire prom devices,
> > > > which contain information about part numbers, revision numbers,
> > > > serial number etc. and MAC addresses for ethernet interfaces.
> > > > This patch adds a master driver to support this IP block.
> > > > It also adds an extra field dev_id to struct w1_bus_master, which
> > > > could be in used in slave drivers for creating unique device names.
> > > >
> > > > Signed-off-by: Thomas Bogendoerfer <[email protected]>
> > > > ---
> > > > drivers/w1/masters/Kconfig | 9 +++
> > > > drivers/w1/masters/Makefile | 1 +
> > > > drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
> > > > include/linux/platform_data/sgi-w1.h | 13 ++++
> > >
> > > Why platform data? I thought that was the "old way", and the "proper
> > > way" now is to use device tree?
> >
> > this machine is old and doesn't have device tree at all.
>
> Your text says "every new SGI ASIC". So new devices are being made for
> old systems?
>
> confused,

ok, now I see where the confusion comes from. New in the meaning of latest
produced SGI MIPS system.

Is it better, if I rephrase this to latest line of MIPS system ASICs ?

Thomas.

--
SUSE Software Solutions Germany GmbH
HRB 247165 (AG M?nchen)
Gesch?ftsf?hrer: Felix Imend?rffer

2019-09-04 12:36:38

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

On Wed, Sep 04, 2019 at 02:14:34PM +0200, Thomas Bogendoerfer wrote:
> On Wed, 4 Sep 2019 14:06:46 +0200
> Greg Kroah-Hartman <[email protected]> wrote:
>
> > On Wed, Sep 04, 2019 at 02:01:34PM +0200, Thomas Bogendoerfer wrote:
> > > On Wed, 4 Sep 2019 13:48:37 +0200
> > > Greg Kroah-Hartman <[email protected]> wrote:
> > >
> > > > On Sat, Aug 31, 2019 at 10:26:21AM +0200, Thomas Bogendoerfer wrote:
> > > > > Starting with SGI Origin machines nearly every new SGI ASIC contains
> > > > > an 1-Wire master. They are used for attaching One-Wire prom devices,
> > > > > which contain information about part numbers, revision numbers,
> > > > > serial number etc. and MAC addresses for ethernet interfaces.
> > > > > This patch adds a master driver to support this IP block.
> > > > > It also adds an extra field dev_id to struct w1_bus_master, which
> > > > > could be in used in slave drivers for creating unique device names.
> > > > >
> > > > > Signed-off-by: Thomas Bogendoerfer <[email protected]>
> > > > > ---
> > > > > drivers/w1/masters/Kconfig | 9 +++
> > > > > drivers/w1/masters/Makefile | 1 +
> > > > > drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
> > > > > include/linux/platform_data/sgi-w1.h | 13 ++++
> > > >
> > > > Why platform data? I thought that was the "old way", and the "proper
> > > > way" now is to use device tree?
> > >
> > > this machine is old and doesn't have device tree at all.
> >
> > Your text says "every new SGI ASIC". So new devices are being made for
> > old systems?
> >
> > confused,
>
> ok, now I see where the confusion comes from. New in the meaning of latest
> produced SGI MIPS system.
>
> Is it better, if I rephrase this to latest line of MIPS system ASICs ?

Nah, I'll take this now, it's ok, thanks for the explanation.

greg k-h

2019-09-04 12:50:28

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] w1: add 1-wire master driver for IP block found in SGI ASICs

On Wed, 4 Sep 2019 14:33:51 +0200
Greg Kroah-Hartman <[email protected]> wrote:

> On Wed, Sep 04, 2019 at 02:14:34PM +0200, Thomas Bogendoerfer wrote:
> > On Wed, 4 Sep 2019 14:06:46 +0200
> > Greg Kroah-Hartman <[email protected]> wrote:
> >
> > > On Wed, Sep 04, 2019 at 02:01:34PM +0200, Thomas Bogendoerfer wrote:
> > > > On Wed, 4 Sep 2019 13:48:37 +0200
> > > > Greg Kroah-Hartman <[email protected]> wrote:
> > > >
> > > > > On Sat, Aug 31, 2019 at 10:26:21AM +0200, Thomas Bogendoerfer wrote:
> > > > > > Starting with SGI Origin machines nearly every new SGI ASIC contains
> > > > > > an 1-Wire master. They are used for attaching One-Wire prom devices,
> > > > > > which contain information about part numbers, revision numbers,
> > > > > > serial number etc. and MAC addresses for ethernet interfaces.
> > > > > > This patch adds a master driver to support this IP block.
> > > > > > It also adds an extra field dev_id to struct w1_bus_master, which
> > > > > > could be in used in slave drivers for creating unique device names.
> > > > > >
> > > > > > Signed-off-by: Thomas Bogendoerfer <[email protected]>
> > > > > > ---
> > > > > > drivers/w1/masters/Kconfig | 9 +++
> > > > > > drivers/w1/masters/Makefile | 1 +
> > > > > > drivers/w1/masters/sgi_w1.c | 130 +++++++++++++++++++++++++++++++++++
> > > > > > include/linux/platform_data/sgi-w1.h | 13 ++++
> > > > >
> > > > > Why platform data? I thought that was the "old way", and the "proper
> > > > > way" now is to use device tree?
> > > >
> > > > this machine is old and doesn't have device tree at all.
> > >
> > > Your text says "every new SGI ASIC". So new devices are being made for
> > > old systems?
> > >
> > > confused,
> >
> > ok, now I see where the confusion comes from. New in the meaning of latest
> > produced SGI MIPS system.
> >
> > Is it better, if I rephrase this to latest line of MIPS system ASICs ?
>
> Nah, I'll take this now, it's ok, thanks for the explanation.

thank you,
Thomas.

--
SUSE Software Solutions Germany GmbH
HRB 247165 (AG M?nchen)
Gesch?ftsf?hrer: Felix Imend?rffer