* [PATCH 3/6] RTC: SWARM I2C board initialization (#2)
@ 2008-05-13 3:27 Maciej W. Rozycki
2008-05-13 11:34 ` Jean Delvare
0 siblings, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2008-05-13 3:27 UTC (permalink / raw)
To: Alessandro Zummo, Andrew Morton, Atsushi Nemoto, David Woodhouse,
Jean Delvare, Ralf Baechle, Thomas Gleixner
Cc: rtc-linux, i2c, linux-mips, linux-kernel
The standard rtc-m41t80.c driver cannot be used with the SWARM as it is,
because the board does not provide setup information for the I2C core.
As a result the bus and the address to probe for the M41T80 chip is not
known.
Here is a set of changes that fix the problem:
1. swarm-i2c.c -- SWARM I2C board setup, currently for the M41T80 chip on
the bus #1 only (there is a MAX6654 temperature sensor on the bus #0
which may be added in the future if we have a driver for that chip).
2. The i2c-sibyte.c BCM1250A SMBus controller driver now registers its
buses as numbered so that board setup is correctly applied.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
I have renamed i2c-swarm.c to swarm-i2c.c for consistency with names
of other files under arch/mips/.
Please note this patch trivially depends on
patch-2.6.26-rc1-20080505-swarm-core-16 -- 2/6 of this set.
Maciej
patch-2.6.26-rc1-20080505-swarm-i2c-17
diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/Makefile linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/Makefile
--- linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/Makefile 2008-05-06 01:18:21.000000000 +0000
+++ linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/Makefile 2008-05-13 03:11:43.000000000 +0000
@@ -1,3 +1,4 @@
obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o
+obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o
obj-$(CONFIG_KGDB) += dbg_io.o
diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/swarm-i2c.c linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/swarm-i2c.c
--- linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/swarm-i2c.c 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/swarm-i2c.c 2008-05-13 03:11:26.000000000 +0000
@@ -0,0 +1,37 @@
+/*
+ * arch/mips/sibyte/swarm/swarm-i2c.c
+ *
+ * Broadcom BCM91250A (SWARM), etc. I2C platform setup.
+ *
+ * Copyright (c) 2008 Maciej W. Rozycki
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+
+static struct i2c_board_info swarm_i2c_info1[] __initdata = {
+ {
+ I2C_BOARD_INFO("m41t81", 0x68),
+ },
+};
+
+static int __init swarm_i2c_init(void)
+{
+ int err;
+
+ err = i2c_register_board_info(1, swarm_i2c_info1,
+ ARRAY_SIZE(swarm_i2c_info1));
+ if (err < 0)
+ printk(KERN_ERR
+ "i2c-swarm: cannot register board I2C devices\n");
+ return err;
+}
+
+arch_initcall(swarm_i2c_init);
diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/drivers/i2c/busses/i2c-sibyte.c linux-2.6.26-rc1-20080505/drivers/i2c/busses/i2c-sibyte.c
--- linux-2.6.26-rc1-20080505.macro/drivers/i2c/busses/i2c-sibyte.c 2008-05-05 02:55:25.000000000 +0000
+++ linux-2.6.26-rc1-20080505/drivers/i2c/busses/i2c-sibyte.c 2008-05-11 01:21:45.000000000 +0000
@@ -143,7 +143,7 @@ int __init i2c_sibyte_add_bus(struct i2c
csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ));
csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL));
- return i2c_add_adapter(i2c_adap);
+ return i2c_add_numbered_adapter(i2c_adap);
}
@@ -159,6 +159,7 @@ static struct i2c_adapter sibyte_board_a
.class = I2C_CLASS_HWMON,
.algo = NULL,
.algo_data = &sibyte_board_data[0],
+ .nr = 0,
.name = "SiByte SMBus 0",
},
{
@@ -167,6 +168,7 @@ static struct i2c_adapter sibyte_board_a
.class = I2C_CLASS_HWMON,
.algo = NULL,
.algo_data = &sibyte_board_data[1],
+ .nr = 1,
.name = "SiByte SMBus 1",
},
};
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] RTC: SWARM I2C board initialization (#2)
2008-05-13 3:27 [PATCH 3/6] RTC: SWARM I2C board initialization (#2) Maciej W. Rozycki
@ 2008-05-13 11:34 ` Jean Delvare
2008-05-13 16:51 ` Maciej W. Rozycki
0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2008-05-13 11:34 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Alessandro Zummo, Andrew Morton, Atsushi Nemoto, David Woodhouse,
Ralf Baechle, Thomas Gleixner, rtc-linux, i2c, linux-mips,
linux-kernel
Hi Maciej,
On Tue, 13 May 2008 04:27:10 +0100 (BST), Maciej W. Rozycki wrote:
> The standard rtc-m41t80.c driver cannot be used with the SWARM as it is,
> because the board does not provide setup information for the I2C core.
> As a result the bus and the address to probe for the M41T80 chip is not
> known.
>
> Here is a set of changes that fix the problem:
>
> 1. swarm-i2c.c -- SWARM I2C board setup, currently for the M41T80 chip on
> the bus #1 only (there is a MAX6654 temperature sensor on the bus #0
> which may be added in the future if we have a driver for that chip).
We don't have a driver yet, however the datasheet for that chip is
publicly available and writing a driver would be easy. Or maybe just
reuse an existing driver - from a quick look at the datasheet I suspect
that this device is essentially compatible with the LM90 and ADM1032
chips supported by the lm90 driver.
>
> 2. The i2c-sibyte.c BCM1250A SMBus controller driver now registers its
> buses as numbered so that board setup is correctly applied.
>
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> ---
> I have renamed i2c-swarm.c to swarm-i2c.c for consistency with names
> of other files under arch/mips/.
But you forgot to update the log message accordingly...
> Please note this patch trivially depends on
> patch-2.6.26-rc1-20080505-swarm-core-16 -- 2/6 of this set.
OK, so I should just wait for patch 2/6 to get upstream before I add
this one to my i2c tree?
>
> Maciej
>
> patch-2.6.26-rc1-20080505-swarm-i2c-17
> diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/Makefile linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/Makefile
> --- linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/Makefile 2008-05-06 01:18:21.000000000 +0000
> +++ linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/Makefile 2008-05-13 03:11:43.000000000 +0000
> @@ -1,3 +1,4 @@
> obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o
>
> +obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o
> obj-$(CONFIG_KGDB) += dbg_io.o
> diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/swarm-i2c.c linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/swarm-i2c.c
> --- linux-2.6.26-rc1-20080505.macro/arch/mips/sibyte/swarm/swarm-i2c.c 1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6.26-rc1-20080505/arch/mips/sibyte/swarm/swarm-i2c.c 2008-05-13 03:11:26.000000000 +0000
> @@ -0,0 +1,37 @@
> +/*
> + * arch/mips/sibyte/swarm/swarm-i2c.c
> + *
> + * Broadcom BCM91250A (SWARM), etc. I2C platform setup.
> + *
> + * Copyright (c) 2008 Maciej W. Rozycki
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +
> +
> +static struct i2c_board_info swarm_i2c_info1[] __initdata = {
> + {
> + I2C_BOARD_INFO("m41t81", 0x68),
> + },
> +};
> +
> +static int __init swarm_i2c_init(void)
> +{
> + int err;
> +
> + err = i2c_register_board_info(1, swarm_i2c_info1,
> + ARRAY_SIZE(swarm_i2c_info1));
> + if (err < 0)
> + printk(KERN_ERR
> + "i2c-swarm: cannot register board I2C devices\n");
> + return err;
> +}
> +
> +arch_initcall(swarm_i2c_init);
> diff -up --recursive --new-file linux-2.6.26-rc1-20080505.macro/drivers/i2c/busses/i2c-sibyte.c linux-2.6.26-rc1-20080505/drivers/i2c/busses/i2c-sibyte.c
> --- linux-2.6.26-rc1-20080505.macro/drivers/i2c/busses/i2c-sibyte.c 2008-05-05 02:55:25.000000000 +0000
> +++ linux-2.6.26-rc1-20080505/drivers/i2c/busses/i2c-sibyte.c 2008-05-11 01:21:45.000000000 +0000
> @@ -143,7 +143,7 @@ int __init i2c_sibyte_add_bus(struct i2c
> csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ));
> csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL));
>
> - return i2c_add_adapter(i2c_adap);
> + return i2c_add_numbered_adapter(i2c_adap);
> }
>
>
> @@ -159,6 +159,7 @@ static struct i2c_adapter sibyte_board_a
> .class = I2C_CLASS_HWMON,
> .algo = NULL,
> .algo_data = &sibyte_board_data[0],
> + .nr = 0,
> .name = "SiByte SMBus 0",
> },
> {
> @@ -167,6 +168,7 @@ static struct i2c_adapter sibyte_board_a
> .class = I2C_CLASS_HWMON,
> .algo = NULL,
> .algo_data = &sibyte_board_data[1],
> + .nr = 1,
> .name = "SiByte SMBus 1",
> },
> };
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] RTC: SWARM I2C board initialization (#2)
2008-05-13 11:34 ` Jean Delvare
@ 2008-05-13 16:51 ` Maciej W. Rozycki
2008-05-13 17:17 ` Jean Delvare
0 siblings, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2008-05-13 16:51 UTC (permalink / raw)
To: Jean Delvare
Cc: Alessandro Zummo, Andrew Morton, Atsushi Nemoto, David Woodhouse,
Ralf Baechle, Thomas Gleixner, rtc-linux, i2c, linux-mips,
linux-kernel
Hi Jean,
> > 1. swarm-i2c.c -- SWARM I2C board setup, currently for the M41T80 chip on
> > the bus #1 only (there is a MAX6654 temperature sensor on the bus #0
> > which may be added in the future if we have a driver for that chip).
>
> We don't have a driver yet, however the datasheet for that chip is
> publicly available and writing a driver would be easy. Or maybe just
> reuse an existing driver - from a quick look at the datasheet I suspect
> that this device is essentially compatible with the LM90 and ADM1032
> chips supported by the lm90 driver.
True, but someone has to do that. I feel no incentive at the moment. ;-)
> > 2. The i2c-sibyte.c BCM1250A SMBus controller driver now registers its
> > buses as numbered so that board setup is correctly applied.
> >
> > Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> > ---
> > I have renamed i2c-swarm.c to swarm-i2c.c for consistency with names
> > of other files under arch/mips/.
>
> But you forgot to update the log message accordingly...
I did not, unless I am missing something.
> > Please note this patch trivially depends on
> > patch-2.6.26-rc1-20080505-swarm-core-16 -- 2/6 of this set.
>
> OK, so I should just wait for patch 2/6 to get upstream before I add
> this one to my i2c tree?
Either this or you can apply both and remove the local copy of the former
when it comes back from upstream. Whatever you prefer -- it is your
choice.
Maciej
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] RTC: SWARM I2C board initialization (#2)
2008-05-13 16:51 ` Maciej W. Rozycki
@ 2008-05-13 17:17 ` Jean Delvare
2008-05-13 17:53 ` Maciej W. Rozycki
0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2008-05-13 17:17 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Alessandro Zummo, Andrew Morton, Atsushi Nemoto, David Woodhouse,
Ralf Baechle, Thomas Gleixner, rtc-linux, i2c, linux-mips,
linux-kernel
On Tue, 13 May 2008 17:51:32 +0100 (BST), Maciej W. Rozycki wrote:
> > > I have renamed i2c-swarm.c to swarm-i2c.c for consistency with names
> > > of other files under arch/mips/.
> >
> > But you forgot to update the log message accordingly...
>
> I did not, unless I am missing something.
printk(KERN_ERR
"i2c-swarm: cannot register board I2C devices\n");
> > > Please note this patch trivially depends on
> > > patch-2.6.26-rc1-20080505-swarm-core-16 -- 2/6 of this set.
> >
> > OK, so I should just wait for patch 2/6 to get upstream before I add
> > this one to my i2c tree?
>
> Either this or you can apply both and remove the local copy of the former
> when it comes back from upstream. Whatever you prefer -- it is your
> choice.
I don't really want to include a mips arch patch in my public i2c tree,
that would be confusing. I think I'll just wait. I have the mips patch
in my local tree, so quilt will tell me when it hits upstream.
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] RTC: SWARM I2C board initialization (#2)
2008-05-13 17:17 ` Jean Delvare
@ 2008-05-13 17:53 ` Maciej W. Rozycki
0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2008-05-13 17:53 UTC (permalink / raw)
To: Jean Delvare
Cc: Alessandro Zummo, Andrew Morton, Atsushi Nemoto, David Woodhouse,
Ralf Baechle, Thomas Gleixner, rtc-linux, i2c, linux-mips,
linux-kernel
Hi Jean,
> printk(KERN_ERR
> "i2c-swarm: cannot register board I2C devices\n");
Thanks -- that's the one I missed. I think there is no point in
resending the whole set for this change only, so I will post an update for
this patch only.
> I don't really want to include a mips arch patch in my public i2c tree,
> that would be confusing. I think I'll just wait. I have the mips patch
> in my local tree, so quilt will tell me when it hits upstream.
Well, your local tree is what I had in mind indeed. I agree it would be
confusing to publish the MIPS change through the i2c repository.
Maciej
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-05-13 17:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-13 3:27 [PATCH 3/6] RTC: SWARM I2C board initialization (#2) Maciej W. Rozycki
2008-05-13 11:34 ` Jean Delvare
2008-05-13 16:51 ` Maciej W. Rozycki
2008-05-13 17:17 ` Jean Delvare
2008-05-13 17:53 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).