From: Simon Aittamaa <simon.aittamaa@gmail.com>
To: Dave Kitchen <dave.kitchen@insync.tv>
Cc: barebox@lists.infradead.org
Subject: Re: MTD with non-power-of-2 page size
Date: Wed, 12 Aug 2015 14:13:05 +0200 [thread overview]
Message-ID: <CALHxSV7F2mNDQCsvLi8oRR8tguOVLfYZs+wK=ojzKc85nUaeRw@mail.gmail.com> (raw)
In-Reply-To: <55CB2C1C.4000002@insync.tv>
On 12 August 2015 at 13:21, Dave Kitchen <dave.kitchen@insync.tv> wrote:
>
> I have just started to work with barebox on an Atmel at91sam9g45 processor.
> The board has an Atmel AT45DB161 dataflash configured as 528-byte page size.
> I find that eg saveenv command does not run as the page erase fails with
> EINVAL. On tracing this is fired from the page size and offset correction
> code [mtd/core,c mtd_erase_align()] which uses bit masking to align the size
> and offset. Unfortunately bit-masking does not work with non-power-of-2
> pages. Has anyone else addressed this problem?
>
Yes, it's a bit of an annoying problem...
The easy solution (if you can spare the space) is to increase the
partition size, e.g. 128*528 should work (which is what I'm currently
using) and any multiple thereof. I'm fairly certain that 64*528 (and
any multiple thereof) should also work, but it was a while since I
messed around with that so you'll have to test it yourself.
You can also reprogram the device to present pages that are
power-of-two, but you should be aware that you lose some space
(pages*16) and the process is not reversible (you've been warned!),
see the datasheet for more information.
Best,
Simon Aittamaa
> The 'trivial' exercise of replacing the bit masks by modulo [%] operator
> does not succeed as the compiler I am using (gcc!) does not support
> long-long divmod.
>
> Regards
> Dave Kitchen
> InSync technology Ltd
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-08-12 12:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 11:21 Dave Kitchen
2015-08-12 12:13 ` Simon Aittamaa [this message]
2015-08-19 14:20 ` Sascha Hauer
2015-08-19 14:29 ` Dave Kitchen
2015-08-19 14:45 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALHxSV7F2mNDQCsvLi8oRR8tguOVLfYZs+wK=ojzKc85nUaeRw@mail.gmail.com' \
--to=simon.aittamaa@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=dave.kitchen@insync.tv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox