From owner-p4-projects@FreeBSD.ORG Wed Mar 29 06:39:35 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1327816A420; Wed, 29 Mar 2006 06:39:35 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E644316A401 for ; Wed, 29 Mar 2006 06:39:34 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A50F543D46 for ; Wed, 29 Mar 2006 06:39:34 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2T6dYVu008339 for ; Wed, 29 Mar 2006 06:39:34 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2T6dYG2008336 for perforce@freebsd.org; Wed, 29 Mar 2006 06:39:34 GMT (envelope-from imp@freebsd.org) Date: Wed, 29 Mar 2006 06:39:34 GMT Message-Id: <200603290639.k2T6dYG2008336@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 94228 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2006 06:39:35 -0000 http://perforce.freebsd.org/chv.cgi?CH=94228 Change 94228 by imp@imp_Speedy on 2006/03/29 06:38:36 Start to add DMA stuff, one weenie step at a time Affected files ... .. //depot/projects/arm/src/sys/arm/at91/uart_dev_at91usart.c#18 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/uart_dev_at91usart.c#18 (text+ko) ==== @@ -45,6 +45,15 @@ #include "uart_if.h" +/* + * High-level UART interface. + */ +struct at91_usart_softc { + struct uart_softc base; + bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dmamap_t tx_map; +}; + #define DEFAULT_RCLK AT91C_MASTER_CLOCK #define RD4(bas, reg) \ @@ -283,10 +292,28 @@ static int at91_usart_bus_attach(struct uart_softc *sc) { + int err; + struct at91_usart_softc *atsc; + + atsc = (struct at91_usart_softc *)sc; + sc->sc_txfifosz = 128; /* Really 64k, but 128 seems a good number */ sc->sc_rxfifosz = 128; sc->sc_hwiflow = 0; - return (0); + + /* + * Allocate DMA tags and maps + */ + err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, + BUS_DMA_ALLOCNOW, NULL, NULL, &atsc->dmatag); + if (err != 0) + goto errout; + err = bus_dmamap_create(atsc->dmatag, 0, &atsc->tx_map); + if (err != 0) + goto errout; +errout:; + return (err); } static int at91_usart_bus_transmit(struct uart_softc *sc) @@ -430,7 +457,7 @@ struct uart_class at91_usart_class = { "at91_usart class", at91_usart_methods, - 1, + sizeof(struct at91_usart_softc), .uc_range = 8, .uc_rclk = DEFAULT_RCLK };