From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [PATCH v1 1/3] dm: serial: Add clock member to struct serial_device_info
Date: Thu, 27 Feb 2020 17:21:54 +0200 [thread overview]
Message-ID: <20200227152156.87385-1-andriy.shevchenko@linux.intel.com> (raw)
Some callers of serial_getinfo() would like to know the UART base
clock speed in order to make decision what to pass to OS in some
cases. In particular, ACPI SPCR table expects only certain base
clock speed and thus we have to act accordingly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/serial/sandbox.c | 1 +
include/serial.h | 3 +++
test/dm/serial.c | 1 +
3 files changed, 5 insertions(+)
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index 1af5cc12f3..545ff3f747 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -198,6 +198,7 @@ static int sandbox_serial_getinfo(struct udevice *dev,
.reg_width = 1,
.reg_offset = 0,
.reg_shift = 0,
+ .clock = SERIAL_DEFAULT_CLOCK,
};
if (!serial_info)
diff --git a/include/serial.h b/include/serial.h
index 104f34ff91..54b21a0470 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -139,6 +139,7 @@ enum adr_space_type {
* @reg_width: size (in bytes) of the IO accesses to the registers
* @reg_offset: offset to apply to the @addr from the start of the registers
* @reg_shift: quantity to shift the register offsets by
+ * @clock: UART base clock speed in Hz
* @baudrate: baud rate
*/
struct serial_device_info {
@@ -148,10 +149,12 @@ struct serial_device_info {
u8 reg_width;
u8 reg_offset;
u8 reg_shift;
+ unsigned int clock;
unsigned int baudrate;
};
#define SERIAL_DEFAULT_ADDRESS 0xBADACCE5
+#define SERIAL_DEFAULT_CLOCK (16 * 115200)
/**
* struct struct dm_serial_ops - Driver model serial operations
diff --git a/test/dm/serial.c b/test/dm/serial.c
index 3d741a8c36..c6be6ab7ab 100644
--- a/test/dm/serial.c
+++ b/test/dm/serial.c
@@ -29,6 +29,7 @@ static int dm_test_serial(struct unit_test_state *uts)
ut_assertok(serial_getinfo(dev_serial, &info_serial));
ut_assert(info_serial.type == SERIAL_CHIP_UNKNOWN);
ut_assert(info_serial.addr == SERIAL_DEFAULT_ADDRESS);
+ ut_assert(info_serial.clock == SERIAL_DEFAULT_CLOCK);
/*
* test with a parameter which is NULL pointer
*/
--
2.25.0
next reply other threads:[~2020-02-27 15:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 15:21 Andy Shevchenko [this message]
2020-02-27 15:21 ` [PATCH v1 2/3] serial: ns16550: Provide UART base clock speed in ->getinfo() Andy Shevchenko
2020-02-27 23:40 ` Simon Glass
2020-04-15 14:19 ` Bin Meng
2020-04-15 14:27 ` Bin Meng
2020-02-27 15:21 ` [PATCH v1 3/3] x86: acpi: Let OS know that console already had been initialized Andy Shevchenko
2020-04-15 14:20 ` Bin Meng
2020-04-15 14:27 ` Bin Meng
2020-02-27 23:40 ` [PATCH v1 1/3] dm: serial: Add clock member to struct serial_device_info Simon Glass
2020-04-15 14:19 ` Bin Meng
2020-04-15 14:27 ` Bin Meng
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=20200227152156.87385-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--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