Re: svn commit: r301714 - head/sys/boot/efi/libefi

2016-06-09 Thread Emmanuel Vadot

 I wanted to more verbose in case of the system don't have partition o
n disk (or the EFI implementation only support raw disks like U-Boot)
but this might be a bad way of doing saw, I didn't think about the
implication you're talking about. I'll try to figure a better way to do
this.

On Wed, 8 Jun 2016 22:21:36 -0400
Warner Losh <wl...@bsdimp.com> wrote:

> 
> > On Jun 8, 2016, at 10:02 PM, Emmanuel Vadot <m...@freebsd.org> wrote:
> > 
> > Author: manu
> > Date: Thu Jun  9 02:02:50 2016
> > New Revision: 301714
> > URL: https://svnweb.freebsd.org/changeset/base/301714
> > 
> > Log:
> >  Print a message when the efi disk isn't a logical partition.
> 
> Why on earth would you do that? This will print a message, one per full disk, 
> and our systems have 36 disks in them?
> Please consider backing this out...
> 
> Warner
> 
> 
> >  Approved by:   andrew (mentor)
> >  Differential Revision: https://reviews.freebsd.org/D6782
> > 
> > Modified:
> >  head/sys/boot/efi/libefi/efipart.c
> > 
> > Modified: head/sys/boot/efi/libefi/efipart.c
> > ==
> > --- head/sys/boot/efi/libefi/efipart.c  Thu Jun  9 01:50:43 2016
> > (r301713)
> > +++ head/sys/boot/efi/libefi/efipart.c  Thu Jun  9 02:02:50 2016
> > (r301714)
> > @@ -119,8 +119,11 @@ efipart_init(void) 
> > (void**));
> > if (EFI_ERROR(status))
> > continue;
> > -   if (!blkio->Media->LogicalPartition)
> > +   if (!blkio->Media->LogicalPartition) {
> > +   printf("%s%d isn't a logical partition, skipping\n",
> > +   efipart_dev.dv_name, n);
> > continue;
> > +   }
> > 
> > /*
> >  * If we come across a logical partition of subtype CDROM
> > 


-- 
Emmanuel Vadot
___
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"


svn commit: r301747 - in head/sys: boot/fdt/dts/arm modules/dtb/allwinner

2016-06-09 Thread Emmanuel Vadot
Author: manu
Date: Thu Jun  9 17:10:19 2016
New Revision: 301747
URL: https://svnweb.freebsd.org/changeset/base/301747

Log:
  Add PCDuino3b dts. It uses the pcduino3 dts from upstream and adds the hdmi 
node, axp gpio and changes the phy mode to rgmii.
  
  Approved by:  andrew (mentor)
  Differential Revision:https://reviews.freebsd.org/D6775

Added:
  head/sys/boot/fdt/dts/arm/pcduino3b.dts   (contents, props changed)
Modified:
  head/sys/modules/dtb/allwinner/Makefile

Added: head/sys/boot/fdt/dts/arm/pcduino3b.dts
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/arm/pcduino3b.dts Thu Jun  9 17:10:19 2016
(r301747)
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 "sun7i-a20-pcduino3.dts"
+#include "sun7i-a20-hdmi.dtsi"
+#include "xpowers-axp209.dtsi"
+
+/ {
+   soc@01c0 {
+   hdmi@01c16000 {
+   status = "okay";
+   };
+
+   hdmiaudio {
+   status = "okay";
+   };
+   };
+};
+
+ {
+  pinctrl-0 = <_pins_rgmii_a>;
+  phy-mode = "rgmii";
+};

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Thu Jun  9 17:03:03 2016
(r301746)
+++ head/sys/modules/dtb/allwinner/Makefile Thu Jun  9 17:10:19 2016
(r301747)
@@ -7,6 +7,7 @@ DTS=\
cubieboard2.dts \
olimex-a20-som-evb.dts \
olinuxino-lime.dts \
+   pcduino3b.dts \
sinovoip-bpi-m3.dts
 
 .include 
___
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"


svn commit: r301714 - head/sys/boot/efi/libefi

2016-06-08 Thread Emmanuel Vadot
Author: manu
Date: Thu Jun  9 02:02:50 2016
New Revision: 301714
URL: https://svnweb.freebsd.org/changeset/base/301714

Log:
  Print a message when the efi disk isn't a logical partition.
  
  Approved by:  andrew (mentor)
  Differential Revision:https://reviews.freebsd.org/D6782

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Thu Jun  9 01:50:43 2016
(r301713)
+++ head/sys/boot/efi/libefi/efipart.c  Thu Jun  9 02:02:50 2016
(r301714)
@@ -119,8 +119,11 @@ efipart_init(void) 
(void**));
if (EFI_ERROR(status))
continue;
-   if (!blkio->Media->LogicalPartition)
+   if (!blkio->Media->LogicalPartition) {
+   printf("%s%d isn't a logical partition, skipping\n",
+   efipart_dev.dv_name, n);
continue;
+   }
 
/*
 * If we come across a logical partition of subtype CDROM
___
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"


svn commit: r300777 - in head/sys: arm/allwinner boot/fdt/dts/arm dev/iicbus/twsi

2016-05-26 Thread Emmanuel Vadot
Author: manu
Date: Thu May 26 21:09:07 2016
New Revision: 300777
URL: https://svnweb.freebsd.org/changeset/base/300777

Log:
  Add support for interrupts, sensors and GPIO for AXP209 PMIC.
  Pressing the PEK (power enable key) will shutdown the board.
  Some events are reported to devd via system "PMU" and subsystem
  "Battery", "AC" and "USB" such as connected/disconnected.
  Some sensors values (power source voltage/current) are reported via
  sysctl (dev.axp209_pmu.X.)
  It also expose a gpioc node usable in kernel and userland. Only 3 of
  the 4 GPIO are exposed (The GPIO3 is different and mostly unused on
  boards). Most popular boards uses GPIO1 as a sense pin for OTG power.
  Add a dtsi file that adds gpio-controller capability to the device as
  upstream doesn't defined it and include it in our custom DTS.
  
  Reviewed by:  jmcneill
  Approved by:  cognet (mentor)
  Differential Revision:https://reviews.freebsd.org/D6135

Added:
  head/sys/arm/allwinner/axp209reg.h   (contents, props changed)
  head/sys/boot/fdt/dts/arm/xpowers-axp209.dtsi   (contents, props changed)
Modified:
  head/sys/arm/allwinner/axp209.c
  head/sys/boot/fdt/dts/arm/bananapi.dts
  head/sys/boot/fdt/dts/arm/cubieboard.dts
  head/sys/boot/fdt/dts/arm/cubieboard2.dts
  head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts
  head/sys/boot/fdt/dts/arm/olinuxino-lime.dts
  head/sys/dev/iicbus/twsi/a10_twsi.c

Modified: head/sys/arm/allwinner/axp209.c
==
--- head/sys/arm/allwinner/axp209.c Thu May 26 21:08:44 2016
(r300776)
+++ head/sys/arm/allwinner/axp209.c Thu May 26 21:09:07 2016
(r300777)
@@ -1,5 +1,6 @@
 /*-
- * Copyright (c) 2015 Emmanuel Vadot <m...@bidouilliste.com>
+ * Copyright (c) 2015-2016 Emmanuel Vadot <m...@freebsd.org>
+ * Copyright (c) 2016 Jared McNeill <jmcne...@invisible.ca>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -46,40 +48,45 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
 
-#include "iicbus_if.h"
-
-/* Power State Register */
-#defineAXP209_PSR  0x00
-#defineAXP209_PSR_ACIN 0x80
-#defineAXP209_PSR_ACIN_SHIFT   7
-#defineAXP209_PSR_VBUS 0x20
-#defineAXP209_PSR_VBUS_SHIFT   5
-
-/* Shutdown and battery control */
-#defineAXP209_SHUTBAT  0x32
-#defineAXP209_SHUTBAT_SHUTDOWN 0x80
-
-/* Temperature monitor */
-#defineAXP209_TEMPMON  0x5e
-#defineAXP209_TEMPMON_H(a) ((a) << 4)
-#defineAXP209_TEMPMON_L(a) ((a) & 0xf)
-#defineAXP209_TEMPMON_MIN  1447/* -144.7C */
+#include 
 
-#defineAXP209_0C_TO_K  2731
+#include "iicbus_if.h"
+#include "gpio_if.h"
 
 struct axp209_softc {
+   device_tdev;
uint32_taddr;
-   struct intr_config_hook enum_hook;
+   struct resource *   res[1];
+   void *  intrcookie;
+   struct intr_config_hook intr_hook;
+   device_tgpiodev;
+   struct mtx  mtx;
+};
+
+/* GPIO3 is different, don't expose it for now */
+static const struct {
+   const char *name;
+   uint8_t ctrl_reg;
+} axp209_pins[] = {
+   { "GPIO0", AXP209_GPIO0_CTRL },
+   { "GPIO1", AXP209_GPIO1_CTRL },
+   { "GPIO2", AXP209_GPIO2_CTRL },
 };
 
-enum axp209_sensor {
-   AXP209_TEMP
+static struct resource_spec axp_res_spec[] = {
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { -1,   0,  0 }
 };
 
+#defineAXP_LOCK(sc)mtx_lock(&(sc)->mtx)
+#defineAXP_UNLOCK(sc)  mtx_unlock(&(sc)->mtx)
+
 static int
 axp209_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
 {
@@ -125,16 +132,75 @@ axp209_sysctl(SYSCTL_HANDLER_ARGS)
uint8_t data[2];
int val, error;
 
-   if (sensor != AXP209_TEMP)
+   switch (sensor) {
+   case AXP209_TEMP:
+   error = axp209_read(dev, AXP209_TEMPMON, data, 2);
+   if (error != 0)
+   return (error);
+
+   /* Temperature is between -144.7C and 264.8C, step +0.1C */
+   val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) -
+   AXP209_TEMPMON_MIN + AXP209_0C_TO_K;
+   break;
+   case AXP209_ACVOLT:
+   error = axp209_read(dev, AXP209_ACIN_VOLTAGE, data, 2);
+   if (error != 0)
+   return (error);
+
+   val = (AXP209_SENSOR_H(data[0]) | AXP209_SENSOR_L(data[1])) *

svn commit: r301995 - head/sys/boot/efi/libefi

2016-06-17 Thread Emmanuel Vadot
Author: manu
Date: Fri Jun 17 17:09:22 2016
New Revision: 301995
URL: https://svnweb.freebsd.org/changeset/base/301995

Log:
  Print a message when disks are found but no logical partition are
  reported by EFI implementation. This address comment on r301714.
  
  Approved by:  re (gjb), andrew (mentor)
  Differential Revision:https://reviews.freebsd.org/D6787

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Fri Jun 17 17:01:32 2016
(r301994)
+++ head/sys/boot/efi/libefi/efipart.c  Fri Jun 17 17:09:22 2016
(r301995)
@@ -82,7 +82,7 @@ efipart_init(void) 
EFI_HANDLE *hin, *hout, *aliases, handle;
EFI_STATUS status;
UINTN sz;
-   u_int n, nin, nout;
+   u_int n, nin, nout, nrdisk;
int err;
 
sz = 0;
@@ -103,6 +103,7 @@ efipart_init(void) 
hout = hin + nin;
aliases = hout + nin;
nout = 0;
+   nrdisk = 0;
 
bzero(aliases, nin * sizeof(EFI_HANDLE));
pdinfo = malloc(nin * sizeof(*pdinfo));
@@ -120,8 +121,7 @@ efipart_init(void) 
if (EFI_ERROR(status))
continue;
if (!blkio->Media->LogicalPartition) {
-   printf("%s%d isn't a logical partition, skipping\n",
-   efipart_dev.dv_name, n);
+   nrdisk++;
continue;
}
 
@@ -156,6 +156,9 @@ efipart_init(void) 
bcache_add_dev(npdinfo);
err = efi_register_handles(_dev, hout, aliases, nout);
free(hin);
+
+   if (nout == 0 && nrdisk > 0)
+   printf("Found %d disk(s) but no logical partition\n", nrdisk);
return (err);
 }
 
___
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"


svn commit: r301945 - head/release/tools

2016-06-15 Thread Emmanuel Vadot
Author: manu
Date: Thu Jun 16 03:02:27 2016
New Revision: 301945
URL: https://svnweb.freebsd.org/changeset/base/301945

Log:
   Bump /tmp from 30m to 50m for ARM release images.
   30m isn't enough for pkg anymore to extract packagesite.txz.
   40m is fine for now but let's take a safer way as we don't know when pkg 
will need more.
  
  Reported by:  many
  Approved by:  re (gjb), andrew (mentor)

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Thu Jun 16 03:00:10 2016(r301944)
+++ head/release/tools/arm.subr Thu Jun 16 03:02:27 2016(r301945)
@@ -109,7 +109,7 @@ arm_install_base() {
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
-   echo "tmpfs /tmp tmpfs rw,mode=1777,size=30m 0 0" \
+   echo "tmpfs /tmp tmpfs rw,mode=1777,size=50m 0 0" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
 
local hostname
___
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"


Re: svn commit: r295144 - head/sys/boot/efi/libefi

2016-02-02 Thread Emmanuel Vadot

 I cannot netboot loader.efi anymore now.

 Consoles: EFI console
 Unable to open network interface 1
 Unable to open network interface 2
 ...
 panic: netboot: no interfaces left untried

 Netboot loader.efi works before even if loading the kernel was really really 
slow.

On Tue, 2 Feb 2016 10:39:19 + (UTC)
Andrew Turner <and...@freebsd.org> wrote:

> Author: andrew
> Date: Tue Feb  2 10:39:18 2016
> New Revision: 295144
> URL: https://svnweb.freebsd.org/changeset/base/295144
> 
> Log:
>   Add suppor to loader.efi to load files off hte network. For this we need
>   to open the device in exclusive mode as, without this, the firmware may
>   also be reading packets off the interface leading to a race.
>   
>   Reviewed by:emaste
>   Sponsored by:   ABT Systems Ltd
>   Differential Revision:  https://reviews.freebsd.org/D4132
> 
> Modified:
>   head/sys/boot/efi/libefi/efinet.c
> 
> Modified: head/sys/boot/efi/libefi/efinet.c
> ==
> --- head/sys/boot/efi/libefi/efinet.c Tue Feb  2 10:32:45 2016
> (r295143)
> +++ head/sys/boot/efi/libefi/efinet.c Tue Feb  2 10:39:18 2016
> (r295144)
> @@ -184,11 +184,16 @@ efinet_init(struct iodesc *desc, void *m
>   EFI_HANDLE h;
>   EFI_STATUS status;
>  
> + if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) {
> + printf("Invalid network interface %d\n", nif->nif_unit);
> + return;
> + }
> +
>   h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
>   status = BS->HandleProtocol(h, _guid, (VOID **)>nif_devdata);
>   if (status != EFI_SUCCESS) {
> - printf("net%d: cannot start interface (status=%ld)\n",
> - nif->nif_unit, (long)status);
> + printf("net%d: cannot start interface (status=%lu)\n",
> + nif->nif_unit, EFI_ERROR_CODE(status));
>   return;
>   }
>  
> @@ -288,11 +293,30 @@ efinet_dev_init()
>   stats = calloc(nifs, sizeof(struct netif_stats));
>  
>   for (i = 0; i < nifs; i++) {
> + EFI_SIMPLE_NETWORK *net;
> + EFI_HANDLE h;
> +
>   dif = _ifs[i];
> + dif->dif_unit = -1;
> +
> + h = efi_find_handle(_dev, i);
> +
> + /*
> +  * Open the network device in exclusive mode. Without this
> +  * we will be racing with the UEFI network stack. It will
> +  * pull packets off the network leading to lost packets.
> +  */
> + status = BS->OpenProtocol(h, _guid, (void **),
> + IH, 0, EFI_OPEN_PROTOCOL_EXCLUSIVE);
> + if (status != EFI_SUCCESS) {
> + printf("Unable to open network interface %d\n", i);
> + continue;
> + }
> +
>   dif->dif_unit = i;
>   dif->dif_nsel = 1;
>   dif->dif_stats = [i];
> - dif->dif_private = efi_find_handle(_dev, i);
> + dif->dif_private = h;
>   }
>  
>   return (0);
> ___
> svn-src-h...@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"


-- 
Emmanuel Vadot <m...@bidouilliste.com>
___
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"


Re: svn commit: r296548 - in head/sys: dev/agp dev/drm2 dev/drm2/i915 modules/drm2/i915kms

2016-03-09 Thread Emmanuel Vadot
i_write] *ERROR* timeout waiting for SBI to complete 
write transaction
error: [drm:pid697:intel_sbi_read] *ERROR* timeout waiting for SBI to complete 
read transaction
error: [drm:pid697:intel_sbi_write] *ERROR* timeout waiting for SBI to complete 
write transaction
error: [drm:pid697:intel_sbi_read] *ERROR* timeout waiting for SBI to complete 
read transaction
error: [drm:pid697:intel_sbi_write] *ERROR* timeout waiting for SBI to complete 
write transaction
error: [drm:pid697:intel_sbi_read] *ERROR* timeout waiting for SBI to complete 
read transaction
error: [drm:pid697:intel_sbi_write] *ERROR* timeout waiting for SBI to complete 
write transaction
error: [drm:pid697:intel_sbi_read] *ERROR* timeout waiting for SBI to complete 
read transaction
error: [drm:pid697:intel_sbi_write] *ERROR* timeout waiting for SBI to complete 
write transaction
drmn0: taking over the fictitious range 0xc000-0xd000

 When loaded via loader the kernel hangs after this line :
error: [drm:pid697:lpt_init_pch_refclk] *ERROR* FDI mPHY reset assert timeout

-- 
Emmanuel Vadot <m...@bidouilliste.com>
___
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"


Re: svn commit: r297426 - in head/sys: arm/conf boot/fdt/dts/arm

2016-03-30 Thread Emmanuel Vadot

 Hi Luiz,

 Why setting the pins to SPI mode here ? This should be done in your own board 
dts file if you need it (unless there is some spi chip on the BBB that I don't 
know of). 
 This reduce the number of GPIOs available on the headers.

 Thanks,

On Wed, 30 Mar 2016 17:32:15 + (UTC)
Luiz Otavio O Souza <l...@freebsd.org> wrote:

> Author: loos
> Date: Wed Mar 30 17:32:14 2016
> New Revision: 297426
> URL: https://svnweb.freebsd.org/changeset/base/297426
> 
> Log:
>   Enable SPI1 on Beaglebone Black.
>   
>   SPI1 was chosen because SPI0 shares the gpio pins with I2C1.
>   
>   Sponsored by:   Rubicon Communications (Netgate)
> 
> Modified:
>   head/sys/arm/conf/BEAGLEBONE
>   head/sys/boot/fdt/dts/arm/beaglebone-black.dts
> 
> Modified: head/sys/arm/conf/BEAGLEBONE
> ==
> --- head/sys/arm/conf/BEAGLEBONE  Wed Mar 30 17:18:49 2016
> (r297425)
> +++ head/sys/arm/conf/BEAGLEBONE  Wed Mar 30 17:32:14 2016
> (r297426)
> @@ -87,6 +87,10 @@ device gpio
>  device   gpioled
>  device   gpiobacklight
>  
> +# SPI
> +device   ti_spi
> +device   spibus
> +
>  # ADC support
>  device   ti_adc
>  
> 
> Modified: head/sys/boot/fdt/dts/arm/beaglebone-black.dts
> ==
> --- head/sys/boot/fdt/dts/arm/beaglebone-black.dtsWed Mar 30 17:18:49 
> 2016(r297425)
> +++ head/sys/boot/fdt/dts/arm/beaglebone-black.dtsWed Mar 30 17:32:14 
> 2016(r297426)
> @@ -37,6 +37,16 @@
>   AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2)   
> /* spi0_cs0.i2c1_scl */
>   >;
>   };
> +
> + spi1_pins: pinmux_spi1_pins {
> + pinctrl-single,pins = <
> + AM33XX_IOPAD(0x964, PIN_INPUT_PULLUP | MUX_MODE2)   
> /* eCAP0_in_PWM0_out.spi1_cs1 */
> + AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE3) 
> /* mcasp0_aclkx.spi1_sclk */
> + AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE3) 
> /* mcasp0_fsx.spi1_d0 - miso */
> + AM33XX_IOPAD(0x998, PIN_INPUT_PULLUP | MUX_MODE3)   
> /* mcasp0_axr0.spi1_d1  - mosi */
> + AM33XX_IOPAD(0x99c, PIN_INPUT_PULLUP | MUX_MODE3)   
> /* mcasp0_ahclkr.spi1_cs0 */
> + >;
> + };
>  };
>  
>   {
> @@ -65,6 +75,13 @@
>   status = "okay";
>  };
>  
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins>;
> +
> + status = "okay";
> +};
> +
>   {
>   hdmi = <>;
>  };
> ___
> svn-src-h...@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"


-- 
Emmanuel Vadot <m...@bidouilliste.com>
___
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"


svn commit: r298542 - head/share/misc

2016-04-24 Thread Emmanuel Vadot
Author: manu
Date: Sun Apr 24 14:49:01 2016
New Revision: 298542
URL: https://svnweb.freebsd.org/changeset/base/298542

Log:
  Add myself as src commiter.
  
  Approved by:  cognet (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Sun Apr 24 13:19:30 2016
(r298541)
+++ head/share/misc/committers-src.dot  Sun Apr 24 14:49:01 2016
(r298542)
@@ -222,6 +222,7 @@ le [label="Lukas Ertl\n...@freebsd.org\n2
 lidl [label="Kurt Lidl\nl...@freebsd.org\n2015/10/21"]
 loos [label="Luiz Otavio O Souza\nl...@freebsd.org\n2013/07/03"]
 lstewart [label="Lawrence Stewart\nlstew...@freebsd.org\n2008/10/06"]
+manu [label="Emmanuel Vadot\nm...@freebsd.org\n2016/04/24"]
 marcel [label="Marcel Moolenaar\nmar...@freebsd.org\n1999/07/03"]
 marius [label="Marius Strobl\nmar...@freebsd.org\n2004/04/17"]
 markj [label="Mark Johnston\nma...@freebsd.org\n2012/12/18"]
@@ -358,6 +359,8 @@ alc -> davide
 
 andre -> qingli
 
+andrew -> manu
+
 anholt -> jkim
 
 avg -> art
@@ -396,6 +399,7 @@ cognet -> br
 cognet -> jceel
 cognet -> kevlo
 cognet -> ian
+cognet -> manu
 cognet -> wkoszek
 cognet -> wma
 cognet -> zbb
___
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"


svn commit: r298625 - in head/sys/arm: allwinner allwinner/a10 conf

2016-04-26 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 26 11:15:48 2016
New Revision: 298625
URL: https://svnweb.freebsd.org/changeset/base/298625

Log:
  Convert A10 interrupt controller to INTRNG
  
  Reviewed by:  skra
  Approved by:  cognet (mentor)
  Differential Revision:https://reviews.freebsd.org/D5573

Added:
  head/sys/arm/allwinner/a10/
  head/sys/arm/allwinner/a10/a10_intc.c
 - copied, changed from r298624, head/sys/arm/allwinner/aintc.c
Deleted:
  head/sys/arm/allwinner/aintc.c
Modified:
  head/sys/arm/allwinner/files.a10
  head/sys/arm/conf/A10

Copied and modified: head/sys/arm/allwinner/a10/a10_intc.c (from r298624, 
head/sys/arm/allwinner/aintc.c)
==
--- head/sys/arm/allwinner/aintc.c  Tue Apr 26 10:04:06 2016
(r298624, copy source)
+++ head/sys/arm/allwinner/a10/a10_intc.c   Tue Apr 26 11:15:48 2016
(r298625)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2012 Ganbold Tsagaankhuu <ganb...@freebsd.org>
+ * Copyright (c) 2016 Emmanuel Vadot <m...@bidouilliste.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,13 +28,24 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#include 
+#include "opt_platform.h"
+
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#ifdef INTRNG
+#include 
+#endif
 #include 
 #include 
 
@@ -42,63 +54,288 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef INTRNG
+#include "pic_if.h"
+#endif
+
 /**
  * Interrupt controller registers
  *
  */
-#define SW_INT_VECTOR_REG  0x00
-#define SW_INT_BASE_ADR_REG0x04
-#define SW_INT_PROTECTION_REG  0x08
-#define SW_INT_NMI_CTRL_REG0x0c
-
-#define SW_INT_IRQ_PENDING_REG00x10
-#define SW_INT_IRQ_PENDING_REG10x14
-#define SW_INT_IRQ_PENDING_REG20x18
-
-#define SW_INT_FIQ_PENDING_REG00x20
-#define SW_INT_FIQ_PENDING_REG10x24
-#define SW_INT_FIQ_PENDING_REG20x28
-
-#define SW_INT_SELECT_REG0 0x30
-#define SW_INT_SELECT_REG1 0x34
-#define SW_INT_SELECT_REG2 0x38
-
-#define SW_INT_ENABLE_REG0 0x40
-#define SW_INT_ENABLE_REG1 0x44
-#define SW_INT_ENABLE_REG2 0x48
-
-#define SW_INT_MASK_REG0   0x50
-#define SW_INT_MASK_REG1   0x54
-#define SW_INT_MASK_REG2   0x58
-
-#define SW_INT_IRQNO_ENMI  0
-
-#define SW_INT_IRQ_PENDING_REG(_b) (0x10 + ((_b) * 4))
-#define SW_INT_FIQ_PENDING_REG(_b) (0x20 + ((_b) * 4))
-#define SW_INT_SELECT_REG(_b)  (0x30 + ((_b) * 4))
-#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}
+#defineSW_INT_VECTOR_REG   0x00
+#defineSW_INT_BASE_ADR_REG 0x04
+#defineSW_INT_PROTECTION_REG   0x08
+#defineSW_INT_NMI_CTRL_REG 0x0c
+
+#defineSW_INT_IRQ_PENDING_REG0 0x10
+#defineSW_INT_IRQ_PENDING_REG1 0x14
+#defineSW_INT_IRQ_PENDING_REG2 0x18
+
+#defineSW_INT_FIQ_PENDING_REG0 0x20
+#defineSW_INT_FIQ_PENDING_REG1 0x24
+#defineSW_INT_FIQ_PENDING_REG2 0x28
+
+#defineSW_INT_SELECT_REG0  0x30
+#defineSW_INT_SELECT_REG1  0x34
+#defineSW_INT_SELECT_REG2  0x38
+
+#defineSW_INT_ENABLE_REG0  0x40
+#defineSW_INT_ENABLE_REG1  0x44
+#defineSW_INT_ENABLE_REG2  0x48
+
+#defineSW_INT_MASK_REG00x50
+#defineSW_INT_MASK_REG10x54
+#defineSW_INT_MASK_REG20x58
+
+#defineSW_INT_IRQNO_ENMI   0
+
+#defineA10_INTR_MAX_NIRQS  81
+
+#defineSW_INT_IRQ_PENDING_REG(_b)  (0x10 + ((_b) * 4))
+#defineSW_INT_FIQ_PENDING_REG(_b)  (0x20 + ((_b) * 4))
+#defineSW_INT_SELECT_REG(_b)   (0x30 + ((_b) * 4))
+#defineSW_INT_ENABLE_REG(_b)   (0x40 + ((_b) * 4))
+#defineSW_INT_MASK_REG(_b) (0x50 + ((_b) * 4))
+
+#ifdef INTRNG
+struct a10_intr_irqsrc {
+   struct intr_irqsrc  isrc;
+   u_int   irq;
 };
+#endif
 
 struct a10_aintc_softc {
device_tsc_dev;
struct resource *   aintc_res;
bus_space_tag_t aintc_bst;
bus_space_handle_t  aintc_bsh;
-   uint8_t ver;
+   struct mt

svn commit: r298721 - head/sys/arm/allwinner

2016-04-27 Thread Emmanuel Vadot
Author: manu
Date: Wed Apr 27 20:49:57 2016
New Revision: 298721
URL: https://svnweb.freebsd.org/changeset/base/298721

Log:
  Add support for the Non-maskable interrupt driver found in the Allwinner A20 
and A31 SoCs.
  This is normally used for the PMU.
  
  Reviewed by:  andrew
  Approved by:  andrew (mentor)
  Differential Revision:https://reviews.freebsd.org/D5663

Added:
  head/sys/arm/allwinner/aw_nmi.c   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner

Added: head/sys/arm/allwinner/aw_nmi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/aw_nmi.c Wed Apr 27 20:49:57 2016
(r298721)
@@ -0,0 +1,396 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 "opt_platform.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "pic_if.h"
+
+#defineNMI_IRQ_CTRL_REG0x0
+#define NMI_IRQ_LOW_LEVEL  0x0
+#define NMI_IRQ_LOW_EDGE   0x1
+#define NMI_IRQ_HIGH_LEVEL 0x2
+#define NMI_IRQ_HIGH_EDGE  0x3
+#defineNMI_IRQ_PENDING_REG 0x4
+#define NMI_IRQ_ACK(1U << 0)
+#defineA20_NMI_IRQ_ENABLE_REG  0x8
+#defineA31_NMI_IRQ_ENABLE_REG  0x34
+#define NMI_IRQ_ENABLE (1U << 0)
+
+#defineSC_NMI_READ(_sc, _reg)  bus_read_4(_sc->res[0], _reg)
+#defineSC_NMI_WRITE(_sc, _reg, _val)   bus_write_4(_sc->res[0], _reg, 
_val)
+
+static struct resource_spec aw_nmi_res_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { -1,   0,  0 }
+};
+
+struct aw_nmi_intr {
+   struct intr_irqsrc  isrc;
+   u_int   irq;
+   enum intr_polarity  pol;
+   enum intr_trigger   tri;
+};
+
+struct aw_nmi_softc {
+   device_tdev;
+   struct resource *   res[2];
+   void *  intrcookie;
+   struct aw_nmi_intr  intr;
+   uint8_t enable_reg;
+};
+
+#defineA20_NMI 1
+#defineA31_NMI 2
+
+static struct ofw_compat_data compat_data[] = {
+   {"allwinner,sun7i-a20-sc-nmi", A20_NMI},
+   {"allwinner,sun6i-a31-sc-nmi", A31_NMI},
+
+   {NULL, 0},
+};
+
+static int
+aw_nmi_intr(void *arg)
+{
+   struct aw_nmi_softc *sc;
+
+   sc = arg;
+
+   if (SC_NMI_READ(sc, NMI_IRQ_PENDING_REG) == 0) {
+   device_printf(sc->dev, "Spurious interrupt\n");
+   return (FILTER_HANDLED);
+   }
+
+   if (intr_isrc_dispatch(>intr.isrc, curthread->td_intr_frame) != 0) {
+   SC_NMI_WRITE(sc, sc->enable_reg, !NMI_IRQ_ENABLE);
+   device_printf(sc->dev, "Stray interrupt, NMI disabled\n");
+   }
+
+   return (FILTER_HANDLED);
+}
+
+static void
+aw_nmi_enable_intr(device_t dev, struct intr_irqsrc *isrc)
+{
+   struct aw_nmi_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   SC_NMI_WRITE(sc, sc->enable_reg, NMI_IRQ_ENABLE);
+}
+
+static void
+aw_nmi_disable_intr(device_t dev, struct intr_irqsrc *isrc)
+{
+   struct aw_nmi_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   SC_NMI_WRITE(sc, sc->enable_reg, !NMI_IRQ_ENABLE);
+}
+
+static int
+aw_nmi_map_f

svn commit: r298855 - head/sys/arm/allwinner

2016-04-30 Thread Emmanuel Vadot
Author: manu
Date: Sat Apr 30 18:07:13 2016
New Revision: 298855
URL: https://svnweb.freebsd.org/changeset/base/298855

Log:
  ACK the interrupt after disabling it, this avoid an interrupt storm.
  
  Approved by:  andrew (mentor)

Modified:
  head/sys/arm/allwinner/aw_nmi.c

Modified: head/sys/arm/allwinner/aw_nmi.c
==
--- head/sys/arm/allwinner/aw_nmi.c Sat Apr 30 17:27:33 2016
(r298854)
+++ head/sys/arm/allwinner/aw_nmi.c Sat Apr 30 18:07:13 2016
(r298855)
@@ -277,8 +277,11 @@ aw_nmi_teardown_intr(device_t dev, struc
 static void
 aw_nmi_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
 {
+   struct aw_nmi_softc *sc;
 
+   sc = device_get_softc(dev);
aw_nmi_disable_intr(dev, isrc);
+   SC_NMI_WRITE(sc, NMI_IRQ_PENDING_REG, NMI_IRQ_ACK);
 }
 
 static void
___
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"


svn commit: r299383 - head/sys/arm/arm

2016-05-10 Thread Emmanuel Vadot
Author: manu
Date: Tue May 10 19:11:25 2016
New Revision: 299383
URL: https://svnweb.freebsd.org/changeset/base/299383

Log:
  When PLATFORM_SMP is enabled, check if tunable hw.ncpu is set and valid
  (>= 1 and <= real ncores) and set mp_ncpus to it.
  
  Approved by:  andrew (mentor)
  Differential Revision:https://reviews.freebsd.org/D6151

Modified:
  head/sys/arm/arm/platform.c

Modified: head/sys/arm/arm/platform.c
==
--- head/sys/arm/arm/platform.c Tue May 10 18:28:38 2016(r299382)
+++ head/sys/arm/arm/platform.c Tue May 10 19:11:25 2016(r299383)
@@ -209,8 +209,16 @@ platform_delay(int usec, void *arg __unu
 void
 platform_mp_setmaxid(void)
 {
+   int ncpu;
 
PLATFORM_MP_SETMAXID(plat_obj);
+
+   if (TUNABLE_INT_FETCH("hw.ncpu", )) {
+   if (ncpu >= 1 && ncpu <= mp_ncpus) {
+   mp_ncpus = ncpu;
+   mp_maxid = ncpu - 1;
+   }
+   }
 }
 
 void
___
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"


svn commit: r300068 - in head/sys: arm/allwinner arm/conf dev/usb/controller

2016-05-17 Thread Emmanuel Vadot
Author: manu
Date: Tue May 17 17:46:12 2016
New Revision: 300068
URL: https://svnweb.freebsd.org/changeset/base/300068

Log:
  Add driver for "generic-ohci" as defined by FDT.
  If platform support EXT_RESOURCES, clocks and resets are handled out of
  the box.
  If not driver can be subclassed using the generic_usb interface.
  generic_usb name was choosed because at one point I'll add generic-ehci
  FDT driver.
  
  Reviewed by:  jmcneill, hselasky
  Approved by:  andrew (mentor)
  Differential Revision:https://reviews.freebsd.org/D5481

Added:
  head/sys/dev/usb/controller/generic_ohci.c   (contents, props changed)
  head/sys/dev/usb/controller/generic_usb_if.m   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/A10
  head/sys/arm/conf/ALLWINNER

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Tue May 17 17:09:45 2016
(r300067)
+++ head/sys/arm/allwinner/files.allwinner  Tue May 17 17:46:12 2016
(r300068)
@@ -24,6 +24,8 @@ arm/allwinner/if_awg.coptional
awg
 arm/allwinner/if_emac.coptionalemac
 arm/allwinner/sunxi_dma_if.m   standard
 dev/iicbus/twsi/a10_twsi.c optionaltwsi
+dev/usb/controller/generic_ohci.c  optionalohci
+dev/usb/controller/generic_usb_if.moptionalohci
 arm/allwinner/aw_sid.c standard
 arm/allwinner/aw_thermal.c standard
 #arm/allwinner/console.c   standard

Modified: head/sys/arm/conf/A10
==
--- head/sys/arm/conf/A10   Tue May 17 17:09:45 2016(r300067)
+++ head/sys/arm/conf/A10   Tue May 17 17:46:12 2016(r300068)
@@ -98,7 +98,7 @@ options   USB_DEBUG
 #options   USB_REQ_DEBUG
 #options   USB_VERBOSE
 #deviceuhci
-#deviceohci
+device ohci
 device ehci
 
 device umass

Modified: head/sys/arm/conf/ALLWINNER
==
--- head/sys/arm/conf/ALLWINNER Tue May 17 17:09:45 2016(r300067)
+++ head/sys/arm/conf/ALLWINNER Tue May 17 17:46:12 2016(r300068)
@@ -113,7 +113,7 @@ options USB_DEBUG
 #options   USB_REQ_DEBUG
 #options   USB_VERBOSE
 #deviceuhci
-#deviceohci
+device ohci
 device ehci
 
 device umass

Added: head/sys/dev/usb/controller/generic_ohci.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/controller/generic_ohci.c  Tue May 17 17:46:12 2016
(r300068)
@@ -0,0 +1,308 @@
+/*-
+ * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+
+/*
+ * Generic OHCI driver based on AT91 OHCI
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#ifdef EXT_RESOURCES
+#include 
+#include 
+#endif
+
+#include "generic_usb_if.h"
+
+#ifdef EXT_RESOURCES
+struct clk_list {
+   TAILQ_ENTRY(clk_list)   next;
+   clk_t   clk;
+};
+#endif
+
+struct generic_ohci_sof

svn commit: r299688 - in head/sys: arm/allwinner arm/allwinner/clk arm/allwinner/h3 arm/conf conf

2016-05-13 Thread Emmanuel Vadot
   { "allwinner,sun9i-a80-pll4-clk",   AWPLL_A80_PLL4 },
{ NULL, 0 }
 };

Modified: head/sys/arm/allwinner/clk/aw_usbclk.c
==
--- head/sys/arm/allwinner/clk/aw_usbclk.c  Fri May 13 17:48:04 2016
(r299687)
+++ head/sys/arm/allwinner/clk/aw_usbclk.c  Fri May 13 18:20:54 2016
(r299688)
@@ -63,17 +63,21 @@ enum aw_usbclk_type {
AW_A10_USBCLK = 1,
AW_A31_USBCLK,
AW_A83T_USBCLK,
+   AW_H3_USBCLK,
 };
 
 static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-usb-clk",AW_A10_USBCLK },
{ "allwinner,sun6i-a31-usb-clk",AW_A31_USBCLK },
{ "allwinner,sun8i-a83t-usb-clk",   AW_A83T_USBCLK },
+   { "allwinner,sun8i-h3-usb-clk", AW_H3_USBCLK },
{ NULL, 0 }
 };
 
 /* Clock indices for A10, as there is no clock-indices property in the DT */
 static uint32_t aw_usbclk_indices_a10[] = { 6, 7, 8 };
+/* Clock indices for H3, as there is no clock-indices property in the DT */
+static uint32_t aw_usbclk_indices_h3[] = { 8, 9, 10, 11, 16, 17, 18, 19 };
 
 struct aw_usbclk_softc {
bus_addr_t  reg;
@@ -193,6 +197,8 @@ aw_usbclk_attach(device_t dev)
 
if (indices == NULL && type == AW_A10_USBCLK)
indices = aw_usbclk_indices_a10;
+   else if (indices == NULL && type == AW_H3_USBCLK)
+   indices = aw_usbclk_indices_h3;
 
error = clk_get_by_ofw_index(dev, 0, _parent);
if (error != 0) {

Added: head/sys/arm/allwinner/h3/files.h3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/h3/files.h3  Fri May 13 18:20:54 2016
(r299688)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+arm/allwinner/h3/h3_padconf.c  standard
+arm/allwinner/h3/h3_r_padconf.cstandard

Added: head/sys/arm/allwinner/h3/h3_padconf.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/h3/h3_padconf.c  Fri May 13 18:20:54 2016
(r299688)
@@ -0,0 +1,147 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 
+
+#ifdef SOC_ALLWINNER_H3
+
+const static struct allwinner_pins h3_pins[] = {
+   {"PA0",  0, 0,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, 
"eint", NULL}},
+   {"PA1",  0, 1,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, 
"eint", NULL}},
+   {"PA2",  0, 2,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, 
"eint", NULL}},
+   {"PA3",  0, 3,  {"gpio_in", "gpio_out", "uart2", "jtag", NULL, NULL, 
"eint", NULL}},
+   {"PA4",  0, 4,  {"gpio_in", "gpio_out", "uart0", NULL, NULL, NULL, 
"eint", NULL}},
+   {"PA5",  0, 5,  {"gpio_in", "gpio_out", "uart0", "pwm0", NULL, NULL, 
"eint", NULL}},
+   {"PA6",  0, 6,  {"gpio_in", "gpio_out", "sim", NULL, NULL, NULL, 
"eint", NULL}},
+ 

svn commit: r299851 - head/sys/arm/arm

2016-05-15 Thread Emmanuel Vadot
Author: manu
Date: Sun May 15 13:20:59 2016
New Revision: 299851
URL: https://svnweb.freebsd.org/changeset/base/299851

Log:
  Allow arm generic_timer code to be included even if not present in the
  SoC.
  
  Reviewed by:  andrew
  Approved by:  cognet (mentor)
  Differential Revision:https://reviews.freebsd.org/D6372

Modified:
  head/sys/arm/arm/generic_timer.c

Modified: head/sys/arm/arm/generic_timer.c
==
--- head/sys/arm/arm/generic_timer.cSun May 15 13:17:05 2016
(r299850)
+++ head/sys/arm/arm/generic_timer.cSun May 15 13:20:59 2016
(r299851)
@@ -214,7 +214,8 @@ static void
 tmr_setup_user_access(void *arg __unused)
 {
 
-   smp_rendezvous(NULL, setup_user_access, NULL, NULL);
+   if (arm_tmr_sc != NULL)
+   smp_rendezvous(NULL, setup_user_access, NULL, NULL);
 }
 SYSINIT(tmr_ua, SI_SUB_SMP, SI_ORDER_SECOND, tmr_setup_user_access, NULL);
 
___
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"


svn commit: r299380 - head/sys/arm/allwinner

2016-05-10 Thread Emmanuel Vadot
Author: manu
Date: Tue May 10 18:00:37 2016
New Revision: 299380
URL: https://svnweb.freebsd.org/changeset/base/299380

Log:
  Merge a20_mp_start_ap and a31_mp_start_ap into one function.
  This function works with all smp non-multicluster allwinner SoC (A20, A31, 
A31S and H3).
  
  Approved by:  cognet (mentor)
  Differential Revision:https://reviews.freebsd.org/D6269

Modified:
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/allwinner/aw_mp.c
  head/sys/arm/allwinner/aw_mp.h

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Tue May 10 17:51:17 2016
(r299379)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Tue May 10 18:00:37 2016
(r299380)
@@ -167,7 +167,7 @@ static platform_method_t a20_methods[] =
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
 #ifdef SMP
-   PLATFORMMETHOD(platform_mp_start_ap,a20_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
 #endif
PLATFORMMETHOD_END,
@@ -182,7 +182,7 @@ static platform_method_t a31_methods[] =
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
 #ifdef SMP
-   PLATFORMMETHOD(platform_mp_start_ap,a31_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
 #endif
PLATFORMMETHOD_END,
@@ -197,7 +197,7 @@ static platform_method_t a31s_methods[] 
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
 #ifdef SMP
-   PLATFORMMETHOD(platform_mp_start_ap,a31_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
 #endif
PLATFORMMETHOD_END,

Modified: head/sys/arm/allwinner/aw_mp.c
==
--- head/sys/arm/allwinner/aw_mp.c  Tue May 10 17:51:17 2016
(r299379)
+++ head/sys/arm/allwinner/aw_mp.c  Tue May 10 18:00:37 2016
(r299380)
@@ -107,12 +107,28 @@ aw_mp_setmaxid(platform_t plat)
mp_maxid = ncpu - 1;
 }
 
-static void
-aw_common_mp_start_ap(bus_space_handle_t cpucfg, bus_space_handle_t prcm)
+void
+aw_mp_start_ap(platform_t plat)
 {
-   int i, j;
+   bus_space_handle_t cpucfg;
+   bus_space_handle_t prcm;
+   int i, j, soc_family;
uint32_t val;
 
+   soc_family = allwinner_soc_family();
+   if (soc_family == ALLWINNERSOC_SUN7I) {
+   if (bus_space_map(fdtbus_bs_tag, A20_CPUCFG_BASE, CPUCFG_SIZE,
+   0, ) != 0)
+   panic("Couldn't map the CPUCFG\n");
+   } else {
+   if (bus_space_map(fdtbus_bs_tag, CPUCFG_BASE, CPUCFG_SIZE,
+   0, ) != 0)
+   panic("Couldn't map the CPUCFG\n");
+   if (bus_space_map(fdtbus_bs_tag, PRCM_BASE, PRCM_SIZE, 0,
+   ) != 0)
+   panic("Couldn't map the PRCM\n");
+   }
+
dcache_wbinv_poc_all();
 
bus_space_write_4(fdtbus_bs_tag, cpucfg, CPUCFG_P_REG0,
@@ -141,7 +157,7 @@ aw_common_mp_start_ap(bus_space_handle_t
/* Release power clamp */
for (i = 1; i < mp_ncpus; i++)
for (j = 0; j <= CPU_PWR_CLAMP_STEPS; j++) {
-   if (prcm) {
+   if (soc_family != ALLWINNERSOC_SUN7I) {
bus_space_write_4(fdtbus_bs_tag, prcm,
CPU_PWR_CLAMP(i), 0xff >> j);
} else {
@@ -152,7 +168,7 @@ aw_common_mp_start_ap(bus_space_handle_t
DELAY(1);
 
/* Clear power-off gating */
-   if (prcm) {
+   if (soc_family != ALLWINNERSOC_SUN7I) {
val = bus_space_read_4(fdtbus_bs_tag, prcm, CPU_PWROFF);
for (i = 0; i < mp_ncpus; i++)
val &= ~(1 << i);
@@ -179,39 +195,8 @@ aw_common_mp_start_ap(bus_space_handle_t
 
armv7_sev();
bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE);
-}
-
-void
-a20_mp_start_ap(platform_t plat)
-{
-   bus_space_handle_t cpucfg;
-
-   if (bus_space_map(fdtbus_bs_tag, A20_CPUCFG_BASE, CPUCFG_SIZE,
-   0, ) != 0)
-   panic("Couldn't map the CPUCFG\n");
-
-   aw_common_mp_start_ap(cpucfg, 0);
-   armv7_sev();
-   bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE);
-}
-
-void
-a31_mp_start_ap(platform_t plat)
-{
-   bus_space_handle_t cpucfg;
-   bus_space_handle_t prcm;
-
-   if (bus_space_map(fdtbus_bs_tag, CPUCFG_BASE, CPUCFG_SIZE,
-   0, ) != 0)
-   panic("Couldn't map the CPUCFG\n");
-   if (bus_space_map(fdtbus_bs_tag, PRCM_BASE, PRCM_SIZE, 0,
-   ) != 0)
-   

svn commit: r303186 - head/sys/arm/allwinner/a20

2016-07-22 Thread Emmanuel Vadot
Author: manu
Date: Fri Jul 22 14:39:55 2016
New Revision: 303186
URL: https://svnweb.freebsd.org/changeset/base/303186

Log:
  PC5 doesn't have mmc2 function.

Modified:
  head/sys/arm/allwinner/a20/a20_padconf.c

Modified: head/sys/arm/allwinner/a20/a20_padconf.c
==
--- head/sys/arm/allwinner/a20/a20_padconf.cFri Jul 22 14:24:17 2016
(r303185)
+++ head/sys/arm/allwinner/a20/a20_padconf.cFri Jul 22 14:39:55 2016
(r303186)
@@ -87,7 +87,7 @@ const static struct allwinner_pins a20_p
{"PC2",  2, 2,  {"gpio_in", "gpio_out", "nand0", "spi0", NULL, NULL, 
NULL, NULL}},
{"PC3",  2, 3,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
{"PC4",  2, 4,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
-   {"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
+   {"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
{"PC6",  2, 6,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
{"PC7",  2, 7,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
{"PC8",  2, 8,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
___
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"


svn commit: r303333 - stable/11/sys/boot/efi/libefi

2016-07-25 Thread Emmanuel Vadot
Author: manu
Date: Tue Jul 26 05:52:53 2016
New Revision: 30
URL: https://svnweb.freebsd.org/changeset/base/30

Log:
  MFC: r303039
  
  Do not use TERM_EMU on arm and arm64 as it doesn't behave
  well with serial console.
  
  Approved by:  re (gjb)

Modified:
  stable/11/sys/boot/efi/libefi/Makefile

Modified: stable/11/sys/boot/efi/libefi/Makefile
==
--- stable/11/sys/boot/efi/libefi/Makefile  Tue Jul 26 05:27:26 2016
(r303332)
+++ stable/11/sys/boot/efi/libefi/Makefile  Tue Jul 26 05:52:53 2016
(r30)
@@ -35,6 +35,10 @@ CFLAGS+= -I${.CURDIR}/../../common
 
 # Handle FreeBSD specific %b and %D printf format specifiers
 CFLAGS+= ${FORMAT_EXTENSIONS}
+
+# Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial 
console
+.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "aarch64"
 CFLAGS+= -DTERM_EMU
+.endif
 
 .include 
___
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"


svn commit: r303974 - in head/sys: boot/fdt/dts/arm modules/dtb/allwinner

2016-08-11 Thread Emmanuel Vadot
Author: manu
Date: Thu Aug 11 23:04:26 2016
New Revision: 303974
URL: https://svnweb.freebsd.org/changeset/base/303974

Log:
  Rename pcduino3b.dts to pcduino3.dts
  The only difference between 3 and 3B is the size of the RJ45 port.
  And now we have a uboot port that expect pcduino3.dts to be present.
  
  Reported by:  imp

Added:
  head/sys/boot/fdt/dts/arm/pcduino3.dts
 - copied unchanged from r303973, head/sys/boot/fdt/dts/arm/pcduino3b.dts
Deleted:
  head/sys/boot/fdt/dts/arm/pcduino3b.dts
Modified:
  head/sys/modules/dtb/allwinner/Makefile

Copied: head/sys/boot/fdt/dts/arm/pcduino3.dts (from r303973, 
head/sys/boot/fdt/dts/arm/pcduino3b.dts)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/dts/arm/pcduino3.dts  Thu Aug 11 23:04:26 2016
(r303974, copy of r303973, head/sys/boot/fdt/dts/arm/pcduino3b.dts)
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 "sun7i-a20-pcduino3.dts"
+#include "sun7i-a20-hdmi.dtsi"
+#include "xpowers-axp209.dtsi"
+
+/ {
+   soc@01c0 {
+   hdmi@01c16000 {
+   status = "okay";
+   };
+
+   hdmiaudio {
+   status = "okay";
+   };
+   };
+};
+
+ {
+  pinctrl-0 = <_pins_rgmii_a>;
+  phy-mode = "rgmii";
+};

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Thu Aug 11 22:30:16 2016
(r303973)
+++ head/sys/modules/dtb/allwinner/Makefile Thu Aug 11 23:04:26 2016
(r303974)
@@ -7,7 +7,7 @@ DTS=\
cubieboard2.dts \
olimex-a20-som-evb.dts \
olinuxino-lime.dts \
-   pcduino3b.dts \
+   pcduino3.dts \
sinovoip-bpi-m3.dts
 
 .include 
___
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"


svn commit: r303728 - head/sys/arm/allwinner

2016-08-03 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug  3 18:45:56 2016
New Revision: 303728
URL: https://svnweb.freebsd.org/changeset/base/303728

Log:
  We need aw_nmi to be attached which needs GIC so attach a bit later.
  Also the GPIOC doesn't need to be attach early
  
  Reviewed by:  andrew
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D7082

Modified:
  head/sys/arm/allwinner/axp209.c

Modified: head/sys/arm/allwinner/axp209.c
==
--- head/sys/arm/allwinner/axp209.c Wed Aug  3 18:04:08 2016
(r303727)
+++ head/sys/arm/allwinner/axp209.c Wed Aug  3 18:45:56 2016
(r303728)
@@ -707,10 +707,10 @@ extern devclass_t ofwgpiobus_devclass, g
 extern driver_t ofw_gpiobus_driver, gpioc_driver;
 
 EARLY_DRIVER_MODULE(axp209, iicbus, axp209_driver, axp209_devclass,
-  0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+  0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
 EARLY_DRIVER_MODULE(ofw_gpiobus, axp209_pmu, ofw_gpiobus_driver,
-ofwgpiobus_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
-EARLY_DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass,
-0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+ofwgpiobus_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
+DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass,
+0, 0);
 MODULE_VERSION(axp209, 1);
 MODULE_DEPEND(axp209, iicbus, 1, 1, 1);
___
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"


svn commit: r304077 - head/sys/arm/allwinner

2016-08-14 Thread Emmanuel Vadot
Author: manu
Date: Sun Aug 14 13:17:59 2016
New Revision: 304077
URL: https://svnweb.freebsd.org/changeset/base/304077

Log:
  Correct the size of the softc in a10_ehci
  
  Reported by:  andrew
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/a10_ehci.c

Modified: head/sys/arm/allwinner/a10_ehci.c
==
--- head/sys/arm/allwinner/a10_ehci.c   Sun Aug 14 13:17:55 2016
(r304076)
+++ head/sys/arm/allwinner/a10_ehci.c   Sun Aug 14 13:17:59 2016
(r304077)
@@ -358,7 +358,7 @@ static device_method_t ehci_methods[] = 
 static driver_t ehci_driver = {
.name = "ehci",
.methods = ehci_methods,
-   .size = sizeof(ehci_softc_t),
+   .size = sizeof(struct aw_ehci_softc),
 };
 
 static devclass_t ehci_devclass;
___
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"


svn commit: r303144 - head/sys/arm/allwinner

2016-07-21 Thread Emmanuel Vadot
Author: manu
Date: Thu Jul 21 13:26:39 2016
New Revision: 303144
URL: https://svnweb.freebsd.org/changeset/base/303144

Log:
  We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + 
BUS_PASS_ORDER_LATE
  
  Reviewed by:  andrew
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D7080

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Thu Jul 21 13:01:35 2016
(r303143)
+++ head/sys/arm/allwinner/a10_gpio.c   Thu Jul 21 13:26:39 2016
(r303144)
@@ -743,4 +743,4 @@ static driver_t a10_gpio_driver = {
 };
 
 EARLY_DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 
0, 0,
-BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
+BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
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"


svn commit: r303145 - head/sys/arm/allwinner

2016-07-21 Thread Emmanuel Vadot
Author: manu
Date: Thu Jul 21 13:28:07 2016
New Revision: 303145
URL: https://svnweb.freebsd.org/changeset/base/303145

Log:
  axp209 needs aw_nmi so attach a bit earlier
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7081

Modified:
  head/sys/arm/allwinner/aw_nmi.c

Modified: head/sys/arm/allwinner/aw_nmi.c
==
--- head/sys/arm/allwinner/aw_nmi.c Thu Jul 21 13:26:39 2016
(r303144)
+++ head/sys/arm/allwinner/aw_nmi.c Thu Jul 21 13:28:07 2016
(r303145)
@@ -401,4 +401,4 @@ static driver_t aw_nmi_driver = {
 static devclass_t aw_nmi_devclass;
 
 EARLY_DRIVER_MODULE(aw_nmi, simplebus, aw_nmi_driver,
-aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST);
+aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
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"


Re: svn commit: r303123 - head/sys/cam

2016-07-21 Thread Emmanuel Vadot

 Hello Warner,

 This break every kernel build that don't have nvme(4).

On Thu, 21 Jul 2016 03:11:35 + (UTC)
Warner Losh <i...@freebsd.org> wrote:

> Author: imp
> Date: Thu Jul 21 03:11:35 2016
> New Revision: 303123
> URL: https://svnweb.freebsd.org/changeset/base/303123
> 
> Log:
>   Fix mismerge and include the nvme support.
>   Also, print out the name of any CCB's functions that's not supported.
>   
>   MFC after: 1 week
> 
> Modified:
>   head/sys/cam/cam_xpt.c
> 
> Modified: head/sys/cam/cam_xpt.c
> ==
> --- head/sys/cam/cam_xpt.cThu Jul 21 00:53:14 2016(r303122)
> +++ head/sys/cam/cam_xpt.cThu Jul 21 03:11:35 2016(r303123)
> @@ -1033,6 +1033,8 @@ xpt_announce_periph(struct cam_periph *p
>   else if (path->device->protocol == PROTO_SEMB)
>   semb_print_ident(
>   (struct sep_identify_data *)>device->ident_data);
> + else if (path->device->protocol == PROTO_NVME)
> + nvme_print_ident(path->device->nvme_cdata, 
> path->device->nvme_data);
>   else
>   printf("Unknown protocol device\n");
>   if (path->device->serial_num_len > 0) {
> @@ -1086,6 +1088,8 @@ xpt_denounce_periph(struct cam_periph *p
>   else if (path->device->protocol == PROTO_SEMB)
>   semb_print_ident_short(
>   (struct sep_identify_data *)>device->ident_data);
> + else if (path->device->protocol == PROTO_NVME)
> + nvme_print_ident(path->device->nvme_cdata, 
> path->device->nvme_data);
>   else
>   printf("Unknown protocol device");
>   if (path->device->serial_num_len > 0)
> @@ -2516,6 +2520,10 @@ xpt_action_default(union ccb *start_ccb)
>   if (start_ccb->ccb_h.func_code == XPT_ATA_IO)
>   start_ccb->ataio.resid = 0;
>   /* FALLTHROUGH */
> + case XPT_NVME_IO:
> + if (start_ccb->ccb_h.func_code == XPT_NVME_IO)
> + start_ccb->nvmeio.resid = 0;
> + /* FALLTHROUGH */
>   case XPT_RESET_DEV:
>   case XPT_ENG_EXEC:
>   case XPT_SMP_IO:
> @@ -2655,6 +2663,8 @@ call_sim:
>   cgd->inq_data = dev->inq_data;
>   cgd->ident_data = dev->ident_data;
>   cgd->inq_flags = dev->inq_flags;
> + cgd->nvme_data = dev->nvme_data;
> + cgd->nvme_cdata = dev->nvme_cdata;
>   cgd->ccb_h.status = CAM_REQ_CMP;
>   cgd->serial_num_len = dev->serial_num_len;
>   if ((dev->serial_num_len > 0)
> @@ -3011,8 +3021,10 @@ call_sim:
>   case XPT_TERM_IO:
>   case XPT_ENG_INQ:
>   /* XXX Implement */
> - printf("%s: CCB type %#x not supported\n", __func__,
> -start_ccb->ccb_h.func_code);
> + xpt_print_path(start_ccb->ccb_h.path);
> + printf("%s: CCB type %#x %s not supported\n", __func__,
> + start_ccb->ccb_h.func_code,
> + xpt_action_name(start_ccb->ccb_h.func_code));
>   start_ccb->ccb_h.status = CAM_PROVIDE_FAIL;
>   if (start_ccb->ccb_h.func_code & XPT_FC_DEV_QUEUED) {
>   xpt_done(start_ccb);
> @@ -3315,6 +3327,13 @@ xpt_run_devq(struct cam_devq *devq)
>ata_cmd_string(_ccb->ataio.cmd,
>   cdb_str, sizeof(cdb_str;
>   break;
> + case XPT_NVME_IO:
> + CAM_DEBUG(work_ccb->ccb_h.path,
> + CAM_DEBUG_CDB,("%s. NCB: %s\n",
> +  nvme_op_string(_ccb->nvmeio.cmd),
> +  nvme_cmd_string(_ccb->nvmeio.cmd,
> + cdb_str, sizeof(cdb_str;
> + break;
>   default:
>       break;
>   }
> @@ -3904,6 +3923,9 @@ xpt_bus_register(struct cam_sim *sim, de
>   case XPORT_SATA:
>   new_bus->xport = ata_get_xport();
>   break;
> + case XPORT_NVME:
> + new_bus->xport = nvme_get_xport();
> + break;
>   default:
>   new_bus->xport = _default;
>   break;


-- 
Emmanuel Vadot
___
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"


svn commit: r303039 - head/sys/boot/efi/libefi

2016-07-19 Thread Emmanuel Vadot
Author: manu
Date: Tue Jul 19 19:00:22 2016
New Revision: 303039
URL: https://svnweb.freebsd.org/changeset/base/303039

Log:
  Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial 
console.
  
  Reviewed by:  andrew, emaste
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D6783

Modified:
  head/sys/boot/efi/libefi/Makefile

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Tue Jul 19 18:40:54 2016
(r303038)
+++ head/sys/boot/efi/libefi/Makefile   Tue Jul 19 19:00:22 2016
(r303039)
@@ -35,6 +35,10 @@ CFLAGS+= -I${.CURDIR}/../../common
 
 # Handle FreeBSD specific %b and %D printf format specifiers
 CFLAGS+= ${FORMAT_EXTENSIONS}
+
+# Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial 
console
+.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "aarch64"
 CFLAGS+= -DTERM_EMU
+.endif
 
 .include 
___
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"


svn commit: r303087 - head/sys/arm/allwinner

2016-07-20 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 20 11:23:06 2016
New Revision: 303087
URL: https://svnweb.freebsd.org/changeset/base/303087

Log:
  Add support for the SID (Security ID Module) on Allwinner A10 and A20.
  The rootkey is burnt at production and can't be changed, thus is can be used
  as a device unique ID or to generate a MAC address (This is was u-boot does).
  The rootkey is exposed as a sysctl (dev.aw_sid..rootkey).
  
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D6383

Modified:
  head/sys/arm/allwinner/aw_sid.c
  head/sys/arm/allwinner/aw_sid.h

Modified: head/sys/arm/allwinner/aw_sid.c
==
--- head/sys/arm/allwinner/aw_sid.c Wed Jul 20 11:15:32 2016
(r303086)
+++ head/sys/arm/allwinner/aw_sid.c Wed Jul 20 11:23:06 2016
(r303087)
@@ -33,12 +33,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -50,13 +52,22 @@ __FBSDID("$FreeBSD$");
 #defineSID_THERMAL_CALIB0  (SID_SRAM + 0x34)
 #defineSID_THERMAL_CALIB1  (SID_SRAM + 0x38)
 
+enum sid_type {
+   A10_SID = 1,
+   A20_SID,
+   A83T_SID,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun8i-a83t-sid",   1 },
+   { "allwinner,sun4i-a10-sid",A10_SID},
+   { "allwinner,sun7i-a20-sid",A20_SID},
+   { "allwinner,sun8i-a83t-sid",   A83T_SID},
{ NULL, 0 }
 };
 
 struct aw_sid_softc {
struct resource *res;
+   int type;
 };
 
 static struct aw_sid_softc *aw_sid_sc;
@@ -66,9 +77,18 @@ static struct resource_spec aw_sid_spec[
{ -1, 0 }
 };
 
+enum sid_keys {
+   AW_SID_ROOT_KEY,
+};
+
+#defineROOT_KEY_OFF0x0
+#defineROOT_KEY_SIZE   4
+
 #defineRD4(sc, reg)bus_read_4((sc)->res, (reg))
 #defineWR4(sc, reg, val)   bus_write_4((sc)->res, (reg), (val))
 
+static int aw_sid_sysctl(SYSCTL_HANDLER_ARGS);
+
 static int
 aw_sid_probe(device_t dev)
 {
@@ -96,6 +116,19 @@ aw_sid_attach(device_t dev)
 
aw_sid_sc = sc;
 
+   sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+   switch (sc->type) {
+   case A10_SID:
+   case A20_SID:
+   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+   OID_AUTO, "rootkey",
+   CTLTYPE_STRING | CTLFLAG_RD,
+   dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key");
+   break;
+   default:
+   break;
+   }
return (0);
 }
 
@@ -107,6 +140,8 @@ aw_sid_read_tscalib(uint32_t *calib0, ui
sc = aw_sid_sc;
if (sc == NULL)
return (ENXIO);
+   if (sc->type != A83T_SID)
+   return (ENXIO);
 
*calib0 = RD4(sc, SID_THERMAL_CALIB0);
*calib1 = RD4(sc, SID_THERMAL_CALIB1);
@@ -114,6 +149,45 @@ aw_sid_read_tscalib(uint32_t *calib0, ui
return (0);
 }
 
+int
+aw_sid_get_rootkey(u_char *out)
+{
+   struct aw_sid_softc *sc;
+   int i;
+   u_int tmp;
+
+   sc = aw_sid_sc;
+   if (sc == NULL)
+   return (ENXIO);
+   if (sc->type != A10_SID && sc->type != A20_SID)
+   return (ENXIO);
+
+   for (i = 0; i < ROOT_KEY_SIZE ; i++) {
+   tmp = RD4(aw_sid_sc, ROOT_KEY_OFF + (i * 4));
+   be32enc([i * 4], tmp);
+   }
+
+   return (0);
+}
+
+static int
+aw_sid_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   enum sid_keys key = arg2;
+   u_char rootkey[16];
+   char out[33];
+
+   if (key != AW_SID_ROOT_KEY)
+   return (ENOENT);
+
+   if (aw_sid_get_rootkey(rootkey) != 0)
+   return (ENOENT);
+   snprintf(out, sizeof(out),
+ "%16D", rootkey, "");
+
+   return sysctl_handle_string(oidp, out, sizeof(out), req);
+}
+
 static device_method_t aw_sid_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, aw_sid_probe),

Modified: head/sys/arm/allwinner/aw_sid.h
==
--- head/sys/arm/allwinner/aw_sid.h Wed Jul 20 11:15:32 2016
(r303086)
+++ head/sys/arm/allwinner/aw_sid.h Wed Jul 20 11:23:06 2016
(r303087)
@@ -30,5 +30,6 @@
 #define __AW_SID_H__
 
 intaw_sid_read_tscalib(uint32_t *, uint32_t *);
+intaw_sid_get_rootkey(u_char *out);
 
 #endif /* !__AW_SID_H__ */
___
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"


svn commit: r302470 - head/sys/arm/allwinner

2016-07-08 Thread Emmanuel Vadot
Author: manu
Date: Fri Jul  8 23:08:59 2016
New Revision: 302470
URL: https://svnweb.freebsd.org/changeset/base/302470

Log:
  Check that the pin function exists before setting it.
  This is needed for Allwinner A13 which has gpio pins with only "out" function.

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Fri Jul  8 23:07:48 2016
(r302469)
+++ head/sys/arm/allwinner/a10_gpio.c   Fri Jul  8 23:08:59 2016
(r302470)
@@ -198,11 +198,15 @@ a10_gpio_get_function(struct a10_gpio_so
return (0);
 }
 
-static void
+static int
 a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f)
 {
uint32_t bank, data, offset;
 
+   /* Check if the function exists in the padconf data */
+   if (sc->padconf->pins[pin].functions[f] == NULL)
+   return (EINVAL);
+
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
 
@@ -214,6 +218,8 @@ a10_gpio_set_function(struct a10_gpio_so
data &= ~(7 << offset);
data |= (f << offset);
A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, pin >> 3), data);
+
+   return (0);
 }
 
 static uint32_t
@@ -275,9 +281,10 @@ a10_gpio_set_drv(struct a10_gpio_softc *
A10_GPIO_WRITE(sc, A10_GPIO_GP_DRV(bank, pin >> 4), val);
 }
 
-static void
+static int
 a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags)
 {
+   int err = 0;
 
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
@@ -285,11 +292,14 @@ a10_gpio_pin_configure(struct a10_gpio_s
/* Manage input/output. */
if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) {
if (flags & GPIO_PIN_OUTPUT)
-   a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
+   err = a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
else
-   a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
+   err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
}
 
+   if (err)
+   return (err);
+
/* Manage Pull-up/pull-down. */
if (flags & (GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)) {
if (flags & GPIO_PIN_PULLUP)
@@ -298,6 +308,8 @@ a10_gpio_pin_configure(struct a10_gpio_s
a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN);
} else
a10_gpio_set_pud(sc, pin, A10_GPIO_NONE);
+
+   return (0);
 }
 
 static device_t
@@ -372,16 +384,17 @@ static int
 a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
 {
struct a10_gpio_softc *sc;
+   int err;
 
sc = device_get_softc(dev);
if (pin > sc->padconf->npins)
return (EINVAL);
 
A10_GPIO_LOCK(sc);
-   a10_gpio_pin_configure(sc, pin, flags);
+   err = a10_gpio_pin_configure(sc, pin, flags);
A10_GPIO_UNLOCK(sc);
 
-   return (0);
+   return (err);
 }
 
 static int
___
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"


svn commit: r302472 - in head/sys: arm/allwinner arm/allwinner/a13 arm/allwinner/clk arm/conf conf

2016-07-08 Thread Emmanuel Vadot
Author: manu
Date: Fri Jul  8 23:38:25 2016
New Revision: 302472
URL: https://svnweb.freebsd.org/changeset/base/302472

Log:
  Add support for Allwinner A13.
  
  Reviewed by:  jmcneill
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D6809

Added:
  head/sys/arm/allwinner/a13/
  head/sys/arm/allwinner/a13/a13_padconf.c   (contents, props changed)
  head/sys/arm/allwinner/a13/files.a13   (contents, props changed)
Modified:
  head/sys/arm/allwinner/a10_codec.c
  head/sys/arm/allwinner/a10_ehci.c
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/allwinner/aw_ccu.c
  head/sys/arm/allwinner/clk/aw_gate.c
  head/sys/arm/allwinner/clk/aw_pll.c
  head/sys/arm/allwinner/clk/aw_usbclk.c
  head/sys/arm/allwinner/std.a10
  head/sys/arm/conf/A10
  head/sys/conf/options.arm

Modified: head/sys/arm/allwinner/a10_codec.c
==
--- head/sys/arm/allwinner/a10_codec.c  Fri Jul  8 23:10:55 2016
(r302471)
+++ head/sys/arm/allwinner/a10_codec.c  Fri Jul  8 23:38:25 2016
(r302472)
@@ -720,13 +720,19 @@ CHANNEL_DECLARE(a10codec_chan);
  * Device interface
  */
 
+static struct ofw_compat_data compat_data[] = {
+   {"allwinner,sun4i-a10-codec", 1},
+   {"allwinner,sun7i-a20-codec", 1},
+   {NULL, 0},
+};
+
 static int
 a10codec_probe(device_t dev)
 {
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "allwinner,sun7i-a20-codec"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "Allwinner Audio Codec");

Modified: head/sys/arm/allwinner/a10_ehci.c
==
--- head/sys/arm/allwinner/a10_ehci.c   Fri Jul  8 23:10:55 2016
(r302471)
+++ head/sys/arm/allwinner/a10_ehci.c   Fri Jul  8 23:38:25 2016
(r302472)
@@ -112,6 +112,7 @@ static const struct aw_ehci_conf a31_ehc
 
 static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-ehci",   (uintptr_t)_ehci_conf },
+   { "allwinner,sun5i-a13-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun6i-a31-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun7i-a20-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun8i-a83t-ehci",  (uintptr_t)_ehci_conf },

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Fri Jul  8 23:10:55 2016
(r302471)
+++ head/sys/arm/allwinner/a10_gpio.c   Fri Jul  8 23:38:25 2016
(r302472)
@@ -80,6 +80,11 @@ __FBSDID("$FreeBSD$");
 extern const struct allwinner_padconf a10_padconf;
 #endif
 
+/* Defined in a13_padconf.c */
+#ifdef SOC_ALLWINNER_A13
+extern const struct allwinner_padconf a13_padconf;
+#endif
+
 /* Defined in a20_padconf.c */
 #ifdef SOC_ALLWINNER_A20
 extern const struct allwinner_padconf a20_padconf;
@@ -115,6 +120,9 @@ static struct ofw_compat_data compat_dat
 #ifdef SOC_ALLWINNER_A10
{"allwinner,sun4i-a10-pinctrl", (uintptr_t)_padconf},
 #endif
+#ifdef SOC_ALLWINNER_A13
+   {"allwinner,sun5i-a13-pinctrl", (uintptr_t)_padconf},
+#endif
 #ifdef SOC_ALLWINNER_A20
{"allwinner,sun7i-a20-pinctrl", (uintptr_t)_padconf},
 #endif

Added: head/sys/arm/allwinner/a13/a13_padconf.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a13/a13_padconf.cFri Jul  8 23:38:25 2016
(r302472)
@@ -0,0 +1,129 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF US

svn commit: r304214 - stable/11/sys/arm/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:10:18 2016
New Revision: 304214
URL: https://svnweb.freebsd.org/changeset/base/304214

Log:
  MFC r303728:
  We need aw_nmi to be attached which needs GIC so attach a bit later.
  Also the GPIOC doesn't need to be attach early
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7082

Modified:
  stable/11/sys/arm/allwinner/axp209.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/axp209.c
==
--- stable/11/sys/arm/allwinner/axp209.cTue Aug 16 09:08:44 2016
(r304213)
+++ stable/11/sys/arm/allwinner/axp209.cTue Aug 16 09:10:18 2016
(r304214)
@@ -707,10 +707,10 @@ extern devclass_t ofwgpiobus_devclass, g
 extern driver_t ofw_gpiobus_driver, gpioc_driver;
 
 EARLY_DRIVER_MODULE(axp209, iicbus, axp209_driver, axp209_devclass,
-  0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+  0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
 EARLY_DRIVER_MODULE(ofw_gpiobus, axp209_pmu, ofw_gpiobus_driver,
-ofwgpiobus_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
-EARLY_DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass,
-0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+ofwgpiobus_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
+DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass,
+0, 0);
 MODULE_VERSION(axp209, 1);
 MODULE_DEPEND(axp209, iicbus, 1, 1, 1);
___
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"


svn commit: r304212 - stable/11/sys/arm/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:06:23 2016
New Revision: 304212
URL: https://svnweb.freebsd.org/changeset/base/304212

Log:
  MFC r303144:
  We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + 
BUS_PASS_ORDER_LATE
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7080

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Tue Aug 16 08:48:41 2016
(r304211)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Tue Aug 16 09:06:23 2016
(r304212)
@@ -708,4 +708,4 @@ static driver_t a10_gpio_driver = {
 };
 
 EARLY_DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 
0, 0,
-BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
+BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
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"


svn commit: r304215 - in stable/11/sys: boot/fdt/dts/arm modules/dtb/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:12:45 2016
New Revision: 304215
URL: https://svnweb.freebsd.org/changeset/base/304215

Log:
  MFC r303974:
  ename pcduino3b.dts to pcduino3.dts
  The only difference between 3 and 3B is the size of the RJ45 port.
  And now we have a uboot port that expect pcduino3.dts to be present.
  
  Reported by:  imp

Added:
  stable/11/sys/boot/fdt/dts/arm/pcduino3.dts
 - copied unchanged from r303974, head/sys/boot/fdt/dts/arm/pcduino3.dts
Deleted:
  stable/11/sys/boot/fdt/dts/arm/pcduino3b.dts
Modified:
  stable/11/sys/modules/dtb/allwinner/Makefile
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/sys/boot/fdt/dts/arm/pcduino3.dts (from r303974, 
head/sys/boot/fdt/dts/arm/pcduino3.dts)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/sys/boot/fdt/dts/arm/pcduino3.dts Tue Aug 16 09:12:45 2016
(r304215, copy of r303974, head/sys/boot/fdt/dts/arm/pcduino3.dts)
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 "sun7i-a20-pcduino3.dts"
+#include "sun7i-a20-hdmi.dtsi"
+#include "xpowers-axp209.dtsi"
+
+/ {
+   soc@01c0 {
+   hdmi@01c16000 {
+   status = "okay";
+   };
+
+   hdmiaudio {
+   status = "okay";
+   };
+   };
+};
+
+ {
+  pinctrl-0 = <_pins_rgmii_a>;
+  phy-mode = "rgmii";
+};

Modified: stable/11/sys/modules/dtb/allwinner/Makefile
==
--- stable/11/sys/modules/dtb/allwinner/MakefileTue Aug 16 09:10:18 
2016(r304214)
+++ stable/11/sys/modules/dtb/allwinner/MakefileTue Aug 16 09:12:45 
2016(r304215)
@@ -7,7 +7,7 @@ DTS=\
cubieboard2.dts \
olimex-a20-som-evb.dts \
olinuxino-lime.dts \
-   pcduino3b.dts \
+   pcduino3.dts \
sinovoip-bpi-m3.dts
 
 .include 
___
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"


svn commit: r304213 - stable/11/sys/arm/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:08:44 2016
New Revision: 304213
URL: https://svnweb.freebsd.org/changeset/base/304213

Log:
  MFC r303145:
  axp209 needs aw_nmi so attach a bit earlier
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7081

Modified:
  stable/11/sys/arm/allwinner/aw_nmi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/aw_nmi.c
==
--- stable/11/sys/arm/allwinner/aw_nmi.cTue Aug 16 09:06:23 2016
(r304212)
+++ stable/11/sys/arm/allwinner/aw_nmi.cTue Aug 16 09:08:44 2016
(r304213)
@@ -400,4 +400,4 @@ static driver_t aw_nmi_driver = {
 static devclass_t aw_nmi_devclass;
 
 EARLY_DRIVER_MODULE(aw_nmi, simplebus, aw_nmi_driver,
-aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST);
+aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
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"


svn commit: r304221 - head/sys/boot/efi/boot1

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 14:23:35 2016
New Revision: 304221
URL: https://svnweb.freebsd.org/changeset/base/304221

Log:
  Use %ju modifier for u_int64_t and %jd modifier for off_t.
  off_t is long long on arm32 and long on amd64
  
  MFC after:1 week

Modified:
  head/sys/boot/efi/boot1/ufs_module.c
  head/sys/boot/efi/boot1/zfs_module.c

Modified: head/sys/boot/efi/boot1/ufs_module.c
==
--- head/sys/boot/efi/boot1/ufs_module.cTue Aug 16 14:15:09 2016
(r304220)
+++ head/sys/boot/efi/boot1/ufs_module.cTue Aug 16 14:23:35 2016
(r304221)
@@ -56,7 +56,7 @@ dskread(void *buf, u_int64_t lba, int nb
devinfo->dev->Media->MediaId, lba, size, buf);
 
if (status != EFI_SUCCESS) {
-   DPRINTF("dskread: failed dev: %p, id: %u, lba: %lu, size: %d, "
+   DPRINTF("dskread: failed dev: %p, id: %u, lba: %zu, size: %d, "
"status: %lu\n", devinfo->dev,
devinfo->dev->Media->MediaId, lba, size,
EFI_ERROR_CODE(status));

Modified: head/sys/boot/efi/boot1/zfs_module.c
==
--- head/sys/boot/efi/boot1/zfs_module.cTue Aug 16 14:15:09 2016
(r304220)
+++ head/sys/boot/efi/boot1/zfs_module.cTue Aug 16 14:23:35 2016
(r304221)
@@ -53,7 +53,7 @@ vdev_read(vdev_t *vdev, void *priv, off_
status = devinfo->dev->ReadBlocks(devinfo->dev,
devinfo->dev->Media->MediaId, lba, bytes, buf);
if (status != EFI_SUCCESS) {
-   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %zu, size: 
%zu,"
+   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %jd, size: 
%zu,"
 " status: %lu\n", devinfo->dev,
 devinfo->dev->Media->MediaId, lba, bytes,
 EFI_ERROR_CODE(status));
___
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"


svn commit: r304222 - head/sys/boot/efi/libefi

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 14:33:25 2016
New Revision: 304222
URL: https://svnweb.freebsd.org/changeset/base/304222

Log:
  Only use WaitForKeys event if it exists, this is not the case in u-boot efi 
implementation.
  
  Reviewed by:  jhb, emaste
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D6781

Modified:
  head/sys/boot/efi/libefi/efi_console.c

Modified: head/sys/boot/efi/libefi/efi_console.c
==
--- head/sys/boot/efi/libefi/efi_console.c  Tue Aug 16 14:23:35 2016
(r304221)
+++ head/sys/boot/efi/libefi/efi_console.c  Tue Aug 16 14:33:25 2016
(r304222)
@@ -438,8 +438,10 @@ efi_cons_getchar()
 
/* Try to read a key stroke. We wait for one if none is pending. */
status = conin->ReadKeyStroke(conin, );
-   if (status == EFI_NOT_READY) {
-   BS->WaitForEvent(1, >WaitForKey, );
+   while (status == EFI_NOT_READY) {
+   /* Some EFI implementation (u-boot for example) do not support 
WaitForKey */
+   if (conin->WaitForKey != NULL)
+   BS->WaitForEvent(1, >WaitForKey, );
status = conin->ReadKeyStroke(conin, );
}
switch (key.ScanCode) {
@@ -454,6 +456,9 @@ efi_cons_getchar()
 int
 efi_cons_poll()
 {
+
+   if (conin->WaitForKey == NULL)
+   return (1);
/* This can clear the signaled state. */
return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS);
 }
___
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"


svn commit: r304289 - head/sys/arm/allwinner

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 10:20:36 2016
New Revision: 304289
URL: https://svnweb.freebsd.org/changeset/base/304289

Log:
  a10_gpio_get_function now returns the whole function not only
  GPIO_INPUT/GPIO_OUTPUT.
  a10_gpio_get_pud now returns the whole pud not only PULLDOWN/PULLUP.
  Add a10_gpio_get_drv to get the current drive strenght.
  During fdt pin configure, avoid setting function/drive/pud if it's already in
  the correct value.
  
  Tested on Allwinner H3 and A20
  
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Wed Aug 17 10:20:05 2016
(r304288)
+++ head/sys/arm/allwinner/a10_gpio.c   Wed Aug 17 10:20:36 2016
(r304289)
@@ -210,14 +210,8 @@ a10_gpio_get_function(struct a10_gpio_so
offset = ((pin & 0x07) << 2);
 
func = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, pin >> 3));
-   switch ((func >> offset) & 0x7) {
-   case A10_GPIO_INPUT:
-   return (GPIO_PIN_INPUT);
-   case A10_GPIO_OUTPUT:
-   return (GPIO_PIN_OUTPUT);
-   }
 
-   return (0);
+   return ((func >> offset) & 0x7);
 }
 
 static int
@@ -257,14 +251,8 @@ a10_gpio_get_pud(struct a10_gpio_softc *
offset = ((pin & 0x0f) << 1);
 
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pin >> 4));
-   switch ((val >> offset) & 0x3) {
-   case A10_GPIO_PULLDOWN:
-   return (GPIO_PIN_PULLDOWN);
-   case A10_GPIO_PULLUP:
-   return (GPIO_PIN_PULLUP);
-   }
 
-   return (0);
+   return ((val >> offset) & AW_GPIO_PUD_MASK);
 }
 
 static void
@@ -285,6 +273,23 @@ a10_gpio_set_pud(struct a10_gpio_softc *
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pin >> 4), val);
 }
 
+static uint32_t
+a10_gpio_get_drv(struct a10_gpio_softc *sc, uint32_t pin)
+{
+   uint32_t bank, offset, val;
+
+   /* Must be called with lock held. */
+   A10_GPIO_LOCK_ASSERT(sc);
+
+   bank = sc->padconf->pins[pin].port;
+   pin = sc->padconf->pins[pin].pin;
+   offset = ((pin & 0x0f) << 1);
+
+   val = A10_GPIO_READ(sc, A10_GPIO_GP_DRV(bank, pin >> 4));
+
+   return ((val >> offset) & AW_GPIO_DRV_MASK);
+}
+
 static void
 a10_gpio_set_drv(struct a10_gpio_softc *sc, uint32_t pin, uint32_t drive)
 {
@@ -373,14 +378,39 @@ static int
 a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
 {
struct a10_gpio_softc *sc;
+   uint32_t func;
+   uint32_t pud;
 
sc = device_get_softc(dev);
if (pin >= sc->padconf->npins)
return (EINVAL);
 
A10_GPIO_LOCK(sc);
-   *flags = a10_gpio_get_function(sc, pin);
-   *flags |= a10_gpio_get_pud(sc, pin);
+   func = a10_gpio_get_function(sc, pin);
+   switch (func) {
+   case A10_GPIO_INPUT:
+   *flags = GPIO_PIN_INPUT;
+   break;
+   case A10_GPIO_OUTPUT:
+   *flags = GPIO_PIN_OUTPUT;
+   break;
+   default:
+   *flags = 0;
+   break;
+   }
+
+   pud = a10_gpio_get_pud(sc, pin);
+   switch (pud) {
+   case A10_GPIO_PULLDOWN:
+   *flags |= GPIO_PIN_PULLDOWN;
+   break;
+   case A10_GPIO_PULLUP:
+   *flags |= GPIO_PIN_PULLUP;
+   break;
+   default:
+   break;
+   }
+
A10_GPIO_UNLOCK(sc);
 
return (0);
@@ -564,9 +594,13 @@ aw_fdt_configure_pins(device_t dev, phan
}
 
A10_GPIO_LOCK(sc);
-   a10_gpio_set_function(sc, pin_num, pin_func);
-   a10_gpio_set_drv(sc, pin_num, pin_drive);
-   a10_gpio_set_pud(sc, pin_num, pin_pull);
+
+   if (a10_gpio_get_function(sc, pin_num) != pin_func)
+   a10_gpio_set_function(sc, pin_num, pin_func);
+   if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
+   a10_gpio_set_drv(sc, pin_num, pin_drive);
+   if (a10_gpio_get_pud(sc, pin_num) != pin_pull)
+   a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
 
___
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"


svn commit: r304291 - head/sys/boot/fdt/dts/arm

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 13:19:28 2016
New Revision: 304291
URL: https://svnweb.freebsd.org/changeset/base/304291

Log:
  Remove pullup settings for MMC pins, this is not needed since r304290
  
  MFC after:1 week

Modified:
  head/sys/boot/fdt/dts/arm/bananapi.dts

Modified: head/sys/boot/fdt/dts/arm/bananapi.dts
==
--- head/sys/boot/fdt/dts/arm/bananapi.dts  Wed Aug 17 13:09:31 2016
(r304290)
+++ head/sys/boot/fdt/dts/arm/bananapi.dts  Wed Aug 17 13:19:28 2016
(r304291)
@@ -41,7 +41,3 @@
};
};
 };
-
-_pins_a {
-   allwinner,pull = ;
-};
___
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"


svn commit: r304290 - head/sys/arm/allwinner

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 13:09:31 2016
New Revision: 304290
URL: https://svnweb.freebsd.org/changeset/base/304290

Log:
  Only set pud settings if this is a pullup or pulldown configuration.
  This removes the need to set the MMC pins with pullups in our DTS.
  Thanks to jmcneill@ for spotting this.
  
  Tested on Orange Pi One (Allwinner H3).
  
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Wed Aug 17 10:20:36 2016
(r304289)
+++ head/sys/arm/allwinner/a10_gpio.c   Wed Aug 17 13:09:31 2016
(r304290)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #if defined(__aarch64__)
 #include "opt_soc.h"
 #endif
@@ -599,7 +601,9 @@ aw_fdt_configure_pins(device_t dev, phan
a10_gpio_set_function(sc, pin_num, pin_func);
if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
a10_gpio_set_drv(sc, pin_num, pin_drive);
-   if (a10_gpio_get_pud(sc, pin_num) != pin_pull)
+   if (a10_gpio_get_pud(sc, pin_num) != pin_pull &&
+   (pin_pull == SUN4I_PINCTRL_PULL_UP ||
+   pin_pull == SUN4I_PINCTRL_PULL_DOWN))
a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
___
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"


svn commit: r304297 - head/sys/modules/dtb/allwinner

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 17:59:09 2016
New Revision: 304297
URL: https://svnweb.freebsd.org/changeset/base/304297

Log:
  Add sun5i-a13-olinuxino to the build.

Modified:
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Wed Aug 17 17:54:24 2016
(r304296)
+++ head/sys/modules/dtb/allwinner/Makefile Wed Aug 17 17:59:09 2016
(r304297)
@@ -8,6 +8,7 @@ DTS=\
olimex-a20-som-evb.dts \
olinuxino-lime.dts \
pcduino3.dts \
-   sinovoip-bpi-m3.dts
+   sinovoip-bpi-m3.dts \
+   sun5i-a13-olinuxino.dts
 
 .include 
___
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"


svn commit: r304316 - in head/sys/arm: allwinner allwinner/a10 conf

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 20:32:08 2016
New Revision: 304316
URL: https://svnweb.freebsd.org/changeset/base/304316

Log:
  Rename kernel config A10 into ALLWINNER_UP as it is intend to work with all
  Allwinner Uniprocessor SoC.
  As of now it works with A10 and A13 (and possibly R8 as it is the same as the 
A13).
  Move files.a10 into a1o subdirectory as it should be.
  Rename std.a10 into std.allwinner_up

Added:
  head/sys/arm/allwinner/a10/files.a10   (contents, props changed)
 - copied, changed from r304315, head/sys/arm/allwinner/files.a10
  head/sys/arm/allwinner/files.allwinner_up   (contents, props changed)
  head/sys/arm/allwinner/std.allwinner_up   (contents, props changed)
 - copied, changed from r304315, head/sys/arm/allwinner/std.a10
  head/sys/arm/conf/ALLWINNER_UP   (contents, props changed)
 - copied, changed from r304315, head/sys/arm/conf/A10
Deleted:
  head/sys/arm/allwinner/files.a10
  head/sys/arm/allwinner/std.a10
  head/sys/arm/conf/A10

Copied and modified: head/sys/arm/allwinner/a10/files.a10 (from r304315, 
head/sys/arm/allwinner/files.a10)
==
--- head/sys/arm/allwinner/files.a10Wed Aug 17 20:27:04 2016
(r304315, copy source)
+++ head/sys/arm/allwinner/a10/files.a10Wed Aug 17 20:32:08 2016
(r304316)
@@ -2,4 +2,3 @@
 
 arm/allwinner/a10/a10_intc.c   standard
 arm/allwinner/a10_padconf.cstandard
-arm/allwinner/timer.c  standard

Added: head/sys/arm/allwinner/files.allwinner_up
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/files.allwinner_up   Wed Aug 17 20:32:08 2016
(r304316)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+arm/allwinner/timer.c  standard

Copied and modified: head/sys/arm/allwinner/std.allwinner_up (from r304315, 
head/sys/arm/allwinner/std.a10)
==
--- head/sys/arm/allwinner/std.a10  Wed Aug 17 20:27:04 2016
(r304315, copy source)
+++ head/sys/arm/allwinner/std.allwinner_up Wed Aug 17 20:32:08 2016
(r304316)
@@ -1,4 +1,4 @@
-# Allwinner A10 common options
+# Allwinner Uniprocessor common options
 #$FreeBSD$
 
 cpuCPU_CORTEXA
@@ -8,6 +8,7 @@ makeoptions CONF_CFLAGS="-march=armv7a"
 makeoptionsKERNVIRTADDR=0xc020
 optionsKERNVIRTADDR=0xc020
 
+files  "../allwinner/files.allwinner_up"
 files  "../allwinner/files.allwinner"
-files  "../allwinner/files.a10"
+files  "../allwinner/a10/files.a10"
 files  "../allwinner/a13/files.a13"

Copied and modified: head/sys/arm/conf/ALLWINNER_UP (from r304315, 
head/sys/arm/conf/A10)
==
--- head/sys/arm/conf/A10   Wed Aug 17 20:27:04 2016(r304315, copy 
source)
+++ head/sys/arm/conf/ALLWINNER_UP  Wed Aug 17 20:32:08 2016
(r304316)
@@ -1,5 +1,5 @@
 #
-# A10 -- Custom configuration for the AllWinner A10 SoC
+# ALLWINNER_UP -- Custom configuration for the AllWinner Uniprocessor SoC
 #
 # For more information on this file, please read the config(5) manual page,
 # and/or the handbook section on Kernel Configuration Files:
@@ -18,10 +18,10 @@
 #
 # $FreeBSD$
 
-ident  A10
+ident  ALLWINNER_UP
 
 include"std.armv6"
-include"../allwinner/std.a10"
+include"../allwinner/std.allwinner_up"
 
 optionsINTRNG
 
___
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"


svn commit: r313389 - head/sys/boot/efi/libefi

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 15:16:01 2017
New Revision: 313389
URL: https://svnweb.freebsd.org/changeset/base/313389

Log:
  efipart is also using the '%S' printf format, add -Wno-format for it.
  This fix building for armv6.

Modified:
  head/sys/boot/efi/libefi/Makefile

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Tue Feb  7 15:13:19 2017
(r313388)
+++ head/sys/boot/efi/libefi/Makefile   Tue Feb  7 15:16:01 2017
(r313389)
@@ -26,6 +26,7 @@ SRCS+=time_event.c
 # of a short. There's no good cast to use here so just ignore the
 # warnings for now.
 CWARNFLAGS.efinet.c+=  -Wno-format
+CWARNFLAGS.efipart.c+= -Wno-format
 CWARNFLAGS.env.c+= -Wno-format
 
 .if ${MACHINE_CPUARCH} == "aarch64"
___
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"


svn commit: r313393 - head/sys/modules/dtb/allwinner

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 17:15:13 2017
New Revision: 313393
URL: https://svnweb.freebsd.org/changeset/base/313393

Log:
  Switch to the Linux device tree upstream names for Allwinner boards.
  Newer u-boot that uses the u-boot-master port uses these names.

Modified:
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Tue Feb  7 17:04:31 2017
(r313392)
+++ head/sys/modules/dtb/allwinner/Makefile Tue Feb  7 17:15:13 2017
(r313393)
@@ -1,17 +1,26 @@
 # $FreeBSD$
 # All the dts files for allwinner systems we support.
 DTS=   \
-   bananapi.dts \
-   bananapim2.dts \
-   cubieboard.dts \
-   cubieboard2.dts \
nanopi-neo.dts \
-   olimex-a20-som-evb.dts \
-   olinuxino-lime.dts \
orangepi-plus-2e.dts \
-   pcduino3.dts \
sinovoip-bpi-m3.dts \
+   sun4i-a10-cubieboard.dts \
+   sun4i-a10-olinuxino-lime.dts \
+   sun6i-a31s-sinovoip-bpi-m2.dts \
sun5i-a13-olinuxino.dts \
-   sun5i-r8-chip.dts
+   sun5i-r8-chip.dts \
+   sun7i-a20-bananapi.dts \
+   sun7i-a20-cubieboard2.dts \
+   sun7i-a20-olimex-som-evb.dts \
+   sun7i-a20-pcduino3.dts
+
+LINKS= \
+   ${DTBDIR}/sun4i-a10-cubieboard.dtb ${DTBDIR}/cubieboard.dtb \
+   ${DTBDIR}/sun4i-a10-olinuxino-lime.dtb ${DTBDIR}/olinuxino-lime.dtb \
+   ${DTBDIR}/sun6i-a31s-sinovoip-bpi-m2.dtb ${DTBDIR}/bananapim2.dtb \
+   ${DTBDIR}/sun7i-a20-bananapi.dtb ${DTBDIR}/bananapi.dtb \
+   ${DTBDIR}/sun7i-a20-cubieboard2.dtb ${DTBDIR}/cubieboard2.dtb \
+   ${DTBDIR}/sun7i-a20-olimex-som-evb.dtb ${DTBDIR}/olimex-a20-som-evb.dtb 
\
+   ${DTBDIR}/sun7i-a20-pcduino3.dtb ${DTBDIR}/pcduino3.dtb
 
 .include 
___
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"


svn commit: r313394 - head/sys/kern

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 17:31:24 2017
New Revision: 313394
URL: https://svnweb.freebsd.org/changeset/base/313394

Log:
  subr_sfbus.c need sys/proc.h for struct thread definition.
  This fixes kernel build for armv6.
  
  Discussed with: kib

Modified:
  head/sys/kern/subr_sfbuf.c

Modified: head/sys/kern/subr_sfbuf.c
==
--- head/sys/kern/subr_sfbuf.c  Tue Feb  7 17:15:13 2017(r313393)
+++ head/sys/kern/subr_sfbuf.c  Tue Feb  7 17:31:24 2017(r313394)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
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"


svn commit: r313403 - head/sys/arm/allwinner

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 19:28:32 2017
New Revision: 313403
URL: https://svnweb.freebsd.org/changeset/base/313403

Log:
  Rename timer.c to a10_timer.c
  
  Requested by: andrew

Added:
  head/sys/arm/allwinner/a10_timer.c
 - copied unchanged from r313402, head/sys/arm/allwinner/timer.c
Deleted:
  head/sys/arm/allwinner/timer.c
Modified:
  head/sys/arm/allwinner/files.allwinner_up

Copied: head/sys/arm/allwinner/a10_timer.c (from r313402, 
head/sys/arm/allwinner/timer.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a10_timer.c  Tue Feb  7 19:28:32 2017
(r313403, copy of r313402, head/sys/arm/allwinner/timer.c)
@@ -0,0 +1,367 @@
+/*-
+ * Copyright (c) 2012 Ganbold Tsagaankhuu 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+/**
+ * Timer registers addr
+ *
+ */
+#define SW_TIMER_IRQ_EN_REG0x00
+#define SW_TIMER_IRQ_STA_REG   0x04
+#define SW_TIMER0_CTRL_REG 0x10
+#define SW_TIMER0_INT_VALUE_REG0x14
+#define SW_TIMER0_CUR_VALUE_REG0x18
+
+#define SW_COUNTER64LO_REG 0xa4
+#define SW_COUNTER64HI_REG 0xa8
+#define CNT64_CTRL_REG 0xa0
+
+#define CNT64_RL_EN0x02 /* read latch enable */
+
+#define TIMER_ENABLE   (1<<0)
+#define TIMER_AUTORELOAD   (1<<1)
+#define TIMER_OSC24M   (1<<2) /* oscillator = 24mhz */
+#define TIMER_PRESCALAR(0<<4) /* prescalar = 1 */
+
+#define SYS_TIMER_CLKSRC   2400 /* clock source */
+
+struct a10_timer_softc {
+   device_tsc_dev;
+   struct resource *res[2];
+   bus_space_tag_t sc_bst;
+   bus_space_handle_t sc_bsh;
+   void*sc_ih; /* interrupt handler */
+   uint32_tsc_period;
+   uint32_ttimer0_freq;
+   struct eventtimer et;
+};
+
+int a10_timer_get_timerfreq(struct a10_timer_softc *);
+
+#define timer_read_4(sc, reg)  \
+   bus_space_read_4(sc->sc_bst, sc->sc_bsh, reg)
+#define timer_write_4(sc, reg, val)\
+   bus_space_write_4(sc->sc_bst, sc->sc_bsh, reg, val)
+
+static u_int   a10_timer_get_timecount(struct timecounter *);
+static int a10_timer_timer_start(struct eventtimer *,
+sbintime_t first, sbintime_t period);
+static int a10_timer_timer_stop(struct eventtimer *);
+
+static uint64_t timer_read_counter64(void);
+
+static int a10_timer_hardclock(void *);
+static int a10_timer_probe(device_t);
+static int a10_timer_attach(device_t);
+
+static delay_func a10_timer_delay;
+
+static struct timecounter a10_timer_timecounter = {
+   .tc_name   = "a10_timer timer0",
+   .tc_get_timecount  = a10_timer_get_timecount,
+   .tc_counter_mask   = ~0u,
+   .tc_frequency  = 0,
+   .tc_quality= 1000,
+};
+
+struct a10_timer_softc *a10_timer_sc = NULL;
+
+static struct resource_spec a10_timer_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+static uint64_t
+timer_read_counter64(void)
+{
+   uint32_t lo, hi;
+
+   /* 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)
+   continue;
+
+   hi = timer_read_4(a10_timer_sc, 

svn commit: r314119 - head/sys/dev/extres/clk

2017-02-22 Thread Emmanuel Vadot
Author: manu
Date: Thu Feb 23 05:33:20 2017
New Revision: 314119
URL: https://svnweb.freebsd.org/changeset/base/314119

Log:
  Do not check divider length if we have a div table.
  
  Reviewed by:  mmel

Modified:
  head/sys/dev/extres/clk/clk_div.c

Modified: head/sys/dev/extres/clk/clk_div.c
==
--- head/sys/dev/extres/clk/clk_div.c   Thu Feb 23 04:26:17 2017
(r314118)
+++ head/sys/dev/extres/clk/clk_div.c   Thu Feb 23 05:33:20 2017
(r314119)
@@ -195,7 +195,8 @@ clknode_div_set_freq(struct clknode *clk
hw_i_div--;
 
*stop = 1;
-   if (hw_i_div > sc->i_mask) {
+   if (hw_i_div > sc->i_mask &&
+   ((sc->div_flags & CLK_DIV_WITH_TABLE) == 0)) {
/* XXX Or only return error? */
printf("%s: %s integer divider is too big: %u\n",
clknode_get_name(clk), __func__, hw_i_div);
___
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"


svn commit: r304488 - head/sys/arm/arm

2016-08-19 Thread Emmanuel Vadot
Author: manu
Date: Fri Aug 19 18:02:36 2016
New Revision: 304488
URL: https://svnweb.freebsd.org/changeset/base/304488

Log:
  Keep boot parameters in ARM trampoline code
  
  Currently boot parameters (r0 - r3) are forgotten in ARM trampoline code.
  This patch save them at startup and restore them before jumping into kernel
  _start() routine.
  This is usefull when booting with Linux ABI and/or custom bootloader.
  
  Submitted by: Grégory Soutadé 
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D7395

Modified:
  head/sys/arm/arm/elf_trampoline.c

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Fri Aug 19 17:57:14 2016
(r304487)
+++ head/sys/arm/arm/elf_trampoline.c   Fri Aug 19 18:02:36 2016
(r304488)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 extern char kernel_start[];
 extern char kernel_end[];
@@ -47,7 +48,7 @@ extern void *_end;
 
 void _start(void);
 void __start(void);
-void __startC(void);
+void __startC(unsigned r0, unsigned r1, unsigned r2, unsigned r3);
 
 extern unsigned int cpu_ident(void);
 extern void armv6_idcache_wbinv_all(void);
@@ -124,6 +125,10 @@ static int  arm_dcache_l2_nsets;
 static int  arm_dcache_l2_assoc;
 static int  arm_dcache_l2_linesize;
 
+/*
+ * Boot parameters
+ */
+static struct arm_boot_params s_boot_params;
 
 extern int arm9_dcache_sets_inc;
 extern int arm9_dcache_sets_max;
@@ -172,12 +177,17 @@ bzero(void *addr, int count)
 static void arm9_setup(void);
 
 void
-_startC(void)
+_startC(unsigned r0, unsigned r1, unsigned r2, unsigned r3)
 {
int tmp1;
unsigned int sp = ((unsigned int)&_end & ~3) + 4;
unsigned int pc, kernphysaddr;
 
+   s_boot_params.abp_r0 = r0;
+   s_boot_params.abp_r1 = r1;
+   s_boot_params.abp_r2 = r2;
+   s_boot_params.abp_r3 = r3;
+
/*
 * Figure out the physical address the kernel was loaded at.  This
 * assumes the entry point (this code right here) is in the first page,
@@ -211,8 +221,15 @@ _startC(void)
/* Temporary set the sp and jump to the new location. */
__asm __volatile(
"mov sp, %1\n"
+   "mov r0, %2\n"
+   "mov r1, %3\n"
+   "mov r2, %4\n"
+   "mov r3, %5\n"
"mov pc, %0\n"
-   : : "r" (target_addr), "r" (tmp_sp));
+   : : "r" (target_addr), "r" (tmp_sp),
+   "r" (s_boot_params.abp_r0), "r" (s_boot_params.abp_r1),
+   "r" (s_boot_params.abp_r2), "r" (s_boot_params.abp_r3),
+   : "r0", "r1", "r2", "r3");
 
}
 #endif
@@ -487,6 +504,7 @@ load_kernel(unsigned int kstart, unsigne
vm_offset_t lastaddr = 0;
Elf_Addr ssym = 0;
Elf_Dyn *dp;
+   struct arm_boot_params local_boot_params;
 
eh = (Elf32_Ehdr *)kstart;
ssym = 0;
@@ -555,6 +573,12 @@ load_kernel(unsigned int kstart, unsigne
if (!d)
return ((void *)lastaddr);
 
+   /*
+* Now the stack is fixed, copy boot params
+* before it's overrided
+*/
+   memcpy(_boot_params, _boot_params, sizeof(local_boot_params));
+
j = eh->e_phnum;
for (i = 0; i < j; i++) {
volatile char c;
@@ -604,7 +628,10 @@ load_kernel(unsigned int kstart, unsigne
"mcr p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/
: "=r" (ssym));
/* Jump to the entry point. */
-   ((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))();
+   ((void(*)(unsigned, unsigned, unsigned, unsigned))
+   (entry_point - KERNVIRTADDR + curaddr))
+   (local_boot_params.abp_r0, local_boot_params.abp_r1,
+   local_boot_params.abp_r2, local_boot_params.abp_r3);
__asm __volatile(".globl func_end\n"
"func_end:");
 
___
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"

svn commit: r304464 - in head/sys/arm/allwinner: . a10

2016-08-19 Thread Emmanuel Vadot
Author: manu
Date: Fri Aug 19 12:48:32 2016
New Revision: 304464
URL: https://svnweb.freebsd.org/changeset/base/304464

Log:
  Allwinner: Move a10_padconf.c into a10 subdirectory.

Added:
  head/sys/arm/allwinner/a10/a10_padconf.c
 - copied unchanged from r304463, head/sys/arm/allwinner/a10_padconf.c
Deleted:
  head/sys/arm/allwinner/a10_padconf.c
Modified:
  head/sys/arm/allwinner/a10/files.a10

Copied: head/sys/arm/allwinner/a10/a10_padconf.c (from r304463, 
head/sys/arm/allwinner/a10_padconf.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a10/a10_padconf.cFri Aug 19 12:48:32 2016
(r304464, copy of r304463, head/sys/arm/allwinner/a10_padconf.c)
@@ -0,0 +1,231 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@bidouilliste.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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 
+
+#ifdef SOC_ALLWINNER_A10
+
+const static struct allwinner_pins a10_pins[] = {
+   {"PA0",  0, 0,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", NULL, 
NULL, NULL}},
+   {"PA1",  0, 1,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", NULL, 
NULL, NULL}},
+   {"PA2",  0, 2,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", NULL, 
NULL, NULL}},
+   {"PA3",  0, 3,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", NULL, 
NULL, NULL}},
+   {"PA4",  0, 4,  {"gpio_in", "gpio_out", "emac", "spi1", NULL, NULL, 
NULL, NULL}},
+   {"PA5",  0, 5,  {"gpio_in", "gpio_out", "emac", "spi3", NULL, NULL, 
NULL, NULL}},
+   {"PA6",  0, 6,  {"gpio_in", "gpio_out", "emac", "spi3", NULL, NULL, 
NULL, NULL}},
+   {"PA7",  0, 7,  {"gpio_in", "gpio_out", "emac", "spi3", NULL, NULL, 
NULL, NULL}},
+   {"PA8",  0, 8,  {"gpio_in", "gpio_out", "emac", "spi3", NULL, NULL, 
NULL, NULL}},
+   {"PA9",  0, 9,  {"gpio_in", "gpio_out", "emac", "spi3", NULL, NULL, 
NULL, NULL}},
+   {"PA10", 0, 10, {"gpio_in", "gpio_out", "emac", NULL, "uart1", NULL, 
NULL, NULL}},
+   {"PA11", 0, 11, {"gpio_in", "gpio_out", "emac", NULL, "uart1", NULL, 
NULL, NULL}},
+   {"PA12", 0, 12, {"gpio_in", "gpio_out", "emac", "uart6", "uart1", NULL, 
NULL, NULL}},
+   {"PA13", 0, 13, {"gpio_in", "gpio_out", "emac", "uart6", "uart1", NULL, 
NULL, NULL}},
+   {"PA14", 0, 14, {"gpio_in", "gpio_out", "emac", "uart7", "uart1", NULL, 
NULL, NULL}},
+   {"PA15", 0, 15, {"gpio_in", "gpio_out", "emac", "uart7", "uart1", NULL, 
NULL, NULL}},
+   {"PA16", 0, 16, {"gpio_in", "gpio_out", NULL, "can", "uart1", NULL, 
NULL, NULL}},
+   {"PA17", 0, 17, {"gpio_in", "gpio_out

svn commit: r304509 - head/sys/arm/allwinner

2016-08-19 Thread Emmanuel Vadot
Author: manu
Date: Fri Aug 19 23:44:07 2016
New Revision: 304509
URL: https://svnweb.freebsd.org/changeset/base/304509

Log:
  if_emac: Before generating a random MAC address, try using the SID rootkey
  to generate one. This is was U-Boot does to generate a random MAC so we end
  up with the same MAC address as if U-Boot did generate it.
  
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/if_emac.c

Modified: head/sys/arm/allwinner/if_emac.c
==
--- head/sys/arm/allwinner/if_emac.cFri Aug 19 23:39:08 2016
(r304508)
+++ head/sys/arm/allwinner/if_emac.cFri Aug 19 23:44:07 2016
(r304509)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -167,12 +168,17 @@ static void
 emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr)
 {
uint32_t val0, val1, rnd;
+   u_char rootkey[16];
 
/*
 * Try to get MAC address from running hardware.
 * If there is something non-zero there just use it.
 *
 * Otherwise set the address to a convenient locally assigned address,
+* using the SID rootkey.
+* This is was uboot does so we end up with the same mac as if uboot
+* did set it.
+* If we can't get the root key, generate a random one,
 * 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally
 * assigned bit set, and the broadcast/multicast bit clear.
 */
@@ -186,13 +192,23 @@ emac_get_hwaddr(struct emac_softc *sc, u
hwaddr[4] = (val0 >> 8) & 0xff;
hwaddr[5] = (val0 >> 0) & 0xff;
} else {
-   rnd = arc4random() & 0x00ff;
-   hwaddr[0] = 'b';
-   hwaddr[1] = 's';
-   hwaddr[2] = 'd';
-   hwaddr[3] = (rnd >> 16) & 0xff;
-   hwaddr[4] = (rnd >> 8) & 0xff;
-   hwaddr[5] = (rnd >> 0) & 0xff;
+   if (aw_sid_get_rootkey(rootkey) == 0) {
+   hwaddr[0] = 0x2;
+   hwaddr[1] = rootkey[3];
+   hwaddr[2] = rootkey[12];
+   hwaddr[3] = rootkey[13];
+   hwaddr[4] = rootkey[14];
+   hwaddr[5] = rootkey[15];
+   }
+   else {
+   rnd = arc4random() & 0x00ff;
+   hwaddr[0] = 'b';
+   hwaddr[1] = 's';
+   hwaddr[2] = 'd';
+   hwaddr[3] = (rnd >> 16) & 0xff;
+   hwaddr[4] = (rnd >> 8) & 0xff;
+   hwaddr[5] = (rnd >> 0) & 0xff;
+   }
}
if (bootverbose)
printf("MAC address: %s\n", ether_sprintf(hwaddr));
___
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"


svn commit: r304562 - stable/11/sys/arm/allwinner

2016-08-21 Thread Emmanuel Vadot
Author: manu
Date: Sun Aug 21 15:45:12 2016
New Revision: 304562
URL: https://svnweb.freebsd.org/changeset/base/304562

Log:
  MFC r304077:
  
  Correct the size of the softc in a10_ehci
  
  Reported by:  andrew

Modified:
  stable/11/sys/arm/allwinner/a10_ehci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_ehci.c
==
--- stable/11/sys/arm/allwinner/a10_ehci.c  Sun Aug 21 15:41:19 2016
(r304561)
+++ stable/11/sys/arm/allwinner/a10_ehci.c  Sun Aug 21 15:45:12 2016
(r304562)
@@ -360,7 +360,7 @@ static device_method_t ehci_methods[] = 
 static driver_t ehci_driver = {
.name = "ehci",
.methods = ehci_methods,
-   .size = sizeof(ehci_softc_t),
+   .size = sizeof(struct aw_ehci_softc),
 };
 
 static devclass_t ehci_devclass;
___
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"


svn commit: r304566 - head/sys/arm/allwinner

2016-08-21 Thread Emmanuel Vadot
Author: manu
Date: Sun Aug 21 16:03:44 2016
New Revision: 304566
URL: https://svnweb.freebsd.org/changeset/base/304566

Log:
  allwinner: Remove a20/a20_cpu_cfg.c from the build.
  This was needed when we used the SoC specific timer and not the generic-timer.

Modified:
  head/sys/arm/allwinner/files.allwinner

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Sun Aug 21 16:02:25 2016
(r304565)
+++ head/sys/arm/allwinner/files.allwinner  Sun Aug 21 16:03:44 2016
(r304566)
@@ -15,7 +15,6 @@ arm/allwinner/aw_if_dwc.c optionaldwc
 arm/allwinner/aw_rsb.c optionalrsb
 arm/allwinner/aw_rtc.c standard
 arm/allwinner/aw_wdog.cstandard
-arm/allwinner/a20/a20_cpu_cfg.cstandard
 arm/allwinner/aw_machdep.c standard
 arm/allwinner/aw_mp.c  optionalsmp
 arm/allwinner/axp209.c optionalaxp209
___
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"


svn commit: r304318 - in head/sys/arm/allwinner: . clk

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 21:44:02 2016
New Revision: 304318
URL: https://svnweb.freebsd.org/changeset/base/304318

Log:
  Rename allwinner_machdep.{c.h} to aw_machdep.{c.h}  as all allwinner source
  files are name aw_*

Added:
  head/sys/arm/allwinner/aw_machdep.c
 - copied, changed from r304317, head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/allwinner/aw_machdep.h
 - copied, changed from r304317, head/sys/arm/allwinner/allwinner_machdep.h
Deleted:
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/allwinner/allwinner_machdep.h
Modified:
  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/aw_if_dwc.c
  head/sys/arm/allwinner/aw_mp.c
  head/sys/arm/allwinner/aw_rtc.c
  head/sys/arm/allwinner/clk/aw_pll.c
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/allwinner/timer.c

Modified: head/sys/arm/allwinner/a10_ehci.c
==
--- head/sys/arm/allwinner/a10_ehci.c   Wed Aug 17 21:29:57 2016
(r304317)
+++ head/sys/arm/allwinner/a10_ehci.c   Wed Aug 17 21:44:02 2016
(r304318)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Wed Aug 17 21:29:57 2016
(r304317)
+++ head/sys/arm/allwinner/a10_gpio.c   Wed Aug 17 21:44:02 2016
(r304318)
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/allwinner/a10_mmc.c
==
--- head/sys/arm/allwinner/a10_mmc.cWed Aug 17 21:29:57 2016
(r304317)
+++ head/sys/arm/allwinner/a10_mmc.cWed Aug 17 21:44:02 2016
(r304318)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/allwinner/aw_if_dwc.c
==
--- head/sys/arm/allwinner/aw_if_dwc.c  Wed Aug 17 21:29:57 2016
(r304317)
+++ head/sys/arm/allwinner/aw_if_dwc.c  Wed Aug 17 21:44:02 2016
(r304318)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 

Copied and modified: head/sys/arm/allwinner/aw_machdep.c (from r304317, 
head/sys/arm/allwinner/allwinner_machdep.c)
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Wed Aug 17 21:29:57 2016
(r304317, copy source)
+++ head/sys/arm/allwinner/aw_machdep.c Wed Aug 17 21:44:02 2016
(r304318)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2012 Ganbold Tsagaankhuu <ganb...@freebsd.org>
- * Copyright (c) 2015-2016 Emmanuel Vadot <m...@bidouilliste.com>
+ * Copyright (c) 2015-2016 Emmanuel Vadot <m...@freebsd.org>
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
@@ -26,6 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
+
  * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
  */
 
@@ -52,7 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
+#include 
 
 #include "platform_if.h"
 

Copied and modified: head/sys/arm/allwinner/aw_machdep.h (from r304317, 
head/sys/arm/allwinner/allwinner_machdep.h)
==
--- head/sys/arm/allwinner/allwinner_machdep.h  Wed Aug 17 21:29:57 2016
(r304317, copy source)
+++ head/sys/arm/allwinner/aw_machdep.h Wed Aug 17 21:44:02 2016
(r304318)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Emmanuel Vadot <m...@bidouilliste.com>
+ * Copyright (c) 2015 Emmanuel Vadot <m...@freebsd.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/arm/allwinner/aw_mp.c
==
--- head/sys/arm/allwinner/aw_mp.c  Wed Aug 17 21:29:57 2016
(r304317)
+++ head/sys/arm/allwinner/aw_mp.c  Wed Aug 17 21:44:02 2016
(r304318)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
+#include 
 
 /* Register for all dual-core SoC */
 #defineA20_CPUCFG_BASE 0x01c25c00

Modified: head/sys/arm/allwinner/aw_rtc.c
==
--- head/sys/arm/allwinner/aw_rtc.c Wed Aug 17 21:29:57 2016
(r304317)
+++ head/sys/arm/allwinner/aw_rtc.c Wed Aug 17 21:44:

svn commit: r314333 - head/sys/arm/allwinner/clkng

2017-02-27 Thread Emmanuel Vadot
Author: manu
Date: Mon Feb 27 11:10:36 2017
New Revision: 314333
URL: https://svnweb.freebsd.org/changeset/base/314333

Log:
  allwinner: Order clocks by offset rather than by type for H3 ccu.
  
  Also add a few more supported gates and add comments for which clocks
  are missing.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk.h
  head/sys/arm/allwinner/clkng/ccu_h3.c
  head/sys/arm/allwinner/clkng/ccu_h3.h

Modified: head/sys/arm/allwinner/clkng/aw_clk.h
==
--- head/sys/arm/allwinner/clkng/aw_clk.h   Mon Feb 27 10:40:39 2017
(r314332)
+++ head/sys/arm/allwinner/clkng/aw_clk.h   Mon Feb 27 11:10:36 2017
(r314333)
@@ -179,7 +179,7 @@ aw_clk_factor_get_value(struct aw_clk_fa
.shift = s, \
},
 
-#define NKMP_CLK(_id, _name, _pnames,  \
+#define NKMP_CLK(_clkname, _id, _name, _pnames,\
   _offset, \
   _n_shift, _n_width, _n_value, _n_flags,  \
   _k_shift, _k_width, _k_value, _k_flags,  \
@@ -188,7 +188,7 @@ aw_clk_factor_get_value(struct aw_clk_fa
   _gate,   \
   _lock, _lock_retries,\
   _flags)  \
-   {   \
+   static struct aw_clk_nkmp_def _clkname = {  \
.clkdef = { \
.id = _id,  \
.name = _name,  \
@@ -216,16 +216,16 @@ aw_clk_factor_get_value(struct aw_clk_fa
.lock_shift = _lock,\
.lock_retries = _lock_retries,  \
.flags = _flags,\
-   },
+   }
 
-#define NM_CLK(_id, _name, _pnames,\
+#define NM_CLK(_clkname, _id, _name, _pnames,  \
  _offset,  \
  _nshift, _nwidth, _nvalue, _nflags,   \
  _mshift, _mwidth, _mvalue, _mflags,   \
 _mux_shift, _mux_width,\
 _gate_shift,   \
 _flags)\
-   {   \
+   static struct aw_clk_nm_def _clkname =  {   \
.clkdef = { \
.id = _id,  \
.name = _name,  \
@@ -244,15 +244,15 @@ aw_clk_factor_get_value(struct aw_clk_fa
.m.flags = _mflags, \
.mux_width = _mux_width,\
.flags = _flags,\
-   },
+   }
 
-#define NM_CLK_WITH_FRAC(_id, _name, _pnames,  \
+#define NM_CLK_WITH_FRAC(_clkname, _id, _name, _pnames,\
  _offset,  \
  _nshift, _nwidth, _nvalue, _nflags,   \
  _mshift, _mwidth, _mvalue, _mflags,   \
  _gate_shift, _lock_shift,_lock_retries,   \
 _flags, _freq0, _freq1, _mode_sel, _freq_sel)  \
-   {   \
+   static struct aw_clk_nm_def _clkname =  {   \
.clkdef = { \
.id = _id,  \
.name = _name,  \
@@ -276,15 +276,15 @@ aw_clk_factor_get_value(struct aw_clk_fa
.frac.freq1 = _freq1,   \
.frac.mode_sel = _mode_sel, \
.frac.freq_sel = _freq_sel, \
-   },
+   }
 
-#define PREDIV_CLK(_id, _name, _pnames,\
+#define PREDIV_CLK(_clkname, _id, _name, _pnames,  \
   _offset, \
   _mux_shift, _mux_width,  \
   _div_shift, _div_width, _div_value, _div_flags,  \
   _prediv_shift, _prediv_width, _prediv_value, _prediv_flags,  \
   _prediv_cond_shift, _prediv_cond_width, _prediv_cond_value)  \
-   {   \
+   static struct aw_clk_prediv_mux_def _clkname = {\
.clkdef = { \
.id = _id,  \
.name = _name,  \
@@ -305,11 +305,11 @@ aw_clk_factor_get_value(struct aw_clk_fa
.prediv.cond_shift = _prediv_cond_shift,\
.prediv.cond_width = _prediv_cond_width,\
.prediv.cond_value = _prediv_cond_value,\
-   },
+   }
 
-#define MUX_CLK(_id, _name, _pnames,   \
+#define MUX_CLK(_clkname, _id, _name, _pnames, 

svn commit: r314303 - in head/sys/arm/allwinner: . clkng h3

2017-02-26 Thread Emmanuel Vadot
Author: manu
Date: Sun Feb 26 16:00:20 2017
New Revision: 314303
URL: https://svnweb.freebsd.org/changeset/base/314303

Log:
  Add clkng driver for Allwinner SoC
  
  Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu 
node.
  Currently only H3 is supported with almost the same state as HEAD.
  (video pll aren't supported for now but we don't support video).
  This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc 
...)
  
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D9517

Added:
  head/sys/arm/allwinner/clkng/
  head/sys/arm/allwinner/clkng/aw_ccung.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_ccung.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nm.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_nm.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.h   (contents, props changed)
  head/sys/arm/allwinner/clkng/ccu_h3.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/ccu_h3.h   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/allwinner/h3/files.h3

Added: head/sys/arm/allwinner/clkng/aw_ccung.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/clkng/aw_ccung.c Sun Feb 26 16:00:20 2017
(r314303)
@@ -0,0 +1,348 @@
+/*-
+ * Copyright (c) 2017 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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$
+ */
+
+/*
+ * Allwinner Clock Control Unit
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#if defined(SOC_ALLWINNER_H3)
+#include 
+#endif
+
+#include "clkdev_if.h"
+#include "hwreset_if.h"
+
+static struct resource_spec aw_ccung_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+#if defined(SOC_ALLWINNER_H3)
+#defineH3_CCU  1
+#endif
+
+static struct ofw_compat_data compat_data[] = {
+#if defined(SOC_ALLWINNER_H3)
+   { "allwinner,sun8i-h3-ccu", H3_CCU },
+#endif
+   {NULL, 0 }
+};
+
+#defineCCU_READ4(sc, reg)  bus_read_4((sc)->res, (reg))
+#defineCCU_WRITE4(sc, reg, val)bus_write_4((sc)->res, (reg), 
(val))
+
+static int
+aw_ccung_write_4(device_t dev, bus_addr_t addr, uint32_t val)
+{
+   struct aw_ccung_softc *sc;
+
+   sc = device_get_softc(dev);
+   CCU_WRITE4(sc, addr, val);
+   return (0);
+}
+
+static int
+aw_ccung_read_4(device_t dev, bus_addr_t addr, uint32_t *val)
+{
+   struct aw_ccung_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   *val = CCU_READ4(sc, addr);
+   return (0);
+}
+
+static int
+aw_ccung_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set)
+{
+   struct aw_ccung_softc *sc;
+   uint32_t reg;
+
+   sc = device_get_softc(dev);
+
+   reg = CCU_READ4(sc, addr);
+   reg &= ~clr;
+   reg |= set;
+   CCU_WRITE4(sc, addr, reg);
+
+   return (0);
+}
+
+static int
+aw_ccung_reset_assert(device_t dev, intptr_t id, bool reset)
+{
+   struct aw_ccung_softc *sc;
+   uint32_t val;
+
+ 

Re: svn commit: r314212 - head/sys/dev/uart

2017-02-26 Thread Emmanuel Vadot

 Hello,

 This break uart in ARM.
 Based on the comment of the macros since we're using our own device
the ealier code was correct.

 Cheers,

On Fri, 24 Feb 2017 16:37:35 + (UTC)
Ruslan Bukin <b...@freebsd.org> wrote:

> Author: br
> Date: Fri Feb 24 16:37:35 2017
> New Revision: 314212
> URL: https://svnweb.freebsd.org/changeset/base/314212
> 
> Log:
>   Use correct macro for Synopsys UART driver declaration.
> 
> Modified:
>   head/sys/dev/uart/uart_dev_snps.c
> 
> Modified: head/sys/dev/uart/uart_dev_snps.c
> ==
> --- head/sys/dev/uart/uart_dev_snps.c Fri Feb 24 16:11:55 2017
> (r314211)
> +++ head/sys/dev/uart/uart_dev_snps.c Fri Feb 24 16:37:35 2017
> (r314212)
> @@ -104,7 +104,7 @@ static struct ofw_compat_data compat_dat
>   { "snps,dw-apb-uart",   (uintptr_t)_snps_class },
>   { NULL, (uintptr_t)NULL }
>  };
> -UART_FDT_CLASS(compat_data);
> +UART_FDT_CLASS_AND_DEVICE(compat_data);
>  
>  #ifdef EXT_RESOURCES
>  static int


-- 
Emmanuel Vadot <m...@bidouilliste.com> <m...@freebsd.org>
___
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"


svn commit: r314394 - in head/sys/arm/allwinner: a31 clkng

2017-02-28 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb 28 15:44:21 2017
New Revision: 314394
URL: https://svnweb.freebsd.org/changeset/base/314394

Log:
  allwinner: A31: Add ccung driver
  
  This adds clocks support for the aw_ccung on the A31 SoC.
  Newer DTS files require this.
  All the clocks except two CSI are defined and exported on the clock domain.

Added:
  head/sys/arm/allwinner/clkng/ccu_a31.c   (contents, props changed)
  head/sys/arm/allwinner/clkng/ccu_a31.h   (contents, props changed)
Modified:
  head/sys/arm/allwinner/a31/files.a31
  head/sys/arm/allwinner/clkng/aw_ccung.c

Modified: head/sys/arm/allwinner/a31/files.a31
==
--- head/sys/arm/allwinner/a31/files.a31Tue Feb 28 15:11:33 2017
(r314393)
+++ head/sys/arm/allwinner/a31/files.a31Tue Feb 28 15:44:21 2017
(r314394)
@@ -1,5 +1,6 @@
 # $FreeBSD$
 
+arm/allwinner/clkng/ccu_a31.c  standard
 arm/allwinner/a31/a31_padconf.cstandard
 arm/allwinner/a31/a31_r_padconf.c  standard
 arm/allwinner/a31/a31s_padconf.c   standard

Modified: head/sys/arm/allwinner/clkng/aw_ccung.c
==
--- head/sys/arm/allwinner/clkng/aw_ccung.c Tue Feb 28 15:11:33 2017
(r314393)
+++ head/sys/arm/allwinner/clkng/aw_ccung.c Tue Feb 28 15:44:21 2017
(r314394)
@@ -54,6 +54,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(SOC_ALLWINNER_A31)
+#include 
+#endif
+
 #if defined(SOC_ALLWINNER_H3)
 #include 
 #endif
@@ -70,10 +74,17 @@ static struct resource_spec aw_ccung_spe
 #defineH3_CCU  1
 #endif
 
+#if defined(SOC_ALLWINNER_A31)
+#defineA31_CCU 2
+#endif
+
 static struct ofw_compat_data compat_data[] = {
 #if defined(SOC_ALLWINNER_H3)
{ "allwinner,sun8i-h3-ccu", H3_CCU },
 #endif
+#if defined(SOC_ALLWINNER_A31)
+   { "allwinner,sun6i-a31-ccu", A31_CCU },
+#endif
{NULL, 0 }
 };
 
@@ -295,6 +306,11 @@ aw_ccung_attach(device_t dev)
ccu_h3_register_clocks(sc);
break;
 #endif
+#if defined(SOC_ALLWINNER_A31)
+   case A31_CCU:
+   ccu_a31_register_clocks(sc);
+   break;
+#endif
}
 
if (sc->gates)

Added: head/sys/arm/allwinner/clkng/ccu_a31.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/clkng/ccu_a31.c  Tue Feb 28 15:44:21 2017
(r314394)
@@ -0,0 +1,936 @@
+/*-
+ * Copyright (c) 2017 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 
+#include 
+#include 
+#include 
+
+#include "ccu_a31.h"
+
+static struct aw_ccung_reset a31_ccu_resets[] = {
+   CCU_RESET(A31_RST_USB_PHY0, 0xcc, 0)
+   CCU_RESET(A31_RST_USB_PHY1, 0xcc, 1)
+   CCU_RESET(A31_RST_USB_PHY2, 0xcc, 2)
+
+   CCU_RESET(A31_RST_AHB1_MIPI_DSI, 0x2c0, 1)
+   CCU_RESET(A31_RST_AHB1_SS, 0x2c0, 5)
+   CCU_RESET(A31_RST_AHB1_DMA, 0x2c0, 6)
+   CCU_RESET(A31_RST_AHB1_MMC0, 0x2c0, 8)
+   CCU_RESET(A31_RST_AHB1_MMC1, 0x2c0, 9)
+   CCU_RESET(A31_RST_AHB1_MMC2, 0x2c0, 10)
+   CCU_RESET(A31_RST_AHB1_MMC3, 0x2c0, 11)
+   CCU_RESET(A31_RST_AHB1_NAND1, 0x2c0, 12)
+   CCU_RESET(A31_RST_AHB1_NAND0, 0x2c0, 13)
+   CCU_RESET(A31_RST_AHB1_SDRAM, 0x2c0, 14)
+   CCU_RESET(A31_RST_AHB1_EMAC, 0x2c0, 17)
+   CCU_RESET(A31_RST_AHB1_TS, 0

svn commit: r314393 - head/sys/arm/allwinner/clkng

2017-02-28 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb 28 15:11:33 2017
New Revision: 314393
URL: https://svnweb.freebsd.org/changeset/base/314393

Log:
  allwinner: nkmp: Add MUX capability
  
  Some NKMP clocks have a mux options.
  Add the capability to aw_clk_nkmp.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk.h
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.c
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.h

Modified: head/sys/arm/allwinner/clkng/aw_clk.h
==
--- head/sys/arm/allwinner/clkng/aw_clk.h   Tue Feb 28 15:03:34 2017
(r314392)
+++ head/sys/arm/allwinner/clkng/aw_clk.h   Tue Feb 28 15:11:33 2017
(r314393)
@@ -219,6 +219,48 @@ aw_clk_factor_get_value(struct aw_clk_fa
.flags = _flags,\
}
 
+#define NKMP_CLK_WITH_MUX(_clkname,\
+  _id, _name, _pnames, \
+  _offset, \
+  _n_shift, _n_width, _n_value, _n_flags,  \
+  _k_shift, _k_width, _k_value, _k_flags,  \
+  _m_shift, _m_width, _m_value, _m_flags,  \
+  _p_shift, _p_width, _p_value, _p_flags,  \
+  _mux_shift, _mux_width, _gate,   \
+  _lock, _lock_retries,\
+  _flags)  \
+   static struct aw_clk_nkmp_def _clkname = {  \
+   .clkdef = { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_names = _pnames,\
+   .parent_cnt = nitems(_pnames),  \
+   },  \
+   .offset = _offset,  \
+   .n.shift = _n_shift,\
+   .n.width = _n_width,\
+   .n.value = _n_value,\
+   .n.flags = _n_flags,\
+   .k.shift = _k_shift,\
+   .k.width = _k_width,\
+   .k.value = _k_value,\
+   .k.flags = _k_flags,\
+   .m.shift = _m_shift,\
+   .m.width = _m_width,\
+   .m.value = _m_value,\
+   .m.flags = _m_flags,\
+   .p.shift = _p_shift,\
+   .p.width = _p_width,\
+   .p.value = _p_value,\
+   .p.flags = _p_flags,\
+   .mux_shift = _mux_shift,\
+   .mux_width = _mux_width,\
+   .gate_shift = _gate,\
+   .lock_shift = _lock,\
+   .lock_retries = _lock_retries,  \
+   .flags = _flags,\
+   }
+
 #define NKMP_CLK_WITH_UPDATE(_clkname, \
   _id, _name, _pnames, \
   _offset, \

Modified: head/sys/arm/allwinner/clkng/aw_clk_nkmp.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nkmp.c  Tue Feb 28 15:03:34 2017
(r314392)
+++ head/sys/arm/allwinner/clkng/aw_clk_nkmp.c  Tue Feb 28 15:11:33 2017
(r314393)
@@ -55,6 +55,8 @@ struct aw_clk_nkmp_sc {
struct aw_clk_factorm;
struct aw_clk_factorp;
 
+   uint32_tmux_shift;
+   uint32_tmux_mask;
uint32_tgate_shift;
uint32_tlock_shift;
uint32_tlock_retries;
@@ -77,7 +79,21 @@ struct aw_clk_nkmp_sc {
 static int
 aw_clk_nkmp_init(struct clknode *clk, device_t dev)
 {
-   clknode_init_parent_idx(clk, 0);
+   struct aw_clk_nkmp_sc *sc;
+   uint32_t val, idx;
+
+   sc = clknode_get_softc(clk);
+
+   idx = 0;
+   if ((sc->flags & AW_CLK_HAS_MUX) != 0) {
+   DEVICE_LOCK(clk);
+   READ4(clk, sc->offset, );
+   DEVICE_UNLOCK(clk);
+
+   idx = (val & sc->mux_mask) >> sc->mux_shift;
+   }
+
+   clknode_init_parent_idx(clk, idx);
return (0);
 }
 
@@ -104,6 +120,27 @@ aw_clk_nkmp_set_gate(struct clknode *clk
return (0);
 }
 
+static int
+aw_clk_nkmp_set_mux(struct clknode *clk, int index)
+{
+   struct aw_clk_nkmp_sc *sc;
+   uint32_t val;
+
+   sc = clknode_get_softc(clk);
+
+   if ((sc->flags & AW_CLK_HAS_MUX) != 0)
+   return (0);
+
+   DEVICE_LOCK(clk);
+   READ4(clk, sc->offset, );
+   val &= ~(sc->mux_mask >> sc->mux_shift);
+   val |= index << 

svn commit: r314383 - head/sys/arm/allwinner/clkng

2017-02-28 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb 28 11:05:45 2017
New Revision: 314383
URL: https://svnweb.freebsd.org/changeset/base/314383

Log:
  allwinner: NM clock: Add value for fixed factor.
  
  The register func for aw_clk_nm didn't copy the value needed for the fixed
  factor, resulting in all fixed factor not working on NM clocks.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nm.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nm.cTue Feb 28 09:50:34 2017
(r314382)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.cTue Feb 28 11:05:45 2017
(r314383)
@@ -331,11 +331,13 @@ aw_clk_nm_register(struct clkdom *clkdom
sc->m.shift = clkdef->m.shift;
sc->m.width = clkdef->m.width;
sc->m.mask = ((1 << sc->m.width) - 1) << sc->m.shift;
+   sc->m.value = clkdef->m.value;
sc->m.flags = clkdef->m.flags;
 
sc->n.shift = clkdef->n.shift;
sc->n.width = clkdef->n.width;
sc->n.mask = ((1 << sc->n.width) - 1) << sc->n.shift;
+   sc->n.value = clkdef->n.value;
sc->n.flags = clkdef->n.flags;
 
sc->frac.freq0 = clkdef->frac.freq0;
___
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"


svn commit: r314384 - head/sys/arm/allwinner/clkng

2017-02-28 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb 28 11:38:11 2017
New Revision: 314384
URL: https://svnweb.freebsd.org/changeset/base/314384

Log:
  allwinner: NKMP clock: add update bit
  
  The PLL_DDR clock have an update bit which need to be set after changing
  the value, add the possibility to define one for NKMP clocks.
  
  This allow us to add the missing clocks.
  We now have the full list of clocks created under the clock domain.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk.h
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.c
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.h
  head/sys/arm/allwinner/clkng/ccu_h3.c
  head/sys/arm/allwinner/clkng/ccu_h3.h

Modified: head/sys/arm/allwinner/clkng/aw_clk.h
==
--- head/sys/arm/allwinner/clkng/aw_clk.h   Tue Feb 28 11:05:45 2017
(r314383)
+++ head/sys/arm/allwinner/clkng/aw_clk.h   Tue Feb 28 11:38:11 2017
(r314384)
@@ -64,6 +64,7 @@ struct aw_clk_init {
 #defineAW_CLK_REPARENT 0x0008
 #defineAW_CLK_SCALE_CHANGE 0x0010
 #defineAW_CLK_HAS_FRAC 0x0020
+#defineAW_CLK_HAS_UPDATE   0x0040
 
 #defineAW_CLK_FACTOR_POWER_OF_TWO  0x0001
 #defineAW_CLK_FACTOR_ZERO_BASED0x0002
@@ -218,6 +219,48 @@ aw_clk_factor_get_value(struct aw_clk_fa
.flags = _flags,\
}
 
+#define NKMP_CLK_WITH_UPDATE(_clkname, \
+  _id, _name, _pnames, \
+  _offset, \
+  _n_shift, _n_width, _n_value, _n_flags,  \
+  _k_shift, _k_width, _k_value, _k_flags,  \
+  _m_shift, _m_width, _m_value, _m_flags,  \
+  _p_shift, _p_width, _p_value, _p_flags,  \
+  _gate,   \
+  _lock, _lock_retries,\
+  _update, \
+  _flags)  \
+   static struct aw_clk_nkmp_def _clkname = {  \
+   .clkdef = { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_names = _pnames,\
+   .parent_cnt = nitems(_pnames),  \
+   },  \
+   .offset = _offset,  \
+   .n.shift = _n_shift,\
+   .n.width = _n_width,\
+   .n.value = _n_value,\
+   .n.flags = _n_flags,\
+   .k.shift = _k_shift,\
+   .k.width = _k_width,\
+   .k.value = _k_value,\
+   .k.flags = _k_flags,\
+   .m.shift = _m_shift,\
+   .m.width = _m_width,\
+   .m.value = _m_value,\
+   .m.flags = _m_flags,\
+   .p.shift = _p_shift,\
+   .p.width = _p_width,\
+   .p.value = _p_value,\
+   .p.flags = _p_flags,\
+   .gate_shift = _gate,\
+   .lock_shift = _lock,\
+   .lock_retries = _lock_retries,  \
+   .update_shift = _update,\
+   .flags = _flags | AW_CLK_HAS_UPDATE,\
+   }
+
 #define NM_CLK(_clkname, _id, _name, _pnames,  \
  _offset,  \
  _nshift, _nwidth, _nvalue, _nflags,   \

Modified: head/sys/arm/allwinner/clkng/aw_clk_nkmp.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nkmp.c  Tue Feb 28 11:05:45 2017
(r314383)
+++ head/sys/arm/allwinner/clkng/aw_clk_nkmp.c  Tue Feb 28 11:38:11 2017
(r314384)
@@ -58,6 +58,7 @@ struct aw_clk_nkmp_sc {
uint32_tgate_shift;
uint32_tlock_shift;
uint32_tlock_retries;
+   uint32_tupdate_shift;
 
uint32_tflags;
 };
@@ -263,6 +264,14 @@ aw_clk_nkmp_set_freq(struct clknode *clk
WRITE4(clk, sc->offset, val);
DELAY(2000);
 
+   if ((sc->flags & AW_CLK_HAS_UPDATE) != 0) {
+   DEVICE_LOCK(clk);
+   READ4(clk, sc->offset, );
+   val |= 1 << sc->update_shift;
+   WRITE4(clk, sc->offset, val);
+   DELAY(2000);
+   }
+
if ((sc->flags & AW_CLK_HAS_LOCK) != 0) {

svn commit: r314346 - head/sys/arm/allwinner/clkng

2017-02-27 Thread Emmanuel Vadot
Author: manu
Date: Mon Feb 27 17:12:17 2017
New Revision: 314346
URL: https://svnweb.freebsd.org/changeset/base/314346

Log:
  allwinner: Correct some clocks name for H3 CCU.

Modified:
  head/sys/arm/allwinner/clkng/ccu_h3.c

Modified: head/sys/arm/allwinner/clkng/ccu_h3.c
==
--- head/sys/arm/allwinner/clkng/ccu_h3.c   Mon Feb 27 17:04:35 2017
(r314345)
+++ head/sys/arm/allwinner/clkng/ccu_h3.c   Mon Feb 27 17:12:17 2017
(r314346)
@@ -147,9 +147,9 @@ static struct aw_ccung_gate h3_ccu_gates
CCU_GATE(H3_CLK_BUS_SPDIF, "bus-spdif", "apb1", 0x68, 1)
CCU_GATE(H3_CLK_BUS_PIO, "bus-pio", "apb1", 0x68, 5)
CCU_GATE(H3_CLK_BUS_THS, "bus-ths", "apb1", 0x68, 8)
-   CCU_GATE(H3_CLK_BUS_I2S0, "bus-i2c0", "apb1", 0x68, 12)
-   CCU_GATE(H3_CLK_BUS_I2S1, "bus-i2c1", "apb1", 0x68, 13)
-   CCU_GATE(H3_CLK_BUS_I2S2, "bus-i2c2", "apb1", 0x68, 14)
+   CCU_GATE(H3_CLK_BUS_I2S0, "bus-i2s0", "apb1", 0x68, 12)
+   CCU_GATE(H3_CLK_BUS_I2S1, "bus-i2s1", "apb1", 0x68, 13)
+   CCU_GATE(H3_CLK_BUS_I2S2, "bus-i2s2", "apb1", 0x68, 14)
 
CCU_GATE(H3_CLK_BUS_I2C0, "bus-i2c0", "apb2", 0x6c, 0)
CCU_GATE(H3_CLK_BUS_I2C1, "bus-i2c1", "apb2", 0x6c, 1)
___
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"


svn commit: r314329 - head/sys/arm/allwinner/clkng

2017-02-27 Thread Emmanuel Vadot
Author: manu
Date: Mon Feb 27 08:58:27 2017
New Revision: 314329
URL: https://svnweb.freebsd.org/changeset/base/314329

Log:
  allwinner: Add support for lock and fractional mode on NM clock
  
  Some PLL have a fractional mode and a lock bit.
  Add support for it on the NM clock and export the clocks in the clkdom.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk.h
  head/sys/arm/allwinner/clkng/aw_clk_nm.c
  head/sys/arm/allwinner/clkng/aw_clk_nm.h
  head/sys/arm/allwinner/clkng/ccu_h3.c

Modified: head/sys/arm/allwinner/clkng/aw_clk.h
==
--- head/sys/arm/allwinner/clkng/aw_clk.h   Mon Feb 27 08:36:51 2017
(r314328)
+++ head/sys/arm/allwinner/clkng/aw_clk.h   Mon Feb 27 08:58:27 2017
(r314329)
@@ -63,6 +63,7 @@ struct aw_clk_init {
 #defineAW_CLK_HAS_MUX  0x0004
 #defineAW_CLK_REPARENT 0x0008
 #defineAW_CLK_SCALE_CHANGE 0x0010
+#defineAW_CLK_HAS_FRAC 0x0020
 
 #defineAW_CLK_FACTOR_POWER_OF_TWO  0x0001
 #defineAW_CLK_FACTOR_ZERO_BASED0x0002
@@ -83,6 +84,13 @@ struct aw_clk_factor {
uint32_tflags;  /* Flags */
 };
 
+struct aw_clk_frac {
+   uint64_tfreq0;
+   uint64_tfreq1;
+   uint32_tmode_sel;
+   uint32_tfreq_sel;
+};
+
 static inline uint32_t
 aw_clk_get_factor(uint32_t val, struct aw_clk_factor *factor)
 {
@@ -238,6 +246,38 @@ aw_clk_factor_get_value(struct aw_clk_fa
.flags = _flags,\
},
 
+#define NM_CLK_WITH_FRAC(_id, _name, _pnames,  \
+ _offset,  \
+ _nshift, _nwidth, _nvalue, _nflags,   \
+ _mshift, _mwidth, _mvalue, _mflags,   \
+ _gate_shift, _lock_shift,_lock_retries,   \
+_flags, _freq0, _freq1, _mode_sel, _freq_sel)  \
+   {   \
+   .clkdef = { \
+   .id = _id,  \
+   .name = _name,  \
+   .parent_names = _pnames,\
+   .parent_cnt = nitems(_pnames),  \
+   },  \
+   .offset = _offset,  \
+   .n.shift = _nshift, \
+   .n.width = _nwidth, \
+   .n.value = _nvalue, \
+   .n.flags = _nflags, \
+   .m.shift = _mshift, \
+   .m.width = _mwidth, \
+   .m.value = _mvalue, \
+   .m.flags = _mflags, \
+   .gate_shift = _gate_shift,  \
+   .lock_shift = _lock_shift,  \
+   .lock_retries = _lock_retries,  \
+   .flags = _flags | AW_CLK_HAS_FRAC,  \
+   .frac.freq0 = _freq0,   \
+   .frac.freq1 = _freq1,   \
+   .frac.mode_sel = _mode_sel, \
+   .frac.freq_sel = _freq_sel, \
+   },
+
 #define PREDIV_CLK(_id, _name, _pnames,\
   _offset, \
   _mux_shift, _mux_width,  \

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nm.cMon Feb 27 08:36:51 2017
(r314328)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.cMon Feb 27 08:58:27 2017
(r314329)
@@ -52,10 +52,13 @@ struct aw_clk_nm_sc {
 
struct aw_clk_factorm;
struct aw_clk_factorn;
+   struct aw_clk_frac  frac;
 
uint32_tmux_shift;
uint32_tmux_mask;
uint32_tgate_shift;
+   uint32_tlock_shift;
+   uint32_tlock_retries;
 
uint32_tflags;
 };
@@ -178,13 +181,13 @@ aw_clk_nm_set_freq(struct clknode *clk, 
struct aw_clk_nm_sc *sc;
struct clknode *p_clk;
const char **p_names;
-   uint64_t cur, best;
+   uint64_t cur, best, best_frac;
uint32_t val, m, n, best_m, best_n;
-   int p_idx, best_parent;
+   int p_idx, best_parent, retry;
 
sc = clknode_get_softc(clk);
 
-   best = cur = 0;
+   best = best_frac = cur = 0;
best_parent = 0;
 
if ((sc->flags & AW_CLK_REPARENT) != 0) {
@@ -205,8 +208,15 @@ aw_clk_nm_set_freq(struct clknode *clk, 
p_idx = clknode_get_parent_idx(clk);
p_clk = clknode_get_parent(clk);
clknode_get_freq(p_clk, );
-   } else
-   best = aw_clk_nm_find_best(sc, fparent, fout, _n, _m);
+   } else {

svn commit: r304649 - head/sys/arm/allwinner

2016-08-22 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 23 00:46:22 2016
New Revision: 304649
URL: https://svnweb.freebsd.org/changeset/base/304649

Log:
  Do not include file from dt-bindings and simply use the already present 
defines.
  
  Reported by:  jmcneill
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Tue Aug 23 00:00:06 2016
(r304648)
+++ head/sys/arm/allwinner/a10_gpio.c   Tue Aug 23 00:46:22 2016
(r304649)
@@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #if defined(__aarch64__)
 #include "opt_soc.h"
 #endif
@@ -602,8 +600,8 @@ aw_fdt_configure_pins(device_t dev, phan
if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
a10_gpio_set_drv(sc, pin_num, pin_drive);
if (a10_gpio_get_pud(sc, pin_num) != pin_pull &&
-   (pin_pull == SUN4I_PINCTRL_PULL_UP ||
-   pin_pull == SUN4I_PINCTRL_PULL_DOWN))
+   (pin_pull == A10_GPIO_PULLUP ||
+   pin_pull == A10_GPIO_PULLDOWN))
a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
___
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"


Re: svn commit: r305354 - head/sys/arm/allwinner

2016-09-03 Thread Emmanuel Vadot

 I'll add that everybody uses this as a serial number. Since thoses are
efuses, you can't change it unless a specific voltage is applied to a
certain pin (which is tied to GND on every board), but no one have tried
to do that.
There might be some way do restrict reading that key a
there is also some configuration fuses but the documentation doesn't
say much about this peripheral.
 You can check http://linux-sunxi.org/SID for (a little) more
information.

On Sat, 3 Sep 2016 14:06:37 -0300 (ADT)
Jared McNeill <jmcne...@invisible.ca> wrote:

> Hi Oliver --
> 
> It's really just a serial number. The Allwinner A20 datasheet refers to it 
> as a root key, later ones such as A83T refer to it as chip ID. U-Boot 
> uses the same process to generate MAC addresses for all Allwinner boards.
> 
> Cheers,
> Jared
> 
> 
> On Sat, 3 Sep 2016, Oliver Pinter wrote:
> 
> > Hi!
> >
> > On 9/3/16, Jared McNeill <jmcne...@freebsd.org> wrote:
> >> Author: jmcneill
> >> Date: Sat Sep  3 15:28:09 2016
> >> New Revision: 305354
> >> URL: https://svnweb.freebsd.org/changeset/base/305354
> >>
> >> Log:
> >>   Use the root key in the Security ID EFUSE (when valid) to generate a
> >>   MAC address instead of creating a random one each boot.
> >
> > Could you please describe a little more about this root key? What is
> > it? What's the main purpose? Is is a crypto root key?
> >
> >>
> >> Modified:
> >>   head/sys/arm/allwinner/if_awg.c
> >>
> >> Modified: head/sys/arm/allwinner/if_awg.c
> >> ==
> >> --- head/sys/arm/allwinner/if_awg.cSat Sep  3 15:26:28 2016
> >> (r305353)
> >> +++ head/sys/arm/allwinner/if_awg.cSat Sep  3 15:28:09 2016
> >> (r305354)
> >> @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
> >>  #include 
> >>
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>
> >> @@ -1277,6 +1278,7 @@ awg_get_eaddr(device_t dev, uint8_t *ead
> >>  {
> >>struct awg_softc *sc;
> >>uint32_t maclo, machi, rnd;
> >> +  u_char rootkey[16];
> >>
> >>sc = device_get_softc(dev);
> >>
> >> @@ -1285,9 +1287,19 @@ awg_get_eaddr(device_t dev, uint8_t *ead
> >>
> >>if (maclo == 0x && machi == 0x) {
> >>/* MAC address in hardware is invalid, create one */
> >> -  rnd = arc4random();
> >> -  maclo = 0x00f2 | (rnd & 0x);
> >> -  machi = rnd & 0x;
> >> +  if (aw_sid_get_rootkey(rootkey) == 0 &&
> >> +  (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
> >> +   rootkey[15]) != 0) {
> >> +  /* MAC address is derived from the root key in SID */
> >> +  maclo = (rootkey[13] << 24) | (rootkey[12] << 16) |
> >> +  (rootkey[3] << 8) | 0x02;
> >> +  machi = (rootkey[15] << 8) | rootkey[14];
> >> +  } else {
> >> +  /* Create one */
> >> +  rnd = arc4random();
> >> +  maclo = 0x00f2 | (rnd & 0x);
> >> +  machi = rnd & 0x;
> >> +  }
> >>}
> >>
> >>eaddr[0] = maclo & 0xff;
> >> ___
> >> svn-src-h...@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"
> >>
> >
> >


-- 
Emmanuel Vadot
___
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"


svn commit: r305437 - stable/11/sys/arm/allwinner/a20

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:29:04 2016
New Revision: 305437
URL: https://svnweb.freebsd.org/changeset/base/305437

Log:
  MFC r303186
  PC5 doesn't have mmc2 function.

Modified:
  stable/11/sys/arm/allwinner/a20/a20_padconf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a20/a20_padconf.c
==
--- stable/11/sys/arm/allwinner/a20/a20_padconf.c   Mon Sep  5 20:17:18 
2016(r305436)
+++ stable/11/sys/arm/allwinner/a20/a20_padconf.c   Mon Sep  5 20:29:04 
2016(r305437)
@@ -87,7 +87,7 @@ const static struct allwinner_pins a20_p
{"PC2",  2, 2,  {"gpio_in", "gpio_out", "nand0", "spi0", NULL, NULL, 
NULL, NULL}},
{"PC3",  2, 3,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
{"PC4",  2, 4,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
-   {"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
+   {"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
{"PC6",  2, 6,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
{"PC7",  2, 7,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
{"PC8",  2, 8,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
___
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"


svn commit: r305441 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 21:25:45 2016
New Revision: 305441
URL: https://svnweb.freebsd.org/changeset/base/305441

Log:
  MFC r304509
  
  if_emac: Before generating a random MAC address, try using the SID rootkey
  to generate one. This is was U-Boot does to generate a random MAC so we end
  up with the same MAC address as if U-Boot did generate it.

Modified:
  stable/11/sys/arm/allwinner/if_emac.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/if_emac.c
==
--- stable/11/sys/arm/allwinner/if_emac.c   Mon Sep  5 21:11:27 2016
(r305440)
+++ stable/11/sys/arm/allwinner/if_emac.c   Mon Sep  5 21:25:45 2016
(r305441)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -167,12 +168,17 @@ static void
 emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr)
 {
uint32_t val0, val1, rnd;
+   u_char rootkey[16];
 
/*
 * Try to get MAC address from running hardware.
 * If there is something non-zero there just use it.
 *
 * Otherwise set the address to a convenient locally assigned address,
+* using the SID rootkey.
+* This is was uboot does so we end up with the same mac as if uboot
+* did set it.
+* If we can't get the root key, generate a random one,
 * 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally
 * assigned bit set, and the broadcast/multicast bit clear.
 */
@@ -186,13 +192,23 @@ emac_get_hwaddr(struct emac_softc *sc, u
hwaddr[4] = (val0 >> 8) & 0xff;
hwaddr[5] = (val0 >> 0) & 0xff;
} else {
-   rnd = arc4random() & 0x00ff;
-   hwaddr[0] = 'b';
-   hwaddr[1] = 's';
-   hwaddr[2] = 'd';
-   hwaddr[3] = (rnd >> 16) & 0xff;
-   hwaddr[4] = (rnd >> 8) & 0xff;
-   hwaddr[5] = (rnd >> 0) & 0xff;
+   if (aw_sid_get_rootkey(rootkey) == 0) {
+   hwaddr[0] = 0x2;
+   hwaddr[1] = rootkey[3];
+   hwaddr[2] = rootkey[12];
+   hwaddr[3] = rootkey[13];
+   hwaddr[4] = rootkey[14];
+   hwaddr[5] = rootkey[15];
+   }
+   else {
+   rnd = arc4random() & 0x00ff;
+   hwaddr[0] = 'b';
+   hwaddr[1] = 's';
+   hwaddr[2] = 'd';
+   hwaddr[3] = (rnd >> 16) & 0xff;
+   hwaddr[4] = (rnd >> 8) & 0xff;
+   hwaddr[5] = (rnd >> 0) & 0xff;
+   }
}
if (bootverbose)
printf("MAC address: %s\n", ether_sprintf(hwaddr));
___
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"


svn commit: r305439 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:46:45 2016
New Revision: 305439
URL: https://svnweb.freebsd.org/changeset/base/305439

Log:
  MFC r304290,r304649
  
  r304290:
  Only set pud settings if this is a pullup or pulldown configuration.
  This removes the need to set the MMC pins with pullups in our DTS.
  Thanks to jmcneill@ for spotting this.
  
  r304649:
  Do not include file from dt-bindings and simply use the already present 
defines.

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:34:15 2016
(r305438)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:46:45 2016
(r305439)
@@ -585,7 +585,9 @@ aw_fdt_configure_pins(device_t dev, phan
a10_gpio_set_function(sc, pin_num, pin_func);
if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
a10_gpio_set_drv(sc, pin_num, pin_drive);
-   if (a10_gpio_get_pud(sc, pin_num) != pin_pull)
+   if (a10_gpio_get_pud(sc, pin_num) != pin_pull &&
+   (pin_pull == A10_GPIO_PULLUP ||
+   pin_pull == A10_GPIO_PULLDOWN))
a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
___
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"


svn commit: r305436 - in stable/11/sys: arm/allwinner arm/allwinner/a13 arm/allwinner/clk arm/conf conf

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:17:18 2016
New Revision: 305436
URL: https://svnweb.freebsd.org/changeset/base/305436

Log:
  MFC r302472
  Add support for Allwinner A13.
  
  Reviewed by:  jmcneill
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D6809

Added:
  stable/11/sys/arm/allwinner/a13/
 - copied from r302472, head/sys/arm/allwinner/a13/
Modified:
  stable/11/sys/arm/allwinner/a10_codec.c
  stable/11/sys/arm/allwinner/a10_ehci.c
  stable/11/sys/arm/allwinner/a10_gpio.c
  stable/11/sys/arm/allwinner/allwinner_machdep.c
  stable/11/sys/arm/allwinner/aw_ccu.c
  stable/11/sys/arm/allwinner/clk/aw_gate.c
  stable/11/sys/arm/allwinner/clk/aw_pll.c
  stable/11/sys/arm/allwinner/clk/aw_usbclk.c
  stable/11/sys/arm/allwinner/std.a10
  stable/11/sys/arm/conf/A10
  stable/11/sys/conf/options.arm
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_codec.c
==
--- stable/11/sys/arm/allwinner/a10_codec.c Mon Sep  5 20:07:03 2016
(r305435)
+++ stable/11/sys/arm/allwinner/a10_codec.c Mon Sep  5 20:17:18 2016
(r305436)
@@ -720,13 +720,19 @@ CHANNEL_DECLARE(a10codec_chan);
  * Device interface
  */
 
+static struct ofw_compat_data compat_data[] = {
+   {"allwinner,sun4i-a10-codec", 1},
+   {"allwinner,sun7i-a20-codec", 1},
+   {NULL, 0},
+};
+
 static int
 a10codec_probe(device_t dev)
 {
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "allwinner,sun7i-a20-codec"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "Allwinner Audio Codec");

Modified: stable/11/sys/arm/allwinner/a10_ehci.c
==
--- stable/11/sys/arm/allwinner/a10_ehci.c  Mon Sep  5 20:07:03 2016
(r305435)
+++ stable/11/sys/arm/allwinner/a10_ehci.c  Mon Sep  5 20:17:18 2016
(r305436)
@@ -112,6 +112,7 @@ static const struct aw_ehci_conf a31_ehc
 
 static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-ehci",   (uintptr_t)_ehci_conf },
+   { "allwinner,sun5i-a13-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun6i-a31-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun7i-a20-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun8i-a83t-ehci",  (uintptr_t)_ehci_conf },

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:07:03 2016
(r305435)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:17:18 2016
(r305436)
@@ -80,6 +80,11 @@ __FBSDID("$FreeBSD$");
 extern const struct allwinner_padconf a10_padconf;
 #endif
 
+/* Defined in a13_padconf.c */
+#ifdef SOC_ALLWINNER_A13
+extern const struct allwinner_padconf a13_padconf;
+#endif
+
 /* Defined in a20_padconf.c */
 #ifdef SOC_ALLWINNER_A20
 extern const struct allwinner_padconf a20_padconf;
@@ -115,6 +120,9 @@ static struct ofw_compat_data compat_dat
 #ifdef SOC_ALLWINNER_A10
{"allwinner,sun4i-a10-pinctrl", (uintptr_t)_padconf},
 #endif
+#ifdef SOC_ALLWINNER_A13
+   {"allwinner,sun5i-a13-pinctrl", (uintptr_t)_padconf},
+#endif
 #ifdef SOC_ALLWINNER_A20
{"allwinner,sun7i-a20-pinctrl", (uintptr_t)_padconf},
 #endif

Modified: stable/11/sys/arm/allwinner/allwinner_machdep.c
==
--- stable/11/sys/arm/allwinner/allwinner_machdep.c Mon Sep  5 20:07:03 
2016(r305435)
+++ stable/11/sys/arm/allwinner/allwinner_machdep.c Mon Sep  5 20:17:18 
2016(r305436)
@@ -68,6 +68,14 @@ a10_attach(platform_t plat)
 }
 
 static int
+a13_attach(platform_t plat)
+{
+   soc_type = ALLWINNERSOC_A13;
+   soc_family = ALLWINNERSOC_SUN5I;
+   return (0);
+}
+
+static int
 a20_attach(platform_t plat)
 {
soc_type = ALLWINNERSOC_A20;
@@ -169,6 +177,17 @@ static platform_method_t a10_methods[] =
 FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10", 200);
 #endif
 
+#if defined(SOC_ALLWINNER_A13)
+static platform_method_t a13_methods[] = {
+   PLATFORMMETHOD(platform_attach, a13_attach),
+   PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
+   PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+
+   PLATFORMMETHOD_END,
+};
+FDT_PLATFORM_DEF(a13, "a13", 0, "allwinner,sun5i-a13", 200);
+#endif
+
 #if defined(SOC_ALLWINNER_A20)
 static platform_method_t a20_methods[] = {
PLATFORMMETHOD(platform_attach, a20_attach),

Modified: stable/11/sys/arm/allwinner/aw_ccu.c
==
--- 

svn commit: r305435 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:07:03 2016
New Revision: 305435
URL: https://svnweb.freebsd.org/changeset/base/305435

Log:
  MFC r302470
  Check that the pin function exists before setting it.
  This is needed for Allwinner A13 which has gpio pins with only "out" function.

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 19:42:35 2016
(r305434)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:07:03 2016
(r305435)
@@ -198,11 +198,15 @@ a10_gpio_get_function(struct a10_gpio_so
return (0);
 }
 
-static void
+static int
 a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f)
 {
uint32_t bank, data, offset;
 
+   /* Check if the function exists in the padconf data */
+   if (sc->padconf->pins[pin].functions[f] == NULL)
+   return (EINVAL);
+
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
 
@@ -214,6 +218,8 @@ a10_gpio_set_function(struct a10_gpio_so
data &= ~(7 << offset);
data |= (f << offset);
A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, pin >> 3), data);
+
+   return (0);
 }
 
 static uint32_t
@@ -275,9 +281,10 @@ a10_gpio_set_drv(struct a10_gpio_softc *
A10_GPIO_WRITE(sc, A10_GPIO_GP_DRV(bank, pin >> 4), val);
 }
 
-static void
+static int
 a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags)
 {
+   int err = 0;
 
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
@@ -285,11 +292,14 @@ a10_gpio_pin_configure(struct a10_gpio_s
/* Manage input/output. */
if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) {
if (flags & GPIO_PIN_OUTPUT)
-   a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
+   err = a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
else
-   a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
+   err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
}
 
+   if (err)
+   return (err);
+
/* Manage Pull-up/pull-down. */
if (flags & (GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)) {
if (flags & GPIO_PIN_PULLUP)
@@ -298,6 +308,8 @@ a10_gpio_pin_configure(struct a10_gpio_s
a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN);
} else
a10_gpio_set_pud(sc, pin, A10_GPIO_NONE);
+
+   return (0);
 }
 
 static device_t
@@ -372,16 +384,17 @@ static int
 a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
 {
struct a10_gpio_softc *sc;
+   int err;
 
sc = device_get_softc(dev);
if (pin > sc->padconf->npins)
return (EINVAL);
 
A10_GPIO_LOCK(sc);
-   a10_gpio_pin_configure(sc, pin, flags);
+   err = a10_gpio_pin_configure(sc, pin, flags);
A10_GPIO_UNLOCK(sc);
 
-   return (0);
+   return (err);
 }
 
 static int
___
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"


svn commit: r305438 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:34:15 2016
New Revision: 305438
URL: https://svnweb.freebsd.org/changeset/base/305438

Log:
  MFC r304289
  
  a10_gpio_get_function now returns the whole function not only
  GPIO_INPUT/GPIO_OUTPUT.
  a10_gpio_get_pud now returns the whole pud not only PULLDOWN/PULLUP.
  Add a10_gpio_get_drv to get the current drive strenght.
  During fdt pin configure, avoid setting function/drive/pud if it's already in
  the correct value.
  
  Tested on Allwinner H3 and A20

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:29:04 2016
(r305437)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:34:15 2016
(r305438)
@@ -196,14 +196,8 @@ a10_gpio_get_function(struct a10_gpio_so
offset = ((pin & 0x07) << 2);
 
func = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, pin >> 3));
-   switch ((func >> offset) & 0x7) {
-   case A10_GPIO_INPUT:
-   return (GPIO_PIN_INPUT);
-   case A10_GPIO_OUTPUT:
-   return (GPIO_PIN_OUTPUT);
-   }
 
-   return (0);
+   return ((func >> offset) & 0x7);
 }
 
 static int
@@ -243,14 +237,8 @@ a10_gpio_get_pud(struct a10_gpio_softc *
offset = ((pin & 0x0f) << 1);
 
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pin >> 4));
-   switch ((val >> offset) & 0x3) {
-   case A10_GPIO_PULLDOWN:
-   return (GPIO_PIN_PULLDOWN);
-   case A10_GPIO_PULLUP:
-   return (GPIO_PIN_PULLUP);
-   }
 
-   return (0);
+   return ((val >> offset) & AW_GPIO_PUD_MASK);
 }
 
 static void
@@ -271,6 +259,23 @@ a10_gpio_set_pud(struct a10_gpio_softc *
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pin >> 4), val);
 }
 
+static uint32_t
+a10_gpio_get_drv(struct a10_gpio_softc *sc, uint32_t pin)
+{
+   uint32_t bank, offset, val;
+
+   /* Must be called with lock held. */
+   A10_GPIO_LOCK_ASSERT(sc);
+
+   bank = sc->padconf->pins[pin].port;
+   pin = sc->padconf->pins[pin].pin;
+   offset = ((pin & 0x0f) << 1);
+
+   val = A10_GPIO_READ(sc, A10_GPIO_GP_DRV(bank, pin >> 4));
+
+   return ((val >> offset) & AW_GPIO_DRV_MASK);
+}
+
 static void
 a10_gpio_set_drv(struct a10_gpio_softc *sc, uint32_t pin, uint32_t drive)
 {
@@ -359,14 +364,39 @@ static int
 a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
 {
struct a10_gpio_softc *sc;
+   uint32_t func;
+   uint32_t pud;
 
sc = device_get_softc(dev);
if (pin >= sc->padconf->npins)
return (EINVAL);
 
A10_GPIO_LOCK(sc);
-   *flags = a10_gpio_get_function(sc, pin);
-   *flags |= a10_gpio_get_pud(sc, pin);
+   func = a10_gpio_get_function(sc, pin);
+   switch (func) {
+   case A10_GPIO_INPUT:
+   *flags = GPIO_PIN_INPUT;
+   break;
+   case A10_GPIO_OUTPUT:
+   *flags = GPIO_PIN_OUTPUT;
+   break;
+   default:
+   *flags = 0;
+   break;
+   }
+
+   pud = a10_gpio_get_pud(sc, pin);
+   switch (pud) {
+   case A10_GPIO_PULLDOWN:
+   *flags |= GPIO_PIN_PULLDOWN;
+   break;
+   case A10_GPIO_PULLUP:
+   *flags |= GPIO_PIN_PULLUP;
+   break;
+   default:
+   break;
+   }
+
A10_GPIO_UNLOCK(sc);
 
return (0);
@@ -550,9 +580,13 @@ aw_fdt_configure_pins(device_t dev, phan
}
 
A10_GPIO_LOCK(sc);
-   a10_gpio_set_function(sc, pin_num, pin_func);
-   a10_gpio_set_drv(sc, pin_num, pin_drive);
-   a10_gpio_set_pud(sc, pin_num, pin_pull);
+
+   if (a10_gpio_get_function(sc, pin_num) != pin_func)
+   a10_gpio_set_function(sc, pin_num, pin_func);
+   if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
+   a10_gpio_set_drv(sc, pin_num, pin_drive);
+   if (a10_gpio_get_pud(sc, pin_num) != pin_pull)
+   a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
 
___
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"


svn commit: r305440 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 21:11:27 2016
New Revision: 305440
URL: https://svnweb.freebsd.org/changeset/base/305440

Log:
  MFC r303087
  
  Add support for the SID (Security ID Module) on Allwinner A10 and A20.
  The rootkey is burnt at production and can't be changed, thus is can be used
  as a device unique ID or to generate a MAC address (This is was u-boot does).
  The rootkey is exposed as a sysctl (dev.aw_sid..rootkey).
  
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D6383

Modified:
  stable/11/sys/arm/allwinner/aw_sid.c
  stable/11/sys/arm/allwinner/aw_sid.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/aw_sid.c
==
--- stable/11/sys/arm/allwinner/aw_sid.cMon Sep  5 20:46:45 2016
(r305439)
+++ stable/11/sys/arm/allwinner/aw_sid.cMon Sep  5 21:11:27 2016
(r305440)
@@ -33,12 +33,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -50,13 +52,22 @@ __FBSDID("$FreeBSD$");
 #defineSID_THERMAL_CALIB0  (SID_SRAM + 0x34)
 #defineSID_THERMAL_CALIB1  (SID_SRAM + 0x38)
 
+enum sid_type {
+   A10_SID = 1,
+   A20_SID,
+   A83T_SID,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun8i-a83t-sid",   1 },
+   { "allwinner,sun4i-a10-sid",A10_SID},
+   { "allwinner,sun7i-a20-sid",A20_SID},
+   { "allwinner,sun8i-a83t-sid",   A83T_SID},
{ NULL, 0 }
 };
 
 struct aw_sid_softc {
struct resource *res;
+   int type;
 };
 
 static struct aw_sid_softc *aw_sid_sc;
@@ -66,9 +77,18 @@ static struct resource_spec aw_sid_spec[
{ -1, 0 }
 };
 
+enum sid_keys {
+   AW_SID_ROOT_KEY,
+};
+
+#defineROOT_KEY_OFF0x0
+#defineROOT_KEY_SIZE   4
+
 #defineRD4(sc, reg)bus_read_4((sc)->res, (reg))
 #defineWR4(sc, reg, val)   bus_write_4((sc)->res, (reg), (val))
 
+static int aw_sid_sysctl(SYSCTL_HANDLER_ARGS);
+
 static int
 aw_sid_probe(device_t dev)
 {
@@ -96,6 +116,19 @@ aw_sid_attach(device_t dev)
 
aw_sid_sc = sc;
 
+   sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+   switch (sc->type) {
+   case A10_SID:
+   case A20_SID:
+   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+   OID_AUTO, "rootkey",
+   CTLTYPE_STRING | CTLFLAG_RD,
+   dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key");
+   break;
+   default:
+   break;
+   }
return (0);
 }
 
@@ -107,6 +140,8 @@ aw_sid_read_tscalib(uint32_t *calib0, ui
sc = aw_sid_sc;
if (sc == NULL)
return (ENXIO);
+   if (sc->type != A83T_SID)
+   return (ENXIO);
 
*calib0 = RD4(sc, SID_THERMAL_CALIB0);
*calib1 = RD4(sc, SID_THERMAL_CALIB1);
@@ -114,6 +149,45 @@ aw_sid_read_tscalib(uint32_t *calib0, ui
return (0);
 }
 
+int
+aw_sid_get_rootkey(u_char *out)
+{
+   struct aw_sid_softc *sc;
+   int i;
+   u_int tmp;
+
+   sc = aw_sid_sc;
+   if (sc == NULL)
+   return (ENXIO);
+   if (sc->type != A10_SID && sc->type != A20_SID)
+   return (ENXIO);
+
+   for (i = 0; i < ROOT_KEY_SIZE ; i++) {
+   tmp = RD4(aw_sid_sc, ROOT_KEY_OFF + (i * 4));
+   be32enc([i * 4], tmp);
+   }
+
+   return (0);
+}
+
+static int
+aw_sid_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   enum sid_keys key = arg2;
+   u_char rootkey[16];
+   char out[33];
+
+   if (key != AW_SID_ROOT_KEY)
+   return (ENOENT);
+
+   if (aw_sid_get_rootkey(rootkey) != 0)
+   return (ENOENT);
+   snprintf(out, sizeof(out),
+ "%16D", rootkey, "");
+
+   return sysctl_handle_string(oidp, out, sizeof(out), req);
+}
+
 static device_method_t aw_sid_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, aw_sid_probe),

Modified: stable/11/sys/arm/allwinner/aw_sid.h
==
--- stable/11/sys/arm/allwinner/aw_sid.hMon Sep  5 20:46:45 2016
(r305439)
+++ stable/11/sys/arm/allwinner/aw_sid.hMon Sep  5 21:11:27 2016
(r305440)
@@ -30,5 +30,6 @@
 #define __AW_SID_H__
 
 intaw_sid_read_tscalib(uint32_t *, uint32_t *);
+intaw_sid_get_rootkey(u_char *out);
 
 #endif /* !__AW_SID_H__ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r305377 - stable/11/sys/boot/efi/libefi

2016-09-04 Thread Emmanuel Vadot
Author: manu
Date: Sun Sep  4 08:53:58 2016
New Revision: 305377
URL: https://svnweb.freebsd.org/changeset/base/305377

Log:
  MFC 304222
  
  Only use WaitForKeys event if it exists, this is not the case in u-boot efi 
implementation.

Modified:
  stable/11/sys/boot/efi/libefi/efi_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/efi/libefi/efi_console.c
==
--- stable/11/sys/boot/efi/libefi/efi_console.c Sun Sep  4 08:52:09 2016
(r305376)
+++ stable/11/sys/boot/efi/libefi/efi_console.c Sun Sep  4 08:53:58 2016
(r305377)
@@ -438,8 +438,10 @@ efi_cons_getchar()
 
/* Try to read a key stroke. We wait for one if none is pending. */
status = conin->ReadKeyStroke(conin, );
-   if (status == EFI_NOT_READY) {
-   BS->WaitForEvent(1, >WaitForKey, );
+   while (status == EFI_NOT_READY) {
+   /* Some EFI implementation (u-boot for example) do not support 
WaitForKey */
+   if (conin->WaitForKey != NULL)
+   BS->WaitForEvent(1, >WaitForKey, );
status = conin->ReadKeyStroke(conin, );
}
switch (key.ScanCode) {
@@ -454,6 +456,9 @@ efi_cons_getchar()
 int
 efi_cons_poll()
 {
+
+   if (conin->WaitForKey == NULL)
+   return (1);
/* This can clear the signaled state. */
return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS);
 }
___
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"


svn commit: r305376 - stable/11/sys/boot/efi/boot1

2016-09-04 Thread Emmanuel Vadot
Author: manu
Date: Sun Sep  4 08:52:09 2016
New Revision: 305376
URL: https://svnweb.freebsd.org/changeset/base/305376

Log:
  MFC 304221 and 304271
  
  Use %ju modifier for u_int64_t and %jd modifier for off_t.
  off_t is long long on arm32 and long on amd64
  
  Correctly print and cast u_int64_t and off_t.

Modified:
  stable/11/sys/boot/efi/boot1/ufs_module.c
  stable/11/sys/boot/efi/boot1/zfs_module.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/efi/boot1/ufs_module.c
==
--- stable/11/sys/boot/efi/boot1/ufs_module.c   Sun Sep  4 01:47:21 2016
(r305375)
+++ stable/11/sys/boot/efi/boot1/ufs_module.c   Sun Sep  4 08:52:09 2016
(r305376)
@@ -56,9 +56,9 @@ dskread(void *buf, u_int64_t lba, int nb
devinfo->dev->Media->MediaId, lba, size, buf);
 
if (status != EFI_SUCCESS) {
-   DPRINTF("dskread: failed dev: %p, id: %u, lba: %lu, size: %d, "
+   DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, "
"status: %lu\n", devinfo->dev,
-   devinfo->dev->Media->MediaId, lba, size,
+   devinfo->dev->Media->MediaId, (uintmax_t)lba, size,
EFI_ERROR_CODE(status));
return (-1);
}

Modified: stable/11/sys/boot/efi/boot1/zfs_module.c
==
--- stable/11/sys/boot/efi/boot1/zfs_module.c   Sun Sep  4 01:47:21 2016
(r305375)
+++ stable/11/sys/boot/efi/boot1/zfs_module.c   Sun Sep  4 08:52:09 2016
(r305376)
@@ -53,10 +53,10 @@ vdev_read(vdev_t *vdev, void *priv, off_
status = devinfo->dev->ReadBlocks(devinfo->dev,
devinfo->dev->Media->MediaId, lba, bytes, buf);
if (status != EFI_SUCCESS) {
-   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %zu, size: 
%zu,"
-" status: %lu\n", devinfo->dev,
-devinfo->dev->Media->MediaId, lba, bytes,
-EFI_ERROR_CODE(status));
+   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %jd, size: 
%zu,"
+   " status: %lu\n", devinfo->dev,
+   devinfo->dev->Media->MediaId, (intmax_t)lba, bytes,
+   EFI_ERROR_CODE(status));
return (-1);
}
 
___
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"


svn commit: r305814 - head/sys/boot/common

2016-09-14 Thread Emmanuel Vadot
Author: manu
Date: Wed Sep 14 17:43:32 2016
New Revision: 305814
URL: https://svnweb.freebsd.org/changeset/base/305814

Log:
  ufsread: Do not cast struct direct from void *
  This cause alignment problem on ARM (and possibly other archs), instead copy 
it.
  
  MFC after:1 week

Modified:
  head/sys/boot/common/ufsread.c

Modified: head/sys/boot/common/ufsread.c
==
--- head/sys/boot/common/ufsread.c  Wed Sep 14 16:47:17 2016
(r305813)
+++ head/sys/boot/common/ufsread.c  Wed Sep 14 17:43:32 2016
(r305814)
@@ -97,21 +97,21 @@ static __inline uint8_t
 fsfind(const char *name, ufs_ino_t * ino)
 {
static char buf[DEV_BSIZE];
-   struct direct *d;
+   static struct direct d;
char *s;
ssize_t n;
 
fs_off = 0;
while ((n = fsread(*ino, buf, DEV_BSIZE)) > 0)
for (s = buf; s < buf + DEV_BSIZE;) {
-   d = (void *)s;
+   memcpy(, s, sizeof(struct direct));
if (ls)
-   printf("%s ", d->d_name);
-   else if (!strcmp(name, d->d_name)) {
-   *ino = d->d_ino;
-   return d->d_type;
+   printf("%s ", d.d_name);
+   else if (!strcmp(name, d.d_name)) {
+   *ino = d.d_ino;
+   return d.d_type;
}
-   s += d->d_reclen;
+   s += d.d_reclen;
}
if (n != -1 && ls)
printf("\n");
___
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"


Re: svn commit: r305814 - head/sys/boot/common

2016-09-14 Thread Emmanuel Vadot

 Hi Bruce,

On Thu, 15 Sep 2016 05:37:19 +1000 (EST)
Bruce Evans <b...@optusnet.com.au> wrote:

> On Wed, 14 Sep 2016, Emmanuel Vadot wrote:
> 
> > Log:
> >  ufsread: Do not cast struct direct from void *
> >  This cause alignment problem on ARM (and possibly other archs), instead 
> > copy it.
> >
> >  MFC after: 1 week
> >
> > Modified:
> >  head/sys/boot/common/ufsread.c
> >
> > Modified: head/sys/boot/common/ufsread.c
> > ==
> > --- head/sys/boot/common/ufsread.c  Wed Sep 14 16:47:17 2016
> > (r305813)
> > +++ head/sys/boot/common/ufsread.c  Wed Sep 14 17:43:32 2016
> > (r305814)
> > @@ -97,21 +97,21 @@ static __inline uint8_t
> > fsfind(const char *name, ufs_ino_t * ino)
> > {
> > static char buf[DEV_BSIZE];
> > -   struct direct *d;
> > +   static struct direct d;
> > char *s;
> > ssize_t n;
> 
> This looks like a good pessimization for space.  boot2 on i386 has to
> fit in 8192 bytes and has a negative number to spare (features are
> already left out).

 Do you have any suggestion on making the code better ?
 This was the last patch for having EFI working on ARMv6 and this is
something that I want to be enabled by default at some point.

> 
> With auto buffers, and also builtin memcpy, the compiler can optimize
> the memcpy to nothing on arches with no alignment, and should do this
> with -Os.  I think -ffreestanding in boot programs kills the builtin,
> and this is almost intentional since compilers have poor support for
> -Os so the inline memcpy is sometimes larger unless it is null.
> 
> >
> > fs_off = 0;
> > while ((n = fsread(*ino, buf, DEV_BSIZE)) > 0)
> > for (s = buf; s < buf + DEV_BSIZE;) {
> > -   d = (void *)s;
> > +   memcpy(, s, sizeof(struct direct));
> > if (ls)
> > -   printf("%s ", d->d_name);
> > -   else if (!strcmp(name, d->d_name)) {
> > -   *ino = d->d_ino;
> > -   return d->d_type;
> > +   printf("%s ", d.d_name);
> > +   else if (!strcmp(name, d.d_name)) {
> > +   *ino = d.d_ino;
> > +   return d.d_type;
> > }
> > -   s += d->d_reclen;
> > +   s += d.d_reclen;
> > }
> > if (n != -1 && ls)
> > printf("\n");
> 
> The static buffer in the old code also looks like a pessimization for
> space.  It doesn't seem to be needed to preserver or return results.
> Compilers don't seem to be smart enough to see this and optimize it
> to auto or vice versa.
> 
> Testing shows that the static buffer is space optimization for gcc
> and a space pessimization for clang:
> 
> X #include 
> X #include 
> X 
> X int
> X foo(void)
> X {
> X static char buf[101];
> X static int buf1[3];
> X 
> X read(0, buf, sizeof(buf));
> X memcpy(buf1, [2], sizeof(buf1));
> X return (buf[0] + buf1[0]);
> X }
> 
> 2 static buffers give the best pessimizations for clang -Os -m32.
> Even with -Os, clang prefers to use large instructions to reduce the
> number of instructions.  The static buffers give largest instructions,
> and also prevent optimizing away the memcpy().  With auto buf1, it
> takes -ffreestanding to kill the optimization of memcpy() and with
> that optimization the size is reduced by almost a factor of 2.  With
> auto buf too, other pessimizations are applied to give a size reduction
> of just 1 byte.  gcc-4.2.1 never inlines the memcpy(), but it does
> the other pessimizations less well to give an in-between size.
> 
> Aproximate sizes on i386: 65 bytes for clang with statics, 49 for gcc,
> 33 for clang with autos and builtins, 28 for tweaked output for clang
> with static buf, auto buf1 and builtins (null memcpy).
> 
> Probably the static buf is an intentional optimization for gcc.
> Compilers do too good a job of generating large code for large stack
> offsets.  In my test code, the offsets are about 101 which is less than
> 128 so it takes only 2 bytes.  DEV_BSIZE is 512 so it needs 5-byte
> offsets from the usual pessimizations for the base pointer (these
> are to point %ebp at the top of the variables and put all the scalar
> variables below the buffer so that the offsets are largest).  But
> clang also does good pessimizations for offsets from the 

svn commit: r305740 - head/sys/arm/conf

2016-09-12 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep 12 16:13:27 2016
New Revision: 305740
URL: https://svnweb.freebsd.org/changeset/base/305740

Log:
  Remove CUBIEBOARD kernel config file.
  Every Allwinner board should either use ALLWINNER (SMP) or ALLWINER_UP kernel
  config files.
  
  MFC after:2 week

Deleted:
  head/sys/arm/conf/CUBIEBOARD
___
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"


svn commit: r305739 - head/release/arm

2016-09-12 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep 12 16:10:47 2016
New Revision: 305739
URL: https://svnweb.freebsd.org/changeset/base/305739

Log:
  Use "generic" ALLWINNER_UP kernel config for Cubieboard release.
  
  Reviewed by:  gjb
  MFC after:2 week

Modified:
  head/release/arm/CUBIEBOARD.conf

Modified: head/release/arm/CUBIEBOARD.conf
==
--- head/release/arm/CUBIEBOARD.confMon Sep 12 15:57:35 2016
(r305738)
+++ head/release/arm/CUBIEBOARD.confMon Sep 12 16:10:47 2016
(r305739)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard"
-KERNEL="CUBIEBOARD"
+KERNEL="ALLWINNER_UP"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"
___
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"


svn commit: r306491 - in head/sys/arm: broadcom/bcm2835 conf

2016-09-30 Thread Emmanuel Vadot
Author: manu
Date: Fri Sep 30 10:21:04 2016
New Revision: 306491
URL: https://svnweb.freebsd.org/changeset/base/306491

Log:
  RPI2: Add support for MULTIDELAY, this is needed for inclusion into GENERIC.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/conf/RPI2

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Sep 30 10:20:53 
2016(r306490)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Sep 30 10:21:04 
2016(r306491)
@@ -147,5 +147,5 @@ static platform_method_t bcm2836_methods
 
PLATFORMMETHOD_END,
 };
-FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 0);
+FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 100);
 #endif

Modified: head/sys/arm/conf/RPI2
==
--- head/sys/arm/conf/RPI2  Fri Sep 30 10:20:53 2016(r306490)
+++ head/sys/arm/conf/RPI2  Fri Sep 30 10:21:04 2016(r306491)
@@ -30,6 +30,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsSMP # Enable multiple cores
 optionsPLATFORM
 optionsPLATFORM_SMP
+optionsMULTIDELAY
 
 # NFS root from boopt/dhcp
 #options   BOOTP
___
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"


svn commit: r306489 - head/sys/arm/broadcom/bcm2835

2016-09-30 Thread Emmanuel Vadot
Author: manu
Date: Fri Sep 30 10:00:57 2016
New Revision: 306489
URL: https://svnweb.freebsd.org/changeset/base/306489

Log:
  bcm2835_cpufreq: Only attach driver if we correcly match on the machine
  compatible string.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Fri Sep 30 09:23:29 
2016(r306488)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Fri Sep 30 10:00:57 
2016(r306489)
@@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -119,6 +124,13 @@ struct bcm2835_cpufreq_softc {
struct intr_config_hook init_hook;
 };
 
+static struct ofw_compat_data compat_data[] = {
+   { "broadcom,bcm2835-vc",1 },
+   { "broadcom,bcm2708-vc",1 },
+   { "brcm,bcm2709",   1 },
+   { NULL, 0 }
+};
+
 static int cpufreq_verbose = 0;
 TUNABLE_INT("hw.bcm2835.cpufreq.verbose", _verbose);
 static int cpufreq_lowest_freq = DEFAULT_LOWEST_FREQ;
@@ -1244,6 +1256,16 @@ bcm2835_cpufreq_init(void *arg)
 static void
 bcm2835_cpufreq_identify(driver_t *driver, device_t parent)
 {
+   const struct ofw_compat_data *compat;
+   phandle_t root;
+
+   root = OF_finddevice("/");
+   for (compat = compat_data; compat->ocd_str != NULL; compat++)
+   if (fdt_is_compatible(root, compat->ocd_str))
+   break;
+
+   if (compat->ocd_data == 0)
+   return;
 
DPRINTF("driver=%p, parent=%p\n", driver, parent);
if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL)
___
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"


svn commit: r306493 - head/sys/arm/conf

2016-09-30 Thread Emmanuel Vadot
Author: manu
Date: Fri Sep 30 10:46:27 2016
New Revision: 306493
URL: https://svnweb.freebsd.org/changeset/base/306493

Log:
  Add support for RPI2 to the armv6 GENERIC kernel.

Modified:
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Fri Sep 30 10:22:50 2016(r306492)
+++ head/sys/arm/conf/GENERIC   Fri Sep 30 10:46:27 2016(r306493)
@@ -33,6 +33,8 @@ files "../allwinner/a20/files.a20"
 files  "../allwinner/a31/files.a31"
 files  "../allwinner/a83t/files.a83t"
 files  "../allwinner/h3/files.h3"
+files  "../broadcom/bcm2835/files.bcm2836"
+files  "../broadcom/bcm2835/files.bcm283x"
 files  "../nvidia/tegra124/files.tegra124"
 files  "../qemu/files.qemu"
 
@@ -41,6 +43,7 @@ options   SOC_ALLWINNER_A31
 optionsSOC_ALLWINNER_A31S
 optionsSOC_ALLWINNER_A83T
 optionsSOC_ALLWINNER_H3
+optionsSOC_BCM2836
 
 optionsSCHED_ULE   # ULE scheduler
 optionsSMP # Enable multiple cores
@@ -103,12 +106,17 @@ devicetwsi
 device rsb
 device axp209  # AXP209 Power Management Unit
 device axp81x  # AXP813/818 Power Management Unit
+device bcm2835_bsc
 device icee
 
 # GPIO
 device gpio
 device gpioled
 
+# SPI
+device spibus
+device bcm2835_spi
+
 device scbus   # SCSI bus (required for ATA/SCSI)
 device da  # Direct Access (disks)
 device cd  # CD
@@ -120,6 +128,7 @@ device  usb
 #deviceuhci
 device ohci
 device ehci
+device dwcotg  # DWC OTG controller
 
 device umass   # Disks/Mass storage - Requires scbus 
and da
 device uhid# "Human Interface Devices"
@@ -137,6 +146,8 @@ device  dwc # 10/100/1000 
integrated G
 device awg # 10/100/1000 integrated EMAC controller
 
 # USB ethernet support, requires miibus
+device smcphy
+device smsc
 device miibus
 
 # Sound support
@@ -148,6 +159,7 @@ device  kbdmux
 device ums
 device videomode
 device hdmi
+device vchiq
 
 # Pinmux
 device fdt_pinctrl
@@ -157,4 +169,4 @@ options EFI
 
 # Flattened Device Tree
 optionsFDT # Configure using FDT/DTB data
-makeoptionsMODULES_EXTRA=dtb/allwinner
+makeoptionsMODULES_EXTRA="dtb/allwinner dtb/rpi"
___
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"


Re: svn commit: r304221 - head/sys/boot/efi/boot1

2016-08-17 Thread Emmanuel Vadot
On Tue, 16 Aug 2016 12:16:30 -0600
Warner Losh <i...@bsdimp.com> wrote:

> On Tue, Aug 16, 2016 at 8:57 AM, Ed Schouten <e...@nuxi.nl> wrote:
> > Hi Emmanuel,
> >
> > 2016-08-16 16:23 GMT+02:00 Emmanuel Vadot <m...@freebsd.org>:
> >> Author: manu
> >> Date: Tue Aug 16 14:23:35 2016
> >> New Revision: 304221
> >> URL: https://svnweb.freebsd.org/changeset/base/304221
> >>
> >> Log:
> >>   Use %ju modifier for u_int64_t and %jd modifier for off_t.
> >>   off_t is long long on arm32 and long on amd64
> >
> > I think both of these should be solved differently:
> >
> > - For uint64_t, you can use 's PRIu64 in the formatting
> > string. In kernel space, I suspect you need to use something like
> > .
> 
> cast it to intmax_t and use %jd. We've shunned PRIu64 in the tree.
> It's existing practice, but I'm sure bruce will voice mild distaste.
> 
> > - For off_t, it's all right to print it with %jd, but then be sure to
> > also add a cast to the argument itself. It may not necessarily be
> > equal to an intmax_t.
> 
> The cast is important.
> 
> Warner


 Thanks to all of you, I didn't know about PRI* (but I guess this was a
good thing to not know about them).

-- 
Emmanuel Vadot
___
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"


svn commit: r304271 - head/sys/boot/efi/boot1

2016-08-17 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug 17 08:29:30 2016
New Revision: 304271
URL: https://svnweb.freebsd.org/changeset/base/304271

Log:
  Correctly print and cast u_int64_t and off_t.
  
  Reported by:  ed, imp
  MFC after:1 week

Modified:
  head/sys/boot/efi/boot1/ufs_module.c
  head/sys/boot/efi/boot1/zfs_module.c

Modified: head/sys/boot/efi/boot1/ufs_module.c
==
--- head/sys/boot/efi/boot1/ufs_module.cWed Aug 17 08:26:08 2016
(r304270)
+++ head/sys/boot/efi/boot1/ufs_module.cWed Aug 17 08:29:30 2016
(r304271)
@@ -56,9 +56,9 @@ dskread(void *buf, u_int64_t lba, int nb
devinfo->dev->Media->MediaId, lba, size, buf);
 
if (status != EFI_SUCCESS) {
-   DPRINTF("dskread: failed dev: %p, id: %u, lba: %zu, size: %d, "
+   DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, "
"status: %lu\n", devinfo->dev,
-   devinfo->dev->Media->MediaId, lba, size,
+   devinfo->dev->Media->MediaId, (uintmax_t)lba, size,
EFI_ERROR_CODE(status));
return (-1);
}

Modified: head/sys/boot/efi/boot1/zfs_module.c
==
--- head/sys/boot/efi/boot1/zfs_module.cWed Aug 17 08:26:08 2016
(r304270)
+++ head/sys/boot/efi/boot1/zfs_module.cWed Aug 17 08:29:30 2016
(r304271)
@@ -54,9 +54,9 @@ vdev_read(vdev_t *vdev, void *priv, off_
devinfo->dev->Media->MediaId, lba, bytes, buf);
if (status != EFI_SUCCESS) {
DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %jd, size: 
%zu,"
-" status: %lu\n", devinfo->dev,
-devinfo->dev->Media->MediaId, lba, bytes,
-EFI_ERROR_CODE(status));
+   " status: %lu\n", devinfo->dev,
+   devinfo->dev->Media->MediaId, (intmax_t)lba, bytes,
+   EFI_ERROR_CODE(status));
return (-1);
}
 
___
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"


svn commit: r304710 - head/sys/arm/allwinner

2016-08-23 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 23 22:26:50 2016
New Revision: 304710
URL: https://svnweb.freebsd.org/changeset/base/304710

Log:
  Allwinner: Add thermal sensor driver for A10/A20
  The thermal sensor lives in the touch screen controller. Touch screen part
  isn't done for now.
  Temperature is read every ~2 seconds and exposed via sysctl.

Added:
  head/sys/arm/allwinner/aw_ts.c   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner

Added: head/sys/arm/allwinner/aw_ts.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/aw_ts.c  Tue Aug 23 22:26:50 2016
(r304710)
@@ -0,0 +1,230 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+
+/*
+ * Allwinner Touch Sreen driver
+ * Touch screen part is not done, only the thermal sensor part is.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#defineREAD(_sc, _r) bus_read_4((_sc)->res[0], (_r))
+#defineWRITE(_sc, _r, _v) bus_write_4((_sc)->res[0], (_r), (_v))
+
+/* Control register 0 */
+#defineTP_CTRL00x00
+#define TP_CTRL0_TACQ(x)   ((x & 0xFF) << 0)
+#define TP_CTRL0_FS_DIV(x) ((x & 0xF) << 16)
+#define TP_CTRL0_CLK_DIV(x)((x & 0x3) << 20)
+#define TP_CTRL0_CLK_SELECT(x) ((x & 0x1) << 22)
+
+/* Control register 1 */
+#defineTP_CTRL10x04
+#define TP_CTRL1_MODE_EN   (1 << 4)
+
+/* Control register 2 */
+#defineTP_CTRL20x08
+
+/* Control register 3 */
+#defineTP_CTRL30x0C
+
+/* Int/FIFO control register */
+#defineTP_FIFOC0x10
+#define TP_FIFOC_TEMP_IRQ_ENABLE   (1 << 18)
+
+/* Int/FIFO status register */
+#defineTP_FIFOS0x14
+#define TP_FIFOS_TEMP_IRQ_PENDING  (1 << 18)
+
+/* Temperature Period Register */
+#defineTP_TPR  0x18
+#define TP_TPR_TEMP_EN (1 << 16)
+#define TP_TPR_TEMP_PERIOD(x)  (x << 0)
+
+/* Common data register */
+#defineTP_CDAT 0x1C
+
+/* Temperature data register */
+#defineTEMP_DATA   0x20
+
+/* TP Data register*/
+#defineTP_DATA 0x24
+
+/* TP IO config register */
+#defineTP_IO_CONFIG0x28
+
+/* TP IO port data register */
+#defineTP_IO_DATA  0x2C
+
+struct aw_ts_softc {
+   device_tdev;
+   struct resource *   res[2];
+   void *  intrhand;
+   int temp_data;
+   int temp_offset;
+   int temp_step;
+};
+
+static struct resource_spec aw_ts_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE | RF_SHAREABLE },
+   { -1, 0 }
+};
+
+#defineA10_TS  1
+#defineA13_TS  2
+
+#defineAW_TS_TEMP_SYSCTL   1
+
+static struct ofw_compat_data compat_data[] = {
+   {"allwinner,sun4i-a10-ts", A10_TS},
+   {"allwinner,sun5i-a13-ts", A13_TS},
+   {NULL, 0}
+};
+
+static void
+aw_ts_intr(void *arg)
+{
+   struct aw_ts_softc *sc;
+   int val;
+
+   sc= (struct aw_ts_softc *)arg;
+
+   val = READ(sc, TP_FIFOS);
+   if (val & TP_FIFOS_TEMP_IRQ_PENDING) {
+   /* Convert the value to mill

svn commit: r304623 - head/sys/arm/arm

2016-08-22 Thread Emmanuel Vadot
Author: manu
Date: Mon Aug 22 18:33:56 2016
New Revision: 304623
URL: https://svnweb.freebsd.org/changeset/base/304623

Log:
  Fix building for ARM kernel that have FLASHADDR, PHYSADDR and LOADERRAMADDR 
defined.
  
  Pointy Hat: myself
  
  Reported by:  bz

Modified:
  head/sys/arm/arm/elf_trampoline.c

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Mon Aug 22 18:19:46 2016
(r304622)
+++ head/sys/arm/arm/elf_trampoline.c   Mon Aug 22 18:33:56 2016
(r304623)
@@ -228,7 +228,7 @@ _startC(unsigned r0, unsigned r1, unsign
"mov pc, %0\n"
: : "r" (target_addr), "r" (tmp_sp),
"r" (s_boot_params.abp_r0), "r" (s_boot_params.abp_r1),
-   "r" (s_boot_params.abp_r2), "r" (s_boot_params.abp_r3),
+   "r" (s_boot_params.abp_r2), "r" (s_boot_params.abp_r3)
: "r0", "r1", "r2", "r3");
 
}
___
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"


svn commit: r306436 - in head/sys/arm: broadcom/bcm2835 conf

2016-09-29 Thread Emmanuel Vadot
Author: manu
Date: Thu Sep 29 06:49:59 2016
New Revision: 306436
URL: https://svnweb.freebsd.org/changeset/base/306436

Log:
  RPI-B: Add support for MULTIDELAY
  
  100 cycles per us seems accurate enough, at least it's better than the 200 
value
  that was used before.
  
  Reviewed by:  andrew, imp
  Differential Revision:https://reviews.freebsd.org/D8062

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
  head/sys/arm/conf/RPI-B

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Thu Sep 29 06:19:45 
2016(r306435)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Thu Sep 29 06:49:59 
2016(r306436)
@@ -129,7 +129,7 @@ static platform_method_t bcm2835_methods
 
PLATFORMMETHOD_END,
 };
-FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 0);
+FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 100);
 #endif
 
 #ifdef SOC_BCM2836

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_systimer.cThu Sep 29 06:19:45 
2016(r306435)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_systimer.cThu Sep 29 06:49:59 
2016(r306436)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -101,6 +102,8 @@ static struct bcm_systimer_softc *bcm_sy
 
 static unsigned bcm_systimer_tc_get_timecount(struct timecounter *);
 
+static delay_func bcm_systimer_delay;
+
 static struct timecounter bcm_systimer_tc = {
.tc_name   = DEFAULT_TIMER_NAME,
.tc_get_timecount  = bcm_systimer_tc_get_timecount,
@@ -113,6 +116,9 @@ static struct timecounter bcm_systimer_t
 static unsigned
 bcm_systimer_tc_get_timecount(struct timecounter *tc)
 {
+   if (bcm_systimer_sc == NULL)
+   return (0);
+
return bcm_systimer_tc_read_4(SYSTIMER_CLO);
 }
 
@@ -147,7 +153,7 @@ restart:
intr_restore(s);
 
return (0);
-   } 
+   }
 
return (EINVAL);
 }
@@ -167,7 +173,7 @@ bcm_systimer_intr(void *arg)
struct systimer *st = (struct systimer *)arg;
uint32_t cs;
 
-   cs = bcm_systimer_tc_read_4(SYSTIMER_CS);
+   cs = bcm_systimer_tc_read_4(SYSTIMER_CS);
if ((cs & (1 << st->index)) == 0)
return (FILTER_STRAY);
 
@@ -254,6 +260,9 @@ bcm_systimer_attach(device_t dev)
 
bcm_systimer_sc = sc;
 
+   if (device_get_unit(dev) == 0)
+   arm_set_delay(bcm_systimer_delay, sc);
+
bcm_systimer_tc.tc_frequency = DEFAULT_FREQUENCY;
tc_init(_systimer_tc);
 
@@ -276,19 +285,14 @@ static devclass_t bcm_systimer_devclass;
 
 DRIVER_MODULE(bcm_systimer, simplebus, bcm_systimer_driver, 
bcm_systimer_devclass, 0, 0);
 
-void
-DELAY(int usec)
+static void
+bcm_systimer_delay(int usec, void *arg)
 {
+   struct bcm_systimer_softc *sc;
int32_t counts;
uint32_t first, last;
 
-   if (bcm_systimer_sc == NULL) {
-   for (; usec > 0; usec--)
-   for (counts = 200; counts > 0; counts--)
-   /* Prevent gcc from optimizing  out the loop */
-   cpufunc_nullop();
-   return;
-   }
+   sc = (struct bcm_systimer_softc *) arg;
 
/* Get the number of times to count */
counts = usec * (bcm_systimer_tc.tc_frequency / 100) + 1;

Modified: head/sys/arm/conf/RPI-B
==
--- head/sys/arm/conf/RPI-B Thu Sep 29 06:19:45 2016(r306435)
+++ head/sys/arm/conf/RPI-B Thu Sep 29 06:49:59 2016(r306436)
@@ -28,6 +28,7 @@ options   INTRNG
 
 optionsSCHED_4BSD  # 4BSD scheduler
 optionsPLATFORM
+optionsMULTIDELAY
 
 # NFS root from boopt/dhcp
 #options   BOOTP
___
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"


svn commit: r306437 - in head/sys/arm: broadcom/bcm2835 conf

2016-09-29 Thread Emmanuel Vadot
Author: manu
Date: Thu Sep 29 06:54:02 2016
New Revision: 306437
URL: https://svnweb.freebsd.org/changeset/base/306437

Log:
  RPI2: Add support for PLATFORM_SMP so we can later add it to GENERIC.
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D8063

Added:
  head/sys/arm/broadcom/bcm2835/bcm2836_mp.h   (contents, props changed)
Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/broadcom/bcm2835/bcm2836_mp.c
  head/sys/arm/conf/RPI2

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Thu Sep 29 06:49:59 
2016(r306436)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Thu Sep 29 06:54:02 
2016(r306437)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include "platform_if.h"
 
@@ -139,6 +140,11 @@ static platform_method_t bcm2836_methods
PLATFORMMETHOD(platform_late_init,  bcm2835_late_init),
PLATFORMMETHOD(platform_cpu_reset,  bcm2835_cpu_reset),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,bcm2836_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,bcm2836_mp_setmaxid),
+#endif
+
PLATFORMMETHOD_END,
 };
 FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 0);

Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2836_mp.c  Thu Sep 29 06:49:59 2016
(r306436)
+++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.c  Thu Sep 29 06:54:02 2016
(r306437)
@@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #ifdef DEBUG
 #defineDPRINTF(fmt, ...) do {  \
@@ -77,7 +80,7 @@ static bus_space_handle_t bs_periph;
bus_space_write_4(fdtbus_bs_tag, bs_periph, (addr), (val))
 
 void
-platform_mp_setmaxid(void)
+bcm2836_mp_setmaxid(platform_t plat)
 {
 
DPRINTF("platform_mp_setmaxid\n");
@@ -90,7 +93,7 @@ platform_mp_setmaxid(void)
 }
 
 void
-platform_mp_start_ap(void)
+bcm2836_mp_start_ap(platform_t plat)
 {
uint32_t val;
int i, retry;

Added: head/sys/arm/broadcom/bcm2835/bcm2836_mp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.h  Thu Sep 29 06:54:02 2016
(r306437)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (C) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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$
+ */
+
+#ifndef _BCM2836_MP_H_
+#define_BCM2836_MP_H_
+
+void   bcm2836_mp_setmaxid(platform_t plat);
+void   bcm2836_mp_start_ap(platform_t plat);
+
+#endif /* _BCM2836_MP_H_ */

Modified: head/sys/arm/conf/RPI2
==
--- head/sys/arm/conf/RPI2  Thu Sep 29 06:49:59 2016(r306436)
+++ head/sys/arm/conf/RPI2  Thu Sep 29 06:54:02 2016(r306437)
@@ -29,6 +29,7 @@ options   INTRNG
 optionsSCHED_ULE   # ULE scheduler
 optionsSMP # Enable multiple cores
 optionsPLATFORM
+optionsPLATFORM_SMP
 
 # NFS root from boopt/dhcp
 #options   BOOTP

svn commit: r306934 - head/sys/modules/dtb/allwinner

2016-10-09 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 10 04:53:15 2016
New Revision: 306934
URL: https://svnweb.freebsd.org/changeset/base/306934

Log:
  Add CHIP dts into the build

Modified:
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Sun Oct  9 23:27:08 2016
(r306933)
+++ head/sys/modules/dtb/allwinner/Makefile Mon Oct 10 04:53:15 2016
(r306934)
@@ -9,6 +9,7 @@ DTS=\
olinuxino-lime.dts \
pcduino3.dts \
sinovoip-bpi-m3.dts \
-   sun5i-a13-olinuxino.dts
+   sun5i-a13-olinuxino.dts \
+   sun5i-r8-chip.dts
 
 .include 
___
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"


Re: svn commit: r308458 - in head/sys: boot/fdt/dts/arm modules/dtb/am335x

2016-11-08 Thread Emmanuel Vadot
quot;default";
> + pinctrl-0 = <_pins>;
> +
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +};
> +
> +_ctrl_mod {
> + status = "okay";
> +};
> +
> +_phy {
> + status = "okay";
> +};
> +
> +_phy {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> + dr_mode = "host";
> +};
> +
> + {
> + status = "okay";
> + dr_mode = "host";
> +};
> +
> +  {
> + status = "okay";
> +};
> +
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins>;
> +
> + status = "okay";
> + clock-frequency = <40>;
> +
> + baseboard_eeprom: baseboard_eeprom@50 {
> + compatible = "atmel,24c02";
> + reg = <0x50>;
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> + baseboard_data: baseboard_data@0 {
> + reg = <0 0x100>;
> + };
> + };
> +};
> +
> +_emac0 {
> + phy_id = <_mdio>, <1>;
> + phy-mode = "rgmii";
> + dual_emac_res_vlan = <1>;
> +};
> +
> +_emac1 {
> + phy_id = <_mdio>, <2>;
> + phy-mode = "rgmii";
> + dual_emac_res_vlan = <2>;
> +};
> +
> + {
> + pinctrl-names = "default", "sleep";
> + pinctrl-0 = <_default>;
> + pinctrl-1 = <_sleep>;
> + active_slave = <1>;
> + status = "okay";
> + dual_emac;
> + txen-skew-ps = <0>;
> + rxdv-skew-ps = <1400>;
> + rxd0-skew-ps = <1400>;
> + rxd1-skew-ps = <1400>;
> + rxd2-skew-ps = <1400>;
> + rxd3-skew-ps = <1400>;
> + txd0-skew-ps = <0>;
> + txd1-skew-ps = <0>;
> + txd2-skew-ps = <0>;
> + txd3-skew-ps = <0>;
> + rxc-skew-ps = <4400>;
> + txc-skew-ps = <6200>;
> +};
> +
> +_mdio {
> + pinctrl-names = "default", "sleep";
> + pinctrl-0 = <_mdio_default>;
> + pinctrl-1 = <_mdio_sleep>;
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +};
> 
> Added: head/sys/boot/fdt/dts/arm/ufw.dts
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/sys/boot/fdt/dts/arm/ufw.dts Wed Nov  9 04:07:15 2016
> (r308458)
> @@ -0,0 +1,70 @@
> +/*-
> + * Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * 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 "am33xx.dtsi"
> +#include "ubmc.dtsi"
> +
> +/ {
> + model = "AM335x uFW";
> + compatible = "ti,am335x-ufw", "ti,am335x-ubmc", "ti,am33xx";
> +};
> +
> + {
> + vmmc-supply = <_fixed>;
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins>;
> + bus-width = <4>;
> + non-removable;
> + status = "okay";
> +};
> +
> + {
> + vmmc-supply = <_fixed>;
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins>;
> + bus-width = <8>;
> + ti,dual-volt;
> + non-removable;
> + status = "okay";
> +};
> +
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins>;
> +
> + status = "okay";
> +};
> +
> + {
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins>;
> +
> + status = "okay";
> +};
> 
> Modified: head/sys/modules/dtb/am335x/Makefile
> ==
> --- head/sys/modules/dtb/am335x/Makefile  Tue Nov  8 23:59:41 2016
> (r308457)
> +++ head/sys/modules/dtb/am335x/Makefile  Wed Nov  9 04:07:15 2016
> (r308458)
> @@ -2,6 +2,7 @@
>  # All the dts files for am335x systems we support.
>  DTS= \
>   beaglebone.dts \
> -beaglebone-black.dts
> + beaglebone-black.dts \
> + ufw.dts
>  
>  .include 


-- 
Emmanuel Vadot <m...@bidouilliste.com> <m...@freebsd.org>
___
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"


svn commit: r308306 - head/sys/arm/allwinner

2016-11-04 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov  4 19:21:11 2016
New Revision: 308306
URL: https://svnweb.freebsd.org/changeset/base/308306

Log:
  Set rst_apb to NULL to avoid panic when release.

Modified:
  head/sys/arm/allwinner/aw_cir.c

Modified: head/sys/arm/allwinner/aw_cir.c
==
--- head/sys/arm/allwinner/aw_cir.c Fri Nov  4 19:07:12 2016
(r308305)
+++ head/sys/arm/allwinner/aw_cir.c Fri Nov  4 19:21:11 2016
(r308306)
@@ -390,6 +390,7 @@ aw_ir_attach(device_t dev)
uint32_t val = 0;
 
clk_ir = clk_gate = NULL;
+   rst_abp = NULL;
 
sc = device_get_softc(dev);
sc->dev = dev;
___
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"


svn commit: r308309 - head/sys/arm/allwinner

2016-11-04 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov  4 20:02:52 2016
New Revision: 308309
URL: https://svnweb.freebsd.org/changeset/base/308309

Log:
  Add support for AXP221 Power Management Unit.
  
  AXP221 is used on board with A31/A31S and is mostly compatible with AXP209.
  Regulators, GPIO and Sensors are supported.
  
  MFC after:2 weeks

Modified:
  head/sys/arm/allwinner/axp209.c
  head/sys/arm/allwinner/axp209reg.h

Modified: head/sys/arm/allwinner/axp209.c
==
--- head/sys/arm/allwinner/axp209.c Fri Nov  4 19:35:49 2016
(r308308)
+++ head/sys/arm/allwinner/axp209.c Fri Nov  4 20:02:52 2016
(r308309)
@@ -27,9 +27,11 @@
 
 #include 
 __FBSDID("$FreeBSD$");
+
 /*
-* X-Power AXP209 PMU for Allwinner SoCs
+* X-Power AXP209/AXP211 PMU for Allwinner SoCs
 */
+
 #include 
 #include 
 #include 
@@ -61,9 +63,9 @@ __FBSDID("$FreeBSD$");
 #include "gpio_if.h"
 #include "regdev_if.h"
 
-MALLOC_DEFINE(M_AXP209_REG, "Axp209 regulator", "Axp209 power regulator");
+MALLOC_DEFINE(M_AXP2XX_REG, "Axp2XX regulator", "Axp2XX power regulator");
 
-struct axp209_regdef {
+struct axp2xx_regdef {
intptr_tid;
char*name;
uint8_t enable_reg;
@@ -77,7 +79,7 @@ struct axp209_regdef {
int voltage_nstep;
 };
 
-static struct axp209_regdef axp209_regdefs[] = {
+static struct axp2xx_regdef axp209_regdefs[] = {
{
.id = AXP209_REG_ID_DCDC2,
.name = "dcdc2",
@@ -129,36 +131,503 @@ static struct axp209_regdef axp209_regde
},
 };
 
-struct axp209_reg_sc {
+static struct axp2xx_regdef axp221_regdefs[] = {
+   {
+   .id = AXP221_REG_ID_DLDO1,
+   .name = "dldo1",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_DLDO1,
+   .voltage_reg = AXP221_REG_DLDO1_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_DLDO2,
+   .name = "dldo2",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_DLDO2,
+   .voltage_reg = AXP221_REG_DLDO2_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_DLDO3,
+   .name = "dldo3",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_DLDO3,
+   .voltage_reg = AXP221_REG_DLDO3_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_DLDO4,
+   .name = "dldo4",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_DLDO4,
+   .voltage_reg = AXP221_REG_DLDO4_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_ELDO1,
+   .name = "eldo1",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_ELDO1,
+   .voltage_reg = AXP221_REG_ELDO1_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_ELDO2,
+   .name = "eldo2",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_ELDO2,
+   .voltage_reg = AXP221_REG_ELDO2_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_ELDO3,
+   .name = "eldo3",
+   .enable_reg = AXP221_POWERCTL_2,
+   .enable_mask = AXP221_POWERCTL2_ELDO3,
+   .voltage_reg = AXP221_REG_ELDO3_VOLTAGE,
+   .voltage_mask = 0x1f,
+   .voltage_min = 700,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 26,
+   },
+   {
+   .id = AXP221_REG_ID_DC5LDO,
+   .name = "dc5ldo",
+   .enable_reg = AXP221_POWERCTL_1,
+   .enable_mask 

svn commit: r308310 - head/sys/boot/fdt/dts/arm

2016-11-04 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov  4 20:06:32 2016
New Revision: 308310
URL: https://svnweb.freebsd.org/changeset/base/308310

Log:
  Add AXP221 node in our BananaPi M2 dts.

Modified:
  head/sys/boot/fdt/dts/arm/bananapim2.dts

Modified: head/sys/boot/fdt/dts/arm/bananapim2.dts
==
--- head/sys/boot/fdt/dts/arm/bananapim2.dtsFri Nov  4 20:02:52 2016
(r308309)
+++ head/sys/boot/fdt/dts/arm/bananapim2.dtsFri Nov  4 20:06:32 2016
(r308310)
@@ -31,3 +31,15 @@
  {
status = "disabled";
 };
+
+ {
+   status = "okay";
+   axp22x: pmic@68 {
+   compatible = "x-powers,axp221";
+   reg = <0x68>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+#include "axp22x.dtsi"
___
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"


svn commit: r308307 - head/sys/arm/allwinner

2016-11-04 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov  4 19:23:52 2016
New Revision: 308307
URL: https://svnweb.freebsd.org/changeset/base/308307

Log:
  Fix r308306 by spelling variable correctly.

Modified:
  head/sys/arm/allwinner/aw_cir.c

Modified: head/sys/arm/allwinner/aw_cir.c
==
--- head/sys/arm/allwinner/aw_cir.c Fri Nov  4 19:21:11 2016
(r308306)
+++ head/sys/arm/allwinner/aw_cir.c Fri Nov  4 19:23:52 2016
(r308307)
@@ -390,7 +390,7 @@ aw_ir_attach(device_t dev)
uint32_t val = 0;
 
clk_ir = clk_gate = NULL;
-   rst_abp = NULL;
+   rst_apb = NULL;
 
sc = device_get_softc(dev);
sc->dev = dev;
___
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"


svn commit: r308341 - stable/11/sys/arm/conf

2016-11-05 Thread Emmanuel Vadot
Author: manu
Date: Sat Nov  5 14:16:32 2016
New Revision: 308341
URL: https://svnweb.freebsd.org/changeset/base/308341

Log:
  Remove A10 kernel config file, this should have been done in rr308273

Deleted:
  stable/11/sys/arm/conf/A10
___
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"


svn commit: r308441 - head/sys/arm/allwinner/clk

2016-11-08 Thread Emmanuel Vadot
Author: manu
Date: Tue Nov  8 10:06:43 2016
New Revision: 308441
URL: https://svnweb.freebsd.org/changeset/base/308441

Log:
  Do not fail to attach the clock if we cannot set the assigned parents as this
  property isn't mandatory.
  
  MFC after:2 weeks

Modified:
  head/sys/arm/allwinner/clk/aw_ahbclk.c

Modified: head/sys/arm/allwinner/clk/aw_ahbclk.c
==
--- head/sys/arm/allwinner/clk/aw_ahbclk.c  Tue Nov  8 10:05:11 2016
(r308440)
+++ head/sys/arm/allwinner/clk/aw_ahbclk.c  Tue Nov  8 10:06:43 2016
(r308441)
@@ -351,7 +351,7 @@ aw_ahbclk_attach(device_t dev)
}
 
error = clk_set_assigned(dev, node);
-   if (error != 0) {
+   if (error != 0 && error != ENOENT) {
device_printf(dev, "cannot set assigned parents: %d\n", error);
goto fail;
}
___
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"


svn commit: r308440 - head/sys/dev/extres/clk

2016-11-08 Thread Emmanuel Vadot
Author: manu
Date: Tue Nov  8 10:05:11 2016
New Revision: 308440
URL: https://svnweb.freebsd.org/changeset/base/308440

Log:
  Do not warn if the 'assigned-clock-parents' property does not exists.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/extres/clk/clk.c

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Tue Nov  8 09:54:11 2016
(r308439)
+++ head/sys/dev/extres/clk/clk.c   Tue Nov  8 10:05:11 2016
(r308440)
@@ -1205,7 +1205,9 @@ clk_set_assigned(device_t dev, phandle_t
"assigned-clock-parents", "#clock-cells", );
 
if (error != 0) {
-   device_printf(dev, "cannot parse assigned-clock-parents 
property\n");
+   if (error != ENOENT)
+   device_printf(dev,
+   "cannot parse assigned-clock-parents property\n");
return (error);
}
 
___
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"


svn commit: r307822 - in head/sys/arm: allwinner conf

2016-10-23 Thread Emmanuel Vadot
Author: manu
Date: Sun Oct 23 12:48:09 2016
New Revision: 307822
URL: https://svnweb.freebsd.org/changeset/base/307822

Log:
  allwinner: Add support for P2WI bus
  
  P2WI (Push-Pull Two Wire Interface) is an I2C-like bus used in sun6i SoC
  for talking to power management unit IC.

Added:
  head/sys/arm/allwinner/aw_p2wi.c   (contents, props changed)
  head/sys/arm/allwinner/aw_p2wi.h   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Added: head/sys/arm/allwinner/aw_p2wi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/aw_p2wi.cSun Oct 23 12:48:09 2016
(r307822)
@@ -0,0 +1,277 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot <m...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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$
+ */
+
+/*
+ * Allwinner P2WI (Push-Pull Two Wire Interface)
+ * P2WI is a iic-like interface used on sun6i hardware
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "iicbus_if.h"
+
+static struct ofw_compat_data compat_data[] = {
+   { "allwinner,sun6i-a31-p2wi",   1 },
+   { NULL, 0 }
+};
+
+static struct resource_spec p2wi_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+struct p2wi_softc {
+   struct resource *res;
+   struct mtx  mtx;
+   clk_t   clk;
+   hwreset_t   rst;
+   device_tiicbus;
+};
+
+#defineP2WI_LOCK(sc)   mtx_lock(&(sc)->mtx)
+#defineP2WI_UNLOCK(sc) mtx_unlock(&(sc)->mtx)
+#defineP2WI_READ(sc, reg)  bus_read_4((sc)->res, (reg))
+#defineP2WI_WRITE(sc, reg, val)bus_write_4((sc)->res, (reg), 
(val))
+
+#defineP2WI_RETRY  1000
+
+static phandle_t
+p2wi_get_node(device_t bus, device_t dev)
+{
+   return (ofw_bus_get_node(bus));
+}
+
+static int
+p2wi_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
+{
+   struct p2wi_softc *sc;
+   int retry;
+
+   sc = device_get_softc(dev);
+
+   P2WI_LOCK(sc);
+
+   P2WI_WRITE(sc, P2WI_CTRL, P2WI_CTRL_SOFT_RESET);
+   for (retry = P2WI_RETRY; retry > 0; retry--)
+   if ((P2WI_READ(sc, P2WI_CTRL) & P2WI_CTRL_SOFT_RESET) == 0)
+   break;
+
+   P2WI_UNLOCK(sc);
+
+   if (retry == 0) {
+   device_printf(dev, "soft reset timeout\n");
+   return (ETIMEDOUT);
+   }
+
+   return (IIC_ENOADDR);
+}
+
+static int
+p2wi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
+{
+   struct p2wi_softc *sc;
+   int retry, error;
+   uint8_t data_len;
+
+   sc = device_get_softc(dev);
+
+   /*
+* Since P2WI is only used for AXP22x PMIC we only support
+* two messages of one byte length
+*/
+   if (nmsgs != 2 || (msgs[0].flags & IIC_M_RD) == IIC_M_RD ||
+   msgs[0].len != 1 || msgs[1].len != 1)
+   return (EINVAL);
+
+   P2WI_LOCK(sc);
+
+   /* Write address */
+   P2WI_WRITE(sc, P2WI_DADDR0, msgs[0].buf[0]);
+
+   /* Write Data length/Direction */
+   data_len = P2WI_DLEN_LEN(msgs[1].len);
+   if ((msgs[1].flags & IIC_M_RD) == 0)
+   P2WI_WRITE(sc, P2WI_DATA0, msgs[1].buf[0]);
+   else
+   data_len |= P2WI_DLEN_READ;
+   P2WI_WRI

svn commit: r307885 - stable/11/sys/arm/allwinner

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 21:31:47 2016
New Revision: 307885
URL: https://svnweb.freebsd.org/changeset/base/307885

Log:
  MFC r307379:
  
  axp209: Add support for regulators
  
  Except for LDO4, all regulators are supported.

Modified:
  stable/11/sys/arm/allwinner/axp209.c
  stable/11/sys/arm/allwinner/axp209reg.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/axp209.c
==
--- stable/11/sys/arm/allwinner/axp209.cMon Oct 24 21:16:21 2016
(r307884)
+++ stable/11/sys/arm/allwinner/axp209.cMon Oct 24 21:31:47 2016
(r307885)
@@ -50,14 +50,92 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include "iicbus_if.h"
 #include "gpio_if.h"
+#include "regdev_if.h"
+
+MALLOC_DEFINE(M_AXP209_REG, "Axp209 regulator", "Axp209 power regulator");
+
+struct axp209_regdef {
+   intptr_tid;
+   char*name;
+   uint8_t enable_reg;
+   uint8_t enable_mask;
+   uint8_t voltage_reg;
+   uint8_t voltage_mask;
+   uint8_t voltage_shift;
+   int voltage_min;
+   int voltage_max;
+   int voltage_step;
+   int voltage_nstep;
+};
+
+static struct axp209_regdef axp209_regdefs[] = {
+   {
+   .id = AXP209_REG_ID_DCDC2,
+   .name = "dcdc2",
+   .enable_reg = AXP209_POWERCTL,
+   .enable_mask = AXP209_POWERCTL_DCDC2,
+   .voltage_reg = AXP209_REG_DCDC2_VOLTAGE,
+   .voltage_mask = 0x3f,
+   .voltage_min = 700,
+   .voltage_max = 2275,
+   .voltage_step = 25,
+   .voltage_nstep = 64,
+   },
+   {
+   .id = AXP209_REG_ID_DCDC3,
+   .name = "dcdc3",
+   .enable_reg = AXP209_POWERCTL,
+   .enable_mask = AXP209_POWERCTL_DCDC3,
+   .voltage_reg = AXP209_REG_DCDC3_VOLTAGE,
+   .voltage_mask = 0x7f,
+   .voltage_min = 700,
+   .voltage_max = 3500,
+   .voltage_step = 25,
+   .voltage_nstep = 128,
+   },
+   {
+   .id = AXP209_REG_ID_LDO2,
+   .name = "ldo2",
+   .enable_reg = AXP209_POWERCTL,
+   .enable_mask = AXP209_POWERCTL_LDO2,
+   .voltage_reg = AXP209_REG_LDO24_VOLTAGE,
+   .voltage_mask = 0xf0,
+   .voltage_shift = 4,
+   .voltage_min = 1800,
+   .voltage_max = 3300,
+   .voltage_step = 100,
+   .voltage_nstep = 16,
+   },
+   {
+   .id = AXP209_REG_ID_LDO3,
+   .name = "ldo3",
+   .enable_reg = AXP209_POWERCTL,
+   .enable_mask = AXP209_POWERCTL_LDO3,
+   .voltage_reg = AXP209_REG_LDO3_VOLTAGE,
+   .voltage_mask = 0x7f,
+   .voltage_min = 700,
+   .voltage_max = 2275,
+   .voltage_step = 25,
+   .voltage_nstep = 128,
+   },
+};
+
+struct axp209_reg_sc {
+   struct regnode  *regnode;
+   device_tbase_dev;
+   struct axp209_regdef*def;
+   phandle_t   xref;
+   struct regnode_std_param *param;
+};
 
 struct axp209_softc {
device_tdev;
@@ -67,6 +145,10 @@ struct axp209_softc {
struct intr_config_hook intr_hook;
device_tgpiodev;
struct mtx  mtx;
+
+   /* Regulators */
+   struct axp209_reg_sc**regs;
+   int nregs;
 };
 
 /* GPIO3 is different, don't expose it for now */
@@ -125,6 +207,115 @@ axp209_write(device_t dev, uint8_t reg, 
 }
 
 static int
+axp209_regnode_init(struct regnode *regnode)
+{
+   return (0);
+}
+
+static int
+axp209_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
+{
+   struct axp209_reg_sc *sc;
+   uint8_t val;
+
+   sc = regnode_get_softc(regnode);
+
+   axp209_read(sc->base_dev, sc->def->enable_reg, , 1);
+   if (enable)
+   val |= sc->def->enable_mask;
+   else
+   val &= ~sc->def->enable_mask;
+   axp209_write(sc->base_dev, sc->def->enable_reg, val);
+
+   *udelay = 0;
+
+   return (0);
+}
+
+static void
+axp209_regnode_reg_to_voltage(struct axp209_reg_sc *sc, uint8_t val, int *uv)
+{
+   if (val < sc->def->voltage_nstep)
+   *uv = sc->def->voltage_min + val * sc->def->voltage_step;
+   else
+   *uv = sc->def->voltage_min +
+  (sc->def->voltage_nstep * sc->def->voltage_step);
+   *uv *= 1000;
+}
+
+static int
+axp209_regnode_voltage_to_reg(struct 

svn commit: r307918 - head/sys/arm/allwinner/clk

2016-10-25 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct 25 15:21:08 2016
New Revision: 307918
URL: https://svnweb.freebsd.org/changeset/base/307918

Log:
  allwinner A10 Pll1 allow changing freq
  
  PLL1 is used by the cpu core, allowing changing freq is needed for cpufreq.
  The factors table contains all the frequencies in the operating point table
  present in the DTS.
  
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/clk/aw_pll.c

Modified: head/sys/arm/allwinner/clk/aw_pll.c
==
--- head/sys/arm/allwinner/clk/aw_pll.c Tue Oct 25 15:20:06 2016
(r307917)
+++ head/sys/arm/allwinner/clk/aw_pll.c Tue Oct 25 15:21:08 2016
(r307918)
@@ -192,6 +192,16 @@ struct aw_pll_factor {
 #definePLLFACTOR(_n, _k, _m, _p, _freq)\
{ .n = (_n), .k = (_k), .m = (_m), .p = (_p), .freq = (_freq) }
 
+static struct aw_pll_factor aw_a10_pll1_factors[] = {
+   PLLFACTOR(6, 0, 0, 0, 14400),
+   PLLFACTOR(12, 0, 0, 0, 31200),
+   PLLFACTOR(21, 0, 0, 0, 52800),
+   PLLFACTOR(29, 0, 0, 0, 72000),
+   PLLFACTOR(18, 1, 0, 0, 86400),
+   PLLFACTOR(19, 1, 0, 0, 91200),
+   PLLFACTOR(20, 1, 0, 0, 96000),
+};
+
 static struct aw_pll_factor aw_a23_pll1_factors[] = {
PLLFACTOR(9, 0, 0, 2, 6000),
PLLFACTOR(10, 0, 0, 2, 6600),
@@ -300,6 +310,47 @@ struct aw_pll_funcs {
 #defineDEVICE_UNLOCK(sc)   CLKDEV_DEVICE_UNLOCK((sc)->clkdev)
 
 static int
+a10_pll1_init(device_t dev, bus_addr_t reg, struct clknode_init_def *def)
+{
+   /* Allow changing PLL frequency while enabled */
+   def->flags = CLK_NODE_GLITCH_FREE;
+
+   return (0);
+}
+
+static int
+a10_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
+int flags)
+{
+   struct aw_pll_factor *f;
+   uint32_t val;
+   int n;
+
+   f = NULL;
+   for (n = 0; n < nitems(aw_a10_pll1_factors); n++) {
+   if (aw_a10_pll1_factors[n].freq == *fout) {
+   f = _a10_pll1_factors[n];
+   break;
+   }
+   }
+   if (f == NULL)
+   return (EINVAL);
+
+   DEVICE_LOCK(sc);
+   PLL_READ(sc, );
+   val &= ~(A10_PLL1_FACTOR_N|A10_PLL1_FACTOR_K|A10_PLL1_FACTOR_M|
+   A10_PLL1_OUT_EXT_DIVP);
+   val |= (f->p << A10_PLL1_OUT_EXT_DIVP_SHIFT);
+   val |= (f->n << A10_PLL1_FACTOR_N_SHIFT);
+   val |= (f->k << A10_PLL1_FACTOR_K_SHIFT);
+   val |= (f->m << A10_PLL1_FACTOR_M_SHIFT);
+   PLL_WRITE(sc, val);
+   DEVICE_UNLOCK(sc);
+
+   return (0);
+}
+
+static int
 a10_pll1_recalc(struct aw_pll_sc *sc, uint64_t *freq)
 {
uint32_t val, m, n, k, p;
@@ -948,7 +999,7 @@ a83t_pllcpux_set_freq(struct aw_pll_sc *
}
 
 static struct aw_pll_funcs aw_pll_func[] = {
-   PLL(AWPLL_A10_PLL1, a10_pll1_recalc, NULL, NULL),
+   PLL(AWPLL_A10_PLL1, a10_pll1_recalc, a10_pll1_set_freq, a10_pll1_init),
PLL(AWPLL_A10_PLL2, a10_pll2_recalc, a10_pll2_set_freq, NULL),
PLL(AWPLL_A10_PLL3, a10_pll3_recalc, a10_pll3_set_freq, a10_pll3_init),
PLL(AWPLL_A10_PLL5, a10_pll5_recalc, NULL, NULL),
___
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"


svn commit: r307862 - in head/sys/arm: allwinner conf

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 14:24:12 2016
New Revision: 307862
URL: https://svnweb.freebsd.org/changeset/base/307862

Log:
  Revert 307822
  
  P2WI is almost compatible with RSB which we already support.
  I'll add support for P2WI in aw_rsb instead.
  
  Discussed with:jmcneill

Deleted:
  head/sys/arm/allwinner/aw_p2wi.c
  head/sys/arm/allwinner/aw_p2wi.h
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Mon Oct 24 14:08:05 2016
(r307861)
+++ head/sys/arm/allwinner/files.allwinner  Mon Oct 24 14:24:12 2016
(r307862)
@@ -12,7 +12,6 @@ arm/allwinner/a10_mmc.c   optional
mmc
 arm/allwinner/a10_sramc.c  standard
 arm/allwinner/aw_nmi.c optionalintrng
 arm/allwinner/aw_if_dwc.c  optionaldwc
-arm/allwinner/aw_p2wi.coptionalp2wi
 arm/allwinner/aw_rsb.c optionalrsb
 arm/allwinner/aw_rtc.c standard
 arm/allwinner/aw_ts.c  standard

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Mon Oct 24 14:08:05 2016(r307861)
+++ head/sys/arm/conf/GENERIC   Mon Oct 24 14:24:12 2016(r307862)
@@ -107,7 +107,6 @@ device  iicbus
 device iic
 device twsi
 device rsb
-device p2wi# Allwinner Push-Pull Two Wire interface
 device axp209  # AXP209 Power Management Unit
 device axp81x  # AXP813/818 Power Management Unit
 device bcm2835_bsc
___
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"


svn commit: r307878 - in head/sys/arm: allwinner conf

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 20:33:42 2016
New Revision: 307878
URL: https://svnweb.freebsd.org/changeset/base/307878

Log:
  allwinner: Add support for P2WI in RSB driver
  
  Push-Pull Two Wire interface is a almost compatible iic like bus used
  in sun6i SoC. It's only use is to communicate with the power management IC.
  
  Reviewed by:  jmcneill
  MFC after:1 week
  Relnotes: yes

Modified:
  head/sys/arm/allwinner/aw_rsb.c
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/allwinner/aw_rsb.c
==
--- head/sys/arm/allwinner/aw_rsb.c Mon Oct 24 19:24:07 2016
(r307877)
+++ head/sys/arm/allwinner/aw_rsb.c Mon Oct 24 20:33:42 2016
(r307878)
@@ -27,7 +27,7 @@
  */
 
 /*
- * Allwinner RSB (Reduced Serial Bus)
+ * Allwinner RSB (Reduced Serial Bus) and P2WI (Push-Pull Two Wire Interface)
  */
 
 #include 
@@ -92,8 +92,12 @@ __FBSDID("$FreeBSD$");
 #defineRSB_ADDR_PMIC_SECONDARY 0x745
 #defineRSB_ADDR_PERIPH_IC  0xe89
 
+#defineA31_P2WI1
+#defineA23_RSB 2
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun8i-a23-rsb",1 },
+   { "allwinner,sun6i-a31-p2wi",   A31_P2WI },
+   { "allwinner,sun8i-a23-rsb",A23_RSB },
{ NULL, 0 }
 };
 
@@ -131,6 +135,7 @@ struct rsb_softc {
int busy;
uint32_tstatus;
uint16_tcur_addr;
+   int type;
 
struct iic_msg  *msg;
 };
@@ -270,8 +275,8 @@ rsb_transfer(device_t dev, struct iic_ms
sc = device_get_softc(dev);
 
/*
-* RSB is not really an I2C or SMBus controller, so there are some
-* restrictions imposed by the driver.
+* P2WI and RSB are not really I2C or SMBus controllers, so there are
+* some restrictions imposed by the driver.
 *
 * Transfers must contain exactly two messages. The first is always
 * a write, containing a single data byte offset. Data will either
@@ -284,34 +289,36 @@ rsb_transfer(device_t dev, struct iic_ms
msgs[0].len != 1 || msgs[1].len > RSB_MAXLEN)
return (EINVAL);
 
-   /* The controller can read or write 1, 2, or 4 bytes at a time. */
-   if ((msgs[1].flags & IIC_M_RD) != 0) {
-   switch (msgs[1].len) {
-   case 1:
-   cmd = CMD_RD8;
-   break;
-   case 2:
-   cmd = CMD_RD16;
-   break;
-   case 4:
-   cmd = CMD_RD32;
-   break;
-   default:
-   return (EINVAL);
-   }
-   } else {
-   switch (msgs[1].len) {
-   case 1:
-   cmd = CMD_WR8;
-   break;
-   case 2:
-   cmd = CMD_WR16;
-   break;
-   case 4: 
-   cmd = CMD_WR32;
-   break;
-   default:
-   return (EINVAL);
+   /* The RSB controller can read or write 1, 2, or 4 bytes at a time. */
+   if (sc->type == A23_RSB) {
+   if ((msgs[1].flags & IIC_M_RD) != 0) {
+   switch (msgs[1].len) {
+   case 1:
+   cmd = CMD_RD8;
+   break;
+   case 2:
+   cmd = CMD_RD16;
+   break;
+   case 4:
+   cmd = CMD_RD32;
+   break;
+   default:
+   return (EINVAL);
+   }
+   } else {
+   switch (msgs[1].len) {
+   case 1:
+   cmd = CMD_WR8;
+   break;
+   case 2:
+   cmd = CMD_WR16;
+   break;
+   case 4:
+   cmd = CMD_WR32;
+   break;
+   default:
+   return (EINVAL);
+   }
}
}
 
@@ -322,13 +329,15 @@ rsb_transfer(device_t dev, struct iic_ms
sc->status = 0;
 
/* Select current run-time address if necessary */
-   device_addr = msgs[0].slave >> 1;
-   if (sc->cur_addr != device_addr) {
-   error = rsb_set_rta(dev, device_addr);
-   if (error != 0)
-   goto done;
-   sc->cur_addr = device_addr;
-   sc->status = 0;
+   if (sc->type == A23_RSB) {
+   

svn commit: r307883 - head/sys/boot/fdt/dts/arm

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 21:09:48 2016
New Revision: 307883
URL: https://svnweb.freebsd.org/changeset/base/307883

Log:
  Add needed cpu-supply property for cpufreq.
  
  Patch is merged upstream, in the meantime add it in our DTS.

Modified:
  head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts

Modified: head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts
==
--- head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dtsMon Oct 24 21:05:23 
2016(r307882)
+++ head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dtsMon Oct 24 21:09:48 
2016(r307883)
@@ -41,3 +41,7 @@
};
};
 };
+
+ {
+   cpu-supply = <_dcdc2>;
+};
___
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"


  1   2   3   4   5   6   7   8   9   10   >