public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM
@ 2016-02-18 16:01 Michal Simek
  2016-02-18 16:01 ` [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default Michal Simek
  2016-02-19 20:55 ` [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Simon Glass
  0 siblings, 2 replies; 8+ messages in thread
From: Michal Simek @ 2016-02-18 16:01 UTC (permalink / raw)
  To: u-boot

Enabling this driver requires some DT changes.
Adding DCC to root or main bus:
dcc: dcc {
	compatible = "arm,dcc";
	u-boot,dm-pre-reloc;
};

Extend alias list to link DCC:
	serial0 = &uart0;
	serial1 = &uart1;
	serial2 = &dcc;

Change stdout-path to point to dcc port.
	stdout-path = "serial2:115200n8";

Also add support for debug uart to help with early debug.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/serial/Kconfig   |  5 ++++
 drivers/serial/arm_dcc.c | 63 +++++++++++++++++++++++++++++-------------------
 2 files changed, 43 insertions(+), 25 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index fac317610e2a..7c18a6218b1f 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -119,6 +119,11 @@ config DEBUG_UART_UARTLITE
 	  You will need to provide parameters to make this work. The driver will
 	  be available until the real driver-model serial is running.
 
+config DEBUG_UART_ARM_DCC
+	bool "ARM DCC"
+	help
+	  Select this to enable a debug UART using the ARM DCC port.
+
 config DEBUG_UART_ZYNQ
 	bool "Xilinx Zynq"
 	help
diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
index 4624666e8a2c..07981e18ee49 100644
--- a/drivers/serial/arm_dcc.c
+++ b/drivers/serial/arm_dcc.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004-2007 ARM Limited.
  * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ * Copyright (C) 2015 - 2016 Xilinx, Inc, Michal Simek
  *
  * SPDX-License-Identifier:	GPL-2.0
  *
@@ -16,6 +17,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <serial.h>
 
 #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7)
@@ -94,12 +96,7 @@
 
 #define TIMEOUT_COUNT 0x4000000
 
-static int arm_dcc_init(void)
-{
-	return 0;
-}
-
-static int arm_dcc_getc(void)
+static int arm_dcc_getc(struct udevice *dev)
 {
 	int ch;
 	register unsigned int reg;
@@ -112,7 +109,7 @@ static int arm_dcc_getc(void)
 	return ch;
 }
 
-static void arm_dcc_putc(char ch)
+static int arm_dcc_putc(struct udevice *dev, char ch)
 {
 	register unsigned int reg;
 	unsigned int timeout_count = TIMEOUT_COUNT;
@@ -123,41 +120,57 @@ static void arm_dcc_putc(char ch)
 			break;
 	}
 	if (timeout_count == 0)
-		return;
+		return -EAGAIN;
 	else
 		write_dcc(ch);
+
+	return 0;
 }
 
-static int arm_dcc_tstc(void)
+static int arm_dcc_pending(struct udevice *dev, bool input)
 {
 	register unsigned int reg;
 
-	can_read_dcc(reg);
+	if (input) {
+		can_read_dcc(reg);
+	} else {
+		can_write_dcc(reg);
+	}
 
 	return reg;
 }
 
-static void arm_dcc_setbrg(void)
-{
-}
+static const struct dm_serial_ops arm_dcc_ops = {
+	.putc = arm_dcc_putc,
+	.pending = arm_dcc_pending,
+	.getc = arm_dcc_getc,
+};
+
+static const struct udevice_id arm_dcc_ids[] = {
+	{ .compatible = "arm,dcc", },
+	{ }
+};
 
-static struct serial_device arm_dcc_drv = {
+U_BOOT_DRIVER(serial_dcc) = {
 	.name	= "arm_dcc",
-	.start	= arm_dcc_init,
-	.stop	= NULL,
-	.setbrg	= arm_dcc_setbrg,
-	.putc	= arm_dcc_putc,
-	.puts	= default_serial_puts,
-	.getc	= arm_dcc_getc,
-	.tstc	= arm_dcc_tstc,
+	.id	= UCLASS_SERIAL,
+	.of_match = arm_dcc_ids,
+	.ops	= &arm_dcc_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };
 
-void arm_dcc_initialize(void)
+#ifdef CONFIG_DEBUG_UART_ARM_DCC
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
 {
-	serial_register(&arm_dcc_drv);
 }
 
-__weak struct serial_device *default_serial_console(void)
+static inline void _debug_uart_putc(int ch)
 {
-	return &arm_dcc_drv;
+	arm_dcc_putc(NULL, ch);
 }
+
+DEBUG_UART_FUNCS
+#endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default
  2016-02-18 16:01 [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Michal Simek
@ 2016-02-18 16:01 ` Michal Simek
  2016-02-19 20:55   ` Simon Glass
  2016-02-19 20:55 ` [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Simon Glass
  1 sibling, 1 reply; 8+ messages in thread
From: Michal Simek @ 2016-02-18 16:01 UTC (permalink / raw)
  To: u-boot

Compile DCC serial driver by default.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 include/configs/xilinx_zynqmp.h | 9 +++------
 include/configs/zynq-common.h   | 8 ++------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index 28622dec1882..8a9ad03cb102 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -53,12 +53,9 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x2000000)
 
 /* Serial setup */
-#if defined(CONFIG_ZYNQMP_DCC)
-# define CONFIG_ARM_DCC
-# define CONFIG_CPU_ARMV8
-#else
-# define CONFIG_ZYNQ_SERIAL
-#endif
+#define CONFIG_ARM_DCC
+#define CONFIG_CPU_ARMV8
+#define CONFIG_ZYNQ_SERIAL
 
 #define CONFIG_CONS_INDEX		0
 #define CONFIG_BAUDRATE			115200
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index e8c3ef0c3872..ec4884878165 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -36,12 +36,8 @@
 #define CONFIG_SYS_BAUDRATE_TABLE  \
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
 
-/* DCC driver */
-#if defined(CONFIG_ZYNQ_DCC)
-# define CONFIG_ARM_DCC
-#else
-# define CONFIG_ZYNQ_SERIAL
-#endif
+#define CONFIG_ARM_DCC
+#define CONFIG_ZYNQ_SERIAL
 
 #define CONFIG_ZYNQ_GPIO
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM
  2016-02-18 16:01 [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Michal Simek
  2016-02-18 16:01 ` [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default Michal Simek
@ 2016-02-19 20:55 ` Simon Glass
  2016-02-22 15:54   ` Michal Simek
  1 sibling, 1 reply; 8+ messages in thread
From: Simon Glass @ 2016-02-19 20:55 UTC (permalink / raw)
  To: u-boot

Hi Michal,

On 18 February 2016 at 09:01, Michal Simek <michal.simek@xilinx.com> wrote:
> Enabling this driver requires some DT changes.
> Adding DCC to root or main bus:
> dcc: dcc {
>         compatible = "arm,dcc";
>         u-boot,dm-pre-reloc;
> };
>
> Extend alias list to link DCC:
>         serial0 = &uart0;
>         serial1 = &uart1;
>         serial2 = &dcc;
>
> Change stdout-path to point to dcc port.
>         stdout-path = "serial2:115200n8";
>
> Also add support for debug uart to help with early debug.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/serial/Kconfig   |  5 ++++
>  drivers/serial/arm_dcc.c | 63 +++++++++++++++++++++++++++++-------------------
>  2 files changed, 43 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index fac317610e2a..7c18a6218b1f 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -119,6 +119,11 @@ config DEBUG_UART_UARTLITE
>           You will need to provide parameters to make this work. The driver will
>           be available until the real driver-model serial is running.
>
> +config DEBUG_UART_ARM_DCC
> +       bool "ARM DCC"
> +       help
> +         Select this to enable a debug UART using the ARM DCC port.

Can you please expand this - what is DCC? What parts support it? What is it for?

> +
>  config DEBUG_UART_ZYNQ
>         bool "Xilinx Zynq"
>         help
> diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
> index 4624666e8a2c..07981e18ee49 100644
> --- a/drivers/serial/arm_dcc.c
> +++ b/drivers/serial/arm_dcc.c
> @@ -1,6 +1,7 @@
>  /*
>   * Copyright (C) 2004-2007 ARM Limited.
>   * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> + * Copyright (C) 2015 - 2016 Xilinx, Inc, Michal Simek
>   *
>   * SPDX-License-Identifier:    GPL-2.0
>   *
> @@ -16,6 +17,7 @@
>   */
>
>  #include <common.h>
> +#include <dm.h>
>  #include <serial.h>
>
>  #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7)
> @@ -94,12 +96,7 @@
>
>  #define TIMEOUT_COUNT 0x4000000
>
> -static int arm_dcc_init(void)
> -{
> -       return 0;
> -}
> -
> -static int arm_dcc_getc(void)
> +static int arm_dcc_getc(struct udevice *dev)
>  {
>         int ch;
>         register unsigned int reg;
> @@ -112,7 +109,7 @@ static int arm_dcc_getc(void)
>         return ch;
>  }
>
> -static void arm_dcc_putc(char ch)
> +static int arm_dcc_putc(struct udevice *dev, char ch)
>  {
>         register unsigned int reg;
>         unsigned int timeout_count = TIMEOUT_COUNT;
> @@ -123,41 +120,57 @@ static void arm_dcc_putc(char ch)
>                         break;
>         }
>         if (timeout_count == 0)
> -               return;
> +               return -EAGAIN;
>         else
>                 write_dcc(ch);
> +
> +       return 0;
>  }
>
> -static int arm_dcc_tstc(void)
> +static int arm_dcc_pending(struct udevice *dev, bool input)
>  {
>         register unsigned int reg;
>
> -       can_read_dcc(reg);
> +       if (input) {

Don't need the {} here

> +               can_read_dcc(reg);
> +       } else {
> +               can_write_dcc(reg);
> +       }
>
>         return reg;
>  }
>
> -static void arm_dcc_setbrg(void)
> -{
> -}
> +static const struct dm_serial_ops arm_dcc_ops = {
> +       .putc = arm_dcc_putc,
> +       .pending = arm_dcc_pending,
> +       .getc = arm_dcc_getc,
> +};
> +
> +static const struct udevice_id arm_dcc_ids[] = {
> +       { .compatible = "arm,dcc", },
> +       { }
> +};
>
> -static struct serial_device arm_dcc_drv = {
> +U_BOOT_DRIVER(serial_dcc) = {
>         .name   = "arm_dcc",
> -       .start  = arm_dcc_init,
> -       .stop   = NULL,
> -       .setbrg = arm_dcc_setbrg,
> -       .putc   = arm_dcc_putc,
> -       .puts   = default_serial_puts,
> -       .getc   = arm_dcc_getc,
> -       .tstc   = arm_dcc_tstc,
> +       .id     = UCLASS_SERIAL,
> +       .of_match = arm_dcc_ids,
> +       .ops    = &arm_dcc_ops,
> +       .flags = DM_FLAG_PRE_RELOC,
>  };
>
> -void arm_dcc_initialize(void)
> +#ifdef CONFIG_DEBUG_UART_ARM_DCC
> +
> +#include <debug_uart.h>
> +
> +static inline void _debug_uart_init(void)
>  {
> -       serial_register(&arm_dcc_drv);
>  }
>
> -__weak struct serial_device *default_serial_console(void)
> +static inline void _debug_uart_putc(int ch)
>  {
> -       return &arm_dcc_drv;
> +       arm_dcc_putc(NULL, ch);
>  }
> +
> +DEBUG_UART_FUNCS
> +#endif
> --
> 1.9.1
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default
  2016-02-18 16:01 ` [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default Michal Simek
@ 2016-02-19 20:55   ` Simon Glass
  2016-02-22 15:28     ` Michal Simek
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2016-02-19 20:55 UTC (permalink / raw)
  To: u-boot

Hi Michal,

On 18 February 2016 at 09:01, Michal Simek <michal.simek@xilinx.com> wrote:
> Compile DCC serial driver by default.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  include/configs/xilinx_zynqmp.h | 9 +++------
>  include/configs/zynq-common.h   | 8 ++------
>  2 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
> index 28622dec1882..8a9ad03cb102 100644
> --- a/include/configs/xilinx_zynqmp.h
> +++ b/include/configs/xilinx_zynqmp.h
> @@ -53,12 +53,9 @@
>  #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 0x2000000)
>
>  /* Serial setup */
> -#if defined(CONFIG_ZYNQMP_DCC)
> -# define CONFIG_ARM_DCC
> -# define CONFIG_CPU_ARMV8
> -#else
> -# define CONFIG_ZYNQ_SERIAL
> -#endif
> +#define CONFIG_ARM_DCC
> +#define CONFIG_CPU_ARMV8
> +#define CONFIG_ZYNQ_SERIAL

Can some of these go in either the board _defconfig files or as a
'default y' in Zynq's Kconfig?

>
>  #define CONFIG_CONS_INDEX              0
>  #define CONFIG_BAUDRATE                        115200
> diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
> index e8c3ef0c3872..ec4884878165 100644
> --- a/include/configs/zynq-common.h
> +++ b/include/configs/zynq-common.h
> @@ -36,12 +36,8 @@
>  #define CONFIG_SYS_BAUDRATE_TABLE  \
>         {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
>
> -/* DCC driver */
> -#if defined(CONFIG_ZYNQ_DCC)
> -# define CONFIG_ARM_DCC
> -#else
> -# define CONFIG_ZYNQ_SERIAL
> -#endif
> +#define CONFIG_ARM_DCC
> +#define CONFIG_ZYNQ_SERIAL
>
>  #define CONFIG_ZYNQ_GPIO
>
> --
> 1.9.1
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default
  2016-02-19 20:55   ` Simon Glass
@ 2016-02-22 15:28     ` Michal Simek
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2016-02-22 15:28 UTC (permalink / raw)
  To: u-boot

On 19.2.2016 21:55, Simon Glass wrote:
> Hi Michal,
> 
> On 18 February 2016 at 09:01, Michal Simek <michal.simek@xilinx.com> wrote:
>> Compile DCC serial driver by default.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  include/configs/xilinx_zynqmp.h | 9 +++------
>>  include/configs/zynq-common.h   | 8 ++------
>>  2 files changed, 5 insertions(+), 12 deletions(-)
>>
>> diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
>> index 28622dec1882..8a9ad03cb102 100644
>> --- a/include/configs/xilinx_zynqmp.h
>> +++ b/include/configs/xilinx_zynqmp.h
>> @@ -53,12 +53,9 @@
>>  #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 0x2000000)
>>
>>  /* Serial setup */
>> -#if defined(CONFIG_ZYNQMP_DCC)
>> -# define CONFIG_ARM_DCC
>> -# define CONFIG_CPU_ARMV8
>> -#else
>> -# define CONFIG_ZYNQ_SERIAL
>> -#endif
>> +#define CONFIG_ARM_DCC
>> +#define CONFIG_CPU_ARMV8
>> +#define CONFIG_ZYNQ_SERIAL
> 
> Can some of these go in either the board _defconfig files or as a
> 'default y' in Zynq's Kconfig?

They will go to defconfig for sure. I wanted to clear this here first.
There will be patches about DT binding and Kconfig entries.
I need to review all drivers which were moved to DM and config cleanups
will be the part of it. Also with adding more boards for ZynqMP and
cleanup existing zynq one.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM
  2016-02-19 20:55 ` [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Simon Glass
@ 2016-02-22 15:54   ` Michal Simek
  2016-02-23  6:38     ` Simon Glass
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Simek @ 2016-02-22 15:54 UTC (permalink / raw)
  To: u-boot

On 19.2.2016 21:55, Simon Glass wrote:
> Hi Michal,
> 
> On 18 February 2016 at 09:01, Michal Simek <michal.simek@xilinx.com> wrote:
>> Enabling this driver requires some DT changes.
>> Adding DCC to root or main bus:
>> dcc: dcc {
>>         compatible = "arm,dcc";
>>         u-boot,dm-pre-reloc;
>> };
>>
>> Extend alias list to link DCC:
>>         serial0 = &uart0;
>>         serial1 = &uart1;
>>         serial2 = &dcc;
>>
>> Change stdout-path to point to dcc port.
>>         stdout-path = "serial2:115200n8";
>>
>> Also add support for debug uart to help with early debug.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  drivers/serial/Kconfig   |  5 ++++
>>  drivers/serial/arm_dcc.c | 63 +++++++++++++++++++++++++++++-------------------
>>  2 files changed, 43 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>> index fac317610e2a..7c18a6218b1f 100644
>> --- a/drivers/serial/Kconfig
>> +++ b/drivers/serial/Kconfig
>> @@ -119,6 +119,11 @@ config DEBUG_UART_UARTLITE
>>           You will need to provide parameters to make this work. The driver will
>>           be available until the real driver-model serial is running.
>>
>> +config DEBUG_UART_ARM_DCC
>> +       bool "ARM DCC"
>> +       help
>> +         Select this to enable a debug UART using the ARM DCC port.
> 
> Can you please expand this - what is DCC? What parts support it? What is it for?

Sure will do.

> 
>> +
>>  config DEBUG_UART_ZYNQ
>>         bool "Xilinx Zynq"
>>         help
>> diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
>> index 4624666e8a2c..07981e18ee49 100644
>> --- a/drivers/serial/arm_dcc.c
>> +++ b/drivers/serial/arm_dcc.c
>> @@ -1,6 +1,7 @@
>>  /*
>>   * Copyright (C) 2004-2007 ARM Limited.
>>   * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>> + * Copyright (C) 2015 - 2016 Xilinx, Inc, Michal Simek
>>   *
>>   * SPDX-License-Identifier:    GPL-2.0
>>   *
>> @@ -16,6 +17,7 @@
>>   */
>>
>>  #include <common.h>
>> +#include <dm.h>
>>  #include <serial.h>
>>
>>  #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7)
>> @@ -94,12 +96,7 @@
>>
>>  #define TIMEOUT_COUNT 0x4000000
>>
>> -static int arm_dcc_init(void)
>> -{
>> -       return 0;
>> -}
>> -
>> -static int arm_dcc_getc(void)
>> +static int arm_dcc_getc(struct udevice *dev)
>>  {
>>         int ch;
>>         register unsigned int reg;
>> @@ -112,7 +109,7 @@ static int arm_dcc_getc(void)
>>         return ch;
>>  }
>>
>> -static void arm_dcc_putc(char ch)
>> +static int arm_dcc_putc(struct udevice *dev, char ch)
>>  {
>>         register unsigned int reg;
>>         unsigned int timeout_count = TIMEOUT_COUNT;
>> @@ -123,41 +120,57 @@ static void arm_dcc_putc(char ch)
>>                         break;
>>         }
>>         if (timeout_count == 0)
>> -               return;
>> +               return -EAGAIN;
>>         else
>>                 write_dcc(ch);
>> +
>> +       return 0;
>>  }
>>
>> -static int arm_dcc_tstc(void)
>> +static int arm_dcc_pending(struct udevice *dev, bool input)
>>  {
>>         register unsigned int reg;
>>
>> -       can_read_dcc(reg);
>> +       if (input) {
> 
> Don't need the {} here
> 
>> +               can_read_dcc(reg);
>> +       } else {
>> +               can_write_dcc(reg);
>> +       }

Unfortunately I do. can_read/write_dcc are macros.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM
  2016-02-22 15:54   ` Michal Simek
@ 2016-02-23  6:38     ` Simon Glass
  2016-02-23  8:53       ` Michal Simek
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2016-02-23  6:38 UTC (permalink / raw)
  To: u-boot

Hi Michal,

On 22 February 2016 at 08:54, Michal Simek <michal.simek@xilinx.com> wrote:
> On 19.2.2016 21:55, Simon Glass wrote:
>> Hi Michal,
>>
>> On 18 February 2016 at 09:01, Michal Simek <michal.simek@xilinx.com> wrote:
>>> Enabling this driver requires some DT changes.
>>> Adding DCC to root or main bus:
>>> dcc: dcc {
>>>         compatible = "arm,dcc";
>>>         u-boot,dm-pre-reloc;
>>> };
>>>
>>> Extend alias list to link DCC:
>>>         serial0 = &uart0;
>>>         serial1 = &uart1;
>>>         serial2 = &dcc;
>>>
>>> Change stdout-path to point to dcc port.
>>>         stdout-path = "serial2:115200n8";
>>>
>>> Also add support for debug uart to help with early debug.
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>>  drivers/serial/Kconfig   |  5 ++++
>>>  drivers/serial/arm_dcc.c | 63 +++++++++++++++++++++++++++++-------------------
>>>  2 files changed, 43 insertions(+), 25 deletions(-)
>>>
>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>> index fac317610e2a..7c18a6218b1f 100644
>>> --- a/drivers/serial/Kconfig
>>> +++ b/drivers/serial/Kconfig
>>> @@ -119,6 +119,11 @@ config DEBUG_UART_UARTLITE
>>>           You will need to provide parameters to make this work. The driver will
>>>           be available until the real driver-model serial is running.
>>>
>>> +config DEBUG_UART_ARM_DCC
>>> +       bool "ARM DCC"
>>> +       help
>>> +         Select this to enable a debug UART using the ARM DCC port.
>>
>> Can you please expand this - what is DCC? What parts support it? What is it for?
>
> Sure will do.
>
>>
>>> +
>>>  config DEBUG_UART_ZYNQ
>>>         bool "Xilinx Zynq"
>>>         help
>>> diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
>>> index 4624666e8a2c..07981e18ee49 100644
>>> --- a/drivers/serial/arm_dcc.c
>>> +++ b/drivers/serial/arm_dcc.c
>>> @@ -1,6 +1,7 @@
>>>  /*
>>>   * Copyright (C) 2004-2007 ARM Limited.
>>>   * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>> + * Copyright (C) 2015 - 2016 Xilinx, Inc, Michal Simek
>>>   *
>>>   * SPDX-License-Identifier:    GPL-2.0
>>>   *
>>> @@ -16,6 +17,7 @@
>>>   */
>>>
>>>  #include <common.h>
>>> +#include <dm.h>
>>>  #include <serial.h>
>>>
>>>  #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7)
>>> @@ -94,12 +96,7 @@
>>>
>>>  #define TIMEOUT_COUNT 0x4000000
>>>
>>> -static int arm_dcc_init(void)
>>> -{
>>> -       return 0;
>>> -}
>>> -
>>> -static int arm_dcc_getc(void)
>>> +static int arm_dcc_getc(struct udevice *dev)
>>>  {
>>>         int ch;
>>>         register unsigned int reg;
>>> @@ -112,7 +109,7 @@ static int arm_dcc_getc(void)
>>>         return ch;
>>>  }
>>>
>>> -static void arm_dcc_putc(char ch)
>>> +static int arm_dcc_putc(struct udevice *dev, char ch)
>>>  {
>>>         register unsigned int reg;
>>>         unsigned int timeout_count = TIMEOUT_COUNT;
>>> @@ -123,41 +120,57 @@ static void arm_dcc_putc(char ch)
>>>                         break;
>>>         }
>>>         if (timeout_count == 0)
>>> -               return;
>>> +               return -EAGAIN;
>>>         else
>>>                 write_dcc(ch);
>>> +
>>> +       return 0;
>>>  }
>>>
>>> -static int arm_dcc_tstc(void)
>>> +static int arm_dcc_pending(struct udevice *dev, bool input)
>>>  {
>>>         register unsigned int reg;
>>>
>>> -       can_read_dcc(reg);
>>> +       if (input) {
>>
>> Don't need the {} here
>>
>>> +               can_read_dcc(reg);
>>> +       } else {
>>> +               can_write_dcc(reg);
>>> +       }
>
> Unfortunately I do. can_read/write_dcc are macros.

What goes wrong if you leave them out? But if you need them, that's OK.

>
> Thanks,
> Michal

Regards,
Simon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM
  2016-02-23  6:38     ` Simon Glass
@ 2016-02-23  8:53       ` Michal Simek
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2016-02-23  8:53 UTC (permalink / raw)
  To: u-boot

On 23.2.2016 07:38, Simon Glass wrote:
> Hi Michal,
> 
> On 22 February 2016 at 08:54, Michal Simek <michal.simek@xilinx.com> wrote:
>> On 19.2.2016 21:55, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 18 February 2016 at 09:01, Michal Simek <michal.simek@xilinx.com> wrote:
>>>> Enabling this driver requires some DT changes.
>>>> Adding DCC to root or main bus:
>>>> dcc: dcc {
>>>>         compatible = "arm,dcc";
>>>>         u-boot,dm-pre-reloc;
>>>> };
>>>>
>>>> Extend alias list to link DCC:
>>>>         serial0 = &uart0;
>>>>         serial1 = &uart1;
>>>>         serial2 = &dcc;
>>>>
>>>> Change stdout-path to point to dcc port.
>>>>         stdout-path = "serial2:115200n8";
>>>>
>>>> Also add support for debug uart to help with early debug.
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>>  drivers/serial/Kconfig   |  5 ++++
>>>>  drivers/serial/arm_dcc.c | 63 +++++++++++++++++++++++++++++-------------------
>>>>  2 files changed, 43 insertions(+), 25 deletions(-)
>>>>
>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>> index fac317610e2a..7c18a6218b1f 100644
>>>> --- a/drivers/serial/Kconfig
>>>> +++ b/drivers/serial/Kconfig
>>>> @@ -119,6 +119,11 @@ config DEBUG_UART_UARTLITE
>>>>           You will need to provide parameters to make this work. The driver will
>>>>           be available until the real driver-model serial is running.
>>>>
>>>> +config DEBUG_UART_ARM_DCC
>>>> +       bool "ARM DCC"
>>>> +       help
>>>> +         Select this to enable a debug UART using the ARM DCC port.
>>>
>>> Can you please expand this - what is DCC? What parts support it? What is it for?
>>
>> Sure will do.
>>
>>>
>>>> +
>>>>  config DEBUG_UART_ZYNQ
>>>>         bool "Xilinx Zynq"
>>>>         help
>>>> diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
>>>> index 4624666e8a2c..07981e18ee49 100644
>>>> --- a/drivers/serial/arm_dcc.c
>>>> +++ b/drivers/serial/arm_dcc.c
>>>> @@ -1,6 +1,7 @@
>>>>  /*
>>>>   * Copyright (C) 2004-2007 ARM Limited.
>>>>   * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>>> + * Copyright (C) 2015 - 2016 Xilinx, Inc, Michal Simek
>>>>   *
>>>>   * SPDX-License-Identifier:    GPL-2.0
>>>>   *
>>>> @@ -16,6 +17,7 @@
>>>>   */
>>>>
>>>>  #include <common.h>
>>>> +#include <dm.h>
>>>>  #include <serial.h>
>>>>
>>>>  #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V7)
>>>> @@ -94,12 +96,7 @@
>>>>
>>>>  #define TIMEOUT_COUNT 0x4000000
>>>>
>>>> -static int arm_dcc_init(void)
>>>> -{
>>>> -       return 0;
>>>> -}
>>>> -
>>>> -static int arm_dcc_getc(void)
>>>> +static int arm_dcc_getc(struct udevice *dev)
>>>>  {
>>>>         int ch;
>>>>         register unsigned int reg;
>>>> @@ -112,7 +109,7 @@ static int arm_dcc_getc(void)
>>>>         return ch;
>>>>  }
>>>>
>>>> -static void arm_dcc_putc(char ch)
>>>> +static int arm_dcc_putc(struct udevice *dev, char ch)
>>>>  {
>>>>         register unsigned int reg;
>>>>         unsigned int timeout_count = TIMEOUT_COUNT;
>>>> @@ -123,41 +120,57 @@ static void arm_dcc_putc(char ch)
>>>>                         break;
>>>>         }
>>>>         if (timeout_count == 0)
>>>> -               return;
>>>> +               return -EAGAIN;
>>>>         else
>>>>                 write_dcc(ch);
>>>> +
>>>> +       return 0;
>>>>  }
>>>>
>>>> -static int arm_dcc_tstc(void)
>>>> +static int arm_dcc_pending(struct udevice *dev, bool input)
>>>>  {
>>>>         register unsigned int reg;
>>>>
>>>> -       can_read_dcc(reg);
>>>> +       if (input) {
>>>
>>> Don't need the {} here
>>>
>>>> +               can_read_dcc(reg);
>>>> +       } else {
>>>> +               can_write_dcc(reg);
>>>> +       }
>>
>> Unfortunately I do. can_read/write_dcc are macros.
> 
> What goes wrong if you leave them out? But if you need them, that's OK.

  CC      drivers/serial/arm_dcc.o
drivers/serial/arm_dcc.c: In function ?arm_dcc_pending?:
drivers/serial/arm_dcc.c:136:2: error: ?else? without a previous ?if?
  else
  ^
make[1]: *** [drivers/serial/arm_dcc.o] Error 1
make: *** [drivers/serial] Error 2

Thanks,
Michal

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-23  8:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-18 16:01 [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Michal Simek
2016-02-18 16:01 ` [U-Boot] [PATCH 2/2] ARM: zynq: zynqmp: Enable DCC serial driver by default Michal Simek
2016-02-19 20:55   ` Simon Glass
2016-02-22 15:28     ` Michal Simek
2016-02-19 20:55 ` [U-Boot] [PATCH 1/2] serial: dcc: Move driver to DM Simon Glass
2016-02-22 15:54   ` Michal Simek
2016-02-23  6:38     ` Simon Glass
2016-02-23  8:53       ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox