summaryrefslogtreecommitdiff
path: root/arch/arm/plat-aspeed/dev-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-aspeed/dev-i2c.c')
-rw-r--r--arch/arm/plat-aspeed/dev-i2c.c183
1 files changed, 167 insertions, 16 deletions
diff --git a/arch/arm/plat-aspeed/dev-i2c.c b/arch/arm/plat-aspeed/dev-i2c.c
index 47cd15249b10..990539024336 100644
--- a/arch/arm/plat-aspeed/dev-i2c.c
+++ b/arch/arm/plat-aspeed/dev-i2c.c
@@ -46,7 +46,8 @@
#if defined (CONFIG_ARCH_AST2400)
#define I2C_PAGE_SIZE 8
-struct buf_page page_info[I2C_PAGE_SIZE] =
+static spinlock_t page_info_lock = SPIN_LOCK_UNLOCKED;
+static struct buf_page page_info[I2C_PAGE_SIZE] =
{
[0] = {
.flag = 0,
@@ -117,9 +118,10 @@ static void pool_buff_page_init(u32 buf_pool_addr)
static u8 request_pool_buff_page(struct buf_page **req_page)
{
int i;
+ unsigned long flags;
//TODO
- spinlock_t lock;
- spin_lock(&lock);
+
+ spin_lock_irqsave(&page_info_lock, flags);
for(i=0;i<I2C_PAGE_SIZE;i++) {
if(page_info[i].flag ==0) {
page_info[i].flag = 1;
@@ -128,21 +130,26 @@ static u8 request_pool_buff_page(struct buf_page **req_page)
break;
}
}
- spin_unlock(&lock);
- return 0;
+ spin_unlock_irqrestore(&page_info_lock, flags);
+ return (i >= I2C_PAGE_SIZE);
}
static void free_pool_buff_page(struct buf_page *req_page)
{
+ unsigned long flags;
+ spin_lock_irqsave(&page_info_lock, flags);
+
req_page->flag = 0;
// I2CDBUG( "free page addr %x \n", req_page->page_addr);
req_page = NULL;
+ spin_unlock_irqrestore(&page_info_lock, flags);
}
#elif defined (CONFIG_ARCH_AST2300)
#define I2C_PAGE_SIZE 5
-struct buf_page page_info[I2C_PAGE_SIZE] =
+static spinlock_t page_info_lock = SPIN_LOCK_UNLOCKED;
+static struct buf_page page_info[I2C_PAGE_SIZE] =
{
[0] = {
.flag = 0,
@@ -186,27 +193,31 @@ static void pool_buff_page_init(u32 buf_pool_addr)
static u8 request_pool_buff_page(struct buf_page **req_page)
{
int i;
+ unsigned long flags;
//TODO
- spinlock_t lock;
- spin_lock(&lock);
+
+ spin_lock_irqsave(&page_info_lock, flags);
for(i=0;i<I2C_PAGE_SIZE;i++) {
if(page_info[i].flag ==0) {
page_info[i].flag = 1;
*req_page = &page_info[i];
- spin_unlock(&lock);
- return 1;
+ spin_unlock_irqrestore(&page_info_lock, flags);
+ return 0;
}
}
- spin_unlock(&lock);
- return 0;
+ spin_unlock_irqrestore(&page_info_lock, flags);
+ return 1;
}
//TODO check free ?
static void free_pool_buff_page(struct buf_page *req_page)
{
+ unsigned long flags;
+ spin_lock_irqsave(&page_info_lock, flags);
req_page->flag = 0;
req_page = NULL;
+ spin_unlock_irqrestore(&page_info_lock, flags);
}
#else
@@ -592,19 +603,148 @@ static struct i2c_board_info __initdata ast_i2c_board_info_1[] = {
}
};
+
+//Under I2C Dev 2
+static struct i2c_board_info __initdata ast_i2c_board_info_2[] = {
+ // Looks like ncp4200 i2c address could be floating depending
+ // on the system. List all possibilities here (0x60 - 0x63).
+ // Hope the address will not change after probing.
+ {
+ I2C_BOARD_INFO("ncp4200", 0x60),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x61),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x62),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x63),
+ },
+};
+
+
+//Under I2C Dev 3
+static struct i2c_board_info __initdata ast_i2c_board_info_3[] = {
+ // Looks like ncp4200 i2c address could be floating depending
+ // on the system. List all possibilities here (0x60 - 0x63)
+ // Hope the address will not change after probing.
+ {
+ I2C_BOARD_INFO("ncp4200", 0x60),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x61),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x62),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x63),
+ },
+};
+
+
//Under I2C Dev 4
static struct i2c_board_info __initdata ast_i2c_board_info_4[] = {
+ // Temperature sensors on Wedge:
+ {
+ I2C_BOARD_INFO("tmp75", 0x48),
+ },
+ {
+ I2C_BOARD_INFO("tmp75", 0x49),
+ },
{
- I2C_BOARD_INFO("24c128", 0x50),
+ I2C_BOARD_INFO("tmp75", 0x4a),
+ },
+};
+//Under I2C Dev 5
+static struct i2c_board_info __initdata ast_i2c_board_info_5[] = {
+ /* Panther+ microserver */
+ {
+ I2C_BOARD_INFO("fb_panther_plus", 0x40),
+ },
+ // Temperature sensor on uServer:
+ {
+ I2C_BOARD_INFO("tmp75", 0x4c),
+ },
+ {
+ I2C_BOARD_INFO("ads7828", 0x4b),
+ },
+ {
+ I2C_BOARD_INFO("24c128", 0x51),
+ },
+};
+//Under I2C Dev 7
+static struct i2c_board_info __initdata ast_i2c_board_info_7[] = {
+ // Wedge devices
+ {
+ I2C_BOARD_INFO("max127", 0x28),
+ },
+ {
+ // Differs from the schematic, but appears to be correct
+ I2C_BOARD_INFO("pcf8574", 0x3f),
+ },
+ {
+ I2C_BOARD_INFO("24c64", 0x50),
}
};
+
+
//Under I2C Dev 8
static struct i2c_board_info __initdata ast_i2c_board_info_8[] = {
{
+ // Eval board:
I2C_BOARD_INFO("lm75b", 0x4a),
- }
+ },
+ // EEPROMS on the pfe1100 power supplies
+ {
+ I2C_BOARD_INFO("24c64", 0x51),
+ },
+ {
+ I2C_BOARD_INFO("24c64", 0x52),
+ },
+ {
+ I2C_BOARD_INFO("pfe1100", 0x59),
+ },
+ {
+ I2C_BOARD_INFO("pfe1100", 0x5a),
+ },
+};
+
+
+//Under I2C Dev 9
+static struct i2c_board_info __initdata ast_i2c_board_info_9[] = {
+ // Looks like ncp4200 i2c address could be floating depending
+ // on the system. List all possibilities here (0x60 - 0x63)
+ // Hope the address will not change after probing.
+ {
+ I2C_BOARD_INFO("ncp4200", 0x60),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x61),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x62),
+ },
+ {
+ I2C_BOARD_INFO("ncp4200", 0x63),
+ },
+};
+
+//Under I2C Dev 12
+static struct i2c_board_info __initdata ast_i2c_board_info_12[] = {
+ {
+ I2C_BOARD_INFO("pfe3000", 0x10),
+ },
+};
+
+//Under I2C Dev 13
+static struct i2c_board_info __initdata ast_i2c_board_info_13[] = {
+ {
+ I2C_BOARD_INFO("adm1278", 0x10),
+ },
};
#endif
@@ -642,25 +782,36 @@ void __init ast_add_device_i2c(void)
platform_device_register(&ast_i2c_dev1_device);
i2c_register_board_info(0, ast_i2c_board_info_1, ARRAY_SIZE(ast_i2c_board_info_1));
platform_device_register(&ast_i2c_dev2_device);
+ i2c_register_board_info(1, ast_i2c_board_info_2, ARRAY_SIZE(ast_i2c_board_info_2));
platform_device_register(&ast_i2c_dev3_device);
+ i2c_register_board_info(2, ast_i2c_board_info_3, ARRAY_SIZE(ast_i2c_board_info_3));
platform_device_register(&ast_i2c_dev4_device);
i2c_register_board_info(3, ast_i2c_board_info_4, ARRAY_SIZE(ast_i2c_board_info_4));
platform_device_register(&ast_i2c_dev5_device);
+ i2c_register_board_info(4, ast_i2c_board_info_5, ARRAY_SIZE(ast_i2c_board_info_5));
platform_device_register(&ast_i2c_dev6_device);
platform_device_register(&ast_i2c_dev7_device);
+ i2c_register_board_info(6, ast_i2c_board_info_7, ARRAY_SIZE(ast_i2c_board_info_7));
platform_device_register(&ast_i2c_dev8_device);
i2c_register_board_info(7, ast_i2c_board_info_8, ARRAY_SIZE(ast_i2c_board_info_8));
platform_device_register(&ast_i2c_dev9_device);
+ i2c_register_board_info(8, ast_i2c_board_info_9, ARRAY_SIZE(ast_i2c_board_info_9));
#if defined(CONFIG_ARCH_AST2400)
platform_device_register(&ast_i2c_dev10_device);
#if defined(CONFIG_MMC_AST)
//Due to share pin with SD
#else
- platform_device_register(&ast_i2c_dev11_device);
+ /*
+ * On Wedge, bus 13 is used as i2c bus. Bus 12 is used on other
+ * hardware. Pins for bus 11, 12, and 14 are used as GPIOs, on
+ * various hardware, but enabling the i2c bus does not seem to
+ * interfere with the GPIOs.
+ */
platform_device_register(&ast_i2c_dev12_device);
+ i2c_register_board_info(11, ast_i2c_board_info_12, ARRAY_SIZE(ast_i2c_board_info_12));
platform_device_register(&ast_i2c_dev13_device);
- platform_device_register(&ast_i2c_dev14_device);
+ i2c_register_board_info(12, ast_i2c_board_info_13, ARRAY_SIZE(ast_i2c_board_info_13));
#endif
#endif
}