1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2021, Microchip 4 */ 5 #ifndef __DRIVERS_ATMEL_RSTC_H 6 #define __DRIVERS_ATMEL_RSTC_H 7 8 #include <compiler.h> 9 #include <drivers/rstctrl.h> 10 #include <stdbool.h> 11 #include <util.h> 12 13 #define RESET_ID_MASK GENMASK_32(8, 5) 14 #define RESET_ID_SHIFT U(5) 15 #define RESET_BIT_POS_MASK GENMASK_32(4, 0) 16 #define RESET_OFFSET(id) (((id) & RESET_ID_MASK) >> RESET_ID_SHIFT) 17 #define RESET_BIT_POS(id) ((id) & RESET_BIT_POS_MASK) 18 19 #if defined(CFG_ATMEL_RSTC) 20 bool atmel_rstc_available(void); 21 22 void __noreturn atmel_rstc_reset(void); 23 void sam_rstc_usb_por(unsigned char id, bool enable); 24 struct rstctrl *sam_get_rstctrl(unsigned int reset_id); 25 #else atmel_rstc_available(void)26static inline bool atmel_rstc_available(void) 27 { 28 return false; 29 } 30 atmel_rstc_reset(void)31static inline void atmel_rstc_reset(void) {} sam_rstc_usb_por(unsigned char id __unused,bool enable __unused)32static inline void sam_rstc_usb_por(unsigned char id __unused, 33 bool enable __unused) {} sam_get_rstctrl(unsigned int reset_id __unused)34static inline struct rstctrl *sam_get_rstctrl(unsigned int reset_id __unused) 35 { 36 return NULL; 37 } 38 #endif 39 40 #endif /* __DRIVERS_ATMEL_RSTC_H */ 41