public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Roy Spliet <r.spliet@ultimaker.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Proposal to add NAND-boot support for Sunxi SPL
Date: Fri, 22 May 2015 09:04:36 +0200	[thread overview]
Message-ID: <555ED504.6020904@ultimaker.com> (raw)
In-Reply-To: <8f6eb28e-558d-4ac9-ad95-e5c6be4cb870@googlegroups.com>

Hello,

For my set-up I made use of Boris Brezillon's sunxi-nand tree[1], or 
actually I rebased his patches on top of 4.0rc7. This basically adds 
support for NAND-chip partitioning, ECC and randomisation. Docs for the 
DT specification in Documentation/devicetree/bindings/mtd/sunxi-nand.txt 
, and an example can be found in 
arch/arm/boot/dts/sun7i-a20-cubietruck.dts . [2] lists the acceptable 
configuration options for the boot and boot_rescue partitions, make sure 
to pick one of these (which should be no problem for MLC-type nand). The 
ECC mode for these boot partitions is called hw_syndrome.

Assuming you now have a Linux set-up kernel based on this tree with NAND 
support on an MMC, for U-boot what you should currently do is:
1) in include/configs/sunxi-common.h, adjust the parameters 
<CONFIG_NAND_SUNXI_>PAGE_SIZE, ECC_STEP, ECC_STRENGTH to match your NAND 
chip and DT configuration.
2) Build
3) Use your MMC to flash u-boot-sunxi-with-spl.bin onto NAND:
# flash_erase /dev/mtd0
# nandwrite -p /dev/mtd0 u-boot-sunxi-with-spl.bin
4) Reboot without the MMC card and see U-boot load

That should be all.

@Alex: To answer your question specifically: It's likely that the 
parameters in sunxi-common.h mentioned above might not match your 
NAND-chip configuration in the Linux kernel. I can't tell you precisely 
how to fetch these details from the 3.4 kernel, sorry. I recall Daniel 
using 24-bit strength ECC with otherwise equal parameters, but perhaps 
he can help you with this better than I can.

Cheers,

Roy

[1] https://github.com/bbrezillon/linux-sunxi/commits/sunxi-nand
[2] https://linux-sunxi.org/NAND#More_information_on_BROM_NAND

Op 22-05-15 om 04:23 schreef kaplan2539 at gmail.com:
> Hi Roy,
>
> I could definitely use such a howto. I have applied the patches to the 
> current mainline u-boot head and try to boot my A13-OlinXino Wifi 
> board in FEL mode.
> I can compile and boot into u-boot via FEL. However, I get these 
> errors when I have CONFIG_SPL_NAND_SUPPORT defined:
>
> U-Boot SPL 2015.07-rc1-00276-g77792f9-dirty (May 21 2015 - 19:15:54)
> DRAM: 512 MiB
> Failed to set core voltage! Can't set CPU frequency
> sunxi board_nand_init()
> Nand initialised
> Error: 1 ECC failures detected
> Error: 512 ECC failures detected
>
> This is my configs/A13-OLinuXino_defconfig looks like this:
> CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER,USB_EHCI,SYS_MAX_NAND_DEVICE=1,SYS_NAND_BASE=0x00"
> CONFIG_NAND=y
> CONFIG_SUNXI_NAND=y
> CONFIG_SUNXI_DMA=y
> CONFIG_CMD_NAND=y
> CONFIG_SPL_NAND_SUPPORT=y
> CONFIG_SPL=y
> CONFIG_FDTFILE="sun5i-a13-olinuxino.dtb"
> CONFIG_USB1_VBUS_PIN="PG11"
> CONFIG_VIDEO_HDMI=n
> CONFIG_VIDEO_VGA_VIA_LCD=y
> CONFIG_VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH=y
> # For use with the Olimex 7" LCD module, adjust timings for other 
> displays
> # Set video-mode=sunxi:800x600-24 at 60,monitor=lcd in the env. to enable
> CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:3,vmode:0"
> CONFIG_VIDEO_LCD_POWER="AXP0-0"
> CONFIG_VIDEO_LCD_BL_PWM="PB2"
> CONFIG_ARM=y
> CONFIG_ARCH_SUNXI=y
> CONFIG_MACH_SUN5I=y
> CONFIG_DRAM_CLK=408
> CONFIG_DRAM_ZQ=123
> CONFIG_DRAM_EMR1=0
> CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino"
>
> I just found out in the sun5i-a13-olinuxino.dts file are no nand settings.
> I guess I can find the information in the linux-sunxi 3.4 kernels fex 
> file for the olinuxio and need to convert to dts, correct?
>
> I am happy about any hints / comments.
>
> Thanks
> Alex
>
>
>
> On Thursday, May 21, 2015 at 11:08:24 AM UTC-7, Hans de Goede wrote:
>
>     Hi Roy,
>
>     On 21-05-15 15:59, Roy Spliet wrote:
>     > The following patches take the work by Daniel Kochm?nski, and
>     make some
>     > heavy modifications for readability and functionality, based on
>     Boris
>     > Brezillon's Linux driver. Tested on an Olimex Lime w/ A20.
>     > Patches are sent as RFC. Open questions:
>     > - Config options added are partially NAND-chip specific. Some
>     options can
>     > be autodetected based on the NAND ID, others require either
>     brute-forcing
>     > or config options like these. Do they belong in sunxi-common?
>     Should
>     > we make a Kconfig option for this? If bikeshedding is desired,
>     are defines
>     > in sunxi-common.h good enough for now?
>     > - Style is mostly kernel-like. Satisfied?
>     > - Daniel: do you think we can work from here?
>     >
>     > Please comment away!
>
>     Cool stuff. Overall this looks good I'll reply with more detailed
>     feedback
>     to your individual patches, 2 questions:
>
>     1) Can you provide a quick howto (at developer level) on how to
>     actually
>     get the spl and u-boot into the nand, what I'm looking for is
>     unstructions
>     like this:
>
>     a) Take this git repo + branch, build a kernel from it
>     b) Look at this dts file for a nand settings example, adjust it
>     for your board
>     c) Once booted into the kernel using an updated dts you should
>     have these
>     block devices, dd spl to this one, and u-boot to this one.
>
>     No more to go more detailed then that :)
>
>     2) What is the plan to add support for loading files from nand in
>     u-boot proper,
>     so that we can get (e.g.) extlinux.conf + kernel +dtb from a /boot
>     on nand ?
>
>     Regards,
>
>     Hans
>


-- 


IMAGINE IT >> MAKE IT

Meet us online at Twitter <http://twitter.com/ultimaker>, Facebook 
<http://facebook.com/ultimaker>, Google+ <http://google.com/+Ultimaker>

www.ultimaker.com

  reply	other threads:[~2015-05-22  7:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 13:59 [U-Boot] Proposal to add NAND-boot support for Sunxi SPL Roy Spliet
2015-05-21 13:59 ` [U-Boot] [PATCH 1/2] nand: sunxi: change BLOCK_SIZE in mksunxiboot to match NAND block size Roy Spliet
2015-05-21 18:12   ` Hans de Goede
2015-05-21 13:59 ` [U-Boot] [PATCH 2/2] nand: sunxi: Add support for booting from internal NAND memory Roy Spliet
2015-05-21 18:39   ` Hans de Goede
2015-05-21 19:02     ` Ian Campbell
2015-05-22  7:30       ` Hans de Goede
2015-05-22  8:57         ` Ian Campbell
2015-06-01 22:14   ` Scott Wood
2015-06-02  6:43     ` Roy Spliet
2015-05-21 18:08 ` [U-Boot] Proposal to add NAND-boot support for Sunxi SPL Hans de Goede
2015-05-22  2:23   ` kaplan2539 at gmail.com
2015-05-22  7:04     ` Roy Spliet [this message]
2015-05-25 18:35       ` Hans de Goede
2015-05-25 20:39         ` Hans de Goede
2015-05-26  7:34           ` Roy Spliet
2015-05-26 14:52             ` Hans de Goede
2015-05-26 19:56               ` Alexander Kaplan
2015-05-26 20:06                 ` Daniel Kochmański
2015-05-26 20:20                 ` Hans de Goede
2015-05-22  7:38   ` [U-Boot] [linux-sunxi] " Michal Suchanek
2015-05-22 10:12   ` [U-Boot] " Roy Spliet
2015-05-22 13:51     ` Hans de Goede
     [not found]       ` <5561D264.4000705@ultimaker.com>
2015-05-25  7:20         ` Hans de Goede
2015-05-25  9:29           ` Daniel Kochmański
2015-05-25 10:10             ` Hans de Goede
2015-05-27 20:19       ` [U-Boot] [linux-sunxi] " Henrik Nordström

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=555ED504.6020904@ultimaker.com \
    --to=r.spliet@ultimaker.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox