Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
735717d1
Commit
735717d1
authored
8 years ago
by
Ladislav Michl
Committed by
Tom Rini
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
onenand_spl_simple: Add a simple OneNAND read function
Signed-off-by:
Ladislav Michl
<
ladis@linux-mips.org
>
parent
e1a89e93
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
drivers/mtd/onenand/onenand_spl.c
+48
-0
48 additions, 0 deletions
drivers/mtd/onenand/onenand_spl.c
include/onenand_uboot.h
+1
-0
1 addition, 0 deletions
include/onenand_uboot.h
with
49 additions
and
0 deletions
drivers/mtd/onenand/onenand_spl.c
+
48
−
0
View file @
735717d1
...
@@ -93,6 +93,54 @@ static int onenand_spl_read_page(uint32_t block, uint32_t page, uint32_t *buf,
...
@@ -93,6 +93,54 @@ static int onenand_spl_read_page(uint32_t block, uint32_t page, uint32_t *buf,
return
0
;
return
0
;
}
}
#ifdef CONFIG_SPL_UBI
/* Temporary storage for non page aligned and non page sized reads. */
static
u8
scratch_buf
[
PAGE_4K
];
/**
* onenand_spl_read_block - Read data from physical eraseblock into a buffer
* @block: Number of the physical eraseblock
* @offset: Data offset from the start of @peb
* @len: Data size to read
* @dst: Address of the destination buffer
*
* Notes:
* @offset + @len are not allowed to be larger than a physical
* erase block. No sanity check done for simplicity reasons.
*/
int
onenand_spl_read_block
(
int
block
,
int
offset
,
int
len
,
void
*
dst
)
{
int
page
,
read
,
psize
;
psize
=
onenand_spl_get_geometry
();
/* Calculate the page number */
page
=
offset
/
psize
;
/* Offset to the start of a flash page */
offset
=
offset
%
psize
;
while
(
len
)
{
/*
* Non page aligned reads go to the scratch buffer.
* Page aligned reads go directly to the destination.
*/
if
(
offset
||
len
<
psize
)
{
onenand_spl_read_page
(
block
,
page
,
(
uint32_t
*
)
scratch_buf
,
psize
);
read
=
min
(
len
,
psize
-
offset
);
memcpy
(
dst
,
scratch_buf
+
offset
,
read
);
offset
=
0
;
}
else
{
onenand_spl_read_page
(
block
,
page
,
dst
,
psize
);
read
=
psize
;
}
page
++
;
len
-=
read
;
dst
+=
read
;
}
return
0
;
}
#endif
void
onenand_spl_load_image
(
uint32_t
offs
,
uint32_t
size
,
void
*
dst
)
void
onenand_spl_load_image
(
uint32_t
offs
,
uint32_t
size
,
void
*
dst
)
{
{
uint32_t
*
addr
=
(
uint32_t
*
)
dst
;
uint32_t
*
addr
=
(
uint32_t
*
)
dst
;
...
...
This diff is collapsed.
Click to expand it.
include/onenand_uboot.h
+
1
−
0
View file @
735717d1
...
@@ -49,6 +49,7 @@ extern int flexonenand_set_boundary(struct mtd_info *mtd, int die,
...
@@ -49,6 +49,7 @@ extern int flexonenand_set_boundary(struct mtd_info *mtd, int die,
int
boundary
,
int
lock
);
int
boundary
,
int
lock
);
/* SPL */
/* SPL */
int
onenand_spl_read_block
(
int
block
,
int
offset
,
int
len
,
void
*
dst
);
void
onenand_spl_load_image
(
uint32_t
offs
,
uint32_t
size
,
void
*
dst
);
void
onenand_spl_load_image
(
uint32_t
offs
,
uint32_t
size
,
void
*
dst
);
#endif
/* __UBOOT_ONENAND_H */
#endif
/* __UBOOT_ONENAND_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment