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
Kirill Smelkov
linux
Commits
52a34c7f
Commit
52a34c7f
authored
Jun 23, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] sunbmac: Convert over to new SBUS device framework.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
c2d81e63
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
67 deletions
+61
-67
drivers/net/sunbmac.c
drivers/net/sunbmac.c
+61
-66
drivers/net/sunbmac.h
drivers/net/sunbmac.h
+0
-1
No files found.
drivers/net/sunbmac.c
View file @
52a34c7f
...
@@ -72,8 +72,6 @@ MODULE_LICENSE("GPL");
...
@@ -72,8 +72,6 @@ MODULE_LICENSE("GPL");
#define DIRQ(x)
#define DIRQ(x)
#endif
#endif
static
struct
bigmac
*
root_bigmac_dev
;
#define DEFAULT_JAMSIZE 4
/* Toe jam */
#define DEFAULT_JAMSIZE 4
/* Toe jam */
#define QEC_RESET_TRIES 200
#define QEC_RESET_TRIES 200
...
@@ -491,7 +489,7 @@ static void bigmac_tcvr_init(struct bigmac *bp)
...
@@ -491,7 +489,7 @@ static void bigmac_tcvr_init(struct bigmac *bp)
}
}
}
}
static
int
bigmac_init
(
struct
bigmac
*
,
int
);
static
int
bigmac_init
_hw
(
struct
bigmac
*
,
int
);
static
int
try_next_permutation
(
struct
bigmac
*
bp
,
void
__iomem
*
tregs
)
static
int
try_next_permutation
(
struct
bigmac
*
bp
,
void
__iomem
*
tregs
)
{
{
...
@@ -551,7 +549,7 @@ static void bigmac_timer(unsigned long data)
...
@@ -551,7 +549,7 @@ static void bigmac_timer(unsigned long data)
if
(
ret
==
-
1
)
{
if
(
ret
==
-
1
)
{
printk
(
KERN_ERR
"%s: Link down, cable problem?
\n
"
,
printk
(
KERN_ERR
"%s: Link down, cable problem?
\n
"
,
bp
->
dev
->
name
);
bp
->
dev
->
name
);
ret
=
bigmac_init
(
bp
,
0
);
ret
=
bigmac_init
_hw
(
bp
,
0
);
if
(
ret
)
{
if
(
ret
)
{
printk
(
KERN_ERR
"%s: Error, cannot re-init the "
printk
(
KERN_ERR
"%s: Error, cannot re-init the "
"BigMAC.
\n
"
,
bp
->
dev
->
name
);
"BigMAC.
\n
"
,
bp
->
dev
->
name
);
...
@@ -621,7 +619,7 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp)
...
@@ -621,7 +619,7 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp)
add_timer
(
&
bp
->
bigmac_timer
);
add_timer
(
&
bp
->
bigmac_timer
);
}
}
static
int
bigmac_init
(
struct
bigmac
*
bp
,
int
from_irq
)
static
int
bigmac_init
_hw
(
struct
bigmac
*
bp
,
int
from_irq
)
{
{
void
__iomem
*
gregs
=
bp
->
gregs
;
void
__iomem
*
gregs
=
bp
->
gregs
;
void
__iomem
*
cregs
=
bp
->
creg
;
void
__iomem
*
cregs
=
bp
->
creg
;
...
@@ -752,7 +750,7 @@ static void bigmac_is_medium_rare(struct bigmac *bp, u32 qec_status, u32 bmac_st
...
@@ -752,7 +750,7 @@ static void bigmac_is_medium_rare(struct bigmac *bp, u32 qec_status, u32 bmac_st
}
}
printk
(
" RESET
\n
"
);
printk
(
" RESET
\n
"
);
bigmac_init
(
bp
,
1
);
bigmac_init
_hw
(
bp
,
1
);
}
}
/* BigMAC transmit complete service routines. */
/* BigMAC transmit complete service routines. */
...
@@ -926,7 +924,7 @@ static int bigmac_open(struct net_device *dev)
...
@@ -926,7 +924,7 @@ static int bigmac_open(struct net_device *dev)
return
ret
;
return
ret
;
}
}
init_timer
(
&
bp
->
bigmac_timer
);
init_timer
(
&
bp
->
bigmac_timer
);
ret
=
bigmac_init
(
bp
,
0
);
ret
=
bigmac_init
_hw
(
bp
,
0
);
if
(
ret
)
if
(
ret
)
free_irq
(
dev
->
irq
,
bp
);
free_irq
(
dev
->
irq
,
bp
);
return
ret
;
return
ret
;
...
@@ -950,7 +948,7 @@ static void bigmac_tx_timeout(struct net_device *dev)
...
@@ -950,7 +948,7 @@ static void bigmac_tx_timeout(struct net_device *dev)
{
{
struct
bigmac
*
bp
=
(
struct
bigmac
*
)
dev
->
priv
;
struct
bigmac
*
bp
=
(
struct
bigmac
*
)
dev
->
priv
;
bigmac_init
(
bp
,
0
);
bigmac_init
_hw
(
bp
,
0
);
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
}
}
...
@@ -1104,6 +1102,8 @@ static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
...
@@ -1104,6 +1102,8 @@ static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
bp
->
qec_sdev
=
qec_sdev
;
bp
->
qec_sdev
=
qec_sdev
;
bp
->
bigmac_sdev
=
qec_sdev
->
child
;
bp
->
bigmac_sdev
=
qec_sdev
->
child
;
SET_NETDEV_DEV
(
dev
,
&
bp
->
bigmac_sdev
->
ofdev
.
dev
);
spin_lock_init
(
&
bp
->
lock
);
spin_lock_init
(
&
bp
->
lock
);
/* Verify the registers we expect, are actually there. */
/* Verify the registers we expect, are actually there. */
...
@@ -1226,11 +1226,7 @@ static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
...
@@ -1226,11 +1226,7 @@ static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
goto
fail_and_cleanup
;
goto
fail_and_cleanup
;
}
}
/* Put us into the list of instances attached for later driver
dev_set_drvdata
(
&
bp
->
bigmac_sdev
->
ofdev
.
dev
,
bp
);
* exit.
*/
bp
->
next_module
=
root_bigmac_dev
;
root_bigmac_dev
=
bp
;
printk
(
KERN_INFO
"%s: BigMAC 100baseT Ethernet "
,
dev
->
name
);
printk
(
KERN_INFO
"%s: BigMAC 100baseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
...
@@ -1266,54 +1262,23 @@ static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
...
@@ -1266,54 +1262,23 @@ static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
/* QEC can be the parent of either QuadEthernet or
/* QEC can be the parent of either QuadEthernet or
* a BigMAC. We want the latter.
* a BigMAC. We want the latter.
*/
*/
static
int
__
init
bigmac_match
(
struct
sbus_dev
*
sdev
)
static
int
__
devinit
bigmac_sbus_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
{
{
struct
sbus_dev
*
child
=
sdev
->
child
;
struct
sbus_dev
*
sdev
=
to_sbus_device
(
&
dev
->
dev
);
struct
device_node
*
dp
=
dev
->
node
;
if
(
strcmp
(
sdev
->
prom_name
,
"qec"
)
!=
0
)
if
(
!
strcmp
(
dp
->
name
,
"be"
)
)
return
0
;
sdev
=
sdev
->
parent
;
if
(
child
==
NULL
)
return
bigmac_ether_init
(
sdev
);
return
0
;
if
(
strcmp
(
child
->
prom_name
,
"be"
)
!=
0
)
return
0
;
return
1
;
}
}
static
int
__
init
bigmac_probe
(
void
)
static
int
__
devexit
bigmac_sbus_remove
(
struct
of_device
*
dev
)
{
{
struct
sbus_bus
*
sbus
;
struct
bigmac
*
bp
=
dev_get_drvdata
(
&
dev
->
dev
);
struct
sbus_dev
*
sdev
=
NULL
;
struct
net_device
*
net_dev
=
bp
->
dev
;
static
int
called
;
int
cards
=
0
,
v
;
root_bigmac_dev
=
NULL
;
unregister_netdevice
(
net_dev
);
if
(
called
)
return
-
ENODEV
;
called
++
;
for_each_sbus
(
sbus
)
{
for_each_sbusdev
(
sdev
,
sbus
)
{
if
(
bigmac_match
(
sdev
))
{
cards
++
;
if
((
v
=
bigmac_ether_init
(
sdev
)))
return
v
;
}
}
}
if
(
!
cards
)
return
-
ENODEV
;
return
0
;
}
static
void
__exit
bigmac_cleanup
(
void
)
{
while
(
root_bigmac_dev
)
{
struct
bigmac
*
bp
=
root_bigmac_dev
;
struct
bigmac
*
bp_nxt
=
root_bigmac_dev
->
next_module
;
sbus_iounmap
(
bp
->
gregs
,
GLOB_REG_SIZE
);
sbus_iounmap
(
bp
->
gregs
,
GLOB_REG_SIZE
);
sbus_iounmap
(
bp
->
creg
,
CREG_REG_SIZE
);
sbus_iounmap
(
bp
->
creg
,
CREG_REG_SIZE
);
...
@@ -1324,11 +1289,41 @@ static void __exit bigmac_cleanup(void)
...
@@ -1324,11 +1289,41 @@ static void __exit bigmac_cleanup(void)
bp
->
bmac_block
,
bp
->
bmac_block
,
bp
->
bblock_dvma
);
bp
->
bblock_dvma
);
unregister_netdev
(
bp
->
dev
);
free_netdev
(
net_dev
);
free_netdev
(
bp
->
dev
);
root_bigmac_dev
=
bp_nxt
;
dev_set_drvdata
(
&
dev
->
dev
,
NULL
);
}
return
0
;
}
static
struct
of_device_id
bigmac_sbus_match
[]
=
{
{
.
name
=
"qec"
,
},
{
.
name
=
"be"
,
},
{},
};
MODULE_DEVICE_TABLE
(
of
,
bigmac_sbus_match
);
static
struct
of_platform_driver
bigmac_sbus_driver
=
{
.
name
=
"sunbmac"
,
.
match_table
=
bigmac_sbus_match
,
.
probe
=
bigmac_sbus_probe
,
.
remove
=
__devexit_p
(
bigmac_sbus_remove
),
};
static
int
__init
bigmac_init
(
void
)
{
return
of_register_driver
(
&
bigmac_sbus_driver
,
&
sbus_bus_type
);
}
static
void
__exit
bigmac_exit
(
void
)
{
of_unregister_driver
(
&
bigmac_sbus_driver
);
}
}
module_init
(
bigmac_
probe
);
module_init
(
bigmac_
init
);
module_exit
(
bigmac_
cleanup
);
module_exit
(
bigmac_
exit
);
drivers/net/sunbmac.h
View file @
52a34c7f
...
@@ -332,7 +332,6 @@ struct bigmac {
...
@@ -332,7 +332,6 @@ struct bigmac {
struct
sbus_dev
*
qec_sdev
;
struct
sbus_dev
*
qec_sdev
;
struct
sbus_dev
*
bigmac_sdev
;
struct
sbus_dev
*
bigmac_sdev
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
bigmac
*
next_module
;
};
};
/* We use this to acquire receive skb's that we can DMA directly into. */
/* We use this to acquire receive skb's that we can DMA directly into. */
...
...
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