2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2004-10-10 21:21:55 +00:00
|
|
|
/*
|
2011-09-15 06:52:34 +00:00
|
|
|
* Copyright 2004, 2011 Freescale Semiconductor.
|
2004-10-10 21:21:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <common.h>
|
2021-12-14 18:36:40 +00:00
|
|
|
#include <clock_legacy.h>
|
2004-10-10 21:21:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CADMUS Board System Registers
|
|
|
|
*/
|
2023-01-10 16:19:45 +00:00
|
|
|
#ifndef CFG_SYS_CADMUS_BASE_REG
|
|
|
|
#define CFG_SYS_CADMUS_BASE_REG (CADMUS_BASE_ADDR + 0x4000)
|
2004-10-10 21:21:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct cadmus_reg {
|
|
|
|
u_char cm_ver; /* Board version */
|
|
|
|
u_char cm_csr; /* General control/status */
|
|
|
|
u_char cm_rst; /* Reset control */
|
|
|
|
u_char cm_hsclk; /* High speed clock */
|
|
|
|
u_char cm_hsxclk; /* High speed clock extended */
|
|
|
|
u_char cm_led; /* LED data */
|
|
|
|
u_char cm_pci; /* PCI control/status */
|
|
|
|
u_char cm_dma; /* DMA control */
|
|
|
|
u_char cm_reserved[248]; /* Total 256 bytes */
|
|
|
|
} cadmus_reg_t;
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
get_board_version(void)
|
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
volatile cadmus_reg_t *cadmus = (cadmus_reg_t *)CFG_SYS_CADMUS_BASE_REG;
|
2004-10-10 21:21:55 +00:00
|
|
|
|
|
|
|
return cadmus->cm_ver;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned long
|
2021-12-14 18:36:39 +00:00
|
|
|
get_board_sys_clk(void)
|
2004-10-10 21:21:55 +00:00
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
volatile cadmus_reg_t *cadmus = (cadmus_reg_t *)CFG_SYS_CADMUS_BASE_REG;
|
2004-10-10 21:21:55 +00:00
|
|
|
|
|
|
|
uint pci1_speed = (cadmus->cm_pci >> 2) & 0x3; /* PSPEED in [4:5] */
|
|
|
|
|
|
|
|
if (pci1_speed == 0) {
|
2011-09-15 06:52:34 +00:00
|
|
|
return 33333333;
|
2004-10-10 21:21:55 +00:00
|
|
|
} else if (pci1_speed == 1) {
|
2011-09-15 06:52:34 +00:00
|
|
|
return 66666666;
|
2004-10-10 21:21:55 +00:00
|
|
|
} else {
|
|
|
|
/* Really, unknown. Be safe? */
|
2011-09-15 06:52:34 +00:00
|
|
|
return 33333333;
|
2004-10-10 21:21:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
get_pci_slot(void)
|
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
volatile cadmus_reg_t *cadmus = (cadmus_reg_t *)CFG_SYS_CADMUS_BASE_REG;
|
2004-10-10 21:21:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PCI slot in USER bits CSR[6:7] by convention.
|
|
|
|
*/
|
|
|
|
return ((cadmus->cm_csr >> 6) & 0x3) + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
get_pci_dual(void)
|
|
|
|
{
|
2023-01-10 16:19:45 +00:00
|
|
|
volatile cadmus_reg_t *cadmus = (cadmus_reg_t *)CFG_SYS_CADMUS_BASE_REG;
|
2004-10-10 21:21:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PCI DUAL in CM_PCI[3]
|
|
|
|
*/
|
|
|
|
return cadmus->cm_pci & 0x10;
|
|
|
|
}
|