Author: andrew
Date: Wed Feb 10 09:19:29 2016
New Revision: 295464
URL: https://svnweb.freebsd.org/changeset/base/295464

Log:
  Update of the Allwinner drivers to:
   * Use the Linux compat string
   * Use EARLY_DRIVER_MODULE to attach at the right time
   * Add a generic A10 kernel config file
   * A20 now use generic_timer
   * Add two new dts files for Olimex boards
   * Update our custom DTS file for A10 and A20 to use the same compatible
     property names as the vendor ones.
  
  Submitted by: Emmanuel Vadot <m...@bidouilliste.com>
  Differential Revision:        https://reviews.freebsd.org/D4792

Added:
  head/sys/arm/conf/A10
     - copied, changed from r295446, head/sys/arm/conf/A20
  head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts
     - copied, changed from r295446, head/sys/boot/fdt/dts/arm/bananapi.dts
  head/sys/boot/fdt/dts/arm/olinuxino-lime.dts
     - copied, changed from r295446, head/sys/boot/fdt/dts/arm/bananapi.dts
Modified:
  head/sys/arm/allwinner/a10_clk.c
  head/sys/arm/allwinner/a10_common.c
  head/sys/arm/allwinner/a10_ehci.c
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/allwinner/a10_mmc.c
  head/sys/arm/allwinner/a10_wdog.c
  head/sys/arm/allwinner/a20/a20_cpu_cfg.c
  head/sys/arm/allwinner/aintc.c
  head/sys/arm/allwinner/files.a10
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/allwinner/if_emac.c
  head/sys/arm/allwinner/timer.c
  head/sys/arm/conf/A20
  head/sys/arm64/arm64/swtch.S
  head/sys/boot/fdt/dts/arm/bananapi.dts
  head/sys/boot/fdt/dts/arm/cubieboard2.dts
  head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi
  head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/sys/arm/allwinner/a10_clk.c
==============================================================================
--- head/sys/arm/allwinner/a10_clk.c    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a10_clk.c    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -109,7 +109,8 @@ static driver_t a10_ccm_driver = {
 
 static devclass_t a10_ccm_devclass;
 
-DRIVER_MODULE(a10_ccm, simplebus, a10_ccm_driver, a10_ccm_devclass, 0, 0);
+EARLY_DRIVER_MODULE(a10_ccm, simplebus, a10_ccm_driver, a10_ccm_devclass, 0, 0,
+    BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
 
 int
 a10_clk_usb_activate(void)
@@ -200,7 +201,7 @@ a10_clk_gmac_activate(phandle_t node)
 
        /* Set GMAC mode. */
        reg_value = CCM_GMAC_CLK_MII;
-       if (OF_getprop_alloc(node, "phy-type", 1, (void **)&phy_type) > 0) {
+       if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type) > 0) {
                if (strcasecmp(phy_type, "rgmii") == 0)
                        reg_value = CCM_GMAC_CLK_RGMII | CCM_GMAC_MODE_RGMII;
                else if (strcasecmp(phy_type, "rgmii-bpi") == 0) {

Modified: head/sys/arm/allwinner/a10_common.c
==============================================================================
--- head/sys/arm/allwinner/a10_common.c Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a10_common.c Wed Feb 10 09:19:29 2016        
(r295464)
@@ -50,7 +50,7 @@ fdt_aintc_decode_ic(phandle_t node, pcel
 {
        int offset;
 
-       if (fdt_is_compatible(node, "allwinner,sun4i-ic"))
+       if (fdt_is_compatible(node, "allwinner,sun4i-a10-ic"))
                offset = 0;
        else if (fdt_is_compatible(node, "arm,gic"))
                offset = 32;

Modified: head/sys/arm/allwinner/a10_ehci.c
==============================================================================
--- head/sys/arm/allwinner/a10_ehci.c   Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a10_ehci.c   Wed Feb 10 09:19:29 2016        
(r295464)
@@ -43,10 +43,10 @@ __FBSDID("$FreeBSD$");
 #include <sys/gpio.h>
 
 #include <machine/bus.h>
-#include <dev/ofw/ofw_bus.h> 
+#include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
-#include <dev/usb/usb.h> 
+#include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
 
 #include <dev/usb/usb_core.h>
@@ -90,6 +90,12 @@ static device_detach_t a10_ehci_detach;
 bs_r_1_proto(reversed);
 bs_w_1_proto(reversed);
 
+static struct ofw_compat_data compat_data[] = {
+       {"allwinner,sun4i-a10-ehci", 1},
+       {"allwinner,sun7i-a20-ehci", 1},
+       {NULL,             0}
+};
+
 static int
 a10_ehci_probe(device_t self)
 {
@@ -97,7 +103,7 @@ a10_ehci_probe(device_t self)
        if (!ofw_bus_status_okay(self))
                return (ENXIO);
 
-       if (!ofw_bus_is_compatible(self, "allwinner,usb-ehci")) 
+       if (ofw_bus_search_compatible(self, compat_data)->ocd_data == 0)
                return (ENXIO);
 
        device_set_desc(self, EHCI_HC_DEVSTR);

Modified: head/sys/arm/allwinner/a10_gpio.c
==============================================================================
--- head/sys/arm/allwinner/a10_gpio.c   Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a10_gpio.c   Wed Feb 10 09:19:29 2016        
(r295464)
@@ -73,6 +73,12 @@ __FBSDID("$FreeBSD$");
 #define A10_GPIO_INPUT         0
 #define A10_GPIO_OUTPUT                1
 
+static struct ofw_compat_data compat_data[] = {
+       {"allwinner,sun4i-a10-pinctrl", 1},
+       {"allwinner,sun7i-a20-pinctrl", 1},
+       {NULL,             0}
+};
+
 struct a10_gpio_softc {
        device_t                sc_dev;
        device_t                sc_busdev;
@@ -373,7 +379,7 @@ a10_gpio_probe(device_t dev)
        if (!ofw_bus_status_okay(dev))
                return (ENXIO);
 
-       if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-gpio"))
+       if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
                return (ENXIO);
 
        device_set_desc(dev, "Allwinner GPIO controller");
@@ -493,7 +499,9 @@ static driver_t a10_gpio_driver = {
        sizeof(struct a10_gpio_softc),
 };
 
-DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 0, 0);
+EARLY_DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 
0, 0,
+    BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
+
 
 int
 a10_gpio_ethernet_activate(uint32_t func)

Modified: head/sys/arm/allwinner/a10_mmc.c
==============================================================================
--- head/sys/arm/allwinner/a10_mmc.c    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a10_mmc.c    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -62,6 +62,12 @@ static int a10_mmc_pio_mode = 0;
 
 TUNABLE_INT("hw.a10.mmc.pio_mode", &a10_mmc_pio_mode);
 
+static struct ofw_compat_data compat_data[] = {
+       {"allwinner,sun4i-a10-mmc", 1},
+       {"allwinner,sun5i-a13-mmc", 1},
+       {NULL,             0}
+};
+
 struct a10_mmc_softc {
        bus_space_handle_t      a10_bsh;
        bus_space_tag_t         a10_bst;
@@ -123,8 +129,9 @@ a10_mmc_probe(device_t dev)
 
        if (!ofw_bus_status_okay(dev))
                return (ENXIO);
-       if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-mmc"))
+       if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
                return (ENXIO);
+
        device_set_desc(dev, "Allwinner Integrated MMC/SD controller");
 
        return (BUS_PROBE_DEFAULT);

Modified: head/sys/arm/allwinner/a10_wdog.c
==============================================================================
--- head/sys/arm/allwinner/a10_wdog.c   Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a10_wdog.c   Wed Feb 10 09:19:29 2016        
(r295464)
@@ -95,7 +95,7 @@ a10wd_probe(device_t dev)
        if (!ofw_bus_status_okay(dev))
                return (ENXIO);
 
-       if (ofw_bus_is_compatible(dev, "allwinner,sun4i-wdt")) {
+       if (ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-wdt")) {
                device_set_desc(dev, "Allwinner A10 Watchdog");
                return (BUS_PROBE_DEFAULT);
        }

Modified: head/sys/arm/allwinner/a20/a20_cpu_cfg.c
==============================================================================
--- head/sys/arm/allwinner/a20/a20_cpu_cfg.c    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/a20/a20_cpu_cfg.c    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -117,7 +117,8 @@ static driver_t a20_cpu_cfg_driver = {
 
 static devclass_t a20_cpu_cfg_devclass;
 
-DRIVER_MODULE(a20_cpu_cfg, simplebus, a20_cpu_cfg_driver, 
a20_cpu_cfg_devclass, 0, 0);
+EARLY_DRIVER_MODULE(a20_cpu_cfg, simplebus, a20_cpu_cfg_driver, 
a20_cpu_cfg_devclass, 0, 0,
+    BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
 
 uint64_t
 a20_read_counter64(void)

Modified: head/sys/arm/allwinner/aintc.c
==============================================================================
--- head/sys/arm/allwinner/aintc.c      Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/aintc.c      Wed Feb 10 09:19:29 2016        
(r295464)
@@ -79,6 +79,12 @@ __FBSDID("$FreeBSD$");
 #define SW_INT_ENABLE_REG(_b)          (0x40 + ((_b) * 4))
 #define SW_INT_MASK_REG(_b)            (0x50 + ((_b) * 4))
 
+static struct ofw_compat_data compat_data[] = {
+       {"allwinner,sun4i-a10-ic", 1},
+       {"allwinner,sun7i-a20-sc-nmi", 1},
+       {NULL,             0}
+};
+
 struct a10_aintc_softc {
        device_t                sc_dev;
        struct resource *       aintc_res;
@@ -101,7 +107,7 @@ a10_aintc_probe(device_t dev)
        if (!ofw_bus_status_okay(dev))
                return (ENXIO);
 
-       if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-ic"))
+       if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
                return (ENXIO);
        device_set_desc(dev, "A10 AINTC Interrupt Controller");
        return (BUS_PROBE_DEFAULT);
@@ -158,7 +164,8 @@ static driver_t a10_aintc_driver = {
 
 static devclass_t a10_aintc_devclass;
 
-DRIVER_MODULE(aintc, simplebus, a10_aintc_driver, a10_aintc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(aintc, simplebus, a10_aintc_driver, a10_aintc_devclass, 0, 
0,
+    BUS_PASS_INTERRUPT + BUS_PASS_ORDER_FIRST);
 
 int
 arm_get_next_irq(int last_irq)

Modified: head/sys/arm/allwinner/files.a10
==============================================================================
--- head/sys/arm/allwinner/files.a10    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/files.a10    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -1,3 +1,4 @@
 # $FreeBSD$
 
 arm/allwinner/aintc.c                  standard
+arm/allwinner/timer.c                  standard

Modified: head/sys/arm/allwinner/files.allwinner
==============================================================================
--- head/sys/arm/allwinner/files.allwinner      Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/files.allwinner      Wed Feb 10 09:19:29 2016        
(r295464)
@@ -12,5 +12,4 @@ arm/allwinner/a10_wdog.c              standard
 arm/allwinner/a20/a20_cpu_cfg.c        standard
 arm/allwinner/allwinner_machdep.c      standard
 arm/allwinner/if_emac.c                        optional        emac
-arm/allwinner/timer.c                  standard
 #arm/allwinner/console.c               standard

Modified: head/sys/arm/allwinner/if_emac.c
==============================================================================
--- head/sys/arm/allwinner/if_emac.c    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/if_emac.c    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -756,7 +756,7 @@ static int
 emac_probe(device_t dev)
 {
 
-       if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-emac"))
+       if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-emac"))
                return (ENXIO);
 
        device_set_desc(dev, "A10/A20 EMAC ethernet controller");

Modified: head/sys/arm/allwinner/timer.c
==============================================================================
--- head/sys/arm/allwinner/timer.c      Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm/allwinner/timer.c      Wed Feb 10 09:19:29 2016        
(r295464)
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/kdb.h>
 
-#include "a20/a20_cpu_cfg.h"
+#include <arm/allwinner/allwinner_machdep.h>
 
 /**
  * Timer registers addr
@@ -84,7 +84,6 @@ struct a10_timer_softc {
        uint32_t        sc_period;
        uint32_t        timer0_freq;
        struct eventtimer et;
-       uint8_t         sc_timer_type;  /* 0 for A10, 1 for A20 */
 };
 
 int a10_timer_get_timerfreq(struct a10_timer_softc *);
@@ -127,10 +126,6 @@ timer_read_counter64(void)
 {
        uint32_t lo, hi;
 
-       /* In case of A20 get appropriate counter info */
-       if (a10_timer_sc->sc_timer_type)
-               return (a20_read_counter64());
-
        /* Latch counter, wait for it to be ready to read. */
        timer_write_4(a10_timer_sc, CNT64_CTRL_REG, CNT64_RL_EN);
        while (timer_read_4(a10_timer_sc, CNT64_CTRL_REG) & CNT64_RL_EN)
@@ -146,14 +141,16 @@ static int
 a10_timer_probe(device_t dev)
 {
        struct a10_timer_softc *sc;
+       u_int soc_family;
 
        sc = device_get_softc(dev);
 
-       if (ofw_bus_is_compatible(dev, "allwinner,sun4i-timer"))
-               sc->sc_timer_type = 0;
-       else if (ofw_bus_is_compatible(dev, "allwinner,sun7i-timer"))
-               sc->sc_timer_type = 1;
-       else
+       if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-timer"))
+               return (ENXIO);
+
+       soc_family = allwinner_soc_family();
+       if (soc_family != ALLWINNERSOC_SUN4I &&
+           soc_family != ALLWINNERSOC_SUN5I)
                return (ENXIO);
 
        device_set_desc(dev, "Allwinner A10/A20 timer");
@@ -352,7 +349,8 @@ static driver_t a10_timer_driver = {
 
 static devclass_t a10_timer_devclass;
 
-DRIVER_MODULE(a10_timer, simplebus, a10_timer_driver, a10_timer_devclass, 0, 
0);
+EARLY_DRIVER_MODULE(a10_timer, simplebus, a10_timer_driver, 
a10_timer_devclass, 0, 0,
+    BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
 
 void
 DELAY(int usec)

Copied and modified: head/sys/arm/conf/A10 (from r295446, head/sys/arm/conf/A20)
==============================================================================
--- head/sys/arm/conf/A20       Tue Feb  9 18:43:52 2016        (r295446, copy 
source)
+++ head/sys/arm/conf/A10       Wed Feb 10 09:19:29 2016        (r295464)
@@ -1,5 +1,5 @@
 #
-# A20 -- Custom configuration for the Allwinner A20 ARM SoC
+# A10 -- Custom configuration for the AllWinner A10 SoC
 #
 # For more information on this file, please read the config(5) manual page,
 # and/or the handbook section on Kernel Configuration Files:
@@ -18,16 +18,13 @@
 #
 # $FreeBSD$
 
-ident          A20
+ident          A10
 
 include        "std.armv6"
-include        "../allwinner/a20/std.a20"
-
-options        ARM_INTRNG
+include        "../allwinner/std.a10"
 
 options        HZ=100
-options        SCHED_ULE               # ULE scheduler
-options        SMP                     # Enable multiple cores
+options        SCHED_4BSD              # 4BSD scheduler
 options        PLATFORM
 
 # Debugging for use in -current
@@ -50,13 +47,7 @@ options      WITNESS_SKIPSPIN        # Don't run wi
 #options       BOOTP_NFSROOT
 #options       BOOTP_COMPAT
 #options       BOOTP_NFSV3
-#options       BOOTP_WIRED_TO=dwc0
-
-# Boot device is 2nd slice on MMC/SD card
-options        ROOTDEVNAME=\"ufs:/dev/da0s2\"
-
-# Interrupt controller
-device         gic
+#options       BOOTP_WIRED_TO=emac0
 
 # MMC/SD/SDIO Card slot support
 device         mmc                     # mmc/sd bus
@@ -104,8 +95,7 @@ device               ether
 device         mii
 device         bpf
 
-#device                emac                    # 10/100 integrated EMAC 
controller
-device         dwc                     # 10/100/1000 integrated GMAC controller
+device         emac
 
 # USB ethernet support, requires miibus
 device         miibus

Modified: head/sys/arm/conf/A20
==============================================================================
--- head/sys/arm/conf/A20       Wed Feb 10 08:03:10 2016        (r295463)
+++ head/sys/arm/conf/A20       Wed Feb 10 09:19:29 2016        (r295464)
@@ -52,12 +52,12 @@ options     WITNESS_SKIPSPIN        # Don't run wi
 #options       BOOTP_NFSV3
 #options       BOOTP_WIRED_TO=dwc0
 
-# Boot device is 2nd slice on MMC/SD card
-options        ROOTDEVNAME=\"ufs:/dev/da0s2\"
-
 # Interrupt controller
 device         gic
 
+# ARM Generic Timer
+device         generic_timer
+
 # MMC/SD/SDIO Card slot support
 device         mmc                     # mmc/sd bus
 device         mmcsd                   # mmc/sd flash cards

Modified: head/sys/arm64/arm64/swtch.S
==============================================================================
--- head/sys/arm64/arm64/swtch.S        Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/arm64/arm64/swtch.S        Wed Feb 10 09:19:29 2016        
(r295464)
@@ -129,12 +129,6 @@ END(cpu_throw)
  * x3 to x7, x16 and x17 are caller saved
  */
 ENTRY(cpu_switch)
-       /* Store the new curthread */
-       str     x1, [x18, #PC_CURTHREAD]
-       /* And the new pcb */
-       ldr     x4, [x1, #TD_PCB]
-       str     x4, [x18, #PC_CURPCB]
-
        /*
         * Save the old context.
         */
@@ -174,10 +168,15 @@ ENTRY(cpu_switch)
        mov     x0, x19
 #endif
 
+       /* Store the new curthread */
+       str     x1, [x18, #PC_CURTHREAD]
+
        /*
-        * Restore the saved context.
+        * Restore the saved context and save it as the curpcb.
         */
        ldr     x4, [x1, #TD_PCB]
+       str     x4, [x18, #PC_CURPCB]
+
 
        /*
         * TODO: We may need to flush the cache here if switching

Modified: head/sys/boot/fdt/dts/arm/bananapi.dts
==============================================================================
--- head/sys/boot/fdt/dts/arm/bananapi.dts      Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/boot/fdt/dts/arm/bananapi.dts      Wed Feb 10 09:19:29 2016        
(r295464)
@@ -28,7 +28,8 @@
 
 /dts-v1/;
 
-/include/ "sun7i-a20.dtsi"
+#include "sun7i-a20.dtsi"
+
 
 #include <dt-bindings/gpio/gpio.h>
 
@@ -65,7 +66,7 @@
                };
 
                gmac@01c50000 {
-                       phy-type = "rgmii-bpi";
+                       phy-mode = "rgmii-bpi";
                        status = "okay";
                };
 

Modified: head/sys/boot/fdt/dts/arm/cubieboard2.dts
==============================================================================
--- head/sys/boot/fdt/dts/arm/cubieboard2.dts   Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/boot/fdt/dts/arm/cubieboard2.dts   Wed Feb 10 09:19:29 2016        
(r295464)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2013 Ganbold Tsagaankhuu <ganb...@freebsd.org>
+ * Copyright (c) 2016 Emmanuel Vadot <m...@bidouilliste.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,78 +23,19 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * $FreeBSD$
  */
 
-/dts-v1/;
-
-/include/ "sun7i-a20.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
+#include "sun7i-a20-cubieboard2.dts"
 
 / {
-       model = "Cubietech Cubieboard2";
-
-       memory {
-               device_type = "memory";
-               reg = < 0x40000000 0x40000000 >;        /* 1GB RAM */
-       };
-
-       aliases {
-               soc = &SOC;
-               UART0 = &UART0;
-       };
-
-       SOC: a20 {
-
-               usb1: usb@01c14000 {
-                       status = "okay";
-               };
-
-               usb2: usb@01c1c000 {
-                       status = "okay";
-               };
-
-               UART0: serial@01c28000 {
-                       status = "okay";
-               };
-
-               mmc0: mmc@01c0f000 {
-                       status = "okay";
-               };
-
-               emac@01c0b000 {
-                       status = "okay";
-               };
-
-               gmac@01c50000 {
-                       status = "okay";
-               };
-
-               ahci: sata@01c18000 {
-                       status = "okay";
+       soc@01c00000 {
+               ccm@01c20000 {
+                       compatible = "allwinner,sun4i-ccm";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = < 0x01c20000 0x400 >;
                };
        };
-
-       leds {
-               compatible = "gpio-leds";
-
-               blue {
-                       label = "cubieboard2:blue:usr";
-                       gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>;
-               };
-
-               green {
-                       label = "cubieboard2:green:usr";
-                       gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       chosen {
-               bootargs = "-v";
-               stdin = "UART0";
-               stdout = "UART0";
-       };
 };
-

Copied and modified: head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts (from 
r295446, head/sys/boot/fdt/dts/arm/bananapi.dts)
==============================================================================
--- head/sys/boot/fdt/dts/arm/bananapi.dts      Tue Feb  9 18:43:52 2016        
(r295446, copy source)
+++ head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts    Wed Feb 10 09:19:29 
2016        (r295464)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013 Ganbold Tsagaankhuu <ganb...@freebsd.org>
+ * Copyright (c) 2015 Emmanuel Vadot <m...@bidouilliste.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,70 +22,19 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * $FreeBSD$
  */
 
-/dts-v1/;
-
-/include/ "sun7i-a20.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
+#include "sun7i-a20-olimex-som-evb.dts"
 
 / {
-       model = "LeMaker Banana Pi";
-       compatible = "lemaker,bananapi", "allwinner,sun7i-a20";
-
-       memory {
-               device_type = "memory";
-               reg = < 0x40000000 0x40000000 >;        /* 1GB RAM */
-       };
-
-       aliases {
-               soc = &SOC;
-               UART0 = &UART0;
-       };
-
-       SOC: a20 {
-
-               usb1: usb@01c14000 {
-                       status = "okay";
-               };
-
-               usb2: usb@01c1c000 {
-                       status = "okay";
-               };
-
-               UART0: serial@01c28000 {
-                       status = "okay";
+       soc@01c00000 {
+               ccm@01c20000 {
+                       compatible = "allwinner,sun4i-ccm";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = < 0x01c20000 0x400 >;
                };
-
-               mmc0: mmc@01c0f000 {
-                       status = "okay";
-               };
-
-               gmac@01c50000 {
-                       phy-type = "rgmii-bpi";
-                       status = "okay";
-               };
-
-               ahci: sata@01c18000 {
-                       status = "okay";
-               };
-       };
-
-       leds {
-               compatible = "gpio-leds";
-
-               green {
-                       label = "bananapi:green:usr";
-                       gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       chosen {
-               bootargs = "-v";
-               stdin = "UART0";
-               stdout = "UART0";
        };
 };

Copied and modified: head/sys/boot/fdt/dts/arm/olinuxino-lime.dts (from 
r295446, head/sys/boot/fdt/dts/arm/bananapi.dts)
==============================================================================
--- head/sys/boot/fdt/dts/arm/bananapi.dts      Tue Feb  9 18:43:52 2016        
(r295446, copy source)
+++ head/sys/boot/fdt/dts/arm/olinuxino-lime.dts        Wed Feb 10 09:19:29 
2016        (r295464)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013 Ganbold Tsagaankhuu <ganb...@freebsd.org>
+ * Copyright (c) 2015 Emmanuel Vadot <m...@bidouilliste.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,66 +26,15 @@
  * $FreeBSD$
  */
 
-/dts-v1/;
-
-/include/ "sun7i-a20.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
+#include "sun4i-a10-olinuxino-lime.dts"
 
 / {
-       model = "LeMaker Banana Pi";
-       compatible = "lemaker,bananapi", "allwinner,sun7i-a20";
-
-       memory {
-               device_type = "memory";
-               reg = < 0x40000000 0x40000000 >;        /* 1GB RAM */
-       };
-
-       aliases {
-               soc = &SOC;
-               UART0 = &UART0;
-       };
-
-       SOC: a20 {
-
-               usb1: usb@01c14000 {
-                       status = "okay";
-               };
-
-               usb2: usb@01c1c000 {
-                       status = "okay";
-               };
-
-               UART0: serial@01c28000 {
-                       status = "okay";
+       soc@01c00000 {
+               ccm@01c20000 {
+                       compatible = "allwinner,sun4i-ccm";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = < 0x01c20000 0x400 >;
                };
-
-               mmc0: mmc@01c0f000 {
-                       status = "okay";
-               };
-
-               gmac@01c50000 {
-                       phy-type = "rgmii-bpi";
-                       status = "okay";
-               };
-
-               ahci: sata@01c18000 {
-                       status = "okay";
-               };
-       };
-
-       leds {
-               compatible = "gpio-leds";
-
-               green {
-                       label = "bananapi:green:usr";
-                       gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       chosen {
-               bootargs = "-v";
-               stdin = "UART0";
-               stdout = "UART0";
        };
 };

Modified: head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi
==============================================================================
--- head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -45,7 +45,7 @@
                bus-frequency = <0>;
 
                AINTC: interrupt-controller@01c20400 {
-                       compatible = "allwinner,sun4i-ic";
+                       compatible = "allwinner,sun4i-a10-ic";
                        interrupt-controller;
                        #address-cells = <0>;
                        #interrupt-cells = <1>;
@@ -67,7 +67,7 @@
                };
 
                timer@01c20c00 {
-                       compatible = "allwinner,sun4i-timer";
+                       compatible = "allwinner,sun4i-a10-timer";
                        reg = <0x01c20c00 0x90>;
                        interrupts = < 22 >;
                        interrupt-parent = <&AINTC>;
@@ -82,7 +82,7 @@
 
                GPIO: gpio@01c20800 {
                        #gpio-cells = <3>;
-                       compatible = "allwinner,sun4i-gpio";
+                       compatible = "allwinner,sun4i-a10-pinctrl";
                        gpio-controller;
                        reg =<  0x01c20800 0x400 >;
                        interrupts = < 28 >;
@@ -90,14 +90,14 @@
                };
 
                usb1: usb@01c14000 {
-                       compatible = "allwinner,usb-ehci", "usb-ehci";
+                       compatible = "allwinner,sun4i-a10-ehci", "generic-ehci";
                        reg = <0x01c14000 0x1000>;
                        interrupts = < 39 >;
                        interrupt-parent = <&AINTC>;
                };
 
                usb2: usb@01c1c000 {
-                       compatible = "allwinner,usb-ehci", "usb-ehci";
+                       compatible = "allwinner,sun4i-a10-ehci", "generic-ehci";
                        reg = <0x01c1c000 0x1000>;
                        interrupts = < 40 >;
                        interrupt-parent = <&AINTC>;
@@ -130,7 +130,7 @@
                };
 
                emac@01c0b000 {
-                       compatible = "allwinner,sun4i-emac";
+                       compatible = "allwinner,sun4i-a10-emac";
                        reg = <0x01c0b000 0x1000>;
                        interrupts = <55>;
                        interrupt-parent = <&AINTC>;

Modified: head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi
==============================================================================
--- head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi    Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi    Wed Feb 10 09:19:29 2016        
(r295464)
@@ -26,6 +26,8 @@
  * $FreeBSD$
  */
 
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
 / {
        compatible = "allwinner,sun7i-a20";
        #address-cells = <1>;
@@ -37,6 +39,14 @@
                soc = &SOC;
        };
 
+       timer {
+               compatible = "arm,armv7-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_LOW)>;
+       };
+
        SOC: a20 {
                #address-cells = <1>;
                #size-cells = <1>;
@@ -47,9 +57,12 @@
                GIC: interrupt-controller@01c81000 {
                        compatible = "arm,gic";
                        reg =   <0x01c81000 0x1000>,    /* Distributor 
Registers */
-                               <0x01c82000 0x0100>;    /* CPU Interface 
Registers */
+                               <0x01c82000 0x0100>,    /* CPU Interface 
Registers */
+                               <0x01c84000 0x2000>,
+                               <0x01c86000 0x2000>;
                        interrupt-controller;
-                       #interrupt-cells = <1>;
+                       #interrupt-cells = <3>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | 
IRQ_TYPE_LEVEL_HIGH)>;
                };
 
                sramc@01c00000 {
@@ -74,53 +87,59 @@
                };
 
                timer@01c20c00 {
-                       compatible = "allwinner,sun7i-timer";
+                       compatible = "allwinner,sun4i-a10-timer";
                        reg = <0x01c20c00 0x90>;
-                       interrupts = < 22 >;
+                       interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-parent = <&GIC>;
                        clock-frequency = < 24000000 >;
                };
 
                watchdog@01c20c90 {
-                       compatible = "allwinner,sun4i-wdt";
+                       compatible = "allwinner,sun4i-a10-wdt";
                        reg = <0x01c20c90 0x10>;
                };
 
                pio: gpio@01c20800 {
                        #gpio-cells = <3>;
-                       compatible = "allwinner,sun4i-gpio";
+                       compatible = "allwinner,sun7i-a20-pinctrl";
                        gpio-controller;
                        reg =<  0x01c20800 0x400 >;
-                       interrupts = < 28 >;
+                       interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
                        interrupt-parent = <&GIC>;
                };
 
                usb1: usb@01c14000 {
-                       compatible = "allwinner,usb-ehci", "usb-ehci";
+                       compatible = "allwinner,sun7i-a20-ehci", "generic-ehci";
                        reg = <0x01c14000 0x1000>;
-                       interrupts = < 39 >;
+                       interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-parent = <&GIC>;
                };
 
                usb2: usb@01c1c000 {
-                       compatible = "allwinner,usb-ehci", "usb-ehci";
+                       compatible = "allwinner,sun7i-a20-ehci", "generic-ehci";
                        reg = <0x01c1c000 0x1000>;
-                       interrupts = < 40 >;
+                       interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-parent = <&GIC>;
                };
 
                mmc0: mmc@01c0f000 {
-                       compatible = "allwinner,sun4i-a10-mmc";
+                       compatible = "allwinner,sun5i-a13-mmc";
                        reg = <0x01c0f000 0x1000>;
-                       interrupts = <32>;
-                       interrupt-parent = <&GIC>;
+                       interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
                        status = "disabled";
                };
 
                sata@01c18000 {
                        compatible = "allwinner,sun4i-a10-ahci";
                        reg = <0x01c18000 0x1000>;
-                       interrupts = <56>;
+                       interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-parent = <&GIC>;
                        status = "disabled";
                };
@@ -129,16 +148,15 @@
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28000 0x400>;
                        reg-shift = <2>;
-                       interrupts = <1>;
-                       interrupt-parent = <&GIC>;
+                       interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
                        current-speed = <115200>;
                        clock-frequency = < 24000000 >;
                };
 
                emac@01c0b000 {
-                       compatible = "allwinner,sun4i-emac";
+                       compatible = "allwinner,sun4i-a10-emac";
                        reg = <0x01c0b000 0x1000>;
-                       interrupts = <55>;
+                       interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-parent = <&GIC>;
                        status = "disabled";
                };
@@ -146,7 +164,7 @@
                gmac@01c50000 {
                        compatible = "allwinner,sun7i-a20-gmac";
                        reg = <0x01c50000 0x10000>;
-                       interrupts = <85>;
+                       interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-parent = <&GIC>;
                        snps,pbl = <2>;
                        snps,fixed-burst;

Modified: head/sys/modules/dtb/allwinner/Makefile
==============================================================================
--- head/sys/modules/dtb/allwinner/Makefile     Wed Feb 10 08:03:10 2016        
(r295463)
+++ head/sys/modules/dtb/allwinner/Makefile     Wed Feb 10 09:19:29 2016        
(r295464)
@@ -3,6 +3,8 @@
 DTS=   \
        bananapi.dts \
        cubieboard.dts \
-       cubieboard2.dts
+       cubieboard2.dts \
+       olimex-a20-som-evb.dts \
+       olinuxino-lime.dts
 
 .include <bsd.dtb.mk>
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to