Release 4.11 arch/arm/mach-imx/iomux-v1.c
/*
* arch/arm/plat-mxc/iomux-v1.c
*
* Copyright (C) 2004 Sascha Hauer, Synertronixx GmbH
* Copyright (C) 2009 Uwe Kleine-Koenig, Pengutronix
*
* Common code for i.MX1, i.MX21 and i.MX27
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/gpio.h>
#include <asm/mach/map.h>
#include "hardware.h"
#include "iomux-v1.h"
static void __iomem *imx_iomuxv1_baseaddr;
static unsigned imx_iomuxv1_numports;
static inline unsigned long imx_iomuxv1_readl(unsigned offset)
{
return imx_readl(imx_iomuxv1_baseaddr + offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 18 | 94.74% | 1 | 50.00% |
Johannes Berg | 1 | 5.26% | 1 | 50.00% |
Total | 19 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_writel(unsigned long val, unsigned offset)
{
imx_writel(val, imx_iomuxv1_baseaddr + offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 18 | 78.26% | 1 | 33.33% |
Juergen Beisert | 4 | 17.39% | 1 | 33.33% |
Johannes Berg | 1 | 4.35% | 1 | 33.33% |
Total | 23 | 100.00% | 3 | 100.00% |
static inline void imx_iomuxv1_rmwl(unsigned offset,
unsigned long mask, unsigned long value)
{
unsigned long reg = imx_iomuxv1_readl(offset);
reg &= ~mask;
reg |= value;
imx_iomuxv1_writel(reg, offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 34 | 79.07% | 1 | 50.00% |
Juergen Beisert | 9 | 20.93% | 1 | 50.00% |
Total | 43 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_puen(
unsigned int port, unsigned int pin, int on)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_PUEN(port), mask, on ? mask : 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 32 | 76.19% | 1 | 50.00% |
Juergen Beisert | 10 | 23.81% | 1 | 50.00% |
Total | 42 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_ddir(
unsigned int port, unsigned int pin, int out)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_DDIR(port), mask, out ? mask : 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 30 | 71.43% | 1 | 50.00% |
Juergen Beisert | 12 | 28.57% | 1 | 50.00% |
Total | 42 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_gpr(
unsigned int port, unsigned int pin, int af)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_GPR(port), mask, af ? mask : 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 30 | 71.43% | 1 | 50.00% |
Juergen Beisert | 12 | 28.57% | 1 | 50.00% |
Total | 42 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_gius(
unsigned int port, unsigned int pin, int inuse)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_GIUS(port), mask, inuse ? mask : 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 30 | 71.43% | 1 | 50.00% |
Juergen Beisert | 12 | 28.57% | 1 | 50.00% |
Total | 42 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_ocr(
unsigned int port, unsigned int pin, unsigned int ocr)
{
unsigned long shift = (pin & 0xf) << 1;
unsigned long mask = 3 << shift;
unsigned long value = ocr << shift;
unsigned long offset = pin < 16 ? MXC_OCR1(port) : MXC_OCR2(port);
imx_iomuxv1_rmwl(offset, mask, value);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 57 | 77.03% | 1 | 50.00% |
Juergen Beisert | 17 | 22.97% | 1 | 50.00% |
Total | 74 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_iconfa(
unsigned int port, unsigned int pin, unsigned int aout)
{
unsigned long shift = (pin & 0xf) << 1;
unsigned long mask = 3 << shift;
unsigned long value = aout << shift;
unsigned long offset = pin < 16 ? MXC_ICONFA1(port) : MXC_ICONFA2(port);
imx_iomuxv1_rmwl(offset, mask, value);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 56 | 75.68% | 1 | 50.00% |
Juergen Beisert | 18 | 24.32% | 1 | 50.00% |
Total | 74 | 100.00% | 2 | 100.00% |
static inline void imx_iomuxv1_set_iconfb(
unsigned int port, unsigned int pin, unsigned int bout)
{
unsigned long shift = (pin & 0xf) << 1;
unsigned long mask = 3 << shift;
unsigned long value = bout << shift;
unsigned long offset = pin < 16 ? MXC_ICONFB1(port) : MXC_ICONFB2(port);
imx_iomuxv1_rmwl(offset, mask, value);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 60 | 81.08% | 1 | 50.00% |
Juergen Beisert | 14 | 18.92% | 1 | 50.00% |
Total | 74 | 100.00% | 2 | 100.00% |
int mxc_gpio_mode(int gpio_mode)
{
unsigned int pin = gpio_mode & GPIO_PIN_MASK;
unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
unsigned int aout = (gpio_mode >> GPIO_AOUT_SHIFT) & 3;
unsigned int bout = (gpio_mode >> GPIO_BOUT_SHIFT) & 3;
if (port >= imx_iomuxv1_numports)
return -EINVAL;
/* Pullup enable */
imx_iomuxv1_set_puen(port, pin, gpio_mode & GPIO_PUEN);
/* Data direction */
imx_iomuxv1_set_ddir(port, pin, gpio_mode & GPIO_OUT);
/* Primary / alternate function */
imx_iomuxv1_set_gpr(port, pin, gpio_mode & GPIO_AF);
/* use as gpio? */
imx_iomuxv1_set_gius(port, pin, !(gpio_mode & (GPIO_PF | GPIO_AF)));
imx_iomuxv1_set_ocr(port, pin, ocr);
imx_iomuxv1_set_iconfa(port, pin, aout);
imx_iomuxv1_set_iconfb(port, pin, bout);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 122 | 76.73% | 2 | 66.67% |
Juergen Beisert | 37 | 23.27% | 1 | 33.33% |
Total | 159 | 100.00% | 3 | 100.00% |
static int imx_iomuxv1_setup_multiple(const int *list, unsigned count)
{
size_t i;
int ret = 0;
for (i = 0; i < count; ++i) {
ret = mxc_gpio_mode(list[i]);
if (ret)
return ret;
}
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 55 | 96.49% | 1 | 50.00% |
Fabio Estevam | 2 | 3.51% | 1 | 50.00% |
Total | 57 | 100.00% | 2 | 100.00% |
int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
const char *label)
{
int ret;
ret = imx_iomuxv1_setup_multiple(pin_list, count);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Juergen Beisert | 22 | 66.67% | 1 | 33.33% |
Sascha Hauer | 8 | 24.24% | 1 | 33.33% |
Uwe Kleine-König | 3 | 9.09% | 1 | 33.33% |
Total | 33 | 100.00% | 3 | 100.00% |
int __init imx_iomuxv1_init(void __iomem *base, int numports)
{
imx_iomuxv1_baseaddr = base;
imx_iomuxv1_numports = numports;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 16 | 64.00% | 2 | 66.67% |
Sascha Hauer | 9 | 36.00% | 1 | 33.33% |
Total | 25 | 100.00% | 3 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Uwe Kleine-König | 572 | 72.68% | 2 | 22.22% |
Juergen Beisert | 191 | 24.27% | 1 | 11.11% |
Sascha Hauer | 17 | 2.16% | 2 | 22.22% |
Shawn Guo | 3 | 0.38% | 2 | 22.22% |
Johannes Berg | 2 | 0.25% | 1 | 11.11% |
Fabio Estevam | 2 | 0.25% | 1 | 11.11% |
Total | 787 | 100.00% | 9 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.