diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index 73b448022d..1f4e4558a9 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -77,6 +77,21 @@ endef $(eval $(call KernelPackage,hwmon-adt7475)) +define KernelPackage/hwmon-drivetemp + TITLE:=Hard disk drives with temperature sensor + KCONFIG:=CONFIG_SENSORS_DRIVETEMP + FILES:=$(LINUX_DIR)/drivers/hwmon/drivetemp.ko + AUTOLOAD:=$(call AutoLoad,60,drivetemp) + $(call AddDepends/hwmon,+kmod-ata-core +kmod-scsi-core) +endef + +define KernelPackage/hwmon-drivetemp/description + Kernel module for Hard disk drives with temperature sensor +endef + +$(eval $(call KernelPackage,hwmon-drivetemp)) + + define KernelPackage/hwmon-gpiofan TITLE:=Generic GPIO FAN support KCONFIG:=CONFIG_SENSORS_GPIO_FAN diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 55c27af666..7c90fcca33 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -12,6 +12,10 @@ PKG_BASE:=1.1.1 PKG_BUGFIX:=e PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX) PKG_RELEASE:=1 +PKG_USE_MIPS16:=0 +ENGINES_DIR=engines-1.1 + +PKG_BUILD_PARALLEL:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= \ @@ -22,10 +26,6 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ PKG_HASH:=694f61ac11cb51c9bf73f54e771ff6022b0327a43bbdfa1b2f19de1662a6dcbe -PKG_USE_MIPS16:=0 -ENGINES_DIR=engines-1.1 -PKG_BUILD_PARALLEL:=1 - PKG_LICENSE:=OpenSSL PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=Eneas U de Queiroz diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile index 14e786f8bb..0835adc41d 100644 --- a/target/linux/gemini/Makefile +++ b/target/linux/gemini/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=Cortina Systems CS351x FEATURES:=squashfs pci rtc usb dt gpio display ext4 rootfs-part boot-part CPU_TYPE:=fa526 -KERNEL_PATCHVER:=4.19 +KERNEL_PATCHVER:=5.4 define Target/Description Build firmware images for the StorLink/Cortina Gemini CS351x ARM FA526 CPU diff --git a/target/linux/gemini/config-5.4 b/target/linux/gemini/config-5.4 new file mode 100644 index 0000000000..7cfdb3ccdb --- /dev/null +++ b/target/linux/gemini/config-5.4 @@ -0,0 +1,466 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_AMBA_PL08X=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_GEMINI=y +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_ARCH_HAS_KCOV=y +CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +CONFIG_ARCH_HAS_PHYS_TO_DMA=y +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_ARCH_MOXART is not set +CONFIG_ARCH_MULTIPLATFORM=y +CONFIG_ARCH_MULTI_V4=y +# CONFIG_ARCH_MULTI_V4T is not set +CONFIG_ARCH_MULTI_V4_V5=y +# CONFIG_ARCH_MULTI_V5 is not set +CONFIG_ARCH_NR_GPIO=0 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_APPENDED_DTB=y +# CONFIG_ARM_ATAG_DTB_COMPAT is not set +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_L1_CACHE_SHIFT=5 +CONFIG_ARM_PATCH_PHYS_VIRT=y +# CONFIG_ARM_SMMU is not set +CONFIG_ARM_UNWIND=y +CONFIG_ATA=y +CONFIG_ATAGS=y +CONFIG_ATA_VERBOSE_ERROR=y +CONFIG_AUTO_ZRELADDR=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BOUNCE=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMA=y +CONFIG_CMA_ALIGNMENT=8 +CONFIG_CMA_AREAS=7 +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_SIZE_MBYTES=16 +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_GEMINI=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_COREDUMP=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_CPU_32v4=y +CONFIG_CPU_ABRT_EV4=y +CONFIG_CPU_CACHE_FA=y +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_COPY_FA=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +# CONFIG_CPU_DCACHE_WRITETHROUGH is not set +CONFIG_CPU_FA526=y +CONFIG_CPU_NO_EFFICIENT_FFS=y +CONFIG_CPU_PABRT_LEGACY=y +CONFIG_CPU_TLB_FA=y +CONFIG_CPU_USE_DOMAINS=y +CONFIG_CRASH_CORE=y +CONFIG_CRC16=y +# CONFIG_CRC32_SARWATE is not set +CONFIG_CRC32_SLICEBY8=y +CONFIG_CRC_CCITT=y +CONFIG_CRC_ITU_T=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CTR=y +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_DRBG_HMAC=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_ECHAINIV=y +CONFIG_CRYPTO_GCM=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_GHASH=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_SEQIV=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_LZ4=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_DMADEVICES=y +CONFIG_DMATEST=y +CONFIG_DMA_CMA=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_ENGINE_RAID=y +CONFIG_DMA_OF=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DRM=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_FBDEV_OVERALLOC=100 +CONFIG_DRM_GEM_CMA_HELPER=y +CONFIG_DRM_KMS_CMA_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_PANEL=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DRM_PANEL_ILITEK_IL9322=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_DRM_TVE200=y +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EEPROM_93CX6=y +CONFIG_ELF_CORE=y +# CONFIG_EMBEDDED is not set +# CONFIG_EXPERT is not set +CONFIG_EXT4_FS=y +CONFIG_FARADAY_FTINTC010=y +CONFIG_FB=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_DEFERRED_IO=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FHANDLE=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FONT_8x16=y +CONFIG_FONT_8x8=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FPE_FASTFPE is not set +# CONFIG_FPE_NWFPE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FS_POSIX_ACL=y +CONFIG_FTTMR010_TIMER=y +CONFIG_FTWDT010_WATCHDOG=y +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_GEMINI_ETHERNET=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GLOB=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_FTGPIO010=y +CONFIG_GPIO_GENERIC=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_UID16=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HDMI=y +CONFIG_HIGHMEM=y +CONFIG_HIGHPTE=y +CONFIG_HWMON=y +CONFIG_HW_CONSOLE=y +CONFIG_HZ_FIXED=0 +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_GPIO=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_INPUT_KEYBOARD=y +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_IOSCHED_CFQ=y +CONFIG_IPC_NS=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISDN is not set +CONFIG_JBD2=y +CONFIG_KALLSYMS=y +CONFIG_KERNEL_LZMA=y +# CONFIG_KERNEL_XZ is not set +CONFIG_KEXEC=y +CONFIG_KEXEC_CORE=y +CONFIG_KEYBOARD_DLINK_DIR685=y +# CONFIG_LDM_DEBUG is not set +CONFIG_LDM_PARTITION=y +CONFIG_LEDS_TRIGGER_DISK=y +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_CLUT224=y +# CONFIG_LOGO_LINUX_MONO is not set +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MANDATORY_FILE_LOCKING=y +CONFIG_MARVELL_PHY=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_GPIO=y +CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_MFD_SYSCON=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_MIGRATION=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MODULE_UNLOAD is not set +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +CONFIG_MTD_CFI_STAA=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_PHYSMAP_GEMINI=y +CONFIG_MTD_REDBOOT_PARTS=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_WRGG_FW=y +CONFIG_NAMESPACES=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_KUSER_HELPERS=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_DSA=y +CONFIG_NET_DSA_REALTEK_SMI=y +CONFIG_NET_DSA_VITESSE_VSC73XX=y +CONFIG_NET_NS=y +CONFIG_NET_SWITCHDEV=y +CONFIG_NLS=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NVMEM=y +CONFIG_OABI_COMPAT=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OF_NET=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_PATA_FTIDE010=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_FTPCI100=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHYLINK=y +CONFIG_PID_NS=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_GEMINI=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PM=y +CONFIG_PM_CLK=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GEMINI_POWEROFF=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_RCU=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_RATIONAL=y +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +# CONFIG_RCU_EXPERT is not set +CONFIG_RCU_NEED_SEGCBLIST=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RD_BZIP2=y +CONFIG_RD_GZIP=y +CONFIG_RD_LZ4=y +CONFIG_RD_LZMA=y +CONFIG_RD_LZO=y +CONFIG_RD_XZ=y +CONFIG_REALTEK_PHY=y +CONFIG_REFCOUNT_FULL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_RELAY=y +CONFIG_RESET_CONTROLLER=y +CONFIG_RSEQ=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_FTRTC010=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RTC_NVMEM=y +CONFIG_SATA_GEMINI=y +CONFIG_SATA_PMP=y +CONFIG_SCSI=y +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCSI_PROC_FS is not set +CONFIG_SENSORS_DRIVETEMP=y +CONFIG_SENSORS_GPIO_FAN=y +CONFIG_SENSORS_LM75=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_EXAR=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_RUNTIME_UARTS=1 +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIO=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_SERPORT=y +CONFIG_SG_POOL=y +CONFIG_SLUB_DEBUG=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +CONFIG_SPLIT_PTLOCK_CPUS=999999 +CONFIG_SRCU=y +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_SWPHY=y +CONFIG_SYNC_FILE=y +CONFIG_SYSFS_SYSCALL=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TASKS_RCU=y +CONFIG_THERMAL=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TREE_SRCU=y +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_UNWINDER_ARM=y +CONFIG_USB_SUPPORT=y +# CONFIG_USERIO is not set +CONFIG_USER_NS=y +CONFIG_USE_OF=y +CONFIG_UTS_NS=y +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +CONFIG_VITESSE_PHY=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_X86=y +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch b/target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch new file mode 100644 index 0000000000..4a6a804ca4 --- /dev/null +++ b/target/linux/gemini/patches-5.4/0001-usb-host-fotg2-add-Gemini-specific-handling.patch @@ -0,0 +1,131 @@ +From 3aaff88a0f5e154aa5a489d59fd4015a2a937c23 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Fri, 21 Apr 2017 22:19:00 +0200 +Subject: [PATCH 1/7] usb: host: fotg2: add Gemini-specific handling + +The Cortina Systems Gemini has bolted on a PHY inside the +silicon that can be handled by six bits in a MISC register in +the system controller. + +If we are running on Gemini, look up a syscon regmap through +a phandle and enable VBUS and optionally the Mini-B connector. + +If the device is flagged as "wakeup-source" using the standard +DT bindings, we also enable this in the global controller for +respective port. + +Signed-off-by: Linus Walleij +--- + drivers/usb/host/Kconfig | 1 + + drivers/usb/host/fotg210-hcd.c | 76 ++++++++++++++++++++++++++++++++++ + 2 files changed, 77 insertions(+) + +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -363,6 +363,7 @@ config USB_ISP1362_HCD + config USB_FOTG210_HCD + tristate "FOTG210 HCD support" + depends on USB && HAS_DMA && HAS_IOMEM ++ select MFD_SYSCON + ---help--- + Faraday FOTG210 is an OTG controller which can be configured as + an USB2.0 host. It is designed to meet USB2.0 EHCI specification +--- a/drivers/usb/host/fotg210-hcd.c ++++ b/drivers/usb/host/fotg210-hcd.c +@@ -33,6 +33,10 @@ + #include + #include + #include ++#include ++/* For Cortina Gemini */ ++#include ++#include + + #include + #include +@@ -5558,6 +5562,72 @@ static void fotg210_init(struct fotg210_ + iowrite32(value, &fotg210->regs->otgcsr); + } + ++/* ++ * Gemini-specific initialization function, only executed on the ++ * Gemini SoC using the global misc control register. ++ */ ++#define GEMINI_GLOBAL_MISC_CTRL 0x30 ++#define GEMINI_MISC_USB0_WAKEUP BIT(14) ++#define GEMINI_MISC_USB1_WAKEUP BIT(15) ++#define GEMINI_MISC_USB0_VBUS_ON BIT(22) ++#define GEMINI_MISC_USB1_VBUS_ON BIT(23) ++#define GEMINI_MISC_USB0_MINI_B BIT(29) ++#define GEMINI_MISC_USB1_MINI_B BIT(30) ++ ++static int fotg210_gemini_init(struct device *dev, struct usb_hcd *hcd) ++{ ++ struct device_node *np = dev->of_node; ++ struct regmap *map; ++ bool mini_b; ++ bool wakeup; ++ u32 mask, val; ++ int ret; ++ ++ map = syscon_regmap_lookup_by_phandle(np, "syscon"); ++ if (IS_ERR(map)) { ++ dev_err(dev, "no syscon\n"); ++ return PTR_ERR(map); ++ } ++ mini_b = of_property_read_bool(np, "cortina,gemini-mini-b"); ++ wakeup = of_property_read_bool(np, "wakeup-source"); ++ ++ /* ++ * Figure out if this is USB0 or USB1 by simply checking the ++ * physical base address. ++ */ ++ mask = 0; ++ if (hcd->rsrc_start == 0x69000000) { ++ val = GEMINI_MISC_USB1_VBUS_ON; ++ if (mini_b) ++ val |= GEMINI_MISC_USB1_MINI_B; ++ else ++ mask |= GEMINI_MISC_USB1_MINI_B; ++ if (wakeup) ++ val |= GEMINI_MISC_USB1_WAKEUP; ++ else ++ mask |= GEMINI_MISC_USB1_WAKEUP; ++ } else { ++ val = GEMINI_MISC_USB0_VBUS_ON; ++ if (mini_b) ++ val |= GEMINI_MISC_USB0_MINI_B; ++ else ++ mask |= GEMINI_MISC_USB0_MINI_B; ++ if (wakeup) ++ val |= GEMINI_MISC_USB0_WAKEUP; ++ else ++ mask |= GEMINI_MISC_USB0_WAKEUP; ++ } ++ ++ ret = regmap_update_bits(map, GEMINI_GLOBAL_MISC_CTRL, mask, val); ++ if (ret) { ++ dev_err(dev, "failed to initialize Gemini PHY\n"); ++ return ret; ++ } ++ ++ dev_info(dev, "initialized Gemini PHY\n"); ++ return 0; ++} ++ + /** + * fotg210_hcd_probe - initialize faraday FOTG210 HCDs + * +@@ -5635,6 +5705,12 @@ static int fotg210_hcd_probe(struct plat + + fotg210_init(fotg210); + ++ if (of_device_is_compatible(dev->of_node, "cortina,gemini-usb")) { ++ retval = fotg210_gemini_init(dev, hcd); ++ if (retval) ++ goto failed_dis_clk; ++ } ++ + retval = usb_add_hcd(hcd, irq, IRQF_SHARED); + if (retval) { + dev_err(dev, "failed to add hcd with err %d\n", retval); diff --git a/target/linux/gemini/patches-5.4/0002-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch b/target/linux/gemini/patches-5.4/0002-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch new file mode 100644 index 0000000000..39dfd3d535 --- /dev/null +++ b/target/linux/gemini/patches-5.4/0002-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch @@ -0,0 +1,37 @@ +From a2de8560885469f3d76c80207a669029e4fc8a45 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Mon, 11 Mar 2019 15:44:29 +0100 +Subject: [PATCH 2/7] ARM: dts: Augment DIR-685 partition table for OpenWrt + +Rename the firmware partition so that the firmware MTD +splitter will do its job, drop the rootfs arguments as +the MTD splitter will set this up automatically. + +Signed-off-by: Linus Walleij +--- + arch/arm/boot/dts/gemini-dlink-dir-685.dts | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts ++++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts +@@ -20,7 +20,7 @@ + }; + + chosen { +- bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait consoleblank=300"; ++ bootargs = "console=ttyS0,19200n8 consoleblank=300"; + stdout-path = "uart0:19200n8"; + }; + +@@ -285,9 +285,9 @@ + * this is called "upgrade" on the vendor system. + */ + partition@40000 { +- label = "upgrade"; ++ compatible = "wrg"; ++ label = "firmware"; + reg = <0x00040000 0x01f40000>; +- read-only; + }; + /* RGDB, Residental Gateway Database? */ + partition@1f80000 { diff --git a/target/linux/gemini/patches-5.4/0003-ARM-dts-gemini-Rename-IDE-nodes.patch b/target/linux/gemini/patches-5.4/0003-ARM-dts-gemini-Rename-IDE-nodes.patch new file mode 100644 index 0000000000..6477b2d2a4 --- /dev/null +++ b/target/linux/gemini/patches-5.4/0003-ARM-dts-gemini-Rename-IDE-nodes.patch @@ -0,0 +1,117 @@ +From 9b95b301b219df19c20f4a563f1da6338b09b0d0 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Tue, 31 Dec 2019 18:14:28 +0100 +Subject: [PATCH 3/7] ARM: dts: gemini: Rename IDE nodes + +By renaming the ATA drive nodes to "ide@" we activate the +semantic checks to the DT schema for the controller and use +the correct notation for PATA drives. + +Signed-off-by: Linus Walleij +--- + arch/arm/boot/dts/gemini-dlink-dir-685.dts | 2 +- + arch/arm/boot/dts/gemini-dlink-dns-313.dts | 2 +- + arch/arm/boot/dts/gemini-nas4220b.dts | 4 ++-- + arch/arm/boot/dts/gemini-sl93512r.dts | 4 ++-- + arch/arm/boot/dts/gemini-sq201.dts | 2 +- + arch/arm/boot/dts/gemini.dtsi | 8 ++++++-- + 6 files changed, 13 insertions(+), 9 deletions(-) + +--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts ++++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts +@@ -443,7 +443,7 @@ + }; + }; + +- ata@63000000 { ++ ide@63000000 { + status = "okay"; + }; + +--- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts ++++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts +@@ -297,7 +297,7 @@ + }; + }; + +- ata@63000000 { ++ ide@63000000 { + status = "okay"; + }; + }; +--- a/arch/arm/boot/dts/gemini-nas4220b.dts ++++ b/arch/arm/boot/dts/gemini-nas4220b.dts +@@ -170,11 +170,11 @@ + }; + }; + +- ata@63000000 { ++ ide@63000000 { + status = "okay"; + }; + +- ata@63400000 { ++ ide@63400000 { + status = "okay"; + }; + +--- a/arch/arm/boot/dts/gemini-sl93512r.dts ++++ b/arch/arm/boot/dts/gemini-sl93512r.dts +@@ -293,11 +293,11 @@ + }; + }; + +- ata@63000000 { ++ ide@63000000 { + status = "okay"; + }; + +- ata@63400000 { ++ ide@63400000 { + status = "okay"; + }; + +--- a/arch/arm/boot/dts/gemini-sq201.dts ++++ b/arch/arm/boot/dts/gemini-sq201.dts +@@ -289,7 +289,7 @@ + }; + }; + +- ata@63000000 { ++ ide@63000000 { + status = "okay"; + }; + +--- a/arch/arm/boot/dts/gemini.dtsi ++++ b/arch/arm/boot/dts/gemini.dtsi +@@ -356,7 +356,7 @@ + }; + }; + +- ata@63000000 { ++ ide@63000000 { + compatible = "cortina,gemini-pata", "faraday,ftide010"; + reg = <0x63000000 0x1000>; + interrupts = <4 IRQ_TYPE_EDGE_RISING>; +@@ -365,9 +365,11 @@ + clock-names = "PCLK"; + sata = <&sata>; + status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; + }; + +- ata@63400000 { ++ ide@63400000 { + compatible = "cortina,gemini-pata", "faraday,ftide010"; + reg = <0x63400000 0x1000>; + interrupts = <5 IRQ_TYPE_EDGE_RISING>; +@@ -376,6 +378,8 @@ + clock-names = "PCLK"; + sata = <&sata>; + status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; + }; + + dma-controller@67000000 { diff --git a/target/linux/gemini/patches-5.4/0004-ARM-dts-gemini-Add-thermal-zone-to-DIR-685.patch b/target/linux/gemini/patches-5.4/0004-ARM-dts-gemini-Add-thermal-zone-to-DIR-685.patch new file mode 100644 index 0000000000..5949b92be1 --- /dev/null +++ b/target/linux/gemini/patches-5.4/0004-ARM-dts-gemini-Add-thermal-zone-to-DIR-685.patch @@ -0,0 +1,101 @@ +From 2b2e9d0e1ee4765b21c648235489028c6dc7e336 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Tue, 31 Dec 2019 18:18:08 +0100 +Subject: [PATCH 4/7] ARM: dts: gemini: Add thermal zone to DIR-685 + +The DIR-685 can now exploit the thermal zone added by the +drive temperature sensor inside the hard drive. We have +patched the libata subsystem to assign the device nodes +properly to the SCSI devices and this is what the drivetemp +driver will use to populate the sensor and the thermal +zone, so pick that up into the thermal zone and let this +control the fan. + +The hardware lacks an embedded temperature sensor so the +D-Link vendor firmware uses this method to control the +temperature of the NAS enclosure using the thermal sensor +inside the hard drive. + +The drive temperature trigger points to be used comes from +the vendor firmware. + +Signed-off-by: Linus Walleij +--- + arch/arm/boot/dts/gemini-dlink-dir-685.dts | 48 ++++++++++++++++++++-- + 1 file changed, 45 insertions(+), 3 deletions(-) + +--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts ++++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts +@@ -119,13 +119,11 @@ + + /* + * This is a Sunon Maglev GM0502PFV2-8 cooling fan @10000 RPM. +- * Since the platform has no temperature sensor, this is controlled +- * from userspace by using the hard disks S.M.A.R.T. temperature + * sensor. It is turned on when the temperature exceeds 46 degrees + * and turned off when the temperatures goes below 41 degrees + * (celsius). + */ +- gpio-fan { ++ fan0: gpio-fan { + compatible = "gpio-fan"; + /* Collides with IDE */ + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; +@@ -133,6 +131,40 @@ + #cooling-cells = <2>; + }; + ++ thermal-zones { ++ chassis-thermal { ++ /* Poll every 20 seconds */ ++ polling-delay = <20000>; ++ /* Poll every 2nd second when cooling */ ++ polling-delay-passive = <2000>; ++ /* Use the thermal sensor in the hard drive */ ++ thermal-sensors = <&drive0>; ++ ++ /* Tripping points from the fan.script in the rootfs */ ++ trips { ++ alert: chassis-alert { ++ /* At 43 degrees turn on the fan */ ++ temperature = <43000>; ++ hysteresis = <3000>; ++ type = "active"; ++ }; ++ crit: chassis-crit { ++ /* Just shut down at 60 degrees */ ++ temperature = <60000>; ++ hysteresis = <2000>; ++ type = "critical"; ++ }; ++ }; ++ ++ cooling-maps { ++ map0 { ++ trip = <&alert>; ++ cooling-device = <&fan0 1 1>; ++ }; ++ }; ++ }; ++ }; ++ + /* + * The touchpad input is connected to a GPIO bit-banged + * I2C bus. +@@ -445,6 +477,16 @@ + + ide@63000000 { + status = "okay"; ++ ++ /* ++ * This drive may have a temperature sensor with a ++ * thermal zone we can use for thermal control of the ++ * chassis temperature using the fan. ++ */ ++ drive0: ide-port@0 { ++ reg = <0>; ++ #thermal-sensor-cells = <0>; ++ }; + }; + + display-controller@6a000000 { diff --git a/target/linux/generic/backport-5.4/800-v5.5-scsi-core-Add-sysfs-attributes-for-VPD-pages-0h-and-.patch b/target/linux/generic/backport-5.4/800-v5.5-scsi-core-Add-sysfs-attributes-for-VPD-pages-0h-and-.patch new file mode 100644 index 0000000000..dc89b279e5 --- /dev/null +++ b/target/linux/generic/backport-5.4/800-v5.5-scsi-core-Add-sysfs-attributes-for-VPD-pages-0h-and-.patch @@ -0,0 +1,122 @@ +From d188b0675b21d5a6ca27b3e741381813983f4719 Mon Sep 17 00:00:00 2001 +From: Ryan Attard +Date: Thu, 26 Sep 2019 11:22:17 -0500 +Subject: [PATCH] scsi: core: Add sysfs attributes for VPD pages 0h and 89h + +Add sysfs attributes for the ATA information page and Supported VPD Pages +page. + +Link: https://lore.kernel.org/r/20190926162216.56591-1-ryanattard@ryanattard.info +Signed-off-by: Ryan Attard +Reviewed-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/scsi.c | 4 ++++ + drivers/scsi/scsi_sysfs.c | 19 +++++++++++++++++++ + include/scsi/scsi_device.h | 2 ++ + 3 files changed, 25 insertions(+) + +--- a/drivers/scsi/scsi.c ++++ b/drivers/scsi/scsi.c +@@ -465,10 +465,14 @@ void scsi_attach_vpd(struct scsi_device + return; + + for (i = 4; i < vpd_buf->len; i++) { ++ if (vpd_buf->data[i] == 0x0) ++ scsi_update_vpd_page(sdev, 0x0, &sdev->vpd_pg0); + if (vpd_buf->data[i] == 0x80) + scsi_update_vpd_page(sdev, 0x80, &sdev->vpd_pg80); + if (vpd_buf->data[i] == 0x83) + scsi_update_vpd_page(sdev, 0x83, &sdev->vpd_pg83); ++ if (vpd_buf->data[i] == 0x89) ++ scsi_update_vpd_page(sdev, 0x89, &sdev->vpd_pg89); + } + kfree(vpd_buf); + } +--- a/drivers/scsi/scsi_sysfs.c ++++ b/drivers/scsi/scsi_sysfs.c +@@ -437,6 +437,7 @@ static void scsi_device_dev_release_user + struct device *parent; + struct list_head *this, *tmp; + struct scsi_vpd *vpd_pg80 = NULL, *vpd_pg83 = NULL; ++ struct scsi_vpd *vpd_pg0 = NULL, *vpd_pg89 = NULL; + unsigned long flags; + + sdev = container_of(work, struct scsi_device, ew.work); +@@ -466,16 +467,24 @@ static void scsi_device_dev_release_user + sdev->request_queue = NULL; + + mutex_lock(&sdev->inquiry_mutex); ++ rcu_swap_protected(sdev->vpd_pg0, vpd_pg0, ++ lockdep_is_held(&sdev->inquiry_mutex)); + rcu_swap_protected(sdev->vpd_pg80, vpd_pg80, + lockdep_is_held(&sdev->inquiry_mutex)); + rcu_swap_protected(sdev->vpd_pg83, vpd_pg83, + lockdep_is_held(&sdev->inquiry_mutex)); ++ rcu_swap_protected(sdev->vpd_pg89, vpd_pg89, ++ lockdep_is_held(&sdev->inquiry_mutex)); + mutex_unlock(&sdev->inquiry_mutex); + ++ if (vpd_pg0) ++ kfree_rcu(vpd_pg0, rcu); + if (vpd_pg83) + kfree_rcu(vpd_pg83, rcu); + if (vpd_pg80) + kfree_rcu(vpd_pg80, rcu); ++ if (vpd_pg89) ++ kfree_rcu(vpd_pg89, rcu); + kfree(sdev->inquiry); + kfree(sdev); + +@@ -868,6 +877,8 @@ static struct bin_attribute dev_attr_vpd + + sdev_vpd_pg_attr(pg83); + sdev_vpd_pg_attr(pg80); ++sdev_vpd_pg_attr(pg89); ++sdev_vpd_pg_attr(pg0); + + static ssize_t show_inquiry(struct file *filep, struct kobject *kobj, + struct bin_attribute *bin_attr, +@@ -1200,12 +1211,18 @@ static umode_t scsi_sdev_bin_attr_is_vis + struct scsi_device *sdev = to_scsi_device(dev); + + ++ if (attr == &dev_attr_vpd_pg0 && !sdev->vpd_pg0) ++ return 0; ++ + if (attr == &dev_attr_vpd_pg80 && !sdev->vpd_pg80) + return 0; + + if (attr == &dev_attr_vpd_pg83 && !sdev->vpd_pg83) + return 0; + ++ if (attr == &dev_attr_vpd_pg89 && !sdev->vpd_pg89) ++ return 0; ++ + return S_IRUGO; + } + +@@ -1248,8 +1265,10 @@ static struct attribute *scsi_sdev_attrs + }; + + static struct bin_attribute *scsi_sdev_bin_attrs[] = { ++ &dev_attr_vpd_pg0, + &dev_attr_vpd_pg83, + &dev_attr_vpd_pg80, ++ &dev_attr_vpd_pg89, + &dev_attr_inquiry, + NULL + }; +--- a/include/scsi/scsi_device.h ++++ b/include/scsi/scsi_device.h +@@ -140,8 +140,10 @@ struct scsi_device { + const char * rev; /* ... "nullnullnullnull" before scan */ + + #define SCSI_VPD_PG_LEN 255 ++ struct scsi_vpd __rcu *vpd_pg0; + struct scsi_vpd __rcu *vpd_pg83; + struct scsi_vpd __rcu *vpd_pg80; ++ struct scsi_vpd __rcu *vpd_pg89; + unsigned char current_tag; /* current tag */ + struct scsi_target *sdev_target; /* used only for single_lun */ + diff --git a/target/linux/generic/backport-5.4/801-v5.5-hwmon-Driver-for-disk-and-solid-state-drives-with-te.patch b/target/linux/generic/backport-5.4/801-v5.5-hwmon-Driver-for-disk-and-solid-state-drives-with-te.patch new file mode 100644 index 0000000000..32a629772f --- /dev/null +++ b/target/linux/generic/backport-5.4/801-v5.5-hwmon-Driver-for-disk-and-solid-state-drives-with-te.patch @@ -0,0 +1,737 @@ +From 5b46903d8bf372e563bf2150d46b87fff197a109 Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Thu, 28 Nov 2019 21:34:40 -0800 +Subject: [PATCH] hwmon: Driver for disk and solid state drives with + temperature sensors +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reading the temperature of ATA drives has been supported for years +by userspace tools such as smarttools or hddtemp. The downside of +such tools is that they need to run with super-user privilege, that +the temperatures are not reported by standard tools such as 'sensors' +or 'libsensors', and that drive temperatures are not available for use +in the kernel's thermal subsystem. + +This driver solves this problem by adding support for reading the +temperature of ATA drives from the kernel using the hwmon API and +by adding a temperature zone for each drive. + +With this driver, the hard disk temperature can be read using the +unprivileged 'sensors' application: + +$ sensors drivetemp-scsi-1-0 +drivetemp-scsi-1-0 +Adapter: SCSI adapter +temp1: +23.0°C + +or directly from sysfs: + +$ grep . /sys/class/hwmon/hwmon9/{name,temp1_input} +/sys/class/hwmon/hwmon9/name:drivetemp +/sys/class/hwmon/hwmon9/temp1_input:23000 + +If the drive supports SCT transport and reports temperature limits, +those are reported as well. + +drivetemp-scsi-0-0 +Adapter: SCSI adapter +temp1: +27.0°C (low = +0.0°C, high = +60.0°C) + (crit low = -41.0°C, crit = +85.0°C) + (lowest = +23.0°C, highest = +34.0°C) + +The driver attempts to use SCT Command Transport to read the drive +temperature. If the SCT Command Transport feature set is not available, +or if it does not report the drive temperature, drive temperatures may +be readable through SMART attributes. Since SMART attributes are not well +defined, this method is only used as fallback mechanism. + +Cc: Chris Healy +Cc: Linus Walleij +Cc: Martin K. Petersen +Cc: Bart Van Assche +Reviewed-by: Linus Walleij +Tested-by: Linus Walleij +Signed-off-by: Guenter Roeck +--- + Documentation/hwmon/drivetemp.rst | 52 +++ + Documentation/hwmon/index.rst | 1 + + drivers/hwmon/Kconfig | 10 + + drivers/hwmon/Makefile | 1 + + drivers/hwmon/drivetemp.c | 574 ++++++++++++++++++++++++++++++ + 5 files changed, 638 insertions(+) + create mode 100644 Documentation/hwmon/drivetemp.rst + create mode 100644 drivers/hwmon/drivetemp.c + +--- /dev/null ++++ b/Documentation/hwmon/drivetemp.rst +@@ -0,0 +1,52 @@ ++.. SPDX-License-Identifier: GPL-2.0 ++ ++Kernel driver drivetemp ++======================= ++ ++ ++References ++---------- ++ ++ANS T13/1699-D ++Information technology - AT Attachment 8 - ATA/ATAPI Command Set (ATA8-ACS) ++ ++ANS Project T10/BSR INCITS 513 ++Information technology - SCSI Primary Commands - 4 (SPC-4) ++ ++ANS Project INCITS 557 ++Information technology - SCSI / ATA Translation - 5 (SAT-5) ++ ++ ++Description ++----------- ++ ++This driver supports reporting the temperature of disk and solid state ++drives with temperature sensors. ++ ++If supported, it uses the ATA SCT Command Transport feature to read ++the current drive temperature and, if available, temperature limits ++as well as historic minimum and maximum temperatures. If SCT Command ++Transport is not supported, the driver uses SMART attributes to read ++the drive temperature. ++ ++ ++Sysfs entries ++------------- ++ ++Only the temp1_input attribute is always available. Other attributes are ++available only if reported by the drive. All temperatures are reported in ++milli-degrees Celsius. ++ ++======================= ===================================================== ++temp1_input Current drive temperature ++temp1_lcrit Minimum temperature limit. Operating the device below ++ this temperature may cause physical damage to the ++ device. ++temp1_min Minimum recommended continuous operating limit ++temp1_max Maximum recommended continuous operating temperature ++temp1_crit Maximum temperature limit. Operating the device above ++ this temperature may cause physical damage to the ++ device. ++temp1_lowest Minimum temperature seen this power cycle ++temp1_highest Maximum temperature seen this power cycle ++======================= ===================================================== +--- a/Documentation/hwmon/index.rst ++++ b/Documentation/hwmon/index.rst +@@ -45,6 +45,7 @@ Hardware Monitoring Kernel Drivers + da9052 + da9055 + dme1737 ++ drivetemp + ds1621 + ds620 + emc1403 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -385,6 +385,16 @@ config SENSORS_ATXP1 + This driver can also be built as a module. If so, the module + will be called atxp1. + ++config SENSORS_DRIVETEMP ++ tristate "Hard disk drives with temperature sensors" ++ depends on SCSI && ATA ++ help ++ If you say yes you get support for the temperature sensor on ++ hard disk drives. ++ ++ This driver can also be built as a module. If so, the module ++ will be called satatemp. ++ + config SENSORS_DS620 + tristate "Dallas Semiconductor DS620" + depends on I2C +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -56,6 +56,7 @@ obj-$(CONFIG_SENSORS_DA9052_ADC)+= da905 + obj-$(CONFIG_SENSORS_DA9055)+= da9055-hwmon.o + obj-$(CONFIG_SENSORS_DELL_SMM) += dell-smm-hwmon.o + obj-$(CONFIG_SENSORS_DME1737) += dme1737.o ++obj-$(CONFIG_SENSORS_DRIVETEMP) += drivetemp.o + obj-$(CONFIG_SENSORS_DS620) += ds620.o + obj-$(CONFIG_SENSORS_DS1621) += ds1621.o + obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o +--- /dev/null ++++ b/drivers/hwmon/drivetemp.c +@@ -0,0 +1,574 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Hwmon client for disk and solid state drives with temperature sensors ++ * Copyright (C) 2019 Zodiac Inflight Innovations ++ * ++ * With input from: ++ * Hwmon client for S.M.A.R.T. hard disk drives with temperature sensors. ++ * (C) 2018 Linus Walleij ++ * ++ * hwmon: Driver for SCSI/ATA temperature sensors ++ * by Constantin Baranov , submitted September 2009 ++ * ++ * This drive supports reporting the temperatire of SATA drives. It can be ++ * easily extended to report the temperature of SCSI drives. ++ * ++ * The primary means to read drive temperatures and temperature limits ++ * for ATA drives is the SCT Command Transport feature set as specified in ++ * ATA8-ACS. ++ * It can be used to read the current drive temperature, temperature limits, ++ * and historic minimum and maximum temperatures. The SCT Command Transport ++ * feature set is documented in "AT Attachment 8 - ATA/ATAPI Command Set ++ * (ATA8-ACS)". ++ * ++ * If the SCT Command Transport feature set is not available, drive temperatures ++ * may be readable through SMART attributes. Since SMART attributes are not well ++ * defined, this method is only used as fallback mechanism. ++ * ++ * There are three SMART attributes which may report drive temperatures. ++ * Those are defined as follows (from ++ * http://www.cropel.com/library/smart-attribute-list.aspx). ++ * ++ * 190 Temperature Temperature, monitored by a sensor somewhere inside ++ * the drive. Raw value typicaly holds the actual ++ * temperature (hexadecimal) in its rightmost two digits. ++ * ++ * 194 Temperature Temperature, monitored by a sensor somewhere inside ++ * the drive. Raw value typicaly holds the actual ++ * temperature (hexadecimal) in its rightmost two digits. ++ * ++ * 231 Temperature Temperature, monitored by a sensor somewhere inside ++ * the drive. Raw value typicaly holds the actual ++ * temperature (hexadecimal) in its rightmost two digits. ++ * ++ * Wikipedia defines attributes a bit differently. ++ * ++ * 190 Temperature Value is equal to (100-temp. °C), allowing manufacturer ++ * Difference or to set a minimum threshold which corresponds to a ++ * Airflow maximum temperature. This also follows the convention of ++ * Temperature 100 being a best-case value and lower values being ++ * undesirable. However, some older drives may instead ++ * report raw Temperature (identical to 0xC2) or ++ * Temperature minus 50 here. ++ * 194 Temperature or Indicates the device temperature, if the appropriate ++ * Temperature sensor is fitted. Lowest byte of the raw value contains ++ * Celsius the exact temperature value (Celsius degrees). ++ * 231 Life Left Indicates the approximate SSD life left, in terms of ++ * (SSDs) or program/erase cycles or available reserved blocks. ++ * Temperature A normalized value of 100 represents a new drive, with ++ * a threshold value at 10 indicating a need for ++ * replacement. A value of 0 may mean that the drive is ++ * operating in read-only mode to allow data recovery. ++ * Previously (pre-2010) occasionally used for Drive ++ * Temperature (more typically reported at 0xC2). ++ * ++ * Common denominator is that the first raw byte reports the temperature ++ * in degrees C on almost all drives. Some drives may report a fractional ++ * temperature in the second raw byte. ++ * ++ * Known exceptions (from libatasmart): ++ * - SAMSUNG SV0412H and SAMSUNG SV1204H) report the temperature in 10th ++ * degrees C in the first two raw bytes. ++ * - A few Maxtor drives report an unknown or bad value in attribute 194. ++ * - Certain Apple SSD drives report an unknown value in attribute 190. ++ * Only certain firmware versions are affected. ++ * ++ * Those exceptions affect older ATA drives and are currently ignored. ++ * Also, the second raw byte (possibly reporting the fractional temperature) ++ * is currently ignored. ++ * ++ * Many drives also report temperature limits in additional SMART data raw ++ * bytes. The format of those is not well defined and varies widely. ++ * The driver does not currently attempt to report those limits. ++ * ++ * According to data in smartmontools, attribute 231 is rarely used to report ++ * drive temperatures. At the same time, several drives report SSD life left ++ * in attribute 231, but do not support temperature sensors. For this reason, ++ * attribute 231 is currently ignored. ++ * ++ * Following above definitions, temperatures are reported as follows. ++ * If SCT Command Transport is supported, it is used to read the ++ * temperature and, if available, temperature limits. ++ * - Otherwise, if SMART attribute 194 is supported, it is used to read ++ * the temperature. ++ * - Otherwise, if SMART attribute 190 is supported, it is used to read ++ * the temperature. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct drivetemp_data { ++ struct list_head list; /* list of instantiated devices */ ++ struct mutex lock; /* protect data buffer accesses */ ++ struct scsi_device *sdev; /* SCSI device */ ++ struct device *dev; /* instantiating device */ ++ struct device *hwdev; /* hardware monitoring device */ ++ u8 smartdata[ATA_SECT_SIZE]; /* local buffer */ ++ int (*get_temp)(struct drivetemp_data *st, u32 attr, long *val); ++ bool have_temp_lowest; /* lowest temp in SCT status */ ++ bool have_temp_highest; /* highest temp in SCT status */ ++ bool have_temp_min; /* have min temp */ ++ bool have_temp_max; /* have max temp */ ++ bool have_temp_lcrit; /* have lower critical limit */ ++ bool have_temp_crit; /* have critical limit */ ++ int temp_min; /* min temp */ ++ int temp_max; /* max temp */ ++ int temp_lcrit; /* lower critical limit */ ++ int temp_crit; /* critical limit */ ++}; ++ ++static LIST_HEAD(drivetemp_devlist); ++ ++#define ATA_MAX_SMART_ATTRS 30 ++#define SMART_TEMP_PROP_190 190 ++#define SMART_TEMP_PROP_194 194 ++ ++#define SCT_STATUS_REQ_ADDR 0xe0 ++#define SCT_STATUS_VERSION_LOW 0 /* log byte offsets */ ++#define SCT_STATUS_VERSION_HIGH 1 ++#define SCT_STATUS_TEMP 200 ++#define SCT_STATUS_TEMP_LOWEST 201 ++#define SCT_STATUS_TEMP_HIGHEST 202 ++#define SCT_READ_LOG_ADDR 0xe1 ++#define SMART_READ_LOG 0xd5 ++#define SMART_WRITE_LOG 0xd6 ++ ++#define INVALID_TEMP 0x80 ++ ++#define temp_is_valid(temp) ((temp) != INVALID_TEMP) ++#define temp_from_sct(temp) (((s8)(temp)) * 1000) ++ ++static inline bool ata_id_smart_supported(u16 *id) ++{ ++ return id[ATA_ID_COMMAND_SET_1] & BIT(0); ++} ++ ++static inline bool ata_id_smart_enabled(u16 *id) ++{ ++ return id[ATA_ID_CFS_ENABLE_1] & BIT(0); ++} ++ ++static int drivetemp_scsi_command(struct drivetemp_data *st, ++ u8 ata_command, u8 feature, ++ u8 lba_low, u8 lba_mid, u8 lba_high) ++{ ++ u8 scsi_cmd[MAX_COMMAND_SIZE]; ++ int data_dir; ++ ++ memset(scsi_cmd, 0, sizeof(scsi_cmd)); ++ scsi_cmd[0] = ATA_16; ++ if (ata_command == ATA_CMD_SMART && feature == SMART_WRITE_LOG) { ++ scsi_cmd[1] = (5 << 1); /* PIO Data-out */ ++ /* ++ * No off.line or cc, write to dev, block count in sector count ++ * field. ++ */ ++ scsi_cmd[2] = 0x06; ++ data_dir = DMA_TO_DEVICE; ++ } else { ++ scsi_cmd[1] = (4 << 1); /* PIO Data-in */ ++ /* ++ * No off.line or cc, read from dev, block count in sector count ++ * field. ++ */ ++ scsi_cmd[2] = 0x0e; ++ data_dir = DMA_FROM_DEVICE; ++ } ++ scsi_cmd[4] = feature; ++ scsi_cmd[6] = 1; /* 1 sector */ ++ scsi_cmd[8] = lba_low; ++ scsi_cmd[10] = lba_mid; ++ scsi_cmd[12] = lba_high; ++ scsi_cmd[14] = ata_command; ++ ++ return scsi_execute_req(st->sdev, scsi_cmd, data_dir, ++ st->smartdata, ATA_SECT_SIZE, NULL, HZ, 5, ++ NULL); ++} ++ ++static int drivetemp_ata_command(struct drivetemp_data *st, u8 feature, ++ u8 select) ++{ ++ return drivetemp_scsi_command(st, ATA_CMD_SMART, feature, select, ++ ATA_SMART_LBAM_PASS, ATA_SMART_LBAH_PASS); ++} ++ ++static int drivetemp_get_smarttemp(struct drivetemp_data *st, u32 attr, ++ long *temp) ++{ ++ u8 *buf = st->smartdata; ++ bool have_temp = false; ++ u8 temp_raw; ++ u8 csum; ++ int err; ++ int i; ++ ++ err = drivetemp_ata_command(st, ATA_SMART_READ_VALUES, 0); ++ if (err) ++ return err; ++ ++ /* Checksum the read value table */ ++ csum = 0; ++ for (i = 0; i < ATA_SECT_SIZE; i++) ++ csum += buf[i]; ++ if (csum) { ++ dev_dbg(&st->sdev->sdev_gendev, ++ "checksum error reading SMART values\n"); ++ return -EIO; ++ } ++ ++ for (i = 0; i < ATA_MAX_SMART_ATTRS; i++) { ++ u8 *attr = buf + i * 12; ++ int id = attr[2]; ++ ++ if (!id) ++ continue; ++ ++ if (id == SMART_TEMP_PROP_190) { ++ temp_raw = attr[7]; ++ have_temp = true; ++ } ++ if (id == SMART_TEMP_PROP_194) { ++ temp_raw = attr[7]; ++ have_temp = true; ++ break; ++ } ++ } ++ ++ if (have_temp) { ++ *temp = temp_raw * 1000; ++ return 0; ++ } ++ ++ return -ENXIO; ++} ++ ++static int drivetemp_get_scttemp(struct drivetemp_data *st, u32 attr, long *val) ++{ ++ u8 *buf = st->smartdata; ++ int err; ++ ++ err = drivetemp_ata_command(st, SMART_READ_LOG, SCT_STATUS_REQ_ADDR); ++ if (err) ++ return err; ++ switch (attr) { ++ case hwmon_temp_input: ++ *val = temp_from_sct(buf[SCT_STATUS_TEMP]); ++ break; ++ case hwmon_temp_lowest: ++ *val = temp_from_sct(buf[SCT_STATUS_TEMP_LOWEST]); ++ break; ++ case hwmon_temp_highest: ++ *val = temp_from_sct(buf[SCT_STATUS_TEMP_HIGHEST]); ++ break; ++ default: ++ err = -EINVAL; ++ break; ++ } ++ return err; ++} ++ ++static int drivetemp_identify_sata(struct drivetemp_data *st) ++{ ++ struct scsi_device *sdev = st->sdev; ++ u8 *buf = st->smartdata; ++ struct scsi_vpd *vpd; ++ bool is_ata, is_sata; ++ bool have_sct_data_table; ++ bool have_sct_temp; ++ bool have_smart; ++ bool have_sct; ++ u16 *ata_id; ++ u16 version; ++ long temp; ++ int err; ++ ++ /* SCSI-ATA Translation present? */ ++ rcu_read_lock(); ++ vpd = rcu_dereference(sdev->vpd_pg89); ++ ++ /* ++ * Verify that ATA IDENTIFY DEVICE data is included in ATA Information ++ * VPD and that the drive implements the SATA protocol. ++ */ ++ if (!vpd || vpd->len < 572 || vpd->data[56] != ATA_CMD_ID_ATA || ++ vpd->data[36] != 0x34) { ++ rcu_read_unlock(); ++ return -ENODEV; ++ } ++ ata_id = (u16 *)&vpd->data[60]; ++ is_ata = ata_id_is_ata(ata_id); ++ is_sata = ata_id_is_sata(ata_id); ++ have_sct = ata_id_sct_supported(ata_id); ++ have_sct_data_table = ata_id_sct_data_tables(ata_id); ++ have_smart = ata_id_smart_supported(ata_id) && ++ ata_id_smart_enabled(ata_id); ++ ++ rcu_read_unlock(); ++ ++ /* bail out if this is not a SATA device */ ++ if (!is_ata || !is_sata) ++ return -ENODEV; ++ if (!have_sct) ++ goto skip_sct; ++ ++ err = drivetemp_ata_command(st, SMART_READ_LOG, SCT_STATUS_REQ_ADDR); ++ if (err) ++ goto skip_sct; ++ ++ version = (buf[SCT_STATUS_VERSION_HIGH] << 8) | ++ buf[SCT_STATUS_VERSION_LOW]; ++ if (version != 2 && version != 3) ++ goto skip_sct; ++ ++ have_sct_temp = temp_is_valid(buf[SCT_STATUS_TEMP]); ++ if (!have_sct_temp) ++ goto skip_sct; ++ ++ st->have_temp_lowest = temp_is_valid(buf[SCT_STATUS_TEMP_LOWEST]); ++ st->have_temp_highest = temp_is_valid(buf[SCT_STATUS_TEMP_HIGHEST]); ++ ++ if (!have_sct_data_table) ++ goto skip_sct; ++ ++ /* Request and read temperature history table */ ++ memset(buf, '\0', sizeof(st->smartdata)); ++ buf[0] = 5; /* data table command */ ++ buf[2] = 1; /* read table */ ++ buf[4] = 2; /* temperature history table */ ++ ++ err = drivetemp_ata_command(st, SMART_WRITE_LOG, SCT_STATUS_REQ_ADDR); ++ if (err) ++ goto skip_sct_data; ++ ++ err = drivetemp_ata_command(st, SMART_READ_LOG, SCT_READ_LOG_ADDR); ++ if (err) ++ goto skip_sct_data; ++ ++ /* ++ * Temperature limits per AT Attachment 8 - ++ * ATA/ATAPI Command Set (ATA8-ACS) ++ */ ++ st->have_temp_max = temp_is_valid(buf[6]); ++ st->have_temp_crit = temp_is_valid(buf[7]); ++ st->have_temp_min = temp_is_valid(buf[8]); ++ st->have_temp_lcrit = temp_is_valid(buf[9]); ++ ++ st->temp_max = temp_from_sct(buf[6]); ++ st->temp_crit = temp_from_sct(buf[7]); ++ st->temp_min = temp_from_sct(buf[8]); ++ st->temp_lcrit = temp_from_sct(buf[9]); ++ ++skip_sct_data: ++ if (have_sct_temp) { ++ st->get_temp = drivetemp_get_scttemp; ++ return 0; ++ } ++skip_sct: ++ if (!have_smart) ++ return -ENODEV; ++ st->get_temp = drivetemp_get_smarttemp; ++ return drivetemp_get_smarttemp(st, hwmon_temp_input, &temp); ++} ++ ++static int drivetemp_identify(struct drivetemp_data *st) ++{ ++ struct scsi_device *sdev = st->sdev; ++ ++ /* Bail out immediately if there is no inquiry data */ ++ if (!sdev->inquiry || sdev->inquiry_len < 16) ++ return -ENODEV; ++ ++ /* Disk device? */ ++ if (sdev->type != TYPE_DISK && sdev->type != TYPE_ZBC) ++ return -ENODEV; ++ ++ return drivetemp_identify_sata(st); ++} ++ ++static int drivetemp_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ struct drivetemp_data *st = dev_get_drvdata(dev); ++ int err = 0; ++ ++ if (type != hwmon_temp) ++ return -EINVAL; ++ ++ switch (attr) { ++ case hwmon_temp_input: ++ case hwmon_temp_lowest: ++ case hwmon_temp_highest: ++ mutex_lock(&st->lock); ++ err = st->get_temp(st, attr, val); ++ mutex_unlock(&st->lock); ++ break; ++ case hwmon_temp_lcrit: ++ *val = st->temp_lcrit; ++ break; ++ case hwmon_temp_min: ++ *val = st->temp_min; ++ break; ++ case hwmon_temp_max: ++ *val = st->temp_max; ++ break; ++ case hwmon_temp_crit: ++ *val = st->temp_crit; ++ break; ++ default: ++ err = -EINVAL; ++ break; ++ } ++ return err; ++} ++ ++static umode_t drivetemp_is_visible(const void *data, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ const struct drivetemp_data *st = data; ++ ++ switch (type) { ++ case hwmon_temp: ++ switch (attr) { ++ case hwmon_temp_input: ++ return 0444; ++ case hwmon_temp_lowest: ++ if (st->have_temp_lowest) ++ return 0444; ++ break; ++ case hwmon_temp_highest: ++ if (st->have_temp_highest) ++ return 0444; ++ break; ++ case hwmon_temp_min: ++ if (st->have_temp_min) ++ return 0444; ++ break; ++ case hwmon_temp_max: ++ if (st->have_temp_max) ++ return 0444; ++ break; ++ case hwmon_temp_lcrit: ++ if (st->have_temp_lcrit) ++ return 0444; ++ break; ++ case hwmon_temp_crit: ++ if (st->have_temp_crit) ++ return 0444; ++ break; ++ default: ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ return 0; ++} ++ ++static const struct hwmon_channel_info *drivetemp_info[] = { ++ HWMON_CHANNEL_INFO(chip, ++ HWMON_C_REGISTER_TZ), ++ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | ++ HWMON_T_LOWEST | HWMON_T_HIGHEST | ++ HWMON_T_MIN | HWMON_T_MAX | ++ HWMON_T_LCRIT | HWMON_T_CRIT), ++ NULL ++}; ++ ++static const struct hwmon_ops drivetemp_ops = { ++ .is_visible = drivetemp_is_visible, ++ .read = drivetemp_read, ++}; ++ ++static const struct hwmon_chip_info drivetemp_chip_info = { ++ .ops = &drivetemp_ops, ++ .info = drivetemp_info, ++}; ++ ++/* ++ * The device argument points to sdev->sdev_dev. Its parent is ++ * sdev->sdev_gendev, which we can use to get the scsi_device pointer. ++ */ ++static int drivetemp_add(struct device *dev, struct class_interface *intf) ++{ ++ struct scsi_device *sdev = to_scsi_device(dev->parent); ++ struct drivetemp_data *st; ++ int err; ++ ++ st = kzalloc(sizeof(*st), GFP_KERNEL); ++ if (!st) ++ return -ENOMEM; ++ ++ st->sdev = sdev; ++ st->dev = dev; ++ mutex_init(&st->lock); ++ ++ if (drivetemp_identify(st)) { ++ err = -ENODEV; ++ goto abort; ++ } ++ ++ st->hwdev = hwmon_device_register_with_info(dev->parent, "drivetemp", ++ st, &drivetemp_chip_info, ++ NULL); ++ if (IS_ERR(st->hwdev)) { ++ err = PTR_ERR(st->hwdev); ++ goto abort; ++ } ++ ++ list_add(&st->list, &drivetemp_devlist); ++ return 0; ++ ++abort: ++ kfree(st); ++ return err; ++} ++ ++static void drivetemp_remove(struct device *dev, struct class_interface *intf) ++{ ++ struct drivetemp_data *st, *tmp; ++ ++ list_for_each_entry_safe(st, tmp, &drivetemp_devlist, list) { ++ if (st->dev == dev) { ++ list_del(&st->list); ++ hwmon_device_unregister(st->hwdev); ++ kfree(st); ++ break; ++ } ++ } ++} ++ ++static struct class_interface drivetemp_interface = { ++ .add_dev = drivetemp_add, ++ .remove_dev = drivetemp_remove, ++}; ++ ++static int __init drivetemp_init(void) ++{ ++ return scsi_register_interface(&drivetemp_interface); ++} ++ ++static void __exit drivetemp_exit(void) ++{ ++ scsi_unregister_interface(&drivetemp_interface); ++} ++ ++module_init(drivetemp_init); ++module_exit(drivetemp_exit); ++ ++MODULE_AUTHOR("Guenter Roeck "); ++MODULE_DESCRIPTION("Hard drive temperature monitor"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index defeaceaa7..a2269a0720 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -118,6 +118,7 @@ CONFIG_AEABI=y # CONFIG_AFE4403 is not set # CONFIG_AFE4404 is not set # CONFIG_AFFS_FS is not set +# CONFIG_AFS_DEBUG_CURSOR is not set # CONFIG_AFS_FS is not set # CONFIG_AF_KCM is not set # CONFIG_AF_RXRPC is not set @@ -1355,6 +1356,7 @@ CONFIG_DQL=y # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set # CONFIG_DRM_LVDS_ENCODER is not set # CONFIG_DRM_MALI_DISPLAY is not set +# CONFIG_DRM_MCDE is not set # CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set # CONFIG_DRM_MGAG200 is not set # CONFIG_DRM_MXSFB is not set @@ -1370,6 +1372,8 @@ CONFIG_DQL=y # 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_NOVATEK_NT39016 is not set +# CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO 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 @@ -1377,13 +1381,17 @@ CONFIG_DQL=y # CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set # 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_SONY_ACX565AKM is not set # CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set +# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set +# CONFIG_DRM_PANEL_TPO_TPG110 is not set # CONFIG_DRM_PANFROST is not set # CONFIG_DRM_PARADE_PS8622 is not set # CONFIG_DRM_PL111 is not set diff --git a/target/linux/generic/pending-5.4/820-libata-Assign-OF-node-to-the-SCSI-device.patch b/target/linux/generic/pending-5.4/820-libata-Assign-OF-node-to-the-SCSI-device.patch new file mode 100644 index 0000000000..9e72313ec9 --- /dev/null +++ b/target/linux/generic/pending-5.4/820-libata-Assign-OF-node-to-the-SCSI-device.patch @@ -0,0 +1,86 @@ +From 43a93893eb33e996836b99fb3e1f7300c0132a51 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Tue, 31 Dec 2019 18:15:33 +0100 +Subject: [PATCH 5/7] libata: Assign OF node to the SCSI device + +When we spawn a SCSI device from an ATA device in libata-scsi +the SCSI device had no relation to the device tree. + +The DT binding allows us to define port nodes under a +PATA (IDE) or SATA host controller, so we can have proper device +nodes for these devices. + +If OF is enabled, walk the children of the host controller node +to see if there is a valid device tree node to assign. The reg +is used to match to ID 0 for the master device and ID 1 for the +slave device. + +The corresponding device tree bindings have been accepted by +the device tree maintainers. + +Cc: Chris Healy +Cc: Martin K. Petersen +Cc: Bart Van Assche +Cc: Guenter Roeck +Signed-off-by: Linus Walleij +--- +ChangeLog v1->v2: +- Use dev_dbg() for the debug print +- return immediately after finding a matching OF node +--- + drivers/ata/libata-scsi.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + #include "libata.h" + #include "libata-transport.h" +@@ -4573,6 +4574,34 @@ int ata_scsi_add_hosts(struct ata_host * + return rc; + } + ++#ifdef CONFIG_OF ++static void ata_scsi_assign_ofnode(struct ata_device *dev, struct ata_port *ap) ++{ ++ struct scsi_device *sdev = dev->sdev; ++ struct device *d = ap->host->dev; ++ struct device_node *np = d->of_node; ++ struct device_node *child; ++ ++ for_each_available_child_of_node(np, child) { ++ int ret; ++ u32 val; ++ ++ ret = of_property_read_u32(child, "reg", &val); ++ if (ret) ++ continue; ++ if (val == dev->devno) { ++ dev_dbg(d, "found matching device node\n"); ++ sdev->sdev_gendev.of_node = child; ++ return; ++ } ++ } ++} ++#else ++static void ata_scsi_assign_ofnode(struct ata_device *dev, struct ata_port *ap) ++{ ++} ++#endif ++ + void ata_scsi_scan_host(struct ata_port *ap, int sync) + { + int tries = 5; +@@ -4598,6 +4627,7 @@ void ata_scsi_scan_host(struct ata_port + NULL); + if (!IS_ERR(sdev)) { + dev->sdev = sdev; ++ ata_scsi_assign_ofnode(dev, ap); + scsi_device_put(sdev); + } else { + dev->sdev = NULL; diff --git a/target/linux/oxnas/patches-5.4/002-irqchip-versatile-fpga-Apply-clear-mask-earlier.patch b/target/linux/oxnas/patches-5.4/002-irqchip-versatile-fpga-Apply-clear-mask-earlier.patch new file mode 100644 index 0000000000..eef2c4624f --- /dev/null +++ b/target/linux/oxnas/patches-5.4/002-irqchip-versatile-fpga-Apply-clear-mask-earlier.patch @@ -0,0 +1,58 @@ +From patchwork Sat Mar 21 13:38:42 2020 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sungbo Eo +X-Patchwork-Id: 11451163 +From: Sungbo Eo +To: linux-oxnas@groups.io, Linus Walleij , + Thomas Gleixner , Jason Cooper , + Marc Zyngier , linux-arm-kernel@lists.infradead.org, + linux-kernel@vger.kernel.org +Subject: [PATCH] irqchip/versatile-fpga: Apply clear-mask earlier +Date: Sat, 21 Mar 2020 22:38:42 +0900 +Message-Id: <20200321133842.2408823-1-mans0n@gorani.run> +MIME-Version: 1.0 +Sender: "linux-arm-kernel" + +Clear its own IRQs before the parent IRQ get enabled, so that the +remaining IRQs do not accidentally interrupt the parent IRQ controller. + +This patch also fixes a reboot bug on OX820 SoC, where the remaining +rps-timer IRQ raises a GIC interrupt that is left pending. After that, +the rps-timer IRQ is cleared during driver initialization, and there's +no IRQ left in rps-irq when local_irq_enable() is called, which evokes +an error message "unexpected IRQ trap". + +Fixes: bdd272cbb97a ("irqchip: versatile FPGA: support cascaded interrupts from DT") +Signed-off-by: Sungbo Eo +Cc: Neil Armstrong +Cc: Daniel Golle +--- + drivers/irqchip/irq-versatile-fpga.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/irqchip/irq-versatile-fpga.c b/drivers/irqchip/irq-versatile-fpga.c +index 70e2cfff8175..f1386733d3bc 100644 +--- a/drivers/irqchip/irq-versatile-fpga.c ++++ b/drivers/irqchip/irq-versatile-fpga.c +@@ -212,6 +212,9 @@ int __init fpga_irq_of_init(struct device_node *node, + if (of_property_read_u32(node, "valid-mask", &valid_mask)) + valid_mask = 0; + ++ writel(clear_mask, base + IRQ_ENABLE_CLEAR); ++ writel(clear_mask, base + FIQ_ENABLE_CLEAR); ++ + /* Some chips are cascaded from a parent IRQ */ + parent_irq = irq_of_parse_and_map(node, 0); + if (!parent_irq) { +@@ -221,9 +224,6 @@ int __init fpga_irq_of_init(struct device_node *node, + + fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node); + +- writel(clear_mask, base + IRQ_ENABLE_CLEAR); +- writel(clear_mask, base + FIQ_ENABLE_CLEAR); +- + /* + * On Versatile AB/PB, some secondary interrupts have a direct + * pass-thru to the primary controller for IRQs 20 and 22-31 which need