blob: b235a2154b759154b2f5614e57d448a66e73a47a [file] [log] [blame]
Dave Chapmand16a8b82006-02-05 16:52:22 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2004 by Thom Johansen
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Dave Chapmand16a8b82006-02-05 16:52:22 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef __PP5002_H__
22#define __PP5002_H__
23
Jens Arnold604e44d2007-07-29 07:50:34 +000024/* Much info gleaned and/or copied from the iPodLinux project. */
Barry Wardell84b509d2007-01-28 18:42:11 +000025#define DRAM_START 0x28000000
26
Jens Arnold1f0d06f2007-10-07 16:44:55 +000027/* LCD bridge */
Jens Arnold8aeed2d2007-10-12 00:28:57 +000028#define LCD1_BASE 0xc0001000
Michael Sevakisda552512007-09-29 06:17:33 +000029
Jens Arnold8aeed2d2007-10-12 00:28:57 +000030#define LCD1_CONTROL (*(volatile unsigned long *)(0xc0001000))
31#define LCD1_CMD (*(volatile unsigned long *)(0xc0001008))
32#define LCD1_DATA (*(volatile unsigned long *)(0xc0001010))
33
34#define LCD1_BUSY_MASK 0x8000
Barry Wardell84b509d2007-01-28 18:42:11 +000035
Jens Arnold1f0d06f2007-10-07 16:44:55 +000036/* I2S controller */
Michael Sevakis6077e5b2007-10-06 22:27:27 +000037#define IISCONFIG (*(volatile unsigned long *)(0xc0002500))
Jens Arnold604e44d2007-07-29 07:50:34 +000038#define IISFIFO_CFG (*(volatile unsigned long *)(0xc000251c))
39#define IISFIFO_WR (*(volatile unsigned long *)(0xc0002540))
40#define IISFIFO_RD (*(volatile unsigned long *)(0xc0002580))
41
Michael Sevakis6077e5b2007-10-06 22:27:27 +000042/* IISCONFIG bits: */
43#define IIS_TXFIFOEN (1 << 2)
44#define IIS_TX_FREE_MASK (0xf << 23)
45#define IIS_TX_FREE_COUNT ((IISFIFO_CFG & IIS_TX_FREE_MASK) >> 23)
46
47/* IISFIFO_CFG bits: */
48#define IIS_IRQTX_REG IISFIFO_CFG
49#define IIS_IRQTX (1 << 9)
50
Jens Arnold174c7ab2007-08-01 10:43:45 +000051#define IDE_BASE 0xc0003000
52
53#define IDE_CFG_STATUS (*(volatile unsigned long *)(0xc0003024))
54
55#define USB_BASE 0xc0005000
56
Jens Arnold604e44d2007-07-29 07:50:34 +000057#define I2C_BASE 0xc0008000
58
Jens Arnold1f0d06f2007-10-07 16:44:55 +000059/* Processor ID */
60#define PROCESSOR_ID (*(volatile unsigned long *)(0xc4000000))
61
62#define PROC_ID_CPU 0x55
63#define PROC_ID_COP 0xaa
64
Dave Chapmanfb4e3842006-02-24 20:54:09 +000065#define GPIOA_ENABLE (*(volatile unsigned char *)(0xcf000000))
66#define GPIOB_ENABLE (*(volatile unsigned char *)(0xcf000004))
67#define GPIOC_ENABLE (*(volatile unsigned char *)(0xcf000008))
68#define GPIOD_ENABLE (*(volatile unsigned char *)(0xcf00000c))
69#define GPIOA_OUTPUT_EN (*(volatile unsigned char *)(0xcf000010))
70#define GPIOB_OUTPUT_EN (*(volatile unsigned char *)(0xcf000014))
71#define GPIOC_OUTPUT_EN (*(volatile unsigned char *)(0xcf000018))
72#define GPIOD_OUTPUT_EN (*(volatile unsigned char *)(0xcf00001c))
73#define GPIOA_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000020))
74#define GPIOB_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000024))
75#define GPIOC_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000028))
76#define GPIOD_OUTPUT_VAL (*(volatile unsigned char *)(0xcf00002c))
77#define GPIOA_INPUT_VAL (*(volatile unsigned char *)(0xcf000030))
78#define GPIOB_INPUT_VAL (*(volatile unsigned char *)(0xcf000034))
79#define GPIOC_INPUT_VAL (*(volatile unsigned char *)(0xcf000038))
80#define GPIOD_INPUT_VAL (*(volatile unsigned char *)(0xcf00003c))
81#define GPIOA_INT_STAT (*(volatile unsigned char *)(0xcf000040))
82#define GPIOB_INT_STAT (*(volatile unsigned char *)(0xcf000044))
83#define GPIOC_INT_STAT (*(volatile unsigned char *)(0xcf000048))
84#define GPIOD_INT_STAT (*(volatile unsigned char *)(0xcf00004c))
85#define GPIOA_INT_EN (*(volatile unsigned char *)(0xcf000050))
86#define GPIOB_INT_EN (*(volatile unsigned char *)(0xcf000054))
87#define GPIOC_INT_EN (*(volatile unsigned char *)(0xcf000058))
88#define GPIOD_INT_EN (*(volatile unsigned char *)(0xcf00005c))
89#define GPIOA_INT_LEV (*(volatile unsigned char *)(0xcf000060))
90#define GPIOB_INT_LEV (*(volatile unsigned char *)(0xcf000064))
91#define GPIOC_INT_LEV (*(volatile unsigned char *)(0xcf000068))
92#define GPIOD_INT_LEV (*(volatile unsigned char *)(0xcf00006c))
93#define GPIOA_INT_CLR (*(volatile unsigned char *)(0xcf000070))
94#define GPIOB_INT_CLR (*(volatile unsigned char *)(0xcf000074))
95#define GPIOC_INT_CLR (*(volatile unsigned char *)(0xcf000078))
96#define GPIOD_INT_CLR (*(volatile unsigned char *)(0xcf00007c))
Dave Chapmand16a8b82006-02-05 16:52:22 +000097
Jens Arnold604e44d2007-07-29 07:50:34 +000098#define CPU_INT_STAT (*(volatile unsigned long *)(0xcf001000))
Jens Arnoldfbfe6d62008-04-03 21:48:41 +000099#define COP_INT_STAT (*(volatile unsigned long *)(0xcf001004))
100#define CPU_FIQ_STAT (*(volatile unsigned long *)(0xcf001008))
101#define COP_FIQ_STAT (*(volatile unsigned long *)(0xcf00100c))
102
103#define INT_STAT (*(volatile unsigned long *)(0xcf001010))
104#define INT_FORCED_STAT (*(volatile unsigned long *)(0xcf001014))
105#define INT_FORCED_SET (*(volatile unsigned long *)(0xcf001018))
106#define INT_FORCED_CLR (*(volatile unsigned long *)(0xcf00101c))
107
108#define CPU_INT_EN_STAT (*(volatile unsigned long *)(0xcf001020))
Jens Arnold604e44d2007-07-29 07:50:34 +0000109#define CPU_INT_EN (*(volatile unsigned long *)(0xcf001024))
Michael Sevakis191320c2008-06-03 05:08:24 +0000110#define CPU_INT_DIS (*(volatile unsigned long *)(0xcf001028))
Jens Arnold604e44d2007-07-29 07:50:34 +0000111#define CPU_INT_PRIORITY (*(volatile unsigned long *)(0xcf00102c))
Jens Arnoldfbfe6d62008-04-03 21:48:41 +0000112
113#define COP_INT_EN_STAT (*(volatile unsigned long *)(0xcf001030))
Jens Arnold604e44d2007-07-29 07:50:34 +0000114#define COP_INT_EN (*(volatile unsigned long *)(0xcf001034))
Michael Sevakis191320c2008-06-03 05:08:24 +0000115#define COP_INT_DIS (*(volatile unsigned long *)(0xcf001038))
Jens Arnold604e44d2007-07-29 07:50:34 +0000116#define COP_INT_PRIORITY (*(volatile unsigned long *)(0xcf00103c))
Dave Chapmand16a8b82006-02-05 16:52:22 +0000117
118#define IDE_IRQ 1
119#define SER0_IRQ 4
120#define I2S_IRQ 5
121#define SER1_IRQ 7
122#define TIMER1_IRQ 11
Jens Arnold604e44d2007-07-29 07:50:34 +0000123#define TIMER2_IRQ 12
Dave Chapmand16a8b82006-02-05 16:52:22 +0000124#define GPIO_IRQ 14
125#define DMA_OUT_IRQ 30
126#define DMA_IN_IRQ 31
127
Jens Arnold604e44d2007-07-29 07:50:34 +0000128#define IDE_MASK (1 << IDE_IRQ)
129#define SER0_MASK (1 << SER0_IRQ)
130#define I2S_MASK (1 << I2S_IRQ)
131#define SER1_MASK (1 << SER1_IRQ)
132#define TIMER1_MASK (1 << TIMER1_IRQ)
133#define TIMER2_MASK (1 << TIMER2_IRQ)
134#define GPIO_MASK (1 << GPIO_IRQ)
135#define DMA_OUT_MASK (1 << DMA_OUT_IRQ)
136#define DMA_IN_MASK (1 << DMA_IN_IRQ)
Dave Chapmana1e2a522006-02-26 20:29:29 +0000137
Michael Sevakis6077e5b2007-10-06 22:27:27 +0000138/* Yes, there is I2S_MASK but this cleans up the pcm code */
139#define IIS_MASK DMA_OUT_MASK
Jens Arnold85568d62007-07-10 20:47:01 +0000140
Jens Arnold604e44d2007-07-29 07:50:34 +0000141#define TIMER1_CFG (*(volatile unsigned long *)(0xcf001100))
142#define TIMER1_VAL (*(volatile unsigned long *)(0xcf001104))
143#define TIMER2_CFG (*(volatile unsigned long *)(0xcf001108))
144#define TIMER2_VAL (*(volatile unsigned long *)(0xcf00110c))
Jens Arnold85568d62007-07-10 20:47:01 +0000145
Jens Arnold604e44d2007-07-29 07:50:34 +0000146#define USEC_TIMER (*(volatile unsigned long *)(0xcf001110))
Dave Chapmanfda14982007-02-23 23:22:03 +0000147
Jens Arnold604e44d2007-07-29 07:50:34 +0000148#define TIMING1_CTL (*(volatile unsigned long *)(0xcf004000))
149#define TIMING2_CTL (*(volatile unsigned long *)(0xcf004008))
Barry Wardell620c62e2007-02-16 22:28:07 +0000150
Jens Arnoldc9fca1e2007-11-03 08:09:07 +0000151#define PP_VER1 (*(volatile unsigned long *)(0xcf004030))
152#define PP_VER2 (*(volatile unsigned long *)(0xcf004034))
153#define PP_VER3 (*(volatile unsigned long *)(0xcf004038))
154#define PP_VER4 (*(volatile unsigned long *)(0xcf00403c))
155
Michael Sevakisa8b388f2007-11-27 01:20:26 +0000156/* Processors Control */
157#define PROC_STAT (*(volatile unsigned long *)(0xcf004050))
Jens Arnold604e44d2007-07-29 07:50:34 +0000158#define CPU_CTL (*(volatile unsigned char *)(0xcf004054))
159#define COP_CTL (*(volatile unsigned char *)(0xcf004058))
160
Michael Sevakisa8b388f2007-11-27 01:20:26 +0000161#define CPU_SLEEPING 0x8000
162#define COP_SLEEPING 0x4000
163#define PROC_SLEEPING(core) (0x8000 >> (core))
164
Michael Sevakisa9b2fb52007-10-16 01:25:17 +0000165#define PROC_CTL(core) ((&CPU_CTL)[(core)*4])
166
Jens Arnold604e44d2007-07-29 07:50:34 +0000167#define PROC_SLEEP 0xca
168#define PROC_WAKE 0xce
169
Michael Sevakisa8b388f2007-11-27 01:20:26 +0000170/* Cache Control */
171#define CACHE_CTL (*(volatile unsigned long *)(0xcf004024))
172#define CACHE_RUN 0x1
173#define CACHE_INIT 0x2
174
175#define CACHE_MASK (*(volatile unsigned long *)(0xf000f020))
176#define CACHE_OPERATION (*(volatile unsigned long *)(0xf000f024))
177#define CACHE_FLUSH_BASE (*(volatile unsigned long *)(0xf000c000))
178#define CACHE_INVALIDATE_BASE (*(volatile unsigned long *)(0xf0004000))
179#define CACHE_SIZE 0x2000 /* PP5002 has 8KB cache */
180
181#define CACHE_OP_UNKNOWN1 (1<<11) /* 0x800 */
Jens Arnold604e44d2007-07-29 07:50:34 +0000182
183#define DEV_EN (*(volatile unsigned long *)(0xcf005000))
184#define DEV_RS (*(volatile unsigned long *)(0xcf005030))
185
186#define DEV_I2C (1<<8)
187#define DEV_USB 0x400000
188
189#define CLOCK_ENABLE (*(volatile unsigned long *)(0xcf005008))
190#define CLOCK_SOURCE (*(volatile unsigned long *)(0xcf00500c))
191#define PLL_CONTROL (*(volatile unsigned long *)(0xcf005010))
192#define PLL_DIV (*(volatile unsigned long *)(0xcf005018))
193#define PLL_MULT (*(volatile unsigned long *)(0xcf00501c))
Jens Arnold1bc3b7f2007-07-31 10:56:50 +0000194#define PLL_UNLOCK (*(volatile unsigned long *)(0xcf005038))
Jens Arnold604e44d2007-07-29 07:50:34 +0000195
196#define MMAP0_LOGICAL (*(volatile unsigned long *)(0xf000f000))
197#define MMAP0_PHYSICAL (*(volatile unsigned long *)(0xf000f004))
198#define MMAP1_LOGICAL (*(volatile unsigned long *)(0xf000f008))
199#define MMAP1_PHYSICAL (*(volatile unsigned long *)(0xf000f00c))
200#define MMAP2_LOGICAL (*(volatile unsigned long *)(0xf000f010))
201#define MMAP2_PHYSICAL (*(volatile unsigned long *)(0xf000f014))
202#define MMAP3_LOGICAL (*(volatile unsigned long *)(0xf000f018))
203#define MMAP3_PHYSICAL (*(volatile unsigned long *)(0xf000f01c))
204
Dave Chapmand16a8b82006-02-05 16:52:22 +0000205#endif