wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * David Mueller, ELSOFT AG, d.mueller@elsoft.ch |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | /* This code should work for both the S3C2400 and the S3C2410 |
| 25 | * as they seem to have the same I2C controller inside. |
| 26 | * The different address mapping is handled by the s3c24xx.h files below. |
| 27 | */ |
| 28 | |
| 29 | #include <common.h> |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 30 | #ifdef CONFIG_EXYNOS5 |
| 31 | #include <asm/arch/clk.h> |
| 32 | #include <asm/arch/cpu.h> |
| 33 | #else |
kevin.morfitt@fearnside-systems.co.uk | ac67804 | 2009-11-17 18:30:34 +0900 | [diff] [blame] | 34 | #include <asm/arch/s3c24x0_cpu.h> |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 35 | #endif |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 36 | #include <asm/io.h> |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 37 | #include <i2c.h> |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 38 | #include "s3c24x0_i2c.h" |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 39 | |
| 40 | #ifdef CONFIG_HARD_I2C |
| 41 | |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 42 | #define I2C_WRITE 0 |
| 43 | #define I2C_READ 1 |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 44 | |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 45 | #define I2C_OK 0 |
| 46 | #define I2C_NOK 1 |
| 47 | #define I2C_NACK 2 |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 48 | #define I2C_NOK_LA 3 /* Lost arbitration */ |
| 49 | #define I2C_NOK_TOUT 4 /* time out */ |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 50 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 51 | #define I2CSTAT_BSY 0x20 /* Busy bit */ |
| 52 | #define I2CSTAT_NACK 0x01 /* Nack bit */ |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 53 | #define I2CCON_ACKGEN 0x80 /* Acknowledge generation */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 54 | #define I2CCON_IRPND 0x10 /* Interrupt pending bit */ |
| 55 | #define I2C_MODE_MT 0xC0 /* Master Transmit Mode */ |
| 56 | #define I2C_MODE_MR 0x80 /* Master Receive Mode */ |
| 57 | #define I2C_START_STOP 0x20 /* START / STOP */ |
| 58 | #define I2C_TXRX_ENA 0x10 /* I2C Tx/Rx enable */ |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 59 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 60 | #define I2C_TIMEOUT 1 /* 1 second */ |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 61 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 62 | |
| 63 | static unsigned int g_current_bus; /* Stores Current I2C Bus */ |
| 64 | |
| 65 | #ifndef CONFIG_EXYNOS5 |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 66 | static int GetI2CSDA(void) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 67 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 68 | struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio(); |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 69 | |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 70 | #ifdef CONFIG_S3C2410 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 71 | return (readl(&gpio->gpedat) & 0x8000) >> 15; |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 72 | #endif |
| 73 | #ifdef CONFIG_S3C2400 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 74 | return (readl(&gpio->pgdat) & 0x0020) >> 5; |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 75 | #endif |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 76 | } |
| 77 | |
wdenk | 06d01db | 2003-03-14 20:47:52 +0000 | [diff] [blame] | 78 | #if 0 |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 79 | static void SetI2CSDA(int x) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 80 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 81 | rGPEDAT = (rGPEDAT & ~0x8000) | (x & 1) << 15; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 82 | } |
wdenk | 06d01db | 2003-03-14 20:47:52 +0000 | [diff] [blame] | 83 | #endif |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 84 | |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 85 | static void SetI2CSCL(int x) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 86 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 87 | struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio(); |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 88 | |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 89 | #ifdef CONFIG_S3C2410 |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 90 | writel((readl(&gpio->gpedat) & ~0x4000) | |
| 91 | (x & 1) << 14, &gpio->gpedat); |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 92 | #endif |
| 93 | #ifdef CONFIG_S3C2400 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 94 | writel((readl(&gpio->pgdat) & ~0x0040) | (x & 1) << 6, &gpio->pgdat); |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 95 | #endif |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 96 | } |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 97 | #endif |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 98 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 99 | static int WaitForXfer(struct s3c24x0_i2c *i2c) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 100 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 101 | int i; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 102 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 103 | i = I2C_TIMEOUT * 10000; |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 104 | while (!(readl(&i2c->iiccon) & I2CCON_IRPND) && (i > 0)) { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 105 | udelay(100); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 106 | i--; |
| 107 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 108 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 109 | return (readl(&i2c->iiccon) & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 112 | static int IsACK(struct s3c24x0_i2c *i2c) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 113 | { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 114 | return !(readl(&i2c->iicstat) & I2CSTAT_NACK); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 115 | } |
| 116 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 117 | static void ReadWriteByte(struct s3c24x0_i2c *i2c) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 118 | { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 119 | writel(readl(&i2c->iiccon) & ~I2CCON_IRPND, &i2c->iiccon); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 120 | } |
| 121 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 122 | static struct s3c24x0_i2c *get_base_i2c(void) |
| 123 | { |
| 124 | #ifdef CONFIG_EXYNOS5 |
| 125 | struct s3c24x0_i2c *i2c = (struct s3c24x0_i2c *)(samsung_get_base_i2c() |
| 126 | + (EXYNOS5_I2C_SPACING |
| 127 | * g_current_bus)); |
| 128 | return i2c; |
| 129 | #else |
| 130 | return s3c24x0_get_base_i2c(); |
| 131 | #endif |
| 132 | } |
| 133 | |
| 134 | static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd) |
| 135 | { |
| 136 | ulong freq, pres = 16, div; |
| 137 | #ifdef CONFIG_EXYNOS5 |
| 138 | freq = get_i2c_clk(); |
| 139 | #else |
| 140 | freq = get_PCLK(); |
| 141 | #endif |
| 142 | /* calculate prescaler and divisor values */ |
| 143 | if ((freq / pres / (16 + 1)) > speed) |
| 144 | /* set prescaler to 512 */ |
| 145 | pres = 512; |
| 146 | |
| 147 | div = 0; |
| 148 | while ((freq / pres / (div + 1)) > speed) |
| 149 | div++; |
| 150 | |
| 151 | /* set prescaler, divisor according to freq, also set ACKGEN, IRQ */ |
| 152 | writel((div & 0x0F) | 0xA0 | ((pres == 512) ? 0x40 : 0), &i2c->iiccon); |
| 153 | |
| 154 | /* init to SLAVE REVEIVE and set slaveaddr */ |
| 155 | writel(0, &i2c->iicstat); |
| 156 | writel(slaveadd, &i2c->iicadd); |
| 157 | /* program Master Transmit (and implicit STOP) */ |
| 158 | writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat); |
| 159 | } |
| 160 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 161 | void i2c_init(int speed, int slaveadd) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 162 | { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 163 | struct s3c24x0_i2c *i2c; |
| 164 | #ifndef CONFIG_EXYNOS5 |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 165 | struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio(); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 166 | #endif |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 167 | int i; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 168 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 169 | /* By default i2c channel 0 is the current bus */ |
| 170 | g_current_bus = 0; |
| 171 | i2c = get_base_i2c(); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 172 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 173 | /* wait for some time to give previous transfer a chance to finish */ |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 174 | i = I2C_TIMEOUT * 1000; |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 175 | while ((readl(&i2c->iicstat) & I2CSTAT_BSY) && (i > 0)) { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 176 | udelay(1000); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 177 | i--; |
| 178 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 179 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 180 | #ifndef CONFIG_EXYNOS5 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 181 | if ((readl(&i2c->iicstat) & I2CSTAT_BSY) || GetI2CSDA() == 0) { |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 182 | #ifdef CONFIG_S3C2410 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 183 | ulong old_gpecon = readl(&gpio->gpecon); |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 184 | #endif |
| 185 | #ifdef CONFIG_S3C2400 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 186 | ulong old_gpecon = readl(&gpio->pgcon); |
wdenk | 6dff552 | 2003-07-15 07:45:49 +0000 | [diff] [blame] | 187 | #endif |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 188 | /* bus still busy probably by (most) previously interrupted |
| 189 | transfer */ |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 190 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 191 | #ifdef CONFIG_S3C2410 |
| 192 | /* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 193 | writel((readl(&gpio->gpecon) & ~0xF0000000) | 0x10000000, |
| 194 | &gpio->gpecon); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 195 | #endif |
| 196 | #ifdef CONFIG_S3C2400 |
| 197 | /* set I2CSDA and I2CSCL (PG5, PG6) to GPIO */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 198 | writel((readl(&gpio->pgcon) & ~0x00003c00) | 0x00001000, |
| 199 | &gpio->pgcon); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 200 | #endif |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 201 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 202 | /* toggle I2CSCL until bus idle */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 203 | SetI2CSCL(0); |
| 204 | udelay(1000); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 205 | i = 10; |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 206 | while ((i > 0) && (GetI2CSDA() != 1)) { |
| 207 | SetI2CSCL(1); |
| 208 | udelay(1000); |
| 209 | SetI2CSCL(0); |
| 210 | udelay(1000); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 211 | i--; |
| 212 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 213 | SetI2CSCL(1); |
| 214 | udelay(1000); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 215 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 216 | /* restore pin functions */ |
| 217 | #ifdef CONFIG_S3C2410 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 218 | writel(old_gpecon, &gpio->gpecon); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 219 | #endif |
| 220 | #ifdef CONFIG_S3C2400 |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 221 | writel(old_gpecon, &gpio->pgcon); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 222 | #endif |
| 223 | } |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 224 | #endif /* #ifndef CONFIG_EXYNOS5 */ |
| 225 | i2c_ch_init(i2c, speed, slaveadd); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | /* |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 229 | * cmd_type is 0 for write, 1 for read. |
| 230 | * |
| 231 | * addr_len can take any value from 0-255, it is only limited |
| 232 | * by the char, we could make it larger if needed. If it is |
| 233 | * 0 we skip the address write cycle. |
| 234 | */ |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 235 | static int i2c_transfer(struct s3c24x0_i2c *i2c, |
| 236 | unsigned char cmd_type, |
| 237 | unsigned char chip, |
| 238 | unsigned char addr[], |
| 239 | unsigned char addr_len, |
| 240 | unsigned char data[], |
| 241 | unsigned short data_len) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 242 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 243 | int i, result; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 244 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 245 | if (data == 0 || data_len == 0) { |
| 246 | /*Don't support data transfer of no length or to address 0 */ |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 247 | debug("i2c_transfer: bad call\n"); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 248 | return I2C_NOK; |
| 249 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 250 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 251 | /* Check I2C bus idle */ |
| 252 | i = I2C_TIMEOUT * 1000; |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 253 | while ((readl(&i2c->iicstat) & I2CSTAT_BSY) && (i > 0)) { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 254 | udelay(1000); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 255 | i--; |
| 256 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 257 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 258 | if (readl(&i2c->iicstat) & I2CSTAT_BSY) |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 259 | return I2C_NOK_TOUT; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 260 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 261 | writel(readl(&i2c->iiccon) | I2CCON_ACKGEN, &i2c->iiccon); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 262 | result = I2C_OK; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 263 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 264 | switch (cmd_type) { |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 265 | case I2C_WRITE: |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 266 | if (addr && addr_len) { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 267 | writel(chip, &i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 268 | /* send START */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 269 | writel(I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP, |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 270 | &i2c->iicstat); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 271 | i = 0; |
| 272 | while ((i < addr_len) && (result == I2C_OK)) { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 273 | result = WaitForXfer(i2c); |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 274 | writel(addr[i], &i2c->iicds); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 275 | ReadWriteByte(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 276 | i++; |
| 277 | } |
| 278 | i = 0; |
| 279 | while ((i < data_len) && (result == I2C_OK)) { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 280 | result = WaitForXfer(i2c); |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 281 | writel(data[i], &i2c->iicds); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 282 | ReadWriteByte(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 283 | i++; |
| 284 | } |
| 285 | } else { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 286 | writel(chip, &i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 287 | /* send START */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 288 | writel(I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP, |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 289 | &i2c->iicstat); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 290 | i = 0; |
| 291 | while ((i < data_len) && (result = I2C_OK)) { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 292 | result = WaitForXfer(i2c); |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 293 | writel(data[i], &i2c->iicds); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 294 | ReadWriteByte(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 295 | i++; |
| 296 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 297 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 298 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 299 | if (result == I2C_OK) |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 300 | result = WaitForXfer(i2c); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 301 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 302 | /* send STOP */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 303 | writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 304 | ReadWriteByte(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 305 | break; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 306 | |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 307 | case I2C_READ: |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 308 | if (addr && addr_len) { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 309 | writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat); |
| 310 | writel(chip, &i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 311 | /* send START */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 312 | writel(readl(&i2c->iicstat) | I2C_START_STOP, |
| 313 | &i2c->iicstat); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 314 | result = WaitForXfer(i2c); |
| 315 | if (IsACK(i2c)) { |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 316 | i = 0; |
| 317 | while ((i < addr_len) && (result == I2C_OK)) { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 318 | writel(addr[i], &i2c->iicds); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 319 | ReadWriteByte(i2c); |
| 320 | result = WaitForXfer(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 321 | i++; |
| 322 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 323 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 324 | writel(chip, &i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 325 | /* resend START */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 326 | writel(I2C_MODE_MR | I2C_TXRX_ENA | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 327 | I2C_START_STOP, &i2c->iicstat); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 328 | ReadWriteByte(i2c); |
| 329 | result = WaitForXfer(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 330 | i = 0; |
| 331 | while ((i < data_len) && (result == I2C_OK)) { |
| 332 | /* disable ACK for final READ */ |
| 333 | if (i == data_len - 1) |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 334 | writel(readl(&i2c->iiccon) |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 335 | & ~I2CCON_ACKGEN, |
| 336 | &i2c->iiccon); |
| 337 | ReadWriteByte(i2c); |
| 338 | result = WaitForXfer(i2c); |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 339 | data[i] = readl(&i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 340 | i++; |
| 341 | } |
| 342 | } else { |
| 343 | result = I2C_NACK; |
| 344 | } |
| 345 | |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 346 | } else { |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 347 | writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); |
| 348 | writel(chip, &i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 349 | /* send START */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 350 | writel(readl(&i2c->iicstat) | I2C_START_STOP, |
| 351 | &i2c->iicstat); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 352 | result = WaitForXfer(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 353 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 354 | if (IsACK(i2c)) { |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 355 | i = 0; |
| 356 | while ((i < data_len) && (result == I2C_OK)) { |
| 357 | /* disable ACK for final READ */ |
| 358 | if (i == data_len - 1) |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 359 | writel(readl(&i2c->iiccon) & |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 360 | ~I2CCON_ACKGEN, |
| 361 | &i2c->iiccon); |
| 362 | ReadWriteByte(i2c); |
| 363 | result = WaitForXfer(i2c); |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 364 | data[i] = readl(&i2c->iicds); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 365 | i++; |
| 366 | } |
| 367 | } else { |
| 368 | result = I2C_NACK; |
| 369 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 370 | } |
| 371 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 372 | /* send STOP */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 373 | writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 374 | ReadWriteByte(i2c); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 375 | break; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 376 | |
| 377 | default: |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 378 | debug("i2c_transfer: bad call\n"); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 379 | result = I2C_NOK; |
| 380 | break; |
| 381 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 382 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 383 | return result; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 384 | } |
| 385 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 386 | int i2c_probe(uchar chip) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 387 | { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 388 | struct s3c24x0_i2c *i2c; |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 389 | uchar buf[1]; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 390 | |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 391 | i2c = get_base_i2c(); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 392 | buf[0] = 0; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 393 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 394 | /* |
| 395 | * What is needed is to send the chip address and verify that the |
| 396 | * address was <ACK>ed (i.e. there was a chip at that address which |
| 397 | * drove the data line low). |
| 398 | */ |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 399 | return i2c_transfer(i2c, I2C_READ, chip << 1, 0, 0, buf, 1) != I2C_OK; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 400 | } |
| 401 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 402 | int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 403 | { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 404 | struct s3c24x0_i2c *i2c; |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 405 | uchar xaddr[4]; |
| 406 | int ret; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 407 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 408 | if (alen > 4) { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 409 | debug("I2C read: addr len %d not supported\n", alen); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 410 | return 1; |
| 411 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 412 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 413 | if (alen > 0) { |
| 414 | xaddr[0] = (addr >> 24) & 0xFF; |
| 415 | xaddr[1] = (addr >> 16) & 0xFF; |
| 416 | xaddr[2] = (addr >> 8) & 0xFF; |
| 417 | xaddr[3] = addr & 0xFF; |
| 418 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 419 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 420 | #ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 421 | /* |
| 422 | * EEPROM chips that implement "address overflow" are ones |
| 423 | * like Catalyst 24WC04/08/16 which has 9/10/11 bits of |
| 424 | * address and the extra bits end up in the "chip address" |
| 425 | * bit slots. This makes a 24WC08 (1Kbyte) chip look like |
| 426 | * four 256 byte chips. |
| 427 | * |
| 428 | * Note that we consider the length of the address field to |
| 429 | * still be one byte because the extra address bits are |
| 430 | * hidden in the chip address. |
| 431 | */ |
| 432 | if (alen > 0) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 433 | chip |= ((addr >> (alen * 8)) & |
| 434 | CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 435 | #endif |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 436 | i2c = get_base_i2c(); |
| 437 | ret = i2c_transfer(i2c, I2C_READ, chip << 1, &xaddr[4 - alen], alen, |
| 438 | buffer, len); |
| 439 | if (ret != 0) { |
| 440 | debug("I2c read: failed %d\n", ret); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 441 | return 1; |
| 442 | } |
| 443 | return 0; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 444 | } |
| 445 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 446 | int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 447 | { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 448 | struct s3c24x0_i2c *i2c; |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 449 | uchar xaddr[4]; |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 450 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 451 | if (alen > 4) { |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 452 | debug("I2C write: addr len %d not supported\n", alen); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 453 | return 1; |
| 454 | } |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 455 | |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 456 | if (alen > 0) { |
| 457 | xaddr[0] = (addr >> 24) & 0xFF; |
| 458 | xaddr[1] = (addr >> 16) & 0xFF; |
| 459 | xaddr[2] = (addr >> 8) & 0xFF; |
| 460 | xaddr[3] = addr & 0xFF; |
| 461 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 462 | #ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 463 | /* |
| 464 | * EEPROM chips that implement "address overflow" are ones |
| 465 | * like Catalyst 24WC04/08/16 which has 9/10/11 bits of |
| 466 | * address and the extra bits end up in the "chip address" |
| 467 | * bit slots. This makes a 24WC08 (1Kbyte) chip look like |
| 468 | * four 256 byte chips. |
| 469 | * |
| 470 | * Note that we consider the length of the address field to |
| 471 | * still be one byte because the extra address bits are |
| 472 | * hidden in the chip address. |
| 473 | */ |
| 474 | if (alen > 0) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 475 | chip |= ((addr >> (alen * 8)) & |
| 476 | CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 477 | #endif |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 478 | i2c = get_base_i2c(); |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 479 | return (i2c_transfer |
Rajeshwari Shinde | ab7e52b | 2012-07-23 21:23:53 +0000 | [diff] [blame^] | 480 | (i2c, I2C_WRITE, chip << 1, &xaddr[4 - alen], alen, buffer, |
wdenk | fc3e216 | 2003-10-08 22:33:00 +0000 | [diff] [blame] | 481 | len) != 0); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 482 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 483 | #endif /* CONFIG_HARD_I2C */ |