]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/eltec/elppc/eepro100_srom.c
2 * (C) Copyright 2002 ELTEC Elektronik AG
3 * Frank Gottschling <fgottschling@eltec.de>
5 * SPDX-License-Identifier: GPL-2.0+
9 * Local network srom writing for first time run
18 extern int eepro100_write_eeprom (struct eth_device
*dev
,
19 int location
, int addr_len
,
22 /*----------------------------------------------------------------------------*/
24 unsigned short eepro100_srom_checksum (unsigned short *sromdata
)
26 unsigned short sum
= 0;
29 for (i
= 0; i
< (EE_SIZE
- 1); i
++) {
32 return (EE_CHECKSUM
- sum
);
35 /*----------------------------------------------------------------------------*/
37 int eepro100_srom_store (unsigned short *source
)
40 struct eth_device onboard_dev
;
42 /* get onboard network iobase */
43 pci_read_config_dword (PCI_BDF (0, 0x10, 0), PCI_BASE_ADDRESS_0
,
44 (unsigned int *) &onboard_dev
.iobase
);
45 onboard_dev
.iobase
&= ~0xf;
47 source
[63] = eepro100_srom_checksum (source
);
49 for (count
= 0; count
< EE_SIZE
; count
++) {
50 if (eepro100_write_eeprom ((struct eth_device
*) &onboard_dev
,
52 SROM_SHORT (source
)) == -1) {
60 /*----------------------------------------------------------------------------*/
62 #ifdef EEPRO100_SROM_CHECK
64 extern int read_eeprom (struct eth_device
*dev
, int location
, int addr_len
);
66 void eepro100_srom_load (unsigned short *destination
)
69 struct eth_device onboard_dev
;
74 printf ("eepro100_srom_download:\n");
77 /* get onboard network iobase */
78 pci_read_config_dword (PCI_BDF (0, 0x10, 0), PCI_BASE_ADDRESS_0
,
80 onboard_dev
.iobase
&= ~0xf;
82 memset (destination
, 0x65, 128);
84 for (count
= 0; count
< 0x40; count
++) {
85 *destination
++ = read_eeprom ((struct eth_device
*) &onboard_dev
,
88 printf ("%04x ", *(destination
- 1));
96 #endif /* EEPRO100_SROM_CHECK */
98 /*----------------------------------------------------------------------------*/