All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] TQM85xx: NAND support via local bus UPMB
Date: Fri, 30 May 2008 20:00:32 +0200	[thread overview]
Message-ID: <484040C0.1030103@grandegger.com> (raw)
In-Reply-To: <20080529124422.GA8247@polina.dev.rtsoft.ru>

Anton Vorontsov wrote:
> On Thu, May 29, 2008 at 01:58:14PM +0200, Wolfgang Grandegger wrote:
>> Anton Vorontsov wrote:
>>> On Wed, May 28, 2008 at 08:38:37PM +0200, Wolfgang Grandegger wrote:
>>>> Scott Wood wrote:
>>>>> On Wed, May 28, 2008 at 08:12:28PM +0200, Wolfgang Grandegger wrote:
>>>>>> This patch adds support for NAND FLASH on the TQM8548. It is disabled by
>>>>>> default and can be enabled for the TQM8548 modules. Note that the R/B pin
>>>>>> is not supported by that module requiring to use the specified maximum
>>>>>> delay time.
>>>>>>
>>>>>> Note: With NAND support enabled the size of the U-Boot image exceeds
>>>>>> 256 KB and TEXT_BASE must therefore be set to 0xfff80000 in config.mk,
>>>>>> doubling the image size :-(.
>>>>> What does this do differently from the code in drivers/mtd/nand/fsl_upm.c?
>>>> Maybe it does not support multi banks on a NAND chip. I have to check.
>>> Me thinks that you'll have to call fsl_upm_nand_init() for each
>>> chip, and that's all. If not, feel free to patch it as you feel appropriate,
>>> I'll able to regress-test this driver on MPC8360E-RDK.
>> That seems not to be a minor problem. If CFG_MAX_NAND_DEVICE > 1,
>> board_nand_init() will be called twice with the base address from
>> CFG_NAND_BASE_LIST. The only problem I see is that the UPM interface is
>> setup twice.
> 
> Personally I think we should remove UPM programming code from the
> fsl_upm_nand.c, and program the UPM via its own interface, see this post:
> 
> From: David Saada <David.Saada@ecitele.com>
> To: "'u-boot-users at lists.sourceforge.net'" <u-boot-users@lists.sourceforge.net>
> Date: Mon, 19 May 2008 19:05:04 +0300
> Subject: [U-Boot-Users] [PATCH][resubmit] MPC85xx, MPC83xx: Add/Fix UPM configuration support
> 
> ^^^ But this is still WIP, and I'm not sure if this is suitable for our
> needs (didn't try it).

OK.

>>>>> How much of this is board-specific?
>>>> Well, I already gave drivers/mtd/nand/fsl_upm.c a try but was unable to
>>>> get it working on this board. Therefore I decided to keep this known to
>>>> work driver which we have already for a while.
>>> This isn't really an excuse to duplicate drivers. :-) This driver was
>>> tested on MPC8555 and MPC8360 CPUs, so it should work with no drastic
>>> changes. Some issues might still be there, and if so, fixes are highly
>>> appreciated.
>> I know, sniff.
>>
>>>> With Linux, I had more success.
>>> ..especially if general idea works well, we should use single driver.
>> I already had a closer look and realized a difference in writing the UPM
>> array. In fsl_upm.c there is:
>>
>>   static void fsl_upm_setup(struct fsl_upm *upm)
>>   {
>> 	int i;
>>
>> 	/* write upm array */
>> 	out_be32(upm->mxmr, FSL_UPM_MxMR_OP_WA);
>>
>> 	for (i = 0; i < 64; i++) {
>> 		out_be32(upm->mdr, upm->array[i]);
>> 		out_8(upm->io_addr, 0x0);
>> 	}
>>
>> 	/* normal operation */
>> 	out_be32(upm->mxmr, FSL_UPM_MxMR_OP_NO);
>> 	while (in_be32(upm->mxmr) != FSL_UPM_MxMR_OP_NO)
>> 		eieio();
>>   }
>>
>> But in my driver I fold the machine address into mbmr for each value:
>>
>>         out_be32 (&lbc->mbmr,
>>                  (in_be32 (&lbc->mbmr) & ~(MxMR_OP_NORM | MxMR_MAD)) |
>>                   MxMR_OP_WARR | (i & MxMR_MAD));
>>                                   ^
> 
> I see. I think there will be a problem with a
> 
> static void fsl_upm_start_pattern(struct fsl_upm *upm, u32 pat_offset)
> {
>         out_be32(upm->mxmr, FSL_UPM_MxMR_OP_RP | pat_offset);
> }
> 
> static void fsl_upm_end_pattern(struct fsl_upm *upm)
> {
>         out_be32(upm->mxmr, FSL_UPM_MxMR_OP_NO);
>         while (in_be32(upm->mxmr) != FSL_UPM_MxMR_OP_NO)
>                 eieio();
> }
> 
> Since it zeroes these values. No problem though, this should
> be replaced by the Linux' versions, that is
> 
> clrsetbits_be32(upm->mxmr, MxMR_MAD, MxMR_OP_RP | pat_offset);
> for start_pattern, and  clrbits32(upm->mxmr, MxMR_OP_RP); for
> end_pattern.
> 
> So, this will leave your values intact, and will work for all boards as
> well.

Fix that, but I can still not access the device properly. I'm a bit
puzzled because it uses a different algorithm to access the device.
While my and the Linux fsl_upm driver uses NAND_ALE, NAND_CLE and
friends to manage the access via hwcontrol callback, the fsl_upm driver
of U-Boot uses the cmdfunc callback doing different things. What is the
difference? It seems to work on the MPC8555, at least, as you mention below.

>> Seem also that defines a duplicated :-(.
> 
> No problem. Please, remove the ones you don't like, and leave the ones
> you do like. :-) Feel completely free to do everything you need to make
> fsl_upm_nand.c work on your hardware, and then we'll see what we can do
> to make our hardware work together.

OK. The defines should go to fsl_lbc.h nowadays.

> As for UPM programming, as I've said, just remove UPM programming code
> from the NAND driver, and leave it in the board file until (if) we'll
> start using generic interface.
> 
>> Has it been tested with an MPC85xx? I will do some more test now.
> 
> Yup, MPC8555.

Wolfgang.

  reply	other threads:[~2008-05-30 18:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 18:12 [U-Boot-Users] [PATCH 0/12] 85xx: various fixes for TQM85xx and support for TQM8548 Wolfgang Grandegger
2008-05-28 18:12 ` [U-Boot-Users] [PATCH] MPC85xx: Beatify boot output of L2 cache configuration Wolfgang Grandegger
2008-05-28 18:12   ` [U-Boot-Users] [PATCH] TQM85xx: Various coding style fixes Wolfgang Grandegger
2008-05-28 18:12     ` [U-Boot-Users] [PATCH] TQM85xx: Fix CPM port pin configuration Wolfgang Grandegger
2008-05-28 18:12       ` [U-Boot-Users] [PATCH] TQM85xx: Support for Spansion 'N' type flashes added Wolfgang Grandegger
2008-05-28 18:12         ` [U-Boot-Users] [PATCH] TQM85xx: Fix chip select configuration for second FLASH bank Wolfgang Grandegger
2008-05-28 18:12           ` [U-Boot-Users] [PATCH] TQM85xx: Bugfix in the SDRAM initialisation Wolfgang Grandegger
2008-05-28 18:12             ` [U-Boot-Users] [PATCH] TQM85xx: Support for Intel 82527 compatible CAN controller Wolfgang Grandegger
2008-05-28 18:12               ` [U-Boot-Users] [PATCH] TQM85xx: Support for Flat Device Tree Wolfgang Grandegger
2008-05-28 18:12                 ` [U-Boot-Users] [PATCH] TQM8548: Basic support for the TQM8548 modules Wolfgang Grandegger
2008-05-28 18:12                   ` [U-Boot-Users] [PATCH] TQM8548: PCI express support Wolfgang Grandegger
2008-05-28 18:12                     ` [U-Boot-Users] [PATCH] TQM85xx: NAND support via local bus UPMB Wolfgang Grandegger
2008-05-28 18:12                       ` [U-Boot-Users] [PATCH] TQM85xx: Change memory map to support Flash memory > 128 MiB Wolfgang Grandegger
2008-05-28 18:25                       ` [U-Boot-Users] [PATCH] TQM85xx: NAND support via local bus UPMB Scott Wood
2008-05-28 18:38                         ` Wolfgang Grandegger
2008-05-29 11:39                           ` Anton Vorontsov
2008-05-29 11:58                             ` Wolfgang Grandegger
2008-05-29 12:44                               ` Anton Vorontsov
2008-05-30 18:00                                 ` Wolfgang Grandegger [this message]
2008-05-30 18:28                                   ` Anton Vorontsov
2008-05-31  7:06                                     ` Wolfgang Grandegger
2008-05-31  7:11                                       ` Wolfgang Grandegger
2008-06-02 10:06                                     ` Wolfgang Grandegger
2008-06-03  3:15   ` [U-Boot-Users] [PATCH] MPC85xx: Beatify boot output of L2 cache configuration Andy Fleming
2008-06-03  7:28     ` Wolfgang Grandegger
2008-06-03 16:50       ` Detlev Zundel

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=484040C0.1030103@grandegger.com \
    --to=wg@grandegger.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.