Skip to content
Permalink
Browse files

drivers: uart_stellaris: Get clock frequency from DTS

The uart_stellaris driver used system clock frequency
as a base for baudrate calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
  • Loading branch information...
pizi-nordic authored and carlescufi committed Apr 11, 2019
1 parent dc44cb0 commit 9e9f5cecffdcb9196d8e846ee67239daeaba078d
Showing with 4 additions and 11 deletions.
  1. +3 −3 drivers/serial/uart_stellaris.c
  2. +0 −7 soc/arm/ti_lm3s6965/soc.h
  3. +1 −1 soc/arm/ti_simplelink/cc2650/dts_fixup.h
@@ -634,7 +634,7 @@ static void irq_config_func_0(struct device *port);

static const struct uart_device_config uart_stellaris_dev_cfg_0 = {
.base = (u8_t *)DT_TI_STELLARIS_UART_4000C000_BASE_ADDRESS,
.sys_clk_freq = DT_UART_STELLARIS_CLK_FREQ,
.sys_clk_freq = DT_TI_STELLARIS_UART_4000C000_CLOCKS_CLOCK_FREQUENCY,

#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = irq_config_func_0,
@@ -672,7 +672,7 @@ static void irq_config_func_1(struct device *port);

static struct uart_device_config uart_stellaris_dev_cfg_1 = {
.base = (u8_t *)DT_TI_STELLARIS_UART_4000D000_BASE_ADDRESS,
.sys_clk_freq = DT_UART_STELLARIS_CLK_FREQ,
.sys_clk_freq = DT_TI_STELLARIS_UART_4000D000_CLOCKS_CLOCK_FREQUENCY,

#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = irq_config_func_1,
@@ -710,7 +710,7 @@ static void irq_config_func_2(struct device *port);

static const struct uart_device_config uart_stellaris_dev_cfg_2 = {
.base = (u8_t *)DT_TI_STELLARIS_UART_4000E000_BASE_ADDRESS,
.sys_clk_freq = DT_UART_STELLARIS_CLK_FREQ,
.sys_clk_freq = DT_TI_STELLARIS_UART_4000E000_CLOCKS_CLOCK_FREQUENCY,

#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = irq_config_func_2,
@@ -75,13 +75,6 @@ extern "C" {
#include <sys/util.h>
#include <random/rand32.h>

/* uart configuration settings */
#if defined(CONFIG_UART_STELLARIS)

#define DT_UART_STELLARIS_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ

#endif /* CONFIG_UART_STELLARIS */

#endif /* !_ASMLANGUAGE */

#ifdef __cplusplus
@@ -6,7 +6,7 @@

#define DT_TI_STELLARIS_UART_4000C000_BASE_ADDRESS DT_TI_STELLARIS_UART_40001000_BASE_ADDRESS
#define DT_TI_STELLARIS_UART_4000C000_CURRENT_SPEED DT_TI_STELLARIS_UART_40001000_CURRENT_SPEED
#define DT_UART_STELLARIS_CLK_FREQ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
#define DT_TI_STELLARIS_UART_4000C000_CLOCKS_CLOCK_FREQUENCY DT_TI_STELLARIS_UART_40001000_CLOCKS_CLOCK_FREQUENCY
#define DT_TI_STELLARIS_UART_4000C000_IRQ_0 DT_TI_STELLARIS_UART_40001000_IRQ_0
#define DT_TI_STELLARIS_UART_4000C000_IRQ_0_PRIORITY DT_TI_STELLARIS_UART_40001000_IRQ_0_PRIORITY
#define DT_TI_STELLARIS_UART_4000C000_LABEL DT_TI_STELLARIS_UART_40001000_LABEL

0 comments on commit 9e9f5ce

Please sign in to comment.
You can’t perform that action at this time.