blob: fa503ed9f86db6d8fb32899d817a9db78d6e60f7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2004 Steven J. Hill
3 * Copyright (C) 2001,2002,2003 Broadcom Corporation
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/module.h>
21#include <linux/i2c-algo-sibyte.h>
22#include <asm/sibyte/sb1250_regs.h>
23#include <asm/sibyte/sb1250_smbus.h>
24
25static struct i2c_algo_sibyte_data sibyte_board_data[2] = {
Ralf Baechlea242b442005-08-09 10:07:57 -070026 { NULL, 0, (void *) (CKSEG1+A_SMB_BASE(0)) },
27 { NULL, 1, (void *) (CKSEG1+A_SMB_BASE(1)) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070028};
29
30static struct i2c_adapter sibyte_board_adapter[2] = {
31 {
32 .owner = THIS_MODULE,
33 .id = I2C_HW_SIBYTE,
34 .class = I2C_CLASS_HWMON,
35 .algo = NULL,
36 .algo_data = &sibyte_board_data[0],
37 .name = "SiByte SMBus 0",
38 },
39 {
40 .owner = THIS_MODULE,
41 .id = I2C_HW_SIBYTE,
42 .class = I2C_CLASS_HWMON,
43 .algo = NULL,
44 .algo_data = &sibyte_board_data[1],
45 .name = "SiByte SMBus 1",
46 },
47};
48
49static int __init i2c_sibyte_init(void)
50{
51 printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n");
52 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
53 return -ENODEV;
54 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0)
55 return -ENODEV;
56 return 0;
57}
58
59static void __exit i2c_sibyte_exit(void)
60{
61 i2c_sibyte_del_bus(&sibyte_board_adapter[0]);
62 i2c_sibyte_del_bus(&sibyte_board_adapter[1]);
63}
64
65module_init(i2c_sibyte_init);
66module_exit(i2c_sibyte_exit);
67
68MODULE_AUTHOR("Kip Walker <kwalker@broadcom.com>, Steven J. Hill <sjhill@realitydiluted.com>");
69MODULE_DESCRIPTION("SMBus adapter routines for SiByte boards");
70MODULE_LICENSE("GPL");