2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com>
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/arch/hardware.h>
12 #include <asm/arch/sys_proto.h>
13 #include <asm/arch/clk.h>
16 * zynq_slcr_mio_get_status - Get the status of MIO peripheral.
18 * @peri_name: Name of the peripheral for checking MIO status
19 * @get_pins: Pointer to array of get pin for this peripheral
20 * @num_pins: Number of pins for this peripheral
22 * @check_val: Required check value to get the status of periph
24 struct zynq_slcr_mio_get_status {
25 const char *peri_name;
32 static const struct zynq_slcr_mio_get_status mio_periphs[] = {
36 * zynq_slcr_get_mio_pin_status - Get the MIO pin status of peripheral.
38 * @periph: Name of the peripheral
40 * Returns count to indicate the number of pins configured for the
43 int zynq_slcr_get_mio_pin_status(const char *periph)
45 const struct zynq_slcr_mio_get_status *mio_ptr;
49 for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) {
50 if (strcmp(periph, mio_periphs[i].peri_name) == 0) {
51 mio_ptr = &mio_periphs[i];
52 for (j = 0; j < mio_ptr->num_pins; j++) {
53 val = readl(&slcr_base->mio_pin
54 [mio_ptr->get_pins[j]]);
55 if ((val & mio_ptr->mask) == mio_ptr->check_val)