On Mon, Jun 21, 2010 at 5:59 AM, Myles Watson <[email protected]> wrote:
> On Sun, Jun 20, 2010 at 8:11 PM, Ward Vandewege <[email protected]> wrote:
>> Hi Myles,
>>
>> Everything seems fine with either patch - but there are some differences in
>> the boot output.
>>
>> I also ran the 'sensors' command.
>>
>> Output here:
>>
>>  http://ward.vandewege.net/coreboot/s2881/20100617-myles/
>>
>> I ran 4 tests: stock r5635 (head), stock r5632 (revision prior to this
>> changeset), r5635 + patch 1 and r5635 + patch 2.
> Thanks for testing.
>
> It looks like only 5632 has the "ADT7463 properly initialized"
> message.  One problem is that patch 2 was meant to be applied after
> patch 1, so the device didn't end up in the tree for that run.  I'll
> have to think about why the only message from the new device with
> patch 1 is "I2C: 00:d0 missing read_resources"  For some reason it
> doesn't look like it got the correct ops.
>
> I wonder why the temperature values look right in all cases.  Does it
> need to be cold booted in order for the initialization to be needed?

The ADM1027 doesn't expect to have children, so it has no scan_bus
method.  I had thought that the ADM1027 was some kind of a controller
for the ADT4763, but it looks like the same type of device.  Is there
really an ADM1027 on your board?  I don't see it in your sensors
output.

So...  the first two patches are the same as before.  The third patch
adds a scan_bus method to the ADM1027 so that the ADT4763 can be
initialized, and the fourth patch replaces the ADM1027 with the
ADT4763 in the device tree, and removes the third patch.

I'd be interested in head + 1 + 2 + 3, and head + 1 + 2 + 3 + 4.

There may be some initialization that was done by the ADM1027 code
that needs to be moved to the ADT7463 code, since both were being run.

So 1 + 2 + 3 should give behavior that is closer to the original code,
but if there is no ADM1027, the right thing to do is 1 + 2 + 3 + 4 +
some ADM1027 code if necessary.

Signed-off-by: Myles Watson <[email protected]>

Thanks,
Myles
Index: svn/src/mainboard/tyan/s2881/Makefile.inc
===================================================================
--- svn.orig/src/mainboard/tyan/s2881/Makefile.inc
+++ svn/src/mainboard/tyan/s2881/Makefile.inc
@@ -1 +1,2 @@
 obj-y += ../../../drivers/i2c/adm1027/adm1027.o
+obj-y += ../../../drivers/i2c/adt7463/adt7463.o
Index: svn/src/mainboard/tyan/s2881/devicetree.cb
===================================================================
--- svn.orig/src/mainboard/tyan/s2881/devicetree.cb
+++ svn/src/mainboard/tyan/s2881/devicetree.cb
@@ -103,7 +103,12 @@ chip northbridge/amd/amdk8/root_complex
                                                         device i2c 57 on end
                                                 end
                                                 chip drivers/i2c/adm1027 # ADT7463A CPU0/1 temp, CPU1 vid, SYS FAN 1/2/3
-                                                        device i2c 2d on end
+                                                        device i2c 2d on
+                                                                chip drivers/i2c/adt7463
+                                                                        device i2c d0 on
+                                                                        end
+                                                                end
+                                                        end
                                                 end
                                                 chip drivers/generic/generic # Winbond HWM 0x54 CPU0/1 VRM temp, SYSFAN 4,CPU0 vid, CPU0/1 FAN
                                                         device i2c 2a on end
Index: svn/src/drivers/i2c/adt7463/adt7463.c
===================================================================
--- svn.orig/src/drivers/i2c/adt7463/adt7463.c
+++ svn/src/drivers/i2c/adt7463/adt7463.c
@@ -116,7 +116,7 @@ static void enable_dev(struct device *de
 	dev->ops = &adt7463_operations;
 }
 
-struct chip_operations mainboard_ops = {
+struct chip_operations drivers_i2c_adt7463_ops = {
 	CHIP_NAME("adt7463")
 	.enable_dev = enable_dev,
 };
Index: svn/src/drivers/i2c/adt7463/adt7463.c
===================================================================
--- svn.orig/src/drivers/i2c/adt7463/adt7463.c
+++ svn/src/drivers/i2c/adt7463/adt7463.c
@@ -35,67 +35,56 @@
  */
 static void adt7463_init(device_t dev)
 {
-	device_t smbus_dev, adt7463;
-	struct device_path path;
+	device_t parent;
 	int result;
 
-	/* Find the SMBus controller (AMD-8111). */
-	smbus_dev = dev_find_device(0x1022, 0x746b, 0);
-	if (!smbus_dev)
-		die("SMBus controller not found\n");
-	printk(BIOS_DEBUG, "SMBus controller found\n");
-
-	/* Find the ADT7463 device. */
-	path.type = DEVICE_PATH_I2C;
-	path.i2c.device = 0x2d;
-	adt7463 = find_dev_path(smbus_dev->link_list, &path);
-	if (!adt7463)
-		die("ADT7463 not found\n");
-	printk(BIOS_DEBUG, "ADT7463 found\n");
+	/* Find the ADT7463's parent device. */
+	parent = dev->bus->dev;
+	printk(BIOS_DEBUG, "ADT7463 parent is %s\n", dev_path(parent));
 
 	/* Set all fans to 'Fastest Speed Calculated by All 3 Temperature
 	 * Channels Controls PWMx'.
 	 */
-	result = smbus_write_byte(adt7463, 0x5c, 0xc2);
-	result = smbus_write_byte(adt7463, 0x5d, 0xc2);
-	result = smbus_write_byte(adt7463, 0x5e, 0xc2);
+	result = smbus_write_byte(parent, 0x5c, 0xc2);
+	result = smbus_write_byte(parent, 0x5d, 0xc2);
+	result = smbus_write_byte(parent, 0x5e, 0xc2);
 
 	/* Make sure that our fans never stop when temp. falls below Tmin,
 	 * but rather keep going at minimum duty cycle (applies to automatic
 	 * fan control mode only).
 	 */
-	result = smbus_write_byte(adt7463, 0x62, 0xc0);
+	result = smbus_write_byte(parent, 0x62, 0xc0);
 
 	/* Set minimum PWM duty cycle to 25%, rather than the default 50%. */
-	result = smbus_write_byte(adt7463, 0x64, 0x40);
-	result = smbus_write_byte(adt7463, 0x65, 0x40);
-	result = smbus_write_byte(adt7463, 0x66, 0x40);
+	result = smbus_write_byte(parent, 0x64, 0x40);
+	result = smbus_write_byte(parent, 0x65, 0x40);
+	result = smbus_write_byte(parent, 0x66, 0x40);
 
 	/* Set Tmin to 55C, rather than the default 90C. Above this temperature
 	 * the fans will start blowing harder as temperature increases
 	 * (automatic mode only).
 	 */
-	result = smbus_write_byte(adt7463, 0x67, 0x37);
-	result = smbus_write_byte(adt7463, 0x68, 0x37);
-	result = smbus_write_byte(adt7463, 0x69, 0x37);
+	result = smbus_write_byte(parent, 0x67, 0x37);
+	result = smbus_write_byte(parent, 0x68, 0x37);
+	result = smbus_write_byte(parent, 0x69, 0x37);
 
 	/* Set THERM limit to 70C, rather than the default 100C.
 	 * The fans will kick in at 100% if the sensors reach this temperature,
 	 * (only in automatic mode, but supposedly even when hardware is
 	 * locked up). This is a failsafe measure.
 	 */
-	result = smbus_write_byte(adt7463, 0x6a, 0x46);
-	result = smbus_write_byte(adt7463, 0x6b, 0x46);
-	result = smbus_write_byte(adt7463, 0x6c, 0x46);
+	result = smbus_write_byte(parent, 0x6a, 0x46);
+	result = smbus_write_byte(parent, 0x6b, 0x46);
+	result = smbus_write_byte(parent, 0x6c, 0x46);
 
 	/* Remote temperature 1 offset (LSB == 0.25C). */
-	result = smbus_write_byte(adt7463, 0x70, 0x02);
+	result = smbus_write_byte(parent, 0x70, 0x02);
 
 	/* Remote temperature 2 offset (LSB == 0.25C). */
-	result = smbus_write_byte(adt7463, 0x72, 0x01);
+	result = smbus_write_byte(parent, 0x72, 0x01);
 
 	/* Set TACH measurements to normal (1/second). */
-	result = smbus_write_byte(adt7463, 0x78, 0xf0);
+	result = smbus_write_byte(parent, 0x78, 0xf0);
 
 	printk(BIOS_DEBUG, "ADT7463 properly initialized\n");
 }
Index: svn/src/drivers/i2c/adm1027/adm1027.c
===================================================================
--- svn.orig/src/drivers/i2c/adm1027/adm1027.c
+++ svn/src/drivers/i2c/adm1027/adm1027.c
@@ -56,6 +56,7 @@ static void adm1027_noop(device_t dummy)
 }
 
 static struct device_operations adm1027_operations = {
+	.scan_bus		= scan_static_bus,
 	.read_resources		= adm1027_noop,
 	.set_resources		= adm1027_noop,
 	.enable_resources	= adm1027_noop,
Index: svn/src/mainboard/tyan/s2881/Makefile.inc
===================================================================
--- svn.orig/src/mainboard/tyan/s2881/Makefile.inc
+++ svn/src/mainboard/tyan/s2881/Makefile.inc
@@ -1,2 +1 @@
-obj-y += ../../../drivers/i2c/adm1027/adm1027.o
 obj-y += ../../../drivers/i2c/adt7463/adt7463.o
Index: svn/src/mainboard/tyan/s2881/devicetree.cb
===================================================================
--- svn.orig/src/mainboard/tyan/s2881/devicetree.cb
+++ svn/src/mainboard/tyan/s2881/devicetree.cb
@@ -102,13 +102,8 @@ chip northbridge/amd/amdk8/root_complex
                                                 chip drivers/generic/generic #dimm 1-1-1
                                                         device i2c 57 on end
                                                 end
-                                                chip drivers/i2c/adm1027 # ADT7463A CPU0/1 temp, CPU1 vid, SYS FAN 1/2/3
-                                                        device i2c 2d on
-                                                                chip drivers/i2c/adt7463
-                                                                        device i2c d0 on
-                                                                        end
-                                                                end
-                                                        end
+                                                chip drivers/i2c/adt7463 # CPU0/1 temp, CPU1 vid, SYS FAN 1/2/3
+                                                        device i2c 2d on end
                                                 end
                                                 chip drivers/generic/generic # Winbond HWM 0x54 CPU0/1 VRM temp, SYSFAN 4,CPU0 vid, CPU0/1 FAN
                                                         device i2c 2a on end
Index: svn/src/drivers/i2c/adm1027/adm1027.c
===================================================================
--- svn.orig/src/drivers/i2c/adm1027/adm1027.c
+++ svn/src/drivers/i2c/adm1027/adm1027.c
@@ -56,7 +56,6 @@ static void adm1027_noop(device_t dummy)
 }
 
 static struct device_operations adm1027_operations = {
-	.scan_bus		= scan_static_bus,
 	.read_resources		= adm1027_noop,
 	.set_resources		= adm1027_noop,
 	.enable_resources	= adm1027_noop,
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to