Author: mw
Date: Wed Aug  9 00:56:29 2017
New Revision: 322287
URL: https://svnweb.freebsd.org/changeset/base/322287

Log:
  Add support for "compatible" parameter in ofw_fdt_fixup
  
  Sometimes it's convenient to provide fixup to many boards
  that use the same SoC family (eg. Marvell Armada 38x).
  Instead of putting multiple entries in fdt_fixup_table,
  use one entry which refers to all boards with given SoC.
  
  Submitted by: Patryk Duda <p...@semihalf.com>
  Reviewed by: nwhitehorn, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11878

Modified:
  head/sys/dev/ofw/ofw_fdt.c

Modified: head/sys/dev/ofw/ofw_fdt.c
==============================================================================
--- head/sys/dev/ofw/ofw_fdt.c  Wed Aug  9 00:51:45 2017        (r322286)
+++ head/sys/dev/ofw/ofw_fdt.c  Wed Aug  9 00:56:29 2017        (r322287)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/fdt/fdt_common.h>
 #include <dev/ofw/ofwvar.h>
 #include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus_subr.h>
 
 #include "ofw_if.h"
 
@@ -450,7 +451,15 @@ ofw_fdt_fixup(ofw_t ofw)
        for (i = 0; fdt_fixup_table[i].model != NULL; i++) {
                if (strncmp(model, fdt_fixup_table[i].model,
                    FDT_MODEL_LEN) != 0)
-                       continue;
+                       /*
+                        * Sometimes it's convenient to provide one
+                        * fixup entry that refers to many boards.
+                        * To handle this case, simply check if model
+                        * is compatible parameter
+                        */
+                       if(!ofw_bus_node_is_compatible(root,
+                           fdt_fixup_table[i].model))
+                               continue;
 
                if (fdt_fixup_table[i].handler != NULL)
                        (*fdt_fixup_table[i].handler)(root);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to