1 /* $OpenBSD: slcreg.h,v 1.1 2021/04/30 13:20:14 visa Exp $ */ 2 3 /* 4 * Copyright (c) 2021 Visa Hankala 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #define SLCR_LOCK 0x0004 20 #define SLCR_LOCK_KEY 0x767b 21 #define SLCR_UNLOCK 0x0008 22 #define SLCR_UNLOCK_KEY 0xdf0d 23 #define SLCR_ARM_PLL_CTRL 0x0100 24 #define SLCR_DDR_PLL_CTRL 0x0104 25 #define SLCR_IO_PLL_CTRL 0x0108 26 #define SLCR_PLL_CTRL_FDIV_MASK 0x7f 27 #define SLCR_PLL_CTRL_FDIV_SHIFT 12 28 #define SLCR_GEM0_CLK_CTRL 0x0140 29 #define SLCR_GEM1_CLK_CTRL 0x0144 30 #define SLCR_SDIO_CLK_CTRL 0x0150 31 #define SLCR_UART_CLK_CTRL 0x0154 32 #define SLCR_CLK_CTRL_DIVISOR1(x) (((x) >> 20) & 0x3f) 33 #define SLCR_CLK_CTRL_DIVISOR1_SHIFT 20 34 #define SLCR_CLK_CTRL_DIVISOR(x) (((x) >> 8) & 0x3f) 35 #define SLCR_CLK_CTRL_DIVISOR_SHIFT 8 36 #define SLCR_CLK_CTRL_SRCSEL_MASK (0x7 << 4) 37 #define SLCR_CLK_CTRL_SRCSEL_DDR (0x3 << 4) 38 #define SLCR_CLK_CTRL_SRCSEL_ARM (0x2 << 4) 39 #define SLCR_CLK_CTRL_SRCSEL_IO (0x1 << 4) 40 #define SLCR_CLK_CTRL_CLKACT(i) (0x1 << (i)) 41 #define SLCR_PSS_RST_CTRL 0x0200 42 #define SLCR_PSS_RST_CTRL_SOFT_RST (1 << 0) 43 44 #define SLCR_DIV_MASK 0x3f 45 46 extern struct mutex zynq_slcr_lock; 47 48 uint32_t zynq_slcr_read(struct regmap *, uint32_t); 49 void zynq_slcr_write(struct regmap *, uint32_t, uint32_t); 50