people/ms/u-boot.git
3 years agoMerge git://git.denx.de/u-boot-socfpga
Tom Rini [Sat, 29 Jul 2017 15:44:08 +0000 (11:44 -0400)] 
Merge git://git.denx.de/u-boot-socfpga

3 years agoMerge git://git.denx.de/u-boot-usb
Tom Rini [Sat, 29 Jul 2017 15:43:51 +0000 (11:43 -0400)] 
Merge git://git.denx.de/u-boot-usb

3 years agoclk: fix compilation errors for poplar platform
Patrice Chotard [Tue, 25 Jul 2017 11:24:45 +0000 (13:24 +0200)] 
clk: fix compilation errors for poplar platform

Move clk_release_all() prototype and definition inside
OF_CONTROL flag to avoid following compilation error for
poplar platform:

aarch64:  +   poplar
+drivers/usb/host/built-in.o: In function `ehci_usb_remove':
+drivers/usb/host/ehci-generic.c:159: undefined reference to `clk_release_all'
+drivers/usb/host/built-in.o: In function `ehci_usb_probe':
+drivers/usb/host/ehci-generic.c:133: undefined reference to `clk_release_all'
+make[1]: *** [u-boot] Error 139
+make: *** [sub-make] Error 2

Introduced by 4e542c4 clk: add clk_release_all()

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
3 years agousb: host: xhci-dxc3: fix compilation warnings
Patrice Chotard [Tue, 25 Jul 2017 11:24:44 +0000 (13:24 +0200)] 
usb: host: xhci-dxc3: fix compilation warnings

Fix following warnings encountered with platforms
dra7xx_evm and dra7xx_hs_evm :

       arm:  +   dra7xx_evm
+  hccr = (struct xhci_hccr *)devfdt_get_addr(dev);
+         ^
+  hcor = (struct xhci_hcor *)((phys_addr_t)hccr +
+                              ^
w+drivers/usb/host/xhci-dwc3.c: In function 'xhci_dwc3_probe':
w+drivers/usb/host/xhci-dwc3.c:124:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
w+drivers/usb/host/xhci-dwc3.c:125:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
w+drivers/usb/host/xhci-dwc3.c:125:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       arm:  +   dra7xx_hs_evm
+  hccr = (struct xhci_hccr *)devfdt_get_addr(dev);
+         ^
+  hcor = (struct xhci_hcor *)((phys_addr_t)hccr +
+                              ^
w+drivers/usb/host/xhci-dwc3.c: In function 'xhci_dwc3_probe':
w+drivers/usb/host/xhci-dwc3.c:124:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
w+drivers/usb/host/xhci-dwc3.c:125:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
w+drivers/usb/host/xhci-dwc3.c:125:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Introduced by 7e65e84 usb: host: xhci-dwc3: Convert driver to DM

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
3 years agophy: add a NO-OP phy driver
Jean-Jacques Hiblot [Mon, 24 Jul 2017 13:18:15 +0000 (15:18 +0200)] 
phy: add a NO-OP phy driver

This driver is used to stub PHY operations in a driver (USB, SATA).
This is useful when the 'client' driver (USB, SATA, ...) uses the PHY
framework and there is no actual PHY harwdare to drive.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
3 years agousb: host: ohci-generic: initialize PHY only when found
Patrice Chotard [Mon, 24 Jul 2017 15:07:05 +0000 (17:07 +0200)] 
usb: host: ohci-generic: initialize PHY only when found

Call generic_phy_init() only when a PHY was found.
This will avoid a crash if no "phys" property is found in DT.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reported-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agousb: host: ehci-generic: initialize PHY only when found
Patrice Chotard [Mon, 24 Jul 2017 15:07:04 +0000 (17:07 +0200)] 
usb: host: ehci-generic: initialize PHY only when found

Call generic_phy_init() only when a PHY was found.
This will avoid a crash if no "phys" property is found in DT.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reported-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agodm: usb: host: xhci-dwc3: add missing #ifdef CONFIG_DM_USB
Patrice Chotard [Mon, 24 Jul 2017 15:07:03 +0000 (17:07 +0200)] 
dm: usb: host: xhci-dwc3: add missing #ifdef CONFIG_DM_USB

Add CONFIG_DM_USB flag to avoid following compilation errors
detected by buildman :
+drivers/usb/host/built-in.o: In function `xhci_dwc3_remove':
+drivers/usb/host/xhci-dwc3.c:168: undefined reference to `xhci_deregister'
+drivers/usb/host/built-in.o: In function `xhci_dwc3_probe':
+drivers/usb/host/xhci-dwc3.c:145: undefined reference to `usb_get_dr_mode'
+drivers/usb/host/xhci-dwc3.c:152: undefined reference to `xhci_register'

introduced by patch d5c3f014da3 "usb: host: xhci-dwc3: Convert driver to DM"

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reported-by: Ran Wang <ran.wang_1@nxp.com>
3 years agodm: phy: add missing #ifdef CONFIG_PHY
Patrice Chotard [Mon, 24 Jul 2017 15:07:02 +0000 (17:07 +0200)] 
dm: phy: add missing #ifdef CONFIG_PHY

To avoid compilation breakage on platform that doesn't
support DM PHY but uses xhci-dwc3 driver, add the missing
CONFIG_PHY flag.

Introduced by patch :
84e53877 "usb: host: xhci-dwc3: Add generic PHY support"

Cc: Ran Wang <ran.wang_1@nxp.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reported-by: Ran Wang <ran.wang_1@nxp.com>
3 years agodfu: add common function to initiate transaction
Patrick Delaunay [Wed, 19 Jul 2017 14:39:25 +0000 (16:39 +0200)] 
dfu: add common function to initiate transaction

- factorize code between read and write transaction
- always use dfu_transaction_cleanup() to initialize
  the internal variable: easy maintenance
- replace direct access by dfu_get_buf() and dfu_get_buf_size()

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agodfu: factorize transaction cleanup
Patrick Delaunay [Wed, 19 Jul 2017 14:39:24 +0000 (16:39 +0200)] 
dfu: factorize transaction cleanup

rename cleanup function, as now called by read

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agodfu: remove limitation on partition size
Patrick Delaunay [Wed, 19 Jul 2017 14:39:23 +0000 (16:39 +0200)] 
dfu: remove limitation on partition size

Change long (32 bits on arm) to u64 (same type than offset)
for size and read offset r_left

So partition and device used for DFU can be greater than 4GB

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agodfu: allow dfu read on partition greater than 2GB
Patrick Delaunay [Wed, 19 Jul 2017 14:39:22 +0000 (16:39 +0200)] 
dfu: allow dfu read on partition greater than 2GB

solve issue on get_medium_size() function
the detection of error is a simple test < 0
but for ARM platform, long is 32bits and 2GB = 0x80000000
is seen as error.

I solve the issue by changing the prototype fo the function
to separate size and result.
This patch prepare the next patch with size change to u64.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agousb: gadget: f_thor: Free the allocated out request buffer
Siva Durga Prasad Paladugu [Tue, 21 Jun 2016 12:50:48 +0000 (14:50 +0200)] 
usb: gadget: f_thor: Free the allocated out request buffer

Fix the memory leak by freeing the allocated out request buffer

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agousb: xhci: Enable TT to support LS/FS devices behind a HS hub
Bin Meng [Wed, 19 Jul 2017 13:51:21 +0000 (21:51 +0800)] 
usb: xhci: Enable TT to support LS/FS devices behind a HS hub

So far LS/FS devices directly attached to xHC root port can be
successfully enumerated by xHCI driver, but if they are connected
behind a hub, the enumeration process fails to address the device.

It turns out xHCI driver still misses a part that in the device's
input slot context, all Transaction Translator (TT) related fields
are not programmed. The xHCI spec defines how to enable TT.

Now LS/FS devices like USB keyboard/mouse can be enumerated behind
a high speed hub.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: xhci: Correct TT_SLOT and TT_PORT macros
Bin Meng [Wed, 19 Jul 2017 13:51:20 +0000 (21:51 +0800)] 
usb: xhci: Correct TT_SLOT and TT_PORT macros

These two macros really need a parameter to make them useful.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: xhci: Implement update_hub_device() operation
Bin Meng [Wed, 19 Jul 2017 13:51:19 +0000 (21:51 +0800)] 
usb: xhci: Implement update_hub_device() operation

There is no way to know whether the attached device is a hub or
not in advance before the device's descriptor is fetched. But
once we know it's a high speed hub, per the xHCI spec, we need
to tell xHC it's a hub device by initializing hub-related fields
in the input slot context.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: hub: Call usb_update_hub_device() after hub descriptor is fetched
Bin Meng [Wed, 19 Jul 2017 13:51:18 +0000 (21:51 +0800)] 
usb: hub: Call usb_update_hub_device() after hub descriptor is fetched

After fetching hub descriptor, we need to call USB uclass operation
update_hub_device() to notify HCD to do some preparation work.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: usb: Add a new USB controller operation 'update_hub_device'
Bin Meng [Wed, 19 Jul 2017 13:51:17 +0000 (21:51 +0800)] 
dm: usb: Add a new USB controller operation 'update_hub_device'

For USB host controllers like xHC, its internal representation of
hub needs to be updated after the hub descriptor is fetched. This
adds a new op that does this.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: hub: Parse and save TT details from device descriptor
Bin Meng [Wed, 19 Jul 2017 13:51:16 +0000 (21:51 +0800)] 
usb: hub: Parse and save TT details from device descriptor

A high speed hub has a special responsibility to handle full speed/
low speed devices connected on downstream ports. In this case, the
hub must isolate the high speed signaling environment from the full
speed/low speed signaling environment with the help of Transaction
Translator (TT). TT details are provided by hub descriptors and we
parse and save it to hub uclass_priv for later use.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: xhci: Program 'route string' in the input slot context
Bin Meng [Wed, 19 Jul 2017 13:51:15 +0000 (21:51 +0800)] 
usb: xhci: Program 'route string' in the input slot context

xHCI spec says: the values of the 'route string' field shall be
initialized by the first 'Address Device' command issued to a
device slot, and shall not be modified by any other command.

So far U-Boot does not program this field, and it does not prevent
SS device directly attached to root port, or HS device behind an HS
hub, from working, due to the fact that 'route string' is used by
the xHC to target SS packets. But in order to enumerate devices
behind an SS hub, this field must be programmed.

With this commit and along with previous commits, now SS & HS devices
attached to a USB 3.0 hub can be enumerated by U-Boot.

As usual, this new feature is only available when DM is on.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: xhci: Change xhci_setup_addressable_virt_dev() signature
Bin Meng [Wed, 19 Jul 2017 13:51:14 +0000 (21:51 +0800)] 
usb: xhci: Change xhci_setup_addressable_virt_dev() signature

For future extension, change xhci_setup_addressable_virt_dev()
signature to accept a pointer to 'struct usb_device', instead
of its members slot_id & speed, as the struct already contains
these two plus some other useful information of the device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: hub: Support 'set hub depth' request for USB 3.0 hubs
Bin Meng [Wed, 19 Jul 2017 13:51:13 +0000 (21:51 +0800)] 
usb: hub: Support 'set hub depth' request for USB 3.0 hubs

USB 3.0 hub uses a hub depth value multiplied by four as an offset
into the 'route string' to locate the bits it uses to determine the
downstream port number. We shall set the hub depth value of a USB
3.0 hub after it is configured.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: hub: Translate USB 3.0 hub port status into old version
Bin Meng [Wed, 19 Jul 2017 13:51:12 +0000 (21:51 +0800)] 
usb: hub: Translate USB 3.0 hub port status into old version

USB 3.0 hub port status field has different bit positions from 2.0
hubs. Since U-Boot only understands the old version, translate the
new one into the old one.

Since we are going to add USB 3.0 hub support, this feature is only
available with driver model USB.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: hub: Add a new API to test if a hub device is root hub
Bin Meng [Wed, 19 Jul 2017 13:51:11 +0000 (21:51 +0800)] 
usb: hub: Add a new API to test if a hub device is root hub

Sometimes we need know if a given hub device is root hub or not.
Add a new API to test this. This removes the xHCI driver's own
version is_root_hub() and change to use the new API.

While we are here, remove the unused/commented out get_usb_device()
in the xHCI driver too.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: hub: Remove hub_port_reset()
Bin Meng [Wed, 19 Jul 2017 13:51:10 +0000 (21:51 +0800)] 
usb: hub: Remove hub_port_reset()

At present hub_port_reset() is defined in DM USB, but it is never
called hence remove it (removing another ifdefs).

While we are here, change legacy_hub_port_reset() name to
usb_hub_port_reset() to better match other function names in the
same hub module.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: hub: Use 'struct usb_hub_device' as hub device's uclass_priv
Bin Meng [Wed, 19 Jul 2017 13:51:09 +0000 (21:51 +0800)] 
usb: hub: Use 'struct usb_hub_device' as hub device's uclass_priv

Use USB hub device's dev->uclass_priv to point to 'usb_hub_device'
so that with driver model usb_hub_reset() and usb_hub_allocate()
are no longer needed.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: xhci-pci: Clean up the driver a little bit
Bin Meng [Wed, 19 Jul 2017 13:51:08 +0000 (21:51 +0800)] 
usb: xhci-pci: Clean up the driver a little bit

This cleans up the driver a little bit.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: xhci-pci: Drop non-DM version of xhci-pci driver
Bin Meng [Wed, 19 Jul 2017 13:51:07 +0000 (21:51 +0800)] 
usb: xhci-pci: Drop non-DM version of xhci-pci driver

As there is no board that currently uses xhci-pci driver without DM
USB, drop its support and leave only DM support.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: minnowmax: Enable USB xHCI support
Bin Meng [Wed, 19 Jul 2017 13:50:10 +0000 (21:50 +0800)] 
x86: minnowmax: Enable USB xHCI support

BayTrail SoC supports both EHCI and xHCI controllers. However only
one host controller (either EHCI or xHCI) can be used. To enable
HSIC and SS ports, xHCI must be used. This turns on xHCI support on
Intel MinnowMax board.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agox86: minnowmax: Add a environment variable for USB power-on delay
Bin Meng [Wed, 19 Jul 2017 13:50:09 +0000 (21:50 +0800)] 
x86: minnowmax: Add a environment variable for USB power-on delay

Occasionally it was observed that on Intel MinnowMax board, with a
USB 2.0 device connected to the bottom port, when doing 'usb start'
on the xHCI controller:

  scanning bus 0 for devices... cannot reset port 3!?

But neither of the two USB ports is routed to xHCI root port 3.
Adding some debug information shows that xHCI port 3 PORTSC register
mysteriously reports both CCS = 1 and CSC = 1.

This is not seen every time. After increasing the timeout to wait
for power to become stable, the issue is gone. So this indicates
current default USB power-on delay (20ms) might be at a critical
region where power is stable/unstable. U-Boot provides a mechanism
to have a environment variable to override the default one. Add
one for MinnowMax.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: xhci: Convert CONFIG_USB_XHCI_PCI to Kconfig
Bin Meng [Wed, 19 Jul 2017 13:50:08 +0000 (21:50 +0800)] 
usb: xhci: Convert CONFIG_USB_XHCI_PCI to Kconfig

Add CONFIG_USB_XHCI_PCI as a Kconfig option.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: cmd: Print actual packet size for super speed devices
Bin Meng [Wed, 19 Jul 2017 13:50:07 +0000 (21:50 +0800)] 
usb: cmd: Print actual packet size for super speed devices

USB 3.0 defines bMaxPacketSize0 field in the device descriptor as
the exponent of 2, so let's print the calculated actual size.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agoconfigs: Remove CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS in all boards
Bin Meng [Wed, 19 Jul 2017 13:50:06 +0000 (21:50 +0800)] 
configs: Remove CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS in all boards

Now that EHCD does not use CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS,
remove it in all boards' config files.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: ehci: Get rid of CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS
Bin Meng [Wed, 19 Jul 2017 13:50:05 +0000 (21:50 +0800)] 
usb: ehci: Get rid of CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS

EHC reports supported maximum number of ports in the HCSPARAMS
register, so it's unnecessary to use a hardcoded config option
CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agoconfigs: Remove CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS in all boards
Bin Meng [Wed, 19 Jul 2017 13:50:04 +0000 (21:50 +0800)] 
configs: Remove CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS in all boards

Now that xHCD does not use CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS,
remove it in all boards' config files.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: xhci: Get rid of CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS
Bin Meng [Wed, 19 Jul 2017 13:50:03 +0000 (21:50 +0800)] 
usb: xhci: Get rid of CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS

xHC reports supported maximum number of ports in the HCSPARAMS1
register, so it's unnecessary to use a hardcoded config option
CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: xhci: Change MAX_HC_PORTS to 255
Bin Meng [Wed, 19 Jul 2017 13:50:02 +0000 (21:50 +0800)] 
usb: xhci: Change MAX_HC_PORTS to 255

HCSPARAMS1:MaxPorts field specifies the maximum port number value,
and its valid values are in the range of 1 to 255.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: hub: Add 3.0 hub port status mask of 2.0 hub
Bin Meng [Wed, 19 Jul 2017 13:50:01 +0000 (21:50 +0800)] 
usb: hub: Add 3.0 hub port status mask of 2.0 hub

USB 3.0 hub port status has different bit position regarding to
port power, port speed, etc. But others are the same as 2.0 hubs.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: hub: Change USB hub descriptor to match USB 3.0 hubs
Bin Meng [Wed, 19 Jul 2017 13:50:00 +0000 (21:50 +0800)] 
usb: hub: Change USB hub descriptor to match USB 3.0 hubs

USB 3.0 hubs have a slightly different hub descriptor than USB 2.0
hubs, with a fixed (rather than variable length) size. Change the
host controller drivers that access those last two fields
(DeviceRemovable and PortPowerCtrlMask) to use the union.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: hub: Revise wLength for 'get port status' request
Bin Meng [Wed, 19 Jul 2017 13:49:59 +0000 (21:49 +0800)] 
usb: hub: Revise wLength for 'get port status' request

For accuracy, we should use 'sizeof(struct usb_port_status)' as the
wLength for 'get port status' request, although it happens to be
equal to 'sizeof(struct usb_hub_status)'.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: hub: Send correct wValue to get hub descriptor of a USB 3.0 hub
Bin Meng [Wed, 19 Jul 2017 13:49:58 +0000 (21:49 +0800)] 
usb: hub: Send correct wValue to get hub descriptor of a USB 3.0 hub

Testing a USB 3.0 hub by connecting it to the xHCI port on Intel
MinnowMax, when issuing 'get hub descriptor' to the hub, xHCI
reports a transfer event TRB with a completion code 6 which means
'Stall Error'.

In fact super speed USB hub descriptor type is 0x2a, not 0x29.
Sending correct SETUP packet to the hub makes it not stall anymore.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: hub: Update handling connect status/change in usb_scan_port()
Bin Meng [Wed, 19 Jul 2017 13:49:57 +0000 (21:49 +0800)] 
usb: hub: Update handling connect status/change in usb_scan_port()

It was observed that on Intel MinnowMax board, when xHCI is enabled
in the BayTrail SoC, with a USB 3.0 device connected to the bottom
USB 3.0 port (mapped to xHCI root port #7), its PORTSC register is
always 0x201203 (CCS = 1, CSC = 0). The root cause of such behavior
is unknown yet. Connect status change bit is set on the same port
with a USB 2.0 device (mapped to xHCI port #1, which is a different
port on the root hub).

With current logic in usb_scan_port(), the enumeration process will
abort if it does not detect a connect status change on a hub port.
However since a device connection status is correctly reported, the
enumeration process can still continue.

With this change, USB device connected to the bottom blue port on
MinnowMax board can be enumerated under either SS or HS mode.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Dinh Nguyen <dinguyen@kernel.org>
3 years agousb: xhci: Add input slot context in xhci_set_configuration()
Bin Meng [Wed, 19 Jul 2017 13:49:56 +0000 (21:49 +0800)] 
usb: xhci: Add input slot context in xhci_set_configuration()

A valid input slot context for a 'configure endpoint' command requires
the 'Context Entries' field to be initialized to the index of the last
valid endpoint context that is defined by the target configuration. We
set up the 'Context Entries' field, but we forget to include the input
slot context in the input control context 'Add Context flags' bitmap.
So xHC will simply ignore input slot context and continue using its own
which contains old information of the device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: xhci: Initialize scratchpad buffer array and scratchpad buffers
Bin Meng [Wed, 19 Jul 2017 13:49:55 +0000 (21:49 +0800)] 
usb: xhci: Initialize scratchpad buffer array and scratchpad buffers

The scratchpad buffer array is used to define the locations of
statically allocated memory pages that are available for the
private use of the xHC. The xHCI spec explicitly mentions that
system software shall allocate the scratchpad buffers before
placing the xHC in to Run mode (Run/Stop (R/S) = ‘1’), however
U-Boot is missing this part.

This causes xHC on Intel platform does not respond the very first
'enable slot' command that is given to xHC and the 'enable slot'
command completion event TRB is never generated and xHC seems to
hang forever.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: xhci: Correct command TRB 4th dword initialization
Bin Meng [Wed, 19 Jul 2017 13:49:54 +0000 (21:49 +0800)] 
usb: xhci: Correct command TRB 4th dword initialization

In xhci_queue_command(), when the command is not 'reset endpoint',
'stop endpoint' or 'set TR dequeue pointer', endpoint ID should not
be encoded in the TRB.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: xhci: Remove incorrect comments for struct xhci_container_ctx
Bin Meng [Wed, 19 Jul 2017 13:49:53 +0000 (21:49 +0800)] 
usb: xhci: Remove incorrect comments for struct xhci_container_ctx

There is no member called 'dma' in struct xhci_container_ctx. Remove
the comments that mentions it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
3 years agousb: host: ohci-generic: add generic PHY support
Patrice Chotard [Tue, 18 Jul 2017 09:57:14 +0000 (11:57 +0200)] 
usb: host: ohci-generic: add generic PHY support

Extend ohci-generic driver with generic PHY framework

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: ohci-generic: add RESET support
Patrice Chotard [Tue, 18 Jul 2017 09:57:13 +0000 (11:57 +0200)] 
usb: host: ohci-generic: add RESET support

use array to save deasserted resets reference in order to
assert them in case of error during probe() or during driver
removal.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: ohci-generic: add CLOCK support
Patrice Chotard [Tue, 18 Jul 2017 09:57:12 +0000 (11:57 +0200)] 
usb: host: ohci-generic: add CLOCK support

use array to save enabled clocks reference in order to
disabled them in case of error during probe() or during
driver removal.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: ehci-generic: add generic PHY support
Patrice Chotard [Tue, 18 Jul 2017 09:57:11 +0000 (11:57 +0200)] 
usb: host: ehci-generic: add generic PHY support

Extend ehci-generic driver with generic PHY framework

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: ehci-generic: add error path and .remove callback
Patrice Chotard [Tue, 18 Jul 2017 09:57:10 +0000 (11:57 +0200)] 
usb: host: ehci-generic: add error path and .remove callback

Use an array to save enabled clocks reference and deasserted resets
in order to respectively disabled and asserted them in case of error
during probe() or during driver removal.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: ehci-generic: replace printf() by error()
Patrice Chotard [Tue, 18 Jul 2017 09:57:09 +0000 (11:57 +0200)] 
usb: host: ehci-generic: replace printf() by error()

this allows to get file, line and function location
of the current error message.

Signed-off-by: patrice chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: add ofnode_count_phandle_with_args()
Patrice Chotard [Tue, 18 Jul 2017 09:57:08 +0000 (11:57 +0200)] 
dm: core: add ofnode_count_phandle_with_args()

This function is usefull to get phandle number contained
in a property list.
For example,  this allows to allocate the right amount
of memory to keep clock's reference contained into the
"clocks" property.

To implement it, either of_count_phandle_with_args() or
fdtdec_parse_phandle_with_args() are used respectively
for live tree and flat tree.
By passing index = -1, these 2 functions returns the
number of phandle contained into the property list.

Add also the dev_count_phandle_with_args() based on
ofnode_count_phandle_with_args()

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoclk: add clk_release_all()
Patrice Chotard [Tue, 18 Jul 2017 09:57:07 +0000 (11:57 +0200)] 
clk: add clk_release_all()

Add clk_release_all() method which Disable/Free an
array of clocks that has been previously requested by
clk_request/get_by_*()

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoreset: add reset_release_all()
Patrice Chotard [Tue, 18 Jul 2017 09:57:06 +0000 (11:57 +0200)] 
reset: add reset_release_all()

Add reset_release_all() method which Assert/Free an
array of resets signal that has been previously successfully
requested by reset_get_by_*()

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoreset: add reset_request()
Patrice Chotard [Tue, 18 Jul 2017 09:57:05 +0000 (11:57 +0200)] 
reset: add reset_request()

This is needed in error path to assert previously deasserted
reset by using a saved reset_ctl reference.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: xhci-dwc3: Add generic PHY support
Patrice Chotard [Tue, 18 Jul 2017 09:38:44 +0000 (11:38 +0200)] 
usb: host: xhci-dwc3: Add generic PHY support

Add support of generic PHY framework support

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodrivers: phy: add generic_phy_valid() method
Patrice Chotard [Tue, 18 Jul 2017 09:38:43 +0000 (11:38 +0200)] 
drivers: phy: add generic_phy_valid() method

This allow to check if a PHY has been correctly
initialised and avoid to get access to phy struct.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
3 years agodrivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails
Patrice Chotard [Tue, 18 Jul 2017 09:38:42 +0000 (11:38 +0200)] 
drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails

phy->dev need to be set to NULL in case of generic_phy_get_by_index()
fails. Then phy->dev can be used to check if the phy is valid

Reported-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: xhci-dwc3: Add dual role mode support from DT
Patrice Chotard [Tue, 18 Jul 2017 09:38:41 +0000 (11:38 +0200)] 
usb: host: xhci-dwc3: Add dual role mode support from DT

DWC3 dual role mode is selected using DT "dr_mode"
property. If not found, DWC3 controller is configured
in HOST mode by default

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agousb: host: xhci-dwc3: Convert driver to DM
Patrice Chotard [Tue, 18 Jul 2017 09:38:40 +0000 (11:38 +0200)] 
usb: host: xhci-dwc3: Convert driver to DM

Add Driver Model support with use of generic DT
compatible string "snps,dwc3"

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: add static to local symbols
Masahiro Yamada [Thu, 22 Jun 2017 07:35:14 +0000 (16:35 +0900)] 
usb: add static to local symbols

Sparse reports "... was not declared. Should it be static?"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agodm: tegra: Move nyan-big, jetson-tk1/tx1, beaver to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:14 +0000 (08:30 -0600)] 
dm: tegra: Move nyan-big, jetson-tk1/tx1, beaver to livetree

Change these board to use a live device tree after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agofdtdec: Drop old compatible values
Simon Glass [Tue, 25 Jul 2017 14:30:13 +0000 (08:30 -0600)] 
fdtdec: Drop old compatible values

These are not needed now since the drivers now use driver model. Drop
them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: power: Convert as3722 to driver model
Simon Glass [Tue, 25 Jul 2017 14:30:12 +0000 (08:30 -0600)] 
dm: power: Convert as3722 to driver model

Convert this PMIC driver to driver model and fix up other users. The
regulator and GPIO functions are now handled by separate drivers.

Update nyan-big to work correct. Three boards will need to be updated by
the maintainers: apalis-tk1, cei-tk1-som. Also the TODO in the code re
as3722_sd_set_voltage() needs to be completed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agopower: Add a GPIO driver for the as3722 PMIC
Simon Glass [Tue, 25 Jul 2017 14:30:11 +0000 (08:30 -0600)] 
power: Add a GPIO driver for the as3722 PMIC

This pmic includes GPIOs which should have their own driver. Add
a driver to support these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agopower: Add a regulator driver for the as3722 PMIC
Simon Glass [Tue, 25 Jul 2017 14:30:10 +0000 (08:30 -0600)] 
power: Add a regulator driver for the as3722 PMIC

This pmic includes regulators which should have their own driver. Add
a driver to support these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: pci: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:09 +0000 (08:30 -0600)] 
dm: tegra: pci: Convert to livetree

Update the tegra pci driver to support a live device tree. Fix the check
for nvidia,num-lanes so that an error will actually be detected.

Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: mmc: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:08 +0000 (08:30 -0600)] 
dm: tegra: mmc: Convert to livetree

Update the tegra mmc driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: pwm: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:07 +0000 (08:30 -0600)] 
dm: tegra: pwm: Convert to livetree

Update the tegra pwm driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: i2c: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:06 +0000 (08:30 -0600)] 
dm: tegra: i2c: Convert to livetree

Update the tegra i2c driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: spi: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:05 +0000 (08:30 -0600)] 
dm: tegra: spi: Convert to livetree

Update the tegra114 spi driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: usb: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:04 +0000 (08:30 -0600)] 
dm: tegra: usb: Convert to livetree

Update the Tegra EHCI driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: gpio: Convert to support livetree
Simon Glass [Tue, 25 Jul 2017 14:30:03 +0000 (08:30 -0600)] 
dm: tegra: gpio: Convert to support livetree

Update the GPIO driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agotegra: dts: Move stdout-path to /chosen
Simon Glass [Tue, 25 Jul 2017 14:30:02 +0000 (08:30 -0600)] 
tegra: dts: Move stdout-path to /chosen

This property should be in the /chosen node, not /aliases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: video: tegra124: Convert to livetree
Simon Glass [Tue, 25 Jul 2017 14:30:01 +0000 (08:30 -0600)] 
dm: video: tegra124: Convert to livetree

Update these drives to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: Convert clock_decode_periph_id() to support livetree
Simon Glass [Tue, 25 Jul 2017 14:30:00 +0000 (08:30 -0600)] 
dm: tegra: Convert clock_decode_periph_id() to support livetree

Adjust this to take a device as a parameter instead of a node.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: tegra: Convert USB setup to livetree
Simon Glass [Tue, 25 Jul 2017 14:29:59 +0000 (08:29 -0600)] 
dm: tegra: Convert USB setup to livetree

Adjust this code to support a live device tree. This should be implemented
as a PHY driver but that is left as an exercise for the maintainer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agotegra: tegra124: Add a PMC syscon driver
Simon Glass [Tue, 25 Jul 2017 14:29:58 +0000 (08:29 -0600)] 
tegra: tegra124: Add a PMC syscon driver

The PMC can be modelled as a syscon peripheral. Add a driver for this
so that it can be accessed by drivers when needed. Enable it for tegra124
boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agotegra: spl: Enable debug UART
Simon Glass [Tue, 25 Jul 2017 14:29:57 +0000 (08:29 -0600)] 
tegra: spl: Enable debug UART

Enable the debug UART in SPL to allow early serial output even if the
standard UART does not work (e.g. due to driver model problem).

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: core: Fix up ofnode_get_addr_index() for 64-bit values
Simon Glass [Tue, 25 Jul 2017 14:29:56 +0000 (08:29 -0600)] 
dm: core: Fix up ofnode_get_addr_index() for 64-bit values

At present this function only supports 32-bit (single-cell) values. Update
it to support two-cell values also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agodm: core: Add ofnode_read_resource()
Simon Glass [Tue, 25 Jul 2017 14:29:55 +0000 (08:29 -0600)] 
dm: core: Add ofnode_read_resource()

We sometimes need to read a resource from an arbitrary node. In any case
for consistency we should not put the live-tree switching code in
a dev_read_...() function. Update this to suit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
3 years agoconsole: simplify puts()
Masahiro Yamada [Mon, 17 Jul 2017 04:08:32 +0000 (13:08 +0900)] 
console: simplify puts()

Current puts() and putc() have similar #ifdef / if() conditionals.
Make puts() iterate over putc() to avoid code duplication.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: remove os_putc() and os_puts()
Masahiro Yamada [Mon, 17 Jul 2017 04:08:31 +0000 (13:08 +0900)] 
sandbox: remove os_putc() and os_puts()

They are unused since commit d8c6fb8cedbc ("sandbox: Drop special
case console code for sandbox").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
3 years agodm: ofnode: change return type of dev_read_prop() to opaque pointer
Masahiro Yamada [Mon, 17 Jul 2017 03:18:39 +0000 (12:18 +0900)] 
dm: ofnode: change return type of dev_read_prop() to opaque pointer

DT property values can be strings as well as integers.  This is why
of_get_property/fdt_getprop returns an opaque pointer.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
3 years agodm: Fix typo in include-guard for dm-structs.h
Philipp Tomsich [Tue, 11 Jul 2017 21:30:07 +0000 (23:30 +0200)] 
dm: Fix typo in include-guard for dm-structs.h

The include-guard for dm-structs.h was misspelled as __DT_STTUCTS.
Change it.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: scsi: Fix null pointer dereference in 'scsi reset'
Bin Meng [Sat, 17 Jun 2017 13:36:00 +0000 (06:36 -0700)] 
cmd: scsi: Fix null pointer dereference in 'scsi reset'

During 'scsi reset', scsi_bus_reset() is called with udevice pointed
to NULL, which causes exception. As a temporary fix, disable the call
for DM SCSI for now.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: ahci: Avoid scsi_scan_dev() in ahci_probe_scsi()
Bin Meng [Sat, 17 Jun 2017 13:35:59 +0000 (06:35 -0700)] 
dm: ahci: Avoid scsi_scan_dev() in ahci_probe_scsi()

Running 'scsi scan' command causes scsi_scan_dev() to be called,
from which device_probe() is called and consequently AHCI driver
probe routine will be called as SCSI driver's parent, and finally
ahci_probe_scsi() calls scsi_scan_dev() again.

Remove the call to scsi_scan_dev() in ahci_probe_scsi().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agorockchip: puma-rk3399: remove duplicate code (merge artifact)
Kever Yang [Thu, 27 Jul 2017 11:59:03 +0000 (19:59 +0800)] 
rockchip: puma-rk3399: remove duplicate code (merge artifact)

A few lines (defines and declarations) had been duplicated when the
puma-rk3399 board was initially merged.  This removes the duplicates
and changes the style to use local constants instead of pasted
literals.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
[fixed up commit-message & converted to use 'const u32':]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agorockchip: add u-boot specific dts for rk3036 sdk
Andy Yan [Mon, 24 Jul 2017 09:52:24 +0000 (17:52 +0800)] 
rockchip: add u-boot specific dts for rk3036 sdk

Add this dts to enable debug uart releated devices
before relocation.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agorockchip: use puts instead of printf when back to bootrom
Andy Yan [Mon, 24 Jul 2017 09:52:01 +0000 (17:52 +0800)] 
rockchip: use puts instead of printf when back to bootrom

printf will increase the code size more than 1kb, but platform
like rk3036 has no enough space for it.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agorockchip: enable SPL_LIBGENERIC for rk3036 based boards
Andy Yan [Mon, 24 Jul 2017 09:51:30 +0000 (17:51 +0800)] 
rockchip: enable SPL_LIBGENERIC for rk3036 based boards

function board_init_f_init_reserve will call memset, which
is implemented in lib, and enabled by CONFIG_SPL_LIBGENERIC_SUPPORT
in spl stage.
To reduce the code size, also enable SPL_TINY_MEMSET.
As rk3036 will return to bootrom immediately after dram
initialization, there is no need to run DM, so disable
SPL_DM_SERIAL.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agorockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
Andy Yan [Mon, 24 Jul 2017 09:51:07 +0000 (17:51 +0800)] 
rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036

RK3036 has no enough sapce use ARCH_MEMCPY/MEMSET in spl stage

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agorockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based...
Andy Yan [Mon, 24 Jul 2017 09:50:46 +0000 (17:50 +0800)] 
rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board

RK3036 only has 4kb sram, the spl code will use
3.4 ~ 3.5 kb, the last 0.5kb are used for SP and
GD, so there is no space for malloc. Also, the spl
will directly return to bootrom after dram initialized,
they never need the space for malloc.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agosandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before...
Andy Yan [Mon, 24 Jul 2017 09:49:59 +0000 (17:49 +0800)] 
sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation

SPL and normal u-boot stage use different malloc pool size
configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN)
to fit different boot stage.

Signed-off-by: Andy Yan <andyshrk@gmail.com>
Changes in v3:
- use CONFIG_VAL(), which suggested by Simon

Changes in v2: None

 arch/sandbox/cpu/start.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agomicroblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot
Andy Yan [Mon, 24 Jul 2017 09:49:01 +0000 (17:49 +0800)] 
microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agopowerpc: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot
Andy Yan [Mon, 24 Jul 2017 09:47:27 +0000 (17:47 +0800)] 
powerpc: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agomips: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot
Andy Yan [Mon, 24 Jul 2017 09:45:27 +0000 (17:45 +0800)] 
mips: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agospl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
Andy Yan [Mon, 24 Jul 2017 09:43:34 +0000 (17:43 +0800)] 
spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>