diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-11-20 23:52:33 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-12-05 06:08:31 -0700 |
commit | d5bb4f862b47ad9112132071ad18f9936494e307 (patch) | |
tree | ba4c615f53874d52b17a25dbf02c10b357c31789 /include/serial.h | |
parent | ac7f5db9dc690901d99fe0afbcb3d4241c3cab8e (diff) | |
download | u-boot-d5bb4f862b47ad9112132071ad18f9936494e307.tar.gz |
dm: serial: Introduce ->getinfo() callback
New callback will give a necessary information to fill up ACPI SPCR table,
for example. Maybe used later for other purposes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Change ADR_SPACE_SYSTEM_IO to SERIAL_ADDRESS_SPACE_IO to fix build error:
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/serial.h')
-rw-r--r-- | include/serial.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/serial.h b/include/serial.h index de21514c0c..c1a9fee250 100644 --- a/include/serial.h +++ b/include/serial.h @@ -118,6 +118,39 @@ enum serial_stop { SERIAL_8_BITS << SERIAL_BITS_SHIFT | \ SERIAL_ONE_STOP << SERIAL_STOP_SHIFT) +enum serial_chip_type { + SERIAL_CHIP_UNKNOWN = -1, + SERIAL_CHIP_16550_COMPATIBLE, +}; + +enum adr_space_type { + SERIAL_ADDRESS_SPACE_MEMORY = 0, + SERIAL_ADDRESS_SPACE_IO, +}; + +/** + * struct serial_device_info - structure to hold serial device info + * + * @type: type of the UART chip + * @addr_space: address space to access the registers + * @addr: physical address of the registers + * @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 + * @baudrate: baud rate + */ +struct serial_device_info { + enum serial_chip_type type; + enum adr_space_type addr_space; + ulong addr; + u8 reg_width; + u8 reg_offset; + u8 reg_shift; + unsigned int baudrate; +}; + +#define SERIAL_DEFAULT_ADDRESS 0xBADACCE5 + /** * struct struct dm_serial_ops - Driver model serial operations * @@ -219,6 +252,13 @@ struct dm_serial_ops { * @return 0 if OK, -ve on error */ int (*setconfig)(struct udevice *dev, uint serial_config); + /** + * getinfo() - Get serial device information + * + * @dev: Device pointer + * @info: struct serial_device_info to fill + */ + int (*getinfo)(struct udevice *dev, struct serial_device_info *info); }; /** |