[linux-yocto] [PATCH 24/94] drivers/i2c: Collapse AI2C driver implementation - removing ai2c_*

Paul Butler butler.paul at gmail.com
Thu Nov 7 17:12:38 PST 2013


Signed-off-by: Paul Butler <paul.butler at windriver.com>
---
 drivers/i2c/busses/ai2c/ai2c_plat.c  | 758 -----------------------------------
 drivers/i2c/busses/ai2c/ai2c_plat.h  | 336 ----------------
 drivers/i2c/busses/ai2c/ai2c_sal.c   | 109 -----
 drivers/i2c/busses/ai2c/ai2c_sal.h   | 393 ------------------
 drivers/i2c/busses/ai2c/ai2c_types.h | 118 ------
 5 files changed, 1714 deletions(-)
 delete mode 100644 drivers/i2c/busses/ai2c/ai2c_plat.c
 delete mode 100644 drivers/i2c/busses/ai2c/ai2c_plat.h
 delete mode 100644 drivers/i2c/busses/ai2c/ai2c_sal.c
 delete mode 100644 drivers/i2c/busses/ai2c/ai2c_sal.h
 delete mode 100644 drivers/i2c/busses/ai2c/ai2c_types.h

diff --git a/drivers/i2c/busses/ai2c/ai2c_plat.c b/drivers/i2c/busses/ai2c/ai2c_plat.c
deleted file mode 100644
index 94f4445..0000000
--- a/drivers/i2c/busses/ai2c/ai2c_plat.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- *  Copyright (C) 2013 LSI Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*! @file ai2c_plat.c
-
-    @brief Linux driver implementation of I2C using the ACP I2C
-	   features upon an LSI development board (San Antonio,
-	   Mission, El Paso, ...)
-
-    @details Command line module parameters (with defaults) include,
-		int ai2c_trace_level = (AI2C_MSG_INFO | AI2C_MSG_ERROR);
-		int ai2c_chip_ver    = -1;
-			//Optional: Needed to figure out memory map, etc.
-			//Can verify against value from 0xa.0x10.0x2c
-			//Values; 0=X1_REL1
-			//	1=X1_REL2+
-			//	7=X7_REL1+
-
-    @details Several items contained in the 'i2c' section of the '.dts'
-	     are used to configure this module including the addresses of
-	     the memory partition, IRQ number, number of DMEs to use (when
-	     we want to override the inferences based on the chipType), etc.
-*/
-
-/*
-#define EXTENDED_GSDBG_INFO
-#define AI2C_EXTERNAL_BUILD
-
-#define CONFIG_LSI_UBOOTENV
-#define CONFIG_I2C
-#define AI2C_CHIP_VER=<verNum>
-*/
-
-#include "ai2c_bus.h"
-#include "regs/ai2c_cfg_node_reg_defines.h"
-#include "regs/ai2c_cfg_node_regs.h"
-#include "asm/lsi/acp_ncr.h"
-
-/*****************************************************************************
- * Local State
- *****************************************************************************/
-/*
- * This block of code defines the memory addresses for each h/w block
- * that is accessible as a direct bus i/o operation.
- *
- * IMPORTANT: ALL BUS GROUPINGS MUST BE MAINTAINED
- */
-static struct ai2c_dev_page_s ai2c_dev_page[AI2C_DEV_PAGE_END_MARKER] = {
-	{
-		AI2C_DEV_PAGE_I2C_0, "AXXIA_I2C0", 0, 0x00000000000ULL,
-		AI2C_DEV_SIZE_4KB, AI2C_DEV_ACCESS_LITTLE_ENDIAN,
-		AI2C_PAGE_FLAGS_I2CBUS, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_I2C_1, "AXXIA_I2C1", 0, 0x00000000000ULL,
-		AI2C_DEV_SIZE_4KB, AI2C_DEV_ACCESS_LITTLE_ENDIAN,
-		AI2C_PAGE_FLAGS_I2CBUS, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_I2C_2, "AXXIA_I2C2", 0, 0x00000000000ULL,
-		AI2C_DEV_SIZE_4KB, AI2C_DEV_ACCESS_LITTLE_ENDIAN,
-		AI2C_PAGE_FLAGS_I2CBUS, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_I2C_3, "AXXIA_SMB", 0, 0x00000000000ULL,
-		AI2C_DEV_SIZE_4KB, AI2C_DEV_ACCESS_LITTLE_ENDIAN,
-		AI2C_PAGE_FLAGS_I2CBUS, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_END_MARKER, NULL, 0, 0x00000000000ULL, 0, 0,
-		AI2C_PAGE_FLAGS_NONE, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_END_MARKER, NULL, 0, 0x00000000000ULL, 0, 0,
-		AI2C_PAGE_FLAGS_NONE, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_END_MARKER, NULL, 0, 0x00000000000ULL, 0, 0,
-		AI2C_PAGE_FLAGS_NONE, NULL,
-	},
-	{
-		AI2C_DEV_PAGE_END_MARKER, NULL, 0, 0x00000000000ULL, 0, 0,
-		AI2C_PAGE_FLAGS_NONE, NULL,
-	},
-};
-
-static struct ai2c_dev_chip_entry_s ai2c_chip_id[] = {
-	{ AI2C_CHIP_ACP55xx, "AXM55xx", 4, &ai2c_axm5500_cfg, },
-	{ AI2C_CHIP_ACP35xx, "AXM35xx", 3, &ai2c_axm5500_cfg, },
-};
-
-static u32 ai2c_chip_id_count = sizeof(ai2c_chip_id)/
-				sizeof(struct ai2c_dev_chip_entry_s);
-
-	/* Region Map
-	 *   Note: Must be same number of entries (and in same order) as
-	 *	 the "AI2C_DEV_PAGE_xxx" enumeration.
-	 */
-
-static struct ai2c_access_map ai2cDummyRegionMap[] = AI2C_DUMMY_REGION_MAP_INIT;
-
-static struct ai2c_region_io ai2c_region_io_map[] = {
-	/* 323.0 */
-	{
-		AI2C_REGION_I2C_0, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_I2C_0,
-	},
-	/* 332.0 */
-	{
-		AI2C_REGION_I2C_1, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_I2C_1,
-	},
-	/* 332.0 */
-	{
-		AI2C_REGION_I2C_2, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_I2C_2,
-	},
-	/* 348.0 */
-	{
-		AI2C_REGION_I2C_3, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_I2C_3,
-	},
-	/* 320.0 */
-	{
-		AI2C_REGION_GPIO_0, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_GPIO_0,
-	},
-	/* 398.0 */
-	{
-		AI2C_REGION_RESET_CTRL, ai2cDummyRegionMap,
-		__ai2c_dev_dcr_read, __ai2c_dev_dcr_write,
-		AI2C_DEV_PAGE_RESET_CTRL,
-	},
-	/* 326.0 */
-	{
-		AI2C_REGION_TIMER, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_TIMER,
-	},
-	/* 329.0 */
-	{
-		AI2C_REGION_GPREG, ai2cDummyRegionMap,
-		__ai2c_dev_direct_read, __ai2c_dev_direct_write,
-		AI2C_DEV_PAGE_GPREG,
-	},
-};
-
-static const u32 ai2c_region_pages_max =
-	sizeof(ai2c_region_io_map) / sizeof(struct ai2c_region_io);
-
-
-/*****************************************************************************
- * Miscellaneous Utility functions
- *****************************************************************************/
-
-u32 ai2c_page_to_region(
-	struct ai2c_priv	  *priv,
-	u32	 pageId)
-{
-	int i;
-	for (i = 0; i < ai2c_region_pages_max; i++)
-		if (pageId == ai2c_region_io_map[i].pageId)
-			return ai2c_region_io_map[i].regionId;
-	return AI2C_REGION_NULL;
-}
-
-struct ai2c_region_io *ai2c_region_lookup(
-	struct ai2c_priv	  *priv,
-	u32      regionId)
-{
-	int i;
-	for (i = 0; i < ai2c_region_pages_max; i++)
-		if (regionId == ai2c_region_io_map[i].regionId)
-			return &ai2c_region_io_map[i];
-	return NULL;
-}
-
-/*****************************************************************************
- * Read/Write ACP Memory Spaces
- *****************************************************************************/
-
-/*
- * ai2c_dev_direct_read
- *
- *   Perform 32-bit AI2C device I/O to non-ConfigRing region.
- */
-int ai2c_dev_direct_read(
-	struct ai2c_priv        *priv,
-	struct ai2c_region_io   *region,
-	u64	offset,
-	u32      *buffer,
-	u32	count,
-	u32	flags,
-	u32	cmdType,
-	u32	xferWidth)
-{
-	int           st = 0;
-	u32       endianness;
-	unsigned long       busAddr;
-	u32       i;
-
-	AI2C_MSG(AI2C_MSG_ENTRY,
-		"direct_read enter: %x.%x.%llx %d\n",
-		AI2C_NODE_ID(region->regionId),
-		AI2C_TARGET_ID(region->regionId),
-		(unsigned long long) offset, count);
-
-	if (priv->pageAddr[region->pageId] == 0) {
-		st = -EBADSLT;
-		goto cleanup;
-	}
-
-	busAddr = AI2C_DEV_BUS_ADDR(priv, region->pageId, offset);
-	endianness = AI2C_DEV_PAGE_ENDIANNESS(region->pageId);
-
-	switch (xferWidth) {
-	case 4:
-		for (i = 0; i < count; i++, busAddr += 4, offset += 4) {
-			buffer[i] = AI2C_BUS_READ32(busAddr, endianness);
-			AI2C_MSG(AI2C_MSG_IOR,
-				"direct_read: region=%x offset = %llx "
-				"busAddr=%lx v=%x\n",
-				region->regionId, offset, busAddr, buffer[i]);
-		}
-		break;
-	case 2:
-		{
-			u16 *p16 = (u16 *) buffer;
-			for (i = 0; i < count; i++, busAddr += 2)
-				p16[i] = AI2C_BUS_READ16(busAddr, endianness);
-		}
-		break;
-	case 1:
-		{
-			u8 *p8 = (u8 *) buffer;
-			for (i = 0; i < count; i++, busAddr += 1)
-				p8[i] = AI2C_BUS_READ8(busAddr);
-		}
-		break;
-	default:
-		st = -EACCES;
-		break;
-	}
-
-cleanup:
-	AI2C_MSG(AI2C_MSG_EXIT,
-		"direct_read exit: st=%d %x.%x.%llx=0x%08x\n",
-		st, AI2C_NODE_ID(region->regionId),
-		AI2C_TARGET_ID(region->regionId), (unsigned long long) offset,
-		buffer[0]);
-	return (int) st;
-}
-
-/*
- * ai2c_dev_direct_write
- *
- *   Perform 32-bit AI2C device I/O to non-ConfigRing region.
- */
-int ai2c_dev_direct_write(
-	struct ai2c_priv        *priv,
-	struct ai2c_region_io   *region,
-	u64	offset,
-	u32      *buffer,
-	u32	count,
-	u32	flags,
-	u32	cmdType,
-	u32	xferWidth)
-{
-	int           st = 0;
-	u32       endianness;
-	unsigned long       busAddr;
-	u32       i;
-
-	AI2C_MSG(AI2C_MSG_ENTRY,
-		"direct_write enter: %x.%x.%llx 0x%08x (%d)\n",
-		AI2C_NODE_ID(region->regionId),
-		AI2C_TARGET_ID(region->regionId),
-		(unsigned long long) offset,
-		buffer[0], count);
-
-	if (priv->pageAddr[region->pageId] == 0) {
-		st = -EBADSLT;
-		goto cleanup;
-	}
-
-	busAddr = AI2C_DEV_BUS_ADDR(priv, region->pageId, offset);
-	endianness = AI2C_DEV_PAGE_ENDIANNESS(region->pageId);
-
-	switch (xferWidth) {
-	case 4:
-		for (i = 0; i < count; i++, busAddr += 4, offset += 4) {
-			AI2C_BUS_WRITE32(busAddr, buffer[i], endianness);
-			AI2C_MSG(AI2C_MSG_IOW,
-				"direct_write: region=%x offset=%llx "
-				"busAddr=%lx v=%x\n",
-				region->regionId, offset, busAddr, buffer[i]);
-		}
-		break;
-
-	case 2:
-		{
-			u16 *buf16 = (u16 *) buffer;
-			for (i = 0; i < count; i++, busAddr += 2) {
-				AI2C_BUS_WRITE16(busAddr, buf16[i], endianness);
-				AI2C_MSG(AI2C_MSG_IOW,
-					"direct_write: region=%x offset=%llx "
-					"busAddr=%lx v=%x\n",
-					region->regionId,
-					offset, busAddr, buf16[i]);
-			}
-		}
-		break;
-	case 1:
-		{
-			u8 *buf8 = (u8 *) buffer;
-			for (i = 0; i < count; i++, busAddr++) {
-				AI2C_BUS_WRITE8(busAddr, buf8[i]);
-				AI2C_MSG(AI2C_MSG_IOW,
-					"direct_write: region=%x offset=%llx "
-					"busAddr=%lx v=%x\n",
-					region->regionId,
-					offset, busAddr, buf8[i]);
-			}
-		}
-		break;
-	default:
-		st = -EACCES;
-		break;
-	}
-
-cleanup:
-	AI2C_MSG(AI2C_MSG_EXIT, "direct_write exit st=%d\n", st);
-	return (int) st;
-}
-
-/*
- * ai2c_dev_read32
- *
- */
-int ai2c_dev_read32(
-	struct ai2c_priv         *priv,
-	u32     regionId,
-	u64        offset,
-	u32       *buffer)
-{
-	int	ai2cStatus = 0;
-	struct ai2c_region_io *region = ai2c_region_lookup(priv, regionId);
-	unsigned long lflags = 0;
-
-	AI2C_SPINLOCK_INTERRUPT_DISABLE(&priv->regLock, lflags);
-
-	AI2C_MSG(AI2C_MSG_ENTRY,
-		"dev_read32 enter: %x.%x.%llx %d\n",
-		AI2C_NODE_ID(regionId), AI2C_TARGET_ID(regionId),
-		(unsigned long long) offset, 1);
-
-	if (region) {
-		ai2cStatus =
-			AI2C_EDEV_BUS_BLOCK_READ32(priv,
-				region->pageId, offset, 1, buffer);
-
-	} else {
-
-#ifdef CONFIG_LSI_UBOOTENV
-		ai2cStatus = ncr_read(regionId, (u32) offset,
-			1 * sizeof(u32), buffer);
-#else
-		ai2cStatus = -ENOSYS;
-#endif
-	}
-
-	AI2C_SPINLOCK_INTERRUPT_ENABLE(&priv->regLock, lflags);
-
-	return ai2cStatus;
-}
-
-/*
- * ai2c_dev_write32
- *
- */
-int ai2c_dev_write32(
-	struct ai2c_priv         *priv,
-	u32     regionId,
-	u64        offset,
-	u32        buffer)
-{
-	int ai2cStatus = 0;
-	struct ai2c_region_io    *region = ai2c_region_lookup(priv, regionId);
-	unsigned long lflags = 0;
-
-	AI2C_SPINLOCK_INTERRUPT_DISABLE(&priv->regLock, lflags);
-
-	AI2C_MSG(AI2C_MSG_ENTRY,
-		"dev_write32 enter: %x.%x.%llx 0x%08x (%d)\n",
-		AI2C_NODE_ID(regionId), AI2C_TARGET_ID(regionId),
-		(unsigned long long) offset, (unsigned int)&buffer, 1);
-
-	if (region) {
-		ai2cStatus =
-			AI2C_EDEV_BUS_BLOCK_WRITE32(priv,
-				region->pageId, offset, 1,
-			&buffer);
-
-	} else {
-
-#ifdef CONFIG_LSI_UBOOTENV
-	ai2cStatus = ncr_write(regionId, (u32) offset,
-		1 * sizeof(u32), &buffer);
-#else
-	ai2cStatus = -ENOSYS;
-#endif
-	}
-
-	AI2C_SPINLOCK_INTERRUPT_ENABLE(&priv->regLock, lflags);
-
-	return ai2cStatus;
-}
-
-/*
- * ai2c_dev_dcr_read
- *
- *   Perform 32-bit AI2C device I/O to non-Config Ring region.
- */
-int ai2c_dev_dcr_read(
-	struct ai2c_priv      *priv,
-	struct ai2c_region_io *region,
-	u64	  offset,
-	u32    *buffer,
-	u32	  count,
-	u32	  flags,
-	u32	  cmdType,
-	u32	  xferWidth)
-{
-	return -ENOSYS;
-}
-
-/*
- * ai2c_dev_dcr_write
- *
- *   Perform 32-bit AI2C device I/O from non-Config Ring region.
- */
-int ai2c_dev_dcr_write(
-	struct ai2c_priv         *priv,
-	struct ai2c_region_io    *region,
-	u64	offset,
-	u32       *buffer,
-	u32	count,
-	u32	flags,
-	u32	cmdType,
-	u32	xferWidth)
-{
-	return -ENOSYS;
-}
-
-
-/*****************************************************************************
- * Basic configuration Fill-in
- *****************************************************************************/
-
-static int ai2c_getChipType(struct ai2c_priv *priv)
-{
-	int            ai2cStatus = AI2C_ST_SUCCESS;
-	u32	       i;
-#ifdef CONFIG_LSI_UBOOTENV
-	ai2c_bool_t    has_ECID = TRUE;
-	u32	       rev_reg;
-	u32	       pt_reg;
-	ai2c_cfg_node_node_cfg_r_t  node_cfg;
-	ai2c_cfg_node_node_info_0_r_t node_info;
-
-	/*
-	 * Determine device revision
-	 */
-
-	/* Read the NCA local config node to see if we are an ASIC or FPGA */
-	AI2C_CALL(ai2c_dev_read32(priv, AI2C_REGION_NCA_CFG,
-		AI2C_CFG_NODE_NODE_CFG,
-		(u32 *) &node_cfg));
-	AI2C_CALL(ai2c_dev_read32(priv, AI2C_REGION_NCA_CFG,
-		AI2C_CFG_NODE_NODE_INFO_0,
-		(u32 *) &node_info));
-
-	if (node_cfg.fpga) {
-		priv->hw_rev.isFpga = 1;
-		/* v1 FPGA doesn't have the ECID block */
-		if (node_info.module_revision == 0)
-			has_ECID = FALSE;
-
-	} else
-		priv->hw_rev.isAsic = 1;
-
-	if (node_info.module_revision == AI2C_CHIP_ACP25xx ||
-	    node_info.module_revision == AI2C_CHIP_ACP55xx)
-		has_ECID = FALSE;
-
-	/* Get the device chipType/Version from the ECID fuse block */
-	if (has_ECID) {
-
-		AI2C_CALL(ai2c_dev_read32(priv,
-			AI2C_REGION_ID(AI2C_NODE_X1_ECID, 0x10),
-			0x2c, (u32 *) &rev_reg));
-
-		AI2C_CALL(ai2c_dev_read32(priv,
-			AI2C_REGION_ID(AI2C_NODE_X1_ECID, 0x10),
-			0x20, &pt_reg));
-
-		priv->hw_rev.chipType = (rev_reg & 0x0000001f);
-		priv->hw_rev.chipVersion = (rev_reg & 0x000007e0) >> 5;
-		priv->hw_rev.cpuDisable = (rev_reg & 0x00007800) >> 11;
-		priv->hw_rev.sppDisable = (rev_reg & 0x00008000) >> 15;
-
-		priv->hw_rev.packageType = (pt_reg & 0xf0000000) >> 28;
-	} else {
-		/* if we don't have an ECID just use the NCA module version */
-		priv->hw_rev.chipType = node_info.module_revision;
-		priv->hw_rev.chipVersion = 0;
-		priv->hw_rev.packageType = 0;
-		priv->hw_rev.cpuDisable = 0;
-		priv->hw_rev.sppDisable = 0;
-	}
-
-	/* fixup chipType for ACP344x variants */
-	switch (priv->hw_rev.chipType) {
-	case 3:
-	case 4:
-		priv->hw_rev.chipType = AI2C_CHIP_ACP34xx;
-		break;
-	case 5:
-		priv->hw_rev.chipType = AI2C_CHIP_ACP34xx;
-		break;
-	default:
-		break;
-	}
-#endif
-
-	/* Environment variable override */
-	if (ai2c_chip_ver != -1) {
-		priv->hw_rev.chipType    = ai2c_chip_ver;
-		priv->hw_rev.chipVersion = 0;
-	}
-#ifdef AI2C_CHIP_VER
-	else {
-		priv->hw_rev.chipType    = AI2C_CHIP_VER;
-		priv->hw_rev.chipVersion = 0;
-	}
-#endif
-
-	for (i = 0; i < ai2c_chip_id_count; i++) {
-		if (ai2c_chip_id[i].chipType == priv->hw_rev.chipType) {
-			priv->busCfg = &ai2c_chip_id[i];
-			priv->numActiveBusses = ai2c_chip_id[i].numActiveBusses;
-		}
-	}
-	if (priv->busCfg == NULL) {
-		ai2cStatus = -ENXIO;
-		goto ai2c_return;
-	}
-
-	AI2C_LOG(AI2C_MSG_INFO, "%s %d.%d.%d %s\n",
-		priv->busCfg->chipName,
-		priv->hw_rev.chipType, priv->hw_rev.chipVersion,
-		priv->hw_rev.packageType,
-		(priv->hw_rev.isFpga) ? "FPGA" : "ASIC");
-
-ai2c_return:
-	return ai2cStatus;
-}
-
-int ai2c_stateSetup(struct ai2c_priv **outPriv)
-{
-	int                     ai2cStatus = AI2C_ST_SUCCESS;
-	struct ai2c_priv        *priv = NULL;
-
-	/* Now for the private memory for this module. */
-	priv = ai2c_malloc(sizeof(struct ai2c_priv));
-	if (!priv) {
-		AI2C_LOG(AI2C_MSG_ERROR,
-			"Could not allocate AI2C private memory root!\n");
-		ai2cStatus = -ENOMEM;
-		goto ai2c_return;
-	}
-	memset(priv, 0, sizeof(struct ai2c_priv));
-
-	/* Check chipType/chipVersion fields of 0xa.0x10.0x2c, first */
-	ai2cStatus = ai2c_getChipType(priv);
-	if (ai2cStatus != AI2C_ST_SUCCESS)
-		goto ai2c_return;
-
-ai2c_return:
-	if (ai2cStatus != AI2C_ST_SUCCESS)
-		(*outPriv) = NULL;
-	else
-		(*outPriv) = priv;
-
-	return ai2cStatus;
-}
-
-int ai2c_memSetup(
-	struct platform_device      *pdev,
-	struct ai2c_priv            *priv)
-{
-	int                     ai2cStatus = AI2C_ST_SUCCESS;
-	struct axxia_i2c_bus_platform_data  *pdata;
-	u32                     busNdx;
-	int                     i;
-
-	/* Where is the current I2C device found on this platform? */
-	pdata = (struct axxia_i2c_bus_platform_data *) pdev->dev.platform_data;
-	if (pdata == NULL) {
-		AI2C_LOG(AI2C_MSG_ERROR,
-			"Can't find platform-specific data!\n");
-		ai2cStatus = -ENXIO;
-		goto ai2c_return;
-	}
-	busNdx = pdata->index;
-
-	priv->pages = ai2c_dev_page;
-
-	if (busNdx > (priv->numActiveBusses-1)) {
-		AI2C_LOG(AI2C_MSG_ERROR, "Invalid I2C bus index (%d)\n",
-			busNdx);
-		ai2cStatus = -ENXIO;
-		goto ai2c_return;
-	}
-
-	priv->pages[busNdx].busName = &pdata->name[0];
-	priv->pages[busNdx].bus_nr  = pdata->bus_nr;
-	priv->pages[busNdx].busAddr = pdata->dev_space.start;
-	priv->pages[busNdx].size    =
-		pdata->dev_space.end - pdata->dev_space.start + 1;
-	priv->pages[busNdx].pdata   = pdata;
-
-	AI2C_LOG(AI2C_MSG_DEBUG,
-		"[%d] ba=0x%010llx (%llx, %llx) sz=0x%x\n",
-		busNdx,
-		priv->pages[busNdx].busAddr,
-		pdata->dev_space.start, pdata->dev_space.end,
-		priv->pages[busNdx].size);
-
-	/*
-	* Interrupt for this bus is in priv->pdata[i].int_space.start
-	*/
-
-
-	/*
-	* Program Address Map driver tables
-	*/
-	if (priv->pageAddr == NULL) {
-		priv->pageAddr =
-			ai2c_malloc(AI2C_DEV_PAGE_END_MARKER * sizeof(u32));
-		if (priv->pageAddr == NULL) {
-			AI2C_LOG(AI2C_MSG_ERROR,
-				"Could not allocate AI2C pageAddr memory!\n");
-			ai2cStatus = -ENOMEM;
-			goto ai2c_return;
-		}
-		memset(priv->pageAddr, 0,
-			AI2C_DEV_PAGE_END_MARKER * sizeof(u32));
-	}
-
-	for (i = 0; i < AI2C_DEV_PAGE_END_MARKER; i++) {
-
-		if (priv->pageAddr[i] ||
-		    (priv->pages[i].busAddr == 0) ||
-		    (priv->pages[i].size == 0) ||
-		    (priv->pages[i].pageId == AI2C_DEV_PAGE_END_MARKER))
-			continue;
-
-		priv->pageAddr[i] =
-			(u32) ioremap(priv->pages[i].busAddr,
-					priv->pages[i].size);
-		if (priv->pageAddr[i] == 0) {
-			AI2C_LOG(AI2C_MSG_ERROR,
-				"Could not ioremap AI2C pageAddr memory %d!\n",
-				i);
-			AI2C_LOG(AI2C_MSG_DEBUG,
-				"ba=0x%010llx sz=0x%x\n",
-				priv->pages[i].busAddr,
-				priv->pages[i].size);
-			ai2cStatus = -ENOMEM;
-			goto ai2c_return;
-		} else {
-			AI2C_LOG(AI2C_MSG_DEBUG,
-				"Map page %d (%08x) / %llx for %x => %x\n",
-				priv->pages[i].pageId,
-				ai2c_page_to_region(priv,
-						priv->pages[i].pageId),
-				(unsigned long long) priv->pages[i].busAddr,
-				priv->pages[i].size,
-				priv->pageAddr[i]);
-		}
-	}
-
-	AI2C_SPINLOCK_INIT(&priv->regLock);
-	AI2C_SPINLOCK_INIT(&priv->ioLock);
-
-ai2c_return:
-
-	if (ai2cStatus != AI2C_ST_SUCCESS) {
-		if (priv) {
-			if (priv->pageAddr) {
-				for (i = 0; i < AI2C_DEV_PAGE_END_MARKER; i++)
-					if (priv->pageAddr[i] != 0)
-						iounmap(
-						    (void __iomem *)
-						    priv->pageAddr[i]);
-				ai2c_free(priv->pageAddr);
-			}
-			ai2c_free(priv);
-		}
-	}
-
-	return ai2cStatus;
-}
-
-int ai2c_memDestroy(struct ai2c_priv *inPriv)
-{
-	int	    ai2cStatus = AI2C_ST_SUCCESS;
-	int         i;
-
-	if (inPriv) {
-		if (inPriv->pageAddr) {
-			for (i = 0; i < AI2C_DEV_PAGE_END_MARKER; i++)
-				if (inPriv->pageAddr[i] != 0)
-					iounmap((void *)inPriv->pageAddr[i]);
-
-			ai2c_free(inPriv->pageAddr);
-		}
-
-		ai2c_free(inPriv);
-	}
-
-	return ai2cStatus;
-}
diff --git a/drivers/i2c/busses/ai2c/ai2c_plat.h b/drivers/i2c/busses/ai2c/ai2c_plat.h
deleted file mode 100644
index 54e6c5b..0000000
--- a/drivers/i2c/busses/ai2c/ai2c_plat.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- *  Copyright (C) 2013 LSI Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef _AI2C_LINUX_H_
-#define _AI2C_LINUX_H_
-
-#include <linux/i2c.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/i2c-axxia.h>
-
-#include "ai2c_sal.h"
-#include "ai2c_dev.h"
-
-/**************************************************************************
-* Constants                                                               *
-**************************************************************************/
-
-/**********************************************************************
-* ACP I/O Mapped Functions Stuff                                      *
-**********************************************************************/
-
-#define  __ai2c_dev_direct_read          ai2c_dev_direct_read
-#define  __ai2c_dev_direct_write         ai2c_dev_direct_write
-#define  __ai2c_dev_indirect_read        ai2c_dev_indirect_read
-#define  __ai2c_dev_indirect_write       ai2c_dev_indirect_write
-#define  __ai2c_dev_dcr_read             ai2c_dev_dcr_read
-#define  __ai2c_dev_dcr_write            ai2c_dev_dcr_write
-
-/*
- * Enumeration of pages/regions tracked by this driver.
- */
-enum {
-	AI2C_DEV_PAGE_AHB_BEGIN,             /* Placeholder (0/1) */
-	AI2C_DEV_PAGE_I2C_0   = AI2C_DEV_PAGE_AHB_BEGIN,
-	AI2C_DEV_PAGE_I2C_1,
-	AI2C_DEV_PAGE_I2C_2,
-	AI2C_DEV_PAGE_I2C_3                 /* aka SMB */,
-	AI2C_DEV_PAGE_GPIO_0,
-	AI2C_DEV_PAGE_RESET_CTRL,
-	AI2C_DEV_PAGE_TIMER,
-	AI2C_DEV_PAGE_GPREG,
-	AI2C_DEV_PAGE_AHB_END = AI2C_DEV_PAGE_GPREG,
-
-	AI2C_DEV_PAGE_END_MARKER,
-};
-
-#undef  AI2C_DEV_APB_PAGE_BASE
-#define AI2C_DEV_APB_PAGE_BASE           AI2C_DEV_PAGE_AHB_BEGIN
-
-
-/**************************************************************************
-* Macros                                                                  *
-**************************************************************************/
-
-    /*************************************************************************
-     * I/O Macros
-     *************************************************************************/
-
-#define AI2C_EDEV_BUS_READ32(dev, p, o, var) \
-	ai2c_region_io_map[p].readFn(dev, &ai2c_region_io_map[p], \
-	o, (var), 1, 0, AI2C_NCA_CMD_CRBR, 4)
-
-#define AI2C_EDEV_BUS_BLOCK_READ32(dev, p, o, cnt, var) \
-	ai2c_region_io_map[p].readFn(dev, &ai2c_region_io_map[p], \
-	o, (var), cnt, 0, AI2C_NCA_CMD_CRBR, 4)
-
-#define AI2C_EDEV_BUS_WRITE32(dev, p, o, var) \
-	ai2c_region_io_map[p].writeFn(dev, &ai2c_region_io_map[p], \
-	o, (var), 1, 0, AI2C_NCA_CMD_CRBW, 4)
-
-#define AI2C_EDEV_BUS_BLOCK_WRITE32(dev, p, o, cnt, var) \
-	ai2c_region_io_map[p].writeFn(dev, &ai2c_region_io_map[p], \
-	o, (var), cnt, 0, AI2C_NCA_CMD_CRBW, 4)
-
-    /*************************************************************************
-     * Debug Macros
-     *************************************************************************/
-
-#define DBGINFO(args...)
-	/* General debugging */
-#define XDBGINFO(args...)
-	/* Miscellaneous debugging, commented out */
-#define ADBGINFO(args...)
-	/* Address debugging */
-#define D1DBGINFO(args...)
-	/* Track descriptor chain register modifications */
-#define D2DBGINFO(args...)
-	/* Track descriptor chain tracking modifications */
-#define D3DBGINFO(args...)
-	/* Track descriptor chain reset modifications */
-#define D4DBGINFO(args...)
-	/* Track dme+descriptor chain modifications */
-#define ODBGINFO(args...)
-	/* Track tx irq transaction */
-#define O2DBGINFO(args...)
-	/* Track tx foreground transaction */
-#define O3DBGINFO(args...)
-	/* Track numFree changes for tx transaction */
-#define IDBGINFO(args...)
-	/* Track rx irq transaction */
-#define I2DBGINFO(args...)
-	/* Track rx foreground transaction */
-#define I3DBGINFO(args...)
-	/* Track numFree changes for rx transaction */
-#define SDBGINFO(args...)
-	/* Track dme select/release */
-#define DDBGINFO(args...)
-	/* Track dbell irq transaction */
-#define EIDBGINFO(args...)
-	/* Track enable/disable irqs */
-#define GSDBGINFO(args...)      printk(args)
-	/* Dump lots of data to console during get_glob_stat */
-#undef MDBG_SUPPORT
-#ifdef MDBG_SUPPORT
-	#define MDBGINFO(args...)   printk(args)
-	/* Track maintenance accesses */
-#else
-	#define MDBGINFO(args...)
-#endif
-
-    /**********************************************************************
-    * Macros for Paged Sysmem Access Methods                              *
-    **********************************************************************/
-
-#define AI2C_EDEV_BUS_PAGE_SHIFT 18
-#define AI2C_EDEV_BUS_PAGE_SIZE ((u64) 1 << AI2C_EDEV_BUS_PAGE_SHIFT)
-
-#define AI2C_EDEV_BUS_PAGE_MASK (AI2C_EDEV_BUS_PAGE_SIZE - 1)     /* ??? */
-#define AI2C_EDEV_BUS_PAGE_OFFSET(x) \
-	((u32) (((x) & (~AI2C_EDEV_BUS_PAGE_MASK)) >> \
-	AI2C_EDEV_BUS_PAGE_SHIFT))  /* ??? */
-
-
-/**********************************************************************
-* Low-level I/O based upon 'page'                                     *
-**********************************************************************/
-
-#define AI2C_DEV_BUS_ADDR(dev, pageId, offset) \
-	((dev)->pageAddr[pageId] + offset)
-
-#define AI2C_DEV_PAGE_ENDIANNESS(pageId) (priv->pages[pageId].endianness)
-
-
-/**************************************************************************
-* Type Definitions                                                        *
-**************************************************************************/
-
-    /**********************************************************************
-    * Support Memory Mappings for Driver State Structure                  *
-    **********************************************************************/
-
-#define AI2C_PAGE_FLAGS_NONE            (0x00000000)
-#define AI2C_PAGE_FLAGS_I2CBUS          (0x00000001)
-
-struct ai2c_dev_page_s {
-	int    pageId;
-	char   *busName;
-	u32    bus_nr;
-	u64    busAddr; /* 38-bit PCI address */
-	u32    size;
-	u32    endianness;
-	u32    flags;
-	struct axxia_i2c_bus_platform_data  *pdata;
-};
-
-struct ai2c_dev_chip_entry_s {
-	u32	chipType;
-	char	*chipName;
-	u32	numActiveBusses;
-	struct ai2c_i2c_access *api;
-};
-
-
-    /**********************************************************************
-    * Driver State Structure                                              *
-    **********************************************************************/
-
-struct ai2c_priv {
-	spinlock_t regLock;
-	spinlock_t ioLock;
-
-	struct ai2c_rev_id hw_rev;
-
-	/* Static configuration describing selected ACP I2C bus region */
-	struct ai2c_dev_chip_entry_s *busCfg;
-
-	/* Memory Mapping/Management constructs */
-	u32 numActiveBusses;
-	struct ai2c_dev_page_s *pages;
-	/* Per module memory pages */
-
-	/* Memory indexing support to reach selected ACP regions */
-	u32 *pageAddr;
-
-	/* Diagnostics */
-};
-
-/**************************************************************************
-* Exportable State                                                        *
-**************************************************************************/
-
-extern int     AI2C_MSG_TRACE_LEVEL;
-
-extern int     ai2c_chip_ver;
-
-
-/**************************************************************************
-* Exportable Functions                                                    *
-**************************************************************************/
-
-extern int ai2c_dev_read32(
-	struct ai2c_priv         *dev,
-	u32	regionId,
-	u64        offset,
-	u32       *buffer);
-
-extern int ai2c_dev_write32(
-	struct ai2c_priv         *dev,
-	u32        regionId,
-	u64        offset,
-	u32        buffer);
-
-int ai2c_dev_direct_read(
-	struct ai2c_priv      *priv,
-	struct ai2c_region_io *region,
-	u64     offset,
-	u32    *buffer,
-	u32     count,
-	u32     flags,
-	u32     cmdType,
-	u32     xferWidth);
-
-int ai2c_dev_direct_write(
-	struct ai2c_priv      *priv,
-	struct ai2c_region_io *region,
-	u64     offset,
-	u32    *buffer,
-	u32     count,
-	u32     flags,
-	u32     cmdType,
-	u32     xferWidth);
-
-int ai2c_dev_dcr_read(
-	struct ai2c_priv      *priv,
-	struct ai2c_region_io *region,
-	u64     offset,
-	u32    *buffer,
-	u32     count,
-	u32     flags,
-	u32     cmdType,
-	u32     xferWidth);
-
-int ai2c_dev_dcr_write(
-	struct ai2c_priv      *priv,
-	struct ai2c_region_io *region,
-	u64     offset,
-	u32    *buffer,
-	u32     count,
-	u32     flags,
-	u32     cmdType,
-	u32     xferWidth);
-
-/*****************************************************************************
-* Externally Visible Function Prototypes				     *
-*****************************************************************************/
-
-/*! @fn u32 ai2c_page_to_region(struct ai2c_priv *priv,
- *                                           u32 pageId);
- *  @brief Map a memory page handle to a regionId handle.
-    @param[in] inPriv Created device state structure
-    @param[in] inPageId Original page id to be mapped
-    @Returns mapped value
- */
-extern u32 ai2c_page_to_region(struct ai2c_priv *priv, u32 pageId);
-
-/*! @fn u32 *ai2c_region_lookup(struct ai2c_priv *priv,
- *                                           u32 regionId);
- *  @brief Map a memory region handle to a region description structure.
-    @param[in] inPriv Created device state structure
-    @param[in] inRegionId Original region id to be mapped
-    @Returns mapped value
- */
-extern struct ai2c_region_io *ai2c_region_lookup(
-	struct ai2c_priv *priv,
-	u32 regionId);
-
-/*! @fn int ai2c_stateSetup(struct ai2c_priv **outPriv);
-    @brief This is a one time initialization for the state linking all
-	   of the I2C protocol layers to be called by the device
-	   initialization step.
-    @param[out] outPriv Created device state structure
-    @Returns success/failure status of the operation
-*/
-extern int ai2c_stateSetup(struct ai2c_priv       **outPriv);
-
-/*! @fn int ai2c_memSetup(struct platform_device *pdev,
-			  struct ai2c_priv *priv);
-    @brief This is a per-device to-be-mapped setup for the I2C protocol
-	   layers to be called by the device initialization step.
-    @param[in] inPDev Source platform device data strucure
-    @param[in] inPriv Created device state structure
-    @Returns success/failure status of the operation
-*/
-extern int ai2c_memSetup(struct platform_device *pdev,
-			 struct ai2c_priv       *priv);
-
-/*! @fn int ai2c_memDestroy(struct ai2c_priv  *inPriv);
-    @brief This function will release resources acquired for the specified
-	   I2C device driver.
-    @param[in] inPriv Created device state structure
-    @Returns success/failure status of the operation
-*/
-extern int ai2c_memDestroy(struct ai2c_priv *inPriv);
-
-
-#endif /* _AI2C_PLAT_H_ */
diff --git a/drivers/i2c/busses/ai2c/ai2c_sal.c b/drivers/i2c/busses/ai2c/ai2c_sal.c
deleted file mode 100644
index ceda0fa..0000000
--- a/drivers/i2c/busses/ai2c/ai2c_sal.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  Copyright (C) 2013 LSI Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include "ai2c_sal.h"
-
-/*
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- */
-
-/*
- * definitions of the ai2c_malloc/ai2c_nvm_malloc family of functions.
- */
-
-void *ai2c_malloc(size_t size)
-{
-	void *p;
-
-	if (size <= 0) {
-#ifdef AI2C_DEBUG
-		AI2C_MSG(AI2C_MSG_DEBUG,
-			"WARNING: ai2c_malloc(%d) passed a zero or "
-			"less size.\n",
-			size);
-#endif
-	return 0;
-	}
-
-	p = __ai2c_malloc(size);
-	if (p == NULL)
-		AI2C_MSG(AI2C_MSG_ERROR, "ai2c_malloc(%d) failed.\n", size);
-
-	return p;
-}
-
-void *ai2c_calloc(size_t no, size_t size)
-{
-	void *p;
-
-	if (size <= 0 || no <= 0) {
-#ifdef AI2C_DEBUG
-		AI2C_MSG(AI2C_MSG_DEBUG,
-			"WARNING: ai2c_calloc(no=%d, size=%d) "
-			"passed a zero or less size.\n",
-			no, size);
-#endif
-		return 0;
-	}
-
-	p = __ai2c_calloc(no, size);
-	if (p == NULL) {
-		AI2C_MSG(AI2C_MSG_ERROR,
-			"ai2c_calloc(no=%d, size=%d) failed.\n", no, size);
-	}
-	return p;
-}
-
-void *ai2c_realloc(void *ptr, size_t size)
-{
-	if (size <= 0) {
-#ifdef AI2C_DEBUG
-		AI2C_MSG(AI2C_MSG_DEBUG,
-			"WARNING: ai2c_realloc(%d) passed a zero or "
-			"less size.\n",
-			size);
-#endif
-		return 0;
-	}
-
-	ptr = __ai2c_realloc(ptr, size);
-	if (ptr == NULL) {
-		AI2C_MSG(AI2C_MSG_ERROR,
-			"ai2c_realloc(ptr=%p, size=%d) failed.\n",
-			ptr, size);
-	}
-	return ptr;
-}
-
-void ai2c_free(void *ptr)
-{
-	if (ptr == NULL) {
-#ifdef AI2C_DEBUG
-		AI2C_MSG(AI2C_MSG_DEBUG,
-			"WARNING:  ai2c_free(%p) passed a NULL pointer.\n",
-			ptr);
-#endif
-		return;
-	}
-
-	__ai2c_free(ptr);
-}
diff --git a/drivers/i2c/busses/ai2c/ai2c_sal.h b/drivers/i2c/busses/ai2c/ai2c_sal.h
deleted file mode 100644
index bbfd2f9..0000000
--- a/drivers/i2c/busses/ai2c/ai2c_sal.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- *  Copyright (C) 2013 LSI Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*! @file      ai2c_sal.h
-    @brief     OS Specific definitions are located here.
-*/
-
-#ifndef __AI2C_SAL_H__
-#define __AI2C_SAL_H__
-
-#include <generated/autoconf.h>
-
-#ifdef __KERNEL__
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/cdev.h>
-#include <linux/of_platform.h>
-#include <linux/init.h>
-#include <linux/poll.h>
-#include <linux/kthread.h>
-#include <linux/sched.h>
-
-#include <linux/io.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/wait.h>
-#include <asm/pgtable.h>
-
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/irqdomain.h>
-#include <linux/spinlock.h>
-#include <linux/signal.h>
-
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
-
-#include <linux/version.h>
-
-#include <linux/time.h>
-#include <linux/fcntl.h>
-#include <linux/unistd.h>
-#include <linux/errno.h>
-#include <linux/mman.h>
-
-#include <asm/byteorder.h>
-
-#else
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#endif
-
-#include "ai2c_types.h"
-#include "ai2c_dev.h"
-
-
-/**************************************************************************
-* Some Constants
-**************************************************************************/
-
-#ifdef __BIG_ENDIAN
-#undef  AI2C_BIG_ENDIAN
-#define AI2C_BIG_ENDIAN	  9999
-#undef  AI2C_LITTLE_ENDIAN
-#endif
-
-#ifdef __LITTLE_ENDIAN
-#undef  AI2C_BIG_ENDIAN
-#undef  AI2C_LITTLE_ENDIAN
-#define AI2C_LITTLE_ENDIAN      9998
-#endif
-
-/**************************************************************************
-* Macros
-**************************************************************************/
-
-/*
-* AI2C_MSG
-*
-*   Print a message to the system console.
-*/
-#ifdef __KERNEL__
-
-#define AI2C_MSG(type, fmt, args...)				         \
-	do {							         \
-		if ((type) & AI2C_MSG_TRACE_LEVEL) {			 \
-			if ((type) == AI2C_MSG_ERROR)			 \
-				printk(KERN_ERR AI2C_MOD_NAME ": ERROR: "); \
-			else						 \
-				printk(KERN_WARNING AI2C_MOD_NAME ": "); \
-			printk(fmt, ## args);				 \
-		}							 \
-	} while (0)
-
-#else
-
-#define AI2C_MSG(type, fmt, args...)				         \
-	do {							         \
-		if ((type) & AI2C_MSG_TRACE_LEVEL) {			 \
-			if ((type) == AI2C_MSG_ERROR)			 \
-				printf("[Error] " AI2C_MOD_NAME ": ERROR: "); \
-			else						 \
-				printf("[Warning] " AI2C_MOD_NAME ": "); \
-			printf(fmt, ## args);				 \
-		}							 \
-	} while (0)
-
-#endif
-
-    /*
-     * AI2C_LOG
-     *
-     *   Print a message to the system log device and/or console. This
-     *   interface is callable from interrupt level.
-     */
-#define AI2C_LOG \
-	AI2C_MSG
-
-#ifndef AI2C_MSG_TRACE_LEVEL
-#define AI2C_MSG_TRACE_LEVEL     ai2c_trace_level
-#endif
-
-extern int AI2C_MSG_TRACE_LEVEL;
-
-
-/*
-* Endian-ness Conversion
-*/
-
-#define AI2C_SWAP16m(n) \
-	((((u16)(n) >>  8) & 0x00ff) |  \
-	(((u16)(n) <<  8) & 0xff00))
-
-#define AI2C_SWAP32m(n) \
-	((((u32)(n) >> 24) & 0x000000ff) |  \
-	(((u32)(n) >>  8) & 0x0000ff00) |  \
-	(((u32)(n) <<  8) & 0x00ff0000) |  \
-	(((u32)(n) << 24) & 0xff000000))
-
-#define SWAP16(x)	\
-	{ { \
-		u16 val = x; \
-		AI2C_SWAP16m(val); \
-	} }
-
-#define SWAP32(x)	\
-	{ { \
-		u32 val = x; \
-		AI2C_SWAP32m(val); \
-	} }
-
-
-/*
-* Endian-ness I/O
-*/
-
-#ifdef CONFIG_ARM
-
-#define in_be8(x)		(*x)
-#define in_be16(x)		AI2C_SWAP16m(*x)
-#define in_be32(x)		AI2C_SWAP32m(*x)
-
-#define in_le8(x)		(*x)
-#define in_le16(x)		(*x)
-#define in_le32(x)		(*x)
-
-#define out_be8(a, v)	        (*a) = (v)
-#define out_be16(a, v)	        (*a) = AI2C_SWAP16m(v)
-#define out_be32(a, v)	        (*a) = AI2C_SWAP32m(v)
-
-#define out_le8(a, v)	        (*a) = (v)
-#define out_le16(a, v)	        (*a) = (v)
-#define out_le32(a, v)	        (*a) = (v)
-
-#endif  /* CONFIG_ARM */
-
-
-#define AI2C_EDEV_BUS_ENFORCE_ORDERING()
-
-#define AI2C_BUS_READ8(addr) \
-	readb((u8 *) (addr))
-
-#define AI2C_BUS_READ16_ENDIAN(endian, addr) \
-	in_##endian##16((u16 __iomem *) (addr))
-
-
-#define AI2C_BUS_READ16_LE(addr) AI2C_BUS_READ16_ENDIAN(le, addr)
-
-#define AI2C_BUS_READ16_BE(addr) AI2C_BUS_READ16_ENDIAN(be, addr)
-
-#define AI2C_BUS_READ16(addr, endian) \
-	(endian == AI2C_DEV_ACCESS_BIG_ENDIAN) ?   \
-		AI2C_BUS_READ16_BE(addr) : AI2C_BUS_READ16_LE(addr)
-
-#define AI2C_BUS_READ32_ENDIAN(endian, addr) \
-	in_##endian##32((u32 __iomem *) (addr))
-
-
-#define AI2C_BUS_READ32_LE(addr) AI2C_BUS_READ32_ENDIAN(le, addr)
-
-#define AI2C_BUS_READ32_BE(addr) AI2C_BUS_READ32_ENDIAN(be, addr)
-
-#define AI2C_BUS_READ32(addr, endian) \
-	(endian == AI2C_DEV_ACCESS_BIG_ENDIAN) ?   \
-	AI2C_BUS_READ32_BE(addr) : AI2C_BUS_READ32_LE(addr)
-
-
-#define AI2C_BUS_WRITE8(addr, data) \
-	writeb((data), (u8 *) (addr))
-
-#define AI2C_BUS_WRITE16_ENDIAN(endian, addr, data) \
-	do { \
-		u16 *__a__ = (u16 *) addr; \
-		u16 __d__ = data; \
-		out_##endian##16((u16 __iomem *) __a__, __d__); \
-		AI2C_EDEV_BUS_ENFORCE_ORDERING(); \
-	} while (0);
-
-#define AI2C_BUS_WRITE16_LE(addr, data) \
-	AI2C_BUS_WRITE16_ENDIAN(le, addr, data)
-
-#define AI2C_BUS_WRITE16_BE(addr, data) \
-	AI2C_BUS_WRITE16_ENDIAN(be, addr, data)
-
-#define AI2C_BUS_WRITE16(addr, data, endian) \
-	do { \
-		if (endian == AI2C_DEV_ACCESS_BIG_ENDIAN) {  \
-			AI2C_BUS_WRITE16_BE(addr, data);    \
-		} else { \
-			AI2C_BUS_WRITE16_LE(addr, data);    \
-		} \
-	} while (0);
-
-#define AI2C_BUS_WRITE32_ENDIAN(endian, addr, data) \
-	do { \
-		u32 *__a__ = (u32 *) addr; \
-		u32 __d__ = data; \
-		out_##endian##32((u32 __iomem *) __a__, __d__); \
-		AI2C_EDEV_BUS_ENFORCE_ORDERING(); \
-	} while (0);
-
-#define AI2C_BUS_WRITE32_LE(addr, data) \
-	AI2C_BUS_WRITE32_ENDIAN(le, addr, data)
-
-#define AI2C_BUS_WRITE32_BE(addr, data) \
-	AI2C_BUS_WRITE32_ENDIAN(be, addr, data)
-
-#define AI2C_BUS_WRITE32(addr, data, endian) \
-	do { \
-		if (endian == AI2C_DEV_ACCESS_BIG_ENDIAN) {  \
-			AI2C_BUS_WRITE32_BE(addr, data);    \
-		} else {			            \
-			AI2C_BUS_WRITE32_LE(addr, data);    \
-		} \
-	} while (0);
-
-    /*
-    * Spinlock mutex stuff
-    */
-
-#define AI2C_SPINLOCK_INIT(pSpinlock) \
-	spin_lock_init(pSpinlock)
-
-#define AI2C_SPINLOCK_LOCK(pSpinlock) \
-	spin_lock(pSpinlock)
-
-#define AI2C_SPINLOCK_TRYLOCK(pSpinlock) \
-	spin_trylock(pSpinlock)
-
-#define AI2C_SPINLOCK_UNLOCK(pSpinlock) \
-	spin_unlock(pSpinlock)
-
-#define AI2C_SPINLOCK_INTERRUPT_DISABLE(pSem, flags) \
-	spin_lock_irqsave(pSem, flags)
-
-#define AI2C_SPINLOCK_INTERRUPT_ENABLE(pSem, flags) \
-	spin_unlock_irqrestore(pSem, flags)
-
-#define AI2C_SPINLOCK_SW_INTERRUPT_DISABLE(pSem, flags) \
-	spin_lock_bh(pSem)
-
-#define AI2C_SPINLOCK_SW_INTERRUPT_ENABLE(pSem, flags) \
-	spin_unlock_bh(pSem)
-
-
-#ifdef __KERNEL__
-    /*
-    * Kernel memory allocation
-    */
-
-#define __ai2c_malloc(size)		kmalloc(size, GFP_KERNEL)
-#define __ai2c_free(ptr)		   kfree(ptr)
-#define __ai2c_realloc(ptr, size)	 (NULL)
-#define __ai2c_calloc(no, size)	   kcalloc(no, size, GFP_KERNEL)
-
-#else
-
-    /*
-    * User space memory allocation
-    */
-
-#define __ai2c_malloc(size)		malloc(size)
-#define __ai2c_free(ptr)		free(ptr)
-#define __ai2c_realloc(ptr, size)	(NULL)
-#define __ai2c_calloc(no, size)	        calloc(no, size)
-
-#endif
-
-
-    /*
-    * Miscellaneous externs not provided by other headers reliably
-    */
-
-extern int snprintf(char *s, size_t n, const char *format, ...);
-
-struct ai2c_rev_id {
-
-#ifdef NCP_BIG_ENDIAN
-	unsigned isAsic:1;
-	unsigned isFpga:1;
-	unsigned isSim:1;
-	unsigned:2;
-	unsigned secDisable:1;
-	unsigned sppDisable:1;
-	unsigned cpuDisable:4;
-	unsigned ecidChipType:5;
-	unsigned:1;
-	unsigned packageType:4;
-	unsigned chipVersion:6;
-	unsigned chipTyp:5;
-#else
-	unsigned chipType:5;
-	unsigned chipVersion:6;
-	unsigned packageType:4;
-	unsigned:1;
-	unsigned ecidChipType:5;
-	unsigned cpuDisable:4;
-	unsigned sppDisable:1;
-	unsigned secDisable:1;
-	unsigned:2;
-	unsigned isSim:1;
-	unsigned isFpga:1;
-	unsigned isAsic:1;
-#endif
-};
-
-
-/**************************************************************************
-* More Macros
-**************************************************************************/
-
-/* Should this be in sal? */
-#ifndef MIN
-#define MIN(a, b)	((a) < (b) ? (a) : (b))
-#endif
-
-#ifndef MAX
-#define MAX(a, b)	((a) > (b) ? (a) : (b))
-#endif
-
-/**************************************************************************
-* Function Prototypes
-**************************************************************************/
-
-extern void *ai2c_malloc(size_t size);
-extern void *ai2c_realloc(void *ptr, size_t size);
-extern void *ai2c_calloc(size_t no, size_t size);
-extern void  ai2c_free(void *ptr);
-
-#endif /* __AI2C_SAL_H__ */
diff --git a/drivers/i2c/busses/ai2c/ai2c_types.h b/drivers/i2c/busses/ai2c/ai2c_types.h
deleted file mode 100644
index a0c04da..0000000
--- a/drivers/i2c/busses/ai2c/ai2c_types.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  Copyright (C) 2013 LSI Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef AI2C_TYPES_H
-#define AI2C_TYPES_H
-
-#ifdef __KERNEL__
-
-#include <linux/types.h>
-
-#else
-
-#define u64     unsigned long long
-#define u32     unsigned long
-#define s32     signed long
-#define size_t  int
-
-#define AI2C_U32        unsigned long
-
-#define ai2c_uint8_t    unsigned char
-#define ai2c_uint16_t   unsigned short
-#define ai2c_uint32_t   unsigned long
-#define ai2c_uint64_t   unsigned long long
-#define ai2c_int8_t     signed char
-#define ai2c_int16_t    signed short
-#define ai2c_int32_t    signed long
-#define ai2c_int64_t    signed long long
-#define ai2c_bool_t     unsigned short
-#define ai2c_size_t     signed long
-
-#endif
-
-/**************************************************************************
-* Constants, #Defines, etc.
-**************************************************************************/
-
-#ifndef NULL
-#define NULL    0
-#endif
-
-#ifndef TRUE
-#define TRUE    1
-#endif
-
-#ifndef FALSE
-#define FALSE   0
-#endif
-
-/**************************************************************************
- * ACP chip types
- *
- * These are the base silicon chip types. Each chip may have one
- * or more variants, but for the purpose of the chipType comparison
- * we only care about the base silicon version. For any variant the
- * driver will set the chipType in virtual register 0x301.0.0 to
- * one of the following.
- **************************************************************************/
-
-#define AI2C_CHIP_ACP34xx	1
-#define AI2C_CHIP_ACP32xx	2
-#define AI2C_CHIP_ACP25xx	6
-#define AI2C_CHIP_ACP25xx_V2    7
-
-#define AI2C_CHIP_X3X7_HYBRID   7       /* TEMP HACK */
-
-#define AI2C_CHIP_ACP55xx	9       /* AXM55xx, aka X7 */
-#define AI2C_CHIP_ACP35xx       16       /* AXM35xx, aka X3 */
-
-
-/**************************************************************************
-* API Configuration Status Codes, Typedefs, etc.
-**************************************************************************/
-
-#define AI2C_ST_SUCCESS	 (0)
-
-
-/**************************************************************************
-* Function Call Support Typedefs, Constants, Macros, etc.
-**************************************************************************/
-
-#ifdef AI2C_ERR_DEBUG
-#define AI2C_PRINT_LINE_FILE				          \
-	AI2C_MSG(AI2C_MSG_INFO, "%s : %s, line = %d\n",	          \
-		 ai2c_status_get(ai2cStatus), __FILE__, __LINE__)
-#else
-#define AI2C_PRINT_LINE_FILE
-#endif			   /* AI2C_ERR_DEBUG */
-
-#define AI2C_CALL(ai2cFunc)		\
-	do {				   \
-		ai2cStatus = (ai2cFunc);	   \
-		if (ai2cStatus != AI2C_ST_SUCCESS) { \
-			AI2C_PRINT_LINE_FILE;	  \
-			goto ai2c_return;	      \
-		}				  \
-	} while (0);
-
-
-#endif  /* AI2C_TYPES_H */
-- 
1.8.3.4




More information about the linux-yocto mailing list