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
8fe6710a
Commit
8fe6710a
authored
Aug 30, 2004
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MMC] MMCI: split the PIO data read and write paths.
parent
2dfa8b1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
29 deletions
+64
-29
drivers/mmc/mmci.c
drivers/mmc/mmci.c
+64
-29
No files found.
drivers/mmc/mmci.c
View file @
8fe6710a
...
...
@@ -191,54 +191,89 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
}
}
/*
* PIO data transfer IRQ handler.
*/
static
irqreturn_t
mmci_pio_irq
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
static
int
mmci_pio_read
(
struct
mmci_host
*
host
,
struct
request
*
req
,
u32
status
)
{
struct
mmci_host
*
host
=
dev_id
;
void
*
base
=
host
->
base
;
u32
status
;
int
ret
=
0
;
do
{
status
=
readl
(
base
+
MMCISTATUS
)
;
unsigned
int
count
;
if
(
!
(
status
&
(
MCI_RXDATAAVLBL
|
MCI_RXFIFOHALFFULL
|
MCI_TXFIFOHALFEMPTY
)))
/*
* Check for data available.
*/
if
(
!
(
status
&
MCI_RXDATAAVLBL
))
break
;
DBG
(
host
,
"irq1 %08x
\n
"
,
status
);
if
(
status
&
(
MCI_RXDATAAVLBL
|
MCI_RXFIFOHALFFULL
))
{
unsigned
int
count
=
host
->
size
-
(
readl
(
base
+
MMCIFIFOCNT
)
<<
2
);
if
(
count
<
0
)
count
=
0
;
if
(
count
&&
host
->
buffer
)
{
readsl
(
base
+
MMCIFIFO
,
host
->
buffer
,
count
>>
2
);
host
->
buffer
+=
count
;
host
->
size
-=
count
;
}
count
=
host
->
size
-
(
readl
(
base
+
MMCIFIFOCNT
)
<<
2
);
if
(
count
<
0
)
count
=
0
;
if
(
count
&&
host
->
buffer
)
{
ret
=
1
;
readsl
(
base
+
MMCIFIFO
,
host
->
buffer
,
count
>>
2
);
host
->
buffer
+=
count
;
host
->
size
-=
count
;
}
status
=
readl
(
base
+
MMCISTATUS
);
}
while
(
status
&
MCI_RXDATAAVLBL
);
return
ret
;
}
static
int
mmci_pio_write
(
struct
mmci_host
*
host
,
struct
request
*
req
,
u32
status
)
{
void
*
base
=
host
->
base
;
int
ret
=
0
;
do
{
unsigned
int
count
,
maxcnt
;
/*
* We only need to test the half-empty flag here - if
* the FIFO is completely empty, then by definition
* it is more than half empty.
*/
if
(
status
&
MCI_TXFIFOHALFEMPTY
)
{
unsigned
int
maxcnt
=
status
&
MCI_TXFIFOEMPTY
?
MCI_FIFOSIZE
:
MCI_FIFOHALFSIZE
;
unsigned
int
count
=
min
(
host
->
size
,
maxcnt
);
if
(
!
(
status
&
MCI_TXFIFOHALFEMPTY
))
break
;
writesl
(
base
+
MMCIFIFO
,
host
->
buffer
,
count
>>
2
);
maxcnt
=
status
&
MCI_TXFIFOEMPTY
?
MCI_FIFOSIZE
:
MCI_FIFOHALFSIZE
;
count
=
min
(
host
->
size
,
maxcnt
);
host
->
buffer
+=
count
;
host
->
size
-=
count
;
}
writesl
(
base
+
MMCIFIFO
,
host
->
buffer
,
count
>>
2
);
host
->
buffer
+=
count
;
host
->
size
-=
count
;
ret
=
1
;
}
while
(
status
);
status
=
readl
(
base
+
MMCISTATUS
);
}
while
(
status
&
MCI_TXFIFOHALFEMPTY
);
return
ret
;
}
/*
* PIO data transfer IRQ handler.
*/
static
irqreturn_t
mmci_pio_irq
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
struct
mmci_host
*
host
=
dev_id
;
struct
request
*
req
;
void
*
base
=
host
->
base
;
u32
status
;
int
ret
=
0
;
status
=
readl
(
base
+
MMCISTATUS
);
DBG
(
host
,
"irq1 %08x
\n
"
,
status
);
req
=
host
->
data
->
req
;
if
(
status
&
MCI_RXACTIVE
)
ret
=
mmci_pio_read
(
host
,
req
,
status
);
else
if
(
status
&
MCI_TXACTIVE
)
ret
=
mmci_pio_write
(
host
,
req
,
status
);
/*
* If we run out of data, disable the data IRQs; this
...
...
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