|
|
|
|
@@ -179,7 +179,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
#define REG32(x) (*(volatile unsigned *)(x))
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* MSC
|
|
|
|
|
* MSC mmc/sd controller
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define MSC_STRPCL REG16 (MSC_BASE + 0x000)
|
|
|
|
|
#define MSC_STAT REG32 (MSC_BASE + 0x004)
|
|
|
|
|
@@ -302,7 +302,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* RTC
|
|
|
|
|
* RTC real-time clock
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define RTC_RCR REG32 (RTC_BASE + 0x00)
|
|
|
|
|
#define RTC_RSR REG32 (RTC_BASE + 0x04)
|
|
|
|
|
@@ -326,7 +326,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* FIR
|
|
|
|
|
* FIR fast infrared(?)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define FIR_TDR REG8 (FIR_BASE + 0x000)
|
|
|
|
|
#define FIR_RDR REG8 (FIR_BASE + 0x004)
|
|
|
|
|
@@ -389,7 +389,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* SCC
|
|
|
|
|
* SCC smart card controller (unused in trendtac)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define SCC_DR(base) REG8 ((base) + 0x000)
|
|
|
|
|
#define SCC_FDR(base) REG8 ((base) + 0x004)
|
|
|
|
|
@@ -456,7 +456,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* ETH
|
|
|
|
|
* ETH ethernet
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define ETH_BMR REG32 (ETH_BASE + 0x1000)
|
|
|
|
|
#define ETH_TPDR REG32 (ETH_BASE + 0x1004)
|
|
|
|
|
@@ -692,7 +692,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* WDT
|
|
|
|
|
* WDT watch-dog timer
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define WDT_WTCSR REG8 (WDT_BASE + 0x00)
|
|
|
|
|
#define WDT_WTCNT REG32 (WDT_BASE + 0x04)
|
|
|
|
|
@@ -703,7 +703,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* OST
|
|
|
|
|
* OST operating system timer
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define OST_TER REG8 (OST_BASE + 0x00)
|
|
|
|
|
#define OST_TRDR(n) REG32 (OST_BASE + 0x10 + ((n) * 0x20))
|
|
|
|
|
@@ -723,21 +723,8 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
#define OST_TCSR_CKS_RTCCLK (4 << OST_TCSR_CKS_BIT)
|
|
|
|
|
#define OST_TCSR_CKS_EXTAL (5 << OST_TCSR_CKS_BIT)
|
|
|
|
|
|
|
|
|
|
#define OST_TCSR0 OST_TCSR(0)
|
|
|
|
|
#define OST_TCSR1 OST_TCSR(1)
|
|
|
|
|
#define OST_TCSR2 OST_TCSR(2)
|
|
|
|
|
#define OST_TRDR0 OST_TRDR(0)
|
|
|
|
|
#define OST_TRDR1 OST_TRDR(1)
|
|
|
|
|
#define OST_TRDR2 OST_TRDR(2)
|
|
|
|
|
#define OST_TCNT0 OST_TCNT(0)
|
|
|
|
|
#define OST_TCNT1 OST_TCNT(1)
|
|
|
|
|
#define OST_TCNT2 OST_TCNT(2)
|
|
|
|
|
#define OST_TCRB0 OST_TCRB(0)
|
|
|
|
|
#define OST_TCRB1 OST_TCRB(1)
|
|
|
|
|
#define OST_TCRB2 OST_TCRB(2)
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* UART
|
|
|
|
|
* UART universal asynchronous receiver/transmitter (serial ports)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define IRDA_BASE UART0_BASE
|
|
|
|
|
@@ -924,7 +911,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* INTC
|
|
|
|
|
* INTC interrupt controller
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define INTC_ISR REG32 (INTC_BASE + 0x00)
|
|
|
|
|
#define INTC_IMR REG32 (INTC_BASE + 0x04)
|
|
|
|
|
@@ -965,7 +952,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* CIM
|
|
|
|
|
* CIM camera interface module (not used in trendtac)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define CIM_CFG REG32 (CIM_BASE + 0x0000)
|
|
|
|
|
#define CIM_CTRL REG32 (CIM_BASE + 0x0004)
|
|
|
|
|
@@ -1066,7 +1053,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* PWM
|
|
|
|
|
* PWM pulse width modulator: 0 is connected to lcd backlight; 1 maybe to a beeper
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define PWM_CTR(n) REG8 (PWM##n##_BASE + 0x000)
|
|
|
|
|
#define PWM_PER(n) REG16 (PWM##n##_BASE + 0x004)
|
|
|
|
|
@@ -1094,7 +1081,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* EMC
|
|
|
|
|
* EMC ?
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define EMC_BCR REG32 (EMC_BASE + 0x00)
|
|
|
|
|
#define EMC_SMCR0 REG32 (EMC_BASE + 0x10)
|
|
|
|
|
@@ -1305,7 +1292,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* GPIO
|
|
|
|
|
* GPIO general purpose input/output
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define GPIO_GPDR(n) REG32 (GPIO_BASE + (0x00 + (n)*0x30))
|
|
|
|
|
#define GPIO_GPDIR(n) REG32 (GPIO_BASE + (0x04 + (n)*0x30))
|
|
|
|
|
@@ -1329,7 +1316,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* HARB
|
|
|
|
|
* HARB ?
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define HARB_HAPOR REG32 (HARB_BASE + 0x000)
|
|
|
|
|
#define HARB_HMCTR REG32 (HARB_BASE + 0x010)
|
|
|
|
|
@@ -1383,7 +1370,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* I2C
|
|
|
|
|
* I2C inter-IC
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define I2C_DR REG8 (I2C_BASE + 0x000)
|
|
|
|
|
#define I2C_CR REG8 (I2C_BASE + 0x004)
|
|
|
|
|
@@ -1410,7 +1397,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* UDC
|
|
|
|
|
* UDC usb device controller (unused in trendtac)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define UDC_EP0InCR REG32 (UDC_BASE + 0x00)
|
|
|
|
|
#define UDC_EP0InSR REG32 (UDC_BASE + 0x04)
|
|
|
|
|
@@ -1585,7 +1572,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* DMAC
|
|
|
|
|
* DMAC dma controller
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define DMAC_DSAR(n) REG32 (DMAC_BASE + (0x00 + (n) * 0x20))
|
|
|
|
|
#define DMAC_DDAR(n) REG32 (DMAC_BASE + (0x04 + (n) * 0x20))
|
|
|
|
|
@@ -1739,7 +1726,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* AIC
|
|
|
|
|
* AIC ac97/i2s controller (sound)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define AIC_FR REG32 (AIC_BASE + 0x000)
|
|
|
|
|
#define AIC_CR REG32 (AIC_BASE + 0x004)
|
|
|
|
|
@@ -1900,7 +1887,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* LCD
|
|
|
|
|
* LCD liquid crystal display
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define LCD_CFG REG32 (LCD_BASE + 0x00)
|
|
|
|
|
#define LCD_VSYNC REG32 (LCD_BASE + 0x04)
|
|
|
|
|
@@ -2019,7 +2006,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* DES
|
|
|
|
|
* DES ?
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define DES_CR1 REG32 (DES_BASE + 0x000)
|
|
|
|
|
#define DES_CR2 REG32 (DES_BASE + 0x004)
|
|
|
|
|
@@ -2059,7 +2046,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* CPM
|
|
|
|
|
* CPM C? power management
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define CPM_CFCR REG32 (CPM_BASE+0x00)
|
|
|
|
|
#define CPM_PLCR1 REG32 (CPM_BASE+0x10)
|
|
|
|
|
@@ -2183,7 +2170,7 @@ static void __map_io (unsigned physical, unsigned mapping):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* SSI
|
|
|
|
|
* SSI ? (audio serial bus?)
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
#define SSI_DR REG32 (SSI_BASE + 0x001)
|
|
|
|
|
#define SSI_CR0 REG16 (SSI_BASE + 0x004)
|
|
|
|
|
@@ -2323,8 +2310,10 @@ static __inline__ void udelay (unsigned us):
|
|
|
|
|
for unsigned k = 0; k < 100; ++k:
|
|
|
|
|
GPIO_GPDR (0) = GPIO_GPDR (0)
|
|
|
|
|
|
|
|
|
|
#ifndef __KERNEL
|
|
|
|
|
static __inline__ void mdelay (unsigned ms):
|
|
|
|
|
udelay (1000 * ms)
|
|
|
|
|
my_sleep ((ms + 99) / 100)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
* MSC
|
|
|
|
|
@@ -2647,18 +2636,17 @@ static __inline__ unsigned msc_calc_slow_clk_divisor (bool is_sd):
|
|
|
|
|
#define ost_disable_all() ( OST_TER &= ~0x07 )
|
|
|
|
|
#define ost_enable_channel(n) ( OST_TER |= (1 << (n)) )
|
|
|
|
|
#define ost_disable_channel(n) ( OST_TER &= ~(1 << (n)) )
|
|
|
|
|
#define ost_set_reload(n, val) ( OST_TRDR(n) = (val) )
|
|
|
|
|
#define ost_set_count(n, val) ( OST_TCNT(n) = (val) )
|
|
|
|
|
#define ost_get_count(n) ( OST_TCNT(n) )
|
|
|
|
|
#define ost_set_clock(n, cs) do { OST_TCSR(n) &= ~OST_TCSR_CKS_MASK; OST_TCSR(n) |= cs; } while (0)
|
|
|
|
|
#define ost_set_mode(n, val) ( OST_TCSR(n) = (val) )
|
|
|
|
|
#define ost_enable_interrupt(n) ( OST_TCSR(n) |= OST_TCSR_UIE )
|
|
|
|
|
#define ost_disable_interrupt(n) ( OST_TCSR(n) &= ~OST_TCSR_UIE )
|
|
|
|
|
#define ost_uf_detected(n) ( OST_TCSR(n) & OST_TCSR_UF )
|
|
|
|
|
#define ost_clear_uf(n) ( OST_TCSR(n) &= ~OST_TCSR_UF )
|
|
|
|
|
#define ost_is_busy(n) ( OST_TCSR(n) & OST_TCSR_BUSY )
|
|
|
|
|
#define ost_clear_busy(n) ( OST_TCSR(n) &= ~OST_TCSR_BUSY )
|
|
|
|
|
|
|
|
|
|
#define ost_set_reload(n, val) ( OST_TRDR (n) = (val) )
|
|
|
|
|
#define ost_set_count(n, val) ( OST_TCNT (n) = (val) )
|
|
|
|
|
#define ost_get_count(n) ( OST_TCNT (n) )
|
|
|
|
|
#define ost_set_clock(n, cs) ( OST_TCSR (n) = OST_TCSR (n) & ~OST_TCSR_CKS_MASK | (cs) )
|
|
|
|
|
#define ost_set_mode(n, val) ( OST_TCSR (n) = (val) )
|
|
|
|
|
#define ost_enable_interrupt(n) ( OST_TCSR (n) |= OST_TCSR_UIE )
|
|
|
|
|
#define ost_disable_interrupt(n) ( OST_TCSR (n) &= ~OST_TCSR_UIE )
|
|
|
|
|
#define ost_uf_detected(n) ( OST_TCSR (n) & OST_TCSR_UF )
|
|
|
|
|
#define ost_clear_uf(n) ( OST_TCSR (n) &= ~OST_TCSR_UF )
|
|
|
|
|
#define ost_is_busy(n) ( OST_TCSR (n) & OST_TCSR_BUSY )
|
|
|
|
|
#define ost_clear_busy(n) ( OST_TCSR (n) &= ~OST_TCSR_BUSY )
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
* UART
|
|
|
|
|
@@ -3790,18 +3778,6 @@ static __inline__ void i2s_reset_codec ():
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
* CPM
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
static __inline__ unsigned int get_pllout ():
|
|
|
|
|
unsigned plcr = CPM_PLCR1
|
|
|
|
|
if plcr & CPM_PLCR1_PLL1EN:
|
|
|
|
|
unsigned nf, nr, no
|
|
|
|
|
unsigned od[4] = {1, 2, 2, 4}
|
|
|
|
|
nf = (plcr & CPM_PLCR1_PLL1FD_MASK) >> CPM_PLCR1_PLL1FD_BIT
|
|
|
|
|
nr = (plcr & CPM_PLCR1_PLL1RD_MASK) >> CPM_PLCR1_PLL1RD_BIT
|
|
|
|
|
no = od[((plcr & CPM_PLCR1_PLL1OD_MASK) >> CPM_PLCR1_PLL1OD_BIT)]
|
|
|
|
|
return (JZ_EXTAL) / ((nr+2) * no) * (nf+2)
|
|
|
|
|
else:
|
|
|
|
|
return JZ_EXTAL
|
|
|
|
|
|
|
|
|
|
#define cpm_plcr1_fd() ((CPM_PLCR1 & CPM_PLCR1_PLL1FD_MASK) >> CPM_PLCR1_PLL1FD_BIT)
|
|
|
|
|
#define cpm_plcr1_rd() ((CPM_PLCR1 & CPM_PLCR1_PLL1RD_MASK) >> CPM_PLCR1_PLL1RD_BIT)
|
|
|
|
|
#define cpm_plcr1_od() ((CPM_PLCR1 & CPM_PLCR1_PLL1OD_MASK) >> CPM_PLCR1_PLL1OD_BIT)
|
|
|
|
|
|