Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
u-boot-2015.04
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor 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
vesta
u-boot-2015.04
Commits
08254a1a
Commit
08254a1a
authored
15 years ago
by
Wolfgang Denk
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
git://git.denx.de/u-boot-cfi-flash
parents
05c2f4fe
f3dec798
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/mtd/cfi_mtd.c
+18
-17
18 additions, 17 deletions
drivers/mtd/cfi_mtd.c
with
18 additions
and
17 deletions
drivers/mtd/cfi_mtd.c
+
18
−
17
View file @
08254a1a
...
@@ -161,8 +161,8 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
...
@@ -161,8 +161,8 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
int
sect
;
int
sect
;
int
regions
=
0
;
int
regions
=
0
;
int
numblocks
=
0
;
int
numblocks
=
0
;
ulong
offset
=
0
;
ulong
offset
;
ulong
base_addr
=
fi
->
start
[
0
]
;
ulong
base_addr
;
/*
/*
* First detect the number of eraseregions so that we can allocate
* First detect the number of eraseregions so that we can allocate
...
@@ -174,29 +174,35 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
...
@@ -174,29 +174,35 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
sect_size_old
=
flash_sector_size
(
fi
,
sect
);
sect_size_old
=
flash_sector_size
(
fi
,
sect
);
}
}
switch
(
regions
)
{
case
0
:
return
1
;
case
1
:
/* flash has uniform erase size */
mtd
->
numeraseregions
=
0
;
mtd
->
erasesize
=
sect_size_old
;
return
0
;
}
mtd
->
numeraseregions
=
regions
;
mtd
->
eraseregions
=
malloc
(
sizeof
(
struct
mtd_erase_region_info
)
*
regions
);
mtd
->
eraseregions
=
malloc
(
sizeof
(
struct
mtd_erase_region_info
)
*
regions
);
/*
/*
* Now detect the largest sector and fill the eraseregions
* Now detect the largest sector and fill the eraseregions
*/
*/
sect_size_old
=
0
;
regions
=
0
;
regions
=
0
;
base_addr
=
offset
=
fi
->
start
[
0
];
sect_size_old
=
flash_sector_size
(
fi
,
0
);
for
(
sect
=
0
;
sect
<
fi
->
sector_count
;
sect
++
)
{
for
(
sect
=
0
;
sect
<
fi
->
sector_count
;
sect
++
)
{
if
((
sect_size_old
!=
flash_sector_size
(
fi
,
sect
))
&&
if
(
sect_size_old
!=
flash_sector_size
(
fi
,
sect
))
{
(
sect_size_old
!=
0
))
{
mtd
->
eraseregions
[
regions
].
offset
=
offset
-
base_addr
;
mtd
->
eraseregions
[
regions
].
offset
=
offset
-
base_addr
;
mtd
->
eraseregions
[
regions
].
erasesize
=
sect_size_old
;
mtd
->
eraseregions
[
regions
].
erasesize
=
sect_size_old
;
mtd
->
eraseregions
[
regions
].
numblocks
=
numblocks
;
mtd
->
eraseregions
[
regions
].
numblocks
=
numblocks
;
/* Now start counting the next eraseregions */
/* Now start counting the next eraseregions */
numblocks
=
0
;
numblocks
=
0
;
regions
++
;
regions
++
;
}
else
{
numblocks
++
;
}
if
(
sect_size_old
!=
flash_sector_size
(
fi
,
sect
))
offset
=
fi
->
start
[
sect
];
offset
=
fi
->
start
[
sect
];
}
numblocks
++
;
/*
/*
* Select the largest sector size as erasesize (e.g. for UBI)
* Select the largest sector size as erasesize (e.g. for UBI)
...
@@ -212,12 +218,7 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
...
@@ -212,12 +218,7 @@ static int cfi_mtd_set_erasesize(struct mtd_info *mtd, flash_info_t *fi)
*/
*/
mtd
->
eraseregions
[
regions
].
offset
=
offset
-
base_addr
;
mtd
->
eraseregions
[
regions
].
offset
=
offset
-
base_addr
;
mtd
->
eraseregions
[
regions
].
erasesize
=
sect_size_old
;
mtd
->
eraseregions
[
regions
].
erasesize
=
sect_size_old
;
mtd
->
eraseregions
[
regions
].
numblocks
=
numblocks
+
1
;
mtd
->
eraseregions
[
regions
].
numblocks
=
numblocks
;
if
(
regions
)
mtd
->
numeraseregions
=
regions
+
1
;
else
mtd
->
numeraseregions
=
0
;
mtd
->
erasesize
=
sect_size
;
mtd
->
erasesize
=
sect_size
;
...
...
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