Skip to content

Commit

Permalink
soc: arm: atmel_sam: Clock clean-up
Browse files Browse the repository at this point in the history
Small clock clean-up. This moves all devicetree entries on SoC to
atmel_sam_dt.h.

Signed-off-by: Gerson Fernando Budke <[email protected]>
  • Loading branch information
nandojve authored and ioannisg committed Apr 23, 2020
1 parent 9c6c1f9 commit b2578c6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 29 deletions.
7 changes: 7 additions & 0 deletions soc/arm/atmel_sam/common/atmel_sam_dt.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#ifndef _ATMEL_SAM_DT_H_
#define _ATMEL_SAM_DT_H_

#include <devicetree.h>

/* Devicetree related macros to construct pin mux config data */

/* Get a node id from a pinctrl-0 prop at index 'i' */
Expand Down Expand Up @@ -43,4 +45,9 @@
ATMEL_SAM_PIN_PERIPH(inst, idx) << 16 \
}

/* Devicetree macros related to clock */

#define ATMEL_SAM_DT_CPU_CLK_FREQ_HZ \
DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)

#endif /* _ATMEL_SAM_SOC_DT_H_ */
9 changes: 2 additions & 7 deletions soc/arm/atmel_sam/sam3x/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,13 @@
#error Library does not support the specified device.
#endif

/* Add include for DTS generated information */
#include <devicetree.h>

#define ID_UART0 ID_UART
#define UART0 UART

#include "../common/soc_pmc.h"
#include "../common/soc_gpio.h"
#include "../common/atmel_sam_dt.h"

/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ DT_ARM_CORTEX_M3_0_CLOCK_FREQUENCY
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ ATMEL_SAM_DT_CPU_CLK_FREQ_HZ

/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ SOC_ATMEL_SAM_HCLK_FREQ_HZ

Expand Down
6 changes: 3 additions & 3 deletions soc/arm/atmel_sam/sam4e/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
#include "../common/soc_gpio.h"
#include "../common/atmel_sam_dt.h"

#endif /* !_ASMLANGUAGE */

/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ DT_ARM_CORTEX_M4F_0_CLOCK_FREQUENCY
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ ATMEL_SAM_DT_CPU_CLK_FREQ_HZ

/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ SOC_ATMEL_SAM_HCLK_FREQ_HZ

#endif /* !_ASMLANGUAGE */

#endif /* _ATMEL_SAM4E_SOC_H_ */
6 changes: 3 additions & 3 deletions soc/arm/atmel_sam/sam4s/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
#include "../common/soc_gpio.h"
#include "../common/atmel_sam_dt.h"

#endif /* !_ASMLANGUAGE */

/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ DT_ARM_CORTEX_M4_0_CLOCK_FREQUENCY
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ ATMEL_SAM_DT_CPU_CLK_FREQ_HZ

/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ SOC_ATMEL_SAM_HCLK_FREQ_HZ

#endif /* !_ASMLANGUAGE */

#endif /* _ATMEL_SAM4S_SOC_H_ */
14 changes: 6 additions & 8 deletions soc/arm/atmel_sam/same70/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@
#include "../common/soc_gpio.h"
#include "../common/atmel_sam_dt.h"

/* Add include for DTS generated information */
#include <devicetree.h>
/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ ATMEL_SAM_DT_CPU_CLK_FREQ_HZ

/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ \
(SOC_ATMEL_SAM_HCLK_FREQ_HZ / CONFIG_SOC_ATMEL_SAME70_MDIV)

#endif /* _ASMLANGUAGE */

Expand Down Expand Up @@ -117,10 +121,4 @@
#define DMA_PERID_TC2_RX 42
#define DMA_PERID_TC3_RX 43

/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ DT_ARM_CORTEX_M7_0_CLOCK_FREQUENCY
/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ \
(SOC_ATMEL_SAM_HCLK_FREQ_HZ / CONFIG_SOC_ATMEL_SAME70_MDIV)

#endif /* _ATMEL_SAME70_SOC_H_ */
14 changes: 6 additions & 8 deletions soc/arm/atmel_sam/samv71/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@
#include "../common/soc_gpio.h"
#include "../common/atmel_sam_dt.h"

/* Add include for DTS generated information */
#include <devicetree.h>
/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ ATMEL_SAM_DT_CPU_CLK_FREQ_HZ

/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ \
(SOC_ATMEL_SAM_HCLK_FREQ_HZ / CONFIG_SOC_ATMEL_SAMV71_MDIV)

#endif /* _ASMLANGUAGE */

Expand Down Expand Up @@ -127,10 +131,4 @@
#define DMA_PERID_I2SC1_TX_R 50
#define DMA_PERID_I2SC1_RX_R 51

/** Processor Clock (HCLK) Frequency */
#define SOC_ATMEL_SAM_HCLK_FREQ_HZ DT_ARM_CORTEX_M7_0_CLOCK_FREQUENCY
/** Master Clock (MCK) Frequency */
#define SOC_ATMEL_SAM_MCK_FREQ_HZ \
(SOC_ATMEL_SAM_HCLK_FREQ_HZ / CONFIG_SOC_ATMEL_SAMV71_MDIV)

#endif /* _ATMEL_SAMV71_SOC_H_ */

0 comments on commit b2578c6

Please sign in to comment.