* Re: [PATCH 0/15] Hypervisor-mode KVM on POWER7 and PPC970
From: Benjamin Herrenschmidt @ 2011-06-22 6:17 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Dmitry Eremin-Solenikov, linuxppc-dev
In-Reply-To: <20110622032013.GA28610@bloggs.ozlabs.ibm.com>
On Wed, 2011-06-22 at 13:20 +1000, Paul Mackerras wrote:
> On Tue, Jun 21, 2011 at 02:18:39PM +0000, Dmitry Eremin-Solenikov wrote:
>
> > I have a Maple board (dual PPC970FX). Will this patchset work on it?
> > Should I add any additional changes to add support for this platform?
>
> Provided the firmware gives you control in hypervisor mode, yes it
> should work, and I don't know of any extra changes you would need.
> I don't recall what firmware the Maple boards had on them, though.
I think it's more specifically whether the FW of the service processor
configure the mode rings of the 970 to "Apple" mode or not.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] powerpc/85xx: fix NAND_CMD_READID read bytes number
From: Artem Bityutskiy @ 2011-06-22 5:32 UTC (permalink / raw)
To: Shaohui Xie; +Cc: scottwood, linux-mtd, linuxppc-dev
In-Reply-To: <1307931792-30386-1-git-send-email-Shaohui.Xie@freescale.com>
On Mon, 2011-06-13 at 10:23 +0800, Shaohui Xie wrote:
> when nand_get_flash_type() is called, it will read 8 bytes of ID instead of 5,
> but the driver only read 5 bytes, so kernel will dump error messages like:
>
> fsl-lbc ffe124000.localbus: read_byte beyond end of buffer
> fsl-lbc ffe124000.localbus: read_byte beyond end of buffer
> fsl-lbc ffe124000.localbus: read_byte beyond end of buffer
>
Thanks!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply
* Re: [PATCH 0/15] Hypervisor-mode KVM on POWER7 and PPC970
From: Paul Mackerras @ 2011-06-22 3:20 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linuxppc-dev
In-Reply-To: <itq97v$dc$1@dough.gmane.org>
On Tue, Jun 21, 2011 at 02:18:39PM +0000, Dmitry Eremin-Solenikov wrote:
> I have a Maple board (dual PPC970FX). Will this patchset work on it?
> Should I add any additional changes to add support for this platform?
Provided the firmware gives you control in hypervisor mode, yes it
should work, and I don't know of any extra changes you would need.
I don't recall what firmware the Maple boards had on them, though.
Paul.
^ permalink raw reply
* Re: [PATCH] fsl-diu-fb: remove the ioctl interface
From: Tabi Timur-B04825 @ 2011-06-21 23:13 UTC (permalink / raw)
To: Anatolij Gustschin
Cc: sun york-R58495, linux-fbdev@vger.kernel.org, lethal@linux-sh.org,
Tabi Timur-B04825, linuxppc-dev@ozlabs.org
In-Reply-To: <20110622003853.1041385c@wker>
Anatolij Gustschin wrote:
> No! We are using ioctl interface of this driver in many video
> rendering applications on overlay planes on huge number of boards.
> So, please don't remove it.
Ok, I had no idea anyone was using it.
Can you email me details about how you use the ioctl interface? If I can't=
=20
remove it, maybe I can clean it up.
--=20
Timur Tabi
Linux kernel developer at Freescale=
^ permalink raw reply
* Re: [PATCH] fsl-diu-fb: remove the ioctl interface
From: Anatolij Gustschin @ 2011-06-21 22:38 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, linux-fbdev, lethal, yorksun
In-Reply-To: <1308691655-3416-1-git-send-email-timur@freescale.com>
On Tue, 21 Jun 2011 16:27:35 -0500
Timur Tabi <timur@freescale.com> wrote:
> The ioctl interface in the Freescale DIU framebuffer driver is just a
> collection of miscellaneous functions which were only used in a one-time
> demo application that was never distributed. Plus, the ioctls were spread
> across two types (both conflicting), and the demo app didn't even use all
> of them.
>
> Removing the ioctl interface also allows us to clean up the header file and
> remove other unusued stuff.
No! We are using ioctl interface of this driver in many video
rendering applications on overlay planes on huge number of boards.
So, please don't remove it.
Anatolij
^ permalink raw reply
* [PATCH] fsl-diu-fb: remove the ioctl interface
From: Timur Tabi @ 2011-06-21 21:27 UTC (permalink / raw)
To: lethal, linux-fbdev, agust, yorksun, linuxppc-dev
The ioctl interface in the Freescale DIU framebuffer driver is just a
collection of miscellaneous functions which were only used in a one-time
demo application that was never distributed. Plus, the ioctls were spread
across two types (both conflicting), and the demo app didn't even use all
of them.
Removing the ioctl interface also allows us to clean up the header file and
remove other unusued stuff.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
There's a warning about dummy_ad_addr that will be fixed in a future patch.
Documentation/ioctl/ioctl-number.txt | 2 -
drivers/video/fsl-diu-fb.c | 157 ++++++++++------------------------
include/linux/fsl-diu-fb.h | 94 --------------------
3 files changed, 44 insertions(+), 209 deletions(-)
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 3a46e36..6c83c07 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -108,7 +108,6 @@ Code Seq#(hex) Include File Comments
'E' 00-0F xen/evtchn.h conflict!
'F' all linux/fb.h conflict!
'F' 01-02 drivers/scsi/pmcraid.h conflict!
-'F' 20 drivers/video/fsl-diu-fb.h conflict!
'F' 20 drivers/video/intelfb/intelfb.h conflict!
'F' 20 linux/ivtvfb.h conflict!
'F' 20 linux/matroxfb.h conflict!
@@ -147,7 +146,6 @@ Code Seq#(hex) Include File Comments
'M' 01-16 mtd/mtd-abi.h conflict!
and drivers/mtd/mtdchar.c
'M' 01-03 drivers/scsi/megaraid/megaraid_sas.h
-'M' 00-0F drivers/video/fsl-diu-fb.h conflict!
'N' 00-1F drivers/usb/scanner.h
'O' 00-06 mtd/ubi-user.h UBI
'P' all linux/soundcard.h conflict!
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index bedf5be..db2abaf 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -37,6 +37,50 @@
#include <linux/fsl-diu-fb.h>
#include "edid.h"
+/* Minimum value that the pixel clock can be set to in pico seconds
+ * This is determined by platform clock/3 where the minimum platform
+ * clock is 533MHz. This gives 5629 pico seconds.
+ */
+#define MIN_PIX_CLK 5629
+#define MAX_PIX_CLK 96096
+
+#define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */
+
+/* INT_STATUS/INT_MASK field descriptions */
+#define INT_VSYNC 0x01 /* Vsync interrupt */
+#define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */
+#define INT_UNDRUN 0x04 /* Under run exception interrupt */
+#define INT_PARERR 0x08 /* Display parameters error interrupt */
+#define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */
+
+/* Panels'operation modes */
+#define MFB_TYPE_OUTPUT 0 /* Panel output to display */
+#define MFB_TYPE_OFF 1 /* Panel off */
+#define MFB_TYPE_WB 2 /* Panel written back to memory */
+#define MFB_TYPE_TEST 3 /* Panel generate color bar */
+
+/* HW cursor parameters */
+#define MAX_CURS 32
+
+struct diu_hw {
+ struct diu *diu_reg;
+ spinlock_t reg_lock;
+ __u32 mode; /* DIU operation mode */
+};
+
+struct diu_addr {
+ __u8 __iomem *vaddr; /* Virtual address */
+ dma_addr_t paddr; /* Physical address */
+ __u32 offset;
+};
+
+struct diu_pool {
+ struct diu_addr ad;
+ struct diu_addr gamma;
+ struct diu_addr pallete;
+ struct diu_addr cursor;
+};
+
/*
* These parameters give default parameters
* for video output 1024x768,
@@ -991,118 +1035,6 @@ static int fsl_diu_blank(int blank_mode, struct fb_info *info)
return 0;
}
-static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
- unsigned long arg)
-{
- struct mfb_info *mfbi = info->par;
- struct diu_ad *ad = mfbi->ad;
- struct mfb_chroma_key ck;
- unsigned char global_alpha;
- struct aoi_display_offset aoi_d;
- __u32 pix_fmt;
- void __user *buf = (void __user *)arg;
-
- if (!arg)
- return -EINVAL;
- switch (cmd) {
- case MFB_SET_PIXFMT:
- if (copy_from_user(&pix_fmt, buf, sizeof(pix_fmt)))
- return -EFAULT;
- ad->pix_fmt = pix_fmt;
- pr_debug("Set pixel format to 0x%08x\n", ad->pix_fmt);
- break;
- case MFB_GET_PIXFMT:
- pix_fmt = ad->pix_fmt;
- if (copy_to_user(buf, &pix_fmt, sizeof(pix_fmt)))
- return -EFAULT;
- pr_debug("get pixel format 0x%08x\n", ad->pix_fmt);
- break;
- case MFB_SET_AOID:
- if (copy_from_user(&aoi_d, buf, sizeof(aoi_d)))
- return -EFAULT;
- mfbi->x_aoi_d = aoi_d.x_aoi_d;
- mfbi->y_aoi_d = aoi_d.y_aoi_d;
- pr_debug("set AOI display offset of index %d to (%d,%d)\n",
- mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d);
- fsl_diu_check_var(&info->var, info);
- fsl_diu_set_aoi(info);
- break;
- case MFB_GET_AOID:
- aoi_d.x_aoi_d = mfbi->x_aoi_d;
- aoi_d.y_aoi_d = mfbi->y_aoi_d;
- if (copy_to_user(buf, &aoi_d, sizeof(aoi_d)))
- return -EFAULT;
- pr_debug("get AOI display offset of index %d (%d,%d)\n",
- mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d);
- break;
- case MFB_GET_ALPHA:
- global_alpha = mfbi->g_alpha;
- if (copy_to_user(buf, &global_alpha, sizeof(global_alpha)))
- return -EFAULT;
- pr_debug("get global alpha of index %d\n", mfbi->index);
- break;
- case MFB_SET_ALPHA:
- /* set panel information */
- if (copy_from_user(&global_alpha, buf, sizeof(global_alpha)))
- return -EFAULT;
- ad->src_size_g_alpha = (ad->src_size_g_alpha & (~0xff)) |
- (global_alpha & 0xff);
- mfbi->g_alpha = global_alpha;
- pr_debug("set global alpha for index %d\n", mfbi->index);
- break;
- case MFB_SET_CHROMA_KEY:
- /* set panel winformation */
- if (copy_from_user(&ck, buf, sizeof(ck)))
- return -EFAULT;
-
- if (ck.enable &&
- (ck.red_max < ck.red_min ||
- ck.green_max < ck.green_min ||
- ck.blue_max < ck.blue_min))
- return -EINVAL;
-
- if (!ck.enable) {
- ad->ckmax_r = 0;
- ad->ckmax_g = 0;
- ad->ckmax_b = 0;
- ad->ckmin_r = 255;
- ad->ckmin_g = 255;
- ad->ckmin_b = 255;
- } else {
- ad->ckmax_r = ck.red_max;
- ad->ckmax_g = ck.green_max;
- ad->ckmax_b = ck.blue_max;
- ad->ckmin_r = ck.red_min;
- ad->ckmin_g = ck.green_min;
- ad->ckmin_b = ck.blue_min;
- }
- pr_debug("set chroma key\n");
- break;
- case FBIOGET_GWINFO:
- if (mfbi->type == MFB_TYPE_OFF)
- return -ENODEV;
- /* get graphic window information */
- if (copy_to_user(buf, ad, sizeof(*ad)))
- return -EFAULT;
- break;
- case FBIOGET_HWCINFO:
- pr_debug("FBIOGET_HWCINFO:0x%08x\n", FBIOGET_HWCINFO);
- break;
- case FBIOPUT_MODEINFO:
- pr_debug("FBIOPUT_MODEINFO:0x%08x\n", FBIOPUT_MODEINFO);
- break;
- case FBIOGET_DISPINFO:
- pr_debug("FBIOGET_DISPINFO:0x%08x\n", FBIOGET_DISPINFO);
- break;
-
- default:
- printk(KERN_ERR "Unknown ioctl command (0x%08X)\n", cmd);
- return -ENOIOCTLCMD;
- }
-
- return 0;
-}
-
/* turn on fb if count == 1
*/
static int fsl_diu_open(struct fb_info *info, int user)
@@ -1162,7 +1094,6 @@ static struct fb_ops fsl_diu_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
- .fb_ioctl = fsl_diu_ioctl,
.fb_open = fsl_diu_open,
.fb_release = fsl_diu_release,
};
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
index 781d467..234c38e 100644
--- a/include/linux/fsl-diu-fb.h
+++ b/include/linux/fsl-diu-fb.h
@@ -20,55 +20,8 @@
#ifndef __FSL_DIU_FB_H__
#define __FSL_DIU_FB_H__
-/* Arbitrary threshold to determine the allocation method
- * See mpc8610fb_set_par(), map_video_memory(), and unmap_video_memory()
- */
-#define MEM_ALLOC_THRESHOLD (1024*768*4+32)
-/* Minimum value that the pixel clock can be set to in pico seconds
- * This is determined by platform clock/3 where the minimum platform
- * clock is 533MHz. This gives 5629 pico seconds.
- */
-#define MIN_PIX_CLK 5629
-#define MAX_PIX_CLK 96096
-
#include <linux/types.h>
-struct mfb_alpha {
- int enable;
- int alpha;
-};
-
-struct mfb_chroma_key {
- int enable;
- __u8 red_max;
- __u8 green_max;
- __u8 blue_max;
- __u8 red_min;
- __u8 green_min;
- __u8 blue_min;
-};
-
-struct aoi_display_offset {
- int x_aoi_d;
- int y_aoi_d;
-};
-
-#define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
-#define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
-
-#define MFB_SET_ALPHA 0x80014d00
-#define MFB_GET_ALPHA 0x40014d00
-#define MFB_SET_AOID 0x80084d04
-#define MFB_GET_AOID 0x40084d04
-#define MFB_SET_PIXFMT 0x80014d08
-#define MFB_GET_PIXFMT 0x40014d08
-
-#define FBIOGET_GWINFO 0x46E0
-#define FBIOPUT_GWINFO 0x46E1
-
-#ifdef __KERNEL__
-#include <linux/spinlock.h>
-
/*
* These are the fields of area descriptor(in DDR memory) for every plane
*/
@@ -165,39 +118,6 @@ struct diu {
__be32 plut;
} __attribute__ ((packed));
-struct diu_hw {
- struct diu *diu_reg;
- spinlock_t reg_lock;
-
- __u32 mode; /* DIU operation mode */
-};
-
-struct diu_addr {
- __u8 __iomem *vaddr; /* Virtual address */
- dma_addr_t paddr; /* Physical address */
- __u32 offset;
-};
-
-struct diu_pool {
- struct diu_addr ad;
- struct diu_addr gamma;
- struct diu_addr pallete;
- struct diu_addr cursor;
-};
-
-#define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */
-#define INT_LCDC 64 /* DIU interrupt number */
-
-#define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */
- /* 1 for plane 0, 2 for plane 1&2 each */
-
-/* Minimum X and Y resolutions */
-#define MIN_XRES 64
-#define MIN_YRES 64
-
-/* HW cursor parameters */
-#define MAX_CURS 32
-
/* Modes of operation of DIU */
#define MFB_MODE0 0 /* DIU off */
#define MFB_MODE1 1 /* All three planes output to display */
@@ -205,18 +125,4 @@ struct diu_pool {
#define MFB_MODE3 3 /* All three planes written back to memory */
#define MFB_MODE4 4 /* Color bar generation */
-/* INT_STATUS/INT_MASK field descriptions */
-#define INT_VSYNC 0x01 /* Vsync interrupt */
-#define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */
-#define INT_UNDRUN 0x04 /* Under run exception interrupt */
-#define INT_PARERR 0x08 /* Display parameters error interrupt */
-#define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */
-
-/* Panels'operation modes */
-#define MFB_TYPE_OUTPUT 0 /* Panel output to display */
-#define MFB_TYPE_OFF 1 /* Panel off */
-#define MFB_TYPE_WB 2 /* Panel written back to memory */
-#define MFB_TYPE_TEST 3 /* Panel generate color bar */
-
-#endif /* __KERNEL__ */
#endif /* __FSL_DIU_FB_H__ */
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH] libata/sas: only set FROZEN flag if new EH is supported
From: Jeff Garzik @ 2011-06-21 20:39 UTC (permalink / raw)
To: Brian King
Cc: wayneb, linux-kernel, linux-ide, mbizon, Tejun Heo,
Nishanth Aravamudan, linuxppc-dev
In-Reply-To: <4E00FF58.7070802@linux.vnet.ibm.com>
On 06/21/2011 04:30 PM, Brian King wrote:
> Looks good to me. Jeff/Tejun - any issues with merging this?
Looks good here too -- though of course we want to move towards purging
old-EH paths :)
Queued...
^ permalink raw reply
* Re: [PATCH] libata/sas: only set FROZEN flag if new EH is supported
From: Brian King @ 2011-06-21 20:30 UTC (permalink / raw)
To: Nishanth Aravamudan
Cc: jgarzik, wayneb, linux-kernel, linux-ide, Tejun Heo, mbizon,
linuxppc-dev
In-Reply-To: <20110621160714.GA14174@us.ibm.com>
Looks good to me. Jeff/Tejun - any issues with merging this?
Thanks,
Brian
On 06/21/2011 11:07 AM, Nishanth Aravamudan wrote:
> Ping on this -- Tejun, Brian, Jeff, this is a pretty annoying 2.6.39
> regression which it would be good to have fixed in 3.0.
>
> Thanks,
> Nish
>
> On 16.06.2011 [08:28:36 -0700], Nishanth Aravamudan wrote:
>> On 16.06.2011 [08:28:39 -0500], Brian King wrote:
>>> On 06/16/2011 02:51 AM, Tejun Heo wrote:
>>>> On Wed, Jun 15, 2011 at 04:34:17PM -0700, Nishanth Aravamudan wrote:
>>>>>> That looks like the right thing to do. For ipr's usage of
>>>>>> libata, we don't have the concept of a port frozen state, so this flag
>>>>>> should really never get set. The alternate way to fix this would be to
>>>>>> only set ATA_PFLAG_FROZEN in ata_port_alloc if ap->ops->error_handler
>>>>>> is not NULL.
>>>>>
>>>>> It seemed like ipr is as you say, but I wasn't sure if it was
>>>>> appropriate to make the change above in the common libata-scis code or
>>>>> not. I don't want to break some other device on accident.
>>>>>
>>>>> Also, I tried your suggestion, but I don't think that can happen in
>>>>> ata_port_alloc? ata_port_alloc is allocated ap itself, and it seems like
>>>>> ap->ops typically gets set only after ata_port_alloc returns?
>>>>
>>>> Maybe we can test error_handler in ata_sas_port_start()?
>>>
>>> Good point. Since libsas is converted to the new eh now, we would need to have
>>> this test.
>>
>> Commit 7b3a24c57d2eeda8dba9c205342b12689c4679f9 ("ahci: don't enable
>> port irq before handler is registered") caused a regression for CD-ROMs
>> attached to the IPR SATA bus on Power machines:
>>
>> ata_port_alloc: ENTER
>> ata_port_probe: ata1: bus probe begin
>> ata1.00: ata_dev_read_id: ENTER
>> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
>> ata1.00: ata_dev_read_id: ENTER
>> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
>> ata1.00: limiting speed to UDMA7:PIO5
>> ata1.00: ata_dev_read_id: ENTER
>> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
>> ata1.00: disabled
>> ata_port_probe: ata1: bus probe end
>> scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
>>
>> The FROZEN flag added in that commit is only cleared by the new EH code,
>> which is not used by ipr. Clear this flag in the SAS code if we don't
>> support new EH.
>>
>> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
>>
>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>> index d51f979..ebe1685 100644
>> --- a/drivers/ata/libata-scsi.c
>> +++ b/drivers/ata/libata-scsi.c
>> @@ -3797,6 +3797,12 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
>> */
>> int ata_sas_port_start(struct ata_port *ap)
>> {
>> + /*
>> + * the port is marked as frozen at allocation time, but if we don't
>> + * have new eh, we won't thaw it
>> + */
>> + if (!ap->ops->error_handler)
>> + ap->pflags &= ~ATA_PFLAG_FROZEN;
>> return 0;
>> }
>> EXPORT_SYMBOL_GPL(ata_sas_port_start);
>>
>>
>> --
>> Nishanth Aravamudan <nacc@us.ibm.com>
>> IBM Linux Technology Center
>
--
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
^ permalink raw reply
* Re: [PATCH 3/5] drivers/amba: create devices from device tree
From: Rob Herring @ 2011-06-21 20:07 UTC (permalink / raw)
To: Grant Likely
Cc: Nicolas Pitre, Russell King, Arnd Bergmann, devicetree-discuss,
linux-kernel, linuxppc-dev, linux-arm-kernel
In-Reply-To: <20110621184503.18176.88260.stgit@ponder>
Grant,
On 06/21/2011 01:45 PM, Grant Likely wrote:
> Add a function to create amba_devices (i.e. primecell peripherals)
> from device tree nodes. The device tree scanning is done by the
> of_platform_populate() function which can call of_amba_device_create
> based on a match table entry.
>
> Nodes with a "arm,primecell-periphid" property can override the h/w
> peripheral id value.
>
> Based on the original work by Jeremy Kerr.
>
> Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> [grant.likely: add Jeremy's original s-o-b line, changes from review
> comments, and moved all code to drivers/of/platform.c]
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> .../devicetree/bindings/arm/primecell.txt | 21 ++++++
> drivers/of/platform.c | 71 ++++++++++++++++++++
> 2 files changed, 92 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/arm/primecell.txt
>
> diff --git a/Documentation/devicetree/bindings/arm/primecell.txt b/Documentation/devicetree/bindings/arm/primecell.txt
> new file mode 100644
> index 0000000..1d5d7a8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/primecell.txt
> @@ -0,0 +1,21 @@
> +* ARM Primecell Peripherals
> +
> +ARM, Ltd. Primecell peripherals have a standard id register that can be used to
> +identify the peripheral type, vendor, and revision. This value can be used for
> +driver matching.
> +
> +Required properties:
> +
> +- compatible : should be a specific value for peripheral and "arm,primecell"
Can I review what I wrote... Perhaps we should put strings in for all
existing drivers in the kernel. This should be a complete list:
arm,pl010
arm,pl011
st,pl011
arm,pl022
st,pl022
st,pl023
arm,pl030
arm,pl031
st,pl031
arm,pl061
arm,pl050
arm,pl080
arm,pl081
st,pl080
arm,pl110
arm,pl180
arm,pl330
arm,sp804
arm,sp805
Otherwise, they may never get added.
Rob
^ permalink raw reply
* Re: [PATCH] hwrng: ppc4xx - add support for ppc4xx TRNG
From: Matt Mackall @ 2011-06-21 18:59 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev, Herbert Xu, linux-crypto
In-Reply-To: <20110621113836.fbf14710.kim.phillips@freescale.com>
On Tue, 2011-06-21 at 11:38 -0500, Kim Phillips wrote:
> [adding linux-crypto]
>
> On Tue, 21 Jun 2011 10:56:02 -0500
> Matt Mackall <mpm@selenic.com> wrote:
>
> > On Tue, 2011-06-21 at 08:19 -0400, Josh Boyer wrote:
> > > +static struct hwrng ppc4xx_rng = {
> > > + .name = MODULE_NAME,
> > > + .data_present = ppc4xx_rng_data_present,
> > > + .data_read = ppc4xx_rng_data_read,
> > > +};
>
> under what criteria should new hwrng drivers use the new hwrng API?
If the RNG is not fundamentally u32-based (like this one), it's strongly
encouraged. We'll eventually abandon the old interface, but I don't
think there's any hurry.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply
* [PATCH 5/5] powerpc/5200: convert mpc5200 to use of_platform_populate()
From: Grant Likely @ 2011-06-21 18:45 UTC (permalink / raw)
To: Nicolas Pitre, devicetree-discuss, linuxppc-dev, linux-kernel,
linux-arm-kernel
Cc: Russell King, Arnd Bergmann
In-Reply-To: <20110621181127.18176.1384.stgit@ponder>
of_platform_populate() also handles nodes at the root of the tree,
which is wanted for things like describing the sound complex. This
patch converts mpc5200 support to use of_platform_populate() instead
of of_platform_bus_probe().
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/powerpc/platforms/52xx/mpc52xx_common.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 41f3a7e..6a2fde2 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -97,13 +97,11 @@ struct mpc52xx_gpio_wkup __iomem *wkup_gpio;
* of the localplus bus to the of_platform
* bus.
*/
-void __init
-mpc52xx_declare_of_platform_devices(void)
+void __init mpc52xx_declare_of_platform_devices(void)
{
- /* Find every child of the SOC node and add it to of_platform */
- if (of_platform_bus_probe(NULL, mpc52xx_bus_ids, NULL))
- printk(KERN_ERR __FILE__ ": "
- "Error while probing of_platform bus\n");
+ /* Find all the 'platform' devices and register them. */
+ if (of_platform_populate(NULL, mpc52xx_bus_ids, NULL, NULL))
+ pr_err(__FILE__ ": Error while populating devices from DT\n");
}
/*
^ permalink raw reply related
* [PATCH 4/5] dt/platform: allow device name to be overridden
From: Grant Likely @ 2011-06-21 18:45 UTC (permalink / raw)
To: Nicolas Pitre, devicetree-discuss, linuxppc-dev, linux-kernel,
linux-arm-kernel
Cc: Russell King, Arnd Bergmann
In-Reply-To: <20110621181127.18176.1384.stgit@ponder>
Some platform code has specific requirements on the naming of devices.
This patch allows callers of of_platform_populate() to provide a
device name lookup table.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/of/platform.c | 73 +++++++++++++++++++++++++++++++++++++------
include/linux/of_platform.h | 35 +++++++++++++++++++++
2 files changed, 98 insertions(+), 10 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 4192ddc..e75af39 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -177,17 +177,20 @@ struct platform_device *of_device_alloc(struct device_node *np,
EXPORT_SYMBOL(of_device_alloc);
/**
- * of_platform_device_create - Alloc, initialize and register an of_device
+ * of_platform_device_create_pdata - Alloc, initialize and register an of_device
* @np: pointer to node to create device for
* @bus_id: name to assign device
+ * @platform_data: pointer to populate platform_data pointer with
* @parent: Linux device model parent device.
*
* Returns pointer to created platform device, or NULL if a device was not
* registered. Unavailable devices will not get registered.
*/
-struct platform_device *of_platform_device_create(struct device_node *np,
- const char *bus_id,
- struct device *parent)
+struct platform_device *of_platform_device_create_pdata(
+ struct device_node *np,
+ const char *bus_id,
+ void *platform_data,
+ struct device *parent)
{
struct platform_device *dev;
@@ -203,6 +206,7 @@ struct platform_device *of_platform_device_create(struct device_node *np,
#endif
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
dev->dev.bus = &platform_bus_type;
+ dev->dev.platform_data = platform_data;
/* We do not fill the DMA ops for platform devices by default.
* This is currently the responsibility of the platform code
@@ -216,6 +220,22 @@ struct platform_device *of_platform_device_create(struct device_node *np,
return dev;
}
+
+/**
+ * of_platform_device_create - Alloc, initialize and register an of_device
+ * @np: pointer to node to create device for
+ * @bus_id: name to assign device
+ * @parent: Linux device model parent device.
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered. Unavailable devices will not get registered.
+ */
+struct platform_device *of_platform_device_create(struct device_node *np,
+ const char *bus_id,
+ struct device *parent)
+{
+ return of_platform_device_create_pdata(np, bus_id, NULL, parent);
+}
EXPORT_SYMBOL(of_platform_device_create);
#ifdef CONFIG_ARM_AMBA
@@ -284,6 +304,28 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
#endif /* CONFIG_ARM_AMBA */
/**
+ * of_devname_lookup() - Given a device node, lookup the preferred Linux name
+ */
+static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup,
+ struct device_node *np)
+{
+ struct resource res;
+ if (lookup) {
+ for(; lookup->name != NULL; lookup++) {
+ if (!of_device_is_compatible(np, lookup->compatible))
+ continue;
+ if (of_address_to_resource(np, 0, &res))
+ continue;
+ if (res.start != lookup->phys_addr)
+ continue;
+ pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
+ return lookup;
+ }
+ }
+ return NULL;
+}
+
+/**
* of_platform_bus_create() - Create a device for a node and its children.
* @bus: device node of the bus to instantiate
* @matches: match table for bus nodes
@@ -295,10 +337,14 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
*/
static int of_platform_bus_create(struct device_node *bus,
const struct of_device_id *matches,
+ const struct of_dev_auxdata *lookup,
struct device *parent, bool strict)
{
+ const struct of_dev_auxdata *auxdata;
struct device_node *child;
struct platform_device *dev;
+ const char *bus_id = NULL;
+ void *platform_data = NULL;
int rc = 0;
/* Make sure it has a compatible property */
@@ -308,18 +354,24 @@ static int of_platform_bus_create(struct device_node *bus,
return 0;
}
+ auxdata = of_dev_lookup(lookup, bus);
+ if (auxdata) {
+ bus_id = auxdata->name;
+ platform_data = auxdata->platform_data;
+ }
+
if (of_device_is_compatible(bus, "arm,primecell")) {
- of_amba_device_create(bus, NULL, NULL, parent);
+ of_amba_device_create(bus, bus_id, platform_data, parent);
return 0;
}
- dev = of_platform_device_create(bus, NULL, parent);
+ dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent);
if (!dev || !of_match_node(matches, bus))
return 0;
for_each_child_of_node(bus, child) {
pr_debug(" create child: %s\n", child->full_name);
- rc = of_platform_bus_create(child, matches, &dev->dev, strict);
+ rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
if (rc) {
of_node_put(child);
break;
@@ -353,11 +405,11 @@ int of_platform_bus_probe(struct device_node *root,
/* Do a self check of bus type, if there's a match, create children */
if (of_match_node(matches, root)) {
- rc = of_platform_bus_create(root, matches, parent, false);
+ rc = of_platform_bus_create(root, matches, NULL, parent, false);
} else for_each_child_of_node(root, child) {
if (!of_match_node(matches, child))
continue;
- rc = of_platform_bus_create(child, matches, parent, false);
+ rc = of_platform_bus_create(child, matches, NULL, parent, false);
if (rc)
break;
}
@@ -387,6 +439,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
*/
int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
+ const struct of_dev_auxdata *lookup,
struct device *parent)
{
struct device_node *child;
@@ -397,7 +450,7 @@ int of_platform_populate(struct device_node *root,
return -EINVAL;
for_each_child_of_node(root, child) {
- rc = of_platform_bus_create(child, matches, parent, true);
+ rc = of_platform_bus_create(child, matches, lookup, parent, true);
if (rc)
break;
}
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 8390233..5a6f458 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -20,6 +20,40 @@
#include <linux/platform_device.h>
/**
+ * struct of_dev_auxdata - lookup table entry for device names & platform_data
+ * @compatible: compatible value of node to match against node
+ * @phys_addr: Start address of registers to match against node
+ * @name: Name to assign for matching nodes
+ * @platform_data: platform_data to assign for matching nodes
+ *
+ * This lookup table allows the caller of of_platform_populate() to override
+ * the names of devices when creating devices from the device tree. The table
+ * should be terminated with an empty entry. It also allows the platform_data
+ * pointer to be set.
+ *
+ * The reason for this functionality is that some Linux infrastructure uses
+ * the device name to look up a specific device, but the Linux-specific names
+ * are not encoded into the device tree, so the kernel needs to provide specific
+ * values.
+ *
+ * Note: Using an auxdata lookup table should be considered a last resort when
+ * converting a platform to use the DT. Normally the automatically generated
+ * device name will not matter, and drivers should obtain data from the device
+ * node instead of from an anonymouns platform_data pointer.
+ */
+struct of_dev_auxdata {
+ char *compatible;
+ resource_size_t phys_addr;
+ char *name;
+ void *platform_data;
+};
+
+/* Macro to simplify populating a lookup table */
+#define OF_DEV_AUXDATA(_compat,_phys,_name,_pdata) \
+ { .compatible = _compat, .phys_addr = _phys, .name = _name, \
+ .platform_data = _pdata }
+
+/**
* of_platform_driver - Legacy of-aware driver for platform devices.
*
* An of_platform_driver driver is attached to a basic platform_device on
@@ -59,6 +93,7 @@ extern int of_platform_bus_probe(struct device_node *root,
struct device *parent);
extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
+ const struct of_dev_auxdata *lookup,
struct device *parent);
#endif /* !CONFIG_SPARC */
^ permalink raw reply related
* [PATCH 3/5] drivers/amba: create devices from device tree
From: Grant Likely @ 2011-06-21 18:45 UTC (permalink / raw)
To: Nicolas Pitre, devicetree-discuss, linuxppc-dev, linux-kernel,
linux-arm-kernel
Cc: Russell King, Arnd Bergmann
In-Reply-To: <20110621181127.18176.1384.stgit@ponder>
Add a function to create amba_devices (i.e. primecell peripherals)
from device tree nodes. The device tree scanning is done by the
of_platform_populate() function which can call of_amba_device_create
based on a match table entry.
Nodes with a "arm,primecell-periphid" property can override the h/w
peripheral id value.
Based on the original work by Jeremy Kerr.
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
[grant.likely: add Jeremy's original s-o-b line, changes from review
comments, and moved all code to drivers/of/platform.c]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
.../devicetree/bindings/arm/primecell.txt | 21 ++++++
drivers/of/platform.c | 71 ++++++++++++++++++++
2 files changed, 92 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/primecell.txt
diff --git a/Documentation/devicetree/bindings/arm/primecell.txt b/Documentation/devicetree/bindings/arm/primecell.txt
new file mode 100644
index 0000000..1d5d7a8
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/primecell.txt
@@ -0,0 +1,21 @@
+* ARM Primecell Peripherals
+
+ARM, Ltd. Primecell peripherals have a standard id register that can be used to
+identify the peripheral type, vendor, and revision. This value can be used for
+driver matching.
+
+Required properties:
+
+- compatible : should be a specific value for peripheral and "arm,primecell"
+
+Optional properties:
+
+- arm,primecell-periphid : Value to override the h/w value with
+
+Example:
+
+serial@fff36000 {
+ compatible = "arm,pl011", "arm,primecell";
+ arm,primecell-periphid = <0x00341011>;
+};
+
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 1f4a5d3..4192ddc 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -13,6 +13,7 @@
*/
#include <linux/errno.h>
#include <linux/module.h>
+#include <linux/amba/bus.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
@@ -217,6 +218,71 @@ struct platform_device *of_platform_device_create(struct device_node *np,
}
EXPORT_SYMBOL(of_platform_device_create);
+#ifdef CONFIG_ARM_AMBA
+static struct amba_device *of_amba_device_create(struct device_node *node,
+ const char *bus_id,
+ void *platform_data,
+ struct device *parent)
+{
+ struct amba_device *dev;
+ const void *prop;
+ int i, ret;
+
+ pr_debug("Creating amba device %s\n", node->full_name);
+
+ if (!of_device_is_available(node))
+ return NULL;
+
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev)
+ return NULL;
+
+ /* setup generic device info */
+ dev->dev.coherent_dma_mask = ~0;
+ dev->dev.of_node = of_node_get(node);
+ dev->dev.parent = parent;
+ dev->dev.platform_data = platform_data;
+ if (bus_id)
+ dev_set_name(&dev->dev, "%s", bus_id);
+ else
+ of_device_make_bus_id(&dev->dev);
+
+ /* setup amba-specific device info */
+ dev->dma_mask = ~0;
+
+ /* Allow the HW Peripheral ID to be overridden */
+ prop = of_get_property(node, "arm,primecell-periphid", NULL);
+ if (prop)
+ dev->periphid = of_read_ulong(prop, 1);
+
+ /* Decode the IRQs and address ranges */
+ for (i = 0; i < AMBA_NR_IRQS; i++)
+ dev->irq[i] = irq_of_parse_and_map(node, i);
+
+ ret = of_address_to_resource(node, 0, &dev->res);
+ if (ret)
+ goto err_free;
+
+ ret = amba_device_register(dev, &iomem_resource);
+ if (ret)
+ goto err_free;
+
+ return dev;
+
+err_free:
+ kfree(dev);
+ return NULL;
+}
+#else /* CONFIG_ARM_AMBA */
+static struct amba_device *of_amba_device_create(struct device_node *node,
+ const char *bus_id,
+ void *platform_data,
+ struct device *parent)
+{
+ return NULL;
+}
+#endif /* CONFIG_ARM_AMBA */
+
/**
* of_platform_bus_create() - Create a device for a node and its children.
* @bus: device node of the bus to instantiate
@@ -242,6 +308,11 @@ static int of_platform_bus_create(struct device_node *bus,
return 0;
}
+ if (of_device_is_compatible(bus, "arm,primecell")) {
+ of_amba_device_create(bus, NULL, NULL, parent);
+ return 0;
+ }
+
dev = of_platform_device_create(bus, NULL, parent);
if (!dev || !of_match_node(matches, bus))
return 0;
^ permalink raw reply related
* [PATCH 2/5] dt: add of_platform_populate() for creating device from the device tree
From: Grant Likely @ 2011-06-21 18:44 UTC (permalink / raw)
To: Nicolas Pitre, devicetree-discuss, linuxppc-dev, linux-kernel,
linux-arm-kernel
Cc: Russell King, Arnd Bergmann
In-Reply-To: <20110621181127.18176.1384.stgit@ponder>
of_platform_populate() is similar to of_platform_bus_probe() except
that it strictly enforces that all device nodes must have a compatible
property, and it can be used to register devices (not buses) which are
children of the root node.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/of/platform.c | 54 ++++++++++++++++++++++++++++++++++++++++---
include/linux/of_platform.h | 3 ++
2 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index bb483ef..1f4a5d3 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -229,19 +229,26 @@ EXPORT_SYMBOL(of_platform_device_create);
*/
static int of_platform_bus_create(struct device_node *bus,
const struct of_device_id *matches,
- struct device *parent)
+ struct device *parent, bool strict)
{
struct device_node *child;
struct platform_device *dev;
int rc = 0;
+ /* Make sure it has a compatible property */
+ if (strict && (!of_get_property(bus, "compatible", NULL))) {
+ pr_debug("%s() - skipping %s, no compatible prop\n",
+ __func__, bus->full_name);
+ return 0;
+ }
+
dev = of_platform_device_create(bus, NULL, parent);
if (!dev || !of_match_node(matches, bus))
return 0;
for_each_child_of_node(bus, child) {
pr_debug(" create child: %s\n", child->full_name);
- rc = of_platform_bus_create(child, matches, &dev->dev);
+ rc = of_platform_bus_create(child, matches, &dev->dev, strict);
if (rc) {
of_node_put(child);
break;
@@ -275,11 +282,11 @@ int of_platform_bus_probe(struct device_node *root,
/* Do a self check of bus type, if there's a match, create children */
if (of_match_node(matches, root)) {
- rc = of_platform_bus_create(root, matches, parent);
+ rc = of_platform_bus_create(root, matches, parent, false);
} else for_each_child_of_node(root, child) {
if (!of_match_node(matches, child))
continue;
- rc = of_platform_bus_create(child, matches, parent);
+ rc = of_platform_bus_create(child, matches, parent, false);
if (rc)
break;
}
@@ -288,4 +295,43 @@ int of_platform_bus_probe(struct device_node *root,
return rc;
}
EXPORT_SYMBOL(of_platform_bus_probe);
+
+/**
+ * of_platform_populate() - Populate platform_devices from device tree data
+ * @root: parent of the first level to probe or NULL for the root of the tree
+ * @matches: match table, NULL to use the default
+ * @parent: parent to hook devices from, NULL for toplevel
+ *
+ * Similar to of_platform_bus_probe(), this function walks the device tree
+ * and creates devices from nodes. It differs in that it follows the modern
+ * convention of requiring all device nodes to have a 'compatible' property,
+ * and it is suitable for creating devices which are children of the root
+ * node (of_platform_bus_probe will only create children of the root which
+ * are selected by the @matches argument).
+ *
+ * New board support should be using this function instead of
+ * of_platform_bus_probe().
+ *
+ * Returns 0 on success, < 0 on failure.
+ */
+int of_platform_populate(struct device_node *root,
+ const struct of_device_id *matches,
+ struct device *parent)
+{
+ struct device_node *child;
+ int rc = 0;
+
+ root = root ? of_node_get(root) : of_find_node_by_path("/");
+ if (!root)
+ return -EINVAL;
+
+ for_each_child_of_node(root, child) {
+ rc = of_platform_bus_create(child, matches, parent, true);
+ if (rc)
+ break;
+ }
+
+ of_node_put(root);
+ return rc;
+}
#endif /* !CONFIG_SPARC */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 8f023f8..8390233 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -57,6 +57,9 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
extern int of_platform_bus_probe(struct device_node *root,
const struct of_device_id *matches,
struct device *parent);
+extern int of_platform_populate(struct device_node *root,
+ const struct of_device_id *matches,
+ struct device *parent);
#endif /* !CONFIG_SPARC */
#endif /* CONFIG_OF_DEVICE */
^ permalink raw reply related
* [PATCH 1/5] dt: Add default match table for bus ids
From: Grant Likely @ 2011-06-21 18:44 UTC (permalink / raw)
To: Nicolas Pitre, devicetree-discuss, linuxppc-dev, linux-kernel,
linux-arm-kernel
Cc: Russell King, Arnd Bergmann
In-Reply-To: <20110621181127.18176.1384.stgit@ponder>
No need for most platforms to define their own bus table when calling
of_platform_populate(). Supply a stock one.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/of/platform.c | 8 ++++++++
include/linux/of_platform.h | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 63d3cb7..bb483ef 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -22,6 +22,14 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+const struct of_device_id of_default_bus_match_table[] = {
+ { .compatible = "simple-bus", },
+#ifdef CONFIG_ARM_AMBA
+ { .compatible = "arm,amba-bus", },
+#endif /* CONFIG_ARM_AMBA */
+ {} /* Empty terminated list */
+};
+
static int of_dev_node_match(struct device *dev, void *data)
{
return dev->of_node == data;
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index fb51ae3..8f023f8 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -40,6 +40,8 @@ struct of_platform_driver
#define to_of_platform_driver(drv) \
container_of(drv,struct of_platform_driver, driver)
+extern const struct of_device_id of_default_bus_match_table[];
+
/* Platform drivers register/unregister */
extern struct platform_device *of_device_alloc(struct device_node *np,
const char *bus_id,
^ permalink raw reply related
* [PATCH 0/5] dt: Device creation infrastructure
From: Grant Likely @ 2011-06-21 18:44 UTC (permalink / raw)
To: Nicolas Pitre, devicetree-discuss, linuxppc-dev, linux-kernel,
linux-arm-kernel
Cc: Russell King, Arnd Bergmann
This series adds infrastructure for generating platform and amba
devices based on device tree data. I intend to queue up this series
for the v3.1 merge window. I had already posted these patches earlier
in the "Full device tree support for ARM Versatile" RFC series. They
haven't changed since I posted that.
Unless I hear otherwise, I'll put the first 4 patches into
devicetree/next later this week. The fifth patch can either go via
devicetree/next or benh's powerpc tree (your choice Ben).
g.
---
Grant Likely (5):
dt: Add default match table for bus ids
dt: add of_platform_populate() for creating device from the device tree
drivers/amba: create devices from device tree
dt/platform: allow device name to be overridden
powerpc/5200: convert mpc5200 to use of_platform_populate()
.../devicetree/bindings/arm/primecell.txt | 21 ++
arch/powerpc/platforms/52xx/mpc52xx_common.c | 10 -
drivers/of/platform.c | 196 +++++++++++++++++++-
include/linux/of_platform.h | 40 ++++
4 files changed, 252 insertions(+), 15 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/primecell.txt
^ permalink raw reply
* Re: [PATCH] perf_events: Enable idle state tracing for pseries (ppc64)
From: Deepthi Dharwar @ 2011-06-21 16:40 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-pm, linux-kernel
In-Reply-To: <4E00C6DE.1030001@linux.vnet.ibm.com>
On Tuesday 21 June 2011 09:59 PM, deepthi wrote:
> On Tuesday 21 June 2011 03:12 AM, Benjamin Herrenschmidt wrote:
>> On Mon, 2011-06-20 at 22:48 +0530, deepthi wrote:
>>> On Friday 17 June 2011 09:54 AM, Benjamin Herrenschmidt wrote:
>>>> On Wed, 2011-06-01 at 18:05 +0530, Deepthi Dharwar wrote:
>>>>> Hi,
>>>>>
>>>>> Please find below a patch, which has perf_events added for pseries (ppc64)
>>>>> platform in order to emit the trace required for perf timechart.
>>>>> It essentially enables perf timechart for pseries platfrom to analyse
>>>>> power savings events like cpuidle states.
>>>>
>>>> Unless I'm mistaken, you added traces to dedicated CPU idle sleep but
>>>> not shared processor. Any reason ?
>>>>
>>> Yes, the traces were added only to dedicated CPU idle sleep and not for
>>> shared processor. This was added only for RFC purpose, and looking for
>>> comments from trace implementation point of view. This can be
>>> easily extended to the latter too.
>>
>> Please do both.
>>
> Yes, I ll do so.
>
>>>> Also I don't really know that tracing stuff but what's the point of
>>>> having start/end _and trace_cpu_idle if you're going to always start &
>>>> end around a single occurence of trace_cpu_idle ?
>>>>
>>> power_start/end are the APIs that were used initially
>>> and they are going to be deprecated in the upcoming kernel releases.
>>> trace_cpu_idle call is going to replace power start/end routines.
>>> To maintain backward compatibility and uniformity, both the routines
>>> have been used.
>>> (ref:https://lkml.org/lkml/2010/11/14/60ref:https://lkml.org/lkml/2010/11/14/60)
>>
>> Backward compatible with what ? Userspace ? Do we care in that specific
>> case since it's a new feature ?
>>
> Going forward, we can just have trace_cpu_idle call and
> remove the power_start/end calls.
>
>>>> Wouldn't there be a way to start/end and then trace the snooze and
>>>> subsequent cede within the same start/end section or that makes no
>>>> sense ?
>>>>
>>> We wanted to find the residency time of both Snooze as well as cede
>>> separately. Knowing this will help us tweak our cpuidle code. So, both
>>> have been captured separately.
>>>
>>>> Also would there be any interest in doing the tracing more generically
>>>> in idle.c ?
>>>>
>>> Yes, this tracing is already implemented for Intel platform. This would
>>> be a part of cpuidle framework. Going further, once the power cpuidle
>>> framework is ported and ready, we will extend this trace there as well.
>>> (ref:https://lkml.org/lkml/2011/6/7/375)
>>
>> So do we need to apply this patch at all since the cpuidle stuff is
>> happening too ?
>>
>
> Well, not really. This is more for RFC purpose.
> I just wanted to share this patch, as we are using it to evaluate
> cpu idle on ppc64.
>
I will re-base the patch and move it to the cpu idle for power
framework. So the tracing too gets in along with the
cpu idle support.
Thanks Ben.
>> Cheers,
>> Ben.
>>
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
Regards,
Deepthi
^ permalink raw reply
* Re: [PATCH] hwrng: ppc4xx - add support for ppc4xx TRNG
From: Kim Phillips @ 2011-06-21 16:38 UTC (permalink / raw)
To: Matt Mackall; +Cc: linuxppc-dev, Herbert Xu, linux-crypto
In-Reply-To: <1308671762.4954.0.camel@calx>
[adding linux-crypto]
On Tue, 21 Jun 2011 10:56:02 -0500
Matt Mackall <mpm@selenic.com> wrote:
> On Tue, 2011-06-21 at 08:19 -0400, Josh Boyer wrote:
> > +static struct hwrng ppc4xx_rng = {
> > + .name = MODULE_NAME,
> > + .data_present = ppc4xx_rng_data_present,
> > + .data_read = ppc4xx_rng_data_read,
> > +};
under what criteria should new hwrng drivers use the new hwrng API?
See commit bb347d9 "hwrng: virtio-rng - Convert to new API".
Kim
^ permalink raw reply
* Re: [PATCH] perf_events: Enable idle state tracing for pseries (ppc64)
From: deepthi @ 2011-06-21 16:29 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-pm, linux-kernel
In-Reply-To: <1308606133.32158.143.camel@pasglop>
On Tuesday 21 June 2011 03:12 AM, Benjamin Herrenschmidt wrote:
> On Mon, 2011-06-20 at 22:48 +0530, deepthi wrote:
>> On Friday 17 June 2011 09:54 AM, Benjamin Herrenschmidt wrote:
>>> On Wed, 2011-06-01 at 18:05 +0530, Deepthi Dharwar wrote:
>>>> Hi,
>>>>
>>>> Please find below a patch, which has perf_events added for pseries (ppc64)
>>>> platform in order to emit the trace required for perf timechart.
>>>> It essentially enables perf timechart for pseries platfrom to analyse
>>>> power savings events like cpuidle states.
>>>
>>> Unless I'm mistaken, you added traces to dedicated CPU idle sleep but
>>> not shared processor. Any reason ?
>>>
>> Yes, the traces were added only to dedicated CPU idle sleep and not for
>> shared processor. This was added only for RFC purpose, and looking for
>> comments from trace implementation point of view. This can be
>> easily extended to the latter too.
>
> Please do both.
>
Yes, I ll do so.
>>> Also I don't really know that tracing stuff but what's the point of
>>> having start/end _and trace_cpu_idle if you're going to always start &
>>> end around a single occurence of trace_cpu_idle ?
>>>
>> power_start/end are the APIs that were used initially
>> and they are going to be deprecated in the upcoming kernel releases.
>> trace_cpu_idle call is going to replace power start/end routines.
>> To maintain backward compatibility and uniformity, both the routines
>> have been used.
>> (ref:https://lkml.org/lkml/2010/11/14/60ref:https://lkml.org/lkml/2010/11/14/60)
>
> Backward compatible with what ? Userspace ? Do we care in that specific
> case since it's a new feature ?
>
Going forward, we can just have trace_cpu_idle call and
remove the power_start/end calls.
>>> Wouldn't there be a way to start/end and then trace the snooze and
>>> subsequent cede within the same start/end section or that makes no
>>> sense ?
>>>
>> We wanted to find the residency time of both Snooze as well as cede
>> separately. Knowing this will help us tweak our cpuidle code. So, both
>> have been captured separately.
>>
>>> Also would there be any interest in doing the tracing more generically
>>> in idle.c ?
>>>
>> Yes, this tracing is already implemented for Intel platform. This would
>> be a part of cpuidle framework. Going further, once the power cpuidle
>> framework is ported and ready, we will extend this trace there as well.
>> (ref:https://lkml.org/lkml/2011/6/7/375)
>
> So do we need to apply this patch at all since the cpuidle stuff is
> happening too ?
>
Well, not really. This is more for RFC purpose.
I just wanted to share this patch, as we are using it to evaluate
cpu idle on ppc64.
> Cheers,
> Ben.
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* Re: [PATCH] libata/sas: only set FROZEN flag if new EH is supported
From: Nishanth Aravamudan @ 2011-06-21 16:07 UTC (permalink / raw)
To: Brian King
Cc: jgarzik, wayneb, linux-kernel, linux-ide, Tejun Heo, mbizon,
linuxppc-dev
In-Reply-To: <20110616152836.GA15268@us.ibm.com>
Ping on this -- Tejun, Brian, Jeff, this is a pretty annoying 2.6.39
regression which it would be good to have fixed in 3.0.
Thanks,
Nish
On 16.06.2011 [08:28:36 -0700], Nishanth Aravamudan wrote:
> On 16.06.2011 [08:28:39 -0500], Brian King wrote:
> > On 06/16/2011 02:51 AM, Tejun Heo wrote:
> > > On Wed, Jun 15, 2011 at 04:34:17PM -0700, Nishanth Aravamudan wrote:
> > >>> That looks like the right thing to do. For ipr's usage of
> > >>> libata, we don't have the concept of a port frozen state, so this flag
> > >>> should really never get set. The alternate way to fix this would be to
> > >>> only set ATA_PFLAG_FROZEN in ata_port_alloc if ap->ops->error_handler
> > >>> is not NULL.
> > >>
> > >> It seemed like ipr is as you say, but I wasn't sure if it was
> > >> appropriate to make the change above in the common libata-scis code or
> > >> not. I don't want to break some other device on accident.
> > >>
> > >> Also, I tried your suggestion, but I don't think that can happen in
> > >> ata_port_alloc? ata_port_alloc is allocated ap itself, and it seems like
> > >> ap->ops typically gets set only after ata_port_alloc returns?
> > >
> > > Maybe we can test error_handler in ata_sas_port_start()?
> >
> > Good point. Since libsas is converted to the new eh now, we would need to have
> > this test.
>
> Commit 7b3a24c57d2eeda8dba9c205342b12689c4679f9 ("ahci: don't enable
> port irq before handler is registered") caused a regression for CD-ROMs
> attached to the IPR SATA bus on Power machines:
>
> ata_port_alloc: ENTER
> ata_port_probe: ata1: bus probe begin
> ata1.00: ata_dev_read_id: ENTER
> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> ata1.00: ata_dev_read_id: ENTER
> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> ata1.00: limiting speed to UDMA7:PIO5
> ata1.00: ata_dev_read_id: ENTER
> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
> ata1.00: disabled
> ata_port_probe: ata1: bus probe end
> scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
>
> The FROZEN flag added in that commit is only cleared by the new EH code,
> which is not used by ipr. Clear this flag in the SAS code if we don't
> support new EH.
>
> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index d51f979..ebe1685 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3797,6 +3797,12 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
> */
> int ata_sas_port_start(struct ata_port *ap)
> {
> + /*
> + * the port is marked as frozen at allocation time, but if we don't
> + * have new eh, we won't thaw it
> + */
> + if (!ap->ops->error_handler)
> + ap->pflags &= ~ATA_PFLAG_FROZEN;
> return 0;
> }
> EXPORT_SYMBOL_GPL(ata_sas_port_start);
>
>
> --
> Nishanth Aravamudan <nacc@us.ibm.com>
> IBM Linux Technology Center
--
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center
^ permalink raw reply
* Re: [PATCH] hwrng: ppc4xx - add support for ppc4xx TRNG
From: Matt Mackall @ 2011-06-21 15:56 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev, Herbert Xu
In-Reply-To: <20110621121955.GB2414@zod.rchland.ibm.com>
On Tue, 2011-06-21 at 08:19 -0400, Josh Boyer wrote:
> Various PowerPC 4xx SoCs contain a TRNG embedded in the Security function.
> This adds a device driver for that TRNG.
>
> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Looks good.
Acked-by: Matt Mackall <mpm@selenic.com>
> ---
> drivers/char/hw_random/Kconfig | 12 +++
> drivers/char/hw_random/Makefile | 1 +
> drivers/char/hw_random/ppc4xx-rng.c | 156 +++++++++++++++++++++++++++++++++++
> 3 files changed, 169 insertions(+), 0 deletions(-)
> create mode 100644 drivers/char/hw_random/ppc4xx-rng.c
>
> diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
> index a60043b..1d2ebc7 100644
> --- a/drivers/char/hw_random/Kconfig
> +++ b/drivers/char/hw_random/Kconfig
> @@ -210,3 +210,15 @@ config HW_RANDOM_PICOXCELL
> module will be called picoxcell-rng.
>
> If unsure, say Y.
> +
> +config HW_RANDOM_PPC4XX
> + tristate "PowerPC 4xx generic true random number generator support"
> + depends on HW_RANDOM && PPC && 4xx
> + ---help---
> + This driver provides the kernel-side support for the TRNG hardware
> + found in the security function of some PowerPC 4xx SoCs.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called ppc4xx-rng.
> +
> + If unsure, say N.
> diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
> index 3db4eb8..c88f244 100644
> --- a/drivers/char/hw_random/Makefile
> +++ b/drivers/char/hw_random/Makefile
> @@ -20,3 +20,4 @@ obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o
> obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
> obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
> obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o
> +obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o
> diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c
> new file mode 100644
> index 0000000..b8afa6a
> --- /dev/null
> +++ b/drivers/char/hw_random/ppc4xx-rng.c
> @@ -0,0 +1,156 @@
> +/*
> + * Generic PowerPC 44x RNG driver
> + *
> + * Copyright 2011 IBM Corporation
> + *
> + * 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; version 2 of the License.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/hw_random.h>
> +#include <linux/delay.h>
> +#include <linux/of_platform.h>
> +#include <asm/io.h>
> +
> +#define PPC4XX_TRNG_DEV_CTRL 0x60080
> +
> +#define PPC4XX_TRNGE 0x00020000
> +#define PPC4XX_TRNG_CTRL 0x0008
> +#define PPC4XX_TRNG_CTRL_DALM 0x20
> +#define PPC4XX_TRNG_STAT 0x0004
> +#define PPC4XX_TRNG_STAT_B 0x1
> +#define PPC4XX_TRNG_DATA 0x0000
> +
> +#define MODULE_NAME "ppc4xx_rng"
> +
> +static int ppc4xx_rng_data_present(struct hwrng *rng, int wait)
> +{
> + void __iomem *rng_regs = (void __iomem *) rng->priv;
> + int busy, i, present = 0;
> +
> + for (i = 0; i < 20; i++) {
> + busy = (in_le32(rng_regs + PPC4XX_TRNG_STAT) & PPC4XX_TRNG_STAT_B);
> + if (!busy || !wait) {
> + present = 1;
> + break;
> + }
> + udelay(10);
> + }
> + return present;
> +}
> +
> +static int ppc4xx_rng_data_read(struct hwrng *rng, u32 *data)
> +{
> + void __iomem *rng_regs = (void __iomem *) rng->priv;
> + *data = in_le32(rng_regs + PPC4XX_TRNG_DATA);
> + return 4;
> +}
> +
> +static int ppc4xx_rng_enable(int enable)
> +{
> + struct device_node *ctrl;
> + void __iomem *ctrl_reg;
> + int err = 0;
> + u32 val;
> +
> + /* Find the main crypto device node and map it to turn the TRNG on */
> + ctrl = of_find_compatible_node(NULL, NULL, "amcc,ppc4xx-crypto");
> + if (!ctrl)
> + return -ENODEV;
> +
> + ctrl_reg = of_iomap(ctrl, 0);
> + if (!ctrl_reg) {
> + err = -ENODEV;
> + goto out;
> + }
> +
> + val = in_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL);
> +
> + if (enable)
> + val |= PPC4XX_TRNGE;
> + else
> + val = val & ~PPC4XX_TRNGE;
> +
> + out_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL, val);
> + iounmap(ctrl_reg);
> +
> +out:
> + of_node_put(ctrl);
> +
> + return err;
> +}
> +
> +static struct hwrng ppc4xx_rng = {
> + .name = MODULE_NAME,
> + .data_present = ppc4xx_rng_data_present,
> + .data_read = ppc4xx_rng_data_read,
> +};
> +
> +static int __devinit ppc4xx_rng_probe(struct platform_device *dev)
> +{
> + void __iomem *rng_regs;
> + int err = 0;
> +
> + rng_regs = of_iomap(dev->dev.of_node, 0);
> + if (!rng_regs)
> + return -ENODEV;
> +
> + err = ppc4xx_rng_enable(1);
> + if (err)
> + return err;
> +
> + out_le32(rng_regs + PPC4XX_TRNG_CTRL, PPC4XX_TRNG_CTRL_DALM);
> + ppc4xx_rng.priv = (unsigned long) rng_regs;
> +
> + err = hwrng_register(&ppc4xx_rng);
> +
> + return err;
> +}
> +
> +static int __devexit ppc4xx_rng_remove(struct platform_device *dev)
> +{
> + void __iomem *rng_regs = (void __iomem *) ppc4xx_rng.priv;
> +
> + hwrng_unregister(&ppc4xx_rng);
> + ppc4xx_rng_enable(0);
> + iounmap(rng_regs);
> +
> + return 0;
> +}
> +
> +static struct of_device_id ppc4xx_rng_match[] = {
> + { .compatible = "ppc4xx-rng", },
> + { .compatible = "amcc,ppc460ex-rng", },
> + { .compatible = "amcc,ppc440epx-rng", },
> + {},
> +};
> +
> +static struct platform_driver ppc4xx_rng_driver = {
> + .driver = {
> + .name = MODULE_NAME,
> + .owner = THIS_MODULE,
> + .of_match_table = ppc4xx_rng_match,
> + },
> + .probe = ppc4xx_rng_probe,
> + .remove = ppc4xx_rng_remove,
> +};
> +
> +static int __init ppc4xx_rng_init(void)
> +{
> + return platform_driver_register(&ppc4xx_rng_driver);
> +}
> +module_init(ppc4xx_rng_init);
> +
> +static void __exit ppc4xx_rng_exit(void)
> +{
> + platform_driver_unregister(&ppc4xx_rng_driver);
> +}
> +module_exit(ppc4xx_rng_exit);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Josh Boyer <jwboyer@linux.vnet.ibm.com>");
> +MODULE_DESCRIPTION("HW RNG driver for PPC 4xx processors");
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply
* Re: [PATCH 0/15] Hypervisor-mode KVM on POWER7 and PPC970
From: Dmitry Eremin-Solenikov @ 2011-06-21 14:18 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20110618082705.GA28413__14973.6630417921$1308385948$gmane$org@bloggs.ozlabs.ibm.com>
Paul Mackerras wrote:
> The following series of patches enable KVM to exploit the hardware
> hypervisor mode on 64-bit Power ISA Book3S machines. At present,
> POWER7 and PPC970 processors are supported. (Note that the PPC970
> processors in Apple G5 machines don't have a usable hypervisor mode
> and are not supported by these patches.)
I have a Maple board (dual PPC970FX). Will this patchset work on it?
Should I add any additional changes to add support for this platform?
Thanks!
--
With best wishes
Dmitry
^ permalink raw reply
* [PATCH 2/2] powerpc: improve error code on reconfiguration notifier failure
From: Akinobu Mita @ 2011-06-21 13:35 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras, Akinobu Mita
In-Reply-To: <1308663356-20957-1-git-send-email-akinobu.mita@gmail.com>
Reconfiguration notifier call for device node may fail by several reasons,
but it always assumes kmalloc failures.
This enables reconfiguration notifier call chain to get the actual error
code rather than -ENOMEM by converting all reconfiguration notifier calls
to return encapsulate error code with notifier_from_errno().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/prom.c | 8 +++-----
arch/powerpc/platforms/pseries/hotplug-cpu.c | 10 +++-------
arch/powerpc/platforms/pseries/hotplug-memory.c | 16 +++++-----------
arch/powerpc/platforms/pseries/reconfig.c | 4 +---
4 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8c3112a..86677ba 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -862,16 +862,14 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
switch (action) {
case PSERIES_RECONFIG_ADD:
err = of_finish_dynamic_node(node);
- if (err < 0) {
+ if (err < 0)
printk(KERN_ERR "finish_node returned %d\n", err);
- err = NOTIFY_BAD;
- }
break;
default:
- err = NOTIFY_DONE;
+ err = 0;
break;
}
- return err;
+ return notifier_from_errno(err);
}
static struct notifier_block prom_reconfig_nb = {
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 46f13a3..bc02885 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -330,21 +330,17 @@ static void pseries_remove_processor(struct device_node *np)
static int pseries_smp_notifier(struct notifier_block *nb,
unsigned long action, void *node)
{
- int err = NOTIFY_OK;
+ int err = 0;
switch (action) {
case PSERIES_RECONFIG_ADD:
- if (pseries_add_processor(node))
- err = NOTIFY_BAD;
+ err = pseries_add_processor(node);
break;
case PSERIES_RECONFIG_REMOVE:
pseries_remove_processor(node);
break;
- default:
- err = NOTIFY_DONE;
- break;
}
- return err;
+ return notifier_from_errno(err);
}
static struct notifier_block pseries_smp_nb = {
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 33867ec..1eaefd6 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -197,27 +197,21 @@ static int pseries_drconf_memory(unsigned long *base, unsigned int action)
static int pseries_memory_notifier(struct notifier_block *nb,
unsigned long action, void *node)
{
- int err = NOTIFY_OK;
+ int err = 0;
switch (action) {
case PSERIES_RECONFIG_ADD:
- if (pseries_add_memory(node))
- err = NOTIFY_BAD;
+ err = pseries_add_memory(node);
break;
case PSERIES_RECONFIG_REMOVE:
- if (pseries_remove_memory(node))
- err = NOTIFY_BAD;
+ err = pseries_remove_memory(node);
break;
case PSERIES_DRCONF_MEM_ADD:
case PSERIES_DRCONF_MEM_REMOVE:
- if (pseries_drconf_memory(node, action))
- err = NOTIFY_BAD;
- break;
- default:
- err = NOTIFY_DONE;
+ err = pseries_drconf_memory(node, action);
break;
}
- return err;
+ return notifier_from_errno(err);
}
static struct notifier_block pseries_mem_nb = {
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 286b6af..168651a 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -114,9 +114,7 @@ int pSeries_reconfig_notify(unsigned long action, void *p)
int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
action, p);
- if (err == NOTIFY_BAD)
- return -ENOMEM; /* For now, safe to assume kmalloc failure */
- return 0;
+ return notifier_to_errno(err);
}
static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
--
1.7.4.4
^ permalink raw reply related
* [PATCH 1/2] powerpc: introduce pSeries_reconfig_notify()
From: Akinobu Mita @ 2011-06-21 13:35 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras, Akinobu Mita
This introduces pSeries_reconfig_notify() as a just wrapper of
blocking_notifier_call_chain() for pSeries_reconfig_chain.
This is a preparation to improvement of error code on reconfiguration
notifier failure.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/include/asm/pSeries_reconfig.h | 2 +-
arch/powerpc/platforms/pseries/dlpar.c | 10 +++-----
arch/powerpc/platforms/pseries/reconfig.c | 30 ++++++++++++++++----------
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/arch/powerpc/include/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h
index 89d2f99..23cd6cc 100644
--- a/arch/powerpc/include/asm/pSeries_reconfig.h
+++ b/arch/powerpc/include/asm/pSeries_reconfig.h
@@ -17,7 +17,7 @@
#ifdef CONFIG_PPC_PSERIES
extern int pSeries_reconfig_notifier_register(struct notifier_block *);
extern void pSeries_reconfig_notifier_unregister(struct notifier_block *);
-extern struct blocking_notifier_head pSeries_reconfig_chain;
+extern int pSeries_reconfig_notify(unsigned long action, void *p);
/* Not the best place to put this, will be fixed when we move some
* of the rtas suspend-me stuff to pseries */
extern void pSeries_coalesce_init(void);
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 57ceb92..e9be25b 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -262,12 +262,11 @@ int dlpar_attach_node(struct device_node *dn)
if (!dn->parent)
return -ENOMEM;
- rc = blocking_notifier_call_chain(&pSeries_reconfig_chain,
- PSERIES_RECONFIG_ADD, dn);
- if (rc == NOTIFY_BAD) {
+ rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn);
+ if (rc) {
printk(KERN_ERR "Failed to add device node %s\n",
dn->full_name);
- return -ENOMEM; /* For now, safe to assume kmalloc failure */
+ return rc;
}
of_attach_node(dn);
@@ -297,8 +296,7 @@ int dlpar_detach_node(struct device_node *dn)
remove_proc_entry(dn->pde->name, parent->pde);
#endif
- blocking_notifier_call_chain(&pSeries_reconfig_chain,
- PSERIES_RECONFIG_REMOVE, dn);
+ pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
of_detach_node(dn);
of_node_put(dn); /* Must decrement the refcount */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 1de2cbb..286b6af 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -97,7 +97,7 @@ static struct device_node *derive_parent(const char *path)
return parent;
}
-BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
+static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
int pSeries_reconfig_notifier_register(struct notifier_block *nb)
{
@@ -109,6 +109,16 @@ void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
}
+int pSeries_reconfig_notify(unsigned long action, void *p)
+{
+ int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
+ action, p);
+
+ if (err == NOTIFY_BAD)
+ return -ENOMEM; /* For now, safe to assume kmalloc failure */
+ return 0;
+}
+
static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
{
struct device_node *np;
@@ -132,11 +142,9 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
goto out_err;
}
- err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
- PSERIES_RECONFIG_ADD, np);
- if (err == NOTIFY_BAD) {
+ err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
+ if (err) {
printk(KERN_ERR "Failed to add device node %s\n", path);
- err = -ENOMEM; /* For now, safe to assume kmalloc failure */
goto out_err;
}
@@ -173,8 +181,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
remove_node_proc_entries(np);
- blocking_notifier_call_chain(&pSeries_reconfig_chain,
- PSERIES_RECONFIG_REMOVE, np);
+ pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
of_detach_node(np);
of_node_put(parent);
@@ -472,11 +479,10 @@ static int do_update_property(char *buf, size_t bufsize)
else
action = PSERIES_DRCONF_MEM_REMOVE;
- rc = blocking_notifier_call_chain(&pSeries_reconfig_chain,
- action, value);
- if (rc == NOTIFY_BAD) {
- rc = prom_update_property(np, oldprop, newprop);
- return -ENOMEM;
+ rc = pSeries_reconfig_notify(action, value);
+ if (rc) {
+ prom_update_property(np, oldprop, newprop);
+ return rc;
}
}
--
1.7.4.4
^ permalink raw reply related
* [PATCH] hwrng: ppc4xx - add support for ppc4xx TRNG
From: Josh Boyer @ 2011-06-21 12:19 UTC (permalink / raw)
To: Matt Mackall, Herbert Xu; +Cc: linuxppc-dev
Various PowerPC 4xx SoCs contain a TRNG embedded in the Security function.
This adds a device driver for that TRNG.
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
---
drivers/char/hw_random/Kconfig | 12 +++
drivers/char/hw_random/Makefile | 1 +
drivers/char/hw_random/ppc4xx-rng.c | 156 +++++++++++++++++++++++++++++++++++
3 files changed, 169 insertions(+), 0 deletions(-)
create mode 100644 drivers/char/hw_random/ppc4xx-rng.c
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index a60043b..1d2ebc7 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -210,3 +210,15 @@ config HW_RANDOM_PICOXCELL
module will be called picoxcell-rng.
If unsure, say Y.
+
+config HW_RANDOM_PPC4XX
+ tristate "PowerPC 4xx generic true random number generator support"
+ depends on HW_RANDOM && PPC && 4xx
+ ---help---
+ This driver provides the kernel-side support for the TRNG hardware
+ found in the security function of some PowerPC 4xx SoCs.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ppc4xx-rng.
+
+ If unsure, say N.
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index 3db4eb8..c88f244 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o
obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o
+obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o
diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c
new file mode 100644
index 0000000..b8afa6a
--- /dev/null
+++ b/drivers/char/hw_random/ppc4xx-rng.c
@@ -0,0 +1,156 @@
+/*
+ * Generic PowerPC 44x RNG driver
+ *
+ * Copyright 2011 IBM Corporation
+ *
+ * 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; version 2 of the License.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/hw_random.h>
+#include <linux/delay.h>
+#include <linux/of_platform.h>
+#include <asm/io.h>
+
+#define PPC4XX_TRNG_DEV_CTRL 0x60080
+
+#define PPC4XX_TRNGE 0x00020000
+#define PPC4XX_TRNG_CTRL 0x0008
+#define PPC4XX_TRNG_CTRL_DALM 0x20
+#define PPC4XX_TRNG_STAT 0x0004
+#define PPC4XX_TRNG_STAT_B 0x1
+#define PPC4XX_TRNG_DATA 0x0000
+
+#define MODULE_NAME "ppc4xx_rng"
+
+static int ppc4xx_rng_data_present(struct hwrng *rng, int wait)
+{
+ void __iomem *rng_regs = (void __iomem *) rng->priv;
+ int busy, i, present = 0;
+
+ for (i = 0; i < 20; i++) {
+ busy = (in_le32(rng_regs + PPC4XX_TRNG_STAT) & PPC4XX_TRNG_STAT_B);
+ if (!busy || !wait) {
+ present = 1;
+ break;
+ }
+ udelay(10);
+ }
+ return present;
+}
+
+static int ppc4xx_rng_data_read(struct hwrng *rng, u32 *data)
+{
+ void __iomem *rng_regs = (void __iomem *) rng->priv;
+ *data = in_le32(rng_regs + PPC4XX_TRNG_DATA);
+ return 4;
+}
+
+static int ppc4xx_rng_enable(int enable)
+{
+ struct device_node *ctrl;
+ void __iomem *ctrl_reg;
+ int err = 0;
+ u32 val;
+
+ /* Find the main crypto device node and map it to turn the TRNG on */
+ ctrl = of_find_compatible_node(NULL, NULL, "amcc,ppc4xx-crypto");
+ if (!ctrl)
+ return -ENODEV;
+
+ ctrl_reg = of_iomap(ctrl, 0);
+ if (!ctrl_reg) {
+ err = -ENODEV;
+ goto out;
+ }
+
+ val = in_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL);
+
+ if (enable)
+ val |= PPC4XX_TRNGE;
+ else
+ val = val & ~PPC4XX_TRNGE;
+
+ out_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL, val);
+ iounmap(ctrl_reg);
+
+out:
+ of_node_put(ctrl);
+
+ return err;
+}
+
+static struct hwrng ppc4xx_rng = {
+ .name = MODULE_NAME,
+ .data_present = ppc4xx_rng_data_present,
+ .data_read = ppc4xx_rng_data_read,
+};
+
+static int __devinit ppc4xx_rng_probe(struct platform_device *dev)
+{
+ void __iomem *rng_regs;
+ int err = 0;
+
+ rng_regs = of_iomap(dev->dev.of_node, 0);
+ if (!rng_regs)
+ return -ENODEV;
+
+ err = ppc4xx_rng_enable(1);
+ if (err)
+ return err;
+
+ out_le32(rng_regs + PPC4XX_TRNG_CTRL, PPC4XX_TRNG_CTRL_DALM);
+ ppc4xx_rng.priv = (unsigned long) rng_regs;
+
+ err = hwrng_register(&ppc4xx_rng);
+
+ return err;
+}
+
+static int __devexit ppc4xx_rng_remove(struct platform_device *dev)
+{
+ void __iomem *rng_regs = (void __iomem *) ppc4xx_rng.priv;
+
+ hwrng_unregister(&ppc4xx_rng);
+ ppc4xx_rng_enable(0);
+ iounmap(rng_regs);
+
+ return 0;
+}
+
+static struct of_device_id ppc4xx_rng_match[] = {
+ { .compatible = "ppc4xx-rng", },
+ { .compatible = "amcc,ppc460ex-rng", },
+ { .compatible = "amcc,ppc440epx-rng", },
+ {},
+};
+
+static struct platform_driver ppc4xx_rng_driver = {
+ .driver = {
+ .name = MODULE_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = ppc4xx_rng_match,
+ },
+ .probe = ppc4xx_rng_probe,
+ .remove = ppc4xx_rng_remove,
+};
+
+static int __init ppc4xx_rng_init(void)
+{
+ return platform_driver_register(&ppc4xx_rng_driver);
+}
+module_init(ppc4xx_rng_init);
+
+static void __exit ppc4xx_rng_exit(void)
+{
+ platform_driver_unregister(&ppc4xx_rng_driver);
+}
+module_exit(ppc4xx_rng_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Josh Boyer <jwboyer@linux.vnet.ibm.com>");
+MODULE_DESCRIPTION("HW RNG driver for PPC 4xx processors");
--
1.7.4.4
^ 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