Patchwork Simplify device enabling and initialization

login
register
about
Submitter Myles Watson
Date 2010-06-21 13:51:51
Message ID <AANLkTil-6FXaJJRCXMm9C8Qcp6koo8Bw7dVisDQZZYKo@mail.gmail.com>
Download mbox | patch
Permalink /patch/1534/
State New
Headers show

Comments

Myles Watson - 2010-06-21 13:51:51
If there is no adm1027, then the adt4763 needs to be initialized, not
its parent.  Updated patch 4 attached.

Signed-off-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles

Patch

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,
Index: svn/src/drivers/i2c/adt7463/adt7463.c
===================================================================
--- svn.orig/src/drivers/i2c/adt7463/adt7463.c
+++ svn/src/drivers/i2c/adt7463/adt7463.c
@@ -35,56 +35,53 @@ 
  */
 static void adt7463_init(device_t dev)
 {
-	device_t parent;
 	int result;
 
-	/* Find the ADT7463's parent device. */
-	parent = dev->bus->dev;
-	printk(BIOS_DEBUG, "ADT7463 parent is %s\n", dev_path(parent));
+	printk(BIOS_DEBUG, "ADT7463 is %s\n", dev_path(dev));
 
 	/* Set all fans to 'Fastest Speed Calculated by All 3 Temperature
 	 * Channels Controls PWMx'.
 	 */
-	result = smbus_write_byte(parent, 0x5c, 0xc2);
-	result = smbus_write_byte(parent, 0x5d, 0xc2);
-	result = smbus_write_byte(parent, 0x5e, 0xc2);
+	result = smbus_write_byte(dev, 0x5c, 0xc2);
+	result = smbus_write_byte(dev, 0x5d, 0xc2);
+	result = smbus_write_byte(dev, 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(parent, 0x62, 0xc0);
+	result = smbus_write_byte(dev, 0x62, 0xc0);
 
 	/* Set minimum PWM duty cycle to 25%, rather than the default 50%. */
-	result = smbus_write_byte(parent, 0x64, 0x40);
-	result = smbus_write_byte(parent, 0x65, 0x40);
-	result = smbus_write_byte(parent, 0x66, 0x40);
+	result = smbus_write_byte(dev, 0x64, 0x40);
+	result = smbus_write_byte(dev, 0x65, 0x40);
+	result = smbus_write_byte(dev, 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(parent, 0x67, 0x37);
-	result = smbus_write_byte(parent, 0x68, 0x37);
-	result = smbus_write_byte(parent, 0x69, 0x37);
+	result = smbus_write_byte(dev, 0x67, 0x37);
+	result = smbus_write_byte(dev, 0x68, 0x37);
+	result = smbus_write_byte(dev, 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(parent, 0x6a, 0x46);
-	result = smbus_write_byte(parent, 0x6b, 0x46);
-	result = smbus_write_byte(parent, 0x6c, 0x46);
+	result = smbus_write_byte(dev, 0x6a, 0x46);
+	result = smbus_write_byte(dev, 0x6b, 0x46);
+	result = smbus_write_byte(dev, 0x6c, 0x46);
 
 	/* Remote temperature 1 offset (LSB == 0.25C). */
-	result = smbus_write_byte(parent, 0x70, 0x02);
+	result = smbus_write_byte(dev, 0x70, 0x02);
 
 	/* Remote temperature 2 offset (LSB == 0.25C). */
-	result = smbus_write_byte(parent, 0x72, 0x01);
+	result = smbus_write_byte(dev, 0x72, 0x01);
 
 	/* Set TACH measurements to normal (1/second). */
-	result = smbus_write_byte(parent, 0x78, 0xf0);
+	result = smbus_write_byte(dev, 0x78, 0xf0);
 
 	printk(BIOS_DEBUG, "ADT7463 properly initialized\n");
 }