Re: LAN91C111 on XSC1BD by voidcoder
voidcoder
Wed Feb 15 12:32:34 CST 2006
Hm, looks ok. Are you sure MAC is programmed correctly?
It seems something is wrong with the MAC address, this may
explain why you receive broadcasts, and not directly addressed
frames. You can turn on promiscuous mode (don't remember,
it should be a special bit somewhere in registers) to receive
all frames and than verify packet header.
What MAC is shown in the device packets by the Etherall when
you send BOOTMEs?
Also please try to read it back once programmed:
OUTPORT16(&g_pSMC->IAR0,mac[0]);
OUTPORT16(&g_pSMC->IAR1,mac[1]);
OUTPORT16(&g_pSMC->IAR2,mac[2]);
mac[0] = INPORT16(&g_pLAN91C->IAR0);
mac[1] = INPORT16(&g_pLAN91C->IAR1);
mac[2] = INPORT16(&g_pLAN91C->IAR2);
OALMSGS(OAL_ETHER&&OAL_FUNC, (
L"MAC = %02x:%02x:%02x:%02x:%02x:%02x\r\n",
mac[0]&0xFF, mac[0]>>8, mac[1]&0xFF, mac[1]>>8, mac[2]&0xFF,
mac[2]>>8
));
Does it show the same MAC?
"Fornazin" <fornazin@gmail.com> wrote in message
news:1140022606.909724.299310@z14g2000cwz.googlegroups.com...
> Hi,
>
> Here is the code for Chip Initialization. I'm using the code from
> Mainstone II BSP. I changed some features to get it working. The main
> changes is the header redefinition and the code to load EEPROM.
>
> BOOL SMCInit( BYTE *pAddress, DWORD offset, USHORT mac[3])
> {
> BOOL rc = FALSE;
>
> OALMSGS(OAL_ETHER&&OAL_FUNC, (
> L"+SMCInit(0x%08x, 0x%08x, 0x%08x)\r\n", pAddress, offset, mac
> ));
>
> // Save address
> g_pSMC = (SMC_REGS*)pAddress;
>
> // Chip settle time.
> OALStall(750);
>
> // Verify that network chip can be detected
> if ((INPORT16(&g_pSMC->BANKSEL) & 0xFF00) != 0x3300)
> {
>
> OALMSGS(OAL_ERROR, (
> L"ERROR: SMCInit: Network Chip not found at 0x%08x\r\n",
> pAddress
> ));
>
> EdbgOutputDebugString("ERROR: SMCInit: Network Chip not found at
> 0x%x\r\n", pAddress);
>
> goto cleanUp;
> }
>
> // Select bank 3 and read the chip ID and revision.
> OUTPORT16(&g_pSMC->BANKSEL, 3);
>
> g_chipRevision = INPORT16(&g_pSMC->REV);
>
> OALMSGS(TRUE, (
> L"SMCxxx: Chip Id %d Revision %d\r\n",
> GET_CHIP_ID(g_chipRevision), GET_REV_ID(g_chipRevision)
> ));
>
>
> // Select bank 1
> OUTPORT16(&g_pSMC->BANKSEL, 1);
>
>
> // Wait until reset & EEPROM load is done
> // Fornazin - We don't have a EEPROM, so we don't need this code
> //OUTPORT16(&g_pSMC->CTR, CTR_RELOAD);
> //while ((INPORT16(&g_pSMC->CTR) & (CTR_RELOAD|CTR_STORE)) != 0);
>
>
> // Fornazin - Programming MAC by hand
> mac[0] = 0x0080;
> mac[1] = 0x263E;
> mac[2] = 0x5D0A;
>
> OUTPORT16(&g_pSMC->IAR0,mac[0]);
> OUTPORT16(&g_pSMC->IAR1,mac[1]);
> OUTPORT16(&g_pSMC->IAR2,mac[2]);
>
> // Initialize the control register
> switch (GET_CHIP_ID(g_chipRevision)) {
> case CHIP_ID_SMC111:
> OUTPORT16(&g_pSMC->CTR, CTR_TEEN);
> // The SMC111's internal PHY is disabled at boot time - enable
> it.
> PhyWrite(0, 0, CONTROL_MII_DIS);
> // Enable auto-negotiation of link speed.
> OUTPORT16(&g_pSMC->BANKSEL, 0);
> OUTPORT16(&g_pSMC->MCRPCR, 0x0800);
> break;
> default:
> // Set SQUELCH & NO WAIT bits
> OUTPORT16(&g_pSMC->BANKSEL, 1);
> SETPORT16(&g_pSMC->CR, CR_SETSQLCH|CR_NOWAIT);
> OUTPORT16(&g_pSMC->CTR, CTR_BIT8|CTR_TEEN);
> // Memory configuration register value.
> OUTPORT16(&g_pSMC->BANKSEL, 0);
> OUTPORT16(&g_pSMC->MCRPCR, 0x0006);
> }
>
> // Initialize transmit control register
> OUTPORT16(&g_pSMC->BANKSEL, 0);
> OUTPORT16(&g_pSMC->TCR, TCR_SWFDUP|TCR_PADEN|TCR_TXEN);
>
> // Initialize interrupt mask register (all ints disabled to start)
> OUTPORT16(&g_pSMC->BANKSEL, 2);
> OUTPORT16(&g_pSMC->INTR, 0);
>
> // Initialize the Receive Control Register
> OUTPORT16(&g_pSMC->BANKSEL, 0);
> OUTPORT16(&g_pSMC->RCR, RCR_RXEN|RCR_STRIP_CRC);
>
> // We are done
> rc = TRUE;
>
> cleanUp:
> OALMSGS(OAL_ETHER&&OAL_FUNC, (
> L"-SMCInit(mac = %02x:%02x:%02x:%02x:%02x:%02x, rc = %d)\r\n",
> mac[0]&0xFF, mac[0]>>8, mac[1]&0xFF, mac[1]>>8, mac[2]&0xFF,
> mac[2]>>8,
> rc
> ));
>
> return rc;
> }
>