]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'u-boot/master' into 'u-boot-arm/master'
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Fri, 12 Apr 2013 20:07:57 +0000 (22:07 +0200)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Fri, 12 Apr 2013 20:07:57 +0000 (22:07 +0200)
Conflicts:
drivers/video/exynos_fb.c

1  2 
Makefile
README
drivers/mtd/nand/mxc_nand.c
drivers/video/exynos_fb.c
include/configs/am335x_evm.h
include/lcd.h

diff --combined Makefile
index e0f2c86ae757f23775c9592ade1f1cfc8a484f06,db7561c2d802bd5258789013cf435a061e9535f6..84b0c43440d0a55ef5b8db3f6735cd7359301077
+++ b/Makefile
@@@ -24,7 -24,7 +24,7 @@@
  VERSION = 2013
  PATCHLEVEL = 04
  SUBLEVEL =
- EXTRAVERSION = -rc1
+ EXTRAVERSION = -rc2
  ifneq "$(SUBLEVEL)" ""
  U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  else
@@@ -46,7 -46,12 +46,7 @@@ HOSTARCH := $(shell uname -m | 
  HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
            sed -e 's/\(cygwin\).*/cygwin/')
  
 -# Set shell to bash if possible, otherwise fall back to sh
 -SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 -      else if [ -x /bin/bash ]; then echo /bin/bash; \
 -      else echo sh; fi; fi)
 -
 -export        HOSTARCH HOSTOS SHELL
 +export        HOSTARCH HOSTOS
  
  # Deal with colliding definitions from tcsh etc.
  VENDOR=
@@@ -268,7 -273,6 +268,7 @@@ LIBS-y += disk/libdisk.
  LIBS-y += drivers/bios_emulator/libatibiosemu.o
  LIBS-y += drivers/block/libblock.o
  LIBS-$(CONFIG_BOOTCOUNT_LIMIT) += drivers/bootcount/libbootcount.o
 +LIBS-y += drivers/crypto/libcrypto.o
  LIBS-y += drivers/dma/libdma.o
  LIBS-y += drivers/fpga/libfpga.o
  LIBS-y += drivers/gpio/libgpio.o
@@@ -402,8 -406,10 +402,10 @@@ ALL-y += $(obj)u-boot.srec $(obj)u-boot
  ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
  ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
  ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
- ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
  ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
+ ifneq ($(CONFIG_SPL_TARGET),)
+ ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
+ endif
  
  # enable combined SPL/u-boot/dtb rules for tegra
  ifneq ($(CONFIG_TEGRA),)
@@@ -481,19 -487,12 +483,19 @@@ $(obj)u-boot.dis:       $(obj)u-boo
  
  
  $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 -              $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(or $(CONFIG_SPL_PAD_TO),0) \
 -                      -O binary $(obj)spl/u-boot-spl \
 -                      $(obj)spl/u-boot-spl-pad.bin
 +              $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
 +                      -I binary -O binary $< $(obj)spl/u-boot-spl-pad.bin
                cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
                rm $(obj)spl/u-boot-spl-pad.bin
  
 +$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 +              $(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
 +                      $(OBJTREE)/u-boot-with-spl.imx
 +
 +$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 +              $(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
 +                      $(OBJTREE)/u-boot-with-nand-spl.imx
 +
  $(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
                $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
                -e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
@@@ -783,6 -782,23 +785,6 @@@ $(obj).boards.depend:     boards.cf
  lcname        = $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
  ucname        = $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
  
 -#########################################################################
 -## ARM1176 Systems
 -#########################################################################
 -smdk6400_noUSB_config \
 -smdk6400_config       :       unconfig
 -      @mkdir -p $(obj)include $(obj)board/samsung/smdk6400
 -      @mkdir -p $(obj)nand_spl/board/samsung/smdk6400
 -      @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
 -      @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
 -      @if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then                       \
 -              echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
 -      else                                                                            \
 -              echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
 -      fi
 -      @$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx
 -      @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
 -
  #########################################################################
  #########################################################################
  
@@@ -841,8 -857,6 +843,8 @@@ clobber:   tid
        @rm -f $(obj)u-boot.kwb
        @rm -f $(obj)u-boot.pbl
        @rm -f $(obj)u-boot.imx
 +      @rm -f $(obj)u-boot-with-spl.imx
 +      @rm -f $(obj)u-boot-with-nand-spl.imx
        @rm -f $(obj)u-boot.ubl
        @rm -f $(obj)u-boot.ais
        @rm -f $(obj)u-boot.dtb
diff --combined README
index 6272853993205496cf8cd1a6176e54e48badca21,67a071fccac5f909a2193d39350757fd14235611..14c83f4bb1796698e3a88b192a390395c51febeb
--- 1/README
--- 2/README
+++ b/README
@@@ -496,6 -496,13 +496,13 @@@ The following options need to be config
                exists, unlike the similar options in the Linux kernel. Do not
                set these options unless they apply!
  
+ - CPU timer options:
+               CONFIG_SYS_HZ
+               The frequency of the timer returned by get_timer().
+               get_timer() must operate in milliseconds and this CONFIG
+               option must be set to 1000.
  - Linux Kernel Interface:
                CONFIG_CLOCKS_IN_MHZ
  
                boot loader that has already initialized the UART.  Define this
                variable to flush the UART at init time.
  
 -              CONFIG_SYS_NS16550_BROKEN_TEMT
 -
 -              16550 UART set the Transmitter Empty (TEMT) Bit when all output
 -              has finished and the transmitter is totally empty. U-Boot waits
 -              for this bit to be set to initialize the serial console. On some
 -              broken platforms this bit is not set in SPL making U-Boot to
 -              hang while waiting for TEMT. Define this option to avoid it.
 -
  
  - Console Interface:
                Depending on board, define exactly one serial port
                        CONFIG_SH_MMCIF_CLK
                        Define the clock frequency for MMCIF
  
+ - USB Device Firmware Update (DFU) class support:
+               CONFIG_DFU_FUNCTION
+               This enables the USB portion of the DFU USB class
+               CONFIG_CMD_DFU
+               This enables the command "dfu" which is used to have
+               U-Boot create a DFU class device via USB.  This command
+               requires that the "dfu_alt_info" environment variable be
+               set and define the alt settings to expose to the host.
+               CONFIG_DFU_MMC
+               This enables support for exposing (e)MMC devices via DFU.
+               CONFIG_DFU_NAND
+               This enables support for exposing NAND devices via DFU.
+               CONFIG_SYS_DFU_MAX_FILE_SIZE
+               When updating files rather than the raw storage device,
+               we use a static buffer to copy the file into and then write
+               the buffer once we've been given the whole file.  Define
+               this to the maximum filesize (in bytes) for the buffer.
+               Default is 4 MiB if undefined.
  - Journaling Flash filesystem support:
                CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
                CONFIG_JFFS2_NAND_DEV
@@@ -1930,15 -1968,15 +1960,15 @@@ CBFS (Coreboot Filesystem) suppor
  
                I2C_READ
  
-               Code that returns TRUE if the I2C data line is high,
-               FALSE if it is low.
+               Code that returns true if the I2C data line is high,
+               false if it is low.
  
                eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0)
  
                I2C_SDA(bit)
  
-               If <bit> is TRUE, sets the I2C data line high. If it
-               is FALSE, it clears it (low).
+               If <bit> is true, sets the I2C data line high. If it
+               is false, it clears it (low).
  
                eg: #define I2C_SDA(bit) \
                        if(bit) immr->im_cpm.cp_pbdat |=  PB_SDA; \
  
                I2C_SCL(bit)
  
-               If <bit> is TRUE, sets the I2C clock line high. If it
-               is FALSE, it clears it (low).
+               If <bit> is true, sets the I2C clock line high. If it
+               is false, it clears it (low).
  
                eg: #define I2C_SCL(bit) \
                        if(bit) immr->im_cpm.cp_pbdat |=  PB_SCL; \
@@@ -2768,6 -2806,32 +2798,32 @@@ FIT uImage format
                Adds the MTD partitioning infrastructure from the Linux
                kernel. Needed for UBI support.
  
+ - UBI support
+               CONFIG_CMD_UBI
+               Adds commands for interacting with MTD partitions formatted
+               with the UBI flash translation layer
+               Requires also defining CONFIG_RBTREE
+               CONFIG_UBI_SILENCE_MSG
+               Make the verbose messages from UBI stop printing.  This leaves
+               warnings and errors enabled.
+ - UBIFS support
+               CONFIG_CMD_UBIFS
+               Adds commands for interacting with UBI volumes formatted as
+               UBIFS.  UBIFS is read-only in u-boot.
+               Requires UBI support as well as CONFIG_LZO
+               CONFIG_UBIFS_SILENCE_MSG
+               Make the verbose messages from UBIFS stop printing.  This leaves
+               warnings and errors enabled.
  - SPL framework
                CONFIG_SPL
                Enable building of SPL globally.
                Support for lib/libgeneric.o in SPL binary
  
                CONFIG_SPL_PAD_TO
 -              Linker address to which the SPL should be padded before
 -              appending the SPL payload.
 +              Image offset to which the SPL should be padded before appending
 +              the SPL payload. By default, this is defined as
 +              CONFIG_SPL_MAX_SIZE, or 0 if CONFIG_SPL_MAX_SIZE is undefined.
 +              CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL
 +              payload without any padding, or >= CONFIG_SPL_MAX_SIZE.
  
                CONFIG_SPL_TARGET
                Final target image containing SPL and payload.  Some SPLs
@@@ -3487,6 -3548,33 +3543,33 @@@ but it can not erase, write this NOR fl
        environment. If redundant environment is used, it will be copied to
        CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE.
  
+ - CONFIG_ENV_IS_IN_UBI:
+       Define this if you have an UBI volume that you want to use for the
+       environment.  This has the benefit of wear-leveling the environment
+       accesses, which is important on NAND.
+       - CONFIG_ENV_UBI_PART:
+         Define this to a string that is the mtd partition containing the UBI.
+       - CONFIG_ENV_UBI_VOLUME:
+         Define this to the name of the volume that you want to store the
+         environment in.
+       - CONFIG_ENV_UBI_VOLUME_REDUND:
+         Define this to the name of another volume to store a second copy of
+         the environment in.  This will enable redundant environments in UBI.
+         It is assumed that both volumes are in the same MTD partition.
+       - CONFIG_UBI_SILENCE_MSG
+       - CONFIG_UBIFS_SILENCE_MSG
+         You will probably want to define these to avoid a really noisy system
+         when storing the env in UBI.
  - CONFIG_SYS_SPI_INIT_OFFSET
  
        Defines offset to the initial SPI buffer area in DPRAM. The
@@@ -3758,13 -3846,9 +3841,13 @@@ Low Level (hardware related) configurat
  - CONFIG_SYS_SRIOn_MEM_SIZE:
                Size of SRIO port 'n' memory region
  
 -- CONFIG_SYS_NDFC_16
 -              Defined to tell the NDFC that the NAND chip is using a
 -              16 bit bus.
 +- CONFIG_SYS_NAND_BUSWIDTH_16BIT
 +              Defined to tell the NAND controller that the NAND chip is using
 +              a 16 bit bus.
 +              Not all NAND drivers use this symbol.
 +              Example of drivers that use it:
 +              - drivers/mtd/nand/ndfc.c
 +              - drivers/mtd/nand/mxc_nand.c
  
  - CONFIG_SYS_NDFC_EBC0_CFG
                Sets the EBC0_CFG register for the NDFC. If not defined
index 507bbc25445c77a952a03ab8ceb9193af3a6a234,04836c00626bdd5f70bc6011b5885ab846d5880c..eeba521942b78e76e0887e7648c8681b9019172b
  #include <nand.h>
  #include <linux/err.h>
  #include <asm/io.h>
 -#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35)
 +#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) || \
 +      defined(CONFIG_MX51) || defined(CONFIG_MX53)
  #include <asm/arch/imx-regs.h>
  #endif
 -#include <fsl_nfc.h>
 +#include "mxc_nand.h"
  
  #define DRIVER_NAME "mxc_nand"
  
- typedef enum {false, true} bool;
  struct mxc_nand_host {
        struct mtd_info                 mtd;
        struct nand_chip                *nand;
  
 -      struct fsl_nfc_regs __iomem     *regs;
 +      struct mxc_nand_regs __iomem    *regs;
 +#ifdef MXC_NFC_V3_2
 +      struct mxc_nand_ip_regs __iomem *ip_regs;
 +#endif
        int                             spare_only;
        int                             status_request;
        int                             pagesize_2k;
@@@ -81,7 -75,7 +79,7 @@@ static struct nand_ecclayout nand_hw_ec
        .oobfree = { {2, 4}, {11, 11}, {27, 11}, {43, 11}, {59, 5} },
  };
  #endif
 -#elif defined(MXC_NFC_V2_1)
 +#elif defined(MXC_NFC_V2_1) || defined(MXC_NFC_V3_2)
  #ifndef CONFIG_SYS_NAND_LARGEPAGE
  static struct nand_ecclayout nand_hw_eccoob = {
        .eccbytes = 9,
@@@ -102,14 -96,45 +100,14 @@@ static struct nand_ecclayout nand_hw_ec
  #endif
  #endif
  
 -#ifdef CONFIG_MX27
  static int is_16bit_nand(void)
  {
 -      struct system_control_regs *sc_regs =
 -              (struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
 -
 -      if (readl(&sc_regs->fmcr) & NF_16BIT_SEL)
 -              return 1;
 -      else
 -              return 0;
 -}
 -#elif defined(CONFIG_MX31)
 -static int is_16bit_nand(void)
 -{
 -      struct clock_control_regs *sc_regs =
 -              (struct clock_control_regs *)CCM_BASE;
 -
 -      if (readl(&sc_regs->rcsr) & CCM_RCSR_NF16B)
 -              return 1;
 -      else
 -              return 0;
 -}
 -#elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
 -static int is_16bit_nand(void)
 -{
 -      struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 -
 -      if (readl(&ccm->rcsr) & CCM_RCSR_NF_16BIT_SEL)
 -              return 1;
 -      else
 -              return 0;
 -}
 +#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT)
 +      return 1;
  #else
 -#warning "8/16 bit NAND autodetection not supported"
 -static int is_16bit_nand(void)
 -{
        return 0;
 -}
  #endif
 +}
  
  static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size)
  {
  
  /*
   * This function polls the NANDFC to wait for the basic operation to
 - * complete by checking the INT bit of config2 register.
 + * complete by checking the INT bit.
   */
  static void wait_op_done(struct mxc_nand_host *host, int max_retries,
                                uint16_t param)
        uint32_t tmp;
  
        while (max_retries-- > 0) {
 -              if (readw(&host->regs->config2) & NFC_INT) {
 -                      tmp = readw(&host->regs->config2);
 -                      tmp  &= ~NFC_INT;
 -                      writew(tmp, &host->regs->config2);
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
 +              tmp = readnfc(&host->regs->config2);
 +              if (tmp & NFC_V1_V2_CONFIG2_INT) {
 +                      tmp &= ~NFC_V1_V2_CONFIG2_INT;
 +                      writenfc(tmp, &host->regs->config2);
 +#elif defined(MXC_NFC_V3_2)
 +              tmp = readnfc(&host->ip_regs->ipc);
 +              if (tmp & NFC_V3_IPC_INT) {
 +                      tmp &= ~NFC_V3_IPC_INT;
 +                      writenfc(tmp, &host->ip_regs->ipc);
 +#endif
                        break;
                }
                udelay(1);
@@@ -160,8 -178,8 +158,8 @@@ static void send_cmd(struct mxc_nand_ho
  {
        MTDDEBUG(MTD_DEBUG_LEVEL3, "send_cmd(host, 0x%x)\n", cmd);
  
 -      writew(cmd, &host->regs->flash_cmd);
 -      writew(NFC_CMD, &host->regs->config2);
 +      writenfc(cmd, &host->regs->flash_cmd);
 +      writenfc(NFC_CMD, &host->regs->operation);
  
        /* Wait for operation to complete */
        wait_op_done(host, TROP_US_DELAY, cmd);
@@@ -176,8 -194,8 +174,8 @@@ static void send_addr(struct mxc_nand_h
  {
        MTDDEBUG(MTD_DEBUG_LEVEL3, "send_addr(host, 0x%x)\n", addr);
  
 -      writew(addr, &host->regs->flash_addr);
 -      writew(NFC_ADDR, &host->regs->config2);
 +      writenfc(addr, &host->regs->flash_addr);
 +      writenfc(NFC_ADDR, &host->regs->operation);
  
        /* Wait for operation to complete */
        wait_op_done(host, TROP_US_DELAY, addr);
@@@ -193,7 -211,7 +191,7 @@@ static void send_prog_page(struct mxc_n
        if (spare_only)
                MTDDEBUG(MTD_DEBUG_LEVEL1, "send_prog_page (%d)\n", spare_only);
  
 -      if (is_mxc_nfc_21()) {
 +      if (is_mxc_nfc_21() || is_mxc_nfc_32()) {
                int i;
                /*
                 *  The controller copies the 64 bytes of spare data from
                }
        }
  
 -      writew(buf_id, &host->regs->buf_addr);
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
 +      writenfc(buf_id, &host->regs->buf_addr);
 +#elif defined(MXC_NFC_V3_2)
 +      uint32_t tmp = readnfc(&host->regs->config1);
 +      tmp &= ~NFC_V3_CONFIG1_RBA_MASK;
 +      tmp |= NFC_V3_CONFIG1_RBA(buf_id);
 +      writenfc(tmp, &host->regs->config1);
 +#endif
  
        /* Configure spare or page+spare access */
        if (!host->pagesize_2k) {
 -              uint16_t config1 = readw(&host->regs->config1);
 +              uint32_t config1 = readnfc(&host->regs->config1);
                if (spare_only)
 -                      config1 |= NFC_SP_EN;
 +                      config1 |= NFC_CONFIG1_SP_EN;
                else
 -                      config1 &= ~NFC_SP_EN;
 -              writew(config1, &host->regs->config1);
 +                      config1 &= ~NFC_CONFIG1_SP_EN;
 +              writenfc(config1, &host->regs->config1);
        }
  
 -      writew(NFC_INPUT, &host->regs->config2);
 +      writenfc(NFC_INPUT, &host->regs->operation);
  
        /* Wait for operation to complete */
        wait_op_done(host, TROP_US_DELAY, spare_only);
@@@ -243,31 -254,24 +241,31 @@@ static void send_read_page(struct mxc_n
  {
        MTDDEBUG(MTD_DEBUG_LEVEL3, "send_read_page (%d)\n", spare_only);
  
 -      writew(buf_id, &host->regs->buf_addr);
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
 +      writenfc(buf_id, &host->regs->buf_addr);
 +#elif defined(MXC_NFC_V3_2)
 +      uint32_t tmp = readnfc(&host->regs->config1);
 +      tmp &= ~NFC_V3_CONFIG1_RBA_MASK;
 +      tmp |= NFC_V3_CONFIG1_RBA(buf_id);
 +      writenfc(tmp, &host->regs->config1);
 +#endif
  
        /* Configure spare or page+spare access */
        if (!host->pagesize_2k) {
 -              uint32_t config1 = readw(&host->regs->config1);
 +              uint32_t config1 = readnfc(&host->regs->config1);
                if (spare_only)
 -                      config1 |= NFC_SP_EN;
 +                      config1 |= NFC_CONFIG1_SP_EN;
                else
 -                      config1 &= ~NFC_SP_EN;
 -              writew(config1, &host->regs->config1);
 +                      config1 &= ~NFC_CONFIG1_SP_EN;
 +              writenfc(config1, &host->regs->config1);
        }
  
 -      writew(NFC_OUTPUT, &host->regs->config2);
 +      writenfc(NFC_OUTPUT, &host->regs->operation);
  
        /* Wait for operation to complete */
        wait_op_done(host, TROP_US_DELAY, spare_only);
  
 -      if (is_mxc_nfc_21()) {
 +      if (is_mxc_nfc_21() || is_mxc_nfc_32()) {
                int i;
  
                /*
  /* Request the NANDFC to perform a read of the NAND device ID. */
  static void send_read_id(struct mxc_nand_host *host)
  {
 -      uint16_t tmp;
 +      uint32_t tmp;
  
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
        /* NANDFC buffer 0 is used for device ID output */
 -      writew(0x0, &host->regs->buf_addr);
 +      writenfc(0x0, &host->regs->buf_addr);
 +#elif defined(MXC_NFC_V3_2)
 +      tmp = readnfc(&host->regs->config1);
 +      tmp &= ~NFC_V3_CONFIG1_RBA_MASK;
 +      writenfc(tmp, &host->regs->config1);
 +#endif
  
        /* Read ID into main buffer */
 -      tmp = readw(&host->regs->config1);
 -      tmp &= ~NFC_SP_EN;
 -      writew(tmp, &host->regs->config1);
 +      tmp = readnfc(&host->regs->config1);
 +      tmp &= ~NFC_CONFIG1_SP_EN;
 +      writenfc(tmp, &host->regs->config1);
  
 -      writew(NFC_ID, &host->regs->config2);
 +      writenfc(NFC_ID, &host->regs->operation);
  
        /* Wait for operation to complete */
        wait_op_done(host, TROP_US_DELAY, 0);
   */
  static uint16_t get_dev_status(struct mxc_nand_host *host)
  {
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
        void __iomem *main_buf = host->regs->main_area[1];
        uint32_t store;
 -      uint16_t ret, tmp;
 +#endif
 +      uint32_t ret, tmp;
        /* Issue status request to NAND device */
  
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
        /* store the main area1 first word, later do recovery */
        store = readl(main_buf);
        /* NANDFC buffer 1 is used for device status */
 -      writew(1, &host->regs->buf_addr);
 +      writenfc(1, &host->regs->buf_addr);
 +#endif
  
        /* Read status into main buffer */
 -      tmp = readw(&host->regs->config1);
 -      tmp &= ~NFC_SP_EN;
 -      writew(tmp, &host->regs->config1);
 +      tmp = readnfc(&host->regs->config1);
 +      tmp &= ~NFC_CONFIG1_SP_EN;
 +      writenfc(tmp, &host->regs->config1);
  
 -      writew(NFC_STATUS, &host->regs->config2);
 +      writenfc(NFC_STATUS, &host->regs->operation);
  
        /* Wait for operation to complete */
        wait_op_done(host, TROP_US_DELAY, 0);
  
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
        /*
         *  Status is placed in first word of main buffer
         * get status, then recovery area 1 data
         */
        ret = readw(main_buf);
        writel(store, main_buf);
 +#elif defined(MXC_NFC_V3_2)
 +      ret = readnfc(&host->regs->config1) >> 16;
 +#endif
  
        return ret;
  }
@@@ -367,23 -357,13 +365,23 @@@ static void _mxc_nand_enable_hwecc(stru
  {
        struct nand_chip *nand_chip = mtd->priv;
        struct mxc_nand_host *host = nand_chip->priv;
 -      uint16_t tmp = readw(&host->regs->config1);
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
 +      uint16_t tmp = readnfc(&host->regs->config1);
  
        if (on)
 -              tmp |= NFC_ECC_EN;
 +              tmp |= NFC_V1_V2_CONFIG1_ECC_EN;
        else
 -              tmp &= ~NFC_ECC_EN;
 -      writew(tmp, &host->regs->config1);
 +              tmp &= ~NFC_V1_V2_CONFIG1_ECC_EN;
 +      writenfc(tmp, &host->regs->config1);
 +#elif defined(MXC_NFC_V3_2)
 +      uint32_t tmp = readnfc(&host->ip_regs->config2);
 +
 +      if (on)
 +              tmp |= NFC_V3_CONFIG2_ECC_EN;
 +      else
 +              tmp &= ~NFC_V3_CONFIG2_ECC_EN;
 +      writenfc(tmp, &host->ip_regs->config2);
 +#endif
  }
  
  #ifdef CONFIG_MXC_NAND_HWECC
@@@ -395,7 -375,7 +393,7 @@@ static void mxc_nand_enable_hwecc(struc
         */
  }
  
 -#ifdef MXC_NFC_V2_1
 +#if defined(MXC_NFC_V2_1) || defined(MXC_NFC_V3_2)
  static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd,
                                      struct nand_chip *chip,
                                      int page, int sndcmd)
  
        MTDDEBUG(MTD_DEBUG_LEVEL0,
                        "%s: Reading OOB area of page %u to oob %p\n",
 -                       __FUNCTION__, host->page_addr, buf);
 +                       __func__, page, buf);
  
        chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
        for (i = 0; i < chip->ecc.steps; i++) {
@@@ -463,7 -443,7 +461,7 @@@ static int mxc_nand_read_page_raw_syndr
        int n;
  
        _mxc_nand_enable_hwecc(mtd, 0);
 -      chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, host->page_addr);
 +      chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
  
        for (n = 0, steps = chip->ecc.steps; steps > 0; n++, steps--) {
                host->col_addr = n * eccsize;
@@@ -507,7 -487,7 +505,7 @@@ static int mxc_nand_read_page_syndrome(
        uint8_t *oob = chip->oob_poi;
  
        MTDDEBUG(MTD_DEBUG_LEVEL1, "Reading page %u to buf %p oob %p\n",
 -            host->page_addr, buf, oob);
 +            page, buf, oob);
  
        /* first read the data area and the available portion of OOB */
        for (n = 0; eccsteps; n++, eccsteps--, p += eccsize) {
  
        /* Then switch ECC off and read the OOB area to get the ECC code */
        _mxc_nand_enable_hwecc(mtd, 0);
 -      chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, host->page_addr);
 +      chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
        eccsteps = chip->ecc.steps;
        oob = chip->oob_poi + chip->ecc.prepad;
        for (n = 0; eccsteps; n++, eccsteps--, p += eccsize) {
@@@ -716,7 -696,7 +714,7 @@@ static int mxc_nand_correct_data(struc
         * additional correction.  2-Bit errors cannot be corrected by
         * HW ECC, so we need to return failure
         */
 -      uint16_t ecc_status = readw(&host->regs->ecc_status_result);
 +      uint16_t ecc_status = readnfc(&host->regs->ecc_status_result);
  
        if (((ecc_status & 0x3) == 2) || ((ecc_status >> 2) == 2)) {
                MTDDEBUG(MTD_DEBUG_LEVEL0,
@@@ -1185,8 -1165,8 +1183,8 @@@ static struct nand_bbt_descr bbt_mirror
  int board_nand_init(struct nand_chip *this)
  {
        struct mtd_info *mtd;
 -#ifdef MXC_NFC_V2_1
 -      uint16_t tmp;
 +#if defined(MXC_NFC_V2_1) || defined(MXC_NFC_V3_2)
 +      uint32_t tmp;
  #endif
  
  #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
        this->read_buf = mxc_nand_read_buf;
        this->verify_buf = mxc_nand_verify_buf;
  
 -      host->regs = (struct fsl_nfc_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
 +      host->regs = (struct mxc_nand_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
 +#ifdef MXC_NFC_V3_2
 +      host->ip_regs =
 +              (struct mxc_nand_ip_regs __iomem *)CONFIG_MXC_NAND_IP_REGS_BASE;
 +#endif
        host->clk_act = 1;
  
  #ifdef CONFIG_MXC_NAND_HWECC
        this->ecc.calculate = mxc_nand_calculate_ecc;
        this->ecc.hwctl = mxc_nand_enable_hwecc;
        this->ecc.correct = mxc_nand_correct_data;
 -      if (is_mxc_nfc_21()) {
 +      if (is_mxc_nfc_21() || is_mxc_nfc_32()) {
                this->ecc.mode = NAND_ECC_HW_SYNDROME;
                this->ecc.read_page = mxc_nand_read_page_syndrome;
                this->ecc.read_page_raw = mxc_nand_read_page_raw_syndrome;
        this->ecc.layout = &nand_hw_eccoob;
  #endif
  
 +#if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
  #ifdef MXC_NFC_V2_1
 -      tmp = readw(&host->regs->config1);
 -      tmp |= NFC_ONE_CYCLE;
 -      tmp |= NFC_4_8N_ECC;
 -      writew(tmp, &host->regs->config1);
 +      tmp = readnfc(&host->regs->config1);
 +      tmp |= NFC_V2_CONFIG1_ONE_CYCLE;
 +      tmp |= NFC_V2_CONFIG1_ECC_MODE_4;
 +      writenfc(tmp, &host->regs->config1);
        if (host->pagesize_2k)
 -              writew(64/2, &host->regs->spare_area_size);
 +              writenfc(64/2, &host->regs->spare_area_size);
        else
 -              writew(16/2, &host->regs->spare_area_size);
 +              writenfc(16/2, &host->regs->spare_area_size);
  #endif
  
        /*
         * preset operation
         * Unlock the internal RAM Buffer
         */
 -      writew(0x2, &host->regs->config);
 +      writenfc(0x2, &host->regs->config);
  
        /* Blocks to be unlocked */
 -      writew(0x0, &host->regs->unlockstart_blkaddr);
 +      writenfc(0x0, &host->regs->unlockstart_blkaddr);
        /* Originally (Freescale LTIB 2.6.21) 0x4000 was written to the
         * unlockend_blkaddr, but the magic 0x4000 does not always work
         * when writing more than some 32 megabytes (on 2k page nands)
         * This might be NAND chip specific and the i.MX31 datasheet is
         * extremely vague about the semantics of this register.
         */
 -      writew(0xFFFF, &host->regs->unlockend_blkaddr);
 +      writenfc(0xFFFF, &host->regs->unlockend_blkaddr);
  
        /* Unlock Block Command for given address range */
 -      writew(0x4, &host->regs->wrprot);
 +      writenfc(0x4, &host->regs->wrprot);
 +#elif defined(MXC_NFC_V3_2)
 +      writenfc(NFC_V3_CONFIG1_RBA(0), &host->regs->config1);
 +      writenfc(NFC_V3_IPC_CREQ, &host->ip_regs->ipc);
 +
 +      /* Unlock the internal RAM Buffer */
 +      writenfc(NFC_V3_WRPROT_BLS_UNLOCK | NFC_V3_WRPROT_UNLOCK,
 +                      &host->ip_regs->wrprot);
 +
 +      /* Blocks to be unlocked */
 +      for (tmp = 0; tmp < CONFIG_SYS_NAND_MAX_CHIPS; tmp++)
 +              writenfc(0x0 | 0xFFFF << 16,
 +                              &host->ip_regs->wrprot_unlock_blkaddr[tmp]);
 +
 +      writenfc(0, &host->ip_regs->ipc);
 +
 +      tmp = readnfc(&host->ip_regs->config2);
 +      tmp &= ~(NFC_V3_CONFIG2_SPAS_MASK | NFC_V3_CONFIG2_EDC_MASK |
 +                      NFC_V3_CONFIG2_ECC_MODE_8 | NFC_V3_CONFIG2_PS_MASK);
 +      tmp |= NFC_V3_CONFIG2_ONE_CYCLE;
 +
 +      if (host->pagesize_2k) {
 +              tmp |= NFC_V3_CONFIG2_SPAS(64/2);
 +              tmp |= NFC_V3_CONFIG2_PS_2048;
 +      } else {
 +              tmp |= NFC_V3_CONFIG2_SPAS(16/2);
 +              tmp |= NFC_V3_CONFIG2_PS_512;
 +      }
 +
 +      writenfc(tmp, &host->ip_regs->config2);
 +
 +      tmp = NFC_V3_CONFIG3_NUM_OF_DEVS(0) |
 +                      NFC_V3_CONFIG3_NO_SDMA |
 +                      NFC_V3_CONFIG3_RBB_MODE |
 +                      NFC_V3_CONFIG3_SBB(6) | /* Reset default */
 +                      NFC_V3_CONFIG3_ADD_OP(0);
 +
 +      if (!(this->options & NAND_BUSWIDTH_16))
 +              tmp |= NFC_V3_CONFIG3_FW8;
 +
 +      writenfc(tmp, &host->ip_regs->config3);
 +
 +      writenfc(0, &host->ip_regs->delay_line);
 +#endif
  
        return 0;
  }
index dfe329fbc631e21630509dfea41ed6fab5c453ab,c0f1830dc9aed1c793231fa1e23c4f8a593fb73f..ed0823bf977af0a6bc1d91fae9240479513c4d6b
@@@ -23,8 -23,6 +23,8 @@@
  #include <config.h>
  #include <common.h>
  #include <lcd.h>
 +#include <fdtdec.h>
 +#include <libfdt.h>
  #include <asm/io.h>
  #include <asm/arch/cpu.h>
  #include <asm/arch/clock.h>
  #include <asm/arch/mipi_dsim.h>
  #include <asm/arch/dp_info.h>
  #include <asm/arch/system.h>
 +#include <asm-generic/errno.h>
  
  #include "exynos_fb.h"
  
  DECLARE_GLOBAL_DATA_PTR;
  
- int lcd_line_length;
- int lcd_color_fg;
- int lcd_color_bg;
- void *lcd_base;
- void *lcd_console_address;
- short console_col;
- short console_row;
  static unsigned int panel_width, panel_height;
  
 +/*
 + * board_init_f(arch/arm/lib/board.c) calls lcd_setmem() which needs
 + * panel_info.vl_col, panel_info.vl_row and panel_info.vl_bpix to reserve
 + * FB memory at a very early stage, i.e even before exynos_fimd_parse_dt()
 + * is called. So, we are forced to statically assign it.
 + */
 +#ifdef CONFIG_OF_CONTROL
 +vidinfo_t panel_info  = {
 +      .vl_col = LCD_XRES,
 +      .vl_row = LCD_YRES,
 +      .vl_bpix = LCD_COLOR16,
 +};
 +#endif
 +
  static void exynos_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
  {
        unsigned long palette_size;
  
        fb_size = vid->vl_row * vid->vl_col * (NBITS(vid->vl_bpix) >> 3);
  
-       lcd_base = lcdbase;
        palette_size = NBITS(vid->vl_bpix) == 8 ? 256 : 16;
  
-       exynos_fimd_lcd_init_mem((unsigned long)lcd_base,
+       exynos_fimd_lcd_init_mem((unsigned long)lcdbase,
                        (unsigned long)fb_size, palette_size);
  }
  
@@@ -112,226 -83,47 +100,226 @@@ static void draw_logo(void
  }
  #endif
  
 +void __exynos_cfg_lcd_gpio(void)
 +{
 +}
 +void exynos_cfg_lcd_gpio(void)
 +      __attribute__((weak, alias("__exynos_cfg_lcd_gpio")));
 +
 +void __exynos_backlight_on(unsigned int onoff)
 +{
 +}
 +void exynos_backlight_on(unsigned int onoff)
 +      __attribute__((weak, alias("__exynos_cfg_lcd_gpio")));
 +
 +void __exynos_reset_lcd(void)
 +{
 +}
 +void exynos_reset_lcd(void)
 +      __attribute__((weak, alias("__exynos_reset_lcd")));
 +
 +void __exynos_lcd_power_on(void)
 +{
 +}
 +void exynos_lcd_power_on(void)
 +      __attribute__((weak, alias("__exynos_lcd_power_on")));
 +
 +void __exynos_cfg_ldo(void)
 +{
 +}
 +void exynos_cfg_ldo(void)
 +      __attribute__((weak, alias("__exynos_cfg_ldo")));
 +
 +void __exynos_enable_ldo(unsigned int onoff)
 +{
 +}
 +void exynos_enable_ldo(unsigned int onoff)
 +      __attribute__((weak, alias("__exynos_enable_ldo")));
 +
 +void __exynos_backlight_reset(void)
 +{
 +}
 +void exynos_backlight_reset(void)
 +      __attribute__((weak, alias("__exynos_backlight_reset")));
 +
  static void lcd_panel_on(vidinfo_t *vid)
  {
        udelay(vid->init_delay);
  
 -      if (vid->backlight_reset)
 -              vid->backlight_reset();
 +      exynos_backlight_reset();
  
 -      if (vid->cfg_gpio)
 -              vid->cfg_gpio();
 +      exynos_cfg_lcd_gpio();
  
 -      if (vid->lcd_power_on)
 -              vid->lcd_power_on();
 +      exynos_lcd_power_on();
  
        udelay(vid->power_on_delay);
  
        if (vid->dp_enabled)
                exynos_init_dp();
  
 -      if (vid->reset_lcd) {
 -              vid->reset_lcd();
 -              udelay(vid->reset_delay);
 -      }
 +      exynos_reset_lcd();
 +
 +      udelay(vid->reset_delay);
  
 -      if (vid->backlight_on)
 -              vid->backlight_on(1);
 +      exynos_backlight_on(1);
  
 -      if (vid->cfg_ldo)
 -              vid->cfg_ldo();
 +      exynos_cfg_ldo();
  
 -      if (vid->enable_ldo)
 -              vid->enable_ldo(1);
 +      exynos_enable_ldo(1);
  
        if (vid->mipi_enabled)
                exynos_mipi_dsi_init();
  }
  
 +#ifdef CONFIG_OF_CONTROL
 +int exynos_fimd_parse_dt(const void *blob)
 +{
 +      unsigned int node;
 +      node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS_FIMD);
 +      if (node <= 0) {
 +              debug("exynos_fb: Can't get device node for fimd\n");
 +              return -ENODEV;
 +      }
 +
 +      panel_info.vl_col = fdtdec_get_int(blob, node, "samsung,vl-col", 0);
 +      if (panel_info.vl_col == 0) {
 +              debug("Can't get XRES\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_row = fdtdec_get_int(blob, node, "samsung,vl-row", 0);
 +      if (panel_info.vl_row == 0) {
 +              debug("Can't get YRES\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_width = fdtdec_get_int(blob, node,
 +                                              "samsung,vl-width", 0);
 +
 +      panel_info.vl_height = fdtdec_get_int(blob, node,
 +                                              "samsung,vl-height", 0);
 +
 +      panel_info.vl_freq = fdtdec_get_int(blob, node, "samsung,vl-freq", 0);
 +      if (panel_info.vl_freq == 0) {
 +              debug("Can't get refresh rate\n");
 +              return -ENXIO;
 +      }
 +
 +      if (fdtdec_get_bool(blob, node, "samsung,vl-clkp"))
 +              panel_info.vl_clkp = CONFIG_SYS_LOW;
 +
 +      if (fdtdec_get_bool(blob, node, "samsung,vl-oep"))
 +              panel_info.vl_oep = CONFIG_SYS_LOW;
 +
 +      if (fdtdec_get_bool(blob, node, "samsung,vl-hsp"))
 +              panel_info.vl_hsp = CONFIG_SYS_LOW;
 +
 +      if (fdtdec_get_bool(blob, node, "samsung,vl-vsp"))
 +              panel_info.vl_vsp = CONFIG_SYS_LOW;
 +
 +      if (fdtdec_get_bool(blob, node, "samsung,vl-dp"))
 +              panel_info.vl_dp = CONFIG_SYS_LOW;
 +
 +      panel_info.vl_bpix = fdtdec_get_int(blob, node, "samsung,vl-bpix", 0);
 +      if (panel_info.vl_bpix == 0) {
 +              debug("Can't get bits per pixel\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_hspw = fdtdec_get_int(blob, node, "samsung,vl-hspw", 0);
 +      if (panel_info.vl_hspw == 0) {
 +              debug("Can't get hsync width\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_hfpd = fdtdec_get_int(blob, node, "samsung,vl-hfpd", 0);
 +      if (panel_info.vl_hfpd == 0) {
 +              debug("Can't get right margin\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_hbpd = (u_char)fdtdec_get_int(blob, node,
 +                                                      "samsung,vl-hbpd", 0);
 +      if (panel_info.vl_hbpd == 0) {
 +              debug("Can't get left margin\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_vspw = (u_char)fdtdec_get_int(blob, node,
 +                                                      "samsung,vl-vspw", 0);
 +      if (panel_info.vl_vspw == 0) {
 +              debug("Can't get vsync width\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_vfpd = fdtdec_get_int(blob, node,
 +                                                      "samsung,vl-vfpd", 0);
 +      if (panel_info.vl_vfpd == 0) {
 +              debug("Can't get lower margin\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_vbpd = fdtdec_get_int(blob, node, "samsung,vl-vbpd", 0);
 +      if (panel_info.vl_vbpd == 0) {
 +              debug("Can't get upper margin\n");
 +              return -ENXIO;
 +      }
 +
 +      panel_info.vl_cmd_allow_len = fdtdec_get_int(blob, node,
 +                                              "samsung,vl-cmd-allow-len", 0);
 +
 +      panel_info.win_id = fdtdec_get_int(blob, node, "samsung,winid", 0);
 +      panel_info.init_delay = fdtdec_get_int(blob, node,
 +                                              "samsung,init-delay", 0);
 +      panel_info.power_on_delay = fdtdec_get_int(blob, node,
 +                                              "samsung,power-on-delay", 0);
 +      panel_info.reset_delay = fdtdec_get_int(blob, node,
 +                                              "samsung,reset-delay", 0);
 +      panel_info.interface_mode = fdtdec_get_int(blob, node,
 +                                              "samsung,interface-mode", 0);
 +      panel_info.mipi_enabled = fdtdec_get_int(blob, node,
 +                                              "samsung,mipi-enabled", 0);
 +      panel_info.dp_enabled = fdtdec_get_int(blob, node,
 +                                              "samsung,dp-enabled", 0);
 +      panel_info.cs_setup = fdtdec_get_int(blob, node,
 +                                              "samsung,cs-setup", 0);
 +      panel_info.wr_setup = fdtdec_get_int(blob, node,
 +                                              "samsung,wr-setup", 0);
 +      panel_info.wr_act = fdtdec_get_int(blob, node, "samsung,wr-act", 0);
 +      panel_info.wr_hold = fdtdec_get_int(blob, node, "samsung,wr-hold", 0);
 +
 +      panel_info.logo_on = fdtdec_get_int(blob, node, "samsung,logo-on", 0);
 +      if (panel_info.logo_on) {
 +              panel_info.logo_width = fdtdec_get_int(blob, node,
 +                                              "samsung,logo-width", 0);
 +              panel_info.logo_height = fdtdec_get_int(blob, node,
 +                                              "samsung,logo-height", 0);
 +              panel_info.logo_addr = fdtdec_get_int(blob, node,
 +                                              "samsung,logo-addr", 0);
 +      }
 +
 +      panel_info.rgb_mode = fdtdec_get_int(blob, node,
 +                                              "samsung,rgb-mode", 0);
 +      panel_info.pclk_name = fdtdec_get_int(blob, node,
 +                                              "samsung,pclk-name", 0);
 +      panel_info.sclk_div = fdtdec_get_int(blob, node,
 +                                              "samsung,sclk-div", 0);
 +      panel_info.dual_lcd_enabled = fdtdec_get_int(blob, node,
 +                                              "samsung,dual-lcd-enabled", 0);
 +
 +      return 0;
 +}
 +#endif
 +
  void lcd_ctrl_init(void *lcdbase)
  {
        set_system_display_ctrl();
        set_lcd_clk();
  
 +#ifdef CONFIG_OF_CONTROL
 +      if (exynos_fimd_parse_dt(gd->fdt_blob))
 +              debug("Can't get proper panel info\n");
 +#endif
        /* initialize parameters which is specific to panel. */
        init_panel_info(&panel_info);
  
  void lcd_enable(void)
  {
        if (panel_info.logo_on) {
-               memset(lcd_base, 0, panel_width * panel_height *
+               memset((void *) gd->fb_base, 0, panel_width * panel_height *
                                (NBITS(panel_info.vl_bpix) >> 3));
  #ifdef CONFIG_CMD_BMP
                draw_logo();
index dbd5ef327b3698b1fcac929155b67d08d0423022,f7f6d2533641f04973f147213980cbdfeb36d33d..ef00306a55ef09d8ecc78a7ca3dcdc4ad7d1bd3d
@@@ -39,6 -39,8 +39,8 @@@
  #define CONFIG_SETUP_MEMORY_TAGS
  #define CONFIG_INITRD_TAG
  
+ #define CONFIG_SYS_CACHELINE_SIZE       64
  /* commands to include */
  #include <config_cmd_default.h>
  
        "fdtfile=\0" \
        "console=ttyO0,115200n8\0" \
        "optargs=\0" \
+       "mtdids=" MTDIDS_DEFAULT "\0" \
+       "mtdparts=" MTDPARTS_DEFAULT "\0" \
+       "dfu_alt_info_mmc=" DFU_ALT_INFO_MMC "\0" \
+       "dfu_alt_info_emmc=rawemmc mmc 0 3751936\0" \
+       "dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \
        "mmcdev=0\0" \
        "mmcroot=/dev/mmcblk0p2 ro\0" \
        "mmcrootfstype=ext4 rootwait\0" \
  
  #define CONFIG_CMD_ECHO
  
- /* max number of command args */
- #define CONFIG_SYS_MAXARGS            16
+ /* We set the max number of command args high to avoid HUSH bugs. */
+ #define CONFIG_SYS_MAXARGS            64
  
  /* Console I/O Buffer Size */
  #define CONFIG_SYS_CBSIZE             512
  #define CONFIG_CMD_MMC
  #define CONFIG_DOS_PARTITION
  #define CONFIG_CMD_FAT
+ #define CONFIG_FAT_WRITE
  #define CONFIG_CMD_EXT2
  #define CONFIG_CMD_EXT4
  #define CONFIG_CMD_FS_GENERIC
  #define CONFIG_CMD_SF
  #define CONFIG_SF_DEFAULT_SPEED               (24000000)
  
+ /* USB Composite download gadget - g_dnl */
+ #define CONFIG_USB_GADGET
+ #define CONFIG_USBDOWNLOAD_GADGET
+ /* USB TI's IDs */
+ #define CONFIG_USBD_HS
+ #define CONFIG_G_DNL_VENDOR_NUM 0x0403
+ #define CONFIG_G_DNL_PRODUCT_NUM 0xBD00
+ #define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
+ /* USB Device Firmware Update support */
+ #define CONFIG_DFU_FUNCTION
+ #define CONFIG_DFU_MMC
+ #define CONFIG_DFU_NAND
+ #define CONFIG_CMD_DFU
+ #define DFU_ALT_INFO_MMC \
+       "boot part 0 1;" \
+       "rootfs part 0 2;" \
+       "MLO fat 0 1;" \
+       "MLO.raw mmc 100 100;" \
+       "u-boot.img.raw mmc 300 3C0;" \
+       "u-boot.img fat 0 1;" \
+       "uEnv.txt fat 0 1"
+ #define DFU_ALT_INFO_NAND \
+       "SPL part 0 1;" \
+       "SPL.backup1 part 0 2;" \
+       "SPL.backup2 part 0 3;" \
+       "SPL.backup3 part 0 4;" \
+       "u-boot part 0 5;" \
+       "kernel part 0 7;" \
+       "rootfs part 0 8"
   /* Physical Memory Map */
  #define CONFIG_NR_DRAM_BANKS          1               /*  1 bank of DRAM */
  #define PHYS_DRAM_1                   0x80000000      /* DRAM Bank #1 */
  #define CONFIG_ARCH_MISC_INIT
  #define CONFIG_MUSB_GADGET
  #define CONFIG_MUSB_PIO_ONLY
 +#define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
  #define CONFIG_USB_GADGET_DUALSPEED
+ #define CONFIG_USB_GADGET_VBUS_DRAW   2
  #define CONFIG_MUSB_HOST
  #define CONFIG_AM335X_USB0
  #define CONFIG_AM335X_USB0_MODE       MUSB_PERIPHERAL
  /* NAND support */
  #ifdef CONFIG_NAND
  #define CONFIG_CMD_NAND
+ #define CONFIG_CMD_MTDPARTS
+ #define MTDIDS_DEFAULT                        "nand0=omap2-nand.0"
+ #define MTDPARTS_DEFAULT              "mtdparts=omap2-nand.0:128k(SPL)," \
+                                       "128k(SPL.backup1)," \
+                                       "128k(SPL.backup2)," \
+                                       "128k(SPL.backup3),1920k(u-boot)," \
+                                       "128k(u-boot-env),5m(kernel),-(rootfs)"
  #define CONFIG_NAND_OMAP_GPMC
  #define GPMC_NAND_ECC_LP_x16_LAYOUT   1
  #define CONFIG_SYS_NAND_BASE          (0x08000000)    /* physical address */
diff --combined include/lcd.h
index a6822d29fe2a946310c2f537590f17c81a298522,267915219cf32a9616d1515914712815778f6ab6..c6e7fc5216330c6797e7c28a640a67322766a446
  extern char lcd_is_enabled;
  
  extern int lcd_line_length;
- extern int lcd_color_fg;
- extern int lcd_color_bg;
  
- /*
-  * Frame buffer memory information
-  */
- extern void *lcd_base;                /* Start of framebuffer memory  */
- extern void *lcd_console_address;     /* Start of console buffer      */
- extern short console_col;
- extern short console_row;
  extern struct vidinfo panel_info;
  
extern void lcd_ctrl_init (void *lcdbase);
extern void lcd_enable (void);
extern int board_splash_screen_prepare(void);
void lcd_ctrl_init(void *lcdbase);
void lcd_enable(void);
+ int board_splash_screen_prepare(void);
  
  /* setcolreg used in 8bpp/16bpp; initcolregs used in monochrome */
- extern void lcd_setcolreg (ushort regno,
-                               ushort red, ushort green, ushort blue);
- extern void lcd_initcolregs (void);
+ void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
+ void lcd_initcolregs(void);
+ int lcd_getfgcolor(void);
  
  /* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */
extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);
extern int bmp_display(ulong addr, int x, int y);
+ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);
+ int bmp_display(ulong addr, int x, int y);
  
  /**
   * Set whether we need to flush the dcache when changing the LCD image. This
@@@ -234,6 -225,15 +225,6 @@@ typedef struct vidinfo 
        u_char  vl_vbpd;        /* Wait end of frame */
        u_char  vl_cmd_allow_len; /* Wait end of frame */
  
 -      void (*cfg_gpio)(void);
 -      void (*backlight_on)(unsigned int onoff);
 -      void (*reset_lcd)(void);
 -      void (*lcd_power_on)(void);
 -      void (*cfg_ldo)(void);
 -      void (*enable_ldo)(unsigned int onoff);
 -      void (*mipi_power)(void);
 -      void (*backlight_reset)(void);
 -
        unsigned int win_id;
        unsigned int init_delay;
        unsigned int power_on_delay;
        unsigned int sclk_div;
  
        unsigned int dual_lcd_enabled;
  } vidinfo_t;
  
  void init_panel_info(vidinfo_t *vid);
@@@ -283,14 -282,12 +273,12 @@@ extern vidinfo_t panel_info
  /* Video functions */
  
  #if defined(CONFIG_RBC823)
- void  lcd_disable     (void);
+ void  lcd_disable(void);
  #endif
  
- /* int        lcd_init        (void *lcdbase); */
- void  lcd_putc        (const char c);
- void  lcd_puts        (const char *s);
- void  lcd_printf      (const char *fmt, ...);
+ void  lcd_putc(const char c);
+ void  lcd_puts(const char *s);
+ void  lcd_printf(const char *fmt, ...);
  void  lcd_clear(void);
  int   lcd_display_bitmap(ulong bmp_image, int x, int y);
  
@@@ -350,7 -347,7 +338,7 @@@ int lcd_get_size(int *line_length)
   *  is connected, as we can't autodetect anything.
   */
  #define CONFIG_SYS_HIGH       0       /* Pins are active high                 */
- #define CONFIG_SYS_LOW                1       /* Pins are active low                  */
+ #define CONFIG_SYS_LOW        1       /* Pins are active low                  */
  
  #define LCD_MONOCHROME        0
  #define LCD_COLOR2    1
  # define LCD_INFO_Y           (BMP_LOGO_HEIGHT + VIDEO_FONT_HEIGHT)
  #elif defined(CONFIG_LCD_LOGO)
  # define LCD_INFO_X           (BMP_LOGO_WIDTH + 4 * VIDEO_FONT_WIDTH)
- # define LCD_INFO_Y           (VIDEO_FONT_HEIGHT)
+ # define LCD_INFO_Y           VIDEO_FONT_HEIGHT
  #else
- # define LCD_INFO_X           (VIDEO_FONT_WIDTH)
- # define LCD_INFO_Y           (VIDEO_FONT_HEIGHT)
+ # define LCD_INFO_X           VIDEO_FONT_WIDTH
+ # define LCD_INFO_Y           VIDEO_FONT_HEIGHT
  #endif
  
  /* Default to 8bpp if bit depth not specified */
  # define PAGE_SIZE    4096
  #endif
  
- /************************************************************************/
- /* ** CONSOLE DEFINITIONS & FUNCTIONS                                 */
- /************************************************************************/
- #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
- # define CONSOLE_ROWS         ((panel_info.vl_row-BMP_LOGO_HEIGHT) \
-                                       / VIDEO_FONT_HEIGHT)
- #else
- # define CONSOLE_ROWS         (panel_info.vl_row / VIDEO_FONT_HEIGHT)
- #endif
- #define CONSOLE_COLS          (panel_info.vl_col / VIDEO_FONT_WIDTH)
- #define CONSOLE_ROW_SIZE      (VIDEO_FONT_HEIGHT * lcd_line_length)
- #define CONSOLE_ROW_FIRST     (lcd_console_address)
- #define CONSOLE_ROW_SECOND    (lcd_console_address + CONSOLE_ROW_SIZE)
- #define CONSOLE_ROW_LAST      (lcd_console_address + CONSOLE_SIZE \
-                                       - CONSOLE_ROW_SIZE)
- #define CONSOLE_SIZE          (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
- #define CONSOLE_SCROLL_SIZE   (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
- #if LCD_BPP == LCD_MONOCHROME
- # define COLOR_MASK(c)                ((c)      | (c) << 1 | (c) << 2 | (c) << 3 | \
-                                (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
- #elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
- # define COLOR_MASK(c)                (c)
- #else
- # error Unsupported LCD BPP.
- #endif
  /************************************************************************/
  
  #endif        /* _LCD_H_ */