* [PATCH 2/3] USB: add of_platform glue driver for FSL USB DR controller
From: Anatolij Gustschin @ 2010-07-22 16:25 UTC (permalink / raw)
To: linux-usb
Cc: David Brownell, Wolfgang Denk, Detlev Zundel, Greg Kroah-Hartman,
linuxppc-dev, Anatolij Gustschin
In-Reply-To: <1279815922-27198-1-git-send-email-agust@denx.de>
The driver creates platform devices based on the information
from USB nodes in the flat device tree. This is the replacement
for old arch fsl_soc usb code removed by the previous patch.
It uses usual of-style binding, available EHCI-HCD and UDC
drivers can be bound to the created devices. The new of-style
driver additionaly instantiates USB OTG platform device, as the
appropriate USB OTG driver will be added soon.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
drivers/usb/gadget/Kconfig | 1 +
drivers/usb/host/Kconfig | 5 +
drivers/usb/host/Makefile | 1 +
drivers/usb/host/fsl-mph-dr-of.c | 189 ++++++++++++++++++++++++++++++++++++++
4 files changed, 196 insertions(+), 0 deletions(-)
create mode 100644 drivers/usb/host/fsl-mph-dr-of.c
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index cd27f9b..e15e314 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -158,6 +158,7 @@ config USB_GADGET_FSL_USB2
boolean "Freescale Highspeed USB DR Peripheral Controller"
depends on FSL_SOC || ARCH_MXC
select USB_GADGET_DUALSPEED
+ select USB_FSL_MPH_DR_OF
help
Some of Freescale PowerPC processors have a High Speed
Dual-Role(DR) USB controller, which supports device mode.
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 2d926ce..6687523 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -112,10 +112,15 @@ config XPS_USB_HCD_XILINX
support both high speed and full speed devices, or high speed
devices only.
+config USB_FSL_MPH_DR_OF
+ bool
+ depends on PPC_OF
+
config USB_EHCI_FSL
bool "Support for Freescale on-chip EHCI USB controller"
depends on USB_EHCI_HCD && FSL_SOC
select USB_EHCI_ROOT_HUB_TT
+ select USB_FSL_MPH_DR_OF
---help---
Variation of ARC USB block used in some Freescale chips.
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index b6315aa..aacbe82 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -33,4 +33,5 @@ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
obj-$(CONFIG_USB_ISP1760_HCD) += isp1760.o
obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o
obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o
+obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
new file mode 100644
index 0000000..020a939
--- /dev/null
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -0,0 +1,189 @@
+/*
+ * Setup platform devices needed by the Freescale multi-port host
+ * and/or dual-role USB controller modules based on the description
+ * in flat device tree.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/fsl_devices.h>
+#include <linux/io.h>
+#include <linux/of_platform.h>
+
+struct fsl_usb2_dev_data {
+ char *dr_mode; /* controller mode */
+ char *drivers[3]; /* drivers to instantiate for this mode */
+ enum fsl_usb2_operating_modes op_mode; /* operating mode */
+};
+
+struct fsl_usb2_dev_data dr_mode_data[] __devinitdata = {
+ {
+ "host",
+ { "fsl-ehci", NULL, NULL, },
+ FSL_USB2_DR_HOST,
+ },
+ {
+ "otg",
+ { "fsl-ehci", "fsl-usb2-udc", "fsl-usb2-otg", },
+ FSL_USB2_DR_OTG,
+ },
+ {
+ "periferal",
+ { "fsl-usb2-udc", NULL, NULL, },
+ FSL_USB2_DR_DEVICE,
+ },
+};
+
+struct fsl_usb2_dev_data * __devinit get_dr_mode_data(struct device_node *np)
+{
+ const unsigned char *prop;
+ int i;
+
+ prop = of_get_property(np, "dr_mode", NULL);
+ if (prop) {
+ for (i = 0; i < ARRAY_SIZE(dr_mode_data); i++) {
+ if (!strcmp(prop, dr_mode_data[i].dr_mode))
+ return &dr_mode_data[i];
+ }
+ }
+ return &dr_mode_data[0]; /* mode not specified, use host */
+}
+
+static enum fsl_usb2_phy_modes __devinit determine_usb_phy(const char *phy_type)
+{
+ if (!phy_type)
+ return FSL_USB2_PHY_NONE;
+ if (!strcasecmp(phy_type, "ulpi"))
+ return FSL_USB2_PHY_ULPI;
+ if (!strcasecmp(phy_type, "utmi"))
+ return FSL_USB2_PHY_UTMI;
+ if (!strcasecmp(phy_type, "utmi_wide"))
+ return FSL_USB2_PHY_UTMI_WIDE;
+ if (!strcasecmp(phy_type, "serial"))
+ return FSL_USB2_PHY_SERIAL;
+
+ return FSL_USB2_PHY_NONE;
+}
+
+struct platform_device * __devinit
+fsl_usb2_device_register(struct of_device *ofdev,
+ struct fsl_usb2_platform_data *pdata,
+ const char *name, int id)
+{
+ struct platform_device *pdev;
+ const struct resource *res = ofdev->resource;
+ unsigned int num = ofdev->num_resources;
+ int retval;
+
+ pdev = platform_device_alloc(name, id);
+ if (!pdev) {
+ retval = -ENOMEM;
+ goto error;
+ }
+
+ pdev->dev.parent = &ofdev->dev;
+
+ pdev->dev.coherent_dma_mask = ofdev->dev.coherent_dma_mask;
+ pdev->dev.dma_mask = &pdev->archdata.dma_mask;
+ *pdev->dev.dma_mask = *ofdev->dev.dma_mask;
+
+ retval = platform_device_add_data(pdev, pdata, sizeof(*pdata));
+ if (retval)
+ goto error;
+
+ if (num) {
+ retval = platform_device_add_resources(pdev, res, num);
+ if (retval)
+ goto error;
+ }
+
+ retval = platform_device_add(pdev);
+ if (retval)
+ goto error;
+
+ return pdev;
+
+error:
+ platform_device_put(pdev);
+ return ERR_PTR(retval);
+}
+
+static int __devinit fsl_usb2_mph_dr_of_probe(struct of_device *ofdev,
+ const struct of_device_id *match)
+{
+ struct device_node *np = ofdev->dev.of_node;
+ struct platform_device *usb_dev;
+ struct fsl_usb2_platform_data data, *pdata;
+ struct fsl_usb2_dev_data *dev_data;
+ const unsigned char *prop;
+ static unsigned int idx;
+ int i;
+
+ if (!of_device_is_available(np))
+ return -ENODEV;
+
+ pdata = match->data;
+ if (!pdata) {
+ memset(&data, 0, sizeof(data));
+ pdata = &data;
+ }
+
+ dev_data = get_dr_mode_data(np);
+
+ if (of_device_is_compatible(np, "fsl-usb2-mph")) {
+ prop = of_get_property(np, "port0", NULL);
+ if (prop)
+ pdata->port_enables |= FSL_USB2_PORT0_ENABLED;
+
+ prop = of_get_property(np, "port1", NULL);
+ if (prop)
+ pdata->port_enables |= FSL_USB2_PORT1_ENABLED;
+
+ pdata->operating_mode = FSL_USB2_MPH_HOST;
+ } else {
+ /* setup mode selected in the device tree */
+ pdata->operating_mode = dev_data->op_mode;
+ }
+
+ prop = of_get_property(np, "phy_type", NULL);
+ pdata->phy_mode = determine_usb_phy(prop);
+
+ for (i = 0; i < ARRAY_SIZE(dev_data->drivers); i++) {
+ if (!dev_data->drivers[i])
+ continue;
+ usb_dev = fsl_usb2_device_register(ofdev, pdata,
+ dev_data->drivers[i], idx);
+ if (IS_ERR(usb_dev)) {
+ dev_err(&ofdev->dev, "Can't register usb device\n");
+ return PTR_ERR(usb_dev);
+ }
+ }
+ idx++;
+ return 0;
+}
+
+static const struct of_device_id fsl_usb2_mph_dr_of_match[] = {
+ { .compatible = "fsl-usb2-mph", },
+ { .compatible = "fsl-usb2-dr", },
+ {},
+};
+
+static struct of_platform_driver fsl_usb2_mph_dr_driver = {
+ .driver = {
+ .name = "fsl-usb2-mph-dr",
+ .owner = THIS_MODULE,
+ .of_match_table = fsl_usb2_mph_dr_of_match,
+ },
+ .probe = fsl_usb2_mph_dr_of_probe,
+};
+
+static int __init fsl_usb2_mph_dr_init(void)
+{
+ return of_register_platform_driver(&fsl_usb2_mph_dr_driver);
+}
+fs_initcall(fsl_usb2_mph_dr_init);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 1/3] powerpc/fsl_soc.c: remove FSL USB platform code
From: Anatolij Gustschin @ 2010-07-22 16:25 UTC (permalink / raw)
To: linux-usb
Cc: David Brownell, Wolfgang Denk, Detlev Zundel, Greg Kroah-Hartman,
linuxppc-dev, Anatolij Gustschin
In-Reply-To: <1279815922-27198-1-git-send-email-agust@denx.de>
This removed code will be replaced by simple of_platform
driver for creation of FSL USB platform devices which is
added by next patch of the series.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
arch/powerpc/sysdev/fsl_soc.c | 163 -----------------------------------------
1 files changed, 0 insertions(+), 163 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index b91f7ac..49a51f1 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -209,169 +209,6 @@ static int __init of_add_fixed_phys(void)
arch_initcall(of_add_fixed_phys);
#endif /* CONFIG_FIXED_PHY */
-static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
-{
- if (!phy_type)
- return FSL_USB2_PHY_NONE;
- if (!strcasecmp(phy_type, "ulpi"))
- return FSL_USB2_PHY_ULPI;
- if (!strcasecmp(phy_type, "utmi"))
- return FSL_USB2_PHY_UTMI;
- if (!strcasecmp(phy_type, "utmi_wide"))
- return FSL_USB2_PHY_UTMI_WIDE;
- if (!strcasecmp(phy_type, "serial"))
- return FSL_USB2_PHY_SERIAL;
-
- return FSL_USB2_PHY_NONE;
-}
-
-static int __init fsl_usb_of_init(void)
-{
- struct device_node *np;
- unsigned int i = 0;
- struct platform_device *usb_dev_mph = NULL, *usb_dev_dr_host = NULL,
- *usb_dev_dr_client = NULL;
- int ret;
-
- for_each_compatible_node(np, NULL, "fsl-usb2-mph") {
- struct resource r[2];
- struct fsl_usb2_platform_data usb_data;
- const unsigned char *prop = NULL;
-
- memset(&r, 0, sizeof(r));
- memset(&usb_data, 0, sizeof(usb_data));
-
- ret = of_address_to_resource(np, 0, &r[0]);
- if (ret)
- goto err;
-
- of_irq_to_resource(np, 0, &r[1]);
-
- usb_dev_mph =
- platform_device_register_simple("fsl-ehci", i, r, 2);
- if (IS_ERR(usb_dev_mph)) {
- ret = PTR_ERR(usb_dev_mph);
- goto err;
- }
-
- usb_dev_mph->dev.coherent_dma_mask = 0xffffffffUL;
- usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask;
-
- usb_data.operating_mode = FSL_USB2_MPH_HOST;
-
- prop = of_get_property(np, "port0", NULL);
- if (prop)
- usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
-
- prop = of_get_property(np, "port1", NULL);
- if (prop)
- usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
-
- prop = of_get_property(np, "phy_type", NULL);
- usb_data.phy_mode = determine_usb_phy(prop);
-
- ret =
- platform_device_add_data(usb_dev_mph, &usb_data,
- sizeof(struct
- fsl_usb2_platform_data));
- if (ret)
- goto unreg_mph;
- i++;
- }
-
- for_each_compatible_node(np, NULL, "fsl-usb2-dr") {
- struct resource r[2];
- struct fsl_usb2_platform_data usb_data;
- const unsigned char *prop = NULL;
-
- if (!of_device_is_available(np))
- continue;
-
- memset(&r, 0, sizeof(r));
- memset(&usb_data, 0, sizeof(usb_data));
-
- ret = of_address_to_resource(np, 0, &r[0]);
- if (ret)
- goto unreg_mph;
-
- of_irq_to_resource(np, 0, &r[1]);
-
- prop = of_get_property(np, "dr_mode", NULL);
-
- if (!prop || !strcmp(prop, "host")) {
- usb_data.operating_mode = FSL_USB2_DR_HOST;
- usb_dev_dr_host = platform_device_register_simple(
- "fsl-ehci", i, r, 2);
- if (IS_ERR(usb_dev_dr_host)) {
- ret = PTR_ERR(usb_dev_dr_host);
- goto err;
- }
- } else if (prop && !strcmp(prop, "peripheral")) {
- usb_data.operating_mode = FSL_USB2_DR_DEVICE;
- usb_dev_dr_client = platform_device_register_simple(
- "fsl-usb2-udc", i, r, 2);
- if (IS_ERR(usb_dev_dr_client)) {
- ret = PTR_ERR(usb_dev_dr_client);
- goto err;
- }
- } else if (prop && !strcmp(prop, "otg")) {
- usb_data.operating_mode = FSL_USB2_DR_OTG;
- usb_dev_dr_host = platform_device_register_simple(
- "fsl-ehci", i, r, 2);
- if (IS_ERR(usb_dev_dr_host)) {
- ret = PTR_ERR(usb_dev_dr_host);
- goto err;
- }
- usb_dev_dr_client = platform_device_register_simple(
- "fsl-usb2-udc", i, r, 2);
- if (IS_ERR(usb_dev_dr_client)) {
- ret = PTR_ERR(usb_dev_dr_client);
- goto err;
- }
- } else {
- ret = -EINVAL;
- goto err;
- }
-
- prop = of_get_property(np, "phy_type", NULL);
- usb_data.phy_mode = determine_usb_phy(prop);
-
- if (usb_dev_dr_host) {
- usb_dev_dr_host->dev.coherent_dma_mask = 0xffffffffUL;
- usb_dev_dr_host->dev.dma_mask = &usb_dev_dr_host->
- dev.coherent_dma_mask;
- if ((ret = platform_device_add_data(usb_dev_dr_host,
- &usb_data, sizeof(struct
- fsl_usb2_platform_data))))
- goto unreg_dr;
- }
- if (usb_dev_dr_client) {
- usb_dev_dr_client->dev.coherent_dma_mask = 0xffffffffUL;
- usb_dev_dr_client->dev.dma_mask = &usb_dev_dr_client->
- dev.coherent_dma_mask;
- if ((ret = platform_device_add_data(usb_dev_dr_client,
- &usb_data, sizeof(struct
- fsl_usb2_platform_data))))
- goto unreg_dr;
- }
- i++;
- }
- return 0;
-
-unreg_dr:
- if (usb_dev_dr_host)
- platform_device_unregister(usb_dev_dr_host);
- if (usb_dev_dr_client)
- platform_device_unregister(usb_dev_dr_client);
-unreg_mph:
- if (usb_dev_mph)
- platform_device_unregister(usb_dev_mph);
-err:
- return ret;
-}
-
-arch_initcall(fsl_usb_of_init);
-
#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
static __be32 __iomem *rstcr;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 0/3] Add USB Host support for MPC5121 SoC
From: Anatolij Gustschin @ 2010-07-22 16:25 UTC (permalink / raw)
To: linux-usb
Cc: David Brownell, Wolfgang Denk, Detlev Zundel, Greg Kroah-Hartman,
linuxppc-dev, Anatolij Gustschin
This is new attempt to add MPC512x USB support in mainline kernel.
USB OTG support is not included in this patch series, it will be
submitted later.
Anatolij Gustschin (3):
powerpc/fsl_soc.c: remove FSL USB platform code
USB: add of_platform glue driver for FSL USB DR controller
USB: add USB EHCI support for MPC5121 SoC
Documentation/powerpc/dts-bindings/fsl/usb.txt | 22 ++
arch/powerpc/sysdev/fsl_soc.c | 163 --------------
drivers/usb/Kconfig | 1 +
drivers/usb/gadget/Kconfig | 1 +
drivers/usb/host/Kconfig | 11 +-
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ehci-fsl.c | 107 +++++++---
drivers/usb/host/ehci-fsl.h | 19 ++-
drivers/usb/host/ehci-mem.c | 2 +-
drivers/usb/host/fsl-mph-dr-of.c | 278 ++++++++++++++++++++++++
include/linux/fsl_devices.h | 15 ++
11 files changed, 425 insertions(+), 195 deletions(-)
create mode 100644 drivers/usb/host/fsl-mph-dr-of.c
^ permalink raw reply
* Re: [PATCH 1/2] MPC85xx: add definitions for PCI error detection soc part
From: Peter Tyser @ 2010-07-22 15:19 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov
Cc: linuxppc-dev, Dave Jiang, bluesmoke-devel, Doug Thompson
In-Reply-To: <1279756992-29543-1-git-send-email-dbaryshkov@gmail.com>
Hi Dmitry,
On Thu, 2010-07-22 at 04:03 +0400, Dmitry Eremin-Solenikov wrote:
> Add definitions for PCI error detection device to be handled by (already
> existing) mpc85xx_edac.c driver.
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
> arch/powerpc/boot/dts/mpc8536ds.dts | 7 +++++++
> arch/powerpc/boot/dts/mpc8536ds_36b.dts | 7 +++++++
> arch/powerpc/boot/dts/mpc8540ads.dts | 8 ++++++++
> arch/powerpc/boot/dts/mpc8541cds.dts | 14 ++++++++++++++
> arch/powerpc/boot/dts/mpc8544ds.dts | 7 +++++++
> arch/powerpc/boot/dts/mpc8548cds.dts | 14 ++++++++++++++
> arch/powerpc/boot/dts/mpc8555cds.dts | 14 ++++++++++++++
> arch/powerpc/boot/dts/mpc8560ads.dts | 7 +++++++
> arch/powerpc/boot/dts/mpc8568mds.dts | 7 +++++++
> arch/powerpc/boot/dts/sbc8548.dts | 7 +++++++
> arch/powerpc/boot/dts/sbc8560.dts | 7 +++++++
> arch/powerpc/boot/dts/socrates.dts | 7 +++++++
> arch/powerpc/boot/dts/stx_gp3_8560.dts | 7 +++++++
> arch/powerpc/boot/dts/tqm8540.dts | 10 ++++++++++
> arch/powerpc/boot/dts/tqm8541.dts | 7 +++++++
> arch/powerpc/boot/dts/tqm8548-bigflash.dts | 7 +++++++
> arch/powerpc/boot/dts/tqm8548.dts | 7 +++++++
> arch/powerpc/boot/dts/tqm8555.dts | 7 +++++++
> arch/powerpc/boot/dts/tqm8560.dts | 7 +++++++
> arch/powerpc/boot/dts/xpedite5200.dts | 7 +++++++
> arch/powerpc/boot/dts/xpedite5200_xmon.dts | 7 +++++++
> 21 files changed, 172 insertions(+), 0 deletions(-)
It looks like the dts files for the MPC8572-based boards weren't
included in this change despite patch 2/2 adding support for them. I'd
guess some other Freescale CPUs (eg P1020, P2020, etc) could be
supported by the same driver if you are inclined to add them to this
patch series.
Best,
Peter
^ permalink raw reply
* Re: [PATCH] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support
From: Kumar Gala @ 2010-07-22 15:36 UTC (permalink / raw)
To: Peter Tyser; +Cc: linuxppc-dev, alsa-devel, broonie, Timur Tabi, lrg
In-Reply-To: <1279812617.7232.8703.camel@petert>
On Jul 22, 2010, at 10:30 AM, Peter Tyser wrote:
> Hi Timur,
>=20
>> +/**
>> + * Global Utility Registers.
>> + *
>> + * Not all registers defined in this structure are available on all =
chips, so
>> + * you are expected to know whether a given register actually exists =
on your
>> + * chip before you access it.
>> + *
>> + * Also, some registers are similar on different chips but have =
slightly
>> + * different names. In these cases, one name is chosen to avoid =
extraneous
>> + * #ifdefs.
>> + */
>> +#ifdef CONFIG_PPC_85xx
>> +struct ccsr_guts_85xx {
>> +#else
>> +struct ccsr_guts_86xx {
>> +#endif
>=20
> Is there a good reason to have 2 different names for the same =
structure
> depending on the architecture? I'd think keeping a common "ccsr_guts"
> name would get rid of the ifdefs above as well as in code that can be
> used on both 85xx and 86xx processors down the road.
I asked for separate structs since the feeling is the GUTS code should =
be limited to platform specific locations. Additionally the new =
P3/P4/P5 class parts have a completely different guts immap so if/when =
we add them in things would have to change.
- k=
^ permalink raw reply
* Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace
From: Kumar Gala @ 2010-07-22 15:38 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov
Cc: linuxppc-dev, Doug Thompson, bluesmoke-devel, Dave Jiang
In-Reply-To: <1279756992-29543-2-git-send-email-dbaryshkov@gmail.com>
On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
> Currently (as mpc8540-pci) devices are not created on of_platform bus,
> mpc85xx_edac can't probe to them. Follow the change to dts trees to =
bind
> not to the main mpc8540-pci node but to special mpc85xx-pci-error =
nodes,
> present on soc bus.
>=20
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
> drivers/edac/mpc85xx_edac.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
Nak.
We already have a node in the dts for the PCI controller. Lets update =
the platform code to add the pci controller to the of_platform_bus_probe =
list.
- k=
^ permalink raw reply
* Re: [PATCH] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support
From: Peter Tyser @ 2010-07-22 15:30 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, alsa-devel, broonie, kumar.gala, lrg
In-Reply-To: <1279749902-13459-1-git-send-email-timur@freescale.com>
Hi Timur,
> +/**
> + * Global Utility Registers.
> + *
> + * Not all registers defined in this structure are available on all chips, so
> + * you are expected to know whether a given register actually exists on your
> + * chip before you access it.
> + *
> + * Also, some registers are similar on different chips but have slightly
> + * different names. In these cases, one name is chosen to avoid extraneous
> + * #ifdefs.
> + */
> +#ifdef CONFIG_PPC_85xx
> +struct ccsr_guts_85xx {
> +#else
> +struct ccsr_guts_86xx {
> +#endif
Is there a good reason to have 2 different names for the same structure
depending on the architecture? I'd think keeping a common "ccsr_guts"
name would get rid of the ifdefs above as well as in code that can be
used on both 85xx and 86xx processors down the road.
Best,
Peter
^ permalink raw reply
* Re: [PATCH] powerpc: print cores passed to firmware in decimal
From: Segher Boessenkool @ 2010-07-22 15:11 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev
In-Reply-To: <4553.1279775749@neuling.org>
> + case 'i':
> + ++q;
> + v = va_arg(args, unsigned long);
> + prom_print_dec(v);
> + break;
Unsigned long should be "%lu".
Segher
^ permalink raw reply
* [PATCH] RapidIO,powerpc/85xx: remove MCSR_MASK in fsl_rio
From: Alexandre Bounine @ 2010-07-21 16:46 UTC (permalink / raw)
To: akpm, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine
Fixes compile problem caused by MCSR_MASK removal from book-E definitions.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Matt Porter <mporter@kernel.crashing.org>
---
arch/powerpc/sysdev/fsl_rio.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 30e1626..c58df58 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -245,7 +245,7 @@ static int (*saved_mcheck_exception)(struct pt_regs *regs);
static int fsl_rio_mcheck_exception(struct pt_regs *regs)
{
const struct exception_table_entry *entry = NULL;
- unsigned long reason = (mfspr(SPRN_MCSR) & MCSR_MASK);
+ unsigned long reason = mfspr(SPRN_MCSR);
if (reason & MCSR_BUS_RBERR) {
reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR));
--
1.7.0.5
^ permalink raw reply related
* Re: build failure with kernel 2.6.35-rc5-git6/git7 on power box
From: Stephen Rothwell @ 2010-07-22 8:40 UTC (permalink / raw)
To: divya; +Cc: David Airlie, linuxppc-dev, LKML
In-Reply-To: <4C47F861.8080501@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
Hi,
On Thu, 22 Jul 2010 13:20:57 +0530 divya <dipraksh@linux.vnet.ibm.com> wrote:
>
> The kernel versions 2.6.35-rc5-git6(commitid f4b23cc2d5dc78ef) and 2.6.35-rc5-git7(commitid cd5b8f8755a89a5) fails
> to build on power6 and power5 machines with the following error
>
>
> drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wb':
> drivers/gpu/drm/ttm/ttm_page_alloc.c:227: error: implicit declaration of function 'unmap_page_from_agp'
> drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wc':
> drivers/gpu/drm/ttm/ttm_page_alloc.c:238: error: implicit declaration of function 'map_page_into_agp'
> drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'ttm_pool_mm_shrink_init':
> drivers/gpu/drm/ttm/ttm_page_alloc.c:419: warning: assignment from incompatible pointer type
> make[4]: *** [drivers/gpu/drm/ttm/ttm_page_alloc.o] Error 1
> make[3]: *** [drivers/gpu/drm/ttm] Error 2
See https://patchwork.kernel.org/patch/113504/
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* build failure with kernel 2.6.35-rc5-git6/git7 on power box
From: divya @ 2010-07-22 7:50 UTC (permalink / raw)
To: LKML, linuxppc-dev, David Airlie
Hi,
The kernel versions 2.6.35-rc5-git6(commitid f4b23cc2d5dc78ef) and 2.6.35-rc5-git7(commitid cd5b8f8755a89a5) fails
to build on power6 and power5 machines with the following error
drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wb':
drivers/gpu/drm/ttm/ttm_page_alloc.c:227: error: implicit declaration of function 'unmap_page_from_agp'
drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'set_pages_array_wc':
drivers/gpu/drm/ttm/ttm_page_alloc.c:238: error: implicit declaration of function 'map_page_into_agp'
drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'ttm_pool_mm_shrink_init':
drivers/gpu/drm/ttm/ttm_page_alloc.c:419: warning: assignment from incompatible pointer type
make[4]: *** [drivers/gpu/drm/ttm/ttm_page_alloc.o] Error 1
make[3]: *** [drivers/gpu/drm/ttm] Error 2
Thanks
Divya
^ permalink raw reply
* Re: [PATCH 5/5] of: remove asm/of_device.h
From: David Miller @ 2010-07-22 5:28 UTC (permalink / raw)
To: grant.likely
Cc: sfr, monstr, gregkh, linux-kernel, linuxppc-dev,
microblaze-uclinux, sparclinux
In-Reply-To: <20100721234015.7782.98378.stgit@angua>
From: Grant Likely <grant.likely@secretlab.ca>
Date: Wed, 21 Jul 2010 17:40:15 -0600
> It is mostly unused now. Sparc has a few defines left in it, but they
> can be moved to other headers. Removing this header means that new
> architectures adding CONFIG_OF support don't need to also add this
> header file.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH 4/5] of: remove asm/of_platform.h
From: David Miller @ 2010-07-22 5:28 UTC (permalink / raw)
To: grant.likely
Cc: sfr, monstr, gregkh, linux-kernel, linuxppc-dev,
microblaze-uclinux, sparclinux
In-Reply-To: <20100721234010.7782.3073.stgit@angua>
From: Grant Likely <grant.likely@secretlab.ca>
Date: Wed, 21 Jul 2010 17:40:10 -0600
> Only thing left in it is of_instantiate_rtc() which can be moved to
> asm/prom.h on PowerPC and is unused in microblaze.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH 3/5] of/platform: remove all of_bus_type and of_platform_bus_type references
From: David Miller @ 2010-07-22 5:28 UTC (permalink / raw)
To: grant.likely
Cc: sfr, monstr, gregkh, linux-kernel, linuxppc-dev,
microblaze-uclinux, sparclinux
In-Reply-To: <20100721234005.7782.52867.stgit@angua>
From: Grant Likely <grant.likely@secretlab.ca>
Date: Wed, 21 Jul 2010 17:40:05 -0600
> Both of_bus_type and of_platform_bus_type are just #define aliases
> for the platform bus. This patch removes all references to them and
> switches to the of_register_platform_driver()/of_unregister_platform_driver()
> API for registering.
>
> Subsequent patches will convert each user of of_register_platform_driver()
> into plain platform_drivers without the of_platform_driver shim. At which
> point the of_register_platform_driver()/of_unregister_platform_driver()
> functions can be removed.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH 2/5] of: Merge of_platform_bus_type with platform_bus_type
From: David Miller @ 2010-07-22 5:28 UTC (permalink / raw)
To: grant.likely
Cc: sfr, monstr, gregkh, linux-kernel, linuxppc-dev,
microblaze-uclinux, sparclinux
In-Reply-To: <20100721233959.7782.17711.stgit@angua>
From: Grant Likely <grant.likely@secretlab.ca>
Date: Wed, 21 Jul 2010 17:40:00 -0600
> of_platform_bus was being used in the same manner as the platform_bus.
> The only difference being that of_platform_bus devices are generated
> from data in the device tree, and platform_bus devices are usually
> statically allocated in platform code. Having them separate causes
> the problem of device drivers having to be registered twice if it
> was possible for the same device to appear on either bus.
>
> This patch removes of_platform_bus_type and registers all of_platform
> bus devices and drivers on the platform bus instead. A previous patch
> made the of_device structure an alias for the platform_device structure,
> and a shim is used to adapt of_platform_drivers to the platform bus.
>
> After all of of_platform_bus drivers are converted to be normal platform
> drivers, the shim code can be removed.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH 0/5] Eliminate of_platform_bus_type
From: David Miller @ 2010-07-22 5:28 UTC (permalink / raw)
To: grant.likely
Cc: sfr, monstr, gregkh, linux-kernel, linuxppc-dev,
microblaze-uclinux, sparclinux
In-Reply-To: <20100721232817.7782.23410.stgit@angua>
From: Grant Likely <grant.likely@secretlab.ca>
Date: Wed, 21 Jul 2010 17:39:49 -0600
> David, you'll also want to take a look at patches 4 & 5 to see if you
> agree with my decisions on where I move symbols in the header files.
Looks fine to me.
^ permalink raw reply
* [PATCH] powerpc: print cores passed to firmware in decimal
From: Michael Neuling @ 2010-07-22 5:15 UTC (permalink / raw)
To: benh, linuxppc-dev
Currently we look pretty stupid when printing out the number of cores
passed to FW
Max number of cores passed to firmware: 0x0000000000000080
So I've change this to print in decimal:
Max number of cores passed to firmware: 128 (NR_CPUS = 256)
This required adding a prom_print_dec() function.
Signed-off-by: Michael Neuling <mikey@neuling.org>
--
Anton suggested printing it in EBCDIC, but I nixed that.
arch/powerpc/kernel/prom_init.c | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 3b6f8ae..4428d26 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -311,6 +311,27 @@ static void __init prom_print_hex(unsigned long val)
call_prom("write", 3, 1, _prom->stdout, buf, nibbles);
}
+/* max number of decimal digits in an unsigned long */
+#define UL_DIGITS 21
+static void __init prom_print_dec(unsigned long val)
+{
+ int i, size;
+ char buf[UL_DIGITS+1];
+ struct prom_t *_prom = &RELOC(prom);
+
+ for (i = UL_DIGITS-1; i >= 0; i--) {
+ buf[i] = (val % 10) + '0';
+ val = val/10;
+ if (val == 0)
+ break;
+ }
+ /* shift stuff down */
+ size = UL_DIGITS - i;
+ for (i = 0 ; i < size ; i++)
+ buf[i] = buf[i + UL_DIGITS - size];
+ buf[size+1] = '\0';
+ call_prom("write", 3, 1, _prom->stdout, buf, size);
+}
static void __init prom_printf(const char *format, ...)
{
@@ -350,6 +371,11 @@ static void __init prom_printf(const char *format, ...)
v = va_arg(args, unsigned long);
prom_print_hex(v);
break;
+ case 'i':
+ ++q;
+ v = va_arg(args, unsigned long);
+ prom_print_dec(v);
+ break;
}
}
}
@@ -869,12 +895,12 @@ static void __init prom_send_capabilities(void)
cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
if (*cores != NR_CPUS) {
prom_printf("WARNING ! "
- "ibm_architecture_vec structure inconsistent: 0x%x !\n",
+ "ibm_architecture_vec structure inconsistent: 0x%i !\n",
*cores);
} else {
*cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
- prom_printf("Max number of cores passed to firmware: 0x%x\n",
- (unsigned long)*cores);
+ prom_printf("Max number of cores passed to firmware: %i (NR_CPUS = %i)\n",
+ *cores, NR_CPUS);
}
/* try calling the ibm,client-architecture-support method */
^ permalink raw reply related
* Re: [PATCH v3 2/2] powerpc: add support for new hcall H_BEST_ENERGY
From: Vaidyanathan Srinivasan @ 2010-07-22 3:35 UTC (permalink / raw)
To: Michael Neuling; +Cc: Paul Mackerras, Anton Blanchard, linuxppc-dev
In-Reply-To: <2127.1277705466@neuling.org>
* Michael Neuling <mikey@neuling.org> [2010-06-28 16:11:06]:
[snip]
> > These hints are abstract number given by the hypervisor based on
> > the extended knowledge the hypervisor has regarding the current system
> > topology and resource mappings.
> >
> > The activate and the deactivate part is for the two distinct
> > operations that we could do for energy savings. When we have more
> > capacity than required, we could deactivate few core to save energy.
> > The choice of the core to deactivate will be based on
> > /sys/devices/system/cpu/deactivate_hint_list. The comma separated
> > list of cpus (cores) will be the preferred choice.
> >
> > Once the system has few deactivated cores, based on workload demand we
> > may have to activate them to meet the demand. In that case the
> > /sys/devices/system/cpu/activate_hint_list will be used to prefer the
> > core in-order among the deactivated cores.
> >
> > In simple terms, activate_hint_list will be null until we deactivate
> > few cores. Then we could look at the corresponding list for
> > activation or deactivation.
>
> Can you put these details in the code and in the check-in comments.
Hi Mikey,
I have added these in the -v4 post.
> > Regarding your second point, there is a reason for both a list and
> > per-cpu interface. The list gives us a system wide list of cores in
> > one shot for userspace to base their decision. This will be the
> > preferred interface for most cases. On the other hand, per-cpu file
> > /sys/device/system/cpu/cpuN/pseries_(de)activate_hint provide more
> > information since it exports the hint value as such.
> >
> > The idea is that the list interface will be used to get a suggested
> > list of cores to manage, while the per-cpu value can be used to
> > further get fine grain information on a per-core bases from the
> > hypervisor. This allows Linux to have access to all information that
> > the hypervisor has offered through this hcall interface.
>
> OK, I didn't realise that they contained different info. Just more
> reasons that this interface needs better documentation :-)
>
> Overall, I'm mostly happy with the interface. It's pretty light weight.
these too.
> > > Other comments below.
> > >
[snip]
> > > > diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platfo
> rms/
> > > pseries/Kconfig
> > > > index c667f0f..b3dd108 100644
> > > > --- a/arch/powerpc/platforms/pseries/Kconfig
> > > > +++ b/arch/powerpc/platforms/pseries/Kconfig
> > > > @@ -33,6 +33,16 @@ config PSERIES_MSI
> > > > depends on PCI_MSI && EEH
> > > > default y
> > > >
> > > > +config PSERIES_ENERGY
> > >
> > > Probably need a less generic name. PSERIES_ENERGY_MANAGEMENT?
> > > PSERIES_ENERGY_HOTPLUG_HINTS?
> >
> > PSERIES_ENERGY_MANAGEMENT may be good but too long for a config
> > option.
> >
> > The idea is to collect all energy management functions in this module
> > as and when new features are introduced in the pseries platform. This
> > hcall interface is the first to be included, but going forward in
> > future I do not propose to have different modules for other energy
> > management related features.
> >
> > The name is specific enough for IBM pseries platform and energy
> > management functions and enablements. Having less generic name below
> > this level will make it difficult to add all varieties of energy
> > management functions in future.
>
> OK, I thought this might be the case but you never said. Please say
> something like "This adds CONFIG_PSERIES_ENERGY which will be used for
> future power saving code" or some such.
I already had this comment in the patch description. Did not want add
a comment in the Kconfig file as the CONFIG_ prefix is assumed in each
of the
> > > > +
> > > > +/* Helper Routines to convert between drc_index to cpu numbers */
> > > > +
> > > > +static u32 cpu_to_drc_index(int cpu)
> > > > +{
> > > > + struct device_node *dn = NULL;
> > > > + const int *indexes;
> > > > + int i;
> > > > + dn = of_find_node_by_path("/cpus");
> > > > + if (dn == NULL)
> > > > + goto err;
> > >
> > > Humm, I not sure this is really needed. If you don't have /cpus you are
> > > probably not going to boot.
> >
> > Good suggestion. I could add all these checks in module_init. I was
> > think if any of the functions being called is allocating memory and in
> > case they fail, we need to abort.
> >
> > I just reviewed and look like of_find_node_by_path() will not sleep or
> > allocate any memory. So if it succeeds once in module_init(), then it
> > will never fail!
> >
> >
> > > > + indexes = of_get_property(dn, "ibm,drc-indexes", NULL);
> > > > + if (indexes == NULL)
> > > > + goto err;
> > >
> > > These checks should probably be moved to module init rather than /sfs
> > > read time. If they fail, don't load the module and print a warning.
> > >
> > > These HCALLS and device-tree entire aren't going to be dynamic.
> >
> > Agreed. Only cause of runtime failure is OOM. If none of these
> > allocate memory, moving these checks once at module_init() will be
> > a good optimization.
>
> Cool, thanks.
Hey, I did not yet remove the failure checks in this iteration. I did
not have these checks earlier and Ben has suggested to check at each
call. I will discuss with him about moving all checks to
module_init() time and then remove these.
--Vaidy
^ permalink raw reply
* [PATCH v4 2/2] powerpc: add support for new hcall H_BEST_ENERGY
From: Vaidyanathan Srinivasan @ 2010-07-22 0:57 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Anton Blanchard
Cc: Michael Neuling, linuxppc-dev
In-Reply-To: <20100722005219.12905.49197.stgit@drishya.in.ibm.com>
Create sysfs interface to export data from H_BEST_ENERGY hcall
that can be used by administrative tools on supported pseries
platforms for energy management optimizations.
/sys/device/system/cpu/pseries_(de)activate_hint_list and
/sys/device/system/cpu/cpuN/pseries_(de)activate_hint will provide
hints for activation and deactivation of cpus respectively.
These hints are abstract number given by the hypervisor based
on the extended knowledge the hypervisor has regarding the
current system topology and resource mappings.
The activate and the deactivate sysfs entry is for the two
distinct operations that we could do for energy savings. When
we have more capacity than required, we could deactivate few
core to save energy. The choice of the core to deactivate
will be based on /sys/devices/system/cpu/deactivate_hint_list.
The comma separated list of cpus (cores) will be the preferred
choice. If we have to activate some of the deactivated cores,
then /sys/devices/system/cpu/activate_hint_list will be used.
The per-cpu file
/sys/device/system/cpu/cpuN/pseries_(de)activate_hint further
provide more fine grain information by exporting the value of
the hint itself.
Added new driver module
arch/powerpc/platforms/pseries/pseries_energy.c
under new config option CONFIG_PSERIES_ENERGY
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hvcall.h | 3
arch/powerpc/platforms/pseries/Kconfig | 10 +
arch/powerpc/platforms/pseries/Makefile | 1
arch/powerpc/platforms/pseries/pseries_energy.c | 326 +++++++++++++++++++++++
4 files changed, 339 insertions(+), 1 deletions(-)
create mode 100644 arch/powerpc/platforms/pseries/pseries_energy.c
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 5119b7d..34b66e0 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -231,7 +231,8 @@
#define H_GET_EM_PARMS 0x2B8
#define H_SET_MPP 0x2D0
#define H_GET_MPP 0x2D4
-#define MAX_HCALL_OPCODE H_GET_MPP
+#define H_BEST_ENERGY 0x2F4
+#define MAX_HCALL_OPCODE H_BEST_ENERGY
#ifndef __ASSEMBLY__
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index c667f0f..8323622 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -33,6 +33,16 @@ config PSERIES_MSI
depends on PCI_MSI && EEH
default y
+config PSERIES_ENERGY
+ tristate "pSeries energy management capabilities driver"
+ depends on PPC_PSERIES
+ default y
+ help
+ Provides interface to platform energy management capabilities
+ on supported PSERIES platforms.
+ Provides: /sys/devices/system/cpu/pseries_(de)activation_hint_list
+ and /sys/devices/system/cpu/cpuN/pseries_(de)activation_hint
+
config SCANLOG
tristate "Scanlog dump interface"
depends on RTAS_PROC && PPC_PSERIES
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 3dbef30..32ae72e 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o eeh_sysfs.o
obj-$(CONFIG_KEXEC) += kexec.o
obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
obj-$(CONFIG_PSERIES_MSI) += msi.o
+obj-$(CONFIG_PSERIES_ENERGY) += pseries_energy.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o
obj-$(CONFIG_MEMORY_HOTPLUG) += hotplug-memory.o
diff --git a/arch/powerpc/platforms/pseries/pseries_energy.c b/arch/powerpc/platforms/pseries/pseries_energy.c
new file mode 100644
index 0000000..e217ea3
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/pseries_energy.c
@@ -0,0 +1,326 @@
+/*
+ * POWER platform energy management driver
+ * Copyright (C) 2010 IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This pseries platform device driver provides access to
+ * platform energy management capabilities.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/seq_file.h>
+#include <linux/sysdev.h>
+#include <linux/cpu.h>
+#include <linux/of.h>
+#include <asm/cputhreads.h>
+#include <asm/page.h>
+#include <asm/hvcall.h>
+
+
+#define MODULE_VERS "1.0"
+#define MODULE_NAME "pseries_energy"
+
+/* Driver flags */
+
+static int sysfs_entries;
+
+/* Helper routines */
+
+/*
+ * Routine to detect firmware support for hcall
+ * return 1 if H_BEST_ENERGY is supported
+ * else return 0
+ */
+
+static int check_for_h_best_energy(void)
+{
+ struct device_node *rtas = NULL;
+ const char *hypertas, *s;
+ int length;
+ int rc = 0;
+
+ rtas = of_find_node_by_path("/rtas");
+ if (!rtas)
+ return 0;
+
+ hypertas = of_get_property(rtas, "ibm,hypertas-functions", &length);
+ if (!hypertas) {
+ of_node_put(rtas);
+ return 0;
+ }
+
+ /* hypertas will have list of strings with hcall names */
+ for (s = hypertas; s < hypertas + length; s += strlen(s) + 1) {
+ if (!strncmp("hcall-best-energy-1", s, 19)) {
+ rc = 1; /* Found the string */
+ break;
+ }
+ }
+ of_node_put(rtas);
+ return rc;
+}
+
+/* Helper Routines to convert between drc_index to cpu numbers */
+
+static u32 cpu_to_drc_index(int cpu)
+{
+ struct device_node *dn = NULL;
+ const int *indexes;
+ int i;
+ int rc = 1;
+ u32 ret = 0;
+
+ dn = of_find_node_by_path("/cpus");
+ if (dn == NULL)
+ goto err;
+ indexes = of_get_property(dn, "ibm,drc-indexes", NULL);
+ if (indexes == NULL)
+ goto err_of_node_put;
+ /* Convert logical cpu number to core number */
+ i = cpu_core_of_thread(cpu);
+ /*
+ * The first element indexes[0] is the number of drc_indexes
+ * returned in the list. Hence i+1 will get the drc_index
+ * corresponding to core number i.
+ */
+ WARN_ON(i > indexes[0]);
+ ret = indexes[i + 1];
+ rc = 0;
+
+err_of_node_put:
+ of_node_put(dn);
+err:
+ if (rc)
+ printk(KERN_WARNING "cpu_to_drc_index(%d) failed", cpu);
+ return ret;
+}
+
+static int drc_index_to_cpu(u32 drc_index)
+{
+ struct device_node *dn = NULL;
+ const int *indexes;
+ int i, cpu = 0;
+ int rc = 1;
+
+ dn = of_find_node_by_path("/cpus");
+ if (dn == NULL)
+ goto err;
+ indexes = of_get_property(dn, "ibm,drc-indexes", NULL);
+ if (indexes == NULL)
+ goto err_of_node_put;
+ /*
+ * First element in the array is the number of drc_indexes
+ * returned. Search through the list to find the matching
+ * drc_index and get the core number
+ */
+ for (i = 0; i < indexes[0]; i++) {
+ if (indexes[i + 1] == drc_index)
+ break;
+ }
+ /* Convert core number to logical cpu number */
+ cpu = cpu_first_thread_of_core(i);
+ rc = 0;
+
+err_of_node_put:
+ of_node_put(dn);
+err:
+ if (rc)
+ printk(KERN_WARNING "drc_index_to_cpu(%d) failed", drc_index);
+ return cpu;
+}
+
+/*
+ * pseries hypervisor call H_BEST_ENERGY provides hints to OS on
+ * preferred logical cpus to activate or deactivate for optimized
+ * energy consumption.
+ */
+
+#define FLAGS_MODE1 0x004E200000080E01
+#define FLAGS_MODE2 0x004E200000080401
+#define FLAGS_ACTIVATE 0x100
+
+static ssize_t get_best_energy_list(char *page, int activate)
+{
+ int rc, cnt, i, cpu;
+ unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+ unsigned long flags = 0;
+ u32 *buf_page;
+ char *s = page;
+
+ buf_page = (u32 *) get_zeroed_page(GFP_KERNEL);
+ if (!buf_page)
+ return -ENOMEM;
+
+ flags = FLAGS_MODE1;
+ if (activate)
+ flags |= FLAGS_ACTIVATE;
+
+ rc = plpar_hcall9(H_BEST_ENERGY, retbuf, flags, 0, __pa(buf_page),
+ 0, 0, 0, 0, 0, 0);
+ if (rc != H_SUCCESS) {
+ free_page((unsigned long) buf_page);
+ return -EINVAL;
+ }
+
+ cnt = retbuf[0];
+ for (i = 0; i < cnt; i++) {
+ cpu = drc_index_to_cpu(buf_page[2*i+1]);
+ if ((cpu_online(cpu) && !activate) ||
+ (!cpu_online(cpu) && activate))
+ s += sprintf(s, "%d,", cpu);
+ }
+ if (s > page) { /* Something to show */
+ s--; /* Suppress last comma */
+ s += sprintf(s, "\n");
+ }
+
+ free_page((unsigned long) buf_page);
+ return s-page;
+}
+
+static ssize_t get_best_energy_data(struct sys_device *dev,
+ char *page, int activate)
+{
+ int rc;
+ unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+ unsigned long flags = 0;
+
+ flags = FLAGS_MODE2;
+ if (activate)
+ flags |= FLAGS_ACTIVATE;
+
+ rc = plpar_hcall9(H_BEST_ENERGY, retbuf, flags,
+ cpu_to_drc_index(dev->id),
+ 0, 0, 0, 0, 0, 0, 0);
+
+ if (rc != H_SUCCESS)
+ return -EINVAL;
+
+ return sprintf(page, "%lu\n", retbuf[1] >> 32);
+}
+
+/* Wrapper functions */
+
+static ssize_t cpu_activate_hint_list_show(struct sysdev_class *class,
+ struct sysdev_class_attribute *attr, char *page)
+{
+ return get_best_energy_list(page, 1);
+}
+
+static ssize_t cpu_deactivate_hint_list_show(struct sysdev_class *class,
+ struct sysdev_class_attribute *attr, char *page)
+{
+ return get_best_energy_list(page, 0);
+}
+
+static ssize_t percpu_activate_hint_show(struct sys_device *dev,
+ struct sysdev_attribute *attr, char *page)
+{
+ return get_best_energy_data(dev, page, 1);
+}
+
+static ssize_t percpu_deactivate_hint_show(struct sys_device *dev,
+ struct sysdev_attribute *attr, char *page)
+{
+ return get_best_energy_data(dev, page, 0);
+}
+
+/*
+ * Create sysfs interface:
+ * /sys/devices/system/cpu/pseries_activate_hint_list
+ * /sys/devices/system/cpu/pseries_deactivate_hint_list
+ * Comma separated list of cpus to activate or deactivate
+ * /sys/devices/system/cpu/cpuN/pseries_activate_hint
+ * /sys/devices/system/cpu/cpuN/pseries_deactivate_hint
+ * Per-cpu value of the hint
+ */
+
+struct sysdev_class_attribute attr_cpu_activate_hint_list =
+ _SYSDEV_CLASS_ATTR(pseries_activate_hint_list, 0444,
+ cpu_activate_hint_list_show, NULL);
+
+struct sysdev_class_attribute attr_cpu_deactivate_hint_list =
+ _SYSDEV_CLASS_ATTR(pseries_deactivate_hint_list, 0444,
+ cpu_deactivate_hint_list_show, NULL);
+
+struct sysdev_attribute attr_percpu_activate_hint =
+ _SYSDEV_ATTR(pseries_activate_hint, 0444,
+ percpu_activate_hint_show, NULL);
+
+struct sysdev_attribute attr_percpu_deactivate_hint =
+ _SYSDEV_ATTR(pseries_deactivate_hint, 0444,
+ percpu_deactivate_hint_show, NULL);
+
+static int __init pseries_energy_init(void)
+{
+ int cpu, err;
+ struct sys_device *cpu_sys_dev;
+
+ if (!check_for_h_best_energy()) {
+ printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n");
+ return 0;
+ }
+ /* Create the sysfs files */
+ err = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
+ &attr_cpu_activate_hint_list.attr);
+ if (!err)
+ err = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
+ &attr_cpu_deactivate_hint_list.attr);
+
+ if (err)
+ return err;
+ for_each_possible_cpu(cpu) {
+ cpu_sys_dev = get_cpu_sysdev(cpu);
+ err = sysfs_create_file(&cpu_sys_dev->kobj,
+ &attr_percpu_activate_hint.attr);
+ if (err)
+ break;
+ err = sysfs_create_file(&cpu_sys_dev->kobj,
+ &attr_percpu_deactivate_hint.attr);
+ if (err)
+ break;
+ }
+
+ if (err)
+ return err;
+
+ sysfs_entries = 1; /* Removed entries on cleanup */
+ return 0;
+
+}
+
+static void __exit pseries_energy_cleanup(void)
+{
+ int cpu;
+ struct sys_device *cpu_sys_dev;
+
+ if (!sysfs_entries)
+ return;
+
+ /* Remove the sysfs files */
+ sysfs_remove_file(&cpu_sysdev_class.kset.kobj,
+ &attr_cpu_activate_hint_list.attr);
+
+ sysfs_remove_file(&cpu_sysdev_class.kset.kobj,
+ &attr_cpu_deactivate_hint_list.attr);
+
+ for_each_possible_cpu(cpu) {
+ cpu_sys_dev = get_cpu_sysdev(cpu);
+ sysfs_remove_file(&cpu_sys_dev->kobj,
+ &attr_percpu_activate_hint.attr);
+ sysfs_remove_file(&cpu_sys_dev->kobj,
+ &attr_percpu_deactivate_hint.attr);
+ }
+}
+
+module_init(pseries_energy_init);
+module_exit(pseries_energy_cleanup);
+MODULE_DESCRIPTION("Driver for pSeries platform energy management");
+MODULE_AUTHOR("Vaidyanathan Srinivasan");
+MODULE_LICENSE("GPL");
^ permalink raw reply related
* [PATCH v4 1/2] powerpc: cleanup APIs for cpu/thread/core mappings
From: Vaidyanathan Srinivasan @ 2010-07-22 0:57 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Anton Blanchard
Cc: Michael Neuling, linuxppc-dev
In-Reply-To: <20100722005219.12905.49197.stgit@drishya.in.ibm.com>
These APIs take logical cpu number as input
Change cpu_first_thread_in_core() to cpu_leftmost_thread_sibling()
Change cpu_last_thread_in_core() to cpu_rightmost_thread_sibling()
These APIs convert core number (index) to logical cpu/thread numbers
Add cpu_first_thread_of_core(int core)
Changed cpu_thread_to_core() to cpu_core_of_thread(int cpu)
The goal is to make 'threads_per_core' accessible to the
pseries_energy module. Instead of making an API to read
threads_per_core, this is a higher level wrapper function to
convert from logical cpu number to core number.
The current APIs cpu_first_thread_in_core() and
cpu_last_thread_in_core() returns logical CPU number while
cpu_thread_to_core() returns core number or index which is
not a logical CPU number. The APIs are now clearly named to
distinguish 'core number' versus first and last 'logical cpu
number' in that core.
The new APIs cpu_{left,right}most_thread_sibling() work on
logical cpu numbers. While cpu_first_thread_of_core() and
cpu_core_of_thread() work on core index.
Example usage: (4 threads per core system)
cpu_leftmost_thread_sibling(5) = 4
cpu_rightmost_thread_sibling(5) = 7
cpu_core_of_thread(5) = 1
cpu_first_thread_of_core(1) = 4
cpu_core_of_thread() is used in cpu_to_drc_index() in the
module and cpu_first_thread_of_core() is used in
drc_index_to_cpu() in the module.
Made API changes to few callers. Exported symbols for use
in modules.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/cputhreads.h | 15 +++++++++------
arch/powerpc/kernel/smp.c | 19 ++++++++++++++++---
arch/powerpc/mm/mmu_context_nohash.c | 12 ++++++------
3 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h
index a8e1844..26dc6bd 100644
--- a/arch/powerpc/include/asm/cputhreads.h
+++ b/arch/powerpc/include/asm/cputhreads.h
@@ -61,22 +61,25 @@ static inline cpumask_t cpu_online_cores_map(void)
return cpu_thread_mask_to_cores(cpu_online_map);
}
-static inline int cpu_thread_to_core(int cpu)
-{
- return cpu >> threads_shift;
-}
+#ifdef CONFIG_SMP
+int cpu_core_of_thread(int cpu);
+int cpu_first_thread_of_core(int core);
+#else
+static inline int cpu_core_of_thread(int cpu) { return cpu; }
+static inline int cpu_first_thread_of_core(int core) { return core; }
+#endif
static inline int cpu_thread_in_core(int cpu)
{
return cpu & (threads_per_core - 1);
}
-static inline int cpu_first_thread_in_core(int cpu)
+static inline int cpu_leftmost_thread_sibling(int cpu)
{
return cpu & ~(threads_per_core - 1);
}
-static inline int cpu_last_thread_in_core(int cpu)
+static inline int cpu_rightmost_thread_sibling(int cpu)
{
return cpu | (threads_per_core - 1);
}
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5c196d1..da4c2f8 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -468,7 +468,20 @@ out:
return id;
}
-/* Must be called when no change can occur to cpu_present_mask,
+/* Helper routines for cpu to core mapping */
+int cpu_core_of_thread(int cpu)
+{
+ return cpu >> threads_shift;
+}
+EXPORT_SYMBOL_GPL(cpu_core_of_thread);
+
+int cpu_first_thread_of_core(int core)
+{
+ return core << threads_shift;
+}
+EXPORT_SYMBOL_GPL(cpu_first_thread_of_core);
+
+/* Must be called when no change can occur to cpu_present_map,
* i.e. during cpu online or offline.
*/
static struct device_node *cpu_to_l2cache(int cpu)
@@ -527,7 +540,7 @@ int __devinit start_secondary(void *unused)
notify_cpu_starting(cpu);
set_cpu_online(cpu, true);
/* Update sibling maps */
- base = cpu_first_thread_in_core(cpu);
+ base = cpu_leftmost_thread_sibling(cpu);
for (i = 0; i < threads_per_core; i++) {
if (cpu_is_offline(base + i))
continue;
@@ -606,7 +619,7 @@ int __cpu_disable(void)
return err;
/* Update sibling maps */
- base = cpu_first_thread_in_core(cpu);
+ base = cpu_leftmost_thread_sibling(cpu);
for (i = 0; i < threads_per_core; i++) {
cpumask_clear_cpu(cpu, cpu_sibling_mask(base + i));
cpumask_clear_cpu(base + i, cpu_sibling_mask(cpu));
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index ddfd7ad..22f3bc5 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -111,8 +111,8 @@ static unsigned int steal_context_smp(unsigned int id)
* a core map instead but this will do for now.
*/
for_each_cpu(cpu, mm_cpumask(mm)) {
- for (i = cpu_first_thread_in_core(cpu);
- i <= cpu_last_thread_in_core(cpu); i++)
+ for (i = cpu_leftmost_thread_sibling(cpu);
+ i <= cpu_rightmost_thread_sibling(cpu); i++)
__set_bit(id, stale_map[i]);
cpu = i - 1;
}
@@ -264,14 +264,14 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
*/
if (test_bit(id, stale_map[cpu])) {
pr_hardcont(" | stale flush %d [%d..%d]",
- id, cpu_first_thread_in_core(cpu),
- cpu_last_thread_in_core(cpu));
+ id, cpu_leftmost_thread_sibling(cpu),
+ cpu_rightmost_thread_sibling(cpu));
local_flush_tlb_mm(next);
/* XXX This clear should ultimately be part of local_flush_tlb_mm */
- for (i = cpu_first_thread_in_core(cpu);
- i <= cpu_last_thread_in_core(cpu); i++) {
+ for (i = cpu_leftmost_thread_sibling(cpu);
+ i <= cpu_rightmost_thread_sibling(cpu); i++) {
__clear_bit(id, stale_map[i]);
}
}
^ permalink raw reply related
* [PATCH v4 0/2] powerpc: add support for new hcall H_BEST_ENERGY
From: Vaidyanathan Srinivasan @ 2010-07-22 0:57 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Anton Blanchard
Cc: Michael Neuling, linuxppc-dev
Hi Ben,
The following series adds a kernel module for powerpc pseries
platforms in order to export platform energy management capabilities.
The module exports data from a new hypervisor call H_BEST_ENERGY.
Some of the comments and suggestions made on the previous iteration of the
patch has been incorporated.
Changes in v4:
* Added more documentation
* Added check_for_h_best_energy() to look in ibm,hypertas-functions so
that sysfs entries are not created in an unsupported platform
* Added cleaner error checks and correct of_node_put()
* Rebased and tested on 2.6.35-rc5
Changed in v3:
[3] [PATCH v3 0/2] powerpc: add support for new hcall H_BEST_ENERGY
http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-June/083414.html
* Added more documentation in the cleanup patch
* Removed RFC tag, rebased and tested on 2.6.35-rc3
* Ready for inclusion in powerpc/next tree for further testing
Changes in v2:
[2] [RFC PATCH v2 0/2] powerpc: add support for new hcall H_BEST_ENERGY
http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-May/082246.html
* Cleanup cpu/thread/core APIs
* Export APIs to module instead of threads_per_core
* Use of_find_node_by_path() instead of of_find_node_by_name()
* Error checking and whitespace cleanups
First version:
[1] [RFC] powerpc: add support for new hcall H_BEST_ENERGY
http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-March/080796.html
This patch series will apply on 2.6.35-rc5 as well as powerpc/next
tree. Please review and include in powerpc/next tree for further
testing.
I could incrementally reduce some of the error checks as suggested by
Michael Neuling as next steps.
Thanks,
Vaidy
---
Vaidyanathan Srinivasan (2):
powerpc: cleanup APIs for cpu/thread/core mappings
powerpc: add support for new hcall H_BEST_ENERGY
arch/powerpc/include/asm/cputhreads.h | 15 +
arch/powerpc/include/asm/hvcall.h | 3
arch/powerpc/kernel/smp.c | 19 +
arch/powerpc/mm/mmu_context_nohash.c | 12 -
arch/powerpc/platforms/pseries/Kconfig | 10 +
arch/powerpc/platforms/pseries/Makefile | 1
arch/powerpc/platforms/pseries/pseries_energy.c | 326 +++++++++++++++++++++++
7 files changed, 370 insertions(+), 16 deletions(-)
create mode 100644 arch/powerpc/platforms/pseries/pseries_energy.c
^ permalink raw reply
* Re: [alsa-devel] [PATCH] powerpc: rename immap_86xx.h to fsl_guts.h, and add 85xx support
From: Timur Tabi @ 2010-07-22 0:28 UTC (permalink / raw)
To: alsa-devel, linuxppc-dev, lrg, broonie, kumar.gala
In-Reply-To: <1279749902-13459-1-git-send-email-timur@freescale.com>
On Wed, Jul 21, 2010 at 5:05 PM, Timur Tabi <timur@freescale.com> wrote:
> The immap_86xx.h header file only defines one data structure: the "global
> utilities" register set found on Freescale PowerPC SOCs. =A0Rename this f=
ile
> to fsl_guts.h to reflect its true purpose, and extend it to cover the "GU=
TS"
> register set on 85xx chips.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
Argh, I forgot to add the text to explain e500 vs. e600.
V2 coming.
--=20
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH 1/5] drivercore/of: Add OF style matching to platform bus
From: Greg KH @ 2010-07-22 0:07 UTC (permalink / raw)
To: Grant Likely
Cc: Stephen Rothwell, Michal Simek, microblaze-uclinux, linux-kernel,
linuxppc-dev, sparclinux, David Miller
In-Reply-To: <20100721233954.7782.81154.stgit@angua>
On Wed, Jul 21, 2010 at 05:39:54PM -0600, Grant Likely wrote:
> As part of the merge between platform bus and of_platform bus, add the
> ability to do of-style matching to the platform bus.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> CC: Greg Kroah-Hartman <gregkh@suse.de>
> CC: Michal Simek <monstr@monstr.eu>
> CC: Grant Likely <grant.likely@secretlab.ca>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Stephen Rothwell <sfr@canb.auug.org.au>
> CC: linux-kernel@vger.kernel.org
> CC: microblaze-uclinux@itee.uq.edu.au
> CC: linuxppc-dev@ozlabs.org
> CC: devicetree-discuss@lists.ozlabs.org
> ---
> drivers/base/platform.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 4d99c8b..6a9b3dd 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -12,6 +12,7 @@
>
> #include <linux/string.h>
> #include <linux/platform_device.h>
> +#include <linux/of_device.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/dma-mapping.h>
> @@ -673,6 +674,10 @@ static int platform_match(struct device *dev, struct device_driver *drv)
> struct platform_device *pdev = to_platform_device(dev);
> struct platform_driver *pdrv = to_platform_driver(drv);
>
> + /* Attempt an OF style match first */
> + if (of_driver_match_device(dev, drv))
> + return 1;
> +
> /* match against the id table first */
I think you need to also change this comment, you can't have two
"firsts" :)
If you do that, feel free to add an:
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
to the patch.
thanks,
greg k-h
^ permalink raw reply
* [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace
From: Dmitry Eremin-Solenikov @ 2010-07-22 0:03 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Doug Thompson, Dave Jiang, bluesmoke-devel
In-Reply-To: <1279756992-29543-1-git-send-email-dbaryshkov@gmail.com>
Currently (as mpc8540-pci) devices are not created on of_platform bus,
mpc85xx_edac can't probe to them. Follow the change to dts trees to bind
not to the main mpc8540-pci node but to special mpc85xx-pci-error nodes,
present on soc bus.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
drivers/edac/mpc85xx_edac.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 52ca09b..d5a61b8 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -236,9 +236,6 @@ static int __devinit mpc85xx_pci_err_probe(struct of_device *op,
goto err;
}
- /* we only need the error registers */
- r.start += 0xe00;
-
if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
pdata->name)) {
printk(KERN_ERR "%s: Error while requesting mem region\n",
@@ -328,12 +325,15 @@ static int mpc85xx_pci_err_remove(struct of_device *op)
}
static struct of_device_id mpc85xx_pci_err_of_match[] = {
- {
- .compatible = "fsl,mpc8540-pcix",
- },
- {
- .compatible = "fsl,mpc8540-pci",
- },
+ { .compatible = "fsl,mpc8536-pci-error", },
+ { .compatible = "fsl,mpc8540-pci-error", },
+ { .compatible = "fsl,mpc8541-pci-error", },
+ { .compatible = "fsl,mpc8544-pci-error", },
+ { .compatible = "fsl,mpc8548-pci-error", },
+ { .compatible = "fsl,mpc8555-pci-error", },
+ { .compatible = "fsl,mpc8560-pci-error", },
+ { .compatible = "fsl,mpc8568-pci-error", },
+ { .compatible = "fsl,mpc8572-pci-error", },
{},
};
--
1.7.1
^ permalink raw reply related
* [PATCH 1/2] MPC85xx: add definitions for PCI error detection soc part
From: Dmitry Eremin-Solenikov @ 2010-07-22 0:03 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Doug Thompson, Dave Jiang, bluesmoke-devel
Add definitions for PCI error detection device to be handled by (already
existing) mpc85xx_edac.c driver.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
arch/powerpc/boot/dts/mpc8536ds.dts | 7 +++++++
arch/powerpc/boot/dts/mpc8536ds_36b.dts | 7 +++++++
arch/powerpc/boot/dts/mpc8540ads.dts | 8 ++++++++
arch/powerpc/boot/dts/mpc8541cds.dts | 14 ++++++++++++++
arch/powerpc/boot/dts/mpc8544ds.dts | 7 +++++++
arch/powerpc/boot/dts/mpc8548cds.dts | 14 ++++++++++++++
arch/powerpc/boot/dts/mpc8555cds.dts | 14 ++++++++++++++
arch/powerpc/boot/dts/mpc8560ads.dts | 7 +++++++
arch/powerpc/boot/dts/mpc8568mds.dts | 7 +++++++
arch/powerpc/boot/dts/sbc8548.dts | 7 +++++++
arch/powerpc/boot/dts/sbc8560.dts | 7 +++++++
arch/powerpc/boot/dts/socrates.dts | 7 +++++++
arch/powerpc/boot/dts/stx_gp3_8560.dts | 7 +++++++
arch/powerpc/boot/dts/tqm8540.dts | 10 ++++++++++
arch/powerpc/boot/dts/tqm8541.dts | 7 +++++++
arch/powerpc/boot/dts/tqm8548-bigflash.dts | 7 +++++++
arch/powerpc/boot/dts/tqm8548.dts | 7 +++++++
arch/powerpc/boot/dts/tqm8555.dts | 7 +++++++
arch/powerpc/boot/dts/tqm8560.dts | 7 +++++++
arch/powerpc/boot/dts/xpedite5200.dts | 7 +++++++
arch/powerpc/boot/dts/xpedite5200_xmon.dts | 7 +++++++
21 files changed, 172 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dts b/arch/powerpc/boot/dts/mpc8536ds.dts
index 815cebb..6c02e5a 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds.dts
@@ -278,6 +278,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8536-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
crypto@30000 {
compatible = "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2",
"fsl,sec2.1", "fsl,sec2.0";
diff --git a/arch/powerpc/boot/dts/mpc8536ds_36b.dts b/arch/powerpc/boot/dts/mpc8536ds_36b.dts
index d95b260..89ef5c1 100644
--- a/arch/powerpc/boot/dts/mpc8536ds_36b.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds_36b.dts
@@ -278,6 +278,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8536-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
crypto@30000 {
compatible = "fsl,sec3.0", "fsl,sec2.4", "fsl,sec2.2",
"fsl,sec2.1", "fsl,sec2.0";
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index 9dc2929..d89f470 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -259,6 +259,14 @@
interrupts = <42 2>;
interrupt-parent = <&mpic>;
};
+
+ pci-error@8e00 {
+ compatible = "fsl,mpc8540-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
mpic: pic@40000 {
interrupt-controller;
#address-cells = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index 9a3ad31..c2c5732 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -226,6 +226,20 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8541-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
+ pci-error@9e00 {
+ compatible = "fsl,mpc8541-pci-error";
+ reg = <0x9e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <25 2>;
+ };
+
crypto@30000 {
compatible = "fsl,sec2.0";
reg = <0x30000 0x10000>;
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 98e94b4..387da1f 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -242,6 +242,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8544-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
global-utilities@e0000 { //global utilities block
compatible = "fsl,mpc8548-guts";
reg = <0xe0000 0x1000>;
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index 0f52624..973966e 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -328,6 +328,20 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
+ pci-error@9e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x9e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <25 2>;
+ };
+
global-utilities@e0000 { //global utilities reg
compatible = "fsl,mpc8548-guts";
reg = <0xe0000 0x1000>;
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index 065b2f0..bcdc344 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -226,6 +226,20 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8555-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
+ pci-error@9e00 {
+ compatible = "fsl,mpc8555-pci-error";
+ reg = <0x9e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <25 2>;
+ };
+
crypto@30000 {
compatible = "fsl,sec2.0";
reg = <0x30000 0x10000>;
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index a5bb1ec..04bc095 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -216,6 +216,13 @@
device_type = "open-pic";
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8560-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
cpm@919c0 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 92fb178..66af3ab 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -329,6 +329,13 @@
};
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8568-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
global-utilities@e0000 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/sbc8548.dts b/arch/powerpc/boot/dts/sbc8548.dts
index 94a3322..002428c 100644
--- a/arch/powerpc/boot/dts/sbc8548.dts
+++ b/arch/powerpc/boot/dts/sbc8548.dts
@@ -333,6 +333,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
global-utilities@e0000 { //global utilities reg
compatible = "fsl,mpc8548-guts";
reg = <0xe0000 0x1000>;
diff --git a/arch/powerpc/boot/dts/sbc8560.dts b/arch/powerpc/boot/dts/sbc8560.dts
index 9e13ed8..1dc389a 100644
--- a/arch/powerpc/boot/dts/sbc8560.dts
+++ b/arch/powerpc/boot/dts/sbc8560.dts
@@ -239,6 +239,13 @@
device_type = "open-pic";
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8560-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
cpm@919c0 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/socrates.dts b/arch/powerpc/boot/dts/socrates.dts
index feb4ef6..06b08f5 100644
--- a/arch/powerpc/boot/dts/socrates.dts
+++ b/arch/powerpc/boot/dts/socrates.dts
@@ -216,6 +216,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8544-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
global-utilities@e0000 { //global utilities block
compatible = "fsl,mpc8548-guts";
reg = <0xe0000 0x1000>;
diff --git a/arch/powerpc/boot/dts/stx_gp3_8560.dts b/arch/powerpc/boot/dts/stx_gp3_8560.dts
index b670d03..78e9e22 100644
--- a/arch/powerpc/boot/dts/stx_gp3_8560.dts
+++ b/arch/powerpc/boot/dts/stx_gp3_8560.dts
@@ -213,6 +213,13 @@
device_type = "open-pic";
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8560-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
cpm@919c0 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/tqm8540.dts b/arch/powerpc/boot/dts/tqm8540.dts
index b5c0940..3e73e35 100644
--- a/arch/powerpc/boot/dts/tqm8540.dts
+++ b/arch/powerpc/boot/dts/tqm8540.dts
@@ -160,6 +160,7 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <29 2 30 2 34 2>;
interrupt-parent = <&mpic>;
+ tbi-handle = <&tbi0>;
phy-handle = <&phy2>;
mdio@520 {
@@ -205,6 +206,7 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <35 2 36 2 40 2>;
interrupt-parent = <&mpic>;
+ tbi-handle = <&tbi1>;
phy-handle = <&phy1>;
mdio@520 {
@@ -232,6 +234,7 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <41 2>;
interrupt-parent = <&mpic>;
+ tbi-handle = <&tbi2>;
phy-handle = <&phy3>;
mdio@520 {
@@ -276,6 +279,13 @@
device_type = "open-pic";
compatible = "chrp,open-pic";
};
+
+ pci-error@8e00 {
+ compatible = "fsl,mpc8540-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
};
pci0: pci@e0008000 {
diff --git a/arch/powerpc/boot/dts/tqm8541.dts b/arch/powerpc/boot/dts/tqm8541.dts
index f49d091..92106fc 100644
--- a/arch/powerpc/boot/dts/tqm8541.dts
+++ b/arch/powerpc/boot/dts/tqm8541.dts
@@ -261,6 +261,13 @@
compatible = "chrp,open-pic";
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8541-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
cpm@919c0 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/tqm8548-bigflash.dts b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
index 5dbb36e..b1944a1 100644
--- a/arch/powerpc/boot/dts/tqm8548-bigflash.dts
+++ b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
@@ -338,6 +338,13 @@
compatible = "chrp,open-pic";
device_type = "open-pic";
};
+
+ pci-error@8e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
};
localbus@a0005000 {
diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
index a050ae4..be2b1de 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -338,6 +338,13 @@
compatible = "chrp,open-pic";
device_type = "open-pic";
};
+
+ pci-error@8e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
};
localbus@e0005000 {
diff --git a/arch/powerpc/boot/dts/tqm8555.dts b/arch/powerpc/boot/dts/tqm8555.dts
index 81bad8c..7b64c71 100644
--- a/arch/powerpc/boot/dts/tqm8555.dts
+++ b/arch/powerpc/boot/dts/tqm8555.dts
@@ -261,6 +261,13 @@
compatible = "chrp,open-pic";
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8555-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
cpm@919c0 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/tqm8560.dts b/arch/powerpc/boot/dts/tqm8560.dts
index 22ec39b..82408d5 100644
--- a/arch/powerpc/boot/dts/tqm8560.dts
+++ b/arch/powerpc/boot/dts/tqm8560.dts
@@ -232,6 +232,13 @@
compatible = "chrp,open-pic";
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8560-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
cpm@919c0 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/xpedite5200.dts b/arch/powerpc/boot/dts/xpedite5200.dts
index a0cf53f..211dbbf 100644
--- a/arch/powerpc/boot/dts/xpedite5200.dts
+++ b/arch/powerpc/boot/dts/xpedite5200.dts
@@ -352,6 +352,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
global-utilities@e0000 { // global utilities reg
compatible = "fsl,mpc8548-guts";
reg = <0xe0000 0x1000>;
diff --git a/arch/powerpc/boot/dts/xpedite5200_xmon.dts b/arch/powerpc/boot/dts/xpedite5200_xmon.dts
index c5b2975..ebe9365 100644
--- a/arch/powerpc/boot/dts/xpedite5200_xmon.dts
+++ b/arch/powerpc/boot/dts/xpedite5200_xmon.dts
@@ -356,6 +356,13 @@
interrupt-parent = <&mpic>;
};
+ pci-error@8e00 {
+ compatible = "fsl,mpc8548-pci-error";
+ reg = <0x8e00 0x100>;
+ interrupt-parent = <&mpic>;
+ interrupts = <24 2>;
+ };
+
global-utilities@e0000 { // global utilities reg
compatible = "fsl,mpc8548-guts";
reg = <0xe0000 0x1000>;
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox