xref: /haiku/src/add-ons/kernel/drivers/audio/ac97/geode/gcscaudioreg.h (revision d14a541795eb66adaf341ddc9244cb253fb59abe)
1*d14a5417SJérôme Duval /*	$NetBSD: gcscaudioreg.h,v 1.1 2008/12/28 15:16:25 jmcneill Exp $	*/
2*d14a5417SJérôme Duval 
3*d14a5417SJérôme Duval /*-
4*d14a5417SJérôme Duval  * Copyright (c) 2008 SHIMIZU Ryo <ryo@nerv.org>
5*d14a5417SJérôme Duval  * All rights reserved.
6*d14a5417SJérôme Duval  *
7*d14a5417SJérôme Duval  * Redistribution and use in source and binary forms, with or without
8*d14a5417SJérôme Duval  * modification, are permitted provided that the following conditions
9*d14a5417SJérôme Duval  * are met:
10*d14a5417SJérôme Duval  * 1. Redistributions of source code must retain the above copyright
11*d14a5417SJérôme Duval  *    notice, this list of conditions and the following disclaimer.
12*d14a5417SJérôme Duval  * 2. Redistributions in binary form must reproduce the above copyright
13*d14a5417SJérôme Duval  *    notice, this list of conditions and the following disclaimer in the
14*d14a5417SJérôme Duval  *    documentation and/or other materials provided with the distribution.
15*d14a5417SJérôme Duval  *
16*d14a5417SJérôme Duval  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*d14a5417SJérôme Duval  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*d14a5417SJérôme Duval  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*d14a5417SJérôme Duval  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*d14a5417SJérôme Duval  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*d14a5417SJérôme Duval  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*d14a5417SJérôme Duval  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*d14a5417SJérôme Duval  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*d14a5417SJérôme Duval  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*d14a5417SJérôme Duval  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*d14a5417SJérôme Duval  * POSSIBILITY OF SUCH DAMAGE.
27*d14a5417SJérôme Duval  */
28*d14a5417SJérôme Duval 
29*d14a5417SJérôme Duval #ifndef _I386_PCI_GCSCAUDIOREG_H_
30*d14a5417SJérôme Duval #define _I386_PCI_GCSCAUDIOREG_H_
31*d14a5417SJérôme Duval 
32*d14a5417SJérôme Duval /*
33*d14a5417SJérôme Duval  * Reference:
34*d14a5417SJérôme Duval  *  - AMD Geode CS5536 Companion Device Data Book
35*d14a5417SJérôme Duval  *    http://www.amd.com/files/connectivitysolutions/geode/geode_lx/33238G_cs5536_db.pdf
36*d14a5417SJérôme Duval  */
37*d14a5417SJérôme Duval 
38*d14a5417SJérôme Duval #define ACC_GLD_MSR_CAP			0x51500000	/* GeodeLinkDevice Capabilities */
39*d14a5417SJérôme Duval 
40*d14a5417SJérôme Duval /*
41*d14a5417SJérôme Duval  * AC97 Audio Codec Controller (ACC) Registers
42*d14a5417SJérôme Duval  */
43*d14a5417SJérôme Duval #define ACC_GPIO_STATUS			0x00		/* Codec GPIO Status Register */
44*d14a5417SJérôme Duval # define ACC_GPIO_STATUS_GPIO_EN	0x80000000	/* GPIO Enable */
45*d14a5417SJérôme Duval # define ACC_GPIO_STATUS_INT_EN		0x40000000	/* Codec GPIO Interrupt Enable */
46*d14a5417SJérôme Duval # define ACC_GPIO_STATUS_WU_INT_EN	0x20000000	/* Codec GPIO Wakeup Interrupt Enable */
47*d14a5417SJérôme Duval # define ACC_GPIO_STATUS_INT_FLAG	0x00200000	/* Codec GPIO Interrupt Flag (Read to Clear) */
48*d14a5417SJérôme Duval # define ACC_GPIO_STATUS_WU_INT_FLAG	0x00100000	/* Codec GPIO Wakeup Interrupt Flag (Read to Clear) */
49*d14a5417SJérôme Duval # define ACC_GPIO_STATUS_PIN_STS_MASK	0x000fffff	/* Codec GPIO Pin Status (Read Only) */
50*d14a5417SJérôme Duval 
51*d14a5417SJérôme Duval #define ACC_GPIO_CNTL			0x04		/* Codec GPIO Control Register */
52*d14a5417SJérôme Duval # define ACC_GPIO_CNTL_PIN_DATA_MASK	0x000fffff	/* Codec GPIO Pin Data */
53*d14a5417SJérôme Duval 
54*d14a5417SJérôme Duval #define ACC_CODEC_REG2ADDR(reg)	(((reg) & 0x7f) << 24)
55*d14a5417SJérôme Duval #define ACC_CODEC_ADDR2REG(adr)	(((adr) >> 24) & 0x7f)
56*d14a5417SJérôme Duval 
57*d14a5417SJérôme Duval #define ACC_CODEC_STATUS		0x08		/* Codec Status Register */
58*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_STS_ADD_MASK	0xff000000	/* Codec Status Address (Read Only) */
59*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_PRM_RDY_STS	0x00800000	/* Primary Codec Ready (Read Only) */
60*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_SEC_RDY_STS	0x00400000	/* Secondary Codec Ready (Read Only) */
61*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_SDATAIN2_EN	0x00200000	/* Enable Second Serial Data Input (AC_S_IN2) */
62*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_BM5_SEL	0x00100000	/* Audio Bus Master 5 AC97 Slot Select */
63*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_BM4_SEL	0x00080000	/* Audio Bus Master 4 AC97 Slot Select */
64*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_STS_NEW	0x00020000	/* Codec Status New (Read to Clear) */
65*d14a5417SJérôme Duval # define ACC_CODEC_STATUS_STS_DATA_MASK	0x0000ffff	/* Codec Status Data (Read Only) */
66*d14a5417SJérôme Duval 
67*d14a5417SJérôme Duval #define ACC_CODEC_CNTL			0x0c		/* Codec Control Register */
68*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_RW_CMD		0x80000000	/* Codec Read/Write Command */
69*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_READ_CMD	0x80000000	/* Codec Read Command */
70*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_WRITE_CMD	0x00000000	/* Codec Write Command */
71*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_ADD_MASK	0x7f000000	/* CMD_ADD Codec Command Address */
72*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_COMM_SEL_MASK	0x00c00000	/* COMM_SEL Audio Codec Communication */
73*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_PD_PRIM		0x00200000	/* Power-down Semaphore for Primary Codec */
74*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_PD_SEC		0x00100000	/* Power-down Semaphore for Secondary Codec */
75*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_LNK_SHTDWN	0x00040000	/* AC Link Shutdown */
76*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_LNK_WRM_RST	0x00020000	/* AC Link Warm Reset */
77*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_CMD_NEW		0x00010000	/* Codec Command New */
78*d14a5417SJérôme Duval # define ACC_CODEC_CNTL_CMD_DATA_MASK	0x0000ffff	/* Codec Command Data */
79*d14a5417SJérôme Duval 
80*d14a5417SJérôme Duval #define ACC_IRQ_STATUS			0x12		/* Second Level Audio IRQ Status Register */
81*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM7_IRQ_STS	0x0200		/* Audio Bus Master 7 IRQ Status */
82*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM6_IRQ_STS	0x0100		/* Audio Bus Master 6 IRQ Status */
83*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM5_IRQ_STS	0x0080		/* Audio Bus Master 5 IRQ Status */
84*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM4_IRQ_STS	0x0040		/* Audio Bus Master 4 IRQ Status */
85*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM3_IRQ_STS	0x0020		/* Audio Bus Master 3 IRQ Status */
86*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM2_IRQ_STS	0x0010		/* Audio Bus Master 2 IRQ Status */
87*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM1_IRQ_STS	0x0008		/* Audio Bus Master 1 IRQ Status */
88*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_BM0_IRQ_STS	0x0004		/* Audio Bus Master 0 IRQ Status */
89*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_WU_IRQ_STS	0x0002		/* Codec GPIO Wakeup IRQ Status */
90*d14a5417SJérôme Duval # define ACC_IRQ_STATUS_IRQ_STS		0x0001		/* Codec GPIO IRQ Status */
91*d14a5417SJérôme Duval 
92*d14a5417SJérôme Duval #define ACC_ENGINE_CNTL			0x14		/* Bus Master Engine Control Register */
93*d14a5417SJérôme Duval # define ACC_ENGINE_CNTL_SSND_MODE	0x00000001	/* Surround Sound (5.1) Synchronization Mode */
94*d14a5417SJérôme Duval 
95*d14a5417SJérôme Duval #define ACC_BM0_CMD			0x20		/* Bus Master 0 Command */
96*d14a5417SJérôme Duval #define ACC_BM0_STATUS			0x21		/* Bus Master 0 IRQ Status */
97*d14a5417SJérôme Duval #define ACC_BM0_PRD			0x24		/* Bus Master 0 PRD Table Address */
98*d14a5417SJérôme Duval #define ACC_BM1_CMD			0x28		/* Bus Master 1 Command */
99*d14a5417SJérôme Duval #define ACC_BM1_STATUS			0x29		/* Bus Master 1 IRQ Status */
100*d14a5417SJérôme Duval #define ACC_BM1_PRD			0x2c		/* Bus Master 1 PRD Table Address */
101*d14a5417SJérôme Duval #define ACC_BM2_CMD			0x30		/* Bus Master 2 Command */
102*d14a5417SJérôme Duval #define ACC_BM2_STATUS			0x31		/* Bus Master 2 IRQ Status */
103*d14a5417SJérôme Duval #define ACC_BM2_PRD			0x34		/* Bus Master 2 PRD Table Address */
104*d14a5417SJérôme Duval #define ACC_BM3_CMD			0x38		/* Bus Master 3 Command */
105*d14a5417SJérôme Duval #define ACC_BM3_STATUS			0x39		/* Bus Master 3 IRQ Status */
106*d14a5417SJérôme Duval #define ACC_BM3_PRD			0x3c		/* Bus Master 3 PRD Table Address */
107*d14a5417SJérôme Duval #define ACC_BM4_CMD			0x40		/* Bus Master 4 Command */
108*d14a5417SJérôme Duval #define ACC_BM4_STATUS			0x41		/* Bus Master 4 IRQ Status */
109*d14a5417SJérôme Duval #define ACC_BM4_PRD			0x44		/* Bus Master 4 PRD Table Address */
110*d14a5417SJérôme Duval #define ACC_BM5_CMD			0x48		/* Bus Master 5 Command */
111*d14a5417SJérôme Duval #define ACC_BM5_STATUS			0x49		/* Bus Master 5 IRQ Status */
112*d14a5417SJérôme Duval #define ACC_BM5_PRD			0x4c		/* Bus Master 5 PRD Table Address */
113*d14a5417SJérôme Duval #define ACC_BM6_CMD			0x50		/* Bus Master 6 Command */
114*d14a5417SJérôme Duval #define ACC_BM6_STATUS			0x51		/* Bus Master 6 IRQ Status */
115*d14a5417SJérôme Duval #define ACC_BM6_PRD			0x54		/* Bus Master 6 PRD Table Address */
116*d14a5417SJérôme Duval #define ACC_BM7_CMD			0x58		/* Bus Master 7 Command */
117*d14a5417SJérôme Duval #define ACC_BM7_STATUS			0x59		/* Bus Master 7 IRQ Status */
118*d14a5417SJérôme Duval #define ACC_BM7_PRD			0x5c		/* Bus Master 7 PRD Table Address */
119*d14a5417SJérôme Duval # define ACC_BMx_CMD_RW_MASK		0x08
120*d14a5417SJérôme Duval # define ACC_BMx_CMD_READ		0x08		/* Codec to Memory */
121*d14a5417SJérôme Duval # define ACC_BMx_CMD_WRITE		0x00		/* Memory to Codec */
122*d14a5417SJérôme Duval # define ACC_BMx_CMD_BYTE_ORD_MASK	0x04
123*d14a5417SJérôme Duval # define ACC_BMx_CMD_BYTE_ORD_EL	0x00		/* Little Endian */
124*d14a5417SJérôme Duval # define ACC_BMx_CMD_BYTE_ORD_EB	0x04		/* Big Endian */
125*d14a5417SJérôme Duval # define ACC_BMx_CMD_BM_CTL_MASK	0x03
126*d14a5417SJérôme Duval # define ACC_BMx_CMD_BM_CTL_DISABLE	0x00		/* Disable bus master */
127*d14a5417SJérôme Duval # define ACC_BMx_CMD_BM_CTL_ENABLE	0x01		/* Enable bus master */
128*d14a5417SJérôme Duval # define ACC_BMx_CMD_BM_CTL_PAUSE	0x03		/* Pause bus master */
129*d14a5417SJérôme Duval # define ACC_BMx_STATUS_BM_EOP_ERR	0x02		/* Bus Master Error */
130*d14a5417SJérôme Duval # define ACC_BMx_STATUS_EOP		0x01		/* End of Page */
131*d14a5417SJérôme Duval 
132*d14a5417SJérôme Duval /* PRD - Physical Region Descriptor Table (addressed by ACC_BMx_PRD) */
133*d14a5417SJérôme Duval struct acc_prd {
134*d14a5417SJérôme Duval 	uint32 address;
135*d14a5417SJérôme Duval 	uint32 ctrlsize;
136*d14a5417SJérôme Duval #define ACC_BMx_PRD_CTRL_EOT		0x80000000
137*d14a5417SJérôme Duval #define ACC_BMx_PRD_CTRL_EOP		0x40000000
138*d14a5417SJérôme Duval #define ACC_BMx_PRD_CTRL_JMP		0x20000000
139*d14a5417SJérôme Duval #define ACC_BMx_PRD_SIZE_MASK		0x0000ffff
140*d14a5417SJérôme Duval };
141*d14a5417SJérôme Duval 
142*d14a5417SJérôme Duval #define ACC_BM0_PNTR			0x60		/* Bus Master 0 DMA Pointer */
143*d14a5417SJérôme Duval #define ACC_BM1_PNTR			0x64		/* Bus Master 1 DMA Pointer */
144*d14a5417SJérôme Duval #define ACC_BM2_PNTR			0x68		/* Bus Master 2 DMA Pointer */
145*d14a5417SJérôme Duval #define ACC_BM3_PNTR			0x6C		/* Bus Master 3 DMA Pointer */
146*d14a5417SJérôme Duval #define ACC_BM4_PNTR			0x70		/* Bus Master 4 DMA Pointer */
147*d14a5417SJérôme Duval #define ACC_BM5_PNTR			0x74		/* Bus Master 5 DMA Pointer */
148*d14a5417SJérôme Duval #define ACC_BM6_PNTR			0x78		/* Bus Master 6 DMA Pointer */
149*d14a5417SJérôme Duval #define ACC_BM7_PNTR			0x7C		/* Bus Master 7 DMA Pointer */
150*d14a5417SJérôme Duval 
151*d14a5417SJérôme Duval #endif /* _I386_PCI_GCSCAUDIOREG_H_ */
152