Skip to contentSkip to conversation

On n2100 systems,

PATCH In review Riku Voipio 4 participants 11 messages Oct 16, 2007 – Oct 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 On n2100 systems,

On thecus n2100, the bootloader does not setup fans to run. In order to protect the user from frying their gear, start up fans on boot.

Depends on:

f75375s: Add new style bindings
f75375s: allow setting up fans with platform_data

patches sent to lm-sensors mailing list.

---
 arch/arm/mach-iop32x/n2100.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-iop32x/n2100.c +11 -0
index 1873bd8..5a4acff 100644
@@ -16,6 +16,7 @@
 
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/f75375s.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = {
 	.resource	= &n2100_uart_resource,
 };
 
+static struct f75375s_platform_data n2100_f75375s = {
+	.pwm		= { 255, 255 },
+	.pwm_enable = { 0, 0 },
+};
+
 static struct i2c_board_info __initdata n2100_i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("rtc-rs5c372", 0x32),
 		.type = "rs5c372b",
 	},
+	{
+		I2C_BOARD_INFO("f75375", 0x2e),
+		.type = "f75375",
+		.platform_data = &n2100_f75375s,
+	},
 };
 
 /*
Signature · 10 lines
1.5.3.1


-- 
"rm -rf" only sounds scary if you don't have backups

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Riku Voipio

On thecus n2100, the bootloader does not setup fans to run. In order to protect the user from frying their gear, start up fans on boot.

Depends on:

f75375s: Add new style bindings
f75375s: allow setting up fans with platform_data

patches sent to lm-sensors mailing list.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Riku Voipio

Hi Riku,

Quoted 2 lines · Riku Voipio

On thecus n2100, the bootloader does not setup fans to run. In order to protect the user from frying their gear, start up fans on boot.

Why don't you fix the "bootloader" (whatever it is in your context) instead? Fixing the fan speed at the OS level sounds wrong. The user might be using a different OS. The user might even not run any OS. Would the hardware fry if the user stays in the bootloader?

On top of this, if I read the the datasheet of the F75375S correctly, it has the fans on (in "speed mode") by default. This suggests that the "bootloader" is no only "not setting up fans to run" but it is actively turning them off. So that's what you really need to fix.

Quoted 26 lines

Depends on:

f75375s: Add new style bindings
f75375s: allow setting up fans with platform_data

patches sent to lm-sensors mailing list.

---
 arch/arm/mach-iop32x/n2100.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-iop32x/n2100.c +1 -0
index 1873bd8..5a4acff 100644
@@ -16,6 +16,7 @@
 
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/f75375s.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>

arch/arm/mach-iop32x/n2100.c static struct platform_device n2100_serial_device = { · line 206

Quoted 6 lines
arch/arm/mach-iop32x/n2100.c +3 -0
@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = {
 	.resource	= &n2100_uart_resource,
 };
 
+static struct f75375s_platform_data n2100_f75375s = {
+	.pwm		= { 255, 255 },
+	.pwm_enable = { 0, 0 },

Bad alignment. And I don't think that PWM can be completely disabled on the F75375S anyway? So you should set pwm_enable to 1 not 0.

Quoted 15 lines
arch/arm/mach-iop32x/n2100.c +7 -0
+};
+
 static struct i2c_board_info __initdata n2100_i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("rtc-rs5c372", 0x32),
 		.type = "rs5c372b",
 	},
+	{
+		I2C_BOARD_INFO("f75375", 0x2e),
+		.type = "f75375",
+		.platform_data = &n2100_f75375s,
+	},
 };
 
 /*
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw
In reply to Riku Voipio
Quoted 4 lines · Jean Delvare
Quoted 2 lines

On thecus n2100, the bootloader does not setup fans to run. In order to protect the user from frying their gear, start up fans on boot.

Why don't you fix the "bootloader" (whatever it is in your context)

The bootloader is Redboot. It is shipped as the default bootloader in the flash of the device as sold, and it runs directly after power on. (In that regard, it's kind of like the PC BIOS in x86 machines.)

While I would agree that fixing this in the bootloader is the cleanest approach, I'm pretty sure that even if we do manage to build a new version of the bootloader (I'm not even sure whether we have the source for it), I'm sure many users would be very reluctant to flash a new bootloader into their device.

We do work around PC BIOS bugs in the Linux kernel as well. This isn't a very different situation from that, I think.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Riku Voipio

Hi Lennert,

Quoted 10 lines · Lennert Buytenhek
Quoted 4 lines · Jean Delvare
Quoted 2 lines

On thecus n2100, the bootloader does not setup fans to run. In order to protect the user from frying their gear, start up fans on boot.

Why don't you fix the "bootloader" (whatever it is in your context)

The bootloader is Redboot. It is shipped as the default bootloader in the flash of the device as sold, and it runs directly after power on. (In that regard, it's kind of like the PC BIOS in x86 machines.)

OK, thanks for the clarification.

Quoted 4 lines

While I would agree that fixing this in the bootloader is the cleanest approach, I'm pretty sure that even if we do manage to build a new version of the bootloader (I'm not even sure whether we have the source for it),

Can't you contact whoever sells this system? If the "BIOS" is broken, that's really up to them to fix it.

Quoted 2 lines

I'm sure many users would be very reluctant to flash a new
bootloader into their device.

If their machine fries when they don't, I'm pretty sure they will ;)

Quoted 2 lines

We do work around PC BIOS bugs in the Linux kernel as well. This isn't a very different situation from that, I think.

I'm not aware of such workarounds to prevent machines from frying. For such critical cases, system vendors typically bother releasing a BIOS update.

What I would like to understand is how we came in to the current situation. As I said, stopped fans is not the default for the F75375S chip. This really suggests that the fans are stopped on purpose by whoever wrote that Redboot thing. I would appreciate if somebody could confirm this. Also, are the fans really stopped, of set into automatic mode and just happen not to spin because the temperature isn't high enough? Can I see a dump of the chip before the Linux driver is loaded?

So, someone is selling hardware that fries when used because they disabled the fans on purpose. How can this be? Is this hardware supposed to be used with another OS, and that other OS does kick the fans in as you suggest Linux should do? Please clarify the situation.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Riku Voipio
Quoted 1 line · Jean Delvare

Hi Lennert,

Hey Jean,

Quoted 7 lines
Quoted 4 lines

While I would agree that fixing this in the bootloader is the cleanest approach, I'm pretty sure that even if we do manage to build a new version of the bootloader (I'm not even sure whether we have the source for it),

Can't you contact whoever sells this system? If the "BIOS" is broken, that's really up to them to fix it.

These systems are sold by Thecus. (www.thecus.com) The n2100 looks something like this:

http://www.trustedreviews.com/images/article/inline/2559-frontleft.jpg

In the default firmware, the bootloader automatically boots an ARM Linux kernel which contains a fan controller driver. Meaning, the default kernel that runs on the machine (which is the only kernel that the manufacturer has envisioned ever running on the machine -- and most users of the device won't actually realise that there is a Linux kernel running on the device at all) handles thermal management correctly.

The n2100 is sold as a purpose-built NAS appliance, not as a general-purpose ARM hack box. Even though it's not too hard to hack the firmware and run your own software on the machine, it's not something that the product is advertised for.

I'm not sure whether the bootloader explicitly disables the fans or whether they just don't kick in because the temperature isn't high enough.

Quoted 4 lines
Quoted 2 lines

I'm sure many users would be very reluctant to flash a new
bootloader into their device.

If their machine fries when they don't, I'm pretty sure they will ;)

Luckily, their machine won't fry if they don't. :)

Quoted 11 lines
Quoted 2 lines

We do work around PC BIOS bugs in the Linux kernel as well. This isn't a very different situation from that, I think.

I'm not aware of such workarounds to prevent machines from frying. For such critical cases, system vendors typically bother releasing a BIOS update.

What I would like to understand is how we came in to the current situation. As I said, stopped fans is not the default for the F75375S chip. This really suggests that the fans are stopped on purpose by whoever wrote that Redboot thing.

As I understand, Redboot was written by Red Hat. It's probably one of the most widely used ARM bootloaders out there.

The port of Redboot to the IOP 80219 (which is the CPU in the n2100) was done by Intel, and the port to the n2100 board specifically was done by Thecus.

As I said above, I am not entirely sure what Redboot does. Riku, do you have the source code for the Redboot used in the n2100?

Quoted 4 lines

I would appreciate if somebody could
confirm this. Also, are the fans really stopped, of set into automatic mode and just happen not to spin because the temperature isn't high enough?

I'm not entirely sure.

Quoted 1 line

Can I see a dump of the chip before the Linux driver is loaded?

Riku?

Quoted 2 lines

So, someone is selling hardware that fries when used because they disabled the fans on purpose.

It's not as dramatic as that. :)

Quoted 3 lines

How can this be? Is this hardware
supposed to be used with another OS, and that other OS does kick the fans in as you suggest Linux should do? Please clarify the situation.

I don't think other OSes run on this machine.

Well, maybe one of the BSDs do -- but I'm not sure how they handle the fans.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw
In reply to Riku Voipio
Quoted 5 lines · Lennert Buytenhek
Quoted 5 lines
Quoted 5 lines

While I would agree that fixing this in the bootloader is the cleanest approach, I'm pretty sure that even if we do manage to build a new version of the bootloader (I'm not even sure whether we have the source for it),

Quoted 10 lines
Quoted 3 lines

Can't you contact whoever sells this system? If the "BIOS" is broken, that's really up to them to fix it.

I'm not sure whether the bootloader explicitly disables the fans or whether they just don't kick in because the temperature isn't high enough.

Redboot does not touch the fans. The problem is that the fanspeed reading isn't reliable. The "speed" mode tries to adjust pwm to get the fanspeed to match whatever is requested in "expect" registers, but never to enough to get the fans to run.

..

Quoted 4 lines
Quoted 4 lines

I'm not aware of such workarounds to prevent machines from frying. For such critical cases, system vendors typically bother releasing a BIOS update.

As Lennert mentioned, Software provided by Thecus does set the fans running by default (by combination of a kernel driver and userland scripts). It's not sold as a general purpose PC.

In my experience the risk of literal "frying" is very very low, but even with just one one disk inside and finnish cool weather, smartmontools have reported the hard drive going over the operating temperature limit (60c).

With, say, 2x10 rpm disks inside the case, I'd say the risk of disks breaking down prematurely is very real. And I do not want to take the responsibility of people reporting that "installing Debian caused my hardware to break down"

Quoted 3 lines

As I said above, I am not entirely sure what Redboot does. Riku, do you have the source code for the Redboot used in the n2100?

We have some redboot code from Thecus. But I'm so not going to touch it, since currently we have no way to recover the bootloader in case it goes bust.

Also, "fixing" in this case is more likely to mean "add support for the fintek chip" rather than "rather"

Quoted 6 lines
Quoted 2 lines

Can I see a dump of the chip before the Linux driver is loaded?

Riku?

I'll grab it, but see the first paragraph I wrote.

Quoted 10 lines
Quoted 4 lines

How can this be? Is this hardware
supposed to be used with another OS, and that other OS does kick the fans in as you suggest Linux should do? Please clarify the situation.

I don't think other OSes run on this machine.

Well, maybe one of the BSDs do -- but I'm not sure how they handle the fans.

The one being OpenBSD. They send fans to full speed in fintek driver with driver paramater. I guess the parameter gets compiled in the kernel when compiling a n2100 kernel.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#7 lore raw
In reply to Riku Voipio

Hi Riku, Lennert,

Quoted 4 lines · Riku Voipio

Redboot does not touch the fans. The problem is that the fanspeed reading isn't reliable. The "speed" mode tries to adjust pwm to get the fanspeed to match whatever is requested in "expect" registers, but never to enough to get the fans to run.

I see. I have to admit that it isn't very smart from Fintek to set the "speed mode" by default on this chip. It would be safer to default to full speed. OTOH the default speed target seems to be 4297 RPM if I read the datasheet correctly, which is high enough. If the fan speed reading isn't reliable (which admittedly is a bad thing to start with) I'd expect the chip to set the fan output to the max. Isn't it the case?

Quoted 10 lines

As Lennert mentioned, Software provided by Thecus does set the fans running by default (by combination of a kernel driver and userland scripts). It's not sold as a general purpose PC.

In my experience the risk of literal "frying" is very very low, but even with just one one disk inside and finnish cool weather, smartmontools have reported the hard drive going over the operating temperature limit (60c).

Quoted 4 lines

With, say, 2x10 rpm disks inside the case, I'd say the risk of disks breaking down prematurely is very real. And I do not want to take the responsibility of people reporting that "installing Debian caused my hardware to break down"

I see. But I can't think of a reason why this can't be simply solved in user-space, as Thecus is doing in their own product. This would be much easier than the kernel patches you've been sending.

Quoted 3 lines
Quoted 1 line

Can I see a dump of the chip before the Linux driver is loaded?

I'll grab it, but see the first paragraph I wrote.

I'm still interested.

Thanks,

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#8 lore raw
In reply to Riku Voipio
Quoted 8 lines · Jean Delvare

Hi Riku, Lennert,

Quoted 4 lines · Riku Voipio

Redboot does not touch the fans. The problem is that the fanspeed reading isn't reliable. The "speed" mode tries to adjust pwm to get the fanspeed to match whatever is requested in "expect" registers, but never to enough to get the fans to run.

Quoted 7 lines

I see. I have to admit that it isn't very smart from Fintek to set the "speed mode" by default on this chip. It would be safer to default to full speed. OTOH the default speed target seems to be 4297 RPM if I read the datasheet correctly, which is high enough. If the fan speed reading isn't reliable (which admittedly is a bad thing to start with) I'd expect the chip to set the fan output to the max. Isn't it the case?

If it would be setting fan speed to full speed by default I would not be sending these patches in the first place...

Quoted 8 lines
Quoted 4 lines

With, say, 2x10 rpm disks inside the case, I'd say the risk of disks breaking down prematurely is very real. And I do not want to take the responsibility of people reporting that "installing Debian caused my hardware to break down"

I see. But I can't think of a reason why this can't be simply solved in user-space, as Thecus is doing in their own product. This would be much easier than the kernel patches you've been sending.

Exactly what should Debian ship in /etc/sensors.conf to make f75375s turn fans on N2100 systems but nowhere else? Simple my ASS. Last I read about operating systems, the bloody point of kernel was to abstract hardware differences.

Conveying platform_data from board configs to drivers is a well established practice to solve platform specific quirks.

Not to mention that these kind of safety measures should be done as early as possible. And due to the reasons I already gave, changing bootloader is not really a option, the kernel is the next best thing.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Can I see a dump of the chip before the Linux driver is loaded?

I'll grab it, but see the first paragraph I wrote.

I'm still interested.

Thanks,

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 01 03 82 40 5c 18 ff ff ff ff ff ff ff ff ff ff    ???@\?..........
10: d8 a8 d7 72 24 22 ff ff ff ff ff ff ff ff ff ff    ???r$"..........
20: ff 00 ff 00 ff 00 ff 00 3c 37 3c 37 ff ff ff ff    ........<7<7....
30: 00 00 00 00 00 f0 00 03 00 ff ff ff ff ff ff ff    .....?.?........
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff 03 06 15 19 34 ff    ..........????4.
60: 50 02 09 00 00 00 09 89 89 30 30 10 10 33 32 00    P??...???00??32.
70: ff ff ff ff ff ff 00 05 0a ff ff ff f5 00 ff ff    .......??...?...
80: ff ff ff ff ff ff 00 05 0a ff ff ff f5 00 ff ff    .......??...?...
90: 00 00 0d ff ff ff ff ff ff ff ff ff ff ff ff ff    ..?.............
a0: 3c 32 28 1e ff ff ff ff ff ff ff ff ff ff ff ff    <2(?............
b0: 3c 32 28 1e ff ff ff ff ff ff ff ff ff ff ff ff    <2(?............
c0: ae 04 ae 04 ff ff ff ff ff ff ff ff ff ff ff ff    ????............
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: 80 80 00 00 00 03 5b 06 c0 00 00 ff ff ff ff 1d    ??...?[??......?

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#9 lore raw
In reply to Riku Voipio

Hi:

Quoted 7 lines · Lennert Buytenhek
Quoted 5 lines · Riku Voipio

On thecus n2100, the bootloader does not setup fans to run. In order to protect the user from frying their gear, start up fans on boot.

Depends on:

Quoted 8 lines
Quoted 6 lines

f75375s: Add new style bindings
f75375s: allow setting up fans with platform_data

patches sent to lm-sensors mailing list.

Applied to hwmon-2.6.git/testing, thanks.

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#10 lore raw
In reply to Riku Voipio

Hi Riku,

Quoted 9 lines · Riku Voipio
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 01 03 82 40 5c 18 ff ff ff ff ff ff ff ff ff ff    ???@\?..........
10: d8 a8 d7 72 24 22 ff ff ff ff ff ff ff ff ff ff    ???r$"..........
20: ff 00 ff 00 ff 00 ff 00 3c 37 3c 37 ff ff ff ff    ........<7<7....
30: 00 00 00 00 00 f0 00 03 00 ff ff ff ff ff ff ff    .....?.?........
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff 03 06 15 19 34 ff    ..........????4.
60: 50 02 09 00 00 00 09 89 89 30 30 10 10 33 32 00    P??...???00??32.
70: ff ff ff ff ff ff 00 05 0a ff ff ff f5 00 ff ff    .......??...?...
Quoted 8 lines
80: ff ff ff ff ff ff 00 05 0a ff ff ff f5 00 ff ff    .......??...?...
90: 00 00 0d ff ff ff ff ff ff ff ff ff ff ff ff ff    ..?.............
a0: 3c 32 28 1e ff ff ff ff ff ff ff ff ff ff ff ff    <2(?............
b0: 3c 32 28 1e ff ff ff ff ff ff ff ff ff ff ff ff    <2(?............
c0: ae 04 ae 04 ff ff ff ff ff ff ff ff ff ff ff ff    ????............
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: 80 80 00 00 00 03 5b 06 c0 00 00 ff ff ff ff 1d    ??...?[??......?

Register 0x60 has value 0x50, meaning that both fans are in manual mode. This is _not_ the chip default according to the datasheet. Registers 0x76 and 0x86 have value 0x00, which mean PWM duty cycle at 0% for both fans. Again this is _not_ the chip default according to the datasheet.

So, assuming that the dump above was really taken right after boot before the Linux kernel driver had a chance to change register values, and also assuming that the datasheet provided by Fintek is correct, this really means that Thecus are voluntarily stopping the fans at boot time. That's a pretty stupid thing to do.

This doesn't imply whether we should or shouldn't start the fans at a later point, of course. But at least it explains why the fans aren't spinning at boot when the datasheet defaults suggested that they should.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors