Skip to contentSkip to conversation

ARM: dts: aspeed: Add ARM system BMC device tree

PATCH Superseded Ken Chen 4 participants 6 messages Jan 8, 2018 – Feb 1, 2018

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Ken Chen

author
#0 lore raw

PATCH 1/1 ARM: dts: aspeed: Add ARM system BMC device tree

Add 2400-rep dts and modify platform initial in aspeed.c

---
 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts | 440 ++++++++++++++++++++++++++
 arch/arm/mach-aspeed/aspeed.c                 |  22 ++
 2 files changed, 462 insertions(+)
 create mode 100644 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +440 -0
new file mode 100644
index 0000000..cf389f5
@@ -0,0 +1,440 @@
+/dts-v1/;
+
+#include "aspeed-g5.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+
+/ {
+	model = "Qualcomm Centriq 2400  REP AST2520";
+	compatible = "qualcomm,centriq2400-rep-bmc", "aspeed,ast2500";
+
+	chosen {
+		stdout-path = &uart5;
+		bootargs = "console=ttyS4,115200 earlyprintk";
+	};
+
+	memory {
+		reg = <0x80000000 0x40000000>;
+	};
+
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		flash_memory: region@98000000 {
+			no-map;
+			reg = <0x98000000 0x04000000>; /* 64M */
+		};
+	};
+
+	iio-hwmon {
+		compatible = "iio-hwmon";
+		io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>,
+                        <&adc 4>, <&adc 5>, <&adc 6>, <&adc 8>;
+	};
+
+	iio-hwmon-battery {
+		compatible = "iio-hwmon";
+		io-channels = <&adc 7>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		UID_LED {
+			label = "UID_LED";
+			gpios = <&gpio ASPEED_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
+		};
+
+		RAS_ERROR_LED {
+			label = "RAS_ERROR_LED";
+			gpios = <&gpio ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+		};
+
+		System_Fault {
+			label = "System_fault";
+			gpios = <&gpio ASPEED_GPIO(A, 1) GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&fmc {
+	status = "okay";
+	flash@0 {
+		status = "okay";
+		m25p,fast-read;
+#include "openbmc-flash-layout.dtsi"
+	};
+};
+
+&spi1 {
+        reg = <0x1e630000 0xc4 0x30000000 0x08000000>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        compatible = "aspeed,ast2500-spi";
+        status = "okay";
+        clocks = <&clk_ahb>;
+        clock-names = "ahb";
+        flash@0 {
+                reg = < 0 >; /* chip select number */
+                compatible = "jedec,spi-nor";
+                status = "okay";
+        };
+};
+
+&spi2 {
+        compatible = "aspeed,ast2500-spi-generic";
+        reg = <0x1e631000 0xc4 0x38000000 0x02000000>;
+        interrupts = <59>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "okay";
+        spi2@0 {
+                reg = < 0 >;
+                compatible = "centriq,centriq2400-spi-hwmon";
+                spi-max-frequency = <16000000>;
+                status = "okay";
+        };
+};
+
+&uart3 {
+        status = "okay";
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_txd3_default
+                     &pinctrl_rxd3_default>;
+        current-speed = <115200>;
+};
+
+&lpc_ctrl {
+	status = "okay";
+	memory-region = <&flash_memory>;
+	flash = <&spi1>;
+};
+
+&uart5 {
+	status = "okay";
+};
+
+&mac0 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_rgmii1_default &pinctrl_mdio1_default>;
+};
+
+&i2c0 {
+	status = "okay";
+
+	pca9542@70 {
+                compatible = "pca9542";
+                reg = <0x70>;
+		i2c@0 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0>;
+			pca9546@77 {
+				compatible = "pca9546";
+				reg = <0x77>;
+				i2c@0 {	
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+					eeprom@52 {
+						compatible = "atmel,24c02";
+						reg = <0x52>;
+					};
+				};
+				i2c@2 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <2>;
+					eeprom@57 {
+						compatible = "atmel,24c02";
+						reg = <0x57>;
+					};
+				};
+			};
+		};
+		i2c@1 {
+			
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <1>;
+			pca9546@77 {
+				compatible = "pca9546";
+				reg = <0x77>;
+				i2c@2 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <2>;
+					eeprom@57 {
+						compatible = "atmel,24c02";
+						reg = <0x57>;
+					};
+				};
+			};
+		};
+
+        };
+};
+
+&i2c1 {
+	status = "okay";
+
+        tmp421@1e {
+                compatible = "ti,tmp421";
+                reg = <0x1e>;
+        };
+        tmp421@2a {
+                compatible = "ti,tmp421";
+                reg = <0x2a>;
+        };
+        tmp421@4e {
+                compatible = "ti,tmp421";
+                reg = <0x4e>;
+        };
+        tmp421@1c {
+                compatible = "ti,tmp421";
+                reg = <0x1c>;
+        };
+};
+
+&i2c2 {
+	status = "okay";
+	ssif {
+                compatible = "ssif-smbus-slave";
+                reg = <0x42>;
+        };
+
+};
+
+&i2c3 {
+	status = "okay";
+};
+
+&i2c4 {
+	status = "okay";
+};
+
+&i2c5 {
+	status = "okay";
+
+        ir38163@42 {
+                compatible = "ir38163";
+                reg = <0x42>;
+        };
+	ir38163@44 {
+                compatible = "ir38163";
+                reg = <0x44>;
+        };
+	ir38163@46 {
+                compatible = "ir38163";
+                reg = <0x46>;
+        };
+	ir38163@48 {
+                compatible = "ir38163";
+                reg = <0x48>;
+        };
+	pxm1310@02 {
+                compatible = "pxm1310";
+                reg = <0x02>;
+        };
+	pxm1310@04 {
+                compatible = "pxm1310";
+                reg = <0x04>;
+        };
+};
+
+&i2c6 {
+	status = "okay";
+        
+	tmp421@1d {
+                compatible = "ti,tmp421";
+                reg = <0x1d>;
+        };
+        tmp421@1f {
+                compatible = "ti,tmp421";
+                reg = <0x1f>;
+        };
+        tmp421@4d {
+                compatible = "ti,tmp421";
+                reg = <0x4d>;
+        };
+        tmp421@4f {
+                compatible = "ti,tmp421";
+                reg = <0x4f>;
+        };
+
+        nvt210@4c {
+                compatible = "nvt210";
+                reg = <0x4c>;
+        };
+
+	eeprom@50 {
+                compatible = "atmel,24c128";
+                reg = <0x50>;
+		pagesize = <128>;
+        };
+};
+
+&i2c7 {
+	status = "okay";
+
+        adm1278@10 {
+                compatible = "adi,adm1278";
+                reg = <0x10>;
+		Rsense = <250>;
+        };
+        adm1278@11 {
+                compatible = "adi,adm1278";
+                reg = <0x11>;
+		Rsense = <250>;
+        };
+};
+
+&i2c8 {
+	status = "okay";
+	
+	pca9641@70 {
+		compatible = "nxp,pca9641";
+		reg = <0x70>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+                i2c-arb{
+                        tmp421@1d {
+                                compatible = "tmp421";
+                                reg = <0x1d>;
+                        };
+                	adm1278@12 {
+                        	compatible = "adi,adm1278";
+                        	reg = <0x12>;
+				Rsense = <500>;
+                	};
+                        max31790@20 {
+                                compatible = "max31790";
+                                reg = <0x20>;
+                                #address-cells = <1>;
+                                #size-cells = <0>;
+				fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                        };
+	                max31790@23 {
+        	                compatible = "max31790";
+                	        reg = <0x23>;
+                        	#address-cells = <2>;
+				#size-cells = <0>;
+				fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                	};
+			eeprom@50 {
+				compatible = "atmel,24c02";
+				reg = <0x50>;
+			};
+                        ds1100@58 {
+                                compatible = "ds1100";
+                                reg = <0x58>;
+                        };
+               };
+	};
+};
+
+&i2c9 {
+	status = "okay";
+};
+
+&i2c10 {
+	status = "disabled";
+};
+
+&i2c11 {
+	status = "disabled";
+};
+
+&i2c12 {
+	status = "disabled";
+};
+
+&i2c13 {
+	status = "disabled";
+};
+
+&vuart {
+	status = "okay";
+};
+
+&gfx {
+        status = "okay";
+};
+
+&pinctrl {
+	aspeed,external-nodes = <&gfx &lhc>;
+};
+&gpio {
+	pin_gpio_a3 {
+		gpios = <ASPEED_GPIO(A, 3) GPIO_ACTIVE_HIGH>;
+		output-low;
+	};
+	pin_gpio_c7 {
+		gpios = <ASPEED_GPIO(C, 7) GPIO_ACTIVE_HIGH>;
+		output-low;
+	};
+	pin_gpio_d2 {
+		gpios = <ASPEED_GPIO(D, 2) GPIO_ACTIVE_HIGH>;
+		output-high;
+	};
+	pin_gpio_d3 {
+		gpios = <ASPEED_GPIO(D, 3) GPIO_ACTIVE_LOW>;
+		output-high;
+	};
+	pin_gpio_f6 {
+		gpios = <ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+		output-high;
+	};
+	pin_gpio_g4 {
+		gpios = <ASPEED_GPIO(G, 4) GPIO_ACTIVE_LOW>;
+		output-low;
+	};
+	pin_gpio_g6 {
+		gpios = <ASPEED_GPIO(G, 6) GPIO_ACTIVE_HIGH>;
+		output-low;
+	};
+	pin_gpio_l4 {
+		gpios = <ASPEED_GPIO(L, 4) GPIO_ACTIVE_LOW>;
+		output-high;
+	};
+	pin_gpio_o6 {
+		gpios = <ASPEED_GPIO(O, 6) GPIO_ACTIVE_HIGH>;
+		output-low;
+	};
+	pin_gpio_p0 {
+		gpios = <ASPEED_GPIO(P, 0) GPIO_ACTIVE_HIGH>;
+		output-high;
+	};
+	pin_gpio_p2 {
+		gpios = <ASPEED_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
+		output-low;
+	};
+	pin_gpio_q4 {
+		gpios = <ASPEED_GPIO(Q, 4) GPIO_ACTIVE_HIGH>;
+		output-low;
+	};
+	pin_gpio_r1 {
+		gpios = <ASPEED_GPIO(R, 1) GPIO_ACTIVE_LOW>;
+		output-high;
+	};
+	pin_gpio_y2 {
+		gpios = <ASPEED_GPIO(Y, 2) GPIO_ACTIVE_HIGH>;
+		output-high;
+	};
+};
arch/arm/mach-aspeed/aspeed.c +22 -0
index 5965bbf..4f6a5e9 100644
@@ -29,6 +29,7 @@
 #define AST_BASE_MAC0		0X1E660000 /* MAC 1 */
 #define AST_BASE_SCU		0x1E6E2000 /* System Control Unit (SCU) */
 #define AST_BASE_GPIO		0x1E780000 /* GPIO Controller */
+#define AST_BASE_WDT		0x1E785000 /* Watchdog Timer */
 
 static struct map_desc aspeed_io_desc[] __initdata __maybe_unused = {
 	{
@@ -232,6 +233,25 @@ static void __init do_mellanox_setup(void)
 	writel(reg, AST_IO(AST_BASE_SCU | 0x48));
 }
 
+
+static void __init do_centriq2400rep_setup(void)
+{
+       u32 reg;
+
+       do_common_setup();
+       writel(0x00000010, AST_IO(AST_BASE_WDT | 0x2c));
+
+       writel(0xff000000, AST_IO(AST_BASE_SCU | 0x88));
+
+       /* Set GPIOC7 to output high to init host spi driver */
+       reg = readl(AST_IO(AST_BASE_GPIO | 0x04)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO | 0x04));
+
+       reg = readl(AST_IO(AST_BASE_GPIO)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO));
+}
+
+
 #define SCU_PASSWORD	0x1688A8A8
 
 static void __init aspeed_init_early(void)
@@ -284,6 +304,8 @@ static void __init aspeed_init_early(void)
 		do_lanyang_setup();
 	if (of_machine_is_compatible("mellanox,msn-bmc"))
 		do_mellanox_setup();
+        if (of_machine_is_compatible("qualcomm,centriq2400-rep-bmc"))
+                do_centriq2400rep_setup();
 }
 
 static void __init aspeed_map_io(void)
Signature · 1 line
2.9.3
maintainer
#1 lore raw

Hello Ken,

Thanks for the patch. Some comments are below. Feel free to ask questions if you need more information.

Quoted 1 line · Ken Chen

Add 2400-rep dts and modify platform initial in aspeed.c

What is 2400-rep stand for?

I can see it being confused with the ast2400. Do you have other suggestions for names for this machine?

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts

Quoted 14 lines
---
 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts | 440 ++++++++++++++++++++++++++
 arch/arm/mach-aspeed/aspeed.c                 |  22 ++
 2 files changed, 462 insertions(+)
 create mode 100644 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +0 -0
new file mode 100644
index 0000000..cf389f5
@@ -0,0 +1,440 @@

Add copyright information to the first line. Something like this:

// SPDX-License-Identifier: GPL-2.0
// Copyright 2018 My Company, Inc

eg:

https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/tree/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts?h=for-next

Quoted 16 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +16 -0
+/dts-v1/;
+
+#include "aspeed-g5.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+
+/ {
+       model = "Qualcomm Centriq 2400  REP AST2520";
+       compatible = "qualcomm,centriq2400-rep-bmc", "aspeed,ast2500";
+
+       chosen {
+               stdout-path = &uart5;
+               bootargs = "console=ttyS4,115200 earlyprintk";
+       };
+
+       memory {
+               reg = <0x80000000 0x40000000>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 26

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               flash_memory: region@98000000 {
+                       no-map;
+                       reg = <0x98000000 0x04000000>; /* 64M */

We use this for an OpenPower specific feature that allows faster loading of the host firmware. Are you planning on doing the same with ARM?

Quoted 8 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +8 -0
+               };
+       };
+
+       iio-hwmon {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>,
+                        <&adc 4>, <&adc 5>, <&adc 6>, <&adc 8>;
+       };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 44

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+       iio-hwmon-battery {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 7>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               UID_LED {

lowercase for the node please:

uid_led {
}

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 45

Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +1 -0
+                       label = "UID_LED";

I think we have a naming convention for openbmc led labels. Brad, can you help out here?

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                       gpios = <&gpio ASPEED_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
+               };
+
+               RAS_ERROR_LED {
+                       label = "RAS_ERROR_LED";
+                       gpios = <&gpio ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+               };
+
+               System_Fault {
+                       label = "System_fault";

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 65

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                       gpios = <&gpio ASPEED_GPIO(A, 1) GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&fmc {
+       status = "okay";
+       flash@0 {
+               status = "okay";
+               m25p,fast-read;

add:

                label = "bmc";
Quoted 7 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +7 -0
+#include "openbmc-flash-layout.dtsi"
+       };
+};
+
+&spi1 {
+        reg = <0x1e630000 0xc4 0x30000000 0x08000000>;
+        #address-cells = <1>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 82

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+        #size-cells = <0>;
+        compatible = "aspeed,ast2500-spi";
+        status = "okay";
+        clocks = <&clk_ahb>;
+        clock-names = "ahb";
+        flash@0 {
+                reg = < 0 >; /* chip select number */
+                compatible = "jedec,spi-nor";
+                status = "okay";
+        };

This is all defined in the aspeed-g5.dtsi. You just need this to enable the controller and the first chip select:

&spi1 {
     status = "okay";
     flash@0 {
               status = "okay";
               m25p,fast-read;
               label = "pnor";
     };
};

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 94

Quoted 12 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +12 -0
+};
+
+&spi2 {
+        compatible = "aspeed,ast2500-spi-generic";
+        reg = <0x1e631000 0xc4 0x38000000 0x02000000>;
+        interrupts = <59>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "okay";
+        spi2@0 {
+                reg = < 0 >;
+                compatible = "centriq,centriq2400-spi-hwmon";

That's kind of strange. I assume you have a driver for this?

Either way, the device tree is incorrect.

Quoted 102 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +102 -0
+                spi-max-frequency = <16000000>;
+                status = "okay";
+        };
+};
+
+&uart3 {
+        status = "okay";
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_txd3_default
+                     &pinctrl_rxd3_default>;
+        current-speed = <115200>;
+};
+
+&lpc_ctrl {
+       status = "okay";
+       memory-region = <&flash_memory>;
+       flash = <&spi1>;
+};
+
+&uart5 {
+       status = "okay";
+};
+
+&mac0 {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_rgmii1_default &pinctrl_mdio1_default>;
+};
+
+&i2c0 {
+       status = "okay";
+
+       pca9542@70 {
+                compatible = "pca9542";
+                reg = <0x70>;
+               i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+                       pca9546@77 {
+                               compatible = "pca9546";
+                               reg = <0x77>;
+                               i2c@0 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <0>;
+                                       eeprom@52 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x52>;
+                                       };
+                               };
+                               i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <2>;
+                                       eeprom@57 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x57>;
+                                       };
+                               };
+                       };
+               };
+               i2c@1 {
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+                       pca9546@77 {
+                               compatible = "pca9546";
+                               reg = <0x77>;
+                               i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <2>;
+                                       eeprom@57 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x57>;
+                                       };
+                               };
+                       };
+               };
+
+        };
+};
+
+&i2c1 {
+       status = "okay";
+
+        tmp421@1e {
+                compatible = "ti,tmp421";
+                reg = <0x1e>;
+        };
+        tmp421@2a {
+                compatible = "ti,tmp421";
+                reg = <0x2a>;
+        };
+        tmp421@4e {
+                compatible = "ti,tmp421";
+                reg = <0x4e>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 206

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+        tmp421@1c {
+                compatible = "ti,tmp421";
+                reg = <0x1c>;
+        };
+};
+
+&i2c2 {
+       status = "okay";
+       ssif {
+                compatible = "ssif-smbus-slave";

There are no bindings that use this string. Do you have a driver for this?

Quoted 8 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +8 -0
+                reg = <0x42>;
+        };
+
+};
+
+&i2c3 {
+       status = "okay";
+};

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 224

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+&i2c4 {
+       status = "okay";
+};
+
+&i2c5 {
+       status = "okay";
+
+        ir38163@42 {
+                compatible = "ir38163";

There are no bindings that use this string. Do you have a driver for this?

Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +6 -0
+                reg = <0x42>;
+        };
+       ir38163@44 {
+                compatible = "ir38163";
+                reg = <0x44>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 240

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       ir38163@46 {
+                compatible = "ir38163";
+                reg = <0x46>;
+        };
+       ir38163@48 {
+                compatible = "ir38163";
+                reg = <0x48>;
+        };
+       pxm1310@02 {
+                compatible = "pxm1310";

Again, there are no bindings that use this string. Do you have a driver for this?

Quoted 27 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +27 -0
+                reg = <0x02>;
+        };
+       pxm1310@04 {
+                compatible = "pxm1310";
+                reg = <0x04>;
+        };
+};
+
+&i2c6 {
+       status = "okay";
+
+       tmp421@1d {
+                compatible = "ti,tmp421";
+                reg = <0x1d>;
+        };
+        tmp421@1f {
+                compatible = "ti,tmp421";
+                reg = <0x1f>;
+        };
+        tmp421@4d {
+                compatible = "ti,tmp421";
+                reg = <0x4d>;
+        };
+        tmp421@4f {
+                compatible = "ti,tmp421";
+                reg = <0x4f>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 277

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+        nvt210@4c {
+                compatible = "nvt210";
+                reg = <0x4c>;
+        };
+
+       eeprom@50 {
+                compatible = "atmel,24c128";
+                reg = <0x50>;
+               pagesize = <128>;

Whitespace is bad here.

Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +5 -0
+        };
+};
+
+&i2c7 {
+       status = "okay";

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 292

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+        adm1278@10 {
+                compatible = "adi,adm1278";
+                reg = <0x10>;
+               Rsense = <250>;
+        };
+        adm1278@11 {
+                compatible = "adi,adm1278";
+                reg = <0x11>;
+               Rsense = <250>;

This looks wrong. Is this a custom modification to the driver to support this property?

Quoted 24 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +24 -0
+        };
+};
+
+&i2c8 {
+       status = "okay";
+
+       pca9641@70 {
+               compatible = "nxp,pca9641";
+               reg = <0x70>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+                i2c-arb{
+                        tmp421@1d {
+                                compatible = "tmp421";
+                                reg = <0x1d>;
+                        };
+                       adm1278@12 {
+                               compatible = "adi,adm1278";
+                               reg = <0x12>;
+                               Rsense = <500>;
+                       };
+                        max31790@20 {
+                                compatible = "max31790";
+                                reg = <0x20>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 326

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                                #address-cells = <1>;
+                                #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                        };

Andrew, can you please review the max parts?

Quoted 34 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +34 -0
+                       max31790@23 {
+                               compatible = "max31790";
+                               reg = <0x23>;
+                               #address-cells = <2>;
+                               #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                       };
+                       eeprom@50 {
+                               compatible = "atmel,24c02";
+                               reg = <0x50>;
+                       };
+                        ds1100@58 {
+                                compatible = "ds1100";
+                                reg = <0x58>;
+                        };
+               };
+       };
+};
+
+&i2c9 {
+       status = "okay";
+};
+
+&i2c10 {
+       status = "disabled";
+};
+
+&i2c11 {

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 370

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       status = "disabled";
+};
+
+&i2c12 {
+       status = "disabled";
+};
+
+&i2c13 {
+       status = "disabled";
+};

Delete the above; they are disabled by default so you don't need to specify this.

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 384

Quoted 13 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +13 -0
+&vuart {
+       status = "okay";
+};
+
+&gfx {
+        status = "okay";
+};
+
+&pinctrl {
+       aspeed,external-nodes = <&gfx &lhc>;
+};
+&gpio {
+       pin_gpio_a3 {

Do you want to add labels that contain the net names for each gpio? I recommend doing this so it is understood what each line is doing.

arch/arm/mach-aspeed/aspeed.c

Quoted 60 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +56 -0
+               gpios = <ASPEED_GPIO(A, 3) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_c7 {
+               gpios = <ASPEED_GPIO(C, 7) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_d2 {
+               gpios = <ASPEED_GPIO(D, 2) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+       pin_gpio_d3 {
+               gpios = <ASPEED_GPIO(D, 3) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_f6 {
+               gpios = <ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_g4 {
+               gpios = <ASPEED_GPIO(G, 4) GPIO_ACTIVE_LOW>;
+               output-low;
+       };
+       pin_gpio_g6 {
+               gpios = <ASPEED_GPIO(G, 6) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_l4 {
+               gpios = <ASPEED_GPIO(L, 4) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_o6 {
+               gpios = <ASPEED_GPIO(O, 6) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_p0 {
+               gpios = <ASPEED_GPIO(P, 0) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+       pin_gpio_p2 {
+               gpios = <ASPEED_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_q4 {
+               gpios = <ASPEED_GPIO(Q, 4) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_r1 {
+               gpios = <ASPEED_GPIO(R, 1) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_y2 {
+               gpios = <ASPEED_GPIO(Y, 2) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+};
arch/arm/mach-aspeed/aspeed.c +0 -0
index 5965bbf..4f6a5e9 100644

Device tree changes should go in a separate to code changes.

Quoted 9 lines
arch/arm/mach-aspeed/aspeed.c +1 -0
@@ -29,6 +29,7 @@
 #define AST_BASE_MAC0          0X1E660000 /* MAC 1 */
 #define AST_BASE_SCU           0x1E6E2000 /* System Control Unit (SCU) */
 #define AST_BASE_GPIO          0x1E780000 /* GPIO Controller */
+#define AST_BASE_WDT           0x1E785000 /* Watchdog Timer */
 
 static struct map_desc aspeed_io_desc[] __initdata __maybe_unused = {
        {

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 242

Quoted 10 lines
arch/arm/mach-aspeed/aspeed.c +7 -0
@@ -232,6 +233,25 @@ static void __init do_mellanox_setup(void)
        writel(reg, AST_IO(AST_BASE_SCU | 0x48));
 }
 
+
+static void __init do_centriq2400rep_setup(void)
+{
+       u32 reg;
+
+       do_common_setup();
+       writel(0x00000010, AST_IO(AST_BASE_WDT | 0x2c));

We have a watchdog driver for modifying the watchdog. Please use that instead of this line.

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 244

Quoted 2 lines
arch/arm/mach-aspeed/aspeed.c +2 -0
+
+       writel(0xff000000, AST_IO(AST_BASE_SCU | 0x88));

This appears to be modifying the multi function pin control. What are you trying to do?

We should be able to use the pinctrl driver to modify these settings.

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 251

Quoted 6 lines
arch/arm/mach-aspeed/aspeed.c +6 -0
+
+       /* Set GPIOC7 to output high to init host spi driver */
+       reg = readl(AST_IO(AST_BASE_GPIO | 0x04)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO | 0x04));
+       reg = readl(AST_IO(AST_BASE_GPIO)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO));

Can you use a GPIO hog instead?

Quoted 18 lines
arch/arm/mach-aspeed/aspeed.c +5 -1
+}
+
+
 #define SCU_PASSWORD   0x1688A8A8
 
 static void __init aspeed_init_early(void)
@@ -284,6 +304,8 @@ static void __init aspeed_init_early(void)
                do_lanyang_setup();
        if (of_machine_is_compatible("mellanox,msn-bmc"))
                do_mellanox_setup();
+        if (of_machine_is_compatible("qualcomm,centriq2400-rep-bmc"))
+                do_centriq2400rep_setup();
 }
 
 static void __init aspeed_map_io(void)
--

2.9.3

#2 lore raw

Hi Joel,

Thanks you.
Before I update new patch, I have some question.
Should I remove the definition which the driver didn't update now? The related driver added or modified will be update in future.

The watchdog is check for BMC and avoid BMC boot error, if we didn't stop this, BMC chip will boot second BMC SPI ROM. Does the driver support this? Could you give me an example or advice?

The multi-function is enable SPI. It might modify driver.

What is the mean of "Can you use a GPIO hog instead?" ?

Hi Mohit and Harold,

Do you have any advice for the company name?

Thanks.
Ken

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Joel Stanley
Sent: Wednesday, January 17, 2018 8:18 AM
To: Chen.KenYY 陳永營 TAO; Brad Bishop; Andrew Jeffery
Cc: OpenBMC Maillist
Subject: Re: [PATCH linux dev-4.10] ARM: dts: aspeed: Add ARM system BMC device tree

Hello Ken,

Thanks for the patch. Some comments are below. Feel free to ask questions if you need more information.

Quoted 1 line · Ken Chen

Add 2400-rep dts and modify platform initial in aspeed.c

What is 2400-rep stand for?

I can see it being confused with the ast2400. Do you have other suggestions for names for this machine?

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts

Quoted 15 lines
---
 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts | 440 ++++++++++++++++++++++++++
 arch/arm/mach-aspeed/aspeed.c                 |  22 ++
 2 files changed, 462 insertions(+)
 create mode 100644 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +0 -0
new file mode 100644
index 0000000..cf389f5
@@ -0,0 +1,440 @@

Add copyright information to the first line. Something like this:

// SPDX-License-Identifier: GPL-2.0
// Copyright 2018 My Company, Inc

eg:

https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/tree/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts?h=for-next

Quoted 16 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +16 -0
+/dts-v1/;
+
+#include "aspeed-g5.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+
+/ {
+       model = "Qualcomm Centriq 2400  REP AST2520";
+       compatible = "qualcomm,centriq2400-rep-bmc", "aspeed,ast2500";
+
+       chosen {
+               stdout-path = &uart5;
+               bootargs = "console=ttyS4,115200 earlyprintk";
+       };
+
+       memory {
+               reg = <0x80000000 0x40000000>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 26

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               flash_memory: region@98000000 {
+                       no-map;
+                       reg = <0x98000000 0x04000000>; /* 64M */

We use this for an OpenPower specific feature that allows faster loading of the host firmware. Are you planning on doing the same with ARM?

Quoted 8 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +8 -0
+               };
+       };
+
+       iio-hwmon {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>,
+                        <&adc 4>, <&adc 5>, <&adc 6>, <&adc 8>;
+       };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 44

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+       iio-hwmon-battery {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 7>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               UID_LED {

lowercase for the node please:

uid_led {
}

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 45

Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +1 -0
+                       label = "UID_LED";

I think we have a naming convention for openbmc led labels. Brad, can you help out here?

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                       gpios = <&gpio ASPEED_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
+               };
+
+               RAS_ERROR_LED {
+                       label = "RAS_ERROR_LED";
+                       gpios = <&gpio ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+               };
+
+               System_Fault {
+                       label = "System_fault";

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 65

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                       gpios = <&gpio ASPEED_GPIO(A, 1) GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&fmc {
+       status = "okay";
+       flash@0 {
+               status = "okay";
+               m25p,fast-read;

add:

                label = "bmc";
Quoted 7 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +7 -0
+#include "openbmc-flash-layout.dtsi"
+       };
+};
+
+&spi1 {
+        reg = <0x1e630000 0xc4 0x30000000 0x08000000>;
+        #address-cells = <1>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 82

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+        #size-cells = <0>;
+        compatible = "aspeed,ast2500-spi";
+        status = "okay";
+        clocks = <&clk_ahb>;
+        clock-names = "ahb";
+        flash@0 {
+                reg = < 0 >; /* chip select number */
+                compatible = "jedec,spi-nor";
+                status = "okay";
+        };

This is all defined in the aspeed-g5.dtsi. You just need this to enable the controller and the first chip select:

&spi1 {
     status = "okay";
     flash@0 {
               status = "okay";
               m25p,fast-read;
               label = "pnor";
     };
};

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 94

Quoted 12 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +12 -0
+};
+
+&spi2 {
+        compatible = "aspeed,ast2500-spi-generic";
+        reg = <0x1e631000 0xc4 0x38000000 0x02000000>;
+        interrupts = <59>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "okay";
+        spi2@0 {
+                reg = < 0 >;
+                compatible = "centriq,centriq2400-spi-hwmon";

That's kind of strange. I assume you have a driver for this?

Either way, the device tree is incorrect.

Quoted 102 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +102 -0
+                spi-max-frequency = <16000000>;
+                status = "okay";
+        };
+};
+
+&uart3 {
+        status = "okay";
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_txd3_default
+                     &pinctrl_rxd3_default>;
+        current-speed = <115200>;
+};
+
+&lpc_ctrl {
+       status = "okay";
+       memory-region = <&flash_memory>;
+       flash = <&spi1>;
+};
+
+&uart5 {
+       status = "okay";
+};
+
+&mac0 {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_rgmii1_default &pinctrl_mdio1_default>; 
+};
+
+&i2c0 {
+       status = "okay";
+
+       pca9542@70 {
+                compatible = "pca9542";
+                reg = <0x70>;
+               i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+                       pca9546@77 {
+                               compatible = "pca9546";
+                               reg = <0x77>;
+                               i2c@0 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <0>;
+                                       eeprom@52 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x52>;
+                                       };
+                               };
+                               i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <2>;
+                                       eeprom@57 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x57>;
+                                       };
+                               };
+                       };
+               };
+               i2c@1 {
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+                       pca9546@77 {
+                               compatible = "pca9546";
+                               reg = <0x77>;
+                               i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <2>;
+                                       eeprom@57 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x57>;
+                                       };
+                               };
+                       };
+               };
+
+        };
+};
+
+&i2c1 {
+       status = "okay";
+
+        tmp421@1e {
+                compatible = "ti,tmp421";
+                reg = <0x1e>;
+        };
+        tmp421@2a {
+                compatible = "ti,tmp421";
+                reg = <0x2a>;
+        };
+        tmp421@4e {
+                compatible = "ti,tmp421";
+                reg = <0x4e>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 206

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+        tmp421@1c {
+                compatible = "ti,tmp421";
+                reg = <0x1c>;
+        };
+};
+
+&i2c2 {
+       status = "okay";
+       ssif {
+                compatible = "ssif-smbus-slave";

There are no bindings that use this string. Do you have a driver for this?

Quoted 8 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +8 -0
+                reg = <0x42>;
+        };
+
+};
+
+&i2c3 {
+       status = "okay";
+};

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 224

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+&i2c4 {
+       status = "okay";
+};
+
+&i2c5 {
+       status = "okay";
+
+        ir38163@42 {
+                compatible = "ir38163";

There are no bindings that use this string. Do you have a driver for this?

Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +6 -0
+                reg = <0x42>;
+        };
+       ir38163@44 {
+                compatible = "ir38163";
+                reg = <0x44>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 240

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       ir38163@46 {
+                compatible = "ir38163";
+                reg = <0x46>;
+        };
+       ir38163@48 {
+                compatible = "ir38163";
+                reg = <0x48>;
+        };
+       pxm1310@02 {
+                compatible = "pxm1310";

Again, there are no bindings that use this string. Do you have a driver for this?

Quoted 27 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +27 -0
+                reg = <0x02>;
+        };
+       pxm1310@04 {
+                compatible = "pxm1310";
+                reg = <0x04>;
+        };
+};
+
+&i2c6 {
+       status = "okay";
+
+       tmp421@1d {
+                compatible = "ti,tmp421";
+                reg = <0x1d>;
+        };
+        tmp421@1f {
+                compatible = "ti,tmp421";
+                reg = <0x1f>;
+        };
+        tmp421@4d {
+                compatible = "ti,tmp421";
+                reg = <0x4d>;
+        };
+        tmp421@4f {
+                compatible = "ti,tmp421";
+                reg = <0x4f>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 277

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+        nvt210@4c {
+                compatible = "nvt210";
+                reg = <0x4c>;
+        };
+
+       eeprom@50 {
+                compatible = "atmel,24c128";
+                reg = <0x50>;
+               pagesize = <128>;

Whitespace is bad here.

Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +5 -0
+        };
+};
+
+&i2c7 {
+       status = "okay";

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 292

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+        adm1278@10 {
+                compatible = "adi,adm1278";
+                reg = <0x10>;
+               Rsense = <250>;
+        };
+        adm1278@11 {
+                compatible = "adi,adm1278";
+                reg = <0x11>;
+               Rsense = <250>;

This looks wrong. Is this a custom modification to the driver to support this property?

Quoted 24 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +24 -0
+        };
+};
+
+&i2c8 {
+       status = "okay";
+
+       pca9641@70 {
+               compatible = "nxp,pca9641";
+               reg = <0x70>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+                i2c-arb{
+                        tmp421@1d {
+                                compatible = "tmp421";
+                                reg = <0x1d>;
+                        };
+                       adm1278@12 {
+                               compatible = "adi,adm1278";
+                               reg = <0x12>;
+                               Rsense = <500>;
+                       };
+                        max31790@20 {
+                                compatible = "max31790";
+                                reg = <0x20>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 326

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                                #address-cells = <1>;
+                                #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                        };

Andrew, can you please review the max parts?

Quoted 34 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +34 -0
+                       max31790@23 {
+                               compatible = "max31790";
+                               reg = <0x23>;
+                               #address-cells = <2>;
+                               #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                       };
+                       eeprom@50 {
+                               compatible = "atmel,24c02";
+                               reg = <0x50>;
+                       };
+                        ds1100@58 {
+                                compatible = "ds1100";
+                                reg = <0x58>;
+                        };
+               };
+       };
+};
+
+&i2c9 {
+       status = "okay";
+};
+
+&i2c10 {
+       status = "disabled";
+};
+
+&i2c11 {

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 370

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       status = "disabled";
+};
+
+&i2c12 {
+       status = "disabled";
+};
+
+&i2c13 {
+       status = "disabled";
+};

Delete the above; they are disabled by default so you don't need to specify this.

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 384

Quoted 11 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +11 -0
+&vuart {
+       status = "okay";
+};
+
+&gfx {
+        status = "okay";
+};
+
+&pinctrl {
+       aspeed,external-nodes = <&gfx &lhc>; }; &gpio {
+       pin_gpio_a3 {

Do you want to add labels that contain the net names for each gpio? I recommend doing this so it is understood what each line is doing.

arch/arm/mach-aspeed/aspeed.c

Quoted 60 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +56 -0
+               gpios = <ASPEED_GPIO(A, 3) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_c7 {
+               gpios = <ASPEED_GPIO(C, 7) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_d2 {
+               gpios = <ASPEED_GPIO(D, 2) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+       pin_gpio_d3 {
+               gpios = <ASPEED_GPIO(D, 3) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_f6 {
+               gpios = <ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_g4 {
+               gpios = <ASPEED_GPIO(G, 4) GPIO_ACTIVE_LOW>;
+               output-low;
+       };
+       pin_gpio_g6 {
+               gpios = <ASPEED_GPIO(G, 6) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_l4 {
+               gpios = <ASPEED_GPIO(L, 4) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_o6 {
+               gpios = <ASPEED_GPIO(O, 6) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_p0 {
+               gpios = <ASPEED_GPIO(P, 0) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+       pin_gpio_p2 {
+               gpios = <ASPEED_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_q4 {
+               gpios = <ASPEED_GPIO(Q, 4) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_r1 {
+               gpios = <ASPEED_GPIO(R, 1) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_y2 {
+               gpios = <ASPEED_GPIO(Y, 2) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+};
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/aspeed.c index 5965bbf..4f6a5e9 100644

arch/arm/mach-aspeed/aspeed.c +0 -0

Device tree changes should go in a separate to code changes.

Quoted 9 lines
arch/arm/mach-aspeed/aspeed.c +1 -0
@@ -29,6 +29,7 @@
 #define AST_BASE_MAC0          0X1E660000 /* MAC 1 */
 #define AST_BASE_SCU           0x1E6E2000 /* System Control Unit (SCU) */
 #define AST_BASE_GPIO          0x1E780000 /* GPIO Controller */
+#define AST_BASE_WDT           0x1E785000 /* Watchdog Timer */
 
 static struct map_desc aspeed_io_desc[] __initdata __maybe_unused = {
        {

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 240

Quoted 8 lines
arch/arm/mach-aspeed/aspeed.c +6 -0
@@ -232,6 +233,25 @@ static void __init do_mellanox_setup(void)
        writel(reg, AST_IO(AST_BASE_SCU | 0x48));  }
 
+
+static void __init do_centriq2400rep_setup(void) {
+       u32 reg;
+
+       do_common_setup();
+       writel(0x00000010, AST_IO(AST_BASE_WDT | 0x2c));

We have a watchdog driver for modifying the watchdog. Please use that instead of this line.

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 244

Quoted 2 lines
arch/arm/mach-aspeed/aspeed.c +2 -0
+
+       writel(0xff000000, AST_IO(AST_BASE_SCU | 0x88));

This appears to be modifying the multi function pin control. What are you trying to do?

We should be able to use the pinctrl driver to modify these settings.

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 251

Quoted 6 lines
arch/arm/mach-aspeed/aspeed.c +6 -0
+
+       /* Set GPIOC7 to output high to init host spi driver */
+       reg = readl(AST_IO(AST_BASE_GPIO | 0x04)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO | 0x04));
+       reg = readl(AST_IO(AST_BASE_GPIO)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO));

Can you use a GPIO hog instead?

Quoted 18 lines
arch/arm/mach-aspeed/aspeed.c +5 -1
+}
+
+
 #define SCU_PASSWORD   0x1688A8A8
 
 static void __init aspeed_init_early(void) @@ -284,6 +304,8 @@ static 
 void __init aspeed_init_early(void)
                do_lanyang_setup();
        if (of_machine_is_compatible("mellanox,msn-bmc"))
                do_mellanox_setup();
+        if (of_machine_is_compatible("qualcomm,centriq2400-rep-bmc"))
+                do_centriq2400rep_setup();
 }
 
 static void __init aspeed_map_io(void)
--

2.9.3

#3 lore raw
Quoted 13 lines · Chen.KenYY 陳永營 TAO

Hi Joel,

Thanks you.
Before I update new patch, I have some question.
Should I remove the definition which the driver didn't update now? The related driver added or modified will be update in future.

The watchdog is check for BMC and avoid BMC boot error, if we didn't stop this, BMC chip will boot second BMC SPI ROM. Does the driver support this? Could you give me an example or advice?

Quoted 7 lines

The multi-function is enable SPI. It might modify driver.

What is the mean of "Can you use a GPIO hog instead?" ?

Hi Mohit and Harold,

Do you have any advice for the company name?

In the Qualcomm layer it is called centriq2400-rep.

Quoted 98 lines

Thanks.
Ken

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Joel Stanley
Sent: Wednesday, January 17, 2018 8:18 AM
To: Chen.KenYY 陳永營 TAO; Brad Bishop; Andrew Jeffery
Cc: OpenBMC Maillist
Subject: Re: [PATCH linux dev-4.10] ARM: dts: aspeed: Add ARM system BMC device tree

Hello Ken,

Thanks for the patch. Some comments are below. Feel free to ask questions if you need more information.

Quoted 1 line · Ken Chen

Add 2400-rep dts and modify platform initial in aspeed.c

What is 2400-rep stand for?

I can see it being confused with the ast2400. Do you have other suggestions for names for this machine?

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts

Quoted 15 lines

---
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts | 440 ++++++++++++++++++++++++++
arch/arm/mach-aspeed/aspeed.c | 22 ++

2 files changed, 462 insertions(+)

create mode 100644 arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +0 -0
new file mode 100644
index 0000000..cf389f5
@@ -0,0 +1,440 @@

Add copyright information to the first line. Something like this:

// SPDX-License-Identifier: GPL-2.0
// Copyright 2018 My Company, Inc

eg:

https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git/tree/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts?h=for-next

Quoted 16 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +16 -0
+/dts-v1/;
+
+#include "aspeed-g5.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+
+/ {
+       model = "Qualcomm Centriq 2400  REP AST2520";
+       compatible = "qualcomm,centriq2400-rep-bmc", "aspeed,ast2500";
+
+       chosen {
+               stdout-path = &uart5;
+               bootargs = "console=ttyS4,115200 earlyprintk";
+       };
+
+       memory {
+               reg = <0x80000000 0x40000000>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 26

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               flash_memory: region@98000000 {
+                       no-map;
+                       reg = <0x98000000 0x04000000>; /* 64M */

We use this for an OpenPower specific feature that allows faster loading of the host firmware. Are you planning on doing the same with ARM?

Quoted 8 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +8 -0
+               };
+       };
+
+       iio-hwmon {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>,
+                        <&adc 4>, <&adc 5>, <&adc 6>, <&adc 8>;
+       };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 44

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+       iio-hwmon-battery {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 7>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               UID_LED {

lowercase for the node please:

Quoted 6 lines

uid_led {
}

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 45

Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +1 -0
+                       label = "UID_LED";

I think we have a naming convention for openbmc led labels. Brad, can you help out here?

There isn’t one, beyond standard DT naming conventions. We are free to call them whatever we want as far as userspace is concerned.

There is retain-state-shutdown and default-state that may be desirable to use here.

Quoted 502 lines
Quoted 11 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                       gpios = <&gpio ASPEED_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
+               };
+
+               RAS_ERROR_LED {
+                       label = "RAS_ERROR_LED";
+                       gpios = <&gpio ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+               };
+
+               System_Fault {
+                       label = "System_fault";

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 65

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                       gpios = <&gpio ASPEED_GPIO(A, 1) GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&fmc {
+       status = "okay";
+       flash@0 {
+               status = "okay";
+               m25p,fast-read;

add:

               label = "bmc";
Quoted 7 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +7 -0
+#include "openbmc-flash-layout.dtsi"
+       };
+};
+
+&spi1 {
+        reg = <0x1e630000 0xc4 0x30000000 0x08000000>;
+        #address-cells = <1>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 82

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+        #size-cells = <0>;
+        compatible = "aspeed,ast2500-spi";
+        status = "okay";
+        clocks = <&clk_ahb>;
+        clock-names = "ahb";
+        flash@0 {
+                reg = < 0 >; /* chip select number */
+                compatible = "jedec,spi-nor";
+                status = "okay";
+        };

This is all defined in the aspeed-g5.dtsi. You just need this to enable the controller and the first chip select:

&spi1 {
    status = "okay";
    flash@0 {
              status = "okay";
              m25p,fast-read;
              label = "pnor";
    };
};

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 94

Quoted 12 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +12 -0
+};
+
+&spi2 {
+        compatible = "aspeed,ast2500-spi-generic";
+        reg = <0x1e631000 0xc4 0x38000000 0x02000000>;
+        interrupts = <59>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "okay";
+        spi2@0 {
+                reg = < 0 >;
+                compatible = "centriq,centriq2400-spi-hwmon";

That's kind of strange. I assume you have a driver for this?

Either way, the device tree is incorrect.

Quoted 102 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +102 -0
+                spi-max-frequency = <16000000>;
+                status = "okay";
+        };
+};
+
+&uart3 {
+        status = "okay";
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_txd3_default
+                     &pinctrl_rxd3_default>;
+        current-speed = <115200>;
+};
+
+&lpc_ctrl {
+       status = "okay";
+       memory-region = <&flash_memory>;
+       flash = <&spi1>;
+};
+
+&uart5 {
+       status = "okay";
+};
+
+&mac0 {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_rgmii1_default &pinctrl_mdio1_default>; 
+};
+
+&i2c0 {
+       status = "okay";
+
+       pca9542@70 {
+                compatible = "pca9542";
+                reg = <0x70>;
+               i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+                       pca9546@77 {
+                               compatible = "pca9546";
+                               reg = <0x77>;
+                               i2c@0 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <0>;
+                                       eeprom@52 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x52>;
+                                       };
+                               };
+                               i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <2>;
+                                       eeprom@57 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x57>;
+                                       };
+                               };
+                       };
+               };
+               i2c@1 {
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+                       pca9546@77 {
+                               compatible = "pca9546";
+                               reg = <0x77>;
+                               i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       reg = <2>;
+                                       eeprom@57 {
+                                               compatible = "atmel,24c02";
+                                               reg = <0x57>;
+                                       };
+                               };
+                       };
+               };
+
+        };
+};
+
+&i2c1 {
+       status = "okay";
+
+        tmp421@1e {
+                compatible = "ti,tmp421";
+                reg = <0x1e>;
+        };
+        tmp421@2a {
+                compatible = "ti,tmp421";
+                reg = <0x2a>;
+        };
+        tmp421@4e {
+                compatible = "ti,tmp421";
+                reg = <0x4e>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 206

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+        tmp421@1c {
+                compatible = "ti,tmp421";
+                reg = <0x1c>;
+        };
+};
+
+&i2c2 {
+       status = "okay";
+       ssif {
+                compatible = "ssif-smbus-slave";

There are no bindings that use this string. Do you have a driver for this?

Quoted 8 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +8 -0
+                reg = <0x42>;
+        };
+
+};
+
+&i2c3 {
+       status = "okay";
+};

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 224

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+&i2c4 {
+       status = "okay";
+};
+
+&i2c5 {
+       status = "okay";
+
+        ir38163@42 {
+                compatible = "ir38163";

There are no bindings that use this string. Do you have a driver for this?

Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +6 -0
+                reg = <0x42>;
+        };
+       ir38163@44 {
+                compatible = "ir38163";
+                reg = <0x44>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 240

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       ir38163@46 {
+                compatible = "ir38163";
+                reg = <0x46>;
+        };
+       ir38163@48 {
+                compatible = "ir38163";
+                reg = <0x48>;
+        };
+       pxm1310@02 {
+                compatible = "pxm1310";

Again, there are no bindings that use this string. Do you have a driver for this?

Quoted 27 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +27 -0
+                reg = <0x02>;
+        };
+       pxm1310@04 {
+                compatible = "pxm1310";
+                reg = <0x04>;
+        };
+};
+
+&i2c6 {
+       status = "okay";
+
+       tmp421@1d {
+                compatible = "ti,tmp421";
+                reg = <0x1d>;
+        };
+        tmp421@1f {
+                compatible = "ti,tmp421";
+                reg = <0x1f>;
+        };
+        tmp421@4d {
+                compatible = "ti,tmp421";
+                reg = <0x4d>;
+        };
+        tmp421@4f {
+                compatible = "ti,tmp421";
+                reg = <0x4f>;
+        };

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 277

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+        nvt210@4c {
+                compatible = "nvt210";
+                reg = <0x4c>;
+        };
+
+       eeprom@50 {
+                compatible = "atmel,24c128";
+                reg = <0x50>;
+               pagesize = <128>;

Whitespace is bad here.

Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +5 -0
+        };
+};
+
+&i2c7 {
+       status = "okay";

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 292

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+
+        adm1278@10 {
+                compatible = "adi,adm1278";
+                reg = <0x10>;
+               Rsense = <250>;
+        };
+        adm1278@11 {
+                compatible = "adi,adm1278";
+                reg = <0x11>;
+               Rsense = <250>;

This looks wrong. Is this a custom modification to the driver to support this property?

Quoted 24 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +24 -0
+        };
+};
+
+&i2c8 {
+       status = "okay";
+
+       pca9641@70 {
+               compatible = "nxp,pca9641";
+               reg = <0x70>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+                i2c-arb{
+                        tmp421@1d {
+                                compatible = "tmp421";
+                                reg = <0x1d>;
+                        };
+                       adm1278@12 {
+                               compatible = "adi,adm1278";
+                               reg = <0x12>;
+                               Rsense = <500>;
+                       };
+                        max31790@20 {
+                                compatible = "max31790";
+                                reg = <0x20>;

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 326

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+                                #address-cells = <1>;
+                                #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                        };

Andrew, can you please review the max parts?

Quoted 34 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +34 -0
+                       max31790@23 {
+                               compatible = "max31790";
+                               reg = <0x23>;
+                               #address-cells = <2>;
+                               #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                       };
+                       eeprom@50 {
+                               compatible = "atmel,24c02";
+                               reg = <0x50>;
+                       };
+                        ds1100@58 {
+                                compatible = "ds1100";
+                                reg = <0x58>;
+                        };
+               };
+       };
+};
+
+&i2c9 {
+       status = "okay";
+};
+
+&i2c10 {
+       status = "disabled";
+};
+
+&i2c11 {

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 370

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +10 -0
+       status = "disabled";
+};
+
+&i2c12 {
+       status = "disabled";
+};
+
+&i2c13 {
+       status = "disabled";
+};

Delete the above; they are disabled by default so you don't need to specify this.

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 384

Quoted 11 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +11 -0
+&vuart {
+       status = "okay";
+};
+
+&gfx {
+        status = "okay";
+};
+
+&pinctrl {
+       aspeed,external-nodes = <&gfx &lhc>; }; &gpio {
+       pin_gpio_a3 {

Do you want to add labels that contain the net names for each gpio? I recommend doing this so it is understood what each line is doing.

arch/arm/mach-aspeed/aspeed.c

Quoted 60 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +56 -0
+               gpios = <ASPEED_GPIO(A, 3) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_c7 {
+               gpios = <ASPEED_GPIO(C, 7) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_d2 {
+               gpios = <ASPEED_GPIO(D, 2) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+       pin_gpio_d3 {
+               gpios = <ASPEED_GPIO(D, 3) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_f6 {
+               gpios = <ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_g4 {
+               gpios = <ASPEED_GPIO(G, 4) GPIO_ACTIVE_LOW>;
+               output-low;
+       };
+       pin_gpio_g6 {
+               gpios = <ASPEED_GPIO(G, 6) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_l4 {
+               gpios = <ASPEED_GPIO(L, 4) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_o6 {
+               gpios = <ASPEED_GPIO(O, 6) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_p0 {
+               gpios = <ASPEED_GPIO(P, 0) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+       pin_gpio_p2 {
+               gpios = <ASPEED_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_q4 {
+               gpios = <ASPEED_GPIO(Q, 4) GPIO_ACTIVE_HIGH>;
+               output-low;
+       };
+       pin_gpio_r1 {
+               gpios = <ASPEED_GPIO(R, 1) GPIO_ACTIVE_LOW>;
+               output-high;
+       };
+       pin_gpio_y2 {
+               gpios = <ASPEED_GPIO(Y, 2) GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+};
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/aspeed.c index 5965bbf..4f6a5e9 100644

arch/arm/mach-aspeed/aspeed.c +0 -0

Device tree changes should go in a separate to code changes.

Quoted 9 lines
arch/arm/mach-aspeed/aspeed.c +1 -0
@@ -29,6 +29,7 @@
 #define AST_BASE_MAC0          0X1E660000 /* MAC 1 */
 #define AST_BASE_SCU           0x1E6E2000 /* System Control Unit (SCU) */
 #define AST_BASE_GPIO          0x1E780000 /* GPIO Controller */
+#define AST_BASE_WDT           0x1E785000 /* Watchdog Timer */
 
 static struct map_desc aspeed_io_desc[] __initdata __maybe_unused = {
       {

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 240

Quoted 8 lines
arch/arm/mach-aspeed/aspeed.c +6 -0
@@ -232,6 +233,25 @@ static void __init do_mellanox_setup(void)
       writel(reg, AST_IO(AST_BASE_SCU | 0x48));  }
 
+
+static void __init do_centriq2400rep_setup(void) {
+       u32 reg;
+
+       do_common_setup();
+       writel(0x00000010, AST_IO(AST_BASE_WDT | 0x2c));

We have a watchdog driver for modifying the watchdog. Please use that instead of this line.

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 244

Quoted 2 lines
arch/arm/mach-aspeed/aspeed.c +2 -0
+
+       writel(0xff000000, AST_IO(AST_BASE_SCU | 0x88));

This appears to be modifying the multi function pin control. What are you trying to do?

We should be able to use the pinctrl driver to modify these settings.

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 251

Quoted 6 lines
arch/arm/mach-aspeed/aspeed.c +6 -0
+
+       /* Set GPIOC7 to output high to init host spi driver */
+       reg = readl(AST_IO(AST_BASE_GPIO | 0x04)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO | 0x04));
+       reg = readl(AST_IO(AST_BASE_GPIO)) | BIT(23);
+       writel(reg, AST_IO(AST_BASE_GPIO));

Can you use a GPIO hog instead?

Quoted 18 lines
arch/arm/mach-aspeed/aspeed.c +3 -0
+}
+
+
 #define SCU_PASSWORD   0x1688A8A8
 

static void __init aspeed_init_early(void) @@ -284,6 +304,8 @@ static void __init aspeed_init_early(void)

               do_lanyang_setup();
       if (of_machine_is_compatible("mellanox,msn-bmc"))
               do_mellanox_setup();
arch/arm/mach-aspeed/aspeed.c +2 -0
+        if (of_machine_is_compatible("qualcomm,centriq2400-rep-bmc"))
+                do_centriq2400rep_setup();

}

static void __init aspeed_map_io(void)
--
2.9.3

#4 lore raw
In reply to Chen.KenYY 陳永營 TAO
Quoted 7 lines · Chen.KenYY 陳永營 TAO

Hi Joel,

Thanks you.
Before I update new patch, I have some question.
Should I remove the definition which the driver didn't update now? The related driver added or modified will be update in future.

Quoted 5 lines

The watchdog is check for BMC and avoid BMC boot error, if we didn't stop this, BMC chip will boot second BMC SPI ROM.
Does the driver support this? Could you give me an example or advice?

The multi-function is enable SPI. It might modify driver.

There's no need to modify the driver. See my previous reply about how to do this via the devicetree and existing pinmux support. Hopefully that clears it up for you.

Quoted 2 lines

What is the mean of "Can you use a GPIO hog instead?" ?

GPIO hogs are a concept in the GPIO subsystem where you can allocate and configure lines during boot and then have them left alone, exactly like you're doing here. You can specify hogs in the devicetree. See [1] for an explanation and example.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/gpio/gpio.txt?h=v4.15#n187

Cheers,

Andrew

#5 lore raw
In reply to Joel Stanley
Quoted 14 lines · Joel Stanley

arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts line 326

Quoted 13 lines
arch/arm/boot/dts/aspeed-bmc-arm-2400-rep.dts new file +13 -0
+                        max31790@20 {
+                                compatible = "max31790";
+                                reg = <0x20>;
+                                #address-cells = <1>;
+                                #size-cells = <0>;
+                               fan-mode = "pwm";
+                                fanconfig1 = <0x08>;
+                                fanconfig2 = <0x09>;
+                                fanconfig3 = <0x08>;
+                                fanconfig4 = <0x08>;
+                                fanconfig5 = <0x09>;
+                                fanconfig6 = <0x08>;
+                        };
Quoted 1 line

Andrew, can you please review the max parts?

This is for the max31790, which is a different part to the max31785 that I have worked on. However, there's no bindings document upstream for the max31790, let alone one that describes the fanconfigX properties.

Looks like we'll need to see some bindings and driver patches before we accept this node as is.

Quoted 11 lines

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 242

Quoted 7 lines
arch/arm/mach-aspeed/aspeed.c +7 -0
+
+static void __init do_centriq2400rep_setup(void)
+{
+       u32 reg;
+
+       do_common_setup();
+       writel(0x00000010, AST_IO(AST_BASE_WDT | 0x2c));

We have a watchdog driver for modifying the watchdog. Please use that instead of this line.

Quoted 7 lines

arch/arm/mach-aspeed/aspeed.c static void __init do_mellanox_setup(void) · line 244

Quoted 2 lines
arch/arm/mach-aspeed/aspeed.c +2 -0
+
+       writel(0xff000000, AST_IO(AST_BASE_SCU | 0x88));

This appears to be modifying the multi function pin control. What are you trying to do?

We should be able to use the pinctrl driver to modify these settings.

Right - this is muxing MDIO pins for MAC#1, SPI pins for SPI2, and the FWSPICS#x functions. This can all be done in the respective devicetree nodes via the existing pinmux support as Joel suggests. See [1] and then [2] for the relevant pinctrl configuration nodes. You'll need something like:

&fmc {
    pinctrl-names = "default";
    pinctrl-names = <pinctrl_&pinctrl_fwspics1_default &pinctrl_fwspics2_default>;
};
&spi2 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_spi2ck_default &pinctrl_spi2miso_default &pinctrl_spi2mosi_default &pinctrl_spi2cs0_default>;
};
&mac0 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_rgmii1_default &pinctrl_mdio1_default>;
};

[1] Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt
[2] arch/arm/boot/dts/aspeed-g5.dtsi

Cheers,

Andrew