/** DesignWare GPIO port group compatible model identifiers */
static const char * dwgpio_group_ids[] = {
- "snps,dw-apb-gpio",
+ DT_ID ( "snps,dw-apb-gpio", "DesignWare GPIO" ),
};
/** DesignWare GPIO port group devicetree driver */
/** DesignWare GPIO port compatible model identifiers */
static const char * dwgpio_ids[] = {
- "snps,dw-apb-gpio-port",
+ DT_ID ( "snps,dw-apb-gpio-port", "DesignWare GPIO port" ),
};
/** DesignWare GPIO port devicetree driver */
/** Cadence GEM compatible model identifiers */
static const char * cgem_ids[] = {
- "sifive,fu540-c000-gem",
+ DT_ROM ( "sifive,fu540-c000-gem", "SiFive GEM" ),
};
/** Cadence GEM devicetree driver */
/** DesignWare MAC compatible model identifiers */
static const char * dwmac_ids[] = {
- "thead,light-dwmac",
- "snps,dwmac",
+ DT_ROM ( "thead,light-dwmac", "T-Head MAC" ),
+ DT_ROM ( "snps,dwmac", "DesignWare MAC" ),
};
/** DesignWare MAC devicetree driver */
/** DesignWare UART compatible model identifiers */
static const char * dwuart_ids[] = {
- "snps,dw-apb-uart",
- "ns16550a",
+ DT_ID ( "snps,dw-apb-uart", "DesignWare UART" ),
+ DT_ID ( "ns16550a", "NS16550-compatible" ),
};
/** DesignWare UART devicetree driver */
/** DesignWare USB3 compatible model identifiers */
static const char * dwusb_ids[] = {
- "snps,dwc3",
+ DT_ID ( "snps,dwc3", "DesignWare USB3" ),
};
/** DesignWare USB3 devicetree driver */
void *priv;
};
+/* Define a devicetree device ID */
+#define DT_ID( _name, _desc ) _name
+
+/* Define a devicetree device ID with a corresponding build rule */
+#define DT_ROM( _name, _desc ) DT_ID ( _name, _desc )
+
/** A devicetree driver */
struct dt_driver {
/** Driver name */
my %RE = (
'parse_driver_class' => qr{ drivers/ (\w+?) / }x,
'parse_family' => qr{^ (?:\./)? (.*) \..+? $}x,
- 'find_rom_line' => qr/^ \s* ( (PCI|ISA|USB)_ROM \s*
+ 'find_rom_line' => qr/^ \s* ( (PCI|ISA|USB|DT)_ROM \s*
\( \s* (.*?) \s* \) \s* ) [,;]/msx,
'find_secboot' => qr/^ \s* FILE_SECBOOT \s*
\( \s* PERMITTED \s* \) \s* ; \s* $/mx,
return process_pci_rom($state, $rom_decl) if $rom_type eq "PCI";
return process_isa_rom($state, $rom_decl) if $rom_type eq "ISA";
return process_usb_rom($state, $rom_decl) if $rom_type eq "USB";
+ return process_dt_rom($state, $rom_decl) if $rom_type eq "DT";
return;
}
return 1;
}
+# Extract values from DT_ROM declaration lines and dispatch to
+# Makefile rule generator
+sub process_dt_rom {
+ my ($state, $decl) = @_;
+ return unless defined $decl;
+ return unless length $decl;
+ (my $image, $decl) = extract_quoted_string($decl, 'IMAGE');
+ (my $desc, $decl) = extract_quoted_string($decl, 'DESCRIPTION');
+ $image =~ s/,/-/;
+ if ( $image and $desc ) {
+ print_make_rules( $state, $image, $desc );
+ } else {
+ log_debug("WARNING", "Malformed DT_ROM macro on line $. of $state->{source_file}");
+ }
+ return 1;
+}
+
# Output Makefile rules for the specified ROM declarations
sub print_make_rules {
my ( $state, $image, $desc, $vendor, $device, $dup ) = @_;