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
91d6d308
Commit
91d6d308
authored
Mar 21, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sun HME/GEM driver probing cleanups.
parent
d241f6b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
68 deletions
+101
-68
drivers/net/sungem.c
drivers/net/sungem.c
+30
-19
drivers/net/sunhme.c
drivers/net/sunhme.c
+71
-49
No files found.
drivers/net/sungem.c
View file @
91d6d308
...
...
@@ -2923,21 +2923,21 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
return
-
ENODEV
;
}
dev
=
init_etherdev
(
NULL
,
sizeof
(
*
gp
));
dev
=
alloc_etherdev
(
sizeof
(
*
gp
));
if
(
!
dev
)
{
printk
(
KERN_ERR
PFX
"Etherdev
init
failed, aborting.
\n
"
);
printk
(
KERN_ERR
PFX
"Etherdev
alloc
failed, aborting.
\n
"
);
return
-
ENOMEM
;
}
SET_MODULE_OWNER
(
dev
);
if
(
!
request_mem_region
(
gemreg_base
,
gemreg_len
,
dev
->
name
))
{
printk
(
KERN_ERR
PFX
"MMIO resource (0x%lx@0x%lx) unavailable, "
"aborting.
\n
"
,
gemreg_base
,
gemreg_len
);
gp
=
dev
->
priv
;
if
(
pci_request_regions
(
pdev
,
dev
->
name
))
{
printk
(
KERN_ERR
PFX
"Cannot obtain PCI resources, "
"aborting.
\n
"
);
goto
err_out_free_netdev
;
}
gp
=
dev
->
priv
;
gp
->
pdev
=
pdev
;
dev
->
base_addr
=
(
long
)
pdev
;
gp
->
dev
=
dev
;
...
...
@@ -2970,7 +2970,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if
(
gp
->
regs
==
0UL
)
{
printk
(
KERN_ERR
PFX
"Cannot map device registers, "
"aborting.
\n
"
);
goto
err_out_free_
mmio_
res
;
goto
err_out_free_res
;
}
/* On Apple, we power the chip up now in order for check
...
...
@@ -3006,22 +3006,28 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
goto
err_out_iounmap
;
}
pci_set_drvdata
(
pdev
,
dev
);
printk
(
KERN_INFO
"%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet "
,
dev
->
name
);
#ifdef CONFIG_ALL_PPC
gp
->
of_node
=
pci_device_to_OF_node
(
pdev
);
#endif
if
(
gem_get_device_address
(
gp
))
goto
err_out_iounmap
;
goto
err_out_free_consistent
;
if
(
register_netdev
(
dev
))
{
printk
(
KERN_ERR
PFX
"Cannot register net device, "
"aborting.
\n
"
);
goto
err_out_free_consistent
;
}
printk
(
KERN_INFO
"%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
pci_set_drvdata
(
pdev
,
dev
);
dev
->
open
=
gem_open
;
dev
->
stop
=
gem_close
;
dev
->
hard_start_xmit
=
gem_start_xmit
;
...
...
@@ -3045,6 +3051,12 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
return
0
;
err_out_free_consistent:
pci_free_consistent
(
pdev
,
sizeof
(
struct
gem_init_block
),
gp
->
init_block
,
gp
->
gblock_dvma
);
err_out_iounmap:
down
(
&
gp
->
pm_sem
);
/* Stop the PM timer & task */
...
...
@@ -3053,13 +3065,13 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if
(
gp
->
hw_running
)
gem_shutdown
(
gp
);
up
(
&
gp
->
pm_sem
);
iounmap
((
void
*
)
gp
->
regs
);
err_out_free_
mmio_
res:
release_mem_region
(
gemreg_base
,
gemreg_len
);
err_out_free_res:
pci_release_regions
(
pdev
);
err_out_free_netdev:
unregister_netdev
(
dev
);
kfree
(
dev
);
return
-
ENODEV
;
...
...
@@ -3088,8 +3100,7 @@ static void __devexit gem_remove_one(struct pci_dev *pdev)
gp
->
init_block
,
gp
->
gblock_dvma
);
iounmap
((
void
*
)
gp
->
regs
);
release_mem_region
(
pci_resource_start
(
pdev
,
0
),
pci_resource_len
(
pdev
,
0
));
pci_release_regions
(
pdev
);
kfree
(
dev
);
pci_set_drvdata
(
pdev
,
NULL
);
...
...
drivers/net/sunhme.c
View file @
91d6d308
...
...
@@ -2658,7 +2658,7 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
}
err
=
-
ENOMEM
;
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
happy_meal
));
dev
=
alloc_etherdev
(
sizeof
(
struct
happy_meal
));
if
(
!
dev
)
goto
err_out
;
SET_MODULE_OWNER
(
dev
);
...
...
@@ -2666,13 +2666,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
if
(
hme_version_printed
++
==
0
)
printk
(
KERN_INFO
"%s"
,
version
);
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (SBUS) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (SBUS) 10/100baseT Ethernet "
,
dev
->
name
);
/* If user did not specify a MAC address specifically, use
* the Quattro local-mac-address property...
*/
...
...
@@ -2693,11 +2686,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
memcpy
(
dev
->
dev_addr
,
idprom
->
id_ethaddr
,
6
);
}
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
hp
=
dev
->
priv
;
memset
(
hp
,
0
,
sizeof
(
*
hp
));
...
...
@@ -2822,17 +2810,38 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
*/
happy_meal_set_initial_advertisement
(
hp
);
ether_setup
(
dev
);
if
(
register_netdev
(
hp
->
dev
))
{
printk
(
KERN_ERR
"happymeal: Cannot register net device, "
"aborting.
\n
"
);
goto
err_out_free_consistent
;
}
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (SBUS) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (SBUS) 10/100baseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
/* We are home free at this point, link us in to the happy
* device list.
*/
dev
->
ifindex
=
dev_new_index
();
hp
->
next_module
=
root_happy_dev
;
root_happy_dev
=
hp
;
return
0
;
err_out_free_consistent:
sbus_free_consistent
(
hp
->
happy_dev
,
PAGE_SIZE
,
hp
->
happy_block
,
hp
->
hblock_dvma
);
err_out_iounmap:
if
(
hp
->
gregs
)
sbus_iounmap
(
hp
->
gregs
,
GREG_REG_SIZE
);
...
...
@@ -2846,7 +2855,6 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
sbus_iounmap
(
hp
->
tcvregs
,
TCVR_REG_SIZE
);
err_out_free_netdev:
unregister_netdev
(
dev
);
kfree
(
dev
);
err_out:
...
...
@@ -2996,7 +3004,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
goto
err_out
;
}
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
happy_meal
));
dev
=
alloc_etherdev
(
sizeof
(
struct
happy_meal
));
err
=
-
ENOMEM
;
if
(
!
dev
)
goto
err_out
;
...
...
@@ -3005,29 +3013,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
if
(
hme_version_printed
++
==
0
)
printk
(
KERN_INFO
"%s"
,
version
);
if
(
!
qfe_slot
)
{
struct
pci_dev
*
qpdev
=
qp
->
quattro_dev
;
prom_name
[
0
]
=
0
;
if
(
!
strncmp
(
dev
->
name
,
"eth"
,
3
))
{
int
i
=
simple_strtoul
(
dev
->
name
+
3
,
NULL
,
10
);
sprintf
(
prom_name
,
"-%d"
,
i
+
3
);
}
printk
(
KERN_INFO
"%s%s: Quattro HME (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
prom_name
);
if
(
qpdev
->
vendor
==
PCI_VENDOR_ID_DEC
&&
qpdev
->
device
==
PCI_DEVICE_ID_DEC_21153
)
printk
(
"DEC 21153 PCI Bridge
\n
"
);
else
printk
(
"unknown bridge %04x.%04x
\n
"
,
qpdev
->
vendor
,
qpdev
->
device
);
}
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (PCI/CheerIO) 10/100BaseT Ethernet "
,
dev
->
name
);
dev
->
base_addr
=
(
long
)
pdev
;
hp
=
(
struct
happy_meal
*
)
dev
->
priv
;
...
...
@@ -3049,9 +3034,15 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
printk
(
KERN_ERR
"happymeal(PCI): Cannot find proper PCI device base address.
\n
"
);
goto
err_out_clear_quattro
;
}
if
(
pci_request_regions
(
pdev
,
dev
->
name
))
{
printk
(
KERN_ERR
"happymeal(PCI): Cannot obtain PCI resources, "
"aborting.
\n
"
);
goto
err_out_clear_quattro
;
}
if
((
hpreg_base
=
(
unsigned
long
)
ioremap
(
hpreg_base
,
0x8000
))
==
0
)
{
printk
(
KERN_ERR
"happymeal(PCI): Unable to remap card memory.
\n
"
);
return
-
ENODEV
;
goto
err_out_free_res
;
}
for
(
i
=
0
;
i
<
6
;
i
++
)
{
...
...
@@ -3076,11 +3067,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
#endif
}
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
/* Layout registers. */
hp
->
gregs
=
(
hpreg_base
+
0x0000UL
);
hp
->
etxregs
=
(
hpreg_base
+
0x2000UL
);
...
...
@@ -3159,12 +3145,44 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
*/
happy_meal_set_initial_advertisement
(
hp
);
ether_setup
(
dev
);
if
(
register_netdev
(
hp
->
dev
))
{
printk
(
KERN_ERR
"happymeal(PCI): Cannot register net device, "
"aborting.
\n
"
);
goto
err_out_iounmap
;
}
if
(
!
qfe_slot
)
{
struct
pci_dev
*
qpdev
=
qp
->
quattro_dev
;
prom_name
[
0
]
=
0
;
if
(
!
strncmp
(
dev
->
name
,
"eth"
,
3
))
{
int
i
=
simple_strtoul
(
dev
->
name
+
3
,
NULL
,
10
);
sprintf
(
prom_name
,
"-%d"
,
i
+
3
);
}
printk
(
KERN_INFO
"%s%s: Quattro HME (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
prom_name
);
if
(
qpdev
->
vendor
==
PCI_VENDOR_ID_DEC
&&
qpdev
->
device
==
PCI_DEVICE_ID_DEC_21153
)
printk
(
"DEC 21153 PCI Bridge
\n
"
);
else
printk
(
"unknown bridge %04x.%04x
\n
"
,
qpdev
->
vendor
,
qpdev
->
device
);
}
if
(
qfe_slot
!=
-
1
)
printk
(
KERN_INFO
"%s: Quattro HME slot %d (PCI/CheerIO) 10/100baseT Ethernet "
,
dev
->
name
,
qfe_slot
);
else
printk
(
KERN_INFO
"%s: HAPPY MEAL (PCI/CheerIO) 10/100BaseT Ethernet "
,
dev
->
name
);
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%2.2x%c"
,
dev
->
dev_addr
[
i
],
i
==
5
?
' '
:
':'
);
printk
(
"
\n
"
);
/* We are home free at this point, link us in to the happy
* device list.
*/
dev
->
ifindex
=
dev_new_index
();
hp
->
next_module
=
root_happy_dev
;
root_happy_dev
=
hp
;
...
...
@@ -3173,11 +3191,13 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
err_out_iounmap:
iounmap
((
void
*
)
hp
->
gregs
);
err_out_free_res:
pci_release_regions
(
pdev
);
err_out_clear_quattro:
if
(
qp
!=
NULL
)
qp
->
happy_meals
[
qfe_slot
]
=
NULL
;
unregister_netdev
(
dev
);
kfree
(
dev
);
err_out:
...
...
@@ -3228,6 +3248,7 @@ static int __init happy_meal_pci_probe(void)
PCI_DEVICE_ID_SUN_HAPPYMEAL
,
pdev
))
!=
NULL
)
{
if
(
pci_enable_device
(
pdev
))
continue
;
pci_set_master
(
pdev
);
cards
++
;
happy_meal_pci_init
(
pdev
);
}
...
...
@@ -3302,6 +3323,7 @@ static void __exit happy_meal_cleanup_module(void)
hp
->
happy_block
,
hp
->
hblock_dvma
);
iounmap
((
void
*
)
hp
->
gregs
);
pci_release_regions
(
hp
->
happy_dev
);
}
#endif
kfree
(
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