Re: dwctwo(4) matching on Octeon

2016-03-19 Thread Masao Uebayashi
OK uebayasi@

On Sat, Mar 19, 2016 at 02:51:56PM +, Visa Hankala wrote:
> dwctwo(4) should be attached only on those Octeon models that have the
> DWC2 controller. The list below is not complete but it covers every
> model that has any chance of working with cnmac(4).
> 
> OK?
> 
> Index: arch/octeon/dev/octdwctwo.c
> ===
> RCS file: src/sys/arch/octeon/dev/octdwctwo.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 octdwctwo.c
> --- arch/octeon/dev/octdwctwo.c   1 Sep 2015 14:45:24 -   1.9
> +++ arch/octeon/dev/octdwctwo.c   19 Mar 2016 14:22:47 -
> @@ -24,6 +24,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -123,7 +124,17 @@ bus_space_t octdwctwo_tag = {
>  int
>  octdwctwo_match(struct device *parent, void *match, void *aux)
>  {
> - return (1);
> + int id;
> +
> + id = octeon_get_chipid();
> + switch (octeon_model_family(id)) {
> + case OCTEON_MODEL_FAMILY_CN30XX:
> + case OCTEON_MODEL_FAMILY_CN31XX:
> + case OCTEON_MODEL_FAMILY_CN50XX:
> + return (1);
> + default:
> + return (0);
> + }
>  }
>  
>  void
> 



dwctwo(4) matching on Octeon

2016-03-19 Thread Visa Hankala
dwctwo(4) should be attached only on those Octeon models that have the
DWC2 controller. The list below is not complete but it covers every
model that has any chance of working with cnmac(4).

OK?

Index: arch/octeon/dev/octdwctwo.c
===
RCS file: src/sys/arch/octeon/dev/octdwctwo.c,v
retrieving revision 1.9
diff -u -p -r1.9 octdwctwo.c
--- arch/octeon/dev/octdwctwo.c 1 Sep 2015 14:45:24 -   1.9
+++ arch/octeon/dev/octdwctwo.c 19 Mar 2016 14:22:47 -
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -123,7 +124,17 @@ bus_space_t octdwctwo_tag = {
 int
 octdwctwo_match(struct device *parent, void *match, void *aux)
 {
-   return (1);
+   int id;
+
+   id = octeon_get_chipid();
+   switch (octeon_model_family(id)) {
+   case OCTEON_MODEL_FAMILY_CN30XX:
+   case OCTEON_MODEL_FAMILY_CN31XX:
+   case OCTEON_MODEL_FAMILY_CN50XX:
+   return (1);
+   default:
+   return (0);
+   }
 }
 
 void