i2c: adds support for i2c bus on 8xx
PATCH 1/1 i2c: adds support for i2c bus on 8xx
Using the port of 2.4 code from Vitaly Bordug <[email protected]> and the actual algorithm used by the i2c driver of the DBox code on cvs.tuxboc.org from Tmbinc, Gillem ([email protected]). Renamed i2c-algo-8xx.c to i2c-algo-cpm.c and i2c-rpx.c to i2c-8xx-of.c. Added original i2c-rpx.c as i2c-8xx.c for pre-OF (arch ppc) devices.
---
This can be pulled from git://git.bocc.de/dbox2.git i2c
arch/powerpc/platforms/8xx/mpc885ads_setup.c | 6 + arch/powerpc/sysdev/fsl_soc.c | 15 + drivers/i2c/algos/Kconfig | 12 + drivers/i2c/algos/Makefile | 1 + drivers/i2c/algos/i2c-algo-cpm.c | 562 ++++++++++++++++++++++++++ drivers/i2c/busses/Kconfig | 16 + drivers/i2c/busses/Makefile | 2 + drivers/i2c/busses/i2c-8xx-of.c | 170 ++++++++ drivers/i2c/busses/i2c-8xx.c | 105 +++++ include/linux/i2c-algo-cpm.h | 34 ++ 10 files changed, 923 insertions(+), 0 deletions(-)
create mode 100644 drivers/i2c/algos/i2c-algo-cpm.c create mode 100644 drivers/i2c/busses/i2c-8xx-of.c create mode 100644 drivers/i2c/busses/i2c-8xx.c create mode 100644 include/linux/i2c-algo-cpm.h
arch/powerpc/platforms/8xx/mpc885ads_setup.c +6 -0
@@ -175,6 +175,12 @@ static void __init init_ioports(void)/* Set FEC1 and FEC2 to MII mode */ clrbits32 (&mpc8xx_immr->im_cpm.cp_cptr,0x00000180 ); + +#ifdef CONFIG_I2C_8XX_OF +setbits32 (&mpc8xx_immr->im_cpm.cp_pbpar,0x00000030 ); +setbits32 (&mpc8xx_immr->im_cpm.cp_pbdir,0x00000030 ); +setbits16 (&mpc8xx_immr->im_cpm.cp_pbodr,0x0030 ); +#endif }static void __init mpc885ads_setup_arch (void )
arch/powerpc/sysdev/fsl_soc.c +15 -0
@@ -28,6 +28,7 @@#include <linux/fsl_devices.h> #include <linux/fs_enet_pd.h> #include <linux/fs_uart_pd.h> +#include <linux/of_platform.h> #include <asm/system.h> #include <asm/atomic.h>
@@ -1210,6 +1211,20 @@ err:arch_initcall (cpm_smc_uart_of_init); +static int __init fsl_i2c_cpm_of_init (void ) +{ +struct device_node *np =NULL ; +/* +* Register all the devices which type is "i2c-cpm" +*/ +while ((np =of_find_compatible_node (np,"i2c" ,"fsl,i2c-cpm" )) !=NULL ) +of_platform_device_create (np,"fsl-i2c-cpm" ,NULL ); +return 0 ; +} + +arch_initcall (fsl_i2c_cpm_of_init); + +#endif /* CONFIG_8xx */ #endif /* CONFIG_PPC_CPM_NEW_BINDING */
drivers/i2c/algos/Kconfig +12 -0
@@ -14,6 +14,18 @@ config I2C_ALGOBIT This support is also available as a module. If so, the module will be called i2c-algo-bit. +config I2C_ALGOCPM + tristate "I2C MPC8xx CPM and MPC8260 CPM2 interfaces" + depends on ( 8xx || 8260 ) && I2C + help + CPM I2C Algorithm, supports the CPM I2C interface for mpc8xx + and mpc8260 CPUs. Say Y if you own a CPU of this class and wish + to use the I2C interface and say Y to the specific driver for the + particular CPU. + + This support is also available as a module. If so, the module + will be called i2c-algo-cpm. + config I2C_ALGOPCF tristate "I2C PCF 8584 interfaces" help
drivers/i2c/algos/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o +obj-$(CONFIG_I2C_ALGOCPM) += i2c-algo-cpm.o ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) EXTRA_CFLAGS += -DDEBUG
drivers/i2c/algos/i2c-algo-cpm.c new file +562 -0
562 lines not on this page · raw message
drivers/i2c/busses/Kconfig +16 -0
@@ -4,6 +4,22 @@ menu "I2C Hardware Bus support" +config I2C_8XX + tristate "MPC8xx CPM oldstyle (no OF)" + depends on 8xx && I2C && !OF + select I2C_ALGOCPM + help + This supports the use of the I2C interface on Freescale MPC8xx + processors. + +config I2C_8XX_OF + tristate "MPC8xx CPM with Open Firmware" + depends on 8xx && I2C && OF + select I2C_ALGOCPM + help + This supports the use of the I2C interface on Freescale MPC8xx + processors. + config I2C_ALI1535 tristate "ALI 1535" depends on PCI
drivers/i2c/busses/Makefile +2 -0
@@ -2,6 +2,8 @@ # Makefile for the i2c bus drivers. # +obj-$(CONFIG_I2C_8XX) += i2c-8xx.o +obj-$(CONFIG_I2C_8XX_OF) += i2c-8xx-of.o obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o obj-$(CONFIG_I2C_ALI1563) += i2c-ali1563.o obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o
drivers/i2c/busses/i2c-8xx-of.c new file +170 -0
170 lines not on this page · raw message
drivers/i2c/busses/i2c-8xx.c new file +105 -0
105 lines not on this page · raw message
include/linux/i2c-algo-cpm.h new file +34 -0
@@ -0,0 +1,34 @@ +/* ------------------------------------------------------------------------- */ +/* i2c-algo-cpm.h i2c driver algorithms for MPX8XX CPM or MPC8250 CPM2 */ +/* ------------------------------------------------------------------------- */ + +#ifndef I2C_ALGO_CPM_H +#define I2C_ALGO_CPM_H + +#include <linux/i2c.h> +#include <asm/8xx_immap.h> +#include <asm/commproc.h> + +#define CPM_MAX_READ 513 +#define CPM_MAXBD 4 + +struct i2c_algo_cpm_data { +uint dp_addr; +int reloc; +int irq; +i2c8xx_t *i2c; +iic_t *iip; +cpm8xx_t *cp; +wait_queue_head_t iic_wait; +struct mutex iic_mutex;/* Protects I2C CPM */ +u_char *txbuf[CPM_MAXBD ]; +u_char *rxbuf[CPM_MAXBD ]; +u32 txdma[CPM_MAXBD ]; +u32 rxdma[CPM_MAXBD ]; +}; + +extern int i2c_cpm_add_bus (struct i2c_adapter *); +extern int i2c_cpm_del_bus (struct i2c_adapter *); + +#endif /* I2C_ALGO_CPM_H */ +