Skip to contentSkip to conversation

ep93xx: register the pwm devices on the edb93xx dev boards

PATCH New H Hartley Sweeten 2 participants 5 messages Jan 5, 2010 – Jan 11, 2010

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

PATCH 1/1 ep93xx: register the pwm devices on the edb93xx dev boards

ep93xx: register the pwm devices on the edb93xx dev boards

Add the platform init code to register the pwm devices that exist on the various edb93xx development boards.

---

arch/arm/mach-ep93xx/edb93xx.c +21 -0
index a4a7be3..cee7e91 100644
@@ -118,12 +118,33 @@ static void __init edb93xx_register_i2c(void)
 	}
 }
 
+
+/*************************************************************************
+ * EDB93xx pwm
+ *************************************************************************/
+static void __init edb93xx_register_pwm(void)
+{
+	if (machine_is_edb9301() ||
+	    machine_is_edb9302() || machine_is_edb9302a()) {
+		/* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
+		ep93xx_register_pwm(0, 1);
+	} if (machine_is_edb9307() || machine_is_edb9307a()) {
+		/* EP9307 only has pwm.0 (PWMOUT) */
+		ep93xx_register_pwm(1, 0);
+	} else {
+		/* EP9312 and EP9315 have both */
+		ep93xx_register_pwm(1, 1);
+	}
+}
+
+
 static void __init edb93xx_init_machine(void)
 {
 	ep93xx_init_devices();
 	edb93xx_register_flash();
 	ep93xx_register_eth(&edb93xx_eth_data, 1);
 	edb93xx_register_i2c();
+	edb93xx_register_pwm();
 }
 
 
#1 lore raw

PATCH 1/1 ep93xx: register the pwm devices on the edb93xx dev boards

Quoted 19 lines · H Hartley Sweeten

ep93xx: register the pwm devices on the edb93xx dev boards

Add the platform init code to register the pwm devices that exist on the various edb93xx development boards.

---

arch/arm/mach-ep93xx/edb93xx.c +1 -0
index a4a7be3..cee7e91 100644
@@ -118,12 +118,33 @@ static void __init edb93xx_register_i2c(void)
 	}
 }
 
+

arch/arm/mach-ep93xx/edb93xx.c static void __init edb93xx_register_i2c(void) · line 131

Quoted 10 lines
arch/arm/mach-ep93xx/edb93xx.c +10 -0
+/*************************************************************************
+ * EDB93xx pwm
+ *************************************************************************/
+static void __init edb93xx_register_pwm(void)
+{
+	if (machine_is_edb9301() ||
+	    machine_is_edb9302() || machine_is_edb9302a()) {
+		/* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
+		ep93xx_register_pwm(0, 1);
+	} if (machine_is_edb9307() || machine_is_edb9307a()) {

else if? Otherwise the else clause below will also occur on 9301, 9302 and 9302a and try to register the pwm's twice.

arch/arm/mach-ep93xx/edb93xx.c static void __init edb93xx_register_i2c(void) · line 138

Quoted 7 lines
arch/arm/mach-ep93xx/edb93xx.c +7 -0
+		/* EP9307 only has pwm.0 (PWMOUT) */
+		ep93xx_register_pwm(1, 0);
+	} else {
+		/* EP9312 and EP9315 have both */
+		ep93xx_register_pwm(1, 1);
+	}
+}

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#2 lore raw

PATCH 1/1 ep93xx: register the pwm devices on the edb93xx dev boards

Quoted 19 lines · Ryan Mallon
Quoted 18 lines · H Hartley Sweeten

ep93xx: register the pwm devices on the edb93xx dev boards

Add the platform init code to register the pwm devices that exist on the various edb93xx development boards.

---

arch/arm/mach-ep93xx/edb93xx.c +0 -0
index a4a7be3..cee7e91 100644
@@ -118,12 +118,33 @@ static void __init edb93xx_register_i2c(void)
 	}
 }
 
Quoted 14 lines

arch/arm/mach-ep93xx/edb93xx.c static void __init edb93xx_register_i2c(void) · line 131

Quoted 11 lines
arch/arm/mach-ep93xx/edb93xx.c +11 -0
+
+/*************************************************************************
+ * EDB93xx pwm
+ *************************************************************************/
+static void __init edb93xx_register_pwm(void)
+{
+	if (machine_is_edb9301() ||
+	    machine_is_edb9302() || machine_is_edb9302a()) {
+		/* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
+		ep93xx_register_pwm(0, 1);
+	} if (machine_is_edb9307() || machine_is_edb9307a()) {

else if? Otherwise the else clause below will also occur on 9301, 9302 and 9302a and try to register the pwm's twice.

Yah, I'm an idiot... Updated patch coming.

Thanks,
Hartley

#3 lore raw

PATCH 1/1 ep93xx: register the pwm devices on the edb93xx dev boards

In reply to Ryan Mallon

ep93xx: register the pwm devices on the edb93xx dev boards

Add the platform init code to register the pwm devices that exist on the various edb93xx development boards.

---

V2 - fix 'if/else if' typo spotted by Ryan Mallon.

arch/arm/mach-ep93xx/edb93xx.c +21 -0
index a4a7be3..d22d67a 100644
@@ -118,12 +118,33 @@ static void __init edb93xx_register_i2c(void)
 	}
 }
 
+
+/*************************************************************************
+ * EDB93xx pwm
+ *************************************************************************/
+static void __init edb93xx_register_pwm(void)
+{
+	if (machine_is_edb9301() ||
+	    machine_is_edb9302() || machine_is_edb9302a()) {
+		/* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
+		ep93xx_register_pwm(0, 1);
+	} else if (machine_is_edb9307() || machine_is_edb9307a()) {
+		/* EP9307 only has pwm.0 (PWMOUT) */
+		ep93xx_register_pwm(1, 0);
+	} else {
+		/* EP9312 and EP9315 have both */
+		ep93xx_register_pwm(1, 1);
+	}
+}
+
+
 static void __init edb93xx_init_machine(void)
 {
 	ep93xx_init_devices();
 	edb93xx_register_flash();
 	ep93xx_register_eth(&edb93xx_eth_data, 1);
 	edb93xx_register_i2c();
+	edb93xx_register_pwm();
 }
 
 
#4 lore raw

PATCH 1/1 ep93xx: register the pwm devices on the edb93xx dev boards

Quoted 40 lines · H Hartley Sweeten

ep93xx: register the pwm devices on the edb93xx dev boards

Add the platform init code to register the pwm devices that exist on the various edb93xx development boards.

---

V2 - fix 'if/else if' typo spotted by Ryan Mallon.

arch/arm/mach-ep93xx/edb93xx.c +20 -0
index a4a7be3..d22d67a 100644
@@ -118,12 +118,33 @@ static void __init edb93xx_register_i2c(void)
 	}
 }
 
+
+/*************************************************************************
+ * EDB93xx pwm
+ *************************************************************************/
+static void __init edb93xx_register_pwm(void)
+{
+	if (machine_is_edb9301() ||
+	    machine_is_edb9302() || machine_is_edb9302a()) {
+		/* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
+		ep93xx_register_pwm(0, 1);
+	} else if (machine_is_edb9307() || machine_is_edb9307a()) {
+		/* EP9307 only has pwm.0 (PWMOUT) */
+		ep93xx_register_pwm(1, 0);
+	} else {
+		/* EP9312 and EP9315 have both */
+		ep93xx_register_pwm(1, 1);
+	}
+}
+
+

arch/arm/mach-ep93xx/edb93xx.c static void __init edb93xx_register_i2c(void) · line 150

Quoted 10 lines
arch/arm/mach-ep93xx/edb93xx.c +1 -0
 static void __init edb93xx_init_machine(void)
 {
 	ep93xx_init_devices();
 	edb93xx_register_flash();
 	ep93xx_register_eth(&edb93xx_eth_data, 1);
 	edb93xx_register_i2c();
+	edb93xx_register_pwm();
 }
 
 

Looks good.

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934