1 /*
2  * Copyright (c) 2015 Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file Board config file
9  */
10 
11 #include <zephyr/device.h>
12 #include <zephyr/init.h>
13 
14 #include <zephyr/kernel.h>
15 
16 #include "soc.h"
17 
18 #ifdef CONFIG_UART_STELLARIS
19 #include <zephyr/drivers/uart.h>
20 
21 #define RCGC1 (*((volatile uint32_t *)0x400FE104))
22 
23 #define RCGC1_UART0_EN 0x00000001
24 #define RCGC1_UART1_EN 0x00000002
25 #define RCGC1_UART2_EN 0x00000004
26 
uart_stellaris_init(void)27 static int uart_stellaris_init(void)
28 {
29 #ifdef CONFIG_UART_STELLARIS_PORT_0
30 	RCGC1 |= RCGC1_UART0_EN;
31 #endif
32 
33 #ifdef CONFIG_UART_STELLARIS_PORT_1
34 	RCGC1 |= RCGC1_UART1_EN;
35 #endif
36 
37 #ifdef CONFIG_UART_STELLARIS_PORT_2
38 	RCGC1 |= RCGC1_UART2_EN;
39 #endif
40 
41 	return 0;
42 }
43 
44 SYS_INIT(uart_stellaris_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
45 
46 #endif /* CONFIG_UART_STELLARIS */
47 
48 #ifdef CONFIG_ETH_STELLARIS
49 
50 #define RCGC2 (*((volatile uint32_t *)0x400FE108))
51 
52 #define RCGC2_PHY_EN   0x40000000
53 #define RCGC2_EMAC_EN  0x10000000
54 
eth_stellaris_init(void)55 static int eth_stellaris_init(void)
56 {
57 	RCGC2 |= (RCGC2_PHY_EN | RCGC2_EMAC_EN);
58 	return 0;
59 }
60 
61 SYS_INIT(eth_stellaris_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
62 
63 #endif /* CONFIG_ETH_STELLARIS */
64