Skip to contentSkip to conversation

Board file cleanup

PATCH In review Joel Stanley 2 participants 11 messages Nov 3, 2016 – Nov 4, 2016

Subsystems (3)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

cover Board file cleanup

This is the beginning of the end of the board file. Now that we have drivers for most of the functionaltiy of the SoC, we need to start removing the hacks we do in early init.

I have identified a few low risk changes to start off with. If these go well, I will send a second series that perform a more complete cleanup.

Cheers,

Joel

Joel Stanley (4):
arm: aspeed: Remove MDIO hack
arm: aspeed: Remove Palmetto SCU hack
arm: aspeed: Remove setting of SCU90 from common
arm: aspeed: Remove SPI controller hacks

 arch/arm/mach-aspeed/aspeed.c | 21 ---------------------
 1 file changed, 21 deletions(-)
Signature · 1 line
2.9.3
author maintainer
#1 lore raw

PATCH 1/4 arm: aspeed: Remove MDIO hack

The ftgmac100 driver now knows to configure the new MDIO interface. We can remove it from the early init process.

---
 arch/arm/mach-aspeed/aspeed.c | 7 -------
 1 file changed, 7 deletions(-)
arch/arm/mach-aspeed/aspeed.c +0 -7
index 57c32ff0fa83..202bf3d9d467 100644
@@ -146,13 +146,6 @@ static void __init do_garrison_setup(void)
 
 static void __init do_ast2500_common_setup(void)
 {
-	unsigned long reg;
-
-	/* Set old MDIO interface */
-	reg = readl(AST_IO(AST_BASE_MAC0 | 0x40));
-	reg &= ~0x80000000;
-	writel(reg, AST_IO(AST_BASE_MAC0 | 0x40));
-
 	/* Set strap[13:12] to 01, Enable SPI master */
 	/* Set bits in writes to SCU7C are cleared from SCU70 */
 	writel(BIT(13), AST_IO(AST_BASE_SCU | 0x7C));
Signature · 1 line
2.9.3
Reviewed-by on v1 1/4
#2 lore raw

Re: [linux dev-4.7 PATCH 1/4] arm: aspeed: Remove MDIO hack

Quoted 4 lines · Joel Stanley

The ftgmac100 driver now knows to configure the new MDIO interface. We can remove it from the early init process.

Quoted 22 lines

---
 arch/arm/mach-aspeed/aspeed.c | 7 -------

 1 file changed, 7 deletions(-)
arch/arm/mach-aspeed/aspeed.c +0 -0
index 57c32ff0fa83..202bf3d9d467 100644
@@ -146,13 +146,6 @@ static void __init do_garrison_setup(void)


 static void __init do_ast2500_common_setup(void)
 {

arch/arm/mach-aspeed/aspeed.c +0 -7
-	unsigned long reg;
-
-	/* Set old MDIO interface */
-	reg = readl(AST_IO(AST_BASE_MAC0 | 0x40));
-	reg &= ~0x80000000;
-	writel(reg, AST_IO(AST_BASE_MAC0 | 0x40));
-

  /* Set strap[13:12] to 01, Enable SPI master */ /* Set bits in writes to SCU7C are cleared from SCU70 */ writel(BIT(13), AST_IO(AST_BASE_SCU | 0x7C));

author maintainer
#3 lore raw

PATCH 2/4 arm: aspeed: Remove Palmetto SCU hack

In reply to Joel Stanley

The Palmetto would write the following state into the SCU, which is now covered by pinmux:

                         Enable MAC#1 MDIO1: 0x0
                          Enable MAC#1 MDC1: 0x0
                    Enable NOR flash ROMA25: 0x0
                    Enable NOR flash ROMA24: 0x0
                       Enable flash ROMCS4#: 0x0
                       Enable flash ROMCS3#: 0x0
                       Enable flash ROMCS2#: 0x0
                       Enable flash ROMCS1#: 0x1
     Enable NOR flash ACK control input pin: 0x1
           Enable BMC IRQ# interrupt output: 0x1
  Enable BMC IRQ# interrupt output polarity: 0x0
                            Enable Reserved: 0x0
                               Enable VPIR9: 0x0
                               Enable VPIR8: 0x0
                               Enable VPIR7: 0x0
                               Enable VPIR6: 0x0
                               Enable VPIR5: 0x0
                               Enable VPIR4: 0x0
                               Enable VPIR3: 0x0
                               Enable VPIR2: 0x0
                               Enable VPIR1: 0x0
                               Enable VPIR0: 0x0
                               Enable VPIG9: 0x0
                               Enable VPIG8: 0x0
                       Enable PWM7 or VPIG7: 0x0
                       Enable PWM6 or VPIG6: 0x1
                        Enable PWM5 or VPIG: 0x1
                        Enable PWM4 or VPIG: 0x1
                        Enable PWM3 or VPIG: 0x1
                        Enable PWM2 or VPIG: 0x1
                       Enable PWM1 or VPIG1: 0x1
                       Enable PWM0 or VPIG0: 0x1
---
 arch/arm/mach-aspeed/aspeed.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm/mach-aspeed/aspeed.c +0 -3
index 202bf3d9d467..cfbd6d3b3b73 100644
@@ -115,9 +115,6 @@ static void __init do_palmetto_setup(void)
 	/* Setup PNOR address mapping for 32M flash */
 	writel(0x30000E00, AST_IO(AST_BASE_LPC | 0x88));
 	writel(0xFE0001FF, AST_IO(AST_BASE_LPC | 0x8C));
-
-	/* SCU setup */
-	writel(0x01C0007F, AST_IO(AST_BASE_SCU | 0x88));
 }
 
 static void __init do_firestone_setup(void)
Signature · 1 line
2.9.3
Reviewed-by on v1 2/4
#4 lore raw

Re: [linux dev-4.7 PATCH 2/4] arm: aspeed: Remove Palmetto SCU hack

Quoted 36 lines · Joel Stanley

The Palmetto would write the following state into the SCU, which is now covered by pinmux:

                         Enable MAC#1 MDIO1: 0x0
                          Enable MAC#1 MDC1: 0x0
                    Enable NOR flash ROMA25: 0x0
                    Enable NOR flash ROMA24: 0x0
                       Enable flash ROMCS4#: 0x0
                       Enable flash ROMCS3#: 0x0
                       Enable flash ROMCS2#: 0x0
                       Enable flash ROMCS1#: 0x1
     Enable NOR flash ACK control input pin: 0x1
           Enable BMC IRQ# interrupt output: 0x1
  Enable BMC IRQ# interrupt output polarity: 0x0
                            Enable Reserved: 0x0
                               Enable VPIR9: 0x0
                               Enable VPIR8: 0x0
                               Enable VPIR7: 0x0
                               Enable VPIR6: 0x0
                               Enable VPIR5: 0x0
                               Enable VPIR4: 0x0
                               Enable VPIR3: 0x0
                               Enable VPIR2: 0x0
                               Enable VPIR1: 0x0
                               Enable VPIR0: 0x0
                               Enable VPIG9: 0x0
                               Enable VPIG8: 0x0
                       Enable PWM7 or VPIG7: 0x0
                       Enable PWM6 or VPIG6: 0x1
                        Enable PWM5 or VPIG: 0x1
                        Enable PWM4 or VPIG: 0x1
                        Enable PWM3 or VPIG: 0x1
                        Enable PWM2 or VPIG: 0x1
                       Enable PWM1 or VPIG1: 0x1
                       Enable PWM0 or VPIG0: 0x1

Quoted 1 line
Quoted 18 lines

---
 arch/arm/mach-aspeed/aspeed.c | 3 ---

 1 file changed, 3 deletions(-)
arch/arm/mach-aspeed/aspeed.c +0 -3
index 202bf3d9d467..cfbd6d3b3b73 100644
@@ -115,9 +115,6 @@ static void __init do_palmetto_setup(void)
  	/* Setup PNOR address mapping for 32M flash */
  	writel(0x30000E00, AST_IO(AST_BASE_LPC | 0x88));
  	writel(0xFE0001FF, AST_IO(AST_BASE_LPC | 0x8C));
-
-	/* SCU setup */
-	writel(0x01C0007F, AST_IO(AST_BASE_SCU | 0x88));
  }


 static void __init do_firestone_setup(void)

author maintainer
#5 lore raw

PATCH 3/4 arm: aspeed: Remove setting of SCU90 from common

In reply to Joel Stanley

This hack enabled I2C buses 3 to 8 inclusive:

Enable I2C8 function pins: 0x1
Enable I2C7 function pins: 0x1
Enable I2C6 function pins: 0x1
Enable I2C5 function pins: 0x1
Enable I2C4 function pins: 0x1
Enable I2C3 function pins: 0x1

Bit 3 set the USB1.1 Host port 2 function, which is not yet supported in our kernel.

Bits 13 and 15 disabled the RGMII/RMII 1 and 2 RX pin internal pull down which is the default state.

Therefore all functionality is present in the device tree and this can be removed.

---
 arch/arm/mach-aspeed/aspeed.c | 1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-aspeed/aspeed.c +0 -1
index cfbd6d3b3b73..46e711ca275c 100644
@@ -58,7 +58,6 @@ static void __init do_common_setup(void)
 	/* TODO: This should go in the GPIO driver device tree bindings */
 	writel(0x01C000FF, AST_IO(AST_BASE_SCU | 0x88));
 	writel(0xC1C000FF, AST_IO(AST_BASE_SCU | 0x8c));
-	writel(0x003FA008, AST_IO(AST_BASE_SCU | 0x90));
 
 	/* Setup scratch registers */
 	writel(0x00000042, AST_IO(AST_BASE_LPC | 0x170));
Signature · 1 line
2.9.3
Reviewed-by on v1 3/4
#6 lore raw

Re: [linux dev-4.7 PATCH 3/4] arm: aspeed: Remove setting of SCU90 from common

Quoted 12 lines · Joel Stanley

This hack enabled I2C buses 3 to 8 inclusive:

   Enable I2C8 function pins: 0x1
   Enable I2C7 function pins: 0x1
   Enable I2C6 function pins: 0x1
   Enable I2C5 function pins: 0x1
   Enable I2C4 function pins: 0x1
   Enable I2C3 function pins: 0x1

Bit 3 set the USB1.1 Host port 2 function, which is not yet supported in our kernel.

Quoted 7 lines

Bits 13 and 15 disabled the RGMII/RMII 1 and 2 RX pin internal pull down which is the default state.

Therefore all functionality is present in the device tree and this can be removed.

Quoted 16 lines

---
 arch/arm/mach-aspeed/aspeed.c | 1 -

 1 file changed, 1 deletion(-)
arch/arm/mach-aspeed/aspeed.c +0 -1
index cfbd6d3b3b73..46e711ca275c 100644
@@ -58,7 +58,6 @@ static void __init do_common_setup(void)
  	/* TODO: This should go in the GPIO driver device tree bindings */
  	writel(0x01C000FF, AST_IO(AST_BASE_SCU | 0x88));
  	writel(0xC1C000FF, AST_IO(AST_BASE_SCU | 0x8c));
-	writel(0x003FA008, AST_IO(AST_BASE_SCU | 0x90));


  /* Setup scratch registers */ writel(0x00000042, AST_IO(AST_BASE_LPC | 0x170));

author maintainer
#7 lore raw

PATCH 4/4 arm: aspeed: Remove SPI controller hacks

In reply to Joel Stanley

The spi-nor driver aspeed-smc configures these registers now.

---
 arch/arm/mach-aspeed/aspeed.c | 10 ----------
 1 file changed, 10 deletions(-)
arch/arm/mach-aspeed/aspeed.c +0 -10
index 46e711ca275c..f81dccbcd2eb 100644
@@ -42,19 +42,9 @@ static void __init do_common_setup(void)
 	/* Enable LPC FWH cycles, Enable LPC to AHB bridge */
 	writel(0x00000500, AST_IO(AST_BASE_LPC | 0x80));
 
-	/* Flash controller */
-	writel(0x00000003, AST_IO(AST_BASE_SPI | 0x00));
-	writel(0x00002404, AST_IO(AST_BASE_SPI | 0x04));
-
 	/* Set UART routing */
 	writel(0x00000000, AST_IO(AST_BASE_LPC | 0x9c));
 
-	/* SCU setup
-	 *  - GPIOC{4,5,6} are FUNC_MODE{0,1,2}. These nets are
-	 *    connected to the Ethernet phy and to ensure the correct
-	 *    operation they all need to be in GPIO mode (SCU90[0] = 0)
-	 *    and then pulled down
-	 */
 	/* TODO: This should go in the GPIO driver device tree bindings */
 	writel(0x01C000FF, AST_IO(AST_BASE_SCU | 0x88));
 	writel(0xC1C000FF, AST_IO(AST_BASE_SCU | 0x8c));
Signature · 1 line
2.9.3
#8 lore raw

Re: [linux dev-4.7 PATCH 4/4] arm: aspeed: Remove SPI controller hacks

Quoted 22 lines · Joel Stanley

The spi-nor driver aspeed-smc configures these registers now.

---
 arch/arm/mach-aspeed/aspeed.c | 10 ----------

 1 file changed, 10 deletions(-)
arch/arm/mach-aspeed/aspeed.c +0 -0
index 46e711ca275c..f81dccbcd2eb 100644
@@ -42,19 +42,9 @@ static void __init do_common_setup(void)
  	/* Enable LPC FWH cycles, Enable LPC to AHB bridge */
  	writel(0x00000500, AST_IO(AST_BASE_LPC | 0x80));

arch/arm/mach-aspeed/aspeed.c +0 -4
-	/* Flash controller */
-	writel(0x00000003, AST_IO(AST_BASE_SPI | 0x00));
-	writel(0x00002404, AST_IO(AST_BASE_SPI | 0x04));
-

  /* Set UART routing */ writel(0x00000000, AST_IO(AST_BASE_LPC | 0x9c));

arch/arm/mach-aspeed/aspeed.c static void __init do_common_setup(void) · line 57

Quoted 6 lines
arch/arm/mach-aspeed/aspeed.c +0 -6
-	/* SCU setup
-	 *  - GPIOC{4,5,6} are FUNC_MODE{0,1,2}. These nets are
-	 *    connected to the Ethernet phy and to ensure the correct
-	 *    operation they all need to be in GPIO mode (SCU90[0] = 0)
-	 *    and then pulled down
-	 */

Did you intend to remove this? It's still relevant and useful.

Quoted 3 lines

  /* TODO: This should go in the GPIO driver device tree bindings */ writel(0x01C000FF, AST_IO(AST_BASE_SCU | 0x88)); writel(0xC1C000FF, AST_IO(AST_BASE_SCU | 0x8c));

author maintainer
#9 lore raw

Re: [linux dev-4.7 PATCH 4/4] arm: aspeed: Remove SPI controller hacks

Quoted 8 lines · Andrew Jeffery

arch/arm/mach-aspeed/aspeed.c static void __init do_common_setup(void) · line 57

Quoted 6 lines
arch/arm/mach-aspeed/aspeed.c +0 -6
-     /* SCU setup
-      *  - GPIOC{4,5,6} are FUNC_MODE{0,1,2}. These nets are
-      *    connected to the Ethernet phy and to ensure the correct
-      *    operation they all need to be in GPIO mode (SCU90[0] = 0)
-      *    and then pulled down
-      */

Did you intend to remove this? It's still relevant and useful.

Yeah I did.

It's still an accurate description of the hardware. But it's not describing the register writes below. It's in the device tree now.

Cheers,

Joel

Reviewed-by
#10 lore raw

Re: [linux dev-4.7 PATCH 4/4] arm: aspeed: Remove SPI controller hacks

Quoted 9 lines · Joel Stanley
Quoted 8 lines · Andrew Jeffery
Quoted 8 lines

-     /* SCU setup
-      *  - GPIOC{4,5,6} are FUNC_MODE{0,1,2}. These nets are -      *    connected to the Ethernet phy and to ensure the correct -      *    operation they all need to be in GPIO mode (SCU90[0] = 0) -      *    and then pulled down
-      */

Quoted 5 lines
Quoted 1 line

Did you intend to remove this? It's still relevant and useful.

Yeah I did.

It's still an accurate description of the hardware. But it's not describing the register writes below. It's in the device tree now.

Hah, fair point.

In that case:

Quoted 4 lines

Cheers,

Joel