Linux Serial subsystem development
 help / color / mirror / Atom feed
* Re: [RFC 1/3] serdev: Add ACPI support
From: Marcel Holtmann @ 2017-09-07 17:21 UTC (permalink / raw)
  To: Frédéric Danis
  Cc: robh, sre, loic.poulain, linux-bluetooth, linux-serial,
	linux-acpi
In-Reply-To: <1504786214-1866-2-git-send-email-frederic.danis.oss@gmail.com>

Hi Fred,

> Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com>
> ---
> drivers/tty/serdev/core.c | 99 ++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 94 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index ae1aaa0..923dd4ad 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -14,6 +14,7 @@
>  * GNU General Public License for more details.
>  */
> 
> +#include <linux/acpi.h>
> #include <linux/errno.h>
> #include <linux/idr.h>
> #include <linux/kernel.h>
> @@ -49,13 +50,22 @@ static const struct device_type serdev_ctrl_type = {
> 
> static int serdev_device_match(struct device *dev, struct device_driver *drv)
> {
> -	/* TODO: ACPI and platform matching */
> +	/* TODO: platform matching */
> +	if (acpi_driver_match_device(dev, drv))
> +		return 1;
> +
> 	return of_driver_match_device(dev, drv);
> }
> 
> static int serdev_uevent(struct device *dev, struct kobj_uevent_env *env)
> {
> -	/* TODO: ACPI and platform modalias */
> +	int rc;
> +
> +	/* TODO: platform modalias */
> +	rc = acpi_device_uevent_modalias(dev, env);
> +	if (rc != -ENODEV)
> +		return rc;
> +
> 	return of_device_uevent_modalias(dev, env);
> }
> 
> @@ -260,6 +270,12 @@ static int serdev_drv_remove(struct device *dev)
> static ssize_t modalias_show(struct device *dev,
> 			     struct device_attribute *attr, char *buf)
> {
> +	int len;
> +
> +	len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
> +	if (len != -ENODEV)
> +		return len;
> +
> 	return of_device_modalias(dev, buf, PAGE_SIZE);
> }
> DEVICE_ATTR_RO(modalias);
> @@ -385,6 +401,74 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
> 	return 0;
> }
> 
> +#ifdef CONFIG_ACPI
> +static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
> +					    struct acpi_device *adev)
> +{
> +	struct serdev_device *serdev = NULL;
> +	int err;
> +
> +	if (acpi_bus_get_status(adev) || !adev->status.present ||
> +	    acpi_device_enumerated(adev))
> +		return AE_OK;
> +
> +	serdev = serdev_device_alloc(ctrl);
> +	if (!serdev) {
> +		dev_err(&ctrl->dev, "failed to allocate Serial device for %s\n",
> +			dev_name(&adev->dev));
> +		return AE_NO_MEMORY;
> +	}
> +
> +	ACPI_COMPANION_SET(&serdev->dev, adev);
> +	acpi_device_set_enumerated(adev);
> +
> +	err = serdev_device_add(serdev);
> +	if (err) {
> +		dev_err(&serdev->dev,
> +			"failure adding ACPI device. status %d\n", err);
> +		serdev_device_put(serdev);
> +	}
> +
> +	return AE_OK;
> +}
> +
> +static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
> +				       void *data, void **return_value)
> +{
> +	struct serdev_controller *ctrl = data;
> +	struct acpi_device *adev;
> +
> +	if (acpi_bus_get_device(handle, &adev))
> +		return AE_OK;
> +
> +	return acpi_serdev_register_device(ctrl, adev);
> +}
> +
> +static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
> +{
> +	acpi_status status;
> +	acpi_handle handle;
> +
> +	handle = ACPI_HANDLE(ctrl->dev.parent);
> +	if (!handle)
> +		return -ENODEV;
> +
> +	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
> +				     acpi_serdev_add_device, NULL, ctrl, NULL);
> +	if (ACPI_FAILURE(status)) {
> +		dev_warn(&ctrl->dev, "failed to enumerate Serial slaves\n");
> +		return -ENODEV;
> +	}
> +
> +	return 0;
> +}

how are we ensuring that we only take UART devices into account here?

> +#else
> +static inline int acpi_serdev_register_devices(struct serdev_controller *ctlr)
> +{
> +	return -ENODEV;
> +}
> +#endif /* CONFIG_ACPI */
> +
> /**
>  * serdev_controller_add() - Add an serdev controller
>  * @ctrl:	controller to be registered.
> @@ -394,7 +478,7 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
>  */
> int serdev_controller_add(struct serdev_controller *ctrl)
> {
> -	int ret;
> +	int ret_of, ret_acpi, ret;
> 
> 	/* Can't register until after driver model init */
> 	if (WARN_ON(!is_registered))
> @@ -404,9 +488,14 @@ int serdev_controller_add(struct serdev_controller *ctrl)
> 	if (ret)
> 		return ret;
> 
> -	ret = of_serdev_register_devices(ctrl);
> -	if (ret)
> +	ret_of = of_serdev_register_devices(ctrl);
> +	ret_acpi = acpi_serdev_register_devices(ctrl);
> +	if (ret_of && ret_acpi) {
> +		dev_dbg(&ctrl->dev, "serdev%d no devices registered: of:%d acpi:%d\n",
> +			ctrl->nr, ret_of, ret_acpi);
> +		ret = -ENODEV;
> 		goto out_dev_del;
> +	}
> 
> 	dev_dbg(&ctrl->dev, "serdev%d registered: dev:%p\n",
> 		ctrl->nr, &ctrl->dev);

Shouldn’t we just consider to always register the controller? Even if there are no devices attached to it.

Regards

Marcel


^ permalink raw reply

* Re: [RFC 1/3] serdev: Add ACPI support
From: Marcel Holtmann @ 2017-09-07 17:15 UTC (permalink / raw)
  To: Greg KH
  Cc: Frédéric Danis, Rob Herring, Sebastian Reichel,
	Loic Poulain, Bluez mailing list, linux-serial, linux-acpi
In-Reply-To: <20170907123030.GA20922@kroah.com>

Hi Greg,

>> Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com>
>> ---
>> drivers/tty/serdev/core.c | 99 ++++++++++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 94 insertions(+), 5 deletions(-)
> 
> I can not take patches without any changelog text, and you should feel
> bad about trying to get me to do so :)

I wouldn’t expect you to take RFC patches :)

Regards

Marcel


^ permalink raw reply

* Re: [RFC 1/3] serdev: Add ACPI support
From: Greg KH @ 2017-09-07 12:30 UTC (permalink / raw)
  To: Frédéric Danis
  Cc: robh, marcel, sre, loic.poulain, linux-bluetooth, linux-serial,
	linux-acpi
In-Reply-To: <1504786214-1866-2-git-send-email-frederic.danis.oss@gmail.com>

On Thu, Sep 07, 2017 at 02:10:12PM +0200, Frédéric Danis wrote:
> Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com>
> ---
>  drivers/tty/serdev/core.c | 99 ++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 94 insertions(+), 5 deletions(-)

I can not take patches without any changelog text, and you should feel
bad about trying to get me to do so :)

thanks,

greg k-h

^ permalink raw reply

* [RFC 3/3] Bluetooth: hci_bcm: Add ACPI serdev support for BCM2E39
From: Frédéric Danis @ 2017-09-07 12:10 UTC (permalink / raw)
  To: robh-DgEjT+Ai2ygdnm+yROfE0A, marcel-kz+m5ild9QBg9hUCZPvPmw,
	sre-DgEjT+Ai2ygdnm+yROfE0A, loic.poulain-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <1504786214-1866-1-git-send-email-frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Frédéric Danis <frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/bluetooth/hci_bcm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 2e358cc..b1cf07e 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -922,7 +922,6 @@ static const struct hci_uart_proto bcm_proto = {
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id bcm_acpi_match[] = {
 	{ "BCM2E1A", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
-	{ "BCM2E39", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
 	{ "BCM2E3A", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
 	{ "BCM2E3D", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
 	{ "BCM2E3F", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
@@ -942,6 +941,14 @@ static const struct acpi_device_id bcm_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, bcm_acpi_match);
 #endif
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id bcm_serdev_acpi_match[] = {
+	{ "BCM2E39", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, bcm_serdev_acpi_match);
+#endif
+
 /* Platform suspend and resume callbacks */
 static const struct dev_pm_ops bcm_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(bcm_suspend, bcm_resume)
@@ -999,6 +1006,7 @@ static struct serdev_device_driver bcm_serdev_driver = {
 	.driver = {
 		.name = "hci_uart_bcm",
 		.of_match_table = of_match_ptr(bcm_bluetooth_of_match),
+		.acpi_match_table = ACPI_PTR(bcm_serdev_acpi_match),
 	},
 };
 
-- 
2.7.4

^ permalink raw reply related

* [RFC 2/3] ACPI / scan: Fix enumeration for special UART devices
From: Frédéric Danis @ 2017-09-07 12:10 UTC (permalink / raw)
  To: robh-DgEjT+Ai2ygdnm+yROfE0A, marcel-kz+m5ild9QBg9hUCZPvPmw,
	sre-DgEjT+Ai2ygdnm+yROfE0A, loic.poulain-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <1504786214-1866-1-git-send-email-frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

UART devices is expected to be enumerated by SerDev subsystem.
Rename spi_i2c_slave to serial_slave as this is no more specific to spi or
i2c buses.

Signed-off-by: Frédéric Danis <frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/acpi/scan.c     | 29 ++++++++++++-----------------
 include/acpi/acpi_bus.h |  2 +-
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 70fd550..04c5ecc 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1429,35 +1429,30 @@ static void acpi_init_coherency(struct acpi_device *adev)
 	adev->flags.coherent_dma = cca;
 }
 
-static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
+static int acpi_check_serial_slave(struct acpi_resource *ares, void *data)
 {
-	bool *is_spi_i2c_slave_p = data;
+	bool *is_serial_slave_p = data;
 
 	if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
 		return 1;
 
-	/*
-	 * devices that are connected to UART still need to be enumerated to
-	 * platform bus
-	 */
-	if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
-		*is_spi_i2c_slave_p = true;
+	*is_serial_slave_p = true;
 
 	 /* no need to do more checking */
 	return -1;
 }
 
-static bool acpi_is_spi_i2c_slave(struct acpi_device *device)
+static bool acpi_is_serial_slave(struct acpi_device *device)
 {
 	struct list_head resource_list;
-	bool is_spi_i2c_slave = false;
+	bool is_serial_slave = false;
 
 	INIT_LIST_HEAD(&resource_list);
-	acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
-			       &is_spi_i2c_slave);
+	acpi_dev_get_resources(device, &resource_list, acpi_check_serial_slave,
+			       &is_serial_slave);
 	acpi_dev_free_resource_list(&resource_list);
 
-	return is_spi_i2c_slave;
+	return is_serial_slave;
 }
 
 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
@@ -1476,7 +1471,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
 	acpi_bus_get_flags(device);
 	device->flags.match_driver = false;
 	device->flags.initialized = true;
-	device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device);
+	device->flags.serial_slave = acpi_is_serial_slave(device);
 	acpi_device_clear_enumerated(device);
 	device_initialize(&device->dev);
 	dev_set_uevent_suppress(&device->dev, true);
@@ -1763,7 +1758,7 @@ static void acpi_default_enumeration(struct acpi_device *device)
 	 * Do not enumerate SPI/I2C slaves as they will be enumerated by their
 	 * respective parents.
 	 */
-	if (!device->flags.spi_i2c_slave) {
+	if (!device->flags.serial_slave) {
 		acpi_create_platform_device(device, NULL);
 		acpi_device_set_enumerated(device);
 	} else {
@@ -1860,7 +1855,7 @@ static void acpi_bus_attach(struct acpi_device *device)
 		return;
 
 	device->flags.match_driver = true;
-	if (ret > 0 && !device->flags.spi_i2c_slave) {
+	if (ret > 0 && !device->flags.serial_slave) {
 		acpi_device_set_enumerated(device);
 		goto ok;
 	}
@@ -1869,7 +1864,7 @@ static void acpi_bus_attach(struct acpi_device *device)
 	if (ret < 0)
 		return;
 
-	if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave)
+	if (!device->pnp.type.platform_id && !device->flags.serial_slave)
 		acpi_device_set_enumerated(device);
 	else
 		acpi_default_enumeration(device);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 68bc6be..49a82f8 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -211,7 +211,7 @@ struct acpi_device_flags {
 	u32 of_compatible_ok:1;
 	u32 coherent_dma:1;
 	u32 cca_seen:1;
-	u32 spi_i2c_slave:1;
+	u32 serial_slave:1;
 	u32 reserved:19;
 };
 
-- 
2.7.4

^ permalink raw reply related

* [RFC 1/3] serdev: Add ACPI support
From: Frédéric Danis @ 2017-09-07 12:10 UTC (permalink / raw)
  To: robh-DgEjT+Ai2ygdnm+yROfE0A, marcel-kz+m5ild9QBg9hUCZPvPmw,
	sre-DgEjT+Ai2ygdnm+yROfE0A, loic.poulain-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <1504786214-1866-1-git-send-email-frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Frédéric Danis <frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/tty/serdev/core.c | 99 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 94 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index ae1aaa0..923dd4ad 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -14,6 +14,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/acpi.h>
 #include <linux/errno.h>
 #include <linux/idr.h>
 #include <linux/kernel.h>
@@ -49,13 +50,22 @@ static const struct device_type serdev_ctrl_type = {
 
 static int serdev_device_match(struct device *dev, struct device_driver *drv)
 {
-	/* TODO: ACPI and platform matching */
+	/* TODO: platform matching */
+	if (acpi_driver_match_device(dev, drv))
+		return 1;
+
 	return of_driver_match_device(dev, drv);
 }
 
 static int serdev_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
-	/* TODO: ACPI and platform modalias */
+	int rc;
+
+	/* TODO: platform modalias */
+	rc = acpi_device_uevent_modalias(dev, env);
+	if (rc != -ENODEV)
+		return rc;
+
 	return of_device_uevent_modalias(dev, env);
 }
 
@@ -260,6 +270,12 @@ static int serdev_drv_remove(struct device *dev)
 static ssize_t modalias_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
 {
+	int len;
+
+	len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
+	if (len != -ENODEV)
+		return len;
+
 	return of_device_modalias(dev, buf, PAGE_SIZE);
 }
 DEVICE_ATTR_RO(modalias);
@@ -385,6 +401,74 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
 	return 0;
 }
 
+#ifdef CONFIG_ACPI
+static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
+					    struct acpi_device *adev)
+{
+	struct serdev_device *serdev = NULL;
+	int err;
+
+	if (acpi_bus_get_status(adev) || !adev->status.present ||
+	    acpi_device_enumerated(adev))
+		return AE_OK;
+
+	serdev = serdev_device_alloc(ctrl);
+	if (!serdev) {
+		dev_err(&ctrl->dev, "failed to allocate Serial device for %s\n",
+			dev_name(&adev->dev));
+		return AE_NO_MEMORY;
+	}
+
+	ACPI_COMPANION_SET(&serdev->dev, adev);
+	acpi_device_set_enumerated(adev);
+
+	err = serdev_device_add(serdev);
+	if (err) {
+		dev_err(&serdev->dev,
+			"failure adding ACPI device. status %d\n", err);
+		serdev_device_put(serdev);
+	}
+
+	return AE_OK;
+}
+
+static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
+				       void *data, void **return_value)
+{
+	struct serdev_controller *ctrl = data;
+	struct acpi_device *adev;
+
+	if (acpi_bus_get_device(handle, &adev))
+		return AE_OK;
+
+	return acpi_serdev_register_device(ctrl, adev);
+}
+
+static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
+{
+	acpi_status status;
+	acpi_handle handle;
+
+	handle = ACPI_HANDLE(ctrl->dev.parent);
+	if (!handle)
+		return -ENODEV;
+
+	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
+				     acpi_serdev_add_device, NULL, ctrl, NULL);
+	if (ACPI_FAILURE(status)) {
+		dev_warn(&ctrl->dev, "failed to enumerate Serial slaves\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+#else
+static inline int acpi_serdev_register_devices(struct serdev_controller *ctlr)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_ACPI */
+
 /**
  * serdev_controller_add() - Add an serdev controller
  * @ctrl:	controller to be registered.
@@ -394,7 +478,7 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
  */
 int serdev_controller_add(struct serdev_controller *ctrl)
 {
-	int ret;
+	int ret_of, ret_acpi, ret;
 
 	/* Can't register until after driver model init */
 	if (WARN_ON(!is_registered))
@@ -404,9 +488,14 @@ int serdev_controller_add(struct serdev_controller *ctrl)
 	if (ret)
 		return ret;
 
-	ret = of_serdev_register_devices(ctrl);
-	if (ret)
+	ret_of = of_serdev_register_devices(ctrl);
+	ret_acpi = acpi_serdev_register_devices(ctrl);
+	if (ret_of && ret_acpi) {
+		dev_dbg(&ctrl->dev, "serdev%d no devices registered: of:%d acpi:%d\n",
+			ctrl->nr, ret_of, ret_acpi);
+		ret = -ENODEV;
 		goto out_dev_del;
+	}
 
 	dev_dbg(&ctrl->dev, "serdev%d registered: dev:%p\n",
 		ctrl->nr, &ctrl->dev);
-- 
2.7.4

^ permalink raw reply related

* [RFC 0/3] ACPI serdev support
From: Frédéric Danis @ 2017-09-07 12:10 UTC (permalink / raw)
  To: robh-DgEjT+Ai2ygdnm+yROfE0A, marcel-kz+m5ild9QBg9hUCZPvPmw,
	sre-DgEjT+Ai2ygdnm+yROfE0A, loic.poulain-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w

Add ACPI support for serial attached devices.

Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave to *serial_slave to reflect this.

As this is only tested on T100TA with Broadcom BCM2E39, I moved this to a
specific acpi_match_table.

Frédéric Danis (3):
  serdev: Add ACPI support
  ACPI / scan: Fix enumeration for special UART devices
  Bluetooth: hci_bcm: Add ACPI serdev support for BCM2E39

 drivers/acpi/scan.c         | 29 ++++++-------
 drivers/bluetooth/hci_bcm.c | 10 ++++-
 drivers/tty/serdev/core.c   | 99 ++++++++++++++++++++++++++++++++++++++++++---
 include/acpi/acpi_bus.h     |  2 +-
 4 files changed, 116 insertions(+), 24 deletions(-)

-- 
2.7.4

^ permalink raw reply

* Re: [PATCH] tty: xilinx_uartps: move to arch_initcall for earlier console
From: Shubhrajyoti Datta @ 2017-09-07  6:10 UTC (permalink / raw)
  To: Michal Simek
  Cc: Linus Walleij, Greg KH, Shubhrajyoti Datta,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <72a8ba54-69fb-5a69-35b3-8c9e277621fb@xilinx.com>

...
>>
>> I *guess* it is to get the console up really early, simply becaus it is
>> quite helpful for spotting early boot problems.
>
>
> ok. It means no concern about the move to arch_initcall.
> Shubhrajyoti: Please send v2 with changelog.

Will do thanks for the review.

>
> Thanks,
> Michal

^ permalink raw reply

* Re: [patch v7 2/4] drivers: jtag: Add Aspeed SoC 24xx and 25xx families JTAG master driver
From: Arnd Bergmann @ 2017-09-06 20:52 UTC (permalink / raw)
  To: Oleksandr Shamray
  Cc: gregkh, Linux Kernel Mailing List, Linux ARM, devicetree,
	OpenBMC Maillist, Joel Stanley, Jiří Pírko,
	Tobias Klauser, linux-serial, mec, vadimp, system-sw-low-level,
	Rob Herring, openocd-devel-owner, Linux API, David Miller,
	Mauro Carvalho Chehab, Jiri Pirko
In-Reply-To: <1504281966-6199-3-git-send-email-oleksandrs@mellanox.com>

On Fri, Sep 1, 2017 at 6:06 PM, Oleksandr Shamray
<oleksandrs@mellanox.com> wrote:
> Driver adds support of Aspeed 2500/2400 series SOC JTAG master controller.
>
> Driver implements the following jtag ops:
> - freq_get;
> - freq_set;
> - status_get;
> - idle;
> - xfer;
>
> It has been tested on Mellanox system with BMC equipped with
> Aspeed 2520 SoC for programming CPLD devices.
>
> Signed-off-by: Oleksandr Shamray <oleksandrs@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

No further comments about this driver, if there is agreement about the subsystem
in general, it looks good to go in.

Acked-by: Arnd Bergmann <arnd@arndb.de

       Arnd

^ permalink raw reply

* [PATCH v2] serial: meson: add Magic SysRq support
From: Yixun Lan @ 2017-09-06 13:52 UTC (permalink / raw)
  To: Kevin Hilman, Greg Kroah-Hartman
  Cc: linux-kernel, Ben Dooks, linux-serial, linux-amlogic,
	linux-arm-kernel, Yixun Lan

This dirver try to implement the Magic SysRq support[1] for
Amlogic Inc's meson platfo
>From the hardware perspective, the UART IP can't detect the 'BREAK' command
clearly via the status register. Instead, we rely on the combination of
'FRAME_ERR bit && ch == 0', and it works fine.

[1] Documentation/admin-guide/sysrq.rst

Signed-off-by: Yixun Lan <dlan@gentoo.org>

---
Changes since v1 at [0]:
- add changelog & a few more comments

[0] https://patchwork.kernel.org/patch/9728475/
---
 drivers/tty/serial/meson_uart.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 42e4a4c7597f..3fea24bafd80 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -14,6 +14,10 @@
  *
  */
 
+#if defined(CONFIG_SERIAL_MESON_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
 #include <linux/clk.h>
 #include <linux/console.h>
 #include <linux/delay.h>
@@ -183,12 +187,12 @@ static void meson_receive_chars(struct uart_port *port)
 {
 	struct tty_port *tport = &port->state->port;
 	char flag;
-	u32 status, ch, mode;
+	u32 ostatus, status, ch, mode;
 
 	do {
 		flag = TTY_NORMAL;
 		port->icount.rx++;
-		status = readl(port->membase + AML_UART_STATUS);
+		ostatus = status = readl(port->membase + AML_UART_STATUS);
 
 		if (status & AML_UART_ERR) {
 			if (status & AML_UART_TX_FIFO_WERR)
@@ -216,6 +220,16 @@ static void meson_receive_chars(struct uart_port *port)
 		ch = readl(port->membase + AML_UART_RFIFO);
 		ch &= 0xff;
 
+		if ((ostatus & AML_UART_FRAME_ERR) && (ch == 0)) {
+			port->icount.brk++;
+			flag = TTY_BREAK;
+			if (uart_handle_break(port))
+				continue;
+		}
+
+		if (uart_handle_sysrq_char(port, ch))
+			continue;
+
 		if ((status & port->ignore_status_mask) == 0)
 			tty_insert_flip_char(tport, ch, flag);
 
-- 
2.14.1

^ permalink raw reply related

* Re: [PATCH] tty: xilinx_uartps: move to arch_initcall for earlier console
From: Michal Simek @ 2017-09-06 12:43 UTC (permalink / raw)
  To: Linus Walleij, Michal Simek
  Cc: Greg KH, Shubhrajyoti Datta, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, shubhrajyoti.datta
In-Reply-To: <CACRpkdZ2kNxM_MLFTXUy6bVxh5q2a_cFd+kwVWMHmOSDzG-cOQ@mail.gmail.com>

On 31.8.2017 14:59, Linus Walleij wrote:
> On Thu, Aug 24, 2017 at 11:32 AM, Michal Simek <michal.simek@xilinx.com> wrote:
>> On 24.8.2017 01:24, Greg KH wrote:
>>> On Wed, Aug 23, 2017 at 04:50:21PM +0530, Shubhrajyoti Datta wrote:
>>>> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>>>
>>> I can't take patches without any changelog text at all :(
>>
>> ok. I see you have also commented this.
>>
>> Anyway this is kind of old discussion about moving serial drivers to
>> arch_initcall from module_init.
>>
>> There is one patch in the tree.
>>
>> commit 4dd9e742df98f8f600b4302d3adbb087a68237f7
>> Author:     Alessandro Rubini <rubini@gnudd.com>
>> AuthorDate: Tue May 5 05:54:13 2009 +0100
>> Commit:     Russell King <rmk+kernel@arm.linux.org.uk>
>> CommitDate: Sun May 31 14:58:11 2009 +0100
>>
>>     [ARM] 5505/1: serial amba-pl011: move to arch_initcall for earlier
>> console
>>
>>     Signed-off-by: Alessandro Rubini <rubini@unipv.it>"
>>     Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
>>
>>
>> and then there was one patch (also sent to linux-serial but don't have link)
>> https://patches.linaro.org/patch/14633/
>>
>> where that discussion wasn't finished.
> 
> Yeah Alessandro never came back on that.
> 
> I *guess* it is to get the console up really early, simply becaus it is
> quite helpful for spotting early boot problems.


ok. It means no concern about the move to arch_initcall.
Shubhrajyoti: Please send v2 with changelog.

Thanks,
Michal

^ permalink raw reply

* Re: [PATCH 4/8] tty/bcm63xx_uart: allow naming clock in device tree
From: Jonas Gorski @ 2017-09-06 12:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: MIPS Mailing List,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Network Development, Rob Herring, Mark Rutland, Ralf Baechle,
	Florian Fainelli, bcm-kernel-feedback-list, Kevin Cernekee,
	Jiri Slaby, David S. Miller, Russell King
In-Reply-To: <20170906121715.GA27869-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>

On 6 September 2017 at 14:17, Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> wrote:
> On Wed, Sep 06, 2017 at 01:01:32PM +0200, Jonas Gorski wrote:
>> Hi Greg,
>>
>> On 2 August 2017 at 11:34, Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > Codify using a named clock for the refclk of the uart. This makes it
>> > easier if we might need to add a gating clock (like present on the
>> > BCM6345).
>> >
>> > Signed-off-by: Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>
>> Could I please get a (N)Ack so Ralf can add this patch to his tree?
>>
>>
>> Regards
>> Jonas
>>
>>
>> > ---
>> >  Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++
>> >  drivers/tty/serial/bcm63xx_uart.c                              | 6 ++++--
>> >  2 files changed, 10 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
>> > index 5c52e5eef16d..8b2b0460259a 100644
>> > --- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
>> > +++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
>> > @@ -11,6 +11,11 @@ Required properties:
>> >  - clocks: Clock driving the hardware; used to figure out the baud rate
>> >    divisor.
>> >
>> > +
>> > +Optional properties:
>> > +
>> > +- clock-names: Should be "refclk".
>> > +
>> >  Example:
>> >
>> >         uart0: serial@14e00520 {
>> > @@ -19,6 +24,7 @@ Example:
>> >                 interrupt-parent = <&periph_intc>;
>> >                 interrupts = <2>;
>> >                 clocks = <&periph_clk>;
>> > +               clock-names = "refclk";
>> >         };
>> >
>> >         clocks {
>
> I don't ack devtree changes :)
>
>> > diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
>> > index a2b9376ec861..f227eff28d3a 100644
>> > --- a/drivers/tty/serial/bcm63xx_uart.c
>> > +++ b/drivers/tty/serial/bcm63xx_uart.c
>> > @@ -841,8 +841,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
>> >         if (!res_irq)
>> >                 return -ENODEV;
>> >
>> > -       clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) :
>> > -                                 clk_get(&pdev->dev, "refclk");
>> > +       clk = clk_get(&pdev->dev, "refclk");
>> > +       if (IS_ERR(clk) && pdev->dev.of_node)
>> > +               clk = of_clk_get(pdev->dev.of_node, 0);
>> > +
>> >         if (IS_ERR(clk))
>> >                 return -ENODEV;
>> >
>
> This part is fine with me:

That's all I wanted :)
>
> Acked-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>

Thank you!


Jonas
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 4/8] tty/bcm63xx_uart: allow naming clock in device tree
From: Greg Kroah-Hartman @ 2017-09-06 12:17 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: MIPS Mailing List, linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
	Network Development, Rob Herring, Mark Rutland, Ralf Baechle,
	Florian Fainelli, bcm-kernel-feedback-list, Kevin Cernekee,
	Jiri Slaby, David S. Miller, Russell King
In-Reply-To: <CAOiHx=mC=GfX0VvuRWR-AmXYfVOEkuruwGHooS08WrL_z-60UA@mail.gmail.com>

On Wed, Sep 06, 2017 at 01:01:32PM +0200, Jonas Gorski wrote:
> Hi Greg,
> 
> On 2 August 2017 at 11:34, Jonas Gorski <jonas.gorski@gmail.com> wrote:
> > Codify using a named clock for the refclk of the uart. This makes it
> > easier if we might need to add a gating clock (like present on the
> > BCM6345).
> >
> > Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> 
> Could I please get a (N)Ack so Ralf can add this patch to his tree?
> 
> 
> Regards
> Jonas
> 
> 
> > ---
> >  Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++
> >  drivers/tty/serial/bcm63xx_uart.c                              | 6 ++++--
> >  2 files changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
> > index 5c52e5eef16d..8b2b0460259a 100644
> > --- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
> > +++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
> > @@ -11,6 +11,11 @@ Required properties:
> >  - clocks: Clock driving the hardware; used to figure out the baud rate
> >    divisor.
> >
> > +
> > +Optional properties:
> > +
> > +- clock-names: Should be "refclk".
> > +
> >  Example:
> >
> >         uart0: serial@14e00520 {
> > @@ -19,6 +24,7 @@ Example:
> >                 interrupt-parent = <&periph_intc>;
> >                 interrupts = <2>;
> >                 clocks = <&periph_clk>;
> > +               clock-names = "refclk";
> >         };
> >
> >         clocks {

I don't ack devtree changes :)

> > diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
> > index a2b9376ec861..f227eff28d3a 100644
> > --- a/drivers/tty/serial/bcm63xx_uart.c
> > +++ b/drivers/tty/serial/bcm63xx_uart.c
> > @@ -841,8 +841,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
> >         if (!res_irq)
> >                 return -ENODEV;
> >
> > -       clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) :
> > -                                 clk_get(&pdev->dev, "refclk");
> > +       clk = clk_get(&pdev->dev, "refclk");
> > +       if (IS_ERR(clk) && pdev->dev.of_node)
> > +               clk = of_clk_get(pdev->dev.of_node, 0);
> > +
> >         if (IS_ERR(clk))
> >                 return -ENODEV;
> >

This part is fine with me:

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply

* Re: [PATCH 4/8] tty/bcm63xx_uart: allow naming clock in device tree
From: Jonas Gorski @ 2017-09-06 11:01 UTC (permalink / raw)
  To: MIPS Mailing List,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Network Development
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Ralf Baechle,
	Florian Fainelli, bcm-kernel-feedback-list, Kevin Cernekee,
	Jiri Slaby, David S. Miller, Russell King
In-Reply-To: <20170802093429.12572-5-jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Hi Greg,

On 2 August 2017 at 11:34, Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Codify using a named clock for the refclk of the uart. This makes it
> easier if we might need to add a gating clock (like present on the
> BCM6345).
>
> Signed-off-by: Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Could I please get a (N)Ack so Ralf can add this patch to his tree?


Regards
Jonas


> ---
>  Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++
>  drivers/tty/serial/bcm63xx_uart.c                              | 6 ++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
> index 5c52e5eef16d..8b2b0460259a 100644
> --- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
> +++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
> @@ -11,6 +11,11 @@ Required properties:
>  - clocks: Clock driving the hardware; used to figure out the baud rate
>    divisor.
>
> +
> +Optional properties:
> +
> +- clock-names: Should be "refclk".
> +
>  Example:
>
>         uart0: serial@14e00520 {
> @@ -19,6 +24,7 @@ Example:
>                 interrupt-parent = <&periph_intc>;
>                 interrupts = <2>;
>                 clocks = <&periph_clk>;
> +               clock-names = "refclk";
>         };
>
>         clocks {
> diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
> index a2b9376ec861..f227eff28d3a 100644
> --- a/drivers/tty/serial/bcm63xx_uart.c
> +++ b/drivers/tty/serial/bcm63xx_uart.c
> @@ -841,8 +841,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
>         if (!res_irq)
>                 return -ENODEV;
>
> -       clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) :
> -                                 clk_get(&pdev->dev, "refclk");
> +       clk = clk_get(&pdev->dev, "refclk");
> +       if (IS_ERR(clk) && pdev->dev.of_node)
> +               clk = of_clk_get(pdev->dev.of_node, 0);
> +
>         if (IS_ERR(clk))
>                 return -ENODEV;
>
> --
> 2.13.2
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 6/8] bcm63xx_enet: just use "enet" as the clock name
From: Jonas Gorski @ 2017-09-06 11:00 UTC (permalink / raw)
  To: MIPS Mailing List, linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
	Network Development
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Ralf Baechle,
	Florian Fainelli, bcm-kernel-feedback-list, Kevin Cernekee,
	Jiri Slaby, David S. Miller, Russell King
In-Reply-To: <20170802093429.12572-7-jonas.gorski@gmail.com>

Hi David,

On 2 August 2017 at 11:34, Jonas Gorski <jonas.gorski@gmail.com> wrote:
> Now that we have the individual clocks available as "enet" we
> don't need to rely on the device id for them anymore.
>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>

Could I please get a (N)Ack so Ralf can add this patch to his tree?


Regards
Jonas

> ---
>  drivers/net/ethernet/broadcom/bcm63xx_enet.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> index 61a88b64bd39..d6844923a1c0 100644
> --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> @@ -1718,7 +1718,6 @@ static int bcm_enet_probe(struct platform_device *pdev)
>         struct bcm63xx_enet_platform_data *pd;
>         struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
>         struct mii_bus *bus;
> -       const char *clk_name;
>         int i, ret;
>
>         /* stop if shared driver failed, assume driver->probe will be
> @@ -1761,14 +1760,12 @@ static int bcm_enet_probe(struct platform_device *pdev)
>         if (priv->mac_id == 0) {
>                 priv->rx_chan = 0;
>                 priv->tx_chan = 1;
> -               clk_name = "enet0";
>         } else {
>                 priv->rx_chan = 2;
>                 priv->tx_chan = 3;
> -               clk_name = "enet1";
>         }
>
> -       priv->mac_clk = clk_get(&pdev->dev, clk_name);
> +       priv->mac_clk = clk_get(&pdev->dev, "enet");
>         if (IS_ERR(priv->mac_clk)) {
>                 ret = PTR_ERR(priv->mac_clk);
>                 goto out;
> --
> 2.13.2
>

^ permalink raw reply

* [GIT PULL] TTY/Serial updates for 4.14-rc1
From: Greg KH @ 2017-09-04 16:41 UTC (permalink / raw)
  To: Linus Torvalds, Jiri Slaby
  Cc: Stephen Rothwell, Andrew Morton, linux-kernel, linux-serial

The following changes since commit ef954844c7ace62f773f4f23e28d2d915adc419f:

  Linux 4.13-rc5 (2017-08-13 16:01:32 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/ tags/tty-4.14-rc1

for you to fetch changes up to 3840ed9548f778717aaab5eab744da798c3ea055:

  tty: goldfish: Implement support for kernel 'earlycon' parameter (2017-08-31 18:58:45 +0200)

----------------------------------------------------------------
TTY/Serial updates for 4.14-rc1

Here is the big tty/serial driver update for 4.14-rc1.

Well, not all that big, just a number of small serial driver fixes, and
a new serial driver.  Also in here are some much needed goldfish tty
driver (emulator) fixes to try to get that codebase under control.

All of these have been in linux-next for a while with no reported
issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

----------------------------------------------------------------
Aleksandar Markovic (1):
      tty: goldfish: Refactor constants to better reflect their nature

Alexey Khoroshilov (2):
      serial: 8250: fix error handling in of_platform_serial_probe()
      drivers/serial: Do not leave sysfs group in case of error in aspeed_vuart_probe()

Andreas Färber (1):
      tty: serial: owl: Implement console driver

Andy Shevchenko (11):
      serial: core: enforce type for upf_t when copying
      serial: core: move UPF_NO_TXEN_TEST to quirks and rename
      serial: 8250_pci: Enable device after we check black list
      serial: fsl_lpuart: Avoid using irq_wake flag
      serial: st-asc: Avoid using irq_wake flag
      serial: stm32-usart: Avoid using irq_wake flag
      serial: core: remove unneeded irq_wake flag
      serial: pch_uart: Make port type explicit
      serial: Remove unused port type
      serial: Fix port type numbering for TI DA8xx
      serial: 8250_port: Remove useless NULL checks

Arnd Bergmann (3):
      tty: improve tty_insert_flip_char() fast path
      tty: improve tty_insert_flip_char() slow path
      tty: fix __tty_insert_flip_char regression

Arvind Yadav (16):
      tty: synclinkmp: constify pci_device_id.
      tty: isicom: constify pci_device_id.
      tty: mxser: constify pci_device_id.
      tty: synclink: constify pci_device_id.
      tty: moxa: constify pci_device_id.
      tty: serial: exar: constify pci_device_id.
      tty: serial: pci: constify pci_device_id.
      tty: synclink_gt: constify pci_device_id.
      tty: serial: jsm: constify pci_device_id.
      serial: pl010: constify amba_id
      serial: pl011: constify amba_id
      tty: 8250: constify parisc_device_id
      tty: mux: constify parisc_device_id
      tty: mips_ejtag_fdc: constify mips_cdmm_device_id
      tty: hvc_vio: constify vio_device_id
      tty: hvcs: constify vio_device_id

Bhumika Goyal (1):
      tty: hvcs: make ktermios const

Bich HEMON (2):
      serial: stm32: fix copyright
      serial: stm32: add RTS support

Eugeniy Paltsev (1):
      earlycon: initialise baud field of earlycon device structure

Fabio Estevam (1):
      serial: pch_uart: Remove unneeded NULL check

Fabrice Gasnier (3):
      serial: stm32: fix error handling in probe
      dt-bindings: serial: add compatible for stm32h7
      serial: stm32: add wakeup mechanism

Franklin S Cooper Jr (1):
      serial: 8250_of: Add basic PM runtime support

Geert Uytterhoeven (1):
      dt-bindings: serial: sh-sci: Add support for r8a77995 (H)SCIF

Gerald Baeza (4):
      serial: stm32: fix multi-ports management
      serial: stm32: Increase maximum number of ports
      serial: stm32: add fifo support
      serial: stm32: fix pio transmit timeout

Greg Kroah-Hartman (2):
      Merge 4.13-rc2 into tty-next
      Merge 4.13-rc5 into tty-next

Gustavo A. R. Silva (1):
      tty: serial: sprd: fix error return code in sprd_probe()

Himanshu Jha (1):
      tty: serial: 8250_mtk: Use PTR_ERR_OR_ZERO

Ian Jamison (1):
      serial: imx: Avoid post-PIO cleanup if TX DMA is started

Jeffy Chen (6):
      serial: arc: Remove __init marking from early write
      serial: omap: Remove __init marking from early write
      serial: xuartps: Remove __init marking from early write
      serial: 8250_ingenic: Remove __init marking from early write
      serial: 8250_early: Remove __init marking from early write
      serial: earlycon: Only try fdt when specify 'earlycon' exactly

Johannes Thumshirn (1):
      mcb: introduce mcb_get_resource()

Julia Lawall (12):
      tty: amba-pl011: constify vendor_data structures
      serial: owl: constify uart_ops structures
      serial: meson: constify uart_ops structures
      serial: uuc_uart: constify uart_ops structures
      serial: 21285: constify uart_ops structures
      serial: sunsab: constify uart_ops structures
      serial: apbuart: constify uart_ops structures
      serial: cpm_uart: constify uart_ops structures
      serial: m32r_sio: constify uart_ops structures
      serial: mpc52xx: constify uart_ops structures
      serial: sunsu: constify uart_ops structures
      serial: mux: constify uart_ops structures

Lanqing Liu (1):
      serial: sprd: clear timeout interrupt only rather than all interrupts

Lars Poeschel (1):
      tty: n_gsm: Add compat_ioctl

Marius Vlad (1):
      tty/serial/fsl_lpuart: Add CONSOLE_POLL support for lpuart32.

Masahiro Yamada (3):
      serial: 8250_uniphier: fix serial port index in private data
      serial: 8250_uniphier: use CHAR register for canary to detect power-off
      serial: 8250_uniphier: add suspend/resume support

Masatake YAMATO (1):
      pty: show associative slave of ptmx in fdinfo

Maxim Yu. Osipov (1):
      tty: serial: imx: disable irq after suspend

Michael Moese (1):
      Introduce 8250_men_mcb

Miodrag Dinic (2):
      tty: goldfish: Use streaming DMA for r/w operations on Ranchu platforms
      tty: goldfish: Implement support for kernel 'earlycon' parameter

Neeraj Upadhyay (1):
      tty: serial: msm: Move request_irq to the end of startup

Philipp Zabel (2):
      serial: 8250_dw: explicitly request exclusive reset control
      serial: tegra: explicitly request exclusive reset control

Rafael Gago (2):
      serial: core: Consider rs485 settings to drive RTS
      serial: 8250: Use hrtimers for rs485 delays

Rob Herring (1):
      tty: Convert to using %pOF instead of full_name

Sean Wang (2):
      dt-bindings: serial: 8250: Add MediaTek BTIF controller bindings
      serial: 8250: of: Add new port type for MediaTek BTIF controller on MT7622/23 SoC

Sergei Shtylyov (2):
      serial: sh-sci: use of_property_read_bool()
      serial: 8250_of: use of_property_read_bool()

Uwe Kleine-König (3):
      serial: imx: drop useless member from driver data
      serial: fsl_lpuart: clear unsupported options in .rs485_config()
      dt-bindings: serial/rs485: make rs485-rts-delay optional

 Documentation/devicetree/bindings/serial/8250.txt  |   2 +
 .../bindings/serial/renesas,sci-serial.txt         |   2 +
 Documentation/devicetree/bindings/serial/rs485.txt |   5 +-
 .../devicetree/bindings/serial/st,stm32-usart.txt  |  17 +-
 drivers/mcb/mcb-core.c                             |  20 +-
 drivers/tty/Kconfig                                |   3 +
 drivers/tty/ehv_bytechan.c                         |   2 +-
 drivers/tty/goldfish.c                             | 234 ++++++--
 drivers/tty/hvc/hvc_opal.c                         |  16 +-
 drivers/tty/hvc/hvc_vio.c                          |   8 +-
 drivers/tty/hvc/hvcs.c                             |   4 +-
 drivers/tty/isicom.c                               |   2 +-
 drivers/tty/mips_ejtag_fdc.c                       |   2 +-
 drivers/tty/moxa.c                                 |   2 +-
 drivers/tty/mxser.c                                |   2 +-
 drivers/tty/n_gsm.c                                |  11 +
 drivers/tty/pty.c                                  |   8 +-
 drivers/tty/serdev/core.c                          |   2 +-
 drivers/tty/serial/21285.c                         |   2 +-
 drivers/tty/serial/8250/8250_aspeed_vuart.c        |   7 +-
 drivers/tty/serial/8250/8250_core.c                |  16 +-
 drivers/tty/serial/8250/8250_dw.c                  |   2 +-
 drivers/tty/serial/8250/8250_early.c               |   8 +-
 drivers/tty/serial/8250/8250_exar.c                |   2 +-
 drivers/tty/serial/8250/8250_gsc.c                 |   4 +-
 drivers/tty/serial/8250/8250_ingenic.c             |   8 +-
 drivers/tty/serial/8250/8250_men_mcb.c             | 118 ++++
 drivers/tty/serial/8250/8250_mtk.c                 |   5 +-
 drivers/tty/serial/8250/8250_of.c                  |  60 +-
 drivers/tty/serial/8250/8250_pci.c                 |  43 +-
 drivers/tty/serial/8250/8250_port.c                |  81 ++-
 drivers/tty/serial/8250/8250_uniphier.c            |  63 +-
 drivers/tty/serial/8250/Kconfig                    |  11 +
 drivers/tty/serial/8250/Makefile                   |   1 +
 drivers/tty/serial/Kconfig                         |   4 +-
 drivers/tty/serial/amba-pl010.c                    |   2 +-
 drivers/tty/serial/amba-pl011.c                    |   6 +-
 drivers/tty/serial/apbuart.c                       |   2 +-
 drivers/tty/serial/arc_uart.c                      |   4 +-
 drivers/tty/serial/cpm_uart/cpm_uart_core.c        |   2 +-
 drivers/tty/serial/earlycon.c                      |   7 +-
 drivers/tty/serial/fsl_lpuart.c                    |  76 ++-
 drivers/tty/serial/imx.c                           |  20 +-
 drivers/tty/serial/jsm/jsm_driver.c                |   2 +-
 drivers/tty/serial/m32r_sio.c                      |   2 +-
 drivers/tty/serial/meson_uart.c                    |   2 +-
 drivers/tty/serial/mpc52xx_uart.c                  |  14 +-
 drivers/tty/serial/msm_serial.c                    |  19 +-
 drivers/tty/serial/mux.c                           |   6 +-
 drivers/tty/serial/omap-serial.c                   |  13 +-
 drivers/tty/serial/owl-uart.c                      | 635 ++++++++++++++++++++-
 drivers/tty/serial/pch_uart.c                      |  38 +-
 drivers/tty/serial/pmac_zilog.c                    |   4 +-
 drivers/tty/serial/serial-tegra.c                  |   2 +-
 drivers/tty/serial/serial_core.c                   |  47 +-
 drivers/tty/serial/sh-sci.c                        |   3 +-
 drivers/tty/serial/sprd_serial.c                   |   8 +-
 drivers/tty/serial/st-asc.c                        |   2 +-
 drivers/tty/serial/stm32-usart.c                   | 125 +++-
 drivers/tty/serial/stm32-usart.h                   |  37 +-
 drivers/tty/serial/sunsab.c                        |   2 +-
 drivers/tty/serial/sunsu.c                         |   6 +-
 drivers/tty/serial/ucc_uart.c                      |   2 +-
 drivers/tty/serial/xilinx_uartps.c                 |   2 +-
 drivers/tty/synclink.c                             |   2 +-
 drivers/tty/synclink_gt.c                          |   2 +-
 drivers/tty/synclinkmp.c                           |   2 +-
 drivers/tty/tty_buffer.c                           |  26 +
 drivers/tty/tty_io.c                               |   9 +
 include/linux/mcb.h                                |   2 +
 include/linux/serial_8250.h                        |   7 +-
 include/linux/serial_core.h                        |  10 +-
 include/linux/tty_driver.h                         |   2 +
 include/linux/tty_flip.h                           |   3 +-
 include/uapi/linux/serial_core.h                   |  14 +-
 75 files changed, 1634 insertions(+), 312 deletions(-)
 create mode 100644 drivers/tty/serial/8250/8250_men_mcb.c

^ permalink raw reply

* Re: [PATCH repost v2] serial: sh-sci: document R8A77970 bindings
From: Geert Uytterhoeven @ 2017-09-04 14:52 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux-Renesas
In-Reply-To: <20170901221519.704978317-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

On Sat, Sep 2, 2017 at 12:15 AM, Sergei Shtylyov
<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org> wrote:
> R-Car V3M (R8A77970) SoC also has the R-Car gen3 compatible SCIF and HSCIF
> ports, so document the SoC specific bindings.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

Acked-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH repost v2] serial: sh-sci: document R8A77970 bindings
From: Simon Horman @ 2017-09-04 14:47 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, linux-serial,
	devicetree, linux-renesas-soc
In-Reply-To: <20170901221519.704978317@cogentembedded.com>

On Sat, Sep 02, 2017 at 01:15:13AM +0300, Sergei Shtylyov wrote:
> R-Car V3M (R8A77970) SoC also has the R-Car gen3 compatible SCIF and HSCIF
> ports, so document the SoC specific bindings.
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> ---
> This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
> 
> Changes in version 2:
> - changed R8A7797 to R8A77970 everywhere;
> - rebased against the current branch.

Acked-by: Simon Horman <horms+renesas@verge.net.au>

^ permalink raw reply

* [PATCH] serial: sccnxp: Fix error handling in sccnxp_probe()
From: Alexey Khoroshilov @ 2017-09-02 20:13 UTC (permalink / raw)
  To: Alexander Shiyan, Greg Kroah-Hartman
  Cc: Alexey Khoroshilov, Jiri Slaby, linux-serial, linux-kernel,
	ldv-project

sccnxp_probe() returns result of regulator_disable() that may lead
to returning zero, while device is not properly initialized.
Also the driver enables clocks, but it does not disable it.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/tty/serial/sccnxp.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index cdd2f942317c..b9c7a904c1ea 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -889,7 +889,16 @@ static int sccnxp_probe(struct platform_device *pdev)
 			goto err_out;
 		uartclk = 0;
 	} else {
-		clk_prepare_enable(clk);
+		ret = clk_prepare_enable(clk);
+		if (ret)
+			goto err_out;
+
+		ret = devm_add_action_or_reset(&pdev->dev,
+				(void(*)(void *))clk_disable_unprepare,
+				clk);
+		if (ret)
+			goto err_out;
+
 		uartclk = clk_get_rate(clk);
 	}
 
@@ -988,7 +997,7 @@ static int sccnxp_probe(struct platform_device *pdev)
 	uart_unregister_driver(&s->uart);
 err_out:
 	if (!IS_ERR(s->regulator))
-		return regulator_disable(s->regulator);
+		regulator_disable(s->regulator);
 
 	return ret;
 }
-- 
2.7.4

^ permalink raw reply related

* [PATCH repost v2] serial: sh-sci: document R8A77970 bindings
From: Sergei Shtylyov @ 2017-09-01 22:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, linux-serial,
	devicetree
  Cc: linux-renesas-soc, Sergei Shtylyov

[-- Attachment #1: serial-sh-sci-document-R8A77970-bindings-v2.patch --]
[-- Type: text/plain, Size: 1438 bytes --]

R-Car V3M (R8A77970) SoC also has the R-Car gen3 compatible SCIF and HSCIF
ports, so document the SoC specific bindings.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.

Changes in version 2:
- changed R8A7797 to R8A77970 everywhere;
- rebased against the current branch.

 Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |    2 ++
 1 file changed, 2 insertions(+)

Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
===================================================================
--- tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
+++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
@@ -41,6 +41,8 @@ Required properties:
     - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART.
     - "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART.
     - "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART.
+    - "renesas,scif-r8a77970" for R8A77970 (R-Car V3M) SCIF compatible UART.
+    - "renesas,hscif-r8a77970" for R8A77970 (R-Car V3M) HSCIF compatible UART.
     - "renesas,scif-r8a77995" for R8A77995 (R-Car D3) SCIF compatible UART.
     - "renesas,hscif-r8a77995" for R8A77995 (R-Car D3) HSCIF compatible UART.
     - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.

^ permalink raw reply

* Re: [PATCH v2] serial: sh-sci: document R8A77970 bindings
From: Sergei Shtylyov @ 2017-09-01 22:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, linux-serial,
	devicetree
  Cc: linux-renesas-soc
In-Reply-To: <20170901220842.577848904@cogentembedded.com>

On 09/02/2017 01:08 AM, Sergei Shtylyov wrote:

> R-Car V3M (R8A77970) SoC also has the R-Car gen3 compatible SCIF and HSCIF
> ports, so document the SoC specific bindings.
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

    Totally forgot about the version history. :-/ Will repost...

MBR, Sergei

^ permalink raw reply

* [PATCH v2] serial: sh-sci: document R8A77970 bindings
From: Sergei Shtylyov @ 2017-09-01 22:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA, Sergei Shtylyov

[-- Attachment #1: serial-sh-sci-document-R8A77970-bindings-v2.patch --]
[-- Type: text/plain, Size: 1512 bytes --]

R-Car V3M (R8A77970) SoC also has the R-Car gen3 compatible SCIF and HSCIF
ports, so document the SoC specific bindings.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

---
 Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |    2 ++
 1 file changed, 2 insertions(+)

Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
===================================================================
--- tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
+++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
@@ -41,6 +41,8 @@ Required properties:
     - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART.
     - "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART.
     - "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART.
+    - "renesas,scif-r8a77970" for R8A77970 (R-Car V3M) SCIF compatible UART.
+    - "renesas,hscif-r8a77970" for R8A77970 (R-Car V3M) HSCIF compatible UART.
     - "renesas,scif-r8a77995" for R8A77995 (R-Car D3) SCIF compatible UART.
     - "renesas,hscif-r8a77995" for R8A77995 (R-Car D3) HSCIF compatible UART.
     - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [patch v7 1/4] drivers: jtag: Add JTAG core driver
From: Moritz Fischer @ 2017-09-01 17:48 UTC (permalink / raw)
  To: Oleksandr Shamray
  Cc: Greg KH, Arnd Bergmann, Linux Kernel Mailing List,
	linux-arm-kernel, Devicetree List, openbmc-uLR06cmDAlY/bJ5BZ2RsiQ,
	joel-U3u1mxZcP9KHXe+LvDLADg, jiri-rHqAuBHg3fBzbRFIqnYvSA,
	tklauser-93Khv+1bN0NyDzI6CaY1VQ,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, mec-WqBc5aa1uDFeoWH0uzbU5w,
	vadimp-45czdsxZ+A5DPfheJLI6IQ,
	system-sw-low-level-VPRAkNaXOzVWk0Htik3J/w, Rob Herring,
	openocd-devel-owner-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-api-u79uwXL29TY76Z2rM5mHXA, David S. Miller,
	mchehab-DgEjT+Ai2ygdnm+yROfE0A, Jiri Pirko
In-Reply-To: <1504281966-6199-2-git-send-email-oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Nit inline ;-)

On Fri, Sep 1, 2017 at 9:06 AM, Oleksandr Shamray
<oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> Initial patch for JTAG friver

s/friver/driver
> JTAG class driver provide infrastructure to support hardware/software
> JTAG platform drivers. It provide user layer API interface for flashing
> and debugging external devices which equipped with JTAG interface
> using standard transactions.
>
> Driver exposes set of IOCTL to user space for:
> - XFER:
> - SIR (Scan Instruction Register, IEEE 1149.1 Data Register scan);
> - SDR (Scan Data Register, IEEE 1149.1 Instruction Register scan);
> - RUNTEST (Forces the IEEE 1149.1 bus to a run state for a specified
>   number of clocks).
> - SIOCFREQ/GIOCFREQ for setting and reading JTAG frequency.
>
> Driver core provides set of internal APIs for allocation and
> registration:
> - jtag_register;
> - jtag_unregister;
> - jtag_alloc;
> - jtag_free;
>
> Platform driver on registration with jtag-core creates the next
> entry in dev folder:
> /dev/jtagX
>
> Signed-off-by: Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Jiri Pirko <jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> v6->v7
> Notifications from kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> - Remove include asm/types.h from jtag.h
> - Add include <linux/types.h> to jtag.c
>
> v5->v6
> v4->v5
>
> v3->v4
> Comments pointed by Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> - change transaction pointer tdio type  to __u64
> - change internal status type from enum to __u32
> - reorder jtag_xfer members to aviod the implied padding
> - add __packed attribute to jtag_xfer and jtag_run_test_idle
>
> v2->v3
> Notifications from kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> - Change include path to <linux/types.h> in jtag.h
>
> v1->v2
> Comments pointed by Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
> - Change license type from GPLv2/BSD to GPLv2
> - Change type of variables which crossed user/kernel to __type
> - Remove "default n" from Kconfig
>
> Comments pointed by Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> - Change list_add_tail in jtag_unregister to list_del
>
> Comments pointed by Neil Armstrong <narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
> - Add SPDX-License-Identifier instead of license text
>
> Comments pointed by Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> - Change __copy_to_user to memdup_user
> - Change __put_user to put_user
> - Change type of variables to __type for compatible 32 and 64-bit systems
> - Add check for maximum xfer data size
> - Change lookup data mechanism to get jtag data from inode
> - Add .compat_ioctl to file ops
> - Add mem alignment for jtag priv data
>
> Comments pointed by Tobias Klauser <tklauser-93Khv+1bN0NyDzI6CaY1VQ@public.gmane.org>
> - Change function names to avoid match with variable types
> - Fix description for jtag_ru_test_idle in uapi jtag.h
> - Fix misprints IDEL/IDLE, trough/through
> ---
>  Documentation/ioctl/ioctl-number.txt |    2 +
>  MAINTAINERS                          |    8 +
>  drivers/Kconfig                      |    2 +
>  drivers/Makefile                     |    1 +
>  drivers/jtag/Kconfig                 |   16 ++
>  drivers/jtag/Makefile                |    1 +
>  drivers/jtag/jtag.c                  |  312 ++++++++++++++++++++++++++++++++++
>  include/linux/jtag.h                 |   48 +++++
>  include/uapi/linux/jtag.h            |  111 ++++++++++++
>  9 files changed, 501 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/jtag/Kconfig
>  create mode 100644 drivers/jtag/Makefile
>  create mode 100644 drivers/jtag/jtag.c
>  create mode 100644 include/linux/jtag.h
>  create mode 100644 include/uapi/linux/jtag.h
>
> diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
> index 3e3fdae..1af2508 100644
> --- a/Documentation/ioctl/ioctl-number.txt
> +++ b/Documentation/ioctl/ioctl-number.txt
> @@ -321,6 +321,8 @@ Code  Seq#(hex)     Include File            Comments
>  0xB0   all     RATIO devices           in development:
>                                         <mailto:vgo-/IYFIZglx74@public.gmane.org>
>  0xB1   00-1F   PPPoX                   <mailto:mostrows-TTukF6hB3AoKZpuMuFhwt/d9D2ou9A/h@public.gmane.org>
> +0xB2   00-0f   linux/jtag.h            JTAG driver
> +                                       <mailto:oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>  0xB3   00      linux/mmc/ioctl.h
>  0xB4   00-0F   linux/gpio.h            <mailto:linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
>  0xB5   00-0F   uapi/linux/rpmsg.h      <mailto:linux-remoteproc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 205d397..141aeaf 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7292,6 +7292,14 @@ L:       linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>  S:     Maintained
>  F:     drivers/tty/serial/jsm/
>
> +JTAG SUBSYSTEM
> +M:     Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> +M:     Vadim Pasternak <vadimp-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> +S:     Maintained
> +F:     include/linux/jtag.h
> +F:     include/uapi/linux/jtag.h
> +F:     drivers/jtag/
> +
>  K10TEMP HARDWARE MONITORING DRIVER
>  M:     Clemens Ladisch <clemens-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
>  L:     linux-hwmon-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 505c676..2214678 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -208,4 +208,6 @@ source "drivers/tee/Kconfig"
>
>  source "drivers/mux/Kconfig"
>
> +source "drivers/jtag/Kconfig"
> +
>  endmenu
> diff --git a/drivers/Makefile b/drivers/Makefile
> index dfdcda0..6a2059b 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -182,3 +182,4 @@ obj-$(CONFIG_FPGA)          += fpga/
>  obj-$(CONFIG_FSI)              += fsi/
>  obj-$(CONFIG_TEE)              += tee/
>  obj-$(CONFIG_MULTIPLEXER)      += mux/
> +obj-$(CONFIG_JTAG)             += jtag/
> diff --git a/drivers/jtag/Kconfig b/drivers/jtag/Kconfig
> new file mode 100644
> index 0000000..0fad1a3
> --- /dev/null
> +++ b/drivers/jtag/Kconfig
> @@ -0,0 +1,16 @@
> +menuconfig JTAG
> +       tristate "JTAG support"
> +       ---help---
> +         This provides basic core functionality support for jtag class devices
> +         Hardware equipped with JTAG microcontroller which can be built
> +         on top of this drivers. Driver exposes the set of IOCTL to the
> +         user space for:
> +         SIR (Scan Instruction Register, IEEE 1149.1 Data Register scan);
> +         SDR (Scan Data Register, IEEE 1149.1 Instruction Register scan);
> +         RUNTEST (Forces IEEE 1149.1 bus to a run state for specified
> +         number of clocks).
> +
> +         If you want this support, you should say Y here.
> +
> +         To compile this driver as a module, choose M here: the module will
> +         be called jtag.
> diff --git a/drivers/jtag/Makefile b/drivers/jtag/Makefile
> new file mode 100644
> index 0000000..af37493
> --- /dev/null
> +++ b/drivers/jtag/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_JTAG)             += jtag.o
> diff --git a/drivers/jtag/jtag.c b/drivers/jtag/jtag.c
> new file mode 100644
> index 0000000..f948d4c
> --- /dev/null
> +++ b/drivers/jtag/jtag.c
> @@ -0,0 +1,312 @@
> +/*
> + * drivers/jtag/jtag.c
> + *
> + * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
> + * Copyright (c) 2017 Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> + *
> + * Released under the GPLv2 only.
> + * SPDX-License-Identifier: GPL-2.0
> + */
> +
> +#include <linux/cdev.h>
> +#include <linux/device.h>
> +#include <linux/jtag.h>
> +#include <linux/kernel.h>
> +#include <linux/list.h>
> +#include <linux/module.h>
> +#include <linux/rtnetlink.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +#include <uapi/linux/jtag.h>
> +
> +struct jtag {
> +       struct list_head list;
> +       struct device *dev;
> +       struct cdev cdev;
> +       int id;
> +       spinlock_t lock;
> +       int open;
> +       const struct jtag_ops *ops;
> +       unsigned long priv[0] __aligned(ARCH_DMA_MINALIGN);
> +};
> +
> +static dev_t jtag_devt;
> +static LIST_HEAD(jtag_list);
> +static DEFINE_MUTEX(jtag_mutex);
> +static DEFINE_IDA(jtag_ida);
> +
> +void *jtag_priv(struct jtag *jtag)
> +{
> +       return jtag->priv;
> +}
> +EXPORT_SYMBOL_GPL(jtag_priv);
> +
> +static __u64 jtag_copy_from_user(__u64 udata, unsigned long bit_size)
> +{
> +       unsigned long size;
> +       void *kdata;
> +
> +       size = DIV_ROUND_UP(bit_size, BITS_PER_BYTE);
> +       kdata = memdup_user(u64_to_user_ptr(udata), size);
> +
> +       return (__u64)(uintptr_t)kdata;
> +}
> +
> +static unsigned long jtag_copy_to_user(__u64 udata, __u64 kdata,
> +                                      unsigned long bit_size)
> +{
> +       unsigned long size;
> +
> +       size = DIV_ROUND_UP(bit_size, BITS_PER_BYTE);
> +
> +       return copy_to_user(u64_to_user_ptr(udata), jtag_u64_to_ptr(kdata),
> +                           size);
> +}
> +
> +static struct class jtag_class = {
> +       .name = "jtag",
> +       .owner = THIS_MODULE,
> +};
> +
> +static int jtag_run_test_idle_op(struct jtag *jtag,
> +                                struct jtag_run_test_idle *idle)
> +{
> +       if (jtag->ops->idle)
> +               return jtag->ops->idle(jtag, idle);
> +       else
> +               return -EOPNOTSUPP;
> +}
> +
> +static int jtag_xfer_op(struct jtag *jtag, struct jtag_xfer *xfer)
> +{
> +       if (jtag->ops->xfer)
> +               return jtag->ops->xfer(jtag, xfer);
> +       else
> +               return -EOPNOTSUPP;
> +}
> +
> +static long jtag_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> +{
> +       struct jtag *jtag = file->private_data;
> +       __u32 *uarg = (__u32 __user *)arg;
> +       void  *varg = (void __user *)arg;
> +       struct jtag_run_test_idle idle;
> +       struct jtag_xfer xfer;
> +       __u64 tdio_user;
> +       __u32 value;
> +       int err;
> +
> +       switch (cmd) {
> +       case JTAG_GIOCFREQ:
> +               if (jtag->ops->freq_get)
> +                       err = jtag->ops->freq_get(jtag, &value);
> +               else
> +                       err = -EOPNOTSUPP;
> +               if (err)
> +                       break;
> +
> +               err = put_user(value, uarg);
> +               break;
> +
> +       case JTAG_SIOCFREQ:
> +               err = __get_user(value, uarg);
> +
> +               if (value == 0)
> +                       err = -EINVAL;
> +               if (err)
> +                       break;
> +
> +               if (jtag->ops->freq_set)
> +                       err = jtag->ops->freq_set(jtag, value);
> +               else
> +                       err = -EOPNOTSUPP;
> +               break;
> +
> +       case JTAG_IOCRUNTEST:
> +               if (copy_from_user(&idle, varg,
> +                                  sizeof(struct jtag_run_test_idle)))
> +                       return -ENOMEM;
> +               err = jtag_run_test_idle_op(jtag, &idle);
> +               break;
> +
> +       case JTAG_IOCXFER:
> +               if (copy_from_user(&xfer, varg, sizeof(struct jtag_xfer)))
> +                       return -EFAULT;
> +
> +               if (xfer.length >= JTAG_MAX_XFER_DATA_LEN)
> +                       return -EFAULT;
> +
> +               tdio_user = xfer.tdio;
> +               xfer.tdio = jtag_copy_from_user(xfer.tdio, xfer.length);
> +               if (!xfer.tdio)
> +                       return -ENOMEM;
> +
> +               err = jtag_xfer_op(jtag, &xfer);
> +               if (jtag_copy_to_user(tdio_user, xfer.tdio, xfer.length)) {
> +                       kfree(jtag_u64_to_ptr(xfer.tdio));
> +                       return -EFAULT;
> +               }
> +
> +               kfree(jtag_u64_to_ptr(xfer.tdio));
> +               xfer.tdio = tdio_user;
> +               if (copy_to_user(varg, &xfer, sizeof(struct jtag_xfer)))
> +                       return -EFAULT;
> +               break;
> +
> +       case JTAG_GIOCSTATUS:
> +               if (jtag->ops->status_get)
> +                       err = jtag->ops->status_get(jtag, &value);
> +               else
> +                       err = -EOPNOTSUPP;
> +               if (err)
> +                       break;
> +
> +               err = put_user(value, uarg);
> +               break;
> +
> +       default:
> +               return -EINVAL;
> +       }
> +       return err;
> +}
> +
> +#ifdef CONFIG_COMPAT
> +static long jtag_ioctl_compat(struct file *file, unsigned int cmd,
> +                             unsigned long arg)
> +{
> +       return jtag_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
> +}
> +#endif
> +
> +static int jtag_open(struct inode *inode, struct file *file)
> +{
> +       struct jtag *jtag = container_of(inode->i_cdev, struct jtag, cdev);
> +
> +       spin_lock(&jtag->lock);
> +
> +       if (jtag->open) {
> +               dev_info(NULL, "jtag already opened\n");
> +               spin_unlock(&jtag->lock);
> +               return -EBUSY;
> +       }
> +
> +       jtag->open++;
> +       file->private_data = jtag;
> +       spin_unlock(&jtag->lock);
> +       return 0;
> +}
> +
> +static int jtag_release(struct inode *inode, struct file *file)
> +{
> +       struct jtag *jtag = file->private_data;
> +
> +       spin_lock(&jtag->lock);
> +       jtag->open--;
> +       spin_unlock(&jtag->lock);
> +       return 0;
> +}
> +
> +static const struct file_operations jtag_fops = {
> +       .owner          = THIS_MODULE,
> +       .open           = jtag_open,
> +       .release        = jtag_release,
> +       .llseek         = noop_llseek,
> +       .unlocked_ioctl = jtag_ioctl,
> +#ifdef CONFIG_COMPAT
> +       .compat_ioctl   = jtag_ioctl_compat,
> +#endif
> +};
> +
> +struct jtag *jtag_alloc(size_t priv_size, const struct jtag_ops *ops)
> +{
> +       struct jtag *jtag;
> +
> +       jtag = kzalloc(sizeof(*jtag) + round_up(priv_size, ARCH_DMA_MINALIGN),
> +                      GFP_KERNEL);
> +       if (!jtag)
> +               return NULL;
> +
> +       jtag->ops = ops;
> +       return jtag;
> +}
> +EXPORT_SYMBOL_GPL(jtag_alloc);
> +
> +void jtag_free(struct jtag *jtag)
> +{
> +       kfree(jtag);
> +}
> +EXPORT_SYMBOL_GPL(jtag_free);
> +
> +int jtag_register(struct jtag *jtag)
> +{
> +       int id;
> +       int err;
> +
> +       id = ida_simple_get(&jtag_ida, 0, 0, GFP_KERNEL);
> +       if (id < 0)
> +               return id;
> +
> +       jtag->id = id;
> +       cdev_init(&jtag->cdev, &jtag_fops);
> +       jtag->cdev.owner = THIS_MODULE;
> +       err = cdev_add(&jtag->cdev, MKDEV(MAJOR(jtag_devt), jtag->id), 1);
> +       if (err)
> +               goto err_cdev;
> +
> +       /* Register this jtag device with the driver core */
> +       jtag->dev = device_create(&jtag_class, NULL, MKDEV(MAJOR(jtag_devt),
> +                                                          jtag->id),
> +                                 NULL, "jtag%d", jtag->id);
> +       if (!jtag->dev)
> +               goto err_device_create;
> +
> +       jtag->open = 0;
> +       dev_set_drvdata(jtag->dev, jtag);
> +       spin_lock_init(&jtag->lock);
> +       mutex_lock(&jtag_mutex);
> +       list_add_tail(&jtag->list, &jtag_list);
> +       mutex_unlock(&jtag_mutex);
> +       return err;
> +
> +err_device_create:
> +       cdev_del(&jtag->cdev);
> +err_cdev:
> +       ida_simple_remove(&jtag_ida, id);
> +       return err;
> +}
> +EXPORT_SYMBOL_GPL(jtag_register);
> +
> +void jtag_unregister(struct jtag *jtag)
> +{
> +       struct device *dev = jtag->dev;
> +
> +       mutex_lock(&jtag_mutex);
> +       list_del(&jtag->list);
> +       mutex_unlock(&jtag_mutex);
> +       cdev_del(&jtag->cdev);
> +       device_unregister(dev);
> +       ida_simple_remove(&jtag_ida, jtag->id);
> +}
> +EXPORT_SYMBOL_GPL(jtag_unregister);
> +
> +static int __init jtag_init(void)
> +{
> +       int err;
> +
> +       err = alloc_chrdev_region(&jtag_devt, 0, 1, "jtag");
> +       if (err)
> +               return err;
> +       return class_register(&jtag_class);
> +}
> +
> +static void __exit jtag_exit(void)
> +{
> +       class_unregister(&jtag_class);
> +}
> +
> +module_init(jtag_init);
> +module_exit(jtag_exit);
> +
> +MODULE_AUTHOR("Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>");
> +MODULE_DESCRIPTION("Generic jtag support");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/jtag.h b/include/linux/jtag.h
> new file mode 100644
> index 0000000..f48ae9d
> --- /dev/null
> +++ b/include/linux/jtag.h
> @@ -0,0 +1,48 @@
> +/*
> + * drivers/jtag/jtag.c
> + *
> + * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
> + * Copyright (c) 2017 Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> + *
> + * Released under the GPLv2 only.
> + * SPDX-License-Identifier: GPL-2.0
> + */
> +
> +#ifndef __JTAG_H
> +#define __JTAG_H
> +
> +#include <uapi/linux/jtag.h>
> +
> +#ifndef ARCH_DMA_MINALIGN
> +#define ARCH_DMA_MINALIGN 1
> +#endif
> +
> +#define jtag_u64_to_ptr(arg) ((void *)(uintptr_t)arg)
> +
> +#define JTAG_MAX_XFER_DATA_LEN 65535
> +
> +struct jtag;
> +/**
> + * struct jtag_ops - callbacks for jtag control functions:
> + *
> + * @freq_get: get frequency function. Filled by device driver
> + * @freq_set: set frequency function. Filled by device driver
> + * @status_get: set status function. Filled by device driver
> + * @idle: set JTAG to idle state function. Filled by device driver
> + * @xfer: send JTAG xfer function. Filled by device driver
> + */
> +struct jtag_ops {
> +       int (*freq_get)(struct jtag *jtag, __u32 *freq);
> +       int (*freq_set)(struct jtag *jtag, __u32 freq);
> +       int (*status_get)(struct jtag *jtag, __u32 *state);
> +       int (*idle)(struct jtag *jtag, struct jtag_run_test_idle *idle);
> +       int (*xfer)(struct jtag *jtag, struct jtag_xfer *xfer);
> +};
> +
> +void *jtag_priv(struct jtag *jtag);
> +int jtag_register(struct jtag *jtag);
> +void jtag_unregister(struct jtag *jtag);
> +struct jtag *jtag_alloc(size_t priv_size, const struct jtag_ops *ops);
> +void jtag_free(struct jtag *jtag);
> +
> +#endif /* __JTAG_H */
> diff --git a/include/uapi/linux/jtag.h b/include/uapi/linux/jtag.h
> new file mode 100644
> index 0000000..af22ea6
> --- /dev/null
> +++ b/include/uapi/linux/jtag.h
> @@ -0,0 +1,111 @@
> +/*
> + * JTAG class driver
> + *
> + * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
> + * Copyright (c) 2017 Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> + *
> + * Released under the GPLv2/BSD.
> + * SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> + */
> +
> +#ifndef __UAPI_LINUX_JTAG_H
> +#define __UAPI_LINUX_JTAG_H
> +
> +/**
> + * enum jtag_xfer_mode:
> + *
> + * @JTAG_XFER_HW_MODE: hardware mode transfer
> + * @JTAG_XFER_SW_MODE: software mode transfer
> + */
> +enum jtag_xfer_mode {
> +       JTAG_XFER_HW_MODE,
> +       JTAG_XFER_SW_MODE,
> +};
> +
> +/**
> + * enum jtag_endstate:
> + *
> + * @JTAG_STATE_IDLE: JTAG state machine IDLE state
> + * @JTAG_STATE_PAUSEIR: JTAG state machine PAUSE_IR state
> + * @JTAG_STATE_PAUSEDR: JTAG state machine PAUSE_DR state
> + */
> +enum jtag_endstate {
> +       JTAG_STATE_IDLE,
> +       JTAG_STATE_PAUSEIR,
> +       JTAG_STATE_PAUSEDR,
> +};
> +
> +/**
> + * enum jtag_xfer_type:
> + *
> + * @JTAG_SIR_XFER: SIR transfer
> + * @JTAG_SDR_XFER: SDR transfer
> + */
> +enum jtag_xfer_type {
> +       JTAG_SIR_XFER,
> +       JTAG_SDR_XFER,
> +};
> +
> +/**
> + * enum jtag_xfer_direction:
> + *
> + * @JTAG_READ_XFER: read transfer
> + * @JTAG_WRITE_XFER: write transfer
> + */
> +enum jtag_xfer_direction {
> +       JTAG_READ_XFER,
> +       JTAG_WRITE_XFER,
> +};
> +
> +/**
> + * struct jtag_run_test_idle - forces JTAG state machine to
> + * RUN_TEST/IDLE state
> + *
> + * @mode: access mode
> + * @reset: 0 - run IDLE/PAUSE from current state
> + *         1 - go through TEST_LOGIC/RESET state before  IDLE/PAUSE
> + * @end: completion flag
> + * @tck: clock counter
> + *
> + * Structure represents interface to JTAG device for jtag idle
> + * execution.
> + */
> +struct jtag_run_test_idle {
> +       __u8    mode;
> +       __u8    reset;
> +       __u8    endstate;
> +       __u8    tck;
> +};
> +
> +/**
> + * struct jtag_xfer - jtag xfer:
> + *
> + * @mode: access mode
> + * @type: transfer type
> + * @direction: xfer direction
> + * @length: xfer bits len
> + * @tdio : xfer data array
> + * @endir: xfer end state
> + *
> + * Structure represents interface to Aspeed JTAG device for jtag sdr xfer
> + * execution.
> + */
> +struct jtag_xfer {
> +       __u8    mode;
> +       __u8    type;
> +       __u8    direction;
> +       __u8    endstate;
> +       __u32   length;
> +       __u64   tdio;
> +};
> +
> +#define __JTAG_IOCTL_MAGIC     0xb2
> +
> +#define JTAG_IOCRUNTEST        _IOW(__JTAG_IOCTL_MAGIC, 0,\
> +                            struct jtag_run_test_idle)
> +#define JTAG_SIOCFREQ  _IOW(__JTAG_IOCTL_MAGIC, 1, unsigned int)
> +#define JTAG_GIOCFREQ  _IOR(__JTAG_IOCTL_MAGIC, 2, unsigned int)
> +#define JTAG_IOCXFER   _IOWR(__JTAG_IOCTL_MAGIC, 3, struct jtag_xfer)
> +#define JTAG_GIOCSTATUS _IOWR(__JTAG_IOCTL_MAGIC, 4, enum jtag_endstate)
> +
> +#endif /* __UAPI_LINUX_JTAG_H */
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks,

Moritz

^ permalink raw reply

* [patch v7 4/4] Documentation: jtag: Add ABI documentation
From: Oleksandr Shamray @ 2017-09-01 16:06 UTC (permalink / raw)
  To: gregkh, arnd
  Cc: linux-kernel, linux-arm-kernel, devicetree, openbmc, joel, jiri,
	tklauser, linux-serial, mec, vadimp, system-sw-low-level, robh+dt,
	openocd-devel-owner, linux-api, davem, mchehab, Oleksandr Shamray
In-Reply-To: <1504281966-6199-1-git-send-email-oleksandrs@mellanox.com>

Added document that describe the ABI for JTAG class drivrer

Signed-off-by: Oleksandr Shamray <oleksandrs@mellanox.com>
---
v6->v7
Comments pointed by Pavel Machek <pavel@ucw.cz>
- Added jtag-cdev documentation to Documentation/ABI/testing folder
---
 Documentation/ABI/testing/jatg-cdev |   27 +++++++++++++++++++++++++++
 MAINTAINERS                         |    1 +
 2 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/jatg-cdev

diff --git a/Documentation/ABI/testing/jatg-cdev b/Documentation/ABI/testing/jatg-cdev
new file mode 100644
index 0000000..14a3610
--- /dev/null
+++ b/Documentation/ABI/testing/jatg-cdev
@@ -0,0 +1,27 @@
+What:		/dev/jtag[0-9]+
+Date:		September 2017
+KernelVersion:	4.14
+Contact:	oleksandrs@mellanox.com
+Description:
+		The character device files /dev/jtag* are the interface
+		between JTAG master interfase and userspace.
+
+		The ioctl(2)-based ABI is defined and documented in
+		[include/uapi]<linux/jtag.h>.
+
+		The following file operations are supported:
+
+		open(2)
+		The argument flag currently support only one access
+		mode O_RDWR.
+
+		ioctl(2)
+		Initiate various actions.
+		See the inline documentation in [include/uapi]<linux/jtag.h>
+		for descriptions of all ioctls.
+
+		close(2)
+		Stops and free up the I/O contexts that was associated
+		with the file descriptor.
+
+Users:		TBD
\ No newline at end of file
diff --git a/MAINTAINERS b/MAINTAINERS
index bfdfa94..dfcf49c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7300,6 +7300,7 @@ F:	include/linux/jtag.h
 F:	include/uapi/linux/jtag.h
 F:	drivers/jtag/
 F:	Documentation/devicetree/bindings/jtag/
+F:	Documentation/ABI/testing/jtag-cdev
 
 K10TEMP HARDWARE MONITORING DRIVER
 M:	Clemens Ladisch <clemens@ladisch.de>
-- 
1.7.1

^ permalink raw reply related

* [patch v7 3/4] Documentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver
From: Oleksandr Shamray @ 2017-09-01 16:06 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, arnd-r2nGTMty4D4
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, openbmc-uLR06cmDAlY/bJ5BZ2RsiQ,
	joel-U3u1mxZcP9KHXe+LvDLADg, jiri-rHqAuBHg3fBzbRFIqnYvSA,
	tklauser-93Khv+1bN0NyDzI6CaY1VQ,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, mec-WqBc5aa1uDFeoWH0uzbU5w,
	vadimp-45czdsxZ+A5DPfheJLI6IQ,
	system-sw-low-level-VPRAkNaXOzVWk0Htik3J/w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	openocd-devel-owner-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-api-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	mchehab-DgEjT+Ai2ygdnm+yROfE0A, Oleksandr Shamray, Jiri Pirko
In-Reply-To: <1504281966-6199-1-git-send-email-oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

It has been tested on Mellanox system with BMC equipped with
Aspeed 2520 SoC for programming CPLD devices.

Signed-off-by: Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Jiri Pirko <jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
V6->v7
Comments pointed by Tobias Klauser <tklauser-93Khv+1bN0NyDzI6CaY1VQ@public.gmane.org>
 - Fix spell "Doccumentation" -> "Documentation"

v5->v6
Comments pointed by Tobias Klauser <tklauser-93Khv+1bN0NyDzI6CaY1VQ@public.gmane.org>
- Small nit: s/documentation/Documentation/

v4->v5

V3->v4
Comments pointed by Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
- delete unnecessary "status" and "reg-shift" descriptions in
  bndings file

v2->v3
Comments pointed by Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
- split Aspeed jtag driver and binding to sepatrate patches
- delete unnecessary "status" and "reg-shift" descriptions in
  bndings file
---
 .../devicetree/bindings/jtag/aspeed-jtag.txt       |   18 ++++++++++++++++++
 MAINTAINERS                                        |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/jtag/aspeed-jtag.txt

diff --git a/Documentation/devicetree/bindings/jtag/aspeed-jtag.txt b/Documentation/devicetree/bindings/jtag/aspeed-jtag.txt
new file mode 100644
index 0000000..f4ded49
--- /dev/null
+++ b/Documentation/devicetree/bindings/jtag/aspeed-jtag.txt
@@ -0,0 +1,18 @@
+Aspeed JTAG driver for ast2400 and ast2500 SoC
+
+Required properties:
+- compatible:		Should be one of
+      - "aspeed,aspeed2400-jtag"
+      - "aspeed,aspeed2500-jtag"
+- reg			contains the offset and length of the JTAG memory
+			region
+- clocks		root clock of bus, should reference the APB clock
+- interrupts		should contain JTAG controller interrupt
+
+Example:
+jtag: jtag@1e6e4000 {
+	compatible = "aspeed,aspeed2500-jtag";
+	reg = <0x1e6e4000 0x1c>;
+	clocks = <&clk_apb>;
+	interrupts = <43>;
+};
diff --git a/MAINTAINERS b/MAINTAINERS
index 141aeaf..bfdfa94 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7299,6 +7299,7 @@ S:	Maintained
 F:	include/linux/jtag.h
 F:	include/uapi/linux/jtag.h
 F:	drivers/jtag/
+F:	Documentation/devicetree/bindings/jtag/
 
 K10TEMP HARDWARE MONITORING DRIVER
 M:	Clemens Ladisch <clemens-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox