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
3ae627a1
Commit
3ae627a1
authored
Aug 29, 2008
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sparc64: Convert EBUS floppy support to pure OF driver.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
aae7fb87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
50 deletions
+36
-50
arch/sparc/include/asm/floppy_64.h
arch/sparc/include/asm/floppy_64.h
+36
-50
No files found.
arch/sparc/include/asm/floppy_64.h
View file @
3ae627a1
...
@@ -9,19 +9,11 @@
...
@@ -9,19 +9,11 @@
#ifndef __ASM_SPARC64_FLOPPY_H
#ifndef __ASM_SPARC64_FLOPPY_H
#define __ASM_SPARC64_FLOPPY_H
#define __ASM_SPARC64_FLOPPY_H
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_device.h>
#include <linux/dma-mapping.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/idprom.h>
#include <asm/oplib.h>
#include <asm/auxio.h>
#include <asm/auxio.h>
#include <asm/irq.h>
/*
/*
* Define this to enable exchanging drive 0 and 1 if only drive 1 is
* Define this to enable exchanging drive 0 and 1 if only drive 1 is
...
@@ -292,13 +284,11 @@ static int sun_fd_eject(int drive)
...
@@ -292,13 +284,11 @@ static int sun_fd_eject(int drive)
return
0
;
return
0
;
}
}
#ifdef CONFIG_PCI
#include <asm/ebus.h>
#include <asm/ebus_dma.h>
#include <asm/ebus_dma.h>
#include <asm/ns87303.h>
#include <asm/ns87303.h>
static
struct
ebus_dma_info
sun_pci_fd_ebus_dma
;
static
struct
ebus_dma_info
sun_pci_fd_ebus_dma
;
static
struct
pci_dev
*
sun_pci_ebus
_dev
;
static
struct
device
*
sun_floppy
_dev
;
static
int
sun_pci_broken_drive
=
-
1
;
static
int
sun_pci_broken_drive
=
-
1
;
struct
sun_pci_dma_op
{
struct
sun_pci_dma_op
{
...
@@ -379,7 +369,7 @@ static void sun_pci_fd_enable_dma(void)
...
@@ -379,7 +369,7 @@ static void sun_pci_fd_enable_dma(void)
sun_pci_dma_pending
.
addr
=
-
1U
;
sun_pci_dma_pending
.
addr
=
-
1U
;
sun_pci_dma_current
.
addr
=
sun_pci_dma_current
.
addr
=
pci_map_single
(
sun_pci_ebus
_dev
,
dma_map_single
(
sun_floppy
_dev
,
sun_pci_dma_current
.
buf
,
sun_pci_dma_current
.
buf
,
sun_pci_dma_current
.
len
,
sun_pci_dma_current
.
len
,
sun_pci_dma_current
.
direction
);
sun_pci_dma_current
.
direction
);
...
@@ -396,7 +386,7 @@ static void sun_pci_fd_disable_dma(void)
...
@@ -396,7 +386,7 @@ static void sun_pci_fd_disable_dma(void)
{
{
ebus_dma_enable
(
&
sun_pci_fd_ebus_dma
,
0
);
ebus_dma_enable
(
&
sun_pci_fd_ebus_dma
,
0
);
if
(
sun_pci_dma_current
.
addr
!=
-
1U
)
if
(
sun_pci_dma_current
.
addr
!=
-
1U
)
pci_unmap_single
(
sun_pci_ebus
_dev
,
dma_unmap_single
(
sun_floppy
_dev
,
sun_pci_dma_current
.
addr
,
sun_pci_dma_current
.
addr
,
sun_pci_dma_current
.
len
,
sun_pci_dma_current
.
len
,
sun_pci_dma_current
.
direction
);
sun_pci_dma_current
.
direction
);
...
@@ -406,9 +396,9 @@ static void sun_pci_fd_disable_dma(void)
...
@@ -406,9 +396,9 @@ static void sun_pci_fd_disable_dma(void)
static
void
sun_pci_fd_set_dma_mode
(
int
mode
)
static
void
sun_pci_fd_set_dma_mode
(
int
mode
)
{
{
if
(
mode
==
DMA_MODE_WRITE
)
if
(
mode
==
DMA_MODE_WRITE
)
sun_pci_dma_pending
.
direction
=
PCI_DMA_TO
DEVICE
;
sun_pci_dma_pending
.
direction
=
DMA_TO_
DEVICE
;
else
else
sun_pci_dma_pending
.
direction
=
PCI_DMA_FROM
DEVICE
;
sun_pci_dma_pending
.
direction
=
DMA_FROM_
DEVICE
;
ebus_dma_prepare
(
&
sun_pci_fd_ebus_dma
,
mode
!=
DMA_MODE_WRITE
);
ebus_dma_prepare
(
&
sun_pci_fd_ebus_dma
,
mode
!=
DMA_MODE_WRITE
);
}
}
...
@@ -540,24 +530,19 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
...
@@ -540,24 +530,19 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
#undef MSR
#undef MSR
#undef DOR
#undef DOR
#endif
/* CONFIG_PCI */
static
int
__init
ebus_fdthree_p
(
struct
device_node
*
dp
)
#ifdef CONFIG_PCI
static
int
__init
ebus_fdthree_p
(
struct
linux_ebus_device
*
edev
)
{
{
if
(
!
strcmp
(
edev
->
prom_node
->
name
,
"fdthree"
))
if
(
!
strcmp
(
dp
->
name
,
"fdthree"
))
return
1
;
return
1
;
if
(
!
strcmp
(
edev
->
prom_node
->
name
,
"floppy"
))
{
if
(
!
strcmp
(
dp
->
name
,
"floppy"
))
{
const
char
*
compat
;
const
char
*
compat
;
compat
=
of_get_property
(
edev
->
prom_node
,
compat
=
of_get_property
(
dp
,
"compatible"
,
NULL
);
"compatible"
,
NULL
);
if
(
compat
&&
!
strcmp
(
compat
,
"fdthree"
))
if
(
compat
&&
!
strcmp
(
compat
,
"fdthree"
))
return
1
;
return
1
;
}
}
return
0
;
return
0
;
}
}
#endif
static
unsigned
long
__init
sun_floppy_init
(
void
)
static
unsigned
long
__init
sun_floppy_init
(
void
)
{
{
...
@@ -584,44 +569,45 @@ static unsigned long __init sun_floppy_init(void)
...
@@ -584,44 +569,45 @@ static unsigned long __init sun_floppy_init(void)
floppy_op
=
op
;
floppy_op
=
op
;
FLOPPY_IRQ
=
op
->
irqs
[
0
];
FLOPPY_IRQ
=
op
->
irqs
[
0
];
}
else
{
}
else
{
#ifdef CONFIG_PCI
struct
device_node
*
ebus_dp
;
struct
linux_ebus
*
ebus
;
struct
linux_ebus_device
*
edev
=
NULL
;
unsigned
long
config
=
0
;
void
__iomem
*
auxio_reg
;
void
__iomem
*
auxio_reg
;
const
char
*
state_prop
;
const
char
*
state_prop
;
unsigned
long
config
;
for_each_ebus
(
ebus
)
{
dp
=
NULL
;
for_each_ebusdev
(
edev
,
ebus
)
{
for_each_node_by_name
(
ebus_dp
,
"ebus"
)
{
if
(
ebus_fdthree_p
(
edev
))
for
(
dp
=
ebus_dp
->
child
;
dp
;
dp
=
dp
->
sibling
)
{
goto
ebus_done
;
if
(
ebus_fdthree_p
(
dp
))
goto
found_fdthree
;
}
}
}
}
ebus_don
e:
found_fdthre
e:
if
(
!
edev
)
if
(
!
dp
)
return
0
;
return
0
;
op
=
&
edev
->
ofdev
;
op
=
of_find_device_by_node
(
dp
);
if
(
!
op
)
return
0
;
state_prop
=
of_get_property
(
op
->
node
,
"status"
,
NULL
);
state_prop
=
of_get_property
(
op
->
node
,
"status"
,
NULL
);
if
(
state_prop
&&
!
strncmp
(
state_prop
,
"disabled"
,
8
))
if
(
state_prop
&&
!
strncmp
(
state_prop
,
"disabled"
,
8
))
return
0
;
return
0
;
FLOPPY_IRQ
=
edev
->
irqs
[
0
];
FLOPPY_IRQ
=
op
->
irqs
[
0
];
/* Make sure the high density bit is set, some systems
/* Make sure the high density bit is set, some systems
* (most notably Ultra5/Ultra10) come up with it clear.
* (most notably Ultra5/Ultra10) come up with it clear.
*/
*/
auxio_reg
=
(
void
__iomem
*
)
edev
->
resource
[
2
].
start
;
auxio_reg
=
(
void
__iomem
*
)
op
->
resource
[
2
].
start
;
writel
(
readl
(
auxio_reg
)
|
0x2
,
auxio_reg
);
writel
(
readl
(
auxio_reg
)
|
0x2
,
auxio_reg
);
sun_
pci_ebus_dev
=
ebus
->
self
;
sun_
floppy_dev
=
&
op
->
dev
;
spin_lock_init
(
&
sun_pci_fd_ebus_dma
.
lock
);
spin_lock_init
(
&
sun_pci_fd_ebus_dma
.
lock
);
/* XXX ioremap */
/* XXX ioremap */
sun_pci_fd_ebus_dma
.
regs
=
(
void
__iomem
*
)
sun_pci_fd_ebus_dma
.
regs
=
(
void
__iomem
*
)
edev
->
resource
[
1
].
start
;
op
->
resource
[
1
].
start
;
if
(
!
sun_pci_fd_ebus_dma
.
regs
)
if
(
!
sun_pci_fd_ebus_dma
.
regs
)
return
0
;
return
0
;
...
@@ -635,7 +621,7 @@ static unsigned long __init sun_floppy_init(void)
...
@@ -635,7 +621,7 @@ static unsigned long __init sun_floppy_init(void)
return
0
;
return
0
;
/* XXX ioremap */
/* XXX ioremap */
sun_fdc
=
(
struct
sun_flpy_controller
*
)
edev
->
resource
[
0
].
start
;
sun_fdc
=
(
struct
sun_flpy_controller
*
)
op
->
resource
[
0
].
start
;
sun_fdops
.
fd_inb
=
sun_pci_fd_inb
;
sun_fdops
.
fd_inb
=
sun_pci_fd_inb
;
sun_fdops
.
fd_outb
=
sun_pci_fd_outb
;
sun_fdops
.
fd_outb
=
sun_pci_fd_outb
;
...
@@ -672,12 +658,15 @@ static unsigned long __init sun_floppy_init(void)
...
@@ -672,12 +658,15 @@ static unsigned long __init sun_floppy_init(void)
/*
/*
* Find NS87303 SuperIO config registers (through ecpp).
* Find NS87303 SuperIO config registers (through ecpp).
*/
*/
for_each_ebus
(
ebus
)
{
config
=
0
;
for_each_ebusdev
(
edev
,
ebus
)
{
for
(
dp
=
ebus_dp
->
child
;
dp
;
dp
=
dp
->
sibling
)
{
if
(
!
strcmp
(
edev
->
prom_node
->
name
,
"ecpp"
))
{
if
(
!
strcmp
(
dp
->
name
,
"ecpp"
))
{
config
=
edev
->
resource
[
1
].
start
;
struct
of_device
*
ecpp_op
;
goto
config_done
;
}
ecpp_op
=
of_find_device_by_node
(
dp
);
if
(
ecpp_op
)
config
=
ecpp_op
->
resource
[
1
].
start
;
goto
config_done
;
}
}
}
}
config_done:
config_done:
...
@@ -726,9 +715,6 @@ static unsigned long __init sun_floppy_init(void)
...
@@ -726,9 +715,6 @@ static unsigned long __init sun_floppy_init(void)
#endif
/* PCI_FDC_SWAP_DRIVES */
#endif
/* PCI_FDC_SWAP_DRIVES */
return
sun_floppy_types
[
0
];
return
sun_floppy_types
[
0
];
#else
return
0
;
#endif
}
}
prop
=
of_get_property
(
op
->
node
,
"status"
,
NULL
);
prop
=
of_get_property
(
op
->
node
,
"status"
,
NULL
);
if
(
prop
&&
!
strncmp
(
state
,
"disabled"
,
8
))
if
(
prop
&&
!
strncmp
(
state
,
"disabled"
,
8
))
...
...
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