1. 23 7月, 2014 26 次提交
    • S
      dm: Avoid accessing uclasses before they are ready · c910e2e2
      Simon Glass 提交于
      Don't allow access to uclasses before they have been initialised.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      c910e2e2
    • S
      dm: Allow a device to be found by its FDT offset · f4cdead2
      Simon Glass 提交于
      Each device that was bound from a device tree has an node that caused it to
      be bound. Add functions that find and return a device based on a device tree
      offset.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      f4cdead2
    • S
      dm: Display the sequence number for each device · b7d66570
      Simon Glass 提交于
      Add this information to 'dm tree' and 'dm uclass' commands.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      b7d66570
    • S
      dm: Introduce device sequence numbering · 5a66a8ff
      Simon Glass 提交于
      In U-Boot it is pretty common to number devices from 0 and access them
      on the command line using this numbering. While it may come to pass that
      we will move away from this numbering, the possibility seems remote at
      present.
      
      Given that devices within a uclass will have an implied numbering, it
      makes sense to build this into driver model as a core feature. The cost
      is fairly small in terms of code and data space.
      
      With each uclass having numbered devices we can ask for SPI port 0 or
      serial port 1 and receive a single device.
      
      Devices typically request a sequence number using aliases in the device
      tree. These are resolved when the device is probed, to deal with conflicts.
      Sequence numbers need not be sequential and holes are permitted.
      
      At present there is no support for sequence numbers using static platform
      data. It could easily be added to 'struct driver_info' if needed, but it
      seems better to add features as we find a use for them, and the use of -1
      to mean 'no sequence' makes the default value somewhat painful.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      5a66a8ff
    • S
      dm: Avoid activating devices in 'dm uclass' command · 4e8bc211
      Simon Glass 提交于
      This command currently activates devices as it lists them. This is not
      desirable since it changes the system state. Fix it and avoid printing
      a newline if there are no devices in a uclass.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      4e8bc211
    • S
      dm: Move device display into its own function · fffa24d7
      Simon Glass 提交于
      The device display for 'dm tree' and 'dm uclass' is mostly the same, so
      move it into a common function.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      fffa24d7
    • S
      fdt: Add a function to get the alias sequence of a node · 5c33c9fd
      Simon Glass 提交于
      Aliases are used to provide U-Boot's numbering of devices, such as:
      
      aliases {
      	spi0 = "/spi@12330000";
      }
      
      spi@12330000 {
      	...
      }
      
      This tells us that the SPI controller at 12330000 is considered to be the
      first SPI controller (SPI 0). So we have a numbering for the SPI node.
      
      Add a function that returns the numbering for a node assume that it exists
      in the list of aliases.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      5c33c9fd
    • S
      dm: Move uclass error checking/probing into a function · 9ca296a1
      Simon Glass 提交于
      Several functions will use this same pattern, so bring it into a function.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      9ca296a1
    • S
      Add a flag indicating when the serial console is ready · 093f79ab
      Simon Glass 提交于
      For sandbox we have a fallback console which is used very early in
      U-Boot, before serial drivers are available. Rather than try to guess
      when to switch to the real console, add a flag so we can be sure. This
      makes sure that sandbox can always output a panic() message, for example,
      and avoids silent failure (which is very annoying in sandbox).
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      093f79ab
    • S
      console: Remove vprintf() optimisation for sandbox · 7793ac96
      Simon Glass 提交于
      If the console is not present, we try to reduce overhead by stopping any
      output in vprintf(), before it gets to putc(). This is of dubious merit
      in general, but in the case of sandbox it is incorrect since we have a
      fallback console which reports errors very early in U-Boot. If this is
      defeated U-Boot can hang or exit with no indication of what is wrong.
      
      Remove the optimisation for sandbox.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      7793ac96
    • S
      stdio: Provide functions to add/remove devices using stdio_dev · d97143a6
      Simon Glass 提交于
      The current functions for adding and removing devices require a device name.
      This is not convenient for driver model, which wants to store a pointer to
      the relevant device. Add new functions which provide this feature and adjust
      the old ones to call these.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      d97143a6
    • S
      dm: Support driver model prior to relocation · ab7cd627
      Simon Glass 提交于
      Initialise devices marked 'pre-reloc' and make them available prior to
      relocation. Note that this requires pre-reloc malloc() to be available.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      ab7cd627
    • S
      dm: Allow drivers to be marked 'before relocation' · 00606d7e
      Simon Glass 提交于
      Driver model currently only operates after relocation is complete. In this
      state U-Boot typically has a small amount of memory available. In adding
      support for driver model prior to relocation we must try to use as little
      memory as possible.
      
      In addition, on some machines the memory has not be inited and/or the CPU
      is not running at full speed or the data cache is off. These can reduce
      execution performance, so the less initialisation that is done before
      relocation the better.
      
      An immediately-obvious improvement is to only initialise drivers which are
      actually going to be used before relocation. On many boards the only such
      driver is a serial UART, so this provides a very large potential benefit.
      
      Allow drivers to mark themselves as 'pre-reloc' which means that they will
      be initialised prior to relocation. This can be done either with a driver
      flag or with a 'dm,pre-reloc' device tree property.
      
      To support this, the various dm scanning function now take a 'pre_reloc_only'
      parameter which indicates that only drivers marked pre-reloc should be
      bound.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      00606d7e
    • S
      sandbox: Remove all drivers before exit · 61336833
      Simon Glass 提交于
      Drivers are supposed to be able to close down cleanly. To set a good example,
      make sandbox shut down its driver model drivers and remove them before exit.
      
      It may be desirable to do the same more generally once driver model is more
      widely-used. This could be done during bootm, before U-Boot jumps to the OS.
      It seems far too early to make this change.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      61336833
    • S
      dm: Provide a way to shut down driver model · 9adbd7a1
      Simon Glass 提交于
      Add a new method which removes and unbinds all drivers.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Acked-by: NMarek Vasut <marex@denx.de>
      9adbd7a1
    • S
      dm: Make sure that the root device is probed · 7497812d
      Simon Glass 提交于
      The root device should be probed just like any other device. The effect of
      this is to mark the device as activated, so that it can be removed (along
      with its children) if required.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Acked-by: NMarek Vasut <marex@denx.de>
      7497812d
    • S
      stdio: Pass device pointer to stdio methods · 709ea543
      Simon Glass 提交于
      At present stdio device functions do not get any clue as to which stdio
      device is being acted on. Some implementations go to great lengths to work
      around this, such as defining a whole separate set of functions for each
      possible device.
      
      For driver model we need to associate a stdio_dev with a device. It doesn't
      seem possible to continue with this work-around approach.
      
      Instead, add a stdio_dev pointer to each of the stdio member functions.
      
      Note: The serial drivers have the same problem, but it is not strictly
      necessary to fix that to get driver model running. Also, if we convert
      serial over to driver model the problem will go away.
      
      Code size increases by 244 bytes for Thumb2 and 428 for PowerPC.
      
      22: stdio: Pass device pointer to stdio methods
             arm: (for 2/2 boards)  all +244.0  bss -4.0  text +248.0
         powerpc: (for 1/1 boards)  all +428.0  text +428.0
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Acked-by: NMarek Vasut <marex@denx.de>
      Reviewed-by: NMarek Vasut <marex@denx.de>
      709ea543
    • S
      stdio: Remove redundant code around stdio_register() calls · 91d0be1d
      Simon Glass 提交于
      There is no point in setting a structure's memory to NULL when it has
      already been zeroed with memset().
      
      Also, there is no need to create a stub function for stdio to call - if the
      function is NULL it will not be called.
      
      This is a clean-up, with no change in functionality.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Acked-by: NMarek Vasut <marex@denx.de>
      91d0be1d
    • S
      dm: Use an explicit expect value in core tests · eb9ef5fe
      Simon Glass 提交于
      Rather than reusing the 'reg' property, use an explicit property for the
      expected ping value used in testing.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      eb9ef5fe
    • S
      dm: gpio: Don't use the driver model uclass for SPL · 5b9765c7
      Simon Glass 提交于
      Driver model does not support SPL yet, so we should not use the GPIO
      uclass for SPL.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      5b9765c7
    • S
      sandbox: Always enable malloc debug · 6d7601e7
      Simon Glass 提交于
      Tun on DEBUG in malloc(). This adds code space and slows things down but
      for sandbox this is acceptable. We gain the ability to check for memory
      leaks in tests.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      6d7601e7
    • S
      sandbox: config: Enable pre-relocation malloc() · b53e94b1
      Simon Glass 提交于
      Enable this for sandbox so that we will be able to use driver model before
      relocation.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      b53e94b1
    • S
      sandbox: Support pre-relocation malloc() · 29afe9e6
      Simon Glass 提交于
      Set up and zero global data before board_init_f() is called so that we can
      remove the need for CONFIG_SYS_GENERIC_GLOBAL_DATA.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      29afe9e6
    • S
      Add a simple malloc() implementation for pre-relocation · d59476b6
      Simon Glass 提交于
      If we are to have driver model before relocation we need to support some
      way of calling memory allocation routines.
      
      The standard malloc() is pretty complicated:
      
      1. It uses some BSS memory for its state, and BSS is not available before
      relocation
      
      2. It supports algorithms for reducing memory fragmentation and improving
      performace of free(). Before relocation we could happily just not support
      free().
      
      3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
      this has been loaded anyway this is not really a problem.
      
      The simplest way to support pre-relocation malloc() is to reserve an area
      of memory and allocate it in increasing blocks as needed. This
      implementation does this.
      
      To enable it, you need to define the size of the malloc() pool as described
      in the README. It will be located above the pre-relocation stack on
      supported architectures.
      
      Note that this implementation is only useful on machines which have some
      memory available before dram_init() is called - this includes those that
      do no DRAM init (like tegra) and those that do it in SPL (quite a few
      boards). Enabling driver model preior to relocation for the rest of the
      boards is left for a later exercise.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      d59476b6
    • S
      sandbox: Set up global data before board_init_f() · 4d94dfa0
      Simon Glass 提交于
      At present sandbox defines CONFIG_SYS_GENERIC_GLOBAL_DATA, meaning that
      the global_data pointer is set up in board_init_f().
      
      If we set up and zero the global data before calling board_init_f() then we
      don't need to define CONFIG_SYS_GENERIC_GLOBAL_DATA.
      
      Make this change to simplify the init process.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      4d94dfa0
    • S
      Remove form-feeds from dlmalloc.c · d93041a4
      Simon Glass 提交于
      These don't really serve any purpose in the modern age. On the other hand
      they show up as annoying control characters in my editor, which then happily
      removes them.
      
      I believe we can drop these characters from the file.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      d93041a4
  2. 22 7月, 2014 14 次提交
    • M
      m68k: define __kernel_size_t as unsinged int again · fbe79a17
      Masahiro Yamada 提交于
      Commit ddc94378 changed the definition of __kernel_size_t
      from unsigned int to unsigned long.
      
      It is true that it fixed warnings on some crosstools
      but it increased warnings on the others.
      
      The problem is that we cannot see consistency in terms of
      the typedef of __kernel_size_t on M68K architecture.
      
      However, I'd like to suggest to have __kernel_size_t to be
      unsigned int again.
      
      Rationale:
      
      [1] Linux Kernel defines __kernel_size_t on M68K as unsigned int.
          Let's stick to the Linux's way.
      
      [2] We want to build boards with popular pre-built toolchains,
          not the one locally-built by indivisuals.
          I think m68-linux-gcc which can be downloaded from www.kernel.org
          is the candidate for our _recommended_ toolchains.
      
      With this patch, all the m68k boards can be built without any warnings.
      
      Give it a try with the following crosstools:
      
      https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/
      x86_64-gcc-4.6.3-nolibc_m68k-linux.tar.xz
      
      or
      
      https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/
      x86_64-gcc-4.9.0-nolibc_m68k-linux.tar.xz
      
      (The latter is newer.)
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Jason Jin <Jason.jin@freescale.com>
      fbe79a17
    • M
      m68k: fix an undefined behavior warning of M5253DEMO board · 61f06b14
      Masahiro Yamada 提交于
      The latest GCC is so clever that it reports more warnings
      than old ones did:
      
       ------------------------------>8------------------------------
      
        board/freescale/m5253demo/flash.c: In function 'flash_get_offsets':
        board/freescale/m5253demo/flash.c:65:23: warning: iteration 2047u
        invokes undefined behavior [-Waggressive-loop-optimizations]
            info->start[k + 1] = info->start[k] + CONFIG_SYS_SST_SECTSZ;
                               ^
        board/freescale/m5253demo/flash.c:64:3: note: containing loop
           for (k = 0, j = 0; j < CONFIG_SYS_SST_SECT; j++, k++) {
           ^
      
       ------------------------------8<------------------------------
      
      The cause of the warning is like this:
      
      The for statement iterates 2048 times in flash_get_offsets() func.
      (Notice CONFIG_SYS_SST_SECT is defined as 2048)
      
      The last iteration does
        info->start[2048] = info->start[2047] + CONFIG_SYS_SST_SECTSZ;
      causing an undefined behavior.
      
      (Please note the array size of info->start is 2048.
      CONFIG_SYS_MAX_FLASH_SECT is defined as 2048 for this board.)
      
      This commit fixes that so as not to overrun the info->start array.
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      Cc: Jason Jin <Jason.jin@freescale.com>
      61f06b14
    • W
      boards.cfg: re-claim ownership for TQM8xx boards · e8078046
      Wolfgang Denk 提交于
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      e8078046
    • P
      Ethernet: let user know if there is no valid ethernet address · 75d9a45c
      Pavel Machek 提交于
      Improve error messages in case of invalid/unset ethernet addresses.
      Signed-off-by: NPavel Machek <pavel@denx.de>
      75d9a45c
    • I
      board_r: run scsi init() on ARM too · 2c997e7a
      Ian Campbell 提交于
      This has been disabled for ARM in initr_scsi since that function was
      introduced. However it works fine for me on Cubieboard and Cubietruck (with the
      upcoming AHCI glue patch).
      
      I also tested on two random ARM platforms which seem to define CONFIG_CMD_SCSI:
       - highbank worked fine (on midway hardware)
       - omap5_uevm built OK and I confirmed using objdump that things were as
         expected (i.e. the default weak scsi_init nop was used).
      
      While there remove the mismatched comment from the #endif (omitting the comment
      seems to be the prevailing style in this file).
      Signed-off-by: NIan Campbell <ijc@hellion.org.uk>
      Acked-by: NSimon Glass <sjg@chromium.org>
      2c997e7a
    • I
      AHCI: Increase link timeout to 200ms · e0ddcf93
      Ian Campbell 提交于
      In 73545f75 "ahci: wait longer for link" I increased the
      timeout to 40ms based on the observed behaviour of a WD disk on a
      Cubietruck. Since then Karsten Merker and myself have both
      observed timeouts with HGST disks (Karsten on Cubietruck, me on
      Cubieboard2). Increasing the timeout to ~175ms fixes this, so go
      to 200ms for a bit of headroom.
      Signed-off-by: NIan Campbell <ijc@hellion.org.uk>
      Cc: Karsten Merker <merker@debian.org>
      Acked-by: NHans de Goede <hdegoede@redhat.com>
      e0ddcf93
    • M
      .gitignore: clean-up unnecessary entries · f63e36ad
      Masahiro Yamada 提交于
      There have been /errlog and /reloc_off in the top level .gitignore
      since commit 1b4aaffe added it about 7 years ago.
      
      But they are no longer generated.
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      f63e36ad
    • M
      Update .mailmap using scripts/mailmapper · e89a07e3
      Masahiro Yamada 提交于
      Add more entries to .mailmap for the canonical names with
      50 commits or more.
      
      This commit was generated by the following command:
      
        scripts/mailmapper > tmp; mv tmp .mailmap
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      e89a07e3
    • M
      scripts: add mailmapper, a tool to create/update mailmap file · 45765eed
      Masahiro Yamada 提交于
      This tool helps to create/update the mailmap file.
      
      It runs 'git shortlog' internally and searches differently spelled author
      names which share the same email address. The author name with the most
      commits is asuumed to be a canonical real name. If the number of commits
      from the cananonical name is equal to or greater than 'MIN_COMMITS' (=50),
      the entry for the cananical name will be output. ('MIN_COMMITS' is used
      here because we do not want to create a fat mailmap by adding every author
      with only a few commits.)
      
      If there exists a mailmap file specified by the mailmap.file configuration
      options or '.mailmap' at the toplevel of the repository, it is used as
      a base file.
      
      The base file and the newly added entries are merged together and sorted
      alphabetically (but the comment block is kept untouched), and then printed
      to standard output.
      
       Usage
       -----
      
        scripts/mailmapper
      
      prints the mailmapping to standard output.
      
        scripts/mailmapper > tmp; mv tmp .mailmap
      
      will be useful for updating '.mailmap' file.
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      45765eed
    • M
      add .mailmap for proper git-shortlog output · 8b90a11f
      Masahiro Yamada 提交于
      This is the first version of .mailmap created by hand.
      Please see "man git-shortlog" for what this commit is trying to do.
      
      Without this file, for example, "git shortlog -n -s" shows as follows:
      
        2693  Wolfgang Denk     <------
        1002  Stefan Roese      <------
         811  wdenk             <------
         808  Mike Frysinger
         806  Simon Glass
           [snip]
         177  Matthias Fuchs
         154  stroese           <------
         153  Timur Tabi
      
      And then, with this file, it shows as follows:
      
        3504  Wolfgang Denk     <------
        1156  Stefan Roese      <------
         808  Mike Frysinger
         806  Simon Glass
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      Cc: Stefan Roese <sr@denx.de>
      Cc: Wolfgang Denk <wd@denx.de>
      8b90a11f
    • P
      whitespace cleanups · 3f9eb6e1
      Pavel Machek 提交于
      Whitespace cleanups.
      Signed-off-by: NPavel Machek <pavel@denx.de>
      3f9eb6e1
    • I
      Makefile: fix tags target documentation · 5fc2f924
      Igor Grinberg 提交于
      Replace the TAGS target name by the actual ctags target name.
      Also, add etags target documentation.
      
      Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
      Signed-off-by: NIgor Grinberg <grinberg@compulab.co.il>
      5fc2f924
    • I
      Makefile: fix ctags/etags clean targets · b3dfe43c
      Igor Grinberg 提交于
      Commit efcf8619 (kbuild: use scripts/Makefile.clean)
      refactored the cleaning targets and accidentially replaced the actually
      generated "ctags" and "etags" files in the file list by "tags" and "TAGS".
      "tags" and "TAGS" are not part of the Makefile build targets and
      therefore should not be a part of the list for clean targets.
      
      Substitute the actually generated files instead, to fix the clean
      targets behavior.
      
      Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
      Signed-off-by: NIgor Grinberg <grinberg@compulab.co.il>
      b3dfe43c
    • I
      Makefile: fix the {c, e}tags/cscope build targets · 8d819ab5
      Igor Grinberg 提交于
      Commit 9e414032 (kbuild: change out-of-tree build)
      changed the U-Boot build working directory to the output tree
      for the out-of-tree builds.
      This broke the {c,e}tags/cscope build targets as TAG_SUBDIRS variable
      collected directories based on assumption that the build working
      directory is the U-Boot source tree directory.
      
      Fix the {c,e}tags/cscope build targets by adding the $(srctree) prefix.
      Also, remove the $(obj) prefix from the etags build target to finish
      the $(obj) prefix removal started by the same commit.
      
      Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
      Signed-off-by: NIgor Grinberg <grinberg@compulab.co.il>
      8d819ab5