/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _PPC_BOOT_DCR_H_
#define _PPC_BOOT_DCR_H_
#define mfdcr(rn) \
({ \
unsigned long rval; \
asm volatile ("mfdcr %0,%1" : "=r" (rval) : "i" (rn)); \
rval; \
})
#define mtdcr(rn, val) \
asm volatile ("mtdcr %0,%1" : : "i" (rn), "r" (val))
#define mfdcrx(rn) \
({ \
unsigned long rval; \
asm volatile ("mfdcrx %0,%1" : "=r" (rval) : "r" (rn)); \
rval; \
})
#define mtdcrx(rn, val) \
({ \
asm volatile ("mtdcrx %0,%1" : : "r" (rn), "r" (val)); \
})
/* 440GP/440GX SDRAM controller DCRs */
#define DCRN_SDRAM0_CFGADDR 0 x010
#define DCRN_SDRAM0_CFGDATA 0 x011
#define SDRAM0_READ(offset) ({\
mtdcr(DCRN_SDRAM0_CFGADDR, offset); \
mfdcr(DCRN_SDRAM0_CFGDATA); })
#define SDRAM0_WRITE(offset, data) ({\
mtdcr(DCRN_SDRAM0_CFGADDR, offset); \
mtdcr(DCRN_SDRAM0_CFGDATA, data); })
#define SDRAM0_B0CR 0 x40
#define SDRAM0_B1CR 0 x44
#define SDRAM0_B2CR 0 x48
#define SDRAM0_B3CR 0 x4c
static const unsigned long sdram_bxcr[] = { SDRAM0_B0CR, SDRAM0_B1CR,
SDRAM0_B2CR, SDRAM0_B3CR };
#define SDRAM_CONFIG_BANK_ENABLE 0 x00000001
#define SDRAM_CONFIG_SIZE_MASK 0 x000e0000
#define SDRAM_CONFIG_BANK_SIZE(reg) \
(0 x00400000 << ((reg & SDRAM_CONFIG_SIZE_MASK) >> 17 ))
/* 440GP External Bus Controller (EBC) */
#define DCRN_EBC0_CFGADDR 0 x012
#define DCRN_EBC0_CFGDATA 0 x013
#define EBC_NUM_BANKS 8
#define EBC_B0CR 0 x00
#define EBC_B1CR 0 x01
#define EBC_B2CR 0 x02
#define EBC_B3CR 0 x03
#define EBC_B4CR 0 x04
#define EBC_B5CR 0 x05
#define EBC_B6CR 0 x06
#define EBC_B7CR 0 x07
#define EBC_BXCR(n) (n)
#define EBC_BXCR_BAS 0 xfff00000
#define EBC_BXCR_BS 0 x000e0000
#define EBC_BXCR_BANK_SIZE(reg) \
(0 x100000 << (((reg) & EBC_BXCR_BS) >> 17 ))
#define EBC_BXCR_BU 0 x00018000
#define EBC_BXCR_BU_OFF 0 x00000000
#define EBC_BXCR_BU_RO 0 x00008000
#define EBC_BXCR_BU_WO 0 x00010000
#define EBC_BXCR_BU_RW 0 x00018000
#define EBC_BXCR_BW 0 x00006000
#define EBC_B0AP 0 x10
#define EBC_B1AP 0 x11
#define EBC_B2AP 0 x12
#define EBC_B3AP 0 x13
#define EBC_B4AP 0 x14
#define EBC_B5AP 0 x15
#define EBC_B6AP 0 x16
#define EBC_B7AP 0 x17
#define EBC_BXAP(n) (0 x10+(n))
#define EBC_BEAR 0 x20
#define EBC_BESR 0 x21
#define EBC_CFG 0 x23
#define EBC_CID 0 x24
/* 440GP Clock, PM, chip control */
#define DCRN_CPC0_SR 0 x0b0
#define DCRN_CPC0_ER 0 x0b1
#define DCRN_CPC0_FR 0 x0b2
#define DCRN_CPC0_SYS0 0 x0e0
#define CPC0_SYS0_TUNE 0 xffc00000
#define CPC0_SYS0_FBDV_MASK 0 x003c0000
#define CPC0_SYS0_FWDVA_MASK 0 x00038000
#define CPC0_SYS0_FWDVB_MASK 0 x00007000
#define CPC0_SYS0_OPDV_MASK 0 x00000c00
#define CPC0_SYS0_EPDV_MASK 0 x00000300
/* Helper macros to compute the actual clock divider values from the
* encodings in the CPC0 register */
#define CPC0_SYS0_FBDV(reg) \
((((((reg) & CPC0_SYS0_FBDV_MASK) >> 18 ) - 1 ) & 0 xf) + 1 )
#define CPC0_SYS0_FWDVA(reg) \
(8 - (((reg) & CPC0_SYS0_FWDVA_MASK) >> 15 ))
#define CPC0_SYS0_FWDVB(reg) \
(8 - (((reg) & CPC0_SYS0_FWDVB_MASK) >> 12 ))
#define CPC0_SYS0_OPDV(reg) \
((((reg) & CPC0_SYS0_OPDV_MASK) >> 10 ) + 1 )
#define CPC0_SYS0_EPDV(reg) \
((((reg) & CPC0_SYS0_EPDV_MASK) >> 8 ) + 1 )
#define CPC0_SYS0_EXTSL 0 x00000080
#define CPC0_SYS0_RW_MASK 0 x00000060
#define CPC0_SYS0_RL 0 x00000010
#define CPC0_SYS0_ZMIISL_MASK 0 x0000000c
#define CPC0_SYS0_BYPASS 0 x00000002
#define CPC0_SYS0_NTO1 0 x00000001
#define DCRN_CPC0_SYS1 0 x0e1
#define DCRN_CPC0_CUST0 0 x0e2
#define DCRN_CPC0_CUST1 0 x0e3
#define DCRN_CPC0_STRP0 0 x0e4
#define DCRN_CPC0_STRP1 0 x0e5
#define DCRN_CPC0_STRP2 0 x0e6
#define DCRN_CPC0_STRP3 0 x0e7
#define DCRN_CPC0_GPIO 0 x0e8
#define DCRN_CPC0_PLB 0 x0e9
#define DCRN_CPC0_CR1 0 x0ea
#define DCRN_CPC0_CR0 0 x0eb
#define CPC0_CR0_SWE 0 x80000000
#define CPC0_CR0_CETE 0 x40000000
#define CPC0_CR0_U1FCS 0 x20000000
#define CPC0_CR0_U0DTE 0 x10000000
#define CPC0_CR0_U0DRE 0 x08000000
#define CPC0_CR0_U0DC 0 x04000000
#define CPC0_CR0_U1DTE 0 x02000000
#define CPC0_CR0_U1DRE 0 x01000000
#define CPC0_CR0_U1DC 0 x00800000
#define CPC0_CR0_U0EC 0 x00400000
#define CPC0_CR0_U1EC 0 x00200000
#define CPC0_CR0_UDIV_MASK 0 x001f0000
#define CPC0_CR0_UDIV(reg) \
((((reg) & CPC0_CR0_UDIV_MASK) >> 16 ) + 1 )
#define DCRN_CPC0_MIRQ0 0 x0ec
#define DCRN_CPC0_MIRQ1 0 x0ed
#define DCRN_CPC0_JTAGID 0 x0ef
#define DCRN_MAL0_CFG 0 x180
#define MAL_RESET 0 x80000000
/* 440EP Clock/Power-on Reset regs */
#define DCRN_CPR0_ADDR 0 xc
#define DCRN_CPR0_DATA 0 xd
#define CPR0_PLLD0 0 x60
#define CPR0_OPBD0 0 xc0
#define CPR0_PERD0 0 xe0
#define CPR0_PRIMBD0 0 xa0
#define CPR0_SCPID 0 x120
#define CPR0_PLLC0 0 x40
/* 440GX/405EX Clock Control reg */
#define DCRN_CPR0_CLKUPD 0 x020
#define DCRN_CPR0_PLLC 0 x040
#define DCRN_CPR0_PLLD 0 x060
#define DCRN_CPR0_PRIMAD 0 x080
#define DCRN_CPR0_PRIMBD 0 x0a0
#define DCRN_CPR0_OPBD 0 x0c0
#define DCRN_CPR0_PERD 0 x0e0
#define DCRN_CPR0_MALD 0 x100
#define DCRN_SDR0_CONFIG_ADDR 0 xe
#define DCRN_SDR0_CONFIG_DATA 0 xf
/* SDR read/write helper macros */
#define SDR0_READ(offset) ({\
mtdcr(DCRN_SDR0_CONFIG_ADDR, offset); \
mfdcr(DCRN_SDR0_CONFIG_DATA); })
#define SDR0_WRITE(offset, data) ({\
mtdcr(DCRN_SDR0_CONFIG_ADDR, offset); \
mtdcr(DCRN_SDR0_CONFIG_DATA, data); })
#define DCRN_SDR0_UART0 0 x0120
#define DCRN_SDR0_UART1 0 x0121
#define DCRN_SDR0_UART2 0 x0122
#define DCRN_SDR0_UART3 0 x0123
/* CPRs read/write helper macros - based off include/asm-ppc/ibm44x.h */
#define DCRN_CPR0_CFGADDR 0 xc
#define DCRN_CPR0_CFGDATA 0 xd
#define CPR0_READ(offset) ({\
mtdcr(DCRN_CPR0_CFGADDR, offset); \
mfdcr(DCRN_CPR0_CFGDATA); })
#define CPR0_WRITE(offset, data) ({\
mtdcr(DCRN_CPR0_CFGADDR, offset); \
mtdcr(DCRN_CPR0_CFGDATA, data); })
#endif /* _PPC_BOOT_DCR_H_ */
Messung V0.5 in Prozent C=95 H=92 G=93
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-08)
¤
*© Formatika GbR, Deutschland