Skip to contentSkip to conversation

IBM Akebono: Add support to AHCI platform driver

PATCH In review Alistair Popple 5 participants 32 messages Nov 5, 2013 – Nov 7, 2013

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

PATCH 1/7 IBM Akebono: Add support to AHCI platform driver

The new IBM Akebono board has an AHCI compliant SATA controller. This patch adds a compatible property for the new board to the AHCI platform driver.

---
 drivers/ata/ahci_platform.c |    1 +
 1 file changed, 1 insertion(+)
drivers/ata/ahci_platform.c +1 -0
index 7d3b853..b20b130 100644
@@ -328,6 +328,7 @@ static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume);
 static const struct of_device_id ahci_of_match[] = {
 	{ .compatible = "snps,spear-ahci", },
 	{ .compatible = "snps,exynos5440-ahci", },
+	{ .compatible = "ibm,akebono-ahci", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, ahci_of_match);
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/7 IBM Akebono: Add a SDHCI platform driver

This patch adds a SDHCI platform driver for the new IBM Akebono board.

---
 drivers/mmc/host/Kconfig            |   12 +++++++
 drivers/mmc/host/Makefile           |    1 +
 drivers/mmc/host/sdhci-of-akebono.c |   60 +++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-of-akebono.c
drivers/mmc/host/Kconfig +12 -0
index 7fc5099..d7a1414 100644
@@ -130,6 +130,18 @@ config MMC_SDHCI_OF_HLWD
 
 	  If unsure, say N.
 
+config MMC_SDHCI_OF_AKEBONO
+	tristate "SDHCI OF support for the IBM Akebono board"
+	depends on MMC_SDHCI_PLTFM
+	depends on PPC_OF
+	help
+	  This selects the Secure Digital Host Controller Interface (SDHCI)
+	  found on the Akebono 476FP SoC.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_CNS3XXX
 	tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
 	depends on ARCH_CNS3XXX
drivers/mmc/host/Makefile +1 -0
index c41d0c3..ea7e757 100644
@@ -59,6 +59,7 @@ obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
+obj-$(CONFIG_MMC_SDHCI_OF_AKEBONO)	+= sdhci-of-akebono.o
 obj-$(CONFIG_MMC_SDHCI_BCM_KONA)	+= sdhci-bcm-kona.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)		+= sdhci-bcm2835.o
 
drivers/mmc/host/sdhci-of-akebono.c new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 3/7 IBM Akebono: Add support for a new PHY to the IBM emac driver

In reply to Alistair Popple

The IBM Akebono board uses a different ethernet PHY that has wake on lan (WOL) support with the IBM emac. This patch adds suppot to the IBM emac driver for this new PHY.

At this stage the wake on lan functionality has not been implemented.

---
 .../devicetree/bindings/powerpc/4xx/emac.txt       |    9 +
 drivers/net/ethernet/ibm/emac/Kconfig              |    4 +
 drivers/net/ethernet/ibm/emac/Makefile             |    1 +
 drivers/net/ethernet/ibm/emac/core.c               |   50 +++-
 drivers/net/ethernet/ibm/emac/core.h               |   12 +
 drivers/net/ethernet/ibm/emac/rgmii_wol.c          |  262 ++++++++++++++++++++
 drivers/net/ethernet/ibm/emac/rgmii_wol.h          |   62 +++++
 7 files changed, 394 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/ethernet/ibm/emac/rgmii_wol.c
 create mode 100644 drivers/net/ethernet/ibm/emac/rgmii_wol.h
Documentation/devicetree/bindings/powerpc/4xx/emac.txt +9 -0
index 712baf6..9928d9d 100644
@@ -61,6 +61,8 @@
 			  Fox Axon: present, whatever value is appropriate for each
 			  EMAC, that is the content of the current (bogus) "phy-port"
 			  property.
+    - rgmii-wol-device  : 1 cell, required iff conntect to a RGMII in the WKUP
+                          power domain. phandle of the RGMII-WOL device node.
 
     Optional properties:
     - phy-address       : 1 cell, optional, MDIO address of the PHY. If absent,
@@ -146,3 +148,10 @@
 			   available.
 			   For Axon: 0x0000012a
 
+      iv) RGMII-WOL node
+
+    Required properties:
+    - compatible         : compatible list, containing 2 entries, first is
+			   "ibm,rgmii-wol-CHIP" where CHIP is the host ASIC (like
+			   EMAC) and the second is "ibm,rgmii-wol".
+    - reg                : <registers mapping>
drivers/net/ethernet/ibm/emac/Kconfig +4 -0
index 3f44a30..7425c27 100644
@@ -55,6 +55,10 @@ config IBM_EMAC_RGMII
 	bool
 	default n
 
+config IBM_EMAC_RGMII_WOL
+	bool
+	default n
+
 config IBM_EMAC_TAH
 	bool
 	default n
drivers/net/ethernet/ibm/emac/Makefile +1 -0
index eba2183..8843803 100644
@@ -7,5 +7,6 @@ obj-$(CONFIG_IBM_EMAC) += ibm_emac.o
 ibm_emac-y := mal.o core.o phy.o
 ibm_emac-$(CONFIG_IBM_EMAC_ZMII) += zmii.o
 ibm_emac-$(CONFIG_IBM_EMAC_RGMII) += rgmii.o
+ibm_emac-$(CONFIG_IBM_EMAC_RGMII_WOL) += rgmii_wol.o
 ibm_emac-$(CONFIG_IBM_EMAC_TAH) += tah.o
 ibm_emac-$(CONFIG_IBM_EMAC_DEBUG) += debug.o
drivers/net/ethernet/ibm/emac/core.c +44 -6

136 lines not on this page · raw message

drivers/net/ethernet/ibm/emac/core.h +12 -0
index 7007479..930a6f6 100644
@@ -43,6 +43,7 @@
 #include "phy.h"
 #include "zmii.h"
 #include "rgmii.h"
+#include "rgmii_wol.h"
 #include "mal.h"
 #include "tah.h"
 #include "debug.h"
@@ -210,6 +211,10 @@ struct emac_instance {
 	u32				rgmii_port;
 	struct platform_device		*rgmii_dev;
 
+	/* RGMII WOL infos if any */
+	u32				rgmii_wol_ph;
+	struct platform_device		*rgmii_wol_dev;
+
 	/* TAH infos if any */
 	u32				tah_ph;
 	u32				tah_port;
@@ -333,6 +338,10 @@ struct emac_instance {
  * APM821xx does not support Half Duplex mode
  */
 #define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
+/*
+ * Set if we have a RGMII with wake on LAN.
+ */
+#define EMAC_FTR_HAS_RGMII_WOL		0x00020000
 
 /* Right now, we don't quite handle the always/possible masks on the
  * most optimal way as we don't have a way to say something like
@@ -356,6 +365,9 @@ enum {
 #ifdef CONFIG_IBM_EMAC_RGMII
 	    EMAC_FTR_HAS_RGMII	|
 #endif
+#ifdef CONFIG_IBM_EMAC_RGMII_WOL
+	    EMAC_FTR_HAS_RGMII_WOL	|
+#endif
 #ifdef CONFIG_IBM_EMAC_NO_FLOW_CTRL
 	    EMAC_FTR_NO_FLOW_CONTROL_40x |
 #endif
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +262 -0

262 lines not on this page · raw message

drivers/net/ethernet/ibm/emac/rgmii_wol.h new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#3 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

On Tue, 2013-11-05 at 16:31 +1100, Alistair Popple wrote:
[...]

drivers/net/ethernet/ibm/emac/Kconfig config IBM_EMAC_RGMII · line 61

Quoted 10 lines
drivers/net/ethernet/ibm/emac/Kconfig +4 -0
@@ -55,6 +55,10 @@ config IBM_EMAC_RGMII
 	bool
 	default n
 
+config IBM_EMAC_RGMII_WOL
+	bool
+	default n
+

[...]

So no-one can even build-test this at present!

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#4 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 8 lines · Ben Hutchings

On Tue, 2013-11-05 at 16:31 +1100, Alistair Popple wrote:
[...]

Quoted 6 lines
drivers/net/ethernet/ibm/emac/Kconfig +0 -0
@@ -55,6 +55,10 @@ config IBM_EMAC_RGMII
 	bool
 	default n
 
Quoted 7 lines

drivers/net/ethernet/ibm/emac/Kconfig config IBM_EMAC_RGMII · line 61

Quoted 4 lines
drivers/net/ethernet/ibm/emac/Kconfig +4 -0
+config IBM_EMAC_RGMII_WOL
+	bool
+	default n
+

[...]

So no-one can even build-test this at present!

Patch 7/7 adds the select to the platform, isn't that sufficient ?

It's an SoC bit so there's little point making it generally selectable by the user.

Alistair: The commit name should be different, it's not a PHY you are adding, it's a PHY interface (the PHY itself is off chip).

Cheers,
Ben.

#5 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 15 lines · Benjamin Herrenschmidt
Quoted 14 lines · Ben Hutchings

On Tue, 2013-11-05 at 16:31 +1100, Alistair Popple wrote:
[...]

Quoted 10 lines
drivers/net/ethernet/ibm/emac/Kconfig +4 -0
@@ -55,6 +55,10 @@ config IBM_EMAC_RGMII
 	bool
 	default n
 
+config IBM_EMAC_RGMII_WOL
+	bool
+	default n
+

[...]

Quoted 3 lines
Quoted 1 line

So no-one can even build-test this at present!

Patch 7/7 adds the select to the platform, isn't that sufficient ?

I suppose so, but I don't think that went to netdev.

Quoted 2 lines

It's an SoC bit so there's little point making it generally selectable by the user.

I think a better way to do this is:

config IBM_EMAC_RGMII_WOL
bool "IBM EMAC RGMII wake-on-LAN support" depends on MY_WONDERFUL_NEW_SOC || COMPILE_TEST default y if MY_WONDERFUL_NEW_SOC

Then anyone making an API change that affects this driver can check that it still complies.

Ben.

Quoted 2 lines

Alistair: The commit name should be different, it's not a PHY you are adding, it's a PHY interface (the PHY itself is off chip).

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#6 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 1 line · On Tue, 5 Nov 2013 23:11:50 Ben Hutchings wrote:

On Wed, 2013-11-06 at 06:54 +1100, Benjamin Herrenschmidt wrote:

[snip]

Quoted 5 lines
Quoted 2 lines

It's an SoC bit so there's little point making it generally selectable by the user.

I think a better way to do this is:

Quoted 7 lines

config IBM_EMAC_RGMII_WOL
bool "IBM EMAC RGMII wake-on-LAN support" depends on MY_WONDERFUL_NEW_SOC || COMPILE_TEST default y if MY_WONDERFUL_NEW_SOC

Then anyone making an API change that affects this driver can check that it still complies.

The method used in this patch is the same as what is currently used by the other IBM EMAC PHY interfaces (eg. config IBM_EMAC_ZMII etc). I'm happy to send a patch to update all of those as well for consistency but that would mean adding what each platform requires into EMACS Kconfig as well.

Personally I think it is nicer to keep the definitions of what each platform requires in one place (ie. arch/powerpc/platforms/44x/Kconfig) as it is consistent with what we do for other 44x drivers, however I am happy to use the above method if people think it's better.

Alternatively we could do something like this:

config IBM_EMAC_RGMII_WOL
bool
default y if COMPILE_TEST
default n

This would leave the platform dependencies as they are currently but still allow compile testing.

Regards,

Alistair

Quoted 4 lines

Ben.

Quoted 2 lines

Alistair: The commit name should be different, it's not a PHY you are adding, it's a PHY interface (the PHY itself is off chip).

#7 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 23 lines · Alistair Popple
Quoted 1 line · On Tue, 5 Nov 2013 23:11:50 Ben Hutchings wrote:

On Wed, 2013-11-06 at 06:54 +1100, Benjamin Herrenschmidt wrote:

[snip]

Quoted 5 lines
Quoted 2 lines

It's an SoC bit so there's little point making it generally selectable by the user.

I think a better way to do this is:

Quoted 7 lines

config IBM_EMAC_RGMII_WOL
bool "IBM EMAC RGMII wake-on-LAN support" depends on MY_WONDERFUL_NEW_SOC || COMPILE_TEST default y if MY_WONDERFUL_NEW_SOC

Then anyone making an API change that affects this driver can check that it still complies.

The method used in this patch is the same as what is currently used by the other IBM EMAC PHY interfaces (eg. config IBM_EMAC_ZMII etc). I'm happy to send a patch to update all of those as well for consistency but that would mean adding what each platform requires into EMACS Kconfig as well.

Quoted 4 lines

Personally I think it is nicer to keep the definitions of what each platform requires in one place (ie. arch/powerpc/platforms/44x/Kconfig) as it is consistent with what we do for other 44x drivers, however I am happy to use the above method if people think it's better.

Yes, I see your point.

Quoted 9 lines

Alternatively we could do something like this:

config IBM_EMAC_RGMII_WOL
bool
default y if COMPILE_TEST
default n

This would leave the platform dependencies as they are currently but still allow compile testing.

It still shouldn't default to y in that case. Instead you can make the symbol conditionally configurable:

config IBM_EMAC_RGMII_WOL
bool "IBM EMAC RGMII wake-on-LAN support" if COMPILE_TEST

and then select this from your platform Kconfig as you intended.

(There is no need to put 'default n' as that's implicit for a configurable symbol. But it doesn't hurt either.)

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#8 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 42 lines · On Wed, 6 Nov 2013 16:40:10 Ben Hutchings wrote:
Quoted 23 lines · Alistair Popple
Quoted 1 line · On Tue, 5 Nov 2013 23:11:50 Ben Hutchings wrote:

On Wed, 2013-11-06 at 06:54 +1100, Benjamin Herrenschmidt wrote:

[snip]

Quoted 5 lines
Quoted 2 lines

It's an SoC bit so there's little point making it generally selectable by the user.

I think a better way to do this is:

Quoted 8 lines

config IBM_EMAC_RGMII_WOL

bool "IBM EMAC RGMII wake-on-LAN support" depends on MY_WONDERFUL_NEW_SOC || COMPILE_TEST default y if MY_WONDERFUL_NEW_SOC

Then anyone making an API change that affects this driver can check that it still complies.

The method used in this patch is the same as what is currently used by the other IBM EMAC PHY interfaces (eg. config IBM_EMAC_ZMII etc). I'm happy to send a patch to update all of those as well for consistency but that would mean adding what each platform requires into EMACS Kconfig as well.

Quoted 4 lines

Personally I think it is nicer to keep the definitions of what each platform requires in one place (ie. arch/powerpc/platforms/44x/Kconfig) as it is consistent with what we do for other 44x drivers, however I am happy to use the above method if people think it's better.

Yes, I see your point.

Quoted 10 lines

Alternatively we could do something like this:

config IBM_EMAC_RGMII_WOL

bool
default y if COMPILE_TEST
default n

This would leave the platform dependencies as they are currently but still allow compile testing.

Quoted 7 lines

It still shouldn't default to y in that case. Instead you can make the symbol conditionally configurable:

config IBM_EMAC_RGMII_WOL
bool "IBM EMAC RGMII wake-on-LAN support" if COMPILE_TEST

and then select this from your platform Kconfig as you intended.

That looks reasonable - I will include it in the next version of the patch series. Thanks.

Quoted 4 lines

(There is no need to put 'default n' as that's implicit for a configurable symbol. But it doesn't hurt either.)

Ben.

Alistair

#9 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

In reply to Alistair Popple

[snip]

Quoted 16 lines
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +16 -0
+/* RGMII bridge supports only GMII/TBI and RGMII/RTBI PHYs */
+static inline int rgmii_valid_mode(int phy_mode)
+{
+       return  phy_mode == PHY_MODE_GMII ||
+               phy_mode == PHY_MODE_MII ||
+               phy_mode == PHY_MODE_RGMII ||
+               phy_mode == PHY_MODE_TBI ||
+               phy_mode == PHY_MODE_RTBI;
+}
+
+static inline const char *rgmii_mode_name(int mode)
+{
+       switch (mode) {
+       case PHY_MODE_RGMII:
+               return "RGMII";
+       case PHY_MODE_TBI:

drivers/net/ethernet/ibm/emac/rgmii_wol.c line 65

Quoted 10 lines
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +10 -0
+               return "TBI";
+       case PHY_MODE_GMII:
+               return "GMII";
+       case PHY_MODE_MII:
+               return "MII";
+       case PHY_MODE_RTBI:
+               return "RTBI";
+       default:
+               BUG();
+       }

Any reasons why you are duplicating what is available in drivers/of/of_net.c ::of_get_phy_mode()?

Signature · 1 line
Florian
#10 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 23 lines · On Tue, 5 Nov 2013 10:47:22 Florian Fainelli wrote:

[snip]

Quoted 21 lines
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +21 -0
+/* RGMII bridge supports only GMII/TBI and RGMII/RTBI PHYs */
+static inline int rgmii_valid_mode(int phy_mode)
+{
+       return  phy_mode == PHY_MODE_GMII ||
+               phy_mode == PHY_MODE_MII ||
+               phy_mode == PHY_MODE_RGMII ||
+               phy_mode == PHY_MODE_TBI ||
+               phy_mode == PHY_MODE_RTBI;
+}
+
+static inline const char *rgmii_mode_name(int mode)
+{
+       switch (mode) {
+       case PHY_MODE_RGMII:
+               return "RGMII";
+       case PHY_MODE_TBI:
+               return "TBI";
+       case PHY_MODE_GMII:
+               return "GMII";
+       case PHY_MODE_MII:
+               return "MII";
Quoted 8 lines

drivers/net/ethernet/ibm/emac/rgmii_wol.c line 65

Quoted 5 lines
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +5 -0
+       case PHY_MODE_RTBI:
+               return "RTBI";
+       default:
+               BUG();
+       }

Any reasons why you are duplicating what is available in drivers/of/of_net.c ::of_get_phy_mode()?

Unless I'm missing something of_get_phy_mode() is going the other way. rgmii_mode_name() is converting PHY_MODE_* into a human-readable string. I couldn't find any obvious kernel method to do this but maybe I missed it?

Regards,

Alistair

#11 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

2013/11/5 Alistair Popple <[email protected]>:

Quoted 33 lines · On Tue, 5 Nov 2013 10:47:22 Florian Fainelli wrote:
Quoted 23 lines

[snip]

Quoted 21 lines
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +21 -0
+/* RGMII bridge supports only GMII/TBI and RGMII/RTBI PHYs */
+static inline int rgmii_valid_mode(int phy_mode)
+{
+       return  phy_mode == PHY_MODE_GMII ||
+               phy_mode == PHY_MODE_MII ||
+               phy_mode == PHY_MODE_RGMII ||
+               phy_mode == PHY_MODE_TBI ||
+               phy_mode == PHY_MODE_RTBI;
+}
+
+static inline const char *rgmii_mode_name(int mode)
+{
+       switch (mode) {
+       case PHY_MODE_RGMII:
+               return "RGMII";
+       case PHY_MODE_TBI:
+               return "TBI";
+       case PHY_MODE_GMII:
+               return "GMII";
+       case PHY_MODE_MII:
+               return "MII";
Quoted 8 lines

drivers/net/ethernet/ibm/emac/rgmii_wol.c line 65

Quoted 5 lines
drivers/net/ethernet/ibm/emac/rgmii_wol.c new file +5 -0
+       case PHY_MODE_RTBI:
+               return "RTBI";
+       default:
+               BUG();
+       }

Any reasons why you are duplicating what is available in drivers/of/of_net.c ::of_get_phy_mode()?

Quoted 3 lines

Unless I'm missing something of_get_phy_mode() is going the other way. rgmii_mode_name() is converting PHY_MODE_* into a human-readable string. I couldn't find any obvious kernel method to do this but maybe I missed it?

Right, rgmii_mode_name() just has informative purposes and should be removed, I would suggest using standard device tree bindings property (phy-mode) anyway such that you could use of_get_phy_mode() and use phy_interface_t types.

Signature · 1 line
Florian
#12 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

On Tue, 5 Nov 2013 16:16:08 Florian Fainelli wrote:

[snip]

Quoted 4 lines

2013/11/5 Alistair Popple <[email protected]>:

Quoted 3 lines
Quoted 2 lines

Any reasons why you are duplicating what is available in drivers/of/of_net.c ::of_get_phy_mode()?

Quoted 8 lines
Quoted 3 lines

Unless I'm missing something of_get_phy_mode() is going the other way. rgmii_mode_name() is converting PHY_MODE_* into a human-readable string. I couldn't find any obvious kernel method to do this but maybe I missed it?

Right, rgmii_mode_name() just has informative purposes and should be removed, I would suggest using standard device tree bindings property (phy-mode) anyway such that you could use of_get_phy_mode() and use phy_interface_t types.

Ok, that's what is currently done in the core IBM EMAC driver. As this is used just for informative purposes I will remove it. Thanks.

Regards,

Alistair

#13 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

Quoted 9 lines · Alistair Popple
Quoted 2 lines

Right, rgmii_mode_name() just has informative purposes and should be removed, I would suggest using standard device tree bindings

property

Quoted 2 lines

(phy-mode) anyway such that you could use of_get_phy_mode() and use phy_interface_t types.

Ok, that's what is currently done in the core IBM EMAC driver. As this is used
just for informative purposes I will remove it. Thanks.

Why ? Information is useful...

Ben.

#14 lore raw

Re: [PATCH 3/7] IBM Akebono: Add support for a new PHY to the IBM emac driver

2013/11/5 Benjamin Herrenschmidt <[email protected]>:

Quoted 12 lines · Alistair Popple
Quoted 9 lines
Quoted 2 lines

Right, rgmii_mode_name() just has informative purposes and should be removed, I would suggest using standard device tree bindings

property

Quoted 2 lines

(phy-mode) anyway such that you could use of_get_phy_mode() and use phy_interface_t types.

Ok, that's what is currently done in the core IBM EMAC driver. As this is used
just for informative purposes I will remove it. Thanks.

Why ? Information is useful...

Not the way they are currently handled:

+ /* Check if we need to attach to a RGMII */
+ if (!rgmii_valid_mode(mode)) {
+ dev_err(&ofdev->dev, "unsupported settings !\n");

Considering that nothing useful is being printed, that or nothing at all really looks identical to me.
--
Florian

#15 lore raw

PATCH 4/7 IBM Akebono: Add support to the OHCI platform driver for Akebono

In reply to Alistair Popple

The IBM Akebono board has a OHCI compliant USB host interface. This patch adds support for it to the OHCI platform driver.

As we use device tree to pass platform specific data instead of platform data we remove the check for platform data and instead provide reasonable defaults if no platform data is present. This is similar to what is currently done in ehci-platform.c.

---
 drivers/usb/host/ohci-platform.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/usb/host/ohci-platform.c +15 -5
index a4c6410..4331454 100644
@@ -23,6 +23,8 @@
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
+#include <linux/slab.h>
+#include <linux/of.h>
 
 #include "ohci.h"
 
@@ -55,6 +57,8 @@ static const struct ohci_driver_overrides platform_overrides __initconst = {
 	.reset =	ohci_platform_reset,
 };
 
+static struct usb_ohci_pdata ohci_platform_defaults;
+
 static int ohci_platform_probe(struct platform_device *dev)
 {
 	struct usb_hcd *hcd;
@@ -63,14 +67,14 @@ static int ohci_platform_probe(struct platform_device *dev)
 	int irq;
 	int err = -ENOMEM;
 
-	if (!pdata) {
-		WARN_ON(1);
-		return -ENODEV;
-	}
-
 	if (usb_disabled())
 		return -ENODEV;
 
+	/* Platforms using DT don't always provide platform data.
+	 * This should provide reasonable defaults. */
+	if (!pdata)
+		dev->dev.platform_data = pdata = &ohci_platform_defaults;
+
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 		dev_err(&dev->dev, "no irq provided");
@@ -171,6 +175,11 @@ static int ohci_platform_resume(struct device *dev)
 #define ohci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id ohci_of_match[] = {
+	{ .compatible = "ibm,akebono-ohci", },
+	{},
+};
+
 static const struct platform_device_id ohci_platform_table[] = {
 	{ "ohci-platform", 0 },
 	{ }
@@ -191,6 +200,7 @@ static struct platform_driver ohci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ohci-platform",
 		.pm	= &ohci_platform_pm_ops,
+		.of_match_table = ohci_of_match,
 	}
 };
 
Signature · 1 line
1.7.10.4
maintainer Acked-by on v1 4/7
#16 lore raw

Re: [PATCH 4/7] IBM Akebono: Add support to the OHCI platform driver for Akebono

Quoted 41 lines · Alistair Popple

The IBM Akebono board has a OHCI compliant USB host interface. This patch adds support for it to the OHCI platform driver.

As we use device tree to pass platform specific data instead of platform data we remove the check for platform data and instead provide reasonable defaults if no platform data is present. This is similar to what is currently done in ehci-platform.c.

---
 drivers/usb/host/ohci-platform.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/usb/host/ohci-platform.c +4 -0
index a4c6410..4331454 100644
@@ -23,6 +23,8 @@
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
+#include <linux/slab.h>
+#include <linux/of.h>
 
 #include "ohci.h"
 
@@ -55,6 +57,8 @@ static const struct ohci_driver_overrides platform_overrides __initconst = {
 	.reset =	ohci_platform_reset,
 };
 
+static struct usb_ohci_pdata ohci_platform_defaults;
+
 static int ohci_platform_probe(struct platform_device *dev)
 {
 	struct usb_hcd *hcd;
@@ -63,14 +67,14 @@ static int ohci_platform_probe(struct platform_device *dev)
 	int irq;
 	int err = -ENOMEM;
 

drivers/usb/host/ohci-platform.c static int ohci_platform_probe(struct platform_device *dev) · line 74

Quoted 10 lines
drivers/usb/host/ohci-platform.c +2 -5
-	if (!pdata) {
-		WARN_ON(1);
-		return -ENODEV;
-	}
-
 	if (usb_disabled())
 		return -ENODEV;
 
+	/* Platforms using DT don't always provide platform data.
+	 * This should provide reasonable defaults. */
	/*
	 * The accepted format for multi-line
	 * comments is like this.
	 */
Quoted 19 lines
drivers/usb/host/ohci-platform.c +8 -0
+	if (!pdata)
+		dev->dev.platform_data = pdata = &ohci_platform_defaults;
+
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 		dev_err(&dev->dev, "no irq provided");
@@ -171,6 +175,11 @@ static int ohci_platform_resume(struct device *dev)
 #define ohci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id ohci_of_match[] = {
+	{ .compatible = "ibm,akebono-ohci", },
+	{},
+};
+
 static const struct platform_device_id ohci_platform_table[] = {
 	{ "ohci-platform", 0 },
 	{ }

drivers/usb/host/ohci-platform.c static struct platform_driver ohci_platform_driver = { · line 205

Quoted 6 lines
drivers/usb/host/ohci-platform.c +1 -0
@@ -191,6 +200,7 @@ static struct platform_driver ohci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ohci-platform",
 		.pm	= &ohci_platform_pm_ops,
+		.of_match_table = ohci_of_match,
 	}
 };

Update the comment formatting, and then you can resubmit with

#17 lore raw

Re: [PATCH 4/7] IBM Akebono: Add support to the OHCI platform driver for Akebono

On Tue, 5 Nov 2013 10:04:02 Alan Stern wrote:

[snip]

Quoted 9 lines

drivers/usb/host/ohci-platform.c static int ohci_platform_probe(struct platform_device *dev) · line 74

Quoted 3 lines
drivers/usb/host/ohci-platform.c +2 -0
+	/* Platforms using DT don't always provide platform data.
+	 * This should provide reasonable defaults. */
	/*
	 * The accepted format for multi-line
	 * comments is like this.
	 */

Ok, I'll fix that for the next revision.

Quoted 33 lines
Quoted 33 lines
drivers/usb/host/ohci-platform.c +8 -0
+	if (!pdata)
+		dev->dev.platform_data = pdata = &ohci_platform_defaults;
+
 
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 
 		dev_err(&dev->dev, "no irq provided");
@@ -171,6 +175,11 @@ static int ohci_platform_resume(struct device *dev)
 
 #define ohci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id ohci_of_match[] = {
+	{ .compatible = "ibm,akebono-ohci", },
+	{},
+};
+
 
 static const struct platform_device_id ohci_platform_table[] = {
drivers/usb/host/ohci-platform.c +1 -0
 	{ "ohci-platform", 0 },
 	{ }
@@ -191,6 +200,7 @@ static struct platform_driver ohci_platform_driver = {
 
 		.owner	= THIS_MODULE,
 		.name	= "ohci-platform",
 		.pm	= &ohci_platform_pm_ops,
 
+		.of_match_table = ohci_of_match,
 
Quoted 7 lines
Quoted 3 lines

}

};

Update the comment formatting, and then you can resubmit with

Thanks. Based on the discussion for the EHCI driver I would like to change the compatibility string to "usb-ochi" (instead of "ibm,akebono-ohci"). Are you still happy for me to add the Acked-by with the alternate compatibility (and of course the formatting fix)? No other drivers currently use "usb-ochi" so it shouldn't require any merging of drivers.

Regards,

Alistair

#18 lore raw

Re: [PATCH 4/7] IBM Akebono: Add support to the OHCI platform driver for Akebono

Quoted 5 lines · Alistair Popple

Thanks. Based on the discussion for the EHCI driver I would like to change the compatibility string to "usb-ochi" (instead of "ibm,akebono-ohci"). Are you still happy for me to add the Acked-by with the alternate compatibility (and of course the formatting fix)? No other drivers currently use "usb-ochi" so it shouldn't require any merging of drivers.

	s/ochi/ohci/ :-)

Cheers,
Ben.

maintainer
#19 lore raw

Re: [PATCH 4/7] IBM Akebono: Add support to the OHCI platform driver for Akebono

In reply to Alistair Popple
Quoted 5 lines · Alistair Popple

Thanks. Based on the discussion for the EHCI driver I would like to change the compatibility string to "usb-ochi" (instead of "ibm,akebono-ohci"). Are you still happy for me to add the Acked-by with the alternate compatibility (and of course the formatting fix)? No other drivers currently use "usb-ochi" so it shouldn't require any merging of drivers.

Yes, go ahead (as long as you use the right spelling, as Ben pointed out).

Alan Stern

#20 lore raw

PATCH 5/7 IBM Akebono: Add support to the EHCI platform driver for Akebono

In reply to Alistair Popple

The IBM Akebono board has an EHCI compliant USB host interface. This patch adds support for it to the EHCI platform driver.

---
 drivers/usb/host/ehci-platform.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-platform.c +3 -2
index f6b790c..0a67616 100644
@@ -203,9 +203,10 @@ static int ehci_platform_resume(struct device *dev)
 #define ehci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
-static const struct of_device_id vt8500_ehci_ids[] = {
+static const struct of_device_id ehci_platform_ids[] = {
 	{ .compatible = "via,vt8500-ehci", },
 	{ .compatible = "wm,prizm-ehci", },
+	{ .compatible = "ibm,akebono-ehci", },
 	{}
 };
 
@@ -229,7 +230,7 @@ static struct platform_driver ehci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ehci-platform",
 		.pm	= &ehci_platform_pm_ops,
-		.of_match_table = vt8500_ehci_ids,
+		.of_match_table = ehci_platform_ids,
 	}
 };
 
Signature · 1 line
1.7.10.4
maintainer Acked-by on v1 5/7
#21 lore raw

Re: [PATCH 5/7] IBM Akebono: Add support to the EHCI platform driver for Akebono

Quoted 27 lines · Alistair Popple

The IBM Akebono board has an EHCI compliant USB host interface. This patch adds support for it to the EHCI platform driver.

---
 drivers/usb/host/ehci-platform.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-platform.c +2 -1
index f6b790c..0a67616 100644
@@ -203,9 +203,10 @@ static int ehci_platform_resume(struct device *dev)
 #define ehci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
-static const struct of_device_id vt8500_ehci_ids[] = {
+static const struct of_device_id ehci_platform_ids[] = {
 	{ .compatible = "via,vt8500-ehci", },
 	{ .compatible = "wm,prizm-ehci", },
+	{ .compatible = "ibm,akebono-ehci", },
 	{}
 };
 

drivers/usb/host/ehci-platform.c static struct platform_driver ehci_platform_driver = { · line 235

Quoted 7 lines
drivers/usb/host/ehci-platform.c +1 -1
@@ -229,7 +230,7 @@ static struct platform_driver ehci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ehci-platform",
 		.pm	= &ehci_platform_pm_ops,
-		.of_match_table = vt8500_ehci_ids,
+		.of_match_table = ehci_platform_ids,
 	}
 };
#22 lore raw

Re: [PATCH 5/7] IBM Akebono: Add support to the EHCI platform driver for Akebono

Quoted 20 lines · Alan Stern
Quoted 18 lines · Alistair Popple

The IBM Akebono board has an EHCI compliant USB host interface. This patch adds support for it to the EHCI platform driver.

---
 drivers/usb/host/ehci-platform.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-platform.c +0 -0
index f6b790c..0a67616 100644
@@ -203,9 +203,10 @@ static int ehci_platform_resume(struct device *dev)
 #define ehci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
Quoted 7 lines

drivers/usb/host/ehci-platform.c static int ehci_platform_resume(struct device *dev) · line 211

Quoted 7 lines
drivers/usb/host/ehci-platform.c +2 -1
-static const struct of_device_id vt8500_ehci_ids[] = {
+static const struct of_device_id ehci_platform_ids[] = {
 	{ .compatible = "via,vt8500-ehci", },
 	{ .compatible = "wm,prizm-ehci", },
+	{ .compatible = "ibm,akebono-ehci", },
 	{}
 };

Why ? Do we need to add an entry for every platform in there ? Besides, it probably should be the SoC name not the platform here....

Why not simply a generic compatible "usb-ehci" ? It's a standard programming interface, there are no specific quirks, we shouldn't need to have to add new entries to the driver like that for every new SoC/platform.

Quoted 15 lines

drivers/usb/host/ehci-platform.c static struct platform_driver ehci_platform_driver = { · line 235

Quoted 8 lines
drivers/usb/host/ehci-platform.c +1 -1
@@ -229,7 +230,7 @@ static struct platform_driver ehci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ehci-platform",
 		.pm	= &ehci_platform_pm_ops,
-		.of_match_table = vt8500_ehci_ids,
+		.of_match_table = ehci_platform_ids,
 	}
 };

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#23 lore raw

Re: [PATCH 5/7] IBM Akebono: Add support to the EHCI platform driver for Akebono

On Wed, 6 Nov 2013 06:52:13 Benjamin Herrenschmidt wrote:

[snip]

Quoted 9 lines

Why ? Do we need to add an entry for every platform in there ? Besides, it probably should be the SoC name not the platform here....

Why not simply a generic compatible "usb-ehci" ? It's a standard programming interface, there are no specific quirks, we shouldn't need to have to add new entries to the driver like that for every new SoC/platform.

Actually a grep of "usb-ehci" turns up the ehci-ppc-of driver which I somehow missed. This driver works and uses .compatible = "usb-ehci" so I can use that instead if that is preferable?

However it is basically the same as the ehci-platform driver so I guess at some point the two should be merged...

Quoted 20 lines
Quoted 20 lines
Quoted 10 lines
drivers/usb/host/ehci-platform.c +1 -1
@@ -229,7 +230,7 @@ static struct platform_driver ehci_platform_driver =
 {
 
 		.owner	= THIS_MODULE,
 		.name	= "ehci-platform",
 		.pm	= &ehci_platform_pm_ops,
 
-		.of_match_table = vt8500_ehci_ids,
+		.of_match_table = ehci_platform_ids,
Quoted 3 lines

}

};

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#24 lore raw

Re: [PATCH 5/7] IBM Akebono: Add support to the EHCI platform driver for Akebono

Quoted 6 lines · Alistair Popple

Actually a grep of "usb-ehci" turns up the ehci-ppc-of driver which I somehow missed. This driver works and uses .compatible = "usb-ehci" so I can use that instead if that is preferable?

However it is basically the same as the ehci-platform driver so I guess at some point the two should be merged...

I think the split predates the grand unification of "of" driver and platform, so yes they should.

Cheers,
Ben.

#25 lore raw

RFC PATCH 1/1 ehci-platform: Merge ppc-of EHCI driver into the ehci-platform driver

Currently the ppc-of driver uses the compatibility string "usb-ehci". This means platforms that use device-tree and implement an EHCI compatible interface have to either use the ppc-of driver or add a compatible line to the ehci-platform driver. It would be more appropriate for the platform driver to be compatible with "usb-ehci" as non-powerpc platforms are also beginning to utilise device-tree.

This patch merges the device tree property parsing from ehci-ppc-of into the platform driver and adds a "usb-ehci" compatibility string. The existing ehci-ppc-of driver is renamed to ehci-440epx as it contains platform specific work arounds for the 440EPX SoC.

---

So I could submit something like this that essentially merges the ppc-of driver into the platform driver instead of adding the "ibm,akebono-ehci" compatible line to the platform driver.

However I'm still fairly new to device-tree so I'm not sure what (if any) the broader impact would be. A quick grep for "usb-ehci" turned up a couple of ARM device tree's using it however they all provided their own drivers and don't select CONFIG_USB_EHCI_HCD_PLATFORM so I'm guess they shouldn't be impacted.

I have attempted to fix up any PowerPC device trees/configs, although I wasn't sure if "usb-ehci" should remain in sequoia.dts or not given that it needs to use the 440EPX specific driver.

Also this hasn't been tested (beyond compilation) yet.

 arch/powerpc/boot/dts/sequoia.dts              |    2 +-
 arch/powerpc/configs/44x/canyonlands_defconfig |    1 +
 drivers/usb/host/Kconfig                       |    8 +-
 drivers/usb/host/ehci-440epx.c                 |  236 
++++++++++++++++++++++++
 drivers/usb/host/ehci-hcd.c                    |    6 +-
 drivers/usb/host/ehci-platform.c               |   18 +-
 drivers/usb/host/ehci-ppc-of.c                 |  236 
------------------------
 7 files changed, 261 insertions(+), 246 deletions(-)
 create mode 100644 drivers/usb/host/ehci-440epx.c
 delete mode 100644 drivers/usb/host/ehci-ppc-of.c
(quoted diff) +0 -0

b/arch/powerpc/boot/dts/sequoia.dts
index b1d3292..e28371e 100644

arch/powerpc/boot/dts/sequoia.dts +1 -1
@@ -153,7 +153,7 @@
 		};
 
 		USB0: ehci@e0000300 {
-			compatible = "ibm,usb-ehci-440epx", "usb-ehci";
+			compatible = "ibm,usb-ehci-440epx";
 			interrupt-parent = <&UIC0>;
 			interrupts = <0x1a 0x4>;
 			reg = <0x00000000 0xe0000300 0x00000090 0x00000000 

0xe0000390 0x00000070>;

(quoted diff) +0 -0

b/arch/powerpc/configs/44x/canyonlands_defconfig
index d5be93e..16dc37f 100644

arch/powerpc/configs/44x/canyonlands_defconfig +1 -0
@@ -75,6 +75,7 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 CONFIG_USB_DEVICEFS=y
 CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=m
+CONFIG_USB_EHCI_HCD_PLATFORM=m
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
drivers/usb/host/Kconfig +4 -4
index b3f20d7..b8d7c24 100644
@@ -188,13 +188,13 @@ config USB_EHCI_TEGRA
          This driver enables support for the internal USB Host Controllers
          found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
 
-config USB_EHCI_HCD_PPC_OF
-	bool "EHCI support for PPC USB controller on OF platform bus"
-	depends on PPC_OF
+config USB_EHCI_HCD_440EPX
+	bool "EHCI support for PPC USB controller on 440EPX"
+	depends on PPC_OF && 440EPX
 	default y
 	---help---
 	  Enables support for the USB controller present on the PowerPC
-	  OpenFirmware platform bus.
+	  440EPX SoC.
 
 config USB_EHCI_SH
 	bool "EHCI support for SuperH USB controller"
drivers/usb/host/ehci-440epx.c new file +236 -0

236 lines not on this page · raw message

drivers/usb/host/ehci-hcd.c +3 -3
index 86ab9fd..3b04f25 100644
@@ -1228,9 +1228,9 @@ MODULE_LICENSE ("GPL");
 #define	PS3_SYSTEM_BUS_DRIVER	ps3_ehci_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
-#include "ehci-ppc-of.c"
-#define OF_PLATFORM_DRIVER	ehci_hcd_ppc_of_driver
+#ifdef CONFIG_USB_EHCI_HCD_440EPX
+#include "ehci-440epx.c"
+#define OF_PLATFORM_DRIVER	ehci_hcd_440epx_driver
 #endif
 
 #ifdef CONFIG_XPS_USB_HCD_XILINX
drivers/usb/host/ehci- renamed from drivers/usb/host/ehci-platform.c +0 -0

platform.c
index f6b790c..027f368 100644

drivers/usb/host/ehci-platform.c +16 -2
@@ -77,6 +77,7 @@ static int ehci_platform_probe(struct platform_device *dev)
 	struct usb_hcd *hcd;
 	struct resource *res_mem;
 	struct usb_ehci_pdata *pdata;
+	struct device_node *dn = dev->dev.of_node;
 	int irq;
 	int err = -ENOMEM;
 
@@ -96,6 +97,18 @@ static int ehci_platform_probe(struct platform_device *dev)
 
 	pdata = dev_get_platdata(&dev->dev);
 
+	/* Initialise platform data from device tree if available. */
+	if (!dn) {
+		if (of_get_property(dn, "big-endian", NULL)) {
+			pdata->big_endian_mmio = 1;
+			pdata->big_endian_desc = 1;
+		}
+		if (of_get_property(dn, "big-endian-regs", NULL))
+			pdata->big_endian_mmio = 1;
+		if (of_get_property(dn, "big-endian-desc", NULL))
+			pdata->big_endian_desc = 1;
+	}
+
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 		dev_err(&dev->dev, "no irq provided");
@@ -203,9 +216,10 @@ static int ehci_platform_resume(struct device *dev)
 #define ehci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
-static const struct of_device_id vt8500_ehci_ids[] = {
+static const struct of_device_id ehci_platform_ids[] = {
 	{ .compatible = "via,vt8500-ehci", },
 	{ .compatible = "wm,prizm-ehci", },
+	{ .compatible = "usb-ehci", },
 	{}
 };
 
@@ -229,7 +243,7 @@ static struct platform_driver ehci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ehci-platform",
 		.pm	= &ehci_platform_pm_ops,
-		.of_match_table = vt8500_ehci_ids,
+		.of_match_table = ehci_platform_ids,
 	}
 };
 
drivers/usb/host/ehci-ppc-of.c deleted +0 -236

236 lines not on this page · raw message

Signature · 1 line
1.7.10.4
maintainer
#26 lore raw

Re: [RFC PATCH] ehci-platform: Merge ppc-of EHCI driver into the ehci-platform driver

Quoted 44 lines · Alistair Popple

Currently the ppc-of driver uses the compatibility string "usb-ehci". This means platforms that use device-tree and implement an EHCI compatible interface have to either use the ppc-of driver or add a compatible line to the ehci-platform driver. It would be more appropriate for the platform driver to be compatible with "usb-ehci" as non-powerpc platforms are also beginning to utilise device-tree.

This patch merges the device tree property parsing from ehci-ppc-of into the platform driver and adds a "usb-ehci" compatibility string. The existing ehci-ppc-of driver is renamed to ehci-440epx as it contains platform specific work arounds for the 440EPX SoC.

---

So I could submit something like this that essentially merges the ppc-of driver into the platform driver instead of adding the "ibm,akebono-ehci" compatible line to the platform driver.

However I'm still fairly new to device-tree so I'm not sure what (if any) the broader impact would be. A quick grep for "usb-ehci" turned up a couple of ARM device tree's using it however they all provided their own drivers and don't select CONFIG_USB_EHCI_HCD_PLATFORM so I'm guess they shouldn't be impacted.

I have attempted to fix up any PowerPC device trees/configs, although I wasn't sure if "usb-ehci" should remain in sequoia.dts or not given that it needs to use the 440EPX specific driver.

Also this hasn't been tested (beyond compilation) yet.

drivers/usb/host/ehci- renamed from drivers/usb/host/ehci-platform.c +0 -0

platform.c
index f6b790c..027f368 100644

drivers/usb/host/ehci-platform.c +1 -0
@@ -77,6 +77,7 @@ static int ehci_platform_probe(struct platform_device *dev)
 	struct usb_hcd *hcd;
 	struct resource *res_mem;
 	struct usb_ehci_pdata *pdata;
+	struct device_node *dn = dev->dev.of_node;
 	int irq;
 	int err = -ENOMEM;
 

drivers/usb/host/ehci-platform.c static int ehci_platform_probe(struct platform_device *dev) · line 101

Quoted 5 lines
drivers/usb/host/ehci-platform.c +2 -0
@@ -96,6 +97,18 @@ static int ehci_platform_probe(struct platform_device *dev)
 
 	pdata = dev_get_platdata(&dev->dev);
 
+	/* Initialise platform data from device tree if available. */
+	if (!dn) {

Shouldn't this be "if (dn)"?

drivers/usb/host/ehci-platform.c static int ehci_platform_probe(struct platform_device *dev) · line 111

Quoted 10 lines
drivers/usb/host/ehci-platform.c +10 -0
+		if (of_get_property(dn, "big-endian", NULL)) {
+			pdata->big_endian_mmio = 1;
+			pdata->big_endian_desc = 1;
+		}
+		if (of_get_property(dn, "big-endian-regs", NULL))
+			pdata->big_endian_mmio = 1;
+		if (of_get_property(dn, "big-endian-desc", NULL))
+			pdata->big_endian_desc = 1;
+	}
+

This isn't good if there is more than one EHCI controller using ehci-platform. To accomodate such cases, it would be necessary to allocate a separate copy of ehci_platform_defaults for each controller.

Alan Stern

#27 lore raw

Re: [RFC PATCH] ehci-platform: Merge ppc-of EHCI driver into the ehci-platform driver

Quoted 1 line · On Wed, 6 Nov 2013 11:14:44 Alan Stern wrote:

On Wed, 6 Nov 2013, Alistair Popple wrote:

[snip]

Quoted 4 lines

drivers/usb/host/ehci-platform.c static int ehci_platform_probe(struct platform_device *dev) · line 101

Quoted 2 lines
drivers/usb/host/ehci-platform.c +2 -0
+	/* Initialise platform data from device tree if available. */
+	if (!dn) {

Shouldn't this be "if (dn)"?

Yep. Thanks.

Quoted 6 lines
Quoted 6 lines
drivers/usb/host/ehci-platform.c +6 -0
+		if (of_get_property(dn, "big-endian", NULL)) {
+			pdata->big_endian_mmio = 1;
+			pdata->big_endian_desc = 1;
+		}
+		if (of_get_property(dn, "big-endian-regs", NULL))
+			pdata->big_endian_mmio = 1;
Quoted 8 lines

drivers/usb/host/ehci-platform.c static int ehci_platform_probe(struct platform_device *dev) · line 111

Quoted 4 lines
drivers/usb/host/ehci-platform.c +4 -0
+		if (of_get_property(dn, "big-endian-desc", NULL))
+			pdata->big_endian_desc = 1;
+	}
+

This isn't good if there is more than one EHCI controller using ehci-platform. To accomodate such cases, it would be necessary to allocate a separate copy of ehci_platform_defaults for each controller.

OK, that's a problem. Rather than allocating platform data for each controller I will move the device tree parsing into ehci_platform_reset().

Quoted 1 line

Alan Stern

#28 lore raw

Re: [RFC PATCH] ehci-platform: Merge ppc-of EHCI driver into the ehci-platform driver

In reply to Alistair Popple

arch/powerpc/boot/dts/sequoia.dts line 156

Quoted 11 lines · Alistair Popple
arch/powerpc/boot/dts/sequoia.dts +1 -1
index b1d3292..e28371e 100644
@@ -153,7 +153,7 @@
 		};
 
 		USB0: ehci@e0000300 {
-			compatible = "ibm,usb-ehci-440epx", "usb-ehci";
+			compatible = "ibm,usb-ehci-440epx";

Compatible properties are string lists so it *should* be ok to have all of them in the list. However I do remember Russell mentioning a problem with the current matching code so adding him on CC for comments.

Quoted 10 lines
arch/powerpc/boot/dts/sequoia.dts +10 -0
+/*
+ * 440EPx Errata USBH_3
+ * Fix: Enable Break Memory Transfer (BMT) in INSNREG3
+ */
+#define PPC440EPX_EHCI0_INSREG_BMT	(0x1 << 0)
+static int
+ppc44x_enable_bmt(struct device_node *dn)
+{
+	__iomem u32 *insreg_virt;
+

arch/powerpc/boot/dts/sequoia.dts

Quoted 10 lines
arch/powerpc/boot/dts/sequoia.dts +10 -0
+	insreg_virt = of_iomap(dn, 1);
+	if (!insreg_virt)
+		return  -EINVAL;
+
+	out_be32(insreg_virt + 3, PPC440EPX_EHCI0_INSREG_BMT);
+
+	iounmap(insreg_virt);
+	return 0;
+}
+

I would go even further and add the 44x workarounds to the normal platform device, with a compatible check in there. That isn't the first time we add quirks to an existing driver.

arch/powerpc/boot/dts/sequoia.dts

Quoted 2 lines
arch/powerpc/boot/dts/sequoia.dts +2 -0
+	/* Initialise platform data from device tree if available. */
+	if (!dn) {

That was supposed to be if (dn) no ?

Quoted 14 lines
arch/powerpc/boot/dts/sequoia.dts +10 -0
+		if (of_get_property(dn, "big-endian", NULL)) {
+			pdata->big_endian_mmio = 1;
+			pdata->big_endian_desc = 1;
+		}
+		if (of_get_property(dn, "big-endian-regs", NULL))
+			pdata->big_endian_mmio = 1;
+		if (of_get_property(dn, "big-endian-desc", NULL))
+			pdata->big_endian_desc = 1;
+	}
+
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 		dev_err(&dev->dev, "no irq provided");

arch/powerpc/boot/dts/sequoia.dts static int ehci_platform_resume(struct device *dev) · line 224

Quoted 10 lines
arch/powerpc/boot/dts/sequoia.dts +2 -1
@@ -203,9 +216,10 @@ static int ehci_platform_resume(struct device *dev)
 #define ehci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
-static const struct of_device_id vt8500_ehci_ids[] = {
+static const struct of_device_id ehci_platform_ids[] = {
 	{ .compatible = "via,vt8500-ehci", },
 	{ .compatible = "wm,prizm-ehci", },
+	{ .compatible = "usb-ehci", },
 	{}
 };

Cheers,
Ben.

#29 lore raw

Re: [RFC PATCH] ehci-platform: Merge ppc-of EHCI driver into the ehci-platform driver

Quoted 1 line · On Thu, 7 Nov 2013 06:57:00 Benjamin Herrenschmidt wrote:

On Wed, 2013-11-06 at 18:39 +1100, Alistair Popple wrote:

[snip]

Quoted 4 lines

I would go even further and add the 44x workarounds to the normal platform device, with a compatible check in there. That isn't the first time we add quirks to an existing driver.

Ok, easily done. I guess I was just cautious of adding a bunch of platform specific code into an otherwise generic driver as there seems to be a number of other platforms with their own quirks and it would be easy to end up with a driver full of platform specific quirks.

That said it is probably better than the current situation in which each platform has its own copy/variation of the generic code in ehci-platform.

Unless anyone is against this I will merge the 440EPX specific quirks into the ehci-platform driver and submit it as part of the next version of the Akebono patch series.

Quoted 4 lines

drivers/usb/host/ehci-platform.c static int ehci_platform_probe(struct platform_device *dev) · line 101

Quoted 2 lines
drivers/usb/host/ehci-platform.c +2 -0
+	/* Initialise platform data from device tree if available. */
+	if (!dn) {

That was supposed to be if (dn) no ?

It sure was, thanks.

Quoted 36 lines
Quoted 30 lines
drivers/usb/host/ehci-platform.c +12 -1
+		if (of_get_property(dn, "big-endian", NULL)) {
+			pdata->big_endian_mmio = 1;
+			pdata->big_endian_desc = 1;
+		}
+		if (of_get_property(dn, "big-endian-regs", NULL))
+			pdata->big_endian_mmio = 1;
+		if (of_get_property(dn, "big-endian-desc", NULL))
+			pdata->big_endian_desc = 1;
+	}
+
 
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 
 		dev_err(&dev->dev, "no irq provided");
@@ -203,9 +216,10 @@ static int ehci_platform_resume(struct device *dev)
 
 #define ehci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
-static const struct of_device_id vt8500_ehci_ids[] = {
+static const struct of_device_id ehci_platform_ids[] = {
 
 	{ .compatible = "via,vt8500-ehci", },
 	{ .compatible = "wm,prizm-ehci", },
 
+	{ .compatible = "usb-ehci", },
Quoted 3 lines

{}

};

Cheers,
Ben.

#30 lore raw

PATCH 6/7 IBM Currituck: Clean up board specific code before adding Akebono code

In reply to Alistair Popple

The IBM Akebono code uses the same initialisation functions as the earlier Currituck board. Rather than create a copy of this code for Akebono we will instead integrate support for it into the same file as the Currituck code.

This patch simply renames the file.

---
 arch/powerpc/platforms/44x/Makefile    |    2 +-
 arch/powerpc/platforms/44x/currituck.c |  233 --------------------------------
 arch/powerpc/platforms/44x/ppc476fpe.c |  233 ++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 234 deletions(-)
 delete mode 100644 arch/powerpc/platforms/44x/currituck.c
 create mode 100644 arch/powerpc/platforms/44x/ppc476fpe.c
arch/powerpc/platforms/44x/Makefile +1 -1
index d03833a..c4fe9cd 100644
@@ -10,4 +10,4 @@ obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
 obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o
 obj-$(CONFIG_ISS4xx)	+= iss4xx.o
 obj-$(CONFIG_CANYONLANDS)+= canyonlands.o
-obj-$(CONFIG_CURRITUCK)	+= currituck.o
+obj-$(CONFIG_CURRITUCK)	+= ppc476fpe.o
arch/powerpc/platforms/44x/currituck.c deleted +0 -233

233 lines not on this page · raw message

arch/powerpc/platforms/44x/ppc476fpe.c new file +233 -0

233 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#31 lore raw

PATCH 7/7 IBM Akebono: Add the Akebono platform

In reply to Alistair Popple

This patch adds support for the IBM Akebono board.

---
 .../devicetree/bindings/powerpc/4xx/akebono.txt    |   76 ++++
 arch/powerpc/boot/Makefile                         |    3 +
 arch/powerpc/boot/dcr.h                            |    2 +
 arch/powerpc/boot/dts/akebono.dts                  |  385 ++++++++++++++++++++
 arch/powerpc/boot/treeboot-akebono.c               |  179 +++++++++
 arch/powerpc/boot/wrapper                          |    3 +
 arch/powerpc/configs/44x/akebono_defconfig         |  148 ++++++++
 arch/powerpc/platforms/44x/Kconfig                 |   28 ++
 arch/powerpc/platforms/44x/Makefile                |    1 +
 arch/powerpc/platforms/44x/ppc476fpe.c             |  112 ++++--
 10 files changed, 914 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/4xx/akebono.txt
 create mode 100644 arch/powerpc/boot/dts/akebono.dts
 create mode 100644 arch/powerpc/boot/treeboot-akebono.c
 create mode 100644 arch/powerpc/configs/44x/akebono_defconfig
Documentation/devicetree/bindings/powerpc/4xx/akebono.txt new file +76 -0
new file mode 100644
index 0000000..cb5272d
@@ -0,0 +1,76 @@
+
+IBM Akebono board device tree
+=============================
+
+The IBM Akebono board is a development board for a 476FPE bases SoC.
+
+0) The root node
+
+   Required properties:
+
+   - model : "ibm,akebono".
+   - compatible : "ibm,akebono" , "ibm,476fpe".
+
+1.a) The Open Host Controller Interface (OHCI) nodes
+
+  Represent the USB 1.x Open Host Controller Interfaces.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-ohci".
+   - reg : should contain the OHCI registers location and length.
+   - interrupt-parent : a phandle for the interrupt controller.
+   - interrupts : should contain the OHCI interrupt.
+
+1.b) The Open Host Controller Interface (EHCI) nodes
+
+  Represent the USB 2.0 Enhanced Host Controller Interface.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-ehci".
+   - reg : should contain the EHCI registers location and length.
+   - interrupt-parent : a phandle for the interrupt controller.
+   - interrupts : should contain the EHCI interrupt.
+
+1.c) The Secure Digital Host Controller Interface (SDHCI) node
+
+  Represent the Secure Digital Host Controller Interfaces.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-sdhci","sdhci".
+   - reg : should contain the SDHCI registers location and length.
+   - interrupt-parent : a phandle for the interrupt controller.
+   - interrupts : should contain the SDHCI interrupt.
+
+1.d) The Advanced Host Controller Interface (AHCI) SATA node
+
+  Represents the advanced host controller SATA interface.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-ahci".
+   - reg : should contain the AHCI registers location and length.
+   - interrupt-parent : a phandle for the interrupt controller.
+   - interrupts : should contain the AHCI interrupt.
+
+1.e) The FPGA node
+
+  The Akebono board stores some board information such as the revision
+  number in an FPGA which is represented by this node.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-fpga".
+   - reg : should contain the FPGA registers location and length.
+
+1.f) The AVR node
+
+  The Akebono board has an Atmel AVR microprocessor attached to the I2C
+  bus as a power controller for the board.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-avr".
+   - reg : should contain the I2C bus address for the AVR.
arch/powerpc/boot/Makefile +3 -0
index 15ca225..645ff21 100644
@@ -46,6 +46,7 @@ $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
+$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
 $(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
 
 
@@ -85,6 +86,7 @@ src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
 				cuboot-taishan.c cuboot-katmai.c \
 				cuboot-warp.c cuboot-yosemite.c \
 				treeboot-iss4xx.c treeboot-currituck.c \
+				treeboot-akebono.c \
 				simpleboot.c fixed-head.S virtex.c
 src-plat-$(CONFIG_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
 src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
@@ -235,6 +237,7 @@ image-$(CONFIG_YOSEMITE)		+= cuImage.yosemite
 image-$(CONFIG_ISS4xx)			+= treeImage.iss4xx \
 					   treeImage.iss4xx-mpic
 image-$(CONFIG_CURRITUCK)			+= treeImage.currituck
+image-$(CONFIG_AKEBONO)			+= treeImage.akebono
 
 # Board ports in arch/powerpc/platform/8xx/Kconfig
 image-$(CONFIG_MPC86XADS)		+= cuImage.mpc866ads
arch/powerpc/boot/dcr.h +2 -0
index cc73f7a..2585965 100644
@@ -15,6 +15,8 @@
 		asm volatile("mfdcrx %0,%1" : "=r"(rval) : "r"(rn)); \
 		rval; \
 	})
+#define mtdcrx(rn, val) \
+	asm volatile("mtdcrx %0,%1" : : "r"(rn), "r" (val))
 
 /* 440GP/440GX SDRAM controller DCRs */
 #define DCRN_SDRAM0_CFGADDR				0x010
arch/powerpc/boot/dts/akebono.dts new file +385 -0

385 lines not on this page · raw message

arch/powerpc/boot/treeboot-akebono.c new file +179 -0

179 lines not on this page · raw message

arch/powerpc/boot/wrapper +3 -0
index cd7af84..1260819 100755
@@ -249,6 +249,9 @@ gamecube|wii)
 treeboot-currituck)
     link_address='0x1000000'
     ;;
+treeboot-akebono)
+    link_address='0x1000000'
+    ;;
 treeboot-iss4xx-mpic)
     platformo="$object/treeboot-iss4xx.o"
     ;;
arch/powerpc/configs/44x/akebono_defconfig new file +148 -0

148 lines not on this page · raw message

arch/powerpc/platforms/44x/Kconfig +28 -0
index d6c7506..b67287c 100644
@@ -195,10 +195,38 @@ config CURRITUCK
 	default n
 	select SWIOTLB
 	select 476FPE
+	select I2C
+	select I2C_IBM_IIC
 	select PPC4xx_PCI_EXPRESS
 	help
 	  This option enables support for the IBM Currituck (476fpe) evaluation board
 
+config AKEBONO
+	bool "IBM Akebono (476fpe) Support"
+	depends on PPC_47x
+	default n
+	select SWIOTLB
+	select 476FPE
+	select PPC4xx_PCI_EXPRESS
+	select I2C
+	select I2C_IBM_IIC
+	select NETDEVICES
+	select ETHERNET
+	select NET_VENDOR_IBM
+	select IBM_EMAC_EMAC4
+	select IBM_EMAC_RGMII_WOL
+	select USB
+	select USB_OHCI_HCD_PLATFORM
+	select USB_EHCI_HCD_PLATFORM
+	select MMC_SDHCI
+	select MMC_SDHCI_PLTFM
+	select MMC_SDHCI_OF_AKEBONO
+	select ATA
+	select SATA_AHCI_PLATFORM
+	help
+	  This option enables support for the IBM Akebono (476fpe) evaluation board
+
+
 config ICON
 	bool "Icon"
 	depends on 44x
arch/powerpc/platforms/44x/Makefile +1 -0
index c4fe9cd..e51189c 100644
@@ -11,3 +11,4 @@ obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o
 obj-$(CONFIG_ISS4xx)	+= iss4xx.o
 obj-$(CONFIG_CANYONLANDS)+= canyonlands.o
 obj-$(CONFIG_CURRITUCK)	+= ppc476fpe.o
+obj-$(CONFIG_AKEBONO)	+= ppc476fpe.o
arch/powerpc/platforms/44x/ppc476fpe.c +89 -23

167 lines not on this page · raw message

Signature · 1 line
1.7.10.4