From 5857e83cfc89440d5dc3177f8f8fc309e1071781 Mon Sep 17 00:00:00 2001 From: G S Niteesh Date: Mon, 10 Feb 2020 00:51:43 +0530 Subject: libchip/ns16550: Allow user calculate baud divisor This patch will allow the user to pass a function to calculate the baud divisor. This will allow for more flexibility, since for some BSPs like raspberrypi, the calculation of baud divisor is different from what is in the current driver. --- bsps/shared/dev/serial/ns16550-context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bsps/shared/dev/serial') diff --git a/bsps/shared/dev/serial/ns16550-context.c b/bsps/shared/dev/serial/ns16550-context.c index ce55b8309c..dbf6c64af4 100644 --- a/bsps/shared/dev/serial/ns16550-context.c +++ b/bsps/shared/dev/serial/ns16550-context.c @@ -112,6 +112,8 @@ static uint32_t NS16550_GetBaudDivisor(ns16550_context *ctx, uint32_t baud) NS16550_FRACTIONAL_DIVIDER, fractionalDivider ); + } else if (ctx->calculate_baud_divisor != NULL) { + baudDivisor = ctx->calculate_baud_divisor(ctx, baud); } return baudDivisor; -- cgit v1.2.3