Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
95d86d92c9
@ -204,11 +204,12 @@ menu "Target Images"
|
||||
|
||||
config GRUB_EFI_IMAGES
|
||||
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
|
||||
depends on TARGET_x86
|
||||
depends on TARGET_x86 || TARGET_armvirt
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||
select PACKAGE_grub2
|
||||
select PACKAGE_grub2-efi
|
||||
select PACKAGE_grub2-bios-setup
|
||||
select PACKAGE_grub2 if TARGET_x86
|
||||
select PACKAGE_grub2-efi if TARGET_x86
|
||||
select PACKAGE_grub2-bios-setup if TARGET_x86
|
||||
select PACKAGE_grub2-efi-arm if TARGET_armvirt
|
||||
select PACKAGE_kmod-fs-vfat
|
||||
default y
|
||||
|
||||
@ -275,7 +276,7 @@ menu "Target Images"
|
||||
|
||||
config VMDK_IMAGES
|
||||
bool "Build VMware image files (VMDK)"
|
||||
depends on TARGET_x86
|
||||
depends on TARGET_x86 || TARGET_armvirt
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
select PACKAGE_kmod-e1000
|
||||
default y if BUILDBOT
|
||||
@ -303,6 +304,7 @@ menu "Target Images"
|
||||
default 8 if TARGET_apm821xx_sata
|
||||
default 16 if TARGET_rockchip
|
||||
default 64 if TARGET_bcm27xx
|
||||
default 128 if TARGET_armvirt
|
||||
default 32
|
||||
|
||||
config TARGET_ROOTFS_PARTSIZE
|
||||
|
@ -399,6 +399,17 @@ config KERNEL_DEBUG_INFO_REDUCED
|
||||
DEBUG_INFO build and compile times are reduced too.
|
||||
Only works with newer gcc versions.
|
||||
|
||||
config KERNEL_FRAME_WARN
|
||||
int
|
||||
range 0 8192
|
||||
default 1280 if KERNEL_KASAN && !ARCH_64BIT
|
||||
default 1024 if !ARCH_64BIT
|
||||
default 2048 if ARCH_64BIT
|
||||
help
|
||||
Tell the compiler to warn at build time for stack frames larger than this.
|
||||
Setting this too low will cause a lot of warnings.
|
||||
Setting it to 0 disables the warning.
|
||||
|
||||
# KERNEL_DEBUG_LL symbols must have the default value set as otherwise
|
||||
# KConfig wont evaluate them unless KERNEL_EARLY_PRINTK is selected
|
||||
# which means that buildroot wont override the DEBUG_LL symbols in target
|
||||
|
@ -33,14 +33,15 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/grub2/Default
|
||||
CATEGORY:=Boot Loaders
|
||||
SECTION:=boot
|
||||
TITLE:=GRand Unified Bootloader ($(1))
|
||||
TITLE:=GRand Unified Bootloader ($(2))
|
||||
URL:=http://www.gnu.org/software/grub/
|
||||
DEPENDS:=@TARGET_x86
|
||||
VARIANT:=$(1)
|
||||
DEPENDS:=@TARGET_$(1)
|
||||
VARIANT:=$(2)
|
||||
endef
|
||||
|
||||
Package/grub2=$(call Package/grub2/Default,pc)
|
||||
Package/grub2-efi=$(call Package/grub2/Default,efi)
|
||||
Package/grub2=$(call Package/grub2/Default,x86,pc)
|
||||
Package/grub2-efi=$(call Package/grub2/Default,x86,efi)
|
||||
Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi)
|
||||
|
||||
define Package/grub2-editenv
|
||||
CATEGORY:=Utilities
|
||||
@ -107,6 +108,10 @@ ifneq ($(BUILD_VARIANT),none)
|
||||
MAKE_PATH := grub-core
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_arm),y)
|
||||
TARGET_CFLAGS := $(filter-out -mfloat-abi=hard,$(TARGET_CFLAGS))
|
||||
endif
|
||||
|
||||
define Host/Configure
|
||||
$(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
|
||||
$(Host/Configure/Default)
|
||||
@ -162,9 +167,31 @@ define Package/grub2-efi/install
|
||||
-O $(CONFIG_ARCH)-efi \
|
||||
-c ./files/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \
|
||||
at_keyboard boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
|
||||
boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
|
||||
endef
|
||||
|
||||
define Package/grub2-efi-arm/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
|
||||
cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O arm$(if $(CONFIG_aarch64),64,)-efi \
|
||||
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi \
|
||||
boot chain configfile fat linux ls part_gpt part_msdos reboot search \
|
||||
search_fs_uuid search_label serial efi_gop lsefi minicmd ext2
|
||||
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
||||
-d $(PKG_BUILD_DIR)/grub-core \
|
||||
-p /boot/grub \
|
||||
-O arm$(if $(CONFIG_aarch64),64,)-efi \
|
||||
-c ./files/grub-early.cfg \
|
||||
-o $(STAGING_DIR_IMAGE)/grub2/iso-bootaa$(if $(CONFIG_aarch64),aa64,arm).efi \
|
||||
boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt \
|
||||
reboot serial test efi_gop
|
||||
endef
|
||||
|
||||
|
||||
define Package/grub2-editenv/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/
|
||||
@ -178,5 +205,6 @@ endef
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,grub2))
|
||||
$(eval $(call BuildPackage,grub2-efi))
|
||||
$(eval $(call BuildPackage,grub2-efi-arm))
|
||||
$(eval $(call BuildPackage,grub2-editenv))
|
||||
$(eval $(call BuildPackage,grub2-bios-setup))
|
||||
|
2
package/boot/grub2/files/grub-early-gpt.cfg
Normal file
2
package/boot/grub2/files/grub-early-gpt.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
search --set=root --label kernel
|
||||
configfile ($root)/efi/openwrt/grub.cfg
|
@ -1602,3 +1602,18 @@ endef
|
||||
|
||||
$(eval $(call KernelPackage,lan743x))
|
||||
|
||||
define KernelPackage/amazon-ena
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Elastic Network Adapter (for Amazon AWS)
|
||||
DEPENDS:=@TARGET_x86_64||TARGET_armvirt_64
|
||||
KCONFIG:=CONFIG_ENA_ETHERNET
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko
|
||||
AUTOLOAD:=$(call AutoLoad,12,ena)
|
||||
endef
|
||||
|
||||
define KernelPackage/amazon-ena/description
|
||||
This driver supports Elastic Network Adapter (ENA)
|
||||
used by Amazon AWS T3 (2018) and later instances.
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,amazon-ena))
|
||||
|
@ -1363,6 +1363,21 @@ endef
|
||||
|
||||
$(eval $(call KernelPackage,mdio))
|
||||
|
||||
define KernelPackage/mdio-bus-mux
|
||||
SUBMENU:=$(NETWORK_SUPPORT_MENU)
|
||||
TITLE:=MDIO bus multiplexers
|
||||
KCONFIG:=CONFIG_MDIO_BUS_MUX
|
||||
HIDDEN:=1
|
||||
FILES:=$(LINUX_DIR)/drivers/net/mdio/mdio-mux.ko
|
||||
AUTOLOAD:=$(call AutoLoad,32,mdio-mux)
|
||||
endef
|
||||
|
||||
define KernelPackage/mdio/description
|
||||
Kernel framework for MDIO bus multiplexers.
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mdio-bus-mux))
|
||||
|
||||
define KernelPackage/macsec
|
||||
SUBMENU:=$(NETWORK_SUPPORT_MENU)
|
||||
TITLE:=IEEE 802.1AE MAC-level encryption (MAC)
|
||||
|
@ -331,17 +331,6 @@ define KernelPackage/usb-bcma
|
||||
endef
|
||||
$(eval $(call KernelPackage,usb-bcma))
|
||||
|
||||
define KernelPackage/usb-fotg210
|
||||
TITLE:=Support for FOTG210 USB host controllers
|
||||
DEPENDS:=@USB_SUPPORT @TARGET_gemini
|
||||
KCONFIG:=CONFIG_USB_FOTG210_HCD
|
||||
FILES:= \
|
||||
$(if $(CONFIG_USB_FOTG210_HCD),$(LINUX_DIR)/drivers/usb/host/fotg210-hcd.ko)
|
||||
AUTOLOAD:=$(call AutoLoad,50,fotg210-hcd,1)
|
||||
$(call AddDepends/usb)
|
||||
endef
|
||||
$(eval $(call KernelPackage,usb-fotg210))
|
||||
|
||||
define KernelPackage/usb-ssb
|
||||
TITLE:=Support for SSB USB controllers
|
||||
DEPENDS:=@USB_SUPPORT @TARGET_bcm47xx
|
||||
|
@ -9,8 +9,10 @@ fi
|
||||
OUTPUT="$1"
|
||||
KERNELSIZE="$2"
|
||||
KERNELDIR="$3"
|
||||
KERNELPARTTYPE=${KERNELPARTTYPE:-83}
|
||||
ROOTFSSIZE="$4"
|
||||
ROOTFSIMAGE="$5"
|
||||
ROOTFSPARTTYPE=${ROOTFSPARTTYPE:-83}
|
||||
ALIGN="$6"
|
||||
|
||||
rm -f "$OUTPUT"
|
||||
@ -19,7 +21,7 @@ head=16
|
||||
sect=63
|
||||
|
||||
# create partition table
|
||||
set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -p "${KERNELSIZE}m${PARTOFFSET:+@$PARTOFFSET}" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID})
|
||||
set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -t "${KERNELPARTTYPE}" -p "${KERNELSIZE}m${PARTOFFSET:+@$PARTOFFSET}" -t "${ROOTFSPARTTYPE}" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID})
|
||||
|
||||
KERNELOFFSET="$(($1 / 512))"
|
||||
KERNELSIZE="$2"
|
||||
|
@ -19,11 +19,12 @@ define KernelPackage/hw-crypto-4xx
|
||||
CONFIG_HW_RANDOM=y \
|
||||
CONFIG_CRYPTO_DEV_PPC4XX \
|
||||
CONFIG_HW_RANDOM_PPC4XX=y
|
||||
DEPENDS:=+kmod-random-core +kmod-crypto-manager \
|
||||
DEPENDS:=@TARGET_apm821xx +kmod-random-core +kmod-crypto-manager \
|
||||
+kmod-crypto-ccm +kmod-crypto-gcm \
|
||||
+kmod-crypto-sha1 +kmod-crypto-sha256 +kmod-crypto-sha512
|
||||
FILES:=$(LINUX_DIR)/drivers/crypto/amcc/crypto4xx.ko
|
||||
AUTOLOAD:=$(call AutoLoad,09,sata_dwc_460ex,1)
|
||||
$(call AddDepends/crypto)
|
||||
endef
|
||||
|
||||
define KernelPackage/hw-crypto-4xx/description
|
||||
|
@ -4,6 +4,7 @@ CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
|
||||
CONFIG_ARCH_MULTIPLATFORM=y
|
||||
CONFIG_ARCH_MULTI_V6_V7=y
|
||||
CONFIG_ARCH_MULTI_V7=y
|
||||
CONFIG_ARCH_MMAP_RND_BITS=8
|
||||
CONFIG_ARCH_NR_GPIO=0
|
||||
CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
|
||||
CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
|
||||
@ -13,6 +14,7 @@ CONFIG_ARM=y
|
||||
CONFIG_ARM_CPU_SUSPEND=y
|
||||
CONFIG_ARM_HAS_SG_CHAIN=y
|
||||
CONFIG_ARM_HEAVY_MB=y
|
||||
# CONFIG_ARM_HIGHBANK_CPUIDLE is not set
|
||||
CONFIG_ARM_L1_CACHE_SHIFT=6
|
||||
CONFIG_ARM_L1_CACHE_SHIFT_6=y
|
||||
CONFIG_ARM_LPAE=y
|
||||
|
@ -1,6 +1,6 @@
|
||||
ARCH:=arm
|
||||
SUBTARGET:=32
|
||||
BOARDNAME:=QEMU ARM Virtual Machine (cortex-a15)
|
||||
BOARDNAME:=32-bit ARM QEMU Virtual Machine
|
||||
CPU_TYPE:=cortex-a15
|
||||
CPU_SUBTYPE:=neon-vfpv4
|
||||
KERNELNAME:=zImage
|
||||
|
@ -1,13 +1,25 @@
|
||||
CONFIG_64BIT=y
|
||||
CONFIG_ACPI_PCC=y
|
||||
CONFIG_ARCH_HISI=y
|
||||
CONFIG_ARCH_INTEL_SOCFPGA=y
|
||||
CONFIG_ARCH_LAYERSCAPE=y
|
||||
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
|
||||
CONFIG_ARCH_MMAP_RND_BITS=18
|
||||
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
|
||||
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
|
||||
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
|
||||
CONFIG_ARCH_MVEBU=y
|
||||
CONFIG_ARCH_NXP=y
|
||||
CONFIG_ARCH_PROC_KCORE_TEXT=y
|
||||
CONFIG_ARCH_ROCKCHIP=y
|
||||
CONFIG_ARCH_STACKWALK=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
CONFIG_ARCH_SYNQUACER=y
|
||||
CONFIG_ARCH_THUNDER=y
|
||||
CONFIG_ARCH_THUNDER2=y
|
||||
CONFIG_ARCH_VEXPRESS=y
|
||||
CONFIG_ARCH_WANTS_NO_INSTR=y
|
||||
CONFIG_ARCH_ZYNQMP=y
|
||||
CONFIG_ARM64=y
|
||||
CONFIG_ARM64_4K_PAGES=y
|
||||
CONFIG_ARM64_CNP=y
|
||||
@ -32,21 +44,64 @@ CONFIG_ARM64_PTR_AUTH_KERNEL=y
|
||||
CONFIG_ARM64_SME=y
|
||||
CONFIG_ARM64_SVE=y
|
||||
CONFIG_ARM64_TAGGED_ADDR_ABI=y
|
||||
CONFIG_ARM64_VA_BITS=39
|
||||
CONFIG_ARM64_VA_BITS_39=y
|
||||
CONFIG_ARM64_VA_BITS=48
|
||||
CONFIG_ARM64_VA_BITS_48=y
|
||||
CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
|
||||
CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
|
||||
CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y
|
||||
# CONFIG_ARMADA_37XX_RWTM_MBOX is not set
|
||||
CONFIG_ARMADA_37XX_WATCHDOG=y
|
||||
CONFIG_ARMADA_THERMAL=y
|
||||
CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y
|
||||
# CONFIG_ARM_DMC620_PMU is not set
|
||||
# CONFIG_ARM_MHU_V2 is not set
|
||||
CONFIG_ARM_SBSA_WATCHDOG=y
|
||||
CONFIG_ARM_SMC_WATCHDOG=y
|
||||
CONFIG_ARM_SMMU=y
|
||||
# CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT is not set
|
||||
# CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS is not set
|
||||
CONFIG_ARM_SMMU_V3=y
|
||||
# CONFIG_ARM_SMMU_V3_PMU is not set
|
||||
# CONFIG_ARM_SMMU_V3_SVA is not set
|
||||
CONFIG_ATOMIC64_SELFTEST=y
|
||||
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
|
||||
# CONFIG_AXI_DMAC is not set
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||
CONFIG_BLK_PM=y
|
||||
CONFIG_CAVIUM_TX2_ERRATUM_219=y
|
||||
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
|
||||
CONFIG_CLK_INTEL_SOCFPGA=y
|
||||
CONFIG_CLK_INTEL_SOCFPGA64=y
|
||||
CONFIG_CLK_LS1028A_PLLDIG=y
|
||||
CONFIG_CLK_PX30=y
|
||||
CONFIG_CLK_QORIQ=y
|
||||
CONFIG_CLK_RK3308=y
|
||||
CONFIG_CLK_RK3328=y
|
||||
CONFIG_CLK_RK3368=y
|
||||
CONFIG_CLK_RK3399=y
|
||||
CONFIG_CLK_RK3568=y
|
||||
CONFIG_CLK_SP810=y
|
||||
CONFIG_CLK_SUNXI=y
|
||||
CONFIG_CLK_SUNXI_CLOCKS=y
|
||||
# CONFIG_CLK_SUNXI_PRCM_SUN6I is not set
|
||||
# CONFIG_CLK_SUNXI_PRCM_SUN8I is not set
|
||||
# CONFIG_CLK_SUNXI_PRCM_SUN9I is not set
|
||||
CONFIG_CLK_VEXPRESS_OSC=y
|
||||
# CONFIG_COMMON_CLK_FSL_FLEXSPI is not set
|
||||
# CONFIG_COMMON_CLK_FSL_SAI is not set
|
||||
CONFIG_COMMON_CLK_HI3516CV300=y
|
||||
CONFIG_COMMON_CLK_HI3519=y
|
||||
CONFIG_COMMON_CLK_HI3559A=y
|
||||
CONFIG_COMMON_CLK_HI3660=y
|
||||
CONFIG_COMMON_CLK_HI3670=y
|
||||
CONFIG_COMMON_CLK_HI3798CV200=y
|
||||
CONFIG_COMMON_CLK_HI6220=y
|
||||
CONFIG_COMMON_CLK_HI655X=y
|
||||
CONFIG_COMMON_CLK_ROCKCHIP=y
|
||||
CONFIG_COMMON_CLK_SCPI=y
|
||||
CONFIG_COMMON_CLK_ZYNQMP=y
|
||||
CONFIG_COMMON_RESET_HI3660=y
|
||||
CONFIG_COMMON_RESET_HI6220=y
|
||||
# CONFIG_COMPAT_32BIT_TIME is not set
|
||||
CONFIG_CPU_IDLE=y
|
||||
CONFIG_CPU_IDLE_GOV_MENU=y
|
||||
@ -63,6 +118,15 @@ CONFIG_CRYPTO_BLAKE2S=y
|
||||
CONFIG_CRYPTO_CHACHA20=y
|
||||
CONFIG_CRYPTO_CHACHA20_NEON=y
|
||||
CONFIG_CRYPTO_CRYPTD=y
|
||||
# CONFIG_CRYPTO_DEV_ALLWINNER is not set
|
||||
# CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM is not set
|
||||
# CONFIG_CRYPTO_DEV_HISI_HPRE is not set
|
||||
# CONFIG_CRYPTO_DEV_HISI_SEC2 is not set
|
||||
# CONFIG_CRYPTO_DEV_HISI_TRNG is not set
|
||||
# CONFIG_CRYPTO_DEV_OCTEONTX2_CPT is not set
|
||||
# CONFIG_CRYPTO_DEV_ROCKCHIP is not set
|
||||
# CONFIG_CRYPTO_DEV_ZYNQMP_AES is not set
|
||||
# CONFIG_CRYPTO_DEV_ZYNQMP_SHA3 is not set
|
||||
CONFIG_CRYPTO_GHASH_ARM64_CE=y
|
||||
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
|
||||
CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y
|
||||
@ -77,6 +141,7 @@ CONFIG_CRYPTO_SIMD=y
|
||||
# CONFIG_CRYPTO_SM4_ARM64_NEON_BLK is not set
|
||||
CONFIG_DMA_DIRECT_REMAP=y
|
||||
CONFIG_DMA_SHARED_BUFFER=y
|
||||
CONFIG_DMA_SUN6I=y
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_BOCHS=y
|
||||
CONFIG_DRM_BRIDGE=y
|
||||
@ -86,10 +151,14 @@ CONFIG_DRM_PANEL=y
|
||||
CONFIG_DRM_PANEL_BRIDGE=y
|
||||
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
|
||||
CONFIG_DRM_QXL=y
|
||||
# CONFIG_DRM_ROCKCHIP is not set
|
||||
CONFIG_DRM_TTM=y
|
||||
CONFIG_DRM_TTM_HELPER=y
|
||||
CONFIG_DRM_VIRTIO_GPU=y
|
||||
CONFIG_DRM_VRAM_HELPER=y
|
||||
# CONFIG_DWMAC_SUN8I is not set
|
||||
# CONFIG_DWMAC_SUNXI is not set
|
||||
CONFIG_DW_WATCHDOG=y
|
||||
CONFIG_FB=y
|
||||
CONFIG_FB_ARMCLCD=y
|
||||
CONFIG_FB_CFB_COPYAREA=y
|
||||
@ -97,62 +166,279 @@ CONFIG_FB_CFB_FILLRECT=y
|
||||
CONFIG_FB_CFB_IMAGEBLIT=y
|
||||
CONFIG_FB_CMDLINE=y
|
||||
CONFIG_FB_MODE_HELPERS=y
|
||||
# CONFIG_FB_XILINX is not set
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
# CONFIG_FSL_DPAA is not set
|
||||
# CONFIG_FSL_DPAA2_QDMA is not set
|
||||
CONFIG_FSL_ERRATUM_A008585=y
|
||||
# CONFIG_FSL_IMX8_DDR_PMU is not set
|
||||
# CONFIG_FSL_PQ_MDIO is not set
|
||||
CONFIG_FUJITSU_ERRATUM_010001=y
|
||||
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
|
||||
CONFIG_GENERIC_CSUM=y
|
||||
CONFIG_GENERIC_FIND_FIRST_BIT=y
|
||||
# CONFIG_GIANFAR is not set
|
||||
CONFIG_GPIO_GENERIC=y
|
||||
CONFIG_GPIO_GENERIC_PLATFORM=y
|
||||
CONFIG_GPIO_MPC8XXX=y
|
||||
CONFIG_GPIO_ROCKCHIP=y
|
||||
CONFIG_GPIO_THUNDERX=y
|
||||
CONFIG_GPIO_XLP=y
|
||||
CONFIG_GPIO_ZYNQ=y
|
||||
CONFIG_GPIO_ZYNQMP_MODEPIN=y
|
||||
CONFIG_HDMI=y
|
||||
CONFIG_HI3660_MBOX=y
|
||||
CONFIG_HI6220_MBOX=y
|
||||
CONFIG_HISILICON_LPC=y
|
||||
CONFIG_HISI_PMU=y
|
||||
CONFIG_HISI_THERMAL=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y
|
||||
# CONFIG_HW_RANDOM_HISI is not set
|
||||
CONFIG_HW_RANDOM_VIRTIO=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_ALGOBIT=y
|
||||
CONFIG_I2C_ALTERA=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
# CONFIG_I2C_HIX5HD2 is not set
|
||||
CONFIG_I2C_IMX=y
|
||||
# CONFIG_I2C_SLAVE_TESTUNIT is not set
|
||||
CONFIG_I2C_SYNQUACER=y
|
||||
CONFIG_I2C_THUNDERX=y
|
||||
# CONFIG_I2C_XLP9XX is not set
|
||||
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
|
||||
# CONFIG_IMX2_WDT is not set
|
||||
# CONFIG_INPUT_HISI_POWERKEY is not set
|
||||
# CONFIG_INPUT_IBM_PANEL is not set
|
||||
# CONFIG_INTEL_STRATIX10_RSU is not set
|
||||
# CONFIG_INTEL_STRATIX10_SERVICE is not set
|
||||
# CONFIG_IOMMU_DEBUGFS is not set
|
||||
# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set
|
||||
CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
|
||||
CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y
|
||||
# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set
|
||||
# CONFIG_IOMMU_IO_PGTABLE_DART is not set
|
||||
# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set
|
||||
CONFIG_IOMMU_SUPPORT=y
|
||||
# CONFIG_K3_DMA is not set
|
||||
CONFIG_KCMP=y
|
||||
# CONFIG_KEYBOARD_SUN4I_LRADC is not set
|
||||
CONFIG_LCD_CLASS_DEVICE=m
|
||||
# CONFIG_LCD_PLATFORM is not set
|
||||
# CONFIG_MAILBOX_TEST is not set
|
||||
CONFIG_MARVELL_10G_PHY=y
|
||||
# CONFIG_MARVELL_CN10K_DDR_PMU is not set
|
||||
# CONFIG_MARVELL_CN10K_TAD_PMU is not set
|
||||
CONFIG_MDIO_SUN4I=y
|
||||
# CONFIG_MFD_ALTERA_A10SR is not set
|
||||
CONFIG_MFD_ALTERA_SYSMGR=y
|
||||
# CONFIG_MFD_AXP20X_RSB is not set
|
||||
CONFIG_MFD_CORE=y
|
||||
CONFIG_MFD_HI655X_PMIC=y
|
||||
# CONFIG_MFD_KHADAS_MCU is not set
|
||||
CONFIG_MFD_SUN4I_GPADC=y
|
||||
# CONFIG_MFD_SUN6I_PRCM is not set
|
||||
CONFIG_MFD_SYSCON=y
|
||||
CONFIG_MFD_VEXPRESS_SYSREG=y
|
||||
CONFIG_MMC=y
|
||||
CONFIG_MMC_ARMMMCI=y
|
||||
CONFIG_MMC_CAVIUM_THUNDERX=y
|
||||
CONFIG_MMC_DW=y
|
||||
# CONFIG_MMC_DW_BLUEFIELD is not set
|
||||
# CONFIG_MMC_DW_EXYNOS is not set
|
||||
# CONFIG_MMC_DW_HI3798CV200 is not set
|
||||
# CONFIG_MMC_DW_K3 is not set
|
||||
# CONFIG_MMC_DW_PCI is not set
|
||||
CONFIG_MMC_DW_PLTFM=y
|
||||
CONFIG_MMC_DW_ROCKCHIP=y
|
||||
CONFIG_MMC_RICOH_MMC=y
|
||||
CONFIG_MMC_SDHCI=y
|
||||
CONFIG_MMC_SDHCI_ACPI=y
|
||||
CONFIG_MMC_SDHCI_OF_ESDHC=y
|
||||
CONFIG_MMC_SDHCI_PCI=y
|
||||
CONFIG_MMC_SDHCI_PLTFM=y
|
||||
CONFIG_MMC_SUNXI=y
|
||||
CONFIG_MODULES_USE_ELF_RELA=y
|
||||
# CONFIG_MVNETA is not set
|
||||
# CONFIG_MVPP2 is not set
|
||||
# CONFIG_MV_XOR is not set
|
||||
CONFIG_NEED_SG_DMA_LENGTH=y
|
||||
# CONFIG_NET_VENDOR_ALLWINNER is not set
|
||||
CONFIG_NO_HZ=y
|
||||
CONFIG_NO_HZ_COMMON=y
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_NR_CPUS=64
|
||||
CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y
|
||||
# CONFIG_NVMEM_LAYERSCAPE_SFP is not set
|
||||
CONFIG_NVMEM_ROCKCHIP_EFUSE=y
|
||||
# CONFIG_NVMEM_ROCKCHIP_OTP is not set
|
||||
# CONFIG_NVMEM_SUNXI_SID is not set
|
||||
# CONFIG_NVMEM_ZYNQMP is not set
|
||||
CONFIG_PCC=y
|
||||
CONFIG_PCIE_HISI_STB=y
|
||||
CONFIG_PCIE_LAYERSCAPE=y
|
||||
CONFIG_PCIE_MOBIVEIL_PLAT=y
|
||||
CONFIG_PCIE_ROCKCHIP=y
|
||||
# CONFIG_PCIE_ROCKCHIP_DW_HOST is not set
|
||||
CONFIG_PCIE_ROCKCHIP_HOST=y
|
||||
CONFIG_PCIE_XILINX_CPM=y
|
||||
CONFIG_PCIE_XILINX_NWL=y
|
||||
CONFIG_PCI_AARDVARK=y
|
||||
CONFIG_PCI_LAYERSCAPE=y
|
||||
# CONFIG_PHY_FSL_LYNX_28G is not set
|
||||
CONFIG_PHY_HI3660_USB=y
|
||||
CONFIG_PHY_HI3670_PCIE=y
|
||||
CONFIG_PHY_HI3670_USB=y
|
||||
CONFIG_PHY_HI6220_USB=y
|
||||
CONFIG_PHY_HISI_INNO_USB2=y
|
||||
# CONFIG_PHY_HISTB_COMBPHY is not set
|
||||
CONFIG_PHY_MVEBU_A3700_COMPHY=y
|
||||
CONFIG_PHY_MVEBU_A3700_UTMI=y
|
||||
CONFIG_PHY_MVEBU_A38X_COMPHY=y
|
||||
CONFIG_PHY_MVEBU_CP110_COMPHY=y
|
||||
# CONFIG_PHY_ROCKCHIP_DP is not set
|
||||
# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set
|
||||
CONFIG_PHY_ROCKCHIP_EMMC=y
|
||||
# CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY is not set
|
||||
# CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY is not set
|
||||
# CONFIG_PHY_ROCKCHIP_INNO_HDMI is not set
|
||||
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
|
||||
# CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY is not set
|
||||
CONFIG_PHY_ROCKCHIP_PCIE=y
|
||||
CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=y
|
||||
CONFIG_PHY_ROCKCHIP_TYPEC=y
|
||||
# CONFIG_PHY_ROCKCHIP_USB is not set
|
||||
CONFIG_PHY_SUN4I_USB=y
|
||||
CONFIG_PHY_SUN50I_USB3=y
|
||||
# CONFIG_PHY_SUN6I_MIPI_DPHY is not set
|
||||
CONFIG_PHY_SUN9I_USB=y
|
||||
# CONFIG_PHY_XILINX_ZYNQMP is not set
|
||||
CONFIG_PINCTRL_ROCKCHIP=y
|
||||
# CONFIG_PINCTRL_SUN20I_D1 is not set
|
||||
CONFIG_PINCTRL_SUN4I_A10=y
|
||||
CONFIG_PINCTRL_SUN50I_A100=y
|
||||
CONFIG_PINCTRL_SUN50I_A100_R=y
|
||||
CONFIG_PINCTRL_SUN50I_A64=y
|
||||
CONFIG_PINCTRL_SUN50I_A64_R=y
|
||||
CONFIG_PINCTRL_SUN50I_H5=y
|
||||
CONFIG_PINCTRL_SUN50I_H6=y
|
||||
CONFIG_PINCTRL_SUN50I_H616=y
|
||||
CONFIG_PINCTRL_SUN50I_H616_R=y
|
||||
CONFIG_PINCTRL_SUN50I_H6_R=y
|
||||
CONFIG_PINCTRL_SUN5I=y
|
||||
# CONFIG_PINCTRL_SUN6I_A31 is not set
|
||||
# CONFIG_PINCTRL_SUN6I_A31_R is not set
|
||||
# CONFIG_PINCTRL_SUN8I_A23 is not set
|
||||
# CONFIG_PINCTRL_SUN8I_A23_R is not set
|
||||
# CONFIG_PINCTRL_SUN8I_A33 is not set
|
||||
# CONFIG_PINCTRL_SUN8I_A83T is not set
|
||||
# CONFIG_PINCTRL_SUN8I_A83T_R is not set
|
||||
# CONFIG_PINCTRL_SUN8I_H3 is not set
|
||||
# CONFIG_PINCTRL_SUN8I_H3_R is not set
|
||||
# CONFIG_PINCTRL_SUN8I_V3S is not set
|
||||
# CONFIG_PINCTRL_SUN9I_A80 is not set
|
||||
# CONFIG_PINCTRL_SUN9I_A80_R is not set
|
||||
CONFIG_PINCTRL_ZYNQMP=y
|
||||
CONFIG_PM=y
|
||||
CONFIG_PM_CLK=y
|
||||
CONFIG_PM_GENERIC_DOMAINS=y
|
||||
CONFIG_PM_GENERIC_DOMAINS_OF=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_HISI=y
|
||||
CONFIG_POWER_RESET_VEXPRESS=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_QORIQ_THERMAL=y
|
||||
CONFIG_QUEUED_RWLOCKS=y
|
||||
CONFIG_QUEUED_SPINLOCKS=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_REGMAP_MMIO=y
|
||||
CONFIG_REGULATOR_AXP20X=y
|
||||
CONFIG_REGULATOR_HI655X=y
|
||||
CONFIG_ROCKCHIP_IODOMAIN=y
|
||||
CONFIG_ROCKCHIP_IOMMU=y
|
||||
# CONFIG_ROCKCHIP_MBOX is not set
|
||||
CONFIG_ROCKCHIP_PM_DOMAINS=y
|
||||
# CONFIG_ROCKCHIP_SARADC is not set
|
||||
# CONFIG_ROCKCHIP_THERMAL is not set
|
||||
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
|
||||
# CONFIG_RTC_DRV_FSL_FTM_ALARM is not set
|
||||
CONFIG_RTC_DRV_MV=y
|
||||
CONFIG_RTC_I2C_AND_SPI=y
|
||||
CONFIG_SMC91X=y
|
||||
# CONFIG_SERIAL_8250_EXAR is not set
|
||||
CONFIG_SERIAL_8250_FSL=y
|
||||
CONFIG_SERIAL_8250_PCI=y
|
||||
CONFIG_SERIAL_FSL_LPUART=y
|
||||
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
|
||||
CONFIG_SERIAL_MVEBU_CONSOLE=y
|
||||
CONFIG_SERIAL_MVEBU_UART=y
|
||||
CONFIG_SERIAL_SAMSUNG=y
|
||||
CONFIG_SERIAL_SAMSUNG_CONSOLE=y
|
||||
# CONFIG_SMC91X is not set
|
||||
# CONFIG_SND_SUN4I_I2S is not set
|
||||
# CONFIG_SND_SUN50I_CODEC_ANALOG is not set
|
||||
# CONFIG_SND_SUN50I_DMIC is not set
|
||||
# CONFIG_SND_SUN8I_CODEC is not set
|
||||
# CONFIG_SND_SUN8I_CODEC_ANALOG is not set
|
||||
# CONFIG_SNI_NETSEC is not set
|
||||
CONFIG_SPARSEMEM=y
|
||||
CONFIG_SPARSEMEM_EXTREME=y
|
||||
CONFIG_SPARSEMEM_VMEMMAP=y
|
||||
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
|
||||
CONFIG_SPI_ARMADA_3700=y
|
||||
# CONFIG_SPI_FSL_QUADSPI is not set
|
||||
# CONFIG_SPI_HISI_KUNPENG is not set
|
||||
# CONFIG_SPI_HISI_SFC is not set
|
||||
# CONFIG_SPI_HISI_SFC_V3XX is not set
|
||||
# CONFIG_SPI_ROCKCHIP_SFC is not set
|
||||
# CONFIG_SPI_SUN4I is not set
|
||||
# CONFIG_SPI_SUN6I is not set
|
||||
# CONFIG_SPI_SYNQUACER is not set
|
||||
CONFIG_SPI_THUNDERX=y
|
||||
# CONFIG_SPI_XLP is not set
|
||||
CONFIG_STUB_CLK_HI3660=y
|
||||
CONFIG_STUB_CLK_HI6220=y
|
||||
CONFIG_SUN50I_A100_CCU=y
|
||||
CONFIG_SUN50I_A100_R_CCU=y
|
||||
CONFIG_SUN50I_A64_CCU=y
|
||||
CONFIG_SUN50I_H616_CCU=y
|
||||
CONFIG_SUN50I_H6_CCU=y
|
||||
CONFIG_SUN50I_H6_R_CCU=y
|
||||
CONFIG_SUN50I_IOMMU=y
|
||||
CONFIG_SUN6I_MSGBOX=y
|
||||
CONFIG_SUN6I_RTC_CCU=y
|
||||
# CONFIG_SUN8I_A83T_CCU is not set
|
||||
CONFIG_SUN8I_DE2_CCU=y
|
||||
# CONFIG_SUN8I_H3_CCU is not set
|
||||
CONFIG_SUN8I_R_CCU=y
|
||||
CONFIG_SUN8I_THERMAL=y
|
||||
CONFIG_SUNXI_CCU=y
|
||||
CONFIG_SUNXI_RSB=y
|
||||
CONFIG_SUNXI_WATCHDOG=y
|
||||
CONFIG_SYNC_FILE=y
|
||||
CONFIG_SYSCTL_EXCEPTION_TRACE=y
|
||||
# CONFIG_TCG_TIS_SYNQUACER is not set
|
||||
CONFIG_THREAD_INFO_IN_TASK=y
|
||||
# CONFIG_TURRIS_MOX_RWTM is not set
|
||||
# CONFIG_UACCE is not set
|
||||
CONFIG_UNMAP_KERNEL_AT_EL0=y
|
||||
CONFIG_USB_DWC3=y
|
||||
CONFIG_USB_DWC3_XILINX=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_HISTB=y
|
||||
CONFIG_USB_XHCI_MVEBU=y
|
||||
CONFIG_USB_XHCI_PLATFORM=y
|
||||
CONFIG_VEXPRESS_CONFIG=y
|
||||
CONFIG_VIDEOMODE_HELPERS=y
|
||||
CONFIG_VIRTIO_DMA_SHARED_BUFFER=y
|
||||
# CONFIG_VIRTIO_IOMMU is not set
|
||||
CONFIG_VMAP_STACK=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_WDAT_WDT=y
|
||||
# CONFIG_XILINX_AMS is not set
|
||||
# CONFIG_XILINX_INTC is not set
|
||||
CONFIG_XLNX_EVENT_MANAGER=y
|
||||
CONFIG_ZONE_DMA32=y
|
||||
CONFIG_ZYNQMP_FIRMWARE=y
|
||||
# CONFIG_ZYNQMP_FIRMWARE_DEBUG is not set
|
||||
CONFIG_ZYNQMP_PM_DOMAINS=y
|
||||
CONFIG_ZYNQMP_POWER=y
|
||||
|
@ -1,8 +1,6 @@
|
||||
ARCH:=aarch64
|
||||
SUBTARGET:=64
|
||||
BOARDNAME:=QEMU ARMv8 Virtual Machine (cortex-a53)
|
||||
CPU_TYPE:=cortex-a53
|
||||
KERNELNAME:=Image
|
||||
BOARDNAME:=64-bit ARM machines
|
||||
|
||||
define Target/Description
|
||||
Build multi-platform images for the ARMv8 instruction set architecture
|
||||
|
@ -6,14 +6,16 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
BOARD:=armvirt
|
||||
BOARDNAME:=QEMU ARM Virtual Machine
|
||||
FEATURES:=fpu pci rtc usb
|
||||
FEATURES+=cpiogz ext4 ramdisk squashfs targz
|
||||
FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part
|
||||
FEATURES+=cpiogz ext4 ramdisk squashfs targz vmdk
|
||||
|
||||
KERNEL_PATCHVER:=5.15
|
||||
KERNEL_TESTING_PATCHVER:=6.1
|
||||
KERNEL_PATCHVER:=6.1
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
DEFAULT_PACKAGES += mkf2fs e2fsprogs
|
||||
# blkid used for resolving PARTUUID
|
||||
# in sysupgrade
|
||||
DEFAULT_PACKAGES += blkid
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
@ -1,21 +1,23 @@
|
||||
This is intended to be used with OpenWrt project to provide image for use with
|
||||
QEMU ARM virt machine.
|
||||
This target generates images that can be used on ARM machines with EFI
|
||||
support (e.g EDKII/TianoCore or U-Boot with bootefi).
|
||||
|
||||
The kernel and filesystem images can also be used directly by QEMU:
|
||||
|
||||
Run with qemu-system-arm
|
||||
|
||||
# boot with initramfs embedded in
|
||||
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-zImage-initramfs
|
||||
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-initramfs-kernel.bin
|
||||
|
||||
# boot with accel=kvm
|
||||
qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel
|
||||
openwrt-armvirt-32-zImage-initramfs
|
||||
openwrt-armvirt-32-generic-initramfs-kernel.bin
|
||||
|
||||
# boot with a separate rootfs
|
||||
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-zImage \
|
||||
-drive file=openwrt-armvirt-32-root.ext4,format=raw,if=virtio -append 'root=/dev/vda rootwait'
|
||||
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \
|
||||
-drive file=openwrt-armvirt-32-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait'
|
||||
|
||||
# boot with local dir as rootfs
|
||||
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-zImage \
|
||||
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \
|
||||
-fsdev local,id=rootdev,path=root-armvirt/,security_model=none \
|
||||
-device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \
|
||||
-append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p'
|
||||
@ -37,4 +39,34 @@ Run with kvmtool
|
||||
The multi-platform ARMv8 target can be used with QEMU:
|
||||
|
||||
qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \
|
||||
-kernel openwrt-armvirt-64-Image-initramfs \
|
||||
-kernel openwrt-armvirt-64-generic-initramfs-kernel.bin \
|
||||
|
||||
With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these
|
||||
images in EFI mode:
|
||||
|
||||
32-bit:
|
||||
gunzip -c bin/targets/armvirt/32/openwrt-armvirt-32-generic-ext4-combined.img.gz > openwrt-arm-32.img
|
||||
qemu-system-arm -nographic \
|
||||
-cpu cortex-a15 -machine virt \
|
||||
-bios QEMU_EFI_32.fd \
|
||||
-smp 1 -m 1024 \
|
||||
-device virtio-rng-pci \
|
||||
-drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \
|
||||
-netdev user,id=testlan -net nic,netdev=testlan \
|
||||
-netdev user,id=testwan -net nic,netdev=testwan
|
||||
|
||||
64-bit:
|
||||
gunzip -c bin/targets/armvirt/64/openwrt-armvirt-64-generic-ext4-combined.img.gz > openwrt-arm-64.img
|
||||
qemu-system-aarch64 -nographic \
|
||||
-cpu cortex-a53 -machine virt \
|
||||
-bios QEMU_EFI_64.fd \
|
||||
-smp 1 -m 1024 \
|
||||
-device virtio-rng-pci \
|
||||
-drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \
|
||||
-netdev user,id=testlan -net nic,netdev=testlan \
|
||||
-netdev user,id=testwan -net nic,netdev=testwan
|
||||
|
||||
One can find EFI/BIOS binaries from:
|
||||
- Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig)
|
||||
- From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian)
|
||||
- Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/
|
||||
|
@ -1,13 +0,0 @@
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
ucidef_set_board_id "armvirt"
|
||||
ucidef_set_model_name "QEMU ARM Virtual Machine"
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
19
target/linux/armvirt/base-files/etc/board.d/01_led
Normal file
19
target/linux/armvirt/base-files/etc/board.d/01_led
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
traverse,ten64)
|
||||
ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx"
|
||||
ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
18
target/linux/armvirt/base-files/etc/board.d/02_network
Normal file
18
target/linux/armvirt/base-files/etc/board.d/02_network
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
case "$(board_name)" in
|
||||
traverse,ten64)
|
||||
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
|
||||
ucidef_set_interface_wan "eth6"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
23
target/linux/armvirt/base-files/etc/board.d/03_gpio_switches
Normal file
23
target/linux/armvirt/base-files/etc/board.d/03_gpio_switches
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
traverse,ten64)
|
||||
ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376"
|
||||
ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377"
|
||||
ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378"
|
||||
ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379"
|
||||
ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369"
|
||||
ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
@ -2,4 +2,8 @@
|
||||
::shutdown:/etc/init.d/rcS K shutdown
|
||||
ttyAMA0::askfirst:/usr/libexec/login.sh
|
||||
ttyS0::askfirst:/usr/libexec/login.sh
|
||||
tty0::askfirst:/usr/libexec/login.sh
|
||||
hvc0::askfirst:/usr/libexec/login.sh
|
||||
ttymxc0::askfirst:/usr/libexec/login.sh
|
||||
ttymxc1::askfirst:/usr/libexec/login.sh
|
||||
ttymxc2::askfirst:/usr/libexec/login.sh
|
||||
|
52
target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi
Normal file
52
target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi
Normal file
@ -0,0 +1,52 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
sanitize_name_arm64() {
|
||||
sed -e '
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;
|
||||
s/[^a-z0-9_-]\+/-/g;
|
||||
s/^-//;
|
||||
s/-$//;
|
||||
' "$@"
|
||||
}
|
||||
|
||||
do_sysinfo_arm64() {
|
||||
local vendor product file
|
||||
|
||||
for file in sys_vendor board_vendor; do
|
||||
vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
|
||||
case "$vendor" in
|
||||
empty | \
|
||||
System\ manufacturer | \
|
||||
To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
[ -n "$vendor" ] && break
|
||||
done
|
||||
|
||||
for file in product_name board_name; do
|
||||
product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
|
||||
case "$vendor:$product" in
|
||||
?*:empty | \
|
||||
?*:System\ Product\ Name | \
|
||||
?*:To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.)
|
||||
continue
|
||||
;;
|
||||
?*:?*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -d "/sys/firmware/devicetree/base" ] && return
|
||||
|
||||
[ -n "$vendor" -a -n "$product" ] || return
|
||||
|
||||
mkdir -p /tmp/sysinfo
|
||||
|
||||
echo "$vendor $product" > /tmp/sysinfo/model
|
||||
|
||||
sanitize_name_arm64 /tmp/sysinfo/model > /tmp/sysinfo/board_name
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main do_sysinfo_arm64
|
164
target/linux/armvirt/base-files/lib/upgrade/platform.sh
Normal file
164
target/linux/armvirt/base-files/lib/upgrade/platform.sh
Normal file
@ -0,0 +1,164 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
RAMFS_COPY_BIN="/usr/sbin/blkid"
|
||||
|
||||
platform_check_image() {
|
||||
local board=$(board_name)
|
||||
local diskdev partdev diff
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
v "Board is ${board}"
|
||||
|
||||
export_bootdevice && export_partdevice diskdev 0 || {
|
||||
v "platform_check_image: Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
|
||||
get_partitions "/dev/$diskdev" bootdisk
|
||||
|
||||
v "Extract boot sector from the image"
|
||||
get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b
|
||||
|
||||
get_partitions /tmp/image.bs image
|
||||
|
||||
#compare tables
|
||||
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
|
||||
|
||||
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
|
||||
|
||||
if [ -n "$diff" ]; then
|
||||
v "Partition layout has changed. Full image will be written."
|
||||
ask_bool 0 "Abort" && exit 1
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
platform_copy_config() {
|
||||
local partdev parttype=ext4
|
||||
|
||||
if export_partdevice partdev 2; then
|
||||
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt
|
||||
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
|
||||
umount /mnt
|
||||
else
|
||||
v "ERROR: Unable to find partition to copy config data to"
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
}
|
||||
|
||||
# To avoid writing over any firmware
|
||||
# files (e.g ubootefi.var or firmware/X/ aka EBBR)
|
||||
# Copy efi/openwrt and efi/boot from the new image
|
||||
# to the existing ESP
|
||||
platform_do_upgrade_efi_system_partition() {
|
||||
local image_file=$1
|
||||
local target_partdev=$2
|
||||
local image_efisp_start=$3
|
||||
local image_efisp_size=$4
|
||||
|
||||
v "Updating ESP on ${target_partdev}"
|
||||
NEW_ESP_DIR="/mnt/new_esp_loop"
|
||||
CUR_ESP_DIR="/mnt/cur_esp"
|
||||
mkdir "${NEW_ESP_DIR}"
|
||||
mkdir "${CUR_ESP_DIR}"
|
||||
|
||||
get_image_dd "$image_file" of="/tmp/new_efi_sys_part.img" \
|
||||
skip="$image_efisp_start" count="$image_efisp_size"
|
||||
|
||||
mount -t vfat -o loop -o ro /tmp/new_efi_sys_part.img "${NEW_ESP_DIR}"
|
||||
if [ ! -d "${NEW_ESP_DIR}/efi/boot" ]; then
|
||||
v "ERROR: Image does not contain EFI boot files (/efi/boot)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mount -t vfat "/dev/$partdev" "${CUR_ESP_DIR}"
|
||||
|
||||
for d in $(find "${NEW_ESP_DIR}/efi/" -mindepth 1 -maxdepth 1 -type d); do
|
||||
v "Copying ${d}"
|
||||
newdir_bname=$(basename "${d}")
|
||||
rm -rf "${CUR_ESP_DIR}/efi/${newdir_bname}"
|
||||
cp -r "${d}" "${CUR_ESP_DIR}/efi"
|
||||
done
|
||||
|
||||
umount "${NEW_ESP_DIR}"
|
||||
umount "${CUR_ESP_DIR}"
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
local diskdev partdev diff
|
||||
|
||||
export_bootdevice && export_partdevice diskdev 0 || {
|
||||
v "platform_do_upgrade: Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
|
||||
sync
|
||||
|
||||
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
|
||||
get_partitions "/dev/$diskdev" bootdisk
|
||||
|
||||
v "Extract boot sector from the image"
|
||||
get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b
|
||||
|
||||
get_partitions /tmp/image.bs image
|
||||
|
||||
#compare tables
|
||||
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
|
||||
else
|
||||
diff=1
|
||||
fi
|
||||
|
||||
# Only change the partition table if sysupgrade -p is set,
|
||||
# otherwise doing so could interfere with embedded "single storage"
|
||||
# (e.g SoC boot from SD card) setups, as well as other user
|
||||
# created storage (like uvol)
|
||||
if [ -n "$diff" ] && [ "${UPGRADE_OPT_SAVE_PARTITIONS}" = "0" ]; then
|
||||
# Need to remove partitions before dd, otherwise the partitions
|
||||
# that are added after will have minor numbers offset
|
||||
partx -d - "/dev/$diskdev"
|
||||
|
||||
get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync
|
||||
|
||||
# Separate removal and addtion is necessary; otherwise, partition 1
|
||||
# will be missing if it overlaps with the old partition 2
|
||||
partx -a - "/dev/$diskdev"
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
#iterate over each partition from the image and write it to the boot disk
|
||||
while read part start size; do
|
||||
if export_partdevice partdev $part; then
|
||||
v "Writing image to /dev/$partdev..."
|
||||
if [ "$part" = "1" ]; then
|
||||
platform_do_upgrade_efi_system_partition \
|
||||
$1 $partdev $start $size || return 1
|
||||
else
|
||||
v "Normal partition, doing DD"
|
||||
get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" \
|
||||
count="$size" conv=fsync
|
||||
fi
|
||||
else
|
||||
v "Unable to find partition $part device, skipped."
|
||||
fi
|
||||
done < /tmp/partmap.image
|
||||
|
||||
local parttype=ext4
|
||||
|
||||
if (blkid > /dev/null) && export_partdevice partdev 1; then
|
||||
part_magic_fat "/dev/$partdev" && parttype=vfat
|
||||
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt
|
||||
if export_partdevice partdev 2; then
|
||||
THIS_PART_BLKID=$(blkid -o value -s PARTUUID "/dev/${partdev}")
|
||||
v "Setting rootfs PARTUUID=${THIS_PART_BLKID}"
|
||||
sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1${THIS_PART_BLKID}/ig" \
|
||||
/mnt/efi/openwrt/grub.cfg
|
||||
fi
|
||||
umount /mnt
|
||||
fi
|
||||
# Provide time for the storage medium to flush before system reset
|
||||
# (despite the sync/umount it appears NVMe etc. do it in the background)
|
||||
sleep 5
|
||||
}
|
@ -1,12 +1,67 @@
|
||||
CONFIG_64BIT=y
|
||||
CONFIG_9P_FS=y
|
||||
# CONFIG_9P_FS_POSIX_ACL is not set
|
||||
# CONFIG_9P_FS_SECURITY is not set
|
||||
# CONFIG_A64FX_DIAG is not set
|
||||
CONFIG_ACPI=y
|
||||
CONFIG_ACPI_AC=y
|
||||
CONFIG_ACPI_APEI=y
|
||||
CONFIG_ACPI_APEI_EINJ=y
|
||||
# CONFIG_ACPI_APEI_ERST_DEBUG is not set
|
||||
CONFIG_ACPI_APEI_GHES=y
|
||||
CONFIG_ACPI_APEI_MEMORY_FAILURE=y
|
||||
CONFIG_ACPI_APEI_PCIEAER=y
|
||||
CONFIG_ACPI_BATTERY=y
|
||||
# CONFIG_ACPI_BGRT is not set
|
||||
CONFIG_ACPI_CCA_REQUIRED=y
|
||||
CONFIG_ACPI_CONTAINER=y
|
||||
CONFIG_ACPI_CPPC_CPUFREQ=y
|
||||
# CONFIG_ACPI_DEBUG is not set
|
||||
# CONFIG_ACPI_DEBUGGER is not set
|
||||
# CONFIG_ACPI_DOCK is not set
|
||||
# CONFIG_ACPI_EC_DEBUGFS is not set
|
||||
CONFIG_ACPI_FAN=y
|
||||
CONFIG_ACPI_GENERIC_GSI=y
|
||||
CONFIG_ACPI_GTDT=y
|
||||
CONFIG_ACPI_HOTPLUG_CPU=y
|
||||
CONFIG_ACPI_I2C_OPREGION=y
|
||||
CONFIG_ACPI_IORT=y
|
||||
CONFIG_ACPI_MCFG=y
|
||||
# CONFIG_ACPI_PCI_SLOT is not set
|
||||
# CONFIG_ACPI_PFRUT is not set
|
||||
CONFIG_ACPI_PPTT=y
|
||||
CONFIG_ACPI_PRMT=y
|
||||
CONFIG_ACPI_PROCESSOR=y
|
||||
CONFIG_ACPI_PROCESSOR_IDLE=y
|
||||
CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y
|
||||
CONFIG_ACPI_SPCR_TABLE=y
|
||||
CONFIG_ACPI_THERMAL=y
|
||||
# CONFIG_ACPI_TINY_POWER_BUTTON is not set
|
||||
# CONFIG_ALIBABA_UNCORE_DRW_PMU is not set
|
||||
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
|
||||
CONFIG_ARCH_FORCE_MAX_ORDER=11
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_KEEP_MEMBLOCK=y
|
||||
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
|
||||
CONFIG_ARCH_MMAP_RND_BITS=18
|
||||
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
|
||||
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
|
||||
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
|
||||
CONFIG_ARCH_PROC_KCORE_TEXT=y
|
||||
CONFIG_ARCH_SPARSEMEM_ENABLE=y
|
||||
CONFIG_ARCH_STACKWALK=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANTS_NO_INSTR=y
|
||||
CONFIG_ARM64=y
|
||||
CONFIG_ARM64_4K_PAGES=y
|
||||
# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set
|
||||
CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y
|
||||
CONFIG_ARM64_PAGE_SHIFT=12
|
||||
CONFIG_ARM64_PA_BITS=48
|
||||
CONFIG_ARM64_PA_BITS_48=y
|
||||
CONFIG_ARM64_TAGGED_ADDR_ABI=y
|
||||
CONFIG_ARM64_VA_BITS=39
|
||||
CONFIG_ARM64_VA_BITS_39=y
|
||||
CONFIG_ARM_AMBA=y
|
||||
CONFIG_ARM_ARCH_TIMER=y
|
||||
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
|
||||
@ -16,40 +71,86 @@ CONFIG_ARM_GIC_V3=y
|
||||
CONFIG_ARM_GIC_V3_ITS=y
|
||||
CONFIG_ARM_GIC_V3_ITS_PCI=y
|
||||
CONFIG_ARM_PSCI_FW=y
|
||||
# CONFIG_ARM_SMMU_V3_PMU is not set
|
||||
CONFIG_ATA=y
|
||||
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
|
||||
CONFIG_BALLOON_COMPACTION=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_BLK_DEV_NVME=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BLK_MQ_VIRTIO=y
|
||||
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_COMMON_CLK=y
|
||||
# CONFIG_COMPAT_32BIT_TIME is not set
|
||||
CONFIG_CONSOLE_TRANSLATIONS=y
|
||||
CONFIG_CPU_IDLE=y
|
||||
CONFIG_CPU_IDLE_GOV_LADDER=y
|
||||
CONFIG_CPU_PM=y
|
||||
CONFIG_CPU_RMAP=y
|
||||
CONFIG_CRC16=y
|
||||
CONFIG_CRYPTO_CRC32=y
|
||||
CONFIG_CRYPTO_CRC32C=y
|
||||
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
|
||||
CONFIG_CRYPTO_RNG2=y
|
||||
CONFIG_DCACHE_WORD_ACCESS=y
|
||||
CONFIG_DEBUG_BUGVERBOSE=y
|
||||
CONFIG_DMADEVICES=y
|
||||
CONFIG_DMA_ACPI=y
|
||||
CONFIG_DMA_DIRECT_REMAP=y
|
||||
CONFIG_DMA_ENGINE=y
|
||||
CONFIG_DMA_OF=y
|
||||
CONFIG_DMA_REMAP=y
|
||||
CONFIG_DMI=y
|
||||
CONFIG_DMIID=y
|
||||
CONFIG_DMI_SYSFS=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EDAC_SUPPORT=y
|
||||
CONFIG_EFI=y
|
||||
CONFIG_EFIVAR_FS=y
|
||||
CONFIG_EFI_ARMSTUB_DTB_LOADER=y
|
||||
# CONFIG_EFI_BOOTLOADER_CONTROL is not set
|
||||
# CONFIG_EFI_CAPSULE_LOADER is not set
|
||||
# CONFIG_EFI_COCO_SECRET is not set
|
||||
# CONFIG_EFI_CUSTOM_SSDT_OVERLAYS is not set
|
||||
# CONFIG_EFI_DISABLE_PCI_DMA is not set
|
||||
# CONFIG_EFI_DISABLE_RUNTIME is not set
|
||||
CONFIG_EFI_EARLYCON=y
|
||||
CONFIG_EFI_ESRT=y
|
||||
CONFIG_EFI_GENERIC_STUB=y
|
||||
# CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER is not set
|
||||
CONFIG_EFI_PARAMS_FROM_FDT=y
|
||||
CONFIG_EFI_RUNTIME_WRAPPERS=y
|
||||
CONFIG_EFI_STUB=y
|
||||
# CONFIG_EFI_TEST is not set
|
||||
# CONFIG_EFI_ZBOOT is not set
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_F2FS_FS=y
|
||||
CONFIG_FAILOVER=y
|
||||
CONFIG_FB_EFI=y
|
||||
CONFIG_FIX_EARLYCON_MEM=y
|
||||
CONFIG_FONT_8x16=y
|
||||
CONFIG_FONT_AUTOSELECT=y
|
||||
CONFIG_FONT_SUPPORT=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_GENERIC_ALLOCATOR=y
|
||||
CONFIG_GENERIC_ARCH_TOPOLOGY=y
|
||||
CONFIG_GENERIC_BUG=y
|
||||
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
|
||||
CONFIG_GENERIC_CPU_AUTOPROBE=y
|
||||
CONFIG_GENERIC_CPU_VULNERABILITIES=y
|
||||
CONFIG_GENERIC_CSUM=y
|
||||
CONFIG_GENERIC_EARLY_IOREMAP=y
|
||||
CONFIG_GENERIC_FIND_FIRST_BIT=y
|
||||
CONFIG_GENERIC_GETTIMEOFDAY=y
|
||||
CONFIG_GENERIC_IDLE_POLL_SETUP=y
|
||||
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
|
||||
@ -66,21 +167,35 @@ CONFIG_GENERIC_STRNCPY_FROM_USER=y
|
||||
CONFIG_GENERIC_STRNLEN_USER=y
|
||||
CONFIG_GENERIC_TIME_VSYSCALL=y
|
||||
CONFIG_GPIOLIB_IRQCHIP=y
|
||||
CONFIG_GPIO_ACPI=y
|
||||
CONFIG_GPIO_CDEV=y
|
||||
# CONFIG_GPIO_HISI is not set
|
||||
CONFIG_GPIO_PL061=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_HID=y
|
||||
CONFIG_HID_GENERIC=y
|
||||
CONFIG_HOTPLUG_CPU=y
|
||||
CONFIG_HOTPLUG_PCI_ACPI=y
|
||||
CONFIG_HVC_DRIVER=y
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
# CONFIG_I2C_AMD_MP2 is not set
|
||||
CONFIG_I2C_HID_ACPI=y
|
||||
# CONFIG_I2C_HISI is not set
|
||||
# CONFIG_I2C_SLAVE_TESTUNIT is not set
|
||||
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
|
||||
# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_INPUT_KEYBOARD=y
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_DOMAIN_HIERARCHY=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
# CONFIG_ISCSI_IBFT is not set
|
||||
CONFIG_JBD2=y
|
||||
CONFIG_LIBFDT=y
|
||||
CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
||||
@ -88,8 +203,13 @@ CONFIG_LOCK_SPIN_ON_OWNER=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
CONFIG_MEMORY_BALLOON=y
|
||||
CONFIG_MIGRATION=y
|
||||
# CONFIG_MLXBF_GIGE is not set
|
||||
CONFIG_MMC_SDHCI_ACPI=y
|
||||
CONFIG_MODULES_USE_ELF_RELA=y
|
||||
CONFIG_MUTEX_SPIN_ON_OWNER=y
|
||||
CONFIG_MVMDIO=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_SG_DMA_LENGTH=y
|
||||
CONFIG_NET_9P=y
|
||||
# CONFIG_NET_9P_DEBUG is not set
|
||||
# CONFIG_NET_9P_FD is not set
|
||||
@ -97,7 +217,10 @@ CONFIG_NET_9P_VIRTIO=y
|
||||
CONFIG_NET_FAILOVER=y
|
||||
CONFIG_NET_FLOW_LIMIT=y
|
||||
CONFIG_NLS=y
|
||||
CONFIG_NR_CPUS=256
|
||||
CONFIG_NVMEM=y
|
||||
CONFIG_NVME_CORE=y
|
||||
# CONFIG_NVME_MULTIPATH is not set
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
@ -109,41 +232,91 @@ CONFIG_PADATA=y
|
||||
CONFIG_PAGE_REPORTING=y
|
||||
CONFIG_PARTITION_PERCPU=y
|
||||
CONFIG_PCI=y
|
||||
# CONFIG_PCIE_HISI_ERR is not set
|
||||
CONFIG_PCI_DOMAINS=y
|
||||
CONFIG_PCI_DOMAINS_GENERIC=y
|
||||
CONFIG_PCI_ECAM=y
|
||||
CONFIG_PCI_HOST_COMMON=y
|
||||
CONFIG_PCI_HOST_GENERIC=y
|
||||
CONFIG_PCI_LABEL=y
|
||||
CONFIG_PCI_MSI=y
|
||||
CONFIG_PCI_MSI_IRQ_DOMAIN=y
|
||||
CONFIG_PGTABLE_LEVELS=3
|
||||
CONFIG_PHYS_ADDR_T_64BIT=y
|
||||
# CONFIG_PMIC_OPREGION is not set
|
||||
CONFIG_PNP=y
|
||||
CONFIG_PNPACPI=y
|
||||
CONFIG_PNP_DEBUG_MESSAGES=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
|
||||
CONFIG_QUEUED_RWLOCKS=y
|
||||
CONFIG_QUEUED_SPINLOCKS=y
|
||||
CONFIG_RATIONAL=y
|
||||
# CONFIG_RESET_ATTACK_MITIGATION is not set
|
||||
CONFIG_RFS_ACCEL=y
|
||||
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
|
||||
CONFIG_RPS=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
CONFIG_RTC_DRV_EFI=y
|
||||
CONFIG_RTC_DRV_PL031=y
|
||||
CONFIG_RWSEM_SPIN_ON_OWNER=y
|
||||
CONFIG_SATA_AHCI=y
|
||||
CONFIG_SATA_AHCI_PLATFORM=y
|
||||
CONFIG_SATA_HOST=y
|
||||
CONFIG_SCSI=y
|
||||
CONFIG_SCSI_COMMON=y
|
||||
CONFIG_SCSI_VIRTIO=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
|
||||
CONFIG_SERIAL_8250_EXTENDED=y
|
||||
CONFIG_SERIAL_8250_FSL=y
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_PNP=y
|
||||
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
|
||||
CONFIG_SERIAL_8250_SHARE_IRQ=y
|
||||
CONFIG_SERIAL_AMBA_PL011=y
|
||||
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
|
||||
CONFIG_SERIAL_EARLYCON=y
|
||||
CONFIG_SERIAL_MCTRL_GPIO=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
CONFIG_SG_POOL=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_SOCK_RX_QUEUE_MAPPING=y
|
||||
CONFIG_SPARSEMEM=y
|
||||
CONFIG_SPARSEMEM_EXTREME=y
|
||||
CONFIG_SPARSEMEM_VMEMMAP=y
|
||||
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
|
||||
CONFIG_SPARSE_IRQ=y
|
||||
CONFIG_SRCU=y
|
||||
# CONFIG_SURFACE_PLATFORMS is not set
|
||||
CONFIG_SWIOTLB=y
|
||||
CONFIG_SYSCTL_EXCEPTION_TRACE=y
|
||||
CONFIG_SYSFB=y
|
||||
# CONFIG_SYSFB_SIMPLEFB is not set
|
||||
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_OF=y
|
||||
CONFIG_THREAD_INFO_IN_TASK=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_TIMER_ACPI=y
|
||||
CONFIG_TIMER_OF=y
|
||||
CONFIG_TIMER_PROBE=y
|
||||
CONFIG_TREE_RCU=y
|
||||
CONFIG_TREE_SRCU=y
|
||||
# CONFIG_UACCE is not set
|
||||
CONFIG_UCS2_STRING=y
|
||||
CONFIG_UNMAP_KERNEL_AT_EL0=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_HID=y
|
||||
CONFIG_USB_HIDDEV=y
|
||||
CONFIG_USB_PCI=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_PCI=y
|
||||
CONFIG_VIRTIO=y
|
||||
CONFIG_VIRTIO_BALLOON=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
@ -154,4 +327,10 @@ CONFIG_VIRTIO_NET=y
|
||||
CONFIG_VIRTIO_PCI=y
|
||||
CONFIG_VIRTIO_PCI_LEGACY=y
|
||||
CONFIG_VIRTIO_PCI_LIB=y
|
||||
CONFIG_VMAP_STACK=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_VT=y
|
||||
CONFIG_VT_CONSOLE=y
|
||||
# CONFIG_VT_HW_CONSOLE_BINDING is not set
|
||||
CONFIG_XPS=y
|
||||
CONFIG_ZONE_DMA32=y
|
||||
|
@ -5,28 +5,113 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
define Image/BuildKernel
|
||||
$(foreach k,$(filter zImage Image,$(KERNELNAME)), \
|
||||
cp $(KDIR)/$(KERNELNAME) $(BIN_DIR)/$(IMG_PREFIX)-$(k) \
|
||||
GRUB2_VARIANT =
|
||||
GRUB_TERMINALS =
|
||||
GRUB_SERIAL_CONFIG =
|
||||
GRUB_TERMINAL_CONFIG =
|
||||
GRUB_CONSOLE_CMDLINE = earlycon
|
||||
|
||||
ifneq ($(CONFIG_GRUB_CONSOLE),)
|
||||
GRUB_TERMINALS += console
|
||||
endif
|
||||
|
||||
GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL))
|
||||
|
||||
ifneq ($(GRUB_SERIAL),)
|
||||
GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1 --rtscts=$(if $(CONFIG_GRUB_FLOWCONTROL),on,off)
|
||||
GRUB_TERMINALS += serial
|
||||
endif
|
||||
|
||||
ifneq ($(GRUB_TERMINALS),)
|
||||
GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
|
||||
endif
|
||||
|
||||
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
|
||||
ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02)
|
||||
GPT_ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
|
||||
GPT_ROOTPART:=$(if $(GPT_ROOTPART),$(GPT_ROOTPART),PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/02/'))
|
||||
|
||||
GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT))
|
||||
GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE))
|
||||
|
||||
BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS))
|
||||
|
||||
define Build/combined
|
||||
$(INSTALL_DIR) $@.boot/
|
||||
$(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/efi/openwrt/
|
||||
-$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/
|
||||
$(if $(filter $(1),efi),
|
||||
$(INSTALL_DIR) $@.boot/efi/boot
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/openwrt/
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/boot/
|
||||
)
|
||||
KERNELPARTTYPE=ef FAT_TYPE="32" PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \
|
||||
$(if $(filter $(1),efi),GUID="$(IMG_PART_DISKGUID)") $(SCRIPT_DIR)/gen_image_generic.sh \
|
||||
$@ \
|
||||
$(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
|
||||
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
|
||||
256
|
||||
endef
|
||||
|
||||
define Image/Build/Initramfs
|
||||
$(foreach k,$(filter zImage Image,$(KERNELNAME)), \
|
||||
cp $(KDIR)/$(k)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(k)-initramfs \
|
||||
)
|
||||
define Build/grub-config
|
||||
rm -fR $@.boot
|
||||
$(INSTALL_DIR) $@.boot/efi/openwrt/
|
||||
sed \
|
||||
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
|
||||
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
|
||||
-e 's#@ROOTPART@#root=$(ROOTPART) rootwait#g' \
|
||||
-e 's#@GPT_ROOTPART@#root=$(GPT_ROOTPART) rootwait#g' \
|
||||
-e 's#@CMDLINE@#$(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE)#g' \
|
||||
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
|
||||
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
|
||||
-e 's#@KERNEL_NAME@#$(KERNEL_NAME)#g' \
|
||||
./grub-$(1).cfg > $@.boot/efi/openwrt/grub.cfg
|
||||
endef
|
||||
|
||||
define Image/Build/gzip
|
||||
gzip -f9n $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img
|
||||
define Build/grub-install
|
||||
rm -fR $@.grub2
|
||||
$(INSTALL_DIR) $@.grub2
|
||||
endef
|
||||
|
||||
$(eval $(call Image/gzip-ext4-padded-squashfs))
|
||||
|
||||
define Image/Build
|
||||
$(call Image/Build/$(1))
|
||||
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img
|
||||
$(call Image/Build/gzip/$(1))
|
||||
DEVICE_VARS += GRUB2_VARIANT
|
||||
define Device/efi-default
|
||||
IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE)
|
||||
IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip
|
||||
IMAGE/combined.img := grub-config efi | combined efi | grub-install efi | append-metadata
|
||||
IMAGE/combined.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata
|
||||
IMAGE/combined.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk
|
||||
ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y)
|
||||
IMAGES-y := rootfs.img.gz
|
||||
IMAGES-y += combined.img.gz
|
||||
else
|
||||
IMAGES-y := rootfs.img
|
||||
IMAGES-y += combined.img
|
||||
endif
|
||||
ifeq ($(CONFIG_VMDK_IMAGES),y)
|
||||
IMAGES-y += combined.vmdk
|
||||
endif
|
||||
KERNEL := kernel-bin
|
||||
KERNEL_INSTALL := 1
|
||||
IMAGES := $$(IMAGES-y)
|
||||
ARTIFACTS := $$(ARTIFACTS-y)
|
||||
SUPPORTED_DEVICES :=
|
||||
ifeq ($(CONFIG_arm),y)
|
||||
KERNEL_NAME = zImage
|
||||
endif
|
||||
endef
|
||||
|
||||
define Device/generic
|
||||
$(call Device/efi-default)
|
||||
DEVICE_TITLE := Generic EFI Boot
|
||||
GRUB2_VARIANT := generic
|
||||
FILESYSTEMS := ext4 squashfs
|
||||
DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \
|
||||
kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \
|
||||
kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \
|
||||
kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \
|
||||
kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \
|
||||
kmod-phy-marvell kmod-phy-marvell-10g kmod-sfp kmod-atlantic
|
||||
endef
|
||||
TARGET_DEVICES += generic
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
14
target/linux/armvirt/image/grub-efi.cfg
Normal file
14
target/linux/armvirt/image/grub-efi.cfg
Normal file
@ -0,0 +1,14 @@
|
||||
@SERIAL_CONFIG@
|
||||
@TERMINAL_CONFIG@
|
||||
|
||||
set default="0"
|
||||
set timeout="@TIMEOUT@"
|
||||
|
||||
menuentry "@TITLE@" {
|
||||
search --set=root --label kernel
|
||||
linux /efi/openwrt/@KERNEL_NAME@ @GPT_ROOTPART@ @CMDLINE@ noinitrd
|
||||
}
|
||||
menuentry "@TITLE@ (failsafe)" {
|
||||
search --set=root --label kernel
|
||||
linux /efi/openwrt/@KERNEL_NAME@ failsafe=true @GPT_ROOTPART@ @CMDLINE@ noinitrd
|
||||
}
|
292
target/linux/armvirt/modules.mk
Normal file
292
target/linux/armvirt/modules.mk
Normal file
@ -0,0 +1,292 @@
|
||||
define KernelPackage/acpi-mdio
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=ACPI MDIO support
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-mdio-devres
|
||||
KCONFIG:=CONFIG_ACPI_MDIO
|
||||
FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko
|
||||
AUTOLOAD:=$(call AutoLoad,11,acpi_mdio)
|
||||
endef
|
||||
|
||||
define KernelPackage/acpi-mdio/description
|
||||
Kernel driver for ACPI MDIO support
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,acpi-mdio))
|
||||
|
||||
define KernelPackage/fsl-pcs-lynx
|
||||
SUBMENU=$(NETWORK_DEVICES_MENU)
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-phylink
|
||||
TITLE:=NXP (Freescale) Lynx PCS
|
||||
HIDDEN:=1
|
||||
KCONFIG:=CONFIG_PCS_LYNX
|
||||
FILES=$(LINUX_DIR)/drivers/net/pcs/pcs-lynx.ko
|
||||
AUTOLOAD=$(call AutoLoad,30,pcs-lynx)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-pcs-lynx))
|
||||
|
||||
define KernelPackage/pcs-xpcs
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Synopsis DesignWare PCS driver
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink
|
||||
KCONFIG:=CONFIG_PCS_XPCS
|
||||
FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko
|
||||
AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,pcs-xpcs))
|
||||
|
||||
define KernelPackage/fsl-fec
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio \
|
||||
+kmod-ptp +kmod-net-selftests
|
||||
TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX)
|
||||
KCONFIG:=CONFIG_FEC
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fec.ko
|
||||
AUTOLOAD:=$(call AutoLoad,35,fec)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-fec))
|
||||
|
||||
define KernelPackage/fsl-xgmac-mdio
|
||||
SUBMENU=$(NETWORK_DEVICES_MENU)
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
|
||||
TITLE:=NXP (Freescale) MDIO bus
|
||||
KCONFIG:=CONFIG_FSL_XGMAC_MDIO
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko
|
||||
AUTOLOAD=$(call AutoLoad,30,xgmac_mdio)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-xgmac-mdio))
|
||||
|
||||
define KernelPackage/fsl-mc-dpio
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=NXP DPAA2 DPIO (Data Path IO) driver
|
||||
HIDDEN:=1
|
||||
KCONFIG:=CONFIG_FSL_MC_BUS=y \
|
||||
CONFIG_FSL_MC_DPIO
|
||||
FILES:=$(LINUX_DIR)/drivers/soc/fsl/dpio/fsl-mc-dpio.ko
|
||||
AUTOLOAD=$(call AutoLoad,30,fsl-mc-dpio)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-mc-dpio))
|
||||
|
||||
define KernelPackage/fsl-enetc-net
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=:NXP ENETC (LS1028A) Ethernet
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-fsl-pcs-lynx
|
||||
KCONFIG:= \
|
||||
CONFIG_FSL_ENETC \
|
||||
CONFIG_FSL_ENETC_VF \
|
||||
CONFIG_FSL_ENETC_QOS
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-mdio.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-ierb.ko
|
||||
AUTOLOAD=$(call AutoLoad,35,fsl-enetc)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-enetc-net))
|
||||
|
||||
define KernelPackage/fsl-dpaa1-net
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=NXP DPAA1 (LS1043/LS1046) Ethernet
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32
|
||||
KCONFIG:= \
|
||||
CONFIG_FSL_DPAA=y \
|
||||
CONFIG_FSL_DPAA_ETH \
|
||||
CONFIG_FSL_FMAN \
|
||||
CONFIG_FSL_DPAA_CHECKING=n \
|
||||
CONFIG_FSL_BMAN_TEST=n \
|
||||
CONFIG_FSL_QMAN_TEST=n
|
||||
MODULES:= \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa/fsl_dpa.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_fman.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_mac.ko
|
||||
AUTOLOAD=$(call AutoLoad,35,fsl-dpa)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-dpaa1-net))
|
||||
|
||||
define KernelPackage/fsl-dpaa2-net
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=NXP DPAA2 Ethernet
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-phylink \
|
||||
+kmod-fsl-pcs-lynx +kmod-fsl-mc-dpio
|
||||
KCONFIG:= \
|
||||
CONFIG_FSL_MC_UAPI_SUPPORT=y \
|
||||
CONFIG_FSL_DPAA2_ETH
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.ko
|
||||
AUTOLOAD=$(call AutoLoad,35,fsl-dpaa2-eth)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-dpaa2-net))
|
||||
|
||||
define KernelPackage/fsl-dpaa2-console
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=NXP DPAA2 Debug console
|
||||
DEPENDS:=@(TARGET_armvirt_64)
|
||||
KCONFIG:=CONFIG_DPAA2_CONSOLE
|
||||
FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko
|
||||
AUTOLOAD=$(call AutoLoad,40,dpaa2-console)
|
||||
endef
|
||||
|
||||
define KernelPackage/fsl-dpaa2-console/description
|
||||
Kernel modules for the NXP DPAA2 debug consoles
|
||||
(Management Complex and AIOP).
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fsl-dpaa2-console))
|
||||
|
||||
define KernelPackage/marvell-mdio
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Marvell Armada platform MDIO driver
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
|
||||
KCONFIG:=CONFIG_MVMDIO
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko
|
||||
AUTOLOAD=$(call AutoLoad,30,marvell-mdio)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,marvell-mdio))
|
||||
|
||||
define KernelPackage/phy-marvell-10g
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Marvell Alaska 10G PHY driver
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy
|
||||
KCONFIG:=CONFIG_MARVELL_10G_PHY
|
||||
FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko
|
||||
AUTOLOAD=$(call AutoLoad,35,marvell10g)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,phy-marvell-10g))
|
||||
|
||||
define KernelPackage/mvneta
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Marvell Armada 370/38x/XP/37xx network driver
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink
|
||||
KCONFIG:=CONFIG_MVNETA
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko
|
||||
AUTOLOAD=$(call AutoLoad,30,mvneta)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mvneta))
|
||||
|
||||
define KernelPackage/mvpp2
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Marvell Armada 375/7K/8K network driver
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink
|
||||
KCONFIG:=CONFIG_MVPP2 \
|
||||
CONFIG_MVPP2_PTP=n
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko
|
||||
AUTOLOAD=$(call AutoLoad,40,mvpp2)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mvpp2))
|
||||
|
||||
define KernelPackage/imx2-wdt
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=NXP (Freescale) i.MX2+ and Layerscape watchdog driver
|
||||
KCONFIG:=CONFIG_IMX2_WDT
|
||||
FILES=$(LINUX_DIR)/drivers/watchdog/imx2_wdt.ko
|
||||
AUTOLOAD=$(call AutoLoad,60,imx2_wdt)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,imx2-wdt))
|
||||
|
||||
define KernelPackage/imx7-ulp-wdt
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=NXP (Freescale) i.MX7ULP and later watchdog
|
||||
KCONFIG:=CONFIG_IMX7ULP_WDT
|
||||
FILES=$(LINUX_DIR)/drivers/watchdog/imx7ulp_wdt.ko
|
||||
AUTOLOAD=$(call AutoLoad,60,imx7ulp_wdt)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,imx7-ulp-wdt))
|
||||
|
||||
define KernelPackage/stmmac-core
|
||||
SUBMENU=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others)
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-pcs-xpcs +kmod-ptp \
|
||||
+kmod-of-mdio
|
||||
KCONFIG:=CONFIG_STMMAC_ETH \
|
||||
CONFIG_STMMAC_SELFTESTS=n \
|
||||
CONFIG_STMMAC_PLATFORM \
|
||||
CONFIG_CONFIG_DWMAC_DWC_QOS_ETH=n \
|
||||
CONFIG_DWMAC_GENERIC
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac-platform.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.ko
|
||||
AUTOLOAD=$(call AutoLoad,40,stmmac stmmac-platform dwmac-generic)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,stmmac-core))
|
||||
|
||||
define KernelPackage/dwmac-imx
|
||||
SUBMENU=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=NXP i.MX8 Ethernet controller
|
||||
DEPENDS:=+kmod-stmmac-core
|
||||
KCONFIG:=CONFIG_DWMAC_IMX8
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.ko
|
||||
AUTOLOAD=$(call AutoLoad,45,dwmac-imx)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,dwmac-imx))
|
||||
|
||||
define KernelPackage/dwmac-sun8i
|
||||
SUBMENU=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Allwinner H3/A83T/A64 (sun8i) Ethernet
|
||||
DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux
|
||||
KCONFIG:=CONFIG_DWMAC_SUN8I
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.ko
|
||||
AUTOLOAD=$(call AutoLoad,45,dwmac-sun8i)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,dwmac-sun8i))
|
||||
|
||||
define KernelPackage/dwmac-rockchip
|
||||
SUBMENU=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Rockchip RK3328/RK3399/RK3568 Ethernet
|
||||
DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux
|
||||
KCONFIG:=CONFIG_DWMAC_ROCKCHIP
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.ko
|
||||
AUTOLOAD=$(call AutoLoad,45,dwmac-rk)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,dwmac-rockchip))
|
||||
|
||||
define KernelPackage/thunderx-net
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Marvell (Cavium) ThunderX/2 network drivers
|
||||
DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-of-mdio
|
||||
KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \
|
||||
CONFIG_THUNDER_NIC_PF \
|
||||
CONFIG_THUNDER_NIC_VF \
|
||||
CONFIG_THUNDER_NIC_BGX \
|
||||
CONFIG_THUNDER_NIC_RGX
|
||||
FILES=$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicvf.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicpf.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_xcv.ko \
|
||||
$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_bgx.ko
|
||||
AUTOLOAD=$(call AutoLoad,40,nicpf nicvf thunder_xcv thunder_bgx)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,thunderx-net))
|
||||
|
||||
define KernelPackage/wdt-sp805
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=ARM SP805 Watchdog
|
||||
KCONFIG:=CONFIG_ARM_SP805_WATCHDOG
|
||||
FILES=$(LINUX_DIR)/drivers/watchdog/sp805_wdt.ko
|
||||
AUTOLOAD=$(call AutoLoad,50,sp805_wdt)
|
||||
endef
|
||||
|
||||
define KernelPackage/wdt-sp805/description
|
||||
Support for the ARM SP805 wathchdog module.
|
||||
This is present in the NXP Layerscape family,
|
||||
HiSilicon HI3660 among others.
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,wdt-sp805))
|
||||
|
@ -0,0 +1,23 @@
|
||||
From b77c0ecdc7915e5c5c515da1aa6cfaf6f4eb8351 Mon Sep 17 00:00:00 2001
|
||||
From: Mathew McBride <matt@traverse.com.au>
|
||||
Date: Wed, 28 Sep 2022 16:39:31 +1000
|
||||
Subject: [PATCH] arm: disable code size reduction measures
|
||||
(gc-sections,-f*-sections)
|
||||
|
||||
This interferes with the EFI boot stub on armv7l.
|
||||
|
||||
Signed-off-by: Mathew McBride <matt@traverse.com.au>
|
||||
---
|
||||
arch/arm/Kconfig | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -122,7 +122,6 @@ config ARM
|
||||
select HAVE_UID16
|
||||
select HAVE_VIRT_CPU_ACCOUNTING_GEN
|
||||
select IRQ_FORCED_THREADING
|
||||
- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
|
||||
select MODULES_USE_ELF_REL
|
||||
select NEED_DMA_MAP_STATE
|
||||
select OF_EARLY_FLATTREE if OF
|
@ -0,0 +1,44 @@
|
||||
From f3763a0c1b07273218cbf5886bdf8df9df501111 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:10 +0200
|
||||
Subject: [PATCH 03/14] net: dpaa2-eth: don't use -ENOTSUPP error code
|
||||
|
||||
dpaa2_eth_setup_dpni() is called from the probe path and
|
||||
dpaa2_eth_set_link_ksettings() is propagated to user space.
|
||||
|
||||
include/linux/errno.h says that ENOTSUPP is "Defined for the NFSv3
|
||||
protocol". Conventional wisdom has it to not use it in networking
|
||||
drivers. Replace it with -EOPNOTSUPP.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +-
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -3613,7 +3613,7 @@ static int dpaa2_eth_setup_dpni(struct f
|
||||
dev_err(dev, "DPNI version %u.%u not supported, need >= %u.%u\n",
|
||||
priv->dpni_ver_major, priv->dpni_ver_minor,
|
||||
DPNI_VER_MAJOR, DPNI_VER_MINOR);
|
||||
- err = -ENOTSUPP;
|
||||
+ err = -EOPNOTSUPP;
|
||||
goto close;
|
||||
}
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
|
||||
@@ -118,7 +118,7 @@ dpaa2_eth_set_link_ksettings(struct net_
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
|
||||
if (!dpaa2_eth_is_type_phy(priv))
|
||||
- return -ENOTSUPP;
|
||||
+ return -EOPNOTSUPP;
|
||||
|
||||
return phylink_ethtool_ksettings_set(priv->mac->phylink, link_settings);
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
From 022a11062261dc4703da846d3bf4d194ef6bebf5 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:11 +0200
|
||||
Subject: [PATCH 04/14] net: dpaa2: replace dpaa2_mac_is_type_fixed() with
|
||||
dpaa2_mac_is_type_phy()
|
||||
|
||||
dpaa2_mac_is_type_fixed() is a header with no implementation and no
|
||||
callers, which is referenced from the documentation though. It can be
|
||||
deleted.
|
||||
|
||||
On the other hand, it would be useful to reuse the code between
|
||||
dpaa2_eth_is_type_phy() and dpaa2_switch_port_is_type_phy(). That common
|
||||
code should be called dpaa2_mac_is_type_phy(), so let's create that.
|
||||
|
||||
The removal and the addition are merged into the same patch because,
|
||||
in fact, is_type_phy() is the logical opposite of is_type_fixed().
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
.../ethernet/freescale/dpaa2/mac-phy-support.rst | 9 ++++++---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 7 +------
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h | 10 ++++++++--
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h | 7 +------
|
||||
4 files changed, 16 insertions(+), 17 deletions(-)
|
||||
|
||||
--- a/Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst
|
||||
+++ b/Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst
|
||||
@@ -181,10 +181,13 @@ when necessary using the below listed AP
|
||||
- int dpaa2_mac_connect(struct dpaa2_mac *mac);
|
||||
- void dpaa2_mac_disconnect(struct dpaa2_mac *mac);
|
||||
|
||||
-A phylink integration is necessary only when the partner DPMAC is not of TYPE_FIXED.
|
||||
-One can check for this condition using the below API::
|
||||
+A phylink integration is necessary only when the partner DPMAC is not of
|
||||
+``TYPE_FIXED``. This means it is either of ``TYPE_PHY``, or of
|
||||
+``TYPE_BACKPLANE`` (the difference being the two that in the ``TYPE_BACKPLANE``
|
||||
+mode, the MC firmware does not access the PCS registers). One can check for
|
||||
+this condition using the following helper::
|
||||
|
||||
- - bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev,struct fsl_mc_io *mc_io);
|
||||
+ - static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac);
|
||||
|
||||
Before connection to a MAC, the caller must allocate and populate the
|
||||
dpaa2_mac structure with the associated net_device, a pointer to the MC portal
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
|
||||
@@ -733,12 +733,7 @@ static inline unsigned int dpaa2_eth_rx_
|
||||
|
||||
static inline bool dpaa2_eth_is_type_phy(struct dpaa2_eth_priv *priv)
|
||||
{
|
||||
- if (priv->mac &&
|
||||
- (priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY ||
|
||||
- priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE))
|
||||
- return true;
|
||||
-
|
||||
- return false;
|
||||
+ return dpaa2_mac_is_type_phy(priv->mac);
|
||||
}
|
||||
|
||||
static inline bool dpaa2_eth_has_mac(struct dpaa2_eth_priv *priv)
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h
|
||||
@@ -30,8 +30,14 @@ struct dpaa2_mac {
|
||||
struct phy *serdes_phy;
|
||||
};
|
||||
|
||||
-bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev,
|
||||
- struct fsl_mc_io *mc_io);
|
||||
+static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac)
|
||||
+{
|
||||
+ if (!mac)
|
||||
+ return false;
|
||||
+
|
||||
+ return mac->attr.link_type == DPMAC_LINK_TYPE_PHY ||
|
||||
+ mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE;
|
||||
+}
|
||||
|
||||
int dpaa2_mac_open(struct dpaa2_mac *mac);
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
|
||||
@@ -230,12 +230,7 @@ static inline bool dpaa2_switch_supports
|
||||
static inline bool
|
||||
dpaa2_switch_port_is_type_phy(struct ethsw_port_priv *port_priv)
|
||||
{
|
||||
- if (port_priv->mac &&
|
||||
- (port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY ||
|
||||
- port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE))
|
||||
- return true;
|
||||
-
|
||||
- return false;
|
||||
+ return dpaa2_mac_is_type_phy(port_priv->mac);
|
||||
}
|
||||
|
||||
static inline bool dpaa2_switch_port_has_mac(struct ethsw_port_priv *port_priv)
|
@ -0,0 +1,88 @@
|
||||
From 97c07369ab8bf9895e05d4b468f18e6567263154 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:12 +0200
|
||||
Subject: [PATCH 05/14] net: dpaa2-mac: absorb phylink_start() call into
|
||||
dpaa2_mac_start()
|
||||
|
||||
The phylink handling is intended to be hidden inside the dpaa2_mac
|
||||
object. Move the phylink_start() call into dpaa2_mac_start(), and
|
||||
phylink_stop() into dpaa2_mac_stop().
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +----
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 8 ++++++++
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +----
|
||||
3 files changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -2082,10 +2082,8 @@ static int dpaa2_eth_open(struct net_dev
|
||||
goto enable_err;
|
||||
}
|
||||
|
||||
- if (dpaa2_eth_is_type_phy(priv)) {
|
||||
+ if (dpaa2_eth_is_type_phy(priv))
|
||||
dpaa2_mac_start(priv->mac);
|
||||
- phylink_start(priv->mac->phylink);
|
||||
- }
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2159,7 +2157,6 @@ static int dpaa2_eth_stop(struct net_dev
|
||||
int retries = 10;
|
||||
|
||||
if (dpaa2_eth_is_type_phy(priv)) {
|
||||
- phylink_stop(priv->mac->phylink);
|
||||
dpaa2_mac_stop(priv->mac);
|
||||
} else {
|
||||
netif_tx_stop_all_queues(net_dev);
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
@@ -336,12 +336,20 @@ static void dpaa2_mac_set_supported_inte
|
||||
|
||||
void dpaa2_mac_start(struct dpaa2_mac *mac)
|
||||
{
|
||||
+ ASSERT_RTNL();
|
||||
+
|
||||
if (mac->serdes_phy)
|
||||
phy_power_on(mac->serdes_phy);
|
||||
+
|
||||
+ phylink_start(mac->phylink);
|
||||
}
|
||||
|
||||
void dpaa2_mac_stop(struct dpaa2_mac *mac)
|
||||
{
|
||||
+ ASSERT_RTNL();
|
||||
+
|
||||
+ phylink_stop(mac->phylink);
|
||||
+
|
||||
if (mac->serdes_phy)
|
||||
phy_power_off(mac->serdes_phy);
|
||||
}
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
@@ -703,10 +703,8 @@ static int dpaa2_switch_port_open(struct
|
||||
|
||||
dpaa2_switch_enable_ctrl_if_napi(ethsw);
|
||||
|
||||
- if (dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
+ if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
dpaa2_mac_start(port_priv->mac);
|
||||
- phylink_start(port_priv->mac->phylink);
|
||||
- }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -718,7 +716,6 @@ static int dpaa2_switch_port_stop(struct
|
||||
int err;
|
||||
|
||||
if (dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
- phylink_stop(port_priv->mac->phylink);
|
||||
dpaa2_mac_stop(port_priv->mac);
|
||||
} else {
|
||||
netif_tx_stop_all_queues(netdev);
|
@ -0,0 +1,50 @@
|
||||
From 095ef388f714d622aa503fcccf20dc4095b72762 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:13 +0200
|
||||
Subject: [PATCH 06/14] net: dpaa2-mac: remove defensive check in
|
||||
dpaa2_mac_disconnect()
|
||||
|
||||
dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if
|
||||
dpaa2_mac_connect() failed, or was never called.
|
||||
|
||||
The callers are these:
|
||||
|
||||
dpaa2_eth_disconnect_mac():
|
||||
|
||||
if (dpaa2_eth_is_type_phy(priv))
|
||||
dpaa2_mac_disconnect(priv->mac);
|
||||
|
||||
dpaa2_switch_port_disconnect_mac():
|
||||
|
||||
if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
dpaa2_mac_disconnect(port_priv->mac);
|
||||
|
||||
priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns
|
||||
false, and dpaa2_mac_disconnect() is never called. Similar for
|
||||
dpaa2-switch.
|
||||
|
||||
When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned
|
||||
zero (success), and therefore, priv->mac->phylink is also a valid
|
||||
pointer.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
@@ -446,9 +446,6 @@ err_pcs_destroy:
|
||||
|
||||
void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
|
||||
{
|
||||
- if (!mac->phylink)
|
||||
- return;
|
||||
-
|
||||
phylink_disconnect_phy(mac->phylink);
|
||||
phylink_destroy(mac->phylink);
|
||||
dpaa2_pcs_destroy(mac);
|
@ -0,0 +1,101 @@
|
||||
From 06efc9b8a1360cad83cae6e71558e5458cc1fbf3 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:14 +0200
|
||||
Subject: [PATCH 07/14] net: dpaa2-eth: assign priv->mac after
|
||||
dpaa2_mac_connect() call
|
||||
|
||||
There are 2 requirements for correct code:
|
||||
|
||||
- Any time the driver accesses the priv->mac pointer at runtime, it
|
||||
either holds NULL to indicate a DPNI-DPNI connection (or unconnected
|
||||
DPNI), or a struct dpaa2_mac whose phylink instance was fully
|
||||
initialized (created and connected to the PHY). No changes are made to
|
||||
priv->mac while it is being used. Currently, rtnl_lock() watches over
|
||||
the call to dpaa2_eth_connect_mac(), so it serves the purpose of
|
||||
serializing this with all readers of priv->mac.
|
||||
|
||||
- dpaa2_mac_connect() should run unlocked, because inside it are 2
|
||||
phylink calls with incompatible locking requirements: phylink_create()
|
||||
requires that the rtnl_mutex isn't held, and phylink_fwnode_phy_connect()
|
||||
requires that the rtnl_mutex is held. The only way to solve those
|
||||
contradictory requirements is to let dpaa2_mac_connect() take
|
||||
rtnl_lock() when it needs to.
|
||||
|
||||
To solve both requirements, we need to identify the writer side of the
|
||||
priv->mac pointer, which can be wrapped in a mutex private to the driver
|
||||
in a future patch. The dpaa2_mac_connect() cannot be part of the writer
|
||||
side critical section, because of an AB/BA deadlock with rtnl_lock().
|
||||
|
||||
So the strategy needs to be that where we prepare the DPMAC by calling
|
||||
dpaa2_mac_connect(), and only make priv->mac point to it once it's fully
|
||||
prepared. This ensures that the writer side critical section has the
|
||||
absolute minimum surface it can.
|
||||
|
||||
The reverse strategy is adopted in the dpaa2_eth_disconnect_mac() code
|
||||
path. This makes sure that priv->mac is NULL when we start tearing down
|
||||
the DPMAC that we disconnected from, and concurrent code will simply not
|
||||
see it.
|
||||
|
||||
No locking changes in this patch (concurrent code is still blocked by
|
||||
the rtnl_mutex).
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
.../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 21 +++++++++++--------
|
||||
1 file changed, 12 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -4443,9 +4443,8 @@ static int dpaa2_eth_connect_mac(struct
|
||||
err = dpaa2_mac_open(mac);
|
||||
if (err)
|
||||
goto err_free_mac;
|
||||
- priv->mac = mac;
|
||||
|
||||
- if (dpaa2_eth_is_type_phy(priv)) {
|
||||
+ if (dpaa2_mac_is_type_phy(mac)) {
|
||||
err = dpaa2_mac_connect(mac);
|
||||
if (err && err != -EPROBE_DEFER)
|
||||
netdev_err(priv->net_dev, "Error connecting to the MAC endpoint: %pe",
|
||||
@@ -4454,11 +4453,12 @@ static int dpaa2_eth_connect_mac(struct
|
||||
goto err_close_mac;
|
||||
}
|
||||
|
||||
+ priv->mac = mac;
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_close_mac:
|
||||
dpaa2_mac_close(mac);
|
||||
- priv->mac = NULL;
|
||||
err_free_mac:
|
||||
kfree(mac);
|
||||
return err;
|
||||
@@ -4466,15 +4466,18 @@ err_free_mac:
|
||||
|
||||
static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv)
|
||||
{
|
||||
- if (dpaa2_eth_is_type_phy(priv))
|
||||
- dpaa2_mac_disconnect(priv->mac);
|
||||
+ struct dpaa2_mac *mac = priv->mac;
|
||||
+
|
||||
+ priv->mac = NULL;
|
||||
|
||||
- if (!dpaa2_eth_has_mac(priv))
|
||||
+ if (!mac)
|
||||
return;
|
||||
|
||||
- dpaa2_mac_close(priv->mac);
|
||||
- kfree(priv->mac);
|
||||
- priv->mac = NULL;
|
||||
+ if (dpaa2_mac_is_type_phy(mac))
|
||||
+ dpaa2_mac_disconnect(mac);
|
||||
+
|
||||
+ dpaa2_mac_close(mac);
|
||||
+ kfree(mac);
|
||||
}
|
||||
|
||||
static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)
|
@ -0,0 +1,73 @@
|
||||
From a5e7f7e277bd4403c45c1c7922d56d0eb08dbc7c Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:15 +0200
|
||||
Subject: [PATCH 08/14] net: dpaa2-switch: assign port_priv->mac after
|
||||
dpaa2_mac_connect() call
|
||||
|
||||
The dpaa2-switch has the exact same locking requirements when connected
|
||||
to a DPMAC, so it needs port_priv->mac to always point either to NULL,
|
||||
or to a DPMAC with a fully initialized phylink instance.
|
||||
|
||||
Make the same preparatory change in the dpaa2-switch driver as in the
|
||||
dpaa2-eth one.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
.../ethernet/freescale/dpaa2/dpaa2-switch.c | 21 +++++++++++--------
|
||||
1 file changed, 12 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
@@ -1450,9 +1450,8 @@ static int dpaa2_switch_port_connect_mac
|
||||
err = dpaa2_mac_open(mac);
|
||||
if (err)
|
||||
goto err_free_mac;
|
||||
- port_priv->mac = mac;
|
||||
|
||||
- if (dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
+ if (dpaa2_mac_is_type_phy(mac)) {
|
||||
err = dpaa2_mac_connect(mac);
|
||||
if (err) {
|
||||
netdev_err(port_priv->netdev,
|
||||
@@ -1462,11 +1461,12 @@ static int dpaa2_switch_port_connect_mac
|
||||
}
|
||||
}
|
||||
|
||||
+ port_priv->mac = mac;
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_close_mac:
|
||||
dpaa2_mac_close(mac);
|
||||
- port_priv->mac = NULL;
|
||||
err_free_mac:
|
||||
kfree(mac);
|
||||
return err;
|
||||
@@ -1474,15 +1474,18 @@ err_free_mac:
|
||||
|
||||
static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv)
|
||||
{
|
||||
- if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
- dpaa2_mac_disconnect(port_priv->mac);
|
||||
+ struct dpaa2_mac *mac = port_priv->mac;
|
||||
+
|
||||
+ port_priv->mac = NULL;
|
||||
|
||||
- if (!dpaa2_switch_port_has_mac(port_priv))
|
||||
+ if (!mac)
|
||||
return;
|
||||
|
||||
- dpaa2_mac_close(port_priv->mac);
|
||||
- kfree(port_priv->mac);
|
||||
- port_priv->mac = NULL;
|
||||
+ if (dpaa2_mac_is_type_phy(mac))
|
||||
+ dpaa2_mac_disconnect(mac);
|
||||
+
|
||||
+ dpaa2_mac_close(mac);
|
||||
+ kfree(mac);
|
||||
}
|
||||
|
||||
static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
|
@ -0,0 +1,111 @@
|
||||
From ce44b6ed9ee65efa9b3025552c513842eabcab88 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:16 +0200
|
||||
Subject: [PATCH 09/14] net: dpaa2: publish MAC stringset to ethtool -S even if
|
||||
MAC is missing
|
||||
|
||||
DPNIs and DPSW objects can connect and disconnect at runtime from DPMAC
|
||||
objects on the same fsl-mc bus. The DPMAC object also holds "ethtool -S"
|
||||
unstructured counters. Those counters are only shown for the entity
|
||||
owning the netdev (DPNI, DPSW) if it's connected to a DPMAC.
|
||||
|
||||
The ethtool stringset code path is split into multiple callbacks, but
|
||||
currently, connecting and disconnecting the DPMAC takes the rtnl_lock().
|
||||
This blocks the entire ethtool code path from running, see
|
||||
ethnl_default_doit() -> rtnl_lock() -> ops->prepare_data() ->
|
||||
strset_prepare_data().
|
||||
|
||||
This is going to be a problem if we are going to no longer require
|
||||
rtnl_lock() when connecting/disconnecting the DPMAC, because the DPMAC
|
||||
could appear between ops->get_sset_count() and ops->get_strings().
|
||||
If it appears out of the blue, we will provide a stringset into an array
|
||||
that was dimensioned thinking the DPMAC wouldn't be there => array
|
||||
accessed out of bounds.
|
||||
|
||||
There isn't really a good way to work around that, and I don't want to
|
||||
put too much pressure on the ethtool framework by playing locking games.
|
||||
Just make the DPMAC counters be always available. They'll be zeroes if
|
||||
the DPNI or DPSW isn't connected to a DPMAC.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 12 +++---------
|
||||
.../ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c | 11 ++---------
|
||||
2 files changed, 5 insertions(+), 18 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
|
||||
@@ -186,7 +186,6 @@ static int dpaa2_eth_set_pauseparam(stru
|
||||
static void dpaa2_eth_get_strings(struct net_device *netdev, u32 stringset,
|
||||
u8 *data)
|
||||
{
|
||||
- struct dpaa2_eth_priv *priv = netdev_priv(netdev);
|
||||
u8 *p = data;
|
||||
int i;
|
||||
|
||||
@@ -200,22 +199,17 @@ static void dpaa2_eth_get_strings(struct
|
||||
strscpy(p, dpaa2_ethtool_extras[i], ETH_GSTRING_LEN);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
- if (dpaa2_eth_has_mac(priv))
|
||||
- dpaa2_mac_get_strings(p);
|
||||
+ dpaa2_mac_get_strings(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int dpaa2_eth_get_sset_count(struct net_device *net_dev, int sset)
|
||||
{
|
||||
- int num_ss_stats = DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS;
|
||||
- struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
-
|
||||
switch (sset) {
|
||||
case ETH_SS_STATS: /* ethtool_get_stats(), ethtool_get_drvinfo() */
|
||||
- if (dpaa2_eth_has_mac(priv))
|
||||
- num_ss_stats += dpaa2_mac_get_sset_count();
|
||||
- return num_ss_stats;
|
||||
+ return DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS +
|
||||
+ dpaa2_mac_get_sset_count();
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
|
||||
@@ -145,14 +145,9 @@ dpaa2_switch_set_link_ksettings(struct n
|
||||
static int
|
||||
dpaa2_switch_ethtool_get_sset_count(struct net_device *netdev, int sset)
|
||||
{
|
||||
- struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
||||
- int num_ss_stats = DPAA2_SWITCH_NUM_COUNTERS;
|
||||
-
|
||||
switch (sset) {
|
||||
case ETH_SS_STATS:
|
||||
- if (port_priv->mac)
|
||||
- num_ss_stats += dpaa2_mac_get_sset_count();
|
||||
- return num_ss_stats;
|
||||
+ return DPAA2_SWITCH_NUM_COUNTERS + dpaa2_mac_get_sset_count();
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@@ -161,7 +156,6 @@ dpaa2_switch_ethtool_get_sset_count(stru
|
||||
static void dpaa2_switch_ethtool_get_strings(struct net_device *netdev,
|
||||
u32 stringset, u8 *data)
|
||||
{
|
||||
- struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
||||
u8 *p = data;
|
||||
int i;
|
||||
|
||||
@@ -172,8 +166,7 @@ static void dpaa2_switch_ethtool_get_str
|
||||
ETH_GSTRING_LEN);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
- if (port_priv->mac)
|
||||
- dpaa2_mac_get_strings(p);
|
||||
+ dpaa2_mac_get_strings(p);
|
||||
break;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
From c838d9fd7e6ba9ddd6006bf0a296396266e9f121 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:17 +0200
|
||||
Subject: [PATCH 10/14] net: dpaa2-switch replace direct MAC access with
|
||||
dpaa2_switch_port_has_mac()
|
||||
|
||||
The helper function will gain a lockdep annotation in a future patch.
|
||||
Make sure to benefit from it.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
|
||||
@@ -189,7 +189,7 @@ static void dpaa2_switch_ethtool_get_sta
|
||||
dpaa2_switch_ethtool_counters[i].name, err);
|
||||
}
|
||||
|
||||
- if (port_priv->mac)
|
||||
+ if (dpaa2_switch_port_has_mac(port_priv))
|
||||
dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i);
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
From e0ea63162cb5f1ca7f844d6ef5fc4079448ee2d5 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:18 +0200
|
||||
Subject: [PATCH 11/14] net: dpaa2-eth: connect to MAC before requesting the
|
||||
"endpoint changed" IRQ
|
||||
|
||||
dpaa2_eth_connect_mac() is called both from dpaa2_eth_probe() and from
|
||||
dpni_irq0_handler_thread().
|
||||
|
||||
It could happen that the DPNI gets connected to a DPMAC on the fsl-mc
|
||||
bus exactly during probe, as soon as the "endpoint change" interrupt is
|
||||
requested in dpaa2_eth_setup_irqs(). This will cause the
|
||||
dpni_irq0_handler_thread() to register a phylink instance for that DPMAC.
|
||||
|
||||
Then, the probing function will also try to register a phylink instance
|
||||
for the same DPMAC, operation which should fail (and this will fail the
|
||||
probing of the driver).
|
||||
|
||||
Reorder dpaa2_eth_setup_irqs() and dpaa2_eth_connect_mac(), such that
|
||||
dpni_irq0_handler_thread() never races with the DPMAC-related portion of
|
||||
the probing path.
|
||||
|
||||
Also reorder dpaa2_eth_disconnect_mac() to be in the mirror position of
|
||||
dpaa2_eth_connect_mac() in the teardown path.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
.../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 18 +++++++++---------
|
||||
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -4710,6 +4710,10 @@ static int dpaa2_eth_probe(struct fsl_mc
|
||||
}
|
||||
#endif
|
||||
|
||||
+ err = dpaa2_eth_connect_mac(priv);
|
||||
+ if (err)
|
||||
+ goto err_connect_mac;
|
||||
+
|
||||
err = dpaa2_eth_setup_irqs(dpni_dev);
|
||||
if (err) {
|
||||
netdev_warn(net_dev, "Failed to set link interrupt, fall back to polling\n");
|
||||
@@ -4722,10 +4726,6 @@ static int dpaa2_eth_probe(struct fsl_mc
|
||||
priv->do_link_poll = true;
|
||||
}
|
||||
|
||||
- err = dpaa2_eth_connect_mac(priv);
|
||||
- if (err)
|
||||
- goto err_connect_mac;
|
||||
-
|
||||
err = dpaa2_eth_dl_alloc(priv);
|
||||
if (err)
|
||||
goto err_dl_register;
|
||||
@@ -4759,13 +4759,13 @@ err_dl_port_add:
|
||||
err_dl_trap_register:
|
||||
dpaa2_eth_dl_free(priv);
|
||||
err_dl_register:
|
||||
- dpaa2_eth_disconnect_mac(priv);
|
||||
-err_connect_mac:
|
||||
if (priv->do_link_poll)
|
||||
kthread_stop(priv->poll_thread);
|
||||
else
|
||||
fsl_mc_free_irqs(dpni_dev);
|
||||
err_poll_thread:
|
||||
+ dpaa2_eth_disconnect_mac(priv);
|
||||
+err_connect_mac:
|
||||
dpaa2_eth_free_rings(priv);
|
||||
err_alloc_rings:
|
||||
err_csum:
|
||||
@@ -4813,9 +4813,6 @@ static int dpaa2_eth_remove(struct fsl_m
|
||||
#endif
|
||||
|
||||
unregister_netdev(net_dev);
|
||||
- rtnl_lock();
|
||||
- dpaa2_eth_disconnect_mac(priv);
|
||||
- rtnl_unlock();
|
||||
|
||||
dpaa2_eth_dl_port_del(priv);
|
||||
dpaa2_eth_dl_traps_unregister(priv);
|
||||
@@ -4826,6 +4823,9 @@ static int dpaa2_eth_remove(struct fsl_m
|
||||
else
|
||||
fsl_mc_free_irqs(ls_dev);
|
||||
|
||||
+ rtnl_lock();
|
||||
+ dpaa2_eth_disconnect_mac(priv);
|
||||
+ rtnl_unlock();
|
||||
dpaa2_eth_free_rings(priv);
|
||||
free_percpu(priv->fd);
|
||||
free_percpu(priv->sgt_cache);
|
@ -0,0 +1,320 @@
|
||||
From 5e448a17dfa2e95166534df7f677a3694ef6187d Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:19 +0200
|
||||
Subject: [PATCH 12/14] net: dpaa2-eth: serialize changes to priv->mac with a
|
||||
mutex
|
||||
|
||||
The dpaa2 architecture permits dynamic connections between objects on
|
||||
the fsl-mc bus, specifically between a DPNI object (represented by a
|
||||
struct net_device) and a DPMAC object (represented by a struct phylink).
|
||||
|
||||
The DPNI driver is notified when those connections are created/broken
|
||||
through the dpni_irq0_handler_thread() method. To ensure that ethtool
|
||||
operations, as well as netdev up/down operations serialize with the
|
||||
connection/disconnection of the DPNI with a DPMAC,
|
||||
dpni_irq0_handler_thread() takes the rtnl_lock() to block those other
|
||||
operations from taking place.
|
||||
|
||||
There is code called by dpaa2_mac_connect() which wants to acquire the
|
||||
rtnl_mutex once again, see phylink_create() -> phylink_register_sfp() ->
|
||||
sfp_bus_add_upstream() -> rtnl_lock(). So the strategy doesn't quite
|
||||
work out, even though it's fairly simple.
|
||||
|
||||
Create a different strategy, where all code paths in the dpaa2-eth
|
||||
driver access priv->mac only while they are holding priv->mac_lock.
|
||||
The phylink instance is not created or connected to the PHY under the
|
||||
priv->mac_lock, but only assigned to priv->mac then. This will eliminate
|
||||
the reliance on the rtnl_mutex.
|
||||
|
||||
Add lockdep annotations and put comments where holding the lock is not
|
||||
necessary, and priv->mac can be dereferenced freely.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
.../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 43 ++++++++++++--
|
||||
.../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 6 ++
|
||||
.../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 58 +++++++++++++++----
|
||||
3 files changed, 91 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -2020,8 +2020,11 @@ static int dpaa2_eth_link_state_update(s
|
||||
|
||||
/* When we manage the MAC/PHY using phylink there is no need
|
||||
* to manually update the netif_carrier.
|
||||
+ * We can avoid locking because we are called from the "link changed"
|
||||
+ * IRQ handler, which is the same as the "endpoint changed" IRQ handler
|
||||
+ * (the writer to priv->mac), so we cannot race with it.
|
||||
*/
|
||||
- if (dpaa2_eth_is_type_phy(priv))
|
||||
+ if (dpaa2_mac_is_type_phy(priv->mac))
|
||||
goto out;
|
||||
|
||||
/* Chech link state; speed / duplex changes are not treated yet */
|
||||
@@ -2060,6 +2063,8 @@ static int dpaa2_eth_open(struct net_dev
|
||||
priv->dpbp_dev->obj_desc.id, priv->bpid);
|
||||
}
|
||||
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
if (!dpaa2_eth_is_type_phy(priv)) {
|
||||
/* We'll only start the txqs when the link is actually ready;
|
||||
* make sure we don't race against the link up notification,
|
||||
@@ -2078,6 +2083,7 @@ static int dpaa2_eth_open(struct net_dev
|
||||
|
||||
err = dpni_enable(priv->mc_io, 0, priv->mc_token);
|
||||
if (err < 0) {
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
netdev_err(net_dev, "dpni_enable() failed\n");
|
||||
goto enable_err;
|
||||
}
|
||||
@@ -2085,6 +2091,8 @@ static int dpaa2_eth_open(struct net_dev
|
||||
if (dpaa2_eth_is_type_phy(priv))
|
||||
dpaa2_mac_start(priv->mac);
|
||||
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+
|
||||
return 0;
|
||||
|
||||
enable_err:
|
||||
@@ -2156,6 +2164,8 @@ static int dpaa2_eth_stop(struct net_dev
|
||||
int dpni_enabled = 0;
|
||||
int retries = 10;
|
||||
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
if (dpaa2_eth_is_type_phy(priv)) {
|
||||
dpaa2_mac_stop(priv->mac);
|
||||
} else {
|
||||
@@ -2163,6 +2173,8 @@ static int dpaa2_eth_stop(struct net_dev
|
||||
netif_carrier_off(net_dev);
|
||||
}
|
||||
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+
|
||||
/* On dpni_disable(), the MC firmware will:
|
||||
* - stop MAC Rx and wait for all Rx frames to be enqueued to software
|
||||
* - cut off WRIOP dequeues from egress FQs and wait until transmission
|
||||
@@ -2488,12 +2500,20 @@ static int dpaa2_eth_ts_ioctl(struct net
|
||||
static int dpaa2_eth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(dev);
|
||||
+ int err;
|
||||
|
||||
if (cmd == SIOCSHWTSTAMP)
|
||||
return dpaa2_eth_ts_ioctl(dev, rq, cmd);
|
||||
|
||||
- if (dpaa2_eth_is_type_phy(priv))
|
||||
- return phylink_mii_ioctl(priv->mac->phylink, rq, cmd);
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
+ if (dpaa2_eth_is_type_phy(priv)) {
|
||||
+ err = phylink_mii_ioctl(priv->mac->phylink, rq, cmd);
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@@ -4453,7 +4473,9 @@ static int dpaa2_eth_connect_mac(struct
|
||||
goto err_close_mac;
|
||||
}
|
||||
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
priv->mac = mac;
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -4466,9 +4488,12 @@ err_free_mac:
|
||||
|
||||
static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv)
|
||||
{
|
||||
- struct dpaa2_mac *mac = priv->mac;
|
||||
+ struct dpaa2_mac *mac;
|
||||
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+ mac = priv->mac;
|
||||
priv->mac = NULL;
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
|
||||
if (!mac)
|
||||
return;
|
||||
@@ -4487,6 +4512,7 @@ static irqreturn_t dpni_irq0_handler_thr
|
||||
struct fsl_mc_device *dpni_dev = to_fsl_mc_device(dev);
|
||||
struct net_device *net_dev = dev_get_drvdata(dev);
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
+ bool had_mac;
|
||||
int err;
|
||||
|
||||
err = dpni_get_irq_status(dpni_dev->mc_io, 0, dpni_dev->mc_handle,
|
||||
@@ -4504,7 +4530,12 @@ static irqreturn_t dpni_irq0_handler_thr
|
||||
dpaa2_eth_update_tx_fqids(priv);
|
||||
|
||||
rtnl_lock();
|
||||
- if (dpaa2_eth_has_mac(priv))
|
||||
+ /* We can avoid locking because the "endpoint changed" IRQ
|
||||
+ * handler is the only one who changes priv->mac at runtime,
|
||||
+ * so we are not racing with anyone.
|
||||
+ */
|
||||
+ had_mac = !!priv->mac;
|
||||
+ if (had_mac)
|
||||
dpaa2_eth_disconnect_mac(priv);
|
||||
else
|
||||
dpaa2_eth_connect_mac(priv);
|
||||
@@ -4605,6 +4636,8 @@ static int dpaa2_eth_probe(struct fsl_mc
|
||||
priv = netdev_priv(net_dev);
|
||||
priv->net_dev = net_dev;
|
||||
|
||||
+ mutex_init(&priv->mac_lock);
|
||||
+
|
||||
priv->iommu_domain = iommu_get_domain_for_dev(dev);
|
||||
|
||||
priv->tx_tstamp_type = HWTSTAMP_TX_OFF;
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
|
||||
@@ -580,6 +580,8 @@ struct dpaa2_eth_priv {
|
||||
#endif
|
||||
|
||||
struct dpaa2_mac *mac;
|
||||
+ /* Serializes changes to priv->mac */
|
||||
+ struct mutex mac_lock;
|
||||
struct workqueue_struct *dpaa2_ptp_wq;
|
||||
struct work_struct tx_onestep_tstamp;
|
||||
struct sk_buff_head tx_skbs;
|
||||
@@ -733,11 +735,15 @@ static inline unsigned int dpaa2_eth_rx_
|
||||
|
||||
static inline bool dpaa2_eth_is_type_phy(struct dpaa2_eth_priv *priv)
|
||||
{
|
||||
+ lockdep_assert_held(&priv->mac_lock);
|
||||
+
|
||||
return dpaa2_mac_is_type_phy(priv->mac);
|
||||
}
|
||||
|
||||
static inline bool dpaa2_eth_has_mac(struct dpaa2_eth_priv *priv)
|
||||
{
|
||||
+ lockdep_assert_held(&priv->mac_lock);
|
||||
+
|
||||
return priv->mac ? true : false;
|
||||
}
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
|
||||
@@ -86,11 +86,16 @@ static void dpaa2_eth_get_drvinfo(struct
|
||||
static int dpaa2_eth_nway_reset(struct net_device *net_dev)
|
||||
{
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
+ int err = -EOPNOTSUPP;
|
||||
+
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
|
||||
if (dpaa2_eth_is_type_phy(priv))
|
||||
- return phylink_ethtool_nway_reset(priv->mac->phylink);
|
||||
+ err = phylink_ethtool_nway_reset(priv->mac->phylink);
|
||||
+
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
|
||||
- return -EOPNOTSUPP;
|
||||
+ return err;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -98,10 +103,18 @@ dpaa2_eth_get_link_ksettings(struct net_
|
||||
struct ethtool_link_ksettings *link_settings)
|
||||
{
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
+ int err;
|
||||
|
||||
- if (dpaa2_eth_is_type_phy(priv))
|
||||
- return phylink_ethtool_ksettings_get(priv->mac->phylink,
|
||||
- link_settings);
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
+ if (dpaa2_eth_is_type_phy(priv)) {
|
||||
+ err = phylink_ethtool_ksettings_get(priv->mac->phylink,
|
||||
+ link_settings);
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
|
||||
link_settings->base.autoneg = AUTONEG_DISABLE;
|
||||
if (!(priv->link_state.options & DPNI_LINK_OPT_HALF_DUPLEX))
|
||||
@@ -116,11 +129,17 @@ dpaa2_eth_set_link_ksettings(struct net_
|
||||
const struct ethtool_link_ksettings *link_settings)
|
||||
{
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
+ int err = -EOPNOTSUPP;
|
||||
|
||||
- if (!dpaa2_eth_is_type_phy(priv))
|
||||
- return -EOPNOTSUPP;
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
+ if (dpaa2_eth_is_type_phy(priv))
|
||||
+ err = phylink_ethtool_ksettings_set(priv->mac->phylink,
|
||||
+ link_settings);
|
||||
|
||||
- return phylink_ethtool_ksettings_set(priv->mac->phylink, link_settings);
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+
|
||||
+ return err;
|
||||
}
|
||||
|
||||
static void dpaa2_eth_get_pauseparam(struct net_device *net_dev,
|
||||
@@ -129,11 +148,16 @@ static void dpaa2_eth_get_pauseparam(str
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
u64 link_options = priv->link_state.options;
|
||||
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
if (dpaa2_eth_is_type_phy(priv)) {
|
||||
phylink_ethtool_get_pauseparam(priv->mac->phylink, pause);
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+
|
||||
pause->rx_pause = dpaa2_eth_rx_pause_enabled(link_options);
|
||||
pause->tx_pause = dpaa2_eth_tx_pause_enabled(link_options);
|
||||
pause->autoneg = AUTONEG_DISABLE;
|
||||
@@ -152,9 +176,17 @@ static int dpaa2_eth_set_pauseparam(stru
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
- if (dpaa2_eth_is_type_phy(priv))
|
||||
- return phylink_ethtool_set_pauseparam(priv->mac->phylink,
|
||||
- pause);
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
+ if (dpaa2_eth_is_type_phy(priv)) {
|
||||
+ err = phylink_ethtool_set_pauseparam(priv->mac->phylink,
|
||||
+ pause);
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
+
|
||||
if (pause->autoneg)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
@@ -309,8 +341,12 @@ static void dpaa2_eth_get_ethtool_stats(
|
||||
}
|
||||
*(data + i++) = buf_cnt;
|
||||
|
||||
+ mutex_lock(&priv->mac_lock);
|
||||
+
|
||||
if (dpaa2_eth_has_mac(priv))
|
||||
dpaa2_mac_get_ethtool_stats(priv->mac, data + i);
|
||||
+
|
||||
+ mutex_unlock(&priv->mac_lock);
|
||||
}
|
||||
|
||||
static int dpaa2_eth_prep_eth_rule(struct ethhdr *eth_value, struct ethhdr *eth_mask,
|
@ -0,0 +1,203 @@
|
||||
From 80d12452a5f160c39d63efc1be07df36f9d07133 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:20 +0200
|
||||
Subject: [PATCH 13/14] net: dpaa2-switch: serialize changes to priv->mac with
|
||||
a mutex
|
||||
|
||||
The dpaa2-switch driver uses a DPMAC in the same way as the dpaa2-eth
|
||||
driver, so we need to duplicate the locking solution established by the
|
||||
previous change to the switch driver as well.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
.../freescale/dpaa2/dpaa2-switch-ethtool.c | 32 +++++++++++++++----
|
||||
.../ethernet/freescale/dpaa2/dpaa2-switch.c | 31 ++++++++++++++++--
|
||||
.../ethernet/freescale/dpaa2/dpaa2-switch.h | 2 ++
|
||||
3 files changed, 55 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c
|
||||
@@ -60,11 +60,18 @@ dpaa2_switch_get_link_ksettings(struct n
|
||||
{
|
||||
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
||||
struct dpsw_link_state state = {0};
|
||||
- int err = 0;
|
||||
+ int err;
|
||||
|
||||
- if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
- return phylink_ethtool_ksettings_get(port_priv->mac->phylink,
|
||||
- link_ksettings);
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
+
|
||||
+ if (dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
+ err = phylink_ethtool_ksettings_get(port_priv->mac->phylink,
|
||||
+ link_ksettings);
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
|
||||
err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0,
|
||||
port_priv->ethsw_data->dpsw_handle,
|
||||
@@ -99,9 +106,16 @@ dpaa2_switch_set_link_ksettings(struct n
|
||||
bool if_running;
|
||||
int err = 0, ret;
|
||||
|
||||
- if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
- return phylink_ethtool_ksettings_set(port_priv->mac->phylink,
|
||||
- link_ksettings);
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
+
|
||||
+ if (dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
+ err = phylink_ethtool_ksettings_set(port_priv->mac->phylink,
|
||||
+ link_ksettings);
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
|
||||
/* Interface needs to be down to change link settings */
|
||||
if_running = netif_running(netdev);
|
||||
@@ -189,8 +203,12 @@ static void dpaa2_switch_ethtool_get_sta
|
||||
dpaa2_switch_ethtool_counters[i].name, err);
|
||||
}
|
||||
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
+
|
||||
if (dpaa2_switch_port_has_mac(port_priv))
|
||||
dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i);
|
||||
+
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
}
|
||||
|
||||
const struct ethtool_ops dpaa2_switch_port_ethtool_ops = {
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
@@ -603,8 +603,11 @@ static int dpaa2_switch_port_link_state_
|
||||
|
||||
/* When we manage the MAC/PHY using phylink there is no need
|
||||
* to manually update the netif_carrier.
|
||||
+ * We can avoid locking because we are called from the "link changed"
|
||||
+ * IRQ handler, which is the same as the "endpoint changed" IRQ handler
|
||||
+ * (the writer to port_priv->mac), so we cannot race with it.
|
||||
*/
|
||||
- if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
+ if (dpaa2_mac_is_type_phy(port_priv->mac))
|
||||
return 0;
|
||||
|
||||
/* Interrupts are received even though no one issued an 'ifconfig up'
|
||||
@@ -684,6 +687,8 @@ static int dpaa2_switch_port_open(struct
|
||||
struct ethsw_core *ethsw = port_priv->ethsw_data;
|
||||
int err;
|
||||
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
+
|
||||
if (!dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
/* Explicitly set carrier off, otherwise
|
||||
* netif_carrier_ok() will return true and cause 'ip link show'
|
||||
@@ -697,6 +702,7 @@ static int dpaa2_switch_port_open(struct
|
||||
port_priv->ethsw_data->dpsw_handle,
|
||||
port_priv->idx);
|
||||
if (err) {
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
netdev_err(netdev, "dpsw_if_enable err %d\n", err);
|
||||
return err;
|
||||
}
|
||||
@@ -706,6 +712,8 @@ static int dpaa2_switch_port_open(struct
|
||||
if (dpaa2_switch_port_is_type_phy(port_priv))
|
||||
dpaa2_mac_start(port_priv->mac);
|
||||
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -715,6 +723,8 @@ static int dpaa2_switch_port_stop(struct
|
||||
struct ethsw_core *ethsw = port_priv->ethsw_data;
|
||||
int err;
|
||||
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
+
|
||||
if (dpaa2_switch_port_is_type_phy(port_priv)) {
|
||||
dpaa2_mac_stop(port_priv->mac);
|
||||
} else {
|
||||
@@ -722,6 +732,8 @@ static int dpaa2_switch_port_stop(struct
|
||||
netif_carrier_off(netdev);
|
||||
}
|
||||
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
+
|
||||
err = dpsw_if_disable(port_priv->ethsw_data->mc_io, 0,
|
||||
port_priv->ethsw_data->dpsw_handle,
|
||||
port_priv->idx);
|
||||
@@ -1461,7 +1473,9 @@ static int dpaa2_switch_port_connect_mac
|
||||
}
|
||||
}
|
||||
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
port_priv->mac = mac;
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1474,9 +1488,12 @@ err_free_mac:
|
||||
|
||||
static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv)
|
||||
{
|
||||
- struct dpaa2_mac *mac = port_priv->mac;
|
||||
+ struct dpaa2_mac *mac;
|
||||
|
||||
+ mutex_lock(&port_priv->mac_lock);
|
||||
+ mac = port_priv->mac;
|
||||
port_priv->mac = NULL;
|
||||
+ mutex_unlock(&port_priv->mac_lock);
|
||||
|
||||
if (!mac)
|
||||
return;
|
||||
@@ -1495,6 +1512,7 @@ static irqreturn_t dpaa2_switch_irq0_han
|
||||
struct ethsw_port_priv *port_priv;
|
||||
u32 status = ~0;
|
||||
int err, if_id;
|
||||
+ bool had_mac;
|
||||
|
||||
err = dpsw_get_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle,
|
||||
DPSW_IRQ_INDEX_IF, &status);
|
||||
@@ -1513,7 +1531,12 @@ static irqreturn_t dpaa2_switch_irq0_han
|
||||
|
||||
if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) {
|
||||
rtnl_lock();
|
||||
- if (dpaa2_switch_port_has_mac(port_priv))
|
||||
+ /* We can avoid locking because the "endpoint changed" IRQ
|
||||
+ * handler is the only one who changes priv->mac at runtime,
|
||||
+ * so we are not racing with anyone.
|
||||
+ */
|
||||
+ had_mac = !!port_priv->mac;
|
||||
+ if (had_mac)
|
||||
dpaa2_switch_port_disconnect_mac(port_priv);
|
||||
else
|
||||
dpaa2_switch_port_connect_mac(port_priv);
|
||||
@@ -3256,6 +3279,8 @@ static int dpaa2_switch_probe_port(struc
|
||||
port_priv->netdev = port_netdev;
|
||||
port_priv->ethsw_data = ethsw;
|
||||
|
||||
+ mutex_init(&port_priv->mac_lock);
|
||||
+
|
||||
port_priv->idx = port_idx;
|
||||
port_priv->stp_state = BR_STATE_FORWARDING;
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
|
||||
@@ -161,6 +161,8 @@ struct ethsw_port_priv {
|
||||
|
||||
struct dpaa2_switch_filter_block *filter_block;
|
||||
struct dpaa2_mac *mac;
|
||||
+ /* Protects against changes to port_priv->mac */
|
||||
+ struct mutex mac_lock;
|
||||
};
|
||||
|
||||
/* Switch data */
|
@ -0,0 +1,113 @@
|
||||
From 4ea2faf5bb13d9ba9f07e996d495c4cbe34a4236 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 29 Nov 2022 16:12:21 +0200
|
||||
Subject: [PATCH 14/14] net: dpaa2-mac: move rtnl_lock() only around
|
||||
phylink_{,dis}connect_phy()
|
||||
|
||||
After the introduction of a private mac_lock that serializes access to
|
||||
priv->mac (and port_priv->mac in the switch), the only remaining purpose
|
||||
of rtnl_lock() is to satisfy the locking requirements of
|
||||
phylink_fwnode_phy_connect() and phylink_disconnect_phy().
|
||||
|
||||
But the functions these live in, dpaa2_mac_connect() and
|
||||
dpaa2_mac_disconnect(), have contradictory locking requirements.
|
||||
While phylink_fwnode_phy_connect() wants rtnl_lock() to be held,
|
||||
phylink_create() wants it to not be held.
|
||||
|
||||
Move the rtnl_lock() from top-level (in the dpaa2-eth and dpaa2-switch
|
||||
drivers) to only surround the phylink calls that require it, in the
|
||||
dpaa2-mac library code.
|
||||
|
||||
This is possible because dpaa2_mac_connect() and dpaa2_mac_disconnect()
|
||||
run unlocked, and there isn't any danger of an AB/BA deadlock between
|
||||
the rtnl_mutex and other private locks.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ----
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 5 +++++
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 ----
|
||||
3 files changed, 5 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -4529,7 +4529,6 @@ static irqreturn_t dpni_irq0_handler_thr
|
||||
dpaa2_eth_set_mac_addr(netdev_priv(net_dev));
|
||||
dpaa2_eth_update_tx_fqids(priv);
|
||||
|
||||
- rtnl_lock();
|
||||
/* We can avoid locking because the "endpoint changed" IRQ
|
||||
* handler is the only one who changes priv->mac at runtime,
|
||||
* so we are not racing with anyone.
|
||||
@@ -4539,7 +4538,6 @@ static irqreturn_t dpni_irq0_handler_thr
|
||||
dpaa2_eth_disconnect_mac(priv);
|
||||
else
|
||||
dpaa2_eth_connect_mac(priv);
|
||||
- rtnl_unlock();
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
@@ -4856,9 +4854,7 @@ static int dpaa2_eth_remove(struct fsl_m
|
||||
else
|
||||
fsl_mc_free_irqs(ls_dev);
|
||||
|
||||
- rtnl_lock();
|
||||
dpaa2_eth_disconnect_mac(priv);
|
||||
- rtnl_unlock();
|
||||
dpaa2_eth_free_rings(priv);
|
||||
free_percpu(priv->fd);
|
||||
free_percpu(priv->sgt_cache);
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
@@ -428,7 +428,9 @@ int dpaa2_mac_connect(struct dpaa2_mac *
|
||||
}
|
||||
mac->phylink = phylink;
|
||||
|
||||
+ rtnl_lock();
|
||||
err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0);
|
||||
+ rtnl_unlock();
|
||||
if (err) {
|
||||
netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err);
|
||||
goto err_phylink_destroy;
|
||||
@@ -446,7 +448,10 @@ err_pcs_destroy:
|
||||
|
||||
void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
|
||||
{
|
||||
+ rtnl_lock();
|
||||
phylink_disconnect_phy(mac->phylink);
|
||||
+ rtnl_unlock();
|
||||
+
|
||||
phylink_destroy(mac->phylink);
|
||||
dpaa2_pcs_destroy(mac);
|
||||
of_phy_put(mac->serdes_phy);
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
|
||||
@@ -1530,7 +1530,6 @@ static irqreturn_t dpaa2_switch_irq0_han
|
||||
}
|
||||
|
||||
if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) {
|
||||
- rtnl_lock();
|
||||
/* We can avoid locking because the "endpoint changed" IRQ
|
||||
* handler is the only one who changes priv->mac at runtime,
|
||||
* so we are not racing with anyone.
|
||||
@@ -1540,7 +1539,6 @@ static irqreturn_t dpaa2_switch_irq0_han
|
||||
dpaa2_switch_port_disconnect_mac(port_priv);
|
||||
else
|
||||
dpaa2_switch_port_connect_mac(port_priv);
|
||||
- rtnl_unlock();
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -2958,9 +2956,7 @@ static void dpaa2_switch_remove_port(str
|
||||
{
|
||||
struct ethsw_port_priv *port_priv = ethsw->ports[port_idx];
|
||||
|
||||
- rtnl_lock();
|
||||
dpaa2_switch_port_disconnect_mac(port_priv);
|
||||
- rtnl_unlock();
|
||||
free_netdev(port_priv->netdev);
|
||||
ethsw->ports[port_idx] = NULL;
|
||||
}
|
@ -12,6 +12,7 @@ CPU_TYPE:=fa526
|
||||
SUBTARGETS:=generic
|
||||
|
||||
KERNEL_PATCHVER:=5.15
|
||||
KERNEL_TESTING_PATCHVER:=6.1
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for the StorLink/Cortina Gemini CS351x ARM FA526 CPU
|
||||
|
427
target/linux/gemini/config-6.1
Normal file
427
target/linux/gemini/config-6.1
Normal file
@ -0,0 +1,427 @@
|
||||
CONFIG_ALIGNMENT_TRAP=y
|
||||
CONFIG_AMBA_PL08X=y
|
||||
CONFIG_ARCH_32BIT_OFF_T=y
|
||||
CONFIG_ARCH_FORCE_MAX_ORDER=11
|
||||
CONFIG_ARCH_GEMINI=y
|
||||
CONFIG_ARCH_KEEP_MEMBLOCK=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_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_ARCH_SPARSEMEM_ENABLE=y
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARM_AMBA=y
|
||||
CONFIG_ARM_APPENDED_DTB=y
|
||||
# CONFIG_ARM_ATAG_DTB_COMPAT is not set
|
||||
CONFIG_ARM_CRYPTO=y
|
||||
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_FORCE=y
|
||||
CONFIG_ATA_VERBOSE_ERROR=y
|
||||
CONFIG_AUTO_ZRELADDR=y
|
||||
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BLK_PM=y
|
||||
CONFIG_BOUNCE=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_PERCENTAGE=10
|
||||
# CONFIG_CMA_SIZE_SEL_MAX is not set
|
||||
# CONFIG_CMA_SIZE_SEL_MBYTES is not set
|
||||
# CONFIG_CMA_SIZE_SEL_MIN is not set
|
||||
CONFIG_CMA_SIZE_SEL_PERCENTAGE=y
|
||||
# CONFIG_CMA_SYSFS is not set
|
||||
CONFIG_COMMON_CLK=y
|
||||
CONFIG_COMMON_CLK_GEMINI=y
|
||||
CONFIG_COMPAT_32BIT_TIME=y
|
||||
CONFIG_CONSOLE_TRANSLATIONS=y
|
||||
CONFIG_CONTIG_ALLOC=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_THERMAL=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_CMAC=y
|
||||
CONFIG_CRYPTO_CRC32C=y
|
||||
CONFIG_CRYPTO_DES=y
|
||||
CONFIG_CRYPTO_DEV_SL3516=y
|
||||
# CONFIG_CRYPTO_DEV_SL3516_DEBUG is not set
|
||||
CONFIG_CRYPTO_DRBG=y
|
||||
CONFIG_CRYPTO_DRBG_HMAC=y
|
||||
CONFIG_CRYPTO_DRBG_MENU=y
|
||||
CONFIG_CRYPTO_ECB=y
|
||||
CONFIG_CRYPTO_ECHAINIV=y
|
||||
CONFIG_CRYPTO_ENGINE=y
|
||||
CONFIG_CRYPTO_HMAC=y
|
||||
CONFIG_CRYPTO_HW=y
|
||||
CONFIG_CRYPTO_JITTERENTROPY=y
|
||||
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
|
||||
CONFIG_CRYPTO_LIB_DES=y
|
||||
CONFIG_CRYPTO_LIB_SHA256=y
|
||||
CONFIG_CRYPTO_MD4=y
|
||||
CONFIG_CRYPTO_MD5=y
|
||||
CONFIG_CRYPTO_RNG=y
|
||||
CONFIG_CRYPTO_RNG2=y
|
||||
CONFIG_CRYPTO_RNG_DEFAULT=y
|
||||
CONFIG_CRYPTO_SEQIV=y
|
||||
CONFIG_CRYPTO_SHA256=y
|
||||
CONFIG_CRYPTO_SHA512=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_DMADEVICES=y
|
||||
CONFIG_DMATEST=y
|
||||
CONFIG_DMA_CMA=y
|
||||
CONFIG_DMA_ENGINE=y
|
||||
CONFIG_DMA_ENGINE_RAID=y
|
||||
CONFIG_DMA_OF=y
|
||||
CONFIG_DMA_OPS=y
|
||||
CONFIG_DMA_REMAP=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_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_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_FWNODE_MDIO=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=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_LIB_DEVMEM_IS_ALLOWED=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_IRQCHIP=y
|
||||
CONFIG_GPIO_CDEV=y
|
||||
CONFIG_GPIO_FTGPIO010=y
|
||||
CONFIG_GPIO_GENERIC=y
|
||||
CONFIG_GRO_CELLS=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_HDMI=y
|
||||
CONFIG_HIGHMEM=y
|
||||
CONFIG_HIGHPTE=y
|
||||
CONFIG_HWMON=y
|
||||
CONFIG_HW_CONSOLE=y
|
||||
CONFIG_HW_RANDOM=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_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_KCMP=y
|
||||
CONFIG_KERNEL_LZMA=y
|
||||
# CONFIG_KERNEL_XZ is not set
|
||||
CONFIG_KEXEC=y
|
||||
CONFIG_KEXEC_CORE=y
|
||||
CONFIG_KEYBOARD_DLINK_DIR685=y
|
||||
CONFIG_KMAP_LOCAL=y
|
||||
CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=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_MARVELL_PHY=y
|
||||
CONFIG_MDIO_BITBANG=y
|
||||
CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MDIO_DEVRES=y
|
||||
CONFIG_MDIO_GPIO=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
CONFIG_MEMORY_ISOLATION=y
|
||||
CONFIG_MFD_SYSCON=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_DEVLINK=y
|
||||
CONFIG_NET_DSA=y
|
||||
CONFIG_NET_DSA_REALTEK_SMI=y
|
||||
CONFIG_NET_DSA_TAG_RTL4_A=y
|
||||
CONFIG_NET_NS=y
|
||||
CONFIG_NET_SELFTESTS=y
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
CONFIG_NLS=y
|
||||
CONFIG_NO_HZ_COMMON=y
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_NVMEM=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_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_PCIEASPM=y
|
||||
CONFIG_PCIEASPM_DEFAULT=y
|
||||
# CONFIG_PCIEASPM_PERFORMANCE is not set
|
||||
# CONFIG_PCIEASPM_POWERSAVE is not set
|
||||
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
|
||||
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_PREEMPTION=y
|
||||
CONFIG_PREEMPT_COUNT=y
|
||||
# CONFIG_PREEMPT_NONE is not set
|
||||
CONFIG_PREEMPT_RCU=y
|
||||
CONFIG_PROC_PAGE_MONITOR=y
|
||||
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
|
||||
CONFIG_RATIONAL=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_REGMAP=y
|
||||
CONFIG_REGMAP_I2C=y
|
||||
CONFIG_REGMAP_MMIO=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_MC146818_LIB=y
|
||||
CONFIG_RTC_NVMEM=y
|
||||
CONFIG_SATA_GEMINI=y
|
||||
CONFIG_SATA_HOST=y
|
||||
CONFIG_SATA_PMP=y
|
||||
CONFIG_SCSI=y
|
||||
CONFIG_SCSI_COMMON=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_MCTRL_GPIO=y
|
||||
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_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_RCU=y
|
||||
CONFIG_TREE_SRCU=y
|
||||
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
|
||||
CONFIG_UNINLINE_SPIN_UNLOCK=y
|
||||
CONFIG_UNUSED_BOARD_FILES=n
|
||||
CONFIG_UNWINDER_ARM=y
|
||||
CONFIG_USB_FOTG210=m
|
||||
CONFIG_USB_FOTG210_HCD=y
|
||||
CONFIG_USB_FOTG210_UDC=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GPIO_VBUS=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
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
|
14
target/linux/gemini/modules.mk
Normal file
14
target/linux/gemini/modules.mk
Normal file
@ -0,0 +1,14 @@
|
||||
define KernelPackage/usb-fotg210
|
||||
TITLE:=Support for FOTG210 USB host and device controllers
|
||||
DEPENDS:=@USB_SUPPORT @TARGET_gemini
|
||||
KCONFIG:=CONFIG_USB_FOTG210 \
|
||||
CONFIG_USB_FOTG210_HCD
|
||||
FILES:=$(if $(CONFIG_USB_FOTG210_HCD),$(LINUX_DIR)/drivers/usb/host/fotg210-hcd.ko@lt6.1) \
|
||||
$(if $(CONFIG_USB_FOTG210),$(LINUX_DIR)/drivers/usb/fotg210/fotg210.ko@ge6.1)
|
||||
AUTOLOAD:=$(call AutoLoad,50, \
|
||||
$(if $(CONFIG_USB_FOTG210_HCD),fotg210-hcd@lt6.1) \
|
||||
$(if $(CONFIG_USB_FOTG210),fotg210@ge6.1),1)
|
||||
$(call AddDepends/usb)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,usb-fotg210))
|
@ -0,0 +1,67 @@
|
||||
From d5a026cc8306ccd3e99e1455c87e38f8e6fa18df Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 7 Nov 2022 00:05:06 +0100
|
||||
Subject: [PATCH 01/29] usb: phy: phy-gpio-vbus-usb: Add device tree probing
|
||||
|
||||
Make it possible to probe the GPIO VBUS detection driver
|
||||
from the device tree compatible for GPIO USB B connectors.
|
||||
|
||||
Since this driver is using the "gpio-usb-b-connector"
|
||||
compatible, it is important to discern it from the role
|
||||
switch connector driver (which does not provide a phy),
|
||||
so we add some Kconfig text and depend on !USB_CONN_GPIO.
|
||||
|
||||
Cc: Rob Herring <robh@kernel.org>
|
||||
Cc: Prashant Malani <pmalani@chromium.org>
|
||||
Cc: Felipe Balbi <balbi@kernel.org>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221106230506.1646101-1-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/phy/Kconfig
|
||||
+++ b/drivers/usb/phy/Kconfig
|
||||
@@ -93,12 +93,16 @@ config USB_GPIO_VBUS
|
||||
tristate "GPIO based peripheral-only VBUS sensing 'transceiver'"
|
||||
depends on GPIOLIB || COMPILE_TEST
|
||||
depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
|
||||
+ depends on !USB_CONN_GPIO
|
||||
select USB_PHY
|
||||
help
|
||||
Provides simple GPIO VBUS sensing for controllers with an
|
||||
internal transceiver via the usb_phy interface, and
|
||||
optionally control of a D+ pullup GPIO as well as a VBUS
|
||||
- current limit regulator.
|
||||
+ current limit regulator. This driver is for devices that do
|
||||
+ NOT support role switch. OTG devices that can do role switch
|
||||
+ (master/peripheral) shall use the USB based connection
|
||||
+ detection driver USB_CONN_GPIO.
|
||||
|
||||
config OMAP_OTG
|
||||
tristate "OMAP USB OTG controller driver"
|
||||
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
|
||||
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
|
||||
@@ -366,12 +366,24 @@ static const struct dev_pm_ops gpio_vbus
|
||||
|
||||
MODULE_ALIAS("platform:gpio-vbus");
|
||||
|
||||
+/*
|
||||
+ * NOTE: this driver matches against "gpio-usb-b-connector" for
|
||||
+ * devices that do NOT support role switch.
|
||||
+ */
|
||||
+static const struct of_device_id gpio_vbus_of_match[] = {
|
||||
+ {
|
||||
+ .compatible = "gpio-usb-b-connector",
|
||||
+ },
|
||||
+ {},
|
||||
+};
|
||||
+
|
||||
static struct platform_driver gpio_vbus_driver = {
|
||||
.driver = {
|
||||
.name = "gpio-vbus",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &gpio_vbus_dev_pm_ops,
|
||||
#endif
|
||||
+ .of_match_table = gpio_vbus_of_match,
|
||||
},
|
||||
.probe = gpio_vbus_probe,
|
||||
.remove = gpio_vbus_remove,
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,332 @@
|
||||
From 0dbc77a99267a5efef0603a4b49ac02ece6a3f23 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Sun, 23 Oct 2022 16:47:07 +0200
|
||||
Subject: [PATCH 03/29] usb: fotg210: Compile into one module
|
||||
|
||||
It is since ages perfectly possible to compile both of these
|
||||
modules into the same kernel, which makes no sense since it
|
||||
is one piece of hardware.
|
||||
|
||||
Compile one module named "fotg210.ko" for both HCD and UDC
|
||||
drivers by collecting the init calls into a fotg210-core.c
|
||||
file and start to centralize things handling one and the same
|
||||
piece of hardware.
|
||||
|
||||
Stub out the initcalls if one or the other part of the driver
|
||||
was not selected.
|
||||
|
||||
Tested by compiling one or the other or both of the drivers
|
||||
into the kernel and as modules.
|
||||
|
||||
Cc: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com>
|
||||
Cc: Felipe Balbi <balbi@kernel.org>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221023144708.3596563-2-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/Kconfig
|
||||
+++ b/drivers/usb/fotg210/Kconfig
|
||||
@@ -12,7 +12,7 @@ config USB_FOTG210
|
||||
if USB_FOTG210
|
||||
|
||||
config USB_FOTG210_HCD
|
||||
- tristate "Faraday FOTG210 USB Host Controller support"
|
||||
+ bool "Faraday FOTG210 USB Host Controller support"
|
||||
depends on USB
|
||||
help
|
||||
Faraday FOTG210 is an OTG controller which can be configured as
|
||||
@@ -24,7 +24,7 @@ config USB_FOTG210_HCD
|
||||
|
||||
config USB_FOTG210_UDC
|
||||
depends on USB_GADGET
|
||||
- tristate "Faraday FOTG210 USB Peripheral Controller support"
|
||||
+ bool "Faraday FOTG210 USB Peripheral Controller support"
|
||||
help
|
||||
Faraday USB2.0 OTG controller which can be configured as
|
||||
high speed or full speed USB device. This driver suppports
|
||||
--- a/drivers/usb/fotg210/Makefile
|
||||
+++ b/drivers/usb/fotg210/Makefile
|
||||
@@ -1,3 +1,10 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
-obj-$(CONFIG_USB_FOTG210_HCD) += fotg210-hcd.o
|
||||
-obj-$(CONFIG_USB_FOTG210_UDC) += fotg210-udc.o
|
||||
+
|
||||
+# This setup links the different object files into one single
|
||||
+# module so we don't have to EXPORT() a lot of internal symbols
|
||||
+# or create unnecessary submodules.
|
||||
+fotg210-objs-y += fotg210-core.o
|
||||
+fotg210-objs-$(CONFIG_USB_FOTG210_HCD) += fotg210-hcd.o
|
||||
+fotg210-objs-$(CONFIG_USB_FOTG210_UDC) += fotg210-udc.o
|
||||
+fotg210-objs := $(fotg210-objs-y)
|
||||
+obj-$(CONFIG_USB_FOTG210) += fotg210.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -0,0 +1,79 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Central probing code for the FOTG210 dual role driver
|
||||
+ * We register one driver for the hardware and then we decide
|
||||
+ * whether to proceed with probing the host or the peripheral
|
||||
+ * driver.
|
||||
+ */
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/usb.h>
|
||||
+
|
||||
+#include "fotg210.h"
|
||||
+
|
||||
+static int fotg210_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_HCD)) {
|
||||
+ ret = fotg210_hcd_probe(pdev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
|
||||
+ ret = fotg210_udc_probe(pdev);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int fotg210_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
|
||||
+ fotg210_hcd_remove(pdev);
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
|
||||
+ fotg210_udc_remove(pdev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_OF
|
||||
+static const struct of_device_id fotg210_of_match[] = {
|
||||
+ { .compatible = "faraday,fotg210" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, fotg210_of_match);
|
||||
+#endif
|
||||
+
|
||||
+static struct platform_driver fotg210_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "fotg210",
|
||||
+ .of_match_table = of_match_ptr(fotg210_of_match),
|
||||
+ },
|
||||
+ .probe = fotg210_probe,
|
||||
+ .remove = fotg210_remove,
|
||||
+};
|
||||
+
|
||||
+static int __init fotg210_init(void)
|
||||
+{
|
||||
+ if (usb_disabled())
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
|
||||
+ fotg210_hcd_init();
|
||||
+ return platform_driver_register(&fotg210_driver);
|
||||
+}
|
||||
+module_init(fotg210_init);
|
||||
+
|
||||
+static void __exit fotg210_cleanup(void)
|
||||
+{
|
||||
+ platform_driver_unregister(&fotg210_driver);
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
|
||||
+ fotg210_hcd_cleanup();
|
||||
+}
|
||||
+module_exit(fotg210_cleanup);
|
||||
+
|
||||
+MODULE_AUTHOR("Yuan-Hsin Chen, Feng-Hsin Chiang");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_DESCRIPTION("FOTG210 Dual Role Controller Driver");
|
||||
--- a/drivers/usb/fotg210/fotg210-hcd.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-hcd.c
|
||||
@@ -39,8 +39,8 @@
|
||||
#include <asm/irq.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
-#define DRIVER_AUTHOR "Yuan-Hsin Chen"
|
||||
-#define DRIVER_DESC "FOTG210 Host Controller (EHCI) Driver"
|
||||
+#include "fotg210.h"
|
||||
+
|
||||
static const char hcd_name[] = "fotg210_hcd";
|
||||
|
||||
#undef FOTG210_URB_TRACE
|
||||
@@ -5490,9 +5490,6 @@ static int fotg210_get_frame(struct usb_
|
||||
* functions and in order to facilitate role switching we cannot
|
||||
* give the fotg210 driver exclusive access to those.
|
||||
*/
|
||||
-MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
-MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
-MODULE_LICENSE("GPL");
|
||||
|
||||
static const struct hc_driver fotg210_fotg210_hc_driver = {
|
||||
.description = hcd_name,
|
||||
@@ -5560,7 +5557,7 @@ static void fotg210_init(struct fotg210_
|
||||
* then invokes the start() method for the HCD associated with it
|
||||
* through the hotplug entry's driver_data.
|
||||
*/
|
||||
-static int fotg210_hcd_probe(struct platform_device *pdev)
|
||||
+int fotg210_hcd_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct usb_hcd *hcd;
|
||||
@@ -5652,7 +5649,7 @@ fail_create_hcd:
|
||||
* @dev: USB Host Controller being removed
|
||||
*
|
||||
*/
|
||||
-static int fotg210_hcd_remove(struct platform_device *pdev)
|
||||
+int fotg210_hcd_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
||||
struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd);
|
||||
@@ -5668,27 +5665,8 @@ static int fotg210_hcd_remove(struct pla
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_OF
|
||||
-static const struct of_device_id fotg210_of_match[] = {
|
||||
- { .compatible = "faraday,fotg210" },
|
||||
- {},
|
||||
-};
|
||||
-MODULE_DEVICE_TABLE(of, fotg210_of_match);
|
||||
-#endif
|
||||
-
|
||||
-static struct platform_driver fotg210_hcd_driver = {
|
||||
- .driver = {
|
||||
- .name = "fotg210-hcd",
|
||||
- .of_match_table = of_match_ptr(fotg210_of_match),
|
||||
- },
|
||||
- .probe = fotg210_hcd_probe,
|
||||
- .remove = fotg210_hcd_remove,
|
||||
-};
|
||||
-
|
||||
-static int __init fotg210_hcd_init(void)
|
||||
+int __init fotg210_hcd_init(void)
|
||||
{
|
||||
- int retval = 0;
|
||||
-
|
||||
if (usb_disabled())
|
||||
return -ENODEV;
|
||||
|
||||
@@ -5704,24 +5682,11 @@ static int __init fotg210_hcd_init(void)
|
||||
|
||||
fotg210_debug_root = debugfs_create_dir("fotg210", usb_debug_root);
|
||||
|
||||
- retval = platform_driver_register(&fotg210_hcd_driver);
|
||||
- if (retval < 0)
|
||||
- goto clean;
|
||||
- return retval;
|
||||
-
|
||||
-clean:
|
||||
- debugfs_remove(fotg210_debug_root);
|
||||
- fotg210_debug_root = NULL;
|
||||
-
|
||||
- clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
|
||||
- return retval;
|
||||
+ return 0;
|
||||
}
|
||||
-module_init(fotg210_hcd_init);
|
||||
|
||||
-static void __exit fotg210_hcd_cleanup(void)
|
||||
+void __exit fotg210_hcd_cleanup(void)
|
||||
{
|
||||
- platform_driver_unregister(&fotg210_hcd_driver);
|
||||
debugfs_remove(fotg210_debug_root);
|
||||
clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
|
||||
}
|
||||
-module_exit(fotg210_hcd_cleanup);
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
|
||||
+#include "fotg210.h"
|
||||
#include "fotg210-udc.h"
|
||||
|
||||
#define DRIVER_DESC "FOTG210 USB Device Controller Driver"
|
||||
@@ -1081,7 +1082,7 @@ static const struct usb_gadget_ops fotg2
|
||||
.udc_stop = fotg210_udc_stop,
|
||||
};
|
||||
|
||||
-static int fotg210_udc_remove(struct platform_device *pdev)
|
||||
+int fotg210_udc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct fotg210_udc *fotg210 = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
@@ -1098,7 +1099,7 @@ static int fotg210_udc_remove(struct pla
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int fotg210_udc_probe(struct platform_device *pdev)
|
||||
+int fotg210_udc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res, *ires;
|
||||
struct fotg210_udc *fotg210 = NULL;
|
||||
@@ -1223,17 +1224,3 @@ err_alloc:
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
-
|
||||
-static struct platform_driver fotg210_driver = {
|
||||
- .driver = {
|
||||
- .name = udc_name,
|
||||
- },
|
||||
- .probe = fotg210_udc_probe,
|
||||
- .remove = fotg210_udc_remove,
|
||||
-};
|
||||
-
|
||||
-module_platform_driver(fotg210_driver);
|
||||
-
|
||||
-MODULE_AUTHOR("Yuan-Hsin Chen, Feng-Hsin Chiang <john453@faraday-tech.com>");
|
||||
-MODULE_LICENSE("GPL");
|
||||
-MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/fotg210/fotg210.h
|
||||
@@ -0,0 +1,42 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+#ifndef __FOTG210_H
|
||||
+#define __FOTG210_H
|
||||
+
|
||||
+#ifdef CONFIG_USB_FOTG210_HCD
|
||||
+int fotg210_hcd_probe(struct platform_device *pdev);
|
||||
+int fotg210_hcd_remove(struct platform_device *pdev);
|
||||
+int fotg210_hcd_init(void);
|
||||
+void fotg210_hcd_cleanup(void);
|
||||
+#else
|
||||
+static inline int fotg210_hcd_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+static inline int fotg210_hcd_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+static inline int fotg210_hcd_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+static inline void fotg210_hcd_cleanup(void)
|
||||
+{
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CONFIG_USB_FOTG210_UDC
|
||||
+int fotg210_udc_probe(struct platform_device *pdev);
|
||||
+int fotg210_udc_remove(struct platform_device *pdev);
|
||||
+#else
|
||||
+static inline int fotg210_udc_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+static inline int fotg210_udc_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif /* __FOTG210_H */
|
@ -0,0 +1,68 @@
|
||||
From 7c0b661926097e935f2711857596fc2277b2304a Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Sun, 23 Oct 2022 16:47:08 +0200
|
||||
Subject: [PATCH 04/29] usb: fotg210: Select subdriver by mode
|
||||
|
||||
Check which mode the hardware is in, and selecte the peripheral
|
||||
driver if the hardware is in explicit peripheral mode, otherwise
|
||||
select host mode.
|
||||
|
||||
This should solve the immediate problem that both subdrivers
|
||||
can get probed.
|
||||
|
||||
Cc: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com>
|
||||
Cc: Felipe Balbi <balbi@kernel.org>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221023144708.3596563-3-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -10,30 +10,37 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
|
||||
#include "fotg210.h"
|
||||
|
||||
static int fotg210_probe(struct platform_device *pdev)
|
||||
{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ enum usb_dr_mode mode;
|
||||
int ret;
|
||||
|
||||
- if (IS_ENABLED(CONFIG_USB_FOTG210_HCD)) {
|
||||
- ret = fotg210_hcd_probe(pdev);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
- }
|
||||
- if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
|
||||
+ mode = usb_get_dr_mode(dev);
|
||||
+
|
||||
+ if (mode == USB_DR_MODE_PERIPHERAL)
|
||||
ret = fotg210_udc_probe(pdev);
|
||||
+ else
|
||||
+ ret = fotg210_hcd_probe(pdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int fotg210_remove(struct platform_device *pdev)
|
||||
{
|
||||
- if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
|
||||
- fotg210_hcd_remove(pdev);
|
||||
- if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ enum usb_dr_mode mode;
|
||||
+
|
||||
+ mode = usb_get_dr_mode(dev);
|
||||
+
|
||||
+ if (mode == USB_DR_MODE_PERIPHERAL)
|
||||
fotg210_udc_remove(pdev);
|
||||
+ else
|
||||
+ fotg210_hcd_remove(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
From f7f6c8aca91093e2f886ec97910b1a7d9a69bf9b Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 9 Nov 2022 21:05:54 +0100
|
||||
Subject: [PATCH 05/29] usb: 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 <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221109200554.1957185-1-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/Kconfig
|
||||
+++ b/drivers/usb/fotg210/Kconfig
|
||||
@@ -5,6 +5,7 @@ config USB_FOTG210
|
||||
depends on USB || USB_GADGET
|
||||
depends on HAS_DMA && HAS_IOMEM
|
||||
default ARCH_GEMINI
|
||||
+ select MFD_SYSCON
|
||||
help
|
||||
Faraday FOTG210 is a dual-mode USB controller that can act
|
||||
in both host controller and peripheral controller mode.
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -5,15 +5,86 @@
|
||||
* whether to proceed with probing the host or the peripheral
|
||||
* driver.
|
||||
*/
|
||||
+#include <linux/bitops.h>
|
||||
#include <linux/device.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
+#include <linux/regmap.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/usb/otg.h>
|
||||
|
||||
#include "fotg210.h"
|
||||
|
||||
+/*
|
||||
+ * Gemini-specific initialization function, only executed on the
|
||||
+ * Gemini SoC using the global misc control register.
|
||||
+ *
|
||||
+ * The gemini USB blocks are connected to either Mini-A (host mode) or
|
||||
+ * Mini-B (peripheral mode) plugs. There is no role switch support on the
|
||||
+ * Gemini SoC, just either-or.
|
||||
+ */
|
||||
+#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 resource *res,
|
||||
+ enum usb_dr_mode mode)
|
||||
+{
|
||||
+ struct device_node *np = dev->of_node;
|
||||
+ struct regmap *map;
|
||||
+ 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);
|
||||
+ }
|
||||
+ 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 (res->start == 0x69000000) {
|
||||
+ mask = GEMINI_MISC_USB1_VBUS_ON | GEMINI_MISC_USB1_MINI_B |
|
||||
+ GEMINI_MISC_USB1_WAKEUP;
|
||||
+ if (mode == USB_DR_MODE_HOST)
|
||||
+ val = GEMINI_MISC_USB1_VBUS_ON;
|
||||
+ else
|
||||
+ val = GEMINI_MISC_USB1_MINI_B;
|
||||
+ if (wakeup)
|
||||
+ val |= GEMINI_MISC_USB1_WAKEUP;
|
||||
+ } else {
|
||||
+ mask = GEMINI_MISC_USB0_VBUS_ON | GEMINI_MISC_USB0_MINI_B |
|
||||
+ GEMINI_MISC_USB0_WAKEUP;
|
||||
+ if (mode == USB_DR_MODE_HOST)
|
||||
+ val = GEMINI_MISC_USB0_VBUS_ON;
|
||||
+ else
|
||||
+ val = GEMINI_MISC_USB0_MINI_B;
|
||||
+ if (wakeup)
|
||||
+ val |= 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 in %s mode\n",
|
||||
+ (mode == USB_DR_MODE_HOST) ? "host" : "gadget");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int fotg210_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -22,6 +93,15 @@ static int fotg210_probe(struct platform
|
||||
|
||||
mode = usb_get_dr_mode(dev);
|
||||
|
||||
+ if (of_device_is_compatible(dev->of_node, "cortina,gemini-usb")) {
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ ret = fotg210_gemini_init(dev, res, mode);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
if (mode == USB_DR_MODE_PERIPHERAL)
|
||||
ret = fotg210_udc_probe(pdev);
|
||||
else
|
@ -0,0 +1,51 @@
|
||||
From 6e002d41889bc52213a26ff91338d340505e0336 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Fri, 11 Nov 2022 15:48:21 +0100
|
||||
Subject: [PATCH 06/29] usb: fotg210: Fix Kconfig for USB host modules
|
||||
|
||||
The kernel robot reports a link failure when activating the
|
||||
FOTG210 host subdriver with =y on a system where the USB host
|
||||
core is a module (CONFIG_USB=m).
|
||||
|
||||
This is a bit of special case, so mimic the Kconfig incantations
|
||||
from DWC3: let the subdrivers for host or peripheral depend
|
||||
on the host or gadget support being =y or the same as the
|
||||
FOTG210 core itself.
|
||||
|
||||
This should ensure that either:
|
||||
|
||||
- The host (CONFIG_USB) or gadget (CONFIG_GADGET) is compiled
|
||||
in and then the FOTG210 can be either module or compiled
|
||||
in.
|
||||
|
||||
- The host or gadget is modular, and then the FOTG210 module
|
||||
must be a module too, or we cannot resolve the symbols
|
||||
at link time.
|
||||
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Link: https://lore.kernel.org/linux-usb/202211112132.0BUPGKCd-lkp@intel.com/
|
||||
Cc: Arnd Bergmann <arnd@arndb.de>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221111144821.113665-1-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/Kconfig
|
||||
+++ b/drivers/usb/fotg210/Kconfig
|
||||
@@ -14,7 +14,7 @@ if USB_FOTG210
|
||||
|
||||
config USB_FOTG210_HCD
|
||||
bool "Faraday FOTG210 USB Host Controller support"
|
||||
- depends on USB
|
||||
+ depends on USB=y || USB=USB_FOTG210
|
||||
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
|
||||
@@ -24,7 +24,7 @@ config USB_FOTG210_HCD
|
||||
module will be called fotg210-hcd.
|
||||
|
||||
config USB_FOTG210_UDC
|
||||
- depends on USB_GADGET
|
||||
+ depends on USB_GADGET=y || USB_GADGET=USB_FOTG210
|
||||
bool "Faraday FOTG210 USB Peripheral Controller support"
|
||||
help
|
||||
Faraday USB2.0 OTG controller which can be configured as
|
@ -0,0 +1,26 @@
|
||||
From 466b10510add46afd21ca19505b29d35ad853370 Mon Sep 17 00:00:00 2001
|
||||
From: Geert Uytterhoeven <geert+renesas@glider.be>
|
||||
Date: Mon, 21 Nov 2022 16:22:19 +0100
|
||||
Subject: [PATCH 07/29] usb: USB_FOTG210 should depend on ARCH_GEMINI
|
||||
|
||||
The Faraday Technology FOTG210 USB2 Dual Role Controller is only present
|
||||
on Cortina Systems Gemini SoCs. Hence add a dependency on ARCH_GEMINI,
|
||||
to prevent asking the user about its drivers when configuring a kernel
|
||||
without Cortina Systems Gemini SoC support.
|
||||
|
||||
Fixes: 1dd33a9f1b95ab59 ("usb: fotg210: Collect pieces of dual mode controller")
|
||||
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/a989b3b798ecaf3b45f35160e30e605636d66a77.1669044086.git.geert+renesas@glider.be
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/Kconfig
|
||||
+++ b/drivers/usb/fotg210/Kconfig
|
||||
@@ -4,6 +4,7 @@ config USB_FOTG210
|
||||
tristate "Faraday FOTG210 USB2 Dual Role controller"
|
||||
depends on USB || USB_GADGET
|
||||
depends on HAS_DMA && HAS_IOMEM
|
||||
+ depends on ARCH_GEMINI || COMPILE_TEST
|
||||
default ARCH_GEMINI
|
||||
select MFD_SYSCON
|
||||
help
|
@ -0,0 +1,61 @@
|
||||
From 27cd321a365fecac857e41ad1681062994142e4a Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 14 Nov 2022 12:51:58 +0100
|
||||
Subject: [PATCH 08/29] fotg210-udc: Use dev pointer in probe and dev_messages
|
||||
|
||||
Add a local struct device *dev pointer and use dev_err()
|
||||
etc to report status.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221114115201.302887-1-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1104,6 +1104,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
struct resource *res, *ires;
|
||||
struct fotg210_udc *fotg210 = NULL;
|
||||
struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
|
||||
+ struct device *dev = &pdev->dev;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
@@ -1135,7 +1136,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
|
||||
fotg210->reg = ioremap(res->start, resource_size(res));
|
||||
if (fotg210->reg == NULL) {
|
||||
- pr_err("ioremap error.\n");
|
||||
+ dev_err(dev, "ioremap error\n");
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
@@ -1146,8 +1147,8 @@ int fotg210_udc_probe(struct platform_de
|
||||
fotg210->gadget.ops = &fotg210_gadget_ops;
|
||||
|
||||
fotg210->gadget.max_speed = USB_SPEED_HIGH;
|
||||
- fotg210->gadget.dev.parent = &pdev->dev;
|
||||
- fotg210->gadget.dev.dma_mask = pdev->dev.dma_mask;
|
||||
+ fotg210->gadget.dev.parent = dev;
|
||||
+ fotg210->gadget.dev.dma_mask = dev->dma_mask;
|
||||
fotg210->gadget.name = udc_name;
|
||||
|
||||
INIT_LIST_HEAD(&fotg210->gadget.ep_list);
|
||||
@@ -1195,15 +1196,15 @@ int fotg210_udc_probe(struct platform_de
|
||||
ret = request_irq(ires->start, fotg210_irq, IRQF_SHARED,
|
||||
udc_name, fotg210);
|
||||
if (ret < 0) {
|
||||
- pr_err("request_irq error (%d)\n", ret);
|
||||
+ dev_err(dev, "request_irq error (%d)\n", ret);
|
||||
goto err_req;
|
||||
}
|
||||
|
||||
- ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget);
|
||||
+ ret = usb_add_gadget_udc(dev, &fotg210->gadget);
|
||||
if (ret)
|
||||
goto err_add_udc;
|
||||
|
||||
- dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION);
|
||||
+ dev_info(dev, "version %s\n", DRIVER_VERSION);
|
||||
|
||||
return 0;
|
||||
|
@ -0,0 +1,158 @@
|
||||
From 03e4b585ac947e2d422bedf03179bbfec3aca3cf Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 14 Nov 2022 12:51:59 +0100
|
||||
Subject: [PATCH 09/29] fotg210-udc: Support optional external PHY
|
||||
|
||||
This adds support for an optional external PHY to the FOTG210
|
||||
UDC driver.
|
||||
|
||||
Tested with the GPIO VBUS PHY driver on the Gemini SoC.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221114115201.302887-2-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
+#include <linux/usb/phy.h>
|
||||
|
||||
#include "fotg210.h"
|
||||
#include "fotg210-udc.h"
|
||||
@@ -1022,10 +1024,18 @@ static int fotg210_udc_start(struct usb_
|
||||
{
|
||||
struct fotg210_udc *fotg210 = gadget_to_fotg210(g);
|
||||
u32 value;
|
||||
+ int ret;
|
||||
|
||||
/* hook up the driver */
|
||||
fotg210->driver = driver;
|
||||
|
||||
+ if (!IS_ERR_OR_NULL(fotg210->phy)) {
|
||||
+ ret = otg_set_peripheral(fotg210->phy->otg,
|
||||
+ &fotg210->gadget);
|
||||
+ if (ret)
|
||||
+ dev_err(fotg210->dev, "can't bind to phy\n");
|
||||
+ }
|
||||
+
|
||||
/* enable device global interrupt */
|
||||
value = ioread32(fotg210->reg + FOTG210_DMCR);
|
||||
value |= DMCR_GLINT_EN;
|
||||
@@ -1067,6 +1077,9 @@ static int fotg210_udc_stop(struct usb_g
|
||||
struct fotg210_udc *fotg210 = gadget_to_fotg210(g);
|
||||
unsigned long flags;
|
||||
|
||||
+ if (!IS_ERR_OR_NULL(fotg210->phy))
|
||||
+ return otg_set_peripheral(fotg210->phy->otg, NULL);
|
||||
+
|
||||
spin_lock_irqsave(&fotg210->lock, flags);
|
||||
|
||||
fotg210_init(fotg210);
|
||||
@@ -1082,12 +1095,50 @@ static const struct usb_gadget_ops fotg2
|
||||
.udc_stop = fotg210_udc_stop,
|
||||
};
|
||||
|
||||
+/**
|
||||
+ * fotg210_phy_event - Called by phy upon VBus event
|
||||
+ * @nb: notifier block
|
||||
+ * @action: phy action, is vbus connect or disconnect
|
||||
+ * @data: the usb_gadget structure in fotg210
|
||||
+ *
|
||||
+ * Called by the USB Phy when a cable connect or disconnect is sensed.
|
||||
+ *
|
||||
+ * Returns NOTIFY_OK or NOTIFY_DONE
|
||||
+ */
|
||||
+static int fotg210_phy_event(struct notifier_block *nb, unsigned long action,
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct usb_gadget *gadget = data;
|
||||
+
|
||||
+ if (!gadget)
|
||||
+ return NOTIFY_DONE;
|
||||
+
|
||||
+ switch (action) {
|
||||
+ case USB_EVENT_VBUS:
|
||||
+ usb_gadget_vbus_connect(gadget);
|
||||
+ return NOTIFY_OK;
|
||||
+ case USB_EVENT_NONE:
|
||||
+ usb_gadget_vbus_disconnect(gadget);
|
||||
+ return NOTIFY_OK;
|
||||
+ default:
|
||||
+ return NOTIFY_DONE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block fotg210_phy_notifier = {
|
||||
+ .notifier_call = fotg210_phy_event,
|
||||
+};
|
||||
+
|
||||
int fotg210_udc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct fotg210_udc *fotg210 = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
|
||||
usb_del_gadget_udc(&fotg210->gadget);
|
||||
+ if (!IS_ERR_OR_NULL(fotg210->phy)) {
|
||||
+ usb_unregister_notifier(fotg210->phy, &fotg210_phy_notifier);
|
||||
+ usb_put_phy(fotg210->phy);
|
||||
+ }
|
||||
iounmap(fotg210->reg);
|
||||
free_irq(platform_get_irq(pdev, 0), fotg210);
|
||||
|
||||
@@ -1127,6 +1178,22 @@ int fotg210_udc_probe(struct platform_de
|
||||
if (fotg210 == NULL)
|
||||
goto err;
|
||||
|
||||
+ fotg210->dev = dev;
|
||||
+
|
||||
+ fotg210->phy = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0);
|
||||
+ if (IS_ERR(fotg210->phy)) {
|
||||
+ ret = PTR_ERR(fotg210->phy);
|
||||
+ if (ret == -EPROBE_DEFER)
|
||||
+ goto err;
|
||||
+ dev_info(dev, "no PHY found\n");
|
||||
+ fotg210->phy = NULL;
|
||||
+ } else {
|
||||
+ ret = usb_phy_init(fotg210->phy);
|
||||
+ if (ret)
|
||||
+ goto err;
|
||||
+ dev_info(dev, "found and initialized PHY\n");
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
|
||||
_ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
|
||||
if (_ep[i] == NULL)
|
||||
@@ -1200,6 +1267,9 @@ int fotg210_udc_probe(struct platform_de
|
||||
goto err_req;
|
||||
}
|
||||
|
||||
+ if (!IS_ERR_OR_NULL(fotg210->phy))
|
||||
+ usb_register_notifier(fotg210->phy, &fotg210_phy_notifier);
|
||||
+
|
||||
ret = usb_add_gadget_udc(dev, &fotg210->gadget);
|
||||
if (ret)
|
||||
goto err_add_udc;
|
||||
@@ -1209,6 +1279,8 @@ int fotg210_udc_probe(struct platform_de
|
||||
return 0;
|
||||
|
||||
err_add_udc:
|
||||
+ if (!IS_ERR_OR_NULL(fotg210->phy))
|
||||
+ usb_unregister_notifier(fotg210->phy, &fotg210_phy_notifier);
|
||||
free_irq(ires->start, fotg210);
|
||||
|
||||
err_req:
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.h
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.h
|
||||
@@ -234,6 +234,8 @@ struct fotg210_udc {
|
||||
|
||||
unsigned long irq_trigger;
|
||||
|
||||
+ struct device *dev;
|
||||
+ struct usb_phy *phy;
|
||||
struct usb_gadget gadget;
|
||||
struct usb_gadget_driver *driver;
|
||||
|
@ -0,0 +1,90 @@
|
||||
From 772ea3ec2b9363b45ef9a4768ea205f758c3debc Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 14 Nov 2022 12:52:00 +0100
|
||||
Subject: [PATCH 10/29] fotg210-udc: Handle PCLK
|
||||
|
||||
This adds optional handling of the peripheral clock PCLK.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221114115201.302887-3-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
+#include <linux/clk.h>
|
||||
#include <linux/usb/otg.h>
|
||||
#include <linux/usb/phy.h>
|
||||
|
||||
@@ -1145,6 +1146,10 @@ int fotg210_udc_remove(struct platform_d
|
||||
fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
|
||||
kfree(fotg210->ep[i]);
|
||||
+
|
||||
+ if (!IS_ERR(fotg210->pclk))
|
||||
+ clk_disable_unprepare(fotg210->pclk);
|
||||
+
|
||||
kfree(fotg210);
|
||||
|
||||
return 0;
|
||||
@@ -1180,17 +1185,34 @@ int fotg210_udc_probe(struct platform_de
|
||||
|
||||
fotg210->dev = dev;
|
||||
|
||||
+ /* It's OK not to supply this clock */
|
||||
+ fotg210->pclk = devm_clk_get(dev, "PCLK");
|
||||
+ if (!IS_ERR(fotg210->pclk)) {
|
||||
+ ret = clk_prepare_enable(fotg210->pclk);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "failed to enable PCLK\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ } else if (PTR_ERR(fotg210->pclk) == -EPROBE_DEFER) {
|
||||
+ /*
|
||||
+ * Percolate deferrals, for anything else,
|
||||
+ * just live without the clocking.
|
||||
+ */
|
||||
+ ret = -EPROBE_DEFER;
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
fotg210->phy = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0);
|
||||
if (IS_ERR(fotg210->phy)) {
|
||||
ret = PTR_ERR(fotg210->phy);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
- goto err;
|
||||
+ goto err_pclk;
|
||||
dev_info(dev, "no PHY found\n");
|
||||
fotg210->phy = NULL;
|
||||
} else {
|
||||
ret = usb_phy_init(fotg210->phy);
|
||||
if (ret)
|
||||
- goto err;
|
||||
+ goto err_pclk;
|
||||
dev_info(dev, "found and initialized PHY\n");
|
||||
}
|
||||
|
||||
@@ -1292,6 +1314,10 @@ err_map:
|
||||
err_alloc:
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
|
||||
kfree(fotg210->ep[i]);
|
||||
+err_pclk:
|
||||
+ if (!IS_ERR(fotg210->pclk))
|
||||
+ clk_disable_unprepare(fotg210->pclk);
|
||||
+
|
||||
kfree(fotg210);
|
||||
|
||||
err:
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.h
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.h
|
||||
@@ -231,6 +231,7 @@ struct fotg210_ep {
|
||||
struct fotg210_udc {
|
||||
spinlock_t lock; /* protect the struct */
|
||||
void __iomem *reg;
|
||||
+ struct clk *pclk;
|
||||
|
||||
unsigned long irq_trigger;
|
||||
|
@ -0,0 +1,69 @@
|
||||
From eda686d41e298a9d16708d2ec8d12d8e682dd7ca Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 14 Nov 2022 12:52:01 +0100
|
||||
Subject: [PATCH 11/29] fotg210-udc: Get IRQ using platform_get_irq()
|
||||
|
||||
The platform_get_irq() is necessary to use to get dynamic
|
||||
IRQ resolution when instantiating the device from the
|
||||
device tree. IRQs are not passed as resources in that
|
||||
case.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221114115201.302887-4-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1157,10 +1157,11 @@ int fotg210_udc_remove(struct platform_d
|
||||
|
||||
int fotg210_udc_probe(struct platform_device *pdev)
|
||||
{
|
||||
- struct resource *res, *ires;
|
||||
+ struct resource *res;
|
||||
struct fotg210_udc *fotg210 = NULL;
|
||||
struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
|
||||
struct device *dev = &pdev->dev;
|
||||
+ int irq;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
@@ -1170,9 +1171,9 @@ int fotg210_udc_probe(struct platform_de
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
- ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||
- if (!ires) {
|
||||
- pr_err("platform_get_resource IORESOURCE_IRQ error.\n");
|
||||
+ irq = platform_get_irq(pdev, 0);
|
||||
+ if (irq < 0) {
|
||||
+ pr_err("could not get irq\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -1202,7 +1203,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
goto err;
|
||||
}
|
||||
|
||||
- fotg210->phy = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0);
|
||||
+ fotg210->phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
|
||||
if (IS_ERR(fotg210->phy)) {
|
||||
ret = PTR_ERR(fotg210->phy);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
@@ -1282,7 +1283,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
|
||||
fotg210_disable_unplug(fotg210);
|
||||
|
||||
- ret = request_irq(ires->start, fotg210_irq, IRQF_SHARED,
|
||||
+ ret = request_irq(irq, fotg210_irq, IRQF_SHARED,
|
||||
udc_name, fotg210);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "request_irq error (%d)\n", ret);
|
||||
@@ -1303,7 +1304,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
err_add_udc:
|
||||
if (!IS_ERR_OR_NULL(fotg210->phy))
|
||||
usb_unregister_notifier(fotg210->phy, &fotg210_phy_notifier);
|
||||
- free_irq(ires->start, fotg210);
|
||||
+ free_irq(irq, fotg210);
|
||||
|
||||
err_req:
|
||||
fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
|
@ -0,0 +1,39 @@
|
||||
From 7889a2f0256c55e0184dffd0001d0782f9e4cb83 Mon Sep 17 00:00:00 2001
|
||||
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||
Date: Mon, 14 Nov 2022 21:38:04 +0100
|
||||
Subject: [PATCH 12/29] usb: fotg210-udc: Remove a useless assignment
|
||||
|
||||
There is no need to use an intermediate array for these memory allocations,
|
||||
so, axe it.
|
||||
|
||||
While at it, turn a '== NULL' into a shorter '!' when testing memory
|
||||
allocation failure.
|
||||
|
||||
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/deab9696fc4000499470e7ccbca7c36fca17bd4e.1668458274.git.christophe.jaillet@wanadoo.fr
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1159,7 +1159,6 @@ int fotg210_udc_probe(struct platform_de
|
||||
{
|
||||
struct resource *res;
|
||||
struct fotg210_udc *fotg210 = NULL;
|
||||
- struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
|
||||
struct device *dev = &pdev->dev;
|
||||
int irq;
|
||||
int ret = 0;
|
||||
@@ -1218,10 +1217,9 @@ int fotg210_udc_probe(struct platform_de
|
||||
}
|
||||
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
|
||||
- _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
|
||||
- if (_ep[i] == NULL)
|
||||
+ fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
|
||||
+ if (!fotg210->ep[i])
|
||||
goto err_alloc;
|
||||
- fotg210->ep[i] = _ep[i];
|
||||
}
|
||||
|
||||
fotg210->reg = ioremap(res->start, resource_size(res));
|
@ -0,0 +1,58 @@
|
||||
From 7b95ade85ac18eec63e81ac58a482b3e88361ffd Mon Sep 17 00:00:00 2001
|
||||
From: Yi Yang <yiyang13@huawei.com>
|
||||
Date: Fri, 2 Dec 2022 09:21:26 +0800
|
||||
Subject: [PATCH 13/29] usb: fotg210-udc: fix potential memory leak in
|
||||
fotg210_udc_probe()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In fotg210_udc_probe(), if devm_clk_get() or clk_prepare_enable()
|
||||
fails, 'fotg210' will not be freed, which will lead to a memory leak.
|
||||
Fix it by moving kfree() to a proper location.
|
||||
|
||||
In addition,we can use "return -ENOMEM" instead of "goto err"
|
||||
to simplify the code.
|
||||
|
||||
Fixes: 718a38d092ec ("fotg210-udc: Handle PCLK")
|
||||
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Signed-off-by: Yi Yang <yiyang13@huawei.com>
|
||||
Link: https://lore.kernel.org/r/20221202012126.246953-1-yiyang13@huawei.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1176,12 +1176,10 @@ int fotg210_udc_probe(struct platform_de
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
- ret = -ENOMEM;
|
||||
-
|
||||
/* initialize udc */
|
||||
fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL);
|
||||
if (fotg210 == NULL)
|
||||
- goto err;
|
||||
+ return -ENOMEM;
|
||||
|
||||
fotg210->dev = dev;
|
||||
|
||||
@@ -1191,7 +1189,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
ret = clk_prepare_enable(fotg210->pclk);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable PCLK\n");
|
||||
- return ret;
|
||||
+ goto err;
|
||||
}
|
||||
} else if (PTR_ERR(fotg210->pclk) == -EPROBE_DEFER) {
|
||||
/*
|
||||
@@ -1317,8 +1315,7 @@ err_pclk:
|
||||
if (!IS_ERR(fotg210->pclk))
|
||||
clk_disable_unprepare(fotg210->pclk);
|
||||
|
||||
- kfree(fotg210);
|
||||
-
|
||||
err:
|
||||
+ kfree(fotg210);
|
||||
return ret;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
From d8eed400495029ba551704ff0fae1dad87332291 Mon Sep 17 00:00:00 2001
|
||||
From: Arnd Bergmann <arnd@arndb.de>
|
||||
Date: Thu, 15 Dec 2022 17:57:20 +0100
|
||||
Subject: [PATCH 14/29] usb: fotg210: fix OTG-only build
|
||||
|
||||
The fotg210 module combines the HCD and OTG drivers, which then
|
||||
fails to build when only the USB gadget support is enabled
|
||||
in the kernel but host support is not:
|
||||
|
||||
aarch64-linux-ld: drivers/usb/fotg210/fotg210-core.o: in function `fotg210_init':
|
||||
fotg210-core.c:(.init.text+0xc): undefined reference to `usb_disabled'
|
||||
|
||||
Move the check for usb_disabled() after the check for the HCD module,
|
||||
and let the OTG driver still be probed in this configuration.
|
||||
|
||||
A nicer approach might be to have the common portion built as a
|
||||
library module, with the two platform other files registering
|
||||
their own platform_driver instances separately.
|
||||
|
||||
Fixes: ddacd6ef44ca ("usb: fotg210: Fix Kconfig for USB host modules")
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
|
||||
Link: https://lore.kernel.org/r/20221215165728.2062984-1-arnd@kernel.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -144,10 +144,7 @@ static struct platform_driver fotg210_dr
|
||||
|
||||
static int __init fotg210_init(void)
|
||||
{
|
||||
- if (usb_disabled())
|
||||
- return -ENODEV;
|
||||
-
|
||||
- if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
|
||||
+ if (IS_ENABLED(CONFIG_USB_FOTG210_HCD) && !usb_disabled())
|
||||
fotg210_hcd_init();
|
||||
return platform_driver_register(&fotg210_driver);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
From eaaa85d907fe27852dd960b2bc5d7bcf11bc3ebd Mon Sep 17 00:00:00 2001
|
||||
From: Yang Yingliang <yangyingliang@huawei.com>
|
||||
Date: Fri, 30 Dec 2022 14:54:27 +0800
|
||||
Subject: [PATCH 15/29] usb: fotg210-udc: fix error return code in
|
||||
fotg210_udc_probe()
|
||||
|
||||
After commit 5f217ccd520f ("fotg210-udc: Support optional external PHY"),
|
||||
the error code is re-assigned to 0 in fotg210_udc_probe(), if allocate or
|
||||
map memory fails after the assignment, it can't return an error code. Set
|
||||
the error code to -ENOMEM to fix this problem.
|
||||
|
||||
Fixes: 5f217ccd520f ("fotg210-udc: Support optional external PHY")
|
||||
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20221230065427.944586-1-yangyingliang@huawei.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1214,6 +1214,8 @@ int fotg210_udc_probe(struct platform_de
|
||||
dev_info(dev, "found and initialized PHY\n");
|
||||
}
|
||||
|
||||
+ ret = -ENOMEM;
|
||||
+
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
|
||||
fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
|
||||
if (!fotg210->ep[i])
|
@ -0,0 +1,25 @@
|
||||
From 407577548b2fcd41cc72ee05df1f05a430ed30a0 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 18 Jan 2023 08:09:16 +0100
|
||||
Subject: [PATCH 16/29] usb: fotg210: List different variants
|
||||
|
||||
There are at least two variants of the FOTG: FOTG200 and
|
||||
FOTG210. Handle them in this driver and let's add
|
||||
more quirks as we go along.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-2-100388af9810@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -127,7 +127,9 @@ static int fotg210_remove(struct platfor
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id fotg210_of_match[] = {
|
||||
+ { .compatible = "faraday,fotg200" },
|
||||
{ .compatible = "faraday,fotg210" },
|
||||
+ /* TODO: can we also handle FUSB220? */
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, fotg210_of_match);
|
@ -0,0 +1,245 @@
|
||||
From fa735ad1afeb5791d5562617b9bbed74574d3e81 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 18 Jan 2023 08:09:17 +0100
|
||||
Subject: [PATCH 17/29] usb: fotg210: Acquire memory resource in core
|
||||
|
||||
The subdrivers are obtaining and mapping the memory resource
|
||||
separately. Create a common state container for the shared
|
||||
resources and start populating this by acquiring the IO
|
||||
memory resource and remap it and pass this to the subdrivers
|
||||
for host and peripheral.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-3-100388af9810@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -33,9 +33,10 @@
|
||||
#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 resource *res,
|
||||
+static int fotg210_gemini_init(struct fotg210 *fotg, struct resource *res,
|
||||
enum usb_dr_mode mode)
|
||||
{
|
||||
+ struct device *dev = fotg->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct regmap *map;
|
||||
bool wakeup;
|
||||
@@ -47,6 +48,7 @@ static int fotg210_gemini_init(struct de
|
||||
dev_err(dev, "no syscon\n");
|
||||
return PTR_ERR(map);
|
||||
}
|
||||
+ fotg->map = map;
|
||||
wakeup = of_property_read_bool(np, "wakeup-source");
|
||||
|
||||
/*
|
||||
@@ -55,6 +57,7 @@ static int fotg210_gemini_init(struct de
|
||||
*/
|
||||
mask = 0;
|
||||
if (res->start == 0x69000000) {
|
||||
+ fotg->port = GEMINI_PORT_1;
|
||||
mask = GEMINI_MISC_USB1_VBUS_ON | GEMINI_MISC_USB1_MINI_B |
|
||||
GEMINI_MISC_USB1_WAKEUP;
|
||||
if (mode == USB_DR_MODE_HOST)
|
||||
@@ -64,6 +67,7 @@ static int fotg210_gemini_init(struct de
|
||||
if (wakeup)
|
||||
val |= GEMINI_MISC_USB1_WAKEUP;
|
||||
} else {
|
||||
+ fotg->port = GEMINI_PORT_0;
|
||||
mask = GEMINI_MISC_USB0_VBUS_ON | GEMINI_MISC_USB0_MINI_B |
|
||||
GEMINI_MISC_USB0_WAKEUP;
|
||||
if (mode == USB_DR_MODE_HOST)
|
||||
@@ -89,23 +93,34 @@ static int fotg210_probe(struct platform
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
enum usb_dr_mode mode;
|
||||
+ struct fotg210 *fotg;
|
||||
int ret;
|
||||
|
||||
+ fotg = devm_kzalloc(dev, sizeof(*fotg), GFP_KERNEL);
|
||||
+ if (!fotg)
|
||||
+ return -ENOMEM;
|
||||
+ fotg->dev = dev;
|
||||
+
|
||||
+ fotg->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!fotg->res)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ fotg->base = devm_ioremap_resource(dev, fotg->res);
|
||||
+ if (!fotg->base)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
mode = usb_get_dr_mode(dev);
|
||||
|
||||
if (of_device_is_compatible(dev->of_node, "cortina,gemini-usb")) {
|
||||
- struct resource *res;
|
||||
-
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- ret = fotg210_gemini_init(dev, res, mode);
|
||||
+ ret = fotg210_gemini_init(fotg, fotg->res, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (mode == USB_DR_MODE_PERIPHERAL)
|
||||
- ret = fotg210_udc_probe(pdev);
|
||||
+ ret = fotg210_udc_probe(pdev, fotg);
|
||||
else
|
||||
- ret = fotg210_hcd_probe(pdev);
|
||||
+ ret = fotg210_hcd_probe(pdev, fotg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
--- a/drivers/usb/fotg210/fotg210-hcd.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-hcd.c
|
||||
@@ -5557,11 +5557,10 @@ static void fotg210_init(struct fotg210_
|
||||
* then invokes the start() method for the HCD associated with it
|
||||
* through the hotplug entry's driver_data.
|
||||
*/
|
||||
-int fotg210_hcd_probe(struct platform_device *pdev)
|
||||
+int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct usb_hcd *hcd;
|
||||
- struct resource *res;
|
||||
int irq;
|
||||
int retval;
|
||||
struct fotg210_hcd *fotg210;
|
||||
@@ -5585,18 +5584,14 @@ int fotg210_hcd_probe(struct platform_de
|
||||
|
||||
hcd->has_tt = 1;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- hcd->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
- if (IS_ERR(hcd->regs)) {
|
||||
- retval = PTR_ERR(hcd->regs);
|
||||
- goto failed_put_hcd;
|
||||
- }
|
||||
+ hcd->regs = fotg->base;
|
||||
|
||||
- hcd->rsrc_start = res->start;
|
||||
- hcd->rsrc_len = resource_size(res);
|
||||
+ hcd->rsrc_start = fotg->res->start;
|
||||
+ hcd->rsrc_len = resource_size(fotg->res);
|
||||
|
||||
fotg210 = hcd_to_fotg210(hcd);
|
||||
|
||||
+ fotg210->fotg = fotg;
|
||||
fotg210->caps = hcd->regs;
|
||||
|
||||
/* It's OK not to supply this clock */
|
||||
--- a/drivers/usb/fotg210/fotg210-hcd.h
|
||||
+++ b/drivers/usb/fotg210/fotg210-hcd.h
|
||||
@@ -182,6 +182,7 @@ struct fotg210_hcd { /* one per contro
|
||||
# define INCR(x) do {} while (0)
|
||||
#endif
|
||||
|
||||
+ struct fotg210 *fotg; /* Overarching FOTG210 device */
|
||||
/* silicon clock */
|
||||
struct clk *pclk;
|
||||
};
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1155,21 +1155,14 @@ int fotg210_udc_remove(struct platform_d
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int fotg210_udc_probe(struct platform_device *pdev)
|
||||
+int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg)
|
||||
{
|
||||
- struct resource *res;
|
||||
struct fotg210_udc *fotg210 = NULL;
|
||||
struct device *dev = &pdev->dev;
|
||||
int irq;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- if (!res) {
|
||||
- pr_err("platform_get_resource error.\n");
|
||||
- return -ENODEV;
|
||||
- }
|
||||
-
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
pr_err("could not get irq\n");
|
||||
@@ -1182,6 +1175,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
return -ENOMEM;
|
||||
|
||||
fotg210->dev = dev;
|
||||
+ fotg210->fotg = fotg;
|
||||
|
||||
/* It's OK not to supply this clock */
|
||||
fotg210->pclk = devm_clk_get(dev, "PCLK");
|
||||
@@ -1222,11 +1216,7 @@ int fotg210_udc_probe(struct platform_de
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
- fotg210->reg = ioremap(res->start, resource_size(res));
|
||||
- if (fotg210->reg == NULL) {
|
||||
- dev_err(dev, "ioremap error\n");
|
||||
- goto err_alloc;
|
||||
- }
|
||||
+ fotg210->reg = fotg->base;
|
||||
|
||||
spin_lock_init(&fotg210->lock);
|
||||
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.h
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.h
|
||||
@@ -236,6 +236,7 @@ struct fotg210_udc {
|
||||
unsigned long irq_trigger;
|
||||
|
||||
struct device *dev;
|
||||
+ struct fotg210 *fotg;
|
||||
struct usb_phy *phy;
|
||||
struct usb_gadget gadget;
|
||||
struct usb_gadget_driver *driver;
|
||||
--- a/drivers/usb/fotg210/fotg210.h
|
||||
+++ b/drivers/usb/fotg210/fotg210.h
|
||||
@@ -2,13 +2,28 @@
|
||||
#ifndef __FOTG210_H
|
||||
#define __FOTG210_H
|
||||
|
||||
+enum gemini_port {
|
||||
+ GEMINI_PORT_NONE = 0,
|
||||
+ GEMINI_PORT_0,
|
||||
+ GEMINI_PORT_1,
|
||||
+};
|
||||
+
|
||||
+struct fotg210 {
|
||||
+ struct device *dev;
|
||||
+ struct resource *res;
|
||||
+ void __iomem *base;
|
||||
+ struct regmap *map;
|
||||
+ enum gemini_port port;
|
||||
+};
|
||||
+
|
||||
#ifdef CONFIG_USB_FOTG210_HCD
|
||||
-int fotg210_hcd_probe(struct platform_device *pdev);
|
||||
+int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg);
|
||||
int fotg210_hcd_remove(struct platform_device *pdev);
|
||||
int fotg210_hcd_init(void);
|
||||
void fotg210_hcd_cleanup(void);
|
||||
#else
|
||||
-static inline int fotg210_hcd_probe(struct platform_device *pdev)
|
||||
+static inline int fotg210_hcd_probe(struct platform_device *pdev,
|
||||
+ struct fotg210 *fotg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -26,10 +41,11 @@ static inline void fotg210_hcd_cleanup(v
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_FOTG210_UDC
|
||||
-int fotg210_udc_probe(struct platform_device *pdev);
|
||||
+int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg);
|
||||
int fotg210_udc_remove(struct platform_device *pdev);
|
||||
#else
|
||||
-static inline int fotg210_udc_probe(struct platform_device *pdev)
|
||||
+static inline int fotg210_udc_probe(struct platform_device *pdev,
|
||||
+ struct fotg210 *fotg)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
From fb8e1e8dbc47e7aff7624b47adaa0a84d2983802 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 18 Jan 2023 08:09:18 +0100
|
||||
Subject: [PATCH 18/29] usb: fotg210: Move clock handling to core
|
||||
|
||||
Grab the optional silicon block clock, prepare and enable it in
|
||||
the core before proceeding to prepare the host or peripheral
|
||||
driver. This saves duplicate code and also uses the simple
|
||||
devm_clk_get_optional_enabled() to do everything we really
|
||||
want to do.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-4-100388af9810@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -6,6 +6,7 @@
|
||||
* driver.
|
||||
*/
|
||||
#include <linux/bitops.h>
|
||||
+#include <linux/clk.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
@@ -109,6 +110,10 @@ static int fotg210_probe(struct platform
|
||||
if (!fotg->base)
|
||||
return -ENOMEM;
|
||||
|
||||
+ fotg->pclk = devm_clk_get_optional_enabled(dev, "PCLK");
|
||||
+ if (IS_ERR(fotg->pclk))
|
||||
+ return PTR_ERR(fotg->pclk);
|
||||
+
|
||||
mode = usb_get_dr_mode(dev);
|
||||
|
||||
if (of_device_is_compatible(dev->of_node, "cortina,gemini-usb")) {
|
||||
--- a/drivers/usb/fotg210/fotg210-hcd.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-hcd.c
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
-#include <linux/clk.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/irq.h>
|
||||
@@ -5594,44 +5593,22 @@ int fotg210_hcd_probe(struct platform_de
|
||||
fotg210->fotg = fotg;
|
||||
fotg210->caps = hcd->regs;
|
||||
|
||||
- /* It's OK not to supply this clock */
|
||||
- fotg210->pclk = clk_get(dev, "PCLK");
|
||||
- if (!IS_ERR(fotg210->pclk)) {
|
||||
- retval = clk_prepare_enable(fotg210->pclk);
|
||||
- if (retval) {
|
||||
- dev_err(dev, "failed to enable PCLK\n");
|
||||
- goto failed_put_hcd;
|
||||
- }
|
||||
- } else if (PTR_ERR(fotg210->pclk) == -EPROBE_DEFER) {
|
||||
- /*
|
||||
- * Percolate deferrals, for anything else,
|
||||
- * just live without the clocking.
|
||||
- */
|
||||
- retval = PTR_ERR(fotg210->pclk);
|
||||
- goto failed_dis_clk;
|
||||
- }
|
||||
-
|
||||
retval = fotg210_setup(hcd);
|
||||
if (retval)
|
||||
- goto failed_dis_clk;
|
||||
+ goto failed_put_hcd;
|
||||
|
||||
fotg210_init(fotg210);
|
||||
|
||||
retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
|
||||
if (retval) {
|
||||
dev_err(dev, "failed to add hcd with err %d\n", retval);
|
||||
- goto failed_dis_clk;
|
||||
+ goto failed_put_hcd;
|
||||
}
|
||||
device_wakeup_enable(hcd->self.controller);
|
||||
platform_set_drvdata(pdev, hcd);
|
||||
|
||||
return retval;
|
||||
|
||||
-failed_dis_clk:
|
||||
- if (!IS_ERR(fotg210->pclk)) {
|
||||
- clk_disable_unprepare(fotg210->pclk);
|
||||
- clk_put(fotg210->pclk);
|
||||
- }
|
||||
failed_put_hcd:
|
||||
usb_put_hcd(hcd);
|
||||
fail_create_hcd:
|
||||
@@ -5647,12 +5624,6 @@ fail_create_hcd:
|
||||
int fotg210_hcd_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
||||
- struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd);
|
||||
-
|
||||
- if (!IS_ERR(fotg210->pclk)) {
|
||||
- clk_disable_unprepare(fotg210->pclk);
|
||||
- clk_put(fotg210->pclk);
|
||||
- }
|
||||
|
||||
usb_remove_hcd(hcd);
|
||||
usb_put_hcd(hcd);
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
-#include <linux/clk.h>
|
||||
#include <linux/usb/otg.h>
|
||||
#include <linux/usb/phy.h>
|
||||
|
||||
@@ -1147,9 +1146,6 @@ int fotg210_udc_remove(struct platform_d
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
|
||||
kfree(fotg210->ep[i]);
|
||||
|
||||
- if (!IS_ERR(fotg210->pclk))
|
||||
- clk_disable_unprepare(fotg210->pclk);
|
||||
-
|
||||
kfree(fotg210);
|
||||
|
||||
return 0;
|
||||
@@ -1177,34 +1173,17 @@ int fotg210_udc_probe(struct platform_de
|
||||
fotg210->dev = dev;
|
||||
fotg210->fotg = fotg;
|
||||
|
||||
- /* It's OK not to supply this clock */
|
||||
- fotg210->pclk = devm_clk_get(dev, "PCLK");
|
||||
- if (!IS_ERR(fotg210->pclk)) {
|
||||
- ret = clk_prepare_enable(fotg210->pclk);
|
||||
- if (ret) {
|
||||
- dev_err(dev, "failed to enable PCLK\n");
|
||||
- goto err;
|
||||
- }
|
||||
- } else if (PTR_ERR(fotg210->pclk) == -EPROBE_DEFER) {
|
||||
- /*
|
||||
- * Percolate deferrals, for anything else,
|
||||
- * just live without the clocking.
|
||||
- */
|
||||
- ret = -EPROBE_DEFER;
|
||||
- goto err;
|
||||
- }
|
||||
-
|
||||
fotg210->phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
|
||||
if (IS_ERR(fotg210->phy)) {
|
||||
ret = PTR_ERR(fotg210->phy);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
- goto err_pclk;
|
||||
+ goto err_free;
|
||||
dev_info(dev, "no PHY found\n");
|
||||
fotg210->phy = NULL;
|
||||
} else {
|
||||
ret = usb_phy_init(fotg210->phy);
|
||||
if (ret)
|
||||
- goto err_pclk;
|
||||
+ goto err_free;
|
||||
dev_info(dev, "found and initialized PHY\n");
|
||||
}
|
||||
|
||||
@@ -1303,11 +1282,8 @@ err_map:
|
||||
err_alloc:
|
||||
for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
|
||||
kfree(fotg210->ep[i]);
|
||||
-err_pclk:
|
||||
- if (!IS_ERR(fotg210->pclk))
|
||||
- clk_disable_unprepare(fotg210->pclk);
|
||||
|
||||
-err:
|
||||
+err_free:
|
||||
kfree(fotg210);
|
||||
return ret;
|
||||
}
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.h
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.h
|
||||
@@ -231,7 +231,6 @@ struct fotg210_ep {
|
||||
struct fotg210_udc {
|
||||
spinlock_t lock; /* protect the struct */
|
||||
void __iomem *reg;
|
||||
- struct clk *pclk;
|
||||
|
||||
unsigned long irq_trigger;
|
||||
|
||||
--- a/drivers/usb/fotg210/fotg210.h
|
||||
+++ b/drivers/usb/fotg210/fotg210.h
|
||||
@@ -12,6 +12,7 @@ struct fotg210 {
|
||||
struct device *dev;
|
||||
struct resource *res;
|
||||
void __iomem *base;
|
||||
+ struct clk *pclk;
|
||||
struct regmap *map;
|
||||
enum gemini_port port;
|
||||
};
|
@ -0,0 +1,54 @@
|
||||
From b1b07abb598211de3ce7f52abdf8dcb24384341e Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 18 Jan 2023 08:09:19 +0100
|
||||
Subject: [PATCH 19/29] usb: fotg210: Check role register in core
|
||||
|
||||
Read the role register and check that we are in host/peripheral
|
||||
mode and issue warnings if we're not in the right role when
|
||||
probing respective driver.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-5-100388af9810@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -18,6 +18,11 @@
|
||||
|
||||
#include "fotg210.h"
|
||||
|
||||
+/* Role Register 0x80 */
|
||||
+#define FOTG210_RR 0x80
|
||||
+#define FOTG210_RR_ID BIT(21) /* 1 = B-device, 0 = A-device */
|
||||
+#define FOTG210_RR_CROLE BIT(20) /* 1 = device, 0 = host */
|
||||
+
|
||||
/*
|
||||
* Gemini-specific initialization function, only executed on the
|
||||
* Gemini SoC using the global misc control register.
|
||||
@@ -95,6 +100,7 @@ static int fotg210_probe(struct platform
|
||||
struct device *dev = &pdev->dev;
|
||||
enum usb_dr_mode mode;
|
||||
struct fotg210 *fotg;
|
||||
+ u32 val;
|
||||
int ret;
|
||||
|
||||
fotg = devm_kzalloc(dev, sizeof(*fotg), GFP_KERNEL);
|
||||
@@ -122,10 +128,16 @@ static int fotg210_probe(struct platform
|
||||
return ret;
|
||||
}
|
||||
|
||||
- if (mode == USB_DR_MODE_PERIPHERAL)
|
||||
+ val = readl(fotg->base + FOTG210_RR);
|
||||
+ if (mode == USB_DR_MODE_PERIPHERAL) {
|
||||
+ if (!(val & FOTG210_RR_CROLE))
|
||||
+ dev_err(dev, "block not in device role\n");
|
||||
ret = fotg210_udc_probe(pdev, fotg);
|
||||
- else
|
||||
+ } else {
|
||||
+ if (val & FOTG210_RR_CROLE)
|
||||
+ dev_err(dev, "block not in host role\n");
|
||||
ret = fotg210_hcd_probe(pdev, fotg);
|
||||
+ }
|
||||
|
||||
return ret;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
From d7c2b0b6da75b86cf5ddbcd51a74d74e19bbf178 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 18 Jan 2023 08:09:20 +0100
|
||||
Subject: [PATCH 20/29] usb: fotg210-udc: Assign of_node and speed on start
|
||||
|
||||
Follow the example set by other drivers to assign of_node
|
||||
and speed to the driver when binding, also print bound
|
||||
info akin to other UDC drivers.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-6-100388af9810@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1028,6 +1028,10 @@ static int fotg210_udc_start(struct usb_
|
||||
|
||||
/* hook up the driver */
|
||||
fotg210->driver = driver;
|
||||
+ fotg210->gadget.dev.of_node = fotg210->dev->of_node;
|
||||
+ fotg210->gadget.speed = USB_SPEED_UNKNOWN;
|
||||
+
|
||||
+ dev_info(fotg210->dev, "bound driver %s\n", driver->driver.name);
|
||||
|
||||
if (!IS_ERR_OR_NULL(fotg210->phy)) {
|
||||
ret = otg_set_peripheral(fotg210->phy->otg,
|
||||
@@ -1084,6 +1088,7 @@ static int fotg210_udc_stop(struct usb_g
|
||||
|
||||
fotg210_init(fotg210);
|
||||
fotg210->driver = NULL;
|
||||
+ fotg210->gadget.speed = USB_SPEED_UNKNOWN;
|
||||
|
||||
spin_unlock_irqrestore(&fotg210->lock, flags);
|
||||
|
@ -0,0 +1,96 @@
|
||||
From 2fbbfb2c556944945639b17b13fcb1e05272b646 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 18 Jan 2023 08:09:21 +0100
|
||||
Subject: [PATCH 21/29] usb: fotg210-udc: Implement VBUS session
|
||||
|
||||
Implement VBUS session handling for FOTG210. This is
|
||||
mainly used by the UDC driver which needs to call down to
|
||||
the FOTG210 core and enable/disable VBUS, as this needs to be
|
||||
handled outside of the HCD and UDC drivers, by platform
|
||||
specific glue code.
|
||||
|
||||
The Gemini has a special bit in a system register to turn
|
||||
VBUS on and off so we implement this in the FOTG210 core.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-7-100388af9810@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-core.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-core.c
|
||||
@@ -95,6 +95,35 @@ static int fotg210_gemini_init(struct fo
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * fotg210_vbus() - Called by gadget driver to enable/disable VBUS
|
||||
+ * @enable: true to enable VBUS, false to disable VBUS
|
||||
+ */
|
||||
+void fotg210_vbus(struct fotg210 *fotg, bool enable)
|
||||
+{
|
||||
+ u32 mask;
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
+
|
||||
+ switch (fotg->port) {
|
||||
+ case GEMINI_PORT_0:
|
||||
+ mask = GEMINI_MISC_USB0_VBUS_ON;
|
||||
+ val = enable ? GEMINI_MISC_USB0_VBUS_ON : 0;
|
||||
+ break;
|
||||
+ case GEMINI_PORT_1:
|
||||
+ mask = GEMINI_MISC_USB1_VBUS_ON;
|
||||
+ val = enable ? GEMINI_MISC_USB1_VBUS_ON : 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return;
|
||||
+ }
|
||||
+ ret = regmap_update_bits(fotg->map, GEMINI_GLOBAL_MISC_CTRL, mask, val);
|
||||
+ if (ret)
|
||||
+ dev_err(fotg->dev, "failed to %s VBUS\n",
|
||||
+ enable ? "enable" : "disable");
|
||||
+ dev_info(fotg->dev, "%s: %s VBUS\n", __func__, enable ? "enable" : "disable");
|
||||
+}
|
||||
+
|
||||
static int fotg210_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -1095,9 +1095,26 @@ static int fotg210_udc_stop(struct usb_g
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * fotg210_vbus_session - Called by external transceiver to enable/disable udc
|
||||
+ * @_gadget: usb gadget
|
||||
+ * @is_active: 0 if should disable UDC VBUS, 1 if should enable
|
||||
+ *
|
||||
+ * Returns 0
|
||||
+ */
|
||||
+static int fotg210_vbus_session(struct usb_gadget *g, int is_active)
|
||||
+{
|
||||
+ struct fotg210_udc *fotg210 = gadget_to_fotg210(g);
|
||||
+
|
||||
+ /* Call down to core integration layer to drive or disable VBUS */
|
||||
+ fotg210_vbus(fotg210->fotg, is_active);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const struct usb_gadget_ops fotg210_gadget_ops = {
|
||||
.udc_start = fotg210_udc_start,
|
||||
.udc_stop = fotg210_udc_stop,
|
||||
+ .vbus_session = fotg210_vbus_session,
|
||||
};
|
||||
|
||||
/**
|
||||
--- a/drivers/usb/fotg210/fotg210.h
|
||||
+++ b/drivers/usb/fotg210/fotg210.h
|
||||
@@ -17,6 +17,8 @@ struct fotg210 {
|
||||
enum gemini_port port;
|
||||
};
|
||||
|
||||
+void fotg210_vbus(struct fotg210 *fotg, bool enable);
|
||||
+
|
||||
#ifdef CONFIG_USB_FOTG210_HCD
|
||||
int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg);
|
||||
int fotg210_hcd_remove(struct platform_device *pdev);
|
@ -0,0 +1,134 @@
|
||||
From f011d1eab23f4c063c5441c0d5a22898adf9145c Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Mon, 23 Jan 2023 08:35:07 +0100
|
||||
Subject: [PATCH 22/29] fotg210-udc: Introduce and use a fotg210_ack_int
|
||||
function
|
||||
|
||||
This is in preparation of support for devices where interrupts are acked
|
||||
differently.
|
||||
|
||||
Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230123073508.2350402-3-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -28,6 +28,14 @@ static const char udc_name[] = "fotg210_
|
||||
static const char * const fotg210_ep_name[] = {
|
||||
"ep0", "ep1", "ep2", "ep3", "ep4"};
|
||||
|
||||
+static void fotg210_ack_int(struct fotg210_udc *fotg210, u32 offset, u32 mask)
|
||||
+{
|
||||
+ u32 value = ioread32(fotg210->reg + offset);
|
||||
+
|
||||
+ value &= ~mask;
|
||||
+ iowrite32(value, fotg210->reg + offset);
|
||||
+}
|
||||
+
|
||||
static void fotg210_disable_fifo_int(struct fotg210_ep *ep)
|
||||
{
|
||||
u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1);
|
||||
@@ -303,8 +311,7 @@ static void fotg210_wait_dma_done(struct
|
||||
goto dma_reset;
|
||||
} while (!(value & DISGR2_DMA_CMPLT));
|
||||
|
||||
- value &= ~DISGR2_DMA_CMPLT;
|
||||
- iowrite32(value, ep->fotg210->reg + FOTG210_DISGR2);
|
||||
+ fotg210_ack_int(ep->fotg210, FOTG210_DISGR2, DISGR2_DMA_CMPLT);
|
||||
return;
|
||||
|
||||
dma_reset:
|
||||
@@ -844,14 +851,6 @@ static void fotg210_ep0in(struct fotg210
|
||||
}
|
||||
}
|
||||
|
||||
-static void fotg210_clear_comabt_int(struct fotg210_udc *fotg210)
|
||||
-{
|
||||
- u32 value = ioread32(fotg210->reg + FOTG210_DISGR0);
|
||||
-
|
||||
- value &= ~DISGR0_CX_COMABT_INT;
|
||||
- iowrite32(value, fotg210->reg + FOTG210_DISGR0);
|
||||
-}
|
||||
-
|
||||
static void fotg210_in_fifo_handler(struct fotg210_ep *ep)
|
||||
{
|
||||
struct fotg210_request *req = list_entry(ep->queue.next,
|
||||
@@ -893,60 +892,43 @@ static irqreturn_t fotg210_irq(int irq,
|
||||
void __iomem *reg = fotg210->reg + FOTG210_DISGR2;
|
||||
u32 int_grp2 = ioread32(reg);
|
||||
u32 int_msk2 = ioread32(fotg210->reg + FOTG210_DMISGR2);
|
||||
- u32 value;
|
||||
|
||||
int_grp2 &= ~int_msk2;
|
||||
|
||||
if (int_grp2 & DISGR2_USBRST_INT) {
|
||||
usb_gadget_udc_reset(&fotg210->gadget,
|
||||
fotg210->driver);
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_USBRST_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_USBRST_INT);
|
||||
pr_info("fotg210 udc reset\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_SUSP_INT) {
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_SUSP_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_SUSP_INT);
|
||||
pr_info("fotg210 udc suspend\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_RESM_INT) {
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_RESM_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_RESM_INT);
|
||||
pr_info("fotg210 udc resume\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_ISO_SEQ_ERR_INT) {
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_ISO_SEQ_ERR_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_ISO_SEQ_ERR_INT);
|
||||
pr_info("fotg210 iso sequence error\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_ISO_SEQ_ABORT_INT) {
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_ISO_SEQ_ABORT_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_ISO_SEQ_ABORT_INT);
|
||||
pr_info("fotg210 iso sequence abort\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_TX0BYTE_INT) {
|
||||
fotg210_clear_tx0byte(fotg210);
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_TX0BYTE_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_TX0BYTE_INT);
|
||||
pr_info("fotg210 transferred 0 byte\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_RX0BYTE_INT) {
|
||||
fotg210_clear_rx0byte(fotg210);
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_RX0BYTE_INT;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_RX0BYTE_INT);
|
||||
pr_info("fotg210 received 0 byte\n");
|
||||
}
|
||||
if (int_grp2 & DISGR2_DMA_ERROR) {
|
||||
- value = ioread32(reg);
|
||||
- value &= ~DISGR2_DMA_ERROR;
|
||||
- iowrite32(value, reg);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR2, DISGR2_DMA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +942,7 @@ static irqreturn_t fotg210_irq(int irq,
|
||||
|
||||
/* the highest priority in this source register */
|
||||
if (int_grp0 & DISGR0_CX_COMABT_INT) {
|
||||
- fotg210_clear_comabt_int(fotg210);
|
||||
+ fotg210_ack_int(fotg210, FOTG210_DISGR0, DISGR0_CX_COMABT_INT);
|
||||
pr_info("fotg210 CX command abort\n");
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
From 367747c7813cecf19b46ef7134691f903ab76dc9 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Mon, 23 Jan 2023 08:35:08 +0100
|
||||
Subject: [PATCH 23/29] fotg210-udc: Improve device initialization
|
||||
|
||||
Reset the device explicitly to get into a known state and also set the chip
|
||||
enable bit. Additionally, mask interrupts which aren't handled.
|
||||
|
||||
Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230123073508.2350402-4-linus.walleij@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.c
|
||||
@@ -7,6 +7,7 @@
|
||||
* Author : Yuan-Hsin Chen <yhchen@faraday-tech.com>
|
||||
*/
|
||||
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -1022,6 +1023,11 @@ static int fotg210_udc_start(struct usb_
|
||||
dev_err(fotg210->dev, "can't bind to phy\n");
|
||||
}
|
||||
|
||||
+ /* chip enable */
|
||||
+ value = ioread32(fotg210->reg + FOTG210_DMCR);
|
||||
+ value |= DMCR_CHIP_EN;
|
||||
+ iowrite32(value, fotg210->reg + FOTG210_DMCR);
|
||||
+
|
||||
/* enable device global interrupt */
|
||||
value = ioread32(fotg210->reg + FOTG210_DMCR);
|
||||
value |= DMCR_GLINT_EN;
|
||||
@@ -1038,6 +1044,15 @@ static void fotg210_init(struct fotg210_
|
||||
iowrite32(GMIR_MHC_INT | GMIR_MOTG_INT | GMIR_INT_POLARITY,
|
||||
fotg210->reg + FOTG210_GMIR);
|
||||
|
||||
+ /* mask interrupts for groups other than 0-2 */
|
||||
+ iowrite32(~(DMIGR_MINT_G0 | DMIGR_MINT_G1 | DMIGR_MINT_G2),
|
||||
+ fotg210->reg + FOTG210_DMIGR);
|
||||
+
|
||||
+ /* udc software reset */
|
||||
+ iowrite32(DMCR_SFRST, fotg210->reg + FOTG210_DMCR);
|
||||
+ /* Better wait a bit, but without a datasheet, no idea how long. */
|
||||
+ usleep_range(100, 200);
|
||||
+
|
||||
/* disable device global interrupt */
|
||||
value = ioread32(fotg210->reg + FOTG210_DMCR);
|
||||
value &= ~DMCR_GLINT_EN;
|
||||
--- a/drivers/usb/fotg210/fotg210-udc.h
|
||||
+++ b/drivers/usb/fotg210/fotg210-udc.h
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
/* Device Mask of Interrupt Group Register (0x130) */
|
||||
#define FOTG210_DMIGR 0x130
|
||||
+#define DMIGR_MINT_G2 (1 << 2)
|
||||
+#define DMIGR_MINT_G1 (1 << 1)
|
||||
#define DMIGR_MINT_G0 (1 << 0)
|
||||
|
||||
/* Device Mask of Interrupt Source Group 0(0x134) */
|
@ -0,0 +1,32 @@
|
||||
From 482830a70408a5d30af264b3d6706f818c78b2b2 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
Date: Fri, 20 Jan 2023 17:44:33 +0200
|
||||
Subject: [PATCH 24/29] usb: fotg210-hcd: use sysfs_emit() to instead of
|
||||
scnprintf()
|
||||
|
||||
Follow the advice of the Documentation/filesystems/sysfs.rst and show()
|
||||
should only use sysfs_emit() or sysfs_emit_at() when formatting the
|
||||
value to be returned to user space.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
Link: https://lore.kernel.org/r/20230120154437.22025-1-andriy.shevchenko@linux.intel.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
--- a/drivers/usb/fotg210/fotg210-hcd.c
|
||||
+++ b/drivers/usb/fotg210/fotg210-hcd.c
|
||||
@@ -4686,14 +4686,11 @@ static ssize_t uframe_periodic_max_show(
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct fotg210_hcd *fotg210;
|
||||
- int n;
|
||||
|
||||
fotg210 = hcd_to_fotg210(bus_to_hcd(dev_get_drvdata(dev)));
|
||||
- n = scnprintf(buf, PAGE_SIZE, "%d\n", fotg210->uframe_periodic_max);
|
||||
- return n;
|
||||
+ return sysfs_emit(buf, "%d\n", fotg210->uframe_periodic_max);
|
||||
}
|
||||
|
||||
-
|
||||
static ssize_t uframe_periodic_max_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
@ -0,0 +1,62 @@
|
||||
From 6b84aa39a063eec883d410a9893cec70fce56163 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Sun, 4 Dec 2022 20:02:28 +0100
|
||||
Subject: [PATCH 25/29] ARM: dts: gemini: Push down flash address/size cells
|
||||
|
||||
The platforms not defining any OF partions complain like
|
||||
this:
|
||||
|
||||
../arch/arm/boot/dts/gemini.dtsi:19.25-28.5: Warning
|
||||
(avoid_unnecessary_addr_size): /soc/flash@30000000: unnecessary
|
||||
#address-cells/#size-cells without "ranges" or child "reg" property
|
||||
|
||||
Get rid of this by only defining the address-cells and
|
||||
size-cells where it is actually used by OF partitions.
|
||||
|
||||
Link: https://lore.kernel.org/r/20221204190230.3345590-1-linus.walleij@linaro.org
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
--- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts
|
||||
@@ -164,6 +164,8 @@
|
||||
compatible = "cortina,gemini-flash", "jedec-flash";
|
||||
status = "okay";
|
||||
reg = <0x30000000 0x00080000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
|
||||
/*
|
||||
* This "RedBoot" is the Storlink derivative.
|
||||
--- a/arch/arm/boot/dts/gemini-wbd111.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-wbd111.dts
|
||||
@@ -86,6 +86,8 @@
|
||||
status = "okay";
|
||||
/* 8MB of flash */
|
||||
reg = <0x30000000 0x00800000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "RedBoot";
|
||||
--- a/arch/arm/boot/dts/gemini-wbd222.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-wbd222.dts
|
||||
@@ -90,6 +90,8 @@
|
||||
status = "okay";
|
||||
/* 8MB of flash */
|
||||
reg = <0x30000000 0x00800000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "RedBoot";
|
||||
--- a/arch/arm/boot/dts/gemini.dtsi
|
||||
+++ b/arch/arm/boot/dts/gemini.dtsi
|
||||
@@ -22,8 +22,6 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pflash_default_pins>;
|
||||
bank-width = <2>;
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 0e733f5af628210f372585e431504a7024e7b571 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Sun, 4 Dec 2022 20:02:29 +0100
|
||||
Subject: [PATCH 26/29] ARM: dts: gemini: wbd111: Use RedBoot partion parser
|
||||
|
||||
This is clearly a RedBoot partitioned device with 0x20000
|
||||
sized erase blocks.
|
||||
|
||||
Link: https://lore.kernel.org/r/20221204190230.3345590-2-linus.walleij@linaro.org
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
--- a/arch/arm/boot/dts/gemini-wbd111.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-wbd111.dts
|
||||
@@ -86,36 +86,11 @@
|
||||
status = "okay";
|
||||
/* 8MB of flash */
|
||||
reg = <0x30000000 0x00800000>;
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <1>;
|
||||
|
||||
- partition@0 {
|
||||
- label = "RedBoot";
|
||||
- reg = <0x00000000 0x00020000>;
|
||||
- read-only;
|
||||
- };
|
||||
- partition@20000 {
|
||||
- label = "kernel";
|
||||
- reg = <0x00020000 0x00100000>;
|
||||
- };
|
||||
- partition@120000 {
|
||||
- label = "rootfs";
|
||||
- reg = <0x00120000 0x006a0000>;
|
||||
- };
|
||||
- partition@7c0000 {
|
||||
- label = "VCTL";
|
||||
- reg = <0x007c0000 0x00010000>;
|
||||
- read-only;
|
||||
- };
|
||||
- partition@7d0000 {
|
||||
- label = "cfg";
|
||||
- reg = <0x007d0000 0x00010000>;
|
||||
- read-only;
|
||||
- };
|
||||
- partition@7e0000 {
|
||||
- label = "FIS";
|
||||
- reg = <0x007e0000 0x00010000>;
|
||||
- read-only;
|
||||
+ partitions {
|
||||
+ compatible = "redboot-fis";
|
||||
+ /* Eraseblock at 0x7e0000 */
|
||||
+ fis-index-block = <0x3f>;
|
||||
};
|
||||
};
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 8558e2e1110a5daa4ac9e1c5b5c15e1651a8fb94 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Sun, 4 Dec 2022 20:02:30 +0100
|
||||
Subject: [PATCH 27/29] ARM: dts: gemini: wbd222: Use RedBoot partion parser
|
||||
|
||||
This is clearly a RedBoot partitioned device with 0x20000
|
||||
sized erase blocks.
|
||||
|
||||
Link: https://lore.kernel.org/r/20221204190230.3345590-3-linus.walleij@linaro.org
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
--- a/arch/arm/boot/dts/gemini-wbd222.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-wbd222.dts
|
||||
@@ -90,36 +90,11 @@
|
||||
status = "okay";
|
||||
/* 8MB of flash */
|
||||
reg = <0x30000000 0x00800000>;
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <1>;
|
||||
|
||||
- partition@0 {
|
||||
- label = "RedBoot";
|
||||
- reg = <0x00000000 0x00020000>;
|
||||
- read-only;
|
||||
- };
|
||||
- partition@20000 {
|
||||
- label = "kernel";
|
||||
- reg = <0x00020000 0x00100000>;
|
||||
- };
|
||||
- partition@120000 {
|
||||
- label = "rootfs";
|
||||
- reg = <0x00120000 0x006a0000>;
|
||||
- };
|
||||
- partition@7c0000 {
|
||||
- label = "VCTL";
|
||||
- reg = <0x007c0000 0x00010000>;
|
||||
- read-only;
|
||||
- };
|
||||
- partition@7d0000 {
|
||||
- label = "cfg";
|
||||
- reg = <0x007d0000 0x00010000>;
|
||||
- read-only;
|
||||
- };
|
||||
- partition@7e0000 {
|
||||
- label = "FIS";
|
||||
- reg = <0x007e0000 0x00010000>;
|
||||
- read-only;
|
||||
+ partitions {
|
||||
+ compatible = "redboot-fis";
|
||||
+ /* Eraseblock at 0x7e0000 */
|
||||
+ fis-index-block = <0x3f>;
|
||||
};
|
||||
};
|
||||
|
@ -0,0 +1,31 @@
|
||||
From d5c01ce4a1016507c69682894cf6b66301abca3d Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 23 Jan 2023 08:39:15 +0100
|
||||
Subject: [PATCH 28/29] ARM: dts: gemini: Fix USB block version
|
||||
|
||||
The FOTG version in the Gemini is the FOTG200, fix this
|
||||
up.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230123073916.2350839-1-linus.walleij@linaro.org
|
||||
---
|
||||
--- a/arch/arm/boot/dts/gemini.dtsi
|
||||
+++ b/arch/arm/boot/dts/gemini.dtsi
|
||||
@@ -439,7 +439,7 @@
|
||||
};
|
||||
|
||||
usb0: usb@68000000 {
|
||||
- compatible = "cortina,gemini-usb", "faraday,fotg210";
|
||||
+ compatible = "cortina,gemini-usb", "faraday,fotg200";
|
||||
reg = <0x68000000 0x1000>;
|
||||
interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
|
||||
resets = <&syscon GEMINI_RESET_USB0>;
|
||||
@@ -460,7 +460,7 @@
|
||||
};
|
||||
|
||||
usb1: usb@69000000 {
|
||||
- compatible = "cortina,gemini-usb", "faraday,fotg210";
|
||||
+ compatible = "cortina,gemini-usb", "faraday,fotg200";
|
||||
reg = <0x69000000 0x1000>;
|
||||
interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
|
||||
resets = <&syscon GEMINI_RESET_USB1>;
|
@ -0,0 +1,54 @@
|
||||
From 296184694ae7a4e388603c95499e98d30b21cc09 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 23 Jan 2023 08:39:16 +0100
|
||||
Subject: [PATCH 29/29] ARM: dts: gemini: Enable DNS313 FOTG210 as periph
|
||||
|
||||
Add the GPIO-based VBUS phy, and enable the FOTG210
|
||||
USB1 block for use as peripheral.
|
||||
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230123073916.2350839-2-linus.walleij@linaro.org
|
||||
---
|
||||
--- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts
|
||||
+++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts
|
||||
@@ -80,6 +80,15 @@
|
||||
#cooling-cells = <2>;
|
||||
};
|
||||
|
||||
+ /*
|
||||
+ * This is the type B USB connector on the device,
|
||||
+ * a GPIO-controlled USB VBUS detect
|
||||
+ */
|
||||
+ usb1_phy: phy {
|
||||
+ compatible = "gpio-usb-b-connector", "usb-b-connector";
|
||||
+ #phy-cells = <0>;
|
||||
+ vbus-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
|
||||
/* Global Mixed-Mode Technology G751 mounted on GPIO I2C */
|
||||
i2c {
|
||||
@@ -302,5 +311,13 @@
|
||||
ide@63000000 {
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+ usb@69000000 {
|
||||
+ status = "okay";
|
||||
+ dr_mode = "peripheral";
|
||||
+ usb-phy = <&usb1_phy>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&usb_default_pins>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
--- a/arch/arm/boot/dts/gemini.dtsi
|
||||
+++ b/arch/arm/boot/dts/gemini.dtsi
|
||||
@@ -455,6 +455,8 @@
|
||||
*/
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&usb_default_pins>;
|
||||
+ /* Default to host mode */
|
||||
+ dr_mode = "host";
|
||||
syscon = <&syscon>;
|
||||
status = "disabled";
|
||||
};
|
@ -0,0 +1,34 @@
|
||||
From 36ee838bf83c01cff7cb47c7b07be278d2950ac0 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Mon, 11 Mar 2019 15:44:29 +0100
|
||||
Subject: [PATCH 2/2] 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 <linus.walleij@linaro.org>
|
||||
---
|
||||
--- 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";
|
||||
};
|
||||
|
||||
@@ -317,9 +317,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 {
|
@ -2076,7 +2076,6 @@ CONFIG_FORTIFY_SOURCE=y
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
|
||||
# CONFIG_FRAME_POINTER is not set
|
||||
CONFIG_FRAME_WARN=1024
|
||||
# CONFIG_FREEZER is not set
|
||||
# CONFIG_FRONTSWAP is not set
|
||||
# CONFIG_FSCACHE is not set
|
||||
|
@ -2164,7 +2164,6 @@ CONFIG_FORTIFY_SOURCE=y
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
|
||||
# CONFIG_FRAME_POINTER is not set
|
||||
CONFIG_FRAME_WARN=1024
|
||||
# CONFIG_FREEZER is not set
|
||||
# CONFIG_FRONTSWAP is not set
|
||||
# CONFIG_FSCACHE is not set
|
||||
|
@ -82,6 +82,7 @@ ipq40xx_setup_interfaces()
|
||||
ucidef_set_interface_lan "sw-eth1 sw-eth2"
|
||||
;;
|
||||
aruba,ap-303h|\
|
||||
buffalo,wtr-m2133hp|\
|
||||
ezviz,cs-w3-wd1200g-eup|\
|
||||
netgear,rbr50|\
|
||||
netgear,rbs50|\
|
||||
|
@ -417,6 +417,35 @@
|
||||
qcom,ath10k-calibration-variant = "Buffalo-WTR-M2133HP";
|
||||
};
|
||||
|
||||
&switch {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&swport2 {
|
||||
status = "okay";
|
||||
label = "lan3";
|
||||
};
|
||||
|
||||
&swport3 {
|
||||
status = "okay";
|
||||
label = "lan2";
|
||||
};
|
||||
|
||||
&swport4 {
|
||||
status = "okay";
|
||||
label = "lan1";
|
||||
};
|
||||
|
||||
&swport5 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gmac {
|
||||
status = "okay";
|
||||
nvmem-cell-names = "mac-address";
|
||||
nvmem-cells = <&macaddr_orgdata_20>;
|
||||
};
|
||||
|
||||
&mdio {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&mdio_pins>;
|
||||
|
@ -305,8 +305,7 @@ define Device/buffalo_wtr-m2133hp
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
endef
|
||||
# Missing DSA Setup
|
||||
#TARGET_DEVICES += buffalo_wtr-m2133hp
|
||||
TARGET_DEVICES += buffalo_wtr-m2133hp
|
||||
|
||||
define Device/cellc_rtl30vw
|
||||
KERNEL_SUFFIX := -zImage.itb
|
||||
|
@ -245,7 +245,7 @@ define Device/nec_wg2600hp3
|
||||
pad-rootfs | append-metadata
|
||||
DEVICE_PACKAGES := -kmod-ata-ahci -kmod-ata-ahci-platform \
|
||||
-kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \
|
||||
-kmod-usb-phy-qcom-dwc3 -kmod-usb3 -kmod-usb-dwc3-qcom \
|
||||
-kmod-phy-qcom-ipq806x-usb -kmod-usb3 -kmod-usb-dwc3-qcom \
|
||||
ath10k-firmware-qca9984-ct
|
||||
endef
|
||||
TARGET_DEVICES += nec_wg2600hp3
|
||||
|
@ -0,0 +1,36 @@
|
||||
From f5aaf6669bd4f1f0218dd7fd5dc90941267ad860 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robimarko@gmail.com>
|
||||
Date: Tue, 30 May 2023 23:26:30 +0200
|
||||
Subject: [PATCH] mmc: core: disable TRIM on Micron MTFC4GACAJCN-1M
|
||||
|
||||
It seems that Micron MTFC4GACAJCN-1M despite advertising TRIM support does
|
||||
not work when the core is trying to use REQ_OP_WRITE_ZEROES.
|
||||
|
||||
We are seeing the following errors in OpenWrt under 6.1 on Qnap Qhora 301W
|
||||
that we did not previously have and tracked it down to REQ_OP_WRITE_ZEROES:
|
||||
[ 18.085950] I/O error, dev loop0, sector 596 op 0x9:(WRITE_ZEROES) flags 0x800 phys_seg 0 prio class 2
|
||||
|
||||
Disabling TRIM makes the error go away, so lets add a quirk for this eMMC
|
||||
to disable TRIM.
|
||||
|
||||
Signed-off-by: Robert Marko <robimarko@gmail.com>
|
||||
---
|
||||
drivers/mmc/core/quirks.h | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/mmc/core/quirks.h
|
||||
+++ b/drivers/mmc/core/quirks.h
|
||||
@@ -101,6 +101,13 @@ static const struct mmc_fixup __maybe_un
|
||||
MMC_QUIRK_TRIM_BROKEN),
|
||||
|
||||
/*
|
||||
+ * Micron MTFC4GACAJCN-1M advertises TRIM but it does not seems to
|
||||
+ * support being used to offload WRITE_ZEROES.
|
||||
+ */
|
||||
+ MMC_FIXUP("Q2J54A", CID_MANFID_MICRON, 0x014e, add_quirk_mmc,
|
||||
+ MMC_QUIRK_TRIM_BROKEN),
|
||||
+
|
||||
+ /*
|
||||
* Some SD cards reports discard support while they don't
|
||||
*/
|
||||
MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
|
@ -0,0 +1,38 @@
|
||||
From 26c97b6fb7d291f55e0e4a410d266d1355118ed9 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robimarko@gmail.com>
|
||||
Date: Wed, 31 May 2023 20:21:26 +0200
|
||||
Subject: [PATCH] mmc: core: disable TRIM on Kingston EMMC04G-M627
|
||||
|
||||
It seems that Kingston EMMC04G-M627 despite advertising TRIM support does
|
||||
not work when the core is trying to use REQ_OP_WRITE_ZEROES.
|
||||
|
||||
We are seeing I/O errors in OpenWrt under 6.1 on Zyxel NBG7815 that we did
|
||||
not previously have and tracked it down to REQ_OP_WRITE_ZEROES.
|
||||
|
||||
Trying to use fstrim seems to also throw errors like:
|
||||
[93010.835112] I/O error, dev loop0, sector 16902 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 2
|
||||
|
||||
Disabling TRIM makes the error go away, so lets add a quirk for this eMMC
|
||||
to disable TRIM.
|
||||
|
||||
Signed-off-by: Robert Marko <robimarko@gmail.com>
|
||||
---
|
||||
drivers/mmc/core/quirks.h | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/mmc/core/quirks.h
|
||||
+++ b/drivers/mmc/core/quirks.h
|
||||
@@ -108,6 +108,13 @@ static const struct mmc_fixup __maybe_un
|
||||
MMC_QUIRK_TRIM_BROKEN),
|
||||
|
||||
/*
|
||||
+ * Kingston EMMC04G-M627 advertises TRIM but it does not seems to
|
||||
+ * support being used to offload WRITE_ZEROES.
|
||||
+ */
|
||||
+ MMC_FIXUP("M62704", CID_MANFID_KINGSTON, 0x0100, add_quirk_mmc,
|
||||
+ MMC_QUIRK_TRIM_BROKEN),
|
||||
+
|
||||
+ /*
|
||||
* Some SD cards reports discard support while they don't
|
||||
*/
|
||||
MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
|
@ -269,7 +269,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
|
||||
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
CONFIG_FREEZER=y
|
||||
# CONFIG_FSL_BMAN_TEST is not set
|
||||
CONFIG_FSL_DPAA=y
|
||||
|
@ -1,44 +0,0 @@
|
||||
# This must be sourced after 30_uboot-envtools
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
cznic,turris-omnia)
|
||||
# Do nothing if this is not the old U-Boot
|
||||
grep -q 'U-Boot 2015.10-rc2' /dev/mtd0 || exit 0
|
||||
# Do nothing if we already have distro_bootcmd
|
||||
fw_printenv distro_bootcmd >/dev/null 2>/dev/null && exit 0
|
||||
# Set the complete environment, since U-Boot does not merge the default environment from its own image!
|
||||
fw_setenv -s - <<-"EOF"
|
||||
baudrate 115200
|
||||
bootdelay 3
|
||||
ethact neta2
|
||||
fdt_high 0x10000000
|
||||
initrd_high 0x10000000
|
||||
bootargs earlyprintk console=ttyS0,115200 rootfstype=btrfs rootdelay=2 root=b301 rootflags=subvol=@,commit=5 rw
|
||||
bootcmd i2c dev 1; i2c read 0x2a 0x9 1 0x00FFFFF0; setexpr.b rescue *0x00FFFFF0; if test $rescue -ge 1; then echo BOOT RESCUE; run rescueboot; else echo BOOT eMMC FS; run mmcboot; setenv bootargs; run distro_bootcmd; fi
|
||||
rescueboot i2c mw 0x2a.1 0x3 0x1c 1; i2c mw 0x2a.1 0x4 0x1c 1; mw.l 0x01000000 0x00ff000c; i2c write 0x01000000 0x2a.1 0x5 4 -s; setenv bootargs "$bootargs omniarescue=$rescue"; sf probe; sf read 0x1000000 0x100000 0x700000; bootz 0x1000000
|
||||
mmcboot btrload mmc 0 ${kernel_addr_r} boot/zImage @ && btrload mmc 0 ${fdt_addr_r} boot/dtb @ && setenv bootargs ${bootargs} cfg80211.freg=${regdomain} && bootz ${kernel_addr_r} - ${fdt_addr_r}
|
||||
kernel_addr_r 0x1000000
|
||||
scriptaddr 0x1800000
|
||||
fdt_addr_r 0x2000000
|
||||
boot_targets mmc0 scsi0
|
||||
boot_prefixes / /boot/
|
||||
boot_scripts boot.scr
|
||||
distro_bootcmd scsi_need_init=true; for target in ${boot_targets}; do run bootcmd_${target}; done
|
||||
bootcmd_mmc0 devnum=0; run mmc_boot
|
||||
mmc_boot if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
|
||||
bootcmd_scsi0 devnum=0; run scsi_boot
|
||||
scsi_boot run scsi_init; if scsi dev ${devnum}; then devtype=scsi; run scan_dev_for_boot_part; fi
|
||||
scsi_init if ${scsi_need_init}; then scsi_need_init=false; scsi scan; fi
|
||||
scan_dev_for_boot_part for distro_bootpart in 1; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
|
||||
scan_dev_for_boot echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_scripts; done
|
||||
scan_dev_for_scripts for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
|
||||
boot_a_script load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -136,17 +136,6 @@ define Build/sdcard-img-ext4
|
||||
83 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS)
|
||||
endef
|
||||
|
||||
define Build/omnia-medkit-initramfs
|
||||
$(TAR) -c -T /dev/null -f $@
|
||||
rm -rf $(dir $(IMAGE_KERNEL))boot
|
||||
mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
|
||||
cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
|
||||
cp $(KDIR)/image-$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
|
||||
$(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
|
||||
$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
|
||||
--file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
|
||||
endef
|
||||
|
||||
define Build/uDPU-firmware
|
||||
(rm -fR $@-fw; mkdir -p $@-fw)
|
||||
$(CP) $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-initramfs.itb $@-fw/recovery.itb
|
||||
|
@ -88,10 +88,8 @@ define Device/cznic_turris-omnia
|
||||
mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \
|
||||
wpad-basic-openssl kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \
|
||||
partx-utils kmod-i2c-mux-pca954x kmod-leds-turris-omnia
|
||||
IMAGES := $$(DEVICE_IMG_PREFIX)-sysupgrade.img.gz omnia-medkit-$$(DEVICE_IMG_PREFIX)-initramfs.tar.gz
|
||||
IMAGE/$$(DEVICE_IMG_PREFIX)-sysupgrade.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata
|
||||
IMAGE/omnia-medkit-$$(DEVICE_IMG_PREFIX)-initramfs.tar.gz := omnia-medkit-initramfs | gzip
|
||||
DEVICE_IMG_NAME = $$(2)
|
||||
IMAGES := sysupgrade.img.gz
|
||||
IMAGE/sysupgrade.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata
|
||||
SUPPORTED_DEVICES += armada-385-turris-omnia
|
||||
BOOT_SCRIPT := turris-omnia
|
||||
endef
|
||||
|
@ -70,7 +70,6 @@ CONFIG_EXT4_FS=y
|
||||
CONFIG_F2FS_FS=y
|
||||
CONFIG_FAT_FS=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
CONFIG_FWNODE_MDIO=y
|
||||
|
@ -247,7 +247,6 @@ CONFIG_FIXED_PHY=y
|
||||
CONFIG_FIX_EARLYCON_MEM=y
|
||||
# CONFIG_FORTIFY_SOURCE is not set
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
CONFIG_FS_POSIX_ACL=y
|
||||
|
@ -93,7 +93,6 @@ CONFIG_FONT_AUTOSELECT=y
|
||||
CONFIG_FONT_SUPPORT=y
|
||||
CONFIG_FPU=y
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
CONFIG_FWNODE_MDIO=y
|
||||
|
@ -168,7 +168,6 @@ CONFIG_FONT_SUPPORT=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
|
||||
CONFIG_FRAME_WARN=2048
|
||||
CONFIG_FREEZER=y
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
|
@ -2,23 +2,6 @@
|
||||
#
|
||||
# Copyright (C) 2017 Cezary Jackiewicz <cezary@eko.one.pll>
|
||||
|
||||
define KernelPackage/amazon-ena
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Elastic Network Adapter (for Amazon AWS T3)
|
||||
DEPENDS:=@TARGET_x86_64
|
||||
KCONFIG:=CONFIG_ENA_ETHERNET
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko
|
||||
AUTOLOAD:=$(call AutoLoad,12,ena)
|
||||
endef
|
||||
|
||||
define KernelPackage/amazon-ena/description
|
||||
This driver supports Elastic Network Adapter (ENA)
|
||||
used by Amazon AWS T3 instances.
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,amazon-ena))
|
||||
|
||||
|
||||
define KernelPackage/amd-xgbe
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=AMD Ethernet on SoC support
|
||||
|
Loading…
x
Reference in New Issue
Block a user