Skip to content

Commit b4e2e9a

Browse files
committed
stm32h7/clk: cleanup
1 parent 7ce7062 commit b4e2e9a

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

arch/arm/src/stm32h7/stm32_serial.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,12 +1570,13 @@ static inline void up_setusartint(struct up_dev_s *priv, uint16_t ie)
15701570
up_serialout(priv, STM32_USART_CR3_OFFSET, cr);
15711571
}
15721572

1573+
#if !defined(SERIAL_HAVE_ONLY_DMA) || defined(CONFIG_PM) || \
1574+
defined(HAVE_RS485)
1575+
15731576
/****************************************************************************
15741577
* Name: up_restoreusartint
15751578
****************************************************************************/
15761579

1577-
#if !defined(SERIAL_HAVE_ONLY_DMA) || defined(CONFIG_PM) || \
1578-
defined(HAVE_RS485)
15791580
static void up_restoreusartint(struct up_dev_s *priv, uint16_t ie)
15801581
{
15811582
irqstate_t flags;
@@ -1643,6 +1644,8 @@ static void up_disableusartint(struct up_dev_s *priv, uint16_t *ie)
16431644
spin_unlock_irqrestore(&priv->lock, flags);
16441645
}
16451646

1647+
#ifdef SERIAL_HAVE_RXDMA
1648+
16461649
/****************************************************************************
16471650
* Name: up_dma_nextrx
16481651
*
@@ -1652,7 +1655,6 @@ static void up_disableusartint(struct up_dev_s *priv, uint16_t *ie)
16521655
*
16531656
****************************************************************************/
16541657

1655-
#ifdef SERIAL_HAVE_RXDMA
16561658
static int up_dma_nextrx(struct up_dev_s *priv)
16571659
{
16581660
size_t dmaresidual;
@@ -1663,6 +1665,8 @@ static int up_dma_nextrx(struct up_dev_s *priv)
16631665
}
16641666
#endif
16651667

1668+
#ifdef CONFIG_PM
1669+
16661670
/****************************************************************************
16671671
* Name: up_setsuspend
16681672
*
@@ -1671,7 +1675,6 @@ static int up_dma_nextrx(struct up_dev_s *priv)
16711675
*
16721676
****************************************************************************/
16731677

1674-
#ifdef CONFIG_PM
16751678
static void up_setsuspend(struct uart_dev_s *dev, bool suspend)
16761679
{
16771680
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
@@ -1776,6 +1779,8 @@ static void up_setsuspend(struct uart_dev_s *dev, bool suspend)
17761779
}
17771780
#endif
17781781

1782+
#ifdef CONFIG_PM
1783+
17791784
/****************************************************************************
17801785
* Name: up_pm_setsuspend
17811786
*
@@ -1784,7 +1789,6 @@ static void up_setsuspend(struct uart_dev_s *dev, bool suspend)
17841789
*
17851790
****************************************************************************/
17861791

1787-
#ifdef CONFIG_PM
17881792
static void up_pm_setsuspend(bool suspend)
17891793
{
17901794
int n;
@@ -2766,6 +2770,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
27662770
return ret;
27672771
}
27682772

2773+
#ifndef SERIAL_HAVE_ONLY_RXDMA
2774+
27692775
/****************************************************************************
27702776
* Name: up_receive
27712777
*
@@ -2776,7 +2782,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
27762782
*
27772783
****************************************************************************/
27782784

2779-
#ifndef SERIAL_HAVE_ONLY_RXDMA
27802785
static int up_receive(struct uart_dev_s *dev, unsigned int *status)
27812786
{
27822787
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
@@ -2797,6 +2802,8 @@ static int up_receive(struct uart_dev_s *dev, unsigned int *status)
27972802
}
27982803
#endif
27992804

2805+
#ifndef SERIAL_HAVE_ONLY_RXDMA
2806+
28002807
/****************************************************************************
28012808
* Name: up_rxint
28022809
*
@@ -2805,7 +2812,6 @@ static int up_receive(struct uart_dev_s *dev, unsigned int *status)
28052812
*
28062813
****************************************************************************/
28072814

2808-
#ifndef SERIAL_HAVE_ONLY_RXDMA
28092815
static void up_rxint(struct uart_dev_s *dev, bool enable)
28102816
{
28112817
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
@@ -2856,6 +2862,8 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
28562862
}
28572863
#endif
28582864

2865+
#ifndef SERIAL_HAVE_ONLY_RXDMA
2866+
28592867
/****************************************************************************
28602868
* Name: up_rxavailable
28612869
*
@@ -2864,14 +2872,15 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
28642872
*
28652873
****************************************************************************/
28662874

2867-
#ifndef SERIAL_HAVE_ONLY_RXDMA
28682875
static bool up_rxavailable(struct uart_dev_s *dev)
28692876
{
28702877
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
28712878
return ((up_serialin(priv, STM32_USART_ISR_OFFSET) & USART_ISR_RXNE) != 0);
28722879
}
28732880
#endif
28742881

2882+
#ifdef CONFIG_SERIAL_IFLOWCONTROL
2883+
28752884
/****************************************************************************
28762885
* Name: up_rxflowcontrol
28772886
*
@@ -2895,7 +2904,6 @@ static bool up_rxavailable(struct uart_dev_s *dev)
28952904
*
28962905
****************************************************************************/
28972906

2898-
#ifdef CONFIG_SERIAL_IFLOWCONTROL
28992907
static bool up_rxflowcontrol(struct uart_dev_s *dev,
29002908
unsigned int nbuffered, bool upper)
29012909
{
@@ -2968,6 +2976,8 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev,
29682976
}
29692977
#endif
29702978

2979+
#ifdef SERIAL_HAVE_RXDMA
2980+
29712981
/****************************************************************************
29722982
* Name: up_dma_receive
29732983
*
@@ -2978,7 +2988,6 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev,
29782988
*
29792989
****************************************************************************/
29802990

2981-
#ifdef SERIAL_HAVE_RXDMA
29822991
static int up_dma_receive(struct uart_dev_s *dev, unsigned int *status)
29832992
{
29842993
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
@@ -3305,6 +3314,8 @@ static void up_send(struct uart_dev_s *dev, int ch)
33053314
up_serialout(priv, STM32_USART_TDR_OFFSET, (uint32_t)ch);
33063315
}
33073316

3317+
3318+
#ifdef SERIAL_HAVE_TXDMA
33083319
/****************************************************************************
33093320
* Name: up_dma_txint
33103321
*
@@ -3313,7 +3324,7 @@ static void up_send(struct uart_dev_s *dev, int ch)
33133324
*
33143325
****************************************************************************/
33153326

3316-
#ifdef SERIAL_HAVE_TXDMA
3327+
33173328
static void up_dma_txint(struct uart_dev_s *dev, bool enable)
33183329
{
33193330
/* Nothing to do. */

arch/arm/src/stm32h7/stm32_start.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,12 @@ void __start(void)
184184
stm32h7_waitfor_cm7();
185185
#endif
186186

187-
/* If enabled reset the MPU */
188187

188+
#ifdef CONFIG_ARM_MPU_EARLY_RESET
189+
/* If enabled reset the MPU */
190+
189191
mpu_early_reset();
192+
#endif
190193

191194
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
192195
* certain that there are no issues with the state of global variables.
@@ -230,9 +233,9 @@ void __start(void)
230233
arm_stack_check_init();
231234
#endif
232235

233-
/* Configure the UART so that we can get debug output as soon as possible */
234-
236+
#ifdef CONFIG_ARCH_FPU
235237
arm_fpuconfig();
238+
#endif
236239

237240
#ifdef CONFIG_ARCH_CHIP_STM32H7_CORTEXM7
238241
/* Enable/disable tightly coupled memories */

0 commit comments

Comments
 (0)