mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 06:00:43 +00:00
dm: serial: Add clock member to struct serial_device_info
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> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
66b8669d77
commit
bf4661bcb0
3 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue