From: Dave Kitchen <dave.kitchen@insync.tv>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: MTD with non-power-of-2 page size
Date: Wed, 19 Aug 2015 15:29:21 +0100 [thread overview]
Message-ID: <55D492C1.3000003@insync.tv> (raw)
In-Reply-To: <20150819142020.GF18700@pengutronix.de>
Hi Sascha
Thank you for the hint. I now have running code with the non-power-of-2
page size.
Shall I try and generate/submit a patch for this? The code may be
marginally slower in the power-of-2 case than the original, but I defy
anyone to notice if they are using spi boot!
Regards
Dave
On 19/08/15 15:20, Sascha Hauer wrote:
> Hi Dave,
>
> On Wed, Aug 12, 2015 at 12:21:00PM +0100, Dave Kitchen 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?
>>
>> 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.
>
> You could use do_div here which returns the remainder. Also see the
> mtd_div_by_eb() and mtd_mod_by_eb() functions which may be what you are
> looking for.
>
> Sascha
>
--
Dave Kitchen
InSync technology Ltd
Tilbrook House
2-4 Grenehurst Way
Petersfield
GU31 4AZ
+44(0) 1730 235117
-fwd
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-08-19 14:29 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
2015-08-19 14:20 ` Sascha Hauer
2015-08-19 14:29 ` Dave Kitchen [this message]
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=55D492C1.3000003@insync.tv \
--to=dave.kitchen@insync.tv \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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