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
ef515469
Commit
ef515469
authored
Jul 29, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed otp reading - forgot a couple functions
parent
a5d81564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
pl35x_nand.c
src/drivers/mtd/nand/pl35x_nand.c
+66
-0
No files found.
src/drivers/mtd/nand/pl35x_nand.c
View file @
ef515469
...
...
@@ -872,6 +872,69 @@ static int pl35x_nand_device_ready(struct mtd_info *mtd)
return
0
;
}
/**
* pl35x_nand_onfi_set_features- [REPLACEABLE] set features for ONFI nand
* @mtd: MTD device structure
* @chip: nand chip info structure
* @addr: feature address.
* @subfeature_param: the subfeature parameters, a four bytes array.
*/
static
int
pl35x_nand_onfi_set_features
(
struct
mtd_info
*
mtd
,
struct
nand_chip
*
chip
,
int
addr
,
uint8_t
*
subfeature_param
)
{
int
status
;
int
i
;
uint8_t
ondie_ecc_feature
;
if
(
!
chip
->
onfi_version
||
!
(
le16_to_cpu
(
chip
->
onfi_params
.
opt_cmd
)
&
ONFI_OPT_CMD_SET_GET_FEATURES
))
return
-
EINVAL
;
if
(
addr
==
ONDIE_ECC_FEATURE_ADDR
){
//keep ondie ecc on;
chip
->
cmdfunc
(
mtd
,
NAND_CMD_GET_FEATURES
,
addr
,
-
1
);
ondie_ecc_feature
=
readb
(
chip
->
IO_ADDR_R
);
subfeature_param
[
0
]
|=
(
ondie_ecc_feature
&
0x08
);
}
chip
->
cmdfunc
(
mtd
,
NAND_CMD_SET_FEATURES
,
addr
,
-
1
);
for
(
i
=
0
;
i
<
ONFI_SUBFEATURE_PARAM_LEN
;
++
i
)
writeb
(
subfeature_param
[
i
],
chip
->
IO_ADDR_W
);
//chip->write_byte(mtd, subfeature_param[i]);
status
=
chip
->
waitfunc
(
mtd
,
chip
);
if
(
status
&
NAND_STATUS_FAIL
)
return
-
EIO
;
return
0
;
}
/**
* nand_onfi_get_features- [REPLACEABLE] get features for ONFI nand
* @mtd: MTD device structure
* @chip: nand chip info structure
* @addr: feature address.
* @subfeature_param: the subfeature parameters, a four bytes array.
*/
static
int
pl35x_nand_onfi_get_features
(
struct
mtd_info
*
mtd
,
struct
nand_chip
*
chip
,
int
addr
,
uint8_t
*
subfeature_param
)
{
int
i
;
if
(
!
chip
->
onfi_version
||
!
(
le16_to_cpu
(
chip
->
onfi_params
.
opt_cmd
)
&
ONFI_OPT_CMD_SET_GET_FEATURES
))
return
-
EINVAL
;
/* clear the sub feature parameters */
memset
(
subfeature_param
,
0
,
ONFI_SUBFEATURE_PARAM_LEN
);
chip
->
cmdfunc
(
mtd
,
NAND_CMD_GET_FEATURES
,
addr
,
-
1
);
for
(
i
=
0
;
i
<
ONFI_SUBFEATURE_PARAM_LEN
;
++
i
)
*
subfeature_param
++
=
chip
->
read_byte
(
mtd
);
return
0
;
}
/**
* pl35x_nand_detect_ondie_ecc - Get the flash ondie ecc state
* @mtd: Pointer to the mtd_info structure
...
...
@@ -1051,6 +1114,9 @@ static int pl35x_nand_probe(struct platform_device *pdev)
nand_chip
->
dev_ready
=
pl35x_nand_device_ready
;
nand_chip
->
select_chip
=
pl35x_nand_select_chip
;
nand_chip
->
onfi_set_features
=
pl35x_nand_onfi_set_features
;
nand_chip
->
onfi_get_features
=
pl35x_nand_onfi_get_features
;
/* If we don't set this delay driver sets 20us by default */
nand_chip
->
chip_delay
=
30
;
...
...
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