Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
6c323103
Commit
6c323103
authored
Nov 28, 2007
by
Francois Romieu
Committed by
David S. Miller
Jan 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
r6040: remove virt_to_bus
Signed-off-by:
Francois Romieu
<
romieu@fr.zoreil.com
>
parent
5125a786
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
53 deletions
+50
-53
drivers/net/r6040.c
drivers/net/r6040.c
+50
-53
No files found.
drivers/net/r6040.c
View file @
6c323103
...
@@ -126,8 +126,8 @@
...
@@ -126,8 +126,8 @@
#define TX_DCNT 0x80
/* TX descriptor count */
#define TX_DCNT 0x80
/* TX descriptor count */
#define RX_DCNT 0x80
/* RX descriptor count */
#define RX_DCNT 0x80
/* RX descriptor count */
#define MAX_BUF_SIZE 0x600
#define MAX_BUF_SIZE 0x600
#define
ALLOC_DESC_SIZE ((TX_DCNT+RX_DCNT) * \
#define
RX_DESC_SIZE (RX_DCNT * sizeof(struct r6040_descriptor))
sizeof(struct r6040_descriptor) + 0x10
)
#define TX_DESC_SIZE (TX_DCNT * sizeof(struct r6040_descriptor)
)
#define MBCR_DEFAULT 0x012A
/* MAC Bus Control Register */
#define MBCR_DEFAULT 0x012A
/* MAC Bus Control Register */
#define MCAST_MAX 4
/* Max number multicast addresses to filter */
#define MCAST_MAX 4
/* Max number multicast addresses to filter */
...
@@ -164,10 +164,12 @@ struct r6040_private {
...
@@ -164,10 +164,12 @@ struct r6040_private {
struct
r6040_descriptor
*
rx_remove_ptr
;
struct
r6040_descriptor
*
rx_remove_ptr
;
struct
r6040_descriptor
*
tx_insert_ptr
;
struct
r6040_descriptor
*
tx_insert_ptr
;
struct
r6040_descriptor
*
tx_remove_ptr
;
struct
r6040_descriptor
*
tx_remove_ptr
;
struct
r6040_descriptor
*
rx_ring
;
struct
r6040_descriptor
*
tx_ring
;
dma_addr_t
rx_ring_dma
;
dma_addr_t
tx_ring_dma
;
u16
tx_free_desc
,
rx_free_desc
,
phy_addr
,
phy_mode
;
u16
tx_free_desc
,
rx_free_desc
,
phy_addr
,
phy_mode
;
u16
mcr0
,
mcr1
;
u16
mcr0
,
mcr1
;
dma_addr_t
desc_dma
;
char
*
desc_pool
;
u16
switch_sig
;
u16
switch_sig
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
mii_if_info
mii_if
;
struct
mii_if_info
mii_if
;
...
@@ -291,6 +293,7 @@ static void r6040_down(struct net_device *dev)
...
@@ -291,6 +293,7 @@ static void r6040_down(struct net_device *dev)
{
{
struct
r6040_private
*
lp
=
netdev_priv
(
dev
);
struct
r6040_private
*
lp
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
lp
->
base
;
void
__iomem
*
ioaddr
=
lp
->
base
;
struct
pci_dev
*
pdev
=
lp
->
pdev
;
int
i
;
int
i
;
int
limit
=
2048
;
int
limit
=
2048
;
u16
*
adrp
;
u16
*
adrp
;
...
@@ -334,8 +337,8 @@ static void r6040_down(struct net_device *dev)
...
@@ -334,8 +337,8 @@ static void r6040_down(struct net_device *dev)
}
}
/* Free Descriptor memory */
/* Free Descriptor memory */
pci_free_consistent
(
lp
->
pdev
,
ALLOC_DESC_SIZE
,
pci_free_consistent
(
pdev
,
RX_DESC_SIZE
,
lp
->
rx_ring
,
lp
->
rx_ring_dma
);
lp
->
desc_pool
,
lp
->
desc
_dma
);
pci_free_consistent
(
pdev
,
TX_DESC_SIZE
,
lp
->
tx_ring
,
lp
->
tx_ring
_dma
);
}
}
static
int
static
int
...
@@ -577,67 +580,53 @@ static void r6040_poll_controller(struct net_device *dev)
...
@@ -577,67 +580,53 @@ static void r6040_poll_controller(struct net_device *dev)
#endif
#endif
static
void
r6040_init_ring_desc
(
struct
r6040_descriptor
*
desc_ring
,
dma_addr_t
desc_dma
,
int
size
)
{
struct
r6040_descriptor
*
desc
=
desc_ring
;
dma_addr_t
mapping
=
desc_dma
;
while
(
size
--
>
0
)
{
mapping
+=
sizeof
(
sizeof
(
*
desc
));
desc
->
ndesc
=
cpu_to_le32
(
mapping
);
desc
->
vndescp
=
desc
+
1
;
desc
++
;
}
desc
--
;
desc
->
ndesc
=
cpu_to_le32
(
desc_dma
);
desc
->
vndescp
=
desc_ring
;
}
/* Init RDC MAC */
/* Init RDC MAC */
static
void
r6040_up
(
struct
net_device
*
dev
)
static
void
r6040_up
(
struct
net_device
*
dev
)
{
{
struct
r6040_private
*
lp
=
netdev_priv
(
dev
);
struct
r6040_private
*
lp
=
netdev_priv
(
dev
);
struct
r6040_descriptor
*
descptr
;
void
__iomem
*
ioaddr
=
lp
->
base
;
void
__iomem
*
ioaddr
=
lp
->
base
;
int
i
;
__le32
tmp_addr
;
dma_addr_t
desc_dma
,
start_dma
;
/* Initialize */
/* Initialize */
lp
->
tx_free_desc
=
TX_DCNT
;
lp
->
tx_free_desc
=
TX_DCNT
;
lp
->
rx_free_desc
=
0
;
lp
->
rx_free_desc
=
0
;
/* Init descriptor */
/* Init descriptor */
memset
(
lp
->
desc_pool
,
0
,
ALLOC_DESC_SIZE
);
/* Let all descriptor = 0 */
lp
->
tx_remove_ptr
=
lp
->
tx_insert_ptr
=
lp
->
tx_ring
;
lp
->
tx_insert_ptr
=
(
struct
r6040_descriptor
*
)
lp
->
desc_pool
;
lp
->
rx_remove_ptr
=
lp
->
rx_insert_ptr
=
lp
->
rx_ring
;
lp
->
tx_remove_ptr
=
lp
->
tx_insert_ptr
;
lp
->
rx_insert_ptr
=
(
struct
r6040_descriptor
*
)
lp
->
tx_insert_ptr
+
TX_DCNT
;
lp
->
rx_remove_ptr
=
lp
->
rx_insert_ptr
;
/* Init TX descriptor */
/* Init TX descriptor */
descptr
=
lp
->
tx_insert_ptr
;
r6040_init_ring_desc
(
lp
->
tx_ring
,
lp
->
tx_ring_dma
,
TX_DCNT
);
desc_dma
=
lp
->
desc_dma
;
start_dma
=
desc_dma
;
for
(
i
=
0
;
i
<
TX_DCNT
;
i
++
)
{
descptr
->
ndesc
=
cpu_to_le32
(
desc_dma
+
sizeof
(
struct
r6040_descriptor
));
descptr
->
vndescp
=
(
descptr
+
1
);
descptr
=
(
descptr
+
1
);
desc_dma
+=
sizeof
(
struct
r6040_descriptor
);
}
(
descptr
-
1
)
->
ndesc
=
cpu_to_le32
(
start_dma
);
(
descptr
-
1
)
->
vndescp
=
lp
->
tx_insert_ptr
;
/* Init RX descriptor */
/* Init RX descriptor */
start_dma
=
desc_dma
;
r6040_init_ring_desc
(
lp
->
rx_ring
,
lp
->
rx_ring_dma
,
RX_DCNT
);
descptr
=
lp
->
rx_insert_ptr
;
for
(
i
=
0
;
i
<
RX_DCNT
;
i
++
)
{
descptr
->
ndesc
=
cpu_to_le32
(
desc_dma
+
sizeof
(
struct
r6040_descriptor
));
descptr
->
vndescp
=
(
descptr
+
1
);
descptr
=
(
descptr
+
1
);
desc_dma
+=
sizeof
(
struct
r6040_descriptor
);
}
(
descptr
-
1
)
->
ndesc
=
cpu_to_le32
(
start_dma
);
(
descptr
-
1
)
->
vndescp
=
lp
->
rx_insert_ptr
;
/* Allocate buffer for RX descriptor */
/* Allocate buffer for RX descriptor */
rx_buf_alloc
(
lp
,
dev
);
rx_buf_alloc
(
lp
,
dev
);
/* TX and RX descriptor start Register */
/*
tmp_addr
=
cpu_to_le32
((
u32
)
lp
->
tx_insert_ptr
);
* TX and RX descriptor start registers.
tmp_addr
=
virt_to_bus
((
volatile
void
*
)
tmp_addr
);
* Lower 16-bits to MxD_SA0. Higher 16-bits to MxD_SA1.
/* Lower 16-bits to MTD_SA0 */
*/
iowrite16
(
tmp_addr
,
ioaddr
+
MTD_SA0
);
iowrite16
(
lp
->
tx_ring_dma
,
ioaddr
+
MTD_SA0
);
/* Higher 16-bits to MTD_SA1 */
iowrite16
(
lp
->
tx_ring_dma
>>
16
,
ioaddr
+
MTD_SA1
);
iowrite16
((
u16
)(
tmp_addr
>>
16
),
ioaddr
+
MTD_SA1
);
tmp_addr
=
cpu_to_le32
((
u32
)
lp
->
rx_insert_ptr
);
iowrite16
(
lp
->
rx_ring_dma
,
ioaddr
+
MRD_SA0
);
tmp_addr
=
virt_to_bus
((
volatile
void
*
)
tmp_addr
);
iowrite16
(
lp
->
rx_ring_dma
>>
16
,
ioaddr
+
MRD_SA1
);
iowrite16
(
tmp_addr
,
ioaddr
+
MRD_SA0
);
iowrite16
((
u16
)(
tmp_addr
>>
16
),
ioaddr
+
MRD_SA1
);
/* Buffer Size Register */
/* Buffer Size Register */
iowrite16
(
MAX_BUF_SIZE
,
ioaddr
+
MR_BSR
);
iowrite16
(
MAX_BUF_SIZE
,
ioaddr
+
MR_BSR
);
...
@@ -743,10 +732,18 @@ r6040_open(struct net_device *dev)
...
@@ -743,10 +732,18 @@ r6040_open(struct net_device *dev)
r6040_mac_address
(
dev
);
r6040_mac_address
(
dev
);
/* Allocate Descriptor memory */
/* Allocate Descriptor memory */
lp
->
desc_pool
=
pci_alloc_consistent
(
lp
->
pdev
,
lp
->
rx_ring
=
ALLOC_DESC_SIZE
,
&
lp
->
desc_dma
);
pci_alloc_consistent
(
lp
->
pdev
,
RX_DESC_SIZE
,
&
lp
->
rx_ring_dma
);
if
(
!
lp
->
desc_pool
)
if
(
!
lp
->
rx_ring
)
return
-
ENOMEM
;
lp
->
tx_ring
=
pci_alloc_consistent
(
lp
->
pdev
,
TX_DESC_SIZE
,
&
lp
->
tx_ring_dma
);
if
(
!
lp
->
tx_ring
)
{
pci_free_consistent
(
lp
->
pdev
,
RX_DESC_SIZE
,
lp
->
rx_ring
,
lp
->
rx_ring_dma
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
r6040_up
(
dev
);
r6040_up
(
dev
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment