Commit Graph

11724 Commits

Author SHA1 Message Date
Frank Wang 22ae868202 rockchip: inno-phy-usb2: fix code logic error
Fix condition logic error in rockchip_usb2phy_parse().

Change-Id: I51d2e97d73f9fc81295d424f97737f00d0e846d7
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2018-01-23 09:35:13 +08:00
Frank Wang d015bf411a usb: gadget: correct the capacity value for upgrade tools
Correct the current capacity to support the different storage
devices upgrade.

Change-Id: I2c96183f317f42944887d02af097ff8a8d29cd4e
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2018-01-23 09:35:09 +08:00
Kever Yang 5531a492c0 rockchip: rk322x: sdram: use common udelay instead of rockchip_udelay
Do not need to use rockchip_udelay after we can use systimer.

Change-Id: Ibcd722a71ca383c057128d9706c6679b49c17a3d
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-23 08:45:25 +08:00
Kever Yang 48e66864c3 power: rk8xx: fix compile warning
If CONFIG_SPL_BUILD is not enable, some functions are defined but
not used.

Change-Id: I1d67f8f5d69c92d2d26209a17d7a765a56b10e59
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-22 17:53:19 +08:00
Kever Yang 6f3eb47422 fastboot: fix compile warning
cb_flashing() should be in the same MACRO of cb_flash().

Change-Id: Ic5641a1bf1fb0ab53ad98bdececd028f1e75a5e2
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-22 17:52:48 +08:00
Kever Yang c85f17a61d Revert "rockchip: rk322x: speed up the emmc and the cpu."
This reverts commit 4a872f4aa8.
rk3229 evb and echo can not work with ddr52 enable.

Change-Id: Ia22b30ffe40de6f6e74e50ec5fd52e3715006de0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-17 15:49:28 +08:00
Kever Yang 77159a9a96 rockchip: inno-phy-usb2: update error to pr_err
Change-Id: I31e321085c9435d11b1f5ba8295300036f1b550b
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-17 15:49:27 +08:00
Stefan Roese 6a2ff3f44f UPSTREAM: dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()
This patch changes the calls to uclass_first/next_device() in blk_first/
next_device() to use uclass_find_first/next_device() instead. These functions
don't prepare the devices, which is correct in this case.

With this patch applied, the "usb storage" command now works again as
expected:

=> usb storage
  Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra
  Type: Removable Hard Disk
  Capacity: 58656.0 MB = 57.2 GB (120127488 x 512)

Without this patch, it used to generate this buggy output:

=> usb storage
Card did not respond to voltage select!
mmc_init: -95, time 26
No storage devices, perhaps not 'usb start'ed..?

Change-Id: I5a037217a568d9e4eedb089bce5a283eadff1310
Signed-off-by: Stefan Roese <sr@denx.de>
Suggested-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8a5cbc065dfe1f258e3a7be823ea128184b90b5b)
2018-01-17 15:27:28 +08:00
Felix Brack 29b6917330 UPSTREAM: power: extend prefix match to regulator-name property
This patch extends pmic_bind_children prefix matching. In addition to
the node name the property regulator-name is used while trying to match
prefixes. This allows assigning different drivers to regulator nodes
named regulator@1 and regulator@10 for example.
I have discarded the idea of using other properties then regulator-name
as I do not see any benefit in using property compatible or even
regulator-compatible. Of course I am open to change this if there are
good reasons to do so.

Change-Id: Ifedf2c0a51cb725ddb290ee9dfd54a3fea45df70
Signed-off-by: Felix Brack <fb@ltec.ch>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit bf802f5d544f85c03b4097ab23d078be43c61855)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 13e1d84013 UPSTREAM: dm: reset: have the reset-command perform a COLD reset
The DM version of do_reset has been issuing a warm-reset, which (on
some platforms keeps GPIOs and other parts of the platform active).
This may cause unintended behaviour, as calling do_reset usually
indicates a desire to reset the board/platform and not just the CPU.

This changes do_reset to always request a COLD reset.
Note that programmatic uses can still invoke a WARM reset through
reset_cpu() or using sysreset_walk().

Change-Id: I65a8ac8e62582866e23e6451315090fdb2781ef4
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b53f6992e9cb7f0d892ebc2b1620b55559f461be)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 1b48bbdd20 UPSTREAM: bitops: collect BIT macros to include/linux/bitops.h
Same macros are defined in various places.  Collect them into
include/linux/bitops.h like Linux.

Change-Id: I81d12e8c8151c6eb29499d2b5cd61ed782500492
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ed3986ca30972c94f0076f88c948406ce030a05c)
2018-01-17 15:27:28 +08:00
Marek Vasut 14595d815a UPSTREAM: usb: gadget: storage: Increase FSG_BUFLEN
Increase the buffer length to be just above maximum permissible value
of 128 kiB . This increases the performance of the UMS and alike by a
factor of 2 - 2.5 as the buffers are less fragmented.

Change-Id: I8b285031fd251b2ebf672c2295a19bfcba77d8c6
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a8c402f45c758235916615757ac537db8e96fc31)
2018-01-17 15:27:28 +08:00
Dirk Behme 1bee64cb36 UPSTREAM: usb: ehci: do not invalidate a NULL buffer
Its a valid use case to call ehci_submit_async() with a NULL buffer
with length 0. E.g. from usb_set_configuration().

As invalidate_dcache_range() isn't able to judge if the address
NULL is valid or not (depending on the SoC hardware configuration it
might be valid) do the check in ehci_submit_async() as here we know
that we don't have to invalidate such a buffer.

Change-Id: If8d1ee336c3123356138551ed4cbb556e26bf4ed
Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b3cbcd902db7019410dfe3729a660abcb1f03ffb)
2018-01-17 15:27:28 +08:00
Heinrich Schuchardt 85b3e780a7 UPSTREAM: dm: usb: ehci: avoid possible NULL dereference
Currently we check in ehci_shutdown() if ctrl is NULL after
dereferencing it.

Before this we have already dereferenced ctrl, ctrl->hccr,
and ctrl->hcor in ehci_get_portsc_register(), ehci_submit_root(),
and hci_common_init().

A better approach is to already check ctrl, ctrl->hccr, and ctrl->hcor
during the initialization in ehci_register() and usb_lowlevel_init()
and signal an error here via the return code.

Change-Id: I940999cbb94fbae4642fd25df820997c4d642da1
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 45157d27644c23493ea1b5a6c9dd67572eb75c8c)
2018-01-17 15:27:28 +08:00
Alexey Brodkin 02b25dcd4f UPSTREAM: usb: ehci: Fix accessors for big-endian platforms and descriptors
Commit 9000eddbae ("drivers/usb/ehci: Use platform-specific accessors")
broke USB 2.0 on big-endian platforms because for them writel/readl()
does automatic conversion of BE data to LE.

Proper implementation requires to use "raw" variant of these accessors
which read/write data without messing with endianess.

While at it replace cpu_to_be32() to be32_to_cpu() in readl() to
keep sane semantics.

Change-Id: I35e193f08aa56967c831bce1b2892e2c51527796
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Marek Vasut <marex@denx.de>
Reported-by: Vladimir Boroda <boroda@yahoo.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9829ce2ff25c659ca29cd15ab773312ac4b6cfc6)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 25527bfaa3 UPSTREAM: rockchip: pinctrl: rk3399: add support for I2C8
The RK3399 has a total of 9 I2C controllers.  To support these, the
enum in periph.h is extended and the mapping from the IRQ numbers to
the peripheral-ids is extended to ensure that pinctrl requests are
passed through to the function configuring the I2C pins.

For I2C8, the pinctrl is implemented and tested (on a RK3399-Q7) using
communication with the FAN53555 connected on I2C8.

Change-Id: I7ad9400f05d3ee89263ecd2bcc391483934b6c74
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8c2bb589e29d5cb89e10c3ddd23b28d949fa9693)
2018-01-17 15:27:28 +08:00
Philipp Tomsich feab7f3343 UPSTREAM: rockchip: clk: rk3399: change extract_bits to bitfield_extract
The RK3399 clk driver still has a left-over use of extract_bits, which
can be replaced by using bitfield_extract from include/bitfield.h.
This rewrites the invocation to use the shared function.

Change-Id: Ia541e82ffce50d0f2a43928530ecece66ae1cd17
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a8ee98df183ed240afb5220c3cdf2991f69fa578)
2018-01-17 15:27:28 +08:00
Ian Ray 8427a52440 UPSTREAM: bootcount: add support for bootcounter on EXT filesystem
Add support for bootcounter on an EXT filesystem.
Sync configuration whitelist.

Change-Id: Iad44e2526afa9b1c117bde7527774e414fa54d8c
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit f31dac4e6e71c7c818151cd917d872909119fb99)
2018-01-17 15:27:28 +08:00
Simon Glass 1abc22cc20 UPSTREAM: dm: core: Correct address cast in dev_read_addr_ptr()
This currently causes a warning in sandbox and will not do the right
thing:

drivers/core/read.c: In function ‘dev_read_addr_ptr’:
drivers/core/read.c:64:44: warning: cast to pointer from integer of
	different size [-Wint-to-pointer-cast]
  return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;

Use map_sysmem() which is the correct way to convert an address to a
pointer.

Fixes: c131c8bca8 (dm: core: add dev_read_addr_ptr())
Change-Id: Ic8ef1cb185d98d84dc6cf35a7001dcdcb4caa849
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8ccc2db6e84244e5cb57885dc9dfd7e752071b98)
2018-01-17 15:27:28 +08:00
Masahiro Yamada aea2f111e0 UPSTREAM: simple-bus: remove DECLARE_GLOBAL_DATA_PTR
No global pointer is used in this file.

Change-Id: I0c2dcde65300f815348d6f44922577225dd0ddf4
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 3d569a807e17b146731c37db0cf21125134dee23)
2018-01-17 15:27:28 +08:00
Heinrich Schuchardt 02234e49de UPSTREAM: usbtty: fix typos
Fix typos in USB tty driver.

Change-Id: Ida39f7d6e86f386173bf4a905ee66d1cfa98aade
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c409336dacff3f48da70727da2dc8a1c47f5bf5e)
2018-01-17 15:27:28 +08:00
Tuomas Tynkkynen b0ec94428e UPSTREAM: Drop CONFIG_HAS_DATAFLASH
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Change-Id: Id05869deccb88c1102700dd5af58a8c249e3e9e2
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c68c03f52badc90951dbf8a054c0e500e04bf365)
2018-01-17 15:27:28 +08:00
Tuomas Tynkkynen 879344fbf1 UPSTREAM: spi: Drop CONFIG_ATMEL_DATAFLASH_SPI
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Change-Id: I37d591ec0dc956e4ec26d17a5e8e2588cf5a1afb
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Acked-by: Wenyou Yang <wenyou.yang@microchip.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 95688de311e238ccfba21c50b1b67ceffbdc7fc5)
2018-01-17 15:27:28 +08:00
Klaus Goger 1b189a920d UPSTREAM: dm: ofnode: query correct property in livetree ofnode_get_addr_size
The livetree codepath of ofnode_get_addr_size always used the "reg"
property for of_get_property. Use the property parameter of the function
call instead and check the return value if the property exists.
Otherwise return FDT_ADDR_T_NONE.

This was discoverd while using SPI NOR with livetree.
spi_flash_decode_fdt checks for memory-map and will not fail with
livetree even if the property does not exist.

Change-Id: Icc63d2edbccea6a9f17cdcb5818993d317736ede
Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 68a345294ac74505f17d65b003a7de836b3d9cba)
2018-01-17 15:27:28 +08:00
Faiz Abbas 9ab2e5eb63 UPSTREAM: dm: core: Round up size when allocating so that it is cache line aligned
The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGN and using it to flush cache leads to cache
misaligned warnings.

Therefore, round up the size to a multiple of ARCH_DMA_MINLAIGN
when allocating private data.

Change-Id: I29c4fb89f4be628518c2f5350d3efbccd28acd36
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5924da1dfe56d32a45b8adf29bdc8caf788bd4c8)
2018-01-17 15:27:28 +08:00
Simon Glass 90d0ce442b UPSTREAM: dm: gpio: Correct use of -ENODEV in drivers
In U-Boot -ENODEV means that there is no device. When there is a problem
with the device, drivers should return an error like -ENXIO or -EREMOTEIO.
When the device tree properties cannot be read correct , they should
return -EINVAL.

Update various GPIO drivers to follow this rule, to help with consistency
for future driver writers.

Change-Id: I6b8f826f6d90dffca55f4d0d5da744b74a39f29a
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 7c84319af9c76084f50f3f2b97545bfa05f3971d)
2018-01-17 15:27:28 +08:00
Masahiro Yamada d42197e44e UPSTREAM: dm: replace dm_dbg() with pr_debug()
As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Change-Id: I0732d1fec827d434b1163093920a3c5bd682803e
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ceb9190969e458dcd1427566f762dbb9cfdfdc94)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 046a6e2a9a bug.h: move runtime BUG/WARN macros into <linux/bug.h>
Collect runtime BUG/WARN into a self-contained header <linux/bug.h>
to make these macros easier to use.

Change-Id: If924684bdab99d2c8fe0b4b3755d0ee5291d11be
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 0a70fb4c1c180d6ad6cd4c1dcd3fae8c5d4dd62e)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 90aa625c9a treewide: replace with error() with pr_err()
U-Boot widely uses error() as a bit noisier variant of printf().

This macro causes name conflict with the following line in
include/linux/compiler-gcc.h:

  # define __compiletime_error(message) __attribute__((error(message)))

This prevents us from using __compiletime_error(), and makes it
difficult to fully sync BUILD_BUG macros with Linux.  (Notice
Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

Let's convert error() into now treewide-available pr_err().

Done with the help of Coccinelle, excluing tools/ directory.

The semantic patch I used is as follows:

// <smpl>
@@@@
-error
+pr_err
 (...)
// </smpl>

Change-Id: I921807c1770d36a91e692c48ab477558bb2ed0b8
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Re-run Coccinelle]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9b643e312d528f291966c1f30b0d90bf3b1d43dc)
2018-01-17 15:27:28 +08:00
Masahiro Yamada a9a4552a1c UPSTREAM: printk: collect printk stuff into <linux/printk.h> with loglevel support
When we import code from Linux, with regular re-sync planned, we want
to use printk() and pr_*().  U-Boot does not support them in a clean
way.  So, people end up with local macros, or compat headers here and
there, then we occasionally see build errors of definition conflicts.

We have include/linux/compat.h, but putting all sorts of unrelated
things into a single header is just a temporal workaround.  Hence this
patch, to find the best home for all printk variants.  If you want to
use printk() and friends, please include <linux/printk.h>.  This header
is self-contained, and pulls in only a few headers.

When I was testing this clean-up, I noticed the image size exceeded
its platform limit on some boards.  This is because all pr_*() that
were previously defined as no-op in include/linux/mtd/mtd.h (unless
CONFIG_MTD_DEBUG is set), are now enabled.

To make such boards happy, this commit also implements CONFIG_LOGLEVEL.
The concept is similar to the kernel parameter "loglevel".  (Actually,
the Kconfig help message was taken from kernel-paremeter.txt of Linux)
Messages with a loglevel smaller than console loglevel will be printed.

The difference is the loglevel is build-time determined.  To save the
image size, lower priority pr_*() are compiled out.  I set the default
of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages
are compiled in.

I adjusted CONFIG_LOGLEVEL to avoid build error for some boards.

Change-Id: I997d8bbeedd48777be87472df8ed126181fc4b8e
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b44b30260ffa3dc82f4bb98b022483bb09e95353)
2018-01-17 15:27:28 +08:00
Bin Meng f018b53dac UPSTREAM: usb: xhci: Set 'Average TRB Length' to 8 for control endpoints
Update the codes to conform with xHCI spec chapter 6.2.3.

Change-Id: I9227754f7f7faf27f90046178526fad4d45e699e
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit fae35857e1c38776854442f59d6b56c17e93fc39)
2018-01-17 15:27:28 +08:00
Bin Meng dd5c0fa315 UPSTREAM: usb: xhci: Set 'Error Count' to 0 for isoch endpoints
Per xHCI spec, 'Error Count' should be set to 0 for isoch endpoints.

Change-Id: Ibf1924935d705faa8a34e0bc94a44e3a0d1c28e2
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ab2b727dc03113fe35d6a9c937911055be3d3990)
2018-01-17 15:27:28 +08:00
Bin Meng 2874e912bc UPSTREAM: usb: xhci: Program max burst size for endpoint
The 'Max Burst Size' indicates to the xHC the maximum number of
consecutive USB transactions that should be executed per scheduling
opportunity. This is a “zero-based” value, where 0 to 15 represents
burst sizes of 1 to 16, but at present this is always set to zero.
Let's program the required value according to real needs.

Change-Id: Id8dbdbfb248acd016b1e133b86334b9815b8ff2d
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit fa483b2c750f6ebdb5946f46b217aa3f9a449531)
2018-01-17 15:27:28 +08:00
Bin Meng 1fa1b46003 UPSTREAM: usb: xhci: Honor endpoint's interval
USB endpoint reports the period between consecutive requests to send
or receive data as bInverval in its endpoint descriptor. So far this
is ignored by xHCI driver and the 'Interval' field in xHC's endpoint
context is always programmed to zero which means 1ms for low speed
or full speed , or 125us for high speed or super speed. We should
honor the interval by getting it from endpoint descriptor.

Change-Id: Ib9180ea7b15d29fdc5a90315dcb0ffea672877a3
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit f51966bf7afe44151756e9a2432705bb56bc2007)
2018-01-17 15:27:28 +08:00
Bin Meng 24acdf7a3d UPSTREAM: usb: xhci: Fix max packet size for full speed device endpoint 0
In xhci_check_maxpacket(), the control endpoint 0 max packet size
is wrongly taken from the interface's endpoint descriptor. However
the default endpoint 0 does not come with an endpoint descriptor
hence is not included in the interface structure. Change to use
epmaxpacketin[0] instead.

The other bug in this routine is that when setting max packet size
to the xHC endpoint 0 context, it does not clear its previous value
at all before programming a new one.

Change-Id: I32199e4f4a0f2950fa71b139f667ece35e55483c
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b5aa857b95194c15126245e99a384ec2fd9536e8)
2018-01-17 15:27:28 +08:00
Bin Meng 83e13f0fe7 UPSTREAM: usb: xhci: Add interrupt transfer support
xHCI uses normal TRBs for both bulk and interrupt. This adds the
missing interrupt transfer support to xHCI so that devices like
USB keyboard that uses interrupt transfer can work.

Change-Id: I857a769b96c3283d99deff1f1092ddd64a9693e2
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 1897d60130976ece389d5875187b78ba0d41428f)
2018-01-17 15:27:28 +08:00
Bin Meng d17dd8c547 UPSTREAM: usb: xhci: Don't assume LS/FS devices are always behind a HS hub
At present xHCI driver assumes LS/FS devices are attached directly
to a HS hub. If they are connected to a LS/FS hub, the driver will
fail to perform the USB enumeration process on such devices.

This is fixed by looking from the device itself all the way up to
the HS hub where the TT that serves the device is located.

Change-Id: I3465e64fdb09cf2fd15e181a5606938cf5819681
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8a0e6d83070a977442aaba2c5a74cbe34e157012)
2018-01-17 15:27:28 +08:00
Bin Meng 5705883872 UPSTREAM: dm: usb: Remove no longer needed blk_unbind_all()
With the root hub unbinding in usb_stop(), there is no need to do
a blk uclass specific unbind operation.

Change-Id: I1f8fef976ba14efc836041e79b23c0cd916a39ee
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ad0a9378bf5cc9280e117b7db94b6bfa1b6e8e76)
2018-01-17 15:27:28 +08:00
Bin Meng 4f46a20e4b UPSTREAM: dm: usb: Fix broken usb_stop()
At present we only do device_remove() during usb stop. The DM API
device_remove() only marks the device state as inactivated, but
still keeps its USB topology (eg: parent, children, etc) in the DM
device structure. There is no issue if we only start USB subsystem
once and never stop it. But a big issue occurs when we do 'usb stop'
and 'usb start' multiple times.

Strange things may be observed with current implementation, like:
- the enumeration may report only 1 mass storage device is detected,
  but the total number of USB devices is correct.
- USB keyboard does not work anymore after a bunch of 'usb reset'
  even if 'usb tree' shows it is correctly identified.
- read/write flash drive via 'fatload usb' may complain "Bad device"

In fact, every time when USB host controller starts the enumeration
process, it takes random time for each USB port to show up online,
hence each USB device may appear in a different order from previous
enumeration, and gets assigned to a totally different USB address.
As a result, we end up using a stale USB topology in the DM device
structure which still reflects the previous enumeration result, and
it may create an exact same DM device name like generic_bus_0_dev_7
that is already in the DM device structure. And since the DM device
structure is there, there is no device_bind() call to bind driver to
the device during current enumeration process, eventually creating
an inconsistent software representation of the hardware topology, a
non-working USB subsystem.

The fix is to clear the unused USB topology in the usb_stop(), by
calling device_unbind() on each controller's root hub device, and
the unbinding will unbind all of its children automatically.

For Sandbox, we need scan the device tree each time when we start
the USB stack, in order to re-create the emulated USB devices and
bind drivers for them before we actually do the driver probe.

Change-Id: I690fd9e4bd18421ea5f11772aab39806a2208b4e
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit d4efefe32ea8a45b7b30f4769b3928c28e181c73)
2018-01-17 15:27:28 +08:00
Philipp Tomsich ea32c351d2 UPSTREAM: power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.

Change-Id: I51fad4fbd9bff634174a7177a3cb6e69516e2f7e
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9086eab8fea5f6b41de1f6ab1313f3acf3f3db76)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 0114ea3199 UPSTREAM: rockchip: pinctrl: rk3368: add pinctrl for SDMMC0
Apparently, our earlier assumption that the BROM will always set up
the iomux for SDcard communication does not always hold true: when
booting U-Boot from the on-module (on the RK3368-uQ7) eMMC, the SDcard
pins are not set up and need to be configured by the pinctrl driver to
allow SD card access.

This change implements support for setting up the SDMMC pins in
pinctrl for the RK3368.

Change-Id: I41d4ccc546e5256713edc162bb7e3ec622843c16
Reported-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit fd0a1ba52ec65e82caf163d0074e768c3abc57ae)
2018-01-17 15:27:28 +08:00
Rob Clark bb0d14804e UPSTREAM: dm: video: Fix cache flushes
Content can come to screen via putc() and we cannot always rely on
updates ending with a puts().  This is the case with efi_console output
to vidconsole.  Fixes corruption with Shell.efi.

Change-Id: I081692793c0a7179a91446460a382259b3db9069
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 889808da9b78d193e5a117a6bf6bc9366d6a3f30)
2018-01-16 18:17:14 +08:00
Seung-Woo Kim 80553dd1d8 UPSTREAM: usb: dwc2: Align size of invalidating dcache before starting DMA
During using dwc2 usb gadget, if usb message size is too small,
following cache misaligned warning is shown:

   CACHE: Misaligned operation at range [bfdbcb00, bfdbcb04]

Align size of invalidating dcache before starting DMA to remove the
warning.

Change-Id: Ibd9040be45da03174d63313e302b994720c7edd3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a939af0c748e2ea1eeb8cf47fa9771a95786de70)
2018-01-16 18:17:07 +08:00
Bin Meng 115142eae5 UPSTREAM: usb: kbd: Set a default polling mechanism for USB keyboard
The choice of "USB keyboard polling" cannot be optional as without
one mechanism being set, it just doesn't work. Set the default one
to CONFIG_SYS_USB_EVENT_POLL.

Fixes: ecad7051 ("configs: Migrate all of the existing USB symbols, except fastboot")
Change-Id: I9c54076edba03ca9fc10801f9f4bebb54ffd0ef9
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 2e5026a2f022f1c5ab5e879684a895ccdca7690c)
2018-01-16 18:17:07 +08:00
Philipp Tomsich 97ff91fa1d UPSTREAM: usb: host: ehci-generic: convert to livetree
Update the generic EHCI driver to support a live tree.

Change-Id: I07159bf921cda3d42247d2134a4f5a6bd7d65bb5
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 6e652e3a7d15b896fd82b717c6eca74b70a33b7a)
2018-01-16 18:17:07 +08:00
Philipp Tomsich c32504a86a UPSTREAM: usb: dwc2: convert to livetree
Update the DWC2 USB driver to support a live tree.

Change-Id: I1b2ccc05a637856cf1af0583985f0f336530121a
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a9d3037a8e4f045434184623eadbe86fa3844b28)
2018-01-16 18:17:07 +08:00
Philipp Tomsich d5c8d3f596 UPSTREAM: rockchip: xhci: Convert to livetree
Update the Rockchip xhci wrapper driver to support a live device tree.

Change-Id: Ie5dad13ae0327b7893c1530d7383994a1375d12e
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 32c8eee37fcb88d372410952d3ab88bcf5fdf7e7)
2018-01-16 18:17:07 +08:00
Bin Meng 50293ea8b3 UPSTREAM: dm: usb: ehci: Implement get_max_xfer_size() operation
EHCD can handle any transfer length as long as there is enough free
heap space left, hence set the theoretical max number SIZE_MAX.

Change-Id: I58711c5a6348b525caf950748d7c3338997e146a
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a23aa66baa3725e8707da46b18c645ad1a7243a0)
2018-01-16 18:17:07 +08:00
Bin Meng dbdd014082 UPSTREAM: dm: usb: xhci: Implement get_max_xfer_size() operation
xHCD allocates one segment which includes 64 TRBs for each endpoint
and the last TRB in this segment is configured as a link TRB to form
a TRB ring. Each TRB can transfer up to 64K bytes, however data
buffers referenced by transfer TRBs shall not span 64KB boundaries.
Hence the maximum number of TRBs we can use in one transfer is 62.

Change-Id: I7ea20b7805fe4da11343d38001a414b95751c7d5
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 022ceacaf8a6a67f86f0a5ed8f6ce6b2f6ab73a4)
2018-01-16 18:17:07 +08:00
Bin Meng 51da7f2167 UPSTREAM: dm: usb: Add a new USB controller operation 'get_max_xfer_size'
The HCD may have limitation on the maximum bytes to be transferred
in a USB transfer. USB class driver needs to be aware of this.

Change-Id: I6084946910810d5dbbe66a9191e6da768b084fe6
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 3e59f59015e39ceb870fa8a7a12e0464e775512b)
2018-01-16 18:17:07 +08:00