From fdfca33350150644481096f1c7a80db2b670cdec Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 7 Mar 2020 22:45:55 +0100 Subject: [PATCH 01/14] Revert "kernel: rewrite run_parsers_by_type() to use add_mtd_partitions()" This reverts commit 15a0701cdde8eeae2a54880b813cdb8cdc09a384. It was reported that this patch breaks on some cases the JFFS2 overlay filesystem on targets still using kernel 4.14. This includes ar71xx, where spurious erase of the ART was reported. Revert this commit for now. Re-adding should probaby also be done for every currently supported kernel version. Ref: FS#2837 FS#2862 FS#2864 Signed-off-by: David Bauer --- ...for-different-partition-parser-types.patch | 33 ++++++++++++------- ...arsers-for-rootfs-and-firmware-split.patch | 4 +-- .../404-mtd-add-more-helper-functions.patch | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch index ae13112ef6..057d473684 100644 --- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch @@ -20,35 +20,44 @@ Signed-off-by: Gabor Juhos /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve -@@ -762,6 +766,27 @@ int mtd_del_partition(struct mtd_info *m +@@ -762,6 +766,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); +static int +run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) +{ -+ struct mtd_partitions pparts = { }; -+ int err; ++ struct mtd_partition *parts; ++ int nr_parts; ++ int i; + -+ pparts.nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, -+ &pparts.parts, NULL); -+ if (pparts.nr_parts <= 0) -+ return pparts.nr_parts; ++ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, ++ NULL); ++ if (nr_parts <= 0) ++ return nr_parts; + -+ if (WARN_ON(!pparts.parts)) ++ if (WARN_ON(!parts)) + return 0; + -+ err = add_mtd_partitions(&slave->mtd, pparts.parts, pparts.nr_parts); ++ for (i = 0; i < nr_parts; i++) { ++ /* adjust partition offsets */ ++ parts[i].offset += slave->offset; + -+ kfree(pparts.parts); ++ mtd_add_partition(slave->parent, ++ parts[i].name, ++ parts[i].offset, ++ parts[i].size); ++ } + -+ return err ? err : pparts.nr_parts; ++ kfree(parts); ++ ++ return nr_parts; +} + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -1147,6 +1172,61 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -1147,6 +1181,61 @@ void mtd_part_parser_cleanup(struct mtd_ } } diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 149c328ac4..2cc06dd463 100644 --- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -795,6 +795,7 @@ run_parsers_by_type(struct mtd_part *sla +@@ -804,6 +804,7 @@ run_parsers_by_type(struct mtd_part *sla static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos } static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -@@ -804,6 +805,12 @@ static void mtd_partition_split(struct m +@@ -813,6 +814,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch index d1a32872af..7b481ffb47 100644 --- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1251,6 +1251,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1260,6 +1260,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); From ddf1832207d462c5b95f3d7de26f8cdf83d3a1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 3 Mar 2020 11:10:14 +0100 Subject: [PATCH 02/14] linux: generic: 5.4: add missing config symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those symbols popped up while building imx6 with all targets enabled. Signed-off-by: Petr Štetiar --- target/linux/generic/config-5.4 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 9fa393a8c8..fc3e157e9b 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -1306,6 +1306,7 @@ CONFIG_DQL=y # CONFIG_DRM_FBDEV_EMULATION is not set # CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set # CONFIG_DRM_FSL_DCU is not set +# CONFIG_DRM_GM12U320 is not set # CONFIG_DRM_GMA500 is not set # CONFIG_DRM_HDLCD is not set # CONFIG_DRM_HISI_HIBMC is not set @@ -1316,8 +1317,10 @@ CONFIG_DQL=y # CONFIG_DRM_I2C_NXP_TDA998X is not set # CONFIG_DRM_I2C_SIL164 is not set # CONFIG_DRM_I915 is not set +# CONFIG_DRM_KOMEDA is not set # CONFIG_DRM_LEGACY is not set # CONFIG_DRM_LIB_RANDOM is not set +# CONFIG_DRM_LIMA is not set # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set # CONFIG_DRM_LVDS_ENCODER is not set # CONFIG_DRM_MALI_DISPLAY is not set @@ -1332,8 +1335,10 @@ CONFIG_DQL=y # CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set # CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set # CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set +# CONFIG_DRM_PANEL_LG_LB035Q02 is not set # CONFIG_DRM_PANEL_LG_LG4573 is not set # CONFIG_DRM_PANEL_LVDS is not set +# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set # CONFIG_DRM_PANEL_ORISETECH_OTM8009A is not set # CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set # CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set @@ -1344,8 +1349,13 @@ CONFIG_DQL=y # CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set # CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set # CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set # CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set +# CONFIG_DRM_PANFROST is not set +# CONFIG_DRM_TOSHIBA_TC358764 is not set +# CONFIG_DRM_TI_SN65DSI86 is not set # CONFIG_DRM_PARADE_PS8622 is not set # CONFIG_DRM_PL111 is not set # CONFIG_DRM_QXL is not set @@ -5043,6 +5053,7 @@ CONFIG_SND_PROC_FS=y # CONFIG_SND_SOC_GTM601 is not set # CONFIG_SND_SOC_ICS43432 is not set # CONFIG_SND_SOC_IMG is not set +# CONFIG_SND_SOC_IMX_AUDMIX is not set # CONFIG_SND_SOC_IMX_AUDMUX is not set # CONFIG_SND_SOC_IMX_ES8328 is not set # CONFIG_SND_SOC_IMX_SPDIF is not set From ea1823a8673a3f10aca418ca64b765f5c5a6e58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sun, 23 Feb 2020 21:45:05 +0100 Subject: [PATCH 03/14] kernel: iio: split buffer modules into separate packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise we would need to enable IIO_TRIGGERED_BUFFER symbol in all kernels in order to be able to use any of the IIO modules which are utilizing triggered buffer based data acquisition method. Acked-by: Stijn Tintel Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/iio.mk | 56 +++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index 986838c0ae..430f318951 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -12,14 +12,9 @@ define KernelPackage/iio-core KCONFIG:= \ CONFIG_IIO \ CONFIG_IIO_BUFFER=y \ - CONFIG_IIO_KFIFO_BUF \ - CONFIG_IIO_TRIGGER=y \ - CONFIG_IIO_TRIGGERED_BUFFER - FILES:= \ - $(LINUX_DIR)/drivers/iio/industrialio.ko \ - $(if $(CONFIG_IIO_TRIGGERED_BUFFER),$(LINUX_DIR)/drivers/iio/buffer/industrialio-triggered-buffer.ko) \ - $(LINUX_DIR)/drivers/iio/buffer/kfifo_buf.ko - AUTOLOAD:=$(call AutoLoad,55,industrialio kfifo_buf industrialio-triggered-buffer) + CONFIG_IIO_TRIGGER=y + FILES:=$(LINUX_DIR)/drivers/iio/industrialio.ko + AUTOLOAD:=$(call AutoLoad,55,industrialio) endef define KernelPackage/iio-core/description @@ -31,9 +26,42 @@ endef $(eval $(call KernelPackage,iio-core)) +define KernelPackage/iio-kfifo-buf + SUBMENU:=$(IIO_MENU) + TITLE:=Industrial I/O buffering based on kfifo + DEPENDS:=+kmod-iio-core + KCONFIG:=CONFIG_IIO_KFIFO_BUF + FILES:=$(LINUX_DIR)/drivers/iio/buffer/kfifo_buf.ko + AUTOLOAD:=$(call AutoLoad,55,kfifo_buf) +endef + +define KernelPackage/iio-kfifo-buf/description + A simple fifo based on kfifo. Note that this currently provides no buffer + events so it is up to userspace to work out how often to read from the buffer. +endef + +$(eval $(call KernelPackage,iio-kfifo-buf)) + + +define KernelPackage/industrialio-triggered-buffer + SUBMENU:=$(IIO_MENU) + TITLE:=Provides helper functions for setting up triggered buffers. + DEPENDS:=+kmod-iio-core +kmod-iio-kfifo-buf + KCONFIG:=CONFIG_IIO_TRIGGERED_BUFFER + FILES:=$(LINUX_DIR)/drivers/iio/buffer/industrialio-triggered-buffer.ko + AUTOLOAD:=$(call AutoLoad,55,industrialio-triggered-buffer) +endef + +define KernelPackage/industrialio-triggered-buffer/description + Provides helper functions for setting up triggered buffers. +endef + +$(eval $(call KernelPackage,industrialio-triggered-buffer)) + + define KernelPackage/iio-ad799x SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer TITLE:=Analog Devices AD799x ADC driver KCONFIG:= \ CONFIG_AD799X_RING_BUFFER=y \ @@ -52,7 +80,7 @@ $(eval $(call KernelPackage,iio-ad799x)) define KernelPackage/iio-hmc5843 SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap-i2c + DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap-i2c +kmod-industrialio-triggered-buffer TITLE:=Honeywell HMC58x3 Magnetometer KCONFIG:= CONFIG_SENSORS_HMC5843_I2C FILES:= \ @@ -82,7 +110,7 @@ $(eval $(call KernelPackage,iio-bh1750)) define KernelPackage/iio-am2315 SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer TITLE:=Asong AM2315 humidity/temperature sensor KCONFIG:= CONFIG_AM2315 FILES:=$(LINUX_DIR)/drivers/iio/humidity/am2315.ko @@ -95,7 +123,7 @@ $(eval $(call KernelPackage,iio-am2315)) define KernelPackage/iio-mxs-lradc SUBMENU:=$(IIO_MENU) - DEPENDS:=@TARGET_mxs +kmod-iio-core + DEPENDS:=@TARGET_mxs +kmod-iio-core +kmod-industrialio-triggered-buffer TITLE:=Freescale i.MX23/i.MX28 LRADC ADC driver KCONFIG:= \ CONFIG_MXS_LRADC_ADC @@ -245,7 +273,7 @@ $(eval $(call KernelPackage,iio-htu21)) define KernelPackage/iio-ccs811 SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer TITLE:=AMS CCS811 VOC sensor KCONFIG:= \ CONFIG_CCS811 @@ -281,7 +309,7 @@ $(eval $(call KernelPackage,iio-si7020)) define KernelPackage/iio-st_accel SUBMENU:=$(IIO_MENU) TITLE:=STMicroelectronics accelerometer 3-Axis Driver - DEPENDS:=+kmod-iio-core +kmod-regmap-core + DEPENDS:=+kmod-iio-core +kmod-regmap-core +kmod-industrialio-triggered-buffer KCONFIG:= \ CONFIG_IIO_ST_ACCEL_3AXIS \ CONFIG_IIO_ST_SENSORS_CORE From aae4d85647f27ca64d2012501636e41d5a8ab42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sun, 23 Feb 2020 22:50:22 +0100 Subject: [PATCH 04/14] kernel: add kernel module for Sensirion SPS30 PMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds into 4.19 backported kernel module from 5.1 for Sensirion SPS30 particulate matter sensor, for kernel 5.4 backported dependency fix. Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/iio.mk | 16 + ...d-IIO_MASSCONCENTRATION-channel-type.patch | 144 ++++++ ...d-support-for-Sensirion-SPS30-sensor.patch | 461 ++++++++++++++++++ ...-sps30-add-support-for-self-cleaning.patch | 105 ++++ ...30-allow-changing-self-cleaning-peri.patch | 297 +++++++++++ ...sps30-remove-printk-format-specifier.patch | 27 + ...emical-sps30-fix-a-loop-timeout-test.patch | 28 ++ ...30-Supress-some-switch-fallthrough-w.patch | 36 ++ ...30-Explicity-truncate-constant-by-ma.patch | 33 ++ ...30-fix-missing-triggered-buffer-depe.patch | 32 ++ ...30-fix-missing-triggered-buffer-depe.patch | 32 ++ 11 files changed, 1211 insertions(+) create mode 100644 target/linux/generic/backport-4.19/499-v4.22-iio-add-IIO_MASSCONCENTRATION-channel-type.patch create mode 100644 target/linux/generic/backport-4.19/500-v5.1-iio-chemical-add-support-for-Sensirion-SPS30-sensor.patch create mode 100644 target/linux/generic/backport-4.19/501-v5.1-iio-chemical-sps30-add-support-for-self-cleaning.patch create mode 100644 target/linux/generic/backport-4.19/502-v5.1-iio-chemical-sps30-allow-changing-self-cleaning-peri.patch create mode 100644 target/linux/generic/backport-4.19/503-v5.1-iio-chemical-sps30-remove-printk-format-specifier.patch create mode 100644 target/linux/generic/backport-4.19/504-v5.1-iio-chemical-sps30-fix-a-loop-timeout-test.patch create mode 100644 target/linux/generic/backport-4.19/505-v5.1-iio-chemical-sps30-Supress-some-switch-fallthrough-w.patch create mode 100644 target/linux/generic/backport-4.19/506-v5.1-iio-chemical-sps30-Explicity-truncate-constant-by-ma.patch create mode 100644 target/linux/generic/backport-4.19/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch create mode 100644 target/linux/generic/backport-5.4/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index 430f318951..17ffdc3441 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -344,6 +344,22 @@ endef $(eval $(call KernelPackage,iio-st_sensors-i2c)) +define KernelPackage/iio-sps30 + SUBMENU:=$(IIO_MENU) + DEPENDS:=@!LINUX_4_14 +kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer +kmod-lib-crc8 + TITLE:=Sensirion SPS30 particulate matter sensor + KCONFIG:=CONFIG_SPS30 + FILES:=$(LINUX_DIR)/drivers/iio/chemical/sps30.ko + AUTOLOAD:=$(call AutoProbe,sps30) +endef + +define KernelPackage/iio-sps30/description + Support for the Sensirion SPS30 particulate matter sensor. +endef + +$(eval $(call KernelPackage,iio-sps30)) + + define KernelPackage/iio-st_sensors-spi SUBMENU:=$(IIO_MENU) TITLE:=STMicroelectronics accelerometer 3-Axis Driver (SPI) diff --git a/target/linux/generic/backport-4.19/499-v4.22-iio-add-IIO_MASSCONCENTRATION-channel-type.patch b/target/linux/generic/backport-4.19/499-v4.22-iio-add-IIO_MASSCONCENTRATION-channel-type.patch new file mode 100644 index 0000000000..c214495f03 --- /dev/null +++ b/target/linux/generic/backport-4.19/499-v4.22-iio-add-IIO_MASSCONCENTRATION-channel-type.patch @@ -0,0 +1,144 @@ +From 17abc9ec68b73ddeb262a507a62421016b9c54d5 Mon Sep 17 00:00:00 2001 +From: Tomasz Duszynski +Date: Fri, 14 Dec 2018 19:28:01 +0100 +Subject: [PATCH] iio: add IIO_MASSCONCENTRATION channel type + +Measuring particulate matter in ug / m3 (micro-grams per cubic meter) +is de facto standard. Existing air quality sensors usually follow +this convention and are capable of returning measurements using +this unit. + +IIO currently does not offer suitable channel type for this +type of measurements hence this patch adds this. + +In addition, extra modifiers are introduced used for distinguishing +between fine pm1, pm2p5 and coarse pm4, pm10 particle measurements, i.e +IIO_MOD_PM1, IIO_MOD_PM25 and IIO_MOD_PM4, IIO_MOD_PM10. + +pmX consists of particles with aerodynamic diameter less or equal to +X micrometers. + +Signed-off-by: Tomasz Duszynski +Acked-by: Matt Ranostay +Signed-off-by: Jonathan Cameron +--- + Documentation/ABI/testing/sysfs-bus-iio | 17 ++++++++++++++++- + drivers/iio/industrialio-core.c | 5 +++++ + include/uapi/linux/iio/types.h | 5 +++++ + tools/iio/iio_event_monitor.c | 10 ++++++++++ + 4 files changed, 36 insertions(+), 1 deletion(-) + +diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio +index 8127a08e366d..67fd88bf7910 100644 +--- a/Documentation/ABI/testing/sysfs-bus-iio ++++ b/Documentation/ABI/testing/sysfs-bus-iio +@@ -1684,4 +1684,19 @@ KernelVersion: 4.18 + Contact: linux-iio@vger.kernel.org + Description: + Raw (unscaled) phase difference reading from channel Y +- that can be processed to radians. +\ No newline at end of file ++ that can be processed to radians. ++ ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm1_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm1_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm2p5_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm2p5_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm4_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm4_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm10_input ++What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input ++KernelVersion: 4.22 ++Contact: linux-iio@vger.kernel.org ++Description: ++ Mass concentration reading of particulate matter in ug / m3. ++ pmX consists of particles with aerodynamic diameter less or ++ equal to X micrometers. +diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c +index 4f5cd9f60870..4700fd5d8c90 100644 +--- a/drivers/iio/industrialio-core.c ++++ b/drivers/iio/industrialio-core.c +@@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = { + [IIO_GRAVITY] = "gravity", + [IIO_POSITIONRELATIVE] = "positionrelative", + [IIO_PHASE] = "phase", ++ [IIO_MASSCONCENTRATION] = "massconcentration", + }; + + static const char * const iio_modifier_names[] = { +@@ -127,6 +128,10 @@ static const char * const iio_modifier_names[] = { + [IIO_MOD_Q] = "q", + [IIO_MOD_CO2] = "co2", + [IIO_MOD_VOC] = "voc", ++ [IIO_MOD_PM1] = "pm1", ++ [IIO_MOD_PM2P5] = "pm2p5", ++ [IIO_MOD_PM4] = "pm4", ++ [IIO_MOD_PM10] = "pm10", + }; + + /* relies on pairs of these shared then separate */ +diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h +index 92baabc103ac..c59adac24b1c 100644 +--- a/include/uapi/linux/iio/types.h ++++ b/include/uapi/linux/iio/types.h +@@ -46,6 +46,7 @@ enum iio_chan_type { + IIO_GRAVITY, + IIO_POSITIONRELATIVE, + IIO_PHASE, ++ IIO_MASSCONCENTRATION, + }; + + enum iio_modifier { +@@ -87,6 +88,10 @@ enum iio_modifier { + IIO_MOD_VOC, + IIO_MOD_LIGHT_UV, + IIO_MOD_LIGHT_DUV, ++ IIO_MOD_PM1, ++ IIO_MOD_PM2P5, ++ IIO_MOD_PM4, ++ IIO_MOD_PM10, + }; + + enum iio_event_type { +diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c +index ac2de6b7e89f..f6b8003fbe3c 100644 +--- a/tools/iio/iio_event_monitor.c ++++ b/tools/iio/iio_event_monitor.c +@@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = { + [IIO_GRAVITY] = "gravity", + [IIO_POSITIONRELATIVE] = "positionrelative", + [IIO_PHASE] = "phase", ++ [IIO_MASSCONCENTRATION] = "massconcentration", + }; + + static const char * const iio_ev_type_text[] = { +@@ -115,6 +116,10 @@ static const char * const iio_modifier_names[] = { + [IIO_MOD_Q] = "q", + [IIO_MOD_CO2] = "co2", + [IIO_MOD_VOC] = "voc", ++ [IIO_MOD_PM1] = "pm1", ++ [IIO_MOD_PM2P5] = "pm2p5", ++ [IIO_MOD_PM4] = "pm4", ++ [IIO_MOD_PM10] = "pm10", + }; + + static bool event_is_known(struct iio_event_data *event) +@@ -156,6 +161,7 @@ static bool event_is_known(struct iio_event_data *event) + case IIO_GRAVITY: + case IIO_POSITIONRELATIVE: + case IIO_PHASE: ++ case IIO_MASSCONCENTRATION: + break; + default: + return false; +@@ -200,6 +206,10 @@ static bool event_is_known(struct iio_event_data *event) + case IIO_MOD_Q: + case IIO_MOD_CO2: + case IIO_MOD_VOC: ++ case IIO_MOD_PM1: ++ case IIO_MOD_PM2P5: ++ case IIO_MOD_PM4: ++ case IIO_MOD_PM10: + break; + default: + return false; diff --git a/target/linux/generic/backport-4.19/500-v5.1-iio-chemical-add-support-for-Sensirion-SPS30-sensor.patch b/target/linux/generic/backport-4.19/500-v5.1-iio-chemical-add-support-for-Sensirion-SPS30-sensor.patch new file mode 100644 index 0000000000..73210b8e0e --- /dev/null +++ b/target/linux/generic/backport-4.19/500-v5.1-iio-chemical-add-support-for-Sensirion-SPS30-sensor.patch @@ -0,0 +1,461 @@ +From 232e0f6ddeaee104d64675fe7d0cc142cf955f35 Mon Sep 17 00:00:00 2001 +From: Tomasz Duszynski +Date: Fri, 14 Dec 2018 19:28:02 +0100 +Subject: [PATCH] iio: chemical: add support for Sensirion SPS30 sensor + +Add support for Sensirion SPS30 particulate matter sensor. + +Signed-off-by: Tomasz Duszynski +Signed-off-by: Jonathan Cameron +--- + drivers/iio/chemical/Kconfig | 11 + + drivers/iio/chemical/Makefile | 1 + + drivers/iio/chemical/sps30.c | 407 ++++++++++++++++++++++++++++++++++ + 3 files changed, 419 insertions(+) + create mode 100644 drivers/iio/chemical/sps30.c + +diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig +index b8e005be4f87..57832b4360e9 100644 +--- a/drivers/iio/chemical/Kconfig ++++ b/drivers/iio/chemical/Kconfig +@@ -61,6 +61,17 @@ config IAQCORE + iAQ-Core Continuous/Pulsed VOC (Volatile Organic Compounds) + sensors + ++config SPS30 ++ tristate "SPS30 particulate matter sensor" ++ depends on I2C ++ select CRC8 ++ help ++ Say Y here to build support for the Sensirion SPS30 particulate ++ matter sensor. ++ ++ To compile this driver as a module, choose M here: the module will ++ be called sps30. ++ + config VZ89X + tristate "SGX Sensortech MiCS VZ89X VOC sensor" + depends on I2C +diff --git a/drivers/iio/chemical/Makefile b/drivers/iio/chemical/Makefile +index 2f4c4ba4d781..9f42f4252151 100644 +--- a/drivers/iio/chemical/Makefile ++++ b/drivers/iio/chemical/Makefile +@@ -9,4 +9,5 @@ obj-$(CONFIG_BME680_I2C) += bme680_i2c.o + obj-$(CONFIG_BME680_SPI) += bme680_spi.o + obj-$(CONFIG_CCS811) += ccs811.o + obj-$(CONFIG_IAQCORE) += ams-iaq-core.o ++obj-$(CONFIG_SPS30) += sps30.o + obj-$(CONFIG_VZ89X) += vz89x.o +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +new file mode 100644 +index 000000000000..fa3cd409b90b +--- /dev/null ++++ b/drivers/iio/chemical/sps30.c +@@ -0,0 +1,407 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Sensirion SPS30 particulate matter sensor driver ++ * ++ * Copyright (c) Tomasz Duszynski ++ * ++ * I2C slave address: 0x69 ++ * ++ * TODO: ++ * - support for turning on fan cleaning ++ * - support for reading/setting auto cleaning interval ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define SPS30_CRC8_POLYNOMIAL 0x31 ++/* max number of bytes needed to store PM measurements or serial string */ ++#define SPS30_MAX_READ_SIZE 48 ++/* sensor measures reliably up to 3000 ug / m3 */ ++#define SPS30_MAX_PM 3000 ++ ++/* SPS30 commands */ ++#define SPS30_START_MEAS 0x0010 ++#define SPS30_STOP_MEAS 0x0104 ++#define SPS30_RESET 0xd304 ++#define SPS30_READ_DATA_READY_FLAG 0x0202 ++#define SPS30_READ_DATA 0x0300 ++#define SPS30_READ_SERIAL 0xd033 ++ ++enum { ++ PM1, ++ PM2P5, ++ PM4, ++ PM10, ++}; ++ ++struct sps30_state { ++ struct i2c_client *client; ++ /* ++ * Guards against concurrent access to sensor registers. ++ * Must be held whenever sequence of commands is to be executed. ++ */ ++ struct mutex lock; ++}; ++ ++DECLARE_CRC8_TABLE(sps30_crc8_table); ++ ++static int sps30_write_then_read(struct sps30_state *state, u8 *txbuf, ++ int txsize, u8 *rxbuf, int rxsize) ++{ ++ int ret; ++ ++ /* ++ * Sensor does not support repeated start so instead of ++ * sending two i2c messages in a row we just send one by one. ++ */ ++ ret = i2c_master_send(state->client, txbuf, txsize); ++ if (ret != txsize) ++ return ret < 0 ? ret : -EIO; ++ ++ if (!rxbuf) ++ return 0; ++ ++ ret = i2c_master_recv(state->client, rxbuf, rxsize); ++ if (ret != rxsize) ++ return ret < 0 ? ret : -EIO; ++ ++ return 0; ++} ++ ++static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size) ++{ ++ /* ++ * Internally sensor stores measurements in a following manner: ++ * ++ * PM1: upper two bytes, crc8, lower two bytes, crc8 ++ * PM2P5: upper two bytes, crc8, lower two bytes, crc8 ++ * PM4: upper two bytes, crc8, lower two bytes, crc8 ++ * PM10: upper two bytes, crc8, lower two bytes, crc8 ++ * ++ * What follows next are number concentration measurements and ++ * typical particle size measurement which we omit. ++ */ ++ u8 buf[SPS30_MAX_READ_SIZE] = { cmd >> 8, cmd }; ++ int i, ret = 0; ++ ++ switch (cmd) { ++ case SPS30_START_MEAS: ++ buf[2] = 0x03; ++ buf[3] = 0x00; ++ buf[4] = crc8(sps30_crc8_table, &buf[2], 2, CRC8_INIT_VALUE); ++ ret = sps30_write_then_read(state, buf, 5, NULL, 0); ++ break; ++ case SPS30_STOP_MEAS: ++ case SPS30_RESET: ++ ret = sps30_write_then_read(state, buf, 2, NULL, 0); ++ break; ++ case SPS30_READ_DATA_READY_FLAG: ++ case SPS30_READ_DATA: ++ case SPS30_READ_SERIAL: ++ /* every two data bytes are checksummed */ ++ size += size / 2; ++ ret = sps30_write_then_read(state, buf, 2, buf, size); ++ break; ++ } ++ ++ if (ret) ++ return ret; ++ ++ /* validate received data and strip off crc bytes */ ++ for (i = 0; i < size; i += 3) { ++ u8 crc = crc8(sps30_crc8_table, &buf[i], 2, CRC8_INIT_VALUE); ++ ++ if (crc != buf[i + 2]) { ++ dev_err(&state->client->dev, ++ "data integrity check failed\n"); ++ return -EIO; ++ } ++ ++ *data++ = buf[i]; ++ *data++ = buf[i + 1]; ++ } ++ ++ return 0; ++} ++ ++static s32 sps30_float_to_int_clamped(const u8 *fp) ++{ ++ int val = get_unaligned_be32(fp); ++ int mantissa = val & GENMASK(22, 0); ++ /* this is fine since passed float is always non-negative */ ++ int exp = val >> 23; ++ int fraction, shift; ++ ++ /* special case 0 */ ++ if (!exp && !mantissa) ++ return 0; ++ ++ exp -= 127; ++ if (exp < 0) { ++ /* return values ranging from 1 to 99 */ ++ return ((((1 << 23) + mantissa) * 100) >> 23) >> (-exp); ++ } ++ ++ /* return values ranging from 100 to 300000 */ ++ shift = 23 - exp; ++ val = (1 << exp) + (mantissa >> shift); ++ if (val >= SPS30_MAX_PM) ++ return SPS30_MAX_PM * 100; ++ ++ fraction = mantissa & GENMASK(shift - 1, 0); ++ ++ return val * 100 + ((fraction * 100) >> shift); ++} ++ ++static int sps30_do_meas(struct sps30_state *state, s32 *data, int size) ++{ ++ int i, ret, tries = 5; ++ u8 tmp[16]; ++ ++ while (tries--) { ++ ret = sps30_do_cmd(state, SPS30_READ_DATA_READY_FLAG, tmp, 2); ++ if (ret) ++ return -EIO; ++ ++ /* new measurements ready to be read */ ++ if (tmp[1] == 1) ++ break; ++ ++ msleep_interruptible(300); ++ } ++ ++ if (!tries) ++ return -ETIMEDOUT; ++ ++ ret = sps30_do_cmd(state, SPS30_READ_DATA, tmp, sizeof(int) * size); ++ if (ret) ++ return ret; ++ ++ for (i = 0; i < size; i++) ++ data[i] = sps30_float_to_int_clamped(&tmp[4 * i]); ++ ++ return 0; ++} ++ ++static irqreturn_t sps30_trigger_handler(int irq, void *p) ++{ ++ struct iio_poll_func *pf = p; ++ struct iio_dev *indio_dev = pf->indio_dev; ++ struct sps30_state *state = iio_priv(indio_dev); ++ int ret; ++ s32 data[4 + 2]; /* PM1, PM2P5, PM4, PM10, timestamp */ ++ ++ mutex_lock(&state->lock); ++ ret = sps30_do_meas(state, data, 4); ++ mutex_unlock(&state->lock); ++ if (ret) ++ goto err; ++ ++ iio_push_to_buffers_with_timestamp(indio_dev, data, ++ iio_get_time_ns(indio_dev)); ++err: ++ iio_trigger_notify_done(indio_dev->trig); ++ ++ return IRQ_HANDLED; ++} ++ ++static int sps30_read_raw(struct iio_dev *indio_dev, ++ struct iio_chan_spec const *chan, ++ int *val, int *val2, long mask) ++{ ++ struct sps30_state *state = iio_priv(indio_dev); ++ int data[4], ret = -EINVAL; ++ ++ switch (mask) { ++ case IIO_CHAN_INFO_PROCESSED: ++ switch (chan->type) { ++ case IIO_MASSCONCENTRATION: ++ mutex_lock(&state->lock); ++ /* read up to the number of bytes actually needed */ ++ switch (chan->channel2) { ++ case IIO_MOD_PM1: ++ ret = sps30_do_meas(state, data, 1); ++ break; ++ case IIO_MOD_PM2P5: ++ ret = sps30_do_meas(state, data, 2); ++ break; ++ case IIO_MOD_PM4: ++ ret = sps30_do_meas(state, data, 3); ++ break; ++ case IIO_MOD_PM10: ++ ret = sps30_do_meas(state, data, 4); ++ break; ++ } ++ mutex_unlock(&state->lock); ++ if (ret) ++ return ret; ++ ++ *val = data[chan->address] / 100; ++ *val2 = (data[chan->address] % 100) * 10000; ++ ++ return IIO_VAL_INT_PLUS_MICRO; ++ default: ++ return -EINVAL; ++ } ++ case IIO_CHAN_INFO_SCALE: ++ switch (chan->type) { ++ case IIO_MASSCONCENTRATION: ++ switch (chan->channel2) { ++ case IIO_MOD_PM1: ++ case IIO_MOD_PM2P5: ++ case IIO_MOD_PM4: ++ case IIO_MOD_PM10: ++ *val = 0; ++ *val2 = 10000; ++ ++ return IIO_VAL_INT_PLUS_MICRO; ++ } ++ default: ++ return -EINVAL; ++ } ++ } ++ ++ return -EINVAL; ++} ++ ++static const struct iio_info sps30_info = { ++ .read_raw = sps30_read_raw, ++}; ++ ++#define SPS30_CHAN(_index, _mod) { \ ++ .type = IIO_MASSCONCENTRATION, \ ++ .modified = 1, \ ++ .channel2 = IIO_MOD_ ## _mod, \ ++ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), \ ++ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ ++ .address = _mod, \ ++ .scan_index = _index, \ ++ .scan_type = { \ ++ .sign = 'u', \ ++ .realbits = 19, \ ++ .storagebits = 32, \ ++ .endianness = IIO_CPU, \ ++ }, \ ++} ++ ++static const struct iio_chan_spec sps30_channels[] = { ++ SPS30_CHAN(0, PM1), ++ SPS30_CHAN(1, PM2P5), ++ SPS30_CHAN(2, PM4), ++ SPS30_CHAN(3, PM10), ++ IIO_CHAN_SOFT_TIMESTAMP(4), ++}; ++ ++static void sps30_stop_meas(void *data) ++{ ++ struct sps30_state *state = data; ++ ++ sps30_do_cmd(state, SPS30_STOP_MEAS, NULL, 0); ++} ++ ++static const unsigned long sps30_scan_masks[] = { 0x0f, 0x00 }; ++ ++static int sps30_probe(struct i2c_client *client) ++{ ++ struct iio_dev *indio_dev; ++ struct sps30_state *state; ++ u8 buf[32]; ++ int ret; ++ ++ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) ++ return -EOPNOTSUPP; ++ ++ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*state)); ++ if (!indio_dev) ++ return -ENOMEM; ++ ++ state = iio_priv(indio_dev); ++ i2c_set_clientdata(client, indio_dev); ++ state->client = client; ++ indio_dev->dev.parent = &client->dev; ++ indio_dev->info = &sps30_info; ++ indio_dev->name = client->name; ++ indio_dev->channels = sps30_channels; ++ indio_dev->num_channels = ARRAY_SIZE(sps30_channels); ++ indio_dev->modes = INDIO_DIRECT_MODE; ++ indio_dev->available_scan_masks = sps30_scan_masks; ++ ++ mutex_init(&state->lock); ++ crc8_populate_msb(sps30_crc8_table, SPS30_CRC8_POLYNOMIAL); ++ ++ ret = sps30_do_cmd(state, SPS30_RESET, NULL, 0); ++ if (ret) { ++ dev_err(&client->dev, "failed to reset device\n"); ++ return ret; ++ } ++ msleep(300); ++ /* ++ * Power-on-reset causes sensor to produce some glitch on i2c bus and ++ * some controllers end up in error state. Recover simply by placing ++ * some data on the bus, for example STOP_MEAS command, which ++ * is NOP in this case. ++ */ ++ sps30_do_cmd(state, SPS30_STOP_MEAS, NULL, 0); ++ ++ ret = sps30_do_cmd(state, SPS30_READ_SERIAL, buf, sizeof(buf)); ++ if (ret) { ++ dev_err(&client->dev, "failed to read serial number\n"); ++ return ret; ++ } ++ /* returned serial number is already NUL terminated */ ++ dev_info(&client->dev, "serial number: %s\n", buf); ++ ++ ret = sps30_do_cmd(state, SPS30_START_MEAS, NULL, 0); ++ if (ret) { ++ dev_err(&client->dev, "failed to start measurement\n"); ++ return ret; ++ } ++ ++ ret = devm_add_action_or_reset(&client->dev, sps30_stop_meas, state); ++ if (ret) ++ return ret; ++ ++ ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev, NULL, ++ sps30_trigger_handler, NULL); ++ if (ret) ++ return ret; ++ ++ return devm_iio_device_register(&client->dev, indio_dev); ++} ++ ++static const struct i2c_device_id sps30_id[] = { ++ { "sps30" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, sps30_id); ++ ++static const struct of_device_id sps30_of_match[] = { ++ { .compatible = "sensirion,sps30" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, sps30_of_match); ++ ++static struct i2c_driver sps30_driver = { ++ .driver = { ++ .name = "sps30", ++ .of_match_table = sps30_of_match, ++ }, ++ .id_table = sps30_id, ++ .probe_new = sps30_probe, ++}; ++module_i2c_driver(sps30_driver); ++ ++MODULE_AUTHOR("Tomasz Duszynski "); ++MODULE_DESCRIPTION("Sensirion SPS30 particulate matter sensor driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/backport-4.19/501-v5.1-iio-chemical-sps30-add-support-for-self-cleaning.patch b/target/linux/generic/backport-4.19/501-v5.1-iio-chemical-sps30-add-support-for-self-cleaning.patch new file mode 100644 index 0000000000..9e4b9c2d43 --- /dev/null +++ b/target/linux/generic/backport-4.19/501-v5.1-iio-chemical-sps30-add-support-for-self-cleaning.patch @@ -0,0 +1,105 @@ +From c546d49656143855093c7b7fde60866e6e23a69d Mon Sep 17 00:00:00 2001 +From: Tomasz Duszynski +Date: Tue, 18 Dec 2018 21:28:09 +0100 +Subject: [PATCH] iio: chemical: sps30: add support for self cleaning + +Self cleaning is especially useful in cases where sensor undergoes +frequent power on/off cycles. In such scenarios it is recommended to +turn self cleaning at least once per week in order to maintain reliable +measurements. + +Self cleaning is activated by writing 1 to a dedicated attribute. +Internal fan accelerates to its maximum speed and keeps spinning +for about 10 seconds blowing out accumulated dust. + +Signed-off-by: Tomasz Duszynski +Tested-by: Andreas Brauchli +Signed-off-by: Jonathan Cameron +--- + Documentation/ABI/testing/sysfs-bus-iio-sps30 | 8 +++++ + drivers/iio/chemical/sps30.c | 35 ++++++++++++++++++- + 2 files changed, 42 insertions(+), 1 deletion(-) + create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-sps30 + +diff --git a/Documentation/ABI/testing/sysfs-bus-iio-sps30 b/Documentation/ABI/testing/sysfs-bus-iio-sps30 +new file mode 100644 +index 000000000000..e7ce2c57635e +--- /dev/null ++++ b/Documentation/ABI/testing/sysfs-bus-iio-sps30 +@@ -0,0 +1,8 @@ ++What: /sys/bus/iio/devices/iio:deviceX/start_cleaning ++Date: December 2018 ++KernelVersion: 4.22 ++Contact: linux-iio@vger.kernel.org ++Description: ++ Writing 1 starts sensor self cleaning. Internal fan accelerates ++ to its maximum speed and keeps spinning for about 10 seconds in ++ order to blow out accumulated dust. +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +index fa3cd409b90b..f3b4390c8f5c 100644 +--- a/drivers/iio/chemical/sps30.c ++++ b/drivers/iio/chemical/sps30.c +@@ -7,7 +7,6 @@ + * I2C slave address: 0x69 + * + * TODO: +- * - support for turning on fan cleaning + * - support for reading/setting auto cleaning interval + */ + +@@ -37,6 +36,7 @@ + #define SPS30_READ_DATA_READY_FLAG 0x0202 + #define SPS30_READ_DATA 0x0300 + #define SPS30_READ_SERIAL 0xd033 ++#define SPS30_START_FAN_CLEANING 0x5607 + + enum { + PM1, +@@ -104,6 +104,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size) + break; + case SPS30_STOP_MEAS: + case SPS30_RESET: ++ case SPS30_START_FAN_CLEANING: + ret = sps30_write_then_read(state, buf, 2, NULL, 0); + break; + case SPS30_READ_DATA_READY_FLAG: +@@ -275,7 +276,39 @@ static int sps30_read_raw(struct iio_dev *indio_dev, + return -EINVAL; + } + ++static ssize_t start_cleaning_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t len) ++{ ++ struct iio_dev *indio_dev = dev_to_iio_dev(dev); ++ struct sps30_state *state = iio_priv(indio_dev); ++ int val, ret; ++ ++ if (kstrtoint(buf, 0, &val) || val != 1) ++ return -EINVAL; ++ ++ mutex_lock(&state->lock); ++ ret = sps30_do_cmd(state, SPS30_START_FAN_CLEANING, NULL, 0); ++ mutex_unlock(&state->lock); ++ if (ret) ++ return ret; ++ ++ return len; ++} ++ ++static IIO_DEVICE_ATTR_WO(start_cleaning, 0); ++ ++static struct attribute *sps30_attrs[] = { ++ &iio_dev_attr_start_cleaning.dev_attr.attr, ++ NULL ++}; ++ ++static const struct attribute_group sps30_attr_group = { ++ .attrs = sps30_attrs, ++}; ++ + static const struct iio_info sps30_info = { ++ .attrs = &sps30_attr_group, + .read_raw = sps30_read_raw, + }; + diff --git a/target/linux/generic/backport-4.19/502-v5.1-iio-chemical-sps30-allow-changing-self-cleaning-peri.patch b/target/linux/generic/backport-4.19/502-v5.1-iio-chemical-sps30-allow-changing-self-cleaning-peri.patch new file mode 100644 index 0000000000..ca3e23b8fc --- /dev/null +++ b/target/linux/generic/backport-4.19/502-v5.1-iio-chemical-sps30-allow-changing-self-cleaning-peri.patch @@ -0,0 +1,297 @@ +From 62129a0849d27cc94ced832bcf9dcde283dcbe08 Mon Sep 17 00:00:00 2001 +From: Tomasz Duszynski +Date: Tue, 15 Jan 2019 20:00:06 +0100 +Subject: [PATCH] iio: chemical: sps30: allow changing self cleaning period + +Sensor can periodically trigger self cleaning. Period can be changed by +writing a new value to a dedicated attribute. Upon attribute read +current period gets returned. + +Signed-off-by: Tomasz Duszynski +Signed-off-by: Jonathan Cameron +--- + Documentation/ABI/testing/sysfs-bus-iio-sps30 | 20 +++ + drivers/iio/chemical/sps30.c | 143 +++++++++++++++--- + 2 files changed, 145 insertions(+), 18 deletions(-) + +diff --git a/Documentation/ABI/testing/sysfs-bus-iio-sps30 b/Documentation/ABI/testing/sysfs-bus-iio-sps30 +index e7ce2c57635e..143df8e89d08 100644 +--- a/Documentation/ABI/testing/sysfs-bus-iio-sps30 ++++ b/Documentation/ABI/testing/sysfs-bus-iio-sps30 +@@ -6,3 +6,23 @@ Description: + Writing 1 starts sensor self cleaning. Internal fan accelerates + to its maximum speed and keeps spinning for about 10 seconds in + order to blow out accumulated dust. ++ ++What: /sys/bus/iio/devices/iio:deviceX/cleaning_period ++Date: January 2019 ++KernelVersion: 5.1 ++Contact: linux-iio@vger.kernel.org ++Description: ++ Sensor is capable of triggering self cleaning periodically. ++ Period can be changed by writing a new value here. Upon reading ++ the current one is returned. Units are seconds. ++ ++ Writing 0 disables periodical self cleaning entirely. ++ ++What: /sys/bus/iio/devices/iio:deviceX/cleaning_period_available ++Date: January 2019 ++KernelVersion: 5.1 ++Contact: linux-iio@vger.kernel.org ++Description: ++ The range of available values in seconds represented as the ++ minimum value, the step and the maximum value, all enclosed in ++ square brackets. +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +index f3b4390c8f5c..376fac41ecb5 100644 +--- a/drivers/iio/chemical/sps30.c ++++ b/drivers/iio/chemical/sps30.c +@@ -5,9 +5,6 @@ + * Copyright (c) Tomasz Duszynski + * + * I2C slave address: 0x69 +- * +- * TODO: +- * - support for reading/setting auto cleaning interval + */ + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +@@ -21,6 +18,7 @@ + #include + #include + #include ++#include + #include + + #define SPS30_CRC8_POLYNOMIAL 0x31 +@@ -28,6 +26,9 @@ + #define SPS30_MAX_READ_SIZE 48 + /* sensor measures reliably up to 3000 ug / m3 */ + #define SPS30_MAX_PM 3000 ++/* minimum and maximum self cleaning periods in seconds */ ++#define SPS30_AUTO_CLEANING_PERIOD_MIN 0 ++#define SPS30_AUTO_CLEANING_PERIOD_MAX 604800 + + /* SPS30 commands */ + #define SPS30_START_MEAS 0x0010 +@@ -37,6 +38,9 @@ + #define SPS30_READ_DATA 0x0300 + #define SPS30_READ_SERIAL 0xd033 + #define SPS30_START_FAN_CLEANING 0x5607 ++#define SPS30_AUTO_CLEANING_PERIOD 0x8004 ++/* not a sensor command per se, used only to distinguish write from read */ ++#define SPS30_READ_AUTO_CLEANING_PERIOD 0x8005 + + enum { + PM1, +@@ -45,6 +49,11 @@ enum { + PM10, + }; + ++enum { ++ RESET, ++ MEASURING, ++}; ++ + struct sps30_state { + struct i2c_client *client; + /* +@@ -52,6 +61,7 @@ struct sps30_state { + * Must be held whenever sequence of commands is to be executed. + */ + struct mutex lock; ++ int state; + }; + + DECLARE_CRC8_TABLE(sps30_crc8_table); +@@ -107,6 +117,9 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size) + case SPS30_START_FAN_CLEANING: + ret = sps30_write_then_read(state, buf, 2, NULL, 0); + break; ++ case SPS30_READ_AUTO_CLEANING_PERIOD: ++ buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8; ++ buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD; + case SPS30_READ_DATA_READY_FLAG: + case SPS30_READ_DATA: + case SPS30_READ_SERIAL: +@@ -114,6 +127,15 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size) + size += size / 2; + ret = sps30_write_then_read(state, buf, 2, buf, size); + break; ++ case SPS30_AUTO_CLEANING_PERIOD: ++ buf[2] = data[0]; ++ buf[3] = data[1]; ++ buf[4] = crc8(sps30_crc8_table, &buf[2], 2, CRC8_INIT_VALUE); ++ buf[5] = data[2]; ++ buf[6] = data[3]; ++ buf[7] = crc8(sps30_crc8_table, &buf[5], 2, CRC8_INIT_VALUE); ++ ret = sps30_write_then_read(state, buf, 8, NULL, 0); ++ break; + } + + if (ret) +@@ -170,6 +192,14 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size) + int i, ret, tries = 5; + u8 tmp[16]; + ++ if (state->state == RESET) { ++ ret = sps30_do_cmd(state, SPS30_START_MEAS, NULL, 0); ++ if (ret) ++ return ret; ++ ++ state->state = MEASURING; ++ } ++ + while (tries--) { + ret = sps30_do_cmd(state, SPS30_READ_DATA_READY_FLAG, tmp, 2); + if (ret) +@@ -276,6 +306,24 @@ static int sps30_read_raw(struct iio_dev *indio_dev, + return -EINVAL; + } + ++static int sps30_do_cmd_reset(struct sps30_state *state) ++{ ++ int ret; ++ ++ ret = sps30_do_cmd(state, SPS30_RESET, NULL, 0); ++ msleep(300); ++ /* ++ * Power-on-reset causes sensor to produce some glitch on i2c bus and ++ * some controllers end up in error state. Recover simply by placing ++ * some data on the bus, for example STOP_MEAS command, which ++ * is NOP in this case. ++ */ ++ sps30_do_cmd(state, SPS30_STOP_MEAS, NULL, 0); ++ state->state = RESET; ++ ++ return ret; ++} ++ + static ssize_t start_cleaning_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +@@ -296,10 +344,82 @@ static ssize_t start_cleaning_store(struct device *dev, + return len; + } + ++static ssize_t cleaning_period_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct iio_dev *indio_dev = dev_to_iio_dev(dev); ++ struct sps30_state *state = iio_priv(indio_dev); ++ u8 tmp[4]; ++ int ret; ++ ++ mutex_lock(&state->lock); ++ ret = sps30_do_cmd(state, SPS30_READ_AUTO_CLEANING_PERIOD, tmp, 4); ++ mutex_unlock(&state->lock); ++ if (ret) ++ return ret; ++ ++ return sprintf(buf, "%d\n", get_unaligned_be32(tmp)); ++} ++ ++static ssize_t cleaning_period_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t len) ++{ ++ struct iio_dev *indio_dev = dev_to_iio_dev(dev); ++ struct sps30_state *state = iio_priv(indio_dev); ++ int val, ret; ++ u8 tmp[4]; ++ ++ if (kstrtoint(buf, 0, &val)) ++ return -EINVAL; ++ ++ if ((val < SPS30_AUTO_CLEANING_PERIOD_MIN) || ++ (val > SPS30_AUTO_CLEANING_PERIOD_MAX)) ++ return -EINVAL; ++ ++ put_unaligned_be32(val, tmp); ++ ++ mutex_lock(&state->lock); ++ ret = sps30_do_cmd(state, SPS30_AUTO_CLEANING_PERIOD, tmp, 0); ++ if (ret) { ++ mutex_unlock(&state->lock); ++ return ret; ++ } ++ ++ msleep(20); ++ ++ /* ++ * sensor requires reset in order to return up to date self cleaning ++ * period ++ */ ++ ret = sps30_do_cmd_reset(state); ++ if (ret) ++ dev_warn(dev, ++ "period changed but reads will return the old value\n"); ++ ++ mutex_unlock(&state->lock); ++ ++ return len; ++} ++ ++static ssize_t cleaning_period_available_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ return snprintf(buf, PAGE_SIZE, "[%d %d %d]\n", ++ SPS30_AUTO_CLEANING_PERIOD_MIN, 1, ++ SPS30_AUTO_CLEANING_PERIOD_MAX); ++} ++ + static IIO_DEVICE_ATTR_WO(start_cleaning, 0); ++static IIO_DEVICE_ATTR_RW(cleaning_period, 0); ++static IIO_DEVICE_ATTR_RO(cleaning_period_available, 0); + + static struct attribute *sps30_attrs[] = { + &iio_dev_attr_start_cleaning.dev_attr.attr, ++ &iio_dev_attr_cleaning_period.dev_attr.attr, ++ &iio_dev_attr_cleaning_period_available.dev_attr.attr, + NULL + }; + +@@ -362,6 +482,7 @@ static int sps30_probe(struct i2c_client *client) + state = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + state->client = client; ++ state->state = RESET; + indio_dev->dev.parent = &client->dev; + indio_dev->info = &sps30_info; + indio_dev->name = client->name; +@@ -373,19 +494,11 @@ static int sps30_probe(struct i2c_client *client) + mutex_init(&state->lock); + crc8_populate_msb(sps30_crc8_table, SPS30_CRC8_POLYNOMIAL); + +- ret = sps30_do_cmd(state, SPS30_RESET, NULL, 0); ++ ret = sps30_do_cmd_reset(state); + if (ret) { + dev_err(&client->dev, "failed to reset device\n"); + return ret; + } +- msleep(300); +- /* +- * Power-on-reset causes sensor to produce some glitch on i2c bus and +- * some controllers end up in error state. Recover simply by placing +- * some data on the bus, for example STOP_MEAS command, which +- * is NOP in this case. +- */ +- sps30_do_cmd(state, SPS30_STOP_MEAS, NULL, 0); + + ret = sps30_do_cmd(state, SPS30_READ_SERIAL, buf, sizeof(buf)); + if (ret) { +@@ -395,12 +508,6 @@ static int sps30_probe(struct i2c_client *client) + /* returned serial number is already NUL terminated */ + dev_info(&client->dev, "serial number: %s\n", buf); + +- ret = sps30_do_cmd(state, SPS30_START_MEAS, NULL, 0); +- if (ret) { +- dev_err(&client->dev, "failed to start measurement\n"); +- return ret; +- } +- + ret = devm_add_action_or_reset(&client->dev, sps30_stop_meas, state); + if (ret) + return ret; diff --git a/target/linux/generic/backport-4.19/503-v5.1-iio-chemical-sps30-remove-printk-format-specifier.patch b/target/linux/generic/backport-4.19/503-v5.1-iio-chemical-sps30-remove-printk-format-specifier.patch new file mode 100644 index 0000000000..8cdd0a718d --- /dev/null +++ b/target/linux/generic/backport-4.19/503-v5.1-iio-chemical-sps30-remove-printk-format-specifier.patch @@ -0,0 +1,27 @@ +From 3fa30bf7004bb8069826ef85487f4753666a73da Mon Sep 17 00:00:00 2001 +From: Tomasz Duszynski +Date: Sat, 2 Feb 2019 10:00:03 +0100 +Subject: [PATCH] iio: chemical: sps30: remove printk format specifier + +pr_fmt is used by printk wrappers. There are not any in the driver +code so remove the format specifier. + +Signed-off-by: Tomasz Duszynski +Signed-off-by: Jonathan Cameron +--- + drivers/iio/chemical/sps30.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +index 376fac41ecb5..e03a28a67146 100644 +--- a/drivers/iio/chemical/sps30.c ++++ b/drivers/iio/chemical/sps30.c +@@ -7,8 +7,6 @@ + * I2C slave address: 0x69 + */ + +-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +- + #include + #include + #include diff --git a/target/linux/generic/backport-4.19/504-v5.1-iio-chemical-sps30-fix-a-loop-timeout-test.patch b/target/linux/generic/backport-4.19/504-v5.1-iio-chemical-sps30-fix-a-loop-timeout-test.patch new file mode 100644 index 0000000000..e0fcdc2ce2 --- /dev/null +++ b/target/linux/generic/backport-4.19/504-v5.1-iio-chemical-sps30-fix-a-loop-timeout-test.patch @@ -0,0 +1,28 @@ +From 905889b4a34c753a538015f0b2cdaa0c9e3a4fd5 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Sat, 9 Feb 2019 12:03:52 +0300 +Subject: [PATCH] iio: chemical: sps30: fix a loop timeout test + +The "while (tries--) {" loop is a postop so it exits with "tries" set +to -1. + +Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor") +Signed-off-by: Dan Carpenter +Signed-off-by: Jonathan Cameron +--- + drivers/iio/chemical/sps30.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +index e03a28a67146..375df5060ed5 100644 +--- a/drivers/iio/chemical/sps30.c ++++ b/drivers/iio/chemical/sps30.c +@@ -210,7 +210,7 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size) + msleep_interruptible(300); + } + +- if (!tries) ++ if (tries == -1) + return -ETIMEDOUT; + + ret = sps30_do_cmd(state, SPS30_READ_DATA, tmp, sizeof(int) * size); diff --git a/target/linux/generic/backport-4.19/505-v5.1-iio-chemical-sps30-Supress-some-switch-fallthrough-w.patch b/target/linux/generic/backport-4.19/505-v5.1-iio-chemical-sps30-Supress-some-switch-fallthrough-w.patch new file mode 100644 index 0000000000..a1c0b3ddca --- /dev/null +++ b/target/linux/generic/backport-4.19/505-v5.1-iio-chemical-sps30-Supress-some-switch-fallthrough-w.patch @@ -0,0 +1,36 @@ +From 59b9bb0abca9efe47207301dbaf0d1beee2bd0f7 Mon Sep 17 00:00:00 2001 +From: Jonathan Cameron +Date: Sat, 9 Feb 2019 19:32:58 +0000 +Subject: [PATCH] iio:chemical:sps30 Supress some switch fallthrough warnings. + +Fixes warnings reported on linux-next but marking one path +and adding an explicit return in the other. + +Signed-off-by: Jonathan Cameron +Cc: Andreas Brauchli +Acked-by: Tomasz Duszynski +--- + drivers/iio/chemical/sps30.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +index 375df5060ed5..edbb956e81e8 100644 +--- a/drivers/iio/chemical/sps30.c ++++ b/drivers/iio/chemical/sps30.c +@@ -118,6 +118,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size) + case SPS30_READ_AUTO_CLEANING_PERIOD: + buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8; + buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD; ++ /* fall through */ + case SPS30_READ_DATA_READY_FLAG: + case SPS30_READ_DATA: + case SPS30_READ_SERIAL: +@@ -295,6 +296,8 @@ static int sps30_read_raw(struct iio_dev *indio_dev, + *val2 = 10000; + + return IIO_VAL_INT_PLUS_MICRO; ++ default: ++ return -EINVAL; + } + default: + return -EINVAL; diff --git a/target/linux/generic/backport-4.19/506-v5.1-iio-chemical-sps30-Explicity-truncate-constant-by-ma.patch b/target/linux/generic/backport-4.19/506-v5.1-iio-chemical-sps30-Explicity-truncate-constant-by-ma.patch new file mode 100644 index 0000000000..6b31483070 --- /dev/null +++ b/target/linux/generic/backport-4.19/506-v5.1-iio-chemical-sps30-Explicity-truncate-constant-by-ma.patch @@ -0,0 +1,33 @@ +From 78b75ab3f8c9dfac563b81105a1b838ec37a940e Mon Sep 17 00:00:00 2001 +From: Jonathan Cameron +Date: Sun, 13 Oct 2019 10:55:15 +0100 +Subject: [PATCH] iio: chemical: sps30: Explicity truncate constant by masking + +When breaking up a constant to write to two 8 bit registers +it isn't obvious to sparse that it was intentional. + +CHECK drivers/iio/chemical/sps30.c +drivers/iio/chemical/sps30.c:120:30: warning: cast truncates bits from constant value (8004 becomes 4) + +So in the interests of minimising noisy warnings, let us add +a mask. + +Signed-off-by: Jonathan Cameron +Acked-by: Tomasz Duszynski +--- + drivers/iio/chemical/sps30.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c +index edbb956e81e8..acb9f8ecbb3d 100644 +--- a/drivers/iio/chemical/sps30.c ++++ b/drivers/iio/chemical/sps30.c +@@ -117,7 +117,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size) + break; + case SPS30_READ_AUTO_CLEANING_PERIOD: + buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8; +- buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD; ++ buf[1] = (u8)(SPS30_AUTO_CLEANING_PERIOD & 0xff); + /* fall through */ + case SPS30_READ_DATA_READY_FLAG: + case SPS30_READ_DATA: diff --git a/target/linux/generic/backport-4.19/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch b/target/linux/generic/backport-4.19/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch new file mode 100644 index 0000000000..a2b274f75e --- /dev/null +++ b/target/linux/generic/backport-4.19/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch @@ -0,0 +1,32 @@ +From 61338e27e2eef3bfcd3df5c39cec5b9dc10ba25c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Sun, 23 Feb 2020 22:08:25 +0100 +Subject: [PATCH] iio: chemical: sps30: fix missing triggered buffer dependency +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +SPS30 uses triggered buffer, but the dependency is not specified in the +Kconfig file. Fix this by selecting IIO_BUFFER and IIO_TRIGGERED_BUFFER +config symbols. + +Cc: stable@vger.kernel.org +Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor") +Signed-off-by: Petr Štetiar +--- + drivers/iio/chemical/Kconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig +index 0b91de4df8f4..a7e65a59bf42 100644 +--- a/drivers/iio/chemical/Kconfig ++++ b/drivers/iio/chemical/Kconfig +@@ -91,6 +91,8 @@ config SPS30 + tristate "SPS30 particulate matter sensor" + depends on I2C + select CRC8 ++ select IIO_BUFFER ++ select IIO_TRIGGERED_BUFFER + help + Say Y here to build support for the Sensirion SPS30 particulate + matter sensor. diff --git a/target/linux/generic/backport-5.4/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch b/target/linux/generic/backport-5.4/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch new file mode 100644 index 0000000000..a2b274f75e --- /dev/null +++ b/target/linux/generic/backport-5.4/507-v5.6-iio-chemical-sps30-fix-missing-triggered-buffer-depe.patch @@ -0,0 +1,32 @@ +From 61338e27e2eef3bfcd3df5c39cec5b9dc10ba25c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Sun, 23 Feb 2020 22:08:25 +0100 +Subject: [PATCH] iio: chemical: sps30: fix missing triggered buffer dependency +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +SPS30 uses triggered buffer, but the dependency is not specified in the +Kconfig file. Fix this by selecting IIO_BUFFER and IIO_TRIGGERED_BUFFER +config symbols. + +Cc: stable@vger.kernel.org +Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor") +Signed-off-by: Petr Štetiar +--- + drivers/iio/chemical/Kconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig +index 0b91de4df8f4..a7e65a59bf42 100644 +--- a/drivers/iio/chemical/Kconfig ++++ b/drivers/iio/chemical/Kconfig +@@ -91,6 +91,8 @@ config SPS30 + tristate "SPS30 particulate matter sensor" + depends on I2C + select CRC8 ++ select IIO_BUFFER ++ select IIO_TRIGGERED_BUFFER + help + Say Y here to build support for the Sensirion SPS30 particulate + matter sensor. From d1c2b25212fdfdf50bafb16cb8aa6197f780408c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 3 Mar 2020 12:13:29 +0100 Subject: [PATCH 05/14] gpio-button-hotplug: remove duplicate logging text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes one of the duplicate `gpio-keys` words found in the logs: gpio-keys gpio-keys: gpio-keysdoes not support key code:143 Signed-off-by: Petr Štetiar --- .../kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 3e8e0ea268..9575c6245b 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -517,20 +517,20 @@ static int gpio_keys_button_probe(struct platform_device *pdev, unsigned int gpio = button->gpio; if (button->wakeup) { - dev_err(dev, DRV_NAME "does not support wakeup\n"); + dev_err(dev, "does not support wakeup\n"); return -EINVAL; } bdata->map_entry = button_get_index(button->code); if (bdata->map_entry < 0) { - dev_warn(dev, DRV_NAME "does not support key code:%u\n", + dev_warn(dev, "does not support key code:%u\n", button->code); continue; } if (!(button->type == 0 || button->type == EV_KEY || button->type == EV_SW)) { - dev_warn(dev, DRV_NAME "only supports buttons or switches\n"); + dev_warn(dev, "only supports buttons or switches\n"); continue; } From a61c787f9f74a34074f8c69cc0325a65af5c3845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sun, 1 Mar 2020 22:26:02 +0100 Subject: [PATCH 06/14] uboot-imx6: bump to 2020.01 and refresh patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update U-Boot to latest release, remove `100-wandboard-enable-fit.patch` as FIT support was added in commit 5b8585825128 ("wandboard: Add FIT image support"). Rework `110-mx6cuboxi-mmc-fallback.patch` into two patches as there was new config option `CONFIG_SPL_FORCE_MMC_BOOT` added upstream which should provide the same functionality as the previous patch hunk. Moving Apalis towards generic distro_bootcmd. Cc: Vladimir Vid Cc: Tim Harvey Cc: Koen Vandeputte Signed-off-by: Petr Štetiar --- package/boot/uboot-imx6/Makefile | 4 +- ...efconfig-enable-some-useful-commands.patch | 39 ++++++ ...s-Make-the-boot-process-more-generic.patch | 123 ------------------ .../patches/100-wandboard-enable-fit.patch | 17 --- .../patches/110-mx6cuboxi-mmc-fallback.patch | 13 +- ...1-mx6cuboxi_defconfig-force-mmc-boot.patch | 23 ++++ 6 files changed, 65 insertions(+), 154 deletions(-) create mode 100644 package/boot/uboot-imx6/patches/0001-apalis_imx6_defconfig-enable-some-useful-commands.patch delete mode 100644 package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch delete mode 100644 package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch create mode 100644 package/boot/uboot-imx6/patches/111-mx6cuboxi_defconfig-force-mmc-boot.patch diff --git a/package/boot/uboot-imx6/Makefile b/package/boot/uboot-imx6/Makefile index 193a35d27c..3f6bb1c5de 100644 --- a/package/boot/uboot-imx6/Makefile +++ b/package/boot/uboot-imx6/Makefile @@ -7,10 +7,10 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2019.04 +PKG_VERSION:=2020.01 PKG_RELEASE:=1 -PKG_HASH:=76b7772d156b3ddd7644c8a1736081e55b78828537ff714065d21dbade229bef +PKG_HASH:=aa453c603208b1b27bd03525775a7f79b443adec577fdc6e8f06974025a135f1 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/boot/uboot-imx6/patches/0001-apalis_imx6_defconfig-enable-some-useful-commands.patch b/package/boot/uboot-imx6/patches/0001-apalis_imx6_defconfig-enable-some-useful-commands.patch new file mode 100644 index 0000000000..18ad2d66d3 --- /dev/null +++ b/package/boot/uboot-imx6/patches/0001-apalis_imx6_defconfig-enable-some-useful-commands.patch @@ -0,0 +1,39 @@ +From 630b39c46b29de1874149c6b2c18c64966a0fabf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Sun, 1 Mar 2020 22:47:31 +0100 +Subject: [PATCH] apalis_imx6_defconfig: enable some useful commands +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +partition table info, EXT4 write support, support for FAT and generic FS +commands like load/ls that work for multiple FS types. + +Signed-off-by: Petr Štetiar +--- + configs/apalis_imx6_defconfig | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig +index 0d11ab53d663..bbb3ec1aa554 100644 +--- a/configs/apalis_imx6_defconfig ++++ b/configs/apalis_imx6_defconfig +@@ -43,6 +43,7 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_I2C=y + CONFIG_CMD_MMC=y ++CONFIG_CMD_PART=y + CONFIG_CMD_USB=y + CONFIG_CMD_USB_SDP=y + CONFIG_CMD_USB_MASS_STORAGE=y +@@ -52,6 +53,10 @@ CONFIG_CMD_PMIC=y + CONFIG_CMD_REGULATOR=y + CONFIG_OF_CONTROL=y + CONFIG_DEFAULT_DEVICE_TREE="imx6-apalis" ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_EXT4_WRITE=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y + CONFIG_ENV_IS_IN_MMC=y + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y diff --git a/package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch b/package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch deleted file mode 100644 index 4de8ede39f..0000000000 --- a/package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 42cc2cffb6d550fbb21dad033d2564d4da571015 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20=C5=A0tetiar?= -Date: Sat, 1 Dec 2018 12:46:37 +0100 -Subject: [PATCH] imx6: apalis: Make the boot process more generic -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -I'm preparing support for Apalis imx6 boards in OpenWrt and I've ended -up with quite huge patchset against upstream U-Boot 2018.03, so I'm -trying to propose more generic way of boot process handling. - -In OpenWrt we usually have kernel, dtbs and U-Boot boot script in boot -partition with ext4fs, so for some use cases it would be handy to be -able to replace some of the files in the boot partion, that's why I've -added write support to the ext4. - -I've added `set_blkcnt` environment variable which is needed for every -`mmc write` command as we need to always specify size in block count. -This is copy&pasted from official Toradex's flashing scripts, so all the -credits for this work belongs to them. - -Currently the rootfs location is passed via mmcblk number and the -problem with this approach is that the mmcblk number for the boot device -changes depending on the kernel version and imx6 SoC type. In order to -avoid such issues, use the UUID method to specify the rootfs location. - -I've added new boot sequence, where we first try to load and run boot -script defined in the new `script` variable, so the boot process could -be more generic and overridden by the distro. When the boot script isn't -loaded, it will use the previous boot sequence so it should be backward -compatible. - -For the recovery purposes and better end user experience I've added boot -from SDP as the last boot command if every other boot option fails. I -plan to use SDP as official flashing/recovery procedure in OpenWrt for -Apalis imx6 boards. - -I've copy&pasted almost everything from the `f086812a mx6sxsabresd: Use -PARTUUID to specify the rootfs location` commit, so credits for the rest -of this patch belongs to Fabio. - -Cc: Stefan Agner -Cc: Max Krummenacher -Signed-off-by: Petr Štetiar ---- - configs/apalis_imx6_defconfig | 2 ++ - include/configs/apalis_imx6.h | 26 +++++++++++++++++++++----- - 2 files changed, 23 insertions(+), 5 deletions(-) - ---- a/configs/apalis_imx6_defconfig -+++ b/configs/apalis_imx6_defconfig -@@ -40,6 +40,7 @@ CONFIG_CMD_DFU=y - CONFIG_CMD_GPIO=y - CONFIG_CMD_I2C=y - CONFIG_CMD_MMC=y -+CONFIG_CMD_PART=y - CONFIG_CMD_USB=y - CONFIG_CMD_USB_SDP=y - CONFIG_CMD_USB_MASS_STORAGE=y -@@ -49,6 +50,7 @@ CONFIG_CMD_PING=y - CONFIG_CMD_BMP=y - CONFIG_CMD_CACHE=y - CONFIG_CMD_EXT4=y -+CONFIG_CMD_EXT4_WRITE=y - CONFIG_CMD_FAT=y - CONFIG_CMD_FS_GENERIC=y - CONFIG_ENV_IS_IN_MMC=y ---- a/include/configs/apalis_imx6.h -+++ b/include/configs/apalis_imx6.h -@@ -138,9 +138,9 @@ - "imx6q-colibri-cam-eval-v3.dtb fat 0 1" - - #define EMMC_BOOTCMD \ -- "emmcargs=ip=off root=/dev/mmcblk0p2 rw,noatime rootfstype=ext3 " \ -+ "emmcargs=ip=off root=PARTUUID=${uuid} rw,noatime rootfstype=ext3 " \ - "rootwait\0" \ -- "emmcboot=run setup; " \ -+ "emmcboot=run setup; run finduuid;" \ - "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \ - "${vidargs}; echo Booting from internal eMMC chip...; " \ - "run emmcdtbload; load mmc 0:1 ${kernel_addr_r} " \ -@@ -197,10 +197,17 @@ - #define FDT_FILE "imx6q-apalis_v1_0-eval.dtb" - #endif - #define CONFIG_EXTRA_ENV_SETTINGS \ -- "bootcmd=run emmcboot ; echo ; echo emmcboot failed ; " \ -+ "script=boot.scr\0" \ -+ "finduuid=part uuid mmc 0:2 uuid\0" \ -+ "loadbootscript=" \ -+ "load mmc 0:1 ${loadaddr} ${script};\0" \ -+ "bootscript=echo Running bootscript from mmc ...; " \ -+ "source\0" \ -+ "bootcmd_default=run emmcboot ; echo ; echo emmcboot failed ; " \ - "run nfsboot ; echo ; echo nfsboot failed ; " \ - "usb start ;" \ -- "setenv stdout serial,vga ; setenv stdin serial,usbkbd\0" \ -+ "setenv stdout serial,vga ; setenv stdin serial,usbkbd;" \ -+ "sdp 0\0" \ - "boot_file=uImage\0" \ - "console=ttymxc0\0" \ - "defargs=enable_wait_mode=off vmalloc=400M\0" \ -@@ -228,7 +235,16 @@ - "vidargs=mxc_hdmi.only_cea=1 " \ - "video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 " \ - "video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off " \ -- "fbmem=32M\0 " -+ "fbmem=32M\0 " \ -+ "set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200\0" -+ -+#define CONFIG_BOOTCOMMAND \ -+ "mmc dev 0;" \ -+ "if run loadbootscript; then " \ -+ "run bootscript; " \ -+ "else " \ -+ "run bootcmd_default; " \ -+ "fi; " - - /* Miscellaneous configurable options */ - #undef CONFIG_SYS_CBSIZE --- -1.9.1 - diff --git a/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch b/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch deleted file mode 100644 index 2fd207e11c..0000000000 --- a/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/configs/wandboard_defconfig -+++ b/configs/wandboard_defconfig -@@ -30,7 +30,7 @@ CONFIG_CMD_I2C=y - CONFIG_CMD_MMC=y - CONFIG_CMD_SATA=y - CONFIG_CMD_USB=y --CONFIG_CMD_CACHE=y -+# CONFIG_CMD_CACHE is not set - CONFIG_CMD_EXT4_WRITE=y - CONFIG_ENV_IS_IN_MMC=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -@@ -44,3 +44,5 @@ CONFIG_USB=y - CONFIG_VIDEO=y - # CONFIG_VIDEO_SW_CURSOR is not set - CONFIG_OF_LIBFDT=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y diff --git a/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch b/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch index 2b2fde5ec9..111e1b9809 100644 --- a/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch +++ b/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch @@ -1,6 +1,6 @@ --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c -@@ -290,6 +290,12 @@ static void setup_iomux_enet(void) +@@ -292,6 +292,12 @@ static void setup_iomux_enet(void) udelay(100); } @@ -13,14 +13,3 @@ int board_phy_config(struct phy_device *phydev) { if (phydev->drv->config) ---- a/arch/arm/mach-imx/spl.c -+++ b/arch/arm/mach-imx/spl.c -@@ -176,7 +176,7 @@ int g_dnl_bind_fixup(struct usb_device_d - /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ - u32 spl_boot_mode(const u32 boot_device) - { -- switch (spl_boot_device()) { -+ switch (boot_device) { - /* for MMC return either RAW or FAT mode */ - case BOOT_DEVICE_MMC1: - case BOOT_DEVICE_MMC2: diff --git a/package/boot/uboot-imx6/patches/111-mx6cuboxi_defconfig-force-mmc-boot.patch b/package/boot/uboot-imx6/patches/111-mx6cuboxi_defconfig-force-mmc-boot.patch new file mode 100644 index 0000000000..19b73e3c9f --- /dev/null +++ b/package/boot/uboot-imx6/patches/111-mx6cuboxi_defconfig-force-mmc-boot.patch @@ -0,0 +1,23 @@ +From 00ad8b42dfe801107db25ead8249cb10afcd0f94 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Sun, 1 Mar 2020 22:10:23 +0100 +Subject: [PATCH] mx6cuboxi_defconfig: force mmc boot +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + configs/mx6cuboxi_defconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/configs/mx6cuboxi_defconfig ++++ b/configs/mx6cuboxi_defconfig +@@ -6,6 +6,7 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y + CONFIG_SPL_LIBGENERIC_SUPPORT=y + CONFIG_TARGET_MX6CUBOXI=y + CONFIG_SPL_MMC_SUPPORT=y ++CONFIG_SPL_FORCE_MMC_BOOT=y + CONFIG_SPL_SERIAL_SUPPORT=y + CONFIG_ENV_SIZE=0x2000 + CONFIG_ENV_OFFSET=0xFE000 From 26760c5e0df29b5a9e4587996dbf5e0e94b9e445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 2 Mar 2020 17:47:16 +0100 Subject: [PATCH 07/14] imx6: apalis: fix variables in bootscript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit U-Boot 2020.01 has changed names for same variables, adjust the bootscript accordingly. Added boot_file variable as the default value is zImage. Signed-off-by: Petr Štetiar --- target/linux/imx6/image/bootscript-apalis | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/linux/imx6/image/bootscript-apalis b/target/linux/imx6/image/bootscript-apalis index 81a501cc63..3a3a6dadb1 100644 --- a/target/linux/imx6/image/bootscript-apalis +++ b/target/linux/imx6/image/bootscript-apalis @@ -1,12 +1,13 @@ -echo "Toradex Apalis OpenWrt Boot script v1.0" +echo "Toradex Apalis OpenWrt Boot script v1.1" -run finduuid +run emmcfinduuid setenv nextcon 0 +setenv boot_file uImage setenv fdt_file imx6q-apalis-ixora.dtb setenv root root=PARTUUID=${uuid} rootfstype=squashfs rootwait setenv bootargs earlyprintk console=${console},${baudrate}n8 ${root} -setenv fsload ext4load mmc ${mmcbootdev}:${bootpart} +setenv fsload ext4load mmc ${emmcdev}:${emmcbootpart} if ${fsload} ${kernel_addr_r} ${boot_file}; then if ${fsload} ${fdt_addr_r} ${fdt_file}; then From 156bf9980e2420c1866110af1ef6e5a0592b75bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 2 Mar 2020 18:03:27 +0100 Subject: [PATCH 08/14] imx6: apalis: move set_blkcnt variable into recovery script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've added `set_blkcnt` environment variable which is needed for every `mmc write` command as we need to always specify size in block count. That `set_blkcnt` variable was previously present in the U-Boot's default environment, but that needed patching U-Boot every time, so that patch was dropped with 2020.01 version bump. Signed-off-by: Petr Štetiar --- target/linux/imx6/image/recovery-apalis | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/imx6/image/recovery-apalis b/target/linux/imx6/image/recovery-apalis index c1c5a3f5d6..d75b954345 100644 --- a/target/linux/imx6/image/recovery-apalis +++ b/target/linux/imx6/image/recovery-apalis @@ -4,6 +4,7 @@ mmc dev 0 1 mmc write 0x12100000 0x2 0x800 # flash openwrt-imx6-apalis-squashfs.combined.bin +setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200' run set_blkcnt mmc dev 0 0 mmc write 0x12500000 0 ${blkcnt} From 0543eb111081a5c1791e2d298db3ee4ea487c3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 2 Mar 2020 21:54:13 +0100 Subject: [PATCH 09/14] imx6: 5.4: add missing kernel perf monitor symbol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing kernel config symbol probably some dependency uncovered by my local perf related and enabled kernel config options. ARM PMU framework (ARM_PMU) [Y/n/?] y Freescale i.MX8 DDR perf monitor (FSL_IMX8_DDR_PMU) [N/m/y/?] (NEW) Signed-off-by: Petr Štetiar --- target/linux/imx6/config-5.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/imx6/config-5.4 b/target/linux/imx6/config-5.4 index b8f42b0044..6dcff24887 100644 --- a/target/linux/imx6/config-5.4 +++ b/target/linux/imx6/config-5.4 @@ -249,6 +249,7 @@ CONFIG_FIX_EARLYCON_MEM=y CONFIG_FSL_GUTS=y # CONFIG_FSL_QDMA is not set CONFIG_FS_ENCRYPTION=y +# CONFIG_FSL_IMX8_DDR_PMU is not set CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y From a5b06b7aa5dad12a7b1cebdff041c95c6bc3ec74 Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Tue, 3 Mar 2020 22:32:42 +0100 Subject: [PATCH 10/14] mxs: switch to kernel 5.4 Compiled for and run-tested on - I2SE Duckbill board - Olimex OLinuXino Maxi board Signed-off-by: Michael Heimpold --- target/linux/mxs/Makefile | 2 +- target/linux/mxs/{config-4.19 => config-5.4} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename target/linux/mxs/{config-4.19 => config-5.4} (100%) diff --git a/target/linux/mxs/Makefile b/target/linux/mxs/Makefile index 96aba031d7..6071329371 100644 --- a/target/linux/mxs/Makefile +++ b/target/linux/mxs/Makefile @@ -13,7 +13,7 @@ FEATURES:=ext4 rtc usb gpio CPU_TYPE:=arm926ej-s MAINTAINER:=Zoltan HERPAI -KERNEL_PATCHVER:=4.19 +KERNEL_PATCHVER:=5.4 KERNELNAME:=zImage dtbs define Target/Description diff --git a/target/linux/mxs/config-4.19 b/target/linux/mxs/config-5.4 similarity index 100% rename from target/linux/mxs/config-4.19 rename to target/linux/mxs/config-5.4 From a468a452531371b99c84ec7442a51edb96d4316f Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Wed, 4 Mar 2020 23:42:02 +0100 Subject: [PATCH 11/14] uboot-envtools: mxs: add support for olimex, imx23-olinuxino Add ubootenv uci config for Olimex OLinuXino boards. Signed-off-by: Michael Heimpold --- package/boot/uboot-envtools/Makefile | 2 +- package/boot/uboot-envtools/files/mxs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 1c6b789716..49d57e69bd 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot PKG_VERSION:=2019.07 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz diff --git a/package/boot/uboot-envtools/files/mxs b/package/boot/uboot-envtools/files/mxs index ecfb5de162..e087d60783 100644 --- a/package/boot/uboot-envtools/files/mxs +++ b/package/boot/uboot-envtools/files/mxs @@ -17,6 +17,9 @@ i2se,duckbill) ubootenv_add_uci_config "/dev/mmcblk0" "0x20000" "0x20000" ubootenv_add_uci_config "/dev/mmcblk0" "0x40000" "0x20000" ;; +olimex,imx23-olinuxino) + ubootenv_add_uci_config "/dev/mmcblk0" "0x40000" "0x4000" + ;; esac config_load ubootenv From 9405fb079bccb0a736f8fd187f4dd5a3c26723ec Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Wed, 4 Mar 2020 23:42:19 +0100 Subject: [PATCH 12/14] uboot-mxs: bump to v2020.01 Also update the U-Boot BSP patch for I2SE Duckbill devices. Run tested on I2SE Duckbill and Olimex OLinuXino Maxi boards. Signed-off-by: Michael Heimpold --- package/boot/uboot-mxs/Makefile | 4 ++-- .../patches/001-add-i2se-duckbill.patch | 24 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile index 04d3f15f95..3112d673d4 100644 --- a/package/boot/uboot-mxs/Makefile +++ b/package/boot/uboot-mxs/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2019.10 +PKG_VERSION:=2020.01 PKG_RELEASE:=1 -PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014 +PKG_HASH:=aa453c603208b1b27bd03525775a7f79b443adec577fdc6e8f06974025a135f1 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch index c7b8fd63ea..033c843202 100644 --- a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch +++ b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch @@ -1,4 +1,4 @@ -From 821d083ae4cfb795eab385eda43a20cdc8c3cacd Mon Sep 17 00:00:00 2001 +From b66c70cd15fa02297b94d928970932ef62c2ff02 Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Sun, 3 Nov 2019 00:50:21 +0100 Subject: [PATCH] arm: mxs: add support for I2SE's Duckbill boards @@ -32,9 +32,9 @@ Signed-off-by: Stefan Wahren board/i2se/duckbill/Makefile | 10 ++ board/i2se/duckbill/duckbill.c | 186 ++++++++++++++++++++++++++++++++ board/i2se/duckbill/iomux.c | 156 +++++++++++++++++++++++++++ - configs/duckbill_defconfig | 40 +++++++ - include/configs/duckbill.h | 179 ++++++++++++++++++++++++++++++ - 8 files changed, 597 insertions(+) + configs/duckbill_defconfig | 41 +++++++ + include/configs/duckbill.h | 176 ++++++++++++++++++++++++++++++ + 8 files changed, 595 insertions(+) create mode 100644 board/i2se/duckbill/Kconfig create mode 100644 board/i2se/duckbill/MAINTAINERS create mode 100644 board/i2se/duckbill/Makefile @@ -471,10 +471,10 @@ index 0000000000..1db3c52c34 +} diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig new file mode 100644 -index 0000000000..5a8c561b4e +index 0000000000..fcdec4f3c7 --- /dev/null +++ b/configs/duckbill_defconfig -@@ -0,0 +1,40 @@ +@@ -0,0 +1,41 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX28=y +CONFIG_SYS_TEXT_BASE=0x40002000 @@ -483,6 +483,8 @@ index 0000000000..5a8c561b4e +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_TARGET_DUCKBILL=y +CONFIG_SPL_SERIAL_SUPPORT=y ++CONFIG_ENV_SIZE=0x20000 ++CONFIG_ENV_OFFSET=0x20000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SPL=y +CONFIG_SPL_TEXT_BASE=0x00001000 @@ -496,7 +498,6 @@ index 0000000000..5a8c561b4e +CONFIG_CMD_BOOTZ=y +# CONFIG_CMD_ELF is not set +CONFIG_CMD_UNZIP=y -+# CONFIG_CMD_FLASH is not set +CONFIG_CMD_FUSE=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_MMC=y @@ -509,18 +510,18 @@ index 0000000000..5a8c561b4e +CONFIG_CMD_FS_GENERIC=y +CONFIG_DOS_PARTITION=y +CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_MXS_GPIO=y +CONFIG_MMC_MXS=y +CONFIG_MII=y +CONFIG_CONS_INDEX=0 +CONFIG_OF_LIBFDT=y -+# CONFIG_EFI_LOADER is not set diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h new file mode 100644 -index 0000000000..e7fce8843e +index 0000000000..76da1008b8 --- /dev/null +++ b/include/configs/duckbill.h -@@ -0,0 +1,179 @@ +@@ -0,0 +1,176 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2014-2019 Michael Heimpold @@ -543,9 +544,6 @@ index 0000000000..e7fce8843e + +/* Environment is in MMC */ +#define CONFIG_ENV_OVERWRITE -+#define CONFIG_ENV_SIZE (128 * 1024) -+#define CONFIG_ENV_OFFSET (128 * 1024) -+#define CONFIG_ENV_OFFSET_REDUND (256 * 1024) +#define CONFIG_SYS_MMC_ENV_DEV 0 +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT + From 1ff8054092668c889c50ad98b66d5bbca7702173 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Fri, 6 Mar 2020 14:08:51 -0800 Subject: [PATCH 13/14] kernel: fix lib-xor for ARM64 use LINUX_KARCH in directory path to avoid failures in non-arm targets. Signed-off-by: Tim Harvey --- package/kernel/linux/modules/lib.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index ea29d08b55..e14c6b31c0 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -187,10 +187,10 @@ define KernelPackage/lib-xor TITLE:=XOR blocks algorithm support HIDDEN:=1 KCONFIG:=CONFIG_XOR_BLOCKS -ifneq ($(wildcard $(LINUX_DIR)/arch/arm/lib/xor-neon.ko),) +ifneq ($(wildcard $(LINUX_DIR)/arch/$(LINUX_KARCH)/lib/xor-neon.ko),) FILES:= \ $(LINUX_DIR)/crypto/xor.ko \ - $(LINUX_DIR)/arch/arm/lib/xor-neon.ko + $(LINUX_DIR)/arch/$(LINUX_KARCH)/lib/xor-neon.ko AUTOLOAD:=$(call AutoProbe,xor-neon xor) else FILES:=$(LINUX_DIR)/crypto/xor.ko From e99093c1cacaf4614d74ec038074a778d9e9fedd Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 8 Mar 2020 15:17:07 +0100 Subject: [PATCH 14/14] oxnas: restore accidentally moved file renamed: files-4.14/phy/phy-oxnas-pcie.c -> files-4.14/drivers/phy/phy-oxnas-pcie.c Signed-off-by: Daniel Golle --- target/linux/oxnas/files-4.14/{ => drivers}/phy/phy-oxnas-pcie.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename target/linux/oxnas/files-4.14/{ => drivers}/phy/phy-oxnas-pcie.c (100%) diff --git a/target/linux/oxnas/files-4.14/phy/phy-oxnas-pcie.c b/target/linux/oxnas/files-4.14/drivers/phy/phy-oxnas-pcie.c similarity index 100% rename from target/linux/oxnas/files-4.14/phy/phy-oxnas-pcie.c rename to target/linux/oxnas/files-4.14/drivers/phy/phy-oxnas-pcie.c