1139826Simp/* $NetBSD: generic_regs.h,v 1.2 2021/12/18 23:45:04 riastradh Exp $ */ 253541Sshin 353541Sshin/* 453541Sshin * Copyright 2012-16 Advanced Micro Devices, Inc. 553541Sshin * 653541Sshin * Permission is hereby granted, free of charge, to any person obtaining a 753541Sshin * copy of this software and associated documentation files (the "Software"), 853541Sshin * to deal in the Software without restriction, including without limitation 953541Sshin * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1053541Sshin * and/or sell copies of the Software, and to permit persons to whom the 1153541Sshin * Software is furnished to do so, subject to the following conditions: 1253541Sshin * 1353541Sshin * The above copyright notice and this permission notice shall be included in 1453541Sshin * all copies or substantial portions of the Software. 1553541Sshin * 1653541Sshin * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1753541Sshin * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1853541Sshin * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1953541Sshin * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 2053541Sshin * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2153541Sshin * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2253541Sshin * OTHER DEALINGS IN THE SOFTWARE. 2353541Sshin * 2453541Sshin * Authors: AMD 2553541Sshin * 2653541Sshin */ 2753541Sshin 28174510Sobrien#ifndef DRIVERS_GPU_DRM_AMD_DC_DEV_DC_GPIO_GENERIC_REGS_H_ 29174510Sobrien#define DRIVERS_GPU_DRM_AMD_DC_DEV_DC_GPIO_GENERIC_REGS_H_ 3053541Sshin 3153541Sshin#include "gpio_regs.h" 32174510Sobrien 33174510Sobrien#define GENERIC_GPIO_REG_LIST_ENTRY(type, cd, id) \ 34174510Sobrien .type ## _reg = REG(DC_GPIO_GENERIC_## type),\ 3562587Sitojun .type ## _mask = DC_GPIO_GENERIC_ ## type ## __DC_GPIO_GENERIC ## id ## _ ## type ## _MASK,\ 3662587Sitojun .type ## _shift = DC_GPIO_GENERIC_ ## type ## __DC_GPIO_GENERIC ## id ## _ ## type ## __SHIFT 37225044Sbz 3855009Sshin#define GENERIC_GPIO_REG_LIST(id) \ 39148921Ssuz {\ 4053541Sshin GENERIC_GPIO_REG_LIST_ENTRY(MASK, cd, id),\ 4153541Sshin GENERIC_GPIO_REG_LIST_ENTRY(A, cd, id),\ 4253541Sshin GENERIC_GPIO_REG_LIST_ENTRY(EN, cd, id),\ 4378064Sume GENERIC_GPIO_REG_LIST_ENTRY(Y, cd, id)\ 4453541Sshin } 4553541Sshin 4653541Sshin#define GENERIC_REG_LIST(id) \ 4753541Sshin GENERIC_GPIO_REG_LIST(id), \ 4853541Sshin .mux = REG(DC_GENERIC ## id),\ 4953541Sshin 5078064Sume#define GENERIC_MASK_SH_LIST(mask_sh, cd) \ 5153541Sshin {(DC_GENERIC ## cd ##__GENERIC ## cd ##_EN## mask_sh),\ 5253541Sshin (DC_GENERIC ## cd ##__GENERIC ## cd ##_SEL## mask_sh)} 5353541Sshin 54225044Sbzstruct generic_registers { 5553541Sshin struct gpio_registers gpio; 5684994Sdarrenr uint32_t mux; 5753541Sshin}; 5853541Sshin 5953541Sshinstruct generic_sh_mask { 6078064Sume /* enable */ 6178064Sume uint32_t GENERIC_EN; 6262587Sitojun /* select */ 6378064Sume uint32_t GENERIC_SEL; 6462587Sitojun 6553541Sshin}; 66148385Sume 6762587Sitojun 6853541Sshin#endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_GPIO_GENERIC_REGS_H_ */ 6953541Sshin