Commit Graph

26292 Commits

Author SHA1 Message Date
Masahiro Yamada bac644675a dm: serial: fix console putc
Commit b8893327e9 (dm: serial: Put common code into separate functions)
consolidated getc() correctly, but introduced another bug to putc();
serial_stub_putc() passes sdev->priv to serial_putc_dev(), but
serial_putc_dev() uses cur_dev instead of the given argument.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
2014-10-23 21:43:08 -06:00
Masahiro Yamada 3fdd0bb2b0 serial: add static directive to local functions
The functions _serial_putc, _serial_putc_raw, _serial_puts,
_serial_getc, _serial_tstc, _serial_setbrg are defined and used
locally in each of serial_ns16550.c and serial_s3c24x0.c.

Add static directive to them and remove declarations from
include/common.h.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
2014-10-23 21:43:08 -06:00
Masahiro Yamada 86256b796e dm: move platform data headers to include/dm/platform_data
The platform_data definitions are generally referenced from both
drivers and board files.  That is why header files defining
platform_data sturectures are placed in "include" directory,
but our top level "include" directory is already too cluttered.

Let's collect platform_data definitions under the directory
"include/dm/platform_data" like Linux gathers ones around under
"include/linux/platform_data".

This commit moves two header files:

  include/serial_mxc.h -> include/dm/platform_data/serial_mxc.h
  include/serial_pl01x.h -> include/dm/platform_data/serial_pl01x.h

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-10-23 21:43:07 -06:00
Simon Glass e98a03ca68 dm: x86: Convert coreboot serial to use driver model
This makes use of the existing device tree node to use driver model
for the serial console.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:45 -06:00
Simon Glass d1259c9f5f dm: x86: dts: Add additional info to the serial port node
Add more information so that U-Boot can find the address of the serial port.
Also fix the reg-shift value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass 7414112d70 dm: x86: Convert Intel ICH6 GPIO driver to use driver model
Convert over this driver, using device tree to pass in the required
information. The peripheral is still probed, just the number of GPIO banks
and their offsets is in the device tree (previously this was a table in
the driver).

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass c15b0b86d1 dm: x86: Add a gpio header for coreboot
This code doesn't follow the normal approach of having its arch-specific
definitions in an arch-specific directory. Add a new arch-specific file
and make use of it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass 5dbcaa2128 dm: x86: Support pre-reloc malloc()
Add support for this by reserving a block of memory below global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass fbd7282426 dm: x86: Zero global data before board_init_f()
To permit information to be passed from the early U-Boot code to
board_init_f() we cannot zero the global_data in board_init_f(). Instead
zero it in the start-up code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass 9c284ffd93 dm: x86: Remove ebp assembler warning in zimage.c
This code generates warnings with recent gcc versions. We really don't need
the clobber specification, so just drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass 1f77690e16 dm: serial: ns16550: Add a cast to the I/O operations
This generates a warning when driver model is enabled, so fix it by adding
a cast.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:45:28 -06:00
Simon Glass 85bfe6e4f6 dm: gpio: Remove unused get_state() uclass method
This is no longer used so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:30:51 -06:00
Simon Glass 2d91a9772c dm: dts: Move omap device tree includes to correct place
These ended up in arch/arm/dts/dt-bindings temporarily, but in fact the
correct place is now include/dt-bindings. Move them to be consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:30:51 -06:00
Simon Glass c65dd445c9 dm: gpio: imx: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:30:51 -06:00
Simon Glass 6227fb87c4 dm: gpio: exynos: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:30:51 -06:00
Simon Glass 3dd2d48055 dm: gpio: rpi_b: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:30:51 -06:00
Simon Glass 5aff3acdb7 dm: gpio: omap3: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:30:50 -06:00
Simon Glass 57d99d368e dm: gpio: tegra: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:53 -06:00
Simon Glass 4324174d03 test: dm: Add additional GPIO tests
Add tests for gpio_requestf() and for memory leaks.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:53 -06:00
Simon Glass 756ac0bb15 test: dm: Support memory leak checking as a core feature
Check the state of the malloc() heap before each test is run, so that tests
can verify that all is well at the end. Provide helper functions to mark
the heap and to check that it returns to its initial state.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:53 -06:00
Simon Glass d44f597b12 dm: gpio: Add gpio_requestf() helper for printf() strings
Add a helper which permits a printf()-style format string for the requester
string.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 4b8f11c2cc test: dm: Update GPIO tests for new gpio_request() method
Now that gpio_request() is handled by the uclass, updates the tests
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 5e0bbd61df dm: gpio: sandbox: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 62cb89d5eb dm: gpio: sandbox: Implement the remove() method
This method frees memory so we must make sure to implement it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 699ea9606c dm: gpio: sandbox: Implement the get_function() method
Implement this method so that the 'gpio' command can do its job correctly.
For sandbox we only support input and output states for a gpio.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 0757535a7e dm: Move the function for getting GPIO status into the uclass
This function can be more easily tested if it is in the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass 6449a506d6 dm: gpio: Add gpio_get_function() and friends
Add helpers to the uclass to allow finding out the pin function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:52 -06:00
Simon Glass b892d127ff dm: gpio: Implement GPIO reservation in the uclass
We have several GPIO drivers now and all are doing similar things to record
which GPIOs are reserved.

Move this logic into the uclass to make the drivers similar.

We retain the request()/free() methods since currently one driver does use
these for setting up the pin.

Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23 19:29:51 -06:00
Simon Glass b3f4ca1135 dm: omap3: Move to driver model for GPIO and serial
Adjust the configuration for the am33xx boards, including beagleboard,
to use driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 1a44cd89fa dm: am33xx: Move to driver model for GPIO and serial
Adjust the configuration for the am33xx boards, including beaglebone black
to use driver model.

This can be extended to other OMAP boards once platform data is provided
for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 1f0d883af7 dm: am335x: Remove serial options from CONFIG_SYS_EXTRA_OPTIONS
With these options in place it is not possible to change the serial port
using 'make menuconfig' or similar. It seems to result in duplicate
defines.

For example:

In file included from include/linux/kconfig.h:4:0,
                 from <command-line>:0:
include/generated/autoconf.h:20:0: note: this is the location of the previous definition
 #define CONFIG_CONS_INDEX 2
 ^

The default option seems to be 1 anyway, in board/ti/am335x/Kconfig.

Remove the options so that we can adjust the serial port if required.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 0bf249511f dm: omap: serial: Add driver model support
Add driver model support to this driver, while retaining support for the
legacy system. Driver model serial support is enabled with CONFIG_DM_SERIAL
as usual.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 4119e06dd8 dm: am33xx: Provide platform data for serial
Provide suitable platform data for am33xx boards, so that these boards can
use driver model for serial.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass d12010b099 dm: am33xx: Provide platform data for GPIOs
Provide suitable platform data for am33xx boards, so that these boards can
use driver model for GPIO access.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 5915a2ad0d dm: omap: gpio: Support driver model
Add driver model support to this driver, while retaining support for the
legacy system. Driver model GPIO support is enabled with CONFIG_DM_GPIO
as usual.

Since gpio_is_valid() no longer exists, we can use the -EINVAL error
returned from gpio_request().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass d57b61143d dm: omap: gpio: Put _get_gpio_value() logic into its own function
Add a separate internal helper function to get a GPIO value, so that we
will be able to call it with the driver model version and avoid code
duplication.

Also move gpio_get_bank() and check_gpio() down below the helper functions
as these won't be needed with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 2539f3926c dm: dts: omap: Select correct console for beaglebone
Select serial0 as the console.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 91155c6560 dm: serial: Support CONFIG_CONS_INDEX if available
Try to use this option to select the correct uart for the console. This
mimics the behaviour of drivers/serial.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 11c1a87893 dm: ns16550: Correct the probe logic for platform data
The probe logic sets up the pointer to the platform data in the device
tree decode method. It should be done in the probe() method, and anyway
the device tree decode method can't be used when CONFIG_OF_CONTROL is
not enabled.

Fix these two problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass 167efe01bc dm: ns16550: Use an address instead of a pointer for the uart base
It is inconvenient to have to use casts when specifying platform data. Also
it is not strictly correct, since we should use map_sysmem() to convert an
address to a pointer.

Adjust the platform data to use an address.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass aea2be2012 dm: serial: ns16550: Correct logic for checking for character
There is a bug in the logic which checks for an available character. This
can cause invalid characters to be received - this was noticed on
beaglebone. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass c487fd476c dm: serial: Reset the watchdog while waiting in getc()
We have moved the busy-wait loop out of drivers and into the uclass. This
means that we must reset the watchdog when busy-waiting.

Note: some drivers may still have a busy-wait even with driver model, as
a transition mechanism. Driver model will tolerate this, and is can be
cleaned up when all users of the driver use driver model. An example is
ns16550.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Simon Glass fe1ef50338 dm: gpio: Support numbered GPIOs
At present banks must be named and it is not possible to refer to GPIOs by
number in driver model. Some boards use numbering - e.g. OMAP. It is fairly
easy to support by detecting the absense of a bank name (which starts with
a letter).

Add support for numbered GPIOs in addition to the existing bank support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2014-10-23 19:29:07 -06:00
Masahiro Yamada 5b3ee386fd kbuild: clear VENDOR variable to fix build error on tcsh
Since the environment "VENDOR" is set in tcsh, it must be cleared in our
makefile.  Otherwise, boards without CONFIG_SYS_VENDOR fail to build:

  > make CROSS_COMPILE=arm-linux-gnueabi- wandboard_quad_defconfig all
    [ snip ]
    AR      arch/arm/lib/lib.a
    CC      arch/arm/lib/eabi_compat.o
  scripts/Makefile.build:55: /home/foo/u-boot/board/unknown/wandboard/ \
  Makefile: No such file or directory
  make[2]: *** No rule to make target `/home/foo/u-boot/board/unknown/ \
  wandboard/Makefile'.  Stop.
  make[1]: *** [board/unknown/wandboard] Error 2
  make: *** [__build_one_by_one] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Tom Everett <tom@khubla.com>
Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-10-23 16:35:12 -04:00
Igor Grinberg 09bab6e770 musb: fix warning in include/linux/usb/musb.h
Fix the following build warning by including linux/compat.h:
include/linux/usb/musb.h:110: warning: 'struct device' declared inside
parameter list
include/linux/usb/musb.h:110: warning: its scope is only this definition
or declaration, which is probably not what you want

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
2014-10-23 21:38:59 +02:00
Tom Rini 03a3536c7b Merge branch 'master' of git://git.denx.de/u-boot-tegra 2014-10-23 14:05:34 -04:00
Masahiro Yamada 7bfd5ee117 mips: enable CONFIG_USE_PRIVATE_LIBGCC by default
Without the private libgcc, we need a full multilib toolchain with
different libgcc or multiple toolchains to build all BE/LE and
hard-float/soft-float variants of MIPS boards.  That is not feasible.

This commit allows us to build all the MIPS boards with a single
kernel.org toolchain:

https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/
x86_64-gcc-4.9.0-nolibc_mips-linux.tar.xz

This change sounds reasonable for most users.  If necessary,
you can disable this option via "make menuconfig" or friends.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2014-10-23 13:19:15 -04:00
Masahiro Yamada 0732b2f96b kconfig: invoke silentoldconfig if spl, tpl/.config is updated
When spl/.config is updated by "make spl/menuconfig" or friends,
spl/include/config/auto.conf, spl/include/generated/autoconf.h
and some other files must be updated by "make silentoldconfig".

There is no hook for SPL in the top Makefile, so this commit
touches .config when spl/.config is updated to invoke silentoldconfig.
Likewise for TPL.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-10-23 13:19:13 -04:00
Masahiro Yamada 9adb6d2407 kbuild: fix a bug of the u-boot-spl link rule
cmd_u-boot-spl includes $(PLATFORM_LIBS) which changes
when CONFIG_USE_PRIVATE_GCC is updated.  The u-boot-spl image
should be re-linked if any prerequisite is newer than it
or the command line has changed.
$(call, if_changed,...) should be used instead of $(call cmd,...).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-10-23 13:19:11 -04:00
Masahiro Yamada 45ccec8f29 kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig
The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>
2014-10-23 13:19:09 -04:00