lkml.org 
[lkml]   [2000]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectMemory map/ioremap question
I'm learning to write driver for ethernet card. The
card only support memory address and has this PCI
configuration:

Offset
00 DeviceID VendorID
04 PciStatus PciCommand
08 ClassCode RevisionId
0c HeaderType LatencyTimer CacheLineSize
10 MemBaseAddr0
14 MemBaseAddr1 (for 64bit addressing)
18 IOBaseAddr0 (default disabled)

This is MemBaseAddr0 register:
3 2 1 0
-------------------------------------
Base Address | 00 | 0 |
-------------------------------------
bit[0] = 0 means memory base addr
[2:1] support all 3 of memory map options
00 anywhere in 32 bit addr space
01 below 2 Meg
10 anywhere in 64 bit addr space
11 Reserved

I did this:
#if (LINUX_VERSION_CODE < 0x02030d)
dev->base_addr = pdev->base_address[0];
#else
dev->base_addr = pdev->resource[0].start;
#endif

myADpriv->Hwregs = (struct myHwregs
*)ioremap(dev->base_addr, 0x4000);

readl(&Hwregs->someReg);

when I try to read the hardware registers, I either
get 0 back or the machine stops working (but not hang,
I can telnet). Did I miss something/do something
wrong? what should I try differently?

Thanks.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.370 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site