public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 03/13 v3] serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL
Date: Tue,  2 Apr 2019 10:57:17 +0200	[thread overview]
Message-ID: <20190402085727.14552-3-sr@denx.de> (raw)
In-Reply-To: <20190402085727.14552-1-sr@denx.de>

This patch adds an alterative SPL version of atmel_serial_enable_clk().
This enables the usage of this driver without full clock support (in
drivers and DT nodes). This saves some space in the SPL image.

Please note that this fixed clock support is only added to the SPL code
in the DM_SERIAL part of this file. All boards not using SPL & DM_SERIAL
should not be affected.

This patch also introduces CONFIG_SPL_UART_CLOCK for the fixed UART
input clock. It defaults to 132096000 for ARCH_AT91 but can be set to
a different value if needed.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Andreas Bießmann <andreas@biessmann.org>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Tested on the taurus board:
Tested-by: Heiko Schocher <hs@denx.de>
---
v3:
- Depend fixed clock atmel_serial_enable_clk() function also on
  !CONFIG_SPL_CLK so that board with full clocj support in SPL
  can still use the normal function here
- Introcude CONFIG_SPL_UART_CLOCK and use this Kconfig option instead
  of the hardcoded value

v2:
- Reword patch subject and commit text to make it more clear, that
  this change only affects ports with SPL and DM_SERIAL enabled
  
 drivers/serial/Kconfig       |  9 +++++++++
 drivers/serial/atmel_usart.c | 12 ++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 887cd687c0..d6bf8309d3 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -508,6 +508,15 @@ config ATMEL_USART
 	  configured in the device tree, and input clock frequency can
 	  be got from the clk node.
 
+config SPL_UART_CLOCK
+	int "SPL fixed UART input clock"
+	depends on SPL
+	default 132096000 if ARCH_AT91
+	help
+	  Provide a fixed clock value as input to the UART controller. This
+	  might be needed on platforms which can't enable CONFIG_SPL_CLK
+	  because of SPL image size restirctions.
+
 config BCM283X_MU_SERIAL
 	bool "Support for BCM283x Mini-UART"
 	depends on DM_SERIAL && ARCH_BCM283X
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index aa8cdff840..c450a4e08a 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -218,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);
@@ -245,6 +256,7 @@ static int atmel_serial_enable_clk(struct udevice *dev)
 
 	return 0;
 }
+#endif
 
 static int atmel_serial_probe(struct udevice *dev)
 {
-- 
2.21.0

  parent reply	other threads:[~2019-04-02  8:57 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02  8:57 [U-Boot] [PATCH 01/13 v3] arm: at91: Makefile: Compile lowlevel_init only when really necessary Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 02/13 v3] arm: at91: spl_at91.c: Call spl_early_init() if OF_CONTROL is enabled Stefan Roese
2019-04-02  8:57 ` Stefan Roese [this message]
2019-04-02 10:12   ` [U-Boot] [PATCH 03/13 v3] serial: atmel_usart: Use fixed clock value in SPL version with DM_SERIAL Eugen.Hristev at microchip.com
2019-04-02 10:40     ` Stefan Roese
2019-04-02 10:45       ` Eugen.Hristev at microchip.com
2019-04-02 11:21       ` [U-Boot] [PATCH 3/13 v4] " Stefan Roese
2019-04-03 10:52         ` Eugen.Hristev at microchip.com
2019-04-03 10:58           ` Stefan Roese
2019-04-03 11:05             ` Eugen.Hristev at microchip.com
2019-04-03 11:11               ` Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 04/13 v3] watchdog: Handle SPL build with watchdog disabled Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 05/13 v3] watchdog: at91sam9_wdt: Fix WDT setup in at91_wdt_start() Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 06/13 v3] arm: at91: Remove CONFIG_AT91_HW_WDT_TIMEOUT Stefan Roese
2019-04-02 11:19   ` Eugen.Hristev at microchip.com
2019-04-03  5:37   ` [U-Boot] [PATCH 06/13 v4] " Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 07/13 v3] arm: at91: Enable watchdog support Stefan Roese
2019-04-02 11:26   ` Eugen.Hristev at microchip.com
2019-04-02 11:50     ` Stefan Roese
2019-04-03  5:40       ` Stefan Roese
2019-04-03  5:37   ` [U-Boot] [PATCH 07/13 v4] " Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 08/13 v3] arm: at91: arm926ejs/u-boot-spl.lds: Add _image_binary_end to SPL lds Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 09/13 v3] Makefile.spl: Move generated AT91SAM NAND image boot.bin to spl directory Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 10/13 v3] Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary Stefan Roese
2019-04-03 11:08   ` Eugen.Hristev at microchip.com
2019-04-03 11:11     ` Eugen.Hristev at microchip.com
2019-04-03 11:21       ` Stefan Roese
2019-04-03 12:22         ` Stefan Roese
2019-04-03 12:31           ` Eugen.Hristev at microchip.com
2019-04-03 12:38             ` Stefan Roese
2019-04-03 12:46               ` Eugen.Hristev at microchip.com
2019-04-03 11:19     ` Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 11/13 v3] arm: at91: siemens: Add support to generate combined SPL+U-Boot image Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 12/13 v3] arm: at91: at91sam9x5.dtsi: Add watchdog handle Stefan Roese
2019-04-02  8:57 ` [U-Boot] [PATCH 13/13 v3] arm: at91: Add gardena-gateway-at91sam support Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190402085727.14552-3-sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox