Peng Fan | abeebc1 | 2018-10-18 14:28:25 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2018 NXP |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | f7ae49f | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 7 | #include <log.h> |
Peng Fan | abeebc1 | 2018-10-18 14:28:25 +0200 | [diff] [blame] | 8 | #include <asm/io.h> |
| 9 | #include <asm/arch/iomux.h> |
| 10 | #include <asm/arch/sci/sci.h> |
| 11 | |
| 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
| 14 | /* |
| 15 | * configures a single pad in the iomuxer |
| 16 | */ |
| 17 | void imx8_iomux_setup_pad(iomux_cfg_t pad) |
| 18 | { |
| 19 | sc_pad_t pin_id = pad & PIN_ID_MASK; |
| 20 | int ret; |
| 21 | |
| 22 | u32 val = (u32)((pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT); |
| 23 | |
| 24 | val |= PADRING_IFMUX_EN_MASK; |
| 25 | val |= PADRING_GP_EN_MASK; |
| 26 | |
| 27 | ret = sc_pad_set(-1, pin_id, val); |
| 28 | if (ret) |
| 29 | printf("sc_pad_set failed!, pin: %u, val: 0x%x\n", pin_id, val); |
| 30 | |
| 31 | debug("iomux: pin %d, val = 0x%x\n", pin_id, val); |
| 32 | } |
| 33 | |
| 34 | /* configures a list of pads within declared with IOMUX_PADS macro */ |
| 35 | void imx8_iomux_setup_multiple_pads(iomux_cfg_t const *pad_list, u32 count) |
| 36 | { |
| 37 | iomux_cfg_t const *p = pad_list; |
| 38 | int i; |
| 39 | |
| 40 | for (i = 0; i < count; i++) { |
| 41 | imx8_iomux_setup_pad(*p); |
| 42 | p++; |
| 43 | } |
| 44 | } |