From patchwork Sat May 18 09:37:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 244774 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2B6A62C0092 for ; Sun, 19 May 2013 02:33:37 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5F9524A051; Sat, 18 May 2013 18:33:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1V46h9-z3QYB; Sat, 18 May 2013 18:33:34 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DF8044A040; Sat, 18 May 2013 18:33:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 376BD4A03B for ; Sat, 18 May 2013 11:38:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NC35t2RWAJJZ for ; Sat, 18 May 2013 11:38:15 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from pollux.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by theia.denx.de (Postfix) with ESMTP id 1F4384A02E for ; Sat, 18 May 2013 11:38:05 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 7B9E47F91; Sat, 18 May 2013 11:38:04 +0200 (CEST) From: Heiko Schocher To: u-boot@lists.denx.de Date: Sat, 18 May 2013 11:37:54 +0200 Message-Id: <1368869881-4398-4-git-send-email-hs@denx.de> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1368869881-4398-1-git-send-email-hs@denx.de> References: <1368869881-4398-1-git-send-email-hs@denx.de> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 18 May 2013 18:33:07 +0200 Cc: Heiko Schocher Subject: [U-Boot] =?utf-8?q?=5BPATCH_v4_03/10=5D_i2c=2C_soft-i2c=3A_switch?= =?utf-8?q?_to_new_multibus/multiadapter_support?= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de - added to soft_i2c driver new multibus/multiadpater support - adapted all config files, which uses this driver Signed-off-by: Heiko Schocher Cc: Simon Glass Cc: Stephen Warren --- - changes for v2: - fix EEprom_ivm setting for km82xx boards - adapted README - rebase against current mainline 178d0cc1a4c73c3341afbeb2a93b172de8c96bd1 - pass i2c_adapter struct to i2c_core callbacks suggested by Stephen Warren and Simon Glass. - changes for v3: - adapt to the new introduced U_BOOT_I2C_ADAP_COMPLETE define - added README entry - patch has 2 different checkpatch warnings: WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt +# define I2C_SOFT_DECLARATIONS volatile ioport_t *iop = \ WARNING: Avoid CamelCase: +#define I2C_INIT (*pFIO_DIR |= PF_SCL); asm("ssync;") This should be fixed in a seperate step, as it affects a lot of boards... --- README | 45 +++++++----- arch/arm/include/asm/arch-kirkwood/config.h | 2 +- arch/arm/lib/board.c | 5 +- arch/m68k/lib/board.c | 8 +-- arch/powerpc/lib/board.c | 9 +-- board/BuS/eb_cpux9k2/cpux9k2.c | 2 +- board/BuS/vl_ma2sc/vl_ma2sc.c | 2 +- board/atc/atc.c | 2 +- board/bluewater/snapper9260/snapper9260.c | 2 +- board/cm5200/cm5200.c | 4 +- board/cpu86/cpu86.c | 2 +- board/cpu87/cpu87.c | 2 +- board/emk/top9000/top9000.c | 8 +-- board/eukrea/cpuat91/cpuat91.c | 2 +- board/freescale/m52277evb/README | 2 +- board/freescale/m53017evb/README | 2 +- board/freescale/m5373evb/README | 2 +- board/freescale/m54455evb/README | 2 +- board/freescale/m547xevb/README | 2 +- board/ids8247/ids8247.c | 2 +- board/keymile/common/ivm.c | 6 +- board/keymile/km_arm/km_arm.c | 8 +-- board/lwmon/lwmon.c | 2 +- board/lwmon/pcmcia.c | 4 +- board/pm826/pm826.c | 2 +- board/pm828/pm828.c | 2 +- board/sacsng/ioconfig.h | 2 +- board/sandburst/karef/karef.c | 1 - board/tqc/tqm8260/tqm8260.c | 2 +- board/tqc/tqm8272/tqm8272.c | 2 +- board/tqc/tqm8272/tqm8272.h | 2 +- common/board_f.c | 6 +- common/cmd_eeprom.c | 3 +- common/stdio.c | 8 +-- drivers/i2c/Makefile | 2 +- drivers/i2c/soft_i2c.c | 104 +++++++++++++++------------- include/configs/A3000.h | 4 +- include/configs/BSC9131RDB.h | 1 - include/configs/CANBT.h | 1 + include/configs/CPU86.h | 7 +- include/configs/CPU87.h | 7 +- include/configs/DU440.h | 1 - include/configs/GEN860T.h | 39 ++++++----- include/configs/HIDDEN_DRAGON.h | 9 ++- include/configs/ICU862.h | 13 ++-- include/configs/IDS8247.h | 9 ++- include/configs/IP860.h | 9 ++- include/configs/IPHASE4539.h | 11 ++- include/configs/JSE.h | 1 - include/configs/KAREF.h | 1 - include/configs/KUP4K.h | 11 ++- include/configs/KUP4X.h | 12 ++-- include/configs/M5208EVBE.h | 1 - include/configs/M52277EVB.h | 1 - include/configs/M5235EVB.h | 1 - include/configs/M5271EVB.h | 1 - include/configs/M5275EVB.h | 1 - include/configs/M53017EVB.h | 1 - include/configs/M5329EVB.h | 1 - include/configs/M5373EVB.h | 1 - include/configs/M54418TWR.h | 2 +- include/configs/M54451EVB.h | 1 - include/configs/M54455EVB.h | 1 - include/configs/M5475EVB.h | 1 - include/configs/M5485EVB.h | 1 - include/configs/METROBOX.h | 1 - include/configs/MHPC.h | 8 +-- include/configs/MPC8323ERDB.h | 1 - include/configs/MPC832XEMDS.h | 1 - include/configs/MPC8349EMDS.h | 1 - include/configs/MPC8349ITX.h | 2 - include/configs/MPC8360EMDS.h | 1 - include/configs/MPC8360ERDK.h | 1 - include/configs/MPC837XEMDS.h | 1 - include/configs/MPC837XERDB.h | 1 - include/configs/MPC8536DS.h | 1 - include/configs/MPC8540ADS.h | 1 - include/configs/MPC8541CDS.h | 1 - include/configs/MPC8544DS.h | 1 - include/configs/MPC8548CDS.h | 3 +- include/configs/MPC8555CDS.h | 1 - include/configs/MPC8560ADS.h | 1 - include/configs/MPC8568MDS.h | 1 - include/configs/MPC8569MDS.h | 1 - include/configs/MPC8572DS.h | 1 - include/configs/MPC8610HPCD.h | 1 - include/configs/MPC8641HPCN.h | 1 - include/configs/P1010RDB.h | 1 - include/configs/P1023RDS.h | 1 - include/configs/P1_P2_RDB.h | 1 - include/configs/P2020COME.h | 1 - include/configs/PM826.h | 8 +-- include/configs/PM828.h | 8 +-- include/configs/PMC440.h | 1 - include/configs/R360MPI.h | 6 +- include/configs/RPXClassic.h | 16 +++-- include/configs/RPXlite.h | 30 ++++++++ include/configs/RRvision.h | 12 ++-- include/configs/SXNI855T.h | 7 +- include/configs/Sandpoint8240.h | 15 ++-- include/configs/Sandpoint8245.h | 15 ++-- include/configs/TASREG.h | 28 ++++---- include/configs/TK885D.h | 12 ++-- include/configs/TOP5200.h | 12 ++-- include/configs/TOP860.h | 10 +-- include/configs/TQM8260.h | 8 +-- include/configs/TQM8272.h | 12 ++-- include/configs/TQM834x.h | 1 - include/configs/TQM855M.h | 12 ++-- include/configs/TQM866M.h | 11 ++- include/configs/TQM885D.h | 12 ++-- include/configs/alpr.h | 1 - include/configs/aria.h | 1 - include/configs/astro_mcf5373l.h | 1 - include/configs/bf533-ezkit.h | 9 ++- include/configs/bf533-stamp.h | 48 +++++++++++-- include/configs/bf561-ezkit.h | 8 ++- include/configs/bfin_adi_common.h | 4 +- include/configs/blackstamp.h | 9 ++- include/configs/blackvme.h | 2 +- include/configs/cpuat91.h | 3 +- include/configs/debris.h | 9 ++- include/configs/eXalion.h | 2 +- include/configs/eb_cpux9k2.h | 13 ++-- include/configs/ep8260.h | 13 ++-- include/configs/ethernut5.h | 8 ++- include/configs/ibf-dsp561.h | 4 +- include/configs/iocon.h | 10 +-- include/configs/km/keymile-common.h | 3 - include/configs/km/km83xx-common.h | 3 + include/configs/km/km_arm.h | 24 +++++-- include/configs/km82xx.h | 18 +++-- include/configs/km_kirkwood.h | 16 ++--- include/configs/korat.h | 1 - include/configs/lwmon.h | 12 ++-- include/configs/lwmon5.h | 1 - include/configs/mecp5123.h | 1 - include/configs/mpc5121ads.h | 1 - include/configs/nhk8815.h | 7 +- include/configs/otc570.h | 17 +++-- include/configs/p1_p2_rdb_pc.h | 1 - include/configs/p3p440.h | 1 - include/configs/pcs440ep.h | 1 - include/configs/pdnb3.h | 10 ++- include/configs/quad100hd.h | 1 - include/configs/s5p_goni.h | 6 +- include/configs/s5pc210_universal.h | 6 +- include/configs/sacsng.h | 11 ++- include/configs/sbc405.h | 1 - include/configs/sbc8349.h | 1 - include/configs/sbc8548.h | 1 - include/configs/sbc8641d.h | 1 - include/configs/sc3.h | 1 - include/configs/snapper9260.h | 8 +-- include/configs/socrates.h | 1 - include/configs/spc1920.h | 12 ++-- include/configs/stxgp3.h | 1 - include/configs/stxssa.h | 1 - include/configs/top9000.h | 9 +-- include/configs/trats.h | 6 +- include/configs/u8500_href.h | 1 - include/configs/uc100.h | 12 ++-- include/configs/utx8245.h | 3 +- include/configs/vct.h | 11 ++- include/configs/vl_ma2sc.h | 6 +- include/configs/vme8349.h | 1 - include/configs/zeus.h | 1 - include/i2c.h | 9 +++ 168 Dateien geändert, 556 Zeilen hinzugefügt(+), 502 Zeilen entfernt(-) diff --git a/README b/README index 17bde96..0454d07 100644 --- a/README +++ b/README @@ -1901,6 +1901,19 @@ CBFS (Coreboot Filesystem) support interface. ported i2c driver to the new framework: + - drivers/i2c/soft_i2c.c: + - activate first bus with CONFIG_SYS_I2C_SOFT define + CONFIG_SYS_I2C_SOFT_SPEED and CONFIG_SYS_I2C_SOFT_SLAVE + for defining speed and slave address + - activate second bus with I2C_SOFT_DECLARATIONS2 define + CONFIG_SYS_I2C_SOFT_SPEED_2 and CONFIG_SYS_I2C_SOFT_SLAVE_2 + for defining speed and slave address + - activate third bus with I2C_SOFT_DECLARATIONS3 define + CONFIG_SYS_I2C_SOFT_SPEED_3 and CONFIG_SYS_I2C_SOFT_SLAVE_3 + for defining speed and slave address + - activate fourth bus with I2C_SOFT_DECLARATIONS4 define + CONFIG_SYS_I2C_SOFT_SPEED_4 and CONFIG_SYS_I2C_SOFT_SLAVE_4 + for defining speed and slave address additional defines: @@ -1939,18 +1952,18 @@ CBFS (Coreboot Filesystem) support which defines bus 0 on adapter 0 without a mux - bus 1 on adapter 0 without a PCA9547 on address 0x70 port 1 - bus 2 on adapter 0 without a PCA9547 on address 0x70 port 2 - bus 3 on adapter 0 without a PCA9547 on address 0x70 port 3 - bus 4 on adapter 0 without a PCA9547 on address 0x70 port 4 - bus 5 on adapter 0 without a PCA9547 on address 0x70 port 5 + bus 1 on adapter 0 with a PCA9547 on address 0x70 port 1 + bus 2 on adapter 0 with a PCA9547 on address 0x70 port 2 + bus 3 on adapter 0 with a PCA9547 on address 0x70 port 3 + bus 4 on adapter 0 with a PCA9547 on address 0x70 port 4 + bus 5 on adapter 0 with a PCA9547 on address 0x70 port 5 bus 6 on adapter 1 without a mux - bus 7 on adapter 1 without a PCA9544 on address 0x72 port 1 - bus 8 on adapter 1 without a PCA9544 on address 0x72 port 2 + bus 7 on adapter 1 with a PCA9544 on address 0x72 port 1 + bus 8 on adapter 1 with a PCA9544 on address 0x72 port 2 If you do not have i2c muxes on your board, omit this define. -- Legacy I2C Support: CONFIG_HARD_I2C | CONFIG_SOFT_I2C +- Legacy I2C Support: CONFIG_HARD_I2C NOTE: It is intended to move drivers to CONFIG_SYS_I2C which provides the following compelling advantages: @@ -1961,9 +1974,9 @@ CBFS (Coreboot Filesystem) support ** Please consider updating your I2C driver now. ** - These enable legacy I2C serial bus commands. Defining either of - (but not both of) CONFIG_HARD_I2C or CONFIG_SOFT_I2C will - include the appropriate I2C driver for the selected CPU. + These enable legacy I2C serial bus commands. Defining + CONFIG_HARD_I2C will include the appropriate I2C driver + for the selected CPU. This will allow you to use i2c commands at the u-boot command line (as long as you set CONFIG_CMD_I2C in @@ -1973,12 +1986,8 @@ CBFS (Coreboot Filesystem) support CONFIG_HARD_I2C selects a hardware I2C controller. - CONFIG_SOFT_I2C configures u-boot to use a software (aka - bit-banging) driver instead of CPM or similar hardware - support for I2C. - There are several other quantities that must also be - defined when you define CONFIG_HARD_I2C or CONFIG_SOFT_I2C. + defined when you define CONFIG_HARD_I2C. In both cases you will need to define CONFIG_SYS_I2C_SPEED to be the frequency (in Hz) at which you wish your i2c bus @@ -2000,7 +2009,7 @@ CBFS (Coreboot Filesystem) support That's all that's required for CONFIG_HARD_I2C. - If you use the software i2c interface (CONFIG_SOFT_I2C) + If you use the software i2c interface (CONFIG_SYS_I2C_SOFT) then the following macros need to be defined (examples are from include/configs/lwmon.h): @@ -3569,7 +3578,7 @@ to save the current settings. I2C muxes, you can define here, how to reach this EEPROM. For example: - #define CONFIG_I2C_ENV_EEPROM_BUS "pca9547:70:d\0" + #define CONFIG_I2C_ENV_EEPROM_BUS 1 EEPROM which holds the environment, is reached over a pca9547 i2c mux with address 0x70, channel 3. diff --git a/arch/arm/include/asm/arch-kirkwood/config.h b/arch/arm/include/asm/arch-kirkwood/config.h index a9499b7..f0e84e6 100644 --- a/arch/arm/include/asm/arch-kirkwood/config.h +++ b/arch/arm/include/asm/arch-kirkwood/config.h @@ -144,7 +144,7 @@ * I2C related stuff */ #ifdef CONFIG_CMD_I2C -#ifndef CONFIG_SOFT_I2C +#ifndef CONFIG_SYS_I2C_SOFT #define CONFIG_I2C_MVTWSI #endif #define CONFIG_SYS_I2C_SLAVE 0x0 diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 5302a13..5360883 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -69,7 +69,6 @@ extern void dataflash_print_info(void); #endif #if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) || \ defined(CONFIG_SYS_I2C) #include #endif @@ -166,7 +165,7 @@ static int display_dram_config(void) return (0); } -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c(void) { puts("I2C: "); @@ -273,7 +272,7 @@ init_fnc_t *init_sequence[] = { #if defined(CONFIG_DISPLAY_BOARDINFO) checkboard, /* display board info */ #endif -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) init_func_i2c, #endif dram_init, /* configure available RAM banks */ diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index 1e42880..0bd1d06 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -56,7 +56,7 @@ #include #if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) + defined(CONFIG_SYS_I2C) #include #endif @@ -142,8 +142,7 @@ static int init_func_ram (void) /***********************************************************************/ -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c (void) { puts ("I2C: "); @@ -183,8 +182,7 @@ init_fnc_t *init_sequence[] = { display_options, checkcpu, checkboard, -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) init_func_i2c, #endif #if defined(CONFIG_HARD_SPI) diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0c2e008..bc7c362 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -98,8 +98,7 @@ extern void sc3_read_eeprom(void); #if defined(CONFIG_CMD_DOC) void doc_init(void); #endif -#if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) #include #endif #include @@ -214,8 +213,7 @@ static int init_func_ram(void) /***********************************************************************/ -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c(void) { puts("I2C: "); @@ -312,8 +310,7 @@ static init_fnc_t *init_sequence[] = { misc_init_f, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) init_func_i2c, #endif #if defined(CONFIG_HARD_SPI) diff --git a/board/BuS/eb_cpux9k2/cpux9k2.c b/board/BuS/eb_cpux9k2/cpux9k2.c index e98244b..01b4382 100644 --- a/board/BuS/eb_cpux9k2/cpux9k2.c +++ b/board/BuS/eb_cpux9k2/cpux9k2.c @@ -288,7 +288,7 @@ int drv_video_init(void) } #endif -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT void i2c_init_board(void) { diff --git a/board/BuS/vl_ma2sc/vl_ma2sc.c b/board/BuS/vl_ma2sc/vl_ma2sc.c index 84b2060..7e086ee 100644 --- a/board/BuS/vl_ma2sc/vl_ma2sc.c +++ b/board/BuS/vl_ma2sc/vl_ma2sc.c @@ -323,7 +323,7 @@ int board_eth_init(bd_t *bis) return rc; } -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT void i2c_init_board(void) { u32 pin; diff --git a/board/atc/atc.c b/board/atc/atc.c index 936c031..c2b5a1f 100644 --- a/board/atc/atc.c +++ b/board/atc/atc.c @@ -170,7 +170,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */ /* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */ /* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/bluewater/snapper9260/snapper9260.c b/board/bluewater/snapper9260/snapper9260.c index 60c55e9..b4378db 100644 --- a/board/bluewater/snapper9260/snapper9260.c +++ b/board/bluewater/snapper9260/snapper9260.c @@ -145,7 +145,7 @@ int board_init(void) /* Initialise peripherals */ at91_seriald_hw_init(); - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(0); nand_hw_init(); macb_hw_init(); diff --git a/board/cm5200/cm5200.c b/board/cm5200/cm5200.c index c0ea1c6..ad50452 100644 --- a/board/cm5200/cm5200.c +++ b/board/cm5200/cm5200.c @@ -325,7 +325,7 @@ int board_early_init_r(void) #ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) uchar buf[6]; char str[18]; char hostname[MODULE_NAME_MAXLEN]; @@ -348,7 +348,7 @@ int misc_init_r(void) " device at address %02X:%04X\n", CONFIG_SYS_I2C_EEPROM, CONFIG_MAC_OFFSET); } -#endif /* defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) */ +#endif /* defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) */ if (!getenv("ethaddr")) printf(LOG_PREFIX "MAC address not set, networking is not " "operational\n"); diff --git a/board/cpu86/cpu86.c b/board/cpu86/cpu86.c index bc7ebfe..1d4f90c 100644 --- a/board/cpu86/cpu86.c +++ b/board/cpu86/cpu86.c @@ -161,7 +161,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */ /* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */ /* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/cpu87/cpu87.c b/board/cpu87/cpu87.c index 057a34c..7c591be 100644 --- a/board/cpu87/cpu87.c +++ b/board/cpu87/cpu87.c @@ -163,7 +163,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */ /* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */ /* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/emk/top9000/top9000.c b/board/emk/top9000/top9000.c index 86a8d0b..c0609f0 100644 --- a/board/emk/top9000/top9000.c +++ b/board/emk/top9000/top9000.c @@ -245,7 +245,7 @@ int board_eth_init(bd_t *bis) * However i2c_get_bus_num() cannot be called before * relocation. */ -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT void iic_init(void) { /* ports are now initialized in board_early_init_f() */ @@ -253,7 +253,7 @@ void iic_init(void) int iic_read(void) { - switch ((gd->flags & GD_FLG_RELOC) ? i2c_get_bus_num() : 0) { + switch (I2C_ADAP_HWNR) { case 0: return at91_get_pio_value(I2C0_PORT, SDA0_PIN); case 1: @@ -264,7 +264,7 @@ int iic_read(void) void iic_sda(int bit) { - switch ((gd->flags & GD_FLG_RELOC) ? i2c_get_bus_num() : 0) { + switch (I2C_ADAP_HWNR) { case 0: at91_set_pio_value(I2C0_PORT, SDA0_PIN, bit); break; @@ -276,7 +276,7 @@ void iic_sda(int bit) void iic_scl(int bit) { - switch ((gd->flags & GD_FLG_RELOC) ? i2c_get_bus_num() : 0) { + switch (I2C_ADAP_HWNR) { case 0: at91_set_pio_value(I2C0_PORT, SCL0_PIN, bit); break; diff --git a/board/eukrea/cpuat91/cpuat91.c b/board/eukrea/cpuat91/cpuat91.c index c74c3fc..5dde274 100644 --- a/board/eukrea/cpuat91/cpuat91.c +++ b/board/eukrea/cpuat91/cpuat91.c @@ -73,7 +73,7 @@ int board_eth_init(bd_t *bis) } #endif -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT void i2c_init_board(void) { u32 pin; diff --git a/board/freescale/m52277evb/README b/board/freescale/m52277evb/README index b6e955b..d5e7b05 100644 --- a/board/freescale/m52277evb/README +++ b/board/freescale/m52277evb/README @@ -84,7 +84,7 @@ CONFIG_MCFPIT -- define to use PIT timer CONFIG_FSL_I2C -- define to use FSL common I2C driver CONFIG_HARD_I2C -- define for I2C hardware support -CONFIG_SOFT_I2C -- define for I2C bit-banged +CONFIG_SYS_I2C_SOFT -- define for I2C bit-banged CONFIG_SYS_I2C_SPEED -- define for I2C speed CONFIG_SYS_I2C_SLAVE -- define for I2C slave address CONFIG_SYS_I2C_OFFSET -- define for I2C base address offset diff --git a/board/freescale/m53017evb/README b/board/freescale/m53017evb/README index 64a3d42..855bbd1 100644 --- a/board/freescale/m53017evb/README +++ b/board/freescale/m53017evb/README @@ -92,7 +92,7 @@ CONFIG_MCFPIT -- define to use PIT timer CONFIG_FSL_I2C -- define to use FSL common I2C driver CONFIG_HARD_I2C -- define for I2C hardware support -CONFIG_SOFT_I2C -- define for I2C bit-banged +CONFIG_SYS_I2C_SOFT -- define for I2C bit-banged CONFIG_SYS_I2C_SPEED -- define for I2C speed CONFIG_SYS_I2C_SLAVE -- define for I2C slave address CONFIG_SYS_I2C_OFFSET -- define for I2C base address offset diff --git a/board/freescale/m5373evb/README b/board/freescale/m5373evb/README index 419d4d6..61e6d97 100644 --- a/board/freescale/m5373evb/README +++ b/board/freescale/m5373evb/README @@ -91,7 +91,7 @@ CONFIG_MCFPIT -- define to use PIT timer CONFIG_FSL_I2C -- define to use FSL common I2C driver CONFIG_HARD_I2C -- define for I2C hardware support -CONFIG_SOFT_I2C -- define for I2C bit-banged +CONFIG_SYS_I2C_SOFT -- define for I2C bit-banged CONFIG_SYS_I2C_SPEED -- define for I2C speed CONFIG_SYS_I2C_SLAVE -- define for I2C slave address CONFIG_SYS_I2C_OFFSET -- define for I2C base address offset diff --git a/board/freescale/m54455evb/README b/board/freescale/m54455evb/README index 2bc6ce4..2b25952 100644 --- a/board/freescale/m54455evb/README +++ b/board/freescale/m54455evb/README @@ -114,7 +114,7 @@ CONFIG_MCFPIT -- define to use PIT timer CONFIG_FSL_I2C -- define to use FSL common I2C driver CONFIG_HARD_I2C -- define for I2C hardware support -CONFIG_SOFT_I2C -- define for I2C bit-banged +CONFIG_SYS_I2C_SOFT -- define for I2C bit-banged CONFIG_SYS_I2C_SPEED -- define for I2C speed CONFIG_SYS_I2C_SLAVE -- define for I2C slave address CONFIG_SYS_I2C_OFFSET -- define for I2C base address offset diff --git a/board/freescale/m547xevb/README b/board/freescale/m547xevb/README index d3aec20..1a8cbce 100644 --- a/board/freescale/m547xevb/README +++ b/board/freescale/m547xevb/README @@ -99,7 +99,7 @@ CONFIG_SLTTMR -- define to use SLT timer CONFIG_FSL_I2C -- define to use FSL common I2C driver CONFIG_HARD_I2C -- define for I2C hardware support -CONFIG_SOFT_I2C -- define for I2C bit-banged +CONFIG_SYS_I2C_SOFT -- define for I2C bit-banged CONFIG_SYS_I2C_SPEED -- define for I2C speed CONFIG_SYS_I2C_SLAVE -- define for I2C slave address CONFIG_SYS_I2C_OFFSET -- define for I2C base address offset diff --git a/board/ids8247/ids8247.c b/board/ids8247/ids8247.c index 02db07f..541d7d6 100644 --- a/board/ids8247/ids8247.c +++ b/board/ids8247/ids8247.c @@ -51,7 +51,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PA27 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 RXDV */ /* PA26 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 RXER */ /* PA25 */ { 0, 0, 0, 0, 1, 0 }, /* 8247_P0 */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PA24 */ { 1, 0, 0, 0, 1, 1 }, /* I2C_SDA2 */ /* PA23 */ { 1, 0, 0, 1, 1, 1 }, /* I2C_SCL2 */ #else /* normal I/O port pins */ diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index 22d5256..918a6ab 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -318,10 +318,14 @@ int ivm_read_eeprom(void) I2C_MUX_DEVICE *dev = NULL; #endif uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN]; - uchar *buf; + char *buf; unsigned long dev_addr = CONFIG_SYS_IVM_EEPROM_ADR; int ret; +#if defined(CONFIG_SYS_I2C) + buf = getenv("EEprom_ivm"); + i2c_set_bus_num(buf ? (int)simple_strtol(buf, NULL, 10) : 0); +#else #if defined(CONFIG_I2C_MUX) /* First init the Bus, select the Bus */ buf = (unsigned char *) getenv("EEprom_ivm"); diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index eda9199..bd81938 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -63,7 +63,7 @@ static const u32 kwmpp_config[] = { MPP5_NF_IO7, MPP6_SYSRST_OUTn, MPP7_PEX_RST_OUTn, -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) MPP8_GPIO, /* SDA */ MPP9_GPIO, /* SCL */ #endif @@ -234,7 +234,7 @@ int misc_init_r(void) int board_early_init_f(void) { -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) u32 tmp; /* set the 2 bitbang i2c pins as output gpios */ @@ -260,7 +260,7 @@ int board_init(void) kw_gpio_set_valid(KM_FLASH_GPIO_PIN, 1); kw_gpio_direction_output(KM_FLASH_GPIO_PIN, 1); -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* * Reinit the GPIO for I2C Bitbang driver so that the now * available gpio framework is consistent. The calls to @@ -440,7 +440,7 @@ int hush_init_var(void) } #endif -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) void set_sda(int state) { I2C_ACTIVE; diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c index 34c6675..85e0995 100644 --- a/board/lwmon/lwmon.c +++ b/board/lwmon/lwmon.c @@ -480,7 +480,7 @@ static void kbd_init (void) uchar val, errcd; int i; - i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(0); gd->arch.kbd_status = 0; diff --git a/board/lwmon/pcmcia.c b/board/lwmon/pcmcia.c index acbb9d5..b9894cf 100644 --- a/board/lwmon/pcmcia.c +++ b/board/lwmon/pcmcia.c @@ -104,7 +104,7 @@ int pcmcia_hardware_enable(int slot) /* switch VCC on */ val |= MAX1604_OP_SUS | MAX1604_VCCBON; - i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(0); i2c_write (CONFIG_SYS_I2C_POWER_A_ADDR, 0, 0, &val, 1); udelay(500000); @@ -193,7 +193,7 @@ int pcmcia_voltage_set(int slot, int vcc, int vpp) */ debug ("PCMCIA power OFF\n"); val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ; - i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + i2c_set_bus_num(0); i2c_write (CONFIG_SYS_I2C_POWER_A_ADDR, 0, 0, &val, 1); val = 0; diff --git a/board/pm826/pm826.c b/board/pm826/pm826.c index 19e7a00..17b4ac9 100644 --- a/board/pm826/pm826.c +++ b/board/pm826/pm826.c @@ -169,7 +169,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */ /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* PD17 */ /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* PD16 */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/pm828/pm828.c b/board/pm828/pm828.c index 4a3b2fd..5e68d4d 100644 --- a/board/pm828/pm828.c +++ b/board/pm828/pm828.c @@ -169,7 +169,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */ /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* PD17 */ /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* PD16 */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/sacsng/ioconfig.h b/board/sacsng/ioconfig.h index be1ce7c..ac8f152 100644 --- a/board/sacsng/ioconfig.h +++ b/board/sacsng/ioconfig.h @@ -187,7 +187,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD17 */ { CONF, SPEC, 1, DOUT, ACTV, 0 }, /* SPI_MOSI */ /* PD16 */ { CONF, SPEC, 1, DIN, ACTV, 0 }, /* SPI_MISO */ #endif -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { CONF, GPIO, 0, DOUT, OPEN, 1 }, /* I2C_SDA */ /* PD14 */ { CONF, GPIO, 0, DOUT, ACTV, 1 }, /* I2C_SCL */ #else diff --git a/board/sandburst/karef/karef.c b/board/sandburst/karef/karef.c index 6457f9b..186998d 100644 --- a/board/sandburst/karef/karef.c +++ b/board/sandburst/karef/karef.c @@ -32,7 +32,6 @@ #include #include #include "../common/sb_common.h" -#include "../common/ppc440gx_i2c.h" #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) || \ defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) #include diff --git a/board/tqc/tqm8260/tqm8260.c b/board/tqc/tqm8260/tqm8260.c index 65a3174..867b969 100644 --- a/board/tqc/tqm8260/tqm8260.c +++ b/board/tqc/tqm8260/tqm8260.c @@ -160,7 +160,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */ /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */ /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/tqc/tqm8272/tqm8272.c b/board/tqc/tqm8272/tqm8272.c index 5aca227..c874a7d 100644 --- a/board/tqc/tqm8272/tqm8272.c +++ b/board/tqc/tqm8272/tqm8272.c @@ -180,7 +180,7 @@ const iop_conf_t iop_conf_tab[4][32] = { /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */ /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */ /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */ #else diff --git a/board/tqc/tqm8272/tqm8272.h b/board/tqc/tqm8272/tqm8272.h index 6d558ec..91b86c9 100644 --- a/board/tqc/tqm8272/tqm8272.h +++ b/board/tqc/tqm8272/tqm8272.h @@ -50,4 +50,4 @@ typedef struct{ static HWIB_INFO hwinf = {0, 0, 1, 0, 1, 0, 0, 0, 0, 8272, 0 ,0, 0, 0, 0, 0, 0, 0}; -#endif +#endif /* __CONFIG_H */ diff --git a/common/board_f.c b/common/board_f.c index 684e61a..e2350b7 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -260,8 +260,7 @@ void __dram_init_banksize(void) void dram_init_banksize(void) __attribute__((weak, alias("__dram_init_banksize"))); -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) static int init_func_i2c(void) { puts("I2C: "); @@ -909,8 +908,7 @@ static init_fnc_t init_sequence_f[] = { misc_init_f, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) init_func_i2c, #endif #if defined(CONFIG_HARD_SPI) diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 4a43116..511d8b6 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -406,8 +406,7 @@ void eeprom_init (void) #if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) spi_init_f (); #endif -#if defined(CONFIG_HARD_I2C) || \ - defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); #endif } diff --git a/common/stdio.c b/common/stdio.c index 2011880..39eef5a 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -34,8 +34,8 @@ #ifdef CONFIG_LOGBUFFER #include #endif -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) || \ - defined(CONFIG_SYS_I2C_ADAPTERS) + +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C) #include #endif @@ -216,11 +216,9 @@ int stdio_init (void) drv_arm_dcc_init (); #endif #ifdef CONFIG_SYS_I2C -#ifdef CONFIG_SYS_I2C_ADAPTERS i2c_init_all(); -#endif #else -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); #endif #endif diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 6373306..3e69270 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -40,13 +40,13 @@ COBJS-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o COBJS-$(CONFIG_PPC4XX_I2C) += ppc4xx_i2c.o COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o -COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o COBJS-$(CONFIG_TEGRA_I2C) += tegra_i2c.o COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o COBJS-$(CONFIG_U8500_I2C) += u8500_i2c.o COBJS-$(CONFIG_SH_I2C) += sh_i2c.o COBJS-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o COBJS-$(CONFIG_SYS_I2C) += i2c_core.o +COBJS-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c index ae3c573..1269304 100644 --- a/drivers/i2c/soft_i2c.c +++ b/drivers/i2c/soft_i2c.c @@ -1,4 +1,8 @@ /* + * (C) Copyright 2009 + * Heiko Schocher, DENX Software Engineering, hs@denx.de. + * Changes for multibus/multiadapter I2C support. + * * (C) Copyright 2001, 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * @@ -103,14 +107,30 @@ /* #define DEBUG_I2C */ -#ifdef DEBUG_I2C DECLARE_GLOBAL_DATA_PTR; + +#ifndef I2C_SOFT_DECLARATIONS +# if defined(CONFIG_MPC8260) +# define I2C_SOFT_DECLARATIONS volatile ioport_t *iop = \ + ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT); +# elif defined(CONFIG_8xx) +# define I2C_SOFT_DECLARATIONS volatile immap_t *immr = \ + (immap_t *)CONFIG_SYS_IMMR; +# else +# define I2C_SOFT_DECLARATIONS +# endif +#endif + +#if !defined(CONFIG_SYS_SOFT_I2C_SPEED) +#define CONFIG_SYS_SOFT_I2C_SPEED CONFIG_SYS_I2C_SPEED +#endif +#if !defined(CONFIG_SYS_SOFT_I2C_SLAVE) +#define CONFIG_SYS_SOFT_I2C_SLAVE CONFIG_SYS_I2C_SLAVE #endif /*----------------------------------------------------------------------- * Definitions */ - #define RETRIES 0 #define I2C_ACK 0 /* PD_SDA level to ack a byte */ @@ -125,10 +145,6 @@ DECLARE_GLOBAL_DATA_PTR; #define PRINTD(fmt,args...) #endif -#if defined(CONFIG_I2C_MULTI_BUS) -static unsigned int i2c_bus_num __attribute__ ((section (".data"))) = 0; -#endif /* CONFIG_I2C_MULTI_BUS */ - /*----------------------------------------------------------------------- * Local functions */ @@ -267,39 +283,6 @@ static int write_byte(uchar data) return(nack); /* not a nack is an ack */ } -#if defined(CONFIG_I2C_MULTI_BUS) -/* - * Functions for multiple I2C bus handling - */ -unsigned int i2c_get_bus_num(void) -{ - return i2c_bus_num; -} - -int i2c_set_bus_num(unsigned int bus) -{ -#if defined(CONFIG_I2C_MUX) - if (bus < CONFIG_SYS_MAX_I2C_BUS) { - i2c_bus_num = bus; - } else { - int ret; - - ret = i2x_mux_select_mux(bus); - i2c_init_board(); - if (ret == 0) - i2c_bus_num = bus; - else - return ret; - } -#else - if (bus >= CONFIG_SYS_MAX_I2C_BUS) - return -1; - i2c_bus_num = bus; -#endif - return 0; -} -#endif - /*----------------------------------------------------------------------- * if ack == I2C_ACK, ACK the byte so can continue reading, else * send I2C_NOACK to end the read. @@ -330,14 +313,10 @@ static uchar read_byte(int ack) return(data); } -/*=====================================================================*/ -/* Public Functions */ -/*=====================================================================*/ - /*----------------------------------------------------------------------- * Initialization */ -void i2c_init (int speed, int slaveaddr) +static void soft_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr) { #if defined(CONFIG_SYS_I2C_INIT_BOARD) /* call board specific i2c bus reset routine before accessing the */ @@ -360,7 +339,7 @@ void i2c_init (int speed, int slaveaddr) * completion of EEPROM writes since the chip stops responding until * the write completes (typically 10mSec). */ -int i2c_probe(uchar addr) +static int soft_i2c_probe(struct i2c_adapter *adap, uint8_t addr) { int rc; @@ -378,7 +357,8 @@ int i2c_probe(uchar addr) /*----------------------------------------------------------------------- * Read bytes */ -int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) +static int soft_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr, + int alen, uchar *buffer, int len) { int shift; PRINTD("i2c_read: chip %02X addr %02X alen %d buffer %p len %d\n", @@ -452,7 +432,8 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) /*----------------------------------------------------------------------- * Write bytes */ -int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) +static int soft_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr, + int alen, uchar *buffer, int len) { int shift, failures = 0; @@ -482,3 +463,32 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) send_stop(); return(failures); } + +/* + * Register soft i2c adapters + */ +U_BOOT_I2C_ADAP_COMPLETE(soft0, soft_i2c_init, soft_i2c_probe, + soft_i2c_read, soft_i2c_write, NULL, + CONFIG_SYS_I2C_SOFT_SPEED, CONFIG_SYS_I2C_SOFT_SLAVE, + 0) +#if defined(I2C_SOFT_DECLARATIONS2) +U_BOOT_I2C_ADAP_COMPLETE(soft1, soft_i2c_init, soft_i2c_probe, + soft_i2c_read, soft_i2c_write, NULL, + CONFIG_SYS_I2C_SOFT_SPEED_2, + CONFIG_SYS_I2C_SOFT_SLAVE_2, + 1) +#endif +#if defined(I2C_SOFT_DECLARATIONS3) +U_BOOT_I2C_ADAP_COMPLETE(soft2, soft_i2c_init, soft_i2c_probe, + soft_i2c_read, soft_i2c_write, NULL, + CONFIG_SYS_I2C_SOFT_SPEED_3, + CONFIG_SYS_I2C_SOFT_SLAVE_3, + 2) +#endif +#if defined(I2C_SOFT_DECLARATIONS4) +U_BOOT_I2C_ADAP_COMPLETE(soft3, soft_i2c_init, soft_i2c_probe, + soft_i2c_read, soft_i2c_write, NULL, + CONFIG_SYS_I2C_SOFT_SPEED_4, + CONFIG_SYS_I2C_SOFT_SLAVE_4, + 3) +#endif diff --git a/include/configs/A3000.h b/include/configs/A3000.h index b85244a..848a93d 100644 --- a/include/configs/A3000.h +++ b/include/configs/A3000.h @@ -86,8 +86,8 @@ * PCI stuff *----------------------------------------------------------------------- */ -#define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ +#define CONFIG_HARD_I2C 1 /* To enable I2C support */ +#undef CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h index fd076e0..134cd7b 100644 --- a/include/configs/BSC9131RDB.h +++ b/include/configs/BSC9131RDB.h @@ -241,7 +241,6 @@ extern unsigned long get_sdram_size(void); #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address*/ diff --git a/include/configs/CANBT.h b/include/configs/CANBT.h index be9238e..fd3eff0 100644 --- a/include/configs/CANBT.h +++ b/include/configs/CANBT.h @@ -180,6 +180,7 @@ /*----------------------------------------------------------------------- * I2C EEPROM (CAT24WC08) for environment */ +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ #define CONFIG_HARD_I2C /* I2C with hardware support */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ diff --git a/include/configs/CPU86.h b/include/configs/CPU86.h index 7ac182f..43b07cf 100644 --- a/include/configs/CPU86.h +++ b/include/configs/CPU86.h @@ -129,10 +129,11 @@ /*----------------------------------------------------------------------- * I2C/EEPROM/RTC configuration */ -#define CONFIG_SOFT_I2C /* Software I2C support enabled */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ diff --git a/include/configs/CPU87.h b/include/configs/CPU87.h index aa5ce29..c9ed376 100644 --- a/include/configs/CPU87.h +++ b/include/configs/CPU87.h @@ -133,10 +133,11 @@ /*----------------------------------------------------------------------- * I2C/EEPROM/RTC configuration */ -#define CONFIG_SOFT_I2C /* Software I2C support enabled */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ diff --git a/include/configs/DU440.h b/include/configs/DU440.h index bbe2713..09876f5 100644 --- a/include/configs/DU440.h +++ b/include/configs/DU440.h @@ -171,7 +171,6 @@ * I2C */ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/GEN860T.h b/include/configs/GEN860T.h index 9a649ca..cc03d39 100644 --- a/include/configs/GEN860T.h +++ b/include/configs/GEN860T.h @@ -158,26 +158,33 @@ /* * Enable I2C and select the hardware/software driver */ -#define CONFIG_HARD_I2C 1 /* CPM based I2C */ -#undef CONFIG_SOFT_I2C /* Bit-banged I2C */ +#define CONFIG_HARD_I2C 1 /* CPM based I2C */ +#undef CONFIG_SYS_I2C_SOFT /* Bit-banged I2C */ #ifdef CONFIG_HARD_I2C -#define CONFIG_SYS_I2C_SPEED 100000 /* clock speed in Hz */ -#define CONFIG_SYS_I2C_SLAVE 0xFE /* I2C slave address */ +#define CONFIG_SYS_I2C_SPEED 100000 /* clock speed in Hz */ +#define CONFIG_SYS_I2C_SLAVE 0xFE /* I2C slave address */ #endif -#ifdef CONFIG_SOFT_I2C -#define PB_SCL 0x00000020 /* PB 26 */ -#define PB_SDA 0x00000010 /* PB 27 */ -#define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL) -#define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA) -#define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA) -#define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0) -#define I2C_SDA(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \ - else immr->im_cpm.cp_pbdat &= ~PB_SDA -#define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ - else immr->im_cpm.cp_pbdat &= ~PB_SCL -#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ +#ifdef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE +#define PB_SCL 0x00000020 /* PB 26 */ +#define PB_SDA 0x00000010 /* PB 27 */ +#define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL) +#define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA) +#define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA) +#define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0) +#define I2C_SDA(bit) if (bit) \ + immr->im_cpm.cp_pbdat |= PB_SDA; \ + else \ + immr->im_cpm.cp_pbdat &= ~PB_SDA +#define I2C_SCL(bit) if (bit) \ + immr->im_cpm.cp_pbdat |= PB_SCL; \ + else \ + immr->im_cpm.cp_pbdat &= ~PB_SCL +#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ #endif /* diff --git a/include/configs/HIDDEN_DRAGON.h b/include/configs/HIDDEN_DRAGON.h index a62ef63..354c44e 100644 --- a/include/configs/HIDDEN_DRAGON.h +++ b/include/configs/HIDDEN_DRAGON.h @@ -168,12 +168,15 @@ * configuration items that the driver uses to drive the port pins. */ #define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ +#undef CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT #error "Soft I2C is not configured properly. Please review!" +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -183,7 +186,7 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 /* EEPROM IS24C02 */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ diff --git a/include/configs/ICU862.h b/include/configs/ICU862.h index b58b6f6..ca8138b 100644 --- a/include/configs/ICU862.h +++ b/include/configs/ICU862.h @@ -106,12 +106,10 @@ #define CONFIG_DOS_PARTITION /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE -# define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 -# define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -133,6 +131,9 @@ #define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ + /* * Command line configuration. diff --git a/include/configs/IDS8247.h b/include/configs/IDS8247.h index 6d0937f..b5a8d37 100644 --- a/include/configs/IDS8247.h +++ b/include/configs/IDS8247.h @@ -73,11 +73,10 @@ #define CONFIG_MISC_INIT_R 1 /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F - +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F /* * Software (bit-bang) I2C driver configuration */ diff --git a/include/configs/IP860.h b/include/configs/IP860.h index 2379718..e5cc4e3 100644 --- a/include/configs/IP860.h +++ b/include/configs/IP860.h @@ -62,8 +62,10 @@ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -80,9 +82,6 @@ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ - -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE # define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM X24C16 */ # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* bytes of address */ /* mask of address bits that overflow into the "EEPROM chip address" */ diff --git a/include/configs/IPHASE4539.h b/include/configs/IPHASE4539.h index 6dd9812..b1fec10 100644 --- a/include/configs/IPHASE4539.h +++ b/include/configs/IPHASE4539.h @@ -110,15 +110,13 @@ * If the software driver is chosen, there are some additional * configuration items that the driver uses to drive the port pins. */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F - +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F /* * Software (bit-bang) I2C driver configuration */ -#ifdef CONFIG_SOFT_I2C #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -128,7 +126,6 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ /* diff --git a/include/configs/JSE.h b/include/configs/JSE.h index e0a0d8e..713dcca 100644 --- a/include/configs/JSE.h +++ b/include/configs/JSE.h @@ -211,7 +211,6 @@ #define CONFIG_SYS_HZ 1000 /* decrementer freq: 1 ms ticks */ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/KAREF.h b/include/configs/KAREF.h index 546e28b..f8da14d 100644 --- a/include/configs/KAREF.h +++ b/include/configs/KAREF.h @@ -134,7 +134,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C hardware support */ -#undef CONFIG_SOFT_I2C /* I2C !bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed 400kHz */ #define CONFIG_SYS_I2C_SLAVE 0x7F /* I2C slave address */ diff --git a/include/configs/KUP4K.h b/include/configs/KUP4K.h index dae9b8c..d6f3a62 100644 --- a/include/configs/KUP4K.h +++ b/include/configs/KUP4K.h @@ -106,13 +106,11 @@ /* * enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C /* I2C bit-banged */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C /* * Software (bit-bang) I2C driver configuration */ @@ -128,7 +126,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ /*----------------------------------------------------------------------- * I2C Configuration diff --git a/include/configs/KUP4X.h b/include/configs/KUP4X.h index cceee96..2473749 100644 --- a/include/configs/KUP4X.h +++ b/include/configs/KUP4X.h @@ -114,13 +114,13 @@ /* * enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE +#ifdef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE -#ifdef CONFIG_SOFT_I2C /* * Software (bit-bang) I2C driver configuration */ @@ -136,7 +136,7 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ /*----------------------------------------------------------------------- diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h index a1eaeff..209c122 100644 --- a/include/configs/M5208EVBE.h +++ b/include/configs/M5208EVBE.h @@ -84,7 +84,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M52277EVB.h b/include/configs/M52277EVB.h index e4dea05..b1bdac2 100644 --- a/include/configs/M52277EVB.h +++ b/include/configs/M52277EVB.h @@ -147,7 +147,6 @@ /* I2c */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M5235EVB.h b/include/configs/M5235EVB.h index 733aece..dfc2ddf 100644 --- a/include/configs/M5235EVB.h +++ b/include/configs/M5235EVB.h @@ -101,7 +101,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x00000300 diff --git a/include/configs/M5271EVB.h b/include/configs/M5271EVB.h index a5913df..e8a8998 100644 --- a/include/configs/M5271EVB.h +++ b/include/configs/M5271EVB.h @@ -111,7 +111,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x00000300 diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h index 9c2a3bb..fbf0c9d 100644 --- a/include/configs/M5275EVB.h +++ b/include/configs/M5275EVB.h @@ -111,7 +111,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x00000300 diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h index 896d0d8..bedba2b 100644 --- a/include/configs/M53017EVB.h +++ b/include/configs/M53017EVB.h @@ -103,7 +103,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h index 64f8302..06fa57c 100644 --- a/include/configs/M5329EVB.h +++ b/include/configs/M5329EVB.h @@ -97,7 +97,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h index 4437bba..faa4f86 100644 --- a/include/configs/M5373EVB.h +++ b/include/configs/M5373EVB.h @@ -97,7 +97,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M54418TWR.h b/include/configs/M54418TWR.h index 3be2f8e..627c1ae 100644 --- a/include/configs/M54418TWR.h +++ b/include/configs/M54418TWR.h @@ -215,7 +215,7 @@ /* I2c */ #undef CONFIG_FSL_I2C #undef CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ +#undef CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/M54451EVB.h b/include/configs/M54451EVB.h index 6552f69..5dbe0b4 100644 --- a/include/configs/M54451EVB.h +++ b/include/configs/M54451EVB.h @@ -158,7 +158,6 @@ /* I2c */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M54455EVB.h b/include/configs/M54455EVB.h index 1bc2c5a..8eeda74 100644 --- a/include/configs/M54455EVB.h +++ b/include/configs/M54455EVB.h @@ -191,7 +191,6 @@ /* I2c */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/M5475EVB.h b/include/configs/M5475EVB.h index 3bdb867..6e9cba0 100644 --- a/include/configs/M5475EVB.h +++ b/include/configs/M5475EVB.h @@ -122,7 +122,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x00008F00 diff --git a/include/configs/M5485EVB.h b/include/configs/M5485EVB.h index 3487e49..24f28e0 100644 --- a/include/configs/M5485EVB.h +++ b/include/configs/M5485EVB.h @@ -119,7 +119,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x00008F00 diff --git a/include/configs/METROBOX.h b/include/configs/METROBOX.h index 286f869..7556ad5 100644 --- a/include/configs/METROBOX.h +++ b/include/configs/METROBOX.h @@ -196,7 +196,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C hardware support */ -#undef CONFIG_SOFT_I2C /* I2C !bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed 400kHz */ #define CONFIG_SYS_I2C_SLAVE 0x7F /* I2C slave address */ diff --git a/include/configs/MHPC.h b/include/configs/MHPC.h index 3ff36ad..fdd811d 100644 --- a/include/configs/MHPC.h +++ b/include/configs/MHPC.h @@ -73,8 +73,10 @@ #undef CONFIG_UCODE_PATCH /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -91,8 +93,6 @@ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#define CONFIG_SYS_I2C_SPEED 50000 -#define CONFIG_SYS_I2C_SLAVE 0xFE #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM X24C04 */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* bytes of address */ /* mask of address bits that overflow into the "EEPROM chip address" */ diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h index 8d5ed0f..0e7e5ad 100644 --- a/include/configs/MPC8323ERDB.h +++ b/include/configs/MPC8323ERDB.h @@ -234,7 +234,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h index f592d3a..0b72a26 100644 --- a/include/configs/MPC832XEMDS.h +++ b/include/configs/MPC832XEMDS.h @@ -327,7 +327,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h index e5529c7..5e0f54f 100644 --- a/include/configs/MPC8349EMDS.h +++ b/include/configs/MPC8349EMDS.h @@ -355,7 +355,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h index 2c3f1f6..9a46fb0 100644 --- a/include/configs/MPC8349ITX.h +++ b/include/configs/MPC8349ITX.h @@ -131,8 +131,6 @@ #define I2C_8574_PCI66 0x20 /* 0=33MHz PCI, 1=66MHz PCI */ #define I2C_8574_FLASHSIDE 0x40 /* 0=Reset vector from U4, 1=from U7*/ -#undef CONFIG_SOFT_I2C - #endif /* Compact Flash */ diff --git a/include/configs/MPC8360EMDS.h b/include/configs/MPC8360EMDS.h index a1fbd5e..e2ae65a 100644 --- a/include/configs/MPC8360EMDS.h +++ b/include/configs/MPC8360EMDS.h @@ -424,7 +424,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h index fc00952..971a3e0 100644 --- a/include/configs/MPC8360ERDK.h +++ b/include/configs/MPC8360ERDK.h @@ -288,7 +288,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h index 8243661..95ea116 100644 --- a/include/configs/MPC837XEMDS.h +++ b/include/configs/MPC837XEMDS.h @@ -342,7 +342,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 9ad7e3a..b9f437d 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -368,7 +368,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index bcd77b6..c47281f 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -435,7 +435,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h index a0fe15e..aca41e6 100644 --- a/include/configs/MPC8540ADS.h +++ b/include/configs/MPC8540ADS.h @@ -261,7 +261,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index a6bea15..d2a4f78 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -284,7 +284,6 @@ extern unsigned long get_clock_freq(void); */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index d5f3c5f..c835cae 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -233,7 +233,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); /* I2C */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index 0e22cc7..aa5c0c9 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -359,8 +359,7 @@ extern unsigned long get_clock_freq(void); */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ +#define CONFIG_SYS_I2C_SPEED 400000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ #define CONFIG_SYS_I2C_OFFSET 0x3000 diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index 266cb54..32a375f 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -282,7 +282,6 @@ extern unsigned long get_clock_freq(void); */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h index 35d15f4..b8c657c 100644 --- a/include/configs/MPC8560ADS.h +++ b/include/configs/MPC8560ADS.h @@ -255,7 +255,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index 5d69fb6..31d83d3 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -267,7 +267,6 @@ extern unsigned long get_clock_freq(void); */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x52 diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index acd3276..40c8dd9 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -303,7 +303,6 @@ extern unsigned long get_clock_freq(void); */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index d233365..1a3ca11 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -432,7 +432,6 @@ /* I2C */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h index c619827..27f825f 100644 --- a/include/configs/MPC8610HPCD.h +++ b/include/configs/MPC8610HPCD.h @@ -253,7 +253,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index 2643097..3323c8d 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -300,7 +300,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index 437ee6e..cbdfaae 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -477,7 +477,6 @@ extern unsigned long get_sdram_size(void); #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address*/ diff --git a/include/configs/P1023RDS.h b/include/configs/P1023RDS.h index 878bd5f..bb5329f 100644 --- a/include/configs/P1023RDS.h +++ b/include/configs/P1023RDS.h @@ -314,7 +314,6 @@ extern unsigned long get_clock_freq(void); /* I2C */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x51 diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h index a57d9dd..6e92735 100644 --- a/include/configs/P1_P2_RDB.h +++ b/include/configs/P1_P2_RDB.h @@ -368,7 +368,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); /* I2C */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address*/ diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h index c75f86c..fc3f236 100644 --- a/include/configs/P2020COME.h +++ b/include/configs/P2020COME.h @@ -226,7 +226,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); /* I2C */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address*/ diff --git a/include/configs/PM826.h b/include/configs/PM826.h index fbcf8e5..b2fa0fa 100644 --- a/include/configs/PM826.h +++ b/include/configs/PM826.h @@ -57,10 +57,10 @@ "bootm" /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ diff --git a/include/configs/PM828.h b/include/configs/PM828.h index c37aafd..82179af 100644 --- a/include/configs/PM828.h +++ b/include/configs/PM828.h @@ -57,10 +57,10 @@ "bootm" /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h index 3837b8f..2265d96 100644 --- a/include/configs/PMC440.h +++ b/include/configs/PMC440.h @@ -226,7 +226,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/R360MPI.h b/include/configs/R360MPI.h index 60cccff..df16598 100644 --- a/include/configs/R360MPI.h +++ b/include/configs/R360MPI.h @@ -97,10 +97,13 @@ #define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ #define CONFIG_HARD_I2C 1 /* To I2C with hardware support */ -#undef CONFIG_SORT_I2C /* To I2C with software support */ +#undef CONFIG_SYS_I2C_SOFT /* To I2C with software support */ #define CONFIG_SYS_I2C_SPEED 4700 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F +#if defined(CONFIG_SYS_I2C_SOFT) +#define CONFIG_SYS_SYS_I2C_SOFT_SPEED 4700 /* I2C speed and slave address */ +#define CONFIG_SYS_SYS_I2C_SOFT_SLAVE 0x7F /* * Software (bit-bang) I2C driver configuration */ @@ -116,6 +119,7 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(50) +#endif /* #define(CONFIG_SYS_I2C_SOFT) */ #define CONFIG_SYS_I2C_LCD_ADDR 0x8 /* LCD Control */ #define CONFIG_SYS_I2C_KEY_ADDR 0x9 /* Keyboard coprocessor */ diff --git a/include/configs/RPXClassic.h b/include/configs/RPXClassic.h index 3595200..8130ee6 100644 --- a/include/configs/RPXClassic.h +++ b/include/configs/RPXClassic.h @@ -148,14 +148,16 @@ * I2C Configuration *----------------------------------------------------------------------------- */ -#define CONFIG_I2C 1 -#define CONFIG_SYS_I2C_SPEED 50000 -#define CONFIG_SYS_I2C_SLAVE 0x34 +#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_SYS_I2C_SLAVE 0x34 /* enable I2C and select the hardware/software driver */ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ +#undef CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ + +#if defined(CONFIG_SYS_I2C_SOFT) +#define CONFIG_SYS_I2C 1 /* * Software (bit-bang) I2C driver configuration */ @@ -170,8 +172,10 @@ #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0x34 +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x34 +#endif + # define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM X24C16 */ # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* bytes of address */ /* mask of address bits that overflow into the "EEPROM chip address" */ diff --git a/include/configs/RPXlite.h b/include/configs/RPXlite.h index 563abea..9a385a4 100644 --- a/include/configs/RPXlite.h +++ b/include/configs/RPXlite.h @@ -62,6 +62,36 @@ #undef CONFIG_SYS_LOADS_BAUD_CHANGE /* don't allow baudrate change */ #define CONFIG_BZIP2 /* Include support for bzip2 compressed images */ + +/* enable I2C and select the hardware/software driver */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 40000 /* 40 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE +/* Software (bit-bang) I2C driver configuration */ +#define PB_SCL 0x00000020 /* PB 26 */ +#define PB_SDA 0x00000010 /* PB 27 */ + +#define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL) +#define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA) +#define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA) +#define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0) +#define I2C_SDA(bit) if (bit) \ + immr->im_cpm.cp_pbdat |= PB_SDA; \ + else \ + immr->im_cpm.cp_pbdat &= ~PB_SDA +#define I2C_SCL(bit) if (bit) \ + immr->im_cpm.cp_pbdat |= PB_SCL; \ + else \ + immr->im_cpm.cp_pbdat &= ~PB_SCL +#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ + +/* M41T11 Serial Access Timekeeper(R) SRAM */ +#define CONFIG_RTC_M41T11 1 +#define CONFIG_SYS_I2C_RTC_ADDR 0x68 +/* play along with the linux driver */ +#define CONFIG_SYS_M41T11_BASE_YEAR 1900 + #undef CONFIG_WATCHDOG /* watchdog disabled */ /* diff --git a/include/configs/RRvision.h b/include/configs/RRvision.h index e2ea016..b14136d 100644 --- a/include/configs/RRvision.h +++ b/include/configs/RRvision.h @@ -122,13 +122,10 @@ #endif /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C /* I2C bit-banged */ - -# define CONFIG_SYS_I2C_SPEED 50000 /* 50 kHz is supposed to work */ -# define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -144,7 +141,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(1) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ /* diff --git a/include/configs/SXNI855T.h b/include/configs/SXNI855T.h index b7fbe5e..f0ce282 100644 --- a/include/configs/SXNI855T.h +++ b/include/configs/SXNI855T.h @@ -121,7 +121,10 @@ #define CONFIG_RTC_DS1306 /* Dallas 1306 real time clock */ -#define CONFIG_SOFT_I2C /* I2C bit-banged */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -138,8 +141,6 @@ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -# define CONFIG_SYS_I2C_SPEED 50000 -# define CONFIG_SYS_I2C_SLAVE 0xFE # define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Atmel 24C64 */ # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* two byte address */ diff --git a/include/configs/Sandpoint8240.h b/include/configs/Sandpoint8240.h index f54fcb3..ea96238 100644 --- a/include/configs/Sandpoint8240.h +++ b/include/configs/Sandpoint8240.h @@ -201,13 +201,16 @@ * If the software driver is chosen, there are some additional * configuration items that the driver uses to drive the port pins. */ -#define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_HARD_I2C 1 /* To enable I2C support */ +#undef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_SYS_I2C_SPEED 400000 -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT #error "Soft I2C is not configured properly. Please review!" +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -217,7 +220,7 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 /* EEPROM IS24C02 */ diff --git a/include/configs/Sandpoint8245.h b/include/configs/Sandpoint8245.h index 84e4891..9a4863b 100644 --- a/include/configs/Sandpoint8245.h +++ b/include/configs/Sandpoint8245.h @@ -171,13 +171,16 @@ * If the software driver is chosen, there are some additional * configuration items that the driver uses to drive the port pins. */ -#define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_HARD_I2C 1 /* To enable I2C support */ +#undef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C_SPEED 400000 +#define CONFIG_SYS_I2C_SLAVE 0x7F -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT #error "Soft I2C is not configured properly. Please review!" +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -187,7 +190,7 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 /* EEPROM IS24C02 */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ diff --git a/include/configs/TASREG.h b/include/configs/TASREG.h index d95a226..059fb36 100644 --- a/include/configs/TASREG.h +++ b/include/configs/TASREG.h @@ -136,19 +136,11 @@ /*----------------------------------------------------------------------- * I2C */ -#define CONFIG_SOFT_I2C -#define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F -#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM CAT28WC32 */ -#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* Bytes of address */ -/* mask of address bits that overflow into the "EEPROM chip address" */ -#define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW 0x01 -#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5 /* The Catalyst CAT24WC32 has */ - /* 32 byte page write mode using*/ - /* last 5 bits of the address */ -#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10 /* and takes up to 10 msec */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 100000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F -#if defined (CONFIG_SOFT_I2C) #if 0 /* push-pull */ #define SDA 0x00800000 #define SCL 0x00000008 @@ -182,7 +174,17 @@ #define I2C_ACTIVE {DIR1|=SDA;} #define I2C_TRISTATE {DIR1&=~SDA;} #endif -#endif + +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM CAT28WC32 */ +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* Bytes of address */ +/* mask of address bits that overflow into the "EEPROM chip address" */ +#define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW 0x01 +/* + * The Catalyst CAT24WC32 has 32 byte page write mode using + * last 5 bits of the address + */ +#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5 +#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10 /* and takes up to 10 msec */ /*----------------------------------------------------------------------- * Definitions for initial stack pointer and data area (in DPRAM) diff --git a/include/configs/TK885D.h b/include/configs/TK885D.h index 623cb66..af88773 100644 --- a/include/configs/TK885D.h +++ b/include/configs/TK885D.h @@ -104,13 +104,10 @@ #undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -126,7 +123,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM AT24C?? */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* two byte address */ diff --git a/include/configs/TOP5200.h b/include/configs/TOP5200.h index 2267d59..e9dcefc 100644 --- a/include/configs/TOP5200.h +++ b/include/configs/TOP5200.h @@ -200,10 +200,13 @@ #define CONFIG_ENV_OVERWRITE #define CONFIG_MISC_INIT_R -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C with softwate support */ +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ -#if defined (CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) +# define CONFIG_SYS_I2C +# define CONFIG_SYS_I2C_SOFT_SPEED 100000 +# define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F +/**/ # define SDA0 0x40 # define SCL0 0x80 # define GPIOE0 *((volatile uchar*)(CONFIG_SYS_MBAR+0x0c00)) @@ -218,8 +221,7 @@ # define I2C_DELAY {udelay(5);} # define I2C_ACTIVE {DDR0|=SDA0;} # define I2C_TRISTATE {DDR0&=~SDA0;} -# define CONFIG_SYS_I2C_SPEED 100000 -# define CONFIG_SYS_I2C_SLAVE 0x7F + #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 #define CONFIG_SYS_I2C_FACT_ADDR 0x57 #endif diff --git a/include/configs/TOP860.h b/include/configs/TOP860.h index 4849f94..1f728e3 100644 --- a/include/configs/TOP860.h +++ b/include/configs/TOP860.h @@ -159,7 +159,6 @@ * Environment handler * only the first 6k in EEPROM are available for user. Of that we use 256b */ -#define CONFIG_SOFT_I2C #define CONFIG_ENV_IS_IN_EEPROM 1 /* turn on EEPROM env feature */ #define CONFIG_ENV_OFFSET 0x1000 #define CONFIG_ENV_SIZE 0x0700 @@ -170,13 +169,15 @@ #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 #define CONFIG_SYS_EEPROM_SIZE 0x2000 -#define CONFIG_SYS_I2C_SPEED 100000 -#define CONFIG_SYS_I2C_SLAVE 0xFE #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 12 #define CONFIG_ENV_OVERWRITE #define CONFIG_MISC_INIT_R -#if defined (CONFIG_SOFT_I2C) +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 100000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE +/**/ #define SDA 0x00010 #define SCL 0x00020 #define __I2C_DIR immr->im_cpm.cp_pbdir @@ -193,7 +194,6 @@ #define I2C_DELAY { udelay(5); } #define I2C_ACTIVE { __I2C_DIR |= SDA; } #define I2C_TRISTATE { __I2C_DIR &= ~SDA; } -#endif #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } diff --git a/include/configs/TQM8260.h b/include/configs/TQM8260.h index 7e24131..5fbfd1c9 100644 --- a/include/configs/TQM8260.h +++ b/include/configs/TQM8260.h @@ -89,10 +89,10 @@ #define CONFIG_BOOTCOMMAND "run flash_self" /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F /* * Software (bit-bang) I2C driver configuration diff --git a/include/configs/TQM8272.h b/include/configs/TQM8272.h index be977f1..a9c4610 100644 --- a/include/configs/TQM8272.h +++ b/include/configs/TQM8272.h @@ -97,11 +97,10 @@ #if CONFIG_I2C /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F - +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F /* * Software (bit-bang) I2C driver configuration */ @@ -135,8 +134,9 @@ #define CONFIG_SYS_DTT_HYSTERESIS 3 #else +#undef CONFIG_SYS_I2C #undef CONFIG_HARD_I2C -#undef CONFIG_SOFT_I2C +#undef CONFIG_SYS_I2C_SOFT #endif /* diff --git a/include/configs/TQM834x.h b/include/configs/TQM834x.h index 0738423..133d7df 100644 --- a/include/configs/TQM834x.h +++ b/include/configs/TQM834x.h @@ -188,7 +188,6 @@ * I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed: 400KHz */ #define CONFIG_SYS_I2C_SLAVE 0x7F /* slave address */ diff --git a/include/configs/TQM855M.h b/include/configs/TQM855M.h index e7fd2db..1b558fc 100644 --- a/include/configs/TQM855M.h +++ b/include/configs/TQM855M.h @@ -93,13 +93,10 @@ #undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -115,7 +112,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM AT24C64 */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* two byte address */ diff --git a/include/configs/TQM866M.h b/include/configs/TQM866M.h index 7d0ae99..9104971 100644 --- a/include/configs/TQM866M.h +++ b/include/configs/TQM866M.h @@ -107,13 +107,11 @@ #undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C /* * Software (bit-bang) I2C driver configuration */ @@ -129,7 +127,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM AT24C256 */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* two byte address */ diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index 7941631..65d7c58 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -101,13 +101,10 @@ #undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -123,7 +120,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* EEPROM AT24C?? */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 /* two byte address */ diff --git a/include/configs/alpr.h b/include/configs/alpr.h index 0d53e51..a6add6b 100644 --- a/include/configs/alpr.h +++ b/include/configs/alpr.h @@ -122,7 +122,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/aria.h b/include/configs/aria.h index b425399..79163ee 100644 --- a/include/configs/aria.h +++ b/include/configs/aria.h @@ -370,7 +370,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* so disable bit-banged I2C */ #define CONFIG_I2C_MULTI_BUS /* I2C speed and slave address */ diff --git a/include/configs/astro_mcf5373l.h b/include/configs/astro_mcf5373l.h index a0ed8f1..6dabe57 100644 --- a/include/configs/astro_mcf5373l.h +++ b/include/configs/astro_mcf5373l.h @@ -118,7 +118,6 @@ /* I2C */ #define CONFIG_FSL_I2C #define CONFIG_HARD_I2C /* I2C with hw support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 80000 #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x58000 diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h index c1a5ecd..beab127 100644 --- a/include/configs/bf533-ezkit.h +++ b/include/configs/bf533-ezkit.h @@ -94,10 +94,15 @@ /* * I2C Settings */ -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C_SOFT +#ifdef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF0 #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF1 - +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 +#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ +#endif /* * Misc Settings diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index e3344e9..7144c63 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -14,7 +14,6 @@ #define CONFIG_BFIN_CPU bf533-0.3 #define CONFIG_BFIN_BOOT_MODE BFIN_BOOT_BYPASS - /* * Clock Settings * CCLK = (CLKIN * VCO_MULT) / CCLK_DIV @@ -38,7 +37,6 @@ /* Values can range from 1-15 */ #define CONFIG_SCLK_DIV 6 /* note: 1.2 boards can go faster */ - /* * Memory Settings */ @@ -74,6 +72,42 @@ /* #define CONFIG_ETHADDR 02:80:ad:20:31:b8 */ +/* I2C */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 +/* + * Software (bit-bang) I2C driver configuration + */ +#define PF_SCL PF3 +#define PF_SDA PF2 +#define I2C_INIT (*pFIO_DIR |= PF_SCL); asm("ssync;") +#define I2C_ACTIVE (*pFIO_DIR |= PF_SDA); \ + *pFIO_INEN &= ~PF_SDA; asm("ssync;") +#define I2C_TRISTATE (*pFIO_DIR &= ~PF_SDA); \ + *pFIO_INEN |= PF_SDA; asm("ssync;") +#define I2C_READ ((volatile)(*pFIO_FLAG_D & PF_SDA) != 0); \ + asm("ssync;") +#define I2C_SDA(bit) if (bit) { \ + *pFIO_FLAG_S = PF_SDA; \ + asm("ssync;"); \ + } \ + else { \ + *pFIO_FLAG_C = PF_SDA; \ + asm("ssync;"); \ + } +#define I2C_SCL(bit) if (bit) { \ + *pFIO_FLAG_S = PF_SCL; \ + asm("ssync;"); \ + } \ + else { \ + *pFIO_FLAG_C = PF_SCL; \ + asm("ssync;"); \ + } +#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ + + /* * Flash Settings */ @@ -84,7 +118,6 @@ #define CONFIG_SYS_MAX_FLASH_BANKS 1 #define CONFIG_SYS_MAX_FLASH_SECT 67 - /* * SPI Settings */ @@ -132,10 +165,15 @@ /* * I2C Settings */ -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C_SOFT +#ifdef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF3 #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF2 - +#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 +#endif /* * Compact Flash / IDE / ATA Settings diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h index 6ee1e4c..404039a 100644 --- a/include/configs/bf561-ezkit.h +++ b/include/configs/bf561-ezkit.h @@ -88,10 +88,14 @@ /* * I2C Settings */ -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C_SOFT +#ifdef CONFIG_SYS_I2C_SOFT #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF0 #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF1 - +#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 +#endif /* * Misc Settings diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h index e1a6fe3..08ccce0 100644 --- a/include/configs/bfin_adi_common.h +++ b/include/configs/bfin_adi_common.h @@ -71,7 +71,7 @@ # ifdef CONFIG_SPI_FLASH # define CONFIG_CMD_SF # endif -# if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +# if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) # define CONFIG_CMD_I2C # define CONFIG_SOFT_I2C_READ_REPEATED_START # endif @@ -299,7 +299,7 @@ /* * I2C Settings */ -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) # ifndef CONFIG_SYS_I2C_SPEED # define CONFIG_SYS_I2C_SPEED 50000 # endif diff --git a/include/configs/blackstamp.h b/include/configs/blackstamp.h index 83ad659..7d82275 100644 --- a/include/configs/blackstamp.h +++ b/include/configs/blackstamp.h @@ -40,7 +40,6 @@ #define SHARED_RESOURCES 1 /* Is I2C bit-banged? */ -#undef CONFIG_SOFT_I2 /* * Clock Settings @@ -115,7 +114,7 @@ # undef CONFIG_CMD_NET #endif -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT # define CONFIG_CMD_I2C #endif @@ -204,11 +203,11 @@ * Note these pins are arbitrarily chosen because we aren't using * them yet. You can (and probably should) change these values! */ -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF9 #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF8 -#define CONFIG_SYS_I2C_SPEED 50000 -#define CONFIG_SYS_I2C_SLAVE 0xFE +#define CONFIG_SYS_SOFT_I2C_SPEED 50000 +#define CONFIG_SYS_SOFT_I2C_SLAVE 0xFE #endif /* diff --git a/include/configs/blackvme.h b/include/configs/blackvme.h index 523c4e4..cd37f9a 100644 --- a/include/configs/blackvme.h +++ b/include/configs/blackvme.h @@ -224,7 +224,7 @@ * Soft I2C settings (BF561 does not have hard I2C) * PF12,13 on SPI connector 0. */ -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT # define CONFIG_CMD_I2C # define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF12 # define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF13 diff --git a/include/configs/cpuat91.h b/include/configs/cpuat91.h index 15d56c3..d9b006a 100644 --- a/include/configs/cpuat91.h +++ b/include/configs/cpuat91.h @@ -92,7 +92,6 @@ #define CONFIG_USART_ID 0/* ignored in arm */ #undef CONFIG_HARD_I2C -#undef CONFIG_SOFT_I2C #define AT91_PIN_SDA (1<<25) #define AT91_PIN_SCL (1<<26) @@ -139,7 +138,7 @@ #undef CONFIG_CMD_NFS #undef CONFIG_CMD_DHCP -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT #define CONFIG_CMD_EEPROM #define CONFIG_CMD_I2C #endif diff --git a/include/configs/debris.h b/include/configs/debris.h index 32aa4e5..8315c6e 100644 --- a/include/configs/debris.h +++ b/include/configs/debris.h @@ -272,12 +272,15 @@ * configuration items that the driver uses to drive the port pins. */ #define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ +#undef CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT #error "Soft I2C is not configured properly. Please review!" +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -287,7 +290,7 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 /* EEPROM IS24C02 */ #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ diff --git a/include/configs/eXalion.h b/include/configs/eXalion.h index 3238ac7..122e0b3 100644 --- a/include/configs/eXalion.h +++ b/include/configs/eXalion.h @@ -223,7 +223,7 @@ * configuration items that the driver uses to drive the port pins. */ #define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ +#undef CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/eb_cpux9k2.h b/include/configs/eb_cpux9k2.h index 3be4929..efb50e3 100644 --- a/include/configs/eb_cpux9k2.h +++ b/include/configs/eb_cpux9k2.h @@ -223,11 +223,10 @@ * I2C-Bus */ -#define CONFIG_SYS_I2C_SPEED 50000 -#define CONFIG_SYS_I2C_SLAVE 0 /* not used */ - -#ifndef CONFIG_HARD_I2C -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 /* Software I2C driver configuration */ @@ -251,9 +250,7 @@ else \ writel(ATMEL_PMX_AA_TWCK, &pio->pioa.codr); -#define I2C_DELAY udelay(2500000/CONFIG_SYS_I2C_SPEED) - -#endif /* CONFIG_HARD_I2C */ +#define I2C_DELAY udelay(2500000/CONFIG_SYS_I2C_SOFT_SPEED) /* I2C-RTC */ diff --git a/include/configs/ep8260.h b/include/configs/ep8260.h index 5a87cc5..2e675bc 100644 --- a/include/configs/ep8260.h +++ b/include/configs/ep8260.h @@ -227,15 +227,18 @@ * If the software driver is chosen, there are some additional * configuration items that the driver uses to drive the port pins. */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ + #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_SYS_I2C_SLAVE 0x7F /* This is for HARD, must go */ /* * Software (bit-bang) I2C driver configuration */ -#ifdef CONFIG_SOFT_I2C +#ifdef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -245,7 +248,7 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ /* #define CONFIG_RTC_DS174x */ diff --git a/include/configs/ethernut5.h b/include/configs/ethernut5.h index 14a0f02..5bf8c22 100644 --- a/include/configs/ethernut5.h +++ b/include/configs/ethernut5.h @@ -210,10 +210,12 @@ /* I2C */ #define CONFIG_SYS_MAX_I2C_BUS 1 -#define CONFIG_SYS_I2C_SLAVE 0 -#define CONFIG_SYS_I2C_SPEED 100000 -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 100000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 + #define I2C_SOFT_DECLARATIONS #define GPIO_I2C_SCL AT91_PIO_PORTA, 24 diff --git a/include/configs/ibf-dsp561.h b/include/configs/ibf-dsp561.h index 294af73..5291755 100644 --- a/include/configs/ibf-dsp561.h +++ b/include/configs/ibf-dsp561.h @@ -105,11 +105,11 @@ /* * I2C Settings */ -#define CONFIG_SOFT_I2C 1 +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF0 #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF1 - /* * Misc Settings */ diff --git a/include/configs/iocon.h b/include/configs/iocon.h index 7f8825b..695aa5c 100644 --- a/include/configs/iocon.h +++ b/include/configs/iocon.h @@ -110,11 +110,11 @@ /* * I2C stuff */ -#define CONFIG_SYS_I2C_SPEED 400000 - -/* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ +#undef CONFIG_HARD_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index 3b15c4e..6182e81 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -78,10 +78,7 @@ #define CONFIG_LOADS_ECHO #define CONFIG_SYS_LOADS_BAUD_CHANGE -#define CONFIG_I2C_MULTI_BUS -#define CONFIG_SYS_MAX_I2C_BUS 1 #define CONFIG_SYS_I2C_INIT_BOARD -#define CONFIG_I2C_MUX /* Support the IVM EEprom */ #define CONFIG_SYS_IVM_EEPROM_ADR 0x50 diff --git a/include/configs/km/km83xx-common.h b/include/configs/km/km83xx-common.h index eb0e5b6..5a430ed 100644 --- a/include/configs/km/km83xx-common.h +++ b/include/configs/km/km83xx-common.h @@ -209,6 +209,9 @@ #define CONFIG_SYS_I2C_SPEED 200000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x3000 +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 1 +#define CONFIG_I2C_MUX /* I2C SYSMON (LM75, AD7414 is almost compatible) */ #define CONFIG_DTT_LM75 /* ON Semi's LM75 */ diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h index 766d76e..c2c67c1 100644 --- a/include/configs/km/km_arm.h +++ b/include/configs/km/km_arm.h @@ -58,7 +58,6 @@ #define CONFIG_CMD_NAND #define CONFIG_CMD_SF -#define CONFIG_SOFT_I2C /* I2C bit-banged */ /* SPI NOR Flash default params, used by sf commands */ #define CONFIG_SF_DEFAULT_SPEED 8100000 @@ -187,8 +186,23 @@ /* * I2C related stuff */ +#undef CONFIG_I2C_MVTWSI +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ + #define CONFIG_KIRKWOOD_GPIO /* Enable GPIO Support */ -#if defined(CONFIG_SOFT_I2C) +#if defined(CONFIG_SYS_I2C_SOFT) + +#define CONFIG_SYS_NUM_I2C_BUSES 6 +#define CONFIG_SYS_I2C_MAX_HOPS 1 +#define CONFIG_SYS_I2C_BUSES { {0, {I2C_NULL_HOP} }, \ + {0, {{I2C_MUX_PCA9547, 0x70, 1} } }, \ + {0, {{I2C_MUX_PCA9547, 0x70, 2} } }, \ + {0, {{I2C_MUX_PCA9547, 0x70, 3} } }, \ + {0, {{I2C_MUX_PCA9547, 0x70, 4} } }, \ + {0, {{I2C_MUX_PCA9547, 0x70, 5} } }, \ + } + #ifndef __ASSEMBLY__ #include extern void __set_direction(unsigned pin, int high); @@ -211,6 +225,8 @@ int get_scl(void); #define I2C_DELAY udelay(1) #define I2C_SOFT_DECLARATIONS +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x0 +#define CONFIG_SYS_I2C_SOFT_SPEED 100000 #endif /* EEprom support 24C128, 24C256 valid for environment eeprom */ @@ -240,7 +256,7 @@ int get_scl(void); #define CONFIG_SYS_EEPROM_WREN #define CONFIG_ENV_OFFSET 0x0 /* no bracets! */ #define CONFIG_ENV_SIZE (0x2000 - CONFIG_ENV_OFFSET) -#define CONFIG_I2C_ENV_EEPROM_BUS KM_ENV_BUS "\0" +#define CONFIG_I2C_ENV_EEPROM_BUS KM_ENV_BUS #define CONFIG_ENV_OFFSET_REDUND 0x2000 /* no bracets! */ #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE) #endif @@ -293,7 +309,7 @@ int get_scl(void); CONFIG_KM_DEF_ENV \ CONFIG_KM_NEW_ENV \ "arch=arm\0" \ - "EEprom_ivm=" KM_IVM_BUS "\0" \ + "EEprom_ivm=" __stringify(KM_IVM_BUS) "\0" \ "" #if defined(CONFIG_SYS_NO_FLASH) diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h index 3c2117f..54041f3 100644 --- a/include/configs/km82xx.h +++ b/include/configs/km82xx.h @@ -212,7 +212,7 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_KM_BOARD_EXTRA_ENV \ CONFIG_KM_DEF_ENV \ - "EEprom_ivm=pca9544a:70:4 \0" \ + "EEprom_ivm=1\0" \ "unlock=yes\0" \ "newenv=" \ "prot off 0xFE0C0000 +0x40000 && " \ @@ -242,10 +242,16 @@ #endif /* CONFIG_ENV_IS_IN_FLASH */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 50000 /* I2C speed */ -#define CONFIG_SYS_I2C_SLAVE 0x7F /* I2C slave address */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_NUM_I2C_BUSES 3 +#define CONFIG_SYS_I2C_MAX_HOPS 1 +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F +#define CONFIG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP} }, \ + {0, {{I2C_MUX_PCA9542, 0x70, 0} } }, \ + {0, {{I2C_MUX_PCA9542, 0x70, 1} } } } /* * Software (bit-bang) I2C driver configuration @@ -282,7 +288,7 @@ int get_scl(void); #define CONFIG_SYS_DTT_MAX_TEMP 70 #define CONFIG_SYS_DTT_LOW_TEMP -30 #define CONFIG_SYS_DTT_HYSTERESIS 3 -#define CONFIG_SYS_DTT_BUS_NUM (CONFIG_SYS_MAX_I2C_BUS) +#define CONFIG_SYS_DTT_BUS_NUM 2 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 diff --git a/include/configs/km_kirkwood.h b/include/configs/km_kirkwood.h index 83bb7aa..a0ad47e 100644 --- a/include/configs/km_kirkwood.h +++ b/include/configs/km_kirkwood.h @@ -42,18 +42,18 @@ #define CONFIG_IDENT_STRING "\nKeymile Kirkwood" #define CONFIG_HOSTNAME km_kirkwood #define CONFIG_KM_DISABLE_PCIE -#define KM_IVM_BUS "pca9544a:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ /* KM_KIRKWOOD_PCI */ #elif defined(CONFIG_KM_KIRKWOOD_PCI) #define CONFIG_IDENT_STRING "\nKeymile Kirkwood PCI" #define CONFIG_HOSTNAME km_kirkwood_pci -#define KM_IVM_BUS "pca9544a:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ #define CONFIG_KM_FPGA_CONFIG /* KM_NUSA */ #elif defined(CONFIG_KM_NUSA) -#define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ #define CONFIG_IDENT_STRING "\nKeymile NUSA" #define CONFIG_HOSTNAME kmnusa #undef CONFIG_SYS_KWD_CONFIG @@ -69,7 +69,7 @@ #elif defined(CONFIG_KM_MGCOGE3UN) #define CONFIG_IDENT_STRING "\nKeymile COGE3UN" #define CONFIG_HOSTNAME mgcoge3un -#define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ #undef CONFIG_SYS_KWD_CONFIG #define CONFIG_SYS_KWD_CONFIG \ $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-memphis.cfg @@ -81,7 +81,7 @@ /* KMCOGE5UN */ #elif defined(CONFIG_KM_COGE5UN) #define CONFIG_IDENT_STRING "\nKeymile COGE5UN" -#define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ #undef CONFIG_SYS_KWD_CONFIG #define CONFIG_SYS_KWD_CONFIG \ $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage_256M8_1.cfg @@ -95,12 +95,12 @@ #elif defined(CONFIG_KM_PORTL2) #define CONFIG_IDENT_STRING "\nKeymile Port-L2" #define CONFIG_HOSTNAME portl2 -#define KM_IVM_BUS "pca9544a:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ #define CONFIG_KM_PIGGY4_88E6061 /* KM_SUV31 */ #elif defined(CONFIG_KM_SUV31) -#define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/ +#define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ #define CONFIG_IDENT_STRING "\nKeymile SUV31" #define CONFIG_HOSTNAME kmsuv31 #define CONFIG_KM_ENV_IS_IN_SPI_NOR @@ -114,7 +114,7 @@ #include "km/km_arm.h" #ifndef CONFIG_KM_ENV_IS_IN_SPI_NOR -#define KM_ENV_BUS "pca9544a:70:d" /* I2C2 (Mux-Port 5)*/ +#define KM_ENV_BUS 5 /* I2C2 (Mux-Port 5)*/ #endif #if defined(CONFIG_KM_PIGGY4_88E6352) diff --git a/include/configs/korat.h b/include/configs/korat.h index b919aec..7d5fb15 100644 --- a/include/configs/korat.h +++ b/include/configs/korat.h @@ -156,7 +156,6 @@ * I2C */ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h index 3c02b73..dc0bd33 100644 --- a/include/configs/lwmon.h +++ b/include/configs/lwmon.h @@ -146,13 +146,10 @@ #undef CONFIG_STATUS_LED /* Status LED disabled */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -168,7 +165,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ #define CONFIG_RTC_PCF8563 /* use Philips PCF8563 RTC */ diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h index ba613e3..4dcb25a 100644 --- a/include/configs/lwmon5.h +++ b/include/configs/lwmon5.h @@ -299,7 +299,6 @@ * I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h index af30257..a3be6e8 100644 --- a/include/configs/mecp5123.h +++ b/include/configs/mecp5123.h @@ -267,7 +267,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* so disable bit-banged I2C */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed */ #define CONFIG_SYS_I2C_SLAVE 0x7F /* slave address */ diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h index 6e6af62..fd87566 100644 --- a/include/configs/mpc5121ads.h +++ b/include/configs/mpc5121ads.h @@ -359,7 +359,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* so disable bit-banged I2C */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/nhk8815.h b/include/configs/nhk8815.h index d438efd..09073e9 100644 --- a/include/configs/nhk8815.h +++ b/include/configs/nhk8815.h @@ -109,8 +109,11 @@ #ifndef __ASSEMBLY__ #include #define CONFIG_CMD_I2C -#define CONFIG_SOFT_I2C -#define CONFIG_SYS_I2C_SPEED 400000 +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT 1 /* I2C bit-banged */ +#define I2C_SOFT_DEFS +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F #define __SDA 63 #define __SCL 62 #define I2C_SDA(x) nmk_gpio_set(__SDA, x) diff --git a/include/configs/otc570.h b/include/configs/otc570.h index fe4f3c0..010e1b9 100644 --- a/include/configs/otc570.h +++ b/include/configs/otc570.h @@ -115,14 +115,13 @@ /* RTC and I2C stuff */ #define CONFIG_RTC_DS1338 #define CONFIG_SYS_I2C_RTC_ADDR 0x68 -#undef CONFIG_HARD_I2C -#define CONFIG_SOFT_I2C -#define CONFIG_SYS_I2C_SPEED 100000 -#define CONFIG_SYS_I2C_SLAVE 0x7F - -#ifdef CONFIG_SOFT_I2C -# define CONFIG_I2C_CMD_TREE -# define CONFIG_I2C_MULTI_BUS + +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#ifdef CONFIG_SYS_I2C_SOFT +#define CONFIG_SYS_I2C_SOFT_SPEED 100000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F + /* Configure data and clock pins for pio */ # define I2C_INIT { \ at91_set_pio_output(AT91_PIO_PORTB, 4, 0); \ @@ -140,7 +139,7 @@ /* Set clock pin */ # define I2C_SCL(bit) at91_set_pio_value(AT91_PIO_PORTB, 5, bit) # define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ +#endif /* CONFIG_SYS_I2C_SOFT */ /* * BOOTP options diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index 7ed634b..bedf28f 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -535,7 +535,6 @@ /* I2C */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C spd and slave address */ diff --git a/include/configs/p3p440.h b/include/configs/p3p440.h index d7b1ca2..ba10e88 100644 --- a/include/configs/p3p440.h +++ b/include/configs/p3p440.h @@ -98,7 +98,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h index 351ff5a..8d46607 100644 --- a/include/configs/pcs440ep.h +++ b/include/configs/pcs440ep.h @@ -140,7 +140,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/pdnb3.h b/include/configs/pdnb3.h index 1e07317..9aa112a 100644 --- a/include/configs/pdnb3.h +++ b/include/configs/pdnb3.h @@ -281,12 +281,10 @@ */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 83000 /* 83 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 83000 /* 83 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h index 5f1bb58..30a8c55 100644 --- a/include/configs/quad100hd.h +++ b/include/configs/quad100hd.h @@ -153,7 +153,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h index 56e8347..89ae32b 100644 --- a/include/configs/s5p_goni.h +++ b/include/configs/s5p_goni.h @@ -226,8 +226,10 @@ #define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3) #define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0) -#define CONFIG_SOFT_I2C 1 -#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_MAX_I2C_BUS 7 #define CONFIG_USB_GADGET diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h index eb13bb3..f7266aa 100644 --- a/include/configs/s5pc210_universal.h +++ b/include/configs/s5pc210_universal.h @@ -250,9 +250,11 @@ #define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7) #define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6) -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0 #define CONFIG_SOFT_I2C_READ_REPEATED_START -#define CONFIG_SYS_I2C_SPEED 50000 #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_MAX_I2C_BUS 7 diff --git a/include/configs/sacsng.h b/include/configs/sacsng.h index 54d55a0..efbf6b6 100644 --- a/include/configs/sacsng.h +++ b/include/configs/sacsng.h @@ -296,15 +296,13 @@ * If the software driver is chosen, there are some additional * configuration items that the driver uses to drive the port pins. */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ -#define CONFIG_SYS_I2C_SLAVE 0x7F - +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F /* * Software (bit-bang) I2C driver configuration */ -#ifdef CONFIG_SOFT_I2C #define I2C_PORT 3 /* Port A=0, B=1, C=2, D=3 */ #define I2C_ACTIVE (iop->pdir |= 0x00010000) #define I2C_TRISTATE (iop->pdir &= ~0x00010000) @@ -314,7 +312,6 @@ #define I2C_SCL(bit) if(bit) iop->pdat |= 0x00020000; \ else iop->pdat &= ~0x00020000 #define I2C_DELAY udelay(20) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ /* Define this to reserve an entire FLASH sector for * environment variables. Otherwise, the environment will be diff --git a/include/configs/sbc405.h b/include/configs/sbc405.h index 5abcda3..9918638 100644 --- a/include/configs/sbc405.h +++ b/include/configs/sbc405.h @@ -169,7 +169,6 @@ #define CONFIG_SYS_RX_ETH_BUFFER 16 /* use 16 rx buffer on 405 emac */ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/sbc8349.h b/include/configs/sbc8349.h index 478d0d8..6d115c5 100644 --- a/include/configs/sbc8349.h +++ b/include/configs/sbc8349.h @@ -305,7 +305,6 @@ /* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h index 2209ddf..33197b4 100644 --- a/include/configs/sbc8548.h +++ b/include/configs/sbc8548.h @@ -445,7 +445,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h index 9040ec6..8142205 100644 --- a/include/configs/sbc8641d.h +++ b/include/configs/sbc8641d.h @@ -290,7 +290,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/sc3.h b/include/configs/sc3.h index fb74608..abca9e0 100644 --- a/include/configs/sc3.h +++ b/include/configs/sc3.h @@ -247,7 +247,6 @@ *----------------------------------------------------------------------- */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define I2C_INIT diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h index 218ca54..c683fab 100644 --- a/include/configs/snapper9260.h +++ b/include/configs/snapper9260.h @@ -106,11 +106,11 @@ #define CONFIG_SYS_PROMPT "Snapper> " /* I2C - Bit-bashed */ -#define CONFIG_SOFT_I2C -#define CONFIG_SYS_I2C_SPEED 100000 -#define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 100000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F #define CONFIG_SOFT_I2C_READ_REPEATED_START -#define CONFIG_I2C_MULTI_BUS #define I2C_INIT do { \ at91_set_gpio_output(AT91_PIN_PA23, 1); \ at91_set_gpio_output(AT91_PIN_PA24, 1); \ diff --git a/include/configs/socrates.h b/include/configs/socrates.h index 25f15f2..e42c8aa 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -236,7 +236,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 102124 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x3000 diff --git a/include/configs/spc1920.h b/include/configs/spc1920.h index 87878d5..2a9b00c 100644 --- a/include/configs/spc1920.h +++ b/include/configs/spc1920.h @@ -207,13 +207,10 @@ */ #if defined(CONFIG_CMD_I2C) /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -229,7 +226,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ #endif /*----------------------------------------------------------------------- diff --git a/include/configs/stxgp3.h b/include/configs/stxgp3.h index 939a964..b688b45 100644 --- a/include/configs/stxgp3.h +++ b/include/configs/stxgp3.h @@ -180,7 +180,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #if 0 diff --git a/include/configs/stxssa.h b/include/configs/stxssa.h index c1a90a7..5d8ff79 100644 --- a/include/configs/stxssa.h +++ b/include/configs/stxssa.h @@ -199,7 +199,6 @@ */ #define CONFIG_FSL_I2C /* Use FSL common I2C driver */ #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #undef CONFIG_SYS_I2C_NOPROBES diff --git a/include/configs/top9000.h b/include/configs/top9000.h index 7cc6577..884670d 100644 --- a/include/configs/top9000.h +++ b/include/configs/top9000.h @@ -201,11 +201,12 @@ #define CONFIG_CMD_USB /* I2C support must always be enabled */ -#define CONFIG_SOFT_I2C #define CONFIG_CMD_I2C -#define CONFIG_SYS_I2C_SPEED 400000 -#define CONFIG_SYS_I2C_SLAVE 0x7F -#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 400000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F + #define I2C0_PORT AT91_PIO_PORTA #define SDA0_PIN 23 #define SCL0_PIN 24 diff --git a/include/configs/trats.h b/include/configs/trats.h index fd58558..ccb5dc8 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -269,10 +269,12 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_CACHELINE_SIZE 32 -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 50000 +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE #define CONFIG_SOFT_I2C_READ_REPEATED_START #define CONFIG_SYS_I2C_INIT_BOARD -#define CONFIG_SYS_I2C_SPEED 50000 #define CONFIG_I2C_MULTI_BUS #define CONFIG_SOFT_I2C_MULTI_BUS #define CONFIG_SYS_MAX_I2C_BUS 15 diff --git a/include/configs/u8500_href.h b/include/configs/u8500_href.h index 1bb6128..218feeb 100644 --- a/include/configs/u8500_href.h +++ b/include/configs/u8500_href.h @@ -166,7 +166,6 @@ */ #define CONFIG_U8500_I2C #undef CONFIG_HARD_I2C /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_SYS_I2C_SPEED 100000 #define CONFIG_SYS_I2C_SLAVE 0 /* slave addr of controller */ diff --git a/include/configs/uc100.h b/include/configs/uc100.h index 450c98b..ce122b4 100644 --- a/include/configs/uc100.h +++ b/include/configs/uc100.h @@ -464,13 +464,10 @@ */ /* enable I2C and select the hardware/software driver */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 93000 /* 93 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0xFE - -#ifdef CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 93000 /* 93 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE /* * Software (bit-bang) I2C driver configuration */ @@ -486,7 +483,6 @@ #define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \ else immr->im_cpm.cp_pbdat &= ~PB_SCL #define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */ -#endif /* CONFIG_SOFT_I2C */ /*----------------------------------------------------------------------- * I2C EEPROM (24C164) diff --git a/include/configs/utx8245.h b/include/configs/utx8245.h index 66568c8..813e08a 100644 --- a/include/configs/utx8245.h +++ b/include/configs/utx8245.h @@ -234,8 +234,7 @@ protect on ${u-boot_startaddr} ${u-boot_endaddr}" *------------------------------------------------------------------*/ #if 1 #define CONFIG_HARD_I2C 1 /* To enable I2C support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ +#define CONFIG_SYS_I2C_SPEED 400000 #define CONFIG_SYS_I2C_SLAVE 0x7F #endif diff --git a/include/configs/vct.h b/include/configs/vct.h index 7aeb668..fbdb728 100644 --- a/include/configs/vct.h +++ b/include/configs/vct.h @@ -245,11 +245,10 @@ /* * I2C/EEPROM */ -#undef CONFIG_HARD_I2C /* I2C with hardware support */ -#define CONFIG_SOFT_I2C /* I2C bit-banged */ - -#define CONFIG_SYS_I2C_SPEED 83000 /* 83 kHz is supposed to work */ -#define CONFIG_SYS_I2C_SLAVE 0x7f +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED 83000 /* 83 kHz is supposed to work */ +#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7f /* * Software (bit-bang) I2C driver configuration @@ -337,7 +336,7 @@ int vct_gpio_get(int pin); #undef CONFIG_CMD_USB #undef CONFIG_SMC911X -#undef CONFIG_SOFT_I2C +#undef CONFIG_SYS_I2C_SOFT #undef CONFIG_SOURCE #undef CONFIG_SYS_LONGHELP #undef CONFIG_TIMESTAMP diff --git a/include/configs/vl_ma2sc.h b/include/configs/vl_ma2sc.h index e2cf4f0..5c43c1b 100644 --- a/include/configs/vl_ma2sc.h +++ b/include/configs/vl_ma2sc.h @@ -147,10 +147,12 @@ #define CONFIG_SYS_I2C_SLAVE 0 /* not used */ #ifndef CONFIG_HARD_I2C -#define CONFIG_SOFT_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED CONFIG_SYS_I2C_SPEED +#define CONFIG_SYS_I2C_SOFT_SLAVE CONFIG_SYS_I2C_SLAVE /* Software I2C driver configuration */ - #define I2C_DELAY udelay(2500000/CONFIG_SYS_I2C_SPEED) #define AT91_PIN_SDA (1<<4) /* AT91C_PIO_PB4 */ diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h index 61e02e6..eec7ee2 100644 --- a/include/configs/vme8349.h +++ b/include/configs/vme8349.h @@ -239,7 +239,6 @@ /* I2C */ #define CONFIG_I2C_MULTI_BUS #define CONFIG_HARD_I2C /* I2C with hardware support*/ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ diff --git a/include/configs/zeus.h b/include/configs/zeus.h index b0c3bd5..75195bc 100644 --- a/include/configs/zeus.h +++ b/include/configs/zeus.h @@ -169,7 +169,6 @@ * I2C *----------------------------------------------------------------------*/ #define CONFIG_HARD_I2C 1 /* I2C with hardware support */ -#undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_PPC4XX_I2C /* use PPC4xx driver */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/i2c.h b/include/i2c.h index 3e09af9..f532a14 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -305,6 +305,15 @@ unsigned int i2c_get_bus_speed(void); * Adjusts I2C pointers after U-Boot is relocated to DRAM */ void i2c_reloc_fixup(void); +#if defined(CONFIG_SYS_I2C_SOFT) +void i2c_soft_init(void); +void i2c_soft_active(void); +void i2c_soft_tristate(void); +int i2c_soft_read(void); +void i2c_soft_sda(int bit); +void i2c_soft_scl(int bit); +void i2c_soft_delay(void); +#endif #else /*