Home | History | Annotate | Line # | Download | only in gpio
      1 /*	$NetBSD: generic_regs.h,v 1.2 2021/12/18 23:45:04 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2012-16 Advanced Micro Devices, Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: AMD
     25  *
     26  */
     27 
     28 #ifndef DRIVERS_GPU_DRM_AMD_DC_DEV_DC_GPIO_GENERIC_REGS_H_
     29 #define DRIVERS_GPU_DRM_AMD_DC_DEV_DC_GPIO_GENERIC_REGS_H_
     30 
     31 #include "gpio_regs.h"
     32 
     33 #define GENERIC_GPIO_REG_LIST_ENTRY(type, cd, id) \
     34 	.type ## _reg =  REG(DC_GPIO_GENERIC_## type),\
     35 	.type ## _mask =  DC_GPIO_GENERIC_ ## type ## __DC_GPIO_GENERIC ## id ## _ ## type ## _MASK,\
     36 	.type ## _shift = DC_GPIO_GENERIC_ ## type ## __DC_GPIO_GENERIC ## id ## _ ## type ## __SHIFT
     37 
     38 #define GENERIC_GPIO_REG_LIST(id) \
     39 	{\
     40 	GENERIC_GPIO_REG_LIST_ENTRY(MASK, cd, id),\
     41 	GENERIC_GPIO_REG_LIST_ENTRY(A, cd, id),\
     42 	GENERIC_GPIO_REG_LIST_ENTRY(EN, cd, id),\
     43 	GENERIC_GPIO_REG_LIST_ENTRY(Y, cd, id)\
     44 	}
     45 
     46 #define GENERIC_REG_LIST(id) \
     47 	GENERIC_GPIO_REG_LIST(id), \
     48 	.mux = REG(DC_GENERIC ## id),\
     49 
     50 #define GENERIC_MASK_SH_LIST(mask_sh, cd) \
     51 	{(DC_GENERIC ## cd ##__GENERIC ## cd ##_EN## mask_sh),\
     52 	(DC_GENERIC ## cd ##__GENERIC ## cd ##_SEL## mask_sh)}
     53 
     54 struct generic_registers {
     55 	struct gpio_registers gpio;
     56 	uint32_t mux;
     57 };
     58 
     59 struct generic_sh_mask {
     60 	/* enable */
     61 	uint32_t GENERIC_EN;
     62 	/* select */
     63 	uint32_t GENERIC_SEL;
     64 
     65 };
     66 
     67 
     68 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_GPIO_GENERIC_REGS_H_ */
     69