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
308fd19d
Commit
308fd19d
authored
Feb 13, 2005
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge pobox.com:/garz/repo/netdev-2.6/dscc4
into pobox.com:/garz/repo/net-drivers-2.6
parents
bcbdd32c
3adae6e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
56 deletions
+61
-56
drivers/net/wan/dscc4.c
drivers/net/wan/dscc4.c
+61
-56
No files found.
drivers/net/wan/dscc4.c
View file @
308fd19d
...
@@ -691,7 +691,7 @@ static void dscc4_free1(struct pci_dev *pdev)
...
@@ -691,7 +691,7 @@ static void dscc4_free1(struct pci_dev *pdev)
root
=
ppriv
->
root
;
root
=
ppriv
->
root
;
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
unregister_hdlc_device
(
dscc4_to_dev
(
&
root
[
i
]
));
unregister_hdlc_device
(
dscc4_to_dev
(
root
+
i
));
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
...
@@ -706,33 +706,36 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -706,33 +706,36 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
{
{
struct
dscc4_pci_priv
*
priv
;
struct
dscc4_pci_priv
*
priv
;
struct
dscc4_dev_priv
*
dpriv
;
struct
dscc4_dev_priv
*
dpriv
;
static
int
cards_found
=
0
;
void
__iomem
*
ioaddr
;
void
__iomem
*
ioaddr
;
int
i
;
int
i
,
rc
;
printk
(
KERN_DEBUG
"%s"
,
version
);
printk
(
KERN_DEBUG
"%s"
,
version
);
if
(
pci_enable_device
(
pdev
))
rc
=
pci_enable_device
(
pdev
);
goto
err_out
;
if
(
rc
<
0
)
if
(
!
request_mem_region
(
pci_resource_start
(
pdev
,
0
),
goto
out
;
pci_resource_len
(
pdev
,
0
),
"registers"
))
{
rc
=
pci_request_region
(
pdev
,
0
,
"registers"
);
if
(
rc
<
0
)
{
printk
(
KERN_ERR
"%s: can't reserve MMIO region (regs)
\n
"
,
printk
(
KERN_ERR
"%s: can't reserve MMIO region (regs)
\n
"
,
DRV_NAME
);
DRV_NAME
);
goto
err_
out
;
goto
err_
disable_0
;
}
}
if
(
!
request_mem_region
(
pci_resource_start
(
pdev
,
1
),
rc
=
pci_request_region
(
pdev
,
1
,
"LBI interface"
);
pci_resource_len
(
pdev
,
1
),
"LBI interface"
)
)
{
if
(
rc
<
0
)
{
printk
(
KERN_ERR
"%s: can't reserve MMIO region (lbi)
\n
"
,
printk
(
KERN_ERR
"%s: can't reserve MMIO region (lbi)
\n
"
,
DRV_NAME
);
DRV_NAME
);
goto
err_
out_free_mmio_region0
;
goto
err_
free_mmio_region_1
;
}
}
ioaddr
=
ioremap
(
pci_resource_start
(
pdev
,
0
),
ioaddr
=
ioremap
(
pci_resource_start
(
pdev
,
0
),
pci_resource_len
(
pdev
,
0
));
pci_resource_len
(
pdev
,
0
));
if
(
!
ioaddr
)
{
if
(
!
ioaddr
)
{
printk
(
KERN_ERR
"%s: cannot remap MMIO region %lx @ %lx
\n
"
,
printk
(
KERN_ERR
"%s: cannot remap MMIO region %lx @ %lx
\n
"
,
DRV_NAME
,
pci_resource_len
(
pdev
,
0
),
DRV_NAME
,
pci_resource_len
(
pdev
,
0
),
pci_resource_start
(
pdev
,
0
));
pci_resource_start
(
pdev
,
0
));
goto
err_out_free_mmio_region
;
rc
=
-
EIO
;
goto
err_free_mmio_regions_2
;
}
}
printk
(
KERN_DEBUG
"Siemens DSCC4, MMIO at %#lx (regs), %#lx (lbi), IRQ %d
\n
"
,
printk
(
KERN_DEBUG
"Siemens DSCC4, MMIO at %#lx (regs), %#lx (lbi), IRQ %d
\n
"
,
pci_resource_start
(
pdev
,
0
),
pci_resource_start
(
pdev
,
0
),
...
@@ -742,14 +745,16 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -742,14 +745,16 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
pci_write_config_byte
(
pdev
,
PCI_LATENCY_TIMER
,
0xf8
);
pci_write_config_byte
(
pdev
,
PCI_LATENCY_TIMER
,
0xf8
);
pci_set_master
(
pdev
);
pci_set_master
(
pdev
);
if
(
dscc4_found1
(
pdev
,
ioaddr
))
rc
=
dscc4_found1
(
pdev
,
ioaddr
);
goto
err_out_iounmap
;
if
(
rc
<
0
)
goto
err_iounmap_3
;
priv
=
(
struct
dscc4_pci_priv
*
)
pci_get_drvdata
(
pdev
);
priv
=
pci_get_drvdata
(
pdev
);
if
(
request_irq
(
pdev
->
irq
,
&
dscc4_irq
,
SA_SHIRQ
,
DRV_NAME
,
priv
->
root
)){
rc
=
request_irq
(
pdev
->
irq
,
dscc4_irq
,
SA_SHIRQ
,
DRV_NAME
,
priv
->
root
);
if
(
rc
<
0
)
{
printk
(
KERN_WARNING
"%s: IRQ %d busy
\n
"
,
DRV_NAME
,
pdev
->
irq
);
printk
(
KERN_WARNING
"%s: IRQ %d busy
\n
"
,
DRV_NAME
,
pdev
->
irq
);
goto
err_
out_free1
;
goto
err_
release_4
;
}
}
/* power up/little endian/dma core controlled via lrda/ltda */
/* power up/little endian/dma core controlled via lrda/ltda */
...
@@ -769,9 +774,11 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -769,9 +774,11 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
priv
->
iqcfg
=
(
u32
*
)
pci_alloc_consistent
(
pdev
,
priv
->
iqcfg
=
(
u32
*
)
pci_alloc_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
&
priv
->
iqcfg_dma
);
IRQ_RING_SIZE
*
sizeof
(
u32
),
&
priv
->
iqcfg_dma
);
if
(
!
priv
->
iqcfg
)
if
(
!
priv
->
iqcfg
)
goto
err_
out_free_irq
;
goto
err_
free_irq_5
;
writel
(
priv
->
iqcfg_dma
,
ioaddr
+
IQCFG
);
writel
(
priv
->
iqcfg_dma
,
ioaddr
+
IQCFG
);
rc
=
-
ENOMEM
;
/*
/*
* SCC 0-3 private rx/tx irq structures
* SCC 0-3 private rx/tx irq structures
* IQRX/TXi needs to be set soon. Learned it the hard way...
* IQRX/TXi needs to be set soon. Learned it the hard way...
...
@@ -781,7 +788,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -781,7 +788,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
dpriv
->
iqtx
=
(
u32
*
)
pci_alloc_consistent
(
pdev
,
dpriv
->
iqtx
=
(
u32
*
)
pci_alloc_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
&
dpriv
->
iqtx_dma
);
IRQ_RING_SIZE
*
sizeof
(
u32
),
&
dpriv
->
iqtx_dma
);
if
(
!
dpriv
->
iqtx
)
if
(
!
dpriv
->
iqtx
)
goto
err_
out_free_iqtx
;
goto
err_
free_iqtx_6
;
writel
(
dpriv
->
iqtx_dma
,
ioaddr
+
IQTX0
+
i
*
4
);
writel
(
dpriv
->
iqtx_dma
,
ioaddr
+
IQTX0
+
i
*
4
);
}
}
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
{
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
{
...
@@ -789,7 +796,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -789,7 +796,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
dpriv
->
iqrx
=
(
u32
*
)
pci_alloc_consistent
(
pdev
,
dpriv
->
iqrx
=
(
u32
*
)
pci_alloc_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
&
dpriv
->
iqrx_dma
);
IRQ_RING_SIZE
*
sizeof
(
u32
),
&
dpriv
->
iqrx_dma
);
if
(
!
dpriv
->
iqrx
)
if
(
!
dpriv
->
iqrx
)
goto
err_
out_free_iqrx
;
goto
err_
free_iqrx_7
;
writel
(
dpriv
->
iqrx_dma
,
ioaddr
+
IQRX0
+
i
*
4
);
writel
(
dpriv
->
iqrx_dma
,
ioaddr
+
IQRX0
+
i
*
4
);
}
}
...
@@ -804,17 +811,18 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -804,17 +811,18 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
writel
(
0xff200001
,
ioaddr
+
GCMDR
);
writel
(
0xff200001
,
ioaddr
+
GCMDR
);
cards_found
++
;
rc
=
0
;
return
0
;
out:
return
rc
;
err_
out_free_iqrx
:
err_
free_iqrx_7
:
while
(
--
i
>=
0
)
{
while
(
--
i
>=
0
)
{
dpriv
=
priv
->
root
+
i
;
dpriv
=
priv
->
root
+
i
;
pci_free_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
pci_free_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
dpriv
->
iqrx
,
dpriv
->
iqrx_dma
);
dpriv
->
iqrx
,
dpriv
->
iqrx_dma
);
}
}
i
=
dev_per_card
;
i
=
dev_per_card
;
err_
out_free_iqtx
:
err_
free_iqtx_6
:
while
(
--
i
>=
0
)
{
while
(
--
i
>=
0
)
{
dpriv
=
priv
->
root
+
i
;
dpriv
=
priv
->
root
+
i
;
pci_free_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
pci_free_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
...
@@ -822,20 +830,19 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
...
@@ -822,20 +830,19 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
}
}
pci_free_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
priv
->
iqcfg
,
pci_free_consistent
(
pdev
,
IRQ_RING_SIZE
*
sizeof
(
u32
),
priv
->
iqcfg
,
priv
->
iqcfg_dma
);
priv
->
iqcfg_dma
);
err_
out_free_irq
:
err_
free_irq_5
:
free_irq
(
pdev
->
irq
,
priv
->
root
);
free_irq
(
pdev
->
irq
,
priv
->
root
);
err_
out_free1
:
err_
release_4
:
dscc4_free1
(
pdev
);
dscc4_free1
(
pdev
);
err_
out_iounmap
:
err_
iounmap_3
:
iounmap
(
ioaddr
);
iounmap
(
ioaddr
);
err_out_free_mmio_region:
err_free_mmio_regions_2:
release_mem_region
(
pci_resource_start
(
pdev
,
1
),
pci_release_region
(
pdev
,
1
);
pci_resource_len
(
pdev
,
1
));
err_free_mmio_region_1:
err_out_free_mmio_region0:
pci_release_region
(
pdev
,
0
);
release_mem_region
(
pci_resource_start
(
pdev
,
0
),
err_disable_0:
pci_resource_len
(
pdev
,
0
));
pci_disable_device
(
pdev
);
err_out:
goto
out
;
return
-
ENODEV
;
};
};
/*
/*
...
@@ -882,8 +889,7 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
...
@@ -882,8 +889,7 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
struct
dscc4_dev_priv
*
root
;
struct
dscc4_dev_priv
*
root
;
int
i
,
ret
=
-
ENOMEM
;
int
i
,
ret
=
-
ENOMEM
;
root
=
(
struct
dscc4_dev_priv
*
)
root
=
kmalloc
(
dev_per_card
*
sizeof
(
*
root
),
GFP_KERNEL
);
kmalloc
(
dev_per_card
*
sizeof
(
*
root
),
GFP_KERNEL
);
if
(
!
root
)
{
if
(
!
root
)
{
printk
(
KERN_ERR
"%s: can't allocate data
\n
"
,
DRV_NAME
);
printk
(
KERN_ERR
"%s: can't allocate data
\n
"
,
DRV_NAME
);
goto
err_out
;
goto
err_out
;
...
@@ -892,22 +898,17 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
...
@@ -892,22 +898,17 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
{
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
{
root
[
i
].
dev
=
alloc_hdlcdev
(
root
+
i
);
root
[
i
].
dev
=
alloc_hdlcdev
(
root
+
i
);
if
(
!
root
[
i
].
dev
)
{
if
(
!
root
[
i
].
dev
)
while
(
i
--
)
free_netdev
(
root
[
i
].
dev
);
goto
err_free_dev
;
goto
err_free_dev
;
}
}
}
ppriv
=
(
struct
dscc4_pci_priv
*
)
kmalloc
(
sizeof
(
*
ppriv
),
GFP_KERNEL
);
ppriv
=
kmalloc
(
sizeof
(
*
ppriv
),
GFP_KERNEL
);
if
(
!
ppriv
)
{
if
(
!
ppriv
)
{
printk
(
KERN_ERR
"%s: can't allocate private data
\n
"
,
DRV_NAME
);
printk
(
KERN_ERR
"%s: can't allocate private data
\n
"
,
DRV_NAME
);
goto
err_free_dev
2
;
goto
err_free_dev
;
}
}
memset
(
ppriv
,
0
,
sizeof
(
struct
dscc4_pci_priv
));
memset
(
ppriv
,
0
,
sizeof
(
struct
dscc4_pci_priv
));
ret
=
dscc4_set_quartz
(
root
,
quartz
);
if
(
ret
<
0
)
goto
err_free_priv
;
ppriv
->
root
=
root
;
ppriv
->
root
=
root
;
spin_lock_init
(
&
ppriv
->
lock
);
spin_lock_init
(
&
ppriv
->
lock
);
...
@@ -951,20 +952,24 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
...
@@ -951,20 +952,24 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
goto
err_unregister
;
goto
err_unregister
;
}
}
}
}
ret
=
dscc4_set_quartz
(
root
,
quartz
);
if
(
ret
<
0
)
goto
err_unregister
;
pci_set_drvdata
(
pdev
,
ppriv
);
pci_set_drvdata
(
pdev
,
ppriv
);
return
ret
;
return
ret
;
err_unregister:
err_unregister:
while
(
--
i
>=
0
)
{
while
(
i
--
>
0
)
{
dscc4_release_ring
(
root
+
i
);
dscc4_release_ring
(
root
+
i
);
unregister_hdlc_device
(
dscc4_to_dev
(
&
root
[
i
]
));
unregister_hdlc_device
(
dscc4_to_dev
(
root
+
i
));
}
}
err_free_priv:
kfree
(
ppriv
);
kfree
(
ppriv
);
err_free_dev2:
i
=
dev_per_card
;
for
(
i
=
0
;
i
<
dev_per_card
;
i
++
)
free_netdev
(
root
[
i
].
dev
);
err_free_dev:
err_free_dev:
while
(
i
--
>
0
)
free_netdev
(
root
[
i
].
dev
);
kfree
(
root
);
kfree
(
root
);
err_out:
err_out:
return
ret
;
return
ret
;
...
@@ -1998,10 +2003,10 @@ static void __devexit dscc4_remove_one(struct pci_dev *pdev)
...
@@ -1998,10 +2003,10 @@ static void __devexit dscc4_remove_one(struct pci_dev *pdev)
iounmap
(
ioaddr
);
iounmap
(
ioaddr
);
release_mem_region
(
pci_resource_start
(
pdev
,
1
),
pci_release_region
(
pdev
,
1
);
pci_resource_len
(
pdev
,
1
)
);
pci_release_region
(
pdev
,
0
);
release_mem_region
(
pci_resource_start
(
pdev
,
0
),
pci_resource_len
(
pdev
,
0
)
);
pci_disable_device
(
pdev
);
}
}
static
int
dscc4_hdlc_attach
(
struct
net_device
*
dev
,
unsigned
short
encoding
,
static
int
dscc4_hdlc_attach
(
struct
net_device
*
dev
,
unsigned
short
encoding
,
...
...
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