Open mani9876 opened 1 year ago
Gadget modules are present but OTG module is not built? https://www.kernel.org/doc/html/latest/usb/chipidea.html
Gadget modules are present but OTG module is not built? https://www.kernel.org/doc/html/latest/usb/chipidea.html
Hello!
I have all modules available to install (kmod-usb-chipidea, kmod-usb-gadget*) But I don't get any entry in /sys/class/udc
and also no /sys/kernel/debug/ci_hdrc
directory:
root@OpenWrt:~# ls -la /sys/class/udc
drwxr-xr-x 2 root root 0 May 30 06:29 .
drwxr-xr-x 30 root root 0 Jan 1 1970 ..
root@OpenWrt:~# ls -la /sys/kernel/debug/
drwx------ 16 root root 0 Jan 1 1970 .
drwxr-xr-x 8 root root 0 Apr 27 20:29 ..
drwxr-xr-x 4 root root 0 Jan 1 1970 ag71xx
drwxr-xr-x 10 root root 0 Jan 1 1970 bdi
drwxr-xr-x 9 root root 0 Jan 1 1970 block
--w------- 1 root root 0 Jan 1 1970 clear_warn_once
drwxr-xr-x 6 root root 0 Jan 1 1970 clk
drwxr-xr-x 2 root root 0 Jan 1 1970 device_component
-r--r--r-- 1 root root 0 Jan 1 1970 devices_deferred
drwxr-xr-x 2 root root 0 Jan 1 1970 dynamic_debug
drwxr-xr-x 2 root root 0 Jan 1 1970 extfrag
-rw-r--r-- 1 root root 0 Jan 1 1970 fault_around_bytes
-r--r--r-- 1 root root 0 Jan 1 1970 gpio
drwxr-xr-x 3 root root 0 Apr 27 20:29 ieee80211
drwxr-xr-x 2 root root 0 Jan 1 1970 mips
drwxr-xr-x 9 root root 0 Jan 1 1970 mtd
drwxr-xr-x 3 root root 0 Jan 1 1970 pinctrl
drwxr-xr-x 4 root root 0 Jan 1 1970 regmap
drwxr-xr-x 3 root root 0 Jan 1 1970 regulator
-r--r--r-- 1 root root 0 Jan 1 1970 sleep_time
drwxr-xr-x 2 root root 0 Jan 1 1970 usb
Kernel doc says its usb-otg-fsm module needed, that is certainly not built. Try to modprobe chipidea module and have a look in /proc/module if it is ok.
Kernel doc says its usb-otg-fsm module needed, that is certainly not built. Try to modprobe chipidea module and have a look in /proc/module if it is ok.
Hello, thanks for your reply!
I may be wrong - but there is no module chipidea, or usb-otg-fsm available
root@OpenWrt:/lib/modules/5.10.176# ls
ath.ko nf_defrag_ipv4.ko nft_masq.ko
ath9k.ko nf_defrag_ipv6.ko nft_nat.ko
ath9k_common.ko nf_flow_table.ko nft_numgen.ko
ath9k_hw.ko nf_flow_table_inet.ko nft_objref.ko
cfg80211.ko nf_flow_table_ipv4.ko nft_quota.ko
ci_hdrc.ko nf_flow_table_ipv6.ko nft_redir.ko
cmac.ko nf_log_common.ko nft_reject.ko
compat.ko nf_log_ipv4.ko nft_reject_inet.ko
configfs.ko nf_log_ipv6.ko nft_reject_ipv4.ko
crc-ccitt.ko nf_nat.ko nft_reject_ipv6.ko
crc32c_generic.ko nf_reject_ipv4.ko nls_base.ko
drbg.ko nf_reject_ipv6.ko phy-generic.ko
ehci-fsl.ko nf_tables.ko ppp_async.ko
ehci-hcd.ko nfnetlink.ko ppp_generic.ko
ehci-platform.ko nft_chain_nat.ko pppoe.ko
fsl-mph-dr-of.ko nft_counter.ko pppox.ko
g_mass_storage.ko nft_ct.ko roles.ko
gpio-button-hotplug.ko nft_fib.ko seqiv.ko
hmac.ko nft_fib_inet.ko sha256_generic.ko
jitterentropy_rng.ko nft_fib_ipv4.ko slhc.ko
libcomposite.ko nft_fib_ipv6.ko udc-core.ko
libcrc32c.ko nft_flow_offload.ko ulpi.ko
libsha256.ko nft_hash.ko usb-common.ko
mac80211.ko nft_limit.ko usb_f_mass_storage.ko
nf_conntrack.ko nft_log.ko usbcore.ko
Or do you mean de ci_hdrc module? It's loaded, but no change:
root@OpenWrt:/lib/modules/5.10.176# modprobe ci_hdrc
root@OpenWrt:/sys/class/udc# cat /proc/modules | grep ci_hdrc
ci_hdrc 32240 0 - Live 0x00000000
ulpi 2048 1 ci_hdrc, Live 0x00000000
roles 3024 1 ci_hdrc, Live 0x00000000
udc_core 9904 3 usb_f_mass_storage,libcomposite,ci_hdrc, Live 0x00000000
ehci_hcd 38128 3 ci_hdrc,ehci_platform,ehci_fsl, Live 0x00000000
usbcore 146432 4 ci_hdrc,ehci_platform,ehci_fsl,ehci_hcd, Live 0x00000000
usb_common 3184 5 libcomposite,ci_hdrc,udc_core,ehci_platform,usbcore, Live 0x00000000
root@OpenWrt:/sys/class/udc# ls -la
drwxr-xr-x 2 root root 0 Apr 27 20:30 .
drwxr-xr-x 30 root root 0 Jan 1 1970 ..
or usb-otg-fsm available
Upstream kernel discusses that to support particular controller.
or usb-otg-fsm available
Upstream kernel discusses that to support particular controller.
Hello, can you give me a hint on how to implement the function on my own? What files are missing in the build? Or do you know when a patch will be available?
in package/kernel/linux/modules/usb.mk you need to add package for otg-fsm module which is to allow reversing USB port.
Hello, thank you for the hint! but I am not able to find ane otg-fsm package in usb.mk. I've also downloaded OpenWRT v19 and I am not able to find the otg-fsm module, and also no Kconfig file. Would you be so kind and give me some more infos?
Thanks!
otg.c in chipidea directory at least in current kernel
otg.c in chipidea directory at least in current kernel
You are right, but I can see that the Makefile in the chipidea directory is already including otg.o/otgfsm.o or am I wrong?
manuel@debian:~/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_tiny/linux-5.10.176/drivers/usb/chipidea$ cat Makefile
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
ci_hdrc-y := core.o otg.o debug.o ulpi.o
ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o
ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o
ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
# Glue/Bridge layers go here
obj-$(CONFIG_USB_CHIPIDEA_GENERIC) += ci_hdrc_usb2.o
obj-$(CONFIG_USB_CHIPIDEA_MSM) += ci_hdrc_msm.o
obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o
obj-$(CONFIG_USB_CHIPIDEA_IMX) += ci_hdrc_imx.o usbmisc_imx.o
obj-$(CONFIG_USB_CHIPIDEA_TEGRA) += ci_hdrc_tegra.o
It depends on config options at kernel toplevel.
It depends on config options at kernel toplevel.
I added "CONFIG_USB_OTG_FSM=y" in the usb.mk usb-chipidea definition, like this:
define KernelPackage/usb-chipidea
TITLE:=Host and device support for Chipidea controllers
DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ath79 +kmod-usb-ehci +kmod-usb-phy-nop +kmod-usb-roles
KCONFIG:= \
CONFIG_EXTCON \
CONFIG_USB_CHIPIDEA \
CONFIG_USB_CHIPIDEA_GENERIC \
CONFIG_USB_CHIPIDEA_HOST=y \
CONFIG_USB_CHIPIDEA_UDC=y \
CONFIG_USB_CHIPIDEA_DEBUG=y \
CONFIG_USB_OTG_FSM=y
FILES:= \
$(LINUX_DIR)/drivers/extcon/extcon-core.ko \
$(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \
$(LINUX_DIR)/drivers/usb/common/ulpi.ko
AUTOLOAD:=$(call AutoLoad,39,ci_hdrc,1)
$(call AddDepends/usb)
endef
But still no luck, wasn't this what you meant?
Thanks!
Thays what upstream kernel doc says, probably try all options on?
Remove line 197 or change it to dr_mode = "otg";
should has some help.
And you need to build your own firmware from the source. Image builder may not work.
https://github.com/openwrt/openwrt/blob/598e058080b990cf59ff84d3d50b639f44f11614/target/linux/ath79/dts/qca953x.dtsi#L197
Remove line 197 or change it to
dr_mode = "otg";
should has some help. And you need to build your own firmware from the source. Image builder may not work.
Thank you, I tried it, but there is also no "ci_hdrc" in /sys/class/udc. Any more ideas :(?
Best regards Manuel
You added gprmally missibg module options as per upstream kernel. It says no other magic needed. Since it is in debug mode - try connecting some device without then with otg?
The Hardware is in OTG mode, Pull-Up Resistor is added, and with the old OpenWrt 19 everything is working fine. Is there a possibility to check if the otg_fsm was built correctly? I am not able to see an otg_fsm.o (Objekt File for the Linker) So I think there is an entry missing in the make file, and the edited usb.mk file, usb-chipidea definition, isn't enough.
Or is there a debug possibility?
There is no directory /sys/kernel/debug/ci_hdrc/
Describe the bug
I own an Gl.Inet AR300M-16, if I use the latest available ar71xx Firmware (19.07.9) I am able to use the USB in Device mode (kmod-usb-chipidea, kmod-usb-gadget)
As soon as I upgrade to a ath79 Firmware (21.xx.x or 22.xx.x) I am not able to use this feature anymore. There is no UDC device in /sys/class/udc available.
Maybe the Patch supplied here: https://github.com/adron-s/QCA953x-usb-device-mode
Has not been ported to the at79 firmware?
Thanks!
OpenWrt version
22.03.5
OpenWrt target/subtarget
22.03.5
Device
Gl.Inet AR300M-16
Image kind
Official downloaded image
Steps to reproduce
No response
Actual behaviour
No response
Expected behaviour
No response
Additional info
No response
Diffconfig
No response
Terms