[PATCH v9 1/2] led: led_cortina: Add CAxxx LED support

2020-06-30 Thread Alex Nemirovsky
From: Jway Lin 

Add Cortina Access LED controller support for CA SOCs

Signed-off-by: Jway Lin 
Signed-off-by: Alex Nemirovsky 
CC: Simon Glass 

Add head file fixed link error and remove unused flashing function

---

Changes in v9:
- Remove unused LED blink function
- Include log.h and linux/bitops.h to avoid compile warnings

Changes in v8:
- No code change
- Split out individual driver from Cortina Package 2 patch series
to help streamline acceptence into master

Changes in v7:
- rename OFFSET to SHIFT from macros
- add additinal struct comments
- Reading the DT should really happen in the ofdata_to_platdata method

Changes in v4:
- remove unused macros
- remove cortina prefix from macros
- remove use BSS variable
- further cleanup to meet code style guidelines
- add additinal struct comments
- rename DT blink rate symbol

 MAINTAINERS   |   8 +-
 drivers/led/Kconfig   |   8 ++
 drivers/led/Makefile  |   1 +
 drivers/led/led_cortina.c | 298 ++
 4 files changed, 314 insertions(+), 1 deletion(-)
 create mode 100644 drivers/led/led_cortina.c

diff --git a/MAINTAINERS b/MAINTAINERS
index db8cecd..8867d14 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -182,6 +182,9 @@ F:  drivers/gpio/cortina_gpio.c
 F: drivers/watchdog/cortina_wdt.c
 F: drivers/serial/serial_cortina.c
 F: drivers/mmc/ca_dw_mmc.c
+F: drivers/i2c/i2c-cortina.c
+F: drivers/i2c/i2c-cortina.h
+F: drivers/led/led_cortina.c
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M: Marek Behun 
@@ -738,6 +741,9 @@ F:  drivers/gpio/cortina_gpio.c
 F: drivers/watchdog/cortina_wdt.c
 F: drivers/serial/serial_cortina.c
 F: drivers/mmc/ca_dw_mmc.c
+F: drivers/i2c/i2c-cortina.c
+F: drivers/i2c/i2c-cortina.h
+F: drivers/led/led_cortina.c
 
 MIPS MSCC
 M: Gregory CLEMENT 
@@ -830,7 +836,7 @@ S:  Maintained
 F: arch/powerpc/
 
 POWERPC MPC8XX
-M: Christophe Leroy 
+M: Christophe Leroy 
 S: Maintained
 T: git https://gitlab.denx.de/u-boot/custodians/u-boot-mpc8xx.git
 F: arch/powerpc/cpu/mpc8xx/
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
index 6675934..cc87fbf 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -35,6 +35,14 @@ config LED_BCM6858
  This option enables support for LEDs connected to the BCM6858
  HW has blinking capabilities and up to 32 LEDs can be controlled.
 
+config LED_CORTINA
+   bool "LED Support for Cortina Access CA SoCs"
+   depends on LED && (CORTINA_PLATFORM)
+   help
+ This option enables support for LEDs connected to the Cortina
+ Access CA SOCs.
+
+
 config LED_BLINK
bool "Support LED blinking"
depends on LED
diff --git a/drivers/led/Makefile b/drivers/led/Makefile
index 3654dd3..8e3ae7f 100644
--- a/drivers/led/Makefile
+++ b/drivers/led/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_LED_BCM6328) += led_bcm6328.o
 obj-$(CONFIG_LED_BCM6358) += led_bcm6358.o
 obj-$(CONFIG_LED_BCM6858) += led_bcm6858.o
 obj-$(CONFIG_$(SPL_)LED_GPIO) += led_gpio.o
+obj-$(CONFIG_LED_CORTINA) += led_cortina.o
diff --git a/drivers/led/led_cortina.c b/drivers/led/led_cortina.c
new file mode 100644
index 000..8fd6fd1
--- /dev/null
+++ b/drivers/led/led_cortina.c
@@ -0,0 +1,298 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * Copyright (C) 2020 Cortina-Access
+ * Author: Jway Lin 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LED_MAX_HW_BLINK   127
+#define LED_MAX_COUNT  16
+
+/* LED_CONTROL fields */
+#define LED_BLINK_RATE1_SHIFT  0
+#define LED_BLINK_RATE1_MASK   0xff
+#define LED_BLINK_RATE2_SHIFT  8
+#define LED_BLINK_RATE2_MASK   0xff
+#define LED_CLK_TEST   BIT(16)
+#define LED_CLK_POLARITY   BIT(17)
+#define LED_CLK_TEST_MODE  BIT(16)
+#define LED_CLK_TEST_RX_TEST   BIT(30)
+#define LED_CLK_TEST_TX_TEST   BIT(31)
+
+/* LED_CONFIG fields */
+#define LED_EVENT_ON_SHIFT 0
+#define LED_EVENT_ON_MASK  0x7
+#define LED_EVENT_BLINK_SHIFT  3
+#define LED_EVENT_BLINK_MASK   0x7
+#define LED_EVENT_OFF_SHIFT6
+#define LED_EVENT_OFF_MASK 0x7
+#define LED_OFF_ON_SHIFT   9
+#define LED_OFF_ON_MASK0x3
+#define LED_PORT_SHIFT 11
+#define LED_PORT_MASK  0x7
+#define LED_OFF_VALBIT(14)
+#define LED_SW_EVENT   BIT(15)
+#define LED_BLINK_SEL  BIT(16)
+
+/* LED_CONFIG structures */
+struct cortina_led_cfg {
+   void __iomem *regs;
+   u32 pin;/* LED pin nubmer */
+   bool active_low;/*Active-High or Active-Low*/
+   u32 off_event;  /* set led off event (RX,TX,SW)*/
+   u32 blink_event;/* set led blink event (RX,TX,SW)*/
+   u32 on_event;   /* set led on event (RX,TX,SW)*/
+   u32 port; 

[PATCH v9 2/2] board: presidio: add LED support

2020-06-30 Thread Alex Nemirovsky
From: Jway Lin 

Add LED support for Cortina Access Presidio Engineering Board

Signed-off-by: Jway Lin 
Signed-off-by: Alex Nemirovsky 
Reviewed-by: Simon Glass 

CC: Simon Glass 

---

(no changes since v4)

Changes in v4:
- rename DT blink rate symbol

 arch/arm/dts/ca-presidio-engboard.dts | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/dts/ca-presidio-engboard.dts 
b/arch/arm/dts/ca-presidio-engboard.dts
index 40c93d7..eef433e 100644
--- a/arch/arm/dts/ca-presidio-engboard.dts
+++ b/arch/arm/dts/ca-presidio-engboard.dts
@@ -64,4 +64,35 @@
spi-max-frequency = <10800>;
};
};
+
+   leds: led-controller@f43200f0 {
+   compatible = "cortina,ca-leds";
+   reg = <0x0 0xf43200f0 0x40>;
+
+   cortina,blink-rate1 = <256>;
+   cortina,blink-rate2 = <512>;
+
+   led@0 {
+   pin = <0>;
+   active-low;
+   blink-sel =<0>;
+   port = <0>;
+   off-event = <0>;
+   label = "led0";
+   };
+
+   led@1 {
+   pin = <1>;
+   active-low;
+   blink-sel =<1>;
+   label = "led1";
+   };
+
+   led@2 {
+   pin = <2>;
+   active-low;
+   label = "led2";
+   };
+
+   };
 };
-- 
2.7.4



Re: [EXT] [PATCH v2 1/1] power: pmic_pca9450: fix PCA9450A I2C address

2020-06-30 Thread Ye Li
On Tue, 2020-06-30 at 15:03 +0200, Sébastien Szymanski wrote:
> Caution: EXT Email
> 
> Quoting Ye Li from NXP:
> 
> "We have confirmed with PMIC team, 0x35 is used only on early
> chips
> and not used any more. 0x25 is the final address."
> 
> Fix it by merging power_pca9450a_init and power_pca9450b_init into
> one
> function power_pca9450_init.
> 
> Signed-off-by: Sébastien Szymanski 
> ---
> 
> Changes for v2:
>  * Quoting Ye Li
>  * Merge both function into one as suggested by Ye Li
> 
>  board/freescale/imx8mp_evk/spl.c  |  2 +-
>  drivers/power/pmic/pmic_pca9450.c | 21 +
>  include/power/pca9450.h   |  3 +--
>  3 files changed, 3 insertions(+), 23 deletions(-)
> 
> diff --git a/board/freescale/imx8mp_evk/spl.c
> b/board/freescale/imx8mp_evk/spl.c
> index 3b3a854e29..3214718e62 100644
> --- a/board/freescale/imx8mp_evk/spl.c
> +++ b/board/freescale/imx8mp_evk/spl.c
> @@ -68,7 +68,7 @@ int power_init_board(void)
> struct pmic *p;
> int ret;
> 
> -   ret = power_pca9450b_init(I2C_PMIC);
> +   ret = power_pca9450_init(I2C_PMIC);
> if (ret)
> printf("power init failed");
> p = pmic_get("PCA9450");
> diff --git a/drivers/power/pmic/pmic_pca9450.c
> b/drivers/power/pmic/pmic_pca9450.c
> index 67a9090200..d4f27428bd 100644
> --- a/drivers/power/pmic/pmic_pca9450.c
> +++ b/drivers/power/pmic/pmic_pca9450.c
> @@ -11,26 +11,7 @@
> 
>  static const char pca9450_name[] = "PCA9450";
> 
> -int power_pca9450a_init(unsigned char bus)
> -{
> -   struct pmic *p = pmic_alloc();
> -
> -   if (!p) {
> -   printf("%s: POWER allocation error!\n", __func__);
> -   return -ENOMEM;
> -   }
> -
> -   p->name = pca9450_name;
> -   p->interface = PMIC_I2C;
> -   p->number_of_regs = PCA9450_REG_NUM;
> -   p->hw.i2c.addr = 0x35;
> -   p->hw.i2c.tx_num = 1;
> -   p->bus = bus;
> -
> -   return 0;
> -}
> -
> -int power_pca9450b_init(unsigned char bus)
> +int power_pca9450_init(unsigned char bus)
>  {
> struct pmic *p = pmic_alloc();
> 
> diff --git a/include/power/pca9450.h b/include/power/pca9450.h
> index 5d4f58ca44..5a9a697d62 100644
> --- a/include/power/pca9450.h
> +++ b/include/power/pca9450.h
> @@ -54,7 +54,6 @@ enum {
> PCA9450_REG_NUM,
>  };
> 
> -int power_pca9450a_init(unsigned char bus);
> -int power_pca9450b_init(unsigned char bus);
> +int power_pca9450_init(unsigned char bus);
> 
>  #endif
> --
> 2.26.2
> 
Reviewed-by: Ye Li 

Best regards,
Ye Li


[RFC PATCH v3 5/6] xhci-ring: Fix crash when issuing "usb reset"

2020-06-30 Thread Jason Wessel
If a "usb reset" is issued when the poll_pend state is set the
abort_td() function will hit one of the BUG() statements in abort_td()
or the BUG() statement at the end of xhci_wait_for_event().

The controller has been reset, so the rest of the cleanup should be
skipped and poll_pend flag should be cleared.

Signed-off-by: Jason Wessel 
---
 drivers/usb/host/xhci-ring.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 1c00f2d496..ed0dea9fca 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -483,6 +483,8 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, 
trb_type expected,
if (expected == TRB_TRANSFER)
return NULL;
 
+   if (poll_pend)
+   return NULL;
printf("XHCI timeout on event type %d... cannot recover.\n", expected);
BUG();
 }
@@ -505,11 +507,16 @@ static void abort_td(struct usb_device *udev, int 
ep_index)
xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_STOP_RING);
 
event = xhci_wait_for_event(ctrl, TRB_TRANSFER, false);
-   field = le32_to_cpu(event->trans_event.flags);
-   BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
-   BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
-   BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len
-   != COMP_STOP)));
+   if (event) {
+   field = le32_to_cpu(event->trans_event.flags);
+   BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
+   BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
+   BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len
+!= COMP_STOP)));
+   } else {
+   debug("XHCI abort timeout\n");
+   return;
+   }
xhci_acknowledge_event(ctrl);
 
event = xhci_wait_for_event(ctrl, TRB_COMPLETION, false);
-- 
2.17.1



[RFC PATCH v3 0/6] Improve USB Keyboard support for rpi3/rpi4

2020-06-30 Thread Jason Wessel
At this point all the USB keyboards I had laying around now work
and I can USB boot the rpi3 and rpi4, so perhaps this series can
move beyond the RFC stage.  More testing will occur over the next
week or so. 

v3:
  - Add in patch 6
  - Finally got the GearHead keyboard + mouse composite USB device working

v2: 
  - Minor cleanups to patches 1-3 based on prior review
  - Patch 4 & 5 are new to fix various xhchi crashes
while having additional devices plugged in along with
booting off the usb port.  The nonblocking mode turned
out to be somewhat complex.

v1:

For testing this patch series, I did apply the USB patches for the
rpi4 board which had not been merged yet.  Once the rpi4 USB changes
are eventually merged the keyboard delay issues will show up and I
imagine this issue is already a problem for other boards. This series
does not depend on rpi4 patches as the changes are in the core USB
functions.

I performed tests with a number of usb modules attached including 
storage, ethernet, serial, wifi, keyboard, and
mouse without any issues.


Jason Wessel (6):
  xhci: Add polling support for USB keyboards
  usb_kbd: Do not fail the keyboard if it does not have an interrupt pending
  common/usb.c: Work around keyboard reporting "USB device not accepting 
new address"
  xhci-ring.c: Add the poll_pend state to properly abort transactions
  xhci-ring: Fix crash when issuing "usb reset"
  usb.c: Add a retry in the usb_prepare_device()

 common/usb.c |  18 +---
 common/usb_kbd.c |   4 ++-
 drivers/usb/host/xhci-ring.c | 123 
++--
 drivers/usb/host/xhci.c  |  11 
 include/usb/xhci.h   |   5 ++--
 5 files changed, 122 insertions(+), 39 deletions(-)



[RFC PATCH v3 1/6] xhci: Add polling support for USB keyboards

2020-06-30 Thread Jason Wessel
The xhci driver was causing intermittent 5 second delays from the USB
keyboard polling hook.  Executing something like a "sleep 1" for
example would sleep for 5 seconds, unless an event occurred on
the USB bus to shorten the delay.

Modeled after the code in the DWC2 driver, a nonblock state was added
to quickly return instead of blocking for up to 5 seconds waiting for
an event before timing out.

Signed-off-by: Jason Wessel 
---
 drivers/usb/host/xhci-ring.c | 26 +-
 drivers/usb/host/xhci.c  | 11 ++-
 include/usb/xhci.h   |  5 +++--
 3 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 86aeaab412..b7b2e16410 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -432,9 +432,11 @@ static int event_ready(struct xhci_ctrl *ctrl)
  *
  * @param ctrl Host controller data structure
  * @param expected TRB type expected from Event TRB
+ * @param nonblock when true do not block waiting for response
  * @return pointer to event trb
  */
-union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected)
+union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected,
+   bool nonblock)
 {
trb_type type;
unsigned long ts = get_timer(0);
@@ -442,8 +444,11 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl 
*ctrl, trb_type expected)
do {
union xhci_trb *event = ctrl->event_ring->dequeue;
 
-   if (!event_ready(ctrl))
+   if (!event_ready(ctrl)) {
+   if (nonblock)
+   return NULL;
continue;
+   }
 
type = TRB_FIELD_TO_TYPE(le32_to_cpu(event->event_cmd.flags));
if (type == expected)
@@ -493,7 +498,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
 
xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_STOP_RING);
 
-   event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+   event = xhci_wait_for_event(ctrl, TRB_TRANSFER, false);
field = le32_to_cpu(event->trans_event.flags);
BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
@@ -501,7 +506,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
!= COMP_STOP)));
xhci_acknowledge_event(ctrl);
 
-   event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+   event = xhci_wait_for_event(ctrl, TRB_COMPLETION, false);
BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
!= udev->slot_id || GET_COMP_CODE(le32_to_cpu(
event->event_cmd.status)) != COMP_SUCCESS);
@@ -509,7 +514,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
 
xhci_queue_command(ctrl, (void *)((uintptr_t)ring->enqueue |
ring->cycle_state), udev->slot_id, ep_index, TRB_SET_DEQ);
-   event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+   event = xhci_wait_for_event(ctrl, TRB_COMPLETION, false);
BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
!= udev->slot_id || GET_COMP_CODE(le32_to_cpu(
event->event_cmd.status)) != COMP_SUCCESS);
@@ -552,10 +557,11 @@ static void record_transfer_result(struct usb_device 
*udev,
  * @param pipe contains the DIR_IN or OUT , devnum
  * @param length   length of the buffer
  * @param buffer   buffer to be read/written based on the request
+ * @param nonblock when true do not block waiting for response
  * @return returns 0 if successful else -1 on failure
  */
 int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
-   int length, void *buffer)
+   int length, void *buffer, bool nonblock)
 {
int num_trbs = 0;
struct xhci_generic_trb *start_trb;
@@ -714,8 +720,10 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
 
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
 
-   event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+   event = xhci_wait_for_event(ctrl, TRB_TRANSFER, nonblock);
if (!event) {
+   if (nonblock)
+   return -EINVAL;
debug("XHCI bulk transfer timed out, aborting...\n");
abort_td(udev, ep_index);
udev->status = USB_ST_NAK_REC;  /* closest thing to a timeout */
@@ -911,7 +919,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long 
pipe,
 
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
 
-   event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+   event = xhci_wait_for_event(ctrl, TRB_TRANSFER, false);
if (!event)
goto abort;
field = le32_to_cpu(event->trans_event.flags);
@@ -929,7 +937,7 @@ int xhci_ctrl_tx(struct usb_device 

[RFC PATCH v3 6/6] usb.c: Add a retry in the usb_prepare_device()

2020-06-30 Thread Jason Wessel
I have found through testing some USB 2 composite mouse/keyboard
devices do not response to the usb_set_address call immediately
following the port reset.  It can take anywhere from 2ms to 20ms.

This patch adds a retry and delay for usb_prepare_device() and allows
all the USB keyboards I tried to function properly.

Signed-off-by: Jason Wessel 
---
 common/usb.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/common/usb.c b/common/usb.c
index ba83bb960b..fb091440cc 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1054,6 +1054,15 @@ static int usb_prepare_device(struct usb_device *dev, 
int addr, bool do_read,
dev->devnum = addr;
 
err = usb_set_address(dev); /* set address */
+   /* Retry for old composite keyboard/mouse usb2 hardware */
+   int i = 0;
+   while (err < 0 && i <= 40) {
+   i += 20;
+   mdelay(20);
+   err = usb_set_address(dev); /* set address */
+   }
+   if (i > 0)
+   debug("usb_set_address delay: %i\n", i);
if (err < 0)
debug("\n   usb_set_address return < 0\n");
if (err < 0 && dev->status != 0) {
-- 
2.17.1



[RFC PATCH v3 4/6] xhci-ring.c: Add the poll_pend state to properly abort transactions

2020-06-30 Thread Jason Wessel
xhci_trl_tx and xhchi_bulk_tx can be called synchronously by other
drivers such as the usb storage or network, while the keyboard driver
exclusively uses the polling mode.

And pending polling transactions must be aborted before switching
modes to avoid corrupting the state of the controller.

Signed-off-by: Jason Wessel 
---
 drivers/usb/host/xhci-ring.c | 86 +---
 1 file changed, 70 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index b7b2e16410..1c00f2d496 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -24,6 +24,12 @@
 
 #include 
 
+static void *last_bulk_tx_buf = NULL;
+static struct usb_device *poll_last_udev;
+int poll_last_ep_index;
+static unsigned long bulk_tx_poll_ts = 0;
+static bool poll_pend = false;
+
 /**
  * Is this TRB a link TRB or was the last TRB the last TRB in this event ring
  * segment?  I.e. would the updated event TRB pointer step off the end of the
@@ -549,19 +555,8 @@ static void record_transfer_result(struct usb_device *udev,
}
 }
 
-/ Bulk and Control transfer methods /
-/**
- * Queues up the BULK Request
- *
- * @param udev pointer to the USB device structure
- * @param pipe contains the DIR_IN or OUT , devnum
- * @param length   length of the buffer
- * @param buffer   buffer to be read/written based on the request
- * @param nonblock when true do not block waiting for response
- * @return returns 0 if successful else -1 on failure
- */
-int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
-   int length, void *buffer, bool nonblock)
+static int _xhci_bulk_tx_queue(struct usb_device *udev, unsigned long pipe,
+ int length, void *buffer)
 {
int num_trbs = 0;
struct xhci_generic_trb *start_trb;
@@ -575,7 +570,6 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
struct xhci_virt_device *virt_dev;
struct xhci_ep_ctx *ep_ctx;
struct xhci_ring *ring; /* EP transfer ring */
-   union xhci_trb *event;
 
int running_total, trb_buff_len;
unsigned int total_packet_count;
@@ -719,20 +713,73 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
} while (running_total < length);
 
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
+   return 0;
+}
 
+/ Bulk and Control transfer methods /
+/**
+ * Queues up the BULK Request
+ *
+ * @param udev pointer to the USB device structure
+ * @param pipe contains the DIR_IN or OUT , devnum
+ * @param length   length of the buffer
+ * @param buffer   buffer to be read/written based on the request
+ * @param nonblock when true do not block waiting for response
+ * @return returns 0 if successful else -1 on failure
+ */
+int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
+   int length, void *buffer, bool nonblock)
+{
+   u32 field;
+   int ret;
+   union xhci_trb *event;
+   struct xhci_ctrl *ctrl = xhci_get_ctrl(udev);
+   int ep_index = usb_pipe_ep_index(pipe);
+
+   if (poll_pend) {
+   /*
+* Abort a pending poll operation if it should have
+* timed out, or if this is a different buffer from a
+* separate request
+*/
+   if (get_timer(bulk_tx_poll_ts) > XHCI_TIMEOUT ||
+   last_bulk_tx_buf != buffer || poll_last_udev != udev ||
+   ep_index != poll_last_ep_index) {
+   abort_td(poll_last_udev, poll_last_ep_index);
+   poll_last_udev->status = USB_ST_NAK_REC;  /* closest 
thing to a timeout */
+   poll_last_udev->act_len = 0;
+   poll_pend = false;
+   }
+   } /* No else here because poll_pend might have changed above */
+   if (!poll_pend) {
+   last_bulk_tx_buf = buffer;
+   ret = _xhci_bulk_tx_queue(udev, pipe, length, buffer);
+   if (ret)
+   return ret;
+   }
event = xhci_wait_for_event(ctrl, TRB_TRANSFER, nonblock);
if (!event) {
-   if (nonblock)
+   if (nonblock) {
+   if (!poll_pend) {
+   /* Start the timer */
+   bulk_tx_poll_ts = get_timer(0);
+   poll_last_udev = udev;
+   poll_last_ep_index = ep_index;
+   poll_pend = true;
+   }
return -EINVAL;
+   }
debug("XHCI bulk transfer timed out, aborting...\n");
abort_td(udev, ep_index);
udev->status = USB_ST_NAK_REC;  /* closest thing to a timeout */

[RFC PATCH v3 3/6] common/usb.c: Work around keyboard reporting "USB device not accepting new address"

2020-06-30 Thread Jason Wessel
When resetting the rpi3 board sometimes it will display:
 USB device not accepting new address (error=0)

After the message appears, the usb keyboard will not work.  It seems
that the configuration actually did succeed however.  Checking the
device status for a return code of zero and continuing allows the usb
keyboard and other usb devices to work function.

Signed-off-by: Jason Wessel 
---
 common/usb.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index aad13fd9c5..ba83bb960b 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1054,11 +1054,12 @@ static int usb_prepare_device(struct usb_device *dev, 
int addr, bool do_read,
dev->devnum = addr;
 
err = usb_set_address(dev); /* set address */
-
-   if (err < 0) {
-   printf("\n  USB device not accepting new address " \
+   if (err < 0)
+   debug("\n   usb_set_address return < 0\n");
+   if (err < 0 && dev->status != 0) {
+   printf("\n  USB device not accepting new address "  \
"(error=%lX)\n", dev->status);
-   return err;
+   return err;
}
 
mdelay(10); /* Let the SET_ADDRESS settle */
-- 
2.17.1



[RFC PATCH v3 2/6] usb_kbd: Do not fail the keyboard if it does not have an interrupt pending

2020-06-30 Thread Jason Wessel
After the initial configuration some USB keyboard+mouse devices never
return any kind of event on the interrupt line.  In particular, the
device identified by "Cypress Cypress USB Keyboard / PS2 Mouse as
/devices/platform/soc/3f98.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:04B4:0101.0001/input/input0"
never returns a data packet until the first external input event.

I found this was also true with some newer model Dell keyboards.

When the device is plugged into a xhci controller there is also no
point in waiting 5 seconds for a device that is never going to present
data, so the call to the interrupt service was changed to a
nonblocking operation for the controllers that support this.

With the patch applied, the rpi3 and rpi4 work well with the more
complex keyboard devices.

Signed-off-by: Jason Wessel 
---
 common/usb_kbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index b316807844..3c0056e1b9 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -519,7 +519,9 @@ static int usb_kbd_probe_dev(struct usb_device *dev, 
unsigned int ifnum)
   1, 0, data->new, USB_KBD_BOOT_REPORT_SIZE) < 0) {
 #else
if (usb_int_msg(dev, data->intpipe, data->new, data->intpktsize,
-   data->intinterval, false) < 0) {
+   data->intinterval, true) < 0) {
+   /* Read first packet if the device provides it, else pick it up 
later */
+   return 1;
 #endif
printf("Failed to get keyboard state from device %04x:%04x\n",
   dev->descriptor.idVendor, dev->descriptor.idProduct);
-- 
2.17.1



Re: [PATCH v2 1/1] riscv: use log functions in fdt_fixup

2020-06-30 Thread Atish Patra
On Tue, Jun 30, 2020 at 2:31 AM Heinrich Schuchardt  wrote:
>
> Replace printf() and debug() by log_err() and log_debug().
>
> "No reserved memory region found in source FDT\n" is not an error but a
> debug information.
>
> %s/can not/cannot/ - use the more common spelling.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
> v2:
> define the log category as LOGC_ARCH
> rebase the patch upon "Assorted fixes related to reserved memory"
> ---
>  arch/riscv/lib/fdt_fixup.c | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
> index fab93873d5..2780475c5d 100644
> --- a/arch/riscv/lib/fdt_fixup.c
> +++ b/arch/riscv/lib/fdt_fixup.c
> @@ -4,6 +4,8 @@
>   *
>   */
>
> +#define LOG_CATEGORY LOGC_ARCH
> +
>  #include 
>  #include 
>  #include 
> @@ -37,7 +39,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
>
> offset = fdt_path_offset(src, "/reserved-memory");
> if (offset < 0) {
> -   printf("No reserved memory region found in source FDT\n");
> +   log_debug("No reserved memory region found in source FDT\n");
> return 0;
> }
>
> @@ -48,7 +50,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
> "reg", 0, ,
> false);
> if (addr == FDT_ADDR_T_NONE) {
> -   debug("failed to read address/size for %s\n", name);
> +   log_debug("failed to read address/size for %s\n", 
> name);
> continue;
> }
> strncpy(basename, name, max_len);
> @@ -63,7 +65,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
> err = fdtdec_add_reserved_memory(dst, basename, _mem,
>  );
> if (err < 0 && err != -FDT_ERR_EXISTS) {
> -   printf("failed to add reserved memory: %d\n", err);
> +   log_err("failed to add reserved memory: %d\n", err);
> return err;
> }
> if (!fdt_getprop(src, node, "no-map", NULL))
> @@ -109,7 +111,7 @@ int board_fix_fdt(void *fdt)
>
> err = riscv_board_reserved_mem_fixup(fdt);
> if (err < 0) {
> -   printf("failed to fixup DT for reserved memory: %d\n", err);
> +   log_err("failed to fixup DT for reserved memory: %d\n", err);
> return err;
> }
>
> @@ -127,14 +129,14 @@ int arch_fixup_fdt(void *blob)
> size = fdt_totalsize(blob);
> err  = fdt_open_into(blob, blob, size + 32);
> if (err < 0) {
> -   printf("Device Tree can't be expanded to accommodate new 
> node");
> +   log_err("Device Tree can't be expanded to accommodate new 
> node");
> return err;
> }
> chosen_offset = fdt_path_offset(blob, "/chosen");
> if (chosen_offset < 0) {
> err = fdt_add_subnode(blob, 0, "chosen");
> if (err < 0) {
> -   printf("chosen node can not be added\n");
> +   log_err("chosen node cannot be added\n");
> return err;
> }
> }
> --
> 2.27.0
>

Reviewed-by: Atish Patra 

-- 
Regards,
Atish


Re: [PATCH 4/4] ti814x: Remove platform

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 12:56:50PM -0400, Tom Rini wrote:

> The TI814x (DM814x) platform is rather old and in need of a lot of
> migration work.  As much of that work is well past the deadline, remove
> this platform.
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/4] am335x: Update list of defconfigs

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 12:56:47PM -0400, Tom Rini wrote:

> Both the am335x_boneblack and am335x_evm_usbspl configs have been gone
> for a while, remove their entries from MAINTAINERS.
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 3/4] ti816x_evm: Enable DM_MMC

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 12:56:49PM -0400, Tom Rini wrote:

> This platform is already using DM in general and the MMC controller is
> the early generation of what is compatible with "ti,omap4-hsmmc" so
> enable DM_MMC (which in turn gets BLK enabled).
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL] u-boot-mips

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 01:10:53AM +0200, Daniel Schwierzeck wrote:

> Hi Tom,
> 
> actually I wanted to send this much earlier but I hope it's still okay.
> 
> This enables Qemu tests for the MIPS Malta board in all variants (32/64 bit,
> big/little endian) in Gitlab CI, Travis CI and Azure Pipelines. This allows
> to deprecate the qemu_mips board in the future because there is no Linux 
> support
> anymore for ages and Qemu deprecated the generic MIPS board as well in favour 
> of
> Malta.
> 
> I had to include the PCNET patches because otherwise the Malta 64bit targets
> had stability issues in the Qemu network test case. Thus it's not just cleanup
> and DM conversion, but also bugfixing ;)
> 
> https://gitlab.denx.de/u-boot/custodians/u-boot-mips/pipelines/3824
> https://travis-ci.org/github/danielschwierzeck/u-boot/builds/703302746
> https://dev.azure.com/danielschwierzeck/u-boot/_build/results?buildId=8=results
> 
> 
> The following changes since commit 0b7d95531cf25a7c71bd9855135da5e7098e7b97:
> 
>   Merge tag 'rockchip-fix' of 
> https://gitlab.denx.de/u-boot/custodians/u-boot-video (2020-06-29 15:58:09 
> -0400)
> 
> are available in the Git repository at:
> 
>   g...@gitlab.denx.de:u-boot/custodians/u-boot-mips.git 
> tags/mips-pull-2020-06-29
> 
> for you to fetch changes up to e35c2a8fdd41a34c06c409ce700c5d5591429367:
> 
>   .azure-pipelines.yml: add Qemu tests for MIPS Malta board (2020-06-29 
> 22:40:16 +0200)
> 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[RFC PATCH v2 4/5] xhci-ring.c: Add the poll_pend state to properly abort transactions

2020-06-30 Thread Jason Wessel
xhci_trl_tx and xhchi_bulk_tx can be called synchronously by other
drivers such as the usb storage or network, while the keyboard driver
exclusively uses the polling mode.

And pending polling transactions must be aborted before switching
modes to avoid corrupting the state of the controller.

Signed-off-by: Jason Wessel 
---
 drivers/usb/host/xhci-ring.c | 86 +---
 1 file changed, 70 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index b7b2e16410..1c00f2d496 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -24,6 +24,12 @@
 
 #include 
 
+static void *last_bulk_tx_buf = NULL;
+static struct usb_device *poll_last_udev;
+int poll_last_ep_index;
+static unsigned long bulk_tx_poll_ts = 0;
+static bool poll_pend = false;
+
 /**
  * Is this TRB a link TRB or was the last TRB the last TRB in this event ring
  * segment?  I.e. would the updated event TRB pointer step off the end of the
@@ -549,19 +555,8 @@ static void record_transfer_result(struct usb_device *udev,
}
 }
 
-/ Bulk and Control transfer methods /
-/**
- * Queues up the BULK Request
- *
- * @param udev pointer to the USB device structure
- * @param pipe contains the DIR_IN or OUT , devnum
- * @param length   length of the buffer
- * @param buffer   buffer to be read/written based on the request
- * @param nonblock when true do not block waiting for response
- * @return returns 0 if successful else -1 on failure
- */
-int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
-   int length, void *buffer, bool nonblock)
+static int _xhci_bulk_tx_queue(struct usb_device *udev, unsigned long pipe,
+ int length, void *buffer)
 {
int num_trbs = 0;
struct xhci_generic_trb *start_trb;
@@ -575,7 +570,6 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
struct xhci_virt_device *virt_dev;
struct xhci_ep_ctx *ep_ctx;
struct xhci_ring *ring; /* EP transfer ring */
-   union xhci_trb *event;
 
int running_total, trb_buff_len;
unsigned int total_packet_count;
@@ -719,20 +713,73 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
} while (running_total < length);
 
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
+   return 0;
+}
 
+/ Bulk and Control transfer methods /
+/**
+ * Queues up the BULK Request
+ *
+ * @param udev pointer to the USB device structure
+ * @param pipe contains the DIR_IN or OUT , devnum
+ * @param length   length of the buffer
+ * @param buffer   buffer to be read/written based on the request
+ * @param nonblock when true do not block waiting for response
+ * @return returns 0 if successful else -1 on failure
+ */
+int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
+   int length, void *buffer, bool nonblock)
+{
+   u32 field;
+   int ret;
+   union xhci_trb *event;
+   struct xhci_ctrl *ctrl = xhci_get_ctrl(udev);
+   int ep_index = usb_pipe_ep_index(pipe);
+
+   if (poll_pend) {
+   /*
+* Abort a pending poll operation if it should have
+* timed out, or if this is a different buffer from a
+* separate request
+*/
+   if (get_timer(bulk_tx_poll_ts) > XHCI_TIMEOUT ||
+   last_bulk_tx_buf != buffer || poll_last_udev != udev ||
+   ep_index != poll_last_ep_index) {
+   abort_td(poll_last_udev, poll_last_ep_index);
+   poll_last_udev->status = USB_ST_NAK_REC;  /* closest 
thing to a timeout */
+   poll_last_udev->act_len = 0;
+   poll_pend = false;
+   }
+   } /* No else here because poll_pend might have changed above */
+   if (!poll_pend) {
+   last_bulk_tx_buf = buffer;
+   ret = _xhci_bulk_tx_queue(udev, pipe, length, buffer);
+   if (ret)
+   return ret;
+   }
event = xhci_wait_for_event(ctrl, TRB_TRANSFER, nonblock);
if (!event) {
-   if (nonblock)
+   if (nonblock) {
+   if (!poll_pend) {
+   /* Start the timer */
+   bulk_tx_poll_ts = get_timer(0);
+   poll_last_udev = udev;
+   poll_last_ep_index = ep_index;
+   poll_pend = true;
+   }
return -EINVAL;
+   }
debug("XHCI bulk transfer timed out, aborting...\n");
abort_td(udev, ep_index);
udev->status = USB_ST_NAK_REC;  /* closest thing to a timeout */

[RFC PATCH v2 5/5] xhci-ring: Fix crash when issuing "usb reset"

2020-06-30 Thread Jason Wessel
If a "usb reset" is issued when the poll_pend state is set the
abort_td() function will hit one of the BUG() statements in abort_td()
or the BUG() statement at the end of xhci_wait_for_event().

The controller has been reset, so the rest of the cleanup should be
skipped and poll_pend flag should be cleared.

Signed-off-by: Jason Wessel 
---
 drivers/usb/host/xhci-ring.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 1c00f2d496..ed0dea9fca 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -483,6 +483,8 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, 
trb_type expected,
if (expected == TRB_TRANSFER)
return NULL;
 
+   if (poll_pend)
+   return NULL;
printf("XHCI timeout on event type %d... cannot recover.\n", expected);
BUG();
 }
@@ -505,11 +507,16 @@ static void abort_td(struct usb_device *udev, int 
ep_index)
xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_STOP_RING);
 
event = xhci_wait_for_event(ctrl, TRB_TRANSFER, false);
-   field = le32_to_cpu(event->trans_event.flags);
-   BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
-   BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
-   BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len
-   != COMP_STOP)));
+   if (event) {
+   field = le32_to_cpu(event->trans_event.flags);
+   BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
+   BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
+   BUG_ON(GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len
+!= COMP_STOP)));
+   } else {
+   debug("XHCI abort timeout\n");
+   return;
+   }
xhci_acknowledge_event(ctrl);
 
event = xhci_wait_for_event(ctrl, TRB_COMPLETION, false);
-- 
2.17.1



[RFC PATCH v2 3/5] common/usb.c: Work around keyboard reporting "USB device not accepting new address"

2020-06-30 Thread Jason Wessel
When resetting the rpi3 board sometimes it will display:
 USB device not accepting new address (error=0)

After the message appears, the usb keyboard will not work.  It seems
that the configuration actually did succeed however.  Checking the
device status for a return code of zero and continuing allows the usb
keyboard and other usb devices to work function.

Signed-off-by: Jason Wessel 
---
 common/usb.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index aad13fd9c5..ba83bb960b 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1054,11 +1054,12 @@ static int usb_prepare_device(struct usb_device *dev, 
int addr, bool do_read,
dev->devnum = addr;
 
err = usb_set_address(dev); /* set address */
-
-   if (err < 0) {
-   printf("\n  USB device not accepting new address " \
+   if (err < 0)
+   debug("\n   usb_set_address return < 0\n");
+   if (err < 0 && dev->status != 0) {
+   printf("\n  USB device not accepting new address "  \
"(error=%lX)\n", dev->status);
-   return err;
+   return err;
}
 
mdelay(10); /* Let the SET_ADDRESS settle */
-- 
2.17.1



[RFC PATCH v2 0/5] Improve USB Keyboard support for rpi3/rpi4

2020-06-30 Thread Jason Wessel
v2: 
  - Minor cleanups to patches 1-3 based on prior review
  - Patch 4 & 5 are new to fix various xhchi crashes
while having additional devices plugged in along with
booting off the usb port.  The nonblocking mode turned
out to be somewhat complex.

v1:

For testing this patch series, I did apply the USB patches for the
rpi4 board which had not been merged yet.  Once the rpi4 USB changes
are eventually merged the keyboard delay issues will show up and I
imagine this issue is already a problem for other boards. This series
does not depend on rpi4 patches as the changes are in the core USB
functions.

I am not entirely certain about the change to the common/usb.c which
is why this is an RFC.  I am not sure if there would be other side
effects to other USB drivers.  I did test with a number of usb modules
attached including storage, ethernet, serial, wifi, keyboard, and
mouse without any issues.


Jason Wessel (5):
  xhci: Add polling support for USB keyboards
  usb_kbd: Do not fail the keyboard if it does not have an interrupt pending
  common/usb.c: Work around keyboard reporting "USB device not accepting 
new address"
  xhci-ring.c: Add the poll_pend state to properly abort transactions
  xhci-ring: Fix crash when issuing "usb reset"

 common/usb.c |   9 +++---
 common/usb_kbd.c |   4 ++-
 drivers/usb/host/xhci-ring.c | 123 
++--
 drivers/usb/host/xhci.c  |  11 
 include/usb/xhci.h   |   5 ++--
 5 files changed, 113 insertions(+), 39 deletions(-)


[RFC PATCH v2 2/5] usb_kbd: Do not fail the keyboard if it does not have an interrupt pending

2020-06-30 Thread Jason Wessel
After the initial configuration some USB keyboard+mouse devices never
return any kind of event on the interrupt line.  In particular, the
device identified by "Cypress Cypress USB Keyboard / PS2 Mouse as
/devices/platform/soc/3f98.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:04B4:0101.0001/input/input0"
never returns a data packet until the first external input event.

I found this was also true with some newer model Dell keyboards.

When the device is plugged into a xhci controller there is also no
point in waiting 5 seconds for a device that is never going to present
data, so the call to the interrupt service was changed to a
nonblocking operation for the controllers that support this.

With the patch applied, the rpi3 and rpi4 work well with the more
complex keyboard devices.

Signed-off-by: Jason Wessel 
---
 common/usb_kbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index b316807844..3c0056e1b9 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -519,7 +519,9 @@ static int usb_kbd_probe_dev(struct usb_device *dev, 
unsigned int ifnum)
   1, 0, data->new, USB_KBD_BOOT_REPORT_SIZE) < 0) {
 #else
if (usb_int_msg(dev, data->intpipe, data->new, data->intpktsize,
-   data->intinterval, false) < 0) {
+   data->intinterval, true) < 0) {
+   /* Read first packet if the device provides it, else pick it up 
later */
+   return 1;
 #endif
printf("Failed to get keyboard state from device %04x:%04x\n",
   dev->descriptor.idVendor, dev->descriptor.idProduct);
-- 
2.17.1



[RFC PATCH v2 1/5] xhci: Add polling support for USB keyboards

2020-06-30 Thread Jason Wessel
The xhci driver was causing intermittent 5 second delays from the USB
keyboard polling hook.  Executing something like a "sleep 1" for
example would sleep for 5 seconds, unless an event occurred on
the USB bus to shorten the delay.

Modeled after the code in the DWC2 driver, a nonblock state was added
to quickly return instead of blocking for up to 5 seconds waiting for
an event before timing out.

Signed-off-by: Jason Wessel 
---
 drivers/usb/host/xhci-ring.c | 26 +-
 drivers/usb/host/xhci.c  | 11 ++-
 include/usb/xhci.h   |  5 +++--
 3 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 86aeaab412..b7b2e16410 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -432,9 +432,11 @@ static int event_ready(struct xhci_ctrl *ctrl)
  *
  * @param ctrl Host controller data structure
  * @param expected TRB type expected from Event TRB
+ * @param nonblock when true do not block waiting for response
  * @return pointer to event trb
  */
-union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected)
+union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected,
+   bool nonblock)
 {
trb_type type;
unsigned long ts = get_timer(0);
@@ -442,8 +444,11 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl 
*ctrl, trb_type expected)
do {
union xhci_trb *event = ctrl->event_ring->dequeue;
 
-   if (!event_ready(ctrl))
+   if (!event_ready(ctrl)) {
+   if (nonblock)
+   return NULL;
continue;
+   }
 
type = TRB_FIELD_TO_TYPE(le32_to_cpu(event->event_cmd.flags));
if (type == expected)
@@ -493,7 +498,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
 
xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_STOP_RING);
 
-   event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+   event = xhci_wait_for_event(ctrl, TRB_TRANSFER, false);
field = le32_to_cpu(event->trans_event.flags);
BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
@@ -501,7 +506,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
!= COMP_STOP)));
xhci_acknowledge_event(ctrl);
 
-   event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+   event = xhci_wait_for_event(ctrl, TRB_COMPLETION, false);
BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
!= udev->slot_id || GET_COMP_CODE(le32_to_cpu(
event->event_cmd.status)) != COMP_SUCCESS);
@@ -509,7 +514,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
 
xhci_queue_command(ctrl, (void *)((uintptr_t)ring->enqueue |
ring->cycle_state), udev->slot_id, ep_index, TRB_SET_DEQ);
-   event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+   event = xhci_wait_for_event(ctrl, TRB_COMPLETION, false);
BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
!= udev->slot_id || GET_COMP_CODE(le32_to_cpu(
event->event_cmd.status)) != COMP_SUCCESS);
@@ -552,10 +557,11 @@ static void record_transfer_result(struct usb_device 
*udev,
  * @param pipe contains the DIR_IN or OUT , devnum
  * @param length   length of the buffer
  * @param buffer   buffer to be read/written based on the request
+ * @param nonblock when true do not block waiting for response
  * @return returns 0 if successful else -1 on failure
  */
 int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
-   int length, void *buffer)
+   int length, void *buffer, bool nonblock)
 {
int num_trbs = 0;
struct xhci_generic_trb *start_trb;
@@ -714,8 +720,10 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
 
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
 
-   event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+   event = xhci_wait_for_event(ctrl, TRB_TRANSFER, nonblock);
if (!event) {
+   if (nonblock)
+   return -EINVAL;
debug("XHCI bulk transfer timed out, aborting...\n");
abort_td(udev, ep_index);
udev->status = USB_ST_NAK_REC;  /* closest thing to a timeout */
@@ -911,7 +919,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long 
pipe,
 
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
 
-   event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+   event = xhci_wait_for_event(ctrl, TRB_TRANSFER, false);
if (!event)
goto abort;
field = le32_to_cpu(event->trans_event.flags);
@@ -929,7 +937,7 @@ int xhci_ctrl_tx(struct usb_device 

Re: [PATCH] omap3_beagle: Finish current outstanding DM migrations

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 02:32:46PM -0500, Adam Ford wrote:
> On Tue, Jun 30, 2020 at 2:02 PM Tom Rini  wrote:
> >
> > At this point in time we can now remove our legacy code and switch to
> > enabling DM for USB and Ethernet.
> >
> > Cc: Derald D. Woods 
> > Cc: Adam Ford 
> > Signed-off-by: Tom Rini 
> > ---
> >  board/ti/beagle/beagle.c   | 70 --
> >  configs/omap3_beagle_defconfig |  5 ++-
> >  2 files changed, 4 insertions(+), 71 deletions(-)
> >
> > diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
> > index 9139ad87d400..9ccd566da370 100644
> > --- a/board/ti/beagle/beagle.c
> > +++ b/board/ti/beagle/beagle.c
> > @@ -40,11 +40,6 @@
> >  #include "beagle.h"
> >  #include 
> >
> > -#ifdef CONFIG_USB_EHCI_HCD
> > -#include 
> > -#include 
> > -#endif
> > -
> >  #define TWL4030_I2C_BUS0
> >  #define EXPANSION_EEPROM_I2C_BUS   1
> >  #define EXPANSION_EEPROM_I2C_ADDRESS   0x50
> > @@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
> >  }
> >  #endif
> >
> > -#ifdef CONFIG_USB_MUSB_OMAP2PLUS
> > -static struct musb_hdrc_config musb_config = {
> > -   .multipoint = 1,
> > -   .dyn_fifo   = 1,
> > -   .num_eps= 16,
> > -   .ram_bits   = 12,
> > -};
> > -
> > -static struct omap_musb_board_data musb_board_data = {
> > -   .interface_type = MUSB_INTERFACE_ULPI,
> > -};
> > -
> > -static struct musb_hdrc_platform_data musb_plat = {
> > -#if defined(CONFIG_USB_MUSB_HOST)
> > -   .mode   = MUSB_HOST,
> > -#elif defined(CONFIG_USB_MUSB_GADGET)
> > -   .mode   = MUSB_PERIPHERAL,
> > -#else
> > -#error "Please define either CONFIG_USB_MUSB_HOST or 
> > CONFIG_USB_MUSB_GADGET"
> > -#endif
> > -   .config = _config,
> > -   .power  = 100,
> > -   .platform_ops   = _ops,
> > -   .board_data = _board_data,
> > -};
> > -#endif
> > -
> >  /*
> >   * Routine: misc_init_r
> >   * Description: Configure board specific parts
> > @@ -506,10 +474,6 @@ int misc_init_r(void)
> > omap3_dss_enable();
> >  #endif
> >
> > -#ifdef CONFIG_USB_MUSB_OMAP2PLUS
> > -   musb_register(_plat, _board_data, (void *)MUSB_BASE);
> > -#endif
> > -
> > if (generate_fake_mac)
> > omap_die_id_usbethaddr();
> >
> > @@ -548,37 +512,3 @@ void board_mmc_power_init(void)
> > twl4030_power_mmc_init(0);
> >  }
> >  #endif
> > -
> > -#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
> > -/* Call usb_stop() before starting the kernel */
> > -void show_boot_progress(int val)
> > -{
> > -   if (val == BOOTSTAGE_ID_RUN_OS)
> > -   usb_stop();
> > -}
> > -
> > -static struct omap_usbhs_board_data usbhs_bdata = {
> > -   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
> > -   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
> > -   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
> > -};
> > -
> > -int ehci_hcd_init(int index, enum usb_init_type init,
> > -   struct ehci_hccr **hccr, struct ehci_hcor **hcor)
> > -{
> > -   return omap_ehci_hcd_init(index, _bdata, hccr, hcor);
> > -}
> > -
> > -int ehci_hcd_stop(int index)
> > -{
> > -   return omap_ehci_hcd_stop();
> > -}
> > -
> > -#endif /* CONFIG_USB_EHCI_HCD */
> > -
> > -#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
> > -int board_eth_init(bd_t *bis)
> > -{
> > -   return usb_eth_initialize(bis);
> > -}
> > -#endif
> > diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig
> > index ed7cb8f2ff63..b08ffc062d29 100644
> > --- a/configs/omap3_beagle_defconfig
> > +++ b/configs/omap3_beagle_defconfig
> > @@ -3,11 +3,11 @@ CONFIG_ARM=y
> >  # CONFIG_SPL_USE_ARCH_MEMSET is not set
> >  CONFIG_ARCH_OMAP2PLUS=y
> >  CONFIG_SYS_MALLOC_F_LEN=0x4000
> > +CONFIG_SPL_TEXT_BASE=0x4020
> >  CONFIG_TARGET_OMAP3_BEAGLE=y
> >  CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
> >  CONFIG_NR_DRAM_BANKS=2
> >  CONFIG_SPL=y
> > -CONFIG_SPL_TEXT_BASE=0x4020
> >  CONFIG_DISTRO_DEFAULTS=y
> >  CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
> >  CONFIG_USE_PREBOOT=y
> > @@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
> >  CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
> >  CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
> >  CONFIG_SPL_NAND_SIMPLE=y
> > +CONFIG_DM_ETH=y
> 
> For my boards, I had to modify the -u-boot.dtsi files [1] because the
> gpmc driver didn't have a driver, so any sub-nodes disappeared leaving
> the Ethernet unavailable.  With the fix Ethernet works.

Here beagle ethernet is via an onboard USB ethernet device.  My
networking tests are as stable as ever (I can't get NFS to work on any
of them, but TFTP and EFI network are fine).

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] omap3_beagle: Finish current outstanding DM migrations

2020-06-30 Thread Adam Ford
On Tue, Jun 30, 2020 at 2:02 PM Tom Rini  wrote:
>
> At this point in time we can now remove our legacy code and switch to
> enabling DM for USB and Ethernet.
>
> Cc: Derald D. Woods 
> Cc: Adam Ford 
> Signed-off-by: Tom Rini 
> ---
>  board/ti/beagle/beagle.c   | 70 --
>  configs/omap3_beagle_defconfig |  5 ++-
>  2 files changed, 4 insertions(+), 71 deletions(-)
>
> diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
> index 9139ad87d400..9ccd566da370 100644
> --- a/board/ti/beagle/beagle.c
> +++ b/board/ti/beagle/beagle.c
> @@ -40,11 +40,6 @@
>  #include "beagle.h"
>  #include 
>
> -#ifdef CONFIG_USB_EHCI_HCD
> -#include 
> -#include 
> -#endif
> -
>  #define TWL4030_I2C_BUS0
>  #define EXPANSION_EEPROM_I2C_BUS   1
>  #define EXPANSION_EEPROM_I2C_ADDRESS   0x50
> @@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
>  }
>  #endif
>
> -#ifdef CONFIG_USB_MUSB_OMAP2PLUS
> -static struct musb_hdrc_config musb_config = {
> -   .multipoint = 1,
> -   .dyn_fifo   = 1,
> -   .num_eps= 16,
> -   .ram_bits   = 12,
> -};
> -
> -static struct omap_musb_board_data musb_board_data = {
> -   .interface_type = MUSB_INTERFACE_ULPI,
> -};
> -
> -static struct musb_hdrc_platform_data musb_plat = {
> -#if defined(CONFIG_USB_MUSB_HOST)
> -   .mode   = MUSB_HOST,
> -#elif defined(CONFIG_USB_MUSB_GADGET)
> -   .mode   = MUSB_PERIPHERAL,
> -#else
> -#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
> -#endif
> -   .config = _config,
> -   .power  = 100,
> -   .platform_ops   = _ops,
> -   .board_data = _board_data,
> -};
> -#endif
> -
>  /*
>   * Routine: misc_init_r
>   * Description: Configure board specific parts
> @@ -506,10 +474,6 @@ int misc_init_r(void)
> omap3_dss_enable();
>  #endif
>
> -#ifdef CONFIG_USB_MUSB_OMAP2PLUS
> -   musb_register(_plat, _board_data, (void *)MUSB_BASE);
> -#endif
> -
> if (generate_fake_mac)
> omap_die_id_usbethaddr();
>
> @@ -548,37 +512,3 @@ void board_mmc_power_init(void)
> twl4030_power_mmc_init(0);
>  }
>  #endif
> -
> -#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
> -/* Call usb_stop() before starting the kernel */
> -void show_boot_progress(int val)
> -{
> -   if (val == BOOTSTAGE_ID_RUN_OS)
> -   usb_stop();
> -}
> -
> -static struct omap_usbhs_board_data usbhs_bdata = {
> -   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
> -   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
> -   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
> -};
> -
> -int ehci_hcd_init(int index, enum usb_init_type init,
> -   struct ehci_hccr **hccr, struct ehci_hcor **hcor)
> -{
> -   return omap_ehci_hcd_init(index, _bdata, hccr, hcor);
> -}
> -
> -int ehci_hcd_stop(int index)
> -{
> -   return omap_ehci_hcd_stop();
> -}
> -
> -#endif /* CONFIG_USB_EHCI_HCD */
> -
> -#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
> -int board_eth_init(bd_t *bis)
> -{
> -   return usb_eth_initialize(bis);
> -}
> -#endif
> diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig
> index ed7cb8f2ff63..b08ffc062d29 100644
> --- a/configs/omap3_beagle_defconfig
> +++ b/configs/omap3_beagle_defconfig
> @@ -3,11 +3,11 @@ CONFIG_ARM=y
>  # CONFIG_SPL_USE_ARCH_MEMSET is not set
>  CONFIG_ARCH_OMAP2PLUS=y
>  CONFIG_SYS_MALLOC_F_LEN=0x4000
> +CONFIG_SPL_TEXT_BASE=0x4020
>  CONFIG_TARGET_OMAP3_BEAGLE=y
>  CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
>  CONFIG_NR_DRAM_BANKS=2
>  CONFIG_SPL=y
> -CONFIG_SPL_TEXT_BASE=0x4020
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
>  CONFIG_USE_PREBOOT=y
> @@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
>  CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
>  CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
>  CONFIG_SPL_NAND_SIMPLE=y
> +CONFIG_DM_ETH=y

For my boards, I had to modify the -u-boot.dtsi files [1] because the
gpmc driver didn't have a driver, so any sub-nodes disappeared leaving
the Ethernet unavailable.  With the fix Ethernet works.

[1] - 
https://gitlab.denx.de/u-boot/u-boot/-/commit/62ca4aa16fcfaaa15e40ed26fe6826878d55ac59




>  CONFIG_SPI=y
>  CONFIG_DM_SPI=y
>  CONFIG_OMAP3_SPI=y
>  CONFIG_USB=y
> +CONFIG_DM_USB=y
> +# CONFIG_SPL_DM_USB is not set
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_OMAP3=y
>  CONFIG_USB_MUSB_GADGET=y
> --
> 2.17.1
>


Re: [PATCH] rockchip: rk3399: allow deselecting SPL_ATF_NO_PLATFORM_PARAM

2020-06-30 Thread Walter Lozano



On 27/6/20 11:36, Kever Yang wrote:


On 2020/6/16 上午7:30, Hugh Cole-Baker wrote:

SPL_ATF_NO_PLATFORM_PARAM is selected by default for RK3399 configs, to
guard against issues when used with TF-A versions that perform
insufficient validation on the platform parameter. However, since commit
8109f738ffa7 "rockchip: increase FDT buffer size" in TF-A, passing a
device tree as platform parameter no longer causes problems for upstream
TF-A for RK3399.

Since SPL_ATF_NO_PLATFORM_PARAM doesn't need to be selected when using
upstream TF-A, change the Kconfig option from select to imply. It'll
still default to being selected but can be deselected by a user if they
know they will be using a compatible version of TF-A.

Signed-off-by: Hugh Cole-Baker 


Reviewed-by: Kever Yang 

Thanks for this patch. Now with the latest TF-A and deselecting 
SPL_ATF_NO_PLATFORM_PARAM is it possible to get console output at the 
correct baudrate on TF.



Tested-by: Walter Lozano 

Regards,

Walter


---
For some background, see this thread on the TF-A list [1].

Since the corresponding required change isn't in a tagged version of
TF-A yet, and I don't know how many RK3399 boards are normally used with
older TF-A versions which required this option, I think it's safest to
keep the default as not sending a platform param to TF-A. Once the next
TF-A version is released, SPL_ATF_NO_PLATFORM_PARAM could be turned off
in defconfigs for boards that use the latest upstream TF-A.

[1]: 
https://lists.trustedfirmware.org/pipermail/tf-a/2020-June/000502.html


  arch/arm/mach-rockchip/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Kconfig 
b/arch/arm/mach-rockchip/Kconfig

index 0cb1f23d0f3..e2b63265846 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -207,7 +207,6 @@ config ROCKCHIP_RK3399
  select SUPPORT_TPL
  select SPL
  select SPL_ATF
-    select SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
  select SPL_BOARD_INIT if SPL
  select SPL_LOAD_FIT
  select SPL_CLK if SPL
@@ -232,6 +231,7 @@ config ROCKCHIP_RK3399
  imply PRE_CONSOLE_BUFFER
  imply ROCKCHIP_COMMON_BOARD
  imply ROCKCHIP_SDRAM_COMMON
+    imply SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
  imply SPL_ROCKCHIP_COMMON_BOARD
  imply TPL_SERIAL_SUPPORT
  imply TPL_LIBCOMMON_SUPPORT





[PATCH] omap3_beagle: Finish current outstanding DM migrations

2020-06-30 Thread Tom Rini
At this point in time we can now remove our legacy code and switch to
enabling DM for USB and Ethernet.

Cc: Derald D. Woods 
Cc: Adam Ford 
Signed-off-by: Tom Rini 
---
 board/ti/beagle/beagle.c   | 70 --
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)

diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 9139ad87d400..9ccd566da370 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include 
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include 
-#include 
-#endif
-
 #define TWL4030_I2C_BUS0
 #define EXPANSION_EEPROM_I2C_BUS   1
 #define EXPANSION_EEPROM_I2C_ADDRESS   0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-   .multipoint = 1,
-   .dyn_fifo   = 1,
-   .num_eps= 16,
-   .ram_bits   = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-   .interface_type = MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-   .mode   = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-   .mode   = MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-   .config = _config,
-   .power  = 100,
-   .platform_ops   = _ops,
-   .board_data = _board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-   musb_register(_plat, _board_data, (void *)MUSB_BASE);
-#endif
-
if (generate_fake_mac)
omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-   if (val == BOOTSTAGE_ID_RUN_OS)
-   usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-   return omap_ehci_hcd_init(index, _bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-   return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-   return usb_eth_initialize(bis);
-}
-#endif
diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig
index ed7cb8f2ff63..b08ffc062d29 100644
--- a/configs/omap3_beagle_defconfig
+++ b/configs/omap3_beagle_defconfig
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x4020
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x4020
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OMAP3=y
 CONFIG_USB_MUSB_GADGET=y
-- 
2.17.1



Re: [PATCH 2/4] omap3_beagle: Disable USB support

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 12:35:31PM -0500, Adam Ford wrote:
> On Tue, Jun 30, 2020 at 12:14 PM Tom Rini  wrote:
> >
> > On Tue, Jun 30, 2020 at 12:07:51PM -0500, Adam Ford wrote:
> > > On Tue, Jun 30, 2020 at 11:56 AM Tom Rini  wrote:
> > > >
> > > > Disable USB support for now.  There is non-trivial work required to
> > > > fully move the OMAP3 platforms to DM.  While this work is in-progress,
> > > > disable USB support for now as we've gone well past the migration
> > > > deadline.
> > > >
> > > > Cc: Adam Ford 
> > > > Signed-off-by: Tom Rini 
> > > > ---
> > >
> > > I don't have a beagle, but I have DM_USB working on two different
> > > OMAP3 boards.  I am curious to know what's left or what's not working.
> >
> > Oh?  I thought when we talked last there was still more to do to fully
> > migrate things over.  Where should I check again to see what I need to
> > do on beagle to convert it over?  Thanks!
> 
> With [1], the DM support for the EHCI controller was added.  There is
> still some work to be done to make it better, because there are still
> some #defines that need to assign the reset GPIO's. Ideally we'd get
> rid of the GPIO defines and use the device tree to address the reset.
> It isn't perfect, but it's better than having no USB at all.  The
> am3517_evm and omap3_logic_somlv have them working. Make sure the
> board files have the legacy USB stuff removed [2]
> 
> [1] - 
> https://gitlab.denx.de/u-boot/u-boot/-/commit/94ed66194f150c308d1713965a28abce3ac6e200
> [2] - 
> https://gitlab.denx.de/u-boot/u-boot/-/commit/76f6d52e61a1968702af69d6cea463b9d9332a96
> 
> Let me know if there is anything I can do to help.

Hunh, thanks.  I thought I had tried this much before but had things
blow up.  With [2] it's a quick conversion and passing basic sanity
checks.  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 2/4] omap3_beagle: Disable USB support

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 12:56:48PM -0400, Tom Rini wrote:

> Disable USB support for now.  There is non-trivial work required to
> fully move the OMAP3 platforms to DM.  While this work is in-progress,
> disable USB support for now as we've gone well past the migration
> deadline.
> 
> Cc: Adam Ford 
> Signed-off-by: Tom Rini 

As Adam noted, I should just convert this instead.  It does in fact
convert easily at this point, so I'm rejecting this patch and will post
a conversion instead soon.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] rockchip: Add delay after link-training

2020-06-30 Thread Kurt Miller
On Sat, 2020-06-27 at 20:57 +0800, Kever Yang wrote:
> Hi Kurt,
> 
> 
> On 2020/6/4 上午5:17, Peter Geis wrote:
> 
> > 
> > On Tue, Jun 2, 2020 at 11:12 AM Kurt Miller  
> > wrote:
> > > 
> > > On Tue, 2020-06-02 at 10:23 +0800, Shawn Lin wrote:
> > > > 
> > > > 在 2020/6/2 9:59, Kever Yang 写道:
> > > > > 
> > > > > Hi Kurt,
> > > > > 
> > > > > On 2020/6/2 上午4:30, Kurt Miller wrote:
> > > > > > 
> > > > > > On at least the RockPro64, many cards will trip a
> > > > > > synchronous abort when first accessing PCIe config space
> > > > > > during bus scanning. A delay after link training allows
> > > > > > some of these cards to function.
> > > > > > 
> > > > > > Signed-off-by: Kurt Miller 
> > > > > > ---
> > > > > > On the RockPro64, some pci cards trip a synchronous abort when
> > > > > > scanning the
> > > > > > pci bus. For example with HighPoint Rocket Raid 640L which is based 
> > > > > > on
> > > > > > Marvell 88SE9230 I see this:
> > > > > > 
> > > > > > => pci
> > > > > > "Synchronous Abort" handler, esr 0x96000210
> > > > > > elr: 0022d034 lr : 0022cfd0 (reloc)
> > > > > > elr: f4568034 lr : f4567fd0
> > > > > > x0 : 0010 x1 : f800
> > > > > > x2 :  x3 : 0010
> > > > > > x4 : f2559290 x5 : 
> > > > > > x6 : 0001 x7 : f2559860
> > > > > > x8 : 0030 x9 : 0008
> > > > > > x10: 0010 x11: f251fd1c
> > > > > > x12: 1421 x13: 1468
> > > > > > x14: f251fd4c x15: 
> > > > > > x16: 00060001 x17: 001f
> > > > > > x18: f2532dc0 x19: f251fcd0
> > > > > > x20: 0001 x21: 
> > > > > > x22: 0001 x23: f45d4000
> > > > > > x24:  x25: f45bc000
> > > > > > x26:  x27: 
> > > > > > x28: f2541440 x29: f251fc20
> > > > > > 
> > > > > > Code: 54c1 35a5 93407c00 f9400081 (b8616800)
> > > > > > Resetting CPU ...
> > > > > > 
> > > > > > Adding a delay after link training works-around the problem. I 
> > > > > > added this
> > > > > > delay to the OpenBSD rkpcie driver as well:
> > > > > > 
> > > > > > https://github.com/openbsd/src/commit/9857dee3520d8ca5bec68538f4b0708d7e64fc87
> > > > > > 
> > > > > > 
> > > > > > HighPoint Rocket Raid 640L needs a 1.75 sec delay and Crossfield
> > > > > > SAS9211-4i
> > > > > > needs a 1 second delay, so I arbitrarily decided on 2 seconds.
> > > > > > 
> > > > > > The delay work-around was originally discovered by nuumio:
> > > > > > https://github.com/nuumio/linux-kernel/commit/5a65b17686002dc84d461bffa324a2cb68e67aee
> > > > > > 
> > > > > > 
> > > > > >    drivers/pci/pcie_rockchip.c | 8 
> > > > > >    1 file changed, 8 insertions(+)
> > > > > > 
> > > > > > diff --git a/drivers/pci/pcie_rockchip.c 
> > > > > > b/drivers/pci/pcie_rockchip.c
> > > > > > index 0edc2464a8..51cfbf6b18 100644
> > > > > > --- a/drivers/pci/pcie_rockchip.c
> > > > > > +++ b/drivers/pci/pcie_rockchip.c
> > > > > > @@ -288,6 +288,14 @@ static int rockchip_pcie_init_port(struct 
> > > > > > udevice
> > > > > > *dev)
> > > > > >    goto err_power_off_phy;
> > > > > >    }
> > > > > > +/*
> > > > > > + * XXX: On at least the RockPro64, many cards will trip a
> > > > > > + * synchronous abort when first accessing PCIe config space
> > > > > > + * during bus scanning. A delay after link training allows
> > > > > > + * some of these cards to function.
> > > > > > + */
> > > > > > +mdelay(2000);
> > > > > I don't understand what kind of delay for init needs 2 Seconds, root
> > > > > cause will preferred.
> > > Hi Kever,
> > > 
> > > While working on this issue for the OpenBSD PCIe driver I was not
> > > able to determine the root cause. I tested the following adapters:
> > > 
> > > ROCKPro64 2 Port SATA
> > > StarTech PEXSAT32 2 Port SATA
> > > Samsung 970 Evo NVMe w/m.2 adapter
> > > IO CREST SI-PEX40148 2 Port SATA
> > > IO CREST SI-PEX40057 4 port
> > > HighPoint Rocket Raid 640L
> > > Crossfield SAS9211-4i
> > > Del PERC H200
> > > Dell PERC 6/i
> > > Intel Gigabit VT Quad Port Server
> > > 
> > > All of the above adapters successfully link trained, however
> > > three of them would panic upon the first read of the PCI config
> > > space. nuumio's work-around of placing a delay after link-training
> > > allows these cards to work.
> > > 
> > > HighPoint Rocket Raid 640L ~1.75 sec delay
> > > Crossfield SAS9211-4i ~1 sec delay
> > > Dell PERC H200 ~1 sec delay
> > > 
> > > In attempt to determine if there was a way to detect how long
> > > to wait, I compared every status and debug register documented
> > > in the rk3399 TRM part 2 for the PCI controller. I compared the
> > > values pre-delay and post-delay. I was not able to find a value
> > > that would indicate it was safe to proceed.
> > > 

Re: [PATCH 2/4] omap3_beagle: Disable USB support

2020-06-30 Thread Adam Ford
On Tue, Jun 30, 2020 at 12:14 PM Tom Rini  wrote:
>
> On Tue, Jun 30, 2020 at 12:07:51PM -0500, Adam Ford wrote:
> > On Tue, Jun 30, 2020 at 11:56 AM Tom Rini  wrote:
> > >
> > > Disable USB support for now.  There is non-trivial work required to
> > > fully move the OMAP3 platforms to DM.  While this work is in-progress,
> > > disable USB support for now as we've gone well past the migration
> > > deadline.
> > >
> > > Cc: Adam Ford 
> > > Signed-off-by: Tom Rini 
> > > ---
> >
> > I don't have a beagle, but I have DM_USB working on two different
> > OMAP3 boards.  I am curious to know what's left or what's not working.
>
> Oh?  I thought when we talked last there was still more to do to fully
> migrate things over.  Where should I check again to see what I need to
> do on beagle to convert it over?  Thanks!

With [1], the DM support for the EHCI controller was added.  There is
still some work to be done to make it better, because there are still
some #defines that need to assign the reset GPIO's. Ideally we'd get
rid of the GPIO defines and use the device tree to address the reset.
It isn't perfect, but it's better than having no USB at all.  The
am3517_evm and omap3_logic_somlv have them working. Make sure the
board files have the legacy USB stuff removed [2]

[1] - 
https://gitlab.denx.de/u-boot/u-boot/-/commit/94ed66194f150c308d1713965a28abce3ac6e200
[2] - 
https://gitlab.denx.de/u-boot/u-boot/-/commit/76f6d52e61a1968702af69d6cea463b9d9332a96

Let me know if there is anything I can do to help.

adam
>
> --
> Tom


Re: [PATCH 2/4] omap3_beagle: Disable USB support

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 12:07:51PM -0500, Adam Ford wrote:
> On Tue, Jun 30, 2020 at 11:56 AM Tom Rini  wrote:
> >
> > Disable USB support for now.  There is non-trivial work required to
> > fully move the OMAP3 platforms to DM.  While this work is in-progress,
> > disable USB support for now as we've gone well past the migration
> > deadline.
> >
> > Cc: Adam Ford 
> > Signed-off-by: Tom Rini 
> > ---
> 
> I don't have a beagle, but I have DM_USB working on two different
> OMAP3 boards.  I am curious to know what's left or what's not working.

Oh?  I thought when we talked last there was still more to do to fully
migrate things over.  Where should I check again to see what I need to
do on beagle to convert it over?  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 2/4] omap3_beagle: Disable USB support

2020-06-30 Thread Adam Ford
On Tue, Jun 30, 2020 at 11:56 AM Tom Rini  wrote:
>
> Disable USB support for now.  There is non-trivial work required to
> fully move the OMAP3 platforms to DM.  While this work is in-progress,
> disable USB support for now as we've gone well past the migration
> deadline.
>
> Cc: Adam Ford 
> Signed-off-by: Tom Rini 
> ---

I don't have a beagle, but I have DM_USB working on two different
OMAP3 boards.  I am curious to know what's left or what's not working.

adam

>  configs/omap3_beagle_defconfig | 20 ++--
>  1 file changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig
> index ed7cb8f2ff63..236a4f4f5f5a 100644
> --- a/configs/omap3_beagle_defconfig
> +++ b/configs/omap3_beagle_defconfig
> @@ -9,6 +9,7 @@ CONFIG_NR_DRAM_BANKS=2
>  CONFIG_SPL=y
>  CONFIG_SPL_TEXT_BASE=0x4020
>  CONFIG_DISTRO_DEFAULTS=y
> +CONFIG_ANDROID_BOOT_IMAGE=y
>  CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
>  CONFIG_USE_PREBOOT=y
>  CONFIG_PREBOOT="usb start"
> @@ -31,7 +32,6 @@ CONFIG_CMD_MMC=y
>  CONFIG_CMD_NAND=y
>  CONFIG_CMD_NAND_TRIMFFS=y
>  CONFIG_CMD_SPI=y
> -CONFIG_CMD_USB=y
>  CONFIG_CMD_CACHE=y
>  CONFIG_CMD_EXT4_WRITE=y
>  CONFIG_CMD_FS_UUID=y
> @@ -50,8 +50,6 @@ CONFIG_ENV_IS_IN_NAND=y
>  CONFIG_SPL_DM=y
>  CONFIG_SPL_DM_SEQ_ALIAS=y
>  CONFIG_SPL_OF_TRANSLATE=y
> -CONFIG_USB_FUNCTION_FASTBOOT=y
> -CONFIG_FASTBOOT_BUF_ADDR=0x8200
>  CONFIG_LED_STATUS=y
>  CONFIG_LED_STATUS0=y
>  CONFIG_LED_STATUS_BIT=1
> @@ -73,24 +71,10 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
>  CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
>  CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
>  CONFIG_SPL_NAND_SIMPLE=y
> +CONFIG_DM_ETH=y
>  CONFIG_SPI=y
>  CONFIG_DM_SPI=y
>  CONFIG_OMAP3_SPI=y
> -CONFIG_USB=y
> -CONFIG_USB_EHCI_HCD=y
> -CONFIG_USB_OMAP3=y
> -CONFIG_USB_MUSB_GADGET=y
> -CONFIG_USB_MUSB_OMAP2PLUS=y
> -CONFIG_TWL4030_USB=y
> -CONFIG_USB_GADGET=y
> -CONFIG_USB_GADGET_MANUFACTURER="TI"
> -CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> -CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
> -CONFIG_USB_ETHER=y
> -CONFIG_USB_HOST_ETHER=y
> -CONFIG_USB_ETHER_ASIX=y
> -CONFIG_USB_ETHER_MCS7830=y
> -CONFIG_USB_ETHER_SMSC95XX=y
>  CONFIG_VIDEO_OMAP3=y
>  CONFIG_FAT_WRITE=y
>  CONFIG_BCH=y
> --
> 2.17.1
>


[PATCH 3/4] ti816x_evm: Enable DM_MMC

2020-06-30 Thread Tom Rini
This platform is already using DM in general and the MMC controller is
the early generation of what is compatible with "ti,omap4-hsmmc" so
enable DM_MMC (which in turn gets BLK enabled).

Signed-off-by: Tom Rini 
---
 configs/ti816x_evm_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/ti816x_evm_defconfig b/configs/ti816x_evm_defconfig
index 17aa6a02067c..033d35df4d02 100644
--- a/configs/ti816x_evm_defconfig
+++ b/configs/ti816x_evm_defconfig
@@ -47,6 +47,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_OMAP24XX=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
-- 
2.17.1



[PATCH 4/4] ti814x: Remove platform

2020-06-30 Thread Tom Rini
The TI814x (DM814x) platform is rather old and in need of a lot of
migration work.  As much of that work is well past the deadline, remove
this platform.

Signed-off-by: Tom Rini 
---
 arch/arm/mach-omap2/Kconfig  |   1 -
 board/ti/ti814x/Kconfig  |  15 ---
 board/ti/ti814x/MAINTAINERS  |   6 --
 board/ti/ti814x/Makefile |  11 --
 board/ti/ti814x/evm.c| 190 ---
 board/ti/ti814x/evm.h|   8 --
 board/ti/ti814x/mux.c|  86 
 configs/ti814x_evm_defconfig |  45 -
 8 files changed, 362 deletions(-)
 delete mode 100644 board/ti/ti814x/Kconfig
 delete mode 100644 board/ti/ti814x/MAINTAINERS
 delete mode 100644 board/ti/ti814x/Makefile
 delete mode 100644 board/ti/ti814x/evm.c
 delete mode 100644 board/ti/ti814x/evm.h
 delete mode 100644 board/ti/ti814x/mux.c
 delete mode 100644 configs/ti814x_evm_defconfig

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4c87cbc00f74..48bc80a6390a 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -181,7 +181,6 @@ source "board/BuR/brppt1/Kconfig"
 source "board/siemens/draco/Kconfig"
 source "board/siemens/pxm2/Kconfig"
 source "board/siemens/rut/Kconfig"
-source "board/ti/ti814x/Kconfig"
 source "board/ti/ti816x/Kconfig"
 source "board/ti/am43xx/Kconfig"
 source "board/ti/am335x/Kconfig"
diff --git a/board/ti/ti814x/Kconfig b/board/ti/ti814x/Kconfig
deleted file mode 100644
index 2960099a8e5b..
--- a/board/ti/ti814x/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
-if TARGET_TI814X_EVM
-
-config SYS_BOARD
-   default "ti814x"
-
-config SYS_VENDOR
-   default "ti"
-
-config SYS_SOC
-   default "am33xx"
-
-config SYS_CONFIG_NAME
-   default "ti814x_evm"
-
-endif
diff --git a/board/ti/ti814x/MAINTAINERS b/board/ti/ti814x/MAINTAINERS
deleted file mode 100644
index b2ee39e8a339..
--- a/board/ti/ti814x/MAINTAINERS
+++ /dev/null
@@ -1,6 +0,0 @@
-TI814X BOARD
-M: Tom Rini 
-S: Maintained
-F: board/ti/ti814x/
-F: include/configs/ti814x_evm.h
-F: configs/ti814x_evm_defconfig
diff --git a/board/ti/ti814x/Makefile b/board/ti/ti814x/Makefile
deleted file mode 100644
index c5ff8d072851..
--- a/board/ti/ti814x/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Makefile
-#
-# Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
-
-ifdef CONFIG_SPL_BUILD
-obj-y  := mux.o
-endif
-
-obj-y  += evm.o
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
deleted file mode 100644
index 8ed80d2f4627..
--- a/board/ti/ti814x/evm.c
+++ /dev/null
@@ -1,190 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * evm.c
- *
- * Board functions for TI814x EVM
- *
- * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "evm.h"
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
-
-/* UART Defines */
-#ifdef CONFIG_SPL_BUILD
-static const struct cmd_control evm_ddr2_cctrl_data = {
-   .cmd0csratio= 0x80,
-   .cmd0iclkout= 0x00,
-
-   .cmd1csratio= 0x80,
-   .cmd1iclkout= 0x00,
-
-   .cmd2csratio= 0x80,
-   .cmd2iclkout= 0x00,
-};
-
-static const struct emif_regs evm_ddr2_emif0_regs = {
-   .sdram_config   = 0x40801ab2,
-   .ref_ctrl   = 0x1c30,
-   .sdram_tim1 = 0x0aaaf552,
-   .sdram_tim2 = 0x043631d2,
-   .sdram_tim3 = 0x0327,
-   .emif_ddr_phy_ctlr_1= 0x0007
-};
-
-static const struct emif_regs evm_ddr2_emif1_regs = {
-   .sdram_config   = 0x40801ab2,
-   .ref_ctrl   = 0x1c30,
-   .sdram_tim1 = 0x0aaaf552,
-   .sdram_tim2 = 0x043631d2,
-   .sdram_tim3 = 0x0327,
-   .emif_ddr_phy_ctlr_1= 0x0007
-};
-
-const struct dmm_lisa_map_regs evm_lisa_map_regs = {
-   .dmm_lisa_map_0 = 0x,
-   .dmm_lisa_map_1 = 0x,
-   .dmm_lisa_map_2 = 0x806c0300,
-   .dmm_lisa_map_3 = 0x806c0300,
-};
-
-static const struct ddr_data evm_ddr2_data = {
-   .datardsratio0  = ((0x35<<10) | (0x35<<0)),
-   .datawdsratio0  = ((0x20<<10) | (0x20<<0)),
-   .datawiratio0   = ((0<<10) | (0<<0)),
-   .datagiratio0   = ((0<<10) | (0<<0)),
-   .datafwsratio0  = ((0x90<<10) | (0x90<<0)),
-   .datawrsratio0  = ((0x50<<10) | (0x50<<0)),
-};
-
-void set_uart_mux_conf(void)
-{
-   /* Set UART pins */
-   

[PATCH 1/4] am335x: Update list of defconfigs

2020-06-30 Thread Tom Rini
Both the am335x_boneblack and am335x_evm_usbspl configs have been gone
for a while, remove their entries from MAINTAINERS.

Signed-off-by: Tom Rini 
---
 board/ti/am335x/MAINTAINERS | 2 --
 1 file changed, 2 deletions(-)

diff --git a/board/ti/am335x/MAINTAINERS b/board/ti/am335x/MAINTAINERS
index 565f7055cdd3..e100adfd68ec 100644
--- a/board/ti/am335x/MAINTAINERS
+++ b/board/ti/am335x/MAINTAINERS
@@ -3,7 +3,5 @@ M:  Tom Rini 
 S: Maintained
 F: board/ti/am335x/
 F: include/configs/am335x_evm.h
-F: configs/am335x_boneblack_defconfig
 F: configs/am335x_boneblack_vboot_defconfig
 F: configs/am335x_evm_defconfig
-F: configs/am335x_evm_usbspl_defconfig
-- 
2.17.1



[PATCH 2/4] omap3_beagle: Disable USB support

2020-06-30 Thread Tom Rini
Disable USB support for now.  There is non-trivial work required to
fully move the OMAP3 platforms to DM.  While this work is in-progress,
disable USB support for now as we've gone well past the migration
deadline.

Cc: Adam Ford 
Signed-off-by: Tom Rini 
---
 configs/omap3_beagle_defconfig | 20 ++--
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig
index ed7cb8f2ff63..236a4f4f5f5a 100644
--- a/configs/omap3_beagle_defconfig
+++ b/configs/omap3_beagle_defconfig
@@ -9,6 +9,7 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0x4020
 CONFIG_DISTRO_DEFAULTS=y
+CONFIG_ANDROID_BOOT_IMAGE=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="usb start"
@@ -31,7 +32,6 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_NAND=y
 CONFIG_CMD_NAND_TRIMFFS=y
 CONFIG_CMD_SPI=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FS_UUID=y
@@ -50,8 +50,6 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_OF_TRANSLATE=y
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x8200
 CONFIG_LED_STATUS=y
 CONFIG_LED_STATUS0=y
 CONFIG_LED_STATUS_BIT=1
@@ -73,24 +71,10 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
-CONFIG_USB=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_OMAP3=y
-CONFIG_USB_MUSB_GADGET=y
-CONFIG_USB_MUSB_OMAP2PLUS=y
-CONFIG_TWL4030_USB=y
-CONFIG_USB_GADGET=y
-CONFIG_USB_GADGET_MANUFACTURER="TI"
-CONFIG_USB_GADGET_VENDOR_NUM=0x0451
-CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
-CONFIG_USB_ETHER=y
-CONFIG_USB_HOST_ETHER=y
-CONFIG_USB_ETHER_ASIX=y
-CONFIG_USB_ETHER_MCS7830=y
-CONFIG_USB_ETHER_SMSC95XX=y
 CONFIG_VIDEO_OMAP3=y
 CONFIG_FAT_WRITE=y
 CONFIG_BCH=y
-- 
2.17.1



Re: [PATCH v6 1/3] gpio-uclass.c: save the GPIOD flags also in the gpio descriptor

2020-06-30 Thread Walter Lozano

Hi Heiko

On 22/5/20 06:08, Heiko Schocher wrote:

save the GPIOD_ flags also in the gpio descriptor.

Signed-off-by: Heiko Schocher 
Reviewed-by: Patrick Delaunay 
Fixes: 788ea834124b ("gpio: add function _dm_gpio_set_dir_flags")


Thanks for this fix, without it the MMC driver of my iMX6 Hummingboard 
produces "Card did not respond to voltage select!" and does not work.




---

Changes in v6:
- add reviewed by from Patrick and Fixes tag

Changes in v5:
- add comment from patrick, update the descriptor flags
   in _dm_gpio_set_dir_flags() if setting direction was OK.

Changes in v4:
- new in version 4

Changes in v3: None
Changes in v2: None

  drivers/gpio/gpio-uclass.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 9eeab22eef..f016532354 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -600,6 +600,10 @@ static int _dm_gpio_set_dir_flags(struct gpio_desc *desc, 
ulong flags)
}
}
  
+	/* save the flags also in descriptor */

+   if (!ret)
+   desc->flags = flags;
+
return ret;
  }
  
@@ -615,10 +619,6 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags)

flags |= desc->flags;
ret = _dm_gpio_set_dir_flags(desc, flags);
  
-	/* update the descriptor flags */

-   if (ret)
-   desc->flags = flags;
-
return ret;
  }
  



Regards,

Walter



Re: [PATCH 0/2] u-boot support for ODROID-C4

2020-06-30 Thread Anand Moon
Hi Neil,

On Tue, 30 Jun 2020 at 18:30, Neil Armstrong  wrote:
>
> Hi,
>
> On 30/06/2020 13:33, Anand Moon wrote:
> > Hi Beniamino,
> >
> > On Wed, 6 May 2020 at 01:53, Beniamino Galvani  wrote:
> >>
> >> Hi,
> >>
> >> these two patches add initial u-boot support for Hardkernel ODROID-C4.
> >>
> >> https://wiki.odroid.com/odroid-c4/odroid-c4
> >>
> >> Beniamino Galvani (2):
> >>   arm: dts: import ODROID-C4 device tree
> >>   boards: amlogic: add ODROID-C4 support
> >>
> >
> > Can you respin this patches, I would like to see these get merged in
> > the current u-boot release
> >
> > -Anand
> >
>
> The Odroid-C4 could re-use the new Odroid-N2 board support I submitted at [1]
>
> Anand, is the MAC address stored stored the same way on the C4 ?
>
> Neil
>
> [1] 
> https://patchwork.ozlabs.org/project/uboot/patch/20200618144037.23392-1-narmstr...@baylibre.com/

I gave this patches a try on latest u-boot but I cannot make my Odroid
C4 to boot up uinsg microSD card and eMMC
Here are the logs.

SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.0;CHK:0;
bl2_stage_init 0x01
bl2_stage_init 0x81
hw id: 0x - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

no sdio debug board detected
L0:
L1:0703
L2:8067
L3:1520
S1:
B2:20282000
B1:a0f83180

TE: 260148

BL2 Built : 22:54:32, Apr 28 2020. g12a ga659aac-dirty - changqing.gao@droid11

Board ID = 1
Set cpu clk to 24M
Set clk81 to 24M
Use GP1_pll as DSU clk.
DSU clk: 1200 Mhz
CPU clk: 1200 MHz
Set clk81 to 166.6M
DDR driver_vesion: LPDDR4_PHY_V_0_1_15 build time: Apr 28 2020 22:54:28
board id: 1
Load FIP HDR from SD, src: 0x00010200, des: 0xfffd, size:
0x4000, part: 0
fw parse done
Load ddrfw from SD, src: 0x00030200, des: 0xfffd, size: 0xc000, part: 0
Load ddrfw from SD, src: 0x0002c200, des: 0xfffd, size: 0x4000, part: 0
PIEI prepare done
fastboot data load
fastboot data verify
verify result: 255
Cfg max: 2, cur: 1. Board id: 255. Force loop cfg
DDR4 probe
ddr clk to 1320MHz
Load ddrfw from SD, src: 0x00014200, des: 0xfffd, size: 0xc000, part: 0

dmc_version 0001
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of Write leveling coarse delay
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from SD, src: 0x00020200, des: 0xfffd, size: 0xc000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

R0_RxClkDly_Margin==106 ps 9
R0_TxDqDly_Margi==118 ps 10


R1_RxClkDly_Margin==0 ps 0
R1_TxDqDly_Margi==0 ps 0

 dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0001

soc_vref_reg_value 0x 004e 004e 004e 004d 004f
004e 004e 004f 004c 004d 004e 004c
004c 004e 004f 004e 0050 004e 004d
004e 004e 004c 004d 004d 004d 004f
004f 004f 004d 004d 004d 004f
dram_vref_reg_value 0x 0021
2D training succeed
aml_ddr_fw_vesion: LPDDR4_PHY_V_0_1_15 build time: Jun 18 2019 20:29:43
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00700024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass

non-sec scramble use zero key
ddr scramble enabled

100bdlr_step_size ps== 461
result report
boot times 0Enable ddr reg access
Load FIP HDR from SD, src: 0x00010200, des: 0x0170, size:
0x4000, part: 0
Load BL3X from SD, src: 0x0003c200, des: 0x0172c000, size: 0x0009, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
MVN_1=0x
MVN_2=0x
[Image: g12a_v1.1.3386-3b31431 2019-05-21 10:41:54 luan.yuan@droid15-sz]
OPS=0x10
ring efuse init
2b 0c 10 00 01 13 20 00 00 0f 36 30 43 57 50 50
[0.017319 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE:  BL31: v1.3(release):4fc40b1
NOTICE:  BL31: Built : 15:57:33, May 22 2019
NOTICE:  BL31: G12A normal boot!
NOTICE:  BL31: BL33 decompress pass
ERROR:   Error initializing runtime service opteed_fast


U-Boot 2020.07-rc5-00076-g46e5b60e21 (Jun 30 2020 - 21:08:25 +0530) odroid-c4

Model: Hardkernel ODROID-C4
SoC:   Amlogic Meson SM1 (Unknown) Revision 2b:c (10:2)
DRAM:  3.8 GiB
MMC:   sd@ffe05000: 0, mmc@ffe07000: 1
stdio_add_devices: Video device failed (ret=-22)
In:serial@3000
Out:   serial@3000
Err:   serial@3000
Net:   Could not get PHY for ethernet@ff3f: addr 8
No ethernet found.

Hit any key to stop autoboot:  0

-Anand


Pull request for UEFI sub-system for efi-2020-07-rc6 (2)

2020-06-30 Thread Heinrich Schuchardt
The following changes since commit 19a7e5814b77b288472aa96b6d94fb2591cc9184:

  Merge tag 'fixes-for-v2020.07' of
https://gitlab.denx.de/u-boot/custodians/u-boot-video (2020-06-28
10:12:25 -0400)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-efi.git
tags/efi-2020-07-rc6-2

for you to fetch changes up to b7cae5739741fad1327e64c18a0b30919bc77a0e:

  test/py: test_efi_fit: Update #size-cells to 1 (2020-06-30 14:35:41 +0200)


Pull request for UEFI sub-system for efi-2020-07-rc6 (2)

Fix an incorrect update of the GD register in efi_get_variable_common().
Fix an incorrect check for an FDT reg property.
Fix a device tree used for Python testing.


Bin Meng (1):
  test/py: test_efi_fit: Update #size-cells to 1

Heinrich Schuchardt (2):
  efi_loader: fix incorrect use of EFI_EXIT()
  efi_loader: incorrect check against FDT_ADDR_T_NONE

 cmd/bootefi.c | 2 +-
 lib/efi_loader/efi_variable.c | 2 +-
 test/py/tests/test_efi_fit.py | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)


Re: [PATCH] configs: powerpc: add usb (host) mass storage support

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 01:08:34PM +0800, Ran Wang wrote:

> commit 0cfccb54014b ("configs: Resync with savedefconfig")
> removed CONFIG_USB_STORAGE from some powerpc platforms' defconfig
> files, whicih would block the use case of system loading rootfs
> from USB drives, add them back.
> 
> Signed-off-by: Ran Wang 

Checking in on this one, the options were removed as at the time
required options weren't enabled.  They're enabled now and this patch
will be stable.

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL] u-boot-mips

2020-06-30 Thread Daniel Schwierzeck
On Tue, Jun 30, 2020 at 2:52 PM Tom Rini  wrote:
>
> On Mon, Jun 29, 2020 at 08:05:15PM -0400, Tom Rini wrote:
> > On Tue, Jun 30, 2020 at 01:10:53AM +0200, Daniel Schwierzeck wrote:
> >
> > > Hi Tom,
> > >
> > > actually I wanted to send this much earlier but I hope it's still okay.
> > >
> > > This enables Qemu tests for the MIPS Malta board in all variants (32/64 
> > > bit,
> > > big/little endian) in Gitlab CI, Travis CI and Azure Pipelines. This 
> > > allows
> > > to deprecate the qemu_mips board in the future because there is no Linux 
> > > support
> > > anymore for ages and Qemu deprecated the generic MIPS board as well in 
> > > favour of
> > > Malta.
> > >
> > > I had to include the PCNET patches because otherwise the Malta 64bit 
> > > targets
> > > had stability issues in the Qemu network test case. Thus it's not just 
> > > cleanup
> > > and DM conversion, but also bugfixing ;)
> > >
> > > https://gitlab.denx.de/u-boot/custodians/u-boot-mips/pipelines/3824
> > > https://travis-ci.org/github/danielschwierzeck/u-boot/builds/703302746
> > > https://dev.azure.com/danielschwierzeck/u-boot/_build/results?buildId=8=results
> >
> > Is it OK for this to go in to -next at this point?  Thanks!
>
> I do see that at this time you're the only user of the PCNET driver, so
> if you're happy and really want it in this release and not the next
> release, OK.  But v2020.07 is scheduled for next Monday too so this
> really is quite late.
>

-next is also OK. Just wanted to get it out of the way before I
prepare the next bigger MIPS update for the next merge window ;)

-- 
- Daniel


Re: [U-Boot] [PATCH v1 08/10] colibri_pxa270_defconfig: enable cmd_dm

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:45:00AM +0200, Marcel Ziswiler wrote:

> Enable CONFIG_CMD_DM.
> 
> Signed-off-by: Marcel Ziswiler 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 29/31] spi: Enable missing CONFIG_SPL_DM_SPI support

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:29PM -0400, Tom Rini wrote:

> Due to how the Makefile logic is we currently get DM_SPI support in SPL
> enabled by having DM_SPI enabled for full U-Boot but not having
> CONFIG_SPL_DM_SPI set.  Add this missing option to boards that were
> inadvertently making use of it.
> 
> Cc: Adam Ford 
> Cc: Akash Gajjar 
> Cc: Anatolij Gustschin 
> Cc: Andy Yan 
> Cc: Anup Patel 
> Cc: Atish Patra 
> Cc: Bin Meng 
> Cc: Chee Hong Ang 
> Cc: Chin-Liang See 
> Cc: Dalon Westergreen 
> Cc: Dinh Nguyen 
> Cc: Eugen Hristev 
> Cc: Hannes Schmelzer 
> Cc: Heiko Schocher 
> Cc: Jagan Teki 
> Cc: Klaus Goger 
> Cc: Levin Du 
> Cc: Ley Foon Tan 
> Cc: Lokesh Vutla 
> Cc: Luca Ceresoli 
> Cc: Marek Vasut 
> Cc: Michal Simek 
> Cc: Mike Looijmans 
> Cc: Nicolas Ferre 
> Cc: Nikita Kiryanov 
> Cc: Palmer Dabbelt 
> Cc: Patrick Delaunay 
> Cc: Paul Walmsley 
> Cc: Pavel Machek 
> Cc: Peter Robinson 
> Cc: Philipp Tomsich 
> Cc: Simon Glass 
> Cc: Stefan Roese 
> Cc: Suniel Mahesh 
> Cc: Vitaly Andrianov 
> Cc: Wolfgang Grandegger 
> Signed-off-by: Tom Rini 
> Reviewed-by: Simon Glass 
> Reviewed-by: Luca Ceresoli 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 06/10] kconfig: mmc: move pxa_mmc_generic to kconfig

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:44:58AM +0200, Marcel Ziswiler wrote:

> Move CONFIG_PXA_MMC_GENERIC to Kconfig.
> 
> Signed-off-by: Marcel Ziswiler 
> Reviewed-by: Simon Glass 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] cmd: add a panic command

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 01:05:45AM +0200, Heiko Stuebner wrote:

> From: Heiko Stuebner 
> 
> Even in boot scripts it may be needed to "panic" when all options
> are exhausted and the device specification specifies hanging
> instead of resetting the board.
> 
> So add a new panic command that just wraps around the core panic
> call in U-Boot and can take an optional message.
> 
> Signed-off-by: Heiko Stuebner 
> Reviewed-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 07/10] arm: pxa: mmc: add driver model support

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:44:59AM +0200, Marcel Ziswiler wrote:

> Add driver model (DM) support.
> 
> Signed-off-by: Marcel Ziswiler 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 05/10] dm: core: gracefully handle alias seq without of

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:44:57AM +0200, Marcel Ziswiler wrote:

> Gracefully handle alias seq in the platform data rather than OF case.
> 
> Signed-off-by: Marcel Ziswiler 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 04/10] Makefile: allow dm_mmc without of_control

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:44:56AM +0200, Marcel Ziswiler wrote:

> Allow for CONFIG_DM_MMC with platform data rather than
> CONFIG_OF_CONTROL.
> 
> Signed-off-by: Marcel Ziswiler 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 09/10] colibri_pxa270: add mmc platform data

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:45:01AM +0200, Marcel Ziswiler wrote:

> Add MMC platform data.
> 
> While at it also fix trivial checkpatch.pl issues.
> 
> Signed-off-by: Marcel Ziswiler 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 10/10] colibri_pxa270_defconfig: enable dm_mmc

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:45:02AM +0200, Marcel Ziswiler wrote:

> Enable CONFIG_DM_MMC.
> 
> Signed-off-by: Marcel Ziswiler 
> Reviewed-by: Igor Opaniuk 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 31/31] Convert CONFIG_CADENCE_QSPI to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:31PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_CADENCE_QSPI
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 03/10] serial: pxa: clean-up platform data include file

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:44:55AM +0200, Marcel Ziswiler wrote:

> Clean-up platform data include file by using BIT macro and converting
> indentation with spaces to tabs.
> 
> Signed-off-by: Marcel Ziswiler 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 28/31] Kconfig: Remove CONFIG_CLOCKS_IN_MHZ

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:28PM -0400, Tom Rini wrote:

> This variable is unset anywhere and only unset on a number of platforms.
> Remove all relevant code.
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 27/31] Convert CONFIG_BOOTM_NETBSD to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:27PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOOTM_NETBSD
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v1 01/10] mmc: add missing space before comment delimiter

2020-06-30 Thread Tom Rini
On Mon, May 20, 2019 at 02:44:53AM +0200, Marcel Ziswiler wrote:

> Add missing space before a comment delimiter.
> 
> Signed-off-by: Marcel Ziswiler 
> Reviewed-by: Peng Fan 
> Reviewed-by: Igor Opaniuk 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 26/31] arm: imx: Finish migration of CONFIG_CSF_SIZE to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:26PM -0400, Tom Rini wrote:

> While in most cases CSF_SIZE is handled via Kconfig we have some i.MX8M
> platforms that set the size based on the now-renamed CONFIG_SECURE_BOOT
> symbol.  Update things so that CSF_SIZE itself depends on IMX_HAB being
> enabled and provide the default value for i.MX8M family of parts.
> 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: Ye Li 
> Cc: NXP i.MX U-Boot Team 
> Fixes: d714a75fd4dc ("imx: replace CONFIG_SECURE_BOOT with CONFIG_IMX_HAB")
> Signed-off-by: Tom Rini 
> Reviewed-by: Stefano Babic 
> Reviewed-by: Ye Li 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 24/31] arm: imx: Finish migration from CONFIG_SECURE_BOOT to CONFIG_IMX_HAB

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:24PM -0400, Tom Rini wrote:

> There are a few remaining places where we say CONFIG_SECURE_BOOT rather
> than CONFIG_IMX HAB.  Update these instances.
> 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: NXP i.MX U-Boot Team 
> Cc: Eddy Petrișor 
> Cc: Shawn Guo 
> Cc: Priyanka Jain 
> Fixes: d714a75fd4dc ("imx: replace CONFIG_SECURE_BOOT with CONFIG_IMX_HAB")
> Signed-off-by: Tom Rini 
> Reviewed-by: Stefano Babic 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 25/31] nxp: Finish switch to CONFIG_NXP_ESBC

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:25PM -0400, Tom Rini wrote:

> There are two remaining users of the CONFIG_SECURE_BOOT symbol that have
> not been migrated to another symbol.  In this case, they should be using
> CONFIG_NXP_ESBC as their guard.
> 
> Cc: Vladimir Oltean 
> Fixes: 5536c3c9d0d1 ("freescale/layerscape: Rename the config 
> CONFIG_SECURE_BOOT name")
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 22/31] arm: toradex: Convert CONFIG_CONSOLE_MUX to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:22PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_CONSOLE_MUX
> 
> Cc: Igor Opaniuk 
> Signed-off-by: Tom Rini 
> Reviewed-by: Igor Opaniuk 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 23/31] Convert CONFIG_CONSOLE_SCROLL_LINES to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:23PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_CONSOLE_SCROLL_LINES
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 19/31] Convert CONFIG_BUILD_TARGET to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:19PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BUILD_TARGET
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 21/31] Convert CONFIG_CONS_INDEX to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:21PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_CONS_INDEX
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 20/31] Convert CONFIG_CMDLINE_EDITING to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:20PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_CMDLINE_EDITING
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 18/31] Convert CONFIG_BOUNCE_BUFFER to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:18PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOUNCE_BUFFER
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 14/31] Convert CONFIG_BOARD_TYPES to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:14PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOARD_TYPES
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 15/31] arm: capricorn: Convert CONFIG_BOOTCOUNT_ENV et al to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:15PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOOTCOUNT_ENV
>CONFIG_BOOTCOUNT_LIMIT
> 
> Cc: Anatolij Gustschin 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 17/31] Convert CONFIG_BOOTP_DNS2 to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:17PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOOTP_DNS2
>CONFIG_BOOTP_PXE_CLIENTARCH
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 16/31] arm: abb secu1: Convert CONFIG_BOOTDELAY to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:16PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOOTDELAY
> 
> Cc: Holger Brunck 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 13/31] Convert CONFIG_BCH to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:13PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BCH
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 12/31] Convert CONFIG_BOOTARGS to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:12PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOOTARGS
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 10/31] Convert CONFIG_BAUDRATE to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:10PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BAUDRATE
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 11/31] Convert CONFIG_BOARD_EARLY_INIT_F et al to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:11PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_BOARD_EARLY_INIT_F
>CONFIG_BOARD_EARLY_INIT_R
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 09/31] bk4r1: Re-convert CONFIG_AUTOBOOT_PROMPT et al to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:09PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_AUTOBOOT_PROMPT
>CONFIG_AUTOBOOT_KEYED
>CONFIG_AUTOBOOT_STOP_STR
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 08/31] Convert CONFIG_ATMEL_USART to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:08PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_ATMEL_USART
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 05/31] Convert CONFIG_AT91_GPIO to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:05PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_AT91_GPIO
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 07/31] Convert CONFIG_ATMEL_NAND_HW_PMECC et al to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:07PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_ATMEL_NAND_HW_PMECC
>CONFIG_ATMEL_NAND_HWECC
>CONFIG_NAND_ATMEL
>CONFIG_PMECC_CAP
>CONFIG_PMECC_SECTOR_SIZE
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 03/31] Convert CONFIG_ARM_PL180_MMCI to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:03PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_ARM_PL180_MMCI
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 06/31] Convert CONFIG_ATMEL_HLCD to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:06PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_ATMEL_HLCD
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv5 2/3] spi: Move DM_SPI_FLASH and SPI_FLASH_DATAFLASH to Kconfig (for ls1021aXXX)

2020-06-30 Thread Tom Rini
On Thu, Jun 04, 2020 at 11:11:52PM +0800, Zhiqiang Hou wrote:

> From: Lukasz Majewski 
> 
> This patch moves the CONFIG_DM_SPI_FLASH and CONFIG_SPI_FLASH_DATAFLASH
> to be defined in Kconfig, not in board specific header file
> (include/configs/.h).
> 
> Before this change the CONFIG_DM_SPI_FLASH was not set in .config (so it
> was not possible to use CONFIG_IS_ENABLED(DM_SPI_FLASH) in SPI DM/DTS
> converted drivers), but it was set in u-boot.cfg file.
> 
> Signed-off-by: Lukasz Majewski 
> Signed-off-by: Hou Zhiqiang 

Applied to u-boot/next (and oops, the other parts of the series too),
thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 02/31] Convert CONFIG_ARCH_MISC_INIT to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:02PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_ARCH_MISC_INIT
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv2 01/31] Convert CONFIG_AM335X_LCD to Kconfig

2020-06-30 Thread Tom Rini
On Tue, Jun 16, 2020 at 07:06:01PM -0400, Tom Rini wrote:

> This converts the following to Kconfig:
>CONFIG_AM335X_LCD
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv5 1/3] spi: Move DM_SPI_FLASH to Kconfig (for NXP's ls1043a)

2020-06-30 Thread Tom Rini
On Thu, Jun 04, 2020 at 11:11:51PM +0800, Zhiqiang Hou wrote:

> From: Lukasz Majewski 
> 
> This patch fixes issue with defining the DM_SPI_FLASH in the
> configs/include/ instead of enabling this option in Kconfig.
> 
> The problem is that CONFIG_IS_ENABLED(DM_SPI_FLASH) shows false as there
> is no DM_SPI_FLASH=y in .config (but the define is set in u-boot.cfg).
> 
> As a result conversion of DM_SPI_FLASH to using CONFIG_IS_ENABLED() is not
> working properly.
> 
> Signed-off-by: Lukasz Majewski 
> Signed-off-by: Hou Zhiqiang 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCHv5 3/3] spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI*

2020-06-30 Thread Tom Rini
On Thu, Jun 04, 2020 at 11:11:53PM +0800, Zhiqiang Hou wrote:

> From: Lukasz Majewski 
> 
> This change allows more fine tuning of driver model based SPI support in
> SPL and TPL. It is now possible to explicitly enable/disable the DM_SPI
> support in SPL and TPL via Kconfig option.
> 
> Before this change it was necessary to use:
> /* SPI Flash Configs */
> #if defined(CONFIG_SPL_BUILD)
> #undef CONFIG_DM_SPI
> #undef CONFIG_DM_SPI_FLASH
> #undef CONFIG_SPI_FLASH_MTD
> #endif
> 
> in the ./include/configs/.h, which is error prone and shall be
> avoided when we strive to switch to Kconfig.
> 
> The goal of this patch:
> 
> Provide distinction for DM_SPI support in both U-Boot proper and SPL (TPL).
> Valid use case is when U-Boot proper wants to use DM_SPI, but SPL must
> still support non DM driver.
> 
> Another use case is the conversion of non DM/DTS SPI driver to support
> DM/DTS. When such driver needs to work in both SPL and U-Boot proper, the
> distinction is needed in Kconfig (also if SPL version of the driver
> supports OF_PLATDATA).
> 
> In the end of the day one would have to support following use cases (in
> single driver file - e.g. mxs_spi.c):
> 
> - U-Boot proper driver supporting DT/DTS
> - U-Boot proper driver without DT/DTS support (deprecated)
> - SPL driver without DT/DTS support
> - SPL (and TPL) driver with DT/DTS (when the SoC has enough resources to
>   run full blown DT/DTS)
> - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have constrained
>   environment with no fitImage and OF_LIBFDT support).
> 
> Some boards do require SPI support (with DM) in SPL (TPL) and some only
> have DM_SPI{_FLASH} defined to allow compiling SPL.
> 
> This patch converts #ifdef CONFIG_DM_SPI* to #if CONFIG_IS_ENABLED(DM_SPI)
> and provides corresponding defines in Kconfig.
> 
> Signed-off-by: Lukasz Majewski 
> Tested-by: Adam Ford  #da850-evm
> Signed-off-by: Hou Zhiqiang 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH V3 6/6] ARM: rmobile: Add Beacon EmbeddedWorks RZG2M Dev Kit

2020-06-30 Thread Adam Ford
The Beacon EmbeddedWorks kit is based on the R8A774A1 SoC also
known as the RZ/G2M.

The kit consists of a SOM + Baseboard and supports microSD,
eMMC, Ethernet, a couple celular radios, two CAN interfaces,
Bluetooth and WiFi.

Signed-off-by: Adam Ford 
---
V3:  Remove unnecessary/unwanted code
 Rename defconfig for consistency with other SoC's
 Move config option to defconfig
 Remove BOOTARGS from defconfig

V2:  New to series

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9900b44274..75e05f18c3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -766,6 +766,7 @@ dtb-$(CONFIG_RCAR_GEN2) += \
r8a7794-silk-u-boot.dtb
 
 dtb-$(CONFIG_RCAR_GEN3) += \
+   r8a774a1-beacon-rzg2m-kit.dtb \
r8a77950-ulcb-u-boot.dtb \
r8a77950-salvator-x-u-boot.dtb \
r8a77960-ulcb-u-boot.dtb \
diff --git a/arch/arm/dts/beacon-renesom-baseboard.dtsi 
b/arch/arm/dts/beacon-renesom-baseboard.dtsi
new file mode 100644
index 00..8a472c057a
--- /dev/null
+++ b/arch/arm/dts/beacon-renesom-baseboard.dtsi
@@ -0,0 +1,597 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2020, Compass Electronics Group, LLC
+ */
+
+#include 
+#include 
+
+/ {
+   aliases {
+   serial0 = 
+   serial1 = 
+   serial2 = 
+   serial3 = 
+   serial4 = 
+   serial5 = 
+   spi0 = 
+   spi1 = 
+   spi2 = 
+   spi3 = 
+   ethernet0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   power-supply = <_lcd>;
+   enable-gpios = <_exp1 3 GPIO_ACTIVE_HIGH>;
+   pwms = < 0 5>;
+   brightness-levels = <0 4 8 16 32 64 128 255>;
+   default-brightness-level = <6>;
+   };
+
+   hdmi0-out {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi0_con: endpoint {
+   remote-endpoint = <_dw_hdmi0_out>;
+   };
+   };
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   key-1 {
+   gpios = < 6 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   label = "Switch-1";
+   wakeup-source;
+   debounce-interval = <20>;
+   };
+   key-2 {
+   gpios = < 13 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   label = "Switch-2";
+   wakeup-source;
+   debounce-interval = <20>;
+   };
+   key-3 {
+   gpios = < 17 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   label = "Switch-3";
+   wakeup-source;
+   debounce-interval = <20>;
+   };
+   key-4 {
+   gpios = < 20 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   label = "Switch-4";
+   wakeup-source;
+   debounce-interval = <20>;
+   };
+   key-5 {
+   gpios = < 22 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   label = "Switch-4";
+   wakeup-source;
+   debounce-interval = <20>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   led0 {
+   gpios = < 4 GPIO_ACTIVE_HIGH>;
+   label = "LED0";
+   linux,default-trigger = "heartbeat";
+   };
+   led1 {
+   gpios = < 0 GPIO_ACTIVE_HIGH>;
+   label = "LED1";
+   linux,default-trigger = "heartbeat";
+   };
+   led2 {
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   label = "LED2";
+   linux,default-trigger = "heartbeat";
+   };
+   led3 {
+   gpios = < 3 GPIO_ACTIVE_HIGH>;
+   label = "LED3";
+   linux,default-trigger = "heartbeat";
+   };
+   };
+
+   reg_audio: regulator_audio {
+   compatible = "regulator-fixed";
+   regulator-name = "audio-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = <_exp2 7 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   reg_lcd: regulator-lcd {
+   

[PATCH V3 4/6] pinctrl: renesas: Enable R8A774A1 PFC tables

2020-06-30 Thread Adam Ford
The PFC tables for the R8A774A1 are already available, but they
not enabled.

This patch adds the Kconfig option and builds the corresponding file
when PINCTRL_PFC_R8A774A1 is enabled.

Signed-off-by: Adam Ford 
---
V3:  Reorder references to R8A774A1 to more closely match Linux's order
V2:  Use tables already build into pfc-r8a7796 instead of creating a new file
 Fix pfc references so the pinmuxer acutally gets loaded

diff --git a/drivers/pinctrl/renesas/Kconfig b/drivers/pinctrl/renesas/Kconfig
index 4d3d68d307..8327bcabd6 100644
--- a/drivers/pinctrl/renesas/Kconfig
+++ b/drivers/pinctrl/renesas/Kconfig
@@ -77,6 +77,16 @@ config PINCTRL_PFC_R8A7796
  the GPIO definitions and pin control functions for each available
  multiplex function.
 
+config PINCTRL_PFC_R8A774A1
+bool "Renesas RCar Gen3 R8A774A1 pin control driver"
+depends on PINCTRL_PFC
+help
+  Support pin multiplexing control on Renesas RZG2M R8A774A1 SoCs.
+
+  The driver is controlled by a device tree node which contains both
+  the GPIO definitions and pin control functions for each available
+  multiplex function.
+
 config PINCTRL_PFC_R8A77965
bool "Renesas RCar Gen3 R8A77965 pin control driver"
depends on PINCTRL_PFC
diff --git a/drivers/pinctrl/renesas/Makefile b/drivers/pinctrl/renesas/Makefile
index a92f787a89..a4eb912d54 100644
--- a/drivers/pinctrl/renesas/Makefile
+++ b/drivers/pinctrl/renesas/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_PINCTRL_PFC) += pfc.o
+obj-$(CONFIG_PINCTRL_PFC_R8A774A1) += pfc-r8a7796.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7790) += pfc-r8a7790.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7791) += pfc-r8a7791.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7792) += pfc-r8a7792.o
diff --git a/drivers/pinctrl/renesas/pfc.c b/drivers/pinctrl/renesas/pfc.c
index 1179afd2e7..7ba7849593 100644
--- a/drivers/pinctrl/renesas/pfc.c
+++ b/drivers/pinctrl/renesas/pfc.c
@@ -32,6 +32,7 @@ enum sh_pfc_model {
SH_PFC_R8A7794,
SH_PFC_R8A7795,
SH_PFC_R8A7796,
+   SH_PFC_R8A774A1,
SH_PFC_R8A77965,
SH_PFC_R8A77970,
SH_PFC_R8A77980,
@@ -853,6 +854,10 @@ static int sh_pfc_pinctrl_probe(struct udevice *dev)
if (model == SH_PFC_R8A7796)
priv->pfc.info = _pinmux_info;
 #endif
+#ifdef CONFIG_PINCTRL_PFC_R8A774A1
+   if (model == SH_PFC_R8A774A1)
+   priv->pfc.info = _pinmux_info;
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A77965
if (model == SH_PFC_R8A77965)
priv->pfc.info = _pinmux_info;
@@ -924,6 +929,12 @@ static const struct udevice_id sh_pfc_pinctrl_ids[] = {
.data = SH_PFC_R8A7796,
},
 #endif
+#ifdef CONFIG_PINCTRL_PFC_R8A774A1
+   {
+   .compatible = "renesas,pfc-r8a774a1",
+   .data = SH_PFC_R8A774A1,
+   },
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A77965
{
.compatible = "renesas,pfc-r8a77965",
diff --git a/drivers/pinctrl/renesas/sh_pfc.h b/drivers/pinctrl/renesas/sh_pfc.h
index db3d513358..81c0179948 100644
--- a/drivers/pinctrl/renesas/sh_pfc.h
+++ b/drivers/pinctrl/renesas/sh_pfc.h
@@ -293,6 +293,7 @@ const struct pinmux_bias_reg *
 sh_pfc_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin,
   unsigned int *bit);
 
+extern const struct sh_pfc_soc_info r8a774a1_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7792_pinmux_info;
-- 
2.25.1



[PATCH V3 0/6] Add Basic support for R8A774A1 (RZ/G2M)

2020-06-30 Thread Adam Ford
The R8A774A1 (RZ/G2M) a commercial SoC based off the automotive
R8A7796 SoC.

This series will start the foundation to support this SoC by importing
porting the device tree and bindings from Linux 5.8-rc2 along with clock
clock driver tables, enable pinctrl driver, and add generic 
rcar-gen3 support to the shdi driver.

Finally, it will add support for the Beacon EmbeddedWorks RZ/G2M dev kit

Adam Ford (6):
  ARM: renesas: Add basic R8A774A1 Support
  ARM: dts: r8a774a1: Import DTS from Linux 5.8-rc1
  clk: renesas: Add R8A774A1 clock tables
  pinctrl: renesas: Enable R8A774A1 PFC tables
  mmc: renesas-sdhi: Enable support for R8A774A1
  ARM: rmobile: Add Beacon EmbeddedWorks RZG2M Dev Kit

 arch/arm/dts/Makefile |1 +
 arch/arm/dts/beacon-renesom-baseboard.dtsi|  597 
 arch/arm/dts/beacon-renesom-som.dtsi  |  312 ++
 .../dts/r8a774a1-beacon-rzg2m-kit-u-boot.dtsi |   34 +
 arch/arm/dts/r8a774a1-beacon-rzg2m-kit.dts|   15 +
 arch/arm/dts/r8a774a1.dtsi| 2787 +
 arch/arm/mach-rmobile/Kconfig.64  |9 +
 board/beacon/beacon-rzg2m/Kconfig |   15 +
 board/beacon/beacon-rzg2m/MAINTAINERS |6 +
 board/beacon/beacon-rzg2m/Makefile|9 +
 board/beacon/beacon-rzg2m/beacon-rzg2m.c  |   52 +
 configs/r8a774a1_beacon_defconfig |   65 +
 drivers/clk/renesas/Kconfig   |7 +
 drivers/clk/renesas/Makefile  |1 +
 drivers/clk/renesas/r8a774a1-cpg-mssr.c   |  339 ++
 drivers/clk/renesas/rcar-gen3-cpg.h   |2 +
 drivers/mmc/renesas-sdhi.c|2 +-
 drivers/pinctrl/renesas/Kconfig   |   10 +
 drivers/pinctrl/renesas/Makefile  |1 +
 drivers/pinctrl/renesas/pfc.c |   11 +
 drivers/pinctrl/renesas/sh_pfc.h  |1 +
 include/configs/beacon-rzg2m.h|   97 +
 include/dt-bindings/clock/r8a774a1-cpg-mssr.h |   65 +
 include/dt-bindings/power/r8a774a1-sysc.h |   33 +
 24 files changed, 4470 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/beacon-renesom-baseboard.dtsi
 create mode 100644 arch/arm/dts/beacon-renesom-som.dtsi
 create mode 100644 arch/arm/dts/r8a774a1-beacon-rzg2m-kit-u-boot.dtsi
 create mode 100644 arch/arm/dts/r8a774a1-beacon-rzg2m-kit.dts
 create mode 100644 arch/arm/dts/r8a774a1.dtsi
 create mode 100644 board/beacon/beacon-rzg2m/Kconfig
 create mode 100644 board/beacon/beacon-rzg2m/MAINTAINERS
 create mode 100644 board/beacon/beacon-rzg2m/Makefile
 create mode 100644 board/beacon/beacon-rzg2m/beacon-rzg2m.c
 create mode 100644 configs/r8a774a1_beacon_defconfig
 create mode 100644 drivers/clk/renesas/r8a774a1-cpg-mssr.c
 create mode 100644 include/configs/beacon-rzg2m.h
 create mode 100644 include/dt-bindings/clock/r8a774a1-cpg-mssr.h
 create mode 100644 include/dt-bindings/power/r8a774a1-sysc.h

-- 
2.25.1



[PATCH V3 5/6] mmc: renesas-sdhi: Enable support for R8A774A1

2020-06-30 Thread Adam Ford
The r8a774a1 is compatible with the generic rcar-gen3-sdhi controller.
This patch adds the compatibilty flag, to support the SDHI controller.

Signed-off-by: Adam Ford 
---
V3:  Use generic rcar-gen3-sdhi reference instead of SoC reference
V2:  No Change

diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
index d6ea99d2ce..d80b3fc28f 100644
--- a/drivers/mmc/renesas-sdhi.c
+++ b/drivers/mmc/renesas-sdhi.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-
 #include "tmio-common.h"
 
 #if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
@@ -843,6 +842,7 @@ static const struct udevice_id renesas_sdhi_match[] = {
{ .compatible = "renesas,sdhi-r8a7794", .data = RENESAS_GEN2_QUIRKS },
{ .compatible = "renesas,sdhi-r8a7795", .data = RENESAS_GEN3_QUIRKS },
{ .compatible = "renesas,sdhi-r8a7796", .data = RENESAS_GEN3_QUIRKS },
+   { .compatible = "renesas,rcar-gen3-sdhi", .data = RENESAS_GEN3_QUIRKS },
{ .compatible = "renesas,sdhi-r8a77965", .data = RENESAS_GEN3_QUIRKS },
{ .compatible = "renesas,sdhi-r8a77970", .data = RENESAS_GEN3_QUIRKS },
{ .compatible = "renesas,sdhi-r8a77990", .data = RENESAS_GEN3_QUIRKS },
-- 
2.25.1



[PATCH V3 2/6] ARM: dts: r8a774a1: Import DTS from Linux 5.8-rc1

2020-06-30 Thread Adam Ford
This patch imports the device tree and required bindings to permit
the device tree to build for the R8Z774A1 (RZ/G2M).

Signed-off-by: Adam Ford 
---
V3:  No change
V2:  No change

diff --git a/arch/arm/dts/r8a774a1.dtsi b/arch/arm/dts/r8a774a1.dtsi
new file mode 100644
index 00..a603d94797
--- /dev/null
+++ b/arch/arm/dts/r8a774a1.dtsi
@@ -0,0 +1,2787 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the r8a774a1 SoC
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "renesas,r8a774a1";
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   aliases {
+   i2c0 = 
+   i2c1 = 
+   i2c2 = 
+   i2c3 = 
+   i2c4 = 
+   i2c5 = 
+   i2c6 = 
+   i2c7 = _dvfs;
+   };
+
+   /*
+* The external audio clocks are configured as 0 Hz fixed frequency
+* clocks by default.
+* Boards that provide audio clocks should override them.
+*/
+   audio_clk_a: audio_clk_a {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   audio_clk_b: audio_clk_b {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   audio_clk_c: audio_clk_c {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   /* External CAN clock - to be overridden by boards that provide it */
+   can_clk: can {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   cluster0_opp: opp_table0 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp-5 {
+   opp-hz = /bits/ 64 <5>;
+   opp-microvolt = <82>;
+   clock-latency-ns = <30>;
+   };
+   opp-10 {
+   opp-hz = /bits/ 64 <10>;
+   opp-microvolt = <82>;
+   clock-latency-ns = <30>;
+   };
+   opp-15 {
+   opp-hz = /bits/ 64 <15>;
+   opp-microvolt = <82>;
+   clock-latency-ns = <30>;
+   };
+   };
+
+   cluster1_opp: opp_table1 {
+   compatible = "operating-points-v2";
+   opp-shared;
+
+   opp-8 {
+   opp-hz = /bits/ 64 <8>;
+   opp-microvolt = <82>;
+   clock-latency-ns = <30>;
+   };
+   opp-10 {
+   opp-hz = /bits/ 64 <10>;
+   opp-microvolt = <82>;
+   clock-latency-ns = <30>;
+   };
+   opp-12 {
+   opp-hz = /bits/ 64 <12>;
+   opp-microvolt = <82>;
+   clock-latency-ns = <30>;
+   };
+   };
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu-map {
+   cluster0 {
+   core0 {
+   cpu = <_0>;
+   };
+   core1 {
+   cpu = <_1>;
+   };
+   };
+
+   cluster1 {
+   core0 {
+   cpu = <_0>;
+   };
+   core1 {
+   cpu = <_1>;
+   };
+   core2 {
+   cpu = <_2>;
+   };
+   core3 {
+   cpu = <_3>;
+   };
+   };
+   };
+
+   a57_0: cpu@0 {
+   compatible = "arm,cortex-a57";
+   reg = <0x0>;
+   device_type = "cpu";
+   power-domains = < R8A774A1_PD_CA57_CPU0>;
+   next-level-cache = <_CA57>;
+   enable-method = "psci";
+   dynamic-power-coefficient = <854>;
+   clocks = < CPG_CORE R8A774A1_CLK_Z>;
+   operating-points-v2 = <_opp>;
+   capacity-dmips-mhz = <1024>;
+   #cooling-cells = <2>;
+   };

[PATCH V3 3/6] clk: renesas: Add R8A774A1 clock tables

2020-06-30 Thread Adam Ford
This sync's the clock tables with the official release from
Linux 5.8-RC2 and update r8a774a1_mstp_table from Ref Manual
v1.00.

Signed-off-by: Adam Ford 
---
V3:  Use clock tables from Linux instead of Renesas' U-Boot repo
 Fix the r8a774a1_mstp_table to match ref manual v1.00
V2:  No Change

diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig
index e78817829b..284e2138b3 100644
--- a/drivers/clk/renesas/Kconfig
+++ b/drivers/clk/renesas/Kconfig
@@ -48,6 +48,13 @@ config CLK_RCAR_GEN3
help
  Enable this to support the clocks on Renesas RCar Gen3 SoC.
 
+config CLK_R8A774A1
+bool "Renesas R8A774A1 clock driver"
+def_bool y if R8A774A1
+depends on CLK_RCAR_GEN3
+help
+  Enable this to support the clocks on Renesas R8A774A1 SoC.
+
 config CLK_R8A7795
bool "Renesas R8A7795 clock driver"
depends on CLK_RCAR_GEN3
diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
index 88339e9d7e..dd599b757e 100644
--- a/drivers/clk/renesas/Makefile
+++ b/drivers/clk/renesas/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
+obj-$(CONFIG_CLK_R8A774A1) += r8a774a1-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7790) += r8a7790-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7791) += r8a7791-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7792) += r8a7792-cpg-mssr.o
diff --git a/drivers/clk/renesas/r8a774a1-cpg-mssr.c 
b/drivers/clk/renesas/r8a774a1-cpg-mssr.c
new file mode 100644
index 00..8935667736
--- /dev/null
+++ b/drivers/clk/renesas/r8a774a1-cpg-mssr.c
@@ -0,0 +1,339 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Renesas R8A774A1 CPG MSSR driver
+ *
+ * Copyright (C) 2017-2019 Marek Vasut 
+ *
+ * Based on the following driver from Linux kernel:
+ * r8a7796 Clock Pulse Generator / Module Standby and Software Reset
+ *
+ * Copyright (C) 2016 Glider bvba
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "renesas-cpg-mssr.h"
+#include "rcar-gen3-cpg.h"
+
+enum clk_ids {
+   /* Core Clock Outputs exported to DT */
+   LAST_DT_CORE_CLK = R8A774A1_CLK_CANFD,
+
+   /* External Input Clocks */
+   CLK_EXTAL,
+   CLK_EXTALR,
+
+   /* Internal Core Clocks */
+   CLK_MAIN,
+   CLK_PLL0,
+   CLK_PLL1,
+   CLK_PLL2,
+   CLK_PLL3,
+   CLK_PLL4,
+   CLK_PLL1_DIV2,
+   CLK_PLL1_DIV4,
+   CLK_S0,
+   CLK_S1,
+   CLK_S2,
+   CLK_S3,
+   CLK_SDSRC,
+   CLK_RINT,
+
+   /* Module Clocks */
+   MOD_CLK_BASE
+};
+
+static const struct cpg_core_clk r8a774a1_core_clks[] = {
+   /* External Clock Inputs */
+   DEF_INPUT("extal",  CLK_EXTAL),
+   DEF_INPUT("extalr", CLK_EXTALR),
+
+   /* Internal Core Clocks */
+   DEF_BASE(".main",   CLK_MAIN, CLK_TYPE_GEN3_MAIN, CLK_EXTAL),
+   DEF_BASE(".pll0",   CLK_PLL0, CLK_TYPE_GEN3_PLL0, CLK_MAIN),
+   DEF_BASE(".pll1",   CLK_PLL1, CLK_TYPE_GEN3_PLL1, CLK_MAIN),
+   DEF_BASE(".pll2",   CLK_PLL2, CLK_TYPE_GEN3_PLL2, CLK_MAIN),
+   DEF_BASE(".pll3",   CLK_PLL3, CLK_TYPE_GEN3_PLL3, CLK_MAIN),
+   DEF_BASE(".pll4",   CLK_PLL4, CLK_TYPE_GEN3_PLL4, CLK_MAIN),
+
+   DEF_FIXED(".pll1_div2", CLK_PLL1_DIV2, CLK_PLL1,   2, 1),
+   DEF_FIXED(".pll1_div4", CLK_PLL1_DIV4, CLK_PLL1_DIV2,  2, 1),
+   DEF_FIXED(".s0",CLK_S0,CLK_PLL1_DIV2,  2, 1),
+   DEF_FIXED(".s1",CLK_S1,CLK_PLL1_DIV2,  3, 1),
+   DEF_FIXED(".s2",CLK_S2,CLK_PLL1_DIV2,  4, 1),
+   DEF_FIXED(".s3",CLK_S3,CLK_PLL1_DIV2,  6, 1),
+   DEF_FIXED(".sdsrc", CLK_SDSRC, CLK_PLL1_DIV2,  2, 1),
+
+   DEF_GEN3_OSC(".r",  CLK_RINT,  CLK_EXTAL,  32),
+
+   /* Core Clock Outputs */
+   DEF_GEN3_Z("z", R8A774A1_CLK_Z, CLK_TYPE_GEN3_Z,  CLK_PLL0, 
2, 8),
+   DEF_GEN3_Z("z2",R8A774A1_CLK_Z2,CLK_TYPE_GEN3_Z,  CLK_PLL2, 
2, 0),
+   DEF_FIXED("ztr",R8A774A1_CLK_ZTR,   CLK_PLL1_DIV2,  6, 1),
+   DEF_FIXED("ztrd2",  R8A774A1_CLK_ZTRD2, CLK_PLL1_DIV2, 12, 1),
+   DEF_FIXED("zt", R8A774A1_CLK_ZT,CLK_PLL1_DIV2,  4, 1),
+   DEF_FIXED("zx", R8A774A1_CLK_ZX,CLK_PLL1_DIV2,  2, 1),
+   DEF_FIXED("s0d1",   R8A774A1_CLK_S0D1,  CLK_S0, 1, 1),
+   DEF_FIXED("s0d2",   R8A774A1_CLK_S0D2,  CLK_S0, 2, 1),
+   DEF_FIXED("s0d3",   R8A774A1_CLK_S0D3,  CLK_S0, 3, 1),
+   DEF_FIXED("s0d4",   R8A774A1_CLK_S0D4,  CLK_S0, 4, 1),
+   DEF_FIXED("s0d6",   R8A774A1_CLK_S0D6,  CLK_S0, 6, 1),
+   DEF_FIXED("s0d8",   R8A774A1_CLK_S0D8,  CLK_S0, 8, 1),
+   DEF_FIXED("s0d12",  R8A774A1_CLK_S0D12, CLK_S0,12, 1),
+   DEF_FIXED("s1d2",   R8A774A1_CLK_S1D2,  CLK_S1, 2, 1),
+   DEF_FIXED("s1d4",   R8A774A1_CLK_S1D4,  CLK_S1,   

[PATCH V3 1/6] ARM: renesas: Add basic R8A774A1 Support

2020-06-30 Thread Adam Ford
In order to build boards based on the R8A774A1, there needs to
be a config option from which to enable other drivers and/or flags
for this SoC.

Signed-off-by: Adam Ford 
---
V3:  No change
V2:  No change

diff --git a/arch/arm/mach-rmobile/Kconfig.64 b/arch/arm/mach-rmobile/Kconfig.64
index c8f93c68bb..bfd513a361 100644
--- a/arch/arm/mach-rmobile/Kconfig.64
+++ b/arch/arm/mach-rmobile/Kconfig.64
@@ -2,6 +2,9 @@ if RCAR_GEN3
 
 menu "Select Target SoC"
 
+config R8A774A1
+bool "Renesas SoC R8A774A1"
+
 config R8A7795
bool "Renesas SoC R8A7795"
imply CLK_R8A7795
-- 
2.25.1



Re: [PATCH v2 1/1] power: pmic_pca9450: fix PCA9450A I2C address

2020-06-30 Thread Fabio Estevam
On Tue, Jun 30, 2020 at 10:03 AM Sébastien Szymanski
 wrote:
>
> Quoting Ye Li from NXP:
>
> "We have confirmed with PMIC team, 0x35 is used only on early chips
> and not used any more. 0x25 is the final address."
>
> Fix it by merging power_pca9450a_init and power_pca9450b_init into one
> function power_pca9450_init.
>
> Signed-off-by: Sébastien Szymanski 

Reviewed-by: Fabio Estevam 


[PATCH v2 1/1] power: pmic_pca9450: fix PCA9450A I2C address

2020-06-30 Thread Sébastien Szymanski
Quoting Ye Li from NXP:

"We have confirmed with PMIC team, 0x35 is used only on early chips
and not used any more. 0x25 is the final address."

Fix it by merging power_pca9450a_init and power_pca9450b_init into one
function power_pca9450_init.

Signed-off-by: Sébastien Szymanski 
---

Changes for v2:
 * Quoting Ye Li
 * Merge both function into one as suggested by Ye Li

 board/freescale/imx8mp_evk/spl.c  |  2 +-
 drivers/power/pmic/pmic_pca9450.c | 21 +
 include/power/pca9450.h   |  3 +--
 3 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c
index 3b3a854e29..3214718e62 100644
--- a/board/freescale/imx8mp_evk/spl.c
+++ b/board/freescale/imx8mp_evk/spl.c
@@ -68,7 +68,7 @@ int power_init_board(void)
struct pmic *p;
int ret;
 
-   ret = power_pca9450b_init(I2C_PMIC);
+   ret = power_pca9450_init(I2C_PMIC);
if (ret)
printf("power init failed");
p = pmic_get("PCA9450");
diff --git a/drivers/power/pmic/pmic_pca9450.c 
b/drivers/power/pmic/pmic_pca9450.c
index 67a9090200..d4f27428bd 100644
--- a/drivers/power/pmic/pmic_pca9450.c
+++ b/drivers/power/pmic/pmic_pca9450.c
@@ -11,26 +11,7 @@
 
 static const char pca9450_name[] = "PCA9450";
 
-int power_pca9450a_init(unsigned char bus)
-{
-   struct pmic *p = pmic_alloc();
-
-   if (!p) {
-   printf("%s: POWER allocation error!\n", __func__);
-   return -ENOMEM;
-   }
-
-   p->name = pca9450_name;
-   p->interface = PMIC_I2C;
-   p->number_of_regs = PCA9450_REG_NUM;
-   p->hw.i2c.addr = 0x35;
-   p->hw.i2c.tx_num = 1;
-   p->bus = bus;
-
-   return 0;
-}
-
-int power_pca9450b_init(unsigned char bus)
+int power_pca9450_init(unsigned char bus)
 {
struct pmic *p = pmic_alloc();
 
diff --git a/include/power/pca9450.h b/include/power/pca9450.h
index 5d4f58ca44..5a9a697d62 100644
--- a/include/power/pca9450.h
+++ b/include/power/pca9450.h
@@ -54,7 +54,6 @@ enum {
PCA9450_REG_NUM,
 };
 
-int power_pca9450a_init(unsigned char bus);
-int power_pca9450b_init(unsigned char bus);
+int power_pca9450_init(unsigned char bus);
 
 #endif
-- 
2.26.2



Re: [PATCH v4 6/6] rockchip: make_fit_atf: add signature handling

2020-06-30 Thread Tom Rini
On Tue, Jun 30, 2020 at 02:46:51PM +0200, Heiko Stübner wrote:
> Hi Tom,
> 
> Am Dienstag, 30. Juni 2020, 14:36:40 CEST schrieb Tom Rini:
> > On Fri, Jun 19, 2020 at 12:45:50PM +0200, Heiko Stuebner wrote:
> > 
> > > From: Heiko Stuebner 
> > > 
> > > If the newly added fit-generator key-options are found, append needed
> > > signature nodes to all generated image blocks, so that they can get
> > > signed when mkimage later compiles the .itb from the generated .its.
> > > 
> > > Signed-off-by: Heiko Stuebner 
> > 
> > First, I want to echo what Simon said.  We need to move towards having
> > less ad-hoc scripts for these kind of final modifiers.
> 
> looking at Simon's binman series is on my todo list, so yes I do agree
> with you :-) .

OK, thanks.

> > > ---
> > >  arch/arm/mach-rockchip/make_fit_atf.py | 57 +-
> > >  1 file changed, 56 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
> > > b/arch/arm/mach-rockchip/make_fit_atf.py
> > > index d15c32b303..de7dc19d11 100755
> > > --- a/arch/arm/mach-rockchip/make_fit_atf.py
> > > +++ b/arch/arm/mach-rockchip/make_fit_atf.py
> > > @@ -14,6 +14,14 @@ import sys
> > >  import getopt
> > >  import logging
> > >  import struct
> > > +try:
> > > + # in python3 Cryptodome succeeds Crypto
> > > + import Cryptodome
> > > + from Cryptodome.PublicKey import RSA
> > > +except:
> > > + import Crypto
> > > + from Crypto.PublicKey import RSA
> > 
> > Is it that older python3 would support "Cryto" not "Cryptodome"  or
> > python2?  If the latter, we should just drop it.  We do however need to
> > document, and should try and be user friendly about catching the
> > failure, that we now need the pycrypto module installed.  Thanks!
> 
> python3 only seems to have Cryptodome, while python2 only seems to
> have Crypto. And with for example Debian's default python is still being
> python2 for a bit longer, I wanted to support both, especially as it it
> works like a drop-in replacement.

I don't _think_ we worry about running on distros where we can't say
/usr/bin/env python3 at this point so I'd rather not add more python2
compatibility code.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] board: amlogic: Add Odroid-N2 board support

2020-06-30 Thread Neil Armstrong
On 18/06/2020 16:40, Neil Armstrong wrote:
> From: Pascal Vizeli 
> 
> Add a proper Odroid-N2 board support to handle the Ethernet MAC
> address stored in the in-SoC eFuses.
> 
> Signed-off-by: Pascal Vizeli 
> Signed-off-by: Neil Armstrong 
> ---
>  board/amlogic/odroid-n2/MAINTAINERS |  7 +
>  board/amlogic/odroid-n2/Makefile|  6 
>  board/amlogic/odroid-n2/odroid-n2.c | 49 +
>  board/amlogic/w400/MAINTAINERS  |  2 --
>  configs/odroid-n2_defconfig |  2 +-
>  5 files changed, 63 insertions(+), 3 deletions(-)
>  create mode 100644 board/amlogic/odroid-n2/MAINTAINERS
>  create mode 100644 board/amlogic/odroid-n2/Makefile
>  create mode 100644 board/amlogic/odroid-n2/odroid-n2.c
> 
> diff --git a/board/amlogic/odroid-n2/MAINTAINERS 
> b/board/amlogic/odroid-n2/MAINTAINERS
> new file mode 100644
> index 00..5627e54058
> --- /dev/null
> +++ b/board/amlogic/odroid-n2/MAINTAINERS
> @@ -0,0 +1,7 @@
> +ODROID-N2
> +M:   Neil Armstrong 
> +S:   Maintained
> +L:   u-boot-amlo...@groups.io
> +F:   board/amlogic/odroid-n2/
> +F:   configs/odroid-n2_defconfig
> +F:   doc/board/amlogic/odroid-n2.rst
> diff --git a/board/amlogic/odroid-n2/Makefile 
> b/board/amlogic/odroid-n2/Makefile
> new file mode 100644
> index 00..68e4e2a828
> --- /dev/null
> +++ b/board/amlogic/odroid-n2/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# (C) Copyright 2020 BayLibre, SAS
> +# Author: Neil Armstrong 
> +
> +obj-y:= odroid-n2.o
> diff --git a/board/amlogic/odroid-n2/odroid-n2.c 
> b/board/amlogic/odroid-n2/odroid-n2.c
> new file mode 100644
> index 00..caf7fd6810
> --- /dev/null
> +++ b/board/amlogic/odroid-n2/odroid-n2.c
> @@ -0,0 +1,49 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2020 BayLibre, SAS
> + * Author: Neil Armstrong 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define EFUSE_MAC_OFFSET 20
> +#define EFUSE_MAC_SIZE   12
> +#define MAC_ADDR_LEN 6
> +
> +int misc_init_r(void)
> +{
> + u8 mac_addr[MAC_ADDR_LEN];
> + char efuse_mac_addr[EFUSE_MAC_SIZE], tmp[3];
> + ssize_t len;
> +
> + meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
> +
> + if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
> + len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
> +   efuse_mac_addr, EFUSE_MAC_SIZE);
> + if (len != EFUSE_MAC_SIZE)
> + return 0;
> +
> + /* MAC is stored in ASCII format, 1bytes = 2characters */
> + for (int i = 0; i < 6; i++) {
> + tmp[0] = efuse_mac_addr[i * 2];
> + tmp[1] = efuse_mac_addr[i * 2 + 1];
> + tmp[2] = '\0';
> + mac_addr[i] = simple_strtoul(tmp, NULL, 16);
> + }
> +
> + if (is_valid_ethaddr(mac_addr))
> + eth_env_set_enetaddr("ethaddr", mac_addr);
> + else
> + meson_generate_serial_ethaddr();
> + }
> +
> + return 0;
> +}
> diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
> index 5e837cfaef..a1b0ac8636 100644
> --- a/board/amlogic/w400/MAINTAINERS
> +++ b/board/amlogic/w400/MAINTAINERS
> @@ -5,8 +5,6 @@ L:u-boot-amlo...@groups.io
>  F:   board/amlogic/w400/
>  F:   configs/khadas-vim3_defconfig
>  F:   configs/khadas-vim3l_defconfig
> -F:   configs/odroid-n2_defconfig
>  F:   doc/board/amlogic/w400.rst
>  F:   doc/board/amlogic/khadas-vim3.rst
>  F:   doc/board/amlogic/khadas-vim3l.rst
> -F:   doc/board/amlogic/odroid-n2.rst
> diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
> index e0cc6e3729..063809416e 100644
> --- a/configs/odroid-n2_defconfig
> +++ b/configs/odroid-n2_defconfig
> @@ -1,5 +1,5 @@
>  CONFIG_ARM=y
> -CONFIG_SYS_BOARD="w400"
> +CONFIG_SYS_BOARD="odroid-n2"
>  CONFIG_ARCH_MESON=y
>  CONFIG_SYS_TEXT_BASE=0x0100
>  CONFIG_ENV_SIZE=0x2000
> 

Applied to u-boot-amlogic for U-Boot 2020.10

Neil


Re: [PATCH 0/2] u-boot support for ODROID-C4

2020-06-30 Thread Neil Armstrong
Hi,

On 30/06/2020 13:33, Anand Moon wrote:
> Hi Beniamino,
> 
> On Wed, 6 May 2020 at 01:53, Beniamino Galvani  wrote:
>>
>> Hi,
>>
>> these two patches add initial u-boot support for Hardkernel ODROID-C4.
>>
>> https://wiki.odroid.com/odroid-c4/odroid-c4
>>
>> Beniamino Galvani (2):
>>   arm: dts: import ODROID-C4 device tree
>>   boards: amlogic: add ODROID-C4 support
>>
> 
> Can you respin this patches, I would like to see these get merged in
> the current u-boot release
> 
> -Anand
> 

The Odroid-C4 could re-use the new Odroid-N2 board support I submitted at [1]

Anand, is the MAC address stored stored the same way on the C4 ?

Neil

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20200618144037.23392-1-narmstr...@baylibre.com/


Re: [PATCH v6 1/8] lib: rsa: distinguish between tpl and spl for CONFIG_RSA_VERIFY

2020-06-30 Thread Heinrich Schuchardt
On 6/30/20 2:49 PM, Heiko Stübner wrote:
> Am Donnerstag, 18. Juni 2020, 16:23:21 CEST schrieb Heiko Stuebner:
>> From: Heiko Stuebner 
>>
>> While the SPL may want to do signature checking this won't be
>> the case for TPL in all cases, as TPL is mostly used when the
>> amount of initial memory is not enough for a full SPL.
>>
>> So on a system where SPL uses DM but TPL does not we currently
>> end up with a TPL compile error of:
>>
>> lib/rsa/rsa-verify.c:48:25: error: dereferencing pointer to incomplete 
>> type ‘struct checksum_algo’
>>
>> To prevent that change the $(SPL_) to $(SPL_TPL_) to distinguish
>> between both. If someone really needs FIT signature checking in
>> TPL as well, a new TPL_RSA_VERIFY config symbol needs to be added.
>>
>> Signed-off-by: Heiko Stuebner 
>> Reviewed-by: Philipp Tomsich 
>
> with it looking like everybody is happy with the fixes series now,
> whom do I need to pester into picking it up? :-D

No pestering needed :) The series is assigned to Tom:

https://patchwork.ozlabs.org/project/uboot/list/?series=184291

Best regards

Heinrich

>
>
> Thanks
> Heiko
>
>
>> ---
>> changes in v5:
>> - drop change that belongs in patch 2/8
>> changes in v4:
>> - amound -> amount
>> - found another entry to handle
>> changes in v2:
>> - fix typo "distinguis(h)"
>>
>>  lib/rsa/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/rsa/Makefile b/lib/rsa/Makefile
>> index 14ed3cb401..c61ebfd79e 100644
>> --- a/lib/rsa/Makefile
>> +++ b/lib/rsa/Makefile
>> @@ -5,6 +5,6 @@
>>  # (C) Copyright 2000-2007
>>  # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
>>
>> -obj-$(CONFIG_$(SPL_)RSA_VERIFY) += rsa-verify.o rsa-checksum.o
>> +obj-$(CONFIG_$(SPL_TPL_)RSA_VERIFY) += rsa-verify.o rsa-checksum.o
>>  obj-$(CONFIG_RSA_VERIFY_WITH_PKEY) += rsa-keyprop.o
>>  obj-$(CONFIG_RSA_SOFTWARE_EXP) += rsa-mod-exp.o
>>
>
>
>
>



Re: [PULL] u-boot-mips

2020-06-30 Thread Tom Rini
On Mon, Jun 29, 2020 at 08:05:15PM -0400, Tom Rini wrote:
> On Tue, Jun 30, 2020 at 01:10:53AM +0200, Daniel Schwierzeck wrote:
> 
> > Hi Tom,
> > 
> > actually I wanted to send this much earlier but I hope it's still okay.
> > 
> > This enables Qemu tests for the MIPS Malta board in all variants (32/64 bit,
> > big/little endian) in Gitlab CI, Travis CI and Azure Pipelines. This allows
> > to deprecate the qemu_mips board in the future because there is no Linux 
> > support
> > anymore for ages and Qemu deprecated the generic MIPS board as well in 
> > favour of
> > Malta.
> > 
> > I had to include the PCNET patches because otherwise the Malta 64bit targets
> > had stability issues in the Qemu network test case. Thus it's not just 
> > cleanup
> > and DM conversion, but also bugfixing ;)
> > 
> > https://gitlab.denx.de/u-boot/custodians/u-boot-mips/pipelines/3824
> > https://travis-ci.org/github/danielschwierzeck/u-boot/builds/703302746
> > https://dev.azure.com/danielschwierzeck/u-boot/_build/results?buildId=8=results
> 
> Is it OK for this to go in to -next at this point?  Thanks!

I do see that at this time you're the only user of the PCNET driver, so
if you're happy and really want it in this release and not the next
release, OK.  But v2020.07 is scheduled for next Monday too so this
really is quite late.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v6 1/8] lib: rsa: distinguish between tpl and spl for CONFIG_RSA_VERIFY

2020-06-30 Thread Heiko Stübner
Am Donnerstag, 18. Juni 2020, 16:23:21 CEST schrieb Heiko Stuebner:
> From: Heiko Stuebner 
> 
> While the SPL may want to do signature checking this won't be
> the case for TPL in all cases, as TPL is mostly used when the
> amount of initial memory is not enough for a full SPL.
> 
> So on a system where SPL uses DM but TPL does not we currently
> end up with a TPL compile error of:
> 
> lib/rsa/rsa-verify.c:48:25: error: dereferencing pointer to incomplete 
> type ‘struct checksum_algo’
> 
> To prevent that change the $(SPL_) to $(SPL_TPL_) to distinguish
> between both. If someone really needs FIT signature checking in
> TPL as well, a new TPL_RSA_VERIFY config symbol needs to be added.
> 
> Signed-off-by: Heiko Stuebner 
> Reviewed-by: Philipp Tomsich 

with it looking like everybody is happy with the fixes series now,
whom do I need to pester into picking it up? :-D


Thanks
Heiko


> ---
> changes in v5:
> - drop change that belongs in patch 2/8
> changes in v4:
> - amound -> amount
> - found another entry to handle
> changes in v2:
> - fix typo "distinguis(h)"
> 
>  lib/rsa/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/rsa/Makefile b/lib/rsa/Makefile
> index 14ed3cb401..c61ebfd79e 100644
> --- a/lib/rsa/Makefile
> +++ b/lib/rsa/Makefile
> @@ -5,6 +5,6 @@
>  # (C) Copyright 2000-2007
>  # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
>  
> -obj-$(CONFIG_$(SPL_)RSA_VERIFY) += rsa-verify.o rsa-checksum.o
> +obj-$(CONFIG_$(SPL_TPL_)RSA_VERIFY) += rsa-verify.o rsa-checksum.o
>  obj-$(CONFIG_RSA_VERIFY_WITH_PKEY) += rsa-keyprop.o
>  obj-$(CONFIG_RSA_SOFTWARE_EXP) += rsa-mod-exp.o
> 






Re: [PATCH v4 6/6] rockchip: make_fit_atf: add signature handling

2020-06-30 Thread Heiko Stübner
Hi Tom,

Am Dienstag, 30. Juni 2020, 14:36:40 CEST schrieb Tom Rini:
> On Fri, Jun 19, 2020 at 12:45:50PM +0200, Heiko Stuebner wrote:
> 
> > From: Heiko Stuebner 
> > 
> > If the newly added fit-generator key-options are found, append needed
> > signature nodes to all generated image blocks, so that they can get
> > signed when mkimage later compiles the .itb from the generated .its.
> > 
> > Signed-off-by: Heiko Stuebner 
> 
> First, I want to echo what Simon said.  We need to move towards having
> less ad-hoc scripts for these kind of final modifiers.

looking at Simon's binman series is on my todo list, so yes I do agree
with you :-) .

> > ---
> >  arch/arm/mach-rockchip/make_fit_atf.py | 57 +-
> >  1 file changed, 56 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
> > b/arch/arm/mach-rockchip/make_fit_atf.py
> > index d15c32b303..de7dc19d11 100755
> > --- a/arch/arm/mach-rockchip/make_fit_atf.py
> > +++ b/arch/arm/mach-rockchip/make_fit_atf.py
> > @@ -14,6 +14,14 @@ import sys
> >  import getopt
> >  import logging
> >  import struct
> > +try:
> > +   # in python3 Cryptodome succeeds Crypto
> > +   import Cryptodome
> > +   from Cryptodome.PublicKey import RSA
> > +except:
> > +   import Crypto
> > +   from Crypto.PublicKey import RSA
> 
> Is it that older python3 would support "Cryto" not "Cryptodome"  or
> python2?  If the latter, we should just drop it.  We do however need to
> document, and should try and be user friendly about catching the
> failure, that we now need the pycrypto module installed.  Thanks!

python3 only seems to have Cryptodome, while python2 only seems to
have Crypto. And with for example Debian's default python is still being
python2 for a bit longer, I wanted to support both, especially as it it
works like a drop-in replacement.

Heiko





Re: [PATCH 1/8] dm: soc: Introduce UCLASS_SOC for SOC ID and attribute matching

2020-06-30 Thread Tom Rini
On Mon, Jun 29, 2020 at 11:38:46PM -0500, Dave Gerlach wrote:

> Introduce UCLASS_SOC to be used for SOC identification and attribute
> matching based on the SoC ID info. This allows drivers to be provided
> for SoCs to retrieve SoC identifying information and also for matching
> device attributes for selecting SoC specific data.
> 
> This is useful for other device drivers that may need different
> parameters or quirks enabled depending on the specific device variant in
> use.
> 
> Signed-off-by: Dave Gerlach 
> ---
>  drivers/soc/Kconfig  |   9 +++
>  drivers/soc/Makefile |   1 +
>  drivers/soc/soc-uclass.c | 102 ++
>  include/dm/uclass-id.h   |   1 +
>  include/soc.h| 132 +++
>  5 files changed, 245 insertions(+)
>  create mode 100644 drivers/soc/soc-uclass.c
>  create mode 100644 include/soc.h

Can we please get a write-up in doc/driver-model/ as well for this?
Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 6/6] rockchip: make_fit_atf: add signature handling

2020-06-30 Thread Tom Rini
On Fri, Jun 19, 2020 at 12:45:50PM +0200, Heiko Stuebner wrote:

> From: Heiko Stuebner 
> 
> If the newly added fit-generator key-options are found, append needed
> signature nodes to all generated image blocks, so that they can get
> signed when mkimage later compiles the .itb from the generated .its.
> 
> Signed-off-by: Heiko Stuebner 

First, I want to echo what Simon said.  We need to move towards having
less ad-hoc scripts for these kind of final modifiers.

> ---
>  arch/arm/mach-rockchip/make_fit_atf.py | 57 +-
>  1 file changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
> b/arch/arm/mach-rockchip/make_fit_atf.py
> index d15c32b303..de7dc19d11 100755
> --- a/arch/arm/mach-rockchip/make_fit_atf.py
> +++ b/arch/arm/mach-rockchip/make_fit_atf.py
> @@ -14,6 +14,14 @@ import sys
>  import getopt
>  import logging
>  import struct
> +try:
> + # in python3 Cryptodome succeeds Crypto
> + import Cryptodome
> + from Cryptodome.PublicKey import RSA
> +except:
> + import Crypto
> + from Crypto.PublicKey import RSA

Is it that older python3 would support "Cryto" not "Cryptodome"  or
python2?  If the latter, we should just drop it.  We do however need to
document, and should try and be user friendly about catching the
failure, that we now need the pycrypto module installed.  Thanks!

-- 
Tom


signature.asc
Description: PGP signature


  1   2   >