* [U-Boot] [PATCH v2] net: pcnet: Fix init on big endian 64 bit
@ 2016-05-26 16:32 Paul Burton
2016-05-27 10:58 ` Daniel Schwierzeck
0 siblings, 1 reply; 2+ messages in thread
From: Paul Burton @ 2016-05-26 16:32 UTC (permalink / raw)
To: u-boot
If dev->iobase is 64 bits wide then writing the value of the BAR into a
pointer to iobase will not work on big endian systems, where the BAR
value will incorrectly get written to the upper 32 bits of the 64 bit
variable. Fix this by reading the BAR into a u32, matching the type
expected by pci_read_config_dword.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
Changes in v2:
- Drop useless cast of &bar.
drivers/net/pcnet.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index d1fd4e4..1da9996 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -155,6 +155,7 @@ int pcnet_initialize(bd_t *bis)
struct eth_device *dev;
u16 command, status;
int dev_nr = 0;
+ u32 bar;
PCNET_DEBUG1("\npcnet_initialize...\n");
@@ -182,9 +183,8 @@ int pcnet_initialize(bd_t *bis)
/*
* Setup the PCI device.
*/
- pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0,
- (unsigned int *)&dev->iobase);
- dev->iobase = pci_io_to_phys(devbusfn, dev->iobase);
+ pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &bar);
+ dev->iobase = pci_io_to_phys(devbusfn, bar);
dev->iobase &= ~0xf;
PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%lx: ",
--
2.8.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH v2] net: pcnet: Fix init on big endian 64 bit
2016-05-26 16:32 [U-Boot] [PATCH v2] net: pcnet: Fix init on big endian 64 bit Paul Burton
@ 2016-05-27 10:58 ` Daniel Schwierzeck
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Schwierzeck @ 2016-05-27 10:58 UTC (permalink / raw)
To: u-boot
Am 26.05.2016 um 18:32 schrieb Paul Burton:
> If dev->iobase is 64 bits wide then writing the value of the BAR into a
> pointer to iobase will not work on big endian systems, where the BAR
> value will incorrectly get written to the upper 32 bits of the 64 bit
> variable. Fix this by reading the BAR into a u32, matching the type
> expected by pci_read_config_dword.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
>
> ---
>
> Changes in v2:
> - Drop useless cast of &bar.
>
> drivers/net/pcnet.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
applied to u-boot-mips, thanks.
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160527/b14f4609/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-27 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-26 16:32 [U-Boot] [PATCH v2] net: pcnet: Fix init on big endian 64 bit Paul Burton
2016-05-27 10:58 ` Daniel Schwierzeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox