efi_loader: correctly render MAC address device path nodes
[oweals/u-boot.git] / drivers / serial / atmel_usart.c
index bb294ff94f0b10a6fbe25e18d7241a1cdc9e41c3..c450a4e08a3dc3f33c15a07829c22fd4950e083b 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2004-2006 Atmel Corporation
  *
  * Modified to support C structur SoC access by
  * Andreas Bießmann <biessmann@corscience.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <clk.h>
@@ -219,6 +218,17 @@ static const struct dm_serial_ops atmel_serial_ops = {
        .setbrg = atmel_serial_setbrg,
 };
 
+#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_CLK)
+static int atmel_serial_enable_clk(struct udevice *dev)
+{
+       struct atmel_serial_priv *priv = dev_get_priv(dev);
+
+       /* Use fixed clock value in SPL */
+       priv->usart_clk_rate = CONFIG_SPL_UART_CLOCK;
+
+       return 0;
+}
+#else
 static int atmel_serial_enable_clk(struct udevice *dev)
 {
        struct atmel_serial_priv *priv = dev_get_priv(dev);
@@ -246,6 +256,7 @@ static int atmel_serial_enable_clk(struct udevice *dev)
 
        return 0;
 }
+#endif
 
 static int atmel_serial_probe(struct udevice *dev)
 {
@@ -295,7 +306,9 @@ U_BOOT_DRIVER(serial_atmel) = {
 #endif
        .probe = atmel_serial_probe,
        .ops    = &atmel_serial_ops,
+#if !CONFIG_IS_ENABLED(OF_CONTROL)
        .flags = DM_FLAG_PRE_RELOC,
+#endif
        .priv_auto_alloc_size   = sizeof(struct atmel_serial_priv),
 };
 #endif