Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2014 10:12:16 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266742 - head/sys/dev/usb/controller
Message-ID:  <201405271012.s4RACGcG022252@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue May 27 10:12:16 2014
New Revision: 266742
URL: http://svnweb.freebsd.org/changeset/base/266742

Log:
  - Correct bus space resource type for register access.
  - Add configuration of interrupt type and polarity via FDT.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/usb/controller/saf1761_otg.c
  head/sys/dev/usb/controller/saf1761_otg.h
  head/sys/dev/usb/controller/saf1761_otg_fdt.c

Modified: head/sys/dev/usb/controller/saf1761_otg.c
==============================================================================
--- head/sys/dev/usb/controller/saf1761_otg.c	Tue May 27 10:01:19 2014	(r266741)
+++ head/sys/dev/usb/controller/saf1761_otg.c	Tue May 27 10:12:16 2014	(r266742)
@@ -2052,7 +2052,8 @@ saf1761_otg_init(struct saf1761_otg_soft
 	SAF1761_WRITE_LE_4(sc, SOTG_INTERRUPT_CFG,
 		SOTG_INTERRUPT_CFG_CDBGMOD |
 		SOTG_INTERRUPT_CFG_DDBGMODIN |
-		SOTG_INTERRUPT_CFG_DDBGMODOUT);
+		SOTG_INTERRUPT_CFG_DDBGMODOUT |
+		sc->sc_interrupt_cfg);
 
 	/* enable VBUS and ID interrupt */
 	SAF1761_WRITE_LE_4(sc, SOTG_IRQ_ENABLE_SET_CLR,

Modified: head/sys/dev/usb/controller/saf1761_otg.h
==============================================================================
--- head/sys/dev/usb/controller/saf1761_otg.h	Tue May 27 10:01:19 2014	(r266741)
+++ head/sys/dev/usb/controller/saf1761_otg.h	Tue May 27 10:12:16 2014	(r266742)
@@ -144,6 +144,7 @@ struct saf1761_otg_softc {
 	uint32_t sc_host_isoc_map;
 	uint32_t sc_intr_enable;	/* enabled interrupts */
 	uint32_t sc_hw_mode;		/* hardware mode */
+	uint32_t sc_interrupt_cfg;	/* interrupt configuration */
 
 	uint32_t sc_bounce_buffer[1024 / 4];
 

Modified: head/sys/dev/usb/controller/saf1761_otg_fdt.c
==============================================================================
--- head/sys/dev/usb/controller/saf1761_otg_fdt.c	Tue May 27 10:01:19 2014	(r266741)
+++ head/sys/dev/usb/controller/saf1761_otg_fdt.c	Tue May 27 10:12:16 2014	(r266742)
@@ -156,6 +156,18 @@ saf1761_otg_fdt_attach(device_t dev)
 		sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DREQ_POL;
 	}
 
+	/* get IRQ polarity */
+	if (OF_getprop(ofw_bus_get_node(dev), "int-polarity",
+	    &param, sizeof(param)) > 0) {
+		sc->sc_interrupt_cfg |= SOTG_INTERRUPT_CFG_INTPOL;
+	}
+
+	/* get IRQ level triggering */
+	if (OF_getprop(ofw_bus_get_node(dev), "int-level",
+	    &param, sizeof(param)) > 0) {
+		sc->sc_interrupt_cfg |= SOTG_INTERRUPT_CFG_INTLVL;
+	}
+
 	/* initialise some bus fields */
 	sc->sc_bus.parent = dev;
 	sc->sc_bus.devices = sc->sc_devices;
@@ -168,7 +180,7 @@ saf1761_otg_fdt_attach(device_t dev)
 	}
 	rid = 0;
 	sc->sc_io_res =
-	    bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
+	    bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
 
 	if (!sc->sc_io_res) {
 		goto error;
@@ -243,7 +255,7 @@ saf1761_otg_fdt_detach(device_t dev)
 		sc->sc_irq_res = NULL;
 	}
 	if (sc->sc_io_res) {
-		bus_release_resource(dev, SYS_RES_IOPORT, 0,
+		bus_release_resource(dev, SYS_RES_MEMORY, 0,
 		    sc->sc_io_res);
 		sc->sc_io_res = NULL;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405271012.s4RACGcG022252>