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.
This commit is contained in:
G S Niteesh
2020-02-10 00:51:43 +05:30
committed by Christian Mauderer
parent b89b44224c
commit 5857e83cfc
2 changed files with 9 additions and 2 deletions

View File

@@ -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;