Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
967b475a
Commit
967b475a
authored
Sep 01, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change processign 'finish' command
parent
c6cc89b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
9 deletions
+24
-9
ahci_elphel.c
src/drivers/ata/ahci_elphel.c
+21
-9
ahci_elphel.h
src/drivers/ata/ahci_elphel.h
+3
-0
No files found.
src/drivers/ata/ahci_elphel.c
View file @
967b475a
...
...
@@ -68,6 +68,7 @@ static void init_vectors(struct elphel_ahci_priv *dpriv);
static
void
deinit_buffers
(
struct
device
*
dev
,
struct
frame_buffers
*
buffs
);
static
inline
struct
elphel_ahci_priv
*
dev_get_dpriv
(
struct
device
*
dev
);
static
void
finish_cmd
(
struct
device
*
dev
,
struct
elphel_ahci_priv
*
dpriv
);
static
void
finish_rec
(
struct
device
*
dev
,
struct
elphel_ahci_priv
*
dpriv
,
struct
ata_port
*
port
);
static
int
process_cmd
(
struct
device
*
dev
,
struct
elphel_ahci_priv
*
dpriv
,
struct
ata_port
*
port
);
//static void start_cmd(struct device *dev, struct elphel_ahci_priv *dpriv, struct ata_port *port);
static
inline
size_t
get_size_from
(
const
struct
fvec
*
vects
,
int
index
,
size_t
offset
,
int
all
);
...
...
@@ -135,7 +136,7 @@ static irqreturn_t elphel_irq_handler(int irq, void * dev_instance)
dpriv
->
flags
&=
~
IRQ_SIMPLE
;
irq_stat
=
readl
(
port_mmio
+
PORT_IRQ_STAT
);
dev_dbg
(
host
->
dev
,
"irq_stat = 0x%x, host irq_stat = 0x%x
\n
"
,
irq_stat
,
host_irq_stat
);
dev_dbg
(
host
->
dev
,
"irq_stat = 0x%x, host irq_stat = 0x%x
, time stamp: %u
\n
"
,
irq_stat
,
host_irq_stat
,
get_rtc_usec
()
);
writel
(
irq_stat
,
port_mmio
+
PORT_IRQ_STAT
);
// writel(0xffffffff, port_mmio + PORT_IRQ_STAT);
...
...
@@ -143,8 +144,13 @@ static irqreturn_t elphel_irq_handler(int irq, void * dev_instance)
writel
(
host_irq_stat
,
hpriv
->
mmio
+
HOST_IRQ_STAT
);
handled
=
IRQ_HANDLED
;
if
(
process_cmd
(
host
->
dev
,
dpriv
,
host
->
ports
[
0
])
==
0
)
if
(
process_cmd
(
host
->
dev
,
dpriv
,
host
->
ports
[
0
])
==
0
)
{
finish_cmd
(
host
->
dev
,
dpriv
);
if
(
dpriv
->
flags
&
DELAYED_FINISH
)
{
dpriv
->
flags
&=
~
DELAYED_FINISH
;
finish_rec
(
host
->
dev
,
dpriv
,
port
);
}
}
}
else
{
/* pass handling to AHCI level */
handled
=
ahci_single_irq_intr
(
irq
,
dev_instance
);
...
...
@@ -1175,6 +1181,7 @@ static int process_cmd(struct device *dev, struct elphel_ahci_priv *dpriv, struc
dpriv
->
lba_ptr
.
wr_count
=
get_blocks_num
(
dpriv
->
sgl
,
dpriv
->
sg_elems
);
dma_sync_single_for_device
(
dev
,
cbuff
->
iov_dma
,
cbuff
->
iov_len
,
DMA_TO_DEVICE
);
printk
(
KERN_DEBUG
">>> time before issuing command: %u
\n
"
,
get_rtc_usec
());
elphel_cmd_issue
(
port
,
dpriv
->
lba_ptr
.
lba_write
,
dpriv
->
lba_ptr
.
wr_count
,
dpriv
->
sgl
,
dpriv
->
sg_elems
,
dpriv
->
curr_cmd
);
}
...
...
@@ -1263,23 +1270,28 @@ static ssize_t rawdev_write(struct device *dev, ///<
size_t
blocks_num
;
static
int
dont_process
=
0
;
if
((
dpriv
->
flags
&
PROC_CMD
)
||
dont_process
)
{
// we are not ready yet
return
-
EAGAIN
;
}
if
(
buff_sz
!=
sizeof
(
struct
frame_data
))
{
dev_err
(
dev
,
"the size of the data buffer is incorrect, should be equal to sizeof(struct frame_data)
\n
"
);
return
-
EINVAL
;
}
memcpy
(
&
fdata
,
buff
,
sizeof
(
struct
frame_data
));
if
(
fdata
.
cmd
==
DRV_CMD_FINISH
)
{
if
(
!
(
dpriv
->
flags
&
PROC_CMD
))
{
finish_rec
(
dev
,
dpriv
,
port
);
}
else
{
dpriv
->
flags
|=
DELAYED_FINISH
;
}
return
buff_sz
;
}
if
((
dpriv
->
flags
&
PROC_CMD
)
||
dont_process
)
{
// we are not ready yet
return
-
EAGAIN
;
}
/* debug code follows */
printk
(
KERN_DEBUG
">>> data pointers received
:
\n
"
);
printk
(
KERN_DEBUG
">>> data pointers received
, time stamp: %u
\n
"
,
get_rtc_usec
()
);
printk
(
KERN_DEBUG
">>> sensor port: %u
\n
"
,
fdata
.
sensor_port
);
printk
(
KERN_DEBUG
">>> cirbuf ptr: %d, cirbuf data len: %d
\n
"
,
fdata
.
cirbuf_ptr
,
fdata
.
jpeg_len
);
printk
(
KERN_DEBUG
">>> meta_index: %d
\n
"
,
fdata
.
meta_index
);
...
...
src/drivers/ata/ahci_elphel.h
View file @
967b475a
...
...
@@ -30,6 +30,9 @@
#define PROC_CMD (1 << 1)
/** Flag indicating that the remaining chunk of data will be recorder */
#define LAST_BLOCK (1 << 2)
/** Flag indicating that recording should be stopped right after the last chunk of data
* is written */
#define DELAYED_FINISH (1 << 3)
/** The length of a command FIS in double words */
#define CMD_FIS_LEN 5
/** This is used to get 28-bit address from 64-bit value */
...
...
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