* [U-Boot] erase and saveenv stop working after using fw_setenv
@ 2008-09-16 7:46 Petri Lehtinen
2008-09-16 9:04 ` Wolfgang Denk
0 siblings, 1 reply; 6+ messages in thread
From: Petri Lehtinen @ 2008-09-16 7:46 UTC (permalink / raw)
To: u-boot
Hi!
I'm using U-Boot 1.3.4 and Linux 2.6.26.5 on MPC8323E-RDB. After using
fw_printenv in Linux, erase and saveenv stop working in U-Boot. In
Linux, fw_* still work.
When using erase, this is the result:
=> protect off fe040000 fe05ffff
Un-Protected 1 sectors
=> erase fe040000 fe05ffff
Flash erase error at address fe040000
Block Erase Error.
Block locked.
done
Erased 1 sectors
=> md fe040000
fe040000: c7be9eae 626f6f74 636d643d 73657465 ....bootcmd=sete
fe040010: 6e762062 6f6f7461 72677320 726f6f74 nv bootargs root
...
So the sector doesn't get erased.
Errors are similar when using saveenv:
=> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
Flash erase error at address fe040000
Block Erase Error.
Block locked.
done
Erased 1 sectors
I tracked the error message down to cfi_flash.c, where this function
call fails:
flash_isequal (info, sector, 0, FLASH_STATUS_DONE)
However, I have no clue on how CFI works, so my ability to debug it
further stops here. A possible reason I can think of is that the ioctl
calls in fw_setenv are somehow messing up the Flash status.
Any ideas?
--
Petri Lehtinen
Inoi Oy
Tel. : +358 40 758 0229
Email: petri.lehtinen at inoi.fi
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] erase and saveenv stop working after using fw_setenv
2008-09-16 7:46 [U-Boot] erase and saveenv stop working after using fw_setenv Petri Lehtinen
@ 2008-09-16 9:04 ` Wolfgang Denk
2008-09-16 9:47 ` Guennadi Liakhovetski
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Wolfgang Denk @ 2008-09-16 9:04 UTC (permalink / raw)
To: u-boot
Dear Petri Lehtinen,
In message <48CF6452.40603@inoi.fi> you wrote:
>
> I'm using U-Boot 1.3.4 and Linux 2.6.26.5 on MPC8323E-RDB. After using
> fw_printenv in Linux, erase and saveenv stop working in U-Boot. In
--^^^^^^^^^^^--
I think this must be a typo. fw_printenv should have no effect. I
guess you mean fw_setenv (as in the Subject) ?
> Linux, fw_* still work.
Obviously the flash locking is the important thing here. Probably your
flashes weren't locked before, but are locked after running fw_setenv.
> When using erase, this is the result:
>
> => protect off fe040000 fe05ffff
> Un-Protected 1 sectors
> => erase fe040000 fe05ffff
>
> Flash erase error at address fe040000
> Block Erase Error.
> Block locked.
^^^^^^^^^^^^^^^
That's a pretty clear error message here.
> Errors are similar when using saveenv:
>
> => saveenv
> Saving Environment to Flash...
> Un-Protected 1 sectors
> Erasing Flash...
> Flash erase error at address fe040000
> Block Erase Error.
> Block locked.
^^^^^^^^^^^^^^^
Again, a clear error message.
> However, I have no clue on how CFI works, so my ability to debug it
> further stops here. A possible reason I can think of is that the ioctl
> calls in fw_setenv are somehow messing up the Flash status.
The problem is that the MPC8323ERDB board has flash chips that
support hardware flash protection (locking), but the board config
file does not select the CFG_FLASH_PROTECTION option. Therefore
U-Boot will not make any attempts to lock or unlock any flash
sectors.
I think two things should be done:
a) Kim, I think it would make sense to add CFG_FLASH_PROTECTION to
all board configurations that use lockable flash chips. I would
even consider this a bug fix and pull it into the upcoming 2008-10
release, if you want.
b) Guennadi, I think it would be nice, user-friendly behaviour if
fw_setenv did not unconditional locking, but would instead leave
the flash in the same state it found it. Do you think it would be
possible to test the state first, and then perform the unlock /
lock operations only when the flash sectors were already locked
when fw_setenv was called?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Brain: an apparatus with which we think we think. - Ambrose Bierce
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] erase and saveenv stop working after using fw_setenv
2008-09-16 9:04 ` Wolfgang Denk
@ 2008-09-16 9:47 ` Guennadi Liakhovetski
2008-09-16 10:06 ` Petri Lehtinen
2008-09-23 14:49 ` [U-Boot] [PATCH] mpc83xx: add h/w flash protection to board configs (was Re: erase and saveenv stop working after using fw_setenv) Kim Phillips
2 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2008-09-16 9:47 UTC (permalink / raw)
To: u-boot
On Tue, 16 Sep 2008, Wolfgang Denk wrote:
> b) Guennadi, I think it would be nice, user-friendly behaviour if
> fw_setenv did not unconditional locking, but would instead leave
> the flash in the same state it found it. Do you think it would be
> possible to test the state first, and then perform the unlock /
> lock operations only when the flash sectors were already locked
> when fw_setenv was called?
I am not sure if this is possible with the current MTD ABI, it looks like
it is not. There is a flags member in struct mtd_info_user, which can take
value MTD_WRITEABLE, but I think it means something different - whether
this mtd-device is writable in principle. So, it looks like the only way
to find out whether the specific sector is locked is to try to write /
erase it:-(
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] erase and saveenv stop working after using fw_setenv
2008-09-16 9:04 ` Wolfgang Denk
2008-09-16 9:47 ` Guennadi Liakhovetski
@ 2008-09-16 10:06 ` Petri Lehtinen
2008-09-23 14:49 ` [U-Boot] [PATCH] mpc83xx: add h/w flash protection to board configs (was Re: erase and saveenv stop working after using fw_setenv) Kim Phillips
2 siblings, 0 replies; 6+ messages in thread
From: Petri Lehtinen @ 2008-09-16 10:06 UTC (permalink / raw)
To: u-boot
>> fw_printenv in Linux, erase and saveenv stop working in U-Boot. In
> --^^^^^^^^^^^--
>
> I think this must be a typo. fw_printenv should have no effect. I
> guess you mean fw_setenv (as in the Subject) ?
Ahh, yes. I meant fw_setenv of course.
> The problem is that the MPC8323ERDB board has flash chips that
> support hardware flash protection (locking), but the board config
> file does not select the CFG_FLASH_PROTECTION option. Therefore
> U-Boot will not make any attempts to lock or unlock any flash
> sectors.
I enabled CFG_FLASH_PROTECTION, and now it works. Thanks a lot.
--
Petri Lehtinen
Inoi Oy
Tel. : +358 40 758 0229
Email: petri.lehtinen at inoi.fi
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] erase and saveenv stop working after using fw_setenv
@ 2008-09-16 11:36 yusuf khan
0 siblings, 0 replies; 6+ messages in thread
From: yusuf khan @ 2008-09-16 11:36 UTC (permalink / raw)
To: u-boot
> Message: 1
> Date: Tue, 16 Sep 2008 10:46:26 +0300
> From: Petri Lehtinen <petri.lehtinen@inoi.fi>
> Subject: [U-Boot] erase and saveenv stop working after using fw_setenv
> To: u-boot at lists.denx.de
> Message-ID: <48CF6452.40603@inoi.fi>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi!
>
> I'm using U-Boot 1.3.4 and Linux 2.6.26.5 on MPC8323E-RDB. After using
> fw_printenv in Linux, erase and saveenv stop working in U-Boot. In
> Linux, fw_* still work.
>
> When using erase, this is the result:
>
> => protect off fe040000 fe05ffff
> Un-Protected 1 sectors
> => erase fe040000 fe05ffff
>
> Flash erase error at address fe040000
> Block Erase Error.
> Block locked.
> done
> Erased 1 sectors
> => md fe040000
> fe040000: c7be9eae 626f6f74 636d643d 73657465 ....bootcmd=sete
> fe040010: 6e762062 6f6f7461 72677320 726f6f74 nv bootargs root
> ...
>
> So the sector doesn't get erased.
>
> Errors are similar when using saveenv:
>
> => saveenv
> Saving Environment to Flash...
> Un-Protected 1 sectors
> Erasing Flash...
> Flash erase error at address fe040000
> Block Erase Error.
> Block locked.
> done
> Erased 1 sectors
>
> I tracked the error message down to cfi_flash.c, where this function
> call fails:
>
> flash_isequal (info, sector, 0, FLASH_STATUS_DONE)
>
> However, I have no clue on how CFI works, so my ability to debug it
> further stops here. A possible reason I can think of is that the ioctl
> calls in fw_setenv are somehow messing up the Flash status.
>
> Any ideas?
>
> --
> Petri Lehtinen
> Inoi Oy
> Tel. : +358 40 758 0229
> Email: petri.lehtinen at inoi.fi
>
>
Hi
I think it is the problem of hardware locking, try enabling
CFG_FLASH_PROTECTION .
--
Thanks & Regards
Yusuf A Khan
Multitech Software Systems
Koramangala,Bangalore
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] mpc83xx: add h/w flash protection to board configs (was Re: erase and saveenv stop working after using fw_setenv)
2008-09-16 9:04 ` Wolfgang Denk
2008-09-16 9:47 ` Guennadi Liakhovetski
2008-09-16 10:06 ` Petri Lehtinen
@ 2008-09-23 14:49 ` Kim Phillips
2 siblings, 0 replies; 6+ messages in thread
From: Kim Phillips @ 2008-09-23 14:49 UTC (permalink / raw)
To: u-boot
On Tue, 16 Sep 2008 11:04:50 +0200
Wolfgang Denk <wd@denx.de> wrote:
> The problem is that the MPC8323ERDB board has flash chips that
> support hardware flash protection (locking), but the board config
> file does not select the CFG_FLASH_PROTECTION option. Therefore
> U-Boot will not make any attempts to lock or unlock any flash
> sectors.
>
>
> I think two things should be done:
>
> a) Kim, I think it would make sense to add CFG_FLASH_PROTECTION to
> all board configurations that use lockable flash chips. I would
> even consider this a bug fix and pull it into the upcoming 2008-10
> release, if you want.
ok, I'll leave non-fsl boards up to their maintainers though:
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-23 14:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16 7:46 [U-Boot] erase and saveenv stop working after using fw_setenv Petri Lehtinen
2008-09-16 9:04 ` Wolfgang Denk
2008-09-16 9:47 ` Guennadi Liakhovetski
2008-09-16 10:06 ` Petri Lehtinen
2008-09-23 14:49 ` [U-Boot] [PATCH] mpc83xx: add h/w flash protection to board configs (was Re: erase and saveenv stop working after using fw_setenv) Kim Phillips
-- strict thread matches above, loose matches on Subject: below --
2008-09-16 11:36 [U-Boot] erase and saveenv stop working after using fw_setenv yusuf khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox