Release 4.9 drivers/net/wireless/ti/wl18xx/io.c
  
  
/*
 * This file is part of wl18xx
 *
 * Copyright (C) 2011 Texas Instruments
 *
 * 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.
 *
 * 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 "../wlcore/wlcore.h"
#include "../wlcore/io.h"
#include "io.h"
int wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val)
{
	u32 tmp;
	int ret;
	if (WARN_ON(addr % 2))
		return -EINVAL;
	if ((addr % 4) == 0) {
		ret = wlcore_read32(wl, addr, &tmp);
		if (ret < 0)
			goto out;
		tmp = (tmp & 0xffff0000) | val;
		ret = wlcore_write32(wl, addr, tmp);
	} else {
		ret = wlcore_read32(wl, addr - 2, &tmp);
		if (ret < 0)
			goto out;
		tmp = (tmp & 0xffff) | (val << 16);
		ret = wlcore_write32(wl, addr - 2, tmp);
	}
out:
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luciano coelho | luciano coelho | 100 | 68.03% | 1 | 33.33% | 
| ido yariv | ido yariv | 47 | 31.97% | 2 | 66.67% | 
 | Total | 147 | 100.00% | 3 | 100.00% | 
int wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out)
{
	u32 val = 0;
	int ret;
	if (WARN_ON(addr % 2))
		return -EINVAL;
	if ((addr % 4) == 0) {
		/* address is 4-bytes aligned */
		ret = wlcore_read32(wl, addr, &val);
		if (ret >= 0 && out)
			*out = val & 0xffff;
	} else {
		ret = wlcore_read32(wl, addr - 2, &val);
		if (ret >= 0 && out)
			*out = (val & 0xffff0000) >> 16;
	}
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luciano coelho | luciano coelho | 68 | 58.12% | 1 | 33.33% | 
| ido yariv | ido yariv | 47 | 40.17% | 1 | 33.33% | 
| arik nemtsov | arik nemtsov | 2 | 1.71% | 1 | 33.33% | 
 | Total | 117 | 100.00% | 3 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luciano coelho | luciano coelho | 178 | 64.96% | 1 | 25.00% | 
| ido yariv | ido yariv | 94 | 34.31% | 2 | 50.00% | 
| arik nemtsov | arik nemtsov | 2 | 0.73% | 1 | 25.00% | 
 | Total | 274 | 100.00% | 4 | 100.00% |