i2c: rename Blackfin TWI I2C driver to i2c-adi-twi.c
Subsystems (2)
PATCH 1/4 i2c: rename Blackfin TWI I2C driver to i2c-adi-twi.c
From: Sonic Zhang <[email protected]>
Rename twi arch header as well.
---
arch/blackfin/include/asm/{bfin_twi.h => twi.h} | 0
drivers/i2c/busses/Kconfig | 14 +++++++-------
drivers/i2c/busses/Makefile | 2 +-
drivers/i2c/busses/{i2c-bfin-twi.c => i2c-adi-twi.c} | 0
4 files changed, 8 insertions(+), 8 deletions(-)
rename arch/blackfin/include/asm/{bfin_twi.h => twi.h} (100%)
rename drivers/i2c/busses/{i2c-bfin-twi.c => i2c-adi-twi.c} (100%)arch/blackfin/include/asm/twi.h renamed from arch/blackfin/include/asm/bfin_twi.h +0 -0
drivers/i2c/busses/Kconfig +7 -7
@@ -356,19 +356,19 @@ config I2C_BCM_KONA If you do not need KONA I2C inteface, say N. -config I2C_BLACKFIN_TWI - tristate "Blackfin TWI I2C support" +config I2C_ADI_TWI + tristate "ADI TWI I2C support" depends on BLACKFIN depends on !BF561 && !BF531 && !BF532 && !BF533 help - This is the I2C bus driver for Blackfin on-chip TWI interface. + This is the I2C bus driver for ADI processors' TWI interface. This driver can also be built as a module. If so, the module - will be called i2c-bfin-twi. + will be called i2c-adi-twi. -config I2C_BLACKFIN_TWI_CLK_KHZ - int "Blackfin TWI I2C clock (kHz)" - depends on I2C_BLACKFIN_TWI +config I2C_ADI_TWI_CLK_KHZ + int "ADI TWI I2C clock (kHz)" + depends on I2C_ADI_TWI range 21 400 default 50 help
drivers/i2c/busses/Makefile +1 -1
@@ -32,7 +32,7 @@ obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o obj-$(CONFIG_I2C_AT91) += i2c-at91.o obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o obj-$(CONFIG_I2C_BCM2835) += i2c-bcm2835.o -obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o +obj-$(CONFIG_I2C_ADI_TWI) += i2c-adi-twi.o obj-$(CONFIG_I2C_CBUS_GPIO) += i2c-cbus-gpio.o obj-$(CONFIG_I2C_CPM) += i2c-cpm.o obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
drivers/i2c/busses/i2c-adi-twi.c renamed from drivers/i2c/busses/i2c-bfin-twi.c +0 -0
Signature · 1 line
1.8.2.3
A message that is not in the archive (sent off-list or not yet received): 1390720020-315-1-git-send-email-sonic.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/4 i2c: i2c-adi: move twi header from arch folder to generic include folder
From: Sonic Zhang <[email protected]>
--- arch/blackfin/include/asm/twi.h | 139 +++----------------------------------- include/linux/i2c/i2c-adi.h | 145 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 131 deletions(-) create mode 100644 include/linux/i2c/i2c-adi.h
arch/blackfin/include/asm/twi.h +8 -131
@@ -1,73 +1,21 @@/* -* bfin_twi.h - interface to Blackfin TWIs +* twi.h - TWI register access header * * Copyright 2005-2010 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ -#ifndef __ASM_BFIN_TWI_H__ -#define __ASM_BFIN_TWI_H__ +#ifndef __ASM_TWI_H__ +#define __ASM_TWI_H__#include <linux/types.h> -#include <linux/i2c.h> - -/* -* All Blackfin system MMRs are padded to 32bits even if the register -* itself is only 16bits. So use a helper macro to streamline this. -*/ -#define __BFP (m) u16 m; u16 __pad_##m - -/* -* bfin twi registers layout -*/ -struct bfin_twi_regs { -__BFP (clkdiv); -__BFP (control); -__BFP (slave_ctl); -__BFP (slave_stat); -__BFP (slave_addr); -__BFP (master_ctl); -__BFP (master_stat); -__BFP (master_addr); -__BFP (int_stat); -__BFP (int_mask); -__BFP (fifo_ctl); -__BFP (fifo_stat); -u32 __pad[20 ]; -__BFP (xmt_data8); -__BFP (xmt_data16); -__BFP (rcv_data8); -__BFP (rcv_data16); -}; - -#undef __BFP - -struct bfin_twi_iface { -int irq; -spinlock_t lock; -char read_write; -u8 command; -u8 *transPtr; -int readNum; -int writeNum; -int cur_mode; -int manual_stop; -int result; -struct i2c_adapter adap; -struct completion complete; -struct i2c_msg *pmsg; -int msg_num; -int cur_msg; -u16 saved_clkdiv; -u16 saved_control; -struct bfin_twi_regs __iomem *regs_base; -}; +#include <asm/blackfin.h> #define DEFINE_TWI_REG (reg_name, reg) \ -static inline u16 read_##reg_name(struct bfin_twi_iface *iface) \ +static inline u16 read_##reg_name(struct adi_twi_iface *iface) \ { return bfin_read16(&iface->regs_base->reg); } \ -static inline void write_##reg_name(struct bfin_twi_iface *iface, u16 v) \ +static inline void write_##reg_name(struct adi_twi_iface *iface, u16 v) \ { bfin_write16(&iface->regs_base->reg, v); }DEFINE_TWI_REG (CLKDIV , clkdiv)
@@ -88,7 +36,7 @@ DEFINE_TWI_REG(XMT_DATA16, xmt_data16) DEFINE_TWI_REG(RCV_DATA8, rcv_data8) DEFINE_TWI_REG(RCV_DATA16, rcv_data16)#else -static inline u16 read_RCV_DATA8 (struct bfin_twi_iface *iface) +static inline u16 read_RCV_DATA8 (struct adi_twi_iface *iface) {u16 ret;unsigned long flags;
@@ -100,7 +48,7 @@ static inline u16 read_RCV_DATA8(struct bfin_twi_iface *iface)return ret; } -static inline u16 read_RCV_DATA16 (struct bfin_twi_iface *iface) +static inline u16 read_RCV_DATA16 (struct adi_twi_iface *iface) {u16 ret;unsigned long flags;
@@ -113,75 +61,4 @@ static inline u16 read_RCV_DATA16(struct bfin_twi_iface *iface) }#endif - -/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ***********************/ -/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */ -#define CLKLOW (x) ((x) & 0xFF)/* Periods Clock Is Held Low */ -#define CLKHI (y) (((y)&0xFF)<<0x8)/* Periods Before New Clock Low */ - -/* TWI_PRESCALE Masks */ -#define PRESCALE 0x007F/* SCLKs Per Internal Time Reference (10MHz) */ -#define TWI_ENA 0x0080/* TWI Enable */ -#define SCCB 0x0200/* SCCB Compatibility Enable */ - -/* TWI_SLAVE_CTL Masks */ -#define SEN 0x0001/* Slave Enable */ -#define SADD_LEN 0x0002/* Slave Address Length */ -#define STDVAL 0x0004/* Slave Transmit Data Valid */ -#define NAK 0x0008/* NAK/ACK* Generated At Conclusion Of Transfer */ -#define GEN 0x0010/* General Call Address Matching Enabled */ - -/* TWI_SLAVE_STAT Masks */ -#define SDIR 0x0001/* Slave Transfer Direction (Transmit/Receive*) */ -#define GCALL 0x0002/* General Call Indicator */ - -/* TWI_MASTER_CTL Masks */ -#define MEN 0x0001/* Master Mode Enable */ -#define MADD_LEN 0x0002/* Master Address Length */ -#define MDIR 0x0004/* Master Transmit Direction (RX/TX*) */ -#define FAST 0x0008/* Use Fast Mode Timing Specs */ -#define STOP 0x0010/* Issue Stop Condition */ -#define RSTART 0x0020/* Repeat Start or Stop* At End Of Transfer */ -#define DCNT 0x3FC0/* Data Bytes To Transfer */ -#define SDAOVR 0x4000/* Serial Data Override */ -#define SCLOVR 0x8000/* Serial Clock Override */ - -/* TWI_MASTER_STAT Masks */ -#define MPROG 0x0001/* Master Transfer In Progress */ -#define LOSTARB 0x0002/* Lost Arbitration Indicator (Xfer Aborted) */ -#define ANAK 0x0004/* Address Not Acknowledged */ -#define DNAK 0x0008/* Data Not Acknowledged */ -#define BUFRDERR 0x0010/* Buffer Read Error */ -#define BUFWRERR 0x0020/* Buffer Write Error */ -#define SDASEN 0x0040/* Serial Data Sense */ -#define SCLSEN 0x0080/* Serial Clock Sense */ -#define BUSBUSY 0x0100/* Bus Busy Indicator */ - -/* TWI_INT_SRC and TWI_INT_ENABLE Masks */ -#define SINIT 0x0001/* Slave Transfer Initiated */ -#define SCOMP 0x0002/* Slave Transfer Complete */ -#define SERR 0x0004/* Slave Transfer Error */ -#define SOVF 0x0008/* Slave Overflow */ -#define MCOMP 0x0010/* Master Transfer Complete */ -#define MERR 0x0020/* Master Transfer Error */ -#define XMTSERV 0x0040/* Transmit FIFO Service */ -#define RCVSERV 0x0080/* Receive FIFO Service */ - -/* TWI_FIFO_CTRL Masks */ -#define XMTFLUSH 0x0001/* Transmit Buffer Flush */ -#define RCVFLUSH 0x0002/* Receive Buffer Flush */ -#define XMTINTLEN 0x0004/* Transmit Buffer Interrupt Length */ -#define RCVINTLEN 0x0008/* Receive Buffer Interrupt Length */ - -/* TWI_FIFO_STAT Masks */ -#define XMTSTAT 0x0003/* Transmit FIFO Status */ -#define XMT_EMPTY 0x0000/* Transmit FIFO Empty */ -#define XMT_HALF 0x0001/* Transmit FIFO Has 1 Byte To Write */ -#define XMT_FULL 0x0003/* Transmit FIFO Full (2 Bytes To Write) */ - -#define RCVSTAT 0x000C/* Receive FIFO Status */ -#define RCV_EMPTY 0x0000/* Receive FIFO Empty */ -#define RCV_HALF 0x0004/* Receive FIFO Has 1 Byte To Read */ -#define RCV_FULL 0x000C/* Receive FIFO Full (2 Bytes To Read) */ -#endif
include/linux/i2c/i2c-adi.h new file +145 -0
145 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH 3/4 i2c: i2c-adi: replace blackfin string with adi in ADI TWI driver
In reply to a message not in the archiveFrom: Sonic Zhang <[email protected]>
remove unnecessary SSYNC from the driver
move necessary SSYNC into MMR access functions. rename i2c-bfin-twi to i2c-adi-twi in file MAINTAINERS
--- MAINTAINERS | 2 +- arch/blackfin/include/asm/twi.h | 23 ++++++- drivers/i2c/busses/i2c-adi-twi.c | 128 +++++++++++++++++---------------------- 3 files changed, 78 insertions(+), 75 deletions(-)
MAINTAINERS +1 -1
@@ -1786,7 +1786,7 @@ M: Sonic Zhang <[email protected]> L: uclinux-dist-devel-ZG0+EudsQA8dtHy/[email protected] W: http://blackfin.uclinux.org/ S: Supported -F: drivers/i2c/busses/i2c-bfin-twi.c +F: drivers/i2c/busses/i2c-adi-twi.c BLACKFIN MEDIA DRIVER M: Scott Jiang <[email protected]>
arch/blackfin/include/asm/twi.h +21 -2
@@ -19,7 +19,6 @@ static inline void write_##reg_name(struct adi_twi_iface *iface, u16 v) \ {bfin_write16 (&iface->regs_base->reg, v); } DEFINE_TWI_REG(CLKDIV, clkdiv) -DEFINE_TWI_REG(CONTROL, control) DEFINE_TWI_REG(SLAVE_CTL, slave_ctl) DEFINE_TWI_REG(SLAVE_STAT, slave_stat)DEFINE_TWI_REG (SLAVE_ADDR , slave_addr)
@@ -28,7 +27,6 @@ DEFINE_TWI_REG(MASTER_STAT, master_stat) DEFINE_TWI_REG(MASTER_ADDR, master_addr) DEFINE_TWI_REG(INT_STAT, int_stat) DEFINE_TWI_REG(INT_MASK, int_mask) -DEFINE_TWI_REG(FIFO_CTL, fifo_ctl) DEFINE_TWI_REG(FIFO_STAT, fifo_stat) DEFINE_TWI_REG(XMT_DATA8, xmt_data8)DEFINE_TWI_REG (XMT_DATA16 , xmt_data16)
@@ -61,4 +59,25 @@ static inline u16 read_RCV_DATA16(struct adi_twi_iface *iface) }#endif +static inline u16 read_FIFO_CTL (struct adi_twi_iface *iface) +{ +return bfin_read16 (&iface->regs_base->fifo_ctl); +} + +static inline void write_FIFO_CTL (struct adi_twi_iface *iface,u16 v) +{ +bfin_write16 (&iface->regs_base->fifo_ctl, v); +SSYNC (); +} + +static inline u16 read_CONTROL (struct adi_twi_iface *iface) +{ +return bfin_read16 (&iface->regs_base->control); +} + +static inline void write_CONTROL (struct adi_twi_iface *iface,u16 v) +{ +SSYNC (); +bfin_write16 (&iface->regs_base->control, v); +}#endif
drivers/i2c/busses/i2c-adi-twi.c +56 -72
371 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH 4/4 video: Update dependant blackfin i2c driver name string
In reply to a message not in the archiveFrom: Sonic Zhang <[email protected]>
rename i2c bus driver name i2c-bfin-twi to i2c-adi-twi
rename I2C_BLACKFIN_TWI with I2C_ADI_TWI in framebuffer driver config options
--- drivers/video/Kconfig | 2 +- drivers/video/bf537-lq035.c | 2 +- drivers/video/bfin_adv7393fb.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/Kconfig +1 -1
@@ -614,7 +614,7 @@ config FB_BFIN_LQ035Q1 config FB_BF537_LQ035 tristate "SHARP LQ035 TFT LCD (BF537 STAMP)" - depends on FB && (BF534 || BF536 || BF537) && I2C_BLACKFIN_TWI + depends on FB && (BF534 || BF536 || BF537) && I2C_ADI_TWI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT
drivers/video/bf537-lq035.c +1 -1
@@ -900,7 +900,7 @@ static struct platform_driver bfin_lq035_driver = {static int __init bfin_lq035_driver_init (void ) { -request_module ("i2c-bfin-twi" ); +request_module ("i2c-adi-twi" );return platform_driver_register (&bfin_lq035_driver); }module_init (bfin_lq035_driver_init);
drivers/video/bfin_adv7393fb.c +2 -2
@@ -795,8 +795,8 @@ static struct i2c_driver bfin_adv7393_fb_driver = {static int __init bfin_adv7393_fb_driver_init (void ) { -#if defined(CONFIG_I2C_BLACKFIN_TWI ) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE ) -request_module ("i2c-bfin-twi" ); +#if IS_ENABLED (CONFIG_I2C_ADI_TWI ) +request_module ("i2c-adi-twi" );#else request_module ("i2c-gpio" );#endif
Signature · 1 line
1.8.2.3