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
4f62d158
Commit
4f62d158
authored
Jun 23, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PARPORT] sunbpp: Convert to new SBUS device framework.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
9eccf1b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
64 deletions
+70
-64
drivers/parport/parport_sunbpp.c
drivers/parport/parport_sunbpp.c
+70
-64
No files found.
drivers/parport/parport_sunbpp.c
View file @
4f62d158
/* $Id: parport_sunbpp.c,v 1.12 2001/05/26 03:01:42 davem Exp $
/* parport_sunbpp.c: Parallel-port routines for SBUS
* Parallel-port routines for Sun architecture
*
*
* Author: Derrick J. Brashear <shadow@dementia.org>
* Author: Derrick J. Brashear <shadow@dementia.org>
*
*
...
@@ -14,6 +13,9 @@
...
@@ -14,6 +13,9 @@
* Gus Baldauf (gbaldauf@ix.netcom.com)
* Gus Baldauf (gbaldauf@ix.netcom.com)
* Peter Zaitcev
* Peter Zaitcev
* Tom Dyas
* Tom Dyas
*
* Updated to new SBUS device framework: David S. Miller <davem@davemloft.net>
*
*/
*/
#include <linux/string.h>
#include <linux/string.h>
...
@@ -287,14 +289,7 @@ static struct parport_operations parport_sunbpp_ops =
...
@@ -287,14 +289,7 @@ static struct parport_operations parport_sunbpp_ops =
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
};
};
typedef
struct
{
static
int
__devinit
init_one_port
(
struct
sbus_dev
*
sdev
)
struct
list_head
list
;
struct
parport
*
port
;
}
Node
;
/* no locks, everything's serialized */
static
LIST_HEAD
(
port_list
);
static
int
__init
init_one_port
(
struct
sbus_dev
*
sdev
)
{
{
struct
parport
*
p
;
struct
parport
*
p
;
/* at least in theory there may be a "we don't dma" case */
/* at least in theory there may be a "we don't dma" case */
...
@@ -303,109 +298,120 @@ static int __init init_one_port(struct sbus_dev *sdev)
...
@@ -303,109 +298,120 @@ static int __init init_one_port(struct sbus_dev *sdev)
int
irq
,
dma
,
err
=
0
,
size
;
int
irq
,
dma
,
err
=
0
,
size
;
struct
bpp_regs
__iomem
*
regs
;
struct
bpp_regs
__iomem
*
regs
;
unsigned
char
value_tcr
;
unsigned
char
value_tcr
;
Node
*
node
;
dprintk
((
KERN_DEBUG
"init_one_port(%p): ranges, alloc_io, "
,
sdev
));
node
=
kmalloc
(
sizeof
(
Node
),
GFP_KERNEL
);
if
(
!
node
)
goto
out0
;
irq
=
sdev
->
irqs
[
0
];
irq
=
sdev
->
irqs
[
0
];
base
=
sbus_ioremap
(
&
sdev
->
resource
[
0
],
0
,
base
=
sbus_ioremap
(
&
sdev
->
resource
[
0
],
0
,
sdev
->
reg_addrs
[
0
].
reg_size
,
sdev
->
reg_addrs
[
0
].
reg_size
,
"sunbpp"
);
"sunbpp"
);
if
(
!
base
)
if
(
!
base
)
goto
out1
;
return
-
ENODEV
;
size
=
sdev
->
reg_addrs
[
0
].
reg_size
;
size
=
sdev
->
reg_addrs
[
0
].
reg_size
;
dma
=
PARPORT_DMA_NONE
;
dma
=
PARPORT_DMA_NONE
;
dprintk
((
"alloc(ppops), "
));
ops
=
kmalloc
(
sizeof
(
struct
parport_operations
),
GFP_KERNEL
);
ops
=
kmalloc
(
sizeof
(
struct
parport_operations
),
GFP_KERNEL
);
if
(
!
ops
)
if
(
!
ops
)
goto
out
2
;
goto
out
_unmap
;
memcpy
(
ops
,
&
parport_sunbpp_ops
,
sizeof
(
struct
parport_operations
));
memcpy
(
ops
,
&
parport_sunbpp_ops
,
sizeof
(
struct
parport_operations
));
dprintk
((
"register_port
\n
"
));
dprintk
((
"register_port
\n
"
));
if
(
!
(
p
=
parport_register_port
((
unsigned
long
)
base
,
irq
,
dma
,
ops
)))
if
(
!
(
p
=
parport_register_port
((
unsigned
long
)
base
,
irq
,
dma
,
ops
)))
goto
out
3
;
goto
out
_free_ops
;
p
->
size
=
size
;
p
->
size
=
size
;
dprintk
((
KERN_DEBUG
"init_one_port: request_irq(%08x:%p:%x:%s:%p) "
,
p
->
irq
,
parport_sunbpp_interrupt
,
SA_SHIRQ
,
p
->
name
,
p
));
if
((
err
=
request_irq
(
p
->
irq
,
parport_sunbpp_interrupt
,
if
((
err
=
request_irq
(
p
->
irq
,
parport_sunbpp_interrupt
,
SA_SHIRQ
,
p
->
name
,
p
))
!=
0
)
{
SA_SHIRQ
,
p
->
name
,
p
))
!=
0
)
{
dprintk
((
"ERROR %d
\n
"
,
err
));
goto
out_put_port
;
goto
out4
;
}
}
dprintk
((
"OK
\n
"
));
parport_sunbpp_enable_irq
(
p
);
parport_sunbpp_enable_irq
(
p
);
regs
=
(
struct
bpp_regs
__iomem
*
)
p
->
base
;
regs
=
(
struct
bpp_regs
__iomem
*
)
p
->
base
;
dprintk
((
KERN_DEBUG
"forward
\n
"
));
value_tcr
=
sbus_readb
(
&
regs
->
p_tcr
);
value_tcr
=
sbus_readb
(
&
regs
->
p_tcr
);
value_tcr
&=
~
P_TCR_DIR
;
value_tcr
&=
~
P_TCR_DIR
;
sbus_writeb
(
value_tcr
,
&
regs
->
p_tcr
);
sbus_writeb
(
value_tcr
,
&
regs
->
p_tcr
);
printk
(
KERN_INFO
"%s: sunbpp at 0x%lx
\n
"
,
p
->
name
,
p
->
base
);
printk
(
KERN_INFO
"%s: sunbpp at 0x%lx
\n
"
,
p
->
name
,
p
->
base
);
node
->
port
=
p
;
list_add
(
&
node
->
list
,
&
port_list
);
parport_announce_port
(
p
);
return
1
;
dev_set_drvdata
(
&
sdev
->
ofdev
.
dev
,
p
);
parport_announce_port
(
p
);
return
0
;
out
4
:
out
_put_port
:
parport_put_port
(
p
);
parport_put_port
(
p
);
out3:
out_free_ops:
kfree
(
ops
);
kfree
(
ops
);
out2:
out_unmap:
sbus_iounmap
(
base
,
size
);
sbus_iounmap
(
base
,
size
);
out1:
kfree
(
node
);
out0:
return
err
;
return
err
;
}
}
static
int
__
init
parport_sunbpp_init
(
void
)
static
int
__
devinit
bpp_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
{
{
struct
sbus_bus
*
sbus
;
struct
sbus_dev
*
sdev
=
to_sbus_device
(
&
dev
->
dev
);
struct
sbus_dev
*
sdev
;
int
count
=
0
;
return
init_one_port
(
sdev
);
for_each_sbus
(
sbus
)
{
for_each_sbusdev
(
sdev
,
sbus
)
{
if
(
!
strcmp
(
sdev
->
prom_name
,
"SUNW,bpp"
))
count
+=
init_one_port
(
sdev
);
}
}
return
count
?
0
:
-
ENODEV
;
}
}
static
void
__exit
parport_sunbpp_exit
(
void
)
static
int
__devexit
bpp_remove
(
struct
of_device
*
dev
)
{
{
while
(
!
list_empty
(
&
port_list
))
{
struct
parport
*
p
=
dev_get_drvdata
(
&
dev
->
dev
);
Node
*
node
=
list_entry
(
port_list
.
next
,
Node
,
list
);
struct
parport
*
p
=
node
->
port
;
struct
parport_operations
*
ops
=
p
->
ops
;
struct
parport_operations
*
ops
=
p
->
ops
;
parport_remove_port
(
p
);
parport_remove_port
(
p
);
if
(
p
->
irq
!=
PARPORT_IRQ_NONE
)
{
if
(
p
->
irq
!=
PARPORT_IRQ_NONE
)
{
parport_sunbpp_disable_irq
(
p
);
parport_sunbpp_disable_irq
(
p
);
free_irq
(
p
->
irq
,
p
);
free_irq
(
p
->
irq
,
p
);
}
}
sbus_iounmap
((
void
__iomem
*
)
p
->
base
,
p
->
size
);
sbus_iounmap
((
void
__iomem
*
)
p
->
base
,
p
->
size
);
parport_put_port
(
p
);
parport_put_port
(
p
);
kfree
(
ops
);
kfree
(
ops
);
list_del
(
&
node
->
list
);
kfree
(
node
);
dev_set_drvdata
(
&
dev
->
dev
,
NULL
);
}
return
0
;
}
static
struct
of_device_id
bpp_match
[]
=
{
{
.
name
=
"SUNW,bpp"
,
},
{},
};
MODULE_DEVICE_TABLE
(
of
,
qec_sbus_match
);
static
struct
of_platform_driver
bpp_sbus_driver
=
{
.
name
=
"bpp"
,
.
match_table
=
bpp_match
,
.
probe
=
bpp_probe
,
.
remove
=
__devexit_p
(
bpp_remove
),
};
static
int
__init
parport_sunbpp_init
(
void
)
{
return
of_register_driver
(
&
bpp_sbus_driver
,
&
sbus_bus_type
);
}
static
void
__exit
parport_sunbpp_exit
(
void
)
{
of_unregister_driver
(
&
bpp_sbus_driver
);
}
}
MODULE_AUTHOR
(
"Derrick J Brashear"
);
MODULE_AUTHOR
(
"Derrick J Brashear"
);
MODULE_DESCRIPTION
(
"Parport Driver for Sparc bidirectional Port"
);
MODULE_DESCRIPTION
(
"Parport Driver for Sparc bidirectional Port"
);
MODULE_SUPPORTED_DEVICE
(
"Sparc Bidirectional Parallel Port"
);
MODULE_SUPPORTED_DEVICE
(
"Sparc Bidirectional Parallel Port"
);
MODULE_VERSION
(
"2.0"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
module_init
(
parport_sunbpp_init
)
module_init
(
parport_sunbpp_init
)
...
...
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