oweals/u-boot.git
8 years agoARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined
Wang Dongsheng [Mon, 18 Jan 2016 03:02:40 +0000 (11:02 +0800)]
ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined

"DISCARD" will remove ._secure.text relocate, but PSCI framework
has already used some absolute address those need to relocate.

Use readelf -t -r u-boot show us:
.__secure_start addr: 601408e4
.__secure_end addr: 60141460

60141140  00000017 R_ARM_RELATIVE
46 _secure_monitor:
47 #ifdef CONFIG_ARMV7_PSCI
48      ldr     r5, =_psci_vectors

60141194  00000017 R_ARM_RELATIVE
6014119c  00000017 R_ARM_RELATIVE
601411a4  00000017 R_ARM_RELATIVE
601411ac  00000017 R_ARM_RELATIVE
64 _psci_table:
66 .word psci_cpu_suspend
...
72 .word psci_migrate

60141344  00000017 R_ARM_RELATIVE
6014145c  00000017 R_ARM_RELATIVE
202 ldr     r5, =psci_text_end

Solutions:
1. Change absolute address to RelAdr.
   Based on LDR (immediate, ARM), we only have 4K offset to jump.
Now PSCI code size is close to 4K size that is LDR limit jump size,
so even if the LDR is based on the current instruction address,
there is also have a risk for RelAdr. If we use two jump steps I
think we can fix this issue, but looks too hack, so give up this way.

2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
   If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
will in the BASE address that is absolute.

Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: cache: Implement cache range check for v7
Marek Vasut [Mon, 27 Jul 2015 20:34:17 +0000 (22:34 +0200)]
arm: cache: Implement cache range check for v7

Add code to aid tracking down cache alignment issues.
In case DEBUG is defined in the cache.c, this code will
check alignment of each attempt to flush/invalidate data
cache and print a warning if the alignment is incorrect.
If DEBUG is not defined, this code is optimized out.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@konsulko.com>
8 years agoarmv7: add cacheline sizes where missing
Albert ARIBAUD [Wed, 27 Jan 2016 07:46:11 +0000 (08:46 +0100)]
armv7: add cacheline sizes where missing

Some armv7 targets are missing a cache line size declaration.
In preparation for "arm: cache: Implement cache range check for v7"
patch, add these declarations with the appropriate value for
the target's SoC or CPU.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: Remove S bit from MMU section entry
Marek Vasut [Tue, 29 Dec 2015 18:44:02 +0000 (19:44 +0100)]
arm: Remove S bit from MMU section entry

Restore the old behavior of the MMU section entries configuration,
which is without the S-bit.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Simon Glass <sjg@chromium.org>
8 years agoarm: Replace test for CONFIG_ARMV7 with CONFIG_CPU_V7
Marek Vasut [Tue, 29 Dec 2015 18:44:01 +0000 (19:44 +0100)]
arm: Replace test for CONFIG_ARMV7 with CONFIG_CPU_V7

The arch/arm/lib/cache-cp15.c checks for CONFIG_ARMV7 and if this macro is
set, it configures TTBR0 register. This register must be configured for the
cache on ARMv7 to operate correctly.

The problem is that noone actually sets the CONFIG_ARMV7 macro and thus the
TTBR0 is not configured at all. On SoCFPGA, this produces all sorts of minor
issues which are hard to replicate, for example certain USB sticks are not
detected or QSPI NOR sometimes fails to write pages completely.

The solution is to replace CONFIG_ARMV7 test with CONFIG_CPU_V7 one. This is
correct because the code which added the test(s) for CONFIG_ARMV7 was added
shortly after CONFIG_ARMV7 was replaced by CONFIG_CPU_V7 and this code was
not adjusted correctly to reflect that change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Simon Glass <sjg@chromium.org>
8 years agovideo: Correct 'tor' typo in comment
Simon Glass [Fri, 15 Jan 2016 01:10:52 +0000 (18:10 -0700)]
video: Correct 'tor' typo in comment

This should be 'rot', not 'tor'.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: test: Add console tests for truetype
Simon Glass [Fri, 15 Jan 2016 01:10:51 +0000 (18:10 -0700)]
video: test: Add console tests for truetype

This adds tests for the different character types, line wrap, scrolling and
backspace.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: sandbox: Enable truetype fonts for sandbox
Simon Glass [Fri, 15 Jan 2016 01:10:50 +0000 (18:10 -0700)]
video: sandbox: Enable truetype fonts for sandbox

Enable this feature so that truetype fonts can be used on the sandbox
console. Update the tests to select the normal/rotated console when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo: sandbox: Allow selection of font size and console name
Simon Glass [Fri, 15 Jan 2016 01:10:49 +0000 (18:10 -0700)]
video: sandbox: Allow selection of font size and console name

For testing it is useful to be able to select the font size and the console
driver for sandbox. Add this information to platform data and copy it to
the video device when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Allow selection of the driver and font size
Simon Glass [Fri, 15 Jan 2016 01:10:48 +0000 (18:10 -0700)]
video: Allow selection of the driver and font size

Provide a way for the video console driver to be selected. This is
controlled by the video driver's private data. This can be set up when the
driver is probed so that it is ready for the video_post_probe() method.

The font size is provided as well. The console driver may or may not support
this depending on its capability.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agoLicense: Add the Open Font License
Simon Glass [Fri, 15 Jan 2016 01:10:47 +0000 (18:10 -0700)]
License: Add the Open Font License

This is used by two of the font files. Add this license to permit tracking
of this. The copyright text cannot be added to the .ttf files, so put it
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo: Add the Cantoraone decorative font
Simon Glass [Fri, 15 Jan 2016 01:10:46 +0000 (18:10 -0700)]
video: Add the Cantoraone decorative font

This font is a little more ornate than normal. Example uses are on security
screens where a feeling of formality is required.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add the Rufscript handwriting font
Simon Glass [Fri, 15 Jan 2016 01:10:45 +0000 (18:10 -0700)]
video: Add the Rufscript handwriting font

This can be used when a a friendly 'hand-writing' font is needed. It helps
to make the device feel familiar.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add the AnkaCoder mono-spaced font
Simon Glass [Fri, 15 Jan 2016 01:10:44 +0000 (18:10 -0700)]
video: Add the AnkaCoder mono-spaced font

This can be used when a mono-space font is needed, but the console font
is too small (such as with high-DPI displays).

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add the Nimbus sans font
Simon Glass [Fri, 15 Jan 2016 01:10:43 +0000 (18:10 -0700)]
video: Add the Nimbus sans font

This provides a good-looking font for user prompts.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add a console driver that uses TrueType fonts
Simon Glass [Fri, 15 Jan 2016 01:10:42 +0000 (18:10 -0700)]
video: Add a console driver that uses TrueType fonts

The existing 8x16 font is adequate for most purposes. It is small and fast.
However for boot screens where information must be presented to the user,
the console font is not ideal. Common requirements are larger and
better-looking fonts.

This console driver can use TrueType fonts built into U-Boot, and render
them at any size. This can be used in scripts to place text as needed on
the display.

This driver is not really designed to operate with the command line. Much
of U-Boot expects a fixed-width font. But to keep things working correctly,
rudimentary support for the console is provided. The main missing feature is
support for command-line editing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo: Provide a backspace method
Simon Glass [Fri, 15 Jan 2016 01:10:41 +0000 (18:10 -0700)]
video: Provide a backspace method

With proportional fonts the vidconsole uclass cannot itself erase the
previous character. Provide an optional method so that the driver can
handle this operation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Provide a signal when a new console line is started
Simon Glass [Fri, 15 Jan 2016 01:10:40 +0000 (18:10 -0700)]
video: Provide a signal when a new console line is started

When we start a new line (due to the user pressing return), signal this to
the driver so that it can flush its buffer of character positions.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Provide a left margin for the text console
Simon Glass [Fri, 15 Jan 2016 01:10:39 +0000 (18:10 -0700)]
video: Provide a left margin for the text console

Allow the left margin to be set so that text does not have to be right up
against the left side. On some panels this makes it hard to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Handle the 'bell' character
Simon Glass [Fri, 15 Jan 2016 01:10:38 +0000 (18:10 -0700)]
video: Handle the 'bell' character

This can be sent when to many characters are entered. Make sure it is
ignored and does not cause a character to be displayed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Use fractional units for X coordinates
Simon Glass [Fri, 15 Jan 2016 01:10:37 +0000 (18:10 -0700)]
video: Use fractional units for X coordinates

With anti-aliased fonts we need a more fine-grained horizontal position
than a single pixel. Characters can be positioned to start part-way through
a pixel, with anti-aliasing (greyscale edges) taking care of the visual
effect.

To cope with this, use fractional units (1/256 pixel) for horizontal
positions in the text console.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo kconfig console_normal
Simon Glass [Fri, 22 Jan 2016 20:53:37 +0000 (21:53 +0100)]
video kconfig console_normal

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased on current master]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agoMakefile: Add rules to build in .ttf files
Simon Glass [Fri, 15 Jan 2016 01:10:35 +0000 (18:10 -0700)]
Makefile: Add rules to build in .ttf files

Add rules to allow TrueType files to be compiled into U-Boot for use on
the video console.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Add stb TrueType font renderer
Simon Glass [Fri, 15 Jan 2016 01:10:34 +0000 (18:10 -0700)]
video: Add stb TrueType font renderer

This is a header file which provides a fairly light-weight TrueType
rendering implementation. It is pulled from http://nothings.org/. The code
style does not comply with U-Boot but I think it is best to leave alone to
permit the source to be synced later if needed.

The only change is to fix a reference to fabs() which should route through
a macro to allow U-Boot to provide its own version.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Fri, 29 Jan 2016 18:47:38 +0000 (13:47 -0500)]
Merge git://git.denx.de/u-boot-dm

8 years agotest/py: dfu: allow boardenv to specify test sizes
Stephen Warren [Thu, 28 Jan 2016 20:14:16 +0000 (13:14 -0700)]
test/py: dfu: allow boardenv to specify test sizes

Allow the env__dfu_configs boardenv data to specify the set of DFU
transfer sizes to test. Manually specifying test sizes is useful if you
wish to test multiple DFU configurations (e.g. SD card ext4 filesystem, SD
card whole raw partition, RAM, etc.), but don't want to test every
single transfer size on each, to avoid bloating the overall time taken by
testing. If the boardenv doesn't specify a set of sizes, the built-in list
is used as a default, preserving backwards-compatibility.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: fix a couple typos in comments
Stephen Warren [Thu, 28 Jan 2016 17:18:03 +0000 (10:18 -0700)]
test/py: fix a couple typos in comments

s/updata/update/.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: run sandbox in source directory
Stephen Warren [Thu, 28 Jan 2016 06:57:53 +0000 (23:57 -0700)]
test/py: run sandbox in source directory

Some unit tests expect the cwd of the sandbox process to be the root
of the source tree. Ensure that requirement is met.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: pass test DTB to sandbox
Stephen Warren [Thu, 28 Jan 2016 06:57:52 +0000 (23:57 -0700)]
test/py: pass test DTB to sandbox

This is required for at least "ut dm" to operate correctly.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: correctly log xfail/xpass tests
Stephen Warren [Thu, 28 Jan 2016 06:57:51 +0000 (23:57 -0700)]
test/py: correctly log xfail/xpass tests

Tests can complete in passed, skipped, xpass, xfailed, or failed, states.
Currently the U-Boot log generation code doesn't handle the xfailed or
xpass states since they aren't used. Add support for the remaining states.
Without this, tests that xfail end up being reported as skipped.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: detect another "bad pattern" in console output
Stephen Warren [Thu, 28 Jan 2016 06:57:50 +0000 (23:57 -0700)]
test/py: detect another "bad pattern" in console output

Many error situations in U-Boot print the message:
    ### ERROR ### Please RESET the board ###

Add this to the list of bad patterns the test system detects. One
practical advantage of this change is to detect the case where sandbox
is told to use a particular DTB file, and the file cannot be opened.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: check for bad patterns everywhere we wait
Stephen Warren [Thu, 28 Jan 2016 06:57:49 +0000 (23:57 -0700)]
test/py: check for bad patterns everywhere we wait

Currently, bad patterns are only honored when executing a shell command.
Other cases, such as the initial boot-up of U-Boot or when interacting
with command output rather than gathering all output prior to the shell
prompt, do not currently look for bad patterns in console output. This
patch makes sure that bad patterns are honored everywhere.

One benefit of this change is that if U-Boot sandbox fails to start up,
the error message it emits can be caught immediately, rather than relying
on a (long) timeout when waiting for the expected signon message and/or
command prompt.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest.py: calculate bad patterns on change only
Stephen Warren [Thu, 28 Jan 2016 06:57:48 +0000 (23:57 -0700)]
test.py: calculate bad patterns on change only

A future patch will use the bad_patterns array in multiple places. Rather
than duplicating the code to calculate it, or even sharing it in a
function and simply calling it redundantly when nothing has changed, only
re-calculate the list when some change is made to it. This reduces work.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: fix spawn.expect multiple match handling
Stephen Warren [Thu, 28 Jan 2016 06:57:47 +0000 (23:57 -0700)]
test/py: fix spawn.expect multiple match handling

Multiple patterns may be passed to spawn.expect(). The pattern which
matches at the earliest position should be designated as the match. This
aspect works correctly. When multiple patterns match at the same position,
priority should be given the the earliest entry in the list of patterns.
This aspect does not work correctly. This patch fixes it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/dm: clear unit test failure count each run
Stephen Warren [Thu, 28 Jan 2016 06:57:46 +0000 (23:57 -0700)]
test/dm: clear unit test failure count each run

The ut command prints a test failure count each time it is executed.
This is stored in a global variable which is never reset. Consequently,
the printed failure count accumulates across runs. Fix this by clearing
the counter each time "ut" is invoked.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Provide custom IDs when parametrizing tests
Stephen Warren [Tue, 26 Jan 2016 22:26:04 +0000 (15:26 -0700)]
test/py: Provide custom IDs when parametrizing tests

When pytest generates the name for parametrized tests, simple parameter
values (ints, strings) get used directly, but more complex values such
as dicts are not handled. This yields test names such as:

    dfu[env__usb_dev_port0-env__dfu_config0]
    dfu[env__usb_dev_port0-env__dfu_config1]

Add some code to extract a custom fixture ID from the fixture values, so
that we end up with meaningful names such as:

    dfu[micro_b-emmc]
    dfu[devport2-ram]

If the boardenv file doesn't define custom names, the code falls back to
the old algorithm.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Quote consistency
Stephen Warren [Tue, 26 Jan 2016 20:41:31 +0000 (13:41 -0700)]
test/py: Quote consistency

When converting test/py from " to ', I missed a few places (or added a
few inconsistencies later). Fix these.

Note that only quotes in code are converted; double-quotes in comments
and HTML are left as-is, since English and HTML use " not '.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: use " for docstrings
Stephen Warren [Tue, 26 Jan 2016 20:41:30 +0000 (13:41 -0700)]
test/py: use " for docstrings

Python's coding style docs indicate to use " not ' for docstrings.

test/py has other violations of the coding style docs, since the docs
specify a stranger style than I would expect, but nobody has complained
about those yet:-)

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: make net test aware of USB and PCI enumeration
Stephen Warren [Tue, 26 Jan 2016 18:10:14 +0000 (11:10 -0700)]
test/py: make net test aware of USB and PCI enumeration

The existing net test executes a list of commands supplied by boardenv
variable env__net_pre_commands. The idea was that boardenv would know
whether the Ethernet device was attached to USB, PCI, ... and hence was
the best place to put any commands required to probe the device.

However, this approach doesn't scale well when attempting to use a single
boardenv across multiple branches of U-Boot, some of which require "pci
enum" to enumerate PCI and others of which don't, or don't /yet/ simply
because various upstream changes haven't been merged down.

This patch updates the test to require that the boardenv state which HW
features are required for Ethernet to work, and lets the test itself map
that knowledge to the set of commands to execute. Since this mapping is
part of the test script, which is part of the U-Boot code/branch, this
approach is more scalable. It also feels cleaner, since again boardenv
is only providing data, rather than test logic.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodistro bootcmd: enumerate PCI before network operations
Stephen Warren [Tue, 26 Jan 2016 18:10:13 +0000 (11:10 -0700)]
distro bootcmd: enumerate PCI before network operations

The PCI bus must be enumerated before PCI devices, such as Ethernet
devices, are known to U-Boot. Enhance the distro boot commands to perform
PCI enumeration when needed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodistro bootcmd: make net boot only optionally start USB
Stephen Warren [Tue, 26 Jan 2016 18:10:12 +0000 (11:10 -0700)]
distro bootcmd: make net boot only optionally start USB

Currently, the distro boot commands always enumerate USB devices before
performing network operations. However, depending on the board and end-
user configuration, network devices may not be attached to USB, and so
enumerating USB may not be necessary. Enhance the scripts to make this
step optional, so that the user can decrease boot time if they don't
need USB.

This change is performed by moving the "usb start" invocation into a
standalone variable. If the user desires, they can replace that
variable's value with some no-op command such as "true" instead.

Booting from a USB storage device always needs to enumerate USB devices,
so this action is still hard-coded.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoImplement "pci enum" command for CONFIG_DM_PCI
Stephen Warren [Tue, 26 Jan 2016 18:10:11 +0000 (11:10 -0700)]
Implement "pci enum" command for CONFIG_DM_PCI

With CONFIG_DM_PCI enabled, PCI buses are not enumerated at boot, as they
are without that config option enabled. No command exists to enumerate the
PCI buses. Hence, unless some board-specific code causes PCI enumeration,
PCI-based Ethernet devices are not detected, and network access is not
available.

This patch implements "pci enum" in the CONFIG_DM_PCI case, thus giving a
mechanism whereby PCI can be enumerated.

do_pci()'s handling of case 'e' is moved into a single location before the
dev variable is assigned, in order to skip calculation of dev. The enum
sub-command doesn't need the dev value, and skipping its calculation
avoids an irrelevant error being printed.

Using a command to initialize PCI like this has a disadvantage relative to
enumerating PCI at boot. In particular, Ethernet devices are not probed
during PCI enumeration, but only when used. This defers setting variables
such as ethact, ethaddr, etc. until the first network-related command is
executed. Hopefully this will not cause further issues. Perhaps in the
long term, we need a "net start/enum" command too?

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agotest/py: dfu: error out if USB device already exists
Stephen Warren [Tue, 26 Jan 2016 17:59:43 +0000 (10:59 -0700)]
test/py: dfu: error out if USB device already exists

The DFU test requests U-Boot configure its USB controller in device mode,
then waits for the host machine to enumerate the USB device and create a
device node for it. However, this wait can be fooled if the USB device
node already exists before the test starts, e.g. if some previous software
stack already configured the USB controller into device mode and never
de-configured it. This "previous software stack" could even be another
test/py test, if U-Boot's own USB teardown does not operate correctly. If
this happens, dfu-util may be run before U-Boot is ready to serve DFU
commands, which may cause false test failures.

Enhance the dfu test to fail if the device node exists before it is
expected to.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoARM: tegra: shut down USB device controller at boot
Stephen Warren [Tue, 26 Jan 2016 17:59:42 +0000 (10:59 -0700)]
ARM: tegra: shut down USB device controller at boot

When loading U-Boot into RAM over USB protocols using tools such as
tegrarcm or L4T's exec-uboot.sh/tegraflash.py, Tegra's USB device
mode controller is initialized and enumerated by the host PC running
the tool. Unfortunately, these tools do not shut down the USB
controller before executing the downloaded code, and so the host PC
does not "de-enumerate" the USB device. This patch implements optional
code to shut down the USB controller when U-Boot boots to avoid leaving
a stale USB device present.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: make crash detection more robust
Stephen Warren [Mon, 25 Jan 2016 22:07:58 +0000 (15:07 -0700)]
test/py: make crash detection more robust

test/py contains logic to detect the target crashing and rebooting by
searching the console output for a U-Boot signon message, which will
presumably be emitted when the system boots after the crash/reset.

Currently, this logic only searches for the exact signon message that
was printed by the U-Boot version under test, upon the assumption that
binary is written into flash, and hence will be the version booted after
any reset. However, this is not a valid assumption; some test setups
download the U-Boot-under-test into RAM and boot it from there, and in
such a scenario an arbitrary U-Boot version may be located in flash and
hence run after any reset.

Fix the reset detection logic to match any U-Boot signon message. This
prevents false negatives.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodm: Remove device_probe_child()
Simon Glass [Mon, 25 Jan 2016 21:58:42 +0000 (14:58 -0700)]
dm: Remove device_probe_child()

This function is not used as the use case for it did not eventuate. Remove
it to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agotest/py: add a networking test
Stephen Warren [Thu, 21 Jan 2016 23:05:31 +0000 (16:05 -0700)]
test/py: add a networking test

This tests:
- dhcp (if indicated by boardenv file).
- Static IP network setup (if provided by boardenv file).
- Ping.
- TFTP get.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: move find_ram_base() into u_boot_utils
Stephen Warren [Thu, 21 Jan 2016 23:05:30 +0000 (16:05 -0700)]
test/py: move find_ram_base() into u_boot_utils

find_ram_base() is a shared utility function, not a core part of the
U-Boot console interaction.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: add DFU test
Stephen Warren [Fri, 22 Jan 2016 19:30:14 +0000 (12:30 -0700)]
test/py: add DFU test

Add a test of DFU functionality to the Python test suite. The test
starts DFU in U-Boot, waits for USB device enumeration on the host,
executes dfu-util multiple times to test various transfer sizes, many
of which trigger USB driver edge cases, and finally aborts the DFU
command in U-Boot.

This test mirrors the functionality previously available via the shell
scripts in test/dfu, and hence those are removed too.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: ums: add filesystem-based testing
Stephen Warren [Fri, 22 Jan 2016 19:30:13 +0000 (12:30 -0700)]
test/py: ums: add filesystem-based testing

Enhance the UMS test to optionally mount a partition and read/write a file
to it, validating that the content written and read back are identical.

This enhancement is backwards-compatible; old boardenv contents that don't
define the new configuration data will cause the test code to perform as
before.

test/ums/ is deleted since the Python test now performs the same testing
that it did.

The code is also re-written to make use of the recently added utility
module, and split it up into nested functions so the overall logic of
the test process can be followed more easily without the details
cluttering the code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: add various utility code
Stephen Warren [Fri, 22 Jan 2016 19:30:12 +0000 (12:30 -0700)]
test/py: add various utility code

Add various common utility functions. These will be used by a forthcoming
re-written UMS test, and a brand-new DFU test.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: optionally ignore errors from shell commands
Stephen Warren [Fri, 22 Jan 2016 19:30:11 +0000 (12:30 -0700)]
test/py: optionally ignore errors from shell commands

Sometimes it's useful to run shell commands and ignore any errors. One
example might be cleanup logic; if a test-case experiences an error, the
cleanup logic might experience an error too, and we don't want that error
to mask the original error, so we want to ignore the subsequent error.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: log when tests send CTRL-C
Stephen Warren [Fri, 22 Jan 2016 19:30:10 +0000 (12:30 -0700)]
test/py: log when tests send CTRL-C

Write a note to the log file when a test sends CTRL-C to U-Boot. This
makes it easier to follow what's happening in the logs, especially since
U-Boot doesn't echo the character back to its output, so there's no other
signal of what's going on.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: drain console log at the end of any failed test
Stephen Warren [Fri, 22 Jan 2016 19:30:09 +0000 (12:30 -0700)]
test/py: drain console log at the end of any failed test

Tests may fail for a number of reasons, and in particular for reasons
other than a timeout waiting for U-Boot to print expected data. If the
last operation that a failed test performs is not waiting for U-Boot to
print something, then any trailing output from U-Boot during that test's
operation will not be logged as part of that test, but rather either
along with the next test, or even thrown away, potentiall hiding clues
re: the test failure reason.

Solve this by explicitly draining (and hence logging) the U-Boot output
in the case of failed tests.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: move U-Boot respawn trigger to the test core
Stephen Warren [Fri, 22 Jan 2016 19:30:08 +0000 (12:30 -0700)]
test/py: move U-Boot respawn trigger to the test core

Prior to this change, U-Boot was lazilly (re-)spawned if/when a test
attempted to interact with it, and no active connection existed. This
approach was simple, yet had the disadvantage that U-Boot might be
spawned in the middle of a test function, e.g. after the test had already
performed actions such as creating data files, etc. In that case, this
could cause the log to contain the sequence (1) some test logs, (2)
U-Boot's boot process, (3) the rest of that test's logs. This isn't
optimally readable. This issue will affect the upcoming DFU and enhanced
UMS tests.

This change converts u_boot_console to be a function-scoped fixture, so
that pytest attempts to re-create the object for each test invocation.
This allows the fixture factory function to ensure that U-Boot is spawned
prior to every test. In practice, the same object is returned each time
so there is essentially no additional overhead due to this change.

This allows us to remove:

- The explicit ensure_spawned() call from test_sleep, since the core now
ensures that the spawn happens before the test code is executed.

- The laxy calls to ensure_spawned() in the u_boot_console_*
implementations.

The one downside is that test_env's "state_ttest_env" fixture must be
converted to a function-scoped fixture too, since a module-scoped fixture
cannot use a function-scoped fixture. To avoid overhead, we use the same
trick of returning the same object each time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: fix timeout to be absolute
Stephen Warren [Fri, 22 Jan 2016 19:30:07 +0000 (12:30 -0700)]
test/py: fix timeout to be absolute

Currently, Spawn.expect() imposes its timeout solely upon receipt of new
data, not on its overall operation. In theory, this could cause the
timeout not to fire if U-Boot continually generated output that did not
match the expected patterns.

Fix the code to additionally impose a timeout on overall operation, which
is the intended mode of operation.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotpm: st33zp24: Add tpm st33zp24 spi support
Christophe Ricard [Thu, 21 Jan 2016 22:27:14 +0000 (23:27 +0100)]
tpm: st33zp24: Add tpm st33zp24 spi support

Add support for TPM ST33ZP24 spi.

The ST33ZP24 does have a spi interface.
The transport protocol is proprietary.

For spi we are relying only on DM_SPI.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
8 years agotpm: st33zp24: Add tpm st33zp24 support with i2c
Christophe Ricard [Thu, 21 Jan 2016 22:27:13 +0000 (23:27 +0100)]
tpm: st33zp24: Add tpm st33zp24 support with i2c

Add support for TPM ST33ZP24 family with i2c.

For i2c we are relying only on DM_I2C.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
8 years agotpm: Rename tpm_tis_infineon.h to tpm_tis.h and move infineon specific stuff in tpm_i...
Christophe Ricard [Thu, 21 Jan 2016 22:27:12 +0000 (23:27 +0100)]
tpm: Rename tpm_tis_infineon.h to tpm_tis.h and move infineon specific stuff in tpm_infineon.c

I2C protocol is not standardize for TPM 1.2.
TIS prococol is define by the Trusted Computing Group and potentially
available on several TPMs.

tpm_tis_infineon.h header is not generic enough.

Rename tpm_tis_infineon.h to tpm_tis.h and move infineon specific
defines/variables to tpm_tis_infineon.c

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
8 years agotpm: tpm_tis_lpc: fix typo
Christophe Ricard [Thu, 21 Jan 2016 22:19:14 +0000 (23:19 +0100)]
tpm: tpm_tis_lpc: fix typo

TPM_TIS_LPC is connected to the LPC bus, not I2C.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
8 years agotpm: Fix fault in case CONFIG_DM_TPM is set without any TPM
Christophe Ricard [Thu, 21 Jan 2016 22:19:13 +0000 (23:19 +0100)]
tpm: Fix fault in case CONFIG_DM_TPM is set without any TPM

In case CONFIG_DM_TPM was set without any TPM chipset configured a fault
was generated (NULL pointer access).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-net
Tom Rini [Thu, 28 Jan 2016 23:42:10 +0000 (18:42 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-net

8 years agonet: Add bootfile in DHCP Request
Alexandre Messier [Thu, 28 Jan 2016 16:19:02 +0000 (11:19 -0500)]
net: Add bootfile in DHCP Request

Add the bootfile name in the DHCP Request packet, in addition
to it already being sent in the DHCP Discover.

This is needed by some DHCP servers so that the bootfile name is
properly returned by the server to the client in the DHCP Ack, as
expected by U-Boot.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-tegra
Tom Rini [Thu, 28 Jan 2016 20:17:11 +0000 (15:17 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-tegra

8 years agonet: phy: implements probe for Cortina phy
Shaohui Xie [Thu, 28 Jan 2016 07:56:36 +0000 (15:56 +0800)]
net: phy: implements probe for Cortina phy

Cortina phy cannot support soft reset, this commit implements probe
for Cortina PHY to tell phylib to skip phy soft reset by setting
PHY_FLAG_BROKEN_RESET in flags.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: introduce a quirk PHY_FLAG_BROKEN_RESET
Shaohui Xie [Thu, 28 Jan 2016 07:55:46 +0000 (15:55 +0800)]
net: phy: introduce a quirk PHY_FLAG_BROKEN_RESET

Current driver always performs a phy soft reset when connecting the phy
device, but soft reset is not always supported by a phy device, so
introduce a quirk PHY_FLAG_BROKEN_RESET to let such a phy device to skip
soft reset. This commit uses 'flags' of phy device structure to store the
quirk.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: micrel: fix divisor value for KSZ9031 phy skew
Dinh Nguyen [Wed, 27 Jan 2016 21:46:00 +0000 (15:46 -0600)]
net: phy: micrel: fix divisor value for KSZ9031 phy skew

The picoseconds to register value divisor(ps_to_regval) should be 60 and not
200. Linux has KSZ9031_PS_TO_REG defined to be 60 as well. 60 is the correct
divisor because the 4-bit skew values are defined from 0x0000(-420ps) to
0xffff(480ps), increments of 60.

For example, a DTS skew value of 420, represents 0ps delay, which should be 0x7.
With the previous divisor of 200, it would result in 0x2, which represents a
-300ps delay.

With this patch, ethernet on the SoCFPGA DE0 Atlas is now able to work with
1Gb ethernet.

References:
http://www.micrel.com/_PDF/Ethernet/datasheets/KSZ9031RNX.pdf -> page 26

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: micrel: add documentation for Micrel KSZ90x1 binding
Dinh Nguyen [Wed, 27 Jan 2016 21:45:59 +0000 (15:45 -0600)]
net: phy: micrel: add documentation for Micrel KSZ90x1 binding

Add the DTS documentation for the Micrel KSZ90x1 binding.

The original document was from:
[commit 4b405efbe12de28b26289282b431323d73992381 from the Linux kernel]

This takes the original document and adds a clarification on how the skew
values are represented in the code.

References:

Micrel ksz9021rl/rn Data Sheet, Revision 1.2. Dated 2/13/2014.
http://www.micrel.com/_PDF/Ethernet/datasheets/ksz9021rl-rn_ds.pdf

Micrel ksz9031rnx Data Sheet, Revision 2.1. Dated 11/20/2014.
http://www.micrel.com/_PDF/Ethernet/datasheets/KSZ9031RNX.pdf

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: Use 'autoneg' flag from phydev
Alexandre Messier [Fri, 22 Jan 2016 19:16:56 +0000 (14:16 -0500)]
net: phy: Use 'autoneg' flag from phydev

Use the 'autoneg' flag available in phydev when checking if
autoneg is in use.

The previous implementation was checking directly in the PHY
if autoneg was supported. Some PHYs will report that autoneg
is supported, even when it is disabled. Thus it is not possible
to use that bit to determine if autoneg is currently in use or
not.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: Set ANRESTART in setup_forced
Alexandre Messier [Fri, 22 Jan 2016 19:16:15 +0000 (14:16 -0500)]
net: phy: Set ANRESTART in setup_forced

When configuring a PHY in fixed (forced) link mode, in order for
the changes to be applied, either one of these conditions must
be triggered:
1- PHY is reset
2- Autoneg is restarted
3- PHY transitions from power-down to power-up

Neither of these is currently done, so effectively the fixed link
configuration is not applied in the PHY.

Fix this by setting the Autoneg restart bit.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: micrel: Disable B_CAST on config
Alexandre Messier [Fri, 22 Jan 2016 19:06:33 +0000 (14:06 -0500)]
net: phy: micrel: Disable B_CAST on config

Micrel PHYs KSZ8021/31 and KSZ8081 have a feature where MDIO address 0
is considered as a broadcast address; the PHY will respond even if it
is not its configured (pinstrapped) address. This feature is enabled
by default.

The Linux kernel disables that feature at initialisation, but not
before it probes the MDIO bus. This causes an issue, because a PHY
at address 3 will be discovered at addresses 0 and 3, but will then
only respond at address 3. Because Linux attaches the first PHY it
discovers on 'eth0', it will attach the PHY from address 0, which
will never answer again.

Fix the issue by disabling the broadcast feature in U-Boot, before
Linux is started.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: Rename eth.c to eth_lecacy.c
Simon Glass [Sun, 17 Jan 2016 21:52:01 +0000 (14:52 -0700)]
net: Rename eth.c to eth_lecacy.c

Rename this file to make it clear it is for the old networking drivers
and not for use with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: Move driver-model code into its own file
Simon Glass [Sun, 17 Jan 2016 21:52:00 +0000 (14:52 -0700)]
net: Move driver-model code into its own file

Every other uclass is in its own file. Create a new eth-uclass.c file and
move the driver-model code into it, so that networking is consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: Move remaining common functions to eth_common.c
Simon Glass [Sun, 17 Jan 2016 21:51:59 +0000 (14:51 -0700)]
net: Move remaining common functions to eth_common.c

Move eth_current_changed(), eth_set_current(), eth_mac_skip() and
eth_get_name() into the common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: Move environment functions to the common file
Simon Glass [Sun, 17 Jan 2016 21:51:58 +0000 (14:51 -0700)]
net: Move environment functions to the common file

Move the functions which set ethernet environment variables to the common
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: Move common init into a new eth_common.c file
Simon Glass [Sun, 17 Jan 2016 21:51:57 +0000 (14:51 -0700)]
net: Move common init into a new eth_common.c file

Only half of the init is actually common. Move that part into a new common
file and call it from driver-model and legacy code. More common functions
will be added in future patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: Don't call board/cpu_eth_init() with driver model
Simon Glass [Sun, 17 Jan 2016 21:51:56 +0000 (14:51 -0700)]
net: Don't call board/cpu_eth_init() with driver model

We should avoid weak functions with driver model. Existing boards that use
driver model don't need them, so let's kill them off.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agotegra: Report errors from PCI init
Simon Glass [Sun, 17 Jan 2016 21:51:55 +0000 (14:51 -0700)]
tegra: Report errors from PCI init

This function can fail, so be sure to report any errors that occur.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet/designware: add support of max-speed device tree property
Alexey Brodkin [Wed, 13 Jan 2016 13:59:37 +0000 (16:59 +0300)]
net/designware: add support of max-speed device tree property

This property allows to specify fastest connection mode supported by
the MAC (as opposed to features of the phy).

There are situations when phy may handle faster modes than the
MAC (or even it's particular implementation or even due to CPU being too
slow).

This property is a standard one in Linux kernel these days and some
boards do already use it in their device tree descriptions.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Sonic Zhang <sonic.zhang@analog.com>
cc: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet/designware: do explicit port selection for 1Gb mode
Alexey Brodkin [Wed, 13 Jan 2016 13:59:36 +0000 (16:59 +0300)]
net/designware: do explicit port selection for 1Gb mode

Current implementation only sets "port select" bit for non-1Gb mode.
That works fine if GMAC has just exited reset state but we may as well
change connection mode in runtime. Then we'll need to reprogram GMAC for
that new mode of operation and if previous mode was 10 or 100 Mb and new
one is 1 Gb we'll need to reset port mode bit.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Sonic Zhang <sonic.zhang@analog.com>
cc: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoinclude/net.h: add max_speed member in struct eth_pdata
Alexey Brodkin [Wed, 13 Jan 2016 13:59:35 +0000 (16:59 +0300)]
include/net.h: add max_speed member in struct eth_pdata

This will be used for getting max speed mode of Ethernet interface that
a particular MAC supports from Device Tree blob and later being used for
phy configuration.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agodrivers/net/phy: introduce phy_set_supported()
Alexey Brodkin [Wed, 13 Jan 2016 13:59:34 +0000 (16:59 +0300)]
drivers/net/phy: introduce phy_set_supported()

This new function will allow MAC drivers to override supported
capabilities of the phy. It is required when MAC cannot handle all
speeds supported by phy.

For example phy supports up-to 1Gb connections while MAC may only work
in modes up to 100 or even 10 Mbit/sec.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: breakdown PHY_*_FEATURES defines
Florian Fainelli [Wed, 13 Jan 2016 13:59:33 +0000 (16:59 +0300)]
net: phy: breakdown PHY_*_FEATURES defines

Breakdown the PHY_*_FEATURES into per speed defines such that we can
easily re-use them individually.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: genphy: Allow overwriting features
Sascha Hauer [Wed, 13 Jan 2016 13:59:32 +0000 (16:59 +0300)]
net: phy: genphy: Allow overwriting features

of_set_phy_supported allows overwiting hardware capabilities of
a phy with values from the devicetree. This does not work with
the genphy driver though because the genphys config_init function
will overwrite all values adjusted by of_set_phy_supported. Fix
this by initialising the genphy features in the phy_driver struct
and in config_init just limit the features to the ones the hardware
can actually support. The resulting features are a subset of the
devicetree specified features and the hardware features.

This is a copy of the patch from Linux kernel, see
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c242a47238fa2a6a54af8a16e62b54e6e031d4bc

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: phy: ensure Gigabit features are masked off if requested
Florian Fainelli [Wed, 13 Jan 2016 13:59:31 +0000 (16:59 +0300)]
net: phy: ensure Gigabit features are masked off if requested

When a Gigabit PHY device is connected to a 10/100Mbits capable Ethernet
MAC, the driver will restrict the phydev->supported modes to mask off
Gigabit. If the Gigabit PHY comes out of reset with the Gigabit features
set by default in MII_CTRL1000, it will keep advertising these feature,
so by the time we call genphy_config_advert(), the condition on
phydev->supported having the Gigabit features on is false, and we do not
update MII_CTRL1000 with updated values, and we keep advertising Gigabit
features, eventually configuring the PHY for Gigabit whilst the Ethernet
MAC does not support that.

This patches fixes the problem by ensuring that the Gigabit feature bits
are always cleared in MII_CTRL1000, if the PHY happens to be a Gigabit
PHY, and then, if Gigabit features are supported, setting those and
updating MII_CTRL1000 accordingly.

This is a copy of patch from Linux kernel, see
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=5273e3a5ca94fbeb8e07d31203069220d5e682aa

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoarm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type()
Bin Meng [Tue, 12 Jan 2016 06:41:26 +0000 (22:41 -0800)]
arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type()

eth_get_dev_by_index() is an API which is not available in driver
model. Use eth_get_dev_by_name() instead, which can also simplifly
the code logic a little bit.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: Use priv->tbiaddr to initialize TBI PHY address
Bin Meng [Tue, 12 Jan 2016 06:41:25 +0000 (22:41 -0800)]
net: tsec: Use priv->tbiaddr to initialize TBI PHY address

Add a new member 'tbiaddr' to tsec_private struct. For non-DM driver,
it is initialized as CONFIG_SYS_TBIPA_VALUE, but for DM driver, we
can get this from device tree. Update the bindings doc as well.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: Add driver model ethernet support
Bin Meng [Tue, 12 Jan 2016 06:41:24 +0000 (22:41 -0800)]
net: tsec: Add driver model ethernet support

This adds driver model support to Freescale TSEC ethernet driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agodoc: dt-bindings: Describe Freescale TSEC ethernet controller
Bin Meng [Tue, 12 Jan 2016 06:41:23 +0000 (22:41 -0800)]
doc: dt-bindings: Describe Freescale TSEC ethernet controller

Adapted from the same file name in the kernel device tree bindings
documentation, to use with U-Boot.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: Use tsec_private pointer as the parameter for internal routines
Bin Meng [Tue, 12 Jan 2016 06:41:22 +0000 (22:41 -0800)]
net: tsec: Use tsec_private pointer as the parameter for internal routines

For internal routines like redundant_init(), startup_tsec() and
init_phy(), change to use tsec_private pointer as the parameter.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: Adjust orders to avoid forward declaration of tsec_send()
Bin Meng [Tue, 12 Jan 2016 06:41:21 +0000 (22:41 -0800)]
net: tsec: Adjust orders to avoid forward declaration of tsec_send()

Adjust static functions in a proper order so that forward declaration
of tsec_send() can be avoided.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: Move rxbd and txbd to struct tsec_private
Bin Meng [Tue, 12 Jan 2016 06:41:20 +0000 (22:41 -0800)]
net: tsec: Move rxbd and txbd to struct tsec_private

rxbd and txbd are declared static with 8 byte alignment requirement,
but they can be put into struct tsec_private as well and are natually
aligned to 8 byte.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: Move rx_idx and tx_idx to struct tsec_private
Bin Meng [Tue, 12 Jan 2016 06:41:19 +0000 (22:41 -0800)]
net: tsec: Move rx_idx and tx_idx to struct tsec_private

At present rx_idx and tx_idx are declared as static variables
in the driver codes. To support multiple interfaces, move it to
struct tsec_private.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: tsec: fsl_mdio: Fix several cosmetic issues
Bin Meng [Tue, 12 Jan 2016 06:41:18 +0000 (22:41 -0800)]
net: tsec: fsl_mdio: Fix several cosmetic issues

Clean up the tsec and fsl_mdio driver codes a little bit, by:
- Fix misuse of tab and space here and there
- Use correct multi-line comment format
- Replace license identifier to GPL-2.0+

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoarm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
Bin Meng [Tue, 12 Jan 2016 06:41:17 +0000 (22:41 -0800)]
arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agopowerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
Bin Meng [Tue, 12 Jan 2016 06:41:16 +0000 (22:41 -0800)]
powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agopowerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
Bin Meng [Tue, 12 Jan 2016 06:41:15 +0000 (22:41 -0800)]
powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agopowerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
Bin Meng [Tue, 12 Jan 2016 06:41:14 +0000 (22:41 -0800)]
powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agopowerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
Bin Meng [Tue, 12 Jan 2016 06:41:13 +0000 (22:41 -0800)]
powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agopowerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
Bin Meng [Tue, 12 Jan 2016 06:41:12 +0000 (22:41 -0800)]
powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>