From cee4cdcd53ddf4f0be871b29f7c6c4598c8201c8 Mon Sep 17 00:00:00 2001 From: "Alexandros C. Couloumbis" Date: Fri, 16 Dec 2022 22:13:53 +0200 Subject: [PATCH] Revert "kernel: remove obsolete kernel version switches for 4.14" This reverts commit 6362a04725b859ac306e54359b14ea2612af28db. --- config/Config-kernel.in | 137 +++---- include/netfilter.mk | 25 +- package/kernel/i2c-gpio-custom/Makefile | 47 +++ package/kernel/i2c-gpio-custom/src/Kconfig | 10 + package/kernel/i2c-gpio-custom/src/Makefile | 1 + .../i2c-gpio-custom/src/i2c-gpio-custom.c | 207 ++++++++++ package/kernel/kmod-sched-cake-oot/Makefile | 54 +++ package/kernel/linux/modules/can.mk | 3 +- package/kernel/linux/modules/crypto.mk | 9 +- package/kernel/linux/modules/fs.mk | 38 +- package/kernel/linux/modules/iio.mk | 4 +- package/kernel/linux/modules/netdevices.mk | 104 +++-- package/kernel/linux/modules/netfilter.mk | 16 +- package/kernel/linux/modules/netsupport.mk | 6 +- package/kernel/linux/modules/other.mk | 97 +++-- package/kernel/linux/modules/usb.mk | 36 +- package/kernel/linux/modules/video.mk | 4 +- package/kernel/spi-gpio-custom/Makefile | 47 +++ package/kernel/spi-gpio-custom/src/Kconfig | 14 + package/kernel/spi-gpio-custom/src/Makefile | 1 + .../spi-gpio-custom/src/spi-gpio-custom.c | 365 ++++++++++++++++++ package/kernel/w1-gpio-custom/Makefile | 48 +++ package/kernel/w1-gpio-custom/src/Kconfig | 4 + package/kernel/w1-gpio-custom/src/Makefile | 1 + .../w1-gpio-custom/src/w1-gpio-custom.c | 190 +++++++++ 25 files changed, 1211 insertions(+), 257 deletions(-) create mode 100644 package/kernel/i2c-gpio-custom/Makefile create mode 100644 package/kernel/i2c-gpio-custom/src/Kconfig create mode 100644 package/kernel/i2c-gpio-custom/src/Makefile create mode 100644 package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c create mode 100644 package/kernel/kmod-sched-cake-oot/Makefile create mode 100644 package/kernel/spi-gpio-custom/Makefile create mode 100644 package/kernel/spi-gpio-custom/src/Kconfig create mode 100644 package/kernel/spi-gpio-custom/src/Makefile create mode 100644 package/kernel/spi-gpio-custom/src/spi-gpio-custom.c create mode 100644 package/kernel/w1-gpio-custom/Makefile create mode 100644 package/kernel/w1-gpio-custom/src/Kconfig create mode 100644 package/kernel/w1-gpio-custom/src/Makefile create mode 100644 package/kernel/w1-gpio-custom/src/w1-gpio-custom.c diff --git a/config/Config-kernel.in b/config/Config-kernel.in index d4648a5064..492c762678 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1,6 +1,8 @@ -# SPDX-License-Identifier: GPL-2.0-only -# # Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# config KERNEL_BUILD_USER string "Custom Kernel Build User Name" @@ -33,10 +35,6 @@ config KERNEL_SWAP bool "Support for paging of anonymous memory (swap)" default y if !SMALL_FLASH -config KERNEL_PROC_STRIPPED - bool "Strip non-essential /proc functionality to reduce code size" - default y if SMALL_FLASH - config KERNEL_DEBUG_FS bool "Compile the kernel with debug filesystem enabled" default y @@ -46,9 +44,15 @@ config KERNEL_DEBUG_FS write to these files. Many common debugging facilities, such as ftrace, require the existence of debugfs. +# remove KERNEL_MIPS_FPU_EMULATOR after kernel 4.19 is gone +config KERNEL_MIPS_FPU_EMULATOR + bool "Compile the kernel with MIPS FPU Emulator" + default y if TARGET_pistachio + depends on (mips || mipsel || mips64 || mips64el) + config KERNEL_MIPS_FP_SUPPORT bool - default y if TARGET_pistachio + default y if KERNEL_MIPS_FPU_EMULATOR config KERNEL_ARM_PMU bool @@ -268,40 +272,6 @@ config KERNEL_FUNCTION_PROFILER depends on KERNEL_FUNCTION_TRACER default n -config KERNEL_IRQSOFF_TRACER - bool "Interrupts-off Latency Tracer" - depends on KERNEL_FTRACE - help - This option measures the time spent in irqs-off critical - sections, with microsecond accuracy. - - The default measurement method is a maximum search, which is - disabled by default and can be runtime (re-)started - via: - - echo 0 > /sys/kernel/debug/tracing/tracing_max_latency - - (Note that kernel size and overhead increase with this option - enabled. This option and the preempt-off timing option can be - used together or separately.) - -config KERNEL_PREEMPT_TRACER - bool "Preemption-off Latency Tracer" - depends on KERNEL_FTRACE - help - This option measures the time spent in preemption-off critical - sections, with microsecond accuracy. - - The default measurement method is a maximum search, which is - disabled by default and can be runtime (re-)started - via: - - echo 0 > /sys/kernel/debug/tracing/tracing_max_latency - - (Note that kernel size and overhead increase with this option - enabled. This option and the irqs-off timing option can be - used together or separately.) - config KERNEL_DEBUG_KERNEL bool default n @@ -363,6 +333,10 @@ config KERNEL_KPROBES instrumentation and testing. If in doubt, say "N". +config KERNEL_KPROBE_EVENT + bool + default y if KERNEL_KPROBES + config KERNEL_KPROBE_EVENTS bool default y if KERNEL_KPROBES @@ -371,10 +345,6 @@ config KERNEL_AIO bool "Compile the kernel with asynchronous IO support" default y if !SMALL_FLASH -config KERNEL_IO_URING - bool "Compile the kernel with io_uring support" - default y if !SMALL_FLASH - config KERNEL_FHANDLE bool "Compile the kernel with support for fhandle syscalls" default y if !SMALL_FLASH @@ -436,22 +406,34 @@ config KERNEL_PROVE_LOCKING select KERNEL_DEBUG_KERNEL default n -config KERNEL_SOFTLOCKUP_DETECTOR - bool "Compile the kernel with detect Soft Lockups" +config KERNEL_LOCKUP_DETECTOR + bool "Compile the kernel with detect Hard and Soft Lockups" depends on KERNEL_DEBUG_KERNEL help Say Y here to enable the kernel to act as a watchdog to detect - soft lockups. + hard and soft lockups. Softlockups are bugs that cause the kernel to loop in kernel mode for more than 20 seconds, without giving other tasks a chance to run. The current stack trace is displayed upon detection and the system will stay locked up. + Hardlockups are bugs that cause the CPU to loop in kernel mode + for more than 10 seconds, without letting other interrupts have a + chance to run. The current stack trace is displayed upon detection + and the system will stay locked up. + + The overhead should be minimal. A periodic hrtimer runs to + generate interrupts and kick the watchdog task every 4 seconds. + An NMI is generated every 10 seconds or so to check for hardlockups. + + The frequency of hrtimer and NMI events and the soft and hard lockup + thresholds can be controlled through the sysctl watchdog_thresh. + config KERNEL_DETECT_HUNG_TASK bool "Compile the kernel with detect Hung Tasks" depends on KERNEL_DEBUG_KERNEL - default KERNEL_SOFTLOCKUP_DETECTOR + default KERNEL_LOCKUP_DETECTOR help Say Y here to enable the kernel to detect "hung tasks", which are bugs that cause the task to be stuck in @@ -555,23 +537,23 @@ if KERNEL_DEVTMPFS endif config KERNEL_KEYS - bool "Enable kernel access key retention support" - default !SMALL_FLASH + bool "Enable kernel access key retention support" + default n config KERNEL_PERSISTENT_KEYRINGS - bool "Enable kernel persistent keyrings" - depends on KERNEL_KEYS - default n - -config KERNEL_KEYS_REQUEST_CACHE - bool "Enable temporary caching of the last request_key() result" - depends on KERNEL_KEYS - default n + bool "Enable kernel persistent keyrings" + depends on KERNEL_KEYS + default n config KERNEL_BIG_KEYS - bool "Enable large payload keys on kernel keyrings" - depends on KERNEL_KEYS - default n + bool "Enable large payload keys on kernel keyrings" + depends on KERNEL_KEYS + default n + +config KERNEL_ENCRYPTED_KEYS + tristate "Enable keys with encrypted payloads on kernel keyrings" + depends on KERNEL_KEYS + default n # # CGROUP support symbols @@ -956,15 +938,6 @@ if KERNEL_IPV6 config KERNEL_IPV6_PIMSM_V2 def_bool n - config KERNEL_IPV6_SEG6_LWTUNNEL - bool "Enable support for lightweight tunnels" - default y if !SMALL_FLASH - help - Using lwtunnel (needed for IPv6 segment routing) requires ip-full package. - - config KERNEL_LWTUNNEL_BPF - def_bool n - endif # @@ -1151,7 +1124,6 @@ config KERNEL_SECURITY_SELINUX config KERNEL_SECURITY_SELINUX_BOOTPARAM bool "NSA SELinux boot parameter" depends on KERNEL_SECURITY_SELINUX - default y config KERNEL_SECURITY_SELINUX_DISABLE bool "NSA SELinux runtime disable" @@ -1160,22 +1132,19 @@ config KERNEL_SECURITY_SELINUX_DISABLE config KERNEL_SECURITY_SELINUX_DEVELOP bool "NSA SELinux Development Support" depends on KERNEL_SECURITY_SELINUX - default y -config KERNEL_SECURITY_SELINUX_SIDTAB_HASH_BITS - int +choice + prompt "First legacy 'major LSM' to be initialized" depends on KERNEL_SECURITY_SELINUX - default 9 + default KERNEL_DEFAULT_SECURITY_SELINUX -config KERNEL_SECURITY_SELINUX_SID2STR_CACHE_SIZE - int - depends on KERNEL_SECURITY_SELINUX - default 256 + config KERNEL_DEFAULT_SECURITY_SELINUX + bool "SELinux" -config KERNEL_LSM - string - default "lockdown,yama,loadpin,safesetid,integrity,selinux" - depends on KERNEL_SECURITY_SELINUX + config KERNEL_DEFAULT_SECURITY_DAC + bool "Unix Discretionary Access Controls" + +endchoice config KERNEL_EXT4_FS_SECURITY bool "Ext4 Security Labels" diff --git a/include/netfilter.mk b/include/netfilter.mk index 60f031e9a7..c6f4f206b5 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -1,6 +1,9 @@ -# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2020 OpenWrt.org +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# ifneq ($(__inc_netfilter),1) __inc_netfilter:=1 @@ -181,18 +184,23 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt)) # kernel only $(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT, $(P_XT)nf_nat),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_REDIRECT, $(P_XT)nf_nat_redirect),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_IPV4, $(P_V4)nf_nat_ipv4),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT6,CONFIG_NF_NAT_IPV6, $(P_V6)nf_nat_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_NAT, $(P_XT)xt_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT,CONFIG_IP_NF_NAT, $(P_V4)iptable_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_NAT, $(P_V6)ip6table_nat),)) +$(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_MASQUERADE, $(P_V6)ip6t_MASQUERADE, lt 5.2),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, $(P_V6)ip6t_NPT),)) # userland only $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT,CONFIG_NF_NAT, ipt_SNAT ipt_DNAT))) $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, ip6t_DNPT ip6t_SNPT))) -$(eval $(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_TARGET_MASQUERADE, $(P_XT)xt_MASQUERADE)) -$(eval $(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_TARGET_REDIRECT, $(P_XT)xt_REDIRECT)) +$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_MASQUERADE, $(P_V4)ipt_MASQUERADE, lt 5.2)) +$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_MASQUERADE, $(P_XT)xt_MASQUERADE, ge 5.2)) +$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_REDIRECT, $(P_XT)xt_REDIRECT)) # nat-extra @@ -211,6 +219,8 @@ $(eval $(call nf_add,NF_NATHELPER,CONFIG_NF_NAT_FTP, $(P_XT)nf_nat_ftp)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_BROADCAST, $(P_XT)nf_conntrack_broadcast)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_AMANDA, $(P_XT)nf_conntrack_amanda)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_AMANDA, $(P_XT)nf_nat_amanda)) +$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CT_PROTO_GRE, $(P_XT)nf_conntrack_proto_gre)) +$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_PROTO_GRE, $(P_V4)nf_nat_proto_gre)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_H323, $(P_XT)nf_conntrack_h323)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_H323, $(P_V4)nf_nat_h323)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_PPTP, $(P_XT)nf_conntrack_pptp)) @@ -322,8 +332,11 @@ $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nf # nftables $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES, $(P_XT)nf_tables),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_SET, $(P_XT)nf_tables_set),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, $(P_V4)nft_chain_route_ipv4),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, $(P_V6)nft_chain_route_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_COUNTER, $(P_XT)nft_counter),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_EXTHDR, $(P_XT)nft_exthdr),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, $(P_XT)nft_hash),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LIMIT, $(P_XT)nft_limit),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),)) @@ -339,12 +352,13 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_META, $(P_EBT) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EBT)nft_reject_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_chain_nat),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_CHAIN_NAT_IPV4, $(P_V4)nft_chain_nat_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ, $(P_XT)nft_masq),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ_IPV4, $(P_V4)nft_masq_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_CHAIN_NAT_IPV6, $(P_V6)nft_chain_nat_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_MASQ_IPV6, $(P_V6)nft_masq_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB, $(P_XT)nft_fib),)) @@ -352,7 +366,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_INET, $(P_XT)nft_fib $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV4, $(P_V4)nft_fib_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV6, $(P_V6)nft_fib_ipv6),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_QUEUE,CONFIG_NFT_QUEUE, $(P_XT)nft_queue),)) # userland only IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m) diff --git a/package/kernel/i2c-gpio-custom/Makefile b/package/kernel/i2c-gpio-custom/Makefile new file mode 100644 index 0000000000..0779107c18 --- /dev/null +++ b/package/kernel/i2c-gpio-custom/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=i2c-gpio-custom +PKG_RELEASE:=3 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/i2c-gpio-custom + SUBMENU:=I2C support + TITLE:=Custom GPIO-based I2C device + DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +kmod-i2c-gpio @LINUX_4_14 + FILES:=$(PKG_BUILD_DIR)/i2c-gpio-custom.ko + KCONFIG:= +endef + +define KernelPackage/i2c-gpio-custom/description + Kernel module for register a custom i2c-gpio platform device. +endef + +EXTRA_KCONFIG:= \ + CONFIG_I2C_GPIO_CUSTOM=m + +EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \ + +MAKE_OPTS:= \ + $(KERNEL_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + $(EXTRA_KCONFIG) + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + modules +endef + +$(eval $(call KernelPackage,i2c-gpio-custom)) diff --git a/package/kernel/i2c-gpio-custom/src/Kconfig b/package/kernel/i2c-gpio-custom/src/Kconfig new file mode 100644 index 0000000000..e2e3a68d92 --- /dev/null +++ b/package/kernel/i2c-gpio-custom/src/Kconfig @@ -0,0 +1,10 @@ +config I2C_GPIO_CUSTOM + tristate "Custom GPIO-based I2C driver" + depends on GENERIC_GPIO + select I2C_GPIO + help + This is an I2C driver to register 1 to 4 custom I2C buses using + GPIO lines. + + This support is also available as a module. If so, the module + will be called i2c-gpio-custom. diff --git a/package/kernel/i2c-gpio-custom/src/Makefile b/package/kernel/i2c-gpio-custom/src/Makefile new file mode 100644 index 0000000000..dcb2e2abe2 --- /dev/null +++ b/package/kernel/i2c-gpio-custom/src/Makefile @@ -0,0 +1 @@ +obj-${CONFIG_I2C_GPIO_CUSTOM} += i2c-gpio-custom.o \ No newline at end of file diff --git a/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c b/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c new file mode 100644 index 0000000000..23dfa36d69 --- /dev/null +++ b/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c @@ -0,0 +1,207 @@ +/* + * Custom GPIO-based I2C driver + * + * Copyright (C) 2007-2008 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * --------------------------------------------------------------------------- + * + * The behaviour of this driver can be altered by setting some parameters + * from the insmod command line. + * + * The following parameters are adjustable: + * + * bus0 These four arguments can be arrays of + * bus1 1-8 unsigned integers as follows: + * bus2 + * bus3 ,,,,,,, + * + * where: + * + * ID to used as device_id for the corresponding bus (required) + * GPIO pin ID to used for SDA (required) + * GPIO pin ID to used for SCL (required) + * signal toggle delay. + * clock stretching timeout. + * SDA is configured as open drain. + * SCL is configured as open drain. + * SCL output drivers cannot be turned off. + * + * See include/i2c-gpio.h for more information about the parameters. + * + * If this driver is built into the kernel, you can use the following kernel + * command line parameters, with the same values as the corresponding module + * parameters listed above: + * + * i2c-gpio-custom.bus0 + * i2c-gpio-custom.bus1 + * i2c-gpio-custom.bus2 + * i2c-gpio-custom.bus3 + */ + +#include +#include +#include +#include + +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) +#include +#else +#include +#endif + +#define DRV_NAME "i2c-gpio-custom" +#define DRV_DESC "Custom GPIO-based I2C driver" +#define DRV_VERSION "0.1.2" + +#define PFX DRV_NAME ": " + +#define BUS_PARAM_ID 0 +#define BUS_PARAM_SDA 1 +#define BUS_PARAM_SCL 2 +#define BUS_PARAM_UDELAY 3 +#define BUS_PARAM_TIMEOUT 4 +#define BUS_PARAM_SDA_OD 5 +#define BUS_PARAM_SCL_OD 6 +#define BUS_PARAM_SCL_OO 7 + +#define BUS_PARAM_REQUIRED 3 +#define BUS_PARAM_COUNT 8 +#define BUS_COUNT_MAX 4 + +static unsigned int bus0[BUS_PARAM_COUNT] __initdata; +static unsigned int bus1[BUS_PARAM_COUNT] __initdata; +static unsigned int bus2[BUS_PARAM_COUNT] __initdata; +static unsigned int bus3[BUS_PARAM_COUNT] __initdata; + +static unsigned int bus_nump[BUS_COUNT_MAX] __initdata; + +#define BUS_PARM_DESC \ + " config -> id,sda,scl[,udelay,timeout,sda_od,scl_od,scl_oo]" + +module_param_array(bus0, uint, &bus_nump[0], 0); +MODULE_PARM_DESC(bus0, "bus0" BUS_PARM_DESC); +module_param_array(bus1, uint, &bus_nump[1], 0); +MODULE_PARM_DESC(bus1, "bus1" BUS_PARM_DESC); +module_param_array(bus2, uint, &bus_nump[2], 0); +MODULE_PARM_DESC(bus2, "bus2" BUS_PARM_DESC); +module_param_array(bus3, uint, &bus_nump[3], 0); +MODULE_PARM_DESC(bus3, "bus3" BUS_PARM_DESC); + +static struct platform_device *devices[BUS_COUNT_MAX]; +static unsigned int nr_devices; + +static void i2c_gpio_custom_cleanup(void) +{ + int i; + + for (i = 0; i < nr_devices; i++) + if (devices[i]) + platform_device_unregister(devices[i]); +} + +static int __init i2c_gpio_custom_add_one(unsigned int id, unsigned int *params) +{ + struct platform_device *pdev; + struct i2c_gpio_platform_data pdata; + int err; + + if (!bus_nump[id]) + return 0; + + if (bus_nump[id] < BUS_PARAM_REQUIRED) { + printk(KERN_ERR PFX "not enough parameters for bus%d\n", id); + err = -EINVAL; + goto err; + } + + pdev = platform_device_alloc("i2c-gpio", params[BUS_PARAM_ID]); + if (!pdev) { + err = -ENOMEM; + goto err; + } + + pdata.sda_pin = params[BUS_PARAM_SDA]; + pdata.scl_pin = params[BUS_PARAM_SCL]; + pdata.udelay = params[BUS_PARAM_UDELAY]; + pdata.timeout = params[BUS_PARAM_TIMEOUT]; + pdata.sda_is_open_drain = params[BUS_PARAM_SDA_OD] != 0; + pdata.scl_is_open_drain = params[BUS_PARAM_SCL_OD] != 0; + pdata.scl_is_output_only = params[BUS_PARAM_SCL_OO] != 0; + + err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); + if (err) + goto err_put; + + err = platform_device_add(pdev); + if (err) + goto err_put; + + devices[nr_devices++] = pdev; + return 0; + +err_put: + platform_device_put(pdev); +err: + return err; +} + +static int __init i2c_gpio_custom_probe(void) +{ + int err; + + printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); + + err = i2c_gpio_custom_add_one(0, bus0); + if (err) + goto err; + + err = i2c_gpio_custom_add_one(1, bus1); + if (err) + goto err; + + err = i2c_gpio_custom_add_one(2, bus2); + if (err) + goto err; + + err = i2c_gpio_custom_add_one(3, bus3); + if (err) + goto err; + + if (!nr_devices) { + printk(KERN_ERR PFX "no bus parameter(s) specified\n"); + err = -ENODEV; + goto err; + } + + return 0; + +err: + i2c_gpio_custom_cleanup(); + return err; +} + +#ifdef MODULE +static int __init i2c_gpio_custom_init(void) +{ + return i2c_gpio_custom_probe(); +} +module_init(i2c_gpio_custom_init); + +static void __exit i2c_gpio_custom_exit(void) +{ + i2c_gpio_custom_cleanup(); +} +module_exit(i2c_gpio_custom_exit); +#else +subsys_initcall(i2c_gpio_custom_probe); +#endif /* MODULE*/ + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gabor Juhos "); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_VERSION(DRV_VERSION); diff --git a/package/kernel/kmod-sched-cake-oot/Makefile b/package/kernel/kmod-sched-cake-oot/Makefile new file mode 100644 index 0000000000..a6ab1eb4c6 --- /dev/null +++ b/package/kernel/kmod-sched-cake-oot/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2016 LEDE +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=sched-cake-oot +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git +PKG_SOURCE_DATE:=2020-07-24 +PKG_SOURCE_VERSION:=48979385757f3408c3427b3ebbf5963efdada5aa +PKG_MIRROR_HASH:=0e8ed53f55e28ad0c30f20293c16988876bae8d6f70f5629a43cf2ce1e49fc51 +PKG_MAINTAINER:=Kevin Darbyshire-Bryant + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/sched-cake-oot + SUBMENU:=Network Support + TITLE:=OOT Cake fq_codel/blue derived shaper + URL:=https://github.com/dtaht/sch_cake + FILES:=$(PKG_BUILD_DIR)/sch_cake.ko + AUTOLOAD:=$(call AutoLoad,75,sch_cake) + DEPENDS:=@LINUX_4_14 +kmod-sched-core +kmod-ipt-conntrack +endef + +define KernelPackage/sched-cake-oot/description + O(ut) O(f) T(ree) Common Applications Kept Enhanced fq_codel/blue derived shaper +endef + +define KernelPackage/sched-cake-virtual + SUBMENU:=Network Support + TITLE:=Virtual package for sched-cake + URL:=https://github.com/dtaht/sch_cake + DEPENDS:=+!LINUX_4_14:kmod-sched-cake +LINUX_4_14:kmod-sched-cake-oot +endef + +define KernelPackage/sched-cake-virtual/description + Virtual package for resolving sch_cake dependencies +endef + +include $(INCLUDE_DIR)/kernel-defaults.mk + +define Build/Compile + $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules +endef + +$(eval $(call KernelPackage,sched-cake-oot)) +$(eval $(call KernelPackage,sched-cake-virtual)) diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk index 3060fc0966..5542c4fe0a 100644 --- a/package/kernel/linux/modules/can.mk +++ b/package/kernel/linux/modules/can.mk @@ -248,7 +248,8 @@ define KernelPackage/can-usb-kvaser TITLE:=Kvaser CAN/USB interface KCONFIG:=CONFIG_CAN_KVASER_USB FILES:= \ - $(LINUX_DIR)/drivers/net/can/usb/kvaser_usb/kvaser_usb.ko + $(LINUX_DIR)/drivers/net/can/usb/kvaser_usb.ko@lt4.19 \ + $(LINUX_DIR)/drivers/net/can/usb/kvaser_usb/kvaser_usb.ko@ge4.19 AUTOLOAD:=$(call AutoProbe,kvaser_usb) $(call AddDepends/can,+kmod-usb-core) endef diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 4e0a73ccf2..c4cbdbfa63 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -387,7 +387,7 @@ $(eval $(call KernelPackage,crypto-hw-padlock)) define KernelPackage/crypto-hw-safexcel TITLE:= MVEBU SafeXcel Crypto Engine module - DEPENDS:=@(TARGET_mvebu_cortexa53||TARGET_mvebu_cortexa72) +eip197-mini-firmware \ + DEPENDS:=@!LINUX_4_14 @(TARGET_mvebu_cortexa53||TARGET_mvebu_cortexa72) +eip197-mini-firmware \ +kmod-crypto-authenc +kmod-crypto-md5 +kmod-crypto-hmac +kmod-crypto-sha256 +kmod-crypto-sha512 KCONFIG:= \ CONFIG_CRYPTO_HW=y \ @@ -688,8 +688,10 @@ ifndef CONFIG_TARGET_x86_64 $(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko \ $(LINUX_DIR)/arch/x86/crypto/serpent-sse2-i586.ko \ $(LINUX_DIR)/arch/x86/crypto/glue_helper.ko \ + $(LINUX_DIR)/crypto/ablk_helper.ko@lt4.17 \ $(LINUX_DIR)/crypto/cryptd.ko \ - $(LINUX_DIR)/crypto/crypto_simd.ko + $(LINUX_DIR)/crypto/lrw.ko@lt4.17 \ + $(LINUX_DIR)/crypto/crypto_simd.ko@ge4.17 AUTOLOAD+= $(call AutoLoad,10,cryptd glue_helper \ serpent-sse2-i586 twofish-i586 blowfish_generic) endef @@ -708,7 +710,8 @@ define KernelPackage/crypto-misc/x86/64 $(LINUX_DIR)/arch/x86/crypto/twofish-avx-x86_64.ko \ $(LINUX_DIR)/arch/x86/crypto/serpent-avx-x86_64.ko \ $(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx2.ko \ - $(LINUX_DIR)/arch/x86/crypto/serpent-avx2.ko + $(LINUX_DIR)/arch/x86/crypto/serpent-avx2.ko \ + $(LINUX_DIR)/crypto/ablk_helper.ko@lt4.17 AUTOLOAD+= $(call AutoLoad,10,camellia-x86_64 \ camellia-aesni-avx-x86_64 camellia-aesni-avx2 cast5-avx-x86_64 \ cast6-avx-x86_64 twofish-x86_64 twofish-x86_64-3way \ diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index d390e29a25..9b3a6dce46 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -89,23 +89,21 @@ define KernelPackage/fs-cifs TITLE:=CIFS support KCONFIG:= \ CONFIG_CIFS \ + CONFIG_CIFS_XATTR=y \ CONFIG_CIFS_DFS_UPCALL=n \ - CONFIG_CIFS_UPCALL=n + CONFIG_CIFS_UPCALL=n \ + CONFIG_CIFS_SMB311=n FILES:=$(LINUX_DIR)/fs/cifs/cifs.ko AUTOLOAD:=$(call AutoLoad,30,cifs) $(call AddDepends/nls) DEPENDS+= \ - +kmod-crypto-md4 \ - +kmod-crypto-md5 \ - +kmod-crypto-sha256 \ - +kmod-crypto-sha512 \ - +kmod-crypto-cmac \ - +kmod-crypto-hmac \ +kmod-crypto-arc4 \ - +kmod-crypto-aead \ - +kmod-crypto-ccm \ + +kmod-crypto-hmac \ + +kmod-crypto-md5 \ + +kmod-crypto-md4 \ + +kmod-crypto-des \ +kmod-crypto-ecb \ - +kmod-crypto-des + +kmod-crypto-sha256 endef define KernelPackage/fs-cifs/description @@ -207,8 +205,14 @@ $(eval $(call KernelPackage,fs-ext4)) define KernelPackage/fs-f2fs SUBMENU:=$(FS_MENU) TITLE:=F2FS filesystem support - DEPENDS:= +kmod-crypto-hash +kmod-crypto-crc32 +kmod-nls-base - KCONFIG:=CONFIG_F2FS_FS + DEPENDS:= +kmod-crypto-hash +kmod-crypto-crc32 +!LINUX_4_19:kmod-nls-base + KCONFIG:= \ + CONFIG_F2FS_FS \ + CONFIG_F2FS_STAT_FS=y \ + CONFIG_F2FS_FS_XATTR=y \ + CONFIG_F2FS_FS_POSIX_ACL=n \ + CONFIG_F2FS_FS_SECURITY=n \ + CONFIG_F2FS_CHECK_FS=n FILES:=$(LINUX_DIR)/fs/f2fs/f2fs.ko AUTOLOAD:=$(call AutoLoad,30,f2fs,1) endef @@ -431,7 +435,7 @@ define KernelPackage/fs-nfs-v4 endef define KernelPackage/fs-nfs-v4/description - Kernel module for NFS v4 client support + Kernel module for NFS v4 support endef $(eval $(call KernelPackage,fs-nfs-v4)) @@ -462,7 +466,7 @@ $(eval $(call KernelPackage,fs-nfsd)) define KernelPackage/fs-ntfs SUBMENU:=$(FS_MENU) - TITLE:=NTFS filesystem read-only (old driver) support + TITLE:=NTFS filesystem support KCONFIG:=CONFIG_NTFS_FS FILES:=$(LINUX_DIR)/fs/ntfs/ntfs.ko AUTOLOAD:=$(call AutoLoad,30,ntfs) @@ -470,8 +474,7 @@ define KernelPackage/fs-ntfs endef define KernelPackage/fs-ntfs/description - Kernel module for limited NTFS filesystem support. Support for writing - is extremely limited and disabled as a result. + Kernel module for NTFS filesystem support endef $(eval $(call KernelPackage,fs-ntfs)) @@ -480,7 +483,8 @@ $(eval $(call KernelPackage,fs-ntfs)) define KernelPackage/fs-reiserfs SUBMENU:=$(FS_MENU) TITLE:=ReiserFS filesystem support - KCONFIG:=CONFIG_REISERFS_FS + KCONFIG:=CONFIG_REISERFS_FS \ + CONFIG_REISERFS_FS_XATTR=y FILES:=$(LINUX_DIR)/fs/reiserfs/reiserfs.ko AUTOLOAD:=$(call AutoLoad,30,reiserfs,1) endef diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index 7bfbd38079..0ea7ba8bdd 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -159,7 +159,7 @@ $(eval $(call KernelPackage,iio-dht11)) define KernelPackage/iio-bme680 SUBMENU:=$(IIO_MENU) TITLE:=BME680 gas/humidity/pressure/temperature sensor - DEPENDS:=+kmod-iio-core +kmod-regmap-core + DEPENDS:=@!LINUX_4_14 +kmod-iio-core +kmod-regmap-core KCONFIG:=CONFIG_BME680 FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_core.ko endef @@ -414,7 +414,7 @@ $(eval $(call KernelPackage,iio-lsm6dsx-spi)) define KernelPackage/iio-sps30 SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer +kmod-lib-crc8 + 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 diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 901bddddea..0db3e3569c 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -286,6 +286,20 @@ endef $(eval $(call KernelPackage,switch-bcm53xx-mdio)) +define KernelPackage/switch-mvsw61xx + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell 88E61xx switch support + DEPENDS:=+kmod-swconfig + KCONFIG:=CONFIG_MVSW61XX_PHY + FILES:=$(LINUX_DIR)/drivers/net/phy/mvsw61xx.ko + AUTOLOAD:=$(call AutoLoad,42,mvsw61xx) +endef + +define KernelPackage/switch-mvsw61xx/description + Marvell 88E61xx switch support +endef + +$(eval $(call KernelPackage,switch-mvsw61xx)) define KernelPackage/switch-ip17xx SUBMENU:=$(NETWORK_DEVICES_MENU) @@ -668,7 +682,7 @@ $(eval $(call KernelPackage,igbvf)) define KernelPackage/ixgbe SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Intel(R) 82598/82599 PCI-Express 10 Gigabit Ethernet support - DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +kmod-libphy + DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +!LINUX_4_19:kmod-libphy KCONFIG:=CONFIG_IXGBE \ CONFIG_IXGBE_VXLAN=n \ CONFIG_IXGBE_HWMON=y \ @@ -706,7 +720,7 @@ $(eval $(call KernelPackage,ixgbevf)) define KernelPackage/i40e SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Intel(R) Ethernet Controller XL710 Family support - DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +kmod-libphy + DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +!LINUX_4_19:kmod-libphy KCONFIG:=CONFIG_I40E \ CONFIG_I40E_VXLAN=n \ CONFIG_I40E_HWMON=y \ @@ -730,7 +744,8 @@ define KernelPackage/iavf CONFIG_I40EVF \ CONFIG_IAVF FILES:= \ - $(LINUX_DIR)/drivers/net/ethernet/intel/iavf/iavf.ko + $(LINUX_DIR)/drivers/net/ethernet/intel/i40evf/i40evf.ko@lt4.20 \ + $(LINUX_DIR)/drivers/net/ethernet/intel/iavf/iavf.ko@ge4.20 AUTOLOAD:=$(call AutoProbe,i40evf iavf) AUTOLOAD:=$(call AutoProbe,iavf) endef @@ -849,6 +864,36 @@ endef $(eval $(call KernelPackage,hfcmulti)) +define KernelPackage/gigaset + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Siemens Gigaset support for isdn4linux + DEPENDS:=@USB_SUPPORT +kmod-isdn4linux +kmod-lib-crc-ccitt +kmod-usb-core @LINUX_4_19 + URL:=http://gigaset307x.sourceforge.net/ + KCONFIG:= \ + CONFIG_ISDN_DRV_GIGASET \ + CONFIG_GIGASET_BASE \ + CONFIG_GIGASET_M101 \ + CONFIG_GIGASET_M105 \ + CONFIG_GIGASET_UNDOCREQ=y \ + CONFIG_GIGASET_I4L=y + FILES:= \ + $(LINUX_DIR)/drivers/isdn/gigaset/gigaset.ko \ + $(LINUX_DIR)/drivers/isdn/gigaset/bas_gigaset.ko \ + $(LINUX_DIR)/drivers/isdn/gigaset/ser_gigaset.ko \ + $(LINUX_DIR)/drivers/isdn/gigaset/usb_gigaset.ko + AUTOLOAD:=$(call AutoProbe,gigaset bas_gigaset ser_gigaset usb_gigaset) +endef + +define KernelPackage/gigaset/description + This driver supports the Siemens Gigaset SX205/255 family of + ISDN DECT bases, including the predecessors Gigaset 3070/3075 + and 4170/4175 and their T-Com versions Sinus 45isdn and Sinus + 721X. +endef + +$(eval $(call KernelPackage,gigaset)) + + define KernelPackage/macvlan SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=MAC-VLAN support @@ -1174,56 +1219,3 @@ define KernelPackage/sfp/description endef $(eval $(call KernelPackage,sfp)) - -define KernelPackage/igc - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Intel(R) Ethernet Controller I225 Series support - DEPENDS:=@PCI_SUPPORT - KCONFIG:=CONFIG_IGC - FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/igc/igc.ko - AUTOLOAD:=$(call AutoProbe,igc) -endef - -define KernelPackage/igc/description - Kernel modules for Intel(R) Ethernet Controller I225 Series -endef - -$(eval $(call KernelPackage,igc)) - -define KernelPackage/sfc - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Solarflare SFC9000/SFC9100/EF100-family support - DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-lib-crc32c +kmod-ptp +kmod-hwmon-core - KCONFIG:= \ - CONFIG_SFC \ - CONFIG_SFC_MTD=y \ - CONFIG_SFC_MCDI_MON=y \ - CONFIG_SFC_MCDI_LOGGING=y \ - CONFIG_SFC_SRIOV=y - FILES:=$(LINUX_DIR)/drivers/net/ethernet/sfc/sfc.ko - AUTOLOAD:=$(call AutoProbe,sfc) -endef - -define KernelPackage/sfc/description - Solarflare SFC9000/SFC9100/EF100-family support - Solarflare EF100 support requires at least kernel version 5.9 -endef - -$(eval $(call KernelPackage,sfc)) - -define KernelPackage/sfc-falcon - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Solarflare SFC4000 support - DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-lib-crc32c +kmod-i2c-algo-bit - KCONFIG:= \ - CONFIG_SFC_FALCON \ - CONFIG_SFC_FALCON_MTD=y - FILES:=$(LINUX_DIR)/drivers/net/ethernet/sfc/falcon/sfc-falcon.ko - AUTOLOAD:=$(call AutoProbe,sfc-falcon) -endef - -define KernelPackage/sfc-falcon/description - Solarflare SFC4000 support -endef - -$(eval $(call KernelPackage,sfc-falcon)) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index b46fcebc08..83bb59be83 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1002,7 +1002,7 @@ $(eval $(call KernelPackage,nfnetlink-queue)) define KernelPackage/nf-conntrack-netlink TITLE:=Connection tracking netlink interface FILES:=$(LINUX_DIR)/net/netfilter/nf_conntrack_netlink.ko - KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NETFILTER_NETLINK_GLUE_CT=y + KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y AUTOLOAD:=$(call AutoProbe,nf_conntrack_netlink) $(call AddDepends/nfnetlink,+kmod-ipt-conntrack) endef @@ -1052,7 +1052,7 @@ $(eval $(call KernelPackage,ipt-rpfilter)) define KernelPackage/nft-core SUBMENU:=$(NF_MENU) TITLE:=Netfilter nf_tables support - DEPENDS:=+kmod-nfnetlink +kmod-nf-reject +IPV6:kmod-nf-reject6 +IPV6:kmod-nf-conntrack6 +kmod-nf-nat + DEPENDS:=+kmod-nfnetlink +kmod-nf-reject +IPV6:kmod-nf-reject6 +IPV6:kmod-nf-conntrack6 +!LINUX_4_19:kmod-nf-nat FILES:=$(foreach mod,$(NFT_CORE-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_CORE-m))) KCONFIG:= \ @@ -1167,15 +1167,3 @@ define KernelPackage/nft-fib endef $(eval $(call KernelPackage,nft-fib)) - - -define KernelPackage/nft-queue - SUBMENU:=$(NF_MENU) - TITLE:=Netfilter nf_tables queue support - DEPENDS:=+kmod-nft-core +kmod-nfnetlink-queue - FILES:=$(foreach mod,$(NFT_QUEUE-m),$(LINUX_DIR)/net/$(mod).ko) - AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_QUEUE-m))) - KCONFIG:=$(KCONFIG_NFT_QUEUE) -endef - -$(eval $(call KernelPackage,nft-queue)) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 4c84bea9bb..051d259e99 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -375,7 +375,7 @@ $(eval $(call KernelPackage,ip6-vti)) define KernelPackage/xfrm-interface SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IPsec XFRM Interface - DEPENDS:=+kmod-ipsec4 +IPV6:kmod-ipsec6 + DEPENDS:=+kmod-ipsec4 +IPV6:kmod-ipsec6 @!LINUX_4_14 KCONFIG:=CONFIG_XFRM_INTERFACE FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko AUTOLOAD:=$(call AutoProbe,xfrm_interface) @@ -765,7 +765,7 @@ $(eval $(call KernelPackage,sched-core)) define KernelPackage/sched-cake SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Cake fq_codel/blue derived shaper - DEPENDS:=+kmod-sched-core + DEPENDS:=@!LINUX_4_14 +kmod-sched-core KCONFIG:=CONFIG_NET_SCH_CAKE FILES:=$(LINUX_DIR)/net/sched/sch_cake.ko AUTOLOAD:=$(call AutoProbe,sch_cake) @@ -1154,7 +1154,7 @@ $(eval $(call KernelPackage,rxrpc)) define KernelPackage/mpls SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=MPLS support - DEPENDS:=+kmod-iptunnel + DEPENDS:=+!LINUX_4_14:kmod-iptunnel KCONFIG:= \ CONFIG_MPLS=y \ CONFIG_LWTUNNEL=y \ diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 83d998c83a..ade5f13ee8 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -136,6 +136,21 @@ endef $(eval $(call KernelPackage,dma-buf)) +define KernelPackage/nvmem + SUBMENU:=$(OTHER_MENU) + TITLE:=Non Volatile Memory support + DEPENDS:=@LINUX_4_19 + KCONFIG:=CONFIG_NVMEM + HIDDEN:=1 + FILES:=$(LINUX_DIR)/drivers/nvmem/nvmem_core.ko +endef + +define KernelPackage/nvmem/description + Support for NVMEM(Non Volatile Memory) devices like EEPROM, EFUSES, etc. +endef + +$(eval $(call KernelPackage,nvmem)) + define KernelPackage/eeprom-93cx6 SUBMENU:=$(OTHER_MENU) TITLE:=EEPROM 93CX6 support @@ -155,7 +170,7 @@ define KernelPackage/eeprom-at24 SUBMENU:=$(OTHER_MENU) TITLE:=EEPROM AT24 support KCONFIG:=CONFIG_EEPROM_AT24 - DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c + DEPENDS:=+kmod-i2c-core +LINUX_4_19:kmod-nvmem +kmod-regmap-i2c FILES:=$(LINUX_DIR)/drivers/misc/eeprom/at24.ko AUTOLOAD:=$(call AutoProbe,at24) endef @@ -171,6 +186,7 @@ define KernelPackage/eeprom-at25 SUBMENU:=$(OTHER_MENU) TITLE:=EEPROM AT25 support KCONFIG:=CONFIG_EEPROM_AT25 + DEPENDS:=+LINUX_4_19:kmod-nvmem FILES:=$(LINUX_DIR)/drivers/misc/eeprom/at25.ko AUTOLOAD:=$(call AutoProbe,at25) endef @@ -249,7 +265,7 @@ $(eval $(call KernelPackage,gpio-nxp-74hc164)) define KernelPackage/gpio-pca953x SUBMENU:=$(OTHER_MENU) - DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +kmod-regmap-i2c + DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +!LINUX_4_19:kmod-regmap-i2c TITLE:=PCA95xx, TCA64xx, and MAX7310 I/O ports KCONFIG:=CONFIG_GPIO_PCA953X FILES:=$(LINUX_DIR)/drivers/gpio/gpio-pca953x.ko @@ -635,7 +651,7 @@ define KernelPackage/rtc-pcf2123 SUBMENU:=$(OTHER_MENU) TITLE:=Philips PCF2123 RTC support DEFAULT:=m if ALL_KMODS && RTC_SUPPORT - DEPENDS:=+kmod-regmap-spi + DEPENDS:=+!LINUX_4_19:kmod-regmap-spi KCONFIG:=CONFIG_RTC_DRV_PCF2123 \ CONFIG_RTC_CLASS=y FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf2123.ko @@ -802,7 +818,7 @@ define KernelPackage/serial-8250 $(LINUX_DIR)/drivers/tty/serial/8250/8250.ko \ $(LINUX_DIR)/drivers/tty/serial/8250/8250_base.ko \ $(if $(CONFIG_PCI),$(LINUX_DIR)/drivers/tty/serial/8250/8250_pci.ko) \ - $(if $(CONFIG_GPIOLIB),$(LINUX_DIR)/drivers/tty/serial/serial_mctrl_gpio.ko) + $(if $(CONFIG_GPIOLIB),$(LINUX_DIR)/drivers/tty/serial/serial_mctrl_gpio.ko@ge5.3) AUTOLOAD:=$(call AutoProbe,8250 8250_base 8250_pci) endef @@ -1039,11 +1055,11 @@ $(eval $(call KernelPackage,random-core)) define KernelPackage/thermal SUBMENU:=$(OTHER_MENU) - TITLE:=Thermal driver + TITLE:=Generic Thermal sysfs driver DEPENDS:=+kmod-hwmon-core HIDDEN:=1 KCONFIG:= \ - CONFIG_THERMAL=y \ + CONFIG_THERMAL \ CONFIG_THERMAL_OF=y \ CONFIG_CPU_THERMAL=y \ CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y \ @@ -1055,11 +1071,14 @@ define KernelPackage/thermal CONFIG_THERMAL_GOV_USER_SPACE=n \ CONFIG_THERMAL_HWMON=y \ CONFIG_THERMAL_EMULATION=n + FILES:=$(LINUX_DIR)/drivers/thermal/thermal_sys.ko + AUTOLOAD:=$(call AutoProbe,thermal_sys) endef define KernelPackage/thermal/description - Thermal driver offers a generic mechanism for thermal management. - Usually it's made up of one or more thermal zone and cooling device. + Generic Thermal Sysfs driver offers a generic mechanism for thermal + management. Usually it's made up of one or more thermal zone and cooling + device. endef $(eval $(call KernelPackage,thermal)) @@ -1100,46 +1119,52 @@ endef $(eval $(call KernelPackage,echo)) -define KernelPackage/keys-encrypted +define KernelPackage/bmp085 SUBMENU:=$(OTHER_MENU) - TITLE:=encrypted keys on kernel keyring - DEPENDS:=@KERNEL_KEYS +kmod-crypto-cbc +kmod-crypto-hmac +kmod-crypto-rng \ - +kmod-crypto-sha256 +kmod-keys-trusted - KCONFIG:=CONFIG_ENCRYPTED_KEYS - FILES:=$(LINUX_DIR)/security/keys/encrypted-keys/encrypted-keys.ko - AUTOLOAD:=$(call AutoLoad,01,encrypted-keys,1) + TITLE:=BMP085/BMP18x pressure sensor + DEPENDS:= +kmod-regmap-core + KCONFIG:= CONFIG_BMP085 + FILES:= $(LINUX_DIR)/drivers/misc/bmp085.ko endef -define KernelPackage/keys-encrypted/description - This module provides support for create/encrypting/decrypting keys - in the kernel. Encrypted keys are kernel generated random numbers, - which are encrypted/decrypted with a 'master' symmetric key. The - 'master' key can be either a trusted-key or user-key type. - Userspace only ever sees/stores encrypted blobs. +define KernelPackage/bmp085/description + This driver adds support for Bosch Sensortec's digital pressure + sensors BMP085 and BMP18x. endef -$(eval $(call KernelPackage,keys-encrypted)) +$(eval $(call KernelPackage,bmp085)) -define KernelPackage/keys-trusted +define KernelPackage/bmp085-i2c SUBMENU:=$(OTHER_MENU) - TITLE:=TPM trusted keys on kernel keyring - DEPENDS:=@KERNEL_KEYS +kmod-crypto-hash +kmod-crypto-hmac +kmod-crypto-sha1 +kmod-tpm - KCONFIG:=CONFIG_TRUSTED_KEYS - FILES:=$(LINUX_DIR)/security/keys/trusted.ko - AUTOLOAD:=$(call AutoLoad,01,trusted-keys,1) + TITLE:=BMP085/BMP18x pressure sensor I2C + DEPENDS:= +kmod-bmp085 + KCONFIG:= CONFIG_BMP085_I2C + FILES:= $(LINUX_DIR)/drivers/misc/bmp085-i2c.ko + AUTOLOAD:=$(call AutoProbe,bmp085-i2c) endef - -define KernelPackage/keys-trusted/description - This module provides support for creating, sealing, and unsealing - keys in the kernel. Trusted keys are random number symmetric keys, - generated and RSA-sealed by the TPM. The TPM only unseals the keys, - if the boot PCRs and other criteria match. Userspace will only ever - see encrypted blobs. +define KernelPackage/bmp085-i2c/description + This driver adds support for Bosch Sensortec's digital pressure + sensor connected via I2C. endef -$(eval $(call KernelPackage,keys-trusted)) +$(eval $(call KernelPackage,bmp085-i2c)) + + +define KernelPackage/bmp085-spi + SUBMENU:=$(OTHER_MENU) + TITLE:=BMP085/BMP18x pressure sensor SPI + DEPENDS:= +kmod-bmp085 + KCONFIG:= CONFIG_BMP085_SPI + FILES:= $(LINUX_DIR)/drivers/misc/bmp085-spi.ko + AUTOLOAD:=$(call AutoProbe,bmp085-spi) +endef +define KernelPackage/bmp085-spi/description + This driver adds support for Bosch Sensortec's digital pressure + sensor connected via SPI. +endef +$(eval $(call KernelPackage,bmp085-spi)) define KernelPackage/tpm SUBMENU:=$(OTHER_MENU) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 93f99f7cbe..87ec0ae080 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -561,7 +561,7 @@ $(eval $(call KernelPackage,usb-serial)) define AddDepends/usb-serial SUBMENU:=$(USB_MENU) - DEPENDS+=+kmod-usb-serial $(1) + DEPENDS+=kmod-usb-serial $(1) endef @@ -1104,21 +1104,6 @@ define AddDepends/usb-net endef -define KernelPackage/usb-net-aqc111 - TITLE:=Support for USB-to-Ethernet Aquantia AQtion 5/2.5GbE - KCONFIG:=CONFIG_USB_NET_AQC111 - FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/aqc111.ko - AUTOLOAD:=$(call AutoProbe,aqc111) - $(call AddDepends/usb-net) -endef - -define KernelPackage/usb-net-aqc111/description - Support for USB-to-Ethernet Aquantia AQtion 5/2.5GbE -endef - -$(eval $(call KernelPackage,usb-net-aqc111)) - - define KernelPackage/usb-net-asix TITLE:=Kernel module for USB-to-Ethernet Asix convertors DEPENDS:=+kmod-libphy @@ -1486,23 +1471,6 @@ endef $(eval $(call KernelPackage,usb-hid)) -define KernelPackage/usb-hid-cp2112 - SUBMENU:=$(USB_MENU) - TITLE:=Silicon Labs CP2112 HID USB to SMBus Master Bridge - KCONFIG:=CONFIG_GPIOLIB=y CONFIG_HID_CP2112 - DEPENDS:=+kmod-usb-hid +kmod-i2c-core - FILES:=$(LINUX_DIR)/drivers/hid/hid-cp2112.ko - AUTOLOAD:=$(call AutoProbe,hid-cp2112) -endef - -define KernelPackage/usb-hid-cp2112/description - HID device driver which registers as an i2c adapter and gpiochip to expose - these functions of the CP2112. -endef - -$(eval $(call KernelPackage,usb-hid-cp2112)) - - define KernelPackage/usb-yealink TITLE:=USB Yealink VOIP phone DEPENDS:=+kmod-input-evdev @@ -1601,7 +1569,7 @@ define KernelPackage/usb-chipidea $(LINUX_DIR)/drivers/extcon/extcon-core.ko \ $(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \ $(LINUX_DIR)/drivers/usb/common/ulpi.ko \ - $(LINUX_DIR)/drivers/usb/roles/roles.ko + $(LINUX_DIR)/drivers/usb/roles/roles.ko@ge5.0 AUTOLOAD:=$(call AutoLoad,39,ci_hdrc,1) $(call AddDepends/usb) endef diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index c71f0760a6..d613c6f66e 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -284,7 +284,8 @@ define KernelPackage/drm-amdgpu CONFIG_DRM_AMD_DC=y \ CONFIG_DEBUG_KERNEL_DC=n FILES:=$(LINUX_DIR)/drivers/gpu/drm/amd/amdgpu/amdgpu.ko \ - $(LINUX_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko + $(LINUX_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko \ + $(LINUX_DIR)/drivers/gpu/drm/amd/lib/chash.ko@lt5.3 AUTOLOAD:=$(call AutoProbe,amdgpu) endef @@ -406,6 +407,7 @@ define KernelPackage/video-core CONFIG_V4L_PLATFORM_DRIVERS=y \ CONFIG_V4L_ISA_PARPORT_DRIVERS=y FILES:= \ + $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-common.ko@lt5.4 \ $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videodev.ko AUTOLOAD:=$(call AutoLoad,60, videodev v4l2-common) endef diff --git a/package/kernel/spi-gpio-custom/Makefile b/package/kernel/spi-gpio-custom/Makefile new file mode 100644 index 0000000000..d658dc2630 --- /dev/null +++ b/package/kernel/spi-gpio-custom/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=spi-gpio-custom +PKG_RELEASE:=1 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/spi-gpio-custom + SUBMENU:=SPI Support + TITLE:=Custom GPIO-based SPI device + DEPENDS:=@GPIO_SUPPORT +kmod-spi-bitbang +kmod-spi-gpio +kmod-spi-dev @LINUX_4_14 + FILES:=$(PKG_BUILD_DIR)/spi-gpio-custom.ko + KCONFIG:= +endef + +define KernelPackage/spi-gpio-custom/description + Kernel module for register a custom spi-gpio platform device. +endef + +EXTRA_KCONFIG:= \ + CONFIG_SPI_GPIO_CUSTOM=m + +EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \ + +MAKE_OPTS:= \ + $(KERNEL_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + $(EXTRA_KCONFIG) + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + modules +endef + +$(eval $(call KernelPackage,spi-gpio-custom)) diff --git a/package/kernel/spi-gpio-custom/src/Kconfig b/package/kernel/spi-gpio-custom/src/Kconfig new file mode 100644 index 0000000000..5e15f05a7b --- /dev/null +++ b/package/kernel/spi-gpio-custom/src/Kconfig @@ -0,0 +1,14 @@ +config SPI_GPIO_CUSTOM + tristate "Custom GPIO-based SPI driver" + depends on GENERIC_GPIO + select SPI_GPIO + help + This is an SPI driver to register 1 to 4 custom SPI buses using + GPIO lines. Each bus can have up to 8 slaves. + The devices will be exposed to userspace as /dev/spidevX.X + + This module is maily intended to interface microcontrollers + and other SPI devices without a specific kernel driver. + + This support is also available as a module. If so, the module + will be called spi-gpio-custom. diff --git a/package/kernel/spi-gpio-custom/src/Makefile b/package/kernel/spi-gpio-custom/src/Makefile new file mode 100644 index 0000000000..cf8c55f98c --- /dev/null +++ b/package/kernel/spi-gpio-custom/src/Makefile @@ -0,0 +1 @@ +obj-${CONFIG_SPI_GPIO_CUSTOM} += spi-gpio-custom.o \ No newline at end of file diff --git a/package/kernel/spi-gpio-custom/src/spi-gpio-custom.c b/package/kernel/spi-gpio-custom/src/spi-gpio-custom.c new file mode 100644 index 0000000000..4c13b56d79 --- /dev/null +++ b/package/kernel/spi-gpio-custom/src/spi-gpio-custom.c @@ -0,0 +1,365 @@ +/* + * Custom GPIO-based SPI driver + * + * Copyright (C) 2013 Marco Burato + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Based on i2c-gpio-custom by: + * Copyright (C) 2007-2008 Gabor Juhos + * --------------------------------------------------------------------------- + * + * The behaviour of this driver can be altered by setting some parameters + * from the insmod command line. + * + * The following parameters are adjustable: + * + * bus0 These four arguments can be arrays of + * bus1 1-8 unsigned integers as follows: + * bus2 + * bus3 ,,,,,,,... + * + * where: + * + * ID to used as device_id for the corresponding bus (required) + * GPIO pin ID to be used for bus SCK (required) + * GPIO pin ID to be used for bus MOSI (required*) + * GPIO pin ID to be used for bus MISO (required*) + * Mode configuration for slave X in the bus (required) + * (see /include/linux/spi/spi.h) + * Maximum clock frequency in Hz for slave X in the bus (required) + * GPIO pin ID to be used for slave X CS (required**) + * + * Notes: + * * If a signal is not used (for example there is no MISO) you need + * to set the GPIO pin ID for that signal to an invalid value. + * ** If you only have 1 slave in the bus with no CS, you can omit the + * param or set it to an invalid GPIO id to disable it. When + * you have 2 or more slaves, they must all have a valid CS. + * + * If this driver is built into the kernel, you can use the following kernel + * command line parameters, with the same values as the corresponding module + * parameters listed above: + * + * spi-gpio-custom.bus0 + * spi-gpio-custom.bus1 + * spi-gpio-custom.bus2 + * spi-gpio-custom.bus3 + */ + +#include +#include +#include +#include + +#include +#include +#include + +#define DRV_NAME "spi-gpio-custom" +#define DRV_DESC "Custom GPIO-based SPI driver" +#define DRV_VERSION "0.1" + +#define PFX DRV_NAME ": " + +#define BUS_PARAM_ID 0 +#define BUS_PARAM_SCK 1 +#define BUS_PARAM_MOSI 2 +#define BUS_PARAM_MISO 3 +#define BUS_PARAM_MODE1 4 +#define BUS_PARAM_MAXFREQ1 5 +#define BUS_PARAM_CS1 6 + +#define BUS_SLAVE_COUNT_MAX 8 +#define BUS_PARAM_REQUIRED 6 +#define BUS_PARAM_PER_SLAVE 3 +#define BUS_PARAM_COUNT (4+BUS_PARAM_PER_SLAVE*BUS_SLAVE_COUNT_MAX) +#define BUS_COUNT_MAX 4 + +static unsigned int bus0[BUS_PARAM_COUNT] __initdata; +static unsigned int bus1[BUS_PARAM_COUNT] __initdata; +static unsigned int bus2[BUS_PARAM_COUNT] __initdata; +static unsigned int bus3[BUS_PARAM_COUNT] __initdata; + +static unsigned int bus_nump[BUS_COUNT_MAX] __initdata; + +#define BUS_PARM_DESC \ + " config -> id,sck,mosi,miso,mode1,maxfreq1[,cs1,mode2,maxfreq2,cs2,...]" + +module_param_array(bus0, uint, &bus_nump[0], 0); +MODULE_PARM_DESC(bus0, "bus0" BUS_PARM_DESC); +module_param_array(bus1, uint, &bus_nump[1], 0); +MODULE_PARM_DESC(bus1, "bus1" BUS_PARM_DESC); +module_param_array(bus2, uint, &bus_nump[2], 0); +MODULE_PARM_DESC(bus2, "bus2" BUS_PARM_DESC); +module_param_array(bus3, uint, &bus_nump[3], 0); +MODULE_PARM_DESC(bus3, "bus3" BUS_PARM_DESC); + +static struct platform_device *devices[BUS_COUNT_MAX]; +static unsigned int nr_devices; + +static void spi_gpio_custom_cleanup(void) +{ + int i; + + for (i = 0; i < nr_devices; i++) + if (devices[i]) + platform_device_unregister(devices[i]); +} + +static int __init spi_gpio_custom_get_slave_mode(unsigned int id, + unsigned int *params, + int slave_index) +{ + int param_index; + + param_index = BUS_PARAM_MODE1+slave_index*BUS_PARAM_PER_SLAVE; + if (param_index >= bus_nump[id]) + return -1; + + return params[param_index]; +} +static int __init spi_gpio_custom_get_slave_maxfreq(unsigned int id, + unsigned int *params, + int slave_index) +{ + int param_index; + + param_index = BUS_PARAM_MAXFREQ1+slave_index*BUS_PARAM_PER_SLAVE; + if (param_index >= bus_nump[id]) + return -1; + + return params[param_index]; +} +static int __init spi_gpio_custom_get_slave_cs(unsigned int id, + unsigned int *params, + int slave_index) +{ + int param_index; + + param_index = BUS_PARAM_CS1+slave_index*BUS_PARAM_PER_SLAVE; + if (param_index >= bus_nump[id]) + return -1; + if (!gpio_is_valid(params[param_index])) + return -1; + + return params[param_index]; +} + +static int __init spi_gpio_custom_check_params(unsigned int id, unsigned int *params) +{ + int i; + struct spi_master *master; + + if (bus_nump[id] < BUS_PARAM_REQUIRED) { + printk(KERN_ERR PFX "not enough values for parameter bus%d\n", + id); + return -EINVAL; + } + + if (bus_nump[id] > (1+BUS_PARAM_CS1)) { + /* more than 1 device: check CS GPIOs */ + for (i = 0; i < BUS_SLAVE_COUNT_MAX; i++) { + /* no more slaves? */ + if (spi_gpio_custom_get_slave_mode(id, params, i) < 0) + break; + + if (spi_gpio_custom_get_slave_cs(id, params, i) < 0) { + printk(KERN_ERR PFX "invalid/missing CS gpio for slave %d on bus %d\n", + i, params[BUS_PARAM_ID]); + return -EINVAL; + } + } + } + + if (!gpio_is_valid(params[BUS_PARAM_SCK])) { + printk(KERN_ERR PFX "invalid SCK gpio for bus %d\n", + params[BUS_PARAM_ID]); + return -EINVAL; + } + + master = spi_busnum_to_master(params[BUS_PARAM_ID]); + if (master) { + spi_master_put(master); + printk(KERN_ERR PFX "bus %d already exists\n", + params[BUS_PARAM_ID]); + return -EEXIST; + } + + return 0; +} + +static int __init spi_gpio_custom_add_one(unsigned int id, unsigned int *params) +{ + struct platform_device *pdev; + struct spi_gpio_platform_data pdata; + int i; + int num_cs; + int err; + struct spi_master *master; + struct spi_device *slave; + struct spi_board_info slave_info; + int mode, maxfreq, cs; + + + if (!bus_nump[id]) + return 0; + + err = spi_gpio_custom_check_params(id, params); + if (err) + goto err; + + /* Create BUS device node */ + + pdev = platform_device_alloc("spi_gpio", params[BUS_PARAM_ID]); + if (!pdev) { + err = -ENOMEM; + goto err; + } + + num_cs = 0; + for (i = 0; i < BUS_SLAVE_COUNT_MAX; i++) { + /* no more slaves? */ + if (spi_gpio_custom_get_slave_mode(id, params, i) < 0) + break; + + if (spi_gpio_custom_get_slave_cs(id, params, i) >= 0) + num_cs++; + } + if (num_cs == 0) { + /* + * Even if no CS is used, spi modules expect + * at least 1 (unused) + */ + num_cs = 1; + } + + pdata.sck = params[BUS_PARAM_SCK]; + pdata.mosi = gpio_is_valid(params[BUS_PARAM_MOSI]) + ? params[BUS_PARAM_MOSI] + : SPI_GPIO_NO_MOSI; + pdata.miso = gpio_is_valid(params[BUS_PARAM_MISO]) + ? params[BUS_PARAM_MISO] + : SPI_GPIO_NO_MISO; + pdata.num_chipselect = num_cs; + + err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); + if (err) { + platform_device_put(pdev); + goto err; + } + + err = platform_device_add(pdev); + if (err) { + printk(KERN_ERR PFX "platform_device_add failed with return code %d\n", + err); + platform_device_put(pdev); + goto err; + } + + /* Register SLAVE devices */ + + for (i = 0; i < BUS_SLAVE_COUNT_MAX; i++) { + mode = spi_gpio_custom_get_slave_mode(id, params, i); + maxfreq = spi_gpio_custom_get_slave_maxfreq(id, params, i); + cs = spi_gpio_custom_get_slave_cs(id, params, i); + + /* no more slaves? */ + if (mode < 0) + break; + + memset(&slave_info, 0, sizeof(slave_info)); + strcpy(slave_info.modalias, "spidev"); + slave_info.controller_data = (void *)((cs >= 0) + ? cs + : SPI_GPIO_NO_CHIPSELECT); + slave_info.max_speed_hz = maxfreq; + slave_info.bus_num = params[BUS_PARAM_ID]; + slave_info.chip_select = i; + slave_info.mode = mode; + + master = spi_busnum_to_master(params[BUS_PARAM_ID]); + if (!master) { + printk(KERN_ERR PFX "unable to get master for bus %d\n", + params[BUS_PARAM_ID]); + err = -EINVAL; + goto err_unregister; + } + slave = spi_new_device(master, &slave_info); + spi_master_put(master); + if (!slave) { + printk(KERN_ERR PFX "unable to create slave %d for bus %d\n", + i, params[BUS_PARAM_ID]); + /* Will most likely fail due to unsupported mode bits */ + err = -EINVAL; + goto err_unregister; + } + } + + devices[nr_devices++] = pdev; + + return 0; + +err_unregister: + platform_device_unregister(pdev); +err: + return err; +} + +static int __init spi_gpio_custom_probe(void) +{ + int err; + + printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); + + err = spi_gpio_custom_add_one(0, bus0); + if (err) + goto err; + + err = spi_gpio_custom_add_one(1, bus1); + if (err) + goto err; + + err = spi_gpio_custom_add_one(2, bus2); + if (err) + goto err; + + err = spi_gpio_custom_add_one(3, bus3); + if (err) + goto err; + + if (!nr_devices) { + printk(KERN_ERR PFX "no bus parameter(s) specified\n"); + err = -ENODEV; + goto err; + } + + return 0; + +err: + spi_gpio_custom_cleanup(); + return err; +} + +#ifdef MODULE +static int __init spi_gpio_custom_init(void) +{ + return spi_gpio_custom_probe(); +} +module_init(spi_gpio_custom_init); + +static void __exit spi_gpio_custom_exit(void) +{ + spi_gpio_custom_cleanup(); +} +module_exit(spi_gpio_custom_exit); +#else +subsys_initcall(spi_gpio_custom_probe); +#endif /* MODULE*/ + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Marco Burato "); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_VERSION(DRV_VERSION); diff --git a/package/kernel/w1-gpio-custom/Makefile b/package/kernel/w1-gpio-custom/Makefile new file mode 100644 index 0000000000..76581c101e --- /dev/null +++ b/package/kernel/w1-gpio-custom/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2008-2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=w1-gpio-custom +PKG_RELEASE:=4 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/w1-gpio-custom + SUBMENU:=W1 support + TITLE:=Custom GPIO-based 1-wire device + DEPENDS:=kmod-w1 +kmod-w1-master-gpio @LINUX_4_14 + FILES:=$(PKG_BUILD_DIR)/w1-gpio-custom.ko + KCONFIG:= +endef + +define KernelPackage/w1-gpio-custom/description + Kernel module to register a custom w1-gpio platform device. +endef + +EXTRA_KCONFIG:= \ + CONFIG_W1_MASTER_GPIO_CUSTOM=m + +EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) + +MAKE_OPTS:= \ + $(KERNEL_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + $(EXTRA_KCONFIG) + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + modules +endef + +$(eval $(call KernelPackage,w1-gpio-custom)) + diff --git a/package/kernel/w1-gpio-custom/src/Kconfig b/package/kernel/w1-gpio-custom/src/Kconfig new file mode 100644 index 0000000000..74b9226c5c --- /dev/null +++ b/package/kernel/w1-gpio-custom/src/Kconfig @@ -0,0 +1,4 @@ +config W1_MASTER_GPIO_CUSTOM + tristate "Custom GPIO-based W1 driver" + depends on GENERIC_GPIO + select W1_GPIO \ No newline at end of file diff --git a/package/kernel/w1-gpio-custom/src/Makefile b/package/kernel/w1-gpio-custom/src/Makefile new file mode 100644 index 0000000000..6a527432c1 --- /dev/null +++ b/package/kernel/w1-gpio-custom/src/Makefile @@ -0,0 +1 @@ +obj-${CONFIG_W1_MASTER_GPIO_CUSTOM} += w1-gpio-custom.o \ No newline at end of file diff --git a/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c b/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c new file mode 100644 index 0000000000..6928769975 --- /dev/null +++ b/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c @@ -0,0 +1,190 @@ +/* + * Custom GPIO-based W1 driver + * + * Copyright (C) 2007 Gabor Juhos + * Copyright (C) 2008 Bifferos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * --------------------------------------------------------------------------- + * + * The behaviour of this driver can be altered by setting some parameters + * from the insmod command line. + * + * The following parameters are adjustable: + * + * bus0 These four arguments must be arrays of + * bus1 3 unsigned integers as follows: + * bus2 + * bus3 ,, + * + * where: + * + * ID to used as device_id for the corresponding bus (required) + * GPIO pin ID of data pin (required) + * Pin is configured as open drain. + * + * See include/w1-gpio.h for more information about the parameters. + * + * If this driver is built into the kernel, you can use the following kernel + * command line parameters, with the same values as the corresponding module + * parameters listed above: + * + * w1-gpio-custom.bus0 + * w1-gpio-custom.bus1 + * w1-gpio-custom.bus2 + * w1-gpio-custom.bus3 + */ + +#include +#include +#include +#include + +#include + +#define DRV_NAME "w1-gpio-custom" +#define DRV_DESC "Custom GPIO-based W1 driver" +#define DRV_VERSION "0.1.2" + +#define PFX DRV_NAME ": " + +#define BUS_PARAM_ID 0 +#define BUS_PARAM_PIN 1 +#define BUS_PARAM_OD 2 + +#define BUS_PARAM_REQUIRED 3 +#define BUS_PARAM_COUNT 3 +#define BUS_COUNT_MAX 4 + +static unsigned int bus0[BUS_PARAM_COUNT] __initdata; +static unsigned int bus1[BUS_PARAM_COUNT] __initdata; +static unsigned int bus2[BUS_PARAM_COUNT] __initdata; +static unsigned int bus3[BUS_PARAM_COUNT] __initdata; + +static unsigned int bus_nump[BUS_COUNT_MAX] __initdata; + +#define BUS_PARM_DESC " config -> id,pin,od" + +module_param_array(bus0, uint, &bus_nump[0], 0); +MODULE_PARM_DESC(bus0, "bus0" BUS_PARM_DESC); +module_param_array(bus1, uint, &bus_nump[1], 0); +MODULE_PARM_DESC(bus1, "bus1" BUS_PARM_DESC); +module_param_array(bus2, uint, &bus_nump[2], 0); +MODULE_PARM_DESC(bus2, "bus2" BUS_PARM_DESC); +module_param_array(bus3, uint, &bus_nump[3], 0); +MODULE_PARM_DESC(bus3, "bus3" BUS_PARM_DESC); + +static struct platform_device *devices[BUS_COUNT_MAX]; +static unsigned int nr_devices; + +static void w1_gpio_custom_cleanup(void) +{ + int i; + + for (i = 0; i < nr_devices; i++) + if (devices[i]) + platform_device_unregister(devices[i]); +} + +static int __init w1_gpio_custom_add_one(unsigned int id, unsigned int *params) +{ + struct platform_device *pdev; + struct w1_gpio_platform_data pdata; + int err; + + if (!bus_nump[id]) + return 0; + + if (bus_nump[id] < BUS_PARAM_REQUIRED) { + printk(KERN_ERR PFX "not enough parameters for bus%d\n", id); + err = -EINVAL; + goto err; + } + + pdev = platform_device_alloc("w1-gpio", params[BUS_PARAM_ID]); + if (!pdev) { + err = -ENOMEM; + goto err; + } + + pdata.pin = params[BUS_PARAM_PIN]; + pdata.is_open_drain = params[BUS_PARAM_OD] ? 1 : 0; + pdata.enable_external_pullup = NULL; + pdata.ext_pullup_enable_pin = -EINVAL; + + err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); + if (err) + goto err_put; + + err = platform_device_add(pdev); + if (err) + goto err_put; + + devices[nr_devices++] = pdev; + return 0; + + err_put: + platform_device_put(pdev); + err: + return err; +} + +static int __init w1_gpio_custom_probe(void) +{ + int err; + + nr_devices = 0; + printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); + + err = w1_gpio_custom_add_one(0, bus0); + if (err) + goto err; + + err = w1_gpio_custom_add_one(1, bus1); + if (err) + goto err; + + err = w1_gpio_custom_add_one(2, bus2); + if (err) + goto err; + + err = w1_gpio_custom_add_one(3, bus3); + if (err) + goto err; + + if (!nr_devices) { + printk(KERN_ERR PFX "no bus parameter(s) specified\n"); + err = -ENODEV; + goto err; + } + + return 0; + +err: + w1_gpio_custom_cleanup(); + return err; +} + +#ifdef MODULE +static int __init w1_gpio_custom_init(void) +{ + return w1_gpio_custom_probe(); +} +module_init(w1_gpio_custom_init); + +static void __exit w1_gpio_custom_exit(void) +{ + w1_gpio_custom_cleanup(); +} +module_exit(w1_gpio_custom_exit); +#else +subsys_initcall(w1_gpio_custom_probe); +#endif /* MODULE*/ + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Bifferos "); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_VERSION(DRV_VERSION); -- 2.35.1