scripts/dtc: dt_to_config - report kernel config options for a devicetree
PATCH 1/1 scripts/dtc: dt_to_config - report kernel config options for a devicetree
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
--- scripts/dtc/dt_to_config | 1061 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1061 insertions(+)
scripts/dtc/dt_to_config new file +1061 -0
@@ -0,0 +1,1061 @@ +#!/usr/bin/perl + +# Copyright 2016 by Frank Rowand +# © Copyright 2016 by Gaurav Minocha +# +# This file is subject to the terms and conditions of the GNU General Public +# License v2. + +use strict 'refs'; +use strict subs; + +use Getopt::Long; + +$VUFX = "160428a"; + +$script_name = $0; +$script_name =~ s|^.*/||; + + +# ----- constants for print_flags() + +# Position in string $pr_flags. Range of 0..($num_pr_flags - 1). +$pr_flag_pos_mcompatible = 0; +$pr_flag_pos_driver = 1; +$pr_flag_pos_mdriver = 2; +$pr_flag_pos_config = 3; +$pr_flag_pos_mconfig = 4; +$pr_flag_pos_node_not_enabled = 5; +$pr_flag_pos_white_list = 6; +$pr_flag_pos_hard_coded = 7; +$pr_flag_pos_config_hard_coded = 8; +$pr_flag_pos_config_none = 9; +$pr_flag_pos_config_m = 10; +$pr_flag_pos_config_y = 11; +$pr_flag_pos_config_test_fail = 12; + +$num_pr_flags = $pr_flag_pos_config_test_fail + 1; + +# flags in @pr_flag_value must be unique values to allow simple regular +# expessions to work for --include_flags and --exclude_flags. +# Convention: use upper case letters for potential issues or problems. + +@pr_flag_value = ('M', 'd', 'D', 'c', 'C', 'E', 'W', 'H', 'x', 'n', 'm', 'y', 'F'); + +@pr_flag_help = ( + "multiple compatibles found for this node", + "driver found for this compatible", + "multiple drivers found for this compatible", + "kernel config found for this driver", + "multiple config options found for this driver", + "node is not enabled", + "compatible is white listed", + "matching driver and/or kernel config is hard coded", + "kernel config hard coded in Makefile", + "one or more kernel config file options is not set", + "one or more kernel config file options is set to 'm'", + "one or more kernel config file options is set to 'y'", + "one of more kernel config file options fails to have correct value" +); + + +# ----- + +%driver_config = (); # driver config array, indexed by driver source file +%driver_count = (); # driver_cnt, indexed by compatible +%compat_driver = (); # compatible driver array, indexed by compatible +%existing_config = (); # existing config symbols present in given config file + # expected values are: "y", "m", a decimal number, a + # hex number, or a string + +# ----- magic compatibles, do not have a driver +# +# Will not search for drivers for these compatibles. + +%compat_white_list = ( + 'fixed-partitions' => '1', + 'none' => '1', + 'pci' => '1', + 'simple-bus' => '1', +); + +# magic compatibles, have a driver +# +# Will not search for drivers for these compatibles. +# Will instead use the drivers and config options listed here. +# +# If you add an entry to this hash, add the corresponding entry +# to %driver_config_hard_code_list. +# +# These compatibles have a very large number of false positives. +# +# 'hardcoded_no_driver' is a magic value. Other code knows this +# magic value. Do not use 'no_driver' here! +# +# TODO: Revisit each 'hardcoded_no_driver' to see how the compatible +# is used. Are there drivers that can be provided? + +%driver_hard_code_list = ( + 'cache' => ['hardcoded_no_driver'], + 'eeprom' => ['hardcoded_no_driver'], + 'gpio' => ['hardcoded_no_driver'], + 'gpios' => ['drivers/leds/leds-tca6507.c'], + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], + 'isa' => ['arch/mips/mti-malta/malta-dt.c', + 'arch/x86/kernel/devicetree.c'], + 'led' => ['hardcoded_no_driver'], + 'm25p32' => ['hardcoded_no_driver'], + 'm25p64' => ['hardcoded_no_driver'], + 'm25p80' => ['hardcoded_no_driver'], + 'mtd_ram' => ['drivers/mtd/maps/physmap_of.c'], + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], + 'spidev' => ['hardcoded_no_driver'], + 'syscon' => ['drivers/mfd/syscon.c'], + 'tlv320aic23' => ['hardcoded_no_driver'], + 'wm8731' => ['hardcoded_no_driver'], +); + +%driver_config_hard_code_list = ( + + # this one needed even if %driver_hard_code_list is empty + 'no_driver' => ['no_config'], + 'hardcoded_no_driver' => ['no_config'], + + 'drivers/leds/leds-tca6507.c' => ['CONFIG_LEDS_TCA6507'], + 'drivers/input/keyboard/gpio_keys.c' => ['CONFIG_KEYBOARD_GPIO'], + 'drivers/i2c/busses/i2c-gpio.c' => ['CONFIG_I2C_GPIO'], + 'arch/mips/mti-malta/malta-dt.c' => ['obj-y'], + 'arch/x86/kernel/devicetree.c' => ['CONFIG_OF'], + 'drivers/mtd/maps/physmap_of.c' => ['CONFIG_MTD_PHYSMAP_OF'], + 'drivers/video/backlight/pwm_bl.c' => ['CONFIG_BACKLIGHT_PWM'], + 'drivers/mfd/syscon.c' => ['CONFIG_MFD_SYSCON'], + + # drivers/usb/host/ehci-ppc-of.c + # drivers/usb/host/ehci-xilinx-of.c + # are included from: + # drivers/usb/host/ehci-hcd.c + # thus the search of Makefile for the included .c files is incorrect + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF + # + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) + # + # similarly, uhci-hcd.c includes uhci-platform.c + + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_PPC_OF'], + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', + 'CONFIG_USB_OHCI_HCD_PPC_OF'], + + 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_XILINX'], + + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', + 'CONFIG_USB_UHCI_PLATFORM'], + + # scan_makefile will find only one of these config options: + # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', + 'CONFIG_SOC_LS1021A && CONFIG_SMP'], +); + + +# 'virt/kvm/arm/.*' are controlled by makefiles in other directories, +# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not +# add complexity to find_kconfig() to deal with this. There is a long +# term intent to change the kvm related makefiles to the normal kernel +# style. After that is done, this entry can be removed from the +# driver_black_list. + +@driver_black_list = ( + 'virt/kvm/arm/.*', +); + + +sub usage() +{ + print STDERR +" +Usage: $script_name [options] device-tree... + + device_tree is: dts_file | dtb_file | proc_device-tree + + +Valid options: + -b ignore driver black list + -c FILE Read kernel config options from FILE + --config FILE synonym for 'c' + --exclude-flag FLAG exclude entries with a matching flag + -h Display this message and exit + --help synonym for 'h' + --include-flag FLAG include only entries with a matching flag + --include-suspect include only entries with an uppercase flag + --show-lists report of white and black lists + --version Display program version and exit + + + Report driver source files that match the compatibles in the device + tree file and the kernel config options that enable the driver source + files. + + This program must be run in the root directory of a Linux kernel + source tree. + + CAUTION: + This program uses heuristics to guess which driver(s) support each + compatible string and which config option enables the driver(s). + Do not believe that the reported information is fully correct. + This program is intended to aid the process of determining the + proper kernel configuration for a device tree, but this is not + a fully automated process -- human involvement may still be + required! + + The driver match heuristic used is to search for source files + containing the compatible string enclosed in quotes. + + This program might not be able to find all drivers matching a + compatible string. + + Some makefiles are overly clever. This program was not made + complex enough to handle them. If no config option is listed + for a driver, look at the makefile for the driver source file. + Even if a config option is listed for a driver, some other + available config options may not be listed. + + + FLAG values: +"; + + for ($k = 0; $k < $num_pr_flags; $k++) { + printf STDERR " %s %s\n", + $pr_flag_value[$k], $pr_flag_help[$k]; + } + + print STDERR +" + Upper case letters indicate potential issues or problems. + + + Return value: + 0 if no error + 1 error processing command line + 2 unable to open or read kernel config file + 3 unable to open or process input device tree file(s) + +"; +} + +sub set_flag() +{ + # pr_flags_ref is a reference to $pr_flags + + my $pr_flags_ref = shift; + my $pos = shift; + + substr $$pr_flags_ref, $pos, 1, $pr_flag_value[$pos]; + + return $pr_flags; +} + +sub print_flags() +{ + # return 1 if anything printed, else 0 + + # some fields of pn_arg_ref might not be used in this function, but + # extract all of them anyway. + my $pn_arg_ref = shift; + + my $compat = $pn_arg_ref->{compat}; + my $compatible_cnt = $pn_arg_ref->{compatible_cnt}; + my $config = $pn_arg_ref->{config}; + my $config_cnt = $pn_arg_ref->{config_cnt}; + my $driver = $pn_arg_ref->{driver}; + my $driver_cnt = $pn_arg_ref->{driver_cnt}; + my $node = $pn_arg_ref->{node}; + my $node_enabled = $pn_arg_ref->{node_enabled}; + my $white_list = $pn_arg_ref->{white_list}; + + my $pr_flags = '-' x $num_pr_flags; + + + # ----- set flags in $pr_flags + + if ($compatible_cnt > 1) { + &set_flag(\$pr_flags, $pr_flag_pos_mcompatible); + } + + if ($config_cnt > 1) { + &set_flag(\$pr_flags, $pr_flag_pos_mconfig); + } + + if ($driver_cnt >= 1) { + &set_flag(\$pr_flags, $pr_flag_pos_driver); + } + + if ($driver_cnt > 1) { + &set_flag(\$pr_flags, $pr_flag_pos_mdriver); + } + + # These strings are the same way the linux kernel tests. + # The ePapr lists of values is slightly different. + if (!( + ($node_enabled eq "") || + ($node_enabled eq "ok") || + ($node_enabled eq "okay") + )) { + &set_flag(\$pr_flags, $pr_flag_pos_node_not_enabled); + } + + if ($white_list) { + &set_flag(\$pr_flags, $pr_flag_pos_white_list); + } + + if (exists($driver_hard_code_list{$compat}) || + (exists($driver_config_hard_code_list{$driver}) && + ($driver ne "no_driver"))) { + &set_flag(\$pr_flags, $pr_flag_pos_hard_coded); + } + + my @configs = split(' && ', $config); + for $configs (@configs) { + $not = $configs =~ /^!/; + $configs =~ s/^!//; + + if (($configs ne "no_config") && ($configs ne "no_makefile")) { + &set_flag(\$pr_flags, $pr_flag_pos_config); + } + + if (($config_cnt >= 1) && + ($configs !~ /CONFIG_/) && + (($configs ne "no_config") && ($configs ne "no_makefile"))) { + &set_flag(\$pr_flags, $pr_flag_pos_config_hard_coded); + } + + my $existing_config = $existing_config{$configs}; + if ($existing_config eq "m") { + &set_flag(\$pr_flags, $pr_flag_pos_config_m); + if ($not) { + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); + } + } elsif ($existing_config eq "y") { + &set_flag(\$pr_flags, $pr_flag_pos_config_y); + if ($not) { + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); + } + } elsif (($config_file) && ($configs =~ /CONFIG_/)) { + &set_flag(\$pr_flags, $pr_flag_pos_config_none); + if (!$not) { + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); + } + } + } + + # ----- include / exclude filters + + if ($include_flag_pattern && ($pr_flags !~ m/$include_flag_pattern/)) { + return 0; + } + + if ($exclude_flag_pattern && ($pr_flags =~ m/$exclude_flag_pattern/)) { + return 0; + } + + print "$pr_flags : "; + + return 1; +} + + +sub print_node() +{ + # return number of lines printed + + # some fields of pn_arg_ref might not be used in this function, but + # extract all of them anyway. + my $pn_arg_ref = shift; + + my $compat = $pn_arg_ref->{compat}; + my $compatible_cnt = $pn_arg_ref->{compatible_cnt}; + my $config = $pn_arg_ref->{config}; + my $config_cnt = $pn_arg_ref->{config_cnt}; + my $driver = $pn_arg_ref->{driver}; + my $driver_cnt = $pn_arg_ref->{driver_cnt}; + my $node = $pn_arg_ref->{node}; + my $node_enabled = $pn_arg_ref->{node_enabled}; + my $white_list = $pn_arg_ref->{white_list}; + + my $separator; + + if (! &print_flags($pn_arg_ref)) { + return 0; + } + + print "$node : $compat : $driver : $config : "; + + if ($config_file) { + my @configs = split(' && ', $config); + for $configs (@configs) { + $configs =~ s/^!//; + my $existing_config = $existing_config{$configs}; + if (!$existing_config) { + # check for /-m/, /-y/, or /-objs/ + if (($configs !~ /CONFIG_/) && + ($configs ne "no_config") && + ($configs ne "no_makefile")) { + $existing_config = "x"; + }; + }; + if ($existing_config) { + print "$separator", "$existing_config"; + $separator = ", "; + } else { + print "$separator", "n"; + $separator = ", "; + } + } + } else { + print "none"; + } + + print "\n"; + + return 1; +} + + +sub scan_makefile +{ + my $pn_arg_ref = shift; + my $driver = shift; + + # ----- Find Kconfig symbols that enable driver + + my ($dir, $base) = $driver =~ m{(.*)/(.*).c}; + + my $makefile = $dir . "/Makefile"; + if (! -r $makefile) { + $makefile = $dir . "/Kbuild"; + } + if (! -r $makefile) { + my $config; + + $config = 'no_makefile'; + push @{ $driver_config{$driver} }, $config; + return; + } + + if (!open(MAKEFILE_FILE, "<", "$makefile")) { + return; + } + + my $line; + my @config; + my @if_config; + my @make_var; + + NEXT_LINE: + while ($next_line = <MAKEFILE_FILE>) { + my $config; + my $if_config; + my $ifdef; + my $ifeq; + my $ifndef; + my $ifneq; + my $ifdef_config; + my $ifeq_config; + my $ifndef_config; + my $ifneq_config; + + chomp($next_line); + $line = $line . $next_line; + if ($next_line =~ /\\$/) { + $line =~ s/\\$/ /; + next NEXT_LINE; + } + if ($line =~ /^\s*#/) { + $line = ""; + next NEXT_LINE; + } + + # ----- condition ... else ... endif + + if ($line =~ /^([ ]\s*|)else\b/) { + $if_config = "!" . pop @if_config; + $if_config =~ s/^!!//; + push @if_config, $if_config; + $line =~ s/^([ ]\s*|)else\b//; + } + + ($null, $ifeq_config, $ifeq_config_val ) = $line =~ /^([ ]\s*|)ifeq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/; + ($null, $ifneq_config, $ifneq_config_val) = $line =~ /^([ ]\s*|)ifneq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/; + ($null, $ifdef_config) = $line =~ /^([ ]\s*|)ifdef\b.*\b(CONFIG_[A-Za-z0-9_]*)/; + ($null, $ifndef_config) = $line =~ /^([ ]\s*|)ifndef\b.*\b(CONFIG_[A-Za-z0-9_]*)/; + + ($null, $ifeq) = $line =~ /^([ ]\s*|)ifeq\b\s*(.*)/; + ($null, $ifneq) = $line =~ /^([ ]\s*|)ifneq\b\s*(.*)/; + ($null, $ifdef) = $line =~ /^([ ]\s*|)ifdef\b\s*(.*)/; + ($null, $ifndef) = $line =~ /^([ ]\s*|)ifndef\b\s*(.*)/; + + # Order of tests is important. Prefer "CONFIG_*" regex match over + # less specific regex match. + if ($ifdef_config) { + $if_config = $ifdef_config; + } elsif ($ifeq_config) { + if ($ifeq_config_val =~ /y/) { + $if_config = $ifeq_config; + } else { + $if_config = "!" . $ifeq_config; + } + } elsif ($ifndef_config) { + $if_config = "!" . $ifndef_config; + } elsif ($ifneq_config) { + if ($ifneq_config_val =~ /y/) { + $if_config = "!" . $ifneq_config; + } else { + $if_config = $ifneq_config; + } + } elsif ($ifdef) { + $if_config = $ifdef; + } elsif ($ifeq) { + $if_config = $ifeq; + } elsif ($ifndef) { + $if_config = "!" . $ifndef; + } elsif ($ifneq) { + $if_config = "!" . $ifneq; + } else { + $if_config = ""; + } + $if_config =~ s/^!!//; + + if ($if_config) { + push @if_config, $if_config; + $line = ""; + next NEXT_LINE; + } + + if ($line =~ /^([ ]\s*|)endif\b/) { + pop @if_config; + $line = ""; + next NEXT_LINE; + } + + # ----- simple CONFIG_* = *.[co] or xxx [+:?]*= *.[co] + # Most makefiles select on *.o, but + # arch/powerpc/boot/Makefile selects on *.c + + ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$base.[co]\b/; + + # ----- match a make variable instead of *.[co] + # Recursively expanded variables are not handled. + + if (!$config) { + my $make_var; + ($make_var) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$base.[co]\b/; + if ($make_var) { + if ($make_var =~ /[a-zA-Z0-9]+-[ym]/) { + $config = $make_var; + } elsif ($make_var =~ /[a-zA-Z0-9]+-objs/) { + $config = $make_var; + } else { + push @make_var, $make_var; + } + } + } + + if (!$config) { + for $make_var (@make_var) { + ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$make_var\b/; + last if ($config); + } + } + + if (!$config) { + for $make_var (@make_var) { + ($config) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$make_var\b/; + last if ($config); + } + } + + # ----- next if no config found + + if (!$config) { + $line = ""; + next NEXT_LINE; + } + + for $if_config (@if_config) { + $config = $if_config . " && " . $config; + } + + push @{ $driver_config{$driver} }, $config; + + $line = ""; + } + + close(MAKEFILE_FILE); + +} + + +sub find_kconfig +{ + my $pn_arg_ref = shift; + my $driver = shift; + + my $lines_printed = 0; + my @configs; + + if (!@{ $driver_config{$driver} }) { + &scan_makefile($pn_arg_ref, $driver); + if (!@{ $driver_config{$driver} }) { + push @{ $driver_config{$driver} }, "no_config"; + } + } + + @configs = @{ $driver_config{$driver} }; + + $$pn_arg_ref{config_cnt} = $#configs + 1; + for my $config (@configs) { + $$pn_arg_ref{config} = $config; + $lines_printed += &print_node($pn_arg_ref); + } + + return $lines_printed; +} + + +sub handle_compatible() +{ + my $node = shift; + my $compatible = shift; + my $node_enabled = shift; + + my $compat; + my $lines_printed = 0; + my %pn_arg = (); + + return if (!$node or !$compatible); + + # Do not process compatible property of root node, + # it is used to match board, not to bind a driver. + return if ($node eq "/"); + + $pn_arg{node} = $node; + $pn_arg{node_enabled} = $node_enabled; + + my @compatibles = split('", "', $compatible); + + $compatibles[0] =~ s/^"//; + $compatibles[$#compatibles] =~ s/"$//; + + $pn_arg{compatible_cnt} = $#compatibles + 1; + + COMPAT: + for $compat (@compatibles) { + + $pn_arg{compat} = $compat; + $pn_arg{driver_cnt} = 0; + $pn_arg{white_list} = 0; + + if (exists($compat_white_list{$compat})) { + $pn_arg{white_list} = 1; + $pn_arg{driver} = "no_driver"; + $pn_arg{config_cnt} = 1; + $pn_arg{config} = "no_config"; + $lines_printed += &print_node(\%pn_arg); + next COMPAT; + } + + # ----- if compat previously seen, use cached info + + if (exists($compat_driver{$compat})) { + + for my $driver (@{ $compat_driver{$compat} }) { + $pn_arg{driver} = $driver; + $pn_arg{driver_cnt} = $driver_count{$compat}; + $pn_arg{config_cnt} = $#{ $driver_config{$driver}} + 1; + + for my $config (@{ $driver_config{$driver} }) { + $pn_arg{config} = $config; + $lines_printed += &print_node(\%pn_arg); + } + } + next COMPAT; + } + + + # ----- Find drivers (source files that contain compatible) + + # this will miss arch/sparc/include/asm/parport.h + # It is better to move the compatible out of the .h + # than to add *.h. to the files list, because *.h generates + # a lot of false negatives. + my $files = '"*.c"'; + my $drivers = `git grep -l '"$compat"' -- $files`; + chomp($drivers); + if ($drivers eq "") { + $pn_arg{driver} = "no_driver"; + $pn_arg{config_cnt} = 1; + $pn_arg{config} = "no_config"; + push @{ $compat_driver{$compat} }, "no_driver"; + $lines_printed += &print_node(\%pn_arg); + next COMPAT; + } + + my @drivers = split("\n", $drivers); + $driver_count{$compat} = $#drivers + 1; + $pn_arg{driver_cnt} = $#drivers + 1; + + DRIVER: + for my $driver (@drivers) { + push @{ $compat_driver{$compat} }, $driver; + $pn_arg{driver} = $driver; + + # ----- if driver previously seen, use cached info + + $pn_arg{config_cnt} = $#{ $driver_config{$driver} } + 1; + for my $config (@{ $driver_config{$driver} }) { + $pn_arg{config} = $config; + $lines_printed += &print_node(\%pn_arg); + } + if (@{ $driver_config{$driver} }) { + next DRIVER; + } + + if (!$ignore_driver_black_list) { + for $black (@driver_black_list) { + next DRIVER if ($driver =~ /^$black$/); + } + } + + + # ----- Find Kconfig symbols that enable driver + + $lines_printed += &find_kconfig(\%pn_arg, $driver); + + } + } + + # White space (line) between nodes for readability. + # Each node may report several compatibles. + # For each compatible, multiple drivers may be reported. + # For each driver, multiple CONFIG_ options may be reported. + if ($lines_printed) { + print "\n"; + } +} + +sub read_dts() +{ + my $file = shift; + + my $compatible = ""; + my $line; + my $node = ""; + my $node_enabled = ""; + + if (! -r $file) { + print STDERR "file '$file' is not readable or does not exist\n"; + exit 3; + } + + if (! `which dtx_diff`) { + print STDERR "\n"; + print STDERR "file 'dtx_diff' is not executable or does not exist\n"; + print STDERR " Is scripts/dtc/ in the shell \$PATH variable?\n"; + print STDERR " Are you in the root directory of a kernel tree?\n"; + print STDERR "\n"; + exit 3; + } + + if (!open(DT_FILE, "-|", "dtx_diff $file")) { + print STDERR "\n"; + print STDERR "shell command failed:\n"; + print STDERR " dtx_diff $file\n"; + print STDERR "\n"; + exit 3; + } + + FILE: + while ($line = <DT_FILE>) { + chomp($line); + + if ($line =~ /{/) { + &handle_compatible($node, $compatible, $node_enabled); + + $node = $line; + $node =~ s/^\s*(.*)\s+\{.*/$1/; + $node =~ s/.*: //; + + $compatible = ""; + $node_enabled = ""; + next FILE; + } + + if ($line =~ /(\s+|^)status =/) { + $node_enabled = $line; + $node_enabled =~ s/^\t*//; + $node_enabled =~ s/^status = "//; + $node_enabled =~ s/";$//; + next FILE; + } + + if ($line =~ /(\s+|^)compatible =/) { + # Extract all compatible entries for this device + # White space matching here and in handle_compatible() is + # precise, because input format is the output of dtc, + # which is invoked by dtx_diff. + $compatible = $line; + $compatible =~ s/^\t*//; + $compatible =~ s/^compatible = //; + $compatible =~ s/;$//; + } + } + + &handle_compatible($node, $compatible, $node_enabled); + + close(DT_FILE); +} + + +sub read_config_file() +{ + if (! -r $config_file) { + print STDERR "file '$config_file' is not readable or does not exist\n"; + exit 2; + } + + if (!open(CONFIG_FILE, "<", "$config_file")) { + print STDERR "open $config_file failed\n"; + exit 2; + } + + my @line; + + LINE: + while ($line = <CONFIG_FILE>) { + chomp($line); + next LINE if ($line =~ /^\s*#/); + next LINE if ($line =~ /^\s*$/); + @line = split /=/, $line; + $existing_config{@line[0]} = @line[1]; + } + + close(CONFIG_FILE); +} + + +sub cmd_line_err() +{ + my $msg = shift; + + print STDERR "\n"; + print STDERR " ERROR processing command line options\n"; + print STDERR " $msg\n" if ($msg ne ""); + print STDERR "\n"; + print STDERR " For help, type '$script_name --help'\n"; + print STDERR "\n"; +} + + +# ----------------------------------------------------------------------------- +# program entry point + +Getopt::Long::Configure("no_ignore_case", "bundling"); + +if (!GetOptions( + "b" => \$ignore_driver_black_list, + "c=s" => \$config_file, + "h" => \$help, + "config=s" => \$config_file, + "exclude-flag=s" => \@exclude_flag, + "help" => \$help, + "include-flag=s" => \@include_flag, + "include-suspect" => \$include_suspect, + "show-lists" => \$show_lists, + "version" => \$version, + )) { + + &cmd_line_err(); + + exit 1; +} + + +my $exit_after_messages = 0; + +if ($version) { + print STDERR "\n$script_name $VUFX\n\n"; + $exit_after_messages = 1; +} + + +if ($help) { + &usage; + $exit_after_messages = 1; +} + + +if ($show_lists) { + + print "\n"; + print "These compatibles are white listed to have no driver.\n"; + print "\n"; + for my $compat (sort keys %compat_white_list) { + print " $compat\n"; + } + + + print "\n\n"; + print "The driver for these compatibles is hard coded.\n"; + print "\n"; + my $max_compat_len = 0; + for my $compat (sort keys %driver_hard_code_list) { + if (length $compat > $max_compat_len) { + $max_compat_len = length $compat; + } + } + for my $compat (sort keys %driver_hard_code_list) { + if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) { + for my $driver (@{ $driver_hard_code_list{$compat} }) { + print " $compat"; + print " " x ($max_compat_len - length $compat); + print " $driver\n"; + } + } + } + + + print "\n\n"; + print "The configuration option for these drivers is hard coded.\n"; + print "\n"; + my $max_driver_len = 0; + for my $driver (sort keys %driver_config_hard_code_list) { + if (length $driver > $max_driver_len) { + $max_driver_len = length $driver; + } + } + for my $driver (sort keys %driver_config_hard_code_list) { + if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) { + for my $config (@{ $driver_config_hard_code_list{$driver} }) { + print " $driver"; + print " " x ($max_driver_len - length $driver); + print " $config\n"; + } + } + } + + + print "\n\n"; + print "These compatibles are black listed. They will not be reported without '-b'.\n"; + print "\n"; + for my $driver (@driver_black_list) { + print " $driver\n"; + } + + print "\n"; + + $exit_after_messages = 1; +} + + +if ($exit_after_messages) { + exit 0; +} + + +$exclude_flag_pattern = "["; +for my $exclude_flag (@exclude_flag) { + $exclude_flag_pattern = $exclude_flag_pattern . $exclude_flag; +} +$exclude_flag_pattern = $exclude_flag_pattern . "]"; +# clean up if empty +$exclude_flag_pattern =~ s/^\[\]$//; + + +$include_flag_pattern = "["; +for my $include_flag (@include_flag) { + $include_flag_pattern = $include_flag_pattern . $include_flag; +} +$include_flag_pattern = $include_flag_pattern . "]"; +# clean up if empty +$include_flag_pattern =~ s/^\[\]$//; + + +if ($exclude_flag_pattern) { + my $found = 0; + for $pr_flag_value (@pr_flag_value) { + if ($exclude_flag_pattern =~ m/$pr_flag_value/) { + $found = 1; + } + } + if (!$found) { + &cmd_line_err("invalid value for FLAG in --exclude-flag\n"); + exit 1 + } +} + +if ($include_flag_pattern) { + my $found = 0; + for $pr_flag_value (@pr_flag_value) { + if ($include_flag_pattern =~ m/$pr_flag_value/) { + $found = 1; + } + } + if (!$found) { + &cmd_line_err("invalid value for FLAG in --include-flag\n"); + exit 1 + } +} + +if ($include_suspect) { + $include_flag_pattern =~ s/\[//; + $include_flag_pattern =~ s/\]//; + $include_flag_pattern = "[" . $include_flag_pattern . "A-Z]"; +} + +if ($exclude_flag_pattern =~ m/$include_flag_pattern/) { + &cmd_line_err("the same flag appears in both --exclude-flag and --include-flag or --include-suspect\n"); + exit 1 +} + + +# ($#ARGV < 0) is valid for --help, --version +if ($#ARGV < 0) { + &cmd_line_err("device-tree... is required"); + exit 1 +} + + +if ($config_file) { + &read_config_file(); +} + + +# avoid pushing duplicates for this value +$driver = "hardcoded_no_driver"; +for $config ( @{ $driver_config_hard_code_list{$driver} } ) { + push @{ $driver_config{$driver} }, $config; +} + +for my $compat (keys %driver_hard_code_list) { + for my $driver (@{ $driver_hard_code_list{$compat} }) { + push @{ $compat_driver{$compat} }, $driver; + if ($driver ne "hardcoded_no_driver") { + $driver_count{$compat} = scalar @{ $compat_driver{$compat} }; + } + } +} + +for my $driver (keys %driver_config_hard_code_list) { + if ($driver ne "hardcoded_no_driver") { + for $config ( @{ $driver_config_hard_code_list{$driver} } ) { + push @{ $driver_config{$driver} }, $config; + } + } +} + + +for $file (@ARGV) { + &read_dts($file); +}
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scripts/dtc: dt_to_config - example 1
Example 1 -- show only the nodes that have complications. Things like multiple compatible values, multiple matching drivers, etc.
$ scripts/dtc/dt_to_config --include-suspect arch/arm/boot/dts/qcom-apq8074-dragonboard.dts -dDc--------- : sleep_clk : fixed-clock : arch/powerpc/platforms/512x/clock-commonclk.c : CONFIG_COMMON_CLK : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/clk-fixed-rate.c : CONFIG_COMMON_CLK : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/clk-u300.c : CONFIG_ARCH_U300 : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/imx/clk-imx27.c : CONFIG_SOC_IMX27 : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/imx/clk-imx31.c : CONFIG_SOC_IMX31 : none
-dDc--------- : xo_board : fixed-clock : arch/powerpc/platforms/512x/clock-commonclk.c : CONFIG_COMMON_CLK : none -dDc--------- : xo_board : fixed-clock : drivers/clk/clk-fixed-rate.c : CONFIG_COMMON_CLK : none -dDc--------- : xo_board : fixed-clock : drivers/clk/clk-u300.c : CONFIG_ARCH_U300 : none -dDc--------- : xo_board : fixed-clock : drivers/clk/imx/clk-imx27.c : CONFIG_SOC_IMX27 : none -dDc--------- : xo_board : fixed-clock : drivers/clk/imx/clk-imx31.c : CONFIG_SOC_IMX31 : none
Md-c--------- : spc : qcom,idle-state-spc : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none MdDc--------- : spc : arm,idle-state : drivers/cpuidle/cpuidle-arm.c : CONFIG_ARM_CPUIDLE : none MdDc--------- : spc : arm,idle-state : drivers/cpuidle/cpuidle-big_little.c : CONFIG_ARM_BIG_LITTLE_CPUIDLE : none
-------H----- : l2-cache : cache : hardcoded_no_driver : no_config : none
-dDc--------- : smem : qcom,smem : drivers/soc/qcom/smem.c : CONFIG_QCOM_SMEM : none -dDc--------- : smem : qcom,smem : drivers/soc/qcom/smp2p.c : CONFIG_QCOM_SMP2P : none
------W------ : soc : simple-bus : no_driver : no_config : none
-dDc--------- : clock-controller@f9088000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f9088000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-dDc--------- : clock-controller@f9098000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f9098000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-dDc--------- : clock-controller@f90a8000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f90a8000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-dDc--------- : clock-controller@f90b8000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f90b8000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-d-c-E------- : i2c@f9964000 : qcom,i2c-qup-v2.1.1 : drivers/i2c/busses/i2c-qup.c : CONFIG_I2C_QUP : none
Md-c--------- : power-controller@f9089000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f9089000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f9099000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f9099000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f90a9000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f90a9000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f90b9000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f90b9000 : qcom,saw2 : no_driver : no_config : none
-d-c-E------- : sdhci@f98a4900 : qcom,sdhci-msm-v4 : drivers/mmc/host/sdhci-msm.c : CONFIG_MMC_SDHCI_MSM : none
Md-c--------- : serial@f991e000 : qcom,msm-uartdm-v1.4 : drivers/tty/serial/msm_serial.c : CONFIG_SERIAL_MSM : none Md-c--------- : serial@f991e000 : qcom,msm-uartdm : drivers/tty/serial/msm_serial.c : CONFIG_SERIAL_MSM : none
Md-c--------- : pm8841@4 : qcom,pm8841 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8841@4 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
Md-c--------- : mpps@a000 : qcom,pm8841-mpp : drivers/pinctrl/qcom/pinctrl-spmi-mpp.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : none M------------ : mpps@a000 : qcom,spmi-mpp : no_driver : no_config : none
Md-c--------- : pm8841@5 : qcom,pm8841 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8841@5 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
Md-c--------- : pm8941@0 : qcom,pm8941 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8941@0 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
-d-c-E------- : coincell@2800 : qcom,pm8941-coincell : drivers/misc/qcom-coincell.c : CONFIG_QCOM_COINCELL : none
Md-c--------- : gpios@c000 : qcom,pm8941-gpio : drivers/pinctrl/qcom/pinctrl-spmi-gpio.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : none M------------ : gpios@c000 : qcom,spmi-gpio : no_driver : no_config : none
M------------ : iadc@3600 : qcom,pm8941-iadc : no_driver : no_config : none
Md-c--------- : iadc@3600 : qcom,spmi-iadc : drivers/iio/adc/qcom-spmi-iadc.c : CONFIG_QCOM_SPMI_IADC : none
Md-c--------- : mpps@a000 : qcom,pm8941-mpp : drivers/pinctrl/qcom/pinctrl-spmi-mpp.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : none M------------ : mpps@a000 : qcom,spmi-mpp : no_driver : no_config : none
Md-c--------- : pm8941@1 : qcom,pm8941 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8941@1 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
-d-c-E------- : wled@d800 : qcom,pm8941-wled : drivers/video/backlight/pm8941-wled.c : CONFIG_BACKLIGHT_PM8941_WLED : none
-d-c---H----- : syscon@f9011000 : syscon : drivers/mfd/syscon.c : CONFIG_MFD_SYSCON : none
-d-c---H----- : syscon@fd484000 : syscon : drivers/mfd/syscon.c : CONFIG_MFD_SYSCON : none
-dDc--------- : timer : arm,armv7-timer : arch/arm/kernel/vdso.c : CONFIG_VDSO : none -dDc--------- : timer : arm,armv7-timer : drivers/clocksource/arm_arch_timer.c : CONFIG_ARM_ARCH_TIMER : none
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scripts/dtc: dt_to_config - example 2
In reply to Frank RowandExample 2 -- show all nodes.
$ scripts/dtc/dt_to_config arch/arm/boot/dts/qcom-apq8074-dragonboard.dts -dDc--------- : sleep_clk : fixed-clock : arch/powerpc/platforms/512x/clock-commonclk.c : CONFIG_COMMON_CLK : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/clk-fixed-rate.c : CONFIG_COMMON_CLK : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/clk-u300.c : CONFIG_ARCH_U300 : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/imx/clk-imx27.c : CONFIG_SOC_IMX27 : none -dDc--------- : sleep_clk : fixed-clock : drivers/clk/imx/clk-imx31.c : CONFIG_SOC_IMX31 : none
-dDc--------- : xo_board : fixed-clock : arch/powerpc/platforms/512x/clock-commonclk.c : CONFIG_COMMON_CLK : none -dDc--------- : xo_board : fixed-clock : drivers/clk/clk-fixed-rate.c : CONFIG_COMMON_CLK : none -dDc--------- : xo_board : fixed-clock : drivers/clk/clk-u300.c : CONFIG_ARCH_U300 : none -dDc--------- : xo_board : fixed-clock : drivers/clk/imx/clk-imx27.c : CONFIG_SOC_IMX27 : none -dDc--------- : xo_board : fixed-clock : drivers/clk/imx/clk-imx31.c : CONFIG_SOC_IMX31 : none
-d-c--------- : cpu-pmu : qcom,krait-pmu : arch/arm/kernel/perf_event_v7.c : CONFIG_HW_PERF_EVENTS : none
------------- : cpu@0 : qcom,krait : no_driver : no_config : none
------------- : cpu@1 : qcom,krait : no_driver : no_config : none
------------- : cpu@2 : qcom,krait : no_driver : no_config : none
------------- : cpu@3 : qcom,krait : no_driver : no_config : none
Md-c--------- : spc : qcom,idle-state-spc : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none MdDc--------- : spc : arm,idle-state : drivers/cpuidle/cpuidle-arm.c : CONFIG_ARM_CPUIDLE : none MdDc--------- : spc : arm,idle-state : drivers/cpuidle/cpuidle-big_little.c : CONFIG_ARM_BIG_LITTLE_CPUIDLE : none
-------H----- : l2-cache : cache : hardcoded_no_driver : no_config : none
-d-c--------- : smd : qcom,smd : drivers/soc/qcom/smd.c : CONFIG_QCOM_SMD : none
-d-c--------- : rpm_requests : qcom,rpm-msm8974 : drivers/soc/qcom/smd-rpm.c : CONFIG_QCOM_SMD_RPM : none
-d-c--------- : pm8841-regulators : qcom,rpm-pm8841-regulators : drivers/regulator/qcom_smd-regulator.c : CONFIG_REGULATOR_QCOM_SMD_RPM : none
-d-c--------- : pm8941-regulators : qcom,rpm-pm8941-regulators : drivers/regulator/qcom_smd-regulator.c : CONFIG_REGULATOR_QCOM_SMD_RPM : none
-dDc--------- : smem : qcom,smem : drivers/soc/qcom/smem.c : CONFIG_QCOM_SMEM : none -dDc--------- : smem : qcom,smem : drivers/soc/qcom/smp2p.c : CONFIG_QCOM_SMP2P : none
-d-c--------- : smp2p-wcnss : qcom,smp2p : drivers/soc/qcom/smp2p.c : CONFIG_QCOM_SMP2P : none
-d-c--------- : smsm : qcom,smsm : drivers/soc/qcom/smsm.c : CONFIG_QCOM_SMSM : none
------W------ : soc : simple-bus : no_driver : no_config : none
-dDc--------- : clock-controller@f9088000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f9088000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-dDc--------- : clock-controller@f9098000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f9098000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-dDc--------- : clock-controller@f90a8000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f90a8000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-dDc--------- : clock-controller@f90b8000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : none -dDc--------- : clock-controller@f90b8000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none
-d-c--------- : clock-controller@fc400000 : qcom,gcc-msm8974 : drivers/clk/qcom/gcc-msm8974.c : CONFIG_MSM_GCC_8974 : none
-d-c--------- : clock-controller@fd8c0000 : qcom,mmcc-msm8974 : drivers/clk/qcom/mmcc-msm8974.c : CONFIG_MSM_MMCC_8974 : none
-d-c--------- : dma-controller@f9944000 : qcom,bam-v1.4.0 : drivers/dma/qcom/bam_dma.c : CONFIG_QCOM_BAM_DMA : none
-d-c-E------- : i2c@f9964000 : qcom,i2c-qup-v2.1.1 : drivers/i2c/busses/i2c-qup.c : CONFIG_I2C_QUP : none
-d-c--------- : i2c@f9967000 : qcom,i2c-qup-v2.1.1 : drivers/i2c/busses/i2c-qup.c : CONFIG_I2C_QUP : none
------------- : eeprom@52 : atmel,24c128 : no_driver : no_config : none
-d-c--------- : interrupt-controller@f9000000 : qcom,msm-qgic2 : drivers/irqchip/irq-gic.c : CONFIG_ARM_GIC : none
-d-c--------- : memory@fc428000 : qcom,rpm-msg-ram : drivers/soc/qcom/smem.c : CONFIG_QCOM_SMEM : none
-d-c--------- : pinctrl@fd510000 : qcom,msm8974-pinctrl : drivers/pinctrl/qcom/pinctrl-msm8x74.c : CONFIG_PINCTRL_MSM8X74 : none
------------- : power-controller@f9012000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f9089000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f9089000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f9099000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f9099000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f90a9000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f90a9000 : qcom,saw2 : no_driver : no_config : none
Md-c--------- : power-controller@f90b9000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : none M------------ : power-controller@f90b9000 : qcom,saw2 : no_driver : no_config : none
-d-c--------- : restart@fc4ab000 : qcom,pshold : drivers/power/reset/msm-poweroff.c : CONFIG_POWER_RESET_MSM : none
-d-c--------- : rng@f9bff000 : qcom,prng : drivers/char/hw_random/msm-rng.c : CONFIG_HW_RANDOM_MSM : none
-d-c--------- : sdhci@f9824900 : qcom,sdhci-msm-v4 : drivers/mmc/host/sdhci-msm.c : CONFIG_MMC_SDHCI_MSM : none
-d-c-E------- : sdhci@f98a4900 : qcom,sdhci-msm-v4 : drivers/mmc/host/sdhci-msm.c : CONFIG_MMC_SDHCI_MSM : none
Md-c--------- : serial@f991e000 : qcom,msm-uartdm-v1.4 : drivers/tty/serial/msm_serial.c : CONFIG_SERIAL_MSM : none Md-c--------- : serial@f991e000 : qcom,msm-uartdm : drivers/tty/serial/msm_serial.c : CONFIG_SERIAL_MSM : none
-d-c--------- : spmi@fc4cf000 : qcom,spmi-pmic-arb : drivers/spmi/spmi-pmic-arb.c : CONFIG_SPMI_MSM_PMIC_ARB : none
Md-c--------- : pm8841@4 : qcom,pm8841 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8841@4 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
Md-c--------- : mpps@a000 : qcom,pm8841-mpp : drivers/pinctrl/qcom/pinctrl-spmi-mpp.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : none M------------ : mpps@a000 : qcom,spmi-mpp : no_driver : no_config : none
-d-c--------- : temp-alarm@2400 : qcom,spmi-temp-alarm : drivers/thermal/qcom-spmi-temp-alarm.c : CONFIG_QCOM_SPMI_TEMP_ALARM : none
Md-c--------- : pm8841@5 : qcom,pm8841 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8841@5 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
Md-c--------- : pm8941@0 : qcom,pm8941 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8941@0 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
-d-c--------- : charger@1000 : qcom,pm8941-charger : drivers/power/qcom_smbb.c : CONFIG_CHARGER_QCOM_SMBB : none
-d-c-E------- : coincell@2800 : qcom,pm8941-coincell : drivers/misc/qcom-coincell.c : CONFIG_QCOM_COINCELL : none
Md-c--------- : gpios@c000 : qcom,pm8941-gpio : drivers/pinctrl/qcom/pinctrl-spmi-gpio.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : none M------------ : gpios@c000 : qcom,spmi-gpio : no_driver : no_config : none
M------------ : iadc@3600 : qcom,pm8941-iadc : no_driver : no_config : none
Md-c--------- : iadc@3600 : qcom,spmi-iadc : drivers/iio/adc/qcom-spmi-iadc.c : CONFIG_QCOM_SPMI_IADC : none
Md-c--------- : mpps@a000 : qcom,pm8941-mpp : drivers/pinctrl/qcom/pinctrl-spmi-mpp.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : none M------------ : mpps@a000 : qcom,spmi-mpp : no_driver : no_config : none
-d-c--------- : pwrkey@800 : qcom,pm8941-pwrkey : drivers/input/misc/pm8941-pwrkey.c : CONFIG_INPUT_PM8941_PWRKEY : none
-d-c--------- : rtc@6000 : qcom,pm8941-rtc : drivers/rtc/rtc-pm8xxx.c : CONFIG_RTC_DRV_PM8XXX : none
-d-c--------- : temp-alarm@2400 : qcom,spmi-temp-alarm : drivers/thermal/qcom-spmi-temp-alarm.c : CONFIG_QCOM_SPMI_TEMP_ALARM : none
-d-c--------- : vadc@3100 : qcom,spmi-vadc : drivers/iio/adc/qcom-spmi-vadc.c : CONFIG_QCOM_SPMI_VADC : none
Md-c--------- : pm8941@1 : qcom,pm8941 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none Md-c--------- : pm8941@1 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : none
-d-c-E------- : wled@d800 : qcom,pm8941-wled : drivers/video/backlight/pm8941-wled.c : CONFIG_BACKLIGHT_PM8941_WLED : none
-d-c---H----- : syscon@f9011000 : syscon : drivers/mfd/syscon.c : CONFIG_MFD_SYSCON : none
-d-c---H----- : syscon@fd484000 : syscon : drivers/mfd/syscon.c : CONFIG_MFD_SYSCON : none
-d-c--------- : tcsr-mutex : qcom,tcsr-mutex : drivers/hwspinlock/qcom_hwspinlock.c : CONFIG_HWSPINLOCK_QCOM : none
-d-c--------- : timer@f9020000 : arm,armv7-timer-mem : drivers/clocksource/arm_arch_timer.c : CONFIG_ARM_ARCH_TIMER : none
-dDc--------- : timer : arm,armv7-timer : arch/arm/kernel/vdso.c : CONFIG_VDSO : none -dDc--------- : timer : arm,armv7-timer : drivers/clocksource/arm_arch_timer.c : CONFIG_ARM_ARCH_TIMER : none
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Example 3 -- show all nodes. Report the value of the kernel config options in the kernel configuration file.
$ scripts/dtc/dt_to_config --config=$KBUILD_OUTPUT/.config arch/arm/boot/dts/qcom-apq8074-dragonboard.dts -dDc-------y- : sleep_clk : fixed-clock : arch/powerpc/platforms/512x/clock-commonclk.c : CONFIG_COMMON_CLK : y -dDc-------y- : sleep_clk : fixed-clock : drivers/clk/clk-fixed-rate.c : CONFIG_COMMON_CLK : y -dDc-----n--F : sleep_clk : fixed-clock : drivers/clk/clk-u300.c : CONFIG_ARCH_U300 : n -dDc-----n--F : sleep_clk : fixed-clock : drivers/clk/imx/clk-imx27.c : CONFIG_SOC_IMX27 : n -dDc-----n--F : sleep_clk : fixed-clock : drivers/clk/imx/clk-imx31.c : CONFIG_SOC_IMX31 : n
-dDc-------y- : xo_board : fixed-clock : arch/powerpc/platforms/512x/clock-commonclk.c : CONFIG_COMMON_CLK : y -dDc-------y- : xo_board : fixed-clock : drivers/clk/clk-fixed-rate.c : CONFIG_COMMON_CLK : y -dDc-----n--F : xo_board : fixed-clock : drivers/clk/clk-u300.c : CONFIG_ARCH_U300 : n -dDc-----n--F : xo_board : fixed-clock : drivers/clk/imx/clk-imx27.c : CONFIG_SOC_IMX27 : n -dDc-----n--F : xo_board : fixed-clock : drivers/clk/imx/clk-imx31.c : CONFIG_SOC_IMX31 : n
-d-c-------y- : cpu-pmu : qcom,krait-pmu : arch/arm/kernel/perf_event_v7.c : CONFIG_HW_PERF_EVENTS : y
------------- : cpu@0 : qcom,krait : no_driver : no_config : n
------------- : cpu@1 : qcom,krait : no_driver : no_config : n
------------- : cpu@2 : qcom,krait : no_driver : no_config : n
------------- : cpu@3 : qcom,krait : no_driver : no_config : n
Md-c-------y- : spc : qcom,idle-state-spc : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y MdDc-------y- : spc : arm,idle-state : drivers/cpuidle/cpuidle-arm.c : CONFIG_ARM_CPUIDLE : y MdDc-----n--F : spc : arm,idle-state : drivers/cpuidle/cpuidle-big_little.c : CONFIG_ARM_BIG_LITTLE_CPUIDLE : n
-------H----- : l2-cache : cache : hardcoded_no_driver : no_config : n
-d-c-------y- : smd : qcom,smd : drivers/soc/qcom/smd.c : CONFIG_QCOM_SMD : y
-d-c-------y- : rpm_requests : qcom,rpm-msm8974 : drivers/soc/qcom/smd-rpm.c : CONFIG_QCOM_SMD_RPM : y
-d-c-------y- : pm8841-regulators : qcom,rpm-pm8841-regulators : drivers/regulator/qcom_smd-regulator.c : CONFIG_REGULATOR_QCOM_SMD_RPM : y
-d-c-------y- : pm8941-regulators : qcom,rpm-pm8941-regulators : drivers/regulator/qcom_smd-regulator.c : CONFIG_REGULATOR_QCOM_SMD_RPM : y
-dDc-------y- : smem : qcom,smem : drivers/soc/qcom/smem.c : CONFIG_QCOM_SMEM : y -dDc-----n--F : smem : qcom,smem : drivers/soc/qcom/smp2p.c : CONFIG_QCOM_SMP2P : n
-d-c-----n--F : smp2p-wcnss : qcom,smp2p : drivers/soc/qcom/smp2p.c : CONFIG_QCOM_SMP2P : n
-d-c-----n--F : smsm : qcom,smsm : drivers/soc/qcom/smsm.c : CONFIG_QCOM_SMSM : n
------W------ : soc : simple-bus : no_driver : no_config : n
-dDc-------y- : clock-controller@f9088000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : y -dDc-------y- : clock-controller@f9088000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y
-dDc-------y- : clock-controller@f9098000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : y -dDc-------y- : clock-controller@f9098000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y
-dDc-------y- : clock-controller@f90a8000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : y -dDc-------y- : clock-controller@f90a8000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y
-dDc-------y- : clock-controller@f90b8000 : qcom,kpss-acc-v2 : arch/arm/mach-qcom/platsmp.c : CONFIG_SMP : y -dDc-------y- : clock-controller@f90b8000 : qcom,kpss-acc-v2 : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y
-d-c-------y- : clock-controller@fc400000 : qcom,gcc-msm8974 : drivers/clk/qcom/gcc-msm8974.c : CONFIG_MSM_GCC_8974 : y
-d-c-------y- : clock-controller@fd8c0000 : qcom,mmcc-msm8974 : drivers/clk/qcom/mmcc-msm8974.c : CONFIG_MSM_MMCC_8974 : y
-d-c-------y- : dma-controller@f9944000 : qcom,bam-v1.4.0 : drivers/dma/qcom/bam_dma.c : CONFIG_QCOM_BAM_DMA : y
-d-c-E-----y- : i2c@f9964000 : qcom,i2c-qup-v2.1.1 : drivers/i2c/busses/i2c-qup.c : CONFIG_I2C_QUP : y
-d-c-------y- : i2c@f9967000 : qcom,i2c-qup-v2.1.1 : drivers/i2c/busses/i2c-qup.c : CONFIG_I2C_QUP : y
------------- : eeprom@52 : atmel,24c128 : no_driver : no_config : n
-d-c-------y- : interrupt-controller@f9000000 : qcom,msm-qgic2 : drivers/irqchip/irq-gic.c : CONFIG_ARM_GIC : y
-d-c-------y- : memory@fc428000 : qcom,rpm-msg-ram : drivers/soc/qcom/smem.c : CONFIG_QCOM_SMEM : y
-d-c-------y- : pinctrl@fd510000 : qcom,msm8974-pinctrl : drivers/pinctrl/qcom/pinctrl-msm8x74.c : CONFIG_PINCTRL_MSM8X74 : y
------------- : power-controller@f9012000 : qcom,saw2 : no_driver : no_config : n
Md-c-------y- : power-controller@f9089000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y M------------ : power-controller@f9089000 : qcom,saw2 : no_driver : no_config : n
Md-c-------y- : power-controller@f9099000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y M------------ : power-controller@f9099000 : qcom,saw2 : no_driver : no_config : n
Md-c-------y- : power-controller@f90a9000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y M------------ : power-controller@f90a9000 : qcom,saw2 : no_driver : no_config : n
Md-c-------y- : power-controller@f90b9000 : qcom,msm8974-saw2-v2.1-cpu : drivers/soc/qcom/spm.c : CONFIG_QCOM_PM : y M------------ : power-controller@f90b9000 : qcom,saw2 : no_driver : no_config : n
-d-c-------y- : restart@fc4ab000 : qcom,pshold : drivers/power/reset/msm-poweroff.c : CONFIG_POWER_RESET_MSM : y
-d-c-------y- : rng@f9bff000 : qcom,prng : drivers/char/hw_random/msm-rng.c : CONFIG_HW_RANDOM_MSM : y
-d-c-------y- : sdhci@f9824900 : qcom,sdhci-msm-v4 : drivers/mmc/host/sdhci-msm.c : CONFIG_MMC_SDHCI_MSM : y
-d-c-E-----y- : sdhci@f98a4900 : qcom,sdhci-msm-v4 : drivers/mmc/host/sdhci-msm.c : CONFIG_MMC_SDHCI_MSM : y
Md-c-------y- : serial@f991e000 : qcom,msm-uartdm-v1.4 : drivers/tty/serial/msm_serial.c : CONFIG_SERIAL_MSM : y Md-c-------y- : serial@f991e000 : qcom,msm-uartdm : drivers/tty/serial/msm_serial.c : CONFIG_SERIAL_MSM : y
-d-c-------y- : spmi@fc4cf000 : qcom,spmi-pmic-arb : drivers/spmi/spmi-pmic-arb.c : CONFIG_SPMI_MSM_PMIC_ARB : y
Md-c-------y- : pm8841@4 : qcom,pm8841 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y Md-c-------y- : pm8841@4 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y
Md-c-------y- : mpps@a000 : qcom,pm8841-mpp : drivers/pinctrl/qcom/pinctrl-spmi-mpp.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : y M------------ : mpps@a000 : qcom,spmi-mpp : no_driver : no_config : n
-d-c-----n--F : temp-alarm@2400 : qcom,spmi-temp-alarm : drivers/thermal/qcom-spmi-temp-alarm.c : CONFIG_QCOM_SPMI_TEMP_ALARM : n
Md-c-------y- : pm8841@5 : qcom,pm8841 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y Md-c-------y- : pm8841@5 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y
Md-c-------y- : pm8941@0 : qcom,pm8941 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y Md-c-------y- : pm8941@0 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y
-d-c-------y- : charger@1000 : qcom,pm8941-charger : drivers/power/qcom_smbb.c : CONFIG_CHARGER_QCOM_SMBB : y
-d-c-E-----y- : coincell@2800 : qcom,pm8941-coincell : drivers/misc/qcom-coincell.c : CONFIG_QCOM_COINCELL : y
Md-c-------y- : gpios@c000 : qcom,pm8941-gpio : drivers/pinctrl/qcom/pinctrl-spmi-gpio.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : y M------------ : gpios@c000 : qcom,spmi-gpio : no_driver : no_config : n
M------------ : iadc@3600 : qcom,pm8941-iadc : no_driver : no_config : n
Md-c-----n--F : iadc@3600 : qcom,spmi-iadc : drivers/iio/adc/qcom-spmi-iadc.c : CONFIG_QCOM_SPMI_IADC : n
Md-c-------y- : mpps@a000 : qcom,pm8941-mpp : drivers/pinctrl/qcom/pinctrl-spmi-mpp.c : CONFIG_PINCTRL_QCOM_SPMI_PMIC : y M------------ : mpps@a000 : qcom,spmi-mpp : no_driver : no_config : n
-d-c-----n--F : pwrkey@800 : qcom,pm8941-pwrkey : drivers/input/misc/pm8941-pwrkey.c : CONFIG_INPUT_PM8941_PWRKEY : n
-d-c-------y- : rtc@6000 : qcom,pm8941-rtc : drivers/rtc/rtc-pm8xxx.c : CONFIG_RTC_DRV_PM8XXX : y
-d-c-----n--F : temp-alarm@2400 : qcom,spmi-temp-alarm : drivers/thermal/qcom-spmi-temp-alarm.c : CONFIG_QCOM_SPMI_TEMP_ALARM : n
-d-c-----n--F : vadc@3100 : qcom,spmi-vadc : drivers/iio/adc/qcom-spmi-vadc.c : CONFIG_QCOM_SPMI_VADC : n
Md-c-------y- : pm8941@1 : qcom,pm8941 : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y Md-c-------y- : pm8941@1 : qcom,spmi-pmic : drivers/mfd/qcom-spmi-pmic.c : CONFIG_MFD_SPMI_PMIC : y
-d-c-E---n--F : wled@d800 : qcom,pm8941-wled : drivers/video/backlight/pm8941-wled.c : CONFIG_BACKLIGHT_PM8941_WLED : n
-d-c---H---y- : syscon@f9011000 : syscon : drivers/mfd/syscon.c : CONFIG_MFD_SYSCON : y
-d-c---H---y- : syscon@fd484000 : syscon : drivers/mfd/syscon.c : CONFIG_MFD_SYSCON : y
-d-c-------y- : tcsr-mutex : qcom,tcsr-mutex : drivers/hwspinlock/qcom_hwspinlock.c : CONFIG_HWSPINLOCK_QCOM : y
-d-c-------y- : timer@f9020000 : arm,armv7-timer-mem : drivers/clocksource/arm_arch_timer.c : CONFIG_ARM_ARCH_TIMER : y
-dDc-------y- : timer : arm,armv7-timer : arch/arm/kernel/vdso.c : CONFIG_VDSO : y -dDc-------y- : timer : arm,armv7-timer : drivers/clocksource/arm_arch_timer.c : CONFIG_ARM_ARCH_TIMER : y
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scripts/dtc: dt_to_config - usage message
In reply to Frank Rowand$ scripts/dtc/dt_to_config --help
Usage: dt_to_config [options] device-tree...
device_tree is: dts_file | dtb_file | proc_device-tree
Valid options:
-b ignore driver black list
-c FILE Read kernel config options from FILE
--config FILE synonym for 'c'
--exclude-flag FLAG exclude entries with a matching flag
-h Display this message and exit
--help synonym for 'h'
--include-flag FLAG include only entries with a matching flag
--include-suspect include only entries with an uppercase flag
--show-lists report of white and black lists
--version Display program version and exitReport driver source files that match the compatibles in the device tree file and the kernel config options that enable the driver source files.
This program must be run in the root directory of a Linux kernel source tree.
CAUTION:
This program uses heuristics to guess which driver(s) support each compatible string and which config option enables the driver(s). Do not believe that the reported information is fully correct. This program is intended to aid the process of determining the proper kernel configuration for a device tree, but this is not a fully automated process -- human involvement may still be required!
The driver match heuristic used is to search for source files containing the compatible string enclosed in quotes.
This program might not be able to find all drivers matching a compatible string.
Some makefiles are overly clever. This program was not made complex enough to handle them. If no config option is listed for a driver, look at the makefile for the driver source file. Even if a config option is listed for a driver, some other available config options may not be listed.
FLAG values:
M multiple compatibles found for this node
d driver found for this compatible
D multiple drivers found for this compatible
c kernel config found for this driver
C multiple config options found for this driver
E node is not enabled
W compatible is white listed
H matching driver and/or kernel config is hard coded
x kernel config hard coded in Makefile
n one or more kernel config file options is not set
m one or more kernel config file options is set to 'm'
y one or more kernel config file options is set to 'y'
F one of more kernel config file options fails to have correct valueUpper case letters indicate potential issues or problems.
Return value:
0 if no error
1 error processing command line
2 unable to open or read kernel config file
3 unable to open or process input device tree file(s)--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
scripts/dtc/dt_to_config line 1
Quoted 13 lines
Signed-off-by Gaurav Minocha <[email protected]>Signed-off-by Frank Rowand <[email protected]>--- scripts/dtc/dt_to_config | 1061 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1061 insertions(+)Index: b/scripts/dtc/dt_to_config
===================================================================scripts/dtc/dt_to_config new file +1
-0@@ -0,0 +1,1061 @@ +#!/usr/bin/perl
I don't do perl...
scripts/dtc/dt_to_config
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+ +# Copyright 2016 by Frank Rowand +# Š Copyright 2016 by Gaurav Minocha
^
Is this supposed to be a copyright symbol?
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+# +# This file is subject to the terms and conditions of the GNU General Public +# License v2.
[...]
scripts/dtc/dt_to_config line 76
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+# ----- magic compatibles, do not have a driver +# +# Will not search for drivers for these compatibles. + +%compat_white_list = ( + 'fixed-partitions' => '1',
Enabling CONFIG_MTD would be useful.
Quoted 1 line
+ 'none' => '1',
Is this an actual string used somewhere?
Quoted 1 line
+ 'pci' => '1',
ditto?
scripts/dtc/dt_to_config line 90
Quoted 12 lines
scripts/dtc/dt_to_config new file +12
-0+ 'simple-bus' => '1', +); + +# magic compatibles, have a driver +# +# Will not search for drivers for these compatibles. +# Will instead use the drivers and config options listed here. +# +# If you add an entry to this hash, add the corresponding entry +# to %driver_config_hard_code_list. +# +# These compatibles have a very large number of false positives.
What does this mean?
Quoted 32 lines
scripts/dtc/dt_to_config new file +32
-0+# +# 'hardcoded_no_driver' is a magic value. Other code knows this +# magic value. Do not use 'no_driver' here! +# +# TODO: Revisit each 'hardcoded_no_driver' to see how the compatible +# is used. Are there drivers that can be provided? + +%driver_hard_code_list = ( + 'cache' => ['hardcoded_no_driver'], + 'eeprom' => ['hardcoded_no_driver'], + 'gpio' => ['hardcoded_no_driver'], + 'gpios' => ['drivers/leds/leds-tca6507.c'], + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], + 'isa' => ['arch/mips/mti-malta/malta-dt.c', + 'arch/x86/kernel/devicetree.c'], + 'led' => ['hardcoded_no_driver'], + 'm25p32' => ['hardcoded_no_driver'], + 'm25p64' => ['hardcoded_no_driver'], + 'm25p80' => ['hardcoded_no_driver'], + 'mtd_ram' => ['drivers/mtd/maps/physmap_of.c'], + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], + 'spidev' => ['hardcoded_no_driver'], + 'syscon' => ['drivers/mfd/syscon.c'], + 'tlv320aic23' => ['hardcoded_no_driver'], + 'wm8731' => ['hardcoded_no_driver'], +); + +%driver_config_hard_code_list = ( + + # this one needed even if %driver_hard_code_list is empty + 'no_driver' => ['no_config'],
scripts/dtc/dt_to_config line 132
Quoted 10 lines
scripts/dtc/dt_to_config new file +10
-0+ 'hardcoded_no_driver' => ['no_config'], + + 'drivers/leds/leds-tca6507.c' => ['CONFIG_LEDS_TCA6507'], + 'drivers/input/keyboard/gpio_keys.c' => ['CONFIG_KEYBOARD_GPIO'], + 'drivers/i2c/busses/i2c-gpio.c' => ['CONFIG_I2C_GPIO'], + 'arch/mips/mti-malta/malta-dt.c' => ['obj-y'], + 'arch/x86/kernel/devicetree.c' => ['CONFIG_OF'], + 'drivers/mtd/maps/physmap_of.c' => ['CONFIG_MTD_PHYSMAP_OF'], + 'drivers/video/backlight/pwm_bl.c' => ['CONFIG_BACKLIGHT_PWM'], + 'drivers/mfd/syscon.c' => ['CONFIG_MFD_SYSCON'],
I don't understand why some of these are not searchable by compatible strings.
Quoted 17 lines
scripts/dtc/dt_to_config new file +17
-0+ + # drivers/usb/host/ehci-ppc-of.c + # drivers/usb/host/ehci-xilinx-of.c + # are included from: + # drivers/usb/host/ehci-hcd.c + # thus the search of Makefile for the included .c files is incorrect + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF + # + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) + # + # similarly, uhci-hcd.c includes uhci-platform.c + + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_PPC_OF'], + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', + 'CONFIG_USB_OHCI_HCD_PPC_OF'], +
scripts/dtc/dt_to_config line 159
Quoted 10 lines
scripts/dtc/dt_to_config new file +10
-0+ 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_XILINX'], + + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', + 'CONFIG_USB_UHCI_PLATFORM'], + + # scan_makefile will find only one of these config options: + # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', + 'CONFIG_SOC_LS1021A && CONFIG_SMP'],
These will never get updated when the files or config options change. Conversely, how do I know if I need to add something here? Is this list complete or based on testing some set of dts files. IMO, this list has to go to merge this.
scripts/dtc/dt_to_config line 172
Quoted 13 lines
scripts/dtc/dt_to_config new file +13
-0+); + + +# 'virt/kvm/arm/.*' are controlled by makefiles in other directories, +# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not +# add complexity to find_kconfig() to deal with this. There is a long +# term intent to change the kvm related makefiles to the normal kernel +# style. After that is done, this entry can be removed from the +# driver_black_list. + +@driver_black_list = ( + 'virt/kvm/arm/.*', +);
A small number of exceptions like this I could stomach.
The rest is just write-only language nonsense...
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 29 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
scripts/dtc/dt_to_config line 1
Quoted 13 lines
Signed-off-by Gaurav Minocha <[email protected]>Signed-off-by Frank Rowand <[email protected]>--- scripts/dtc/dt_to_config | 1061 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1061 insertions(+)Index: b/scripts/dtc/dt_to_config
===================================================================scripts/dtc/dt_to_config new file +1
-0@@ -0,0 +1,1061 @@ +#!/usr/bin/perlI don't do perl...
Quoted 5 lines
scripts/dtc/dt_to_config
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+ +# Copyright 2016 by Frank Rowand +# Š Copyright 2016 by Gaurav Minocha^Is this supposed to be a copyright symbol?
Yes. Gaurav, can we drop this symbol?
Quoted 6 lines
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+# +# This file is subject to the terms and conditions of the GNU General Public +# License v2.[...]
Quoted 8 lines
scripts/dtc/dt_to_config line 76
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+# ----- magic compatibles, do not have a driver +# +# Will not search for drivers for these compatibles. + +%compat_white_list = ( + 'fixed-partitions' => '1',Enabling
CONFIG_MTDwould be useful.
Thanks! I'll dig deeper, but it likes like maybeCONFIG_MTD_OF_PARTS also.
Quoted 3 lines
Quoted 1 line
+ 'none' => '1',
Is this an actual string used somewhere?
Yes. Looking at the output from running this against all .dts files has led to some interesting information.
An example of compatible = "none" is node mct@10050000 from arch/arm/boot/dts/exynos4210-universal_c210.dts
Quoted 4 lines
Quoted 2 lines
+ 'pci' => '1',
ditto?
arch/x86/platform/ce4100/falconfalls.dts, node pci@3fc
Quoted 6 lines
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+ 'simple-bus' => '1', +); + +# magic compatibles, have a driver +# +# Will not search for drivers for these compatibles.
Quoted 8 lines
scripts/dtc/dt_to_config line 90
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+# Will instead use the drivers and config options listed here. +# +# If you add an entry to this hash, add the corresponding entry +# to %driver_config_hard_code_list. +# +# These compatibles have a very large number of false positives.What does this mean?
That means that a _lot_ of garbage, bogus matches are reported, creating a lot of noise in the report.
Quoted 36 lines
Quoted 36 lines
scripts/dtc/dt_to_config new file +36
-0+# +# 'hardcoded_no_driver' is a magic value. Other code knows this +# magic value. Do not use 'no_driver' here! +# +# TODO: Revisit each 'hardcoded_no_driver' to see how the compatible +# is used. Are there drivers that can be provided? + +%driver_hard_code_list = ( + 'cache' => ['hardcoded_no_driver'], + 'eeprom' => ['hardcoded_no_driver'], + 'gpio' => ['hardcoded_no_driver'], + 'gpios' => ['drivers/leds/leds-tca6507.c'], + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], + 'isa' => ['arch/mips/mti-malta/malta-dt.c', + 'arch/x86/kernel/devicetree.c'], + 'led' => ['hardcoded_no_driver'], + 'm25p32' => ['hardcoded_no_driver'], + 'm25p64' => ['hardcoded_no_driver'], + 'm25p80' => ['hardcoded_no_driver'], + 'mtd_ram' => ['drivers/mtd/maps/physmap_of.c'], + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], + 'spidev' => ['hardcoded_no_driver'], + 'syscon' => ['drivers/mfd/syscon.c'], + 'tlv320aic23' => ['hardcoded_no_driver'], + 'wm8731' => ['hardcoded_no_driver'], +); + +%driver_config_hard_code_list = ( + + # this one needed even if %driver_hard_code_list is empty + 'no_driver' => ['no_config'], + 'hardcoded_no_driver' => ['no_config'], + + 'drivers/leds/leds-tca6507.c' => ['CONFIG_LEDS_TCA6507'], + 'drivers/input/keyboard/gpio_keys.c' => ['CONFIG_KEYBOARD_GPIO'],
Quoted 8 lines
scripts/dtc/dt_to_config line 132
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+ 'drivers/i2c/busses/i2c-gpio.c' => ['CONFIG_I2C_GPIO'], + 'arch/mips/mti-malta/malta-dt.c' => ['obj-y'], + 'arch/x86/kernel/devicetree.c' => ['CONFIG_OF'], + 'drivers/mtd/maps/physmap_of.c' => ['CONFIG_MTD_PHYSMAP_OF'], + 'drivers/video/backlight/pwm_bl.c' => ['CONFIG_BACKLIGHT_PWM'], + 'drivers/mfd/syscon.c' => ['CONFIG_MFD_SYSCON'],I don't understand why some of these are not searchable by compatible strings.
I will have to get back to you later on this question.
Quoted 24 lines
Quoted 24 lines
scripts/dtc/dt_to_config new file +24
-0+ + # drivers/usb/host/ehci-ppc-of.c + # drivers/usb/host/ehci-xilinx-of.c + # are included from: + # drivers/usb/host/ehci-hcd.c + # thus the search of Makefile for the included .c files is incorrect + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF + # + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) + # + # similarly, uhci-hcd.c includes uhci-platform.c + + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_PPC_OF'], + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', + 'CONFIG_USB_OHCI_HCD_PPC_OF'], + + 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_XILINX'], + + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', + 'CONFIG_USB_UHCI_PLATFORM'], + + # scan_makefile will find only one of these config options:
Quoted 8 lines
scripts/dtc/dt_to_config line 159
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+ # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', + 'CONFIG_SOC_LS1021A && CONFIG_SMP'],These will never get updated when the files or config options change. Conversely, how do I know if I need to add something here? Is this list complete or based on testing some set of dts files. IMO, this list has to go to merge this.
That is a concern that I have also. I added a warning flag in the flags field to indicate when one of these hard-coded values was used. The flag does not solve the issue, but does make it more visible.
The list is a result of running against every dts file in the kernel tree and looking at the reports.
Quoted 16 lines
scripts/dtc/dt_to_config line 172
Quoted 13 lines
scripts/dtc/dt_to_config new file +13
-0+); + + +# 'virt/kvm/arm/.*' are controlled by makefiles in other directories, +# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not +# add complexity to find_kconfig() to deal with this. There is a long +# term intent to change the kvm related makefiles to the normal kernel +# style. After that is done, this entry can be removed from the +# driver_black_list. + +@driver_black_list = ( + 'virt/kvm/arm/.*', +);A small number of exceptions like this I could stomach.
Quoted 4 lines
The rest is just write-only language nonsense...
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Frank Rowand
Quoted 29 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
scripts/dtc/dt_to_config line 1
Quoted 13 lines
Signed-off-by Gaurav Minocha <[email protected]>Signed-off-by Frank Rowand <[email protected]>--- scripts/dtc/dt_to_config | 1061 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1061 insertions(+)Index: b/scripts/dtc/dt_to_config
===================================================================scripts/dtc/dt_to_config new file +1
-0@@ -0,0 +1,1061 @@ +#!/usr/bin/perlI don't do perl...
Quoted 8 lines
Quoted 5 lines
scripts/dtc/dt_to_config
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+ +# Copyright 2016 by Frank Rowand +# Š Copyright 2016 by Gaurav Minocha^Is this supposed to be a copyright symbol?
Yes. Gaurav, can we drop this symbol?
Yes, Of course.
Quoted 138 lines
Quoted 7 lines
Quoted 4 lines
scripts/dtc/dt_to_config new file +3
-0+# +# This file is subject to the terms and conditions of the GNU General Public +# License v2.[...]
Quoted 8 lines
scripts/dtc/dt_to_config line 76
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+# ----- magic compatibles, do not have a driver +# +# Will not search for drivers for these compatibles. + +%compat_white_list = ( + 'fixed-partitions' => '1',Enabling
CONFIG_MTDwould be useful.Thanks! I'll dig deeper, but it likes like maybe
CONFIG_MTD_OF_PARTSalso.Quoted 3 lines
Quoted 1 line
+ 'none' => '1',
Is this an actual string used somewhere?
Yes. Looking at the output from running this against all .dts files has led to some interesting information.
An example of compatible = "none" is node mct@10050000 from
arch/arm/boot/dts/exynos4210-universal_c210.dtsQuoted 4 lines
Quoted 2 lines
+ 'pci' => '1',
ditto?
arch/x86/platform/ce4100/falconfalls.dts, node pci@3fcQuoted 6 lines
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+ 'simple-bus' => '1', +); + +# magic compatibles, have a driver +# +# Will not search for drivers for these compatibles.Quoted 8 lines
scripts/dtc/dt_to_config line 90
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+# Will instead use the drivers and config options listed here. +# +# If you add an entry to this hash, add the corresponding entry +# to %driver_config_hard_code_list. +# +# These compatibles have a very large number of false positives.What does this mean?
That means that a _lot_ of garbage, bogus matches are reported, creating a lot of noise in the report.
Quoted 36 lines
Quoted 36 lines
scripts/dtc/dt_to_config new file +36
-0+# +# 'hardcoded_no_driver' is a magic value. Other code knows this +# magic value. Do not use 'no_driver' here! +# +# TODO: Revisit each 'hardcoded_no_driver' to see how the compatible +# is used. Are there drivers that can be provided? + +%driver_hard_code_list = ( + 'cache' => ['hardcoded_no_driver'], + 'eeprom' => ['hardcoded_no_driver'], + 'gpio' => ['hardcoded_no_driver'], + 'gpios' => ['drivers/leds/leds-tca6507.c'], + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], + 'isa' => ['arch/mips/mti-malta/malta-dt.c', + 'arch/x86/kernel/devicetree.c'], + 'led' => ['hardcoded_no_driver'], + 'm25p32' => ['hardcoded_no_driver'], + 'm25p64' => ['hardcoded_no_driver'], + 'm25p80' => ['hardcoded_no_driver'], + 'mtd_ram' => ['drivers/mtd/maps/physmap_of.c'], + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], + 'spidev' => ['hardcoded_no_driver'], + 'syscon' => ['drivers/mfd/syscon.c'], + 'tlv320aic23' => ['hardcoded_no_driver'], + 'wm8731' => ['hardcoded_no_driver'], +); + +%driver_config_hard_code_list = ( + + # this one needed even if %driver_hard_code_list is empty + 'no_driver' => ['no_config'], + 'hardcoded_no_driver' => ['no_config'], + + 'drivers/leds/leds-tca6507.c' => ['CONFIG_LEDS_TCA6507'], + 'drivers/input/keyboard/gpio_keys.c' => ['CONFIG_KEYBOARD_GPIO'],Quoted 8 lines
scripts/dtc/dt_to_config line 132
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+ 'drivers/i2c/busses/i2c-gpio.c' => ['CONFIG_I2C_GPIO'], + 'arch/mips/mti-malta/malta-dt.c' => ['obj-y'], + 'arch/x86/kernel/devicetree.c' => ['CONFIG_OF'], + 'drivers/mtd/maps/physmap_of.c' => ['CONFIG_MTD_PHYSMAP_OF'], + 'drivers/video/backlight/pwm_bl.c' => ['CONFIG_BACKLIGHT_PWM'], + 'drivers/mfd/syscon.c' => ['CONFIG_MFD_SYSCON'],I don't understand why some of these are not searchable by compatible strings.
I will have to get back to you later on this question.
Quoted 24 lines
Quoted 24 lines
scripts/dtc/dt_to_config new file +24
-0+ + # drivers/usb/host/ehci-ppc-of.c + # drivers/usb/host/ehci-xilinx-of.c + # are included from: + # drivers/usb/host/ehci-hcd.c + # thus the search of Makefile for the included .c files is incorrect + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF + # + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) + # + # similarly, uhci-hcd.c includes uhci-platform.c + + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_PPC_OF'], + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', + 'CONFIG_USB_OHCI_HCD_PPC_OF'], + + 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_XILINX'], + + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', + 'CONFIG_USB_UHCI_PLATFORM'], + + # scan_makefile will find only one of these config options:Quoted 8 lines
scripts/dtc/dt_to_config line 159
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+ # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', + 'CONFIG_SOC_LS1021A && CONFIG_SMP'],These will never get updated when the files or config options change. Conversely, how do I know if I need to add something here? Is this list complete or based on testing some set of dts files. IMO, this list has to go to merge this.
Quoted 29 lines
That is a concern that I have also. I added a warning flag in the flags field to indicate when one of these hard-coded values was used. The flag does not solve the issue, but does make it more visible.
The list is a result of running against every dts file in the kernel tree and looking at the reports.
Quoted 20 lines
scripts/dtc/dt_to_config line 172
Quoted 13 lines
scripts/dtc/dt_to_config new file +13
-0+); + + +# 'virt/kvm/arm/.*' are controlled by makefiles in other directories, +# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not +# add complexity to find_kconfig() to deal with this. There is a long +# term intent to change the kvm related makefiles to the normal kernel +# style. After that is done, this entry can be removed from the +# driver_black_list. + +@driver_black_list = ( + 'virt/kvm/arm/.*', +);A small number of exceptions like this I could stomach.
The rest is just write-only language nonsense...
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
Quoted 3 lines
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
Do you mean to generate something like .config? If yes, then IMO it would not be a correct configuration file.
Quoted 97 lines
Quoted 13 lines
Signed-off-by Gaurav Minocha <[email protected]>Signed-off-by Frank Rowand <[email protected]>--- scripts/dtc/dt_to_config | 1061 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1061 insertions(+)Index: b/scripts/dtc/dt_to_config
===================================================================scripts/dtc/dt_to_config line 1
Quoted 1 line
scripts/dtc/dt_to_config new file +1
-0@@ -0,0 +1,1061 @@ +#!/usr/bin/perlI don't do perl...
scripts/dtc/dt_to_config
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+ +# Copyright 2016 by Frank Rowand +# Š Copyright 2016 by Gaurav Minocha^Is this supposed to be a copyright symbol?
Quoted 3 lines
scripts/dtc/dt_to_config new file +3
-0+# +# This file is subject to the terms and conditions of the GNU General Public +# License v2.[...]
scripts/dtc/dt_to_config line 76
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+# ----- magic compatibles, do not have a driver +# +# Will not search for drivers for these compatibles. + +%compat_white_list = ( + 'fixed-partitions' => '1',Enabling
CONFIG_MTDwould be useful.Quoted 1 line
+ 'none' => '1',
Is this an actual string used somewhere?
Quoted 1 line
+ 'pci' => '1',
ditto?
scripts/dtc/dt_to_config line 90
Quoted 12 lines
scripts/dtc/dt_to_config new file +12
-0+ 'simple-bus' => '1', +); + +# magic compatibles, have a driver +# +# Will not search for drivers for these compatibles. +# Will instead use the drivers and config options listed here. +# +# If you add an entry to this hash, add the corresponding entry +# to %driver_config_hard_code_list. +# +# These compatibles have a very large number of false positives.What does this mean?
Quoted 36 lines
scripts/dtc/dt_to_config new file +36
-0+# +# 'hardcoded_no_driver' is a magic value. Other code knows this +# magic value. Do not use 'no_driver' here! +# +# TODO: Revisit each 'hardcoded_no_driver' to see how the compatible +# is used. Are there drivers that can be provided? + +%driver_hard_code_list = ( + 'cache' => ['hardcoded_no_driver'], + 'eeprom' => ['hardcoded_no_driver'], + 'gpio' => ['hardcoded_no_driver'], + 'gpios' => ['drivers/leds/leds-tca6507.c'], + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], + 'isa' => ['arch/mips/mti-malta/malta-dt.c', + 'arch/x86/kernel/devicetree.c'], + 'led' => ['hardcoded_no_driver'], + 'm25p32' => ['hardcoded_no_driver'], + 'm25p64' => ['hardcoded_no_driver'], + 'm25p80' => ['hardcoded_no_driver'], + 'mtd_ram' => ['drivers/mtd/maps/physmap_of.c'], + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], + 'spidev' => ['hardcoded_no_driver'], + 'syscon' => ['drivers/mfd/syscon.c'], + 'tlv320aic23' => ['hardcoded_no_driver'], + 'wm8731' => ['hardcoded_no_driver'], +); + +%driver_config_hard_code_list = ( + + # this one needed even if %driver_hard_code_list is empty + 'no_driver' => ['no_config'], + 'hardcoded_no_driver' => ['no_config'], + + 'drivers/leds/leds-tca6507.c' => ['CONFIG_LEDS_TCA6507'], + 'drivers/input/keyboard/gpio_keys.c' => ['CONFIG_KEYBOARD_GPIO'],
Quoted 8 lines
scripts/dtc/dt_to_config line 132
Quoted 6 lines
scripts/dtc/dt_to_config new file +6
-0+ 'drivers/i2c/busses/i2c-gpio.c' => ['CONFIG_I2C_GPIO'], + 'arch/mips/mti-malta/malta-dt.c' => ['obj-y'], + 'arch/x86/kernel/devicetree.c' => ['CONFIG_OF'], + 'drivers/mtd/maps/physmap_of.c' => ['CONFIG_MTD_PHYSMAP_OF'], + 'drivers/video/backlight/pwm_bl.c' => ['CONFIG_BACKLIGHT_PWM'], + 'drivers/mfd/syscon.c' => ['CONFIG_MFD_SYSCON'],I don't understand why some of these are not searchable by compatible strings.
do you mean - pwm-backlight, gpio-keys, i2c-gpio and isa?
these are being filtered by:
my $drivers = git grep -l '"$compat"' -- $files;
not,
git grep -l '\.compatible\s*=\s*"$compat"' -- $files
Frank, please advise!
Quoted 53 lines
Quoted 18 lines
scripts/dtc/dt_to_config new file +17
-0+ + # drivers/usb/host/ehci-ppc-of.c + # drivers/usb/host/ehci-xilinx-of.c + # are included from: + # drivers/usb/host/ehci-hcd.c + # thus the search of Makefile for the included .c files is incorrect + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF + # + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) + # + # similarly, uhci-hcd.c includes uhci-platform.c + + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_PPC_OF'], + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', + 'CONFIG_USB_OHCI_HCD_PPC_OF'], +scripts/dtc/dt_to_config line 159
Quoted 10 lines
scripts/dtc/dt_to_config new file +10
-0+ 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', + 'CONFIG_USB_EHCI_HCD_XILINX'], + + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', + 'CONFIG_USB_UHCI_PLATFORM'], + + # scan_makefile will find only one of these config options: + # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', + 'CONFIG_SOC_LS1021A && CONFIG_SMP'],These will never get updated when the files or config options change. Conversely, how do I know if I need to add something here? Is this list complete or based on testing some set of dts files. IMO, this list has to go to merge this.
scripts/dtc/dt_to_config line 172
Quoted 13 lines
scripts/dtc/dt_to_config new file +13
-0+); + + +# 'virt/kvm/arm/.*' are controlled by makefiles in other directories, +# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not +# add complexity to find_kconfig() to deal with this. There is a long +# term intent to change the kvm related makefiles to the normal kernel +# style. After that is done, this entry can be removed from the +# driver_black_list. + +@driver_black_list = ( + 'virt/kvm/arm/.*', +);A small number of exceptions like this I could stomach.
The rest is just write-only language nonsense...
Rob
Quoted 10 lines · Gaurav Minocha
Quoted 9 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
Quoted 6 lines
Quoted 3 lines
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
Do you mean to generate something like .config? If yes, then IMO it would not be a correct configuration file.
A fragment to be appended to your current .config.
After that, an additional run of "make oldconfig" should (hopefully) bring everything into good shape.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Geert Uytterhoeven
Quoted 14 lines · Gaurav Minocha
Quoted 12 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
Quoted 7 lines
Quoted 2 lines
Do you mean to generate something like .config? If yes, then IMO it would not be a correct configuration file.
A fragment to be appended to your current .config.
After that, an additional run of "make oldconfig" should (hopefully) bring everything into good shape.
$ scripts/dtc/dt_to_config \
--config=$KBUILD_OUTPUT/.config \
arch/arm/boot/dts/qcom-apq8074-dragonboard.dts \
| grep "^............F" \
| cut -d ":" -f5 \
| sed -e 's| $|=y|' \
| sed -e 's| ||g'
CONFIG_ARCH_U300=y
CONFIG_SOC_IMX27=y
CONFIG_SOC_IMX31=y
CONFIG_ARCH_U300=y
CONFIG_SOC_IMX27=y
CONFIG_SOC_IMX31=y
CONFIG_ARM_BIG_LITTLE_CPUIDLE=y
CONFIG_QCOM_SMP2P=y
CONFIG_QCOM_SMP2P=y
CONFIG_QCOM_SMSM=y
CONFIG_QCOM_SPMI_TEMP_ALARM=y
CONFIG_QCOM_SPMI_IADC=y
CONFIG_INPUT_PM8941_PWRKEY=y
CONFIG_QCOM_SPMI_TEMP_ALARM=y
CONFIG_QCOM_SPMI_VADC=y
CONFIG_BACKLIGHT_PM8941_WLED=yBut Gaurav is correct. The answer is not this easy. For example, there may be multiple drivers that match a compatible value. But only one of those drivers will be the correct one. That is just one example, some cases become are much more complex.
I started writing code to try to score how good each compatible match is so the best match could be picked. At the moment, it is 255 lines and not very functional. I may continue experimenting with scoring in the future.
-Frank
Quoted 10 lines · Gaurav Minocha
Quoted 9 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
Quoted 6 lines
Quoted 3 lines
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
Do you mean to generate something like .config? If yes, then IMO it would not be a correct configuration file.
No, only a config fragment which is just some subset of config options. Then you could have a generic defconfig plus the fragment for a platform to get a working setup.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Rob Herring
Quoted 14 lines · Gaurav Minocha
Quoted 12 lines · Rob Herring
Quoted 7 lines · Frank Rowand
From: Frank Rowand <[email protected]>
Determining which kernel config options need to be enabled for a given devicetree can be a painful process. Create a new tool to find the drivers that may match a devicetree node compatible, find the kernel config options that enable the driver, and optionally report whether the kernel config option is enabled.
I would find this more useful to output a config fragment with all the options enabled. The hard part there is enabling the options a given option is dependent on which I don't think kbuild takes care of.
Quoted 6 lines
Quoted 2 lines
Do you mean to generate something like .config? If yes, then IMO it would not be a correct configuration file.
No, only a config fragment which is just some subset of config options. Then you could have a generic defconfig plus the fragment for a platform to get a working setup.
Okay, that seems like a useful option, that should be part of the tool itself. Will discuss with Frank once he is back. Thanks!
Quoted 2 lines
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html