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
c2d81e63
Commit
c2d81e63
authored
Jun 23, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] sunlance: Convert to new SBUS driver framework.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
050bbb19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
76 deletions
+97
-76
drivers/net/sunlance.c
drivers/net/sunlance.c
+97
-76
No files found.
drivers/net/sunlance.c
View file @
c2d81e63
...
@@ -266,7 +266,6 @@ struct lance_private {
...
@@ -266,7 +266,6 @@ struct lance_private {
char
*
name
;
char
*
name
;
dma_addr_t
init_block_dvma
;
dma_addr_t
init_block_dvma
;
struct
net_device
*
dev
;
/* Backpointer */
struct
net_device
*
dev
;
/* Backpointer */
struct
lance_private
*
next_module
;
struct
sbus_dev
*
sdev
;
struct
sbus_dev
*
sdev
;
struct
timer_list
multicast_timer
;
struct
timer_list
multicast_timer
;
};
};
...
@@ -298,8 +297,6 @@ int sparc_lance_debug = 2;
...
@@ -298,8 +297,6 @@ int sparc_lance_debug = 2;
#define LANCE_ADDR(x) ((long)(x) & ~0xff000000)
#define LANCE_ADDR(x) ((long)(x) & ~0xff000000)
static
struct
lance_private
*
root_lance_dev
;
/* Load the CSR registers */
/* Load the CSR registers */
static
void
load_csrs
(
struct
lance_private
*
lp
)
static
void
load_csrs
(
struct
lance_private
*
lp
)
{
{
...
@@ -1327,9 +1324,9 @@ static struct ethtool_ops sparc_lance_ethtool_ops = {
...
@@ -1327,9 +1324,9 @@ static struct ethtool_ops sparc_lance_ethtool_ops = {
.
get_link
=
sparc_lance_get_link
,
.
get_link
=
sparc_lance_get_link
,
};
};
static
int
__init
sparc_lance_
init
(
struct
sbus_dev
*
sdev
,
static
int
__init
sparc_lance_
probe_one
(
struct
sbus_dev
*
sdev
,
struct
sbus_dma
*
ledma
,
struct
sbus_dma
*
ledma
,
struct
sbus_dev
*
lebuffer
)
struct
sbus_dev
*
lebuffer
)
{
{
static
unsigned
version_printed
;
static
unsigned
version_printed
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
...
@@ -1473,6 +1470,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
...
@@ -1473,6 +1470,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
lp
->
dev
=
dev
;
lp
->
dev
=
dev
;
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
SET_NETDEV_DEV
(
dev
,
&
sdev
->
ofdev
.
dev
);
dev
->
open
=
&
lance_open
;
dev
->
open
=
&
lance_open
;
dev
->
stop
=
&
lance_close
;
dev
->
stop
=
&
lance_close
;
dev
->
hard_start_xmit
=
&
lance_start_xmit
;
dev
->
hard_start_xmit
=
&
lance_start_xmit
;
...
@@ -1500,8 +1498,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
...
@@ -1500,8 +1498,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
goto
fail
;
goto
fail
;
}
}
lp
->
next_module
=
root_lance_dev
;
dev_set_drvdata
(
&
sdev
->
ofdev
.
dev
,
lp
);
root_lance_dev
=
lp
;
printk
(
KERN_INFO
"%s: LANCE "
,
dev
->
name
);
printk
(
KERN_INFO
"%s: LANCE "
,
dev
->
name
);
...
@@ -1536,88 +1533,112 @@ static inline struct sbus_dma *find_ledma(struct sbus_dev *sdev)
...
@@ -1536,88 +1533,112 @@ static inline struct sbus_dma *find_ledma(struct sbus_dev *sdev)
#include <asm/machines.h>
#include <asm/machines.h>
/* Find all the lance cards on the system and initialize them */
/* Find all the lance cards on the system and initialize them */
static
int
__init
sparc_lance_probe
(
void
)
static
struct
sbus_dev
sun4_sdev
;
static
int
__init
sparc_lance_init
(
void
)
{
{
static
struct
sbus_dev
sdev
;
static
int
called
;
root_lance_dev
=
NULL
;
if
(
called
)
return
-
ENODEV
;
called
++
;
if
((
idprom
->
id_machtype
==
(
SM_SUN4
|
SM_4_330
))
||
if
((
idprom
->
id_machtype
==
(
SM_SUN4
|
SM_4_330
))
||
(
idprom
->
id_machtype
==
(
SM_SUN4
|
SM_4_470
)))
{
(
idprom
->
id_machtype
==
(
SM_SUN4
|
SM_4_470
)))
{
memset
(
&
sdev
,
0
,
sizeof
(
sdev
));
memset
(
&
s
un4_s
dev
,
0
,
sizeof
(
sdev
));
sdev
.
reg_addrs
[
0
].
phys_addr
=
sun4_eth_physaddr
;
s
un4_s
dev
.
reg_addrs
[
0
].
phys_addr
=
sun4_eth_physaddr
;
sdev
.
irqs
[
0
]
=
6
;
s
un4_s
dev
.
irqs
[
0
]
=
6
;
return
sparc_lance_
init
(
&
sdev
,
NULL
,
NULL
);
return
sparc_lance_
probe_one
(
&
sun4_
sdev
,
NULL
,
NULL
);
}
}
return
-
ENODEV
;
return
-
ENODEV
;
}
}
#else
/* !CONFIG_SUN4 */
static
int
__exit
sunlance_sun4_remove
(
void
)
/* Find all the lance cards on the system and initialize them */
static
int
__init
sparc_lance_probe
(
void
)
{
{
struct
sbus_bus
*
bus
;
struct
lance_private
*
lp
=
dev_get_drvdata
(
&
sun4_sdev
->
dev
);
struct
sbus_dev
*
sdev
=
NULL
;
struct
net_device
*
net_dev
=
lp
->
dev
;
struct
sbus_dma
*
ledma
=
NULL
;
static
int
called
;
unregister_netdevice
(
net_dev
);
int
cards
=
0
,
v
;
lance_free_hwresources
(
root_lance_dev
);
root_lance_dev
=
NULL
;
free_netdev
(
net_dev
);
if
(
called
)
return
-
ENODEV
;
dev_set_drvdata
(
&
sun4_sdev
->
dev
,
NULL
);
called
++
;
for_each_sbus
(
bus
)
{
for_each_sbusdev
(
sdev
,
bus
)
{
if
(
strcmp
(
sdev
->
prom_name
,
"le"
)
==
0
)
{
cards
++
;
if
((
v
=
sparc_lance_init
(
sdev
,
NULL
,
NULL
)))
return
v
;
continue
;
}
if
(
strcmp
(
sdev
->
prom_name
,
"ledma"
)
==
0
)
{
cards
++
;
ledma
=
find_ledma
(
sdev
);
if
((
v
=
sparc_lance_init
(
sdev
->
child
,
ledma
,
NULL
)))
return
v
;
continue
;
}
if
(
strcmp
(
sdev
->
prom_name
,
"lebuffer"
)
==
0
){
cards
++
;
if
((
v
=
sparc_lance_init
(
sdev
->
child
,
NULL
,
sdev
)))
return
v
;
continue
;
}
}
/* for each sbusdev */
}
/* for each sbus */
if
(
!
cards
)
return
-
ENODEV
;
return
0
;
return
0
;
}
}
#endif
/* !CONFIG_SUN4 */
static
void
__exit
sparc_lance_cleanup
(
void
)
#else
/* !CONFIG_SUN4 */
static
int
__devinit
sunlance_sbus_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
{
{
struct
lance_private
*
lp
;
struct
sbus_dev
*
sdev
=
to_sbus_device
(
&
dev
->
dev
);
struct
device_node
*
dp
=
dev
->
node
;
int
err
;
if
(
!
strcmp
(
dp
->
name
,
"le"
))
{
err
=
sparc_lance_probe_one
(
sdev
,
NULL
,
NULL
);
}
else
if
(
!
strcmp
(
dp
->
name
,
"ledma"
))
{
struct
sbus_dma
*
ledma
=
find_ledma
(
sdev
);
while
(
root_lance_dev
)
{
err
=
sparc_lance_probe_one
(
sdev
->
child
,
ledma
,
NULL
);
lp
=
root_lance_dev
->
next_module
;
}
else
{
BUG_ON
(
strcmp
(
dp
->
name
,
"lebuffer"
));
unregister_netdev
(
root_lance_dev
->
dev
);
err
=
sparc_lance_probe_one
(
sdev
->
child
,
NULL
,
sdev
);
lance_free_hwresources
(
root_lance_dev
);
free_netdev
(
root_lance_dev
->
dev
);
root_lance_dev
=
lp
;
}
}
return
err
;
}
static
int
__devexit
sunlance_sbus_remove
(
struct
of_device
*
dev
)
{
struct
lance_private
*
lp
=
dev_get_drvdata
(
&
dev
->
dev
);
struct
net_device
*
net_dev
=
lp
->
dev
;
unregister_netdevice
(
net_dev
);
lance_free_hwresources
(
lp
);
free_netdev
(
net_dev
);
dev_set_drvdata
(
&
dev
->
dev
,
NULL
);
return
0
;
}
static
struct
of_device_id
sunlance_sbus_match
[]
=
{
{
.
name
=
"le"
,
},
{
.
name
=
"ledma"
,
},
{
.
name
=
"lebuffer"
,
},
{},
};
MODULE_DEVICE_TABLE
(
of
,
sunlance_sbus_match
);
static
struct
of_platform_driver
sunlance_sbus_driver
=
{
.
name
=
"sunlance"
,
.
match_table
=
sunlance_sbus_match
,
.
probe
=
sunlance_sbus_probe
,
.
remove
=
__devexit_p
(
sunlance_sbus_remove
),
};
/* Find all the lance cards on the system and initialize them */
static
int
__init
sparc_lance_init
(
void
)
{
return
of_register_driver
(
&
sunlance_sbus_driver
,
&
sbus_bus_type
);
}
#endif
/* !CONFIG_SUN4 */
static
void
__exit
sparc_lance_exit
(
void
)
{
#ifdef CONFIG_SUN4
sunlance_sun4_remove
();
#else
of_unregister_driver
(
&
sunlance_sbus_driver
);
#endif
}
}
module_init
(
sparc_lance_
probe
);
module_init
(
sparc_lance_
init
);
module_exit
(
sparc_lance_
cleanup
);
module_exit
(
sparc_lance_
exit
);
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