From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 05:44:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D26C515; Sun, 27 Jul 2014 05:44:43 +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 4A96F27DA; Sun, 27 Jul 2014 05:44:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6R5ih8P000940; Sun, 27 Jul 2014 05:44:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6R5ihsl000938; Sun, 27 Jul 2014 05:44:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201407270544.s6R5ihsl000938@svn.freebsd.org> From: Adrian Chadd Date: Sun, 27 Jul 2014 05:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269148 - head/sys/mips/atheros 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: Sun, 27 Jul 2014 05:44:43 -0000 Author: adrian Date: Sun Jul 27 05:44:42 2014 New Revision: 269148 URL: http://svnweb.freebsd.org/changeset/base/269148 Log: Commit some sins in the name of "oh god oh god I don't really want to be able to claim I know how the UART code works." * Just return 115200 as the current baud rate. I should cache it in the device struct and return that but I'm lazy right now. * don't error out on other ioctl settings for now, just silently ignore them. * remove some code that was copied from the 8250 driver that isn't needed any longer. Tested: * AR9331, Carambola-2 board. Modified: head/sys/mips/atheros/uart_dev_ar933x.c Modified: head/sys/mips/atheros/uart_dev_ar933x.c ============================================================================== --- head/sys/mips/atheros/uart_dev_ar933x.c Sat Jul 26 21:33:17 2014 (r269147) +++ head/sys/mips/atheros/uart_dev_ar933x.c Sun Jul 27 05:44:42 2014 (r269148) @@ -428,8 +428,6 @@ ar933x_bus_getsig(struct uart_softc *sc) /* * For now, let's just return that DSR/DCD/CTS is asserted. - * - * XXX TODO: actually verify whether this is correct! */ SIGCHG(1, sig, SER_DSR, SER_DDSR); SIGCHG(1, sig, SER_CTS, SER_DCTS); @@ -441,80 +439,31 @@ ar933x_bus_getsig(struct uart_softc *sc) return (sig); } +/* + * XXX TODO: actually implement the rest of this! + */ static int ar933x_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { -#if 0 - struct uart_bas *bas; - int baudrate, divisor, error; - uint8_t efr, lcr; + int error = 0; - bas = &sc->sc_bas; - error = 0; - uart_lock(sc->sc_hwmtx); + /* XXX lock */ switch (request) { case UART_IOCTL_BREAK: - lcr = uart_getreg(bas, REG_LCR); - if (data) - lcr |= LCR_SBREAK; - else - lcr &= ~LCR_SBREAK; - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); - break; case UART_IOCTL_IFLOW: - lcr = uart_getreg(bas, REG_LCR); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, 0xbf); - uart_barrier(bas); - efr = uart_getreg(bas, REG_EFR); - if (data) - efr |= EFR_RTS; - else - efr &= ~EFR_RTS; - uart_setreg(bas, REG_EFR, efr); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); - break; case UART_IOCTL_OFLOW: - lcr = uart_getreg(bas, REG_LCR); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, 0xbf); - uart_barrier(bas); - efr = uart_getreg(bas, REG_EFR); - if (data) - efr |= EFR_CTS; - else - efr &= ~EFR_CTS; - uart_setreg(bas, REG_EFR, efr); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); break; case UART_IOCTL_BAUD: - lcr = uart_getreg(bas, REG_LCR); - uart_setreg(bas, REG_LCR, lcr | LCR_DLAB); - uart_barrier(bas); - divisor = uart_getreg(bas, REG_DLL) | - (uart_getreg(bas, REG_DLH) << 8); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); - baudrate = (divisor > 0) ? bas->rclk / divisor / 16 : 0; - if (baudrate > 0) - *(int*)data = baudrate; - else - error = ENXIO; + *(int*)data = 115200; break; default: error = EINVAL; break; } - uart_unlock(sc->sc_hwmtx); + + /* XXX unlock */ + return (error); -#endif - return (ENXIO); } /* @@ -581,6 +530,8 @@ ar933x_bus_ipend(struct uart_softc *sc) /* * Only signal TX idle if we're not busy transmitting. + * + * XXX I never get _out_ of txbusy? Debug that! */ if (sc->sc_txbusy) { if (isr & AR933X_UART_INT_TX_EMPTY) {