2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #include <linux/config.h>
20 #include <linux/kernel.h>
21 #include <linux/module.h>
22 #include <linux/init.h>
23 #include <linux/errno.h>
25 #include <asm/sibyte/sb1250_regs.h>
26 #include <asm/sibyte/sb1250_smbus.h>
28 #include <linux/i2c.h>
29 #include <linux/i2c-algo-sibyte.h>
31 static int sibyte_reg(struct i2c_client *client)
36 static int sibyte_unreg(struct i2c_client *client)
41 static void sibyte_inc_use(struct i2c_adapter *adap)
48 static void sibyte_dec_use(struct i2c_adapter *adap)
55 static struct i2c_algo_sibyte_data sibyte_board_data[2] = {
56 { NULL, 0, (void *)(KSEG1+A_SMB_BASE(0)) },
57 { NULL, 1, (void *)(KSEG1+A_SMB_BASE(1)) }
60 static struct i2c_adapter sibyte_board_adapter[2] = {
62 name: "SiByte SMBus 0",
65 algo_data: &sibyte_board_data[0],
66 inc_use: sibyte_inc_use,
67 dec_use: sibyte_dec_use,
68 client_register: sibyte_reg,
69 client_unregister: sibyte_unreg,
73 name: "SiByte SMBus 1",
76 algo_data: &sibyte_board_data[1],
77 inc_use: sibyte_inc_use,
78 dec_use: sibyte_dec_use,
79 client_register: sibyte_reg,
80 client_unregister: sibyte_unreg,
85 int __init i2c_sibyte_init(void)
87 printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n");
88 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
90 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0)
99 MODULE_AUTHOR("Kip Walker, Broadcom Corp.");
100 MODULE_DESCRIPTION("SMBus adapter routines for SiByte boards");
101 MODULE_LICENSE("GPL");
103 int init_module(void)
105 return i2c_sibyte_init();
108 void cleanup_module(void)
110 i2c_sibyte_del_bus(&sibyte_board_adapter[0]);
111 i2c_sibyte_del_bus(&sibyte_board_adapter[1]);