Index: sys/arm/allwinner/a10_clk.c =================================================================== --- sys/arm/allwinner/a10_clk.c +++ sys/arm/allwinner/a10_clk.c @@ -109,7 +109,8 @@ 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); int a10_clk_usb_activate(void) @@ -200,7 +201,7 @@ /* 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) { Index: sys/arm/allwinner/a10_common.c =================================================================== --- sys/arm/allwinner/a10_common.c +++ sys/arm/allwinner/a10_common.c @@ -42,13 +42,15 @@ { NULL, NULL } }; +#ifndef ARM_INTRNG + static int fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, int *pol) { 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; @@ -66,3 +68,5 @@ &fdt_aintc_decode_ic, NULL }; + +#endif /* ARM_INTRNG */ Index: sys/arm/allwinner/a10_ehci.c =================================================================== --- sys/arm/allwinner/a10_ehci.c +++ sys/arm/allwinner/a10_ehci.c @@ -43,10 +43,10 @@ #include #include -#include +#include #include -#include +#include #include #include @@ -97,7 +97,8 @@ if (!ofw_bus_status_okay(self)) return (ENXIO); - if (!ofw_bus_is_compatible(self, "allwinner,usb-ehci")) + if (!ofw_bus_is_compatible(self, "allwinner,sun4i-a10-ehci") && + !ofw_bus_is_compatible(self, "allwinner,sun7i-a20-ehci")) return (ENXIO); device_set_desc(self, EHCI_HC_DEVSTR); Index: sys/arm/allwinner/a10_gpio.c =================================================================== --- sys/arm/allwinner/a10_gpio.c +++ sys/arm/allwinner/a10_gpio.c @@ -373,7 +373,8 @@ if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-gpio")) + if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-pinctrl") && + !ofw_bus_is_compatible(dev, "allwinner,sun7i-a20-pinctrl")) return (ENXIO); device_set_desc(dev, "Allwinner GPIO controller"); @@ -493,7 +494,9 @@ 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_LAST); + int a10_gpio_ethernet_activate(uint32_t func) Index: sys/arm/allwinner/a10_machdep.c =================================================================== --- sys/arm/allwinner/a10_machdep.c +++ sys/arm/allwinner/a10_machdep.c @@ -45,32 +45,31 @@ #include #include #include -#include +#include #include #include +#include -vm_offset_t -platform_lastaddr(void) -{ +#include "platform_if.h" - return (arm_devmap_lastaddr()); -} +static u_int soc_type; +static u_int soc_family; -void -platform_probe_and_attach(void) +static int +a10_attach(platform_t plat) { + soc_type = ALLWINNERSOC_A10; + soc_family = ALLWINNERSOC_SUN4I; + return (0); } -void -platform_gpio_init(void) +static vm_offset_t +a10_lastaddr(platform_t plat) { -} -void -platform_late_init(void) -{ + return (arm_devmap_lastaddr()); } /* @@ -83,8 +82,8 @@ * shouldn't be device-mapped. The original code mapped a 4MB block, but * perhaps a 1MB block would be more appropriate. */ -int -platform_devmap_init(void) +static int +a10_devmap_init(platform_t plat) { arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ @@ -111,3 +110,23 @@ printf("Reset failed!\n"); while (1); } + +static platform_method_t a10_methods[] = { + PLATFORMMETHOD(platform_attach, a10_attach), + PLATFORMMETHOD(platform_lastaddr, a10_lastaddr), + PLATFORMMETHOD(platform_devmap_init, a10_devmap_init), + + PLATFORMMETHOD_END, +}; + +u_int allwinner_soc_type(void) +{ + return (soc_type); +} + +u_int allwinner_soc_family(void) +{ + return (soc_family); +} + +FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10"); Index: sys/arm/allwinner/a10_mmc.c =================================================================== --- sys/arm/allwinner/a10_mmc.c +++ sys/arm/allwinner/a10_mmc.c @@ -123,7 +123,8 @@ if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-mmc")) + if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-mmc") && + !ofw_bus_is_compatible(dev, "allwinner,sun5i-a13-mmc")) return (ENXIO); device_set_desc(dev, "Allwinner Integrated MMC/SD controller"); Index: sys/arm/allwinner/a10_wdog.c =================================================================== --- sys/arm/allwinner/a10_wdog.c +++ sys/arm/allwinner/a10_wdog.c @@ -95,7 +95,7 @@ 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); } Index: sys/arm/allwinner/a20/a20_cpu_cfg.c =================================================================== --- sys/arm/allwinner/a20/a20_cpu_cfg.c +++ sys/arm/allwinner/a20/a20_cpu_cfg.c @@ -117,7 +117,8 @@ 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); uint64_t a20_read_counter64(void) Index: sys/arm/allwinner/a20/a20_machdep.c =================================================================== --- sys/arm/allwinner/a20/a20_machdep.c +++ sys/arm/allwinner/a20/a20_machdep.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2012 Ganbold Tsagaankhuu + * Copyright (c) 2015 Emmanuel Vadot * All rights reserved. * * This code is derived from software written for Brini by Mark Brinicombe @@ -45,32 +46,31 @@ #include #include #include -#include +#include #include #include +#include -vm_offset_t -platform_lastaddr(void) -{ +#include "platform_if.h" - return (arm_devmap_lastaddr()); -} +static u_int soc_type; +static u_int soc_family; -void -platform_probe_and_attach(void) +static int +a20_attach(platform_t plat) { + soc_type = ALLWINNERSOC_A20; + soc_family = ALLWINNERSOC_SUN7I; + return (0); } -void -platform_gpio_init(void) +static vm_offset_t +a20_lastaddr(platform_t plat) { -} -void -platform_late_init(void) -{ + return (arm_devmap_lastaddr()); } /* @@ -83,8 +83,8 @@ * shouldn't be device-mapped. The original code mapped a 4MB block, but * perhaps a 1MB block would be more appropriate. */ -int -platform_devmap_init(void) +static int +a20_devmap_init(platform_t plat) { arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ @@ -111,3 +111,23 @@ printf("Reset failed!\n"); while (1); } + +static platform_method_t a20_methods[] = { + PLATFORMMETHOD(platform_attach, a20_attach), + PLATFORMMETHOD(platform_lastaddr, a20_lastaddr), + PLATFORMMETHOD(platform_devmap_init, a20_devmap_init), + + PLATFORMMETHOD_END, +}; + +u_int allwinner_soc_type(void) +{ + return (soc_type); +} + +u_int allwinner_soc_family(void) +{ + return (soc_family); +} + +FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20"); Index: sys/arm/allwinner/a20/files.a20 =================================================================== --- sys/arm/allwinner/a20/files.a20 +++ sys/arm/allwinner/a20/files.a20 @@ -1,4 +1,5 @@ # $FreeBSD$ +arm/allwinner/a20/a20_machdep.c standard arm/allwinner/a20/a20_mp.c optional smp arm/allwinner/a20/a20_if_dwc.c optional dwc Index: sys/arm/allwinner/aintc.c =================================================================== --- sys/arm/allwinner/aintc.c +++ sys/arm/allwinner/aintc.c @@ -101,7 +101,8 @@ if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-ic")) + if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-ic") && + !ofw_bus_is_compatible(dev, "allwinner,sun7i-a20-sc-nmi")) return (ENXIO); device_set_desc(dev, "A10 AINTC Interrupt Controller"); return (BUS_PROBE_DEFAULT); @@ -158,7 +159,8 @@ 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) Index: sys/arm/allwinner/allwinner_machdep.h =================================================================== --- sys/arm/allwinner/allwinner_machdep.h +++ sys/arm/allwinner/allwinner_machdep.h @@ -1,7 +1,9 @@ /*- - * Copyright (c) 2012 Ganbold Tsagaankhuu + * Copyright (c) 2015 Emmanuel Vadot * All rights reserved. * + * This code is derived from software written for Brini by Mark Brinicombe + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -22,47 +24,24 @@ * 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. + * */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include - -#include -#include - -struct fdt_fixup_entry fdt_fixup_table[] = { - { NULL, NULL } -}; +#ifndef AW_MACHDEP_H +#define AW_MACHDEP_H -static int -fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - int offset; +#include - if (fdt_is_compatible(node, "allwinner,sun4i-ic")) - offset = 0; - else if (fdt_is_compatible(node, "arm,gic")) - offset = 32; - else - return (ENXIO); +#define ALLWINNERSOC_A10 0x10000000 +#define ALLWINNERSOC_A13 0x13000000 +#define ALLWINNERSOC_A10S 0x10000001 +#define ALLWINNERSOC_A20 0x20000000 - *interrupt = fdt32_to_cpu(intr[0]) + offset; - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; +#define ALLWINNERSOC_SUN4I 0x40000000 +#define ALLWINNERSOC_SUN5I 0x50000000 +#define ALLWINNERSOC_SUN7I 0x70000000 - return (0); -} +u_int allwinner_soc_type(void); +u_int allwinner_soc_family(void); -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_aintc_decode_ic, - NULL -}; +#endif /* AW_MACHDEP_H */ Index: sys/arm/allwinner/files.a10 =================================================================== --- sys/arm/allwinner/files.a10 +++ sys/arm/allwinner/files.a10 @@ -1,3 +1,5 @@ # $FreeBSD$ +arm/allwinner/a10_machdep.c standard arm/allwinner/aintc.c standard +arm/allwinner/timer.c standard Index: sys/arm/allwinner/files.allwinner =================================================================== --- sys/arm/allwinner/files.allwinner +++ sys/arm/allwinner/files.allwinner @@ -6,11 +6,9 @@ arm/allwinner/a10_common.c standard arm/allwinner/a10_ehci.c optional ehci arm/allwinner/a10_gpio.c optional gpio -arm/allwinner/a10_machdep.c standard arm/allwinner/a10_mmc.c optional mmc arm/allwinner/a10_sramc.c standard arm/allwinner/a10_wdog.c standard arm/allwinner/a20/a20_cpu_cfg.c standard arm/allwinner/if_emac.c optional emac -arm/allwinner/timer.c standard #arm/allwinner/console.c standard Index: sys/arm/allwinner/if_emac.c =================================================================== --- sys/arm/allwinner/if_emac.c +++ sys/arm/allwinner/if_emac.c @@ -756,7 +756,7 @@ 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"); Index: sys/arm/allwinner/timer.c =================================================================== --- sys/arm/allwinner/timer.c +++ sys/arm/allwinner/timer.c @@ -50,7 +50,7 @@ #include -#include "a20/a20_cpu_cfg.h" +#include /** * Timer registers addr @@ -84,7 +84,6 @@ 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 @@ { 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) @@ -142,17 +137,22 @@ return (((uint64_t)hi << 32) | lo); } +extern int allwinner_is_a20; + 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; + soc_family = allwinner_soc_family(); + if (ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-timer")) { + if (soc_family != ALLWINNERSOC_SUN4I && + soc_family != ALLWINNERSOC_SUN5I) + return (ENXIO); + } else return (ENXIO); @@ -352,7 +352,8 @@ 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); void DELAY(int usec) Index: sys/arm/conf/A10 =================================================================== --- sys/arm/conf/A10 +++ sys/arm/conf/A10 @@ -1,6 +1,5 @@ # -# CUBIEBOARD -- Custom configuration for the CUBIEBOARD ARM development -# platform, check out http://www.cubieboard.org +# 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: @@ -19,13 +18,14 @@ # # $FreeBSD$ -ident CUBIEBOARD +ident A10 include "std.armv6" include "../allwinner/std.a10" options HZ=100 options SCHED_4BSD # 4BSD scheduler +options PLATFORM # Debugging for use in -current makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols @@ -104,6 +104,4 @@ # Flattened Device Tree options FDT # Configure using FDT/DTB data -options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=cubieboard.dts makeoptions MODULES_EXTRA=dtb/allwinner Index: sys/arm/conf/A20 =================================================================== --- sys/arm/conf/A20 +++ sys/arm/conf/A20 @@ -23,9 +23,12 @@ include "std.armv6" include "../allwinner/a20/std.a20" +options ARM_INTRNG + options HZ=100 options SCHED_ULE # ULE scheduler options SMP # Enable multiple cores +options PLATFORM # Debugging for use in -current makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols @@ -55,6 +58,9 @@ # 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 Index: sys/arm/conf/CUBIEBOARD =================================================================== --- sys/arm/conf/CUBIEBOARD +++ sys/arm/conf/CUBIEBOARD @@ -26,6 +26,7 @@ options HZ=100 options SCHED_4BSD # 4BSD scheduler +options PLATFORM # Debugging for use in -current makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols Index: sys/boot/fdt/dts/arm/bananapi.dts =================================================================== --- sys/boot/fdt/dts/arm/bananapi.dts +++ sys/boot/fdt/dts/arm/bananapi.dts @@ -28,7 +28,8 @@ /dts-v1/; -/include/ "sun7i-a20.dtsi" +#include "sun7i-a20.dtsi" + #include @@ -65,7 +66,7 @@ }; gmac@01c50000 { - phy-type = "rgmii-bpi"; + phy-mode = "rgmii-bpi"; status = "okay"; }; Index: sys/boot/fdt/dts/arm/cubieboard2.dts =================================================================== --- sys/boot/fdt/dts/arm/cubieboard2.dts +++ sys/boot/fdt/dts/arm/cubieboard2.dts @@ -28,7 +28,7 @@ /dts-v1/; -/include/ "sun7i-a20.dtsi" +#include "sun7i-a20.dtsi" #include Index: sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts =================================================================== --- sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts +++ sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Ganbold Tsagaankhuu + * Copyright (c) 2015 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,47 +22,23 @@ * 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$ */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include - -#include -#include - -struct fdt_fixup_entry fdt_fixup_table[] = { - { NULL, NULL } +#include "sun7i-a20-olimex-som-evb.dts" + +/ { + soc@01c00000 { + ccm@01c20000 { + compatible = "allwinner,sun4i-ccm"; + #address-cells = <1>; + #size-cells = <1>; + reg = < 0x01c20000 0x400 >; + }; + }; }; -static int -fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - int offset; - - if (fdt_is_compatible(node, "allwinner,sun4i-ic")) - offset = 0; - else if (fdt_is_compatible(node, "arm,gic")) - offset = 32; - else - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]) + offset; - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_aintc_decode_ic, - NULL +&uart0 { + busy-detect = <1>; }; Index: sys/boot/fdt/dts/arm/olinuxino-lime.dts =================================================================== --- sys/boot/fdt/dts/arm/olinuxino-lime.dts +++ sys/boot/fdt/dts/arm/olinuxino-lime.dts @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013 Ganbold Tsagaankhuu + * Copyright (c) 2015 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,66 +26,29 @@ * $FreeBSD$ */ -/dts-v1/; - -/include/ "sun7i-a20.dtsi" - -#include +#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"; - }; - - mmc0: mmc@01c0f000 { - status = "okay"; - }; - - gmac@01c50000 { - phy-type = "rgmii-bpi"; - status = "okay"; - }; - - ahci: sata@01c18000 { - status = "okay"; - }; + serial0 = &uart0; }; - leds { - compatible = "gpio-leds"; - - green { - label = "bananapi:green:usr"; - gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>; + soc@01c00000 { + ccm@01c20000 { + compatible = "allwinner,sun4i-ccm"; + #address-cells = <1>; + #size-cells = <1>; + reg = < 0x01c20000 0x400 >; }; }; chosen { bootargs = "-v"; - stdin = "UART0"; - stdout = "UART0"; + stdin = "serial0"; + stdout = "serial0"; }; }; + +&uart0 { + busy-detect = <1>; +}; Index: sys/boot/fdt/dts/arm/sun4i-a10.dtsi =================================================================== --- sys/boot/fdt/dts/arm/sun4i-a10.dtsi +++ sys/boot/fdt/dts/arm/sun4i-a10.dtsi @@ -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>; @@ -120,7 +120,7 @@ }; UART0: serial@01c28000 { - compatible = "ns16550"; + compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>; reg-shift = <2>; interrupts = <1>; @@ -131,7 +131,7 @@ }; emac@01c0b000 { - compatible = "allwinner,sun4i-emac"; + compatible = "allwinner,sun4i-a10-emac"; reg = <0x01c0b000 0x1000>; interrupts = <55>; interrupt-parent = <&AINTC>; Index: sys/boot/fdt/dts/arm/sun7i-a20.dtsi =================================================================== --- sys/boot/fdt/dts/arm/sun7i-a20.dtsi +++ sys/boot/fdt/dts/arm/sun7i-a20.dtsi @@ -26,6 +26,8 @@ * $FreeBSD$ */ +#include + / { compatible = "allwinner,sun7i-a20"; #address-cells = <1>; @@ -37,6 +39,14 @@ soc = &SOC; }; + timer { + compatible = "arm,armv7-timer"; + interrupts = , + , + , + ; + }; + 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 = ; }; sramc@01c00000 { @@ -74,72 +87,77 @@ }; timer@01c20c00 { - compatible = "allwinner,sun7i-timer"; + compatible = "allwinner,sun4i-a10-timer"; reg = <0x01c20c00 0x90>; - interrupts = < 22 >; + interrupts = , + , + , + , + , + ; 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 = ; + 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 = ; 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 = ; 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 = ; status = "disabled"; }; sata@01c18000 { compatible = "allwinner,sun4i-a10-ahci"; reg = <0x01c18000 0x1000>; - interrupts = <56>; + interrupts = ; interrupt-parent = <&GIC>; status = "disabled"; }; UART0: serial@01c28000 { - compatible = "ns16550"; + compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>; reg-shift = <2>; - interrupts = <1>; - interrupt-parent = <&GIC>; + interrupts = ; current-speed = <115200>; clock-frequency = < 24000000 >; busy-detect = <1>; }; emac@01c0b000 { - compatible = "allwinner,sun4i-emac"; + compatible = "allwinner,sun4i-a10-emac"; reg = <0x01c0b000 0x1000>; - interrupts = <55>; + interrupts = ; interrupt-parent = <&GIC>; status = "disabled"; }; @@ -147,7 +165,7 @@ gmac@01c50000 { compatible = "allwinner,sun7i-a20-gmac"; reg = <0x01c50000 0x10000>; - interrupts = <85>; + interrupts = ; interrupt-parent = <&GIC>; snps,pbl = <2>; snps,fixed-burst; Index: sys/dev/uart/uart_dev_ns8250.c =================================================================== --- sys/dev/uart/uart_dev_ns8250.c +++ sys/dev/uart/uart_dev_ns8250.c @@ -396,6 +396,7 @@ #ifdef FDT static struct ofw_compat_data compat_data[] = { {"ns16550", (uintptr_t)&uart_ns8250_class}, + {"snps,dw-apb-uart", (uintptr_t)&uart_ns8250_class}, {NULL, (uintptr_t)NULL}, }; UART_FDT_CLASS_AND_DEVICE(compat_data); Index: sys/gnu/dts/arm/sun7i-a20-olimex-som-evb.dts =================================================================== --- /dev/null +++ sys/gnu/dts/arm/sun7i-a20-olimex-som-evb.dts @@ -0,0 +1,198 @@ +/* + * Copyright 2015 - Marcus Cooper + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include + +/ { + model = "Olimex A20-Olimex-SOM-EVB"; + compatible = "olimex,a20-olimex-som-evb", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins_olimex_som_evb>; + + green { + label = "a20-olimex-som-evb:green:usr"; + gpios = <&pio 7 2 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + }; +}; + +&ahci { + target-supply = <®_ahci_5v>; + status = "okay"; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + +&gmac { + pinctrl-names = "default"; + pinctrl-0 = <&gmac_pins_rgmii_a>; + phy = <&phy1>; + phy-mode = "rgmii"; + status = "okay"; + + phy1: ethernet-phy@1 { + reg = <1>; + }; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins_a>; + status = "okay"; + + axp209: pmic@34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>; + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ + cd-inverted; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&ohci1 { + status = "okay"; +}; + +&pio { + ahci_pwr_pin_olimex_som_evb: ahci_pwr_pin@1 { + allwinner,pins = "PC3"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; + + led_pins_olimex_som_evb: led_pins@0 { + allwinner,pins = "PH2"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; +}; + +®_ahci_5v { + pinctrl-0 = <&ahci_pwr_pin_olimex_som_evb>; + gpio = <&pio 2 3 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +#include "axp209.dtsi" + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "vdd-int-dll"; +}; + +®_ldo1 { + regulator-name = "vdd-rtc"; +}; + +®_ldo2 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +}; + +®_usb1_vbus { + status = "okay"; +}; + +®_usb2_vbus { + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins_a>; + status = "okay"; +}; + +&usbphy { + usb1_vbus-supply = <®_usb1_vbus>; + usb2_vbus-supply = <®_usb2_vbus>; + status = "okay"; +}; Index: sys/gnu/dts/include/dt-bindings/clock/sun4i-a10-pll2.h =================================================================== --- /dev/null +++ sys/gnu/dts/include/dt-bindings/clock/sun4i-a10-pll2.h @@ -0,0 +1,53 @@ +/* + * Copyright 2015 Maxime Ripard + * + * Maxime Ripard + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __DT_BINDINGS_CLOCK_SUN4I_A10_PLL2_H_ +#define __DT_BINDINGS_CLOCK_SUN4I_A10_PLL2_H_ + +#define SUN4I_A10_PLL2_1X 0 +#define SUN4I_A10_PLL2_2X 1 +#define SUN4I_A10_PLL2_4X 2 +#define SUN4I_A10_PLL2_8X 3 + +#endif /* __DT_BINDINGS_CLOCK_SUN4I_A10_PLL2_H_ */ Index: sys/modules/dtb/allwinner/Makefile =================================================================== --- sys/modules/dtb/allwinner/Makefile +++ sys/modules/dtb/allwinner/Makefile @@ -3,6 +3,8 @@ DTS= \ bananapi.dts \ cubieboard.dts \ - cubieboard2.dts + cubieboard2.dts \ + olimex-a20-som-evb.dts \ + olinuxino-lime.dts .include