From owner-svn-soc-all@freebsd.org Sat Jul 18 12:24:12 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 452799A4230 for ; Sat, 18 Jul 2015 12:24:12 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 3526B1E5D for ; Sat, 18 Jul 2015 12:24:12 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t6ICOCbt066490 for ; Sat, 18 Jul 2015 12:24:12 GMT (envelope-from pratiksinghal@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t6ICOBBJ066486 for svn-soc-all@FreeBSD.org; Sat, 18 Jul 2015 12:24:11 GMT (envelope-from pratiksinghal@FreeBSD.org) Date: Sat, 18 Jul 2015 12:24:11 GMT Message-Id: <201507181224.t6ICOBBJ066486@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to pratiksinghal@FreeBSD.org using -f From: pratiksinghal@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r288519 - in soc2015/pratiksinghal/cubie-head/sys: arm/allwinner boot/fdt/dts/arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jul 2015 12:24:12 -0000 Author: pratiksinghal Date: Sat Jul 18 12:24:10 2015 New Revision: 288519 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=288519 Log: Added the modified dts and the header containing useful constants Added: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h Modified: soc2015/pratiksinghal/cubie-head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi Added: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h Sat Jul 18 12:24:10 2015 (r288519) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2015 Pratik Singhal + * 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. + */ + +#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask)) +#define __BIT(__n) (((__n) == 32) ? 0 : ((uint32_t)1 << (__n))) +#define __BITS(__m, __n) \ + ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1)) +#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask)) + + +/* Module base address */ +#define AC97 0x01C21400 + +/* Register Offsets */ +#define AC_CTL 0x00 /* AC97 control register */ +#define AC_FAT 0x04 /* AC97 Format register */ +#define AC_CMD 0x08 /* AC97 Command register */ +#define AC_CS 0x0C /* AC97 Codec Status register */ +#define AC_TX_FIFO 0x10 /* AC97 TX FIFO */ +#define AC_RX_FIFO 0x14 /* AC97 RX FIFO */ +#define AC_FCTL 0x18 /* AC97 FIFO control register */ +#define AC_FSTA 0x1C /* AC97 FIFO status register */ +#define AC_INT 0x20 /* AC97 interrupt control register */ +#define AC_ISTA 0x24 /* AC97 interrupt status register */ +#define AC_TX_CNT 0x28 /* AC97 TX counter register */ +#define AC_RX_CNT 0x2C /* AC97 RX counter register */ + +/* AC_CTL */ +#define AC_CODEC_FULL (1U << 18) +#define AC_CMD_FULL (1U << 17) +#define AC_RX_MIC_IN (1U << 16) +#define AC_RX_MODE_MIC (1U << 9) +#define AC_TX_EN (1U << 7) +#define AC_RX_EN (1U << 6) +#define AC_LINK_EN (1U << 5) +#define AC_GLOBAL_EN (1U << 4) +#define AC_WARM_RST (1U << 1) + +/* AC_FAT */ +#define AC_TX_MODE_2 (0) +#define AC_TX_MODE_6 (0U << 8)|(1U << 7) +#define AC_DRA_1 (1U << 6) +#define AC_VRA_MODE (1U << 4) +#define AC_TX_RES_16 (0U << 2) +#define AC_TX_RES_18 (2U << 2) +#define AC_TX_RES_20 (1U << 3) +#define AC_RX_RES_16 (0U << 1) +#define AC_RX_RES_18 (2U << 0) +#define AC_RX_RES_20 (1U << 1) + +/* AC_CMD */ +#define AC_CMD_READ (1U << 23) Modified: soc2015/pratiksinghal/cubie-head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi ============================================================================== --- soc2015/pratiksinghal/cubie-head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi Sat Jul 18 09:02:50 2015 (r288518) +++ soc2015/pratiksinghal/cubie-head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi Sat Jul 18 12:24:10 2015 (r288519) @@ -127,6 +127,14 @@ status = "disabled"; }; + ac97@01c21400 { + compatible = "allwinner,sun4i-a10-ac97"; + reg = <0x01C214000 0x1000>; + interrupts = <46> + interrupt-parent = <&AINTC>; + status = "disabled"; + }; + UART0: serial@01c28000 { compatible = "ns16550"; reg = <0x01c28000 0x400>;