diff --git a/src/ethboot/ethboot.c b/src/ethboot/ethboot.c
index a8fb492969b1268f75de32d948d6333a04043c7c..56c480e5789fd16ead74da3e50fec6cd6c3ede80 100644 (file)
--- a/src/ethboot/ethboot.c
+++ b/src/ethboot/ethboot.c
+/*
+ *
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
/*********************************************************************************
* FILE PURPOSE: The Ethernet boot wrapper
*********************************************************************************
#include "mdioapi.h"
#include <string.h>
#include "net_osal.h"
+#include "cpsw_api.h"
+#include "qm_api.h"
+#include "cpdma_api.h"
/**
* @brief Remove the possible re-definition of iblEthBoot. iblcfg.h defines this to be a void
void (*exit)();
uint8 buf[16];
char *ext;
-
-
+ unsigned int i,j;
/* Power up the device. No action is taken if the device is already powered up */
- if (devicePowerPeriph (TARGET_PWR_ETH(ibl.ethConfig[eIdx].port)) < 0)
+ if (devicePowerPeriph (TARGET_PWR_ETH(ibl.bootModes[eIdx].port)) < 0)
return;
/* Do any mdio configuration */
hwMdio (ibl.mdioConfig.nMdioOps, ibl.mdioConfig.mdio,
ibl.mdioConfig.mdioClkDiv, ibl.mdioConfig.interDelay);
+ for (j = 0; j < 0x100; j++)
+ for (i = 0; i < 0x1000000; i++);
/* SGMII configuration. If sgmii is not present this statement is defined
* to void in target.h */
- hwSgmiiConfig (ibl.ethConfig[eIdx].port, &ibl.sgmiiConfig[eIdx]);
+ for (n = 0; n < ibl_N_ETH_PORTS; n++) {
+ if (ibl.sgmiiConfig[eIdx].configure == TRUE)
+ hwSgmiiConfig (n, &ibl.sgmiiConfig[n]);
+ }
+
+
+#ifdef DEVICE_CPSW
+ /* On chip switch configuration */
+ hwCpswConfig (targetGetSwitchCtl(), targetGetSwitchMaxPktSize());
+#endif
+
+
+#ifdef DEVICE_QM
+ /* Queue manager configuration */
+ hwQmSetup ((qmConfig_t *)(targetGetQmConfig()));
+ targetInitQs ();
+#endif
+
+
+#ifdef DEVICE_CPDMA
+ /* Cpdma configuration. */
+ hwCpdmaRxConfig ((cpdmaRxCfg_t *)targetGetCpdmaRxConfig());
+ hwCpdmaTxConfig ((cpdmaTxCfg_t *)targetGetCpdmaTxConfig());
+#endif
+
+
+#ifdef DEVICE_PA
+ /* Packet accelerator configuration. If PA is not present this statement is defined
+ * to void in target.h */
+ targetPaConfig(ibl.bootModes[eIdx].u.ethBoot.ethInfo.hwAddress);
+#endif
- nDevice.port_num = ibl.ethConfig[eIdx].port;
+#ifdef DEVICE_SS
+ /* Streaming switch configuration. If not present this statement is defined to void
+ * in target.h. If present this is usually defined to a series of register writes */
+ hwConfigStreamingSwitch();
+#endif
+
+ nDevice.port_num = ibl.bootModes[eIdx].port;
/* Simple transation to initialize the driver */
- netMemcpy (nDevice.mac_address, ibl.ethConfig[eIdx].ethInfo.hwAddress, sizeof(nDevice.mac_address));
+ netMemcpy (nDevice.mac_address, ibl.bootModes[eIdx].u.ethBoot.ethInfo.hwAddress, sizeof(nDevice.mac_address));
- nl = FORM_IPN(ibl.ethConfig[eIdx].ethInfo.ipAddr);
- if (ibl.ethConfig[eIdx].doBootp == TRUE)
+ nl = FORM_IPN(ibl.bootModes[eIdx].u.ethBoot.ethInfo.ipAddr);
+ if (ibl.bootModes[eIdx].u.ethBoot.doBootp == TRUE)
nDevice.ip_address = 0;
else
nDevice.ip_address = htonl(nl);
- nl = FORM_IPN(ibl.ethConfig[eIdx].ethInfo.netmask);
+ nl = FORM_IPN(ibl.bootModes[eIdx].u.ethBoot.ethInfo.netmask);
nDevice.net_mask = htonl(nl);
- nl = FORM_IPN(ibl.ethConfig[eIdx].ethInfo.serverIp);
+ nl = FORM_IPN(ibl.bootModes[eIdx].u.ethBoot.ethInfo.serverIp);
nDevice.server_ip = htonl(nl);
- nDevice.use_bootp_server_ip = ibl.ethConfig[eIdx].useBootpServerIp;
+ nDevice.use_bootp_server_ip = ibl.bootModes[eIdx].u.ethBoot.useBootpServerIp;
/* Note - the file name structure in nDevice is only 64 bytes, but 128 in ethInfo */
- netMemcpy (nDevice.file_name, ibl.ethConfig[eIdx].ethInfo.fileName, sizeof(nDevice.file_name));
- nDevice.use_bootp_file_name = ibl.ethConfig[eIdx].useBootpFileName;
+ netMemcpy (nDevice.file_name, ibl.bootModes[eIdx].u.ethBoot.ethInfo.fileName, sizeof(nDevice.file_name));
+ nDevice.use_bootp_file_name = ibl.bootModes[eIdx].u.ethBoot.useBootpFileName;
nDevice.start = cpmac_drv_start;
}
}
- format = ibl.ethConfig[eIdx].bootFormat;
+ format = ibl.bootModes[eIdx].u.ethBoot.bootFormat;
/* If the data format was based on the name extension, determine
* the boot data format */
}
- entry = iblBoot (&net_boot_module, format, &ibl.ethConfig[eIdx].blob);
+ entry = iblBoot (&net_boot_module, format, &ibl.bootModes[eIdx].u.ethBoot.blob);
/* Before closing the module read any remaining data. In the coff boot mode the boot may
/* Close up the peripheral */
(*net_boot_module.close)();
+
+#ifdef DEVICE_PA
+ hwPaDisable ();
+#endif
+
+#ifdef DEVICE_CPDMA
+ /* Cpdma configuration. */
+ hwCpdmaRxDisable ((cpdmaRxCfg_t *)targetGetCpdmaRxConfig());
+ hwCpdmaTxDisable ((cpdmaTxCfg_t *)targetGetCpdmaTxConfig());
+#endif
+
+#ifdef DEVICE_QM
+ targetFreeQs ();
+ /* Queue manager configuration */
+ hwQmTeardown ();
+#endif
+
+
if (entry != 0) {
iblStatus.exitAddress = entry;