Skip to content
Snippets Groups Projects
  1. Aug 18, 2015
    • Masahiro Yamada's avatar
      linux/kconfig.h: add CPP macros useful for per-image config options · 8be60f06
      Masahiro Yamada authored
      
      The previous commit introduced a useful macro used in makefiles,
      in order to reference to different variables (CONFIG_... or
      CONFIG_SPL_...) depending on the build context.
      
      Per-image config option control is a PITA in C sources, too.
      Here are some macros useful in C/CPP expressions.
      
      CONFIG_IS_ENABLED(FOO) can be used as a shorthand for
      
        (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \
         (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO))
      
      For example, it is useful to describe C code as follows,
      
        #if CONFIG_IS_ENABLED(OF_CONTROL)
            (device tree code)
        #else
            (board file code)
        #endif
      
      The ifdef conditional above is switched by CONFIG_OF_CONTROL during
      the U-Boot proper building (CONFIG_SPL_BUILD is not defined), and by
      CONFIG_SPL_OF_CONTROL during SPL building (CONFIG_SPL_BUILD is
      defined).
      
      The macro can be used in C context as well, so you can also write the
      equivalent code as follows:
      
        if (CONFIG_IS_ENABLED(OF_CONTROL)) {
            (device tree code)
        } else {
            (board file code)
        }
      
      Another useful macro is CONFIG_VALUE().
      CONFIG_VALUE(FOO) is expanded into CONFIG_FOO if CONFIG_SPL_BUILD is
      undefined, and into CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined.
      
      You can write as follows:
      
        text_base = CONFIG_VALUE(TEXT_BASE);
      
      instead of:
      
        #ifdef CONFIG_SPL_BUILD
            text_base = CONFIG_SPL_TEXT_BASE;
        #else
            text_base = CONFIG_TEXT_BASE;
        #endif
      
      This commit also adds slight hacking on fixdep so that it can
      output a correct list of fixed dependencies.
      
      If the fixdep finds CONFIG_IS_ENABLED(FOO) in a source file,
      we want
          $(wildcard include/config/foo.h)
      in the U-boot proper building context, while we want
          $(wildcard include/config/spl/foo.h)
      in the SPL build context.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
      8be60f06
    • Masahiro Yamada's avatar
      kbuild: add a makefile macro useful with per-image config options · 04a5c406
      Masahiro Yamada authored
      
      Commit e02ee254 ("kconfig: switch to single .config
      configuration") made the configuration itself pretty simple,
      instead, we lost the way to systematically enable/disable config
      options for each image independently.
      
      Our current strategy is, put entries into Makefile.spl for options
      we need separate enabling, or once enable the options globally in
      Kconfig and then undef them in Makefile.uncmd_spl if we do not want
      to compile the features for SPL at all.  Things are getting really
      messy.  Besides, "ifdef CONFIG_SPL_BUILD" are sprinkled everywhere
      in makefiles.
      
      This commit adds a variable to help describe makefile simpler.
      
      $(SPL_) evaluates to "SPL_" during the SPL build, while to an empty
      string during building U-boot proper.
      
      So, you can write
      
        obj-$(CONFIG_$(SPL_)FOO) += foo.o
      
      instead of
      
        ifdef CONFIG_SPL_BUILD
        obj-$(CONFIG_SPL_FOO) += foo.o
        else
        obj-$(CONFIG_FOO) += foo.o
        endif
      
      If CONFIG_SPL_FOO does not exist in Kconfig, it is equivalent to
      
        ifndef CONFIG_SPL_BUILD
        obj-$(CONFIG_SPL_FOO) += foo.o
        endif
      
      This is the pattern we often see in our current makefiles.
      
      To take advantage of this macro, we should prefix SPL_ for the SPL
      version of the option when we need independent control between
      U-boot and SPL.  With this naming scheme, I hope our makefiles will
      be much simplified.
      
      It means we want to rename existing config options as follows
      in the long run:
      
        CONFIG_SPL_SERIAL_SUPPORT     -> CONFIG_SPL_SERIAL
        CONFIG_SPL_I2C_SUPPORT        -> CONFIG_SPL_I2C
        CONFIG_SPL_GPIO_SUPPORT       -> CONFIG_SPL_GPIO
        CONFIG_SPL_SPI_SUPPORT        -> CONFIG_SPL_SPI
        CONFIG_SPL_DISABLE_OF_CONTROL -> CONFIG_SPL_OF_CONTROL
                                            (inverting the logic)
      
      Then drivers/Makefile would be re-worked as follows:
      
        obj-$(CONFIG_$(SPL_)SERIAL)  += serial/
        obj-$(CONFIG_$(SPL_)I2C)     += i2c/
        obj-$(CONFIG_$(SPL_)GPIO)    += gpio/
        obj-$(CONFIG_$(SPL_)SPI)     += spi/
           ...
      
      Eventually, SPL-specialized entries in Makefile.spl would go away.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
      04a5c406
    • Masahiro Yamada's avatar
      kbuild: fixdep: optimize code slightly · 29974f77
      Masahiro Yamada authored
      
      If the target string matches "CONFIG_", move the pointer p
      forward.  This saves several 7-chars adjustments.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
      29974f77
    • Stephen Warren's avatar
      fs-test.sh: minor fixes · 04812605
      Stephen Warren authored
      
      - Re-direct stderr into the log files, so any errors U-Boot emits are
        visible in the logs. This is relevant if the "reset" shell command
        attempts to report that it's not supported on the sandbox board.
      - Fix test_fs_nonfs() to name the files it created differently for each
        invocation. Otherwise, the logs from different tests overwrite
        each-other.
      
      Signed-off-by: default avatarStephen Warren <swarren@wwwdotorg.org>
      Acked-by: default avatarSuriyan Ramasami <suriyan.r@gmail.com>
      04812605
    • Vladimir Zapolskiy's avatar
      i2c: lpc32xx: correct sanity check for requested bus speed · ea16c6a1
      Vladimir Zapolskiy authored
      
      LPC32xx has 3 I2C bus controllers, 2 of them are used as generic ones
      and their parent clock is HCLK and CLK_HI/CLK_LO registers are 10 bit
      wide. This means that if HCLK is 104MHz, then minimal configurable I2C
      clock speed is about 51KHz.
      
      Only USB OTG I2C bus controller CLK registers are 8 bit wide, thus in
      assumption that peripheral clock is 13MHz it allows to set the minimal
      bus speed about 25.5KHz.
      
      Check for negative half clock value is removed since it is always false.
      
      The change fixes the following problem for I2C busses 0 and 1:
      
        => i2c dev 0
        Setting bus to 0
        => i2c speed 100000
        Setting bus speed to 100000 Hz
        Failure changing bus speed (-22)
      
      Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Tested-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      ea16c6a1
    • Vladimir Zapolskiy's avatar
      lpc32xx: add common USB OHCI defines for all LPC32xx boards · 554b0e0d
      Vladimir Zapolskiy authored
      
      The change adds a number of macro definitions used by USB OHCI driver,
      if CONFIG_USB_OHCI_LPC32XX is selected from a board config file.
      
      Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Tested-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      554b0e0d
    • Sylvain Lemieux's avatar
      usb: lpc32xx: add host USB driver · adf8d58d
      Sylvain Lemieux authored
      
      Incorporate USB driver from legacy LPCLinux NXP BSP.
      The files taken from the legacy patch are:
      - lpc32xx USB driver
      - lpc3250 header file USB registers definition.
      
      The legacy driver was updated and clean-up as part of the integration with the latest u-boot.
      
      Signed-off-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      adf8d58d
    • Sylvain Lemieux's avatar
      i2c: lpc32xx: add support for OTG I2C · 1933af15
      Sylvain Lemieux authored
      
      Updated the LPC32xx I2C driver to support
      the OTG I2C that is part of the USB module.
      
      Signed-off-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      1933af15
    • Sylvain Lemieux's avatar
      nand: lpc32xx: add ECC layout for small page NAND · 30cb3bf4
      Sylvain Lemieux authored
      
      Incorporate ECC layout for small page NAND from legacy LPCLinux NXP BSP.
      The code taken from the legacy patch is:
      - lpc32xx SLC NAND driver (ECC layout for small page)
      
      This layout is matching the lpc32xx NAND SLC Linux Kernel driver.
      
      Signed-off-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      30cb3bf4
    • Sylvain Lemieux's avatar
      nand: lpc32xx: add hardware ECC support · 5f63bf3e
      Sylvain Lemieux authored
      
      Incorporate NAND SLC hardware ECC support from legacy LPCLinux NXP BSP.
      The code taken from the legacy patch is:
      - lpc32xx SLC NAND driver (hardware ECC support)
      - lpc3250 header file missing SLC NAND registers definition
      
      The legacy driver was updated and clean-up as part of the integration with the existing NAND SLC driver.
      
      Signed-off-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      Tested-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      5f63bf3e
    • Vladimir Zapolskiy's avatar
      lpc32xx: move common SLC NAND defines to arch/config.h · 327f0d23
      Vladimir Zapolskiy authored
      
      A number of LPC32xx SLC NAND defines is dictated by controller
      hardware limits and OOB layout is defined by operating system, the
      definitions are common for all users. Since those macro are used
      in out of NAND SLC driver code (simple NAND SPL framework), they can
      not be placed into the driver, therefore move them from board config
      files to arch/config.h
      
      The change also adds OOB layout details specific to small page NAND
      devices taken from Linux kernel.
      
      Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Tested-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      327f0d23
    • Sylvain Lemieux's avatar
      dma: lpc32xx: add DMA driver · 980db8ca
      Sylvain Lemieux authored
      
      Incorporate DMA driver from legacy LPCLinux NXP BSP.
      The files taken from the legacy patch are:
      - lpc32xx DMA driver
      - lpc3250 header file DMA registers definition.
      
      The legacy driver was updated and clean-up as part of the integration with the latest u-boot.
      
      Signed-off-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      980db8ca
    • Tom Rini's avatar
      952bd79b
    • Tom Rini's avatar
      783983f3
  2. Aug 17, 2015
Loading