Re: [U-Boot] [PATCH RFC] arm64: allwinner: a64: Add Brava Keller initial support

2017-11-30 Thread Maxime Ripard
On Fri, Dec 01, 2017 at 12:14:41AM +0530, Jagan Teki wrote:
> Brava Keller is A64 based IoT device, which support
> - Allwinner A64 Cortex-A53
> - AXP803 PMIC
> - 1GB DDR3 RAM
> - 8GB eMMC
> - Mali-400MP2 GPU
> - AP6330 Wifi/BLE
> - Camera OV5640
> - USB Host and OTG
> 
> Signed-off-by: Jagan Teki 
> ---
> Note: Need to test it on hardware

Obviously this will need to be tested before being merged.

>  arch/arm/dts/Makefile|   1 +
>  arch/arm/dts/sun50i-a64-brava-keller.dts | 107 
> +++
>  board/sunxi/MAINTAINERS  |   5 ++
>  configs/brava_keller_defconfig   |  13 
>  4 files changed, 126 insertions(+)
>  create mode 100644 arch/arm/dts/sun50i-a64-brava-keller.dts
>  create mode 100644 configs/brava_keller_defconfig
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index cd540e9..b89e75a 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -342,6 +342,7 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \
>   sun50i-h5-orangepi-zero-plus2.dtb
>  dtb-$(CONFIG_MACH_SUN50I) += \
>   sun50i-a64-bananapi-m64.dtb \
> + sun50i-a64-brava-keller.dtb \
>   sun50i-a64-nanopi-a64.dtb \
>   sun50i-a64-olinuxino.dtb \
>   sun50i-a64-orangepi-win.dtb \
> diff --git a/arch/arm/dts/sun50i-a64-brava-keller.dts 
> b/arch/arm/dts/sun50i-a64-brava-keller.dts
> new file mode 100644
> index 000..094eee0
> --- /dev/null
> +++ b/arch/arm/dts/sun50i-a64-brava-keller.dts
> @@ -0,0 +1,107 @@
> +/*
> + * Copyright (C) 2017 Jagan Teki 
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of the
> + * License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + * obtaining a copy of this software and associated documentation
> + * files (the "Software"), to deal in the Software without
> + * restriction, including without limitation the rights to use,
> + * copy, modify, merge, publish, distribute, sublicense, and/or
> + * sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following
> + * conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +/dts-v1/;
> +
> +#include "sun50i-a64.dtsi"
> +
> +#include 
> +
> +/ {
> + model = "Brava Keller";
> + compatible = "brava,brava-keller", "allwinner,sun50i-a64";
> +
> + aliases {
> + serial2 = &uart2;
> + };
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + };
> +
> + reg_vcc3v3: vcc3v3 {
> + compatible = "regulator-fixed";
> + regulator-name = "vcc3v3";
> + regulator-min-microvolt = <330>;
> + regulator-max-microvolt = <330>;
> + };
> +};
> +
> +&ehci0 {
> + status = "okay";
> +};
> +
> +&ehci1 {
> + status = "okay";
> +};
> +
> +&mmc2 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&mmc2_pins>;
> + vmmc-supply = <®_vcc3v3>;
> + bus-width = <8>;
> + non-removable;
> + cap-mmc-hw-reset;
> + status = "okay";
> +};
> +
> +&ohci0 {
> + status = "okay";
> +};
> +
> +&ohci1 {
> + status = "okay";
> +};
> +
> +&uart2 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&uart2_pins>;
> + status = "okay";
> +};

That doesn't really make much sense. You have a single uart, and the
fact that you used stdout-path seems to indicate that it's your
console. However, you're using ttyS0 in stdout-path, and yet an alias
that would call it ttyS2...

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linu

[U-Boot] [PATCH V11 3/4] rockchip:usb: add a simple readme for rockusb

2017-11-30 Thread Eddie Cai
add a simple readme to introduce rockusb and tell people how to use it

Signed-off-by: Eddie Cai 
Reviewed-by: Simon Glass 
---
Changes in v11:
-add to MAINTAINER

Changes in v10:
-none

Changes in v9:
-none

Changes in v8:
-none

Changes in v7:
-none

Changes in v6:
-none

Changes in v5:
-none

Changes in v4:
-add some blank line to make it look better

Changes in v3:
-fix checkpatch error

---
 MAINTAINERS|  1 +
 doc/README.rockusb | 51 +++
 2 files changed, 52 insertions(+)
 create mode 100644 doc/README.rockusb

diff --git a/MAINTAINERS b/MAINTAINERS
index c7db583..4bef71f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -457,6 +457,7 @@ M:  Eddie Cai 
 S:  Maintained
 F: drivers/usb/gadget/f_rockusb.c
 F: cmd/rockusb.c
+F: doc/README.rockusb
 
 VIDEO
 M: Anatolij Gustschin 
diff --git a/doc/README.rockusb b/doc/README.rockusb
new file mode 100644
index 000..5405dc4
--- /dev/null
+++ b/doc/README.rockusb
@@ -0,0 +1,51 @@
+Rockusb (Rockchip USB protocol)
+=
+
+Overview
+
+
+Rockusb protocol is widely used by Rockchip SoC based devices. It can
+read/write info, image to/from devices. This document briefly describes how to
+use Rockusb for upgrading firmware (e.g. kernel, u-boot, rootfs, etc.).
+
+Tools
+
+There are many tools can support Rockusb protocol. rkdeveloptool
+(https://github.com/rockchip-linux/rkdeveloptool) is open source,
+It is maintained by Rockchip. People don't want to build from source
+can download from here
+(https://github.com/rockchip-linux/rkbin/blob/master/tools/rkdeveloptool)
+
+Usage
+
+The Usage of Rockusb command is:
+
+rockusb   
+
+e.g. rockusb 0 mmc 0
+
+On your U-Boot console, type this command to enter rockusb mode.
+On your host PC. use lsusb command. you should see a usb device
+using 0x2207 as its USB verdor id.
+
+for more detail about the rkdeveloptool. please read the usage.
+
+rkdeveloptool -h
+
+use rkdeveloptool wl command to write lba. BeginSec is the lba on device
+you want to write.
+
+sudo rkdeveloptool wl   
+
+to flash U-Boot image use below command. U-Boot binary is made by mkimage.
+see doc/README.rockchip for more detail about how to get U-Boot binary.
+
+sudo rkdeveloptool wl  64 
+
+There are plenty of Rockusb command. but wl(write lba) and
+rd(reboot) command. These two command can let people flash
+image to device.
+
+To do
+-
+* Fully support Rockusb protocol
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH V11 4/4] rockchip: rk3288: enable rockusb support on rk3288 based device

2017-11-30 Thread Eddie Cai
this patch enable rockusb support on rk3288 based device.

Signed-off-by: Eddie Cai 
Reviewed-by: Simon Glass 
---
Changes in v11:
-none

Changes in v10:
-rebase to latest mainline U-Boot, add vyasa board support

Changes in v9:
-fix compile error

Changes in v8:
-fix compile error

Changes in v7:
-use imply in the Kconfig to enable rockusb

Changes in v6:
-enable rockusb in defconfig

Changes in v5:
-none

Changes in v4:
-move to rk3288_common.h

Changes in v3:
-move to defconfig

---
 arch/arm/mach-rockchip/Kconfig  |  2 ++
 configs/chromebit_mickey_defconfig  |  7 +++
 configs/chromebook_jerry_defconfig  |  7 +++
 configs/chromebook_minnie_defconfig |  7 +++
 configs/evb-rk3288_defconfig|  9 +
 configs/fennec-rk3288_defconfig |  5 +
 configs/firefly-rk3288_defconfig|  7 +++
 configs/miqi-rk3288_defconfig   |  5 +
 configs/phycore-rk3288_defconfig|  6 ++
 configs/popmetal-rk3288_defconfig   |  5 +
 configs/rock2_defconfig |  8 
 configs/tinker-rk3288_defconfig |  5 +
 configs/vyasa-rk3288_defconfig  | 25 +
 13 files changed, 98 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index a26736a..186018c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -52,6 +52,8 @@ config ROCKCHIP_RK3288
select SPL_BOARD_INIT if SPL
select SUPPORT_SPL
select SPL
+   imply USB_FUNCTION_ROCKUSB
+   imply CMD_ROCKUSB
help
  The Rockchip RK3288 is a ARM-based SoC with a quad-core Cortex-A17
  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
diff --git a/configs/chromebit_mickey_defconfig 
b/configs/chromebit_mickey_defconfig
index c74a006..2a74784 100644
--- a/configs/chromebit_mickey_defconfig
+++ b/configs/chromebit_mickey_defconfig
@@ -22,6 +22,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
@@ -78,6 +79,7 @@ CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
 CONFIG_USB_GADGET_VENDOR_NUM=0x2207
 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_STORAGE=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
@@ -86,3 +88,8 @@ CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
 # CONFIG_SPL_OF_LIBFDT is not set
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_GADGET_VBUS_DRAW=0
+CONFIG_G_DNL_MANUFACTURER="Rockchip"
+CONFIG_G_DNL_VENDOR_NUM=0x2207
+CONFIG_G_DNL_PRODUCT_NUM=0x320a
diff --git a/configs/chromebook_jerry_defconfig 
b/configs/chromebook_jerry_defconfig
index 9576c30..81ed7d0 100644
--- a/configs/chromebook_jerry_defconfig
+++ b/configs/chromebook_jerry_defconfig
@@ -24,6 +24,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
@@ -79,6 +80,7 @@ CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
 CONFIG_USB_GADGET_VENDOR_NUM=0x2207
 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_STORAGE=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
@@ -88,3 +90,8 @@ CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
 # CONFIG_SPL_OF_LIBFDT is not set
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_GADGET_VBUS_DRAW=0
+CONFIG_G_DNL_MANUFACTURER="Rockchip"
+CONFIG_G_DNL_VENDOR_NUM=0x2207
+CONFIG_G_DNL_PRODUCT_NUM=0x320a
diff --git a/configs/chromebook_minnie_defconfig 
b/configs/chromebook_minnie_defconfig
index 197c242..0565c03 100644
--- a/configs/chromebook_minnie_defconfig
+++ b/configs/chromebook_minnie_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
@@ -78,6 +79,7 @@ CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
 CONFIG_USB_GADGET_VENDOR_NUM=0x2207
 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_STORAGE=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
@@ -88,3 +90,8 @@ CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
 # CONFIG_SPL_OF_LIBFDT is not set
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_GADGET_VBUS_DRAW=0
+CONFIG_G_DNL_MANUFACTURER="Rockchip"
+CONFIG_G_DNL_VENDOR_NUM=0x2207
+CONFIG_G_DNL_PRODUCT_NUM=0x320a
diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig
index e944f97..6024b86 100644
--- a/configs/evb-rk3288_defconfig
+++ b/configs/evb-rk3288_defconfig
@@ -20,6 +20,7 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
@@ -74,6 +75,14 @@ CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
 CONFIG_VIDEO_ROCKCHIP_MAX_YRES=1200
 CONFIG_DISPLAY_ROCKCHIP_MIPI=y
+CONFIG_USB=y
+CONFIG_USB_DWC2=y
+CONFIG_USB_STORAGE=y
 CO

[U-Boot] [PATCH V11 1/4] usb: rockchip: add the rockusb gadget

2017-11-30 Thread Eddie Cai
this patch implement rockusb protocol on the device side. this is based on
USB download gadget infrastructure. the rockusb function implements the rd,
wl, rid commands. it can work with rkdeveloptool

Signed-off-by: Eddie Cai 
Reviewed-by: Simon Glass 
---
Changes in v11:
-fix checkpatch error
-add maintainer

Changes in v10:
-fix build error

Changes in v9:
-fix compile error

Changes in v8:
-none

Changes in v7:
-none

Changes in v6:
-move some data to f_rockusb structure

Changes in v5:
-fix build error when build non-rockchip board
-fix checkpatch error

Changes in v4:
-use enum instead of macro define
-move some structure define and macro to f_rockusb.h
-add some function comment as Simon required
-address other comment from Simon
-fix build error as Lukasz point out

---
 MAINTAINERS|   5 +
 arch/arm/include/asm/arch-rockchip/f_rockusb.h | 132 +
 drivers/usb/gadget/Kconfig |   8 +
 drivers/usb/gadget/Makefile|   1 +
 drivers/usb/gadget/f_rockusb.c | 697 +
 5 files changed, 843 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rockchip/f_rockusb.h
 create mode 100644 drivers/usb/gadget/f_rockusb.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 2a20b94..e92a15d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -452,6 +452,11 @@ S: Maintained
 T: git git://git.denx.de/u-boot-usb.git
 F: drivers/usb/
 
+ROCKUSB
+M: Eddie Cai 
+S:  Maintained
+F: drivers/usb/gadget/f_rockusb.c
+
 VIDEO
 M: Anatolij Gustschin 
 S: Maintained
diff --git a/arch/arm/include/asm/arch-rockchip/f_rockusb.h 
b/arch/arm/include/asm/arch-rockchip/f_rockusb.h
new file mode 100644
index 000..c207a78
--- /dev/null
+++ b/arch/arm/include/asm/arch-rockchip/f_rockusb.h
@@ -0,0 +1,132 @@
+/*
+ * (C) Copyright 2017
+ *
+ * Eddie Cai 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _F_ROCKUSB_H_
+#define _F_ROCKUSB_H_
+#include 
+
+#define ROCKUSB_VERSION"0.1"
+
+#define ROCKUSB_INTERFACE_CLASS0xff
+#define ROCKUSB_INTERFACE_SUB_CLASS0x06
+#define ROCKUSB_INTERFACE_PROTOCOL 0x05
+
+#define RX_ENDPOINT_MAXIMUM_PACKET_SIZE_2_0  (0x0200)
+#define RX_ENDPOINT_MAXIMUM_PACKET_SIZE_1_1  (0x0040)
+#define TX_ENDPOINT_MAXIMUM_PACKET_SIZE  (0x0040)
+
+#define EP_BUFFER_SIZE 4096
+/*
+ * EP_BUFFER_SIZE must always be an integral multiple of maxpacket size
+ * (64 or 512 or 1024), else we break on certain controllers like DWC3
+ * that expect bulk OUT requests to be divisible by maxpacket size.
+ */
+
+#define CONFIG_ROCKUSB_BUF_ADDRCONFIG_SYS_LOAD_ADDR
+#define CONFIG_ROCKUSB_BUF_SIZE0x0800
+
+#define RKUSB_STATUS_IDLE  0
+#define RKUSB_STATUS_CMD   1
+#define RKUSB_STATUS_RXDATA2
+#define RKUSB_STATUS_TXDATA3
+#define RKUSB_STATUS_CSW   4
+#define RKUSB_STATUS_RXDATA_PREPARE5
+#define RKUSB_STATUS_TXDATA_PREPARE6
+
+enum rkusb_command {
+K_FW_TEST_UNIT_READY   = 0x00,
+K_FW_READ_FLASH_ID = 0x01,
+K_FW_SET_DEVICE_ID = 0x02,
+K_FW_TEST_BAD_BLOCK = 0x03,
+K_FW_READ_10 = 0x04,
+K_FW_WRITE_10 = 0x05,
+K_FW_ERASE_10 = 0x06,
+K_FW_WRITE_SPARE = 0x07,
+K_FW_READ_SPARE = 0x08,
+
+K_FW_ERASE_10_FORCE = 0x0b,
+K_FW_GET_VERSION = 0x0c,
+
+K_FW_LBA_READ_10 = 0x14,
+K_FW_LBA_WRITE_10 = 0x15,
+K_FW_ERASE_SYS_DISK = 0x16,
+K_FW_SDRAM_READ_10 = 0x17,
+K_FW_SDRAM_WRITE_10 = 0x18,
+K_FW_SDRAM_EXECUTE = 0x19,
+K_FW_READ_FLASH_INFO = 0x1A,
+K_FW_GET_CHIP_VER = 0x1B,
+K_FW_LOW_FORMAT = 0x1C,
+K_FW_SET_RESET_FLAG = 0x1E,
+K_FW_SPI_READ_10 = 0x21,
+K_FW_SPI_WRITE_10 = 0x22,
+
+K_FW_SESSION = 0X30,
+K_FW_RESET = 0xff,
+};
+
+#define CBW_DIRECTION_OUT  0x00
+#define CBW_DIRECTION_IN   0x80
+
+struct cmd_dispatch_info {
+   enum rkusb_command cmd;
+   /* call back function to handle rockusb command */
+   void (*cb)(struct usb_ep *ep, struct usb_request *req);
+};
+
+/* Bulk-only data structures */
+
+/* Command Block Wrapper */
+struct fsg_bulk_cb_wrap {
+   __le32  signature;  /* Contains 'USBC' */
+   u32 tag;/* Unique per command id */
+   __le32  data_transfer_length;   /* Size of the data */
+   u8  flags;  /* Direction in bit 7 */
+   u8  lun;/* lun (normally 0) */
+   u8  length; /* Of the CDB, <= MAX_COMMAND_SIZE */
+   u8  CDB[16];/* Command Data Block */
+};
+
+#define USB_BULK_CB_WRAP_LEN31
+#define USB_BULK_CB_SIG 0x43425355  /* Spells out USBC */
+#define USB_BULK_IN_FLAG0x80
+
+/* Command status Wrapper */
+struct bulk_cs_wrap {
+   __le32  signature;  /* Should = 'USBS' */
+   u32 tag;/* Same as original command */
+   __le32  residue;

[U-Boot] [PATCH V11 2/4] usb: rockchip: add rockusb command

2017-11-30 Thread Eddie Cai
this patch add rockusb command. the usage is
rockusb   
e.g. rockusb 0 mmc 0

Signed-off-by: Eddie Cai 
Reviewed-by: Simon Glass 
---
Changes in v11:
-fix check patch error
-add maintainer

Changes in v10:
-fix build error

Changes in v9:
-fix compile error

Changes in v8:
-none

Changes in v7:
-none

Changes in v6:
-move some data to f_rockusb structure

Changes in v5:
-fix build error when build non-rockchip board
-fix checkpatch error

Changes in v4:
-use enum instead of macro define
-move some structure define and macro to f_rockusb.h
-add some function comment as Simon required
-address other comment from Simon
-fix build error as Lukasz point out

---
 MAINTAINERS   |  1 +
 cmd/Kconfig   |  8 +++
 cmd/Makefile  |  1 +
 cmd/rockusb.c | 74 +++
 4 files changed, 84 insertions(+)
 create mode 100644 cmd/rockusb.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e92a15d..c7db583 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -456,6 +456,7 @@ ROCKUSB
 M: Eddie Cai 
 S:  Maintained
 F: drivers/usb/gadget/f_rockusb.c
+F: cmd/rockusb.c
 
 VIDEO
 M: Anatolij Gustschin 
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5a6afab..b46bf41 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -914,6 +914,14 @@ config CMD_USB_SDP
help
  Enables the command "sdp" which is used to have U-Boot emulating the
  Serial Download Protocol (SDP) via USB.
+config CMD_ROCKUSB
+   bool "rockusb"
+   depends on USB_FUNCTION_ROCKUSB
+   help
+  Rockusb protocol is widely used by Rockchip SoC based devices. It can
+ read/write info, image to/from devices. This enable rockusb command
+ support to communication with rockusb device. for more detail about
+ this command, please read doc/README.rockusb.
 
 config CMD_USB_MASS_STORAGE
bool "UMS usb mass storage"
diff --git a/cmd/Makefile b/cmd/Makefile
index 2b0444d..6837e9b 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -105,6 +105,7 @@ obj-$(CONFIG_CMD_READ) += read.o
 obj-$(CONFIG_CMD_REGINFO) += reginfo.o
 obj-$(CONFIG_CMD_REISER) += reiser.o
 obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o
+obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o
 obj-$(CONFIG_SANDBOX) += host.o
 obj-$(CONFIG_CMD_SATA) += sata.o
 obj-$(CONFIG_CMD_NVME) += nvme.o
diff --git a/cmd/rockusb.c b/cmd/rockusb.c
new file mode 100644
index 000..af81cdc
--- /dev/null
+++ b/cmd/rockusb.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2017 Eddie Cai 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int do_rockusb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+   int controller_index, dev_index;
+   char *usb_controller;
+   char *devtype;
+   char *devnum;
+   int ret;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   usb_controller = argv[1];
+   controller_index = simple_strtoul(usb_controller, NULL, 0);
+
+   if (argc >= 4) {
+   devtype = argv[2];
+   devnum  = argv[3];
+   } else {
+   return CMD_RET_USAGE;
+   }
+   dev_index = simple_strtoul(devnum, NULL, 0);
+   rockusb_dev_init(devtype, dev_index);
+
+   ret = board_usb_init(controller_index, USB_INIT_DEVICE);
+   if (ret) {
+   printf("USB init failed: %d\n", ret);
+   return CMD_RET_FAILURE;
+   }
+
+   g_dnl_clear_detach();
+   ret = g_dnl_register("usb_dnl_rockusb");
+   if (ret)
+   return CMD_RET_FAILURE;
+
+   if (!g_dnl_board_usb_cable_connected()) {
+   puts("\rUSB cable not detected, Command exit.\n");
+   ret = CMD_RET_FAILURE;
+   goto exit;
+   }
+
+   while (1) {
+   if (g_dnl_detach())
+   break;
+   if (ctrlc())
+   break;
+   usb_gadget_handle_interrupts(controller_index);
+   }
+   ret = CMD_RET_SUCCESS;
+
+exit:
+   g_dnl_unregister();
+   g_dnl_clear_detach();
+   board_usb_cleanup(controller_index, USB_INIT_DEVICE);
+
+   return ret;
+}
+
+U_BOOT_CMD(rockusb, 4, 1, do_rockusb,
+  "use the rockusb protocol",
+  "e.g. rockusb 0 mmc 0\n"
+);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH V11 0/4] introduce Rockchip rockusb

2017-11-30 Thread Eddie Cai
Changes in v11:
-fix check patch error
-add maintainer

Changes in v10:
-rebase to latest mainline U-Boot
-fix build error

Changes in v9:
-rebase to the latest mainline
-fix compile error

Changes in v8:
-rebase to v2017.09-rc2
-fix compile error

Changes in v7:
-use imply in the Kconfig to enable rockusb

Changes in v6:
-enable rockusb in defconfig
-move some data to f_rockusb structure

Changes in v5:
-fix build error when build other board
-fix checkpatch error

Changes in v4:
-use enum instead of macro define
-move some structure define and macro to f_rockusb.h
-add some function comment as Simon required
-address other comment from Simon
-fix build error as Lukasz point out

Changes in v3:
-switch back to use g_dnl code
-address comment from Lukasz and Simon
-fix checkpatch error

Changes in v2:
-switch to use usb masstorage framework
-add readme for rockusb

Eddie Cai (4):
  usb: rockchip: add the rockusb gadget
  usb: rockchip: add rockusb command
  rockchip:usb: add a simple readme for rockusb
  rockchip: rk3288: enable rockusb support on rk3288 based device

 MAINTAINERS|   7 +
 arch/arm/include/asm/arch-rockchip/f_rockusb.h | 132 +
 arch/arm/mach-rockchip/Kconfig |   2 +
 cmd/Kconfig|   8 +
 cmd/Makefile   |   1 +
 cmd/rockusb.c  |  74 +++
 configs/chromebit_mickey_defconfig |   7 +
 configs/chromebook_jerry_defconfig |   7 +
 configs/chromebook_minnie_defconfig|   7 +
 configs/evb-rk3288_defconfig   |   9 +
 configs/fennec-rk3288_defconfig|   5 +
 configs/firefly-rk3288_defconfig   |   7 +
 configs/miqi-rk3288_defconfig  |   5 +
 configs/phycore-rk3288_defconfig   |   6 +
 configs/popmetal-rk3288_defconfig  |   5 +
 configs/rock2_defconfig|   8 +
 configs/tinker-rk3288_defconfig|   5 +
 configs/vyasa-rk3288_defconfig |  25 +
 doc/README.rockusb |  51 ++
 drivers/usb/gadget/Kconfig |   8 +
 drivers/usb/gadget/Makefile|   1 +
 drivers/usb/gadget/f_rockusb.c | 697 +
 22 files changed, 1077 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rockchip/f_rockusb.h
 create mode 100644 cmd/rockusb.c
 create mode 100644 doc/README.rockusb
 create mode 100644 drivers/usb/gadget/f_rockusb.c

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] net: sh-eth: Add to Kconfig and convert

2017-11-30 Thread Nobuhiro Iwamatsu
This adds SH_ETHER to drivers/net/Kconfig and convert to Kconfig.

Signed-off-by: Nobuhiro Iwamatsu 
---
 configs/ap_sh4a_4a_defconfig   | 3 ++-
 configs/armadillo-800eva_defconfig | 3 ++-
 configs/ecovec_defconfig   | 3 ++-
 configs/espt_defconfig | 3 ++-
 configs/gose_defconfig | 3 ++-
 configs/koelsch_defconfig  | 3 ++-
 configs/lager_defconfig| 3 ++-
 configs/porter_defconfig   | 3 ++-
 configs/r0p7734_defconfig  | 3 ++-
 configs/sh7752evb_defconfig| 3 ++-
 configs/sh7753evb_defconfig| 3 ++-
 configs/sh7757lcr_defconfig| 3 ++-
 configs/sh7763rdp_defconfig| 3 ++-
 configs/silk_defconfig | 3 ++-
 configs/stout_defconfig| 3 ++-
 drivers/net/Kconfig| 6 ++
 include/configs/alt.h  | 1 -
 include/configs/ap_sh4a_4a.h   | 1 -
 include/configs/armadillo-800eva.h | 1 -
 include/configs/ecovec.h   | 1 -
 include/configs/espt.h | 1 -
 include/configs/gose.h | 1 -
 include/configs/koelsch.h  | 1 -
 include/configs/lager.h| 1 -
 include/configs/porter.h   | 1 -
 include/configs/r0p7734.h  | 1 -
 include/configs/sh7752evb.h| 1 -
 include/configs/sh7753evb.h| 1 -
 include/configs/sh7757lcr.h| 1 -
 include/configs/sh7763rdp.h| 1 -
 include/configs/silk.h | 1 -
 include/configs/stout.h| 1 -
 scripts/config_whitelist.txt   | 1 -
 33 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/configs/ap_sh4a_4a_defconfig b/configs/ap_sh4a_4a_defconfig
index ef14121273..976680aa51 100644
--- a/configs/ap_sh4a_4a_defconfig
+++ b/configs/ap_sh4a_4a_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_MTD_NOR_FLASH=y
-CONFIG_PHYLIB=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/armadillo-800eva_defconfig 
b/configs/armadillo-800eva_defconfig
index d9a5169905..14d6c843ae 100644
--- a/configs/armadillo-800eva_defconfig
+++ b/configs/armadillo-800eva_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_ENV_IS_IN_FLASH=y
 # CONFIG_MMC is not set
-CONFIG_PHYLIB=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/ecovec_defconfig b/configs/ecovec_defconfig
index 5d65e9dc30..5c6c55fdb8 100644
--- a/configs/ecovec_defconfig
+++ b/configs/ecovec_defconfig
@@ -29,7 +29,8 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_MTD_NOR_FLASH=y
-CONFIG_PHYLIB=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/espt_defconfig b/configs/espt_defconfig
index 520bc9fa53..32ba9d0f6e 100644
--- a/configs/espt_defconfig
+++ b/configs/espt_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_MTD_NOR_FLASH=y
-CONFIG_PHYLIB=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USE_PRIVATE_LIBGCC=y
diff --git a/configs/gose_defconfig b/configs/gose_defconfig
index bc3299033a..5f10d9a304 100644
--- a/configs/gose_defconfig
+++ b/configs/gose_defconfig
@@ -24,8 +24,9 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_BAUDRATE=38400
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USB=y
diff --git a/configs/koelsch_defconfig b/configs/koelsch_defconfig
index 5def33bac3..acc7289139 100644
--- a/configs/koelsch_defconfig
+++ b/configs/koelsch_defconfig
@@ -24,8 +24,9 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_BAUDRATE=38400
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USB=y
diff --git a/configs/lager_defconfig b/configs/lager_defconfig
index 5072045e89..c0778ee824 100644
--- a/configs/lager_defconfig
+++ b/configs/lager_defconfig
@@ -24,8 +24,9 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_BAUDRATE=38400
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USB=y
diff --git a/configs/porter_defconfig b/configs/porter_defconfig
index ac36dca972..7374a30ed2 100644
--- a/configs/porter_defconfig
+++ b/configs/porter_defconfig
@@ -24,8 +24,9 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
+CONFIG_NETDEVICES=y
+CONFIG_SH_ETHER=y
 CONFIG_BAUDRATE=38400
 CONFIG_SCIF_CONSOLE=y
 CONFIG_USB=y
diff --git a/configs/r0p7734_defconfig b/configs/r0p7734_defconfig
index e0b19bbb7f..342365d8c5 100644
--- a/configs/r0p7734_defconfig
+++ b/configs/r0p773

Re: [U-Boot] [PATCH 2/2] armv8: ls1043a: Discard the needless cpu nodes

2017-11-30 Thread Wenbin Song
Hi York, 
Yes, you are right. 
I have tested it on others SoCs (LS1043a/LS1023a, LS2088a/LS2048a).  It works 
fine.

So, I will remove the config and the #if condition.

Thank you and Prabhakar for the advice.

Best Regards
Wenbin Song

 

-Original Message-
From: York Sun 
Sent: Friday, December 01, 2017 1:41 AM
To: Wenbin Song ; Prabhakar Kushwaha 
; Ran Wang ; Mingkai Hu 
; u-boot@lists.denx.de
Subject: Re: [PATCH 2/2] armv8: ls1043a: Discard the needless cpu nodes

On 11/29/2017 07:16 PM, Wenbin song wrote:
> Using "cpu_pos_mask()" function to detect the real online cpus, and 
> discard the needless cpu nodes on kernel dft.
> 
> Signed-off-by: Wenbin Song 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/Kconfig |  4 
>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c   | 32 
> +++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
> b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> index 47145a2432..971a98c6cc 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> @@ -176,6 +176,10 @@ config HAS_FEATURE_ENHANCED_MSI
>   bool
>   default y if ARCH_LS1043A
>  
> +config DISCARD_OFFLINE_CPU_NODES
> + bool
> + default y if ARCH_LS1043A
> +
>  menu "Layerscape PPA"
>  config FSL_LS_PPA
>   bool "FSL Layerscape PPA firmware support"
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
> b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> index 33f3e64848..241f0abe18 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> @@ -44,6 +44,38 @@ void ft_fixup_cpu(void *blob)
>   int addr_cells;
>   u64 val, core_id;
>   size_t *boot_code_size = &(__secondary_boot_code_size);
> +
> +#if defined(CONFIG_DISCARD_OFFLINE_CPU_NODES)
> + u32 mask = cpu_pos_mask();
> + int off_prev = -1;
> + int pos;
> +
> + off = fdt_path_offset(blob, "/cpus");
> + if (off < 0) {
> + puts("couldn't find /cpus node\n");
> + return;
> + }
> +
> + fdt_support_default_count_cells(blob, off, &addr_cells, NULL);
> +
> + off = fdt_node_offset_by_prop_value(blob, off_prev, "device_type",
> + "cpu", 4);
> + while (off != -FDT_ERR_NOTFOUND) {
> + reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
> + if (reg) {
> + core_id = fdt_read_number(reg, addr_cells);
> + pos = ((core_id & 0xff00) >> 5) + (core_id & 0xff);
> + if (!test_bit(pos, &mask)) {
> + fdt_del_node(blob, off);
> + off = off_prev;
> + }
> + }
> + off_prev = off;
> + off = fdt_node_offset_by_prop_value(blob, off_prev,
> + "device_type", "cpu", 4);
> + }
> +#endif
> +
>  #if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && \
>   defined(CONFIG_SEC_FIRMWARE_ARMV8_PSCI)
>   int node;
> 

Wenbin,

Using topology registers to identify the existence of cores is correct.
Do you need the new config option to gate the code? It is a correct operation 
for all SoCs, isn't it?

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [V2 2/2] armv8: ls1043a: Discard the needless cpu nodes

2017-11-30 Thread Wenbin song
Using "cpu_pos_mask()" function to detect the real online cpus,
and discard the needless cpu nodes on kernel dts.

Signed-off-by: Wenbin Song 
---
Changes for v1:
Remove the config option.
Use id_to_core() funcation to find the position of core.
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 3c32c0f860..0cada6abe4 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -42,6 +42,33 @@ void ft_fixup_cpu(void *blob)
int addr_cells;
u64 val, core_id;
size_t *boot_code_size = &(__secondary_boot_code_size);
+   u32 mask = cpu_pos_mask();
+   int off_prev = -1;
+
+   off = fdt_path_offset(blob, "/cpus");
+   if (off < 0) {
+   puts("couldn't find /cpus node\n");
+   return;
+   }
+
+   fdt_support_default_count_cells(blob, off, &addr_cells, NULL);
+
+   off = fdt_node_offset_by_prop_value(blob, off_prev, "device_type",
+   "cpu", 4);
+   while (off != -FDT_ERR_NOTFOUND) {
+   reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
+   if (reg) {
+   core_id = fdt_read_number(reg, addr_cells);
+   if (!test_bit(id_to_core(core_id), &mask)) {
+   fdt_del_node(blob, off);
+   off = off_prev;
+   }
+   }
+   off_prev = off;
+   off = fdt_node_offset_by_prop_value(blob, off_prev,
+   "device_type", "cpu", 4);
+   }
+
 #if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && \
defined(CONFIG_SEC_FIRMWARE_ARMV8_PSCI)
int node;
-- 
2.14.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [V2 1/2] armv8: ls1043a: modify the detecting way to cover all variants

2017-11-30 Thread Wenbin song
There are many variants for ls1043a. Modify the detecting way to
make that the below fixup apply to all variants of ls1043a.
- Fix GIC offset for rev1.1
- Fix msi node for rev1.1
- erratum_a010151

Signed-off-by: Wenbin Song 
---
Changes for V1:
None.
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c| 4 ++--
 arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S   | 5 ++---
 arch/arm/include/asm/arch-fsl-layerscape/soc.h | 3 +++
 drivers/usb/common/fsl-errata.c| 7 +--
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index cae59da803..3c32c0f860 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -145,7 +145,7 @@ static void fdt_fixup_gic(void *blob)
 
val = gur_in32(&gur->svr);
 
-   if (SVR_SOC_VER(val) != SVR_LS1043A) {
+   if (!IS_SVR_DEV(val, SVR_DEV_LS1043A)) {
align_64k = 1;
} else if (SVR_REV(val) != REV1_0) {
val = scfg_in32(&scfg->gic_align) & (0x01 << GIC_ADDR_BIT);
@@ -327,7 +327,7 @@ static void fdt_fixup_msi(void *blob)
 
rev = gur_in32(&gur->svr);
 
-   if (SVR_SOC_VER(rev) != SVR_LS1043A)
+   if (!IS_SVR_DEV(rev, SVR_DEV_LS1043A))
return;
 
rev = SVR_REV(rev);
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S 
b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
index fa93096c68..54b825a626 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
+++ b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
@@ -37,9 +37,8 @@ ENTRY(get_gic_offset)
ldr x2, =DCFG_CCSR_SVR
ldr w2, [x2]
rev w2, w2
-   mov w3, w2
-   andsw3, w3, #SVR_WO_E << 8
-   mov w4, #SVR_LS1043A << 8
+   lsr w3, w2, #16
+   ldr w4, =SVR_DEV_LS1043A
cmp w3, w4
b.ne1f
andsw2, w2, #0xff
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/soc.h 
b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
index 247f09e0f5..a2a039ec53 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/soc.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/soc.h
@@ -77,6 +77,7 @@ struct cpu_type {
 #define SVR_LS2041A0x870914
 
 #define SVR_DEV_LS2080A0x8701
+#define SVR_DEV_LS1043A0x8792
 
 #define SVR_MAJ(svr)   (((svr) >> 4) & 0xf)
 #define SVR_MIN(svr)   (((svr) >> 0) & 0xf)
@@ -85,6 +86,8 @@ struct cpu_type {
 #define IS_E_PROCESSOR(svr)(!((svr >> 8) & 0x1))
 #define IS_SVR_REV(svr, maj, min) \
((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min)))
+#define IS_SVR_DEV(svr, dev) \
+   (((svr) >> 16) == (dev))
 
 /* ahci port register default value */
 #define AHCI_PORT_PHY_1_CFG0xa003fffe
diff --git a/drivers/usb/common/fsl-errata.c b/drivers/usb/common/fsl-errata.c
index 823beb32f6..c20c9a3567 100644
--- a/drivers/usb/common/fsl-errata.c
+++ b/drivers/usb/common/fsl-errata.c
@@ -198,6 +198,11 @@ bool has_erratum_a010151(void)
u32 svr = get_svr();
u32 soc = SVR_SOC_VER(svr);
 
+#ifdef CONFIG_ARM64
+   if (IS_SVR_DEV(svr, SVR_DEV_LS1043A))
+   return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
+#endif
+
switch (soc) {
 #ifdef CONFIG_ARM64
case SVR_LS2080A:
@@ -209,8 +214,6 @@ bool has_erratum_a010151(void)
case SVR_LS1046A:
case SVR_LS1012A:
return IS_SVR_REV(svr, 1, 0);
-   case SVR_LS1043A:
-   return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
 #endif
 #ifdef CONFIG_ARCH_LS1021A
case SOC_VER_LS1020:
-- 
2.14.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] x86: Add 'imply SCSI' to boards using AHCI_PCI

2017-11-30 Thread Bin Meng
Hi Tuomas,

On Fri, Dec 1, 2017 at 5:35 AM, Tuomas Tynkkynen
 wrote:
> The qemu and coreboot boards have 'imply AHCI_PCI' but no 'imply SCSI',
> i.e. they are enabling the driver for the Serial ATA controller but
> (AFAICT) have no way of accessing those devices from the prompt.
>
> In fact, without this patch I get a silent U-Boot crash when I add a
> SATA device to QEMU with the following options:
>
> -drive if=none,file=mydisk.qcow2,id=root
> -device ich9-ahci,id=ahci
> -device ide-drive,drive=root,bus=ahci.0
>
> With the 'imply SCSI' added, U-Boot doesn't crash and the drive is found
> when 'scsi scan' is run.
>
> Signed-off-by: Tuomas Tynkkynen 
> ---
> Hi Bin, Simon
>
> Does this make sense? I was working on converting drivers/ata to
> Kconfig, which includes CONFIG_SCSI_AHCI (used by x86) but noticed these
> boards that currently have {SCSI=n, AHCI_PCI=y, SCSI_AHCI=y}.

By default QEMU supports the i440FX chipset via '-M pc'. If we want to
use AHCI, '-M q35' should be specified and DTS should be changed to
qemu-x86_q35.dts.
That's why SCSI is not turned on by default.

However when I try to reproduce the crash issue with QEMU, I cannot
reproduce the crash issue after I added CONFIG_SCSI to the
'menuconfig'.
But I did find another dependency problem. If I turned on the
CONFIG_CMD_SCSI first without turning on CONFIG_SCSI, QEMU x86 does
not build.

cmd/built-in.o: In function `do_scsi':
git/u-boot/cmd/scsi.c:38: undefined reference to `scsi_scan'
git/u-boot/cmd/scsi.c:44: undefined reference to `scsi_scan'
Makefile:1255: recipe for target 'u-boot' failed

I believe we should do:

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5a6afab..8218a2c 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1437,6 +1437,7 @@ config CMD_REISER

 config CMD_SCSI
bool "scsi - Access to SCSI devices"
+   depends on SCSI
default y if SCSI
help
  This provides a 'scsi' command which provides access to SCSI (Small

> ---
>  arch/x86/cpu/coreboot/Kconfig | 1 +
>  arch/x86/cpu/qemu/Kconfig | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git arch/x86/cpu/coreboot/Kconfig arch/x86/cpu/coreboot/Kconfig
> index 60eb45f9d0..0e83a43d99 100644
> --- arch/x86/cpu/coreboot/Kconfig
> +++ arch/x86/cpu/coreboot/Kconfig
> @@ -10,6 +10,7 @@ config SYS_COREBOOT
> imply MMC_PCI
> imply MMC_SDHCI
> imply MMC_SDHCI_SDMA
> +   imply SCSI
> imply SPI_FLASH
> imply SYS_NS16550
> imply USB
> diff --git arch/x86/cpu/qemu/Kconfig arch/x86/cpu/qemu/Kconfig
> index 81444f3d9e..a0090281b9 100644
> --- arch/x86/cpu/qemu/Kconfig
> +++ arch/x86/cpu/qemu/Kconfig
> @@ -9,6 +9,7 @@ config QEMU
> select ARCH_EARLY_INIT_R
> imply AHCI_PCI
> imply E1000
> +   imply SCSI
> imply SYS_NS16550
> imply USB
> imply USB_EHCI_HCD
> --

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] cmd: i2c: Fix use sdram sub command with CONFIG_DM_I2C

2017-11-30 Thread Nobuhiro Iwamatsu
sdram sub command of i2c command does not support Drivers Model.
This adds Drivers Model support to sdram sub command.

Signed-off-by: Nobuhiro Iwamatsu 
---
 cmd/i2c.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/cmd/i2c.c b/cmd/i2c.c
index 3dd7c6ba4d..bfddf8be1b 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -1156,7 +1156,10 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int 
argc, char * const argv[])
uintchip;
u_char  data[128];
u_char  cksum;
-   int j;
+   int j, ret;
+#ifdef CONFIG_DM_I2C
+   struct udevice *dev;
+#endif
 
static const char *decode_CAS_DDR2[] = {
" TBD", " 6", " 5", " 4", " 3", " 2", " TBD", " TBD"
@@ -1210,7 +1213,14 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int 
argc, char * const argv[])
 */
chip = simple_strtoul (argv[1], NULL, 16);
 
-   if (i2c_read (chip, 0, 1, data, sizeof (data)) != 0) {
+#ifdef CONFIG_DM_I2C
+   ret = i2c_get_cur_bus_chip(chip, &dev);
+   if (!ret)
+   ret = dm_i2c_read(dev, 0, data, sizeof(data));
+#else
+   ret = i2c_read(chip, 0, 1, data, sizeof(data));
+#endif
+   if (ret) {
puts ("No SDRAM Serial Presence Detect found.\n");
return 1;
}
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] MAINTAINERS: git-mailrc: Update the maintainer for rmobile

2017-11-30 Thread Nobuhiro Iwamatsu
Adding Marek Vasut to MAINTAINERS and git-mailrc for the Renesas ARM rmobile
architecture.

Signed-off-by: Nobuhiro Iwamatsu 
---
 doc/git-mailrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/git-mailrc b/doc/git-mailrc
index 5a365cddd9..f2fc6d4c5e 100644
--- a/doc/git-mailrc
+++ b/doc/git-mailrc
@@ -66,7 +66,7 @@ alias imxuboot, sbabic
 alias kirkwood   uboot, prafulla, luka
 alias omap   ti
 alias pxauboot, marex
-alias rmobileuboot, iwamatsu
+alias rmobileuboot, iwamatsu, marex
 alias s3csamsung
 alias s5pc   samsung
 alias samsunguboot, prom
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] net: sh-eth: Fix misaligned cache operation warning

2017-11-30 Thread Nobuhiro Iwamatsu
When we using network on board using sh-eth, it prints a lot of
"CACHE: Misaligned operation at range" messages.
This commit fixes this problem.

Signed-off-by: Nobuhiro Iwamatsu 
---
 drivers/net/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index cb000dd18e..b7a0f413c6 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -29,7 +29,7 @@
 
 #if defined(CONFIG_SH_ETHER_CACHE_WRITEBACK) && !defined(CONFIG_SYS_DCACHE_OFF)
 #define flush_cache_wback(addr, len)\
-   flush_dcache_range((u32)addr, (u32)(addr + len - 1))
+   flush_dcache_range((u32)addr, (u32)(addr + ALIGN(len, 
CONFIG_SH_ETHER_ALIGNE_SIZE)))
 #else
 #define flush_cache_wback(...)
 #endif
@@ -205,7 +205,7 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
goto err;
}
 
-   flush_cache_wback((u32)port_info->tx_desc_alloc, alloc_desc_size);
+   flush_cache_wback(port_info->tx_desc_alloc, alloc_desc_size);
 
/* Make sure we use a P2 address (non-cacheable) */
port_info->tx_desc_base =
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/3] ARM: rmobile: Move CONFIG_SYS_TEXT_BASE to Kconfig

2017-11-30 Thread Nobuhiro Iwamatsu
Signed-off-by: Nobuhiro Iwamatsu 
---
 v2: no change.

 board/atmark-techno/armadillo-800eva/Kconfig | 2 ++
 board/kmc/kzm9g/Kconfig  | 3 +++
 board/renesas/alt/Kconfig| 4 
 board/renesas/blanche/Kconfig| 4 
 board/renesas/gose/Kconfig   | 4 
 board/renesas/koelsch/Kconfig| 4 
 board/renesas/lager/Kconfig  | 4 
 board/renesas/porter/Kconfig | 4 
 board/renesas/silk/Kconfig   | 4 
 board/renesas/stout/Kconfig  | 4 
 include/configs/alt.h| 6 --
 include/configs/armadillo-800eva.h   | 1 -
 include/configs/blanche.h| 2 --
 include/configs/gose.h   | 6 --
 include/configs/koelsch.h| 6 --
 include/configs/kzm9g.h  | 1 -
 include/configs/lager.h  | 6 --
 include/configs/porter.h | 6 --
 include/configs/silk.h   | 6 --
 include/configs/stout.h  | 6 --
 20 files changed, 37 insertions(+), 46 deletions(-)

diff --git a/board/atmark-techno/armadillo-800eva/Kconfig 
b/board/atmark-techno/armadillo-800eva/Kconfig
index cd37dd4861..68ee5efa93 100644
--- a/board/atmark-techno/armadillo-800eva/Kconfig
+++ b/board/atmark-techno/armadillo-800eva/Kconfig
@@ -9,4 +9,6 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "armadillo-800eva"
 
+config SYS_TEXT_BASE
+   default 0xE80C
 endif
diff --git a/board/kmc/kzm9g/Kconfig b/board/kmc/kzm9g/Kconfig
index f163efd989..7d7e6ac244 100644
--- a/board/kmc/kzm9g/Kconfig
+++ b/board/kmc/kzm9g/Kconfig
@@ -9,4 +9,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "kzm9g"
 
+config SYS_TEXT_BASE
+   default 0x
+
 endif
diff --git a/board/renesas/alt/Kconfig b/board/renesas/alt/Kconfig
index 39d53c185b..a7ed87ecf0 100644
--- a/board/renesas/alt/Kconfig
+++ b/board/renesas/alt/Kconfig
@@ -9,6 +9,10 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "alt"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 config R8A7794_ETHERNET_B
bool "Use ethernet B function"
depends on TARGET_ALT
diff --git a/board/renesas/blanche/Kconfig b/board/renesas/blanche/Kconfig
index ac4730a62f..ed72638870 100644
--- a/board/renesas/blanche/Kconfig
+++ b/board/renesas/blanche/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "blanche"
 
+config SYS_TEXT_BASE
+   default 0x if MTD_NOR_FLASH
+   default 0x4000
+
 endif
diff --git a/board/renesas/gose/Kconfig b/board/renesas/gose/Kconfig
index 930a44559e..5111507dbd 100644
--- a/board/renesas/gose/Kconfig
+++ b/board/renesas/gose/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "gose"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/koelsch/Kconfig b/board/renesas/koelsch/Kconfig
index 6475f02b66..503da62284 100644
--- a/board/renesas/koelsch/Kconfig
+++ b/board/renesas/koelsch/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "koelsch"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/lager/Kconfig b/board/renesas/lager/Kconfig
index e990c2019c..0a5e86ded6 100644
--- a/board/renesas/lager/Kconfig
+++ b/board/renesas/lager/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "lager"
 
+config SYS_TEXT_BASE
+   default 0xB000 if RMOBILE_EXTRAM_BOOT
+   default 0xE808
+
 endif
diff --git a/board/renesas/porter/Kconfig b/board/renesas/porter/Kconfig
index a6f621b73f..b9ed2f7308 100644
--- a/board/renesas/porter/Kconfig
+++ b/board/renesas/porter/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "porter"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/silk/Kconfig b/board/renesas/silk/Kconfig
index 07aee0e50f..56b1faa742 100644
--- a/board/renesas/silk/Kconfig
+++ b/board/renesas/silk/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "silk"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/stout/Kconfig b/board/renesas/stout/Kconfig
index cbbc6dd9e4..06a0d26a2d 100644
--- a/board/renesas/stout/Kconfig
+++ b/board/renesas/stout/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "stout"
 
+config SYS_TEXT_BASE
+   default 0xB000 if RMOBILE_EXTRAM_BOOT
+   default 0xE808
+
 endif
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 4

[U-Boot] [PATCH v2 3/3] ARM: rmobile: Move config of SoCs to Kconfig

2017-11-30 Thread Nobuhiro Iwamatsu
Signed-off-by: Nobuhiro Iwamatsu 
---
 v2: no change.

 arch/arm/mach-rmobile/Kconfig.32   | 31 +++
 include/configs/alt.h  |  1 -
 include/configs/armadillo-800eva.h |  1 -
 include/configs/gose.h |  1 -
 include/configs/koelsch.h  |  1 -
 include/configs/kzm9g.h|  1 -
 include/configs/lager.h|  1 -
 include/configs/porter.h   |  1 -
 include/configs/silk.h |  1 -
 include/configs/stout.h|  1 -
 scripts/config_whitelist.txt   |  7 ---
 11 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-rmobile/Kconfig.32 b/arch/arm/mach-rmobile/Kconfig.32
index 49d6206ac2..2b50163783 100644
--- a/arch/arm/mach-rmobile/Kconfig.32
+++ b/arch/arm/mach-rmobile/Kconfig.32
@@ -1,52 +1,83 @@
 if RCAR_32
 
+config R8A7740
+   bool
+
+config R8A7790
+   bool
+
+config R8A7791
+   bool
+
+config R8A7792
+   bool
+
+config R8A7793
+   bool
+
+config R8A7794
+   bool
+
+config SH73A0
+   bool
+
 choice
prompt "Renesas ARM SoCs board select"
optional
 
 config TARGET_ARMADILLO_800EVA
bool "armadillo 800 eva board"
+   select R8A7740
 
 config TARGET_BLANCHE
bool "Blanche board"
+   select R8A7792
select DM
select DM_SERIAL
 
 config TARGET_GOSE
bool "Gose board"
+   select R8A7793
select DM
select DM_SERIAL
 
 config TARGET_KOELSCH
bool "Koelsch board"
+   select R8A7791
select DM
select DM_SERIAL
 
 config TARGET_LAGER
bool "Lager board"
+   select R8A7790
select DM
select DM_SERIAL
 
 config TARGET_KZM9G
bool "KZM9D board"
+   select SH73A0
 
 config TARGET_ALT
bool "Alt board"
+   select R8A7794
select DM
select DM_SERIAL
 
 config TARGET_SILK
bool "Silk board"
+   select R8A7794
select DM
select DM_SERIAL
 
 config TARGET_PORTER
bool "Porter board"
+   select R8A7791
select DM
select DM_SERIAL
 
 config TARGET_STOUT
bool "Stout board"
+   select R8A7790
select DM
select DM_SERIAL
 
diff --git a/include/configs/alt.h b/include/configs/alt.h
index d1bb984984..788368b959 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -11,7 +11,6 @@
 #define __ALT_H
 
 #undef DEBUG
-#define CONFIG_R8A7794
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/armadillo-800eva.h 
b/include/configs/armadillo-800eva.h
index ca058bf1a1..4686f879bf 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -10,7 +10,6 @@
 #define __ARMADILLO_800EVA_H
 
 #undef DEBUG
-#define CONFIG_R8A7740
 #define CONFIG_SH_GPIO_PFC
 
 #include 
diff --git a/include/configs/gose.h b/include/configs/gose.h
index 2f171d358b..4abd9777f9 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -10,7 +10,6 @@
 #define __GOSE_H
 
 #undef DEBUG
-#define CONFIG_R8A7793
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 89680b7c8d..d8a670c48d 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -10,7 +10,6 @@
 #define __KOELSCH_H
 
 #undef DEBUG
-#define CONFIG_R8A7791
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index 25e2f79c92..aecea73a00 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -10,7 +10,6 @@
 
 #undef DEBUG
 
-#define CONFIG_SH73A0
 #define CONFIG_KZM_A9_GT
 #define CONFIG_MACH_TYPE MACH_TYPE_KZM9G
 
diff --git a/include/configs/lager.h b/include/configs/lager.h
index f7ea95fce6..cb4c38027c 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -11,7 +11,6 @@
 #define __LAGER_H
 
 #undef DEBUG
-#define CONFIG_R8A7790
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/porter.h b/include/configs/porter.h
index a966cf3c76..52b27c7537 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -12,7 +12,6 @@
 #define __PORTER_H
 
 #undef DEBUG
-#define CONFIG_R8A7791
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/silk.h b/include/configs/silk.h
index 18c53e6b8c..c04f743520 100644
--- a/include/configs/silk.h
+++ b/include/configs/silk.h
@@ -12,7 +12,6 @@
 #define __SILK_H
 
 #undef DEBUG
-#define CONFIG_R8A7794
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/stout.h b/include/configs/stout.h
index 92b9f85f92..dadee2d58c 100644
--- a/include/configs/stout.h
+++ b/include/configs/stout.h
@@ -13,7 +13,6 @@
 #define __STOUT_H
 
 #undef DEBUG
-#define CONFIG_R8A7790
 
 #include "rcar-gen2-common.h"
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 1a9403a8d1..d594c0e137 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1784,12 +1784,6 @@ CONFIG_R8A66597_BASE_ADDR
 CONFIG_R8A66597_ENDIAN
 

[U-Boot] [PATCH v2 1/3] ARM: rmobile: Use CONFIG_SYS_BOARD instaed of CONFIG_ARCH_RMOBILE_BOARD_STRING

2017-11-30 Thread Nobuhiro Iwamatsu
CONFIG_SYS_BOARD is provided by Kconfig, this has the same value as
CONFIG_ARCH_RMOBILE_BOARD_STRING provided in .h.
This switches from CONFIG_ARCH_RMOBILE_BOARD_STRING to CONFIG_SYS_BOARD.

Signed-off-by: Nobuhiro Iwamatsu 
---
 v2: rebase.

 board/atmark-techno/armadillo-800eva/armadillo-800eva.c | 2 +-
 board/kmc/kzm9g/kzm9g.c | 2 +-
 board/renesas/alt/alt.c | 2 +-
 board/renesas/blanche/blanche.c | 2 +-
 board/renesas/gose/gose.c   | 2 +-
 board/renesas/koelsch/koelsch.c | 2 +-
 board/renesas/lager/lager.c | 2 +-
 board/renesas/porter/porter.c   | 2 +-
 board/renesas/silk/silk.c   | 2 +-
 board/renesas/stout/stout.c | 2 +-
 include/configs/alt.h   | 1 -
 include/configs/armadillo-800eva.h  | 1 -
 include/configs/blanche.h   | 1 -
 include/configs/gose.h  | 1 -
 include/configs/koelsch.h   | 1 -
 include/configs/kzm9g.h | 1 -
 include/configs/lager.h | 1 -
 include/configs/porter.h| 1 -
 include/configs/silk.h  | 1 -
 include/configs/stout.h | 1 -
 scripts/config_whitelist.txt| 1 -
 21 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/board/atmark-techno/armadillo-800eva/armadillo-800eva.c 
b/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
index abe69abcc8..dcb5c78f55 100644
--- a/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
+++ b/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
@@ -315,7 +315,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 int board_late_init(void)
diff --git a/board/kmc/kzm9g/kzm9g.c b/board/kmc/kzm9g/kzm9g.c
index a284721cfd..679dff7084 100644
--- a/board/kmc/kzm9g/kzm9g.c
+++ b/board/kmc/kzm9g/kzm9g.c
@@ -349,7 +349,7 @@ int board_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 int dram_init(void)
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index 0bf8160f1f..a4e3cccf78 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -217,7 +217,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index 574dcda01b..434544d90f 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -468,7 +468,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index 54e126985b..465be87c01 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -201,7 +201,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index 8fa648e40a..45a422044b 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -222,7 +222,7 @@ int board_phy_config(struct phy_device *phydev)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index 562be04760..04343a9be6 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -235,7 +235,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 5b1a167906..711baf04c5 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -203,7 +203,7 @@ int board_phy_config(struct phy_device *phydev)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD,
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
index a8de402d20..30be941a44 100644
--- a/board/renesas/silk/silk.c
+++ b/board/renesas/silk/silk.c
@@ -192,7 +192,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_B

Re: [U-Boot] [PATCH 00/23] imx: add i.MX8M support and i.MX8MQ EVK

2017-11-30 Thread Peng Fan
Hi Stefano,

I plan to send out V2 patchset today or tommorw. 

About 
https://patchwork.ozlabs.org/patch/842122/  imx: mx8m: add ddr register 
memory map
https://patchwork.ozlabs.org/patch/842167/   imx: add i.MX8MQ EVK 
support

it is hard for me to convert using structure about the ddr script.
It was released by SoC team, and lots registers there.
For now, even if I struggle to convert to use structure, it will be pain
if SoC team released new script.

So is it possible that ddr_init in spl_dram_init is marked as "TODO" in the 
board patch,
and ddr related part is removed this V2 patchset?

I hope the i.MX8M patchset could be in next release.

Thanks,
Peng.

> -Original Message-
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Peng Fan
> Sent: Wednesday, November 29, 2017 1:31 PM
> To: Stefano Babic ; Fabio Estevam
> 
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH 00/23] imx: add i.MX8M support and i.MX8MQ
> EVK
> 
> Hi Stefano,
> 
> > -Original Message-
> > From: Stefano Babic [mailto:sba...@denx.de]
> > Sent: Tuesday, November 28, 2017 10:46 PM
> > To: Peng Fan ; sba...@denx.de; Fabio Estevam
> > 
> > Cc: u-boot@lists.denx.de; van.free...@gmail.com
> > Subject: Re: [PATCH 00/23] imx: add i.MX8M support and i.MX8MQ EVK
> >
> > Hi Peng,
> >
> > On 28/11/2017 13:31, Peng Fan wrote:
> > > This patchset is to add i.MX8M and i.MX8MQ-EVK support
> > >
> >
> > Thanks for sharing this.
> >
> > > patch: "power: pmic.h: include dm/ofnode.h" and
> > > "power: pmic/regulator allow dm be omited by SPL" is previously
> > > reviewed in mailist to not merged. Pick it up.
> >
> >
> > Ok, I'll merge these two independently from the rest.
> 
> Thanks. I should say if no issue, you may pick it up. Then I'll not include 
> these
> two patches in V2.
> 
> >
> >
> > > The board support is a large patch because of the ddr related code.
> > > If it is not good,
> >
> > You agree, it is not good. Anyway, I think one goal will be to have a
> > platform like we have for i.MX6. Nowadays, it is easy and
> > straightforward to add a new
> > i.MX6 board. I set this goal for i.MX8, too.
> 
> i.MX8M is actually like i.MX6/7, it is different from i.MX8QM and else. You 
> could
> see there is no scu api in this patchset.
> 
> >
> > >please first review/pick-up other patches if they  are ok.
> >
> > I'll do it.
> 
> Thanks,
> Peng.
> 
> >
> > >
> > > Peng Fan (23):
> > >   imx: add i.MX8M into Kconfig
> > >   imx: mx8m: add register definition header file
> > >   imx: mx8m: add pin header file
> > >   imx: mx8m: add clock driver
> > >   imx: add sip function
> > >   imx: boot_mode: add USB_BOOT entry
> > >   imx: cpu: update cpu file to support i.MX8M
> > >   imx: spl: implement spl_boot_device for i.MX8M
> > >   power: pmic.h: include dm/ofnode.h
> > >   imx: add i.MX8MQ SoC Revision and is_mx8m helper
> > >   imx: add pad settings bit definition for i.MX8M
> > >   imx: mx8m: add soc related settings and files
> > >   imx: makefile: compile files for i.MX8M
> > >   misc: ocotp: add i.MX8M support
> > >   mmc: fsl_esdhc: support i.MX8M
> > >   imx: lcdif: include i.MX8M
> > >   gpio: mxc: add i.MX8M support
> > >   imx: mx8m: add ddr register memory map
> > >   net: fec: do not access reserved register for i.MX8M
> > >   net: fec: fix build warnings for 64bits support
> > >   power: pmic/regulator allow dm be omitted by SPL
> > >   imx: imx8mq: add dtsi file
> > >   imx: add i.MX8MQ EVK support
> > >
> > >  arch/arm/Kconfig   |8 +
> > >  arch/arm/Makefile  |4 +-
> > >  arch/arm/dts/Makefile  |2 +
> > >  arch/arm/dts/fsl-imx8-ca53.dtsi|   92 ++
> > >  arch/arm/dts/fsl-imx8mq-evk.dts|  597 ++
> > >  arch/arm/dts/fsl-imx8mq.dtsi   |  961 
> > > 
> > >  arch/arm/include/asm/arch-imx/cpu.h|6 +-
> > >  arch/arm/include/asm/arch-mx8m/clock.h |  864 +++
> > >  arch/arm/include/asm/arch-mx8m/crm_regs.h  |   10 +
> > >  arch/arm/include/asm/arch-mx8m/ddr_memory_map.h|  496
> +
> > >  arch/arm/include/asm/arch-mx8m/gpio.h  |   12 +
> > >  arch/arm/include/asm/arch-mx8m/imx-regs.h  |  298 +
> > >  arch/arm/include/asm/arch-mx8m/mx8mq_pins.h|  623 +++
> > >  arch/arm/include/asm/arch-mx8m/sys_proto.h |   17 +
> > >  arch/arm/include/asm/mach-imx/boot_mode.h  |1 +
> > >  arch/arm/include/asm/mach-imx/iomux-v3.h   |   22 +-
> > >  arch/arm/include/asm/mach-imx/regs-lcdif.h |   11 +-
> > >  arch/arm/include/asm/mach-imx/sys_proto.h  |4 +
> > >  arch/arm/mach-imx/Makefile |   13 +-
> > >  arch/arm/mach-imx/cpu.c|   11 +-
> > >  arch/arm/mach-imx/mx8m/Kconfig |   22 +
> > >  arch/arm/mach-imx/

Re: [U-Boot] [PATCH 1/3] ARM: rmobile: Use CONFIG_SYS_BOARD instaed of CONFIG_ARCH_RMOBILE_BOARD_STRING

2017-11-30 Thread Nobuhiro Iwamatsu
Hi,

2017-12-01 8:06 GMT+09:00 Nobuhiro Iwamatsu :
> CONFIG_SYS_BOARD is provided by Kconfig, this has the same value as
> CONFIG_ARCH_RMOBILE_BOARD_STRING provided in .h.
> This switches from CONFIG_ARCH_RMOBILE_BOARD_STRING to CONFIG_SYS_BOARD.

Sorry, forgot the rebase. Ignore these patches for rmobile.

Best regards,
  Nobuhiro

>
> Signed-off-by: Nobuhiro Iwamatsu 
> ---
>  board/atmark-techno/armadillo-800eva/armadillo-800eva.c | 2 +-
>  board/kmc/kzm9g/kzm9g.c | 2 +-
>  board/renesas/alt/alt.c | 2 +-
>  board/renesas/blanche/blanche.c | 2 +-
>  board/renesas/gose/gose.c   | 2 +-
>  board/renesas/koelsch/koelsch.c | 2 +-
>  board/renesas/lager/lager.c | 2 +-
>  board/renesas/porter/porter.c   | 2 +-
>  board/renesas/salvator-x/salvator-x.c   | 2 +-
>  board/renesas/silk/silk.c   | 2 +-
>  board/renesas/stout/stout.c | 2 +-
>  board/renesas/ulcb/ulcb.c   | 2 +-
>  include/configs/alt.h   | 1 -
>  include/configs/armadillo-800eva.h  | 1 -
>  include/configs/blanche.h   | 1 -
>  include/configs/gose.h  | 1 -
>  include/configs/koelsch.h   | 1 -
>  include/configs/kzm9g.h | 1 -
>  include/configs/lager.h | 1 -
>  include/configs/porter.h| 1 -
>  include/configs/salvator-x.h| 2 --
>  include/configs/silk.h  | 1 -
>  include/configs/stout.h | 1 -
>  include/configs/ulcb.h  | 2 --
>  scripts/config_whitelist.txt| 1 -
>  25 files changed, 12 insertions(+), 27 deletions(-)
>
> diff --git a/board/atmark-techno/armadillo-800eva/armadillo-800eva.c 
> b/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
> index abe69abcc8..dcb5c78f55 100644
> --- a/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
> +++ b/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
> @@ -315,7 +315,7 @@ int dram_init(void)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_ARCH_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  int board_late_init(void)
> diff --git a/board/kmc/kzm9g/kzm9g.c b/board/kmc/kzm9g/kzm9g.c
> index a284721cfd..679dff7084 100644
> --- a/board/kmc/kzm9g/kzm9g.c
> +++ b/board/kmc/kzm9g/kzm9g.c
> @@ -349,7 +349,7 @@ int board_init(void)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_ARCH_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  int dram_init(void)
> diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
> index 0bf8160f1f..a4e3cccf78 100644
> --- a/board/renesas/alt/alt.c
> +++ b/board/renesas/alt/alt.c
> @@ -217,7 +217,7 @@ int dram_init(void)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_ARCH_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  void reset_cpu(ulong addr)
> diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
> index 574dcda01b..434544d90f 100644
> --- a/board/renesas/blanche/blanche.c
> +++ b/board/renesas/blanche/blanche.c
> @@ -468,7 +468,7 @@ int dram_init(void)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  void reset_cpu(ulong addr)
> diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
> index 54e126985b..465be87c01 100644
> --- a/board/renesas/gose/gose.c
> +++ b/board/renesas/gose/gose.c
> @@ -201,7 +201,7 @@ int dram_init(void)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_ARCH_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  void reset_cpu(ulong addr)
> diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
> index 8fa648e40a..45a422044b 100644
> --- a/board/renesas/koelsch/koelsch.c
> +++ b/board/renesas/koelsch/koelsch.c
> @@ -222,7 +222,7 @@ int board_phy_config(struct phy_device *phydev)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_ARCH_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  void reset_cpu(ulong addr)
> diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
> index 562be04760..04343a9be6 100644
> --- a/board/renesas/lager/lager.c
> +++ b/board/renesas/lager/lager.c
> @@ -235,7 +235,7 @@ int dram_init(void)
>  }
>
>  const struct rmobile_sysinfo sysinfo = {
> -   CONFIG_ARCH_RMOBILE_BOARD_STRING
> +   CONFIG_SYS_BOARD
>  };
>
>  void reset_cpu(ulong addr)
> diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
> index 5b1a167906..711baf04c5 10064

[U-Boot] [PATCH] net: sh-eth: Change structure used in read/write function to struct sh_eth_info

2017-11-30 Thread Nobuhiro Iwamatsu
This changes Change structure used in sh_eth_read and sh_eth_write function
from struct sh_eth_dev to struct sh_eth_info.
This is necessary to convert to Drivers model.

Signed-off-by: Nobuhiro Iwamatsu 
---
 drivers/net/sh_eth.c | 119 +--
 drivers/net/sh_eth.h |  13 +++---
 2 files changed, 75 insertions(+), 57 deletions(-)

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index aee2e57e97..cb000dd18e 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -86,8 +86,8 @@ int sh_eth_send(struct eth_device *dev, void *packet, int len)
flush_cache_wback(port_info->tx_desc_cur, sizeof(struct tx_desc_s));
 
/* Restart the transmitter if disabled */
-   if (!(sh_eth_read(eth, EDTRR) & EDTRR_TRNS))
-   sh_eth_write(eth, EDTRR_TRNS, EDTRR);
+   if (!(sh_eth_read(port_info, EDTRR) & EDTRR_TRNS))
+   sh_eth_write(port_info, EDTRR_TRNS, EDTRR);
 
/* Wait until packet is transmitted */
timeout = TIMEOUT_CNT;
@@ -147,24 +147,25 @@ int sh_eth_recv(struct eth_device *dev)
}
 
/* Restart the receiver if disabled */
-   if (!(sh_eth_read(eth, EDRRR) & EDRRR_R))
-   sh_eth_write(eth, EDRRR_R, EDRRR);
+   if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R))
+   sh_eth_write(port_info, EDRRR_R, EDRRR);
 
return len;
 }
 
 static int sh_eth_reset(struct sh_eth_dev *eth)
 {
+   struct sh_eth_info *port_info = ð->port_info[eth->port];
 #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
int ret = 0, i;
 
/* Start e-dmac transmitter and receiver */
-   sh_eth_write(eth, EDSR_ENALL, EDSR);
+   sh_eth_write(port_info, EDSR_ENALL, EDSR);
 
/* Perform a software reset and wait for it to complete */
-   sh_eth_write(eth, EDMR_SRST, EDMR);
+   sh_eth_write(port_info, EDMR_SRST, EDMR);
for (i = 0; i < TIMEOUT_CNT; i++) {
-   if (!(sh_eth_read(eth, EDMR) & EDMR_SRST))
+   if (!(sh_eth_read(port_info, EDMR) & EDMR_SRST))
break;
udelay(1000);
}
@@ -176,9 +177,10 @@ static int sh_eth_reset(struct sh_eth_dev *eth)
 
return ret;
 #else
-   sh_eth_write(eth, sh_eth_read(eth, EDMR) | EDMR_SRST, EDMR);
+   sh_eth_write(port_info, sh_eth_read(port_info, EDMR) | EDMR_SRST, EDMR);
udelay(3000);
-   sh_eth_write(eth, sh_eth_read(eth, EDMR) & ~EDMR_SRST, EDMR);
+   sh_eth_write(port_info,
+sh_eth_read(port_info, EDMR) & ~EDMR_SRST, EDMR);
 
return 0;
 #endif
@@ -226,11 +228,11 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
 * Point the controller to the tx descriptor list. Must use physical
 * addresses
 */
-   sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDLAR);
+   sh_eth_write(port_info, ADDR_TO_PHY(port_info->tx_desc_base), TDLAR);
 #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
-   sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDFAR);
-   sh_eth_write(eth, ADDR_TO_PHY(cur_tx_desc), TDFXR);
-   sh_eth_write(eth, 0x01, TDFFR);/* Last discriptor bit */
+   sh_eth_write(port_info, ADDR_TO_PHY(port_info->tx_desc_base), TDFAR);
+   sh_eth_write(port_info, ADDR_TO_PHY(cur_tx_desc), TDFXR);
+   sh_eth_write(port_info, 0x01, TDFFR);/* Last discriptor bit */
 #endif
 
 err:
@@ -293,11 +295,11 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
cur_rx_desc->rd0 |= RD_RDLE;
 
/* Point the controller to the rx descriptor list */
-   sh_eth_write(eth, ADDR_TO_PHY(port_info->rx_desc_base), RDLAR);
+   sh_eth_write(port_info, ADDR_TO_PHY(port_info->rx_desc_base), RDLAR);
 #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
-   sh_eth_write(eth, ADDR_TO_PHY(port_info->rx_desc_base), RDFAR);
-   sh_eth_write(eth, ADDR_TO_PHY(cur_rx_desc), RDFXR);
-   sh_eth_write(eth, RDFFR_RDLF, RDFFR);
+   sh_eth_write(port_info, ADDR_TO_PHY(port_info->rx_desc_base), RDFAR);
+   sh_eth_write(port_info, ADDR_TO_PHY(cur_rx_desc), RDFXR);
+   sh_eth_write(port_info, RDFFR_RDLF, RDFFR);
 #endif
 
return ret;
@@ -382,45 +384,45 @@ static int sh_eth_config(struct sh_eth_dev *eth)
struct phy_device *phy;
 
/* Configure e-dmac registers */
-   sh_eth_write(eth, (sh_eth_read(eth, EDMR) & ~EMDR_DESC_R) |
+   sh_eth_write(port_info, (sh_eth_read(port_info, EDMR) & ~EMDR_DESC_R) |
(EMDR_DESC | EDMR_EL), EDMR);
 
-   sh_eth_write(eth, 0, EESIPR);
-   sh_eth_write(eth, 0, TRSCER);
-   sh_eth_write(eth, 0, TFTR);
-   sh_eth_write(eth, (FIFO_SIZE_T | FIFO_SIZE_R), FDR);
-   sh_eth_write(eth, RMCR_RST, RMCR);
+   sh_eth_write(port_info, 0, EESIPR);
+   sh_eth_write(port_info, 0, TRSCER);
+   sh_eth_write(port_info, 0, TFTR);
+   sh_eth_write(port_info, (FIFO_SIZE_T | FIFO_SIZE_R), F

[U-Boot] [PATCH] net: sh-eth: Fix coding style checked by checkpatch.pl

2017-11-30 Thread Nobuhiro Iwamatsu
This fixes the chord style checked by checkpatch.pl.
Details of change details are as follows:

 - Fix typo
Change from alligned to aligned.
 - Remove whitespace before ','
 - Add spaces preferred around that '|'
 - Fix missing a blank line after declarations
 - Remove space after a cast declaration
 - Fix format of block comments
 - Add a blank line after function/struct/union/enum declarations

Signed-off-by: Nobuhiro Iwamatsu 
---
 drivers/net/sh_eth.c | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 970d730e56..5c6278069c 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -67,7 +67,7 @@ int sh_eth_send(struct eth_device *dev, void *packet, int len)
 
/* packet must be a 4 byte boundary */
if ((int)packet & 3) {
-   printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n"
+   printf(SHETHER_NAME ": %s: packet not 4 byte aligned\n"
, __func__);
ret = -EFAULT;
goto err;
@@ -222,8 +222,10 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
cur_tx_desc--;
cur_tx_desc->td0 |= TD_TDLE;
 
-   /* Point the controller to the tx descriptor list. Must use physical
-  addresses */
+   /*
+* Point the controller to the tx descriptor list. Must use physical
+* addresses
+*/
sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDLAR);
 #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDFAR);
@@ -237,7 +239,7 @@ err:
 
 static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
 {
-   int port = eth->port, i , ret = 0;
+   int port = eth->port, i, ret = 0;
u32 alloc_desc_size = NUM_RX_DESC * sizeof(struct rx_desc_s);
struct sh_eth_info *port_info = ð->port_info[port];
struct rx_desc_s *cur_rx_desc;
@@ -283,7 +285,7 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
 i < NUM_RX_DESC; cur_rx_desc++, rx_buf += MAX_BUF_SIZE, i++) {
cur_rx_desc->rd0 = RD_RACT;
cur_rx_desc->rd1 = MAX_BUF_SIZE << 16;
-   cur_rx_desc->rd2 = (u32) ADDR_TO_PHY(rx_buf);
+   cur_rx_desc->rd2 = (u32)ADDR_TO_PHY(rx_buf);
}
 
/* Mark the end of the descriptors */
@@ -465,11 +467,14 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
/* Check if full duplex mode is supported by the phy */
if (phy->duplex) {
printf("Full\n");
-   sh_eth_write(eth, val | (ECMR_CHG_DM|ECMR_RE|ECMR_TE|ECMR_DM),
+   sh_eth_write(eth,
+val | (ECMR_CHG_DM | ECMR_RE | ECMR_TE | ECMR_DM),
 ECMR);
} else {
printf("Half\n");
-   sh_eth_write(eth, val | (ECMR_CHG_DM|ECMR_RE|ECMR_TE), ECMR);
+   sh_eth_write(eth,
+val | (ECMR_CHG_DM | ECMR_RE | ECMR_TE),
+ECMR);
}
 
return ret;
@@ -524,6 +529,7 @@ err:
 void sh_eth_halt(struct eth_device *dev)
 {
struct sh_eth_dev *eth = dev->priv;
+
sh_eth_stop(eth);
 }
 
@@ -532,6 +538,7 @@ int sh_eth_initialize(bd_t *bd)
int ret = 0;
struct sh_eth_dev *eth = NULL;
struct eth_device *dev = NULL;
+   struct mii_dev *mdiodev;
 
eth = (struct sh_eth_dev *)malloc(sizeof(struct sh_eth_dev));
if (!eth) {
@@ -566,16 +573,15 @@ int sh_eth_initialize(bd_t *bd)
eth_register(dev);
 
bb_miiphy_buses[0].priv = eth;
-   int retval;
-   struct mii_dev *mdiodev = mdio_alloc();
+   mdiodev = mdio_alloc();
if (!mdiodev)
return -ENOMEM;
strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
mdiodev->read = bb_miiphy_read;
mdiodev->write = bb_miiphy_write;
 
-   retval = mdio_register(mdiodev);
-   if (retval < 0)
+   retl = mdio_register(mdiodev);
+   if (ret < 0)
return retval;
 
if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr))
@@ -670,4 +676,5 @@ struct bb_miiphy_bus bb_miiphy_buses[] = {
.delay  = sh_eth_bb_delay,
}
 };
+
 int bb_miiphy_buses_num = ARRAY_SIZE(bb_miiphy_buses);
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] net: sh-eth: Remove bd_t from sh_eth_config()

2017-11-30 Thread Nobuhiro Iwamatsu
bd_t is not used in sh_eth_config(). This deletes bd_t from sh_eth_config().

Signed-off-by: Nobuhiro Iwamatsu 
---
 drivers/net/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 5c6278069c..aee2e57e97 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -373,7 +373,7 @@ static int sh_eth_phy_config(struct sh_eth_dev *eth)
return ret;
 }
 
-static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
+static int sh_eth_config(struct sh_eth_dev *eth)
 {
int port = eth->port, ret = 0;
u32 val;
@@ -510,7 +510,7 @@ int sh_eth_init(struct eth_device *dev, bd_t *bd)
if (ret)
goto err;
 
-   ret = sh_eth_config(eth, bd);
+   ret = sh_eth_config(eth);
if (ret)
goto err_config;
 
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/3] ARM: rmobile: Move config of SoCs to Kconfig

2017-11-30 Thread Nobuhiro Iwamatsu
Signed-off-by: Nobuhiro Iwamatsu 
---
 arch/arm/mach-rmobile/Kconfig.32   | 31 +++
 include/configs/alt.h  |  1 -
 include/configs/armadillo-800eva.h |  1 -
 include/configs/gose.h |  1 -
 include/configs/koelsch.h  |  1 -
 include/configs/kzm9g.h|  1 -
 include/configs/lager.h|  1 -
 include/configs/porter.h   |  1 -
 include/configs/silk.h |  1 -
 include/configs/stout.h|  1 -
 scripts/config_whitelist.txt   |  7 ---
 11 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-rmobile/Kconfig.32 b/arch/arm/mach-rmobile/Kconfig.32
index 89588aaf72..59844ab071 100644
--- a/arch/arm/mach-rmobile/Kconfig.32
+++ b/arch/arm/mach-rmobile/Kconfig.32
@@ -1,52 +1,83 @@
 if RCAR_32
 
+config R8A7740
+   bool
+
+config R8A7790
+   bool
+
+config R8A7791
+   bool
+
+config R8A7792
+   bool
+
+config R8A7793
+   bool
+
+config R8A7794
+   bool
+
+config SH73A0
+   bool
+
 choice
prompt "Renesus ARM SoCs board select"
optional
 
 config TARGET_ARMADILLO_800EVA
bool "armadillo 800 eva board"
+   select R8A7740
 
 config TARGET_BLANCHE
bool "Blanche board"
+   select R8A7792
select DM
select DM_SERIAL
 
 config TARGET_GOSE
bool "Gose board"
+   select R8A7793
select DM
select DM_SERIAL
 
 config TARGET_KOELSCH
bool "Koelsch board"
+   select R8A7791
select DM
select DM_SERIAL
 
 config TARGET_LAGER
bool "Lager board"
+   select R8A7790
select DM
select DM_SERIAL
 
 config TARGET_KZM9G
bool "KZM9D board"
+   select SH73A0
 
 config TARGET_ALT
bool "Alt board"
+   select R8A7794
select DM
select DM_SERIAL
 
 config TARGET_SILK
bool "Silk board"
+   select R8A7794
select DM
select DM_SERIAL
 
 config TARGET_PORTER
bool "Porter board"
+   select R8A7791
select DM
select DM_SERIAL
 
 config TARGET_STOUT
bool "Stout board"
+   select R8A7790
select DM
select DM_SERIAL
 
diff --git a/include/configs/alt.h b/include/configs/alt.h
index d1bb984984..788368b959 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -11,7 +11,6 @@
 #define __ALT_H
 
 #undef DEBUG
-#define CONFIG_R8A7794
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/armadillo-800eva.h 
b/include/configs/armadillo-800eva.h
index ca058bf1a1..4686f879bf 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -10,7 +10,6 @@
 #define __ARMADILLO_800EVA_H
 
 #undef DEBUG
-#define CONFIG_R8A7740
 #define CONFIG_SH_GPIO_PFC
 
 #include 
diff --git a/include/configs/gose.h b/include/configs/gose.h
index 2f171d358b..4abd9777f9 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -10,7 +10,6 @@
 #define __GOSE_H
 
 #undef DEBUG
-#define CONFIG_R8A7793
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 89680b7c8d..d8a670c48d 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -10,7 +10,6 @@
 #define __KOELSCH_H
 
 #undef DEBUG
-#define CONFIG_R8A7791
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index 25e2f79c92..aecea73a00 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -10,7 +10,6 @@
 
 #undef DEBUG
 
-#define CONFIG_SH73A0
 #define CONFIG_KZM_A9_GT
 #define CONFIG_MACH_TYPE MACH_TYPE_KZM9G
 
diff --git a/include/configs/lager.h b/include/configs/lager.h
index f7ea95fce6..cb4c38027c 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -11,7 +11,6 @@
 #define __LAGER_H
 
 #undef DEBUG
-#define CONFIG_R8A7790
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/porter.h b/include/configs/porter.h
index a966cf3c76..52b27c7537 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -12,7 +12,6 @@
 #define __PORTER_H
 
 #undef DEBUG
-#define CONFIG_R8A7791
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/silk.h b/include/configs/silk.h
index 18c53e6b8c..c04f743520 100644
--- a/include/configs/silk.h
+++ b/include/configs/silk.h
@@ -12,7 +12,6 @@
 #define __SILK_H
 
 #undef DEBUG
-#define CONFIG_R8A7794
 
 #include "rcar-gen2-common.h"
 
diff --git a/include/configs/stout.h b/include/configs/stout.h
index 92b9f85f92..dadee2d58c 100644
--- a/include/configs/stout.h
+++ b/include/configs/stout.h
@@ -13,7 +13,6 @@
 #define __STOUT_H
 
 #undef DEBUG
-#define CONFIG_R8A7790
 
 #include "rcar-gen2-common.h"
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 52e7691c5d..5cd943e394 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1787,12 +1787,6 @@ CONFIG_R8A66597_BASE_ADDR
 CONFIG_R8A66597_ENDIAN
 CONFIG_R8A66597_L

[U-Boot] [PATCH 2/3] ARM: rmobile: Move CONFIG_SYS_TEXT_BASE to Kconfig

2017-11-30 Thread Nobuhiro Iwamatsu
Signed-off-by: Nobuhiro Iwamatsu 
---
 board/atmark-techno/armadillo-800eva/Kconfig | 2 ++
 board/kmc/kzm9g/Kconfig  | 3 +++
 board/renesas/alt/Kconfig| 4 
 board/renesas/blanche/Kconfig| 4 
 board/renesas/gose/Kconfig   | 4 
 board/renesas/koelsch/Kconfig| 4 
 board/renesas/lager/Kconfig  | 4 
 board/renesas/porter/Kconfig | 4 
 board/renesas/silk/Kconfig   | 4 
 board/renesas/stout/Kconfig  | 4 
 include/configs/alt.h| 6 --
 include/configs/armadillo-800eva.h   | 1 -
 include/configs/blanche.h| 2 --
 include/configs/gose.h   | 6 --
 include/configs/koelsch.h| 6 --
 include/configs/kzm9g.h  | 1 -
 include/configs/lager.h  | 6 --
 include/configs/porter.h | 6 --
 include/configs/silk.h   | 6 --
 include/configs/stout.h  | 6 --
 20 files changed, 37 insertions(+), 46 deletions(-)

diff --git a/board/atmark-techno/armadillo-800eva/Kconfig 
b/board/atmark-techno/armadillo-800eva/Kconfig
index cd37dd4861..68ee5efa93 100644
--- a/board/atmark-techno/armadillo-800eva/Kconfig
+++ b/board/atmark-techno/armadillo-800eva/Kconfig
@@ -9,4 +9,6 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "armadillo-800eva"
 
+config SYS_TEXT_BASE
+   default 0xE80C
 endif
diff --git a/board/kmc/kzm9g/Kconfig b/board/kmc/kzm9g/Kconfig
index f163efd989..7d7e6ac244 100644
--- a/board/kmc/kzm9g/Kconfig
+++ b/board/kmc/kzm9g/Kconfig
@@ -9,4 +9,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "kzm9g"
 
+config SYS_TEXT_BASE
+   default 0x
+
 endif
diff --git a/board/renesas/alt/Kconfig b/board/renesas/alt/Kconfig
index 39d53c185b..a7ed87ecf0 100644
--- a/board/renesas/alt/Kconfig
+++ b/board/renesas/alt/Kconfig
@@ -9,6 +9,10 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "alt"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 config R8A7794_ETHERNET_B
bool "Use ethernet B function"
depends on TARGET_ALT
diff --git a/board/renesas/blanche/Kconfig b/board/renesas/blanche/Kconfig
index ac4730a62f..ed72638870 100644
--- a/board/renesas/blanche/Kconfig
+++ b/board/renesas/blanche/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "blanche"
 
+config SYS_TEXT_BASE
+   default 0x if MTD_NOR_FLASH
+   default 0x4000
+
 endif
diff --git a/board/renesas/gose/Kconfig b/board/renesas/gose/Kconfig
index 930a44559e..5111507dbd 100644
--- a/board/renesas/gose/Kconfig
+++ b/board/renesas/gose/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "gose"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/koelsch/Kconfig b/board/renesas/koelsch/Kconfig
index 6475f02b66..503da62284 100644
--- a/board/renesas/koelsch/Kconfig
+++ b/board/renesas/koelsch/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "koelsch"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/lager/Kconfig b/board/renesas/lager/Kconfig
index e990c2019c..0a5e86ded6 100644
--- a/board/renesas/lager/Kconfig
+++ b/board/renesas/lager/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "lager"
 
+config SYS_TEXT_BASE
+   default 0xB000 if RMOBILE_EXTRAM_BOOT
+   default 0xE808
+
 endif
diff --git a/board/renesas/porter/Kconfig b/board/renesas/porter/Kconfig
index a6f621b73f..b9ed2f7308 100644
--- a/board/renesas/porter/Kconfig
+++ b/board/renesas/porter/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "porter"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/silk/Kconfig b/board/renesas/silk/Kconfig
index 07aee0e50f..56b1faa742 100644
--- a/board/renesas/silk/Kconfig
+++ b/board/renesas/silk/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "silk"
 
+config SYS_TEXT_BASE
+   default 0x7000 if RMOBILE_EXTRAM_BOOT
+   default 0xE6304000
+
 endif
diff --git a/board/renesas/stout/Kconfig b/board/renesas/stout/Kconfig
index cbbc6dd9e4..06a0d26a2d 100644
--- a/board/renesas/stout/Kconfig
+++ b/board/renesas/stout/Kconfig
@@ -9,4 +9,8 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "stout"
 
+config SYS_TEXT_BASE
+   default 0xB000 if RMOBILE_EXTRAM_BOOT
+   default 0xE808
+
 endif
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 4021910bb3..d1bb98

[U-Boot] [PATCH 1/3] ARM: rmobile: Use CONFIG_SYS_BOARD instaed of CONFIG_ARCH_RMOBILE_BOARD_STRING

2017-11-30 Thread Nobuhiro Iwamatsu
CONFIG_SYS_BOARD is provided by Kconfig, this has the same value as
CONFIG_ARCH_RMOBILE_BOARD_STRING provided in .h.
This switches from CONFIG_ARCH_RMOBILE_BOARD_STRING to CONFIG_SYS_BOARD.

Signed-off-by: Nobuhiro Iwamatsu 
---
 board/atmark-techno/armadillo-800eva/armadillo-800eva.c | 2 +-
 board/kmc/kzm9g/kzm9g.c | 2 +-
 board/renesas/alt/alt.c | 2 +-
 board/renesas/blanche/blanche.c | 2 +-
 board/renesas/gose/gose.c   | 2 +-
 board/renesas/koelsch/koelsch.c | 2 +-
 board/renesas/lager/lager.c | 2 +-
 board/renesas/porter/porter.c   | 2 +-
 board/renesas/salvator-x/salvator-x.c   | 2 +-
 board/renesas/silk/silk.c   | 2 +-
 board/renesas/stout/stout.c | 2 +-
 board/renesas/ulcb/ulcb.c   | 2 +-
 include/configs/alt.h   | 1 -
 include/configs/armadillo-800eva.h  | 1 -
 include/configs/blanche.h   | 1 -
 include/configs/gose.h  | 1 -
 include/configs/koelsch.h   | 1 -
 include/configs/kzm9g.h | 1 -
 include/configs/lager.h | 1 -
 include/configs/porter.h| 1 -
 include/configs/salvator-x.h| 2 --
 include/configs/silk.h  | 1 -
 include/configs/stout.h | 1 -
 include/configs/ulcb.h  | 2 --
 scripts/config_whitelist.txt| 1 -
 25 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/board/atmark-techno/armadillo-800eva/armadillo-800eva.c 
b/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
index abe69abcc8..dcb5c78f55 100644
--- a/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
+++ b/board/atmark-techno/armadillo-800eva/armadillo-800eva.c
@@ -315,7 +315,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 int board_late_init(void)
diff --git a/board/kmc/kzm9g/kzm9g.c b/board/kmc/kzm9g/kzm9g.c
index a284721cfd..679dff7084 100644
--- a/board/kmc/kzm9g/kzm9g.c
+++ b/board/kmc/kzm9g/kzm9g.c
@@ -349,7 +349,7 @@ int board_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 int dram_init(void)
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index 0bf8160f1f..a4e3cccf78 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -217,7 +217,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index 574dcda01b..434544d90f 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -468,7 +468,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index 54e126985b..465be87c01 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -201,7 +201,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index 8fa648e40a..45a422044b 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -222,7 +222,7 @@ int board_phy_config(struct phy_device *phydev)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index 562be04760..04343a9be6 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -235,7 +235,7 @@ int dram_init(void)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 5b1a167906..711baf04c5 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -203,7 +203,7 @@ int board_phy_config(struct phy_device *phydev)
 }
 
 const struct rmobile_sysinfo sysinfo = {
-   CONFIG_ARCH_RMOBILE_BOARD_STRING
+   CONFIG_SYS_BOARD,
 };
 
 void reset_cpu(ulong addr)
diff --git a/board/renesas/salvator-x/salvator-x.c 
b/board/renesas/salva

Re: [U-Boot] [U-Boot, v2, 1/2] rockchip: rk3399-puma: add code to allow forcing a power-on reset

2017-11-30 Thread Philipp Tomsich
> The reset circuitry in the RK3399 only resets 'almost all logic' when
> a software reset is performed.  To make our software maintenance
> easier in the future, we want to have the option (controlled by a DTS
> property) to force all reset causes other than a power-on reset to
> trigger a power-on reset via a GPIO trigger.
> 
> This adds the necessary support to the rk3399-puma (i.e. RK3399-Q7)
> board-support and the documentation for the new property
> (sysreset-gpio) within the /config-node.
> 
> Signed-off-by: Philipp Tomsich 
> Tested-by: Klaus Goger 
> Reviewed-by: Simon Glass 
> ---
> 
> Changes in v2:
> - updated for review comments (i.e. simplified dm_gpio_is_valid
>   check)
> 
>  board/theobroma-systems/puma_rk3399/puma-rk3399.c | 44 
> +++
>  doc/device-tree-bindings/config.txt   |  6 
>  2 files changed, 50 insertions(+)
> 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 2/2] rockchip: dts: rk3399-puma: add /config/sysreset-gpio property

2017-11-30 Thread Philipp Tomsich
> On the RK3399-Q7, we want to trigger a full platform reset (so the
> various software stacks supported don't have to deal with the same
> complexities over and over again) in case that anything other than a
> power-on reset occurred.
> 
> To do so, this defines the /config/sysreset-gpio property and has it
> point to a GPIO that will perform a power-on reset of the entire
> platform.
> 
> Signed-off-by: Philipp Tomsich 
> Tested-by: Klaus Goger 
> ---
> 
> Changes in v2: None
> 
>  arch/arm/dts/rk3399-puma.dtsi | 5 +
>  1 file changed, 5 insertions(+)
> 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/4] ARM: imx: cm-fx6: reinstate USB support by syncing the devicetree with Linux

2017-11-30 Thread christopher.spinrath
From: Christopher Spinrath 

Commit 5248930ebf48 ("dm: imx: cm_fx6: Enable more driver model support")
enabled driver model support for USB, thereby effectively removing USB
support because the cm_fx6 devicetree in the U-Boot does *not* enable the
USB nodes.

Reinstate the USB support by syncing the devicetree with Linux whose
devicetree enables the USB nodes properly.

More precisely, use the devicetree found in Linux v4.15-rc1 with the
following two changes:
  1) Remove the audio mux; the required dt-bindings header is not
 present in the U-Boot.
  2) Keep the usdhc3 MMC controller node currently present in the
 U-Boot's devicetree to retain the ability to boot from MMC.

Fixes: 5248930ebf48 ("dm: imx: cm_fx6: Enable more driver model support")
Signed-off-by: Christopher Spinrath 
---
 arch/arm/dts/imx6q-cm-fx6.dts | 396 --
 1 file changed, 342 insertions(+), 54 deletions(-)

diff --git a/arch/arm/dts/imx6q-cm-fx6.dts b/arch/arm/dts/imx6q-cm-fx6.dts
index 4f1fced40e..1f574c5eb5 100644
--- a/arch/arm/dts/imx6q-cm-fx6.dts
+++ b/arch/arm/dts/imx6q-cm-fx6.dts
@@ -3,15 +3,46 @@
  *
  * Author: Valentin Raevsky 
  *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
  *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
+#include 
 #include "imx6q.dtsi"
 
 / {
@@ -31,6 +62,118 @@
linux,default-trigger = "heartbeat";
};
};
+
+   awnh387_pwrseq: pwrseq {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_pwrseq>;
+   compatible = "mmc-pwrseq-sd8787";
+   powerdown-gpios = <&gpio7 12 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <&gpio6 16 GPIO_ACTIVE_HIGH>;
+   };
+
+   reg_pcie_power_on_gpio: regulator-pcie-power-on-gpio {
+   compatible = "regulator-fixed";
+   regulator-name = "regulator-pcie-power-on-gpio";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   gpio = <&gpio2 24 GPIO_ACTIVE_LOW>;
+   };
+
+   reg_usb_h1_vbus: usb_h1_vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usb_h1_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   gpio = <&gpio7 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   reg_usb_otg_vbus: usb_otg_vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usb_otg_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   sound-analog {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "On-board

[U-Boot] [PATCH 4/4] ARM: imx: cm_fx6: remove esdhc init code from board file

2017-11-30 Thread christopher.spinrath
From: Christopher Spinrath 

Commit 5248930ebf48 ("dm: imx: cm_fx6: Enable more driver model support")
enabled driver model support for MMC. Remove the old mmc init code, which
is no longer used, from the board file.

Signed-off-by: Christopher Spinrath 
---
 board/compulab/cm_fx6/cm_fx6.c | 29 -
 1 file changed, 29 deletions(-)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 81438cd28c..620c3f2d0d 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -506,35 +506,6 @@ static void cm_fx6_setup_gpmi_nand(void)
 static void cm_fx6_setup_gpmi_nand(void) {}
 #endif
 
-#ifdef CONFIG_FSL_ESDHC
-static struct fsl_esdhc_cfg usdhc_cfg[3] = {
-   {USDHC1_BASE_ADDR},
-   {USDHC2_BASE_ADDR},
-   {USDHC3_BASE_ADDR},
-};
-
-static enum mxc_clock usdhc_clk[3] = {
-   MXC_ESDHC_CLK,
-   MXC_ESDHC2_CLK,
-   MXC_ESDHC3_CLK,
-};
-
-int board_mmc_init(bd_t *bis)
-{
-   int i;
-
-   cm_fx6_set_usdhc_iomux();
-   for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
-   usdhc_cfg[i].sdhc_clk = mxc_get_clock(usdhc_clk[i]);
-   usdhc_cfg[i].max_bus_width = 4;
-   fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
-   enable_usdhc_clk(1, i);
-   }
-
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_MXC_SPI
 int cm_fx6_setup_ecspi(void)
 {
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/4] ARM: imx: cm_fx6: remove sata init code from board file

2017-11-30 Thread christopher.spinrath
From: Christopher Spinrath 

Commit 5248930ebf48 ("dm: imx: cm_fx6: Enable more driver model support")
enabled driver model support for AHCI. Remove the old, now unused, sata
init code from the board file.

Signed-off-by: Christopher Spinrath 
---
 board/compulab/cm_fx6/cm_fx6.c | 42 --
 1 file changed, 42 deletions(-)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 638e9f393b..81438cd28c 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -210,48 +210,6 @@ static int cm_fx6_setup_issd(void)
 
 #define CM_FX6_SATA_INIT_RETRIES   10
 
-# if !CONFIG_IS_ENABLED(AHCI)
-int sata_initialize(void)
-{
-   int err, i;
-
-   /* Make sure this gpio has logical 0 value */
-   gpio_direction_output(CM_FX6_SATA_PWLOSS_INT, 0);
-   udelay(100);
-   cm_fx6_sata_power(1);
-
-   for (i = 0; i < CM_FX6_SATA_INIT_RETRIES; i++) {
-   err = setup_sata();
-   if (err) {
-   printf("SATA setup failed: %d\n", err);
-   return err;
-   }
-
-   udelay(100);
-
-   err = __sata_initialize();
-   if (!err)
-   break;
-
-   /* There is no device on the SATA port */
-   if (sata_port_status(0, 0) == 0)
-   break;
-
-   /* There's a device, but link not established. Retry */
-   }
-
-   return err;
-}
-
-int sata_stop(void)
-{
-   __sata_stop();
-   cm_fx6_sata_power(0);
-   mdelay(250);
-
-   return 0;
-}
-# endif
 #else
 static int cm_fx6_setup_issd(void) { return 0; }
 #endif
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/4] ARM: imx: cm_fx6: fix & clean up device model support

2017-11-30 Thread christopher.spinrath
From: Christopher Spinrath 

Hi all,

The primary objective of this series is to reinstate basic USB support for
the cm_fx6 module which was effectively removed by Commit 5248930ebf48
("dm: imx: cm_fx6: Enable more driver model support").

This is achieved by synchronizing the devicetree with Linux (patch 1) and
by enabling device model support for keyboards (patch 2).

There are still some USB limitations/regressions not fixed by this series:

 - The OTG port doesn't work (the controller is enumerated but it looks
   like it is not switched to host mode).

 - I have to use a hub to connect any of my keyboards (USB 1.1 devices?)
   which is odd because there is already an internal hub.

Patches 3 & 4 remove some dead init code in the board file that is no longer
used/required now that device model support for the related devices is enabled.

The USB related init code in the board file is still required (removal of any
part of it renders USB completely unusable, the controllers are not enumerated)
-- is this expected? 

Cheers,
Christopher

Christopher Spinrath (4):
  ARM: imx: cm-fx6: reinstate USB support by syncing the devicetree with
Linux
  ARM: imx: cm_fx6: defconfig: enable CONFIG_DM_KEYBOARD
  ARM: imx: cm_fx6: remove sata init code from board file
  ARM: imx: cm_fx6: remove esdhc init code from board file

 arch/arm/dts/imx6q-cm-fx6.dts  | 396 +++--
 board/compulab/cm_fx6/cm_fx6.c |  71 
 configs/cm_fx6_defconfig   |   1 +
 3 files changed, 343 insertions(+), 125 deletions(-)

-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/4] ARM: imx: cm_fx6: defconfig: enable CONFIG_DM_KEYBOARD

2017-11-30 Thread christopher.spinrath
From: Christopher Spinrath 

Commit 5248930ebf48 ("dm: imx: cm_fx6: Enable more driver model support")
enabled driver model support for USB. But it missed to enable driver
model support for keyboards. As a result, USB keyboards do no longer
work.

Fix this by enabling driver model support for keyboards.

Fixes: 5248930ebf48 ("dm: imx: cm_fx6: Enable more driver model support")
Signed-off-by: Christopher Spinrath 
---
 configs/cm_fx6_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
index 68ae70e554..2fe5d655d6 100644
--- a/configs/cm_fx6_defconfig
+++ b/configs/cm_fx6_defconfig
@@ -52,6 +52,7 @@ CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
 
CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:768k(uboot),256k(uboot-environment),-(reserved)"
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_DM_KEYBOARD=y
 CONFIG_DM_MMC=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] x86: Add 'imply SCSI' to boards using AHCI_PCI

2017-11-30 Thread Tuomas Tynkkynen
The qemu and coreboot boards have 'imply AHCI_PCI' but no 'imply SCSI',
i.e. they are enabling the driver for the Serial ATA controller but
(AFAICT) have no way of accessing those devices from the prompt.

In fact, without this patch I get a silent U-Boot crash when I add a
SATA device to QEMU with the following options:

-drive if=none,file=mydisk.qcow2,id=root
-device ich9-ahci,id=ahci
-device ide-drive,drive=root,bus=ahci.0

With the 'imply SCSI' added, U-Boot doesn't crash and the drive is found
when 'scsi scan' is run.

Signed-off-by: Tuomas Tynkkynen 
---
Hi Bin, Simon

Does this make sense? I was working on converting drivers/ata to
Kconfig, which includes CONFIG_SCSI_AHCI (used by x86) but noticed these
boards that currently have {SCSI=n, AHCI_PCI=y, SCSI_AHCI=y}.
---
 arch/x86/cpu/coreboot/Kconfig | 1 +
 arch/x86/cpu/qemu/Kconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git arch/x86/cpu/coreboot/Kconfig arch/x86/cpu/coreboot/Kconfig
index 60eb45f9d0..0e83a43d99 100644
--- arch/x86/cpu/coreboot/Kconfig
+++ arch/x86/cpu/coreboot/Kconfig
@@ -10,6 +10,7 @@ config SYS_COREBOOT
imply MMC_PCI
imply MMC_SDHCI
imply MMC_SDHCI_SDMA
+   imply SCSI
imply SPI_FLASH
imply SYS_NS16550
imply USB
diff --git arch/x86/cpu/qemu/Kconfig arch/x86/cpu/qemu/Kconfig
index 81444f3d9e..a0090281b9 100644
--- arch/x86/cpu/qemu/Kconfig
+++ arch/x86/cpu/qemu/Kconfig
@@ -9,6 +9,7 @@ config QEMU
select ARCH_EARLY_INIT_R
imply AHCI_PCI
imply E1000
+   imply SCSI
imply SYS_NS16550
imply USB
imply USB_EHCI_HCD
-- 
2.15.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 11/11] configs: omapl138_lcdk: decrease the loglevel to reduce the size of the SPL

2017-11-30 Thread Peter Howard
On Thu, 2017-11-30 at 11:55 -0500, Tom Rini wrote:
> On Thu, Nov 30, 2017 at 05:44:04PM +0100, Jean-Jacques Hiblot wrote:
> 
> > The changes in the MMC stack have increased its footprint up to the
> > point
> > were its breaks the generation of the SPL for this platform.
> > Fix this by reducing the loglevel.
> > 
> > Signed-off-by: Jean-Jacques Hiblot 
> > ---
> > 
> > new patch that takes adavntage of "mmc: convert most of printf() to
> > pr_err()
> > and pr_warn()" to reduce the size of the SPL.
> > WIthout this patch the SPL is too big and the build breaks.
> > 
> >  configs/omapl138_lcdk_defconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/configs/omapl138_lcdk_defconfig
> > b/configs/omapl138_lcdk_defconfig
> > index 8d6b12f..0d4506e 100644
> > --- a/configs/omapl138_lcdk_defconfig
> > +++ b/configs/omapl138_lcdk_defconfig
> > @@ -8,6 +8,7 @@ CONFIG_SPL_MMC_SUPPORT=y
> >  CONFIG_SPL_SERIAL_SUPPORT=y
> >  CONFIG_SPL_NAND_SUPPORT=y
> >  CONFIG_BOOTDELAY=3
> > +CONFIG_LOGLEVEL=3
> >  CONFIG_VERSION_VARIABLE=y
> >  # CONFIG_DISPLAY_CPUINFO is not set
> >  # CONFIG_DISPLAY_BOARDINFO is not set
> 
> Peter?  Thanks!

Sorry, missed it first time.  Fine by me.

Reviewed-by: Peter Howard 

> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

signature.asc
Description: This is a digitally signed message part
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] U-boot configuration

2017-11-30 Thread A.W.C.
Hello,

Linux embedded file system (Linux v. 2.6.26.5) running on raw NAND flash, and 
use Full Image's RootFS.
I need to access to linux shell when Linux kernel already is fully loaded and 
make some changes.

U-boot> setenv bootargs console=ttyS1,115200n8 rootfstype=squashfs noalign 
half_image=0 verify=y single init=/bin/sh

BusyBox v1.10.2 (2017-08-02 14:07:25 CST) built-in shell (ash)
When I access to Busybox emergency shell, Linux kernel is not fully loaded, 
actual root partition is not mounted yet, the available commands are very 
limited.

BusyBox v1.10.2 (2015-09-06 10:58:05 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
# help

Built-in commands:
---
. : [ [[ alias bg break cd chdir continue echo eval exec exit
export false fg hash help jobs let local pwd read readonly return
set shift source test times trap true type ulimit umask unalias
unset wait

# fdisk -l
/bin/sh: fdisk: not found
#

# mount
mount: no /proc/mounts
#

How to get Linux Kernel fully loaded, and MTD-devices mounted, at the same time 
having full access to file system from Busybox emergency shell?


Regards,
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Running u-boot on qemu-arm complains about missing ld.so.1

2017-11-30 Thread Dipanjan Das
Compiling uboot with Ubunu's arm-none-eabi package abd symlinking the ld.so
from gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf toolchain throws
the following error:
"Inconsistency detected by ld.so: rtld.c: 1137: dl_main: Assertion
`GL(dl_rtld_map).l_libname' failed!"

Compiling uboot with gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf
doesn't work because of compiler issues


On 30 November 2017 at 10:40, Dipanjan Das 
wrote:

>
> In order to compile u-boot, I tried to use CodeSourcery toolchain which
> did not work. However the version of arm-none-eabi toolchain hosted in
> Ubuntu reposiroty does compile u-boot codebase.
>
> When I try to run the u-boot standalone executable qemu-arm, it complains
> about missing '/usr/lib/ld.so.1'. I understand this is a toolchain error.
> Which toolchain is officially supported? How do I locate the cross-compiled
> ld.so on my system? It doesn't seem to be lying under
> /usr/lib/arm-none-eabi directory.
>
> --
>
> Thanks & Regards,
> Dipanjan
>



-- 

Thanks & Regards,
Dipanjan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH RFC] arm64: allwinner: a64: Add Brava Keller initial support

2017-11-30 Thread Jagan Teki
Brava Keller is A64 based IoT device, which support
- Allwinner A64 Cortex-A53
- AXP803 PMIC
- 1GB DDR3 RAM
- 8GB eMMC
- Mali-400MP2 GPU
- AP6330 Wifi/BLE
- Camera OV5640
- USB Host and OTG

Signed-off-by: Jagan Teki 
---
Note: Need to test it on hardware

 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/sun50i-a64-brava-keller.dts | 107 +++
 board/sunxi/MAINTAINERS  |   5 ++
 configs/brava_keller_defconfig   |  13 
 4 files changed, 126 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-a64-brava-keller.dts
 create mode 100644 configs/brava_keller_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index cd540e9..b89e75a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -342,6 +342,7 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \
sun50i-h5-orangepi-zero-plus2.dtb
 dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-bananapi-m64.dtb \
+   sun50i-a64-brava-keller.dtb \
sun50i-a64-nanopi-a64.dtb \
sun50i-a64-olinuxino.dtb \
sun50i-a64-orangepi-win.dtb \
diff --git a/arch/arm/dts/sun50i-a64-brava-keller.dts 
b/arch/arm/dts/sun50i-a64-brava-keller.dts
new file mode 100644
index 000..094eee0
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-brava-keller.dts
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2017 Jagan Teki 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64.dtsi"
+
+#include 
+
+/ {
+   model = "Brava Keller";
+   compatible = "brava,brava-keller", "allwinner,sun50i-a64";
+
+   aliases {
+   serial2 = &uart2;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   reg_vcc3v3: vcc3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+};
+
+&ehci0 {
+   status = "okay";
+};
+
+&ehci1 {
+   status = "okay";
+};
+
+&mmc2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&mmc2_pins>;
+   vmmc-supply = <®_vcc3v3>;
+   bus-width = <8>;
+   non-removable;
+   cap-mmc-hw-reset;
+   status = "okay";
+};
+
+&ohci0 {
+   status = "okay";
+};
+
+&ohci1 {
+   status = "okay";
+};
+
+&uart2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&uart2_pins>;
+   status = "okay";
+};
+
+&usb_otg {
+   status = "okay";
+};
+
+&usbphy {
+   status = "okay";
+};
diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
index 99809c6..a6222ba 100644
--- a/board/sunxi/MAINTAINERS
+++ b/board/sunxi/MAINTAINERS
@@ -143,6 +143,11 @@ M: Jagan Teki 
 S: Maintained
 F: configs/bananapi_m64_defconfig
 
+BRAVA KELLER
+M: Jagan Teki 
+S: Maintained
+F: configs/brava_keller_defconfig
+
 COLOMBUS BOARD
 M: Maxime Ripard 
 S: Maintained
diff --git a/configs/brava_keller_defconfig b/configs/brava_keller_defconfig
new file mode 100644
index 000..67dea1c
--- /dev/null

Re: [U-Boot] Please pull u-boot-marvell/master

2017-11-30 Thread Tom Rini
On Thu, Nov 30, 2017 at 01:33:43PM +0100, Stefan Roese wrote:

> Hi Tom,
> 
> please pull the following MVEBU related changes.
> 
> Thanks,
> Stefan
> 
> The following changes since commit b06c46de632c55f4c39d404c6f0f65e414b31050:
> 
>   Merge tag 'xilinx-for-v2018.01' of git://www.denx.de/git/u-boot-microblaze 
> (2017-11-29 08:26:07 -0500)
> 
> are available in the Git repository at:
> 
>   git://www.denx.de/git/u-boot-marvell.git 
> 
> for you to fetch changes up to 01c541e0e698196ab29761fd29fd06f36185e03e:
> 
>   arm: mvebu: correct comments around cas_wl/cas_l (2017-11-30 08:30:59 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PULL] u-boot-sh/rmobile-mx

2017-11-30 Thread Tom Rini
On Thu, Nov 30, 2017 at 01:50:07PM +0100, Marek Vasut wrote:

> The following changes since commit b06c46de632c55f4c39d404c6f0f65e414b31050:
> 
>   Merge tag 'xilinx-for-v2018.01' of
> git://www.denx.de/git/u-boot-microblaze (2017-11-29 08:26:07 -0500)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sh.git rmobile-mx
> 
> for you to fetch changes up to ab61e175713a0400c6ece6348e8f655998cf574d:
> 
>   ARM: rmobile: Rework the ULCB CPLD driver (2017-11-30 08:54:18 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-x86

2017-11-30 Thread Tom Rini
On Thu, Nov 30, 2017 at 02:03:53PM +0800, Bin Meng wrote:

> Hi Tom,
> 
> The following changes since commit b06c46de632c55f4c39d404c6f0f65e414b31050:
> 
>   Merge tag 'xilinx-for-v2018.01' of
> git://www.denx.de/git/u-boot-microblaze (2017-11-29 08:26:07 -0500)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-x86.git
> 
> for you to fetch changes up to aa7839b39c2ee77f9ab8c393c56b8d812507dbb7:
> 
>   x86: lib: Implement standalone __udivdi3 etc instead of libgcc ones
> (2017-11-30 13:50:17 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Running u-boot on qemu-arm complains about missing ld.so.1

2017-11-30 Thread Dipanjan Das
In order to compile u-boot, I tried to use CodeSourcery toolchain which did
not work. However the version of arm-none-eabi toolchain hosted in Ubuntu
reposiroty does compile u-boot codebase.

When I try to run the u-boot standalone executable qemu-arm, it complains
about missing '/usr/lib/ld.so.1'. I understand this is a toolchain error.
Which toolchain is officially supported? How do I locate the cross-compiled
ld.so on my system? It doesn't seem to be lying under
/usr/lib/arm-none-eabi directory.

-- 

Thanks & Regards,
Dipanjan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [v2] armv8: ls1012a: enable/disable eSDHC1 through hwconfig for RDB

2017-11-30 Thread York Sun
On 11/29/2017 08:44 PM, Y.b. Lu wrote:
> Hi York,
> 
> I copied hardware team Kinjalk's explain here.
> 
> "Enabling SDHC2 on ‘00’ is not correct on revision D and later boards as the 
> sd wifi is not on there on these revs.
> The IO expander was designed to override the dip switch values. So, the DIP 
> switch values are driven through low strength drivers. The I2C reads of DIP 
> switch settings may not be correct and reliable as the noise margin is very 
> low. If the IO expander is driving CFG than the situation is different and 
> reads will always be reliable."
> 
> It seemed ls1012ardb RevD reworked the SDHC2 circuit. The SDIO wifi device 
> was removed and I2C reading of DIP switch setting was not reliable.
> This changes is causing many kernel error messages on RevD boards. 
> "mmc1: Controller never released inhibit bit(s)."
> It's safe to disable SDHC2 in default and enable it manually when hardware 
> configuration(DIP switch) is correct for SDHC2 since software doesn’t have 
> way to check.
> 
> Do you think this should be fixed by hardware? If so, I will try to suggest 
> that.

Yangbo,

If the hardware can be fixed to operate the same way, please push for a
fix. If rev D board (and later) removes the feature to read DIP
switches, and you can make the code backward-compatible, then we can
accept this change.

Your change is to use hwconfig to determine if eSDHC1 is available. This
will cause all previous boards losing the ability to automatically
select eSDHC1. Is that acceptable to existing users, and clearly documented?

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [Patch v2 1/2] driver: net: ldpaa_eth: Add PHY-less SGMII support

2017-11-30 Thread York Sun
On 11/29/2017 09:45 PM, Ashish Kumar wrote:
> Hello Joe, York,
> 
> 
> Any comments on V2 series?
> 

Ashish,

I can't see if this set is correct. Did you look into the similar
PHY-less situation for Power-based platform? We don't have PHY-less
SGMII support there. I was hoping you can add the same.

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] armv8: ls1043a: Discard the needless cpu nodes

2017-11-30 Thread York Sun
On 11/29/2017 07:16 PM, Wenbin song wrote:
> Using "cpu_pos_mask()" function to detect the real online cpus,
> and discard the needless cpu nodes on kernel dft.
> 
> Signed-off-by: Wenbin Song 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/Kconfig |  4 
>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c   | 32 
> +++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
> b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> index 47145a2432..971a98c6cc 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> @@ -176,6 +176,10 @@ config HAS_FEATURE_ENHANCED_MSI
>   bool
>   default y if ARCH_LS1043A
>  
> +config DISCARD_OFFLINE_CPU_NODES
> + bool
> + default y if ARCH_LS1043A
> +
>  menu "Layerscape PPA"
>  config FSL_LS_PPA
>   bool "FSL Layerscape PPA firmware support"
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
> b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> index 33f3e64848..241f0abe18 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> @@ -44,6 +44,38 @@ void ft_fixup_cpu(void *blob)
>   int addr_cells;
>   u64 val, core_id;
>   size_t *boot_code_size = &(__secondary_boot_code_size);
> +
> +#if defined(CONFIG_DISCARD_OFFLINE_CPU_NODES)
> + u32 mask = cpu_pos_mask();
> + int off_prev = -1;
> + int pos;
> +
> + off = fdt_path_offset(blob, "/cpus");
> + if (off < 0) {
> + puts("couldn't find /cpus node\n");
> + return;
> + }
> +
> + fdt_support_default_count_cells(blob, off, &addr_cells, NULL);
> +
> + off = fdt_node_offset_by_prop_value(blob, off_prev, "device_type",
> + "cpu", 4);
> + while (off != -FDT_ERR_NOTFOUND) {
> + reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
> + if (reg) {
> + core_id = fdt_read_number(reg, addr_cells);
> + pos = ((core_id & 0xff00) >> 5) + (core_id & 0xff);
> + if (!test_bit(pos, &mask)) {
> + fdt_del_node(blob, off);
> + off = off_prev;
> + }
> + }
> + off_prev = off;
> + off = fdt_node_offset_by_prop_value(blob, off_prev,
> + "device_type", "cpu", 4);
> + }
> +#endif
> +
>  #if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && \
>   defined(CONFIG_SEC_FIRMWARE_ARMV8_PSCI)
>   int node;
> 

Wenbin,

Using topology registers to identify the existence of cores is correct.
Do you need the new config option to gate the code? It is a correct
operation for all SoCs, isn't it?

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 10/14] ram: stm32: add memory mapping selection support

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

This allows to controls the memory internal mapping at
address 0x .
We can either map at 0x  :
  _ main flash memory
  _ system flash memory
  _ FMC bank1 (NOR/PSRAM 1 and 2)
  _ embedded SRAM
  _ FMC/SDRAM bank1

This is needed for future STM32F469-disco board

Signed-off-by: Patrice Chotard 
---
 drivers/ram/stm32_sdram.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 6e92b22..ec2edd6 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -11,6 +11,9 @@
 #include 
 #include 
 
+#define MEM_MODE_MASK  GENMASK(2, 0)
+#define NOT_FOUND  0xff
+
 DECLARE_GLOBAL_DATA_PTR;
 
 struct stm32_fmc_regs {
@@ -253,9 +256,31 @@ static int stm32_fmc_ofdata_to_platdata(struct udevice 
*dev)
 {
struct stm32_sdram_params *params = dev_get_platdata(dev);
struct bank_params *bank_params;
+   struct ofnode_phandle_args args;
+   u32 *syscfg_base;
+   u32 mem_remap;
ofnode bank_node;
char *bank_name;
u8 bank = 0;
+   int ret;
+
+   mem_remap = dev_read_u32_default(dev, "st,mem_remap", NOT_FOUND);
+   if (mem_remap != NOT_FOUND) {
+   ret = dev_read_phandle_with_args(dev, "st,syscfg", NULL, 0, 0,
+&args);
+   if (ret) {
+   debug("%s: can't find syscon device (%d)\n", __func__,
+ ret);
+   return ret;
+   }
+
+   syscfg_base = (u32 *)ofnode_get_addr(args.node);
+
+   /* set memory mapping selection */
+   clrsetbits_le32(syscfg_base, MEM_MODE_MASK, mem_remap);
+   } else {
+   debug("%s: cannot find st,mem_remap property\n", __func__);
+   }
 
dev_for_each_subnode(bank_node, dev) {
/* extract the bank index from DT */
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 12/14] ARM: DTS: stm32: add stm32f469-disco-u-boot dts file

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

  _ Add gpio compatible and aliases for stm32f469

  _ Add FMC sdram node

  _ Add "u-boot,dm-pre-reloc" for rcc, fmc, fixed-clock, pinctrl,
pwrcfg and gpio nodes.

Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/stm32f469-disco-u-boot.dtsi | 230 +++
 1 file changed, 230 insertions(+)
 create mode 100644 arch/arm/dts/stm32f469-disco-u-boot.dtsi

diff --git a/arch/arm/dts/stm32f469-disco-u-boot.dtsi 
b/arch/arm/dts/stm32f469-disco-u-boot.dtsi
new file mode 100644
index 000..094bab4
--- /dev/null
+++ b/arch/arm/dts/stm32f469-disco-u-boot.dtsi
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Patrice Chotard,  for STMicroelectronics.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+/{
+   clocks {
+   u-boot,dm-pre-reloc;
+   };
+
+   aliases {
+   /* Aliases for gpios so as to use sequence */
+   gpio0 = &gpioa;
+   gpio1 = &gpiob;
+   gpio2 = &gpioc;
+   gpio3 = &gpiod;
+   gpio4 = &gpioe;
+   gpio5 = &gpiof;
+   gpio6 = &gpiog;
+   gpio7 = &gpioh;
+   gpio8 = &gpioi;
+   gpio9 = &gpioj;
+   gpio10 = &gpiok;
+   };
+
+   soc {
+   u-boot,dm-pre-reloc;
+   pin-controller {
+   u-boot,dm-pre-reloc;
+   };
+
+   fmc: fmc@A000 {
+   compatible = "st,stm32-fmc";
+   reg = <0xA000 0x1000>;
+   clocks = <&rcc 0 STM32F4_AHB3_CLOCK(FMC)>;
+   st,syscfg = <&syscfg>;
+   pinctrl-0 = <&fmc_pins_d32>;
+   pinctrl-names = "default";
+   st,mem_remap = <4>;
+   u-boot,dm-pre-reloc;
+
+   /*
+* Memory configuration from sdram
+* MICRON MT48LC4M32B2B5-6A
+*/
+   bank0: bank@0 {
+  st,sdram-control = /bits/ 8 ;
+  st,sdram-timing = /bits/ 8 ;
+  st,sdram-refcount = < 1292 >;
+  };
+   };
+   };
+};
+
+&clk_hse {
+   u-boot,dm-pre-reloc;
+};
+
+&clk_lse {
+   u-boot,dm-pre-reloc;
+};
+
+&clk_i2s_ckin {
+   u-boot,dm-pre-reloc;
+};
+
+&pwrcfg {
+   u-boot,dm-pre-reloc;
+};
+
+&syscfg {
+   u-boot,dm-pre-reloc;
+};
+
+&rcc {
+   u-boot,dm-pre-reloc;
+};
+
+&gpioa {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiob {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioc {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiod {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioe {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiof {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiog {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioh {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioi {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioj {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiok {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&pinctrl {
+   usart3_pins_a: usart3@0 {
+   u-boot,dm-pre-reloc;
+   pins1 {
+   u-boot,dm-pre-reloc;
+   };
+   pins2 {
+   u-boot,dm-pre-reloc;
+   };
+   };
+
+   fmc_pins_d32: fmc_d32@0 {
+   u-boot,dm-pre-reloc;
+   pins
+   {
+   pinmux = , /* D31 */
+, /* D30 */
+, /* D29 */
+, /* D28 */
+, /* D27 */
+, /* D26 */
+, /* D25 */
+, /* D24 */
+, /* D23 */
+, /* D22 */
+, /* D21 */
+, /* D20 */
+, /* D19 */
+, /* D18 */
+, /* D17 */
+, /* D16 */
+
+, /* D15 */
+, /* D14 */
+, /* D13 */
+, /* D12 */
+, /* D11 */
+, /* D10 */
+, /* D09 */
+   

[U-Boot] [PATCH 09/14] board: stm32f429-disco: switch to DM STM32 pinctrl and gpio driver

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

Use available DM stm32f7_gpio.c and pinctrl_stm32.c drivers
instead of board GPIO initialization.

Remove stm32_gpio.c which is no more used and migrate
structs stm32_gpio_regs and stm32_gpio_priv into
arch-stm32f4/gpio.h to not break compilation.

Signed-off-by: Patrice Chotard 
---
 arch/arm/include/asm/arch-stm32f4/gpio.h   |  20 ++-
 arch/arm/include/asm/arch-stm32f4/stm32.h  |  10 --
 board/st/stm32f429-discovery/stm32f429-discovery.c | 111 -
 configs/stm32f429-discovery_defconfig  |   3 +
 drivers/gpio/Makefile  |   1 -
 drivers/gpio/stm32_gpio.c  | 182 -
 include/configs/stm32f429-discovery.h  |   1 -
 7 files changed, 19 insertions(+), 309 deletions(-)
 delete mode 100644 drivers/gpio/stm32_gpio.c

diff --git a/arch/arm/include/asm/arch-stm32f4/gpio.h 
b/arch/arm/include/asm/arch-stm32f4/gpio.h
index 831c542..6173fa1 100644
--- a/arch/arm/include/asm/arch-stm32f4/gpio.h
+++ b/arch/arm/include/asm/arch-stm32f4/gpio.h
@@ -131,6 +131,22 @@ struct stm32_gpio_ctl {
enum stm32_gpio_af  af;
 };
 
+struct stm32_gpio_regs {
+   u32 moder;  /* GPIO port mode */
+   u32 otyper; /* GPIO port output type */
+   u32 ospeedr;/* GPIO port output speed */
+   u32 pupdr;  /* GPIO port pull-up/pull-down */
+   u32 idr;/* GPIO port input data */
+   u32 odr;/* GPIO port output data */
+   u32 bsrr;   /* GPIO port bit set/reset */
+   u32 lckr;   /* GPIO port configuration lock */
+   u32 afr[2]; /* GPIO alternate function */
+};
+
+struct stm32_gpio_priv {
+   struct stm32_gpio_regs *regs;
+};
+
 static inline unsigned stm32_gpio_to_port(unsigned gpio)
 {
return gpio / 16;
@@ -141,8 +157,4 @@ static inline unsigned stm32_gpio_to_pin(unsigned gpio)
return gpio % 16;
 }
 
-int stm32_gpio_config(const struct stm32_gpio_dsc *gpio_dsc,
-   const struct stm32_gpio_ctl *gpio_ctl);
-int stm32_gpout_set(const struct stm32_gpio_dsc *gpio_dsc, int state);
-
 #endif /* _STM32_GPIO_H_ */
diff --git a/arch/arm/include/asm/arch-stm32f4/stm32.h 
b/arch/arm/include/asm/arch-stm32f4/stm32.h
index 889778c..0449fce 100644
--- a/arch/arm/include/asm/arch-stm32f4/stm32.h
+++ b/arch/arm/include/asm/arch-stm32f4/stm32.h
@@ -23,16 +23,6 @@
 
 #define STM32_BUS_MASK 0x
 
-#define STM32_GPIOA_BASE   (STM32_AHB1PERIPH_BASE + 0x)
-#define STM32_GPIOB_BASE   (STM32_AHB1PERIPH_BASE + 0x0400)
-#define STM32_GPIOC_BASE   (STM32_AHB1PERIPH_BASE + 0x0800)
-#define STM32_GPIOD_BASE   (STM32_AHB1PERIPH_BASE + 0x0C00)
-#define STM32_GPIOE_BASE   (STM32_AHB1PERIPH_BASE + 0x1000)
-#define STM32_GPIOF_BASE   (STM32_AHB1PERIPH_BASE + 0x1400)
-#define STM32_GPIOG_BASE   (STM32_AHB1PERIPH_BASE + 0x1800)
-#define STM32_GPIOH_BASE   (STM32_AHB1PERIPH_BASE + 0x1C00)
-#define STM32_GPIOI_BASE   (STM32_AHB1PERIPH_BASE + 0x2000)
-
 /*
  * Register maps
  */
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c 
b/board/st/stm32f429-discovery/stm32f429-discovery.c
index c5f4573..3d90218 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -16,120 +16,14 @@
 
 #include 
 #include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-const struct stm32_gpio_ctl gpio_ctl_gpout = {
-   .mode = STM32_GPIO_MODE_OUT,
-   .otype = STM32_GPIO_OTYPE_PP,
-   .speed = STM32_GPIO_SPEED_50M,
-   .pupd = STM32_GPIO_PUPD_NO,
-   .af = STM32_GPIO_AF0
-};
-
-const struct stm32_gpio_ctl gpio_ctl_usart = {
-   .mode = STM32_GPIO_MODE_AF,
-   .otype = STM32_GPIO_OTYPE_PP,
-   .speed = STM32_GPIO_SPEED_50M,
-   .pupd = STM32_GPIO_PUPD_UP,
-   .af = STM32_GPIO_USART
-};
-
-static const struct stm32_gpio_dsc usart_gpio[] = {
-   {STM32_GPIO_PORT_X, STM32_GPIO_PIN_TX}, /* TX */
-   {STM32_GPIO_PORT_X, STM32_GPIO_PIN_RX}, /* RX */
-};
-
-int uart_setup_gpio(void)
-{
-   int i;
-   int rv = 0;
-
-   for (i = 0; i < ARRAY_SIZE(usart_gpio); i++) {
-   rv = stm32_gpio_config(&usart_gpio[i], &gpio_ctl_usart);
-   if (rv)
-   goto out;
-   }
-
-out:
-   return rv;
-}
-
-const struct stm32_gpio_ctl gpio_ctl_fmc = {
-   .mode = STM32_GPIO_MODE_AF,
-   .otype = STM32_GPIO_OTYPE_PP,
-   .speed = STM32_GPIO_SPEED_100M,
-   .pupd = STM32_GPIO_PUPD_NO,
-   .af = STM32_GPIO_AF12
-};
-
-static const struct stm32_gpio_dsc ext_ram_fmc_gpio[] = {
-   /* Chip is LQFP144, see DM00077036.pdf for details */
-   {STM32_GPIO_PORT_D, STM32_GPIO_PIN_10}, /* 79, FMC_D15 */
-   {STM32_GPIO_PORT_D, STM32_GPIO_PIN_9},  /* 78, FMC_D14 */
-   {STM32_GPIO_PORT_D, STM32_GPIO_PIN_8},  /* 77, FMC_D13 */
-   {STM32_GPIO_PORT_E, STM32_GPIO_PIN_15}, /* 68, FMC_D12 */
-   {STM32_GPIO_PORT_

[U-Boot] [PATCH 14/14] ARM: DTS: stm32: add SDIO controller support for stm32f469-disco

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

STM32F469 SoC uses an arm_pl180_mmci SDIO controller.

Signed-off-by: Andrea Merello 
Signed-off-by: Alexandre Torgue 
Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/stm32f4-pinctrl.dtsi | 31 +++
 arch/arm/dts/stm32f429.dtsi   | 12 
 arch/arm/dts/stm32f469-disco.dts  | 16 
 3 files changed, 59 insertions(+)

diff --git a/arch/arm/dts/stm32f4-pinctrl.dtsi 
b/arch/arm/dts/stm32f4-pinctrl.dtsi
index df59956..736bca7 100644
--- a/arch/arm/dts/stm32f4-pinctrl.dtsi
+++ b/arch/arm/dts/stm32f4-pinctrl.dtsi
@@ -339,6 +339,37 @@
slew-rate = <3>;
};
};
+
+   sdio_pins: sdio_pins@0 {
+   pins {
+   pinmux = ,
+,
+,
+,
+,
+;
+   drive-push-pull;
+   slew-rate = <2>;
+   };
+   };
+
+   sdio_pins_od: sdio_pins_od@0 {
+   pins1 {
+   pinmux = ,
+,
+,
+,
+;
+   drive-push-pull;
+   slew-rate = <2>;
+   };
+
+   pins2 {
+   pinmux = ;
+   drive-open-drain;
+   slew-rate = <2>;
+   };
+   };
};
};
 };
diff --git a/arch/arm/dts/stm32f429.dtsi b/arch/arm/dts/stm32f429.dtsi
index 23b7946..6bcf986 100644
--- a/arch/arm/dts/stm32f429.dtsi
+++ b/arch/arm/dts/stm32f429.dtsi
@@ -576,6 +576,18 @@
reg = <0x40007000 0x400>;
};
 
+   sdio: sdio@40012c00 {
+   compatible = "st,stm32f4xx-sdio";
+   reg = <0x40012c00 0x400>;
+   clocks = <&rcc 0 171>;
+   interrupts = <49>;
+   status = "disabled";
+   pinctrl-0 = <&sdio_pins>;
+   pinctrl-1 = <&sdio_pins_od>;
+   pinctrl-names = "default", "opendrain";
+   max-frequency = <4800>;
+   };
+
ltdc: display-controller@40016800 {
compatible = "st,stm32-ltdc";
reg = <0x40016800 0x200>;
diff --git a/arch/arm/dts/stm32f469-disco.dts b/arch/arm/dts/stm32f469-disco.dts
index 67b19dc..3ecef28 100644
--- a/arch/arm/dts/stm32f469-disco.dts
+++ b/arch/arm/dts/stm32f469-disco.dts
@@ -61,6 +61,13 @@
serial0 = &usart3;
};
 
+   mmc_vcard: mmc_vcard {
+   compatible = "regulator-fixed";
+   regulator-name = "mmc_vcard";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
soc {
dma-ranges = <0xc000 0x0 0x1000>;
};
@@ -115,6 +122,15 @@
};
 };
 
+&sdio {
+   status = "okay";
+   vmmc-supply = <&mmc_vcard>;
+   pinctrl-names = "default", "opendrain";
+   pinctrl-0 = <&sdio_pins>;
+   pinctrl-1 = <&sdio_pins_od>;
+   bus-width = <4>;
+};
+
 &usart3 {
pinctrl-0 = <&usart3_pins_a>;
pinctrl-names = "default";
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 11/14] ARM: DTS: add STM32F469 Discovery board support

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

This DT file comes from kernel v4.15-rc1

stm32f469-pinctrl.dtsi header has been updated with correct
STMicroelectronics Copyright.

Remove the paragraph about writing to the Free Software
Foundation's mailing address as requested by checkpatch.

Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/Makefile   |   3 +-
 arch/arm/dts/stm32f469-disco.dts| 129 
 arch/arm/dts/stm32f469-pinctrl.dtsi |  97 +++
 3 files changed, 228 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/stm32f469-disco.dts
 create mode 100644 arch/arm/dts/stm32f469-pinctrl.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 77fac9e..15ea108 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -210,7 +210,8 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
 
 dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb
 
-dtb-$(CONFIG_STM32F4) += stm32f429-disco.dtb
+dtb-$(CONFIG_STM32F4) += stm32f429-disco.dtb \
+   stm32f469-disco.dtb
 
 dtb-$(CONFIG_STM32F7) += stm32f746-disco.dtb \
stm32f769-disco.dtb
diff --git a/arch/arm/dts/stm32f469-disco.dts b/arch/arm/dts/stm32f469-disco.dts
new file mode 100644
index 000..67b19dc
--- /dev/null
+++ b/arch/arm/dts/stm32f469-disco.dts
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2016 - Lee Jones 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "stm32f429.dtsi"
+#include "stm32f469-pinctrl.dtsi"
+
+/ {
+   model = "STMicroelectronics STM32F469i-DISCO board";
+   compatible = "st,stm32f469i-disco", "st,stm32f469";
+
+   chosen {
+   bootargs = "root=/dev/ram";
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory {
+   reg = <0x 0x100>;
+   };
+
+   aliases {
+   serial0 = &usart3;
+   };
+
+   soc {
+   dma-ranges = <0xc000 0x0 0x1000>;
+   };
+
+   /* This turns on vbus for otg for host mode (dwc2) */
+   vcc5v_otg: vcc5v-otg-regulator {
+   compatible = "regulator-fixed";
+   enable-active-high;
+   gpio = <&gpiob 2 0>;
+   regulator-name = "vcc5_host1";
+   regulator-always-on;
+   };
+};
+
+&rcc {
+   compatible = "st,stm32f469-rcc", "st,stm32f42xx-rcc", "st,stm32-rcc";
+};
+
+&clk_hse {
+   clock-frequency = <800>;
+};
+
+&rtc {
+   status = "okay";
+};
+
+&timers1 {
+   status = "okay";
+
+   pwm {
+   pinctrl-0 = <&pwm1_pins>;
+   pinctrl-names = "default";
+   status = "okay";
+   };
+
+   timer@0 {
+   status = "okay";
+   };
+};
+
+&timers3 {
+   status = "okay";
+
+   pwm {
+   pinctrl-0 = <&pwm3_pins>;
+   pinctrl-names = "default";
+   status = "okay";
+   };
+
+   timer@2 {
+   status = "okay";
+   };
+};
+
+&usart3 {
+   pinctrl-0 = <&usart3_pins_a>;
+   pinctrl-names = "default

[U-Boot] [PATCH 06/14] board: stm32f429-disco: switch to DM STM32 serial driver

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

Remove serial_stm32.c driver and uart init from board file,
use available DM serial_stm32x7.c driver compatible for
STM32F4/F7 and H7 SoCs.

The serial_stm32x7.c driver will be renamed later with a more
generic name as it's shared with all STM32 Socs.

Signed-off-by: Patrice Chotard 
---
 arch/arm/include/asm/arch-stm32f4/stm32.h  |   8 --
 board/st/stm32f429-discovery/stm32f429-discovery.c |  10 --
 configs/stm32f429-discovery_defconfig  |   1 +
 drivers/serial/serial_stm32.c  | 117 -
 include/configs/stm32f429-discovery.h  |   1 -
 5 files changed, 1 insertion(+), 136 deletions(-)
 delete mode 100644 drivers/serial/serial_stm32.c

diff --git a/arch/arm/include/asm/arch-stm32f4/stm32.h 
b/arch/arm/include/asm/arch-stm32f4/stm32.h
index e9f3aab..bd5c2ec 100644
--- a/arch/arm/include/asm/arch-stm32f4/stm32.h
+++ b/arch/arm/include/asm/arch-stm32f4/stm32.h
@@ -59,14 +59,6 @@ struct stm32_pwr_regs {
 #define STM32_PWR_BASE (STM32_APB1PERIPH_BASE + 0x7000)
 #define STM32_PWR  ((struct stm32_pwr_regs *)STM32_PWR_BASE)
 
-/*
- * Peripheral base addresses
- */
-#define STM32_USART1_BASE  (STM32_APB2PERIPH_BASE + 0x1000)
-#define STM32_USART2_BASE  (STM32_APB1PERIPH_BASE + 0x4400)
-#define STM32_USART3_BASE  (STM32_APB1PERIPH_BASE + 0x4800)
-#define STM32_USART6_BASE  (STM32_APB2PERIPH_BASE + 0x1400)
-
 #define FLASH_CNTL_BASE(STM32_AHB1PERIPH_BASE + 0x3C00)
 
 static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c 
b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 7e8df8e..7e62bd2 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -168,15 +167,6 @@ int dram_init_banksize(void)
return 0;
 }
 
-static const struct stm32_serial_platdata serial_platdata = {
-   .base = (struct stm32_usart *)STM32_USART1_BASE,
-};
-
-U_BOOT_DEVICE(stm32_serials) = {
-   .name = "serial_stm32",
-   .platdata = &serial_platdata,
-};
-
 u32 get_board_rev(void)
 {
return 0;
diff --git a/configs/stm32f429-discovery_defconfig 
b/configs/stm32f429-discovery_defconfig
index 15ff646..ae106ff 100644
--- a/configs/stm32f429-discovery_defconfig
+++ b/configs/stm32f429-discovery_defconfig
@@ -27,3 +27,4 @@ CONFIG_RAM=y
 CONFIG_STM32_SDRAM=y
 CONFIG_DM_RESET=y
 CONFIG_STM32_RESET=y
+CONFIG_STM32X7_SERIAL=y
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
deleted file mode 100644
index c793ba6..000
--- a/drivers/serial/serial_stm32.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * (C) Copyright 2015
- * Kamil Lulko, 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-struct stm32_usart {
-   u32 sr;
-   u32 dr;
-   u32 brr;
-   u32 cr1;
-   u32 cr2;
-   u32 cr3;
-   u32 gtpr;
-};
-
-#define USART_CR1_RE   (1 << 2)
-#define USART_CR1_TE   (1 << 3)
-#define USART_CR1_UE   (1 << 13)
-
-#define USART_SR_FLAG_RXNE (1 << 5)
-#define USART_SR_FLAG_TXE  (1 << 7)
-
-#define USART_BRR_F_MASK   0xF
-#define USART_BRR_M_SHIFT  4
-#define USART_BRR_M_MASK   0xFFF0
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
-{
-   struct stm32_serial_platdata *plat = dev->platdata;
-   struct stm32_usart *const usart = plat->base;
-   u32  clock, int_div, frac_div, tmp;
-
-   if (((u32)usart & STM32_BUS_MASK) == STM32_APB1PERIPH_BASE)
-   clock = clock_get(CLOCK_APB1);
-   else if (((u32)usart & STM32_BUS_MASK) == STM32_APB2PERIPH_BASE)
-   clock = clock_get(CLOCK_APB2);
-   else
-   return -EINVAL;
-
-   int_div = (25 * clock) / (4 * baudrate);
-   tmp = ((int_div / 100) << USART_BRR_M_SHIFT) & USART_BRR_M_MASK;
-   frac_div = int_div - (100 * (tmp >> USART_BRR_M_SHIFT));
-   tmp |= (((frac_div * 16) + 50) / 100) & USART_BRR_F_MASK;
-   writel(tmp, &usart->brr);
-
-   return 0;
-}
-
-static int stm32_serial_getc(struct udevice *dev)
-{
-   struct stm32_serial_platdata *plat = dev->platdata;
-   struct stm32_usart *const usart = plat->base;
-
-   if ((readl(&usart->sr) & USART_SR_FLAG_RXNE) == 0)
-   return -EAGAIN;
-
-   return readl(&usart->dr);
-}
-
-static int stm32_serial_putc(struct udevice *dev, const char c)
-{
-   struct stm32_serial_platdata *plat = dev->platdata;
-   struct stm32_usart *const usart = plat->base;
-
-   if ((readl(&usart->sr) & USART_SR_FLAG_TXE) == 0)
-   return -EAGAIN;
-
-   writel(c, &usart->dr);
-
-   return 0;
-}
-
-static int stm32_serial_pending(st

[U-Boot] [PATCH 08/14] board: stm32f429-disco: switch to DM STM32 clock driver

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

Use available DM clk_stm32f.c driver instead of dedicated
mach-stm32/stm32f4/clock.c.

Migrate periph_clock defines from stm32_periph.h directly in
CLK driver. These periph_clock defines will be removed when STMMAC,
TIMER2 and SYSCFG drivers will support DM CLK.

Enable also CLK flag.

Signed-off-by: Patrice Chotard 
---
 arch/arm/include/asm/arch-stm32f4/stm32.h  |  17 --
 arch/arm/mach-stm32/stm32f4/Makefile   |   2 +-
 arch/arm/mach-stm32/stm32f4/clock.c| 258 -
 board/st/stm32f429-discovery/stm32f429-discovery.c |  24 +-
 configs/stm32f429-discovery_defconfig  |   1 +
 drivers/clk/clk_stm32f.c   |   7 +-
 6 files changed, 9 insertions(+), 300 deletions(-)
 delete mode 100644 arch/arm/mach-stm32/stm32f4/clock.c

diff --git a/arch/arm/include/asm/arch-stm32f4/stm32.h 
b/arch/arm/include/asm/arch-stm32f4/stm32.h
index bd5c2ec..889778c 100644
--- a/arch/arm/include/asm/arch-stm32f4/stm32.h
+++ b/arch/arm/include/asm/arch-stm32f4/stm32.h
@@ -42,11 +42,6 @@ struct stm32_u_id_regs {
u32 u_id_high;
 };
 
-struct stm32_pwr_regs {
-   u32 cr;
-   u32 csr;
-};
-
 /*
  * Registers access macros
  */
@@ -56,9 +51,6 @@ struct stm32_pwr_regs {
 #define STM32_RCC_BASE (STM32_AHB1PERIPH_BASE + 0x3800)
 #define STM32_RCC  ((struct stm32_rcc_regs *)STM32_RCC_BASE)
 
-#define STM32_PWR_BASE (STM32_APB1PERIPH_BASE + 0x7000)
-#define STM32_PWR  ((struct stm32_pwr_regs *)STM32_PWR_BASE)
-
 #define FLASH_CNTL_BASE(STM32_AHB1PERIPH_BASE + 0x3C00)
 
 static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {
@@ -67,15 +59,6 @@ static const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = {
[5 ... 11] =128 * 1024
 };
 
-enum clock {
-   CLOCK_CORE,
-   CLOCK_AHB,
-   CLOCK_APB1,
-   CLOCK_APB2
-};
-
-int configure_clocks(void);
-unsigned long clock_get(enum clock clck);
 void stm32_flash_latency_cfg(int latency);
 
 #endif /* _MACH_STM32_H_ */
diff --git a/arch/arm/mach-stm32/stm32f4/Makefile 
b/arch/arm/mach-stm32/stm32f4/Makefile
index 63db820..86c81bb 100644
--- a/arch/arm/mach-stm32/stm32f4/Makefile
+++ b/arch/arm/mach-stm32/stm32f4/Makefile
@@ -8,4 +8,4 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y += clock.o timer.o
+obj-y += timer.o
diff --git a/arch/arm/mach-stm32/stm32f4/clock.c 
b/arch/arm/mach-stm32/stm32f4/clock.c
deleted file mode 100644
index 774591d..000
--- a/arch/arm/mach-stm32/stm32f4/clock.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * (C) Copyright 2015
- * Kamil Lulko, 
- *
- * (C) Copyright 2014
- * STMicroelectronics
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define RCC_CR_HSION   (1 << 0)
-#define RCC_CR_HSEON   (1 << 16)
-#define RCC_CR_HSERDY  (1 << 17)
-#define RCC_CR_HSEBYP  (1 << 18)
-#define RCC_CR_CSSON   (1 << 19)
-#define RCC_CR_PLLON   (1 << 24)
-#define RCC_CR_PLLRDY  (1 << 25)
-
-#define RCC_PLLCFGR_PLLM_MASK  0x3F
-#define RCC_PLLCFGR_PLLN_MASK  0x7FC0
-#define RCC_PLLCFGR_PLLP_MASK  0x3
-#define RCC_PLLCFGR_PLLQ_MASK  0xF00
-#define RCC_PLLCFGR_PLLSRC (1 << 22)
-#define RCC_PLLCFGR_PLLN_SHIFT 6
-#define RCC_PLLCFGR_PLLP_SHIFT 16
-#define RCC_PLLCFGR_PLLQ_SHIFT 24
-
-#define RCC_CFGR_AHB_PSC_MASK  0xF0
-#define RCC_CFGR_APB1_PSC_MASK 0x1C00
-#define RCC_CFGR_APB2_PSC_MASK 0xE000
-#define RCC_CFGR_SW0   (1 << 0)
-#define RCC_CFGR_SW1   (1 << 1)
-#define RCC_CFGR_SW_MASK   0x3
-#define RCC_CFGR_SW_HSI0
-#define RCC_CFGR_SW_HSERCC_CFGR_SW0
-#define RCC_CFGR_SW_PLLRCC_CFGR_SW1
-#define RCC_CFGR_SWS0  (1 << 2)
-#define RCC_CFGR_SWS1  (1 << 3)
-#define RCC_CFGR_SWS_MASK  0xC
-#define RCC_CFGR_SWS_HSI   0
-#define RCC_CFGR_SWS_HSE   RCC_CFGR_SWS0
-#define RCC_CFGR_SWS_PLL   RCC_CFGR_SWS1
-#define RCC_CFGR_HPRE_SHIFT4
-#define RCC_CFGR_PPRE1_SHIFT   10
-#define RCC_CFGR_PPRE2_SHIFT   13
-
-#define RCC_APB1ENR_PWREN  (1 << 28)
-
-/*
- * RCC USART specific definitions
- */
-#define RCC_ENR_USART1EN   (1 << 4)
-#define RCC_ENR_USART2EN   (1 << 17)
-#define RCC_ENR_USART3EN   (1 << 18)
-#define RCC_ENR_USART6EN   (1 <<  5)
-
-#define PWR_CR_VOS0(1 << 14)
-#define PWR_CR_VOS1(1 << 15)
-#define PWR_CR_VOS_MASK0xC000
-#define PWR_CR_VOS_SCALE_MODE_1(PWR_CR_VOS0 | PWR_CR_VOS1)
-#define PWR_CR_VOS_SCALE_MODE_2(PWR_CR_VOS1)
-#define PWR_CR_VOS_SCALE_MODE_3(PWR_CR_VOS0)
-
-/*
- * RCC GPIO specific definitions
- */
-#define RCC_ENR_GPIO_A_EN  (1 << 0)
-#define RCC_ENR_GPIO_B_EN  (1 << 1)
-#define RCC_ENR_GPIO_C_EN  (1 << 2)
-#define RCC_ENR_GPIO_D_EN  (1 << 3)
-#define RCC_ENR_GPIO_E_EN  (1 << 4)
-#define RCC_ENR_GPIO_F_EN  

[U-Boot] [PATCH 03/14] board: stm32f429-discovery: switch to DM STM32 sdram driver

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

Use available DM stm32_sdram.c driver instead of board
SDRAM initialization.
For that, enable OF_CONTROL, OF_EMBED and STM32_SDRAM flags.

Signed-off-by: Patrice Chotard 
---
 board/st/stm32f429-discovery/stm32f429-discovery.c | 136 +++--
 configs/stm32f429-discovery_defconfig  |   6 +-
 include/configs/stm32f429-discovery.h  |   1 -
 3 files changed, 19 insertions(+), 124 deletions(-)

diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c 
b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 1c34a8e..7e8df8e 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -15,10 +15,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -140,56 +138,10 @@ out:
  */
 #define STM32_RCC_ENR_FMC  (1 << 0)/* FMC module clock  */
 
-static inline u32 _ns2clk(u32 ns, u32 freq)
-{
-   u32 tmp = freq/100;
-   return (tmp * ns) / 1000;
-}
-
-#define NS2CLK(ns) (_ns2clk(ns, freq))
-
-/*
- * Following are timings for IS42S16400J, from corresponding datasheet
- */
-#define SDRAM_CAS  3   /* 3 cycles */
-#define SDRAM_NB   1   /* Number of banks */
-#define SDRAM_MWID 1   /* 16 bit memory */
-
-#define SDRAM_NR   0x1 /* 12-bit row */
-#define SDRAM_NC   0x0 /* 8-bit col */
-#define SDRAM_RBURST   0x1 /* Single read requests always as bursts */
-#define SDRAM_RPIPE0x0 /* No HCLK clock cycle delay */
-
-#define SDRAM_TRRD (NS2CLK(14) - 1)
-#define SDRAM_TRCD (NS2CLK(15) - 1)
-#define SDRAM_TRP  (NS2CLK(15) - 1)
-#define SDRAM_TRAS (NS2CLK(42) - 1)
-#define SDRAM_TRC  (NS2CLK(63) - 1)
-#define SDRAM_TRFC (NS2CLK(63) - 1)
-#define SDRAM_TCDL (1 - 1)
-#define SDRAM_TRDL (2 - 1)
-#define SDRAM_TBDL (1 - 1)
-#define SDRAM_TREF 1386
-#define SDRAM_TCCD (1 - 1)
-
-#define SDRAM_TXSR (NS2CLK(70) - 1)/* Row cycle time after precharge */
-#define SDRAM_TMRD (3 - 1) /* Page 10, Mode Register Set */
-
-/* Last data-in to row precharge, need also comply ineq from RM 37.7.5 */
-#define SDRAM_TWR  max(\
-   (int)max((int)SDRAM_TRDL, (int)(SDRAM_TRAS - SDRAM_TRCD - 1)), \
-   (int)(SDRAM_TRC - SDRAM_TRCD - SDRAM_TRP - 2)\
-)
-
-#define SDRAM_MODE_BL_SHIFT0
-#define SDRAM_MODE_CAS_SHIFT   4
-#define SDRAM_MODE_BL  0
-#define SDRAM_MODE_CAS SDRAM_CAS
-
 int dram_init(void)
 {
-   u32 freq;
int rv;
+   struct udevice *dev;
 
rv = fmc_setup_gpio();
if (rv)
@@ -197,83 +149,23 @@ int dram_init(void)
 
setbits_le32(&STM32_RCC->ahb3enr, STM32_RCC_ENR_FMC);
 
-   /*
-* Get frequency for NS2CLK calculation.
-*/
-   freq = clock_get(CLOCK_AHB) / CONFIG_SYS_RAM_FREQ_DIV;
-
-   writel(CONFIG_SYS_RAM_FREQ_DIV << FMC_SDCR_SDCLK_SHIFT
-   | SDRAM_RPIPE << FMC_SDCR_RPIPE_SHIFT
-   | SDRAM_RBURST << FMC_SDCR_RBURST_SHIFT,
-   &STM32_SDRAM_FMC->sdcr1);
-
-   writel(CONFIG_SYS_RAM_FREQ_DIV << FMC_SDCR_SDCLK_SHIFT
-   | SDRAM_CAS << FMC_SDCR_CAS_SHIFT
-   | SDRAM_NB << FMC_SDCR_NB_SHIFT
-   | SDRAM_MWID << FMC_SDCR_MWID_SHIFT
-   | SDRAM_NR << FMC_SDCR_NR_SHIFT
-   | SDRAM_NC << FMC_SDCR_NC_SHIFT
-   | SDRAM_RPIPE << FMC_SDCR_RPIPE_SHIFT
-   | SDRAM_RBURST << FMC_SDCR_RBURST_SHIFT,
-   &STM32_SDRAM_FMC->sdcr2);
-
-   writel(SDRAM_TRP << FMC_SDTR_TRP_SHIFT
-   | SDRAM_TRC << FMC_SDTR_TRC_SHIFT,
-   &STM32_SDRAM_FMC->sdtr1);
-
-   writel(SDRAM_TRCD << FMC_SDTR_TRCD_SHIFT
-   | SDRAM_TRP << FMC_SDTR_TRP_SHIFT
-   | SDRAM_TWR << FMC_SDTR_TWR_SHIFT
-   | SDRAM_TRC << FMC_SDTR_TRC_SHIFT
-   | SDRAM_TRAS << FMC_SDTR_TRAS_SHIFT
-   | SDRAM_TXSR << FMC_SDTR_TXSR_SHIFT
-   | SDRAM_TMRD << FMC_SDTR_TMRD_SHIFT,
-   &STM32_SDRAM_FMC->sdtr2);
-
-   writel(FMC_SDCMR_BANK_2 | FMC_SDCMR_MODE_START_CLOCK,
-  &STM32_SDRAM_FMC->sdcmr);
-
-   udelay(200);/* 200 us delay, page 10, "Power-Up" */
-   FMC_BUSY_WAIT();
-
-   writel(FMC_SDCMR_BANK_2 | FMC_SDCMR_MODE_PRECHARGE,
-  &STM32_SDRAM_FMC->sdcmr);
-
-   udelay(100);
-   FMC_BUSY_WAIT();
-
-   writel((FMC_SDCMR_BANK_2 | FMC_SDCMR_MODE_AUTOREFRESH
-   | 7 << FMC_SDCMR_NRFS_SHIFT), &STM32_SDRAM_FMC->sdcmr);
-
-   udelay(100);
-   FMC_BUSY_WAIT();
-
-   writel(FMC_SDCMR_BANK_2 | (SDRAM_MODE_BL << SDRAM_MODE_BL_SHIFT
-   | SDRAM_MODE_CAS << SDRAM_MODE_CAS_SHIFT)
-   << FMC_SDCMR_MODE_REGISTER_SHIFT | FMC_SDCMR_MODE_WRITE_MODE,
-   &STM32_SDRAM_FMC->sdcmr);
-
-   udelay(100);
-
-   FMC_BUSY_WAIT();
-
-   writel(FMC_SDCMR_BANK_2 |

[U-Boot] [PATCH 13/14] board: stm32: add stm32f469-discovery board support

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

This board offers :

 _ STM32F469NIH6 microcontroller featuring 2 Mbytes of Flash memory
   and 324 Kbytes of RAM in BGA216 package
 _ On-board ST-LINK/V2-1 SWD debugger, supporting USB reenumeration capability:
 _ Mbed-enabled (mbed.org)
 _ USB functions: USB virtual COM port, mass storage, debug port
 _ 4 inches 800x480 pixel TFT color LCD with MIPI DSI interface and capacitive
   touch screen
 _ SAI Audio DAC, with a stereo headphone output jack
 _ 3 MEMS microphones
 _ MicroSD card connector
 _ I2C extension connector
 _ 4Mx32bit SDRAM
 _ 128-Mbit Quad-SPI NOR Flash
 _ Reset and wake-up buttons
 _ 4 color user LEDs
 _ USB OTG FS with Micro-AB connector
 _ Three power supply options:
 _ Expansion connectors and Arduino™ UNO V3 connectors

Signed-off-by: Patrice Chotard 
---
 arch/arm/mach-stm32/stm32f4/Kconfig|  4 ++
 board/st/stm32f469-discovery/Kconfig   | 19 ++
 board/st/stm32f469-discovery/MAINTAINERS   |  6 ++
 board/st/stm32f469-discovery/Makefile  |  8 +++
 board/st/stm32f469-discovery/stm32f469-discovery.c | 74 ++
 configs/stm32f469-discovery_defconfig  | 42 
 include/configs/stm32f469-discovery.h  | 68 
 7 files changed, 221 insertions(+)
 create mode 100644 board/st/stm32f469-discovery/Kconfig
 create mode 100644 board/st/stm32f469-discovery/MAINTAINERS
 create mode 100644 board/st/stm32f469-discovery/Makefile
 create mode 100644 board/st/stm32f469-discovery/stm32f469-discovery.c
 create mode 100644 configs/stm32f469-discovery_defconfig
 create mode 100644 include/configs/stm32f469-discovery.h

diff --git a/arch/arm/mach-stm32/stm32f4/Kconfig 
b/arch/arm/mach-stm32/stm32f4/Kconfig
index a63619e..7005c65 100644
--- a/arch/arm/mach-stm32/stm32f4/Kconfig
+++ b/arch/arm/mach-stm32/stm32f4/Kconfig
@@ -3,6 +3,10 @@ if STM32F4
 config TARGET_STM32F429_DISCOVERY
bool "STM32F429 Discovery board"
 
+config TARGET_STM32F469_DISCOVERY
+   bool "STM32F469 Discovery board"
+
 source "board/st/stm32f429-discovery/Kconfig"
+source "board/st/stm32f469-discovery/Kconfig"
 
 endif
diff --git a/board/st/stm32f469-discovery/Kconfig 
b/board/st/stm32f469-discovery/Kconfig
new file mode 100644
index 000..de61b6f
--- /dev/null
+++ b/board/st/stm32f469-discovery/Kconfig
@@ -0,0 +1,19 @@
+if TARGET_STM32F469_DISCOVERY
+
+config SYS_BOARD
+   string
+   default "stm32f469-discovery"
+
+config SYS_VENDOR
+   string
+   default "st"
+
+config SYS_SOC
+   string
+   default "stm32f4"
+
+config SYS_CONFIG_NAME
+   string
+   default "stm32f469-discovery"
+
+endif
diff --git a/board/st/stm32f469-discovery/MAINTAINERS 
b/board/st/stm32f469-discovery/MAINTAINERS
new file mode 100644
index 000..d3c791a
--- /dev/null
+++ b/board/st/stm32f469-discovery/MAINTAINERS
@@ -0,0 +1,6 @@
+STM32F469-DISCOVERY BOARD
+M: Patrice Chotard 
+S: Maintained
+F: board/st/stm32f469-discovery/
+F: include/configs/stm32f469-discovery.h
+F: configs/stm32f469-discovery_defconfig
diff --git a/board/st/stm32f469-discovery/Makefile 
b/board/st/stm32f469-discovery/Makefile
new file mode 100644
index 000..9ecd61e
--- /dev/null
+++ b/board/st/stm32f469-discovery/Makefile
@@ -0,0 +1,8 @@
+#
+# Copyright (C) STMicroelectronics SA 2017
+# Author(s): Patrice CHOTARD,  for STMicroelectronics.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := stm32f469-discovery.o
diff --git a/board/st/stm32f469-discovery/stm32f469-discovery.c 
b/board/st/stm32f469-discovery/stm32f469-discovery.c
new file mode 100644
index 000..36f7b2e
--- /dev/null
+++ b/board/st/stm32f469-discovery/stm32f469-discovery.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2017
+ * Author(s): Patrice CHOTARD,  for STMicroelectronics.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+   int rv;
+   struct udevice *dev;
+
+   rv = uclass_get_device(UCLASS_RAM, 0, &dev);
+   if (rv) {
+   debug("DRAM init failed: %d\n", rv);
+   return rv;
+   }
+
+   if (fdtdec_setup_memory_size() != 0)
+   rv = -EINVAL;
+
+   return rv;
+}
+
+int dram_init_banksize(void)
+{
+   fdtdec_setup_memory_banksize();
+
+   return 0;
+}
+
+u32 get_board_rev(void)
+{
+   return 0;
+}
+
+int board_early_init_f(void)
+{
+   return 0;
+}
+
+int board_init(void)
+{
+   gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+   return 0;
+}
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+   char serialno[25];
+   u32 u_id_low, u_id_mid, u_id_high;
+
+   if (!env_get("serial#")) {
+   u_id_low  = readl(&STM32_U_ID->u_id_low);
+   u_id_mid  = readl(&STM32_U_ID->u_id_mid);
+   u_id_high = readl(&STM32_U_ID->u_id_high);
+

[U-Boot] [PATCH 07/14] mach-stm32: stmf32f4: timer: remove clock_get() call

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

In order to use common clock driver between STM32F4 and
STM32F7, remove clock_get() call
As APB_PSC is always set to 2, only case when
clock_get(CLOCK_AHB) != clock_get(CLOCK_APB1) is kept

Signed-off-by: Patrice Chotard 
---
 arch/arm/mach-stm32/stm32f4/timer.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-stm32/stm32f4/timer.c 
b/arch/arm/mach-stm32/stm32f4/timer.c
index 163f461..00b1d4a 100644
--- a/arch/arm/mach-stm32/stm32f4/timer.c
+++ b/arch/arm/mach-stm32/stm32f4/timer.c
@@ -51,12 +51,8 @@ int timer_init(void)
 
setbits_le32(&STM32_RCC->apb1enr, RCC_APB1ENR_TIM2EN);
 
-   if (clock_get(CLOCK_AHB) == clock_get(CLOCK_APB1))
-   writel((clock_get(CLOCK_APB1) / CONFIG_SYS_HZ_CLOCK) - 1,
-  &tim->psc);
-   else
-   writel(((clock_get(CLOCK_APB1) * 2) / CONFIG_SYS_HZ_CLOCK) - 1,
-  &tim->psc);
+   writel(((CONFIG_SYS_CLK_FREQ / 2) / CONFIG_SYS_HZ_CLOCK) - 1,
+  &tim->psc);
 
writel(0x, &tim->arr);
writel(TIM_CR1_CEN, &tim->cr1);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 05/14] configs: stm32f429-disco: enable MISC, STM32_RCC, DM_RESET and STM32_RESET

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

This allows to support rcc MFD driver.
By enabling all these flags, we need to increase malloc area to avoid
crash during early stage.

Signed-off-by: Patrice Chotard 
---
 configs/stm32f429-discovery_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/stm32f429-discovery_defconfig 
b/configs/stm32f429-discovery_defconfig
index 1cf3b6a..15ff646 100644
--- a/configs/stm32f429-discovery_defconfig
+++ b/configs/stm32f429-discovery_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_STM32=y
+CONFIG_SYS_MALLOC_F_LEN=0xF00
 CONFIG_STM32F4=y
 CONFIG_TARGET_STM32F429_DISCOVERY=y
 CONFIG_DEFAULT_DEVICE_TREE="stm32f429-disco"
@@ -18,7 +19,11 @@ CONFIG_CMD_TIMER=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_ENV_IS_IN_FLASH=y
+CONFIG_MISC=y
+CONFIG_STM32_RCC=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_RAM=y
 CONFIG_STM32_SDRAM=y
+CONFIG_DM_RESET=y
+CONFIG_STM32_RESET=y
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 04/14] pinctrl: stm32: add stm32f4 pinctrl compatible strings

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

STM32F4 SoCs uses the same pinctrl block as found into
STM32F7 and H7 SoCs.
We can add "st,stm32f429-pinctrl" and "st,stm32f469-pinctrl"
compatible string into pinctrl_stm32.c.

Signed-off-by: Patrice Chotard 
---
 drivers/pinctrl/pinctrl_stm32.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
index 51fdfb3..2066e11 100644
--- a/drivers/pinctrl/pinctrl_stm32.c
+++ b/drivers/pinctrl/pinctrl_stm32.c
@@ -182,6 +182,8 @@ static struct pinctrl_ops stm32_pinctrl_ops = {
 };
 
 static const struct udevice_id stm32_pinctrl_ids[] = {
+   { .compatible = "st,stm32f429-pinctrl" },
+   { .compatible = "st,stm32f469-pinctrl" },
{ .compatible = "st,stm32f746-pinctrl" },
{ .compatible = "st,stm32h743-pinctrl" },
{ }
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 02/14] ARM: DTS: stm32: add stm32f429-disco-u-boot dts file

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

_ Add gpio compatible and aliases for stm32f429

_ Add FMC sdram node with associated new bindings value to
  manage second bank (ie bank 1).

_ Add "u-boot,dm-pre-reloc" for rcc, fmc, fixed-clock, pinctrl,
  pwrcfg and gpio nodes.

Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/stm32f429-disco-u-boot.dtsi | 204 +++
 include/dt-bindings/memory/stm32-sdram.h |   2 +
 2 files changed, 206 insertions(+)
 create mode 100644 arch/arm/dts/stm32f429-disco-u-boot.dtsi

diff --git a/arch/arm/dts/stm32f429-disco-u-boot.dtsi 
b/arch/arm/dts/stm32f429-disco-u-boot.dtsi
new file mode 100644
index 000..59dda43
--- /dev/null
+++ b/arch/arm/dts/stm32f429-disco-u-boot.dtsi
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Patrice Chotard,  for STMicroelectronics.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+/{
+   clocks {
+   u-boot,dm-pre-reloc;
+   };
+
+   aliases {
+   /* Aliases for gpios so as to use sequence */
+   gpio0 = &gpioa;
+   gpio1 = &gpiob;
+   gpio2 = &gpioc;
+   gpio3 = &gpiod;
+   gpio4 = &gpioe;
+   gpio5 = &gpiof;
+   gpio6 = &gpiog;
+   gpio7 = &gpioh;
+   gpio8 = &gpioi;
+   gpio9 = &gpioj;
+   gpio10 = &gpiok;
+   };
+
+   soc {
+   u-boot,dm-pre-reloc;
+   pin-controller {
+   u-boot,dm-pre-reloc;
+   };
+
+   fmc: fmc@A000 {
+   compatible = "st,stm32-fmc";
+   reg = <0xA000 0x1000>;
+   clocks = <&rcc 0 STM32F4_AHB3_CLOCK(FMC)>;
+   pinctrl-0 = <&fmc_pins>;
+   pinctrl-names = "default";
+   u-boot,dm-pre-reloc;
+
+   /*
+* Memory configuration from sdram datasheet
+* IS42S16400J
+*/
+   bank1: bank@1 {
+  st,sdram-control = /bits/ 8 ;
+  st,sdram-timing = /bits/ 8 ;
+  st,sdram-refcount = < 1386 >;
+  };
+   };
+   };
+};
+
+&clk_hse {
+   u-boot,dm-pre-reloc;
+};
+
+&clk_lse {
+   u-boot,dm-pre-reloc;
+};
+
+&clk_i2s_ckin {
+   u-boot,dm-pre-reloc;
+};
+
+&pwrcfg {
+   u-boot,dm-pre-reloc;
+};
+
+&rcc {
+   u-boot,dm-pre-reloc;
+};
+
+&gpioa {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiob {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioc {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiod {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioe {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiof {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiog {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioh {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioi {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpioj {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&gpiok {
+   compatible = "st,stm32-gpio";
+   u-boot,dm-pre-reloc;
+};
+
+&pinctrl {
+   usart1_pins_a: usart1@0 {
+   u-boot,dm-pre-reloc;
+   pins1 {
+   u-boot,dm-pre-reloc;
+   };
+   pins2 {
+   u-boot,dm-pre-reloc;
+   };
+   };
+
+   fmc_pins: fmc@0 {
+   u-boot,dm-pre-reloc;
+   pins
+   {
+   pinmux = , /* D15 */
+, /* D14 */
+, /* D13 */
+, /* D12 */
+, /* D11 */
+, /* D10 */
+, /* D09 */
+, /* D08 */
+, /* D07 */
+, /* D06 */
+, /* D05 */
+, /* D04 */
+, /* D03 */
+, /* D02 */
+, /* D01 */
+, /* D00 */
+
+, /* NBL0 */
+, /* NBL1 */
+
+, /* BA1 */
+, /* BA0 */
+
+, /* A11 */
+, /* A10 */
+, /* A09 */
+, 

[U-Boot] [PATCH 01/14] ARM: DTS: stm32: add STM32F429 SoC and its Discovery board support

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

All these files comes from kernel v4.15-rc1.

Update some header with correct STMicroelectronics Copyright.

Remove the paragraph about writing to the Free Software
Foundation's mailing address as requested by checkpatch.

Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/Makefile   |   2 +
 arch/arm/dts/stm32f4-pinctrl.dtsi   | 344 ++
 arch/arm/dts/stm32f429-disco.dts| 124 +
 arch/arm/dts/stm32f429-pinctrl.dtsi |  96 
 arch/arm/dts/stm32f429.dtsi | 699 
 include/dt-bindings/mfd/stm32f4-rcc.h   | 108 +
 include/dt-bindings/pinctrl/stm32-pinfunc.h |  30 ++
 7 files changed, 1403 insertions(+)
 create mode 100644 arch/arm/dts/stm32f4-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32f429-disco.dts
 create mode 100644 arch/arm/dts/stm32f429-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32f429.dtsi
 create mode 100644 include/dt-bindings/mfd/stm32f4-rcc.h
 create mode 100644 include/dt-bindings/pinctrl/stm32-pinfunc.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9db56f2..77fac9e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -210,6 +210,8 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
 
 dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb
 
+dtb-$(CONFIG_STM32F4) += stm32f429-disco.dtb
+
 dtb-$(CONFIG_STM32F7) += stm32f746-disco.dtb \
stm32f769-disco.dtb
 dtb-$(CONFIG_STM32H7) += stm32h743i-disco.dtb \
diff --git a/arch/arm/dts/stm32f4-pinctrl.dtsi 
b/arch/arm/dts/stm32f4-pinctrl.dtsi
new file mode 100644
index 000..df59956
--- /dev/null
+++ b/arch/arm/dts/stm32f4-pinctrl.dtsi
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Alexandre Torgue  for 
STMicroelectronics.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+
+/ {
+   soc {
+   pinctrl: pin-controller {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges = <0 0x4002 0x3000>;
+   interrupt-parent = <&exti>;
+   st,syscfg = <&syscfg 0x8>;
+   pins-are-numbered;
+
+   gpioa: gpio@4002 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x0 0x400>;
+   clocks = <&rcc 0 STM32F4_AHB1_CLOCK(GPIOA)>;
+   st,bank-name = "GPIOA";
+   };
+
+   gpiob: gpio@40020400 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x400 0x400>;
+   

[U-Boot] [PATCH 00/14] Convert STM3F4 to DT and driver model

2017-11-30 Thread patrice.chotard
From: Patrice Chotard 

This is the final step to convert STM32F4 to device tree and driver model:
  _ add stm32f429-discovery device tree files from kernel v4.15-rc1.
  _ switch to DM driver (pinctrl, serial, gpio, clock, reset, sdram) 
and clean-up stm32f429-discovery.c board file.
  _ update STM32 sdram driver needed for stm32f469-disco board.
  _ add support for new stm32f469-disco board.
  _ update stm32f469-discovery device tree to enable MMC support.

Patrice Chotard (14):
  ARM: DTS: stm32: add STM32F429 SoC and its Discovery board support
  ARM: DTS: stm32: add stm32f429-disco-u-boot dts file
  board: stm32f429-discovery: switch to DM STM32 sdram driver
  pinctrl: stm32: add stm32f4 pinctrl compatible strings
  configs: stm32f429-disco: enable MISC,STM32_RCC,DM_RESET and
STM32_RESET
  board: stm32f429-disco: switch to DM STM32 serial driver
  mach-stm32: stmf32f4: timer: remove clock_get() call
  board: stm32f429-disco: switch to DM STM32 clock driver
  board: stm32f429-disco: switch to DM STM32 pinctrl and gpio driver
  ram: stm32: add memory mapping selection support
  ARM: DTS: add STM32F469 Discovery board support
  ARM: DTS: stm32: add stm32f469-disco-u-boot dts file
  board: stm32: add stm32f469-discovery board support
  ARM: DTS: stm32: add SDIO controller support for stm32f469-disco

 arch/arm/dts/Makefile  |   3 +
 arch/arm/dts/stm32f4-pinctrl.dtsi  | 375 +++
 arch/arm/dts/stm32f429-disco-u-boot.dtsi   | 204 ++
 arch/arm/dts/stm32f429-disco.dts   | 124 
 arch/arm/dts/stm32f429-pinctrl.dtsi|  96 +++
 arch/arm/dts/stm32f429.dtsi| 711 +
 arch/arm/dts/stm32f469-disco-u-boot.dtsi   | 230 +++
 arch/arm/dts/stm32f469-disco.dts   | 145 +
 arch/arm/dts/stm32f469-pinctrl.dtsi|  97 +++
 arch/arm/include/asm/arch-stm32f4/gpio.h   |  20 +-
 arch/arm/include/asm/arch-stm32f4/stm32.h  |  35 -
 arch/arm/mach-stm32/stm32f4/Kconfig|   4 +
 arch/arm/mach-stm32/stm32f4/Makefile   |   2 +-
 arch/arm/mach-stm32/stm32f4/clock.c| 258 
 arch/arm/mach-stm32/stm32f4/timer.c|   8 +-
 board/st/stm32f429-discovery/stm32f429-discovery.c | 277 +---
 board/st/stm32f469-discovery/Kconfig   |  19 +
 board/st/stm32f469-discovery/MAINTAINERS   |   6 +
 board/st/stm32f469-discovery/Makefile  |   8 +
 board/st/stm32f469-discovery/stm32f469-discovery.c |  74 +++
 configs/stm32f429-discovery_defconfig  |  16 +-
 configs/stm32f469-discovery_defconfig  |  42 ++
 drivers/clk/clk_stm32f.c   |   7 +-
 drivers/gpio/Makefile  |   1 -
 drivers/gpio/stm32_gpio.c  | 182 --
 drivers/pinctrl/pinctrl_stm32.c|   2 +
 drivers/ram/stm32_sdram.c  |  25 +
 drivers/serial/serial_stm32.c  | 117 
 include/configs/stm32f429-discovery.h  |   3 -
 include/configs/stm32f469-discovery.h  |  68 ++
 include/dt-bindings/memory/stm32-sdram.h   |   2 +
 include/dt-bindings/mfd/stm32f4-rcc.h  | 108 
 include/dt-bindings/pinctrl/stm32-pinfunc.h|  30 +
 33 files changed, 2426 insertions(+), 873 deletions(-)
 create mode 100644 arch/arm/dts/stm32f4-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32f429-disco-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32f429-disco.dts
 create mode 100644 arch/arm/dts/stm32f429-pinctrl.dtsi
 create mode 100644 arch/arm/dts/stm32f429.dtsi
 create mode 100644 arch/arm/dts/stm32f469-disco-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32f469-disco.dts
 create mode 100644 arch/arm/dts/stm32f469-pinctrl.dtsi
 delete mode 100644 arch/arm/mach-stm32/stm32f4/clock.c
 create mode 100644 board/st/stm32f469-discovery/Kconfig
 create mode 100644 board/st/stm32f469-discovery/MAINTAINERS
 create mode 100644 board/st/stm32f469-discovery/Makefile
 create mode 100644 board/st/stm32f469-discovery/stm32f469-discovery.c
 create mode 100644 configs/stm32f469-discovery_defconfig
 delete mode 100644 drivers/gpio/stm32_gpio.c
 delete mode 100644 drivers/serial/serial_stm32.c
 create mode 100644 include/configs/stm32f469-discovery.h
 create mode 100644 include/dt-bindings/mfd/stm32f4-rcc.h
 create mode 100644 include/dt-bindings/pinctrl/stm32-pinfunc.h

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 11/11] configs: omapl138_lcdk: decrease the loglevel to reduce the size of the SPL

2017-11-30 Thread Tom Rini
On Thu, Nov 30, 2017 at 05:44:04PM +0100, Jean-Jacques Hiblot wrote:

> The changes in the MMC stack have increased its footprint up to the point
> were its breaks the generation of the SPL for this platform.
> Fix this by reducing the loglevel.
> 
> Signed-off-by: Jean-Jacques Hiblot 
> ---
> 
> new patch that takes adavntage of "mmc: convert most of printf() to pr_err()
> and pr_warn()" to reduce the size of the SPL.
> WIthout this patch the SPL is too big and the build breaks.
> 
>  configs/omapl138_lcdk_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index 8d6b12f..0d4506e 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -8,6 +8,7 @@ CONFIG_SPL_MMC_SUPPORT=y
>  CONFIG_SPL_SERIAL_SUPPORT=y
>  CONFIG_SPL_NAND_SUPPORT=y
>  CONFIG_BOOTDELAY=3
> +CONFIG_LOGLEVEL=3
>  CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  # CONFIG_DISPLAY_BOARDINFO is not set

Peter?  Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 07/11] mmc: convert most of printf() to pr_err() and pr_warn()

2017-11-30 Thread Tom Rini
On Thu, Nov 30, 2017 at 05:44:00PM +0100, Jean-Jacques Hiblot wrote:

> This allows to compile out the log message by tweaking the LOGLEVEL.
> 
> Signed-off-by: Jean-Jacques Hiblot 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 11/11] configs: omapl138_lcdk: decrease the loglevel to reduce the size of the SPL

2017-11-30 Thread Jean-Jacques Hiblot
The changes in the MMC stack have increased its footprint up to the point
were its breaks the generation of the SPL for this platform.
Fix this by reducing the loglevel.

Signed-off-by: Jean-Jacques Hiblot 
---

new patch that takes adavntage of "mmc: convert most of printf() to pr_err()
and pr_warn()" to reduce the size of the SPL.
WIthout this patch the SPL is too big and the build breaks.

 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 8d6b12f..0d4506e 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -8,6 +8,7 @@ CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_BOOTDELAY=3
+CONFIG_LOGLEVEL=3
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 10/11] configs: openrd: removed support for eMMC hardware partitioning

2017-11-30 Thread Jean-Jacques Hiblot
builds are broken because the size of the binary exceeds the limit.
Make some space by removing support for hardware partitioning as those
boards don't have any eMMC.

Signed-off-by: Jean-Jacques Hiblot 
---
no change since v4

 configs/openrd_base_defconfig | 1 +
 configs/openrd_client_defconfig   | 1 +
 configs/openrd_ultimate_defconfig | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/openrd_base_defconfig b/configs/openrd_base_defconfig
index efebf82..80f8772 100644
--- a/configs/openrd_base_defconfig
+++ b/configs/openrd_base_defconfig
@@ -24,6 +24,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand_mtd:0x10@0x00(uboot),0x40@0x1
 CONFIG_CMD_UBI=y
 CONFIG_ISO_PARTITION=y
 CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_MMC_HW_PARTITIONING is not set
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/openrd_client_defconfig b/configs/openrd_client_defconfig
index 6722e42..000ba1a 100644
--- a/configs/openrd_client_defconfig
+++ b/configs/openrd_client_defconfig
@@ -24,6 +24,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand_mtd:0x10@0x00(uboot),0x40@0x1
 CONFIG_CMD_UBI=y
 CONFIG_ISO_PARTITION=y
 CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_MMC_HW_PARTITIONING is not set
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/openrd_ultimate_defconfig 
b/configs/openrd_ultimate_defconfig
index fb31b11..5b2e690 100644
--- a/configs/openrd_ultimate_defconfig
+++ b/configs/openrd_ultimate_defconfig
@@ -24,6 +24,7 @@ 
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand_mtd:0x10@0x00(uboot),0x40@0x1
 CONFIG_CMD_UBI=y
 CONFIG_ISO_PARTITION=y
 CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_MMC_HW_PARTITIONING is not set
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 01/11] mmc: dump card and host capabilities if debug is enabled

2017-11-30 Thread Jean-Jacques Hiblot
This is a useful information while debugging the initialization process or
performance issues.
Also dump this information with the other mmc info if the verbose option
is selected

Signed-off-by: Jean-Jacques Hiblot 
---
no changes since v3

 cmd/mmc.c | 4 
 drivers/mmc/mmc.c | 9 +
 2 files changed, 13 insertions(+)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 6d48ecb..25795e0 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -24,7 +24,11 @@ static void print_mmcinfo(struct mmc *mmc)
(mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
 
printf("Bus Speed: %d\n", mmc->clock);
+#if CONFIG_IS_ENABLED(MMC_VERBOSE)
printf("Mode : %s\n", mmc_mode_name(mmc->selected_mode));
+   mmc_dump_capabilities("card capabilities", mmc->card_caps);
+   mmc_dump_capabilities("host capabilities", mmc->host_caps);
+#endif
printf("Rd Block Len: %d\n", mmc->read_bl_len);
 
printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC",
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ab2483e..9b5c982 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1582,6 +1582,10 @@ static int sd_select_mode_and_width(struct mmc *mmc, 
uint card_caps)
bool uhs_en = (mmc->ocr & OCR_S18R) ? true : false;
uint caps;
 
+#ifdef DEBUG
+   mmc_dump_capabilities("sd card", card_caps);
+   mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT);
+#endif
 
/* Restrict card's capabilities by what the host can do */
caps = card_caps & (mmc->host_caps | MMC_MODE_1BIT);
@@ -1764,6 +1768,11 @@ static int mmc_select_mode_and_width(struct mmc *mmc, 
uint card_caps)
const struct mode_width_tuning *mwt;
const struct ext_csd_bus_width *ecbw;
 
+#ifdef DEBUG
+   mmc_dump_capabilities("mmc", card_caps);
+   mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT);
+#endif
+
/* Restrict card's capabilities by what the host can do */
card_caps &= (mmc->host_caps | MMC_MODE_1BIT);
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 08/11] mmc: make UHS and HS200 optional

2017-11-30 Thread Jean-Jacques Hiblot
Supporting USH and HS200 increases the code size as it brings in IO voltage
control, tuning and fatter data structures.
Use Kconfig configuration to select which of those features should be
built in.

Signed-off-by: Jean-Jacques Hiblot 
---

changes since v4:
* reordered the options for convenience

drivers/mmc/Kconfig  | 46 +++
 drivers/mmc/mmc-uclass.c |  4 +++
 drivers/mmc/mmc.c| 63 +++-
 include/mmc.h| 27 ++---
 4 files changed, 135 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index ad3e593..fe84edd 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -51,6 +51,52 @@ config MMC_QUIRKS
  are enabled by default, other may require additionnal flags or are
  enabled by the host driver.
 
+config MMC_IO_VOLTAGE
+   bool "Support IO voltage configuration"
+   help
+ IO voltage configuration allows selecting the voltage level of the IO
+ lines (not the level of main supply). This is required for UHS
+ support. For eMMC this not mandatory, but not enabling this option may
+ prevent the driver of using the faster modes.
+
+config SPL_MMC_IO_VOLTAGE
+   bool "Support IO voltage configuration in SPL"
+   default n
+   help
+ IO voltage configuration allows selecting the voltage level of the IO
+ lines (not the level of main supply). This is required for UHS
+ support. For eMMC this not mandatory, but not enabling this option may
+ prevent the driver of using the faster modes.
+
+config MMC_UHS_SUPPORT
+   bool "enable UHS support"
+   depends on MMC_IO_VOLTAGE
+   help
+ The Ultra High Speed (UHS) bus is available on some SDHC and SDXC
+ cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus
+ frequency can go up to 208MHz (SDR104)
+
+config SPL_MMC_UHS_SUPPORT
+   bool "enable UHS support in SPL"
+   depends on SPL_MMC_IO_VOLTAGE
+   help
+ The Ultra High Speed (UHS) bus is available on some SDHC and SDXC
+ cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus
+ frequency can go up to 208MHz (SDR104)
+
+config MMC_HS200_SUPPORT
+   bool "enable HS200 support"
+   help
+ The HS200 mode is support by some eMMC. The bus frequency is up to
+ 200MHz. This mode requires tuning the IO.
+
+
+config SPL_MMC_HS200_SUPPORT
+   bool "enable HS200 support in SPL"
+   help
+ The HS200 mode is support by some eMMC. The bus frequency is up to
+ 200MHz. This mode requires tuning the IO.
+
 config MMC_VERBOSE
bool "Output more information about the MMC"
default y
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index bfda942..793196b 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -63,6 +63,7 @@ void mmc_send_init_stream(struct mmc *mmc)
dm_mmc_send_init_stream(mmc->dev);
 }
 
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT)
 int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout)
 {
struct dm_mmc_ops *ops = mmc_get_ops(dev);
@@ -76,6 +77,7 @@ int mmc_wait_dat0(struct mmc *mmc, int state, int timeout)
 {
return dm_mmc_wait_dat0(mmc->dev, state, timeout);
 }
+#endif
 
 int dm_mmc_get_wp(struct udevice *dev)
 {
@@ -105,6 +107,7 @@ int mmc_getcd(struct mmc *mmc)
return dm_mmc_get_cd(mmc->dev);
 }
 
+#ifdef MMC_SUPPORTS_TUNING
 int dm_mmc_execute_tuning(struct udevice *dev, uint opcode)
 {
struct dm_mmc_ops *ops = mmc_get_ops(dev);
@@ -118,6 +121,7 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode)
 {
return dm_mmc_execute_tuning(mmc->dev, opcode);
 }
+#endif
 
 int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
 {
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 3fb82d9..400e163 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -59,10 +59,12 @@ struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
 
 #if !CONFIG_IS_ENABLED(DM_MMC)
 
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT)
 static int mmc_wait_dat0(struct mmc *mmc, int state, int timeout)
 {
return -ENOSYS;
 }
+#endif
 
 __weak int board_mmc_getwp(struct mmc *mmc)
 {
@@ -190,14 +192,20 @@ static uint mmc_mode2freq(struct mmc *mmc, enum bus_mode 
mode)
  [SD_LEGACY]   = 2500,
  [MMC_HS]  = 2600,
  [SD_HS]   = 5000,
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT)
  [UHS_SDR12]   = 2500,
  [UHS_SDR25]   = 5000,
  [UHS_SDR50]   = 1,
- [UHS_SDR104]  = 20800,
  [UHS_DDR50]   = 5000,
+#ifdef MMC_SUPPORTS_TUNING
+ [UHS_SDR104]  = 20800,
+#endif
+#endif
  [MMC_HS_52]   = 5200,
  [MMC_DDR_52]  = 5200,
+#if CONFIG_IS_ENABLED(MMC_H

[U-Boot] [PATCH v5 09/11] mmc: make optional the support for eMMC hardware partitioning

2017-11-30 Thread Jean-Jacques Hiblot
Not all boards have an eMMC and not all users have a need for this.
Allow to compile it out. By default it is still included.

Signed-off-by: Jean-Jacques Hiblot 
---
no change since v4

 cmd/mmc.c   | 4 
 drivers/mmc/Kconfig | 7 +++
 drivers/mmc/mmc.c   | 2 ++
 3 files changed, 13 insertions(+)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 25795e0..9a95293 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -438,6 +438,7 @@ static int do_mmc_list(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_SUCCESS;
 }
 
+#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
 static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
 int argc, char * const argv[])
 {
@@ -587,6 +588,7 @@ static int do_mmc_hwpartition(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 }
+#endif
 
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
 static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag,
@@ -796,7 +798,9 @@ static cmd_tbl_t cmd_mmc[] = {
U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
+#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),
+#endif
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""),
U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""),
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index fe84edd..36137bf 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -51,6 +51,13 @@ config MMC_QUIRKS
  are enabled by default, other may require additionnal flags or are
  enabled by the host driver.
 
+config MMC_HW_PARTITIONING
+   bool "Support for HW partitioning command(eMMC)"
+   default y
+   help
+ This adds a command and an API to do hardware partitioning on eMMC
+ devices.
+
 config MMC_IO_VOLTAGE
bool "Support IO voltage configuration"
help
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 400e163..67d05c5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -950,6 +950,7 @@ int mmc_switch_part(struct mmc *mmc, unsigned int part_num)
return ret;
 }
 
+#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
 int mmc_hwpart_config(struct mmc *mmc,
  const struct mmc_hwpart_conf *conf,
  enum mmc_hwpart_conf_mode mode)
@@ -1143,6 +1144,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 
return 0;
 }
+#endif
 
 #if !CONFIG_IS_ENABLED(DM_MMC)
 int mmc_getcd(struct mmc *mmc)
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 05/11] mmc: fix for old MMCs (below version 4)

2017-11-30 Thread Jean-Jacques Hiblot
The ext_csd is allocated only for MMC above version 4. The compare will
crash or fail for older MMCs.

Signed-off-by: Jean-Jacques Hiblot 
---
no change since v4

 drivers/mmc/mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 0ebcc45..2a58031 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1657,6 +1657,9 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc)
const u8 *ext_csd = mmc->ext_csd;
ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN);
 
+   if (mmc->version < MMC_VERSION_4)
+   return 0;
+
err = mmc_send_ext_csd(mmc, test_csd);
if (err)
return err;
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 03/11] mmc: Fixed a problem with old sd or mmc that do not support High speed

2017-11-30 Thread Jean-Jacques Hiblot
As the legacy modes were not added to the list of supported modes, old
cards that do not support other modes could not be used.

Signed-off-by: Jean-Jacques Hiblot 
Reviewed-by: Lukasz Majewski 
Reviewed-by: Simon Glass 
---
no change since v1

 drivers/mmc/mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 9b5c982..c1f8851 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -818,7 +818,7 @@ static int mmc_get_capabilities(struct mmc *mmc)
u8 *ext_csd = mmc->ext_csd;
char cardtype;
 
-   mmc->card_caps = MMC_MODE_1BIT;
+   mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(MMC_LEGACY);
 
if (mmc_host_is_spi(mmc))
return 0;
@@ -1171,7 +1171,7 @@ static int sd_get_capabilities(struct mmc *mmc)
int timeout;
u32 sd3_bus_mode;
 
-   mmc->card_caps = MMC_MODE_1BIT;
+   mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(SD_LEGACY);
 
if (mmc_host_is_spi(mmc))
return 0;
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 06/11] mmc: don't use malloc_cache_aligned()

2017-11-30 Thread Jean-Jacques Hiblot
Not using this function reduces the size of the binary. It's replaces by
a standard malloc() and the alignment requirement is handled by an
intermediate buffer on the stack.

Also make sure that the allocated buffer is freed in case of error.

Signed-off-by: Jean-Jacques Hiblot 
---
no change since v4

 drivers/mmc/mmc.c | 26 +-
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 2a58031..13979a5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1867,21 +1867,23 @@ static int mmc_startup_v4(struct mmc *mmc)
u64 capacity;
bool has_parts = false;
bool part_completed;
-   u8 *ext_csd;
+   ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
 
if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4))
return 0;
 
-   ext_csd = malloc_cache_aligned(MMC_MAX_BLOCK_LEN);
-   if (!ext_csd)
-   return -ENOMEM;
-
-   mmc->ext_csd = ext_csd;
-
/* check  ext_csd version and capacity */
err = mmc_send_ext_csd(mmc, ext_csd);
if (err)
-   return err;
+   goto error;
+
+   /* store the ext csd for future reference */
+   if (!mmc->ext_csd)
+   mmc->ext_csd = malloc(MMC_MAX_BLOCK_LEN);
+   if (!mmc->ext_csd)
+   return -ENOMEM;
+   memcpy(mmc->ext_csd, ext_csd, MMC_MAX_BLOCK_LEN);
+
if (ext_csd[EXT_CSD_REV] >= 2) {
/*
 * According to the JEDEC Standard, the value of
@@ -1990,7 +1992,7 @@ static int mmc_startup_v4(struct mmc *mmc)
 EXT_CSD_ERASE_GROUP_DEF, 1);
 
if (err)
-   return err;
+   goto error;
 
ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;
}
@@ -2029,6 +2031,12 @@ static int mmc_startup_v4(struct mmc *mmc)
mmc->wr_rel_set = ext_csd[EXT_CSD_WR_REL_SET];
 
return 0;
+error:
+   if (mmc->ext_csd) {
+   free(mmc->ext_csd);
+   mmc->ext_csd = NULL;
+   }
+   return err;
 }
 
 static int mmc_startup(struct mmc *mmc)
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 04/11] mmc: all hosts support 1-bit bus width and legacy timings

2017-11-30 Thread Jean-Jacques Hiblot
Make sure that those basic capabilities are advertised by the host.

Signed-off-by: Jean-Jacques Hiblot 
Reviewed-by: Lukasz Majewski 
Reviewed-by: Simon Glass 
---

no change since v1

 drivers/mmc/mmc.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index c1f8851..0ebcc45 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1584,11 +1584,11 @@ static int sd_select_mode_and_width(struct mmc *mmc, 
uint card_caps)
 
 #ifdef DEBUG
mmc_dump_capabilities("sd card", card_caps);
-   mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT);
+   mmc_dump_capabilities("host", mmc->host_caps);
 #endif
 
/* Restrict card's capabilities by what the host can do */
-   caps = card_caps & (mmc->host_caps | MMC_MODE_1BIT);
+   caps = card_caps & mmc->host_caps;
 
if (!uhs_en)
caps &= ~UHS_CAPS;
@@ -1770,11 +1770,11 @@ static int mmc_select_mode_and_width(struct mmc *mmc, 
uint card_caps)
 
 #ifdef DEBUG
mmc_dump_capabilities("mmc", card_caps);
-   mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT);
+   mmc_dump_capabilities("host", mmc->host_caps);
 #endif
 
/* Restrict card's capabilities by what the host can do */
-   card_caps &= (mmc->host_caps | MMC_MODE_1BIT);
+   card_caps &= mmc->host_caps;
 
/* Only version 4 of MMC supports wider bus widths */
if (mmc->version < MMC_VERSION_4)
@@ -2389,7 +2389,12 @@ int mmc_start_init(struct mmc *mmc)
bool uhs_en = supports_uhs(mmc->cfg->host_caps);
int err;
 
-   mmc->host_caps = mmc->cfg->host_caps;
+   /*
+* all hosts are capable of 1 bit bus-width and able to use the legacy
+* timings.
+*/
+   mmc->host_caps = mmc->cfg->host_caps | MMC_CAP(SD_LEGACY) |
+MMC_CAP(MMC_LEGACY) | MMC_MODE_1BIT;
 
/* we pretend there's no card when init is NULL */
no_card = mmc_getcd(mmc) == 0;
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 02/11] dm: mmc: update mmc_of_parse()

2017-11-30 Thread Jean-Jacques Hiblot
* convert to livetree API
* don't fail because of an invalid bus-width, instead default to 1-bit.
* recognize 1.2v DDR and 1.2v HS200 flags

Signed-off-by: Jean-Jacques Hiblot 
---
no changes since v3

 drivers/mmc/mmc-uclass.c | 36 
 include/mmc.h| 11 ++-
 2 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index e30cde7..bfda942 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "mmc_private.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -120,11 +119,11 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode)
return dm_mmc_execute_tuning(mmc->dev, opcode);
 }
 
-int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg)
+int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
 {
int val;
 
-   val = fdtdec_get_int(fdt, node, "bus-width", 1);
+   val = dev_read_u32_default(dev, "bus-width", 1);
 
switch (val) {
case 0x8:
@@ -137,30 +136,35 @@ int mmc_of_parse(const void *fdt, int node, struct 
mmc_config *cfg)
cfg->host_caps |= MMC_MODE_1BIT;
break;
default:
-   printf("error: %s invalid bus-width property %d\n",
-  fdt_get_name(fdt, node, NULL), val);
-   return -ENOENT;
+   debug("warning: %s invalid bus-width property. using 1-bit\n",
+ dev_read_name(dev));
+   cfg->host_caps |= MMC_MODE_1BIT;
+   break;
}
 
-   cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 5200);
+   cfg->f_max = dev_read_u32_default(dev, "max-frequency", 5200);
 
-   if (fdtdec_get_bool(fdt, node, "cap-sd-highspeed"))
+   if (dev_read_bool(dev, "cap-sd-highspeed"))
cfg->host_caps |= MMC_CAP(SD_HS);
-   if (fdtdec_get_bool(fdt, node, "cap-mmc-highspeed"))
+   if (dev_read_bool(dev, "cap-mmc-highspeed"))
cfg->host_caps |= MMC_CAP(MMC_HS);
-   if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr12"))
+   if (dev_read_bool(dev, "sd-uhs-sdr12"))
cfg->host_caps |= MMC_CAP(UHS_SDR12);
-   if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr25"))
+   if (dev_read_bool(dev, "sd-uhs-sdr25"))
cfg->host_caps |= MMC_CAP(UHS_SDR25);
-   if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr50"))
+   if (dev_read_bool(dev, "sd-uhs-sdr50"))
cfg->host_caps |= MMC_CAP(UHS_SDR50);
-   if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr104"))
+   if (dev_read_bool(dev, "sd-uhs-sdr104"))
cfg->host_caps |= MMC_CAP(UHS_SDR104);
-   if (fdtdec_get_bool(fdt, node, "sd-uhs-ddr50"))
+   if (dev_read_bool(dev, "sd-uhs-ddr50"))
cfg->host_caps |= MMC_CAP(UHS_DDR50);
-   if (fdtdec_get_bool(fdt, node, "mmc-ddr-1_8v"))
+   if (dev_read_bool(dev, "mmc-ddr-1_8v"))
cfg->host_caps |= MMC_CAP(MMC_DDR_52);
-   if (fdtdec_get_bool(fdt, node, "mmc-hs200-1_8v"))
+   if (dev_read_bool(dev, "mmc-ddr-1_2v"))
+   cfg->host_caps |= MMC_CAP(MMC_DDR_52);
+   if (dev_read_bool(dev, "mmc-hs200-1_8v"))
+   cfg->host_caps |= MMC_CAP(MMC_HS_200);
+   if (dev_read_bool(dev, "mmc-hs200-1_2v"))
cfg->host_caps |= MMC_CAP(MMC_HS_200);
 
return 0;
diff --git a/include/mmc.h b/include/mmc.h
index 6230a32..e3f777f 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -651,7 +651,16 @@ int mmc_unbind(struct udevice *dev);
 int mmc_initialize(bd_t *bis);
 int mmc_init(struct mmc *mmc);
 int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error);
-int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg);
+
+/**
+ * mmc_of_parse() - Parse the device tree to get the capabilities of the host
+ *
+ * @dev:   MMC device
+ * @cfg:   MMC configuration
+ * @return 0 if OK, -ve on error
+ */
+int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg);
+
 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
 
 /**
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 07/11] mmc: convert most of printf() to pr_err() and pr_warn()

2017-11-30 Thread Jean-Jacques Hiblot
This allows to compile out the log message by tweaking the LOGLEVEL.

Signed-off-by: Jean-Jacques Hiblot 
---
changes since v4:
this replaces patch 'mmc: allow to compile out the error messages'. Instead
of using a custom macro to compile out the log messages, rely on the existing
pr_err() and pr_warn() macros and the LOGLEVEL config option.

 drivers/mmc/Kconfig |  7 ---
 drivers/mmc/mmc.c   | 44 ++--
 2 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index dbbef5a..ad3e593 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -58,13 +58,6 @@ config MMC_VERBOSE
  Enable the output of more information about the card such as the
  operating mode.
 
-config SPL_MMC_VERBOSE
-   bool "Output more information about the MMC in SPL"
-   default n
-   help
- Enable the output of more information about the card such as the
- operating mode.
-
 config SPL_MMC_TINY
bool "Tiny MMC framework in SPL"
help
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 13979a5..3fb82d9 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -251,8 +251,8 @@ int mmc_send_status(struct mmc *mmc, int timeout)
 
if (cmd.response[0] & MMC_STATUS_MASK) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-   printf("Status Error: 0x%08X\n",
-   cmd.response[0]);
+   pr_err("Status Error: 0x%08X\n",
+  cmd.response[0]);
 #endif
return -ECOMM;
}
@@ -268,7 +268,7 @@ int mmc_send_status(struct mmc *mmc, int timeout)
mmc_trace_state(mmc, &cmd);
if (timeout <= 0) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-   printf("Timeout waiting card ready\n");
+   pr_err("Timeout waiting card ready\n");
 #endif
return -ETIMEDOUT;
}
@@ -408,7 +408,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, 
lbaint_t start,
cmd.resp_type = MMC_RSP_R1b;
if (mmc_send_cmd(mmc, &cmd, NULL)) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-   printf("mmc fail to send stop cmd\n");
+   pr_err("mmc fail to send stop cmd\n");
 #endif
return 0;
}
@@ -448,8 +448,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, 
lbaint_t blkcnt,
 
if ((start + blkcnt) > block_dev->lba) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-   printf("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
-   start + blkcnt, block_dev->lba);
+   pr_err("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
+  start + blkcnt, block_dev->lba);
 #endif
return 0;
}
@@ -828,7 +828,7 @@ static int mmc_get_capabilities(struct mmc *mmc)
return 0;
 
if (!ext_csd) {
-   printf("No ext_csd found!\n"); /* this should enver happen */
+   pr_err("No ext_csd found!\n"); /* this should enver happen */
return -ENOTSUPP;
}
 
@@ -946,17 +946,17 @@ int mmc_hwpart_config(struct mmc *mmc,
return -EINVAL;
 
if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4_41)) {
-   printf("eMMC >= 4.4 required for enhanced user data area\n");
+   pr_err("eMMC >= 4.4 required for enhanced user data area\n");
return -EMEDIUMTYPE;
}
 
if (!(mmc->part_support & PART_SUPPORT)) {
-   printf("Card does not support partitioning\n");
+   pr_err("Card does not support partitioning\n");
return -EMEDIUMTYPE;
}
 
if (!mmc->hc_wp_grp_size) {
-   printf("Card does not define HC WP group size\n");
+   pr_err("Card does not define HC WP group size\n");
return -EMEDIUMTYPE;
}
 
@@ -964,7 +964,7 @@ int mmc_hwpart_config(struct mmc *mmc,
if (conf->user.enh_size) {
if (conf->user.enh_size % mmc->hc_wp_grp_size ||
conf->user.enh_start % mmc->hc_wp_grp_size) {
-   printf("User data enhanced area not HC WP group "
+   pr_err("User data enhanced area not HC WP group "
   "size aligned\n");
return -EINVAL;
}
@@ -983,7 +983,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 
for (pidx = 0; pidx < 4; pidx++) {
if (conf->gp_part[pidx].size % mmc->hc_wp_grp_size) {
-   printf("GP%i partition not HC WP group size "
+   pr_err("GP%i par

[U-Boot] [PATCH v5 00/11] mmc: fixes for HS200/UHS core support

2017-11-30 Thread Jean-Jacques Hiblot
This series applies on top of "[PATCH v2 00/26] mmc: Add support for HS200
and UHS modes"

It fixes a bug with old SD and MMC cards that support only the legacy mode.
This series also adresses the problem of increased code size that broke some
platform (openrd and omapl138_lcdk) by making more things optional.

It also addresses other comments made on the mailing list:
* dump card and host capabilities in debug mode
* use 1-bit if the DTS property 'bus-width' is not present.
* recognize the "mmc-ddr-1_2v" and "mmc-hs200-1_2v" DTS properties
* convert mmc_of_parse to livetree

  
Tested on DRA72

changes since v4:
* use pr_warn() and pr_error() instead of custom macro to output log messages
* add a new patch to lower the LOGLEVEL for the platform omapl138_lcdk
* Fix typo in patch 'mmc: make optional the support for eMMC hardware
  partitioning'

changes since v3:
* Make UHS support optional. Disabled by default
* Make HS200 support optional. Disabled by default
* Make eMMC Hardware Partitioning optional. Enabled by default
* Display most of the error messages only if MMC_VERBOSE is set (it's set by 
default)

changes since v2:
* use the device-oriented helpers like dev_read_u32_default() instead of using
  the livetree API
* Dump the host and card capabilities only in when debug is enabled. Also dump
  the capabilities when 'mmc info' is executed if the verbose option is enabled

changes since v1:
* convert mmc_of_parse to livetree
* squashed all changes to mmc_of_parse in a single patch

Jean-Jacques Hiblot (11):
  mmc: dump card and host capabilities if debug is enabled
  dm: mmc: update mmc_of_parse()
  mmc: Fixed a problem with old sd or mmc that do not support High speed
  mmc: all hosts support 1-bit bus width and legacy timings
  mmc: fix for old MMCs (below version 4)
  mmc: don't use malloc_cache_aligned()
  mmc: convert most of printf() to pr_err() and pr_warn()
  mmc: make UHS and HS200 optional
  mmc: make optional the support for eMMC hardware partitioning
  configs: openrd: removed support for eMMC hardware partitioning
  configs: omapl138_lcdk: decrease the loglevel to reduce the size of
the SPL

 cmd/mmc.c |   8 ++
 configs/omapl138_lcdk_defconfig   |   1 +
 configs/openrd_base_defconfig |   1 +
 configs/openrd_client_defconfig   |   1 +
 configs/openrd_ultimate_defconfig |   1 +
 drivers/mmc/Kconfig   |  58 --
 drivers/mmc/mmc-uclass.c  |  40 ++
 drivers/mmc/mmc.c | 162 +-
 include/mmc.h |  38 +++--
 9 files changed, 246 insertions(+), 64 deletions(-)

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v3,10/14] log: Add a test command

2017-11-30 Thread Tom Rini
On Thu, Nov 30, 2017 at 09:27:13AM -0700, Simon Glass wrote:
> Hi Tom,
> 
> On 29 November 2017 at 20:35, Tom Rini  wrote:
> > On Mon, Nov 20, 2017 at 03:33:31PM -0700, Simon Glass wrote:
> >
> >> Add a command which exercises the logging system.
> >>
> >> Signed-off-by: Simon Glass 
> >> Reviewed-by: Lukasz Majewski 
> >
> > NAK.  With clang-3.8 we see this (and many more):
> > test/log/log_test.c:35:16: warning: implicit conversion from
> > enumeration type 'enum uclass_id' to different enumeration type 'enum
> > log_category_t' [-Wenum-conversion]
> > UCLASS_MMC, UCLASS_SPI, LOGC_NONE, LOGC_END
> > ^~
> >
> > For nearly all instances of UCLASS_MMC and UCLASS_SPI in the code.
> 
> That is unfortunate. I was really hoping to use the uclass as the
> logging class. I'll have to add a cast or something like that,

There were a bunch of other clang related warnings in this series too (I
wasn't sure which patch, nor for certain it was this series until I
dropped 'em all, after sending the email here).  Can you please grab
clang-3.8 (easy in Debian 9/Ubuntu 16.04 at least) and see what pops up
over the whole series?  Also, don't move up newer as, sigh, there's a
bunch of other warnings showing up unrelated there and I haven't sat
down and tried to figure any of those out.  Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Build failure in u-boot-mmc/master: undefined reference to error

2017-11-30 Thread Stephen Warren

On 11/27/2017 02:59 AM, Jaehoon Chung wrote:

On 11/03/2017 05:52 AM, Stephen Warren wrote:

On 10/24/2017 01:54 AM, Jaehoon Chung wrote:

On 10/24/2017 12:22 AM, Stephen Warren wrote:

On 10/22/2017 08:53 PM, Jaehoon Chung wrote:

Dear Stephen,

On 10/21/2017 12:47 AM, Stephen Warren wrote:

With the latest content of u-boot-mmc/master, 41dc35a149b3 "drivers: mmc: Avoid 
memory leak in case of failure", all Tegra boards (perhaps others too; my system 
only tests Tegra) fail to build with the following error:


I had found the same error at build testing, I will fix it on today.
Thanks for noticing it.


Thanks.

I see that the build failures are fixed now, but the following unit-tests are 
failing on sandbox:

test_ut[ut_dm_blk_base]
test_ut[ut_dm_blk_devnum]
test_ut[ut_dm_blk_get_from_parent]
test_ut[ut_dm_mmc_base]
test_ut[ut_dm_mmc_blk]

For example:


=> ut dm blk_base
Test: dm_test_blk_base: blk.c
unable to select a mode
mmc_init: -524, time 6
/var/lib/jenkins/workspace/u-boot-denx_uboot_mmc-master-build/src/u-boot/test/dm/blk.c:40,
 dm_test_blk_base(): 0 == blk_first_device(IF_TYPE_HOST, &dev): Expected 0, got 
-524
Test: dm_test_blk_base: blk.c (flat tree)
unable to select a mode
mmc_init: -524, time 6
/var/lib/jenkins/workspace/u-boot-denx_uboot_mmc-master-build/src/u-boot/test/dm/blk.c:40,
 dm_test_blk_base(): 0 == blk_first_device(IF_TYPE_HOST, &dev): Expected 0, got 
-524
Failures: 2


You should be able to reproduce this by running the following from the U-Boot 
source tree:

./test/py/test.py --bd sandbox --build


Will check. thanks!


Jaehoon, did you find the issue? I don't see any new commits pushed.


Sorry for late. I didn't see this issue.. Well, i'm checking one more..


FYI the latest code pushed within the last 24 hours still has the same 
issue.

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v3,10/14] log: Add a test command

2017-11-30 Thread Simon Glass
Hi Tom,

On 29 November 2017 at 20:35, Tom Rini  wrote:
> On Mon, Nov 20, 2017 at 03:33:31PM -0700, Simon Glass wrote:
>
>> Add a command which exercises the logging system.
>>
>> Signed-off-by: Simon Glass 
>> Reviewed-by: Lukasz Majewski 
>
> NAK.  With clang-3.8 we see this (and many more):
> test/log/log_test.c:35:16: warning: implicit conversion from
> enumeration type 'enum uclass_id' to different enumeration type 'enum
> log_category_t' [-Wenum-conversion]
> UCLASS_MMC, UCLASS_SPI, LOGC_NONE, LOGC_END
> ^~
>
> For nearly all instances of UCLASS_MMC and UCLASS_SPI in the code.

That is unfortunate. I was really hoping to use the uclass as the
logging class. I'll have to add a cast or something like that,

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] test/py: Add dependency on HUSH parser

2017-11-30 Thread Michal Simek
Hi,

On 15.11.2017 19:31, Stephen Warren wrote:
> On 11/15/2017 02:34 AM, Michal Simek wrote:
>> Hi,
>>
>> On 10.11.2017 22:34, Stephen Warren wrote:
>>> On 11/10/2017 04:01 AM, Michal Simek wrote:
 After adding our small zynq uboot which has hush parser off these 3
 tests
 start to failed. It is probably just coincidence that others are
 passing without hush parser.
>>>
>>> What was the exact problem here? The set of tests you've disabled all
>>> seem to rely on setenv/printenv and don't seem to do anything
>>> complicated shell syntax wise. Are you sure they shouldn't depend on
>>> setenv being available rather than hush_parser?
>>
>> These 3 tests. (html attached too.)
>>
>> Zynq> printenv baudrate
>> baudrate=115200
>> Zynq>
>> test/py/tests/test_env.py .sZynq> printenv test_env_0
>> ## Error: "test_env_0" not defined
>> Zynq> .sZynq> setenv test_env_0 "foo"
>> Zynq> printenv test_env_0
>> test_env_0="foo"
>> Zynq> F+u-boot-test-reset zynq_cse_qspi zc706
>>
>>
>>
>> Zynq> Zynq> setenv test_env_0 "bar"
>> Zynq> printenv test_env_0
>> test_env_0="bar"
>> Zynq> F
> 
> For those two failures, the issue is that the test is expecting setenv
> to print:
> 
> test_env_0=foo
> test_env_0=bar
> 
> ... but it prints:
> 
> test_env_0="foo"
> test_env_0="bar"
> 
> I guess this is because the set_var() function wraps the values in
> quotes to ensure that values that contain spaces work as expected, yet
> when not using Hush, quotes aren't processed.
> 
> I think the best solution is to enhance set_var() to do the following if
> Hush isn't available:
> 
> a) Skip the test if the value contains any spaces (or perhaps if the
> value contains any characters that aren't in a whitelist.
> 
> b) Not use quotes when not running on Hush.
> 
> I think re-writing it as follows would work:
> 
>>     bc = state_test_env.u_boot_console.config.buildconfig
>>     if bc.get('config_hush_parser', None):
>>     quote = '"'
>>     else:
>>     quote = ''
>>     if ' ' in value:
>>     pytest.skip('Space in variable value on non-Hush shell')
>>
>>     state_test_env.u_boot_console.run_command(
>>     'setenv %s %s%s%s' % (var, quote, value, quote))
>>     state_test_env.env[var] = value
> 


First of all sorry for delay. I had to fix some other issues.
This is fixing issues with all tests and I have sent v2.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs




signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] test/py: Setup variables based on HUSH selection

2017-11-30 Thread Michal Simek
From: Stephen Warren 

After adding our small zynq uboot which has hush parser off same
variable tests start to failed. Use quotes only when hush is enabled.

Reported-by: Michal Simek 
Signed-off-by: Stephen Warren 
---

Changes in v2:
- code taken from v1 review from Stephen

Stephen: it is your code that's why I have added your SoB line. Tests
are passing for hush and !hush cases

Signed-off-by: Michal Simek 
---
 test/py/tests/test_env.py | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index b7f960c755fe..f8694017b42a 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -125,7 +125,16 @@ def set_var(state_test_env, var, value):
 Nothing.
 """
 
-state_test_env.u_boot_console.run_command('setenv %s "%s"' % (var, value))
+bc = state_test_env.u_boot_console.config.buildconfig
+if bc.get('config_hush_parser', None):
+quote = '"'
+else:
+quote = ''
+if ' ' in value:
+pytest.skip('Space in variable value on non-Hush shell')
+
+state_test_env.u_boot_console.run_command(
+'setenv %s %s%s%s' % (var, quote, value, quote))
 state_test_env.env[var] = value
 
 def validate_empty(state_test_env, var):
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] armv8: fsl-layerscape: SPL size reduction

2017-11-30 Thread Sumit Garg
> -Original Message-
> From: York Sun
> Sent: Thursday, November 30, 2017 12:07 AM
> To: Sumit Garg ; u-boot@lists.denx.de
> Cc: Ruchika Gupta ; Prabhakar Kushwaha
> ; Ashish Kumar 
> Subject: Re: [PATCH 1/3] armv8: fsl-layerscape: SPL size reduction
> 
> On 10/05/2017 12:55 AM, Sumit Garg wrote:
> >
> > I will wait for SD boot patches to be accepted in upstream. As
> > reducing SPL size for ls1088ardb in upstream does only makes sense
> > once we have base platform support merged in upstream.
> >
> 
> Please rework this patch set.
> 
> York

Sure, I will pick it up. Actually I am currently occupied in some other work.

Sumit
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] fastboot: Enable flashing by default on sunxi

2017-11-30 Thread Maxime Ripard
On Thu, Nov 30, 2017 at 09:56:18AM +, Andre Przywara wrote:
> Hi,
> 
> On 30/11/17 07:58, Maxime Ripard wrote:
> > On Thu, Nov 30, 2017 at 12:23:28AM +, André Przywara wrote:
> >> On 28/11/17 10:34, Maxime Ripard wrote:
> >>> Now that more and more devices are built using eMMC, providing a way to
> >>> easily flash the system without too much hassle seems like a right thing 
> >>> to
> >>> do.
> >>>
> >>> Since fastboot is the most deployed tool to do that these days, we can 
> >>> just
> >>> rely on it to provide a way to flash the various components in the system
> >>> (SPL, U-Boot and the system itself) easily, especially since you can 
> >>> upload
> >>> the U-Boot hosting the fastboot "server" through FEL.
> >>>
> >>> Signed-off-by: Maxime Ripard 
> >>
> >> Reviewed-by: Andre Przywara 
> >>
> >> The binary size for 32-bit targets is still reasonable with this
> >> addition (thanks to Thumb2).
> >>
> >> But if I enable MUSB for the Pine64 it generates a 537KB u-boot.itb. And
> >> the build process does not complain, I guess because I don't generate a
> >> combined binary (glueing SPL in front). But this isn't really caused by
> >> this patch, so just a heads up.
> > 
> > I guess we would need to have kind of the same check at compile time
> > for ARM64 then. I'm not sure exactly how that would be doable
> > though...
> 
> Me neither without digging deeply into the build system ;-)
> 
> By the way, can you point me to the part which triggers the generation
> of u-boot-sunxi-with-spl.bin? This does not get generated for ARM64 at
> the moment, though it should. And this is probably the place where the
> check lives for ARM.

I *think* this is in arch/arm/cpu/armv7/sunxi/config.mk

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/4] sunxi: Add default partition scheme

2017-11-30 Thread Maxime Ripard
On Thu, Nov 30, 2017 at 09:22:07AM +, Andre Przywara wrote:
> Hi,
> 
> On 30/11/17 07:56, Maxime Ripard wrote:
> > Hi,
> > 
> > On Thu, Nov 30, 2017 at 12:23:06AM +, André Przywara wrote:
> >> Hi Maxime,
> >>
> >> On 28/11/17 10:34, Maxime Ripard wrote:
> >>> The partitions variable is especially useful to create a partition table
> >>> from U-Boot, either directly from the U-Boot shell, or through flashing
> >>> tools like fastboot and its oem format command.
> >>>
> >>> This is especially useful on devices with an eMMC you can't take out to
> >>> flash from another system, and booting a Linux system first to flash our
> >>> system then is not really practical.
> >>>
> >>> Signed-off-by: Maxime Ripard 
> >>> ---
> >>>  include/configs/sunxi-common.h |  9 +
> >>>  1 file changed, 9 insertions(+)
> >>>
> >>> diff --git a/include/configs/sunxi-common.h 
> >>> b/include/configs/sunxi-common.h
> >>> index 4391a8cbc824..c9214a709221 100644
> >>> --- a/include/configs/sunxi-common.h
> >>> +++ b/include/configs/sunxi-common.h
> >>> @@ -493,6 +493,12 @@ extern int soft_i2c_gpio_scl;
> >>>  #define SUNXI_MTDPARTS_DEFAULT
> >>>  #endif
> >>>  
> >>> +#define PARTS_DEFAULT \
> >>> + "name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};" \
> >>> + "name=loader2,size=984k,uuid=${uuid_gpt_loader2};" \
> >>> + "name=esp,size=128M,bootable,uuid=${uuid_gpt_esp};" \
> >>
> >> Those numbers look right to me, but I can't find the definition of
> >> uuid_gpt_loader{1,2} in U-Boot. Only I see them referenced by some
> >> rockchip header.
> >> Is there some magic definition I missed or do we actually need to add them?
> >> I guess you are after the Android-IA bootloader UUIDs from the Wikipedia
> >> page, starting with 2568845D- and 114EAFFE-?
> > 
> > The fact that they have been left out is intentional. Without a UUID
> > defined, U-Boot will generate a random one if you have
> > CONFIG_RANDOM_UUID set. That kind of construct allow you to specifiy a
> > UUID if you want, without modifying the partitions variable.
> 
> Ah, thanks for the explanation, I was afraid I missed something.
> 
> > I'm totally fine with having a default one though. I just couldn't
> > find one that would be relevant, so I left it out.
> 
> I guess this is fine. Wikipedia[1] points me to Android-IA having
> specified two UUIDs for boot loader partitions here [2], but I don't
> think they are really authoritative.

Yeah, I saw those as well, and came to the same conclusion :)

> >>> + "name=system,size=-,uuid=${uuid_gpt_system};"
> >>
> >> So does fastboot require a system partition? And it wouldn't know where
> >> to put the rootfs to without one?
> >> In this case I guess it's fine, because it fits the use case.
> >> But otherwise (as mentioned before) one giant partition to fill the rest
> >> of the "disk" is more annoying than helpful for regular Linux installers.
> > 
> > So fasboot is dumber than you assume it to be ;)
> > 
> > The only thing you do is giving it a file and a partition. So yeah,
> > you would need to have a partition defined for that.
> > 
> >>> +
> >>>  #define CONSOLE_ENV_SETTINGS \
> >>>   CONSOLE_STDIN_SETTINGS \
> >>>   CONSOLE_STDOUT_SETTINGS
> >>> @@ -511,6 +517,9 @@ extern int soft_i2c_gpio_scl;
> >>>   "console=ttyS0,115200\0" \
> >>>   SUNXI_MTDIDS_DEFAULT \
> >>>   SUNXI_MTDPARTS_DEFAULT \
> >>> + "uuid_gpt_esp=C12A7328-F81F-11D2-BA4B-00A0C93EC93B\0" \
> >>> + "uuid_gpt_system=0FC63DAF-8483-4772-8E79-3D69D8477DE4\0" \
> >>
> >> The ESP GUID is correct, the other is "Linux filesystem data", right?
> >> Technically I guess root partition would be more suitable, but we would
> >> need to know whether it's AArch64 or ARM, if I get this correctly.
> >> Shall we use #ifdef CONFIG_ARM64 here?
> > 
> > We can, what UUID do you have in mind?
> 
> FreeDesktop [3] seems to define some UUIDs for Linux root partitions,
> separated by architectures, and it lists ARM and AArch64.

Ok, I'll use them then.

Thanks!
maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] env: suppress a spurious warning with GCC 7.1

2017-11-30 Thread Tom Rini
On Tue, Nov 21, 2017 at 11:29:40PM +0100, Philipp Tomsich wrote:

> GCC 7.1 seems to be smart enough to track val through the various
> static inline functions, but not smart enough to see that val will
> always be initialised when no error is returned.  This triggers
> the following warning:
>   env/mmc.c: In function 'mmc_get_env_addr':
>   env/mmc.c:121:12: warning: 'val' may be used uninitialized in this function 
> [-Wmaybe-uninitialized]
> 
> To make it easier for compiler to understand what is going on, let's
> initialise val.
> 
> Signed-off-by: Philipp Tomsich 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v2,1/2] board: laird: add WB45N CPU module

2017-11-30 Thread Tom Rini
On Thu, Nov 23, 2017 at 01:47:47PM +, Ben Whitten wrote:

> From: Ben Whitten 
> 
> This board is based on the Atmel 9x5 eval board.
> Supporting the following features:
>  - Boot from NAND Flash
>  - Ethernet
>  - FIT
>  - SPL
> 
> Signed-off-by: Ben Whitten 
> Signed-off-by: Dan Kephart 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/2] clk: at91: clk-generated: select absolute closest rate

2017-11-30 Thread Tom Rini
On Fri, Nov 17, 2017 at 02:50:21PM +0800, Wenyou Yang wrote:

> From: Ludovic Desroches 
> 
> To get the same behavior as the Linux driver, instead of selecting
> the closest inferior rate, select the closest inferior or superior
> rate
> 
> Signed-off-by: Ludovic Desroches 
> Signed-off-by: Wenyou Yang 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v2,2/2] board: laird: add WB50N CPU module

2017-11-30 Thread Tom Rini
On Thu, Nov 23, 2017 at 01:47:48PM +, Ben Whitten wrote:

> From: Ben Whitten 
> 
> This board is based on the Atmel sama5d3 eval boards.
> Supporting the following features:
>  - Boot from NAND Flash
>  - Ethernet
>  - FIT
>  - SPL
> 
> Signed-off-by: Ben Whitten 
> Signed-off-by: Dan Kephart 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/1] fs: avoid possible NULL dereference in fs_devread

2017-11-30 Thread Tom Rini
On Sun, Nov 19, 2017 at 11:49:21PM +0100, Heinrich Schuchardt wrote:

> It is unwise to first dereference a variable
> and then to check if it was NULL.
> 
> Signed-off-by: Heinrich Schuchardt 
> Reviewed-by: Marek Behun 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 11/11] stm32: migrate clock structs in include/stm32_rcc.h

2017-11-30 Thread Tom Rini
On Wed, Nov 15, 2017 at 01:14:53PM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> In order to factorize code between STM32F4 and STM32F7
> migrate all structs related to RCC clocks in include/stm32_rcc.h
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] spl: make CONFIG_OF_EMBED pass dts through fdtgrep

2017-11-30 Thread Tom Rini
On Tue, Nov 21, 2017 at 12:29:56PM +, Goldschmidt Simon wrote:

> Building spl with CONFIG_OF_EMBED enabled results in an error message
> on my board: "SPL image too big". This is because the fdtgrep build
> step is only executed for CONFIG_OF_SEPARATE.
> 
> Fix this by moving the fdtgrep build step ('cmd_fdtgreo') from
> scripts/Makefile.spl to dts/Makefile so that the reduced dtb is
> available for all kinds of spl builds.
> 
> The resulting variable name for the embedded device tree blob changes,
> too, which is why common.h and fdtdec.c have tiny changes.
> 
> Signed-off-by: Simon Goldschmidt 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] fat: Use cache aligned buffers for fat_opendir

2017-11-30 Thread Tom Rini
On Fri, Nov 24, 2017 at 09:54:41AM +0100, Neil Armstrong wrote:

> Before this patch one could receive following errors when executing "fatls"
> command on machine with cache enabled (ex i.MX6Q) :
> 
> => fatls mmc 0:1
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
> ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
> ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
> 
> To alleviate this problem - the calloc()s have been replaced with
> malloc_cache_aligned() and memset().
> 
> After those changes the buffers are properly aligned (with both start
> address and size) to SoC cache line.
> 
> Fixes: 09fa964bba80 ("fs/fat: Fix 'CACHE: Misaligned operation at range' 
> warnings")
> Suggested-by: Lukasz Majewski 
> Signed-off-by: Neil Armstrong 
> Reviewed-by: Lukasz Majewski 
> Reviewed-by: Fabio Estevam 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ARM: dts: Rename logicpd-toredp-37xx-devkit in U-Boot

2017-11-30 Thread Tom Rini
On Mon, Nov 20, 2017 at 09:56:03AM -0600, Adam Ford wrote:

> In U-Boot, this device tree is compatible with both the Torpedo and
> SOM-LV kits.  Let's rename it in the device tree since the U-Boot code and
> show a more generic OMAP3 name.  The code auto detects between the two and
> loads the proper DTB file for Linux.  This would eliminate the SOM-LV showing
> the name Torpedo during boot and hopefully eliminate some confusion.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi 
> b/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi
> index 85cb548..d46ecdb 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,2/2] board: atmel: add sama5d2_ptc_ek board

2017-11-30 Thread Tom Rini
On Fri, Nov 17, 2017 at 02:57:12PM +0800, Wenyou Yang wrote:

> From: Ludovic Desroches 
> 
> Add the SAMA5D2 PTC EK board and remove the SAMA5D2 PTC ENGI board
> which was a prototype.
> 
> Signed-off-by: Ludovic Desroches 
> Signed-off-by: Wenyou Yang 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,1/1] cmd: blk: remove unreachable code

2017-11-30 Thread Tom Rini
On Sun, Nov 19, 2017 at 11:25:32PM +0100, Heinrich Schuchardt wrote:

> Remove an unreachable return statement.
> 
> Signed-off-by: Heinrich Schuchardt 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] disk: efi: correct the allocation size for mbr header in stack

2017-11-30 Thread Tom Rini
On Fri, Nov 17, 2017 at 10:08:18AM +0100, Patrick Delaunay wrote:

> use ALLOC_CACHE_ALIGN_BUFFER_PAD for mbr header allocation
> in stack to fix alloc issue in is_gpt_valid()
> 
> this patch fix also issue for GPT partition handling
> with blocksize != 512 in set_protective_mbr()
> 
> Signed-off-by: Patrick Delaunay 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 08/11] configs: stm32f746-disco: enable MISC/DM_RESET/STM32_RESET and STM32_RCC

2017-11-30 Thread Tom Rini
On Wed, Nov 15, 2017 at 01:14:50PM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> This allows to add rcc MFD support to stm32f746-disco board
> This rcc MFD driver manages clock and reset for STM32 SoCs family
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 09/11] dm: misc: bind STM32F4/F7 clock from rcc MFD driver

2017-11-30 Thread Tom Rini
On Wed, Nov 15, 2017 at 01:14:51PM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Like STM32H7, now STM32F4/F7 clock drivers are binded by
> MFD stm32_rcc driver.
> This also allows to add reset support to STM32F4/F7 SoCs family.
> As Reset driver is not part of SPL supported drivers, don't bind it
> in case of SPL to avoid that stm32_rcc_bind() returns an error.
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 10/11] clk: clk_stm32fx: add clock configuration for mmc usage

2017-11-30 Thread Tom Rini
On Wed, Nov 15, 2017 at 01:14:52PM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> MMC block needs 48Mhz source clock, for that we choose
> to select the SAI PLL.
> Update also stm32_clock_get_rate() to retrieve the MMC
> clock source needed in MMC driver.
> 
> STM32F4 uses a different RCC variant than STM32F7. For STM32F4
> sdmmc clocks bit are located into dckcfgr register whereas there
> are located into dckcfgr2 registers on STM32F7.
> In both registers, bits CK48MSEL and SDMMC1SEL are located at
> the same position.
> 
> Signed-off-by: Christophe Priouzeau 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 03/11] clk: stm32f7: add dedicated STM32F7 compatible string

2017-11-30 Thread Tom Rini
On Wed, Nov 15, 2017 at 01:14:45PM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Add a dedicated stm32f7 compatible string to use clk_stm32f7
> driver with both STM32F4 and STM32F7 SoCs.
> It will be needed to manage differences between these 2 SoCs.
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] mach-stm32: Factorize MPU's region config for STM32 SoCs

2017-11-30 Thread Tom Rini
On Thu, Nov 16, 2017 at 08:59:21AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> MPU's region setup can be factorized between STM32F4/F7/H7 SoCs family
> and used a common MPU's region config.
> 
> Only one exception for STM32H7 which doesn't have device area
> located at 0xA000 .
> 
> For STM32F4, configure_clocks() need to be moved from arch_cpu_init()
> to board_early_init_f().
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 07/11] clk: stm32fx: migrate define from rcc.h to driver

2017-11-30 Thread Tom Rini
On Wed, Nov 15, 2017 at 01:14:49PM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> STM32F4 doesn't get rcc.h file, to avoid compilation
> issue, migrate RCC related defines from rcc.h to driver
> file and remove rcc.h file.
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/1] common: command: tempory buffer should have size of command line buf

2017-11-30 Thread Tom Rini
On Sun, Nov 19, 2017 at 11:07:50PM +0100, Heinrich Schuchardt wrote:

> When copying the command line buffer the target array should
> at least have the same size.
> 
> Cf. definition of console_buffer in common/cli_readline.c.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >