Release 4.7 drivers/i2c/busses/i2c-acorn.c
  
  
/*
 *  linux/drivers/acorn/char/i2c.c
 *
 *  Copyright (C) 2000 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *  ARM IOC/IOMD i2c driver.
 *
 *  On Acorn machines, the following i2c devices are on the bus:
 *      - PCF8583 real time clock & static RAM
 */
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <asm/hardware/ioc.h>
#define FORCE_ONES	0xdc
#define SCL		0x02
#define SDA		0x01
/*
 * We must preserve all non-i2c output bits in IOC_CONTROL.
 * Note also that we need to preserve the value of SCL and
 * SDA outputs as well (which may be different from the
 * values read back from IOC_CONTROL).
 */
static u_int force_ones;
static void ioc_setscl(void *data, int state)
{
	u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA);
	u_int ones = force_ones;
	if (state)
		ones |= SCL;
	else
		ones &= ~SCL;
	force_ones = ones;
 	ioc_writeb(ioc_control | ones, IOC_CONTROL);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| russell king | russell king | 60 | 100.00% | 1 | 100.00% | 
 | Total | 60 | 100.00% | 1 | 100.00% | 
static void ioc_setsda(void *data, int state)
{
	u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA);
	u_int ones = force_ones;
	if (state)
		ones |= SDA;
	else
		ones &= ~SDA;
	force_ones = ones;
 	ioc_writeb(ioc_control | ones, IOC_CONTROL);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| russell king | russell king | 60 | 100.00% | 1 | 100.00% | 
 | Total | 60 | 100.00% | 1 | 100.00% | 
static int ioc_getscl(void *data)
{
	return (ioc_readb(IOC_CONTROL) & SCL) != 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| russell king | russell king | 22 | 100.00% | 1 | 100.00% | 
 | Total | 22 | 100.00% | 1 | 100.00% | 
static int ioc_getsda(void *data)
{
	return (ioc_readb(IOC_CONTROL) & SDA) != 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| russell king | russell king | 22 | 100.00% | 1 | 100.00% | 
 | Total | 22 | 100.00% | 1 | 100.00% | 
static struct i2c_algo_bit_data ioc_data = {
	.setsda		= ioc_setsda,
	.setscl		= ioc_setscl,
	.getsda		= ioc_getsda,
	.getscl		= ioc_getscl,
	.udelay		= 80,
	.timeout	= HZ,
};
static struct i2c_adapter ioc_ops = {
	.nr			= 0,
	.algo_data		= &ioc_data,
};
static int __init i2c_ioc_init(void)
{
	force_ones = FORCE_ONES | SCL | SDA;
	return i2c_bit_add_numbered_bus(&ioc_ops);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| russell king | russell king | 24 | 100.00% | 2 | 100.00% | 
 | Total | 24 | 100.00% | 2 | 100.00% | 
module_init(i2c_ioc_init);
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| russell king | russell king | 280 | 98.59% | 3 | 50.00% | 
| jean delvare | jean delvare | 2 | 0.70% | 1 | 16.67% | 
| paul gortmaker | paul gortmaker | 1 | 0.35% | 1 | 16.67% | 
| al viro | al viro | 1 | 0.35% | 1 | 16.67% | 
 | Total | 284 | 100.00% | 6 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.