Add OHCI and UHCI drivers to initrd.

USB smart card readers are most full speed devices, and there is no
"rate-matching hubs" beneath the root hub on older (e.g. GM45) plat-
forms, which has companion OHCI or UHCI controllers and needs cor-
responding drivers to communicate with card readers directly plugged
into the motherboard, otherwise a discrete USB hub should be inserted
between the motherboard and the reader.

This time I make inserting linux modules for OHCI and UHCI controllable
with option CONFIG_LINUX_USB_COMPANION_CONTROLLER.

A linux config for x200 is added as an example.

Tested on my x200s and elitebook revolve 810g1.
This commit is contained in:
persmule 2017-12-06 16:04:27 +08:00
parent 55c4864d3d
commit baa30a2026
5 changed files with 2711 additions and 34 deletions

2667
config/linux-x200.config Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
# Sign a valid directory of kexec params # Sign a valid directory of kexec params
set -e -o pipefail set -e -o pipefail
. /etc/config
. /etc/functions . /etc/functions
rollback="n" rollback="n"

View File

@ -1,23 +1,9 @@
#!/bin/sh #!/bin/sh
# Mount a USB device # Mount a USB device
die() { echo >&2 "!!!!! $@"; exit 1; } . /etc/functions
enable_usb
if ! lsmod | grep -q ehci_hcd; then
insmod /lib/modules/ehci-hcd.ko \
|| die "ehci_hcd: module load failed"
fi
if ! lsmod | grep -q ehci_pci; then
insmod /lib/modules/ehci-pci.ko \
|| die "ehci_pci: module load failed"
fi
if ! lsmod | grep -q xhci_hcd; then
insmod /lib/modules/xhci-hcd.ko \
|| die "ehci_hcd: module load failed"
fi
if ! lsmod | grep -q xhci_pci; then
insmod /lib/modules/xhci-pci.ko \
|| die "ehci_pci: module load failed"
fi
if ! lsmod | grep -q usb_storage; then if ! lsmod | grep -q usb_storage; then
insmod /lib/modules/usb-storage.ko \ insmod /lib/modules/usb-storage.ko \
|| die "usb_storage: module load failed" || die "usb_storage: module load failed"

View File

@ -68,6 +68,41 @@ confirm_totp()
echo echo
} }
enable_usb()
{
if [ "$CONFIG_LINUX_USB_COMPANION_CONTROLLER" = y ]; then
if ! lsmod | grep -q uhci_hcd; then
insmod /lib/modules/uhci-hcd.ko \
|| die "uhci_hcd: module load failed"
fi
if ! lsmod | grep -q ohci_hcd; then
insmod /lib/modules/ohci-hcd.ko \
|| die "ohci_hcd: module load failed"
fi
if ! lsmod | grep -q ohci_pci; then
insmod /lib/modules/ohci-pci.ko \
|| die "ohci_pci: module load failed"
fi
fi
if ! lsmod | grep -q ehci_hcd; then
insmod /lib/modules/ehci-hcd.ko \
|| die "ehci_hcd: module load failed"
fi
if ! lsmod | grep -q ehci_pci; then
insmod /lib/modules/ehci-pci.ko \
|| die "ehci_pci: module load failed"
fi
if ! lsmod | grep -q xhci_hcd; then
insmod /lib/modules/xhci-hcd.ko \
|| die "xhci_hcd: module load failed"
fi
if ! lsmod | grep -q xhci_pci; then
insmod /lib/modules/xhci-pci.ko \
|| die "xhci_pci: module load failed"
sleep 2
fi
}
confirm_gpg_card() confirm_gpg_card()
{ {
read \ read \
@ -84,23 +119,7 @@ confirm_gpg_card()
fi fi
# setup the USB so we can reach the GPG card # setup the USB so we can reach the GPG card
if ! lsmod | grep -q ehci_hcd; then enable_usb
insmod /lib/modules/ehci-hcd.ko \
|| die "ehci_hcd: module load failed"
fi
if ! lsmod | grep -q ehci_pci; then
insmod /lib/modules/ehci-pci.ko \
|| die "ehci_pci: module load failed"
fi
if ! lsmod | grep -q xhci_hcd; then
insmod /lib/modules/xhci-hcd.ko \
|| die "ehci_hcd: module load failed"
fi
if ! lsmod | grep -q xhci_pci; then
insmod /lib/modules/xhci-pci.ko \
|| die "ehci_pci: module load failed"
sleep 2
fi
gpg --card-status \ gpg --card-status \
|| die "gpg card read failed" || die "gpg card read failed"

View File

@ -63,6 +63,10 @@ linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_co
linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko
# USB modules for both types of controllers # USB modules for both types of controllers
# older boards also need ohci and uhci
linux_modules-$(CONFIG_LINUX_USB_COMPANION_CONTROLLER) += drivers/usb/host/uhci-hcd.ko
linux_modules-$(CONFIG_LINUX_USB_COMPANION_CONTROLLER) += drivers/usb/host/ohci-hcd.ko
linux_modules-$(CONFIG_LINUX_USB_COMPANION_CONTROLLER) += drivers/usb/host/ohci-pci.ko
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-hcd.ko linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-hcd.ko
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-pci.ko linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-pci.ko
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/xhci-hcd.ko linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/xhci-hcd.ko