Platform: Make UART1 non-secure by default

Make UART1 non-secure peripheral by default, which can
be switched to secure using a compile time switch for
demonstration purposes.

Change-Id: I834b7d9a2b42ce55e14ee9f06e244420c9e6ac5b
Signed-off-by: Miklos Balint <miklos.balint@arm.com>
diff --git a/platform/ext/common/uart_stdout.c b/platform/ext/common/uart_stdout.c
index fbf2d17..8075873 100755
--- a/platform/ext/common/uart_stdout.c
+++ b/platform/ext/common/uart_stdout.c
@@ -71,19 +71,33 @@
     /* Add a configuration step for the UART channel to use, 0 or 1 */

     switch(uchan) {

     case UART0_CHANNEL:

-        /* UART0 is configured as a non-secure peripheral, so we wouldn't be

-         * able to access it using its secure alias. Ideally, we would want

-         * to use UART1 only from S side as it's a secure peripheral, but for

-         * simplicity, leave the option to use UART0 and use a workaround

+        /* UART0 is configured as a non-secure peripheral, so it cannot be

+         * accessed using its secure alias. Ideally the driver would

+         * be configured with the right properties, but for simplicity,

+         * use a workaround for now

          */

 #ifdef TARGET_MUSCA_A

         memcpy(&UART0_DEV_S, &UART0_DEV_NS, sizeof(struct uart_pl011_dev_t));

 #else

-        memcpy(&ARM_UART0_DEV_S, &ARM_UART0_DEV_NS, sizeof(struct arm_uart_dev_t));

+        memcpy(&ARM_UART0_DEV_S, &ARM_UART0_DEV_NS,

+                                                sizeof(struct arm_uart_dev_t));

 #endif

         Driver_USART = &Driver_USART0;

         break;

     case UART1_CHANNEL:

+#ifndef SECURE_UART1

+        /* If UART1 is configured as a non-secure peripheral, it cannot be

+         * accessed using its secure alias. Ideally the driver would

+         * be configured with the right properties, but for simplicity,

+         * use a workaround for now

+         */

+#ifdef TARGET_MUSCA_A

+        memcpy(&UART1_DEV_S, &UART1_DEV_NS, sizeof(struct uart_pl011_dev_t));

+#else

+        memcpy(&ARM_UART1_DEV_S, &ARM_UART1_DEV_NS,

+                                                sizeof(struct arm_uart_dev_t));

+#endif

+#endif

         Driver_USART = &Driver_USART1;

         break;

     default: