u-boot-brain/arch/arm/mach-keystone/include/mach/mux-k2g.h
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00

58 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* K2G: Pinmux configuration
*
* (C) Copyright 2015
* Texas Instruments Incorporated, <www.ti.com>
*/
#ifndef __ASM_ARCH_MUX_K2G_H
#define __ASM_ARCH_MUX_K2G_H
#include <common.h>
#include <asm/io.h>
#define K2G_PADCFG_REG (KS2_DEVICE_STATE_CTRL_BASE + 0x1000)
/*
* 20:19 - buffer class RW fixed
* 18 - rxactive (Input enabled for the pad ) 0 - Di; 1 - En;
* 17 - pulltypesel (0 - PULLDOWN; 1 - PULLUP);
* 16 - pulluden (0 - PULLUP/DOWN EN; 1 - DI);
* 3:0 - muxmode (available modes 0:5)
*/
#define PIN_IEN (1 << 18) /* pin input enabled */
#define PIN_PDIS (1 << 16) /* pull up/down disabled */
#define PIN_PTU (1 << 17) /* pull up */
#define PIN_PTD (0 << 17) /* pull down */
#define MODE(m) ((m) & 0x7)
#define MAX_PIN_N 260
#define MUX_CFG(value, index) \
__raw_writel(\
(value) | \
(__raw_readl(K2G_PADCFG_REG + (index << 2)) & \
(0x3 << 19)),\
(K2G_PADCFG_REG + (index << 2))\
);
struct pin_cfg {
int reg_inx;
u32 val;
};
static inline void configure_pin_mux(struct pin_cfg *pin_mux)
{
if (!pin_mux)
return;
while ((pin_mux->reg_inx >= 0) && (pin_mux->reg_inx < MAX_PIN_N)) {
MUX_CFG(pin_mux->val, pin_mux->reg_inx);
pin_mux++;
}
}
#endif /* __ASM_ARCH_MUX_K2G_H */