diff options
Diffstat (limited to '_to_remove/recipes-kernel')
24 files changed, 1977 insertions, 0 deletions
diff --git a/_to_remove/recipes-kernel/most/files/0002-src-most-add-auto-conf-feature.patch b/_to_remove/recipes-kernel/most/files/0002-src-most-add-auto-conf-feature.patch new file mode 100644 index 000000000..dd811c81b --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0002-src-most-add-auto-conf-feature.patch @@ -0,0 +1,472 @@ +From 9cb7cb85f59509ac445116e9458c502cf6cb74e6 Mon Sep 17 00:00:00 2001 +From: Christian Gromm <christian.gromm@microchip.com> +Date: Thu, 9 Nov 2017 13:20:23 +0100 +Subject: [PATCH 2/2] src: most: add auto conf feature + +This patch adds the auto configuration feature to the driver +sources. It is needed to have the driver configured automatically +upon start up w/o the need for userspace to set up sysfs. + +Signed-off-by: Christian Gromm <christian.gromm@microchip.com> +--- + driver/Makefile | 3 + + driver/default_conf.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++ + driver/include/mostcore.h | 64 ++++++++++++++++++ + driver/mostcore/core.c | 120 ++++++++++++++++++++++++++++------ + 4 files changed, 331 insertions(+), 18 deletions(-) + create mode 100644 driver/default_conf.c + +diff --git a/Makefile b/Makefile +index e77a4b6..6d74ebe 100644 +--- a/Makefile ++++ b/Makefile +@@ -6,6 +6,9 @@ obj-m := mostcore.o + mostcore-y := mostcore/core.o + CFLAGS_core.o := -I$(src)/include/ + ++obj-m += default_conf.o ++CFLAGL_default_conf.o := -I$(src)/include ++ + obj-m += aim_cdev.o + aim_cdev-y := aim-cdev/cdev.o + CFLAGS_cdev.o := -I$(src)/include/ +diff --git a/default_conf.c b/default_conf.c +new file mode 100644 +index 0000000..adb1786 +--- /dev/null ++++ b/default_conf.c +@@ -0,0 +1,162 @@ ++/* ++ * default_conf.c - Default configuration for the MOST channels. ++ * ++ * Copyright (C) 2017, Microchip Technology Germany II GmbH & Co. KG ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * This file is licensed under GPLv2. ++ */ ++ ++#include "include/mostcore.h" ++#include <linux/module.h> ++ ++static struct most_config_probe config_probes[] = { ++ ++ /* OS81118 Control */ ++ { ++ .ch_name = "ep8f", ++ .cfg = { ++ .direction = MOST_CH_RX, ++ .data_type = MOST_CH_CONTROL, ++ .num_buffers = 16, ++ .buffer_size = 64, ++ }, ++ .aim_name = "cdev", ++ .aim_param = "inic-usb-crx", ++ }, ++ { ++ .ch_name = "ep0f", ++ .cfg = { ++ .direction = MOST_CH_TX, ++ .data_type = MOST_CH_CONTROL, ++ .num_buffers = 16, ++ .buffer_size = 64, ++ }, ++ .aim_name = "cdev", ++ .aim_param = "inic-usb-ctx", ++ }, ++ /* OS81118 Async */ ++ { ++ .ch_name = "ep8e", ++ .cfg = { ++ .direction = MOST_CH_RX, ++ .data_type = MOST_CH_ASYNC, ++ .num_buffers = 20, ++ .buffer_size = 1522, ++ }, ++ .aim_name = "networking", ++ .aim_param = "inic-usb-arx", ++ }, ++ { ++ .ch_name = "ep0e", ++ .cfg = { ++ .direction = MOST_CH_TX, ++ .data_type = MOST_CH_ASYNC, ++ .num_buffers = 20, ++ .buffer_size = 1522, ++ }, ++ .aim_name = "networking", ++ .aim_param = "inic-usb-atx", ++ }, ++ /* OS81210 Control */ ++ { ++ .ch_name = "ep87", ++ .cfg = { ++ .direction = MOST_CH_RX, ++ .data_type = MOST_CH_CONTROL, ++ .num_buffers = 16, ++ .buffer_size = 64, ++ }, ++ .aim_name = "cdev", ++ .aim_param = "inic-usb-crx", ++ }, ++ { ++ .ch_name = "ep07", ++ .cfg = { ++ .direction = MOST_CH_TX, ++ .data_type = MOST_CH_CONTROL, ++ .num_buffers = 16, ++ .buffer_size = 64, ++ }, ++ .aim_name = "cdev", ++ .aim_param = "inic-usb-ctx", ++ }, ++ /* OS81210 Async */ ++ { ++ .ch_name = "ep86", ++ .cfg = { ++ .direction = MOST_CH_RX, ++ .data_type = MOST_CH_ASYNC, ++ .num_buffers = 20, ++ .buffer_size = 1522, ++ }, ++ .aim_name = "networking", ++ .aim_param = "inic-usb-arx", ++ }, ++ { ++ .ch_name = "ep06", ++ .cfg = { ++ .direction = MOST_CH_TX, ++ .data_type = MOST_CH_ASYNC, ++ .num_buffers = 20, ++ .buffer_size = 1522, ++ }, ++ .aim_name = "networking", ++ .aim_param = "inic-usb-atx", ++ }, ++ /* Streaming channels (common for all INICs) */ ++ { ++ .ch_name = "ep01", ++ .cfg = { ++ .direction = MOST_CH_TX, ++ .data_type = MOST_CH_SYNC, ++ .num_buffers = 8, ++ .buffer_size = 2 * 12 * 42, ++ .subbuffer_size = 12, ++ .packets_per_xact = 42, ++ }, ++ .aim_name = "sound", ++ .aim_param = "ep01-6ch.6x16", ++ }, ++ { ++ .ch_name = "ep02", ++ .cfg = { ++ .direction = MOST_CH_TX, ++ .data_type = MOST_CH_ISOC, ++ .num_buffers = 8, ++ .buffer_size = 40 * 188, ++ .subbuffer_size = 188, ++ .packets_per_xact = 2, ++ }, ++ .aim_name = "cdev", ++ .aim_param = "inic-usb-itx1", ++ }, ++ ++ /* sentinel */ ++ {} ++}; ++ ++static struct most_config_set config_set = { ++ .probes = config_probes ++}; ++ ++static int __init mod_init(void) ++{ ++ most_register_config_set(&config_set); ++ return 0; ++} ++ ++static void __exit mod_exit(void) ++{ ++ most_deregister_config_set(&config_set); ++} ++ ++module_init(mod_init); ++module_exit(mod_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Andrey Shvetsov <andrey.shvetsov@k2l.de>"); ++MODULE_DESCRIPTION("Default configuration for the MOST channels"); +diff --git a/include/mostcore.h b/include/mostcore.h +index dc87121..3c00efb 100644 +--- a/include/mostcore.h ++++ b/include/mostcore.h +@@ -145,6 +145,39 @@ struct most_channel_config { + u16 dbr_size; + }; + ++/** ++ * struct most_config_probe - matching rule, channel configuration and ++ * the optional AIM name used for the automatic configuration and linking ++ * of the channel ++ * @dev_name: optional matching device id ++ * ("usb_device 1-1:1.0," "dim2-12345678", etc.) ++ * @ch_name: matching channel name ("ep8f", "ca2", etc.) ++ * @cfg: configuration that will be applied for the found channel ++ * @aim_name: optional name of the AIM that will be linked to the channel ++ * ("cdev", "networking", "v4l", "sound") ++ * @aim_param: AIM dependent parameter (it is the character device name ++ * for the cdev AIM, PCM format for the audio AIM, etc.) ++ */ ++struct most_config_probe { ++ const char *dev_name; ++ const char *ch_name; ++ struct most_channel_config cfg; ++ const char *aim_name; ++ const char *aim_param; ++}; ++ ++/** ++ * struct most_config_set - the configuration set containing ++ * several automatic configurations for the different channels ++ * @probes: list of the matching rules and the configurations, ++ * that must be ended with the empty structure ++ * @list: list head used by the MostCore ++ */ ++struct most_config_set { ++ const struct most_config_probe *probes; ++ struct list_head list; ++}; ++ + /* + * struct mbo - MOST Buffer Object. + * @context: context for core completion handler +@@ -285,6 +318,37 @@ struct most_aim { + }; + + /** ++ * most_register_config_set - registers the configuration set ++ * ++ * @cfg_set: configuration set to be registered for the future probes ++ * ++ * The function registers the given configuration set. ++ * ++ * It is possible to register or deregister several configuration sets ++ * independently. Different configuration sets may contain the ++ * overlapped matching rules but later registered configuration set has ++ * the higher priority over the prior registered set. ++ * ++ * The only the first matched configuration is applied for each ++ * channel. ++ * ++ * The configuration for the channel is applied at the time of ++ * registration of the parent most_interface. ++ */ ++void most_register_config_set(struct most_config_set *cfg_set); ++ ++/** ++ * most_deregister_config_set - deregisters the prior registered ++ * configuration set ++ * ++ * @cfg_set: configuration set to be deregistered ++ * ++ * The calling of this function does not change the current ++ * configuration of the channels. ++ */ ++void most_deregister_config_set(struct most_config_set *cfg_set); ++ ++/** + * most_register_interface - Registers instance of the interface. + * @iface: Pointer to the interface instance description. + * +diff --git a/mostcore/core.c b/mostcore/core.c +index 9e0a352..6035cf0 100644 +--- a/mostcore/core.c ++++ b/mostcore/core.c +@@ -36,6 +36,8 @@ static struct class *most_class; + static struct device *core_dev; + static struct ida mdev_id; + static int dummy_num_buffers; ++static struct list_head config_probes; ++struct mutex config_probes_mt; /* config_probes */ + + struct most_c_aim_obj { + struct most_aim *ptr; +@@ -918,6 +920,30 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch) + return c; + } + ++static int link_channel_to_aim(struct most_c_obj *c, struct most_aim *aim, ++ char *aim_param) ++{ ++ int ret; ++ struct most_aim **aim_ptr; ++ ++ if (!c->aim0.ptr) ++ aim_ptr = &c->aim0.ptr; ++ else if (!c->aim1.ptr) ++ aim_ptr = &c->aim1.ptr; ++ else ++ return -ENOSPC; ++ ++ *aim_ptr = aim; ++ ret = aim->probe_channel(c->iface, c->channel_id, ++ &c->cfg, &c->kobj, aim_param); ++ if (ret) { ++ *aim_ptr = NULL; ++ return ret; ++ } ++ ++ return 0; ++} ++ + /** + * add_link_store - store() function for add_link attribute + * @aim_obj: pointer to AIM object +@@ -946,45 +972,33 @@ static ssize_t add_link_store(struct most_aim_obj *aim_obj, + size_t len) + { + struct most_c_obj *c; +- struct most_aim **aim_ptr; + char buffer[STRING_SIZE]; + char *mdev; + char *mdev_ch; +- char *mdev_devnod; ++ char *aim_param; + char devnod_buf[STRING_SIZE]; + int ret; + size_t max_len = min_t(size_t, len + 1, STRING_SIZE); + + strlcpy(buffer, buf, max_len); + +- ret = split_string(buffer, &mdev, &mdev_ch, &mdev_devnod); ++ ret = split_string(buffer, &mdev, &mdev_ch, &aim_param); + if (ret) + return ret; + +- if (!mdev_devnod || *mdev_devnod == 0) { ++ if (!aim_param || *aim_param == 0) { + snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, + mdev_ch); +- mdev_devnod = devnod_buf; ++ aim_param = devnod_buf; + } + + c = get_channel_by_name(mdev, mdev_ch); + if (IS_ERR(c)) + return -ENODEV; + +- if (!c->aim0.ptr) +- aim_ptr = &c->aim0.ptr; +- else if (!c->aim1.ptr) +- aim_ptr = &c->aim1.ptr; +- else +- return -ENOSPC; +- +- *aim_ptr = aim_obj->driver; +- ret = aim_obj->driver->probe_channel(c->iface, c->channel_id, +- &c->cfg, &c->kobj, mdev_devnod); +- if (ret) { +- *aim_ptr = NULL; ++ ret = link_channel_to_aim(c, aim_obj->driver, aim_param); ++ if (ret) + return ret; +- } + + return len; + } +@@ -1679,6 +1693,73 @@ int most_deregister_aim(struct most_aim *aim) + } + EXPORT_SYMBOL_GPL(most_deregister_aim); + ++void most_register_config_set(struct most_config_set *cfg_set) ++{ ++ mutex_lock(&config_probes_mt); ++ list_add(&cfg_set->list, &config_probes); ++ mutex_unlock(&config_probes_mt); ++} ++EXPORT_SYMBOL(most_register_config_set); ++ ++void most_deregister_config_set(struct most_config_set *cfg_set) ++{ ++ mutex_lock(&config_probes_mt); ++ list_del(&cfg_set->list); ++ mutex_unlock(&config_probes_mt); ++} ++EXPORT_SYMBOL(most_deregister_config_set); ++ ++static int probe_aim(struct most_c_obj *c, ++ const char *aim_name, const char *aim_param) ++{ ++ struct most_aim_obj *aim_obj; ++ char buf[STRING_SIZE]; ++ ++ list_for_each_entry(aim_obj, &aim_list, list) { ++ if (!strcmp(aim_obj->driver->name, aim_name)) { ++ strlcpy(buf, aim_param ? aim_param : "", sizeof(buf)); ++ return link_channel_to_aim(c, aim_obj->driver, buf); ++ } ++ } ++ return 0; ++} ++ ++static bool probe_config_set(struct most_c_obj *c, ++ const char *dev_name, const char *ch_name, ++ const struct most_config_probe *p) ++{ ++ int err; ++ ++ for (; p->ch_name; p++) { ++ if ((p->dev_name && strcmp(dev_name, p->dev_name)) || ++ strcmp(ch_name, p->ch_name)) ++ continue; ++ ++ c->cfg = p->cfg; ++ if (p->aim_name) { ++ err = probe_aim(c, p->aim_name, p->aim_param); ++ if (err) ++ pr_err("failed to autolink %s to %s: %d\n", ++ ch_name, p->aim_name, err); ++ } ++ return true; ++ } ++ return false; ++} ++ ++static void find_configuration(struct most_c_obj *c, const char *dev_name, ++ const char *ch_name) ++{ ++ struct most_config_set *plist; ++ ++ mutex_lock(&config_probes_mt); ++ list_for_each_entry(plist, &config_probes, list) { ++ if (probe_config_set(c, dev_name, ch_name, plist->probes)) ++ break; ++ } ++ mutex_unlock(&config_probes_mt); ++} ++ + /** + * most_register_interface - registers an interface with core + * @iface: pointer to the instance of the interface description. +@@ -1777,6 +1858,7 @@ struct kobject *most_register_interface(struct most_interface *iface) + mutex_init(&c->start_mutex); + mutex_init(&c->nq_mutex); + list_add_tail(&c->list, &inst->channel_list); ++ find_configuration(c, iface->description, channel_name); + } + pr_info("registered new MOST device mdev%d (%s)\n", + inst->dev_id, iface->description); +@@ -1880,6 +1962,8 @@ static int __init most_init(void) + pr_info("init()\n"); + INIT_LIST_HEAD(&instance_list); + INIT_LIST_HEAD(&aim_list); ++ INIT_LIST_HEAD(&config_probes); ++ mutex_init(&config_probes_mt); + ida_init(&mdev_id); + + err = bus_register(&most_bus); +-- +2.7.4 + diff --git a/_to_remove/recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch b/_to_remove/recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch new file mode 100644 index 000000000..4703844a1 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch @@ -0,0 +1,26 @@ +From b269994be937cbb31c0d73ecc899ca8a545a6a4a Mon Sep 17 00:00:00 2001 +From: Christian Gromm <christian.gromm@microchip.com> +Date: Mon, 4 Sep 2017 11:09:17 +0200 +Subject: [PATCH 3/5] core: remove kernel log for MBO status + +Signed-off-by: Christian Gromm <christian.gromm@microchip.com> +--- + driver/mostcore/core.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mostcore/core.c b/mostcore/core.c +index 931efb9..595becc 100644 +--- a/mostcore/core.c ++++ b/mostcore/core.c +@@ -1348,8 +1348,6 @@ static void most_write_completion(struct mbo *mbo) + BUG_ON((!mbo) || (!mbo->context)); + + c = mbo->context; +- if (mbo->status == MBO_E_INVAL) +- pr_info("WARN: Tx MBO status: invalid\n"); + if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE))) + trash_mbo(mbo); + else +-- +2.7.4 + diff --git a/_to_remove/recipes-kernel/most/files/0004-most-video-set-device_caps.patch b/_to_remove/recipes-kernel/most/files/0004-most-video-set-device_caps.patch new file mode 100644 index 000000000..010d4b0d0 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0004-most-video-set-device_caps.patch @@ -0,0 +1,25 @@ +From a5fd2ae8d4a3b2a8f7a33a4ea469ea7ee0d946ef Mon Sep 17 00:00:00 2001 +From: Christian Gromm <christian.gromm@microchip.com> +Date: Mon, 4 Sep 2017 15:36:38 +0200 +Subject: [PATCH 4/5] most: video: set device_caps + +Signed-off-by: Christian Gromm <christian.gromm@microchip.com> +--- + driver/aim-v4l2/video.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/aim-v4l2/video.c b/aim-v4l2/video.c +index e074841..6405a03 100644 +--- a/aim-v4l2/video.c ++++ b/aim-v4l2/video.c +@@ -263,6 +263,7 @@ static int vidioc_querycap(struct file *file, void *priv, + snprintf(cap->bus_info, sizeof(cap->bus_info), + "%s", mdev->iface->description); + ++ cap->device_caps = + cap->capabilities = + V4L2_CAP_READWRITE | + V4L2_CAP_TUNER | +-- +2.7.4 + diff --git a/_to_remove/recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch b/_to_remove/recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch new file mode 100644 index 000000000..ebaee9e14 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch @@ -0,0 +1,25 @@ +From 7518453386ad3e82008186a6c9ca86ed8c136801 Mon Sep 17 00:00:00 2001 +From: Christian Gromm <christian.gromm@microchip.com> +Date: Mon, 4 Sep 2017 16:08:38 +0200 +Subject: [PATCH 5/5] most: video: set V4L2_CAP_DEVICE_CAPS flag + +Signed-off-by: Christian Gromm <christian.gromm@microchip.com> +--- + driver/aim-v4l2/video.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/aim-v4l2/video.c b/aim-v4l2/video.c +index 6405a03..db75d4d 100644 +--- a/aim-v4l2/video.c ++++ b/aim-v4l2/video.c +@@ -265,6 +265,7 @@ static int vidioc_querycap(struct file *file, void *priv, + + cap->device_caps = + cap->capabilities = ++ V4L2_CAP_DEVICE_CAPS | + V4L2_CAP_READWRITE | + V4L2_CAP_TUNER | + V4L2_CAP_VIDEO_CAPTURE; +-- +2.7.4 + diff --git a/_to_remove/recipes-kernel/most/files/0006-dim2-fix-startup-sequence.patch b/_to_remove/recipes-kernel/most/files/0006-dim2-fix-startup-sequence.patch new file mode 100644 index 000000000..59c6ae671 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0006-dim2-fix-startup-sequence.patch @@ -0,0 +1,186 @@ +From 63bcd9b421ae7927948bffec9566db47f40ea290 Mon Sep 17 00:00:00 2001 +From: Andrey Shvetsov <andrey.shvetsov@k2l.de> +Date: Tue, 30 Jan 2018 17:34:09 +0100 +Subject: [PATCH] staging: most: dim2: fix startup sequence + +Platform specific initializations (pdata->init) must be done before DIM2 +IP module startup (dim_startup). + +Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> +--- + hdm-dim2/dim2_hdm.c | 90 +++++++++++++++++++++++++++++++++++++++--------------------------------------------------- + 1 file changed, 39 insertions(+), 51 deletions(-) + +diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c +index 893b8e4..e4629a5 100644 +--- a/hdm-dim2/dim2_hdm.c ++++ b/hdm-dim2/dim2_hdm.c +@@ -155,38 +155,6 @@ void dimcb_on_error(u8 error_id, const char *error_message) + } + + /** +- * startup_dim - initialize the dim2 interface +- * @pdev: platform device +- */ +-static int startup_dim(struct platform_device *pdev) +-{ +- struct dim2_hdm *dev = platform_get_drvdata(pdev); +- struct dim2_platform_data *pdata = pdev->dev.platform_data; +- u8 hal_ret; +- int ret; +- +- if (!pdata) { +- pr_err("missing platform data\n"); +- return -EINVAL; +- } +- +- ret = pdata->init ? pdata->init(pdata, dev->io_base) : 0; +- if (ret) +- return ret; +- +- pr_info("sync: num of frames per sub-buffer: %u\n", fcnt); +- hal_ret = dim_startup(dev->io_base, pdata->clk_speed, fcnt); +- if (hal_ret != DIM_NO_ERROR) { +- pr_err("dim_startup failed: %d\n", hal_ret); +- if (pdata && pdata->destroy) +- pdata->destroy(pdata); +- return -ENODEV; +- } +- +- return 0; +-} +- +-/** + * try_start_dim_transfer - try to transfer a buffer on a channel + * @hdm_ch: channel specific data + * +@@ -727,10 +695,12 @@ static void dma_free(struct mbo *mbo, u32 size) + */ + static int dim2_probe(struct platform_device *pdev) + { ++ struct dim2_platform_data *pdata = pdev->dev.platform_data; + struct dim2_hdm *dev; + struct resource *res; + int ret, i; + struct kobject *kobj; ++ u8 hal_ret; + int irq; + + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); +@@ -745,38 +715,59 @@ static int dim2_probe(struct platform_device *pdev) + if (IS_ERR(dev->io_base)) + return PTR_ERR(dev->io_base); + ++ if (!pdata) { ++ dev_err(&pdev->dev, "missing platform data\n"); ++ return -EINVAL; ++ } ++ ++ ret = pdata->init ? pdata->init(pdata, dev->io_base) : 0; ++ if (ret) ++ return ret; ++ ++ dev_info(&pdev->dev, "sync: num of frames per sub-buffer: %u\n", fcnt); ++ hal_ret = dim_startup(dev->io_base, pdata->clk_speed, fcnt); ++ if (hal_ret != DIM_NO_ERROR) { ++ dev_err(&pdev->dev, "dim_startup failed: %d\n", hal_ret); ++ ret = -ENODEV; ++ goto err_bsp_destroy; ++ } ++ + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "failed to get ahb0_int irq: %d\n", irq); +- return irq; ++ ret = irq; ++ goto err_shutdown_dim; + } + + ret = devm_request_irq(&pdev->dev, irq, dim2_ahb_isr, 0, + "dim2_ahb0_int", dev); + if (ret) { + dev_err(&pdev->dev, "failed to request ahb0_int irq %d\n", irq); +- return ret; ++ goto err_shutdown_dim; + } + + irq = platform_get_irq(pdev, 1); + if (irq < 0) { + dev_err(&pdev->dev, "failed to get mlb_int irq: %d\n", irq); +- return irq; ++ ret = irq; ++ goto err_shutdown_dim; + } + + ret = devm_request_irq(&pdev->dev, irq, dim2_mlb_isr, 0, + "dim2_mlb_int", dev); + if (ret) { + dev_err(&pdev->dev, "failed to request mlb_int irq %d\n", irq); +- return ret; ++ goto err_shutdown_dim; + } + + init_waitqueue_head(&dev->netinfo_waitq); + dev->deliver_netinfo = 0; +- dev->netinfo_task = kthread_run(&deliver_netinfo_thread, (void *)dev, ++ dev->netinfo_task = kthread_run(&deliver_netinfo_thread, dev, + "dim2_netinfo"); +- if (IS_ERR(dev->netinfo_task)) +- return PTR_ERR(dev->netinfo_task); ++ if (IS_ERR(dev->netinfo_task)) { ++ ret = PTR_ERR(dev->netinfo_task); ++ goto err_shutdown_dim; ++ } + + for (i = 0; i < DMA_CHANNELS; i++) { + struct most_channel_capability *cap = dev->capabilities + i; +@@ -833,20 +824,17 @@ static int dim2_probe(struct platform_device *pdev) + if (ret) + goto err_unreg_iface; + +- ret = startup_dim(pdev); +- if (ret) { +- dev_err(&pdev->dev, "failed to initialize DIM2\n"); +- goto err_destroy_bus; +- } +- + return 0; + +-err_destroy_bus: +- dim2_sysfs_destroy(&dev->bus); + err_unreg_iface: + most_deregister_interface(&dev->most_iface); + err_stop_thread: + kthread_stop(dev->netinfo_task); ++err_shutdown_dim: ++ dim_shutdown(); ++err_bsp_destroy: ++ if (pdata && pdata->destroy) ++ pdata->destroy(pdata); + + return ret; + } +@@ -863,6 +851,10 @@ static int dim2_remove(struct platform_device *pdev) + struct dim2_platform_data *pdata = pdev->dev.platform_data; + unsigned long flags; + ++ dim2_sysfs_destroy(&dev->bus); ++ most_deregister_interface(&dev->most_iface); ++ kthread_stop(dev->netinfo_task); ++ + spin_lock_irqsave(&dim_lock, flags); + dim_shutdown(); + spin_unlock_irqrestore(&dim_lock, flags); +@@ -870,10 +862,6 @@ static int dim2_remove(struct platform_device *pdev) + if (pdata && pdata->destroy) + pdata->destroy(pdata); + +- dim2_sysfs_destroy(&dev->bus); +- most_deregister_interface(&dev->most_iface); +- kthread_stop(dev->netinfo_task); +- + /* + * break link to local platform_device_id struct + * to prevent crash by unload platform device module +-- +libgit2 0.26.0 diff --git a/_to_remove/recipes-kernel/most/files/0007-dim2-use-device-tree.patch b/_to_remove/recipes-kernel/most/files/0007-dim2-use-device-tree.patch new file mode 100644 index 000000000..679fab79c --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0007-dim2-use-device-tree.patch @@ -0,0 +1,378 @@ +From 8e16207392cd715ea88f6780981a3d55ab005588 Mon Sep 17 00:00:00 2001 +From: Andrey Shvetsov <andrey.shvetsov@k2l.de> +Date: Mon, 12 Feb 2018 12:23:37 +0100 +Subject: [PATCH] staging: most: dim2: use device tree + +Current dim2 driver expects the existence of a platform driver that +implements the platform specific initialization and delivery of the irq +numbers. + +This patch integrates the device tree activity and platform specific +code into the driver. + +Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> +--- + hdm-dim2/dim2_hdm.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------- + hdm-dim2/dim2_hdm.h | 28 ---------------------------- + hdm-dim2/platform/dim2_arwen_mlb3.c | 165 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + hdm-dim2/platform/dim2_arwen_mlb6.c | 169 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + hdm-dim2/platform/dim2_h2_dt.c | 227 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + hdm-dim2/platform/dim2_mx6q.c | 192 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + hdm-dim2/platform/dim2_mx6q_dt.c | 224 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7 files changed, 193 insertions(+), 1034 deletions(-) + delete mode 100644 hdm-dim2/dim2_hdm.h + delete mode 100644 hdm-dim2/platform/dim2_arwen_mlb3.c + delete mode 100644 hdm-dim2/platform/dim2_arwen_mlb6.c + delete mode 100644 hdm-dim2/platform/dim2_h2_dt.c + delete mode 100644 hdm-dim2/platform/dim2_mx6q.c + delete mode 100644 hdm-dim2/platform/dim2_mx6q_dt.c + +diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c +index e4629a5..2dba917 100644 +--- a/hdm-dim2/dim2_hdm.c ++++ b/hdm-dim2/dim2_hdm.c +@@ -14,6 +14,7 @@ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + #include <linux/module.h> ++#include <linux/of_platform.h> + #include <linux/printk.h> + #include <linux/kernel.h> + #include <linux/init.h> +@@ -21,13 +22,13 @@ + #include <linux/interrupt.h> + #include <linux/slab.h> + #include <linux/io.h> ++#include <linux/clk.h> + #include <linux/dma-mapping.h> + #include <linux/sched.h> + #include <linux/kthread.h> + + #include <mostcore.h> + #include "dim2_hal.h" +-#include "dim2_hdm.h" + #include "dim2_errors.h" + #include "dim2_sysfs.h" + +@@ -93,6 +94,9 @@ struct dim2_hdm { + struct most_interface most_iface; + char name[16 + sizeof "dim2-"]; + void __iomem *io_base; ++ u8 clk_speed; ++ struct clk *clk; ++ struct clk *clk_pll; + struct task_struct *netinfo_task; + wait_queue_head_t netinfo_waitq; + int deliver_netinfo; +@@ -102,6 +106,12 @@ struct dim2_hdm { + struct medialb_bus bus; + void (*on_netinfo)(struct most_interface *, + unsigned char, unsigned char *); ++ void (*disable_platform)(struct platform_device *); ++}; ++ ++struct dim2_platform_data { ++ int (*enable)(struct platform_device *); ++ void (*disable)(struct platform_device *); + }; + + #define iface_to_hdm(iface) container_of(iface, struct dim2_hdm, most_iface) +@@ -686,6 +696,8 @@ static void dma_free(struct mbo *mbo, u32 size) + dma_free_coherent(NULL, size, mbo->virt_address, mbo->bus_address); + } + ++static const struct of_device_id dim2_of_match[]; ++ + /* + * dim2_probe - dim2 probe handler + * @pdev: platform device structure +@@ -695,7 +707,7 @@ static void dma_free(struct mbo *mbo, u32 size) + */ + static int dim2_probe(struct platform_device *pdev) + { +- struct dim2_platform_data *pdata = pdev->dev.platform_data; ++ const struct dim2_platform_data *pdata; + struct dim2_hdm *dev; + struct resource *res; + int ret, i; +@@ -703,6 +715,8 @@ static int dim2_probe(struct platform_device *pdev) + u8 hal_ret; + int irq; + ++ enum { MLB_INT_IDX, AHB0_INT_IDX }; ++ + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; +@@ -710,29 +724,30 @@ static int dim2_probe(struct platform_device *pdev) + dev->atx_idx = -1; + + platform_set_drvdata(pdev, dev); ++ ++ dev->clk_speed = CLK_4096FS; ++ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + dev->io_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(dev->io_base)) + return PTR_ERR(dev->io_base); + +- if (!pdata) { +- dev_err(&pdev->dev, "missing platform data\n"); +- return -EINVAL; +- } +- +- ret = pdata->init ? pdata->init(pdata, dev->io_base) : 0; ++ pdata = of_match_node(dim2_of_match, pdev->dev.of_node)->data; ++ ret = pdata && pdata->enable ? pdata->enable(pdev) : 0; + if (ret) + return ret; + ++ dev->disable_platform = pdata ? pdata->disable : 0; ++ + dev_info(&pdev->dev, "sync: num of frames per sub-buffer: %u\n", fcnt); +- hal_ret = dim_startup(dev->io_base, pdata->clk_speed, fcnt); ++ hal_ret = dim_startup(dev->io_base, dev->clk_speed, fcnt); + if (hal_ret != DIM_NO_ERROR) { + dev_err(&pdev->dev, "dim_startup failed: %d\n", hal_ret); + ret = -ENODEV; +- goto err_bsp_destroy; ++ goto err_disable_platform; + } + +- irq = platform_get_irq(pdev, 0); ++ irq = platform_get_irq(pdev, AHB0_INT_IDX); + if (irq < 0) { + dev_err(&pdev->dev, "failed to get ahb0_int irq: %d\n", irq); + ret = irq; +@@ -746,7 +761,7 @@ static int dim2_probe(struct platform_device *pdev) + goto err_shutdown_dim; + } + +- irq = platform_get_irq(pdev, 1); ++ irq = platform_get_irq(pdev, MLB_INT_IDX); + if (irq < 0) { + dev_err(&pdev->dev, "failed to get mlb_int irq: %d\n", irq); + ret = irq; +@@ -832,9 +847,9 @@ static int dim2_probe(struct platform_device *pdev) + kthread_stop(dev->netinfo_task); + err_shutdown_dim: + dim_shutdown(); +-err_bsp_destroy: +- if (pdata && pdata->destroy) +- pdata->destroy(pdata); ++err_disable_platform: ++ if (dev->disable_platform) ++ dev->disable_platform(pdev); + + return ret; + } +@@ -848,7 +863,6 @@ static int dim2_probe(struct platform_device *pdev) + static int dim2_remove(struct platform_device *pdev) + { + struct dim2_hdm *dev = platform_get_drvdata(pdev); +- struct dim2_platform_data *pdata = pdev->dev.platform_data; + unsigned long flags; + + dim2_sysfs_destroy(&dev->bus); +@@ -859,37 +873,187 @@ static int dim2_remove(struct platform_device *pdev) + dim_shutdown(); + spin_unlock_irqrestore(&dim_lock, flags); + +- if (pdata && pdata->destroy) +- pdata->destroy(pdata); ++ if (dev->disable_platform) ++ dev->disable_platform(pdev); ++ ++ return 0; ++} ++ ++/* platform specific functions [[ */ ++ ++static int fsl_mx6_enable(struct platform_device *pdev) ++{ ++ struct dim2_hdm *dev = platform_get_drvdata(pdev); ++ int ret; ++ ++ dev->clk = devm_clk_get(&pdev->dev, "mlb"); ++ if (IS_ERR_OR_NULL(dev->clk)) { ++ dev_err(&pdev->dev, "unable to get mlb clock\n"); ++ return -EFAULT; ++ } ++ ++ ret = clk_prepare_enable(dev->clk); ++ if (ret) { ++ dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed"); ++ return ret; ++ } ++ ++ if (dev->clk_speed >= CLK_2048FS) { ++ /* enable pll */ ++ dev->clk_pll = devm_clk_get(&pdev->dev, "pll8_mlb"); ++ if (IS_ERR_OR_NULL(dev->clk_pll)) { ++ dev_err(&pdev->dev, "unable to get mlb pll clock\n"); ++ clk_disable_unprepare(dev->clk); ++ return -EFAULT; ++ } ++ ++ writel(0x888, dev->io_base + 0x38); ++ clk_prepare_enable(dev->clk_pll); ++ } ++ ++ return 0; ++} ++ ++static void fsl_mx6_disable(struct platform_device *pdev) ++{ ++ struct dim2_hdm *dev = platform_get_drvdata(pdev); ++ ++ if (dev->clk_speed >= CLK_2048FS) ++ clk_disable_unprepare(dev->clk_pll); ++ ++ clk_disable_unprepare(dev->clk); ++} ++ ++static int rcar_h2_enable(struct platform_device *pdev) ++{ ++ struct dim2_hdm *dev = platform_get_drvdata(pdev); ++ int ret; ++ ++ dev->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(dev->clk)) { ++ dev_err(&pdev->dev, "cannot get clock\n"); ++ return PTR_ERR(dev->clk); ++ } ++ ++ ret = clk_prepare_enable(dev->clk); ++ if (ret) { ++ dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed"); ++ return ret; ++ } ++ ++ if (dev->clk_speed >= CLK_2048FS) { ++ /* enable MLP pll and LVDS drivers */ ++ writel(0x03, dev->io_base + 0x600); ++ /* set bias */ ++ writel(0x888, dev->io_base + 0x38); ++ } else { ++ /* PLL */ ++ writel(0x04, dev->io_base + 0x600); ++ } ++ + +- /* +- * break link to local platform_device_id struct +- * to prevent crash by unload platform device module +- */ +- pdev->id_entry = NULL; ++ /* BBCR = 0b11 */ ++ writel(0x03, dev->io_base + 0x500); ++ writel(0x0002FF02, dev->io_base + 0x508); + + return 0; + } + +-static const struct platform_device_id dim2_id[] = { +- { "medialb_dim2" }, +- { }, /* Terminating entry */ ++static void rcar_h2_disable(struct platform_device *pdev) ++{ ++ struct dim2_hdm *dev = platform_get_drvdata(pdev); ++ ++ clk_disable_unprepare(dev->clk); ++ ++ /* disable PLLs and LVDS drivers */ ++ writel(0x0, dev->io_base + 0x600); ++} ++ ++static int rcar_m3_enable(struct platform_device *pdev) ++{ ++ struct dim2_hdm *dev = platform_get_drvdata(pdev); ++ u32 enable_512fs = dev->clk_speed == CLK_512FS; ++ int ret; ++ ++ dev->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(dev->clk)) { ++ dev_err(&pdev->dev, "cannot get clock\n"); ++ return PTR_ERR(dev->clk); ++ } ++ ++ ret = clk_prepare_enable(dev->clk); ++ if (ret) { ++ dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed"); ++ return ret; ++ } ++ ++ /* PLL */ ++ writel(0x04, dev->io_base + 0x600); ++ ++ writel(enable_512fs, dev->io_base + 0x604); ++ ++ /* BBCR = 0b11 */ ++ writel(0x03, dev->io_base + 0x500); ++ writel(0x0002FF02, dev->io_base + 0x508); ++ ++ return 0; ++} ++ ++static void rcar_m3_disable(struct platform_device *pdev) ++{ ++ struct dim2_hdm *dev = platform_get_drvdata(pdev); ++ ++ clk_disable_unprepare(dev->clk); ++ ++ /* disable PLLs and LVDS drivers */ ++ writel(0x0, dev->io_base + 0x600); ++} ++ ++/* ]] platform specific functions */ ++ ++enum dim2_platforms { FSL_MX6, RCAR_H2, RCAR_M3 }; ++ ++static struct dim2_platform_data plat_data[] = { ++ [FSL_MX6] = { .enable = fsl_mx6_enable, .disable = fsl_mx6_disable }, ++ [RCAR_H2] = { .enable = rcar_h2_enable, .disable = rcar_h2_disable }, ++ [RCAR_M3] = { .enable = rcar_m3_enable, .disable = rcar_m3_disable }, ++}; ++ ++static const struct of_device_id dim2_of_match[] = { ++ { ++ .compatible = "fsl,imx6q-mlb150", ++ .data = plat_data + FSL_MX6 ++ }, ++ { ++ .compatible = "renesas,mlp", ++ .data = plat_data + RCAR_H2 ++ }, ++ { ++ .compatible = "rcar,medialb-dim2", ++ .data = plat_data + RCAR_M3 ++ }, ++ { ++ .compatible = "xlnx,axi4-os62420_3pin-1.00.a", ++ }, ++ { ++ .compatible = "xlnx,axi4-os62420_6pin-1.00.a", ++ }, ++ {}, + }; + +-MODULE_DEVICE_TABLE(platform, dim2_id); ++MODULE_DEVICE_TABLE(of, dim2_of_match); + + static struct platform_driver dim2_driver = { + .probe = dim2_probe, + .remove = dim2_remove, +- .id_table = dim2_id, + .driver = { + .name = "hdm_dim2", ++ .of_match_table = dim2_of_match, + }, + }; + + module_platform_driver(dim2_driver); + +-MODULE_AUTHOR("Jain Roy Ambi <JainRoy.Ambi@microchip.com>"); + MODULE_AUTHOR("Andrey Shvetsov <andrey.shvetsov@k2l.de>"); + MODULE_DESCRIPTION("MediaLB DIM2 Hardware Dependent Module"); + MODULE_LICENSE("GPL"); +libgit2 0.26.0 diff --git a/_to_remove/recipes-kernel/most/files/0008-dim2-read-clock-speed-from-the-device-tree.patch b/_to_remove/recipes-kernel/most/files/0008-dim2-read-clock-speed-from-the-device-tree.patch new file mode 100644 index 000000000..1b01fb156 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0008-dim2-read-clock-speed-from-the-device-tree.patch @@ -0,0 +1,92 @@ +From 839ad403a2d8081a6c15f6fc2836b01919338f3c Mon Sep 17 00:00:00 2001 +From: Andrey Shvetsov <andrey.shvetsov@k2l.de> +Date: Mon, 12 Feb 2018 12:24:37 +0100 +Subject: [PATCH] staging: most: dim2: read clock speed from the device tree + +This implements reading of the clock speed parameter from the device +tree. + +Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> +--- + Documentation/devicetree/bindings/inic/microchip,inic-dim2.txt | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + hdm-dim2/dim2_hdm.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 113 insertions(+), 1 deletion(-) + create mode 100644 Documentation/devicetree/bindings/inic/microchip,inic-dim2.txt + +diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c +index 2dba917..05e1896 100644 +--- a/hdm-dim2/dim2_hdm.c ++++ b/hdm-dim2/dim2_hdm.c +@@ -698,6 +698,42 @@ static void dma_free(struct mbo *mbo, u32 size) + + static const struct of_device_id dim2_of_match[]; + ++static struct { ++ const char *clock_speed; ++ u8 clk_speed; ++} clk_mt[] = { ++ { "256fs", CLK_256FS }, ++ { "512fs", CLK_512FS }, ++ { "1024fs", CLK_1024FS }, ++ { "2048fs", CLK_2048FS }, ++ { "3072fs", CLK_3072FS }, ++ { "4096fs", CLK_4096FS }, ++ { "6144fs", CLK_6144FS }, ++ { "8192fs", CLK_8192FS }, ++}; ++ ++/** ++ * get_dim2_clk_speed - converts string to DIM2 clock speed value ++ * ++ * @clock_speed: string in the format "{NUMBER}fs" ++ * @val: pointer to get one of the CLK_{NUMBER}FS values ++ * ++ * By success stores one of the CLK_{NUMBER}FS in the *val and returns 0, ++ * otherwise returns -EINVAL. ++ */ ++static int get_dim2_clk_speed(const char *clock_speed, u8 *val) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(clk_mt); i++) { ++ if (!strcmp(clock_speed, clk_mt[i].clock_speed)) { ++ *val = clk_mt[i].clk_speed; ++ return 0; ++ } ++ } ++ return -EINVAL; ++} ++ + /* + * dim2_probe - dim2 probe handler + * @pdev: platform device structure +@@ -708,6 +744,7 @@ static const struct of_device_id dim2_of_match[]; + static int dim2_probe(struct platform_device *pdev) + { + const struct dim2_platform_data *pdata; ++ const char *clock_speed; + struct dim2_hdm *dev; + struct resource *res; + int ret, i; +@@ -725,7 +762,18 @@ static int dim2_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, dev); + +- dev->clk_speed = CLK_4096FS; ++ ret = of_property_read_string(pdev->dev.of_node, ++ "microchip,clock-speed", &clock_speed); ++ if (ret) { ++ dev_err(&pdev->dev, "missing dt property clock-speed\n"); ++ return ret; ++ } ++ ++ ret = get_dim2_clk_speed(clock_speed, &dev->clk_speed); ++ if (ret) { ++ dev_err(&pdev->dev, "bad dt property clock-speed\n"); ++ return ret; ++ } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + dev->io_base = devm_ioremap_resource(&pdev->dev, res); +-- +libgit2 0.26.0 diff --git a/_to_remove/recipes-kernel/most/files/0009-dim2-use-device-for-coherent-memory-allocation.patch b/_to_remove/recipes-kernel/most/files/0009-dim2-use-device-for-coherent-memory-allocation.patch new file mode 100644 index 000000000..08cd6f99d --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0009-dim2-use-device-for-coherent-memory-allocation.patch @@ -0,0 +1,47 @@ +From 756f2f1f90524c2620ed7951e436d13bdb929a6b Mon Sep 17 00:00:00 2001 +From: Andrey Shvetsov <andrey.shvetsov@k2l.de> +Date: Mon, 12 Feb 2018 12:25:37 +0100 +Subject: [PATCH] staging: most: dim2: use device for coherent memory allocation + +On several modern architectures the allocation of coherent memory needs +a device that has the dma_ops properly set. This patch enables use of +the DIM2 platform device for the allocation process. + +Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> +--- + hdm-dim2/dim2_hdm.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c +index 05e1896..1847091 100644 +--- a/hdm-dim2/dim2_hdm.c ++++ b/hdm-dim2/dim2_hdm.c +@@ -688,12 +688,16 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx) + + static void *dma_alloc(struct mbo *mbo, u32 size) + { +- return dma_alloc_coherent(NULL, size, &mbo->bus_address, GFP_KERNEL); ++ struct device *dev = mbo->ifp->dev; ++ ++ return dma_alloc_coherent(dev, size, &mbo->bus_address, GFP_KERNEL); + } + + static void dma_free(struct mbo *mbo, u32 size) + { +- dma_free_coherent(NULL, size, mbo->virt_address, mbo->bus_address); ++ struct device *dev = mbo->ifp->dev; ++ ++ dma_free_coherent(dev, size, mbo->virt_address, mbo->bus_address); + } + + static const struct of_device_id dim2_of_match[]; +@@ -875,6 +879,7 @@ static int dim2_probe(struct platform_device *pdev) + dev->most_iface.poison_channel = poison_channel; + dev->most_iface.request_netinfo = request_netinfo; + dev->most_iface.extra_attrs = DBR_ATTRS; ++ dev->most_iface.dev = &pdev->dev; + + kobj = most_register_interface(&dev->most_iface); + if (IS_ERR(kobj)) { +-- +libgit2 0.26.0 diff --git a/_to_remove/recipes-kernel/most/files/0010-backport-usb-setup-timer.patch b/_to_remove/recipes-kernel/most/files/0010-backport-usb-setup-timer.patch new file mode 100644 index 000000000..ff21b2130 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0010-backport-usb-setup-timer.patch @@ -0,0 +1,35 @@ +From 8eaec876f732c7e4b238ada5f9304c6da2380eb1 Mon Sep 17 00:00:00 2001 +From: Andrey Shvetsov <andrey.shvetsov@k2l.de> +Date: Fri, 8 Feb 2019 22:44:32 +0000 +Subject: [PATCH] backport: usb: setup_timer + +--- + driver/hdm-usb/hdm_usb.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/hdm-usb/hdm_usb.c b/hdm-usb/hdm_usb.c +index 5b0af88..9896835 100644 +--- a/hdm-usb/hdm_usb.c ++++ b/hdm-usb/hdm_usb.c +@@ -760,9 +760,9 @@ static void hdm_request_netinfo(struct most_interface *iface, int channel, + * The handler runs in interrupt context. That's why we need to defer the + * tasks to a work queue. + */ +-static void link_stat_timer_handler(unsigned long data) ++static void link_stat_timer_handler(struct timer_list *t) + { +- struct most_dev *mdev = (struct most_dev *)data; ++ struct most_dev *mdev = from_timer(mdev, t, link_stat_timer); + + schedule_work(&mdev->poll_work_obj); + mdev->link_stat_timer.expires = jiffies + (2 * HZ); +@@ -1154,8 +1154,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) + num_endpoints = usb_iface_desc->desc.bNumEndpoints; + mutex_init(&mdev->io_mutex); + INIT_WORK(&mdev->poll_work_obj, wq_netinfo); +- setup_timer(&mdev->link_stat_timer, link_stat_timer_handler, +- (unsigned long)mdev); ++ timer_setup(&mdev->link_stat_timer, link_stat_timer_handler, 0); + + mdev->usb_device = usb_dev; + mdev->link_stat_timer.expires = jiffies + (2 * HZ); diff --git a/_to_remove/recipes-kernel/most/files/0011-handle-snd_pcm_lib_mmap_vmalloc-removal.patch b/_to_remove/recipes-kernel/most/files/0011-handle-snd_pcm_lib_mmap_vmalloc-removal.patch new file mode 100644 index 000000000..d4383c4f6 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0011-handle-snd_pcm_lib_mmap_vmalloc-removal.patch @@ -0,0 +1,30 @@ +Handle snd_pcm_lib_mmap_vmalloc removal in 4.19 + +Add .mmap field back to pcm_ops for kernels older than 4.19. + +Upstream-Status: Inappropriate + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +diff --git a/aim-sound/sound.c b/aim-sound/sound.c +index 4b3329b..c0a26be 100644 +--- a/aim-sound/sound.c ++++ b/aim-sound/sound.c +@@ -17,6 +17,7 @@ + #include <linux/printk.h> + #include <linux/kernel.h> + #include <linux/init.h> ++#include <linux/version.h> + #include <sound/core.h> + #include <sound/pcm.h> + #include <sound/pcm_params.h> +@@ -463,6 +464,9 @@ static const struct snd_pcm_ops pcm_ops = { + .trigger = pcm_trigger, + .pointer = pcm_pointer, + .page = snd_pcm_lib_get_vmalloc_page, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0) ++ .mmap = snd_pcm_lib_mmap_vmalloc, ++#endif + }; + + static int split_arg_list(char *buf, char **card_name, u16 *ch_num, diff --git a/_to_remove/recipes-kernel/most/files/0012-Fix-build-with-5.4-kernel.patch b/_to_remove/recipes-kernel/most/files/0012-Fix-build-with-5.4-kernel.patch new file mode 100644 index 000000000..02eca27d2 --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0012-Fix-build-with-5.4-kernel.patch @@ -0,0 +1,68 @@ +From 877d7475413bb787deb07aa83bafac03efa399fa Mon Sep 17 00:00:00 2001 +From: Paul Barker <paul.barker@sancloud.co.uk> +Date: Mon, 24 Feb 2020 14:58:52 +0000 +Subject: [PATCH] Fix build with 5.4 kernel + +Signed-off-by: Paul Barker <paul.barker@sancloud.co.uk> +--- + driver/Makefile | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 281241d..609e692 100644 +--- a/Makefile ++++ b/Makefile +@@ -5,6 +5,7 @@ SRC := $(shell pwd) + obj-m := mostcore.o + mostcore-y := mostcore/core.o + CFLAGS_core.o := -I$(src)/include/ ++CFLAGS_mostcore/core.o := -I$(src)/include/ + + obj-m += default_conf.o + CFLAGL_default_conf.o := -I$(src)/include +@@ -12,33 +13,41 @@ CFLAGL_default_conf.o := -I$(src)/include + obj-m += aim_cdev.o + aim_cdev-y := aim-cdev/cdev.o + CFLAGS_cdev.o := -I$(src)/include/ ++CFLAGS_aim-cdev/cdev.o := -I$(src)/include/ + + obj-m += aim_network.o + aim_network-y := aim-network/networking.o + CFLAGS_networking.o := -I$(src)/include/ ++CFLAGS_aim-network/networking.o := -I$(src)/include/ + + obj-m += aim_sound.o + aim_sound-y := aim-sound/sound.o + CFLAGS_sound.o := -I$(src)/include/ ++CFLAGS_aim-sound/sound.o := -I$(src)/include/ + + obj-m += aim_v4l2.o + aim_v4l2-y := aim-v4l2/video.o + CFLAGS_video.o := -Idrivers/media/video -I$(src)/include/ ++CFLAGS_aim-v4l2/video.o := -Idrivers/media/video -I$(src)/include/ + + obj-m += hdm_i2c.o + hdm_i2c-y := hdm-i2c/hdm_i2c.o + CFLAGS_hdm_i2c.o := -I$(src)/include/ ++CFLAGS_hdm-i2c/hdm_i2c.o := -I$(src)/include/ + + ifdef CONFIG_OF + obj-m += hdm_dim2.o + hdm_dim2-y := hdm-dim2/dim2_hdm.o hdm-dim2/dim2_hal.o hdm-dim2/dim2_sysfs.o + CFLAGS_dim2_hdm.o := -I$(src)/include/ ++CFLAGS_hdm-dim2/dim2_hdm.o := -I$(src)/include/ ++CFLAGS_hdm-dim2/dim2_hal.o := -I$(src)/include/ ++CFLAGS_hdm-dim2/dim2_sysfs.o := -I$(src)/include/ + endif + + obj-m += hdm_usb.o + hdm_usb-y := hdm-usb/hdm_usb.o + CFLAGS_hdm_usb.o := -I$(src)/include/ +- ++CFLAGS_hdm-usb/hdm_usb.o := -I$(src)/include/ + + all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules +-- +2.20.1 + diff --git a/_to_remove/recipes-kernel/most/files/0013-Fix-build-with-5.7-kernel.patch b/_to_remove/recipes-kernel/most/files/0013-Fix-build-with-5.7-kernel.patch new file mode 100644 index 000000000..85e38857c --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0013-Fix-build-with-5.7-kernel.patch @@ -0,0 +1,54 @@ +Fix building against 5.7 or newer kernels + +VFL_TYPE_GRABBER was renamed VFL_TYPE_VIDEO in 5.7. Marking as +inappropriate for upstream for now, as it seems the standalone +version of the driver has been superceded by the version in the +staging tree in the mainline kernel, and there are no obvious +signs of maintenance. + +Upstream-Status: Inappropriate [no upstream] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- +diff --git a/aim-v4l2/video.c b/aim-v4l2/video.c +index db75d4d..fbf7139 100644 +--- a/aim-v4l2/video.c ++++ b/aim-v4l2/video.c +@@ -14,6 +14,7 @@ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + #include <linux/module.h> ++#include <linux/version.h> + #include <linux/slab.h> + #include <linux/init.h> + #include <linux/device.h> +@@ -31,6 +32,11 @@ + + #define V4L2_AIM_MAX_INPUT 1 + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0) ++/* Handle pre-5.7 naming */ ++#define VFL_TYPE_VIDEO VFL_TYPE_GRABBER ++#endif ++ + static struct most_aim aim_info; + + struct most_video_dev { +@@ -82,7 +88,7 @@ static int aim_vdev_open(struct file *filp) + v4l2_info(&mdev->v4l2_dev, "aim_vdev_open()\n"); + + switch (vdev->vfl_type) { +- case VFL_TYPE_GRABBER: ++ case VFL_TYPE_VIDEO: + break; + default: + return -EINVAL; +@@ -461,7 +467,7 @@ static int aim_register_videodev(struct most_video_dev *mdev) + + /* Register the v4l2 device */ + video_set_drvdata(mdev->vdev, mdev); +- ret = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1); ++ ret = video_register_device(mdev->vdev, VFL_TYPE_VIDEO, -1); + if (ret) { + v4l2_err(&mdev->v4l2_dev, "video_register_device failed (%d)\n", + ret); diff --git a/_to_remove/recipes-kernel/most/files/0014-Fix-build-with-5.9-kernel.patch b/_to_remove/recipes-kernel/most/files/0014-Fix-build-with-5.9-kernel.patch new file mode 100644 index 000000000..fd430c9df --- /dev/null +++ b/_to_remove/recipes-kernel/most/files/0014-Fix-build-with-5.9-kernel.patch @@ -0,0 +1,39 @@ +Fix building against 5.9 or newer kernels + +DECLARE_TASKLET was replaced with DECLARE_TASKLET_OLD in 5.9. +Marking as inappropriate for upstream for now, as it seems the +standalone version of the driver has been superceded by the version +in the staging tree in the mainline kernel, and there are no obvious +signs of maintenance. + +Upstream-Status: Inappropriate [no upstream] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- + driver/hdm-dim2/dim2_hdm.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c +index 1847091..fc02c6b 100644 +--- a/hdm-dim2/dim2_hdm.c ++++ b/hdm-dim2/dim2_hdm.c +@@ -14,6 +14,7 @@ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + #include <linux/module.h> ++#include <linux/version.h> + #include <linux/of_platform.h> + #include <linux/printk.h> + #include <linux/kernel.h> +@@ -53,7 +54,11 @@ MODULE_PARM_DESC(fcnt, "Num of frames per sub-buffer for sync channels as a powe + static DEFINE_SPINLOCK(dim_lock); + + static void dim2_tasklet_fn(unsigned long data); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + static DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn, 0); ++#else ++static DECLARE_TASKLET_OLD(dim2_tasklet, dim2_tasklet_fn); ++#endif + + /** + * struct hdm_channel - private structure to keep channel specific data diff --git a/_to_remove/recipes-kernel/most/most.bb b/_to_remove/recipes-kernel/most/most.bb new file mode 100644 index 000000000..f709a6d9a --- /dev/null +++ b/_to_remove/recipes-kernel/most/most.bb @@ -0,0 +1,14 @@ +DESCRIPTION = "Build MOST driver" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://mostcore/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" + +inherit module + +PV = "0.1" + +SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/most;protocol=https;branch=${AGL_BRANCH}" + +S = "${WORKDIR}/git/driver" +SRCREV = "e4dbbaf9e7652efaed0df3e0aab4464f5f228573" + +KERNEL_MODULE_AUTOLOAD += "aim_cdev aim_sound aim_network aim_v4l2 hdm_i2c hdm_dim2 hdm_usb mostcore" diff --git a/_to_remove/recipes-kernel/most/most.bbappend b/_to_remove/recipes-kernel/most/most.bbappend new file mode 100644 index 000000000..af7ea687e --- /dev/null +++ b/_to_remove/recipes-kernel/most/most.bbappend @@ -0,0 +1,17 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://0002-src-most-add-auto-conf-feature.patch \ + file://0003-core-remove-kernel-log-for-MBO-status.patch \ + file://0004-most-video-set-device_caps.patch \ + file://0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch \ + file://0006-dim2-fix-startup-sequence.patch \ + file://0007-dim2-use-device-tree.patch \ + file://0008-dim2-read-clock-speed-from-the-device-tree.patch \ + file://0009-dim2-use-device-for-coherent-memory-allocation.patch \ + file://0010-backport-usb-setup-timer.patch \ + file://0011-handle-snd_pcm_lib_mmap_vmalloc-removal.patch \ + file://0012-Fix-build-with-5.4-kernel.patch \ + file://0013-Fix-build-with-5.7-kernel.patch \ + file://0014-Fix-build-with-5.9-kernel.patch \ +" diff --git a/_to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch b/_to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch new file mode 100644 index 000000000..99d6183ab --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch @@ -0,0 +1,27 @@ +From 04ffb4b8f828c19e914987e271aaf3aa7eab28bf Mon Sep 17 00:00:00 2001 +From: Yuichi Kusakabe <yuichi.kusakabe@denso-ten.com> +Date: Thu, 29 Nov 2018 22:12:00 +0900 +Subject: [PATCH] Disable sllin driver debug log + +Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@denso-ten.com> +--- + sllin/sllin.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 77b2cb8..133d6e9 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -41,7 +41,9 @@ + * Funded by: Volkswagen Group Research + */ + ++#if 0 + #define DEBUG 1 /* Enables pr_debug() printouts */ ++#endif + + #include <linux/module.h> + #include <linux/moduleparam.h> +-- +2.7.4 + diff --git a/_to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch b/_to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch new file mode 100644 index 000000000..7db57802b --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch @@ -0,0 +1,21 @@ +diff --git a/sllin/Makefile b/sllin/Makefile +index 8ae7510..037846f 100644 +--- a/sllin/Makefile ++++ b/sllin/Makefile +@@ -1,10 +1,11 @@ + obj-m += sllin.o +-KPATH=/lib/modules/$(shell uname -r)/build ++KPATH=$(KERNEL_SRC) + #KPATH=/mnt/data/_dokumenty_/_w_/_dce_can_/src/can-benchmark/kernel/build/shark/3.0.4 + #KPATH=/mnt/data/_dokumenty_/_w_/_dce_can_/src/can-benchmark/kernel/build/shark/2.6.36 +- ++SRC := $(shell pwd) + all: +- make -C ${KPATH} M=$(PWD) modules +- ++ make -C ${KPATH} M=$(SRC) modules ++modules_install: ++ make -C ${KPATH} M=$(SRC) modules_install + clean: +- make -C ${KPATH} M=$(PWD) clean ++ make -C ${KPATH} M=$(SRC) clean diff --git a/_to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch b/_to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch new file mode 100644 index 000000000..896e2680d --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch @@ -0,0 +1,176 @@ +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 2db896f..2969448 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -869,7 +869,6 @@ static int sllin_send_tx_buff(struct sllin *sl) + #else + remains = sl->tx_lim - sl->tx_cnt; + #endif +- + res = tty->ops->write(tty, sl->tx_buff + sl->tx_cnt, remains); + if (res < 0) + goto error_in_write; +@@ -916,10 +915,25 @@ static int sllin_send_break(struct sllin *sl) + unsigned long break_baud; + int res; + ++ netdev_dbg(sl->dev, "%s()#<BREAK_BY_BAUD> invoke.\n", __func__); ++ if (tty == NULL) { ++ netdev_dbg(sl->dev, "%s() tty == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } ++ if (tty->ops == NULL) { ++ netdev_dbg(sl->dev, "%s() tty->ops == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } + break_baud = ((sl->lin_baud * 2) / 3); + sltty_change_speed(tty, break_baud); + +- tty->ops->flush_buffer(tty); ++ if (tty->ops->flush_buffer) { ++ tty->ops->flush_buffer(tty); ++ } else { ++ netdev_dbg(sl->dev, "%s() tty->ops->flush_buffer is NULL.\n", __func__); ++ } + sl->rx_cnt = SLLIN_BUFF_BREAK; + + sl->rx_expect = SLLIN_BUFF_BREAK + 1; +@@ -943,6 +957,17 @@ static int sllin_send_break(struct sllin *sl) + unsigned long usleep_range_min; + unsigned long usleep_range_max; + ++ netdev_dbg(sl->dev, "%s() invoke.\n", __func__); ++ if (tty == NULL) { ++ netdev_dbg(sl->dev, "%s() tty == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } ++ if (tty->ops == NULL) { ++ netdev_dbg(sl->dev, "%s() tty->ops == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } + break_baud = ((sl->lin_baud * 2) / 3); + sl->rx_cnt = SLLIN_BUFF_BREAK; + sl->rx_expect = SLLIN_BUFF_BREAK + 1; +@@ -950,21 +975,31 @@ static int sllin_send_break(struct sllin *sl) + + /* Do the break ourselves; Inspired by + http://lxr.linux.no/#linux+v3.1.2/drivers/tty/tty_io.c#L2452 */ +- retval = tty->ops->break_ctl(tty, -1); +- if (retval) +- return retval; ++ if (tty->ops->break_ctl) { ++ retval = tty->ops->break_ctl(tty, -1); ++ if (retval) ++ return retval; ++ } else { ++ netdev_dbg(sl->dev, "%s() tty->ops->break_ctl is NULL.\n", __func__); ++ } + + /* udelay(712); */ + usleep_range_min = (1000000l * SLLIN_SAMPLES_PER_CHAR) / break_baud; + usleep_range_max = usleep_range_min + 50; + usleep_range(usleep_range_min, usleep_range_max); + +- retval = tty->ops->break_ctl(tty, 0); ++ if(tty->ops->break_ctl) { ++ retval = tty->ops->break_ctl(tty, 0); ++ } + usleep_range_min = (1000000l * 1 /* 1 bit */) / break_baud; + usleep_range_max = usleep_range_min + 30; + usleep_range(usleep_range_min, usleep_range_max); + +- tty->ops->flush_buffer(tty); ++ if ( tty->ops->flush_buffer) { ++ tty->ops->flush_buffer(tty); ++ } else { ++ netdev_dbg(sl->dev, "%s() tty->ops->flush_buffer is NULL.\n", __func__); ++ } + + sl->tx_cnt = SLLIN_BUFF_SYNC; + +@@ -1028,6 +1063,12 @@ static int sllin_kwthread(void *ptr) + int lin_dlc; + u8 lin_data_buff[SLLIN_DATA_MAX]; + ++ if (sl == NULL) { ++ pr_err("sllin: sl is NULL\n"); ++ } ++ if (sl->dev == NULL) { ++ pr_err("sllin: sl->dev is NULL\n"); ++ } + + if ((sl->lin_state == SLSTATE_IDLE) && sl->lin_master && + sl->id_to_send) { +@@ -1036,6 +1077,7 @@ static int sllin_kwthread(void *ptr) + } + } + ++ netdev_dbg(sl->dev, "sllin_kthread <WAIT_EVENT>\n"); + wait_event_killable(sl->kwt_wq, kthread_should_stop() || + test_bit(SLF_RXEVENT, &sl->flags) || + test_bit(SLF_TXEVENT, &sl->flags) || +@@ -1046,6 +1088,7 @@ static int sllin_kwthread(void *ptr) + (sl->lin_state == SLSTATE_RESPONSE_WAIT)) + && test_bit(SLF_MSGEVENT, &sl->flags))); + ++ netdev_dbg(sl->dev, "sllin_kthread <WAKEUPED>\n"); + if (test_and_clear_bit(SLF_RXEVENT, &sl->flags)) { + netdev_dbg(sl->dev, "sllin_kthread RXEVENT\n"); + } +@@ -1078,21 +1121,25 @@ static int sllin_kwthread(void *ptr) + sl->lin_state = SLSTATE_IDLE; + } + ++ netdev_dbg(sl->dev, "sllin_kthread: lin_state <%08x>\n",sl->lin_state); + switch (sl->lin_state) { + case SLSTATE_IDLE: + if (!test_bit(SLF_MSGEVENT, &sl->flags)) + break; +- ++ if (sl->tx_req_skb == NULL) ++ netdev_dbg(sl->dev, "sl->tx_req_skb == NULL\n"); ++ if (sl->tx_req_skb->data == NULL) ++ netdev_dbg(sl->dev, "sl->tx_req_skb->data == NULL\n"); + cf = (struct can_frame *)sl->tx_req_skb->data; + + /* SFF RTR CAN frame -> LIN header */ + if (cf->can_id & CAN_RTR_FLAG) { + struct sllin_conf_entry *sce; + +- netdev_dbg(sl->dev, "%s: RTR SFF CAN frame, ID = %x\n", +- __func__, cf->can_id & LIN_ID_MASK); + + sce = &sl->linfr_cache[cf->can_id & LIN_ID_MASK]; ++ netdev_dbg(sl->dev, "%s: RTR SFF CAN frame, ID = %x dlc=%d\n", ++ __func__, cf->can_id & LIN_ID_MASK, sce->dlc); + spin_lock_irqsave(&sl->linfr_lock, flags); + + /* Is there Slave response in linfr_cache to be sent? */ +@@ -1114,8 +1161,8 @@ static int sllin_kwthread(void *ptr) + spin_unlock_irqrestore(&sl->linfr_lock, flags); + + } else { /* SFF NON-RTR CAN frame -> LIN header + LIN response */ +- netdev_dbg(sl->dev, "%s: NON-RTR SFF CAN frame, ID = %x\n", +- __func__, (int)cf->can_id & LIN_ID_MASK); ++ netdev_dbg(sl->dev, "%s: NON-RTR SFF CAN frame, ID = %x\n dlc=%d", ++ __func__, (int)cf->can_id & LIN_ID_MASK, cf->can_dlc); + + lin_data = cf->data; + lin_dlc = cf->can_dlc; +@@ -1140,6 +1187,7 @@ static int sllin_kwthread(void *ptr) + hrtimer_start(&sl->rx_timer, + ktime_add(ktime_get(), sl->rx_timer_timeout), + HRTIMER_MODE_ABS); ++ netdev_dbg(sl->dev, "sllin_kthread: SLSTATE finish\n"); + break; + + case SLSTATE_BREAK_SENT: +@@ -1654,3 +1702,4 @@ static void __exit sllin_exit(void) + + module_init(sllin_init); + module_exit(sllin_exit); ++ diff --git a/_to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch b/_to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch new file mode 100644 index 000000000..c8f2f9268 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch @@ -0,0 +1,69 @@ +From fcebb8f510bbb5c681f1f9af4506b4de241837dd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org> +Date: Wed, 31 Oct 2018 20:48:20 +0000 +Subject: [PATCH] Allow recent kernels newer 4.11.x to build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +API changes enforce porting. + +Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org> +--- + sllin/sllin.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 2969448..7e17127 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -56,7 +56,12 @@ + #include <linux/rtnetlink.h> + #include <linux/if_arp.h> + #include <linux/if_ether.h> ++#include <linux/version.h> ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) + #include <linux/sched.h> ++#else ++#include <uapi/linux/sched/types.h> ++#endif + #include <linux/delay.h> + #include <linux/init.h> + #include <linux/can.h> +@@ -447,7 +451,9 @@ static int sll_open(struct net_device *dev) + static void sll_free_netdev(struct net_device *dev) + { + int i = dev->base_addr; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9) + free_netdev(dev); ++#endif + sllin_devs[i] = NULL; + } + +@@ -460,7 +466,12 @@ static const struct net_device_ops sll_netdev_ops = { + static void sll_setup(struct net_device *dev) + { + dev->netdev_ops = &sll_netdev_ops; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9) + dev->destructor = sll_free_netdev; ++#else ++ dev->needs_free_netdev = true; ++ dev->priv_destructor = sll_free_netdev; ++#endif + + dev->hard_header_len = 0; + dev->addr_len = 0; +@@ -1685,8 +1696,10 @@ static void __exit sllin_exit(void) + sl = netdev_priv(dev); + if (sl->tty) { + netdev_dbg(sl->dev, "tty discipline still running\n"); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9) + /* Intentionally leak the control block. */ + dev->destructor = NULL; ++#endif + } + + unregister_netdev(dev); +-- +2.13.7 + diff --git a/_to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch b/_to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch new file mode 100644 index 000000000..f3bcda9fe --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch @@ -0,0 +1,48 @@ +Use sched_set_fifo on newer kernels + +The 5.9 kernel removed the export of sched_setscheduler, use +the new sched_set_fifo API if building on 5.9 or newer. There +is a slight difference in resulting priority level, the new +API will yield a priority of 50 instead of the explicit value +of 40 being used with sched_setscheduler, but this should not +be an issue. + +Upstream-Status: Inappropriate [no upstream] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 133d6e9..92c52ad 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -1059,14 +1059,20 @@ static int sllin_kwthread(void *ptr) + { + struct sllin *sl = (struct sllin *)ptr; + struct tty_struct *tty = sl->tty; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + struct sched_param schparam = { .sched_priority = 40 }; ++#endif + int tx_bytes = 0; /* Used for Network statistics */ + unsigned long flags; + int lin_id; + struct sllin_conf_entry *sce; + + netdev_dbg(sl->dev, "sllin_kwthread started.\n"); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + sched_setscheduler(current, SCHED_FIFO, &schparam); ++#else ++ sched_set_fifo(current); ++#endif + + clear_bit(SLF_ERROR, &sl->flags); + sltty_change_speed(tty, sl->lin_baud); +@@ -1274,8 +1280,8 @@ slstate_response_wait: + sl->lin_state = SLSTATE_RESPONSE_WAIT_BUS; + } + } ++ fallthrough; + +- /* Be aware, no BREAK here */ + case SLSTATE_RESPONSE_WAIT_BUS: + if (sl->rx_cnt < sl->rx_expect) + continue; diff --git a/_to_remove/recipes-kernel/sllin/files/lin_config.conf b/_to_remove/recipes-kernel/sllin/files/lin_config.conf new file mode 100644 index 000000000..9775b8b39 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/lin_config.conf @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--PCAN-LIN CT profile.--> +<PCLIN_PROFILE Version="1"> + <LIN Group="2"> + <Scheduler_Entries Count="1"> + <!-- Poll steering wheel adapter at address 0x21 every 100 ms --> + <Entry Time="100">33</Entry> + </Scheduler_Entries> + </LIN> +</PCLIN_PROFILE> diff --git a/_to_remove/recipes-kernel/sllin/files/sllin-demo.service b/_to_remove/recipes-kernel/sllin/files/sllin-demo.service new file mode 100644 index 000000000..e3e7432f3 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/sllin-demo.service @@ -0,0 +1,14 @@ +[Unit] +Description=LIN demo configuration +ConditionPathExists=/dev/ttyUSB0 +After=afm-system-daemon.service +Before=can-dev-mapping-helper.service + +[Service] +Type=forking +PIDFile=/run/lin_config/lin_config.pid +ExecStart=/usr/bin/start_lin_demo.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/_to_remove/recipes-kernel/sllin/files/start_lin_demo.sh b/_to_remove/recipes-kernel/sllin/files/start_lin_demo.sh new file mode 100755 index 000000000..c7627ca74 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/start_lin_demo.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# Attach serial LIN->CAN bridge and set up LIN polling +if [ -c /dev/ttyUSB0 ]; then + sleep 1 + /usr/bin/lin_config -c /etc/lin_config.conf -a sllin:/dev/ttyUSB0 + mkdir -p /run/lin_config/ + pidof lin_config > /run/lin_config/lin_config.pid + sleep 1 +else + ip link add dev sllin0 type vcan +fi +ip link set sllin0 up + +# Initialize HVAC controller +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 02A# +usleep 100000 +cansend sllin0 02B# +usleep 100000 +cansend sllin0 032#F0F8FFFFFFFFFFFF +usleep 100000 +cansend sllin0 032#F0F8FFFFFFFFFFFF +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 02D# +usleep 100000 +cansend sllin0 02C# +usleep 100000 +cansend sllin0 02D# +usleep 100000 +cansend sllin0 02C# +usleep 100000 + diff --git a/_to_remove/recipes-kernel/sllin/sllin.bb b/_to_remove/recipes-kernel/sllin/sllin.bb new file mode 100644 index 000000000..cc72b3095 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/sllin.bb @@ -0,0 +1,45 @@ +DESCRIPTION = "slLIN driver module" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://sllin.c;beginline=7;endline=37;md5=6408e14dba951f8cbe3c2a003a0d89d2" + +inherit module systemd + +DEPENDS = "virtual/kernel" + +SRC_URI = "git://github.com/trainman419/linux-lin.git;protocol=https" +SRCREV = "155d885e8ccc907a56f6c86c4b159fac27ef6fec" +S = "${WORKDIR}/git/sllin" + +PV = "0.1+git${SRCPV}" + +SRC_URI:append = " \ + file://0001_update_makefile.patch;pnum=2 \ + file://0002_fix_null_operation_check.patch;pnum=2 \ + file://0003-Allow-recent-kernels-newer-4.11.x-to-build.patch;pnum=2 \ + file://0001-Disable-sllin-driver-debug-log.patch;pnum=2 \ + file://0004-Fix-build-with-5.9-kernel.patch;pnum=2 \ + file://sllin-demo.service \ + file://start_lin_demo.sh \ + file://lin_config.conf \ +" + +KERNEL_MODULE_AUTOLOAD:append = " sllin" +KERNEL_MODULE_PROBECONF:append = " sllin" + +SLLINBAUDRATE ??= "9600" +module_conf_sllin = "options sllin baudrate=${SLLINBAUDRATE}" + +SYSTEMD_SERVICE:${PN} = "sllin-demo.service" + +do_install:append () { + install -d 644 ${D}/${bindir} + install -m 755 ${WORKDIR}/start_lin_demo.sh ${D}/${bindir}/start_lin_demo.sh + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/sllin-demo.service ${D}${systemd_system_unitdir}/ + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/lin_config.conf ${D}${sysconfdir}/ +} + +FILES:${PN} += "${bindir}/start_lin_demo.sh ${sysconfdir}/lin_config.conf" + +RDEPENDS:${PN} += "lin-config" |