asuswrt-merlin.ng/release/src-rt-5.02axhnd.675x/hostTools/scripts/gendefconfig.d/20usbhost.conf
2022-05-26 12:19:01 -04:00

115 lines
3.3 KiB
Perl
Executable file

#!/usr/bin/perl
use strict;
use warnings;
use FindBin qw($Bin);
use lib "$Bin/../../PerlLib";
use BRCM::GenConfig;
# $p will allow us to GET values from the PROFILE
# $c will allow us to SET (and GET and DRIVER_SETUP) on the config
# file as we transform it from a template to the final config
# arguments
# * profile file
# * config file
my $p = new BRCM::GenConfig(shift);
my $chip = $p->get('BRCM_CHIP');
my $c = new BRCM::GenConfig( shift, Chip => $chip, Profile => $p );
# As we fake our USB host controller as a PCI device in DSL chips pci quirks
# need to be enabled for USB host to avoid relocation of address space
if ( $p->get("LINUX_3_4_0_RT") || $p->get("LINUX_3_14_0") || $p->get("LINUX_4_1_0") ) {
if ( $chip !~ /^(63148|63138|4908|6858|6836|63158|6846|47189|6856|63178|47622|6878|6855)$/ ) {
$c->set( "CONFIG_PCI_QUIRKS", 'y' );
}
}
if ( $p->get("LINUX_DRIVER_USB_HOST") ) {
# to set a long list of variables to the same value,
# pass a list reference to set()
$c->set(
[
qw[ CONFIG_USB CONFIG_USB_EHCI_HCD CONFIG_USB_EHCI_PCI
CONFIG_USB_PRINTER CONFIG_USB_DEVICEFS ]
],
'y'
);
if ( $chip !~ /^(6838)$/ ) {
$c->set( "CONFIG_USB_OHCI_HCD", 'y' );
$c->set( "CONFIG_USB_OHCI_HCD_PCI", 'y' );
}
if ( $chip =~ /^(63148|63138|4908|6858|6836|63158|6846|47189|6856|63178|47622|6878|6855)$/ ) {
$c->set(
[
qw[ CONFIG_USB_EHCI_HCD_PLATFORM
CONFIG_USB_OHCI_HCD_PLATFORM
]
],
'y'
);
$c->set(
[
qw( CONFIG_USB_EHCI_HCD
CONFIG_USB_OHCI_HCD
CONFIG_USB_PRINTER )
],
'm'
);
if( $p->get("LINUX_DRIVER_USB3_HOST") ) {
$c->set( "CONFIG_USB_XHCI_PLATFORM", 'm' );
$c->set( "CONFIG_USB_XHCI_HCD", 'm' );
}
}
if ( $chip =~ /^(63138|4908|6858|6836|63158|6856|63178|47622)$/ ) {
$c->set( "CONFIG_USB_UAS", 'y');
}
if ( $chip =~ /^(63381)$/ ) {
if( $p->get("LINUX_DRIVER_USB3_HOST") ) {
$c->set( "CONFIG_USB_XHCI_PLATFORM", 'y');
$c->set( "CONFIG_USB_XHCI_HCD", 'm');
}
}
if ( $p->get("LINUX_DRIVER_USBNET") ) {
$c->set(
[
qw[ CONFIG_USB_NET_DRIVERS CONFIG_USB_USBNET CONFIG_USB_NET_CDCETHER
CONFIG_USB_NET_RNDIS_HOST CONFIG_USB_NET_CDC_EEM CONFIG_USB_NET_CDC_NCM ]
],
'y'
);
$c->set( [qw[CONFIG_USB_NET_AX8817X ]], 'y' ); #common usb-ethernet dongle
$c->set( [qw[CONFIG_USB_NET_AX88179_178A ]], 'y' ); #common usb-ethernet dongle
if ( $p->get("BRCM_DRIVER_USBNET_THREAD") ) {
$c->set( [qw[CONFIG_BCM_USBNET_THREAD]], 'y' );
}
if ( $p->get("BRCM_DRIVER_PKTFLOW_USBNET") ) {
$c->set( [qw[CONFIG_BCM_USBNET_ACCELERATION ]], 'y' ); #FCACHE acceleration
}
}
if ( $p->get("LINUX_KERNEL_USBMASS") ) {
# always compile usb-storage as mdoule for automount to work correctly on all platforms
$c->set( 'CONFIG_USB_STORAGE', 'm' );
}
if ( $p->get("BRCM_DRIVER_WIRELESS_USBAP") ) {
$c->set( "CONFIG_BCM_WLAN_USBAP", "y" );
}
}
$c->write();