From owner-svn-src-all@FreeBSD.ORG Tue May 27 10:12:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B642E7F; Tue, 27 May 2014 10:12:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C6552771; Tue, 27 May 2014 10:12:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4RACG6D022255; Tue, 27 May 2014 10:12:16 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4RACGcG022252; Tue, 27 May 2014 10:12:16 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201405271012.s4RACGcG022252@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 27 May 2014 10:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266742 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2014 10:12:17 -0000 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", + ¶m, 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", + ¶m, 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; }