/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* mc3.c */
#include "common.h"
#include "regs.h"
#include "mc3.h"
#ifdef CONFIG_CHELSIO_T1_1G
# include "fpga_defs.h"
#endif
struct pemc3 {
unsigned int size;
};
{
#ifdef CONFIG_CHELSIO_T1_1G
} else {
#endif
}
}
{
pl_intr & ~F_PL_INTR_MC3);
#ifdef CONFIG_CHELSIO_T1_1G
} else {
#endif
}
}
{
/*
* Workaround for T1B bug: we must write to enable
* register to clear interrupts.
*/
0xffffffff);
} else
0xffffffff);
#ifdef CONFIG_CHELSIO_T1_1G
} else {
0xffffffff);
#endif
}
}
{
#ifdef CONFIG_CHELSIO_T1_1G
if (!t1_is_asic(adapter))
#endif
if (cause & F_MC3_CORR_ERR) {
CH_WARN("%s: MC3 correctable error at addr 0x%x, "
"data 0x%x 0x%x 0x%x 0x%x 0x%x\n",
}
if (cause & F_MC3_UNCORR_ERR) {
CH_ALERT("%s: MC3 uncorrectable error at addr 0x%x, "
"data 0x%x 0x%x 0x%x 0x%x 0x%x\n",
}
if (G_MC3_PARITY_ERR(cause)) {
}
if (cause & F_MC3_ADDR_ERR) {
}
if (cause & MC3_INTR_FATAL)
/*
* Workaround for T1B bug: we must write to enable register to
* clear interrupts.
*/
/* restore enable */
} else
return 0;
}
/*
* Write a value to a register and check that the write completed. These
* writes normally complete in a cycle or two, so one read should suffice.
* The very first read exists to flush the posted write to the device.
*/
{
return 0;
CH_ERR("%s: write to MC3 register 0x%x timed out\n",
return -EIO;
}
{
/* Check to see if ASIC is running in slow mode. */
if (mc3_clock <= 100000000)
else if (mc3_clock <= 133000000)
else
if (fast_asic) { /* setup DLLs */
val & ~F_SLAVE_DLL_RESET);
/* Wait for slave DLLs to lock */
} else {
/* Initialize the master DLL and slave delay lines. */
val & ~F_MASTER_DLL_RESET);
/* Wait for the master DLL to lock. */
attempts = 100;
do {
DELAY_US(1);
if (!(val & MC3_DLL_DONE)) {
CH_ERR("%s: MC3 DLL lock failed\n",
goto out_fail;
}
}
}
/* Initiate a precharge and wait for the precharge to complete. */
goto out_fail;
/* Set the SDRAM output drive strength and enable DLLs if needed */
goto out_fail;
/* Specify the SDRAM operating parameters. */
goto out_fail;
/* Initiate a precharge and wait for the precharge to complete. */
goto out_fail;
/* Initiate an immediate refresh and wait for the write to complete. */
goto out_fail;
/* 2nd immediate refresh as before */
goto out_fail;
/* Specify the SDRAM operating parameters. */
goto out_fail;
/* Convert to KHz first to avoid 64-bit division. */
/* Enable periodic refresh. */
/* Use the BIST engine to clear MC3 memory and initialize ECC. */
attempts = 100;
do {
DELAY_MS(100);
goto out_fail;
}
/* Enable normal memory accesses. */
return 0;
return -1;
}
{
}
{
if (mc3) {
}
return mc3;
}
{
}
{
}
{
}