mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-03 21:48:15 +00:00 
			
		
		
		
	Merge branch 'master' of git://git.denx.de/u-boot-i2c
This commit is contained in:
		
						commit
						f8eab9c3e1
					
				@ -49,10 +49,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_SYS_I2C_MX31_PORT1
 | 
					#ifdef CONFIG_SYS_I2C_MX31_PORT1
 | 
				
			||||||
#define I2C_BASE	0x43f80000
 | 
					#define I2C_BASE	0x43f80000
 | 
				
			||||||
 | 
					#define I2C_CLK_OFFSET	26
 | 
				
			||||||
#elif defined (CONFIG_SYS_I2C_MX31_PORT2)
 | 
					#elif defined (CONFIG_SYS_I2C_MX31_PORT2)
 | 
				
			||||||
#define I2C_BASE	0x43f98000
 | 
					#define I2C_BASE	0x43f98000
 | 
				
			||||||
 | 
					#define I2C_CLK_OFFSET	28
 | 
				
			||||||
#elif defined (CONFIG_SYS_I2C_MX31_PORT3)
 | 
					#elif defined (CONFIG_SYS_I2C_MX31_PORT3)
 | 
				
			||||||
#define I2C_BASE	0x43f84000
 | 
					#define I2C_BASE	0x43f84000
 | 
				
			||||||
 | 
					#define I2C_CLK_OFFSET	30
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
 | 
					#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -72,6 +75,9 @@ void i2c_init(int speed, int unused)
 | 
				
			|||||||
	int freq = mx31_get_ipg_clk();
 | 
						int freq = mx31_get_ipg_clk();
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* start the required I2C clock */
 | 
				
			||||||
 | 
						__REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << I2C_CLK_OFFSET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < 0x1f; i++)
 | 
						for (i = 0; i < 0x1f; i++)
 | 
				
			||||||
		if (freq / div[i] <= speed)
 | 
							if (freq / div[i] <= speed)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
				
			|||||||
@ -159,14 +159,7 @@ static inline u8 i2c_reg_read(u8 addr, u8 reg)
 | 
				
			|||||||
	printf("%s: addr=0x%02x, reg=0x%02x\n", __func__, addr, reg);
 | 
						printf("%s: addr=0x%02x, reg=0x%02x\n", __func__, addr, reg);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_BLACKFIN
 | 
					 | 
				
			||||||
	/* This ifdef will become unneccessary in a future version of the
 | 
					 | 
				
			||||||
	 * blackfin I2C driver.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	i2c_read(addr, reg, 0, &buf, 1);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	i2c_read(addr, reg, 1, &buf, 1);
 | 
						i2c_read(addr, reg, 1, &buf, 1);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return buf;
 | 
						return buf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -183,14 +176,7 @@ static inline void i2c_reg_write(u8 addr, u8 reg, u8 val)
 | 
				
			|||||||
	       __func__, addr, reg, val);
 | 
						       __func__, addr, reg, val);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_BLACKFIN
 | 
					 | 
				
			||||||
	/* This ifdef will become unneccessary in a future version of the
 | 
					 | 
				
			||||||
	 * blackfin I2C driver.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	i2c_write(addr, reg, 0, &val, 1);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
	i2c_write(addr, reg, 1, &val, 1);
 | 
						i2c_write(addr, reg, 1, &val, 1);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user