Index: rts/beagleboneblack/cpu_gpio.h
===================================================================
--- ports/beagleboneblack/cpu_gpio.h	(revision 35608bbeccd5111a777e712d0081f8a16034fd58)
+++ 	(revision )
@@ -1,113 +1,0 @@
-
-//=============================================================================
-//
-//      cpu_gpio.h
-//
-//      CPU/Board Specific GPIO assignments
-//
-// Author(s):    Luis Torrico, Cogent Computer Systems, Inc.
-// Date:         05/12/2008
-// Description:  This file contains the GPIOIO usage for the CSB733
-//
-//
-//=============================================================================
-
-// PORT 1 - Virtual GPIO Bits 0-31
-#define PORT1_VBIT      0
-// Signal			    Bit		               Dir	Active	Usage
-
-// Define initial direction (0 = output) and value
-#define PORT1_OE		0xFFFFFFFF
-// Define data value
-#define PORT1_DR        0
-       
-// -----------------------------------------------------------------------------------------------
-// PORT 2
-#define PORT2_VBIT      32
-// Signal			    Bit		               Dir	Active	Usage
-#define	N_RDY_BIT	    BIT30	            // In   High	NAND Ready
-#define	N_RDY		    PORT2_VBIT + 30
-#define	LCD_BKL_BIT	    BIT26	            // Out  High	LCD Backlight Enable
-#define	LCD_BKL		    PORT2_VBIT + 26
-#define	EXP_INT_BIT	    BIT25	            // In   Low		Expansion Interrupt
-#define	EXP_INT		    PORT2_VBIT + 25
-
-// Define initial direction (0 = output) and value
-#define PORT2_OE		~(LCD_BKL_BIT)
-// Define data value
-#define PORT2_DR        (LCD_BKL_BIT)
-
-// -----------------------------------------------------------------------------------------------
-// PORT 3
-#define PORT3_VBIT      64
-
-// Signal			    Bit		               Dir	Active	Usage
-#define	GPIO7_BIT	    BIT28	            // In	High	Set as GPIO Input, pulled high.  Shared with SPI1_CS1
-#define	GPIO7	        PORT3_VBIT + 28
-#define	SPI3_CS0_BIT    BIT27	            // In	High	SPI3_CS0
-#define	SPI3_CS0        PORT3_VBIT + 27
-#define	E_INT_BIT	    BIT1	            // In	Low		LAN9211 Interrupt
-#define	E_INT	        PORT3_VBIT + 1
-
-// Define initial direction (0 = output) and value
-#define PORT3_OE		~(SPI3_CS0_BIT)
-// Define data value
-#define PORT3_DR 		SPI3_CS0_BIT
-
-// -----------------------------------------------------------------------------------------------
-// PORT 4
-#define PORT4_VBIT      96
-
-// Signal			    Bit		               Dir	Active	Usage
-#define	PIRQ_BIT	    BIT31	            // In	Low		Touch Interrupt from ADS7843
-#define	PIRQ	        PORT4_VBIT + 31
-#define	I2C_INT_BIT	    BIT30	            // In	Low		I2C Interrupt
-#define	I2C_INT	        PORT4_VBIT + 30
-
-// Define initial direction (0 = output) and value
-#define PORT4_OE		0xFFFFFFFF
-// Define data value
-#define PORT4_DR 		0
-
-// -----------------------------------------------------------------------------------------------
-// PORT 5
-#define PORT5_VBIT      128
-
-// Signal			    Bit		               Dir	Active	Usage
-#define	U_SEL_BIT	    BIT12	            // Out	N/A		Selects between USB Host or Device
-#define	U_SEL	        PORT5_VBIT + 12
-#define	GPIO1_BIT	    BIT1	            // In	High	Push button on CSB703
-#define	GPIO1	        PORT5_VBIT + 1
-#define	GPIO0_BIT	    BIT0	            // Out	N/A		LED on CSB703
-#define	GPIO0	        PORT5_VBIT + 0
-
-// Define initial direction (0 = output) and value
-#define PORT5_OE		~(U_SEL_BIT | GPIO0_BIT)
-// Define data value
-#define PORT5_DR 		(U_SEL_BIT | GPIO0_BIT)
-
-// -----------------------------------------------------------------------------------------------
-// PORT 6
-#define PORT6_VBIT      160
-
-// Signal			    Bit		               Dir	Active	Usage
-#define	GPIO9_BIT	    BIT25	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO9	        PORT6_VBIT + 25
-#define	GPIO8_BIT	    BIT24	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO8	        PORT6_VBIT + 24
-#define	GPIO2_BIT	    BIT22	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO2	        PORT6_VBIT + 22
-#define	GPIO3_BIT	    BIT21	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO3	        PORT6_VBIT + 21
-#define	GPIO4_BIT	    BIT20	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO4	        PORT6_VBIT + 20
-#define	GPIO5_BIT	    BIT19	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO5	        PORT6_VBIT + 19
-#define	GPIO6_BIT	    BIT17	            // In	High	Set as GPIO Input, pulled high.
-#define	GPIO6	        PORT6_VBIT + 17
-
-// Define initial direction (0 = output) and value
-#define PORT6_OE		0xFFFFFFFF
-// Define data value
-#define PORT6_DR 		0
-
Index: rts/beagleboneblack/cpu_i2c.c
===================================================================
--- ports/beagleboneblack/cpu_i2c.c	(revision 35608bbeccd5111a777e712d0081f8a16034fd58)
+++ 	(revision )
@@ -1,322 +1,0 @@
-//==========================================================================
-//
-//      cpu_i2c.c
-//
-// Author(s):   Michael Kelly - Cogent Computer Systems, Inc.
-// Date:        03/26/2003
-// Description:	Generic IIC Routines - requires I2C_SCL and I2C_SDA to
-//				be defined in cpu_gpio.h
-//
-//==========================================================================
-
-#include "config.h"
-#include "cpuio.h"
-#include "genlib.h"
-#include "stddefs.h"
-#include "cli.h"
-#include "cpu_gpio.h"
-#include "cpu_gpio.h"
-#include "umongpio.h"
-
-//--------------------------------------------------------------------------
-// function prototypes
-//
-ulong i2c_init(void);
-ulong i2c_wr_device(uchar dev, uchar reg, uchar data);
-ulong i2c_rd_device(uchar dev, uchar reg, uchar *data);
-ulong i2c_wr_byte(uchar data);
-uchar i2c_rd_byte(void);
-void i2c_start(void);
-void i2c_stop(void);
-int i2c(int argc,char *argv[]);
-
-extern void udelay(int delay);
-
-//--------------------------------------------------------------------------
-// I2C Macros
-//
-#define I2C_SCL_CLR             GPIO_out(I2C_SCL)				
-#define I2C_SCL_SET             GPIO_in(I2C_SCL)				 	
-
-#define I2C_SDA_CLR				GPIO_out(I2C_SDA)		
-#define I2C_SDA_SET				GPIO_in(I2C_SDA) 		
-
-#define I2C_SCL_RD				GPIO_tst(I2C_SCL)
-#define I2C_SDA_RD				GPIO_tst(I2C_SDA)
-
-#define I2C_DELAY 				udelay(1000)
-
-//--------------------------------------------------------------------------
-// i2c_init()
-//
-// I2C is a shared bus.  We drive a low by setting the SCL/SDA GPIO as
-// an output.  We must preset a 0 in the GPIO output bit so the line will
-// go low whenever we make it an output.  For a high, we make the GPIO an
-// input, thus letting the external pullup to pull the line high.
-//
-ulong i2c_init()
-{
-    GPIO_out(I2C_SCL);
-    GPIO_clr(I2C_SCL);
-    GPIO_in(I2C_SCL);
-	
-    GPIO_out(I2C_SDA);
-    GPIO_clr(I2C_SDA);
-    GPIO_in(I2C_SDA);
-	
-    return 0;
-
-}
-
-//--------------------------------------------------------------------------
-// i2c_wr_device()
-//
-// This function writes an 8-bit value to the I2C device at the requested
-// register.
-//
-ulong i2c_wr_device(uchar dev, uchar reg, uchar data)
-{
-
-	// issue a start command
-	i2c_start();
-
-	// write the 7-bit device address with write = 0
-	if(i2c_wr_byte((dev << 1) & 0xfe)){
-		return -1;
-	}
-	// Write the 8-bit register address
-	if(i2c_wr_byte(reg)){
-		return -1;
-	}
-	// Write the 8-bit data value
-	if(i2c_wr_byte(data)){
-		return -1;
-	}
-
-	// issue a stop
-	i2c_stop();
-	
-	return 0;
-}
-
-//--------------------------------------------------------------------------
-// i2c_rd_device()
-//
-// This function reads an 8-bit value from the I2C device at the requested
-// register.
-//
-ulong i2c_rd_device(uchar dev, uchar reg, uchar *data)
-{
-
-	// issue a start command
-	i2c_start();
-
-	// write the 7-bit device address with write = 0
-	if(i2c_wr_byte((dev << 1) & 0xfe)){
-		return -1;
-	}
-	// Write the 8-bit register address
-	if(i2c_wr_byte(reg)){
-		return -1;
-	}
-	// repeat the start command
-	i2c_start();
-	// write the 7-bit device address again plus data direction (read = 1)
-	if(i2c_wr_byte((dev << 1) | 0x01)){
-		return -1;
-	}
-	*data = i2c_rd_byte();
-
-	// issue a stop
-	i2c_stop();
-
-	return 0;
-}
-
-//--------------------------------------------------------------------------
-// i2c_wr_byte()
-//
-// This function writes an 8-bit value to the I2C bus, MSB first.
-// Data is written by changing SDA during SCL low, then bringing
-// SCL high.  SCL is returned low to setup for the next transition.
-//
-ulong i2c_wr_byte(uchar data)
-{
-
-	int i;
-
-	for (i = 0; i < 8; i++){
-		if (data & 0x80) {
-			// write a 1 bit
-			I2C_SDA_SET;
-			I2C_DELAY;
-			I2C_SCL_SET;
-			I2C_DELAY;
-			I2C_SCL_CLR;
-			I2C_DELAY;
-		}
-		else {
-			// write a 0 bit
-			I2C_SDA_CLR;
-			I2C_DELAY;
-			I2C_SCL_SET;
-			I2C_DELAY;
-			I2C_SCL_CLR;
-			I2C_DELAY;
-		}
-		data = data << 1;
-	}
-	// Release SDA, bring SCL high, then read SDA.
-	// A low indicates an acknowledge.
-	I2C_SDA_SET;
-	I2C_DELAY;
-   	I2C_SCL_SET;
-	I2C_DELAY;
-	if(I2C_SDA_RD){	// a high means no ack
-		// re-enable SDA for output
-	   	I2C_SCL_CLR;
-		I2C_DELAY;
-		return -1;
-	}
-
-   	I2C_SCL_CLR;
-	I2C_DELAY;
-
-	return 0;
-}
-
-//--------------------------------------------------------------------------
-// i2c_rd_byte()
-//
-// This function reads an 8-bit data value from the I2C bus, MSB first. 
-// Data is read from SDA after each low to high SCL transition.
-//
-uchar i2c_rd_byte()
-{
-
-	int i;
-	uchar volatile data;
-
-	data = 0;
-
-	for (i = 0; i < 8; i++){
-		data = data << 1;
-		data = data & 0xfe;
-		// clock the data out of the slave
-		I2C_SCL_SET;
-		I2C_DELAY;
-		// check it
-		if (I2C_SDA_RD){
-			data = data | 0x01;
-		}
-		I2C_SCL_CLR;
-		I2C_DELAY;
-	}
-	// generate an extra SCL transition
-	// The slave generates no acknowledge for reads.
-	I2C_SCL_SET;
-	I2C_DELAY;
-	I2C_SCL_CLR;
-	I2C_DELAY;
-
-	return data;
-}
-
-
-//--------------------------------------------------------------------------
-// i2c_start()
-//
-// This function issues an I2C start command which is a high to low
-// transition on SDA while SCL is high.
-//
-void i2c_start()
-{
-
-	I2C_SDA_SET;
-	I2C_DELAY;
-   	I2C_SCL_SET;
-	I2C_DELAY;
-   	I2C_SDA_CLR;
-	I2C_DELAY;
-   	I2C_SCL_CLR;
-	I2C_DELAY;
-	I2C_SDA_SET;
-	I2C_DELAY;
-}
-
-//--------------------------------------------------------------------------
-// i2c_stop()
-//
-// This function issues an I2C stop command which is a low to high
-// transition on SDA while SCL is high.
-//
-void i2c_stop()
-{
-
-	I2C_SDA_CLR;
-	I2C_DELAY;
-	I2C_SCL_SET;
-	I2C_DELAY;
-	I2C_SDA_SET;
-	I2C_DELAY;
-	I2C_SCL_CLR;
-	I2C_DELAY;
-}
-
-char *i2cHelp[] = {
-	" This command allows the user to read ",
-	" and write devices on the i2c bus. \n ",
-    " Usage:",
-    " i2c -[w] {device} {register} {val/count}",
-    " Options...",
-    " -w write val to device/register",
-	" no options, read from device/register up to count",
-	0
-};
-
-int i2c(int argc,char *argv[])
-{
-	int i, opt;
-	int write = 0;
-	uchar dev, reg, data, count;
-
-    while ((opt=getopt(argc,argv,"w")) != -1) {
-    if (opt == 'w') write = 1;
-	}
-
-	// make sure we have the right number of paramters
-	if (argc < (optind+3))
-		return(CMD_PARAM_ERROR);
-
-	dev = (uchar) strtoul(argv[optind],(char **)0,0);
-	reg = (uchar) strtoul(argv[optind+1],(char **)0,0);
-
-	// 3rd arg is the data value if it's a write, count if it's a read
-	data = (uchar) strtoul(argv[optind+2],(char **)0,0);
-	count = data;
-	// do it
-	if (write)
-	{
-		printf("Writing 0x%02x to Device 0x%02x @ Register 0x%02x.\n", data, dev, reg);
-    	if(i2c_wr_device(dev, reg, data))
-    	{
-			printf("I2C Bus Failure - Check Paramters!\n");
-    		return (CMD_FAILURE);
-		}
-	}
-	else
-	{
-		for (i = 0; i < count; i++)
-    	{
-			printf("Read Device 0x%02x, Register 0x%02x = ", dev, reg + i);
-			if(i2c_rd_device(dev, reg + i, &data))
-			{
-				printf("I2C Bus Failure - Check Paramters!\n");
-    			return (CMD_FAILURE);
-			}
-			printf("0x%02x.\n", data);
-		}
-	}
-	return(CMD_SUCCESS);
-}
-
Index: rts/beagleboneblack/cpu_i2c.h
===================================================================
--- ports/beagleboneblack/cpu_i2c.h	(revision 35608bbeccd5111a777e712d0081f8a16034fd58)
+++ 	(revision )
@@ -1,269 +1,0 @@
-//==========================================================================
-//
-//      cpu_i2c.c
-//
-// Author(s):   Michael Kelly - Cogent Computer Systems, Inc.
-// Date:        03/30/2002
-// Description:	CSB272 - 405GP Single Board IIC Routines 
-//
-//==========================================================================
-
-#include "config.h"
-#include "cpuio.h"
-#include "genlib.h"
-#include "stddefs.h"
-
-//--------------------------------------------------------------------------
-// some 405GP I2C register and bit defines
-//
-#define I2C_XCTL				*(vulong *)(0xef60050f)	// extended control register
-#define I2C_XCTL_SRST			0x01000000	// Soft Reset Bit - must be set 
-											// to 1 to use direct control
-
-#define I2C_DCTL				*(vulong *)(0xef600510)	// direct control of IIC bits
-#define I2C_DCTL_SDA_OUT		0x08000000	// SDA Out, 0 = drive low, 1 = tri-state 
-#define I2C_DCTL_SCL_OUT		0x04000000	// SCL Out, 0 = drive low, 1 = tri-state 
-#define I2C_DCTL_SDA_IN			0x02000000	// SDA In, Direct Read
-#define I2C_DCTL_SCL_IN			0x01000000	// SCL In, Direct Read
-
-//--------------------------------------------------------------------------
-// Low level I2C Macros
-//
-#define I2C_SCL_CLR				I2C_DCTL &= ~(I2C_DCTL_SCL_OUT)
-#define I2C_SCL_SET				I2C_DCTL |= (I2C_DCTL_SCL_OUT) 	
-
-#define I2C_SDA_CLR				I2C_DCTL &= ~(I2C_DCTL_SDA_OUT)		
-#define I2C_SDA_SET				I2C_DCTL |= (I2C_DCTL_SDA_OUT) 		
-
-#define I2C_SDA_RD				I2C_DCTL & I2C_DCTL_SDA_IN
-#define I2C_SCL_RD				I2C_DCTL & I2C_DCTL_SCL_IN
-
-#define I2C_DELAY 				udelay(100)
-
-//--------------------------------------------------------------------------
-// function prototypes
-//
-ulong i2c_init(void);
-ulong i2c_wr_device(uchar dev, uchar reg, uchar data);
-ulong i2c_rd_device(uchar dev, uchar reg, uchar *data);
-ulong i2c_wr_byte(uchar data);
-uchar i2c_rd_byte(void);
-void i2c_start(void);
-void i2c_stop(void);
-
-extern void udelay(int delay);
-
-extern ulong sed_disp_mode;
-
-//--------------------------------------------------------------------------
-// i2c_init()
-//
-// Initialize the I2C registers for direct I2C control
-ulong i2c_init()
-{
-	// place the automatic I2C logic in reset
-	I2C_XCTL |= I2C_XCTL_SRST;
-
-	// Set the SCL and SDA outputs into tristate
-	I2C_DCTL |= (I2C_DCTL_SDA_OUT | I2C_DCTL_SCL_OUT);
-
-	return 0;
-
-}
-
-//--------------------------------------------------------------------------
-// i2c_wr_device()
-//
-// This function writes an 8-bit value to the I2C device at the requested
-// register.
-//
-ulong i2c_wr_device(uchar dev, uchar reg, uchar data)
-{
-
-	// issue a start command
-	i2c_start();
-
-	// write the 7-bit device address with write = 0
-	if(i2c_wr_byte((dev << 1) & 0xfe)){
-		return -1;
-	}
-	// Write the 8-bit register address
-	if(i2c_wr_byte(reg)){
-		return -1;
-	}
-	// Write the 8-bit data value
-	if(i2c_wr_byte(data)){
-		return -1;
-	}
-
-	// issue a stop
-	i2c_stop();
-	
-	return 0;
-}
-
-//--------------------------------------------------------------------------
-// i2c_rd_device()
-//
-// This function reads an 8-bit value from the I2C device at the requested
-// register.
-//
-ulong i2c_rd_device(uchar dev, uchar reg, uchar *data)
-{
-
-	// issue a start command
-	i2c_start();
-
-	// write the 7-bit device address with write = 0
-	if(i2c_wr_byte((dev << 1) & 0xfe)){
-		return -1;
-	}
-	// Write the 8-bit register address
-	if(i2c_wr_byte(reg)){
-		return -1;
-	}
-	// repeat the start command
-	i2c_start();
-	// write the 7-bit device address again plus data direction (read = 1)
-	if(i2c_wr_byte((dev << 1) | 0x01)){
-		return -1;
-	}
-	*data = i2c_rd_byte();
-
-	// issue a stop
-	i2c_stop();
-
-	return 0;
-}
-
-//--------------------------------------------------------------------------
-// i2c_wr_byte()
-//
-// This function writes an 8-bit value to the I2C bus, MSB first.
-// Data is written by changing SDA during SCL low, then bringing
-// SCL high.  SCL is returned low to setup for the next transition.
-//
-ulong i2c_wr_byte(uchar data)
-{
-
-	int i;
-
-	for (i = 0; i < 8; i++){
-		if (data & 0x80) {
-			// write a 1 bit
-			I2C_SDA_SET;
-			I2C_DELAY;
-			I2C_SCL_SET;
-			I2C_DELAY;
-			I2C_SCL_CLR;
-			I2C_DELAY;
-		}
-		else {
-			// write a 0 bit
-			I2C_SDA_CLR;
-			I2C_DELAY;
-			I2C_SCL_SET;
-			I2C_DELAY;
-			I2C_SCL_CLR;
-			I2C_DELAY;
-		}
-		data = data << 1;
-	}
-	// Release SDA, bring SCL high, then read SDA.
-	// A low indicates an acknowledge.
-	I2C_SDA_SET;
-	I2C_DELAY;
-   	I2C_SCL_SET;
-	I2C_DELAY;
-	if(I2C_SDA_RD){	// a high means no ack
-		// re-enable SDA for output
-	   	I2C_SCL_CLR;
-		I2C_DELAY;
-		return -1;
-	}
-
-   	I2C_SCL_CLR;
-	I2C_DELAY;
-
-	return 0;
-}
-
-//--------------------------------------------------------------------------
-// i2c_rd_byte()
-//
-// This function reads an 8-bit data value from the I2C bus, MSB first. 
-// Data is read from SDA after each low to high SCL transition.
-//
-uchar i2c_rd_byte()
-{
-
-	int i;
-	uchar volatile data;
-
-	data = 0;
-
-	for (i = 0; i < 8; i++){
-		data = data << 1;
-		data = data & 0xfe;
-		// clock the data out of the slave
-		I2C_SCL_SET;
-		I2C_DELAY;
-		// check it
-		if (I2C_SDA_RD){
-			data = data | 0x01;
-		}
-		I2C_SCL_CLR;
-		I2C_DELAY;
-	}
-	// generate an extra SCL transition
-	// The slave generates no acknowledge for reads.
-	I2C_SCL_SET;
-	I2C_DELAY;
-	I2C_SCL_CLR;
-	I2C_DELAY;
-
-	return data;
-}
-
-
-//--------------------------------------------------------------------------
-// i2c_start()
-//
-// This function issues an I2C start command which is a high to low
-// transition on SDA while SCL is high.
-//
-void i2c_start()
-{
-
-	I2C_SDA_SET;
-	I2C_DELAY;
-   	I2C_SCL_SET;
-	I2C_DELAY;
-   	I2C_SDA_CLR;
-	I2C_DELAY;
-   	I2C_SCL_CLR;
-	I2C_DELAY;
-	I2C_SDA_SET;
-	I2C_DELAY;
-}
-
-//--------------------------------------------------------------------------
-// i2c_stop()
-//
-// This function issues an I2C stop command which is a low to high
-// transition on SDA while SCL is high.
-//
-void i2c_stop()
-{
-
-	I2C_SDA_CLR;
-	I2C_DELAY;
-	I2C_SCL_SET;
-	I2C_DELAY;
-	I2C_SDA_SET;
-	I2C_DELAY;
-	I2C_SCL_CLR;
-	I2C_DELAY;
-}
-
-
