* [PATCH v2 1/1 net-next] NET: FEC: dynamtic check DMA desc buff type
From: Lothar Waßmann @ 2012-12-28 14:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1356676164-10910-1-git-send-email-Frank.Li@freescale.com>
Frank Li writes:
> MX6 and mx28 support enhanced DMA descript buff to support 1588
> ptp. But MX25, MX3x, MX5x can't support enhanced DMA descript buff.
> Check fec type and choose correct DAM descript buff type.
^^^
s/DAM/DMA/
s/descript/descriptor/g
[...]
> diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> index 0704bca..290f91c 100644
> --- a/drivers/net/ethernet/freescale/fec.c
> +++ b/drivers/net/ethernet/freescale/fec.c
> @@ -76,6 +76,8 @@
> #define FEC_QUIRK_USE_GASKET (1 << 2)
> /* Controller has GBIT support */
> #define FEC_QUIRK_HAS_GBIT (1 << 3)
> +/* Controller has extend desc buffer */
> +#define FEC_QUICK_HAS_BUFDESC_EX (1 << 4)
^^^^^
As Sascha has already pointed out, this should be 'QUIRK' rather than
'QUICK' (like in the preceeding lines)!
> static struct platform_device_id fec_devtype[] = {
> {
> @@ -93,7 +95,8 @@ static struct platform_device_id fec_devtype[] = {
> .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
> }, {
> .name = "imx6q-fec",
> - .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT,
> + .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
> + FEC_QUICK_HAS_BUFDESC_EX,
^^^^^
same as above.
[...]
> @@ -1574,6 +1617,8 @@ fec_probe(struct platform_device *pdev)
> fep->pdev = pdev;
> fep->dev_id = dev_id++;
>
> + fep->bufdesc_ex = 0;
> +
> if (!fep->hwp) {
> ret = -ENOMEM;
> goto failed_ioremap;
> @@ -1628,19 +1673,19 @@ fec_probe(struct platform_device *pdev)
> goto failed_clk;
> }
>
> -#ifdef CONFIG_FEC_PTP
> fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp");
> + fep->bufdesc_ex =
> + pdev->id_entry->driver_data & FEC_QUICK_HAS_BUFDESC_EX;
^^^^^
same as above.
Lothar Wa?mann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
^ permalink raw reply
* Re: [PATCH/RFC] nl80211/cfg80211/mac80211: add NL80211_CMD_GET_MESH_SETUP
From: Johannes Berg @ 2012-12-28 14:43 UTC (permalink / raw)
To: Bob Copeland; +Cc: linux-wireless, thomas, devel
In-Reply-To: <20121214151442.GA10736@localhost>
On Fri, 2012-12-14 at 10:14 -0500, Bob Copeland wrote:
> Add a new netlink call to get the parameters used at join time
> for the mesh. This provides a way for userspace to get
> some basic mesh properties that are otherwise unavailable, such
> as the meshid and (eventually) configured dtim and beacon
> values.
>
> Signed-off-by: Bob Copeland <bob@cozybit.com>
> ---
> We can currently return the config values in GET_MESH_CONFIG
> but not the fixed join-time values.
>
> My use case is to have a way to get the locally configured
> dtim and beacon interval, once Marco's patches are in
> (obviously not handled yet in this patch). Note the local
> values might be different from peer mesh STAs' settings.
>
> Thomas suggested a general GET_MESH_SETUP would be good to
> also allow userspace to get the meshid and to know if mesh
> is running without doing a bogus SET_MESH_CONFIG.
>
> Presumably, once someone implements beacon collision avoidance,
> I'd rather have the current dtim/beacon_int values, which isn't
> really setup anymore, but maybe we don't care so much.
Seems fine, but I think you should document the latter. OTOH, maybe it
should just be documented that the setup values are hints only when that
is implemented ...
I guess the question is: would there be value in knowing what it was set
up with vs. what it's currently doing? Maybe because if other peers go
away it would fall back to the previous values?
Or maybe that just means that if the values are changed they should be
returned differently?
johannes
^ permalink raw reply
* Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available
From: JoonSoo Kim @ 2012-12-28 14:42 UTC (permalink / raw)
To: Sasha Levin
Cc: David Rientjes, Andrew Morton, Johannes Weiner, David S. Miller,
Tejun Heo, Yinghai Lu, linux-mm, linux-kernel
In-Reply-To: <50DCD4CB.50205@oracle.com>
Hello, Sasha.
2012/12/28 Sasha Levin <sasha.levin@oracle.com>:
> On 12/27/2012 06:04 PM, David Rientjes wrote:
>> On Thu, 27 Dec 2012, Sasha Levin wrote:
>>
>>> That's exactly what happens with the patch. Note that in the current upstream
>>> version there are several slab checks scattered all over.
>>>
>>> In this case for example, I'm removing it from __alloc_bootmem_node(), but the
>>> first code line of__alloc_bootmem_node_nopanic() is:
>>>
>>> if (WARN_ON_ONCE(slab_is_available()))
>>> return kzalloc(size, GFP_NOWAIT);
>>>
>>
>> You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice
>> that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(),
>> it calls ___alloc_bootmem_node_nopanic().
>
> Holy cow, this is an underscore hell.
>
>
> Thanks,
> Sasha
>
I have a different idea.
How about removing fallback allocation in bootmem.c completely?
I don't know why it is there exactly.
But, warning for 'slab_is_available()' is there for a long time.
So, most people who misuse fallback allocation change their code adequately.
I think that removing fallback at this time is valid. Isn't it?
Fallback allocation may cause possible bug.
If someone free a memory from fallback allocation,
it can't be handled properly.
So, IMHO, at this time, we should remove fallback allocation in
bootmem.c entirely.
Please let me know what I misunderstand.
Thanks.
^ permalink raw reply
* Re: [PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available
From: JoonSoo Kim @ 2012-12-28 14:42 UTC (permalink / raw)
To: Sasha Levin
Cc: David Rientjes, Andrew Morton, Johannes Weiner, David S. Miller,
Tejun Heo, Yinghai Lu, linux-mm, linux-kernel
In-Reply-To: <50DCD4CB.50205@oracle.com>
Hello, Sasha.
2012/12/28 Sasha Levin <sasha.levin@oracle.com>:
> On 12/27/2012 06:04 PM, David Rientjes wrote:
>> On Thu, 27 Dec 2012, Sasha Levin wrote:
>>
>>> That's exactly what happens with the patch. Note that in the current upstream
>>> version there are several slab checks scattered all over.
>>>
>>> In this case for example, I'm removing it from __alloc_bootmem_node(), but the
>>> first code line of__alloc_bootmem_node_nopanic() is:
>>>
>>> if (WARN_ON_ONCE(slab_is_available()))
>>> return kzalloc(size, GFP_NOWAIT);
>>>
>>
>> You're only talking about mm/bootmem.c and not mm/nobootmem.c, and notice
>> that __alloc_bootmem_node() does not call __alloc_bootmem_node_nopanic(),
>> it calls ___alloc_bootmem_node_nopanic().
>
> Holy cow, this is an underscore hell.
>
>
> Thanks,
> Sasha
>
I have a different idea.
How about removing fallback allocation in bootmem.c completely?
I don't know why it is there exactly.
But, warning for 'slab_is_available()' is there for a long time.
So, most people who misuse fallback allocation change their code adequately.
I think that removing fallback at this time is valid. Isn't it?
Fallback allocation may cause possible bug.
If someone free a memory from fallback allocation,
it can't be handled properly.
So, IMHO, at this time, we should remove fallback allocation in
bootmem.c entirely.
Please let me know what I misunderstand.
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: enable netbase network interfaces?
From: Gary Thomas @ 2012-12-28 14:38 UTC (permalink / raw)
To: Lai Eddy; +Cc: yocto
In-Reply-To: <CACrgodeMSvt9yr_M_VE0GqTHVFeYXTbMhFzALF762QjXaJMbmg@mail.gmail.com>
On 2012-12-27 23:40, Lai Eddy wrote:
> Thanks Gary,
>
> after download and extract the ti cortex A8 BSP . there's only binary image inside, what MACHINE to use to build a beagleboard yocto image?
MACHINE="beagleboard"
Why does this matter? You asked about how to set up *your* BSP to have
a tailored network interface file. All you need to do is pattern your
setup after the beagleboard one, as quoted.
n.b. please don't top-post :-(
>
> On 2012-12-25 16:31, Lai Eddy wrote:
>
> in the "Reference Manual "How do I make sure connected network interfaces are brought up by default?" said 2 files need to be added to enable network interfaces, where can I find
> template files?
> ------------------------------__------------------------------__------------------------------__-----------------
> The default interfaces file provided by the netbase recipe does not automatically bring up network interfaces. Therefore, you will need to add a BSP-specific netbase that includes
> an interfaces file.
> For example, add the following files to your layer:
> meta-MACHINE/recipes-bsp/__netbase/netbase/MACHINE/__interfaces
> meta-MACHINE/recipes-bsp/__netbase/netbase_5.0.bbappend
> ------------------------------__------------------------------__------------------------------__------------------
>
>
> Look in meta-ti (git://git.yoctoproject.org/__meta-ti <http://git.yoctoproject.org/meta-ti>):
> $ find meta-ti/recipes-core/netbase/
> meta-ti/recipes-core/netbase/
> meta-ti/recipes-core/netbase/__netbase-5.0
> meta-ti/recipes-core/netbase/__netbase-5.0/beagleboard
> meta-ti/recipes-core/netbase/__netbase-5.0/beagleboard/__interfaces
> meta-ti/recipes-core/netbase/__netbase_5.0.bbappend
>
>
>
> --
> ------------------------------__------------------------------
> Gary Thomas | Consulting for the
> MLB Associates | Embedded world
> ------------------------------__------------------------------
> _________________________________________________
> yocto mailing list
> yocto@yoctoproject.org <mailto:yocto@yoctoproject.org>
> https://lists.yoctoproject.__org/listinfo/yocto <https://lists.yoctoproject.org/listinfo/yocto>
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply
* Re: [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Andrew Lunn @ 2012-12-28 14:37 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Jason Cooper, len.brown-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w, linux ARM
In-Reply-To: <50DDAD68.4090704-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
On Fri, Dec 28, 2012 at 03:32:08PM +0100, Florian Fainelli wrote:
> Hello Andrew,
>
> Le 12/28/12 13:47, Andrew Lunn a ??crit :
> >Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> >into drivers/cpuidle. Convert the driver into a platform driver and
> >add a device tree binding. Add a DT node to instantiate the driver for
> >boards converted to DT, and a platform data for old style boards.
> >
> >Signed-off-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> >---
>
> [snip]
>
> >
> >+/*****************************************************************************
> >+ * CPU idle
> >+ ****************************************************************************/
> >+static struct resource kirkwood_cpuidle_resource[] = {
> >+ {
> >+ .flags = IORESOURCE_MEM,
> >+ .start = DDR_OPERATION_BASE,
> >+ .end = 3,
>
> Should not this be DDR_OPERATION_BASE + 3?
Yes it should.
Thanks
Andrew
^ permalink raw reply
* [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Andrew Lunn @ 2012-12-28 14:37 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <50DDAD68.4090704@openwrt.org>
On Fri, Dec 28, 2012 at 03:32:08PM +0100, Florian Fainelli wrote:
> Hello Andrew,
>
> Le 12/28/12 13:47, Andrew Lunn a ??crit :
> >Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> >into drivers/cpuidle. Convert the driver into a platform driver and
> >add a device tree binding. Add a DT node to instantiate the driver for
> >boards converted to DT, and a platform data for old style boards.
> >
> >Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> >---
>
> [snip]
>
> >
> >+/*****************************************************************************
> >+ * CPU idle
> >+ ****************************************************************************/
> >+static struct resource kirkwood_cpuidle_resource[] = {
> >+ {
> >+ .flags = IORESOURCE_MEM,
> >+ .start = DDR_OPERATION_BASE,
> >+ .end = 3,
>
> Should not this be DDR_OPERATION_BASE + 3?
Yes it should.
Thanks
Andrew
^ permalink raw reply
* Re: [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Andrew Lunn @ 2012-12-28 14:35 UTC (permalink / raw)
To: Rob Herring
Cc: Andrew Lunn, Jason Cooper, len.brown-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w, linux ARM
In-Reply-To: <50DDAA42.2020101-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On Fri, Dec 28, 2012 at 08:18:42AM -0600, Rob Herring wrote:
> On 12/28/2012 06:47 AM, Andrew Lunn wrote:
> > Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> > into drivers/cpuidle. Convert the driver into a platform driver and
> > add a device tree binding. Add a DT node to instantiate the driver for
> > boards converted to DT, and a platform data for old style boards.
>
> Is this an old comment? I don't see any platform data.
There is no platform data, since all the driver needs is an address of
the DDR control register. The code to create a platform device entry
is in common.c hunk.
>
> >
> > Signed-off-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> > ---
> > .../devicetree/bindings/power/qnap-poweroff.txt | 14 +++
> > arch/arm/boot/dts/kirkwood.dtsi | 5 +
> > arch/arm/configs/kirkwood_defconfig | 1 +
> > arch/arm/mach-kirkwood/Makefile | 1 -
> > arch/arm/mach-kirkwood/common.c | 23 ++++
> > arch/arm/mach-kirkwood/cpuidle.c | 73 -------------
> > arch/arm/mach-kirkwood/include/mach/kirkwood.h | 3 +-
> > drivers/cpuidle/Kconfig | 6 ++
> > drivers/cpuidle/Makefile | 1 +
> > drivers/cpuidle/cpuidle-kirkwood.c | 114 ++++++++++++++++++++
> > 10 files changed, 166 insertions(+), 75 deletions(-)
> > create mode 100644 Documentation/devicetree/bindings/power/qnap-poweroff.txt
> > delete mode 100644 arch/arm/mach-kirkwood/cpuidle.c
> > create mode 100644 drivers/cpuidle/cpuidle-kirkwood.c
> >
> > diff --git a/Documentation/devicetree/bindings/power/qnap-poweroff.txt b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> > new file mode 100644
> > index 0000000..e15a334
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> > @@ -0,0 +1,14 @@
> > +* QNAP Power Off
>
> This doesn't match the rest of the patch.
Yep, does not belong here. It should be in one of the next patches.
> > --- a/arch/arm/boot/dts/kirkwood.dtsi
> > +++ b/arch/arm/boot/dts/kirkwood.dtsi
> > @@ -23,6 +23,11 @@
> > #address-cells = <1>;
> > #size-cells = <1>;
> >
> > + cpuidle@1418 {
> > + compatible = "marvell,kirkwood-cpuidle";
> > + reg = <0x1418 0x4>;
> > + };
> > +
>
> This is describing what linux wants, not the hardware. This is a common
> problem with cpuidle drivers in that they use shared registers. I don't
> have a good solution, but this doesn't belong in DTS.
Do you have a bad solution?
I could just hard code the address, since its the same for all
kirkwood SoCs. Also, the register is not being used by any other
code on kirkwood, so its not shared.
>
> Rob
>
> > core_clk: core-clocks@10030 {
> > compatible = "marvell,kirkwood-core-clock";
> > reg = <0x10030 0x4>;
> > diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
> > index 93f3794..13482ea 100644
> > --- a/arch/arm/configs/kirkwood_defconfig
> > +++ b/arch/arm/configs/kirkwood_defconfig
> > @@ -56,6 +56,7 @@ CONFIG_AEABI=y
> > CONFIG_ZBOOT_ROM_TEXT=0x0
> > CONFIG_ZBOOT_ROM_BSS=0x0
> > CONFIG_CPU_IDLE=y
> > +CONFIG_CPU_IDLE_KIRKWOOD=y
> > CONFIG_NET=y
> > CONFIG_PACKET=y
> > CONFIG_UNIX=y
> > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> > index 8d2e5a9..d665309 100644
> > --- a/arch/arm/mach-kirkwood/Makefile
> > +++ b/arch/arm/mach-kirkwood/Makefile
> > @@ -19,7 +19,6 @@ obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> > obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> > obj-$(CONFIG_MACH_T5325) += t5325-setup.o
> >
> > -obj-$(CONFIG_CPU_IDLE) += cpuidle.o
> > obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
> > obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
> > obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
> > diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
> > index bac21a5..e8a2978 100644
> > --- a/arch/arm/mach-kirkwood/common.c
> > +++ b/arch/arm/mach-kirkwood/common.c
> > @@ -499,6 +499,28 @@ void __init kirkwood_wdt_init(void)
> > orion_wdt_init();
> > }
> >
> > +/*****************************************************************************
> > + * CPU idle
> > + ****************************************************************************/
> > +static struct resource kirkwood_cpuidle_resource[] = {
> > + {
> > + .flags = IORESOURCE_MEM,
> > + .start = DDR_OPERATION_BASE,
> > + .end = 3,
> > + },
> > +};
> > +
> > +static struct platform_device kirkwood_cpuidle = {
> > + .name = "kirkwood_cpuidle",
> > + .id = -1,
> > + .resource = kirkwood_cpuidle_resource,
> > + .num_resources = 1,
> > +};
> > +
> > +static void __init kirkwood_cpuidle_init(void)
> > +{
> > + platform_device_register(&kirkwood_cpuidle);
> > +}
> >
> > /*****************************************************************************
> > * Time handling
> > @@ -671,6 +693,7 @@ void __init kirkwood_init(void)
> > kirkwood_xor1_init();
> > kirkwood_crypto_init();
> >
> > + kirkwood_cpuidle_init();
> > #ifdef CONFIG_KEXEC
> > kexec_reinit = kirkwood_enable_pcie;
> > #endif
> > diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
> > deleted file mode 100644
> > index f730467..0000000
> > --- a/arch/arm/mach-kirkwood/cpuidle.c
> > +++ /dev/null
> > @@ -1,73 +0,0 @@
> > -/*
> > - * arch/arm/mach-kirkwood/cpuidle.c
> > - *
> > - * CPU idle Marvell Kirkwood SoCs
> > - *
> > - * This file is licensed under the terms of the GNU General Public
> > - * License version 2. This program is licensed "as is" without any
> > - * warranty of any kind, whether express or implied.
> > - *
> > - * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> > - * to implement two idle states -
> > - * #1 wait-for-interrupt
> > - * #2 wait-for-interrupt and DDR self refresh
> > - */
> > -
> > -#include <linux/kernel.h>
> > -#include <linux/init.h>
> > -#include <linux/platform_device.h>
> > -#include <linux/cpuidle.h>
> > -#include <linux/io.h>
> > -#include <linux/export.h>
> > -#include <asm/proc-fns.h>
> > -#include <asm/cpuidle.h>
> > -#include <mach/kirkwood.h>
> > -
> > -#define KIRKWOOD_MAX_STATES 2
> > -
> > -/* Actual code that puts the SoC in different idle states */
> > -static int kirkwood_enter_idle(struct cpuidle_device *dev,
> > - struct cpuidle_driver *drv,
> > - int index)
> > -{
> > - writel(0x7, DDR_OPERATION_BASE);
> > - cpu_do_idle();
> > -
> > - return index;
> > -}
> > -
> > -static struct cpuidle_driver kirkwood_idle_driver = {
> > - .name = "kirkwood_idle",
> > - .owner = THIS_MODULE,
> > - .en_core_tk_irqen = 1,
> > - .states[0] = ARM_CPUIDLE_WFI_STATE,
> > - .states[1] = {
> > - .enter = kirkwood_enter_idle,
> > - .exit_latency = 10,
> > - .target_residency = 100000,
> > - .flags = CPUIDLE_FLAG_TIME_VALID,
> > - .name = "DDR SR",
> > - .desc = "WFI and DDR Self Refresh",
> > - },
> > - .state_count = KIRKWOOD_MAX_STATES,
> > -};
> > -
> > -static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> > -
> > -/* Initialize CPU idle by registering the idle states */
> > -static int kirkwood_init_cpuidle(void)
> > -{
> > - struct cpuidle_device *device;
> > -
> > - device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > - device->state_count = KIRKWOOD_MAX_STATES;
> > -
> > - cpuidle_register_driver(&kirkwood_idle_driver);
> > - if (cpuidle_register_device(device)) {
> > - pr_err("kirkwood_init_cpuidle: Failed registering\n");
> > - return -EIO;
> > - }
> > - return 0;
> > -}
> > -
> > -device_initcall(kirkwood_init_cpuidle);
> > diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> > index 041653a..a05563a 100644
> > --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> > +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> > @@ -60,8 +60,9 @@
> > * Register Map
> > */
> > #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
> > +#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
> > #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500)
> > -#define DDR_OPERATION_BASE (DDR_VIRT_BASE + 0x1418)
> > +#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
> >
> > #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
> > #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)
> > diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> > index c4cc27e..071e2c3 100644
> > --- a/drivers/cpuidle/Kconfig
> > +++ b/drivers/cpuidle/Kconfig
> > @@ -39,4 +39,10 @@ config CPU_IDLE_CALXEDA
> > help
> > Select this to enable cpuidle on Calxeda processors.
> >
> > +config CPU_IDLE_KIRKWOOD
> > + bool "CPU Idle Driver for Kirkwood processors"
> > + depends on ARCH_KIRKWOOD
> > + help
> > + Select this to enable cpuidle on Kirkwood processors.
> > +
> > endif
> > diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> > index 03ee874..24c6e7d 100644
> > --- a/drivers/cpuidle/Makefile
> > +++ b/drivers/cpuidle/Makefile
> > @@ -6,3 +6,4 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
> > obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
> >
> > obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
> > +obj-$(CONFIG_CPU_IDLE_KIRKWOOD) += cpuidle-kirkwood.o
> > diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> > new file mode 100644
> > index 0000000..2d9d5b3
> > --- /dev/null
> > +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> > @@ -0,0 +1,114 @@
> > +/*
> > + * arch/arm/mach-kirkwood/cpuidle.c
> > + *
> > + * CPU idle Marvell Kirkwood SoCs
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2. This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + *
> > + * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> > + * to implement two idle states -
> > + * #1 wait-for-interrupt
> > + * #2 wait-for-interrupt and DDR self refresh
> > + */
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/cpuidle.h>
> > +#include <linux/io.h>
> > +#include <linux/export.h>
> > +#include <linux/of.h>
> > +#include <asm/proc-fns.h>
> > +#include <asm/cpuidle.h>
> > +
> > +#define KIRKWOOD_MAX_STATES 2
> > +
> > +static void __iomem *ddr_operation_base;
> > +
> > +/* Actual code that puts the SoC in different idle states */
> > +static int kirkwood_enter_idle(struct cpuidle_device *dev,
> > + struct cpuidle_driver *drv,
> > + int index)
> > +{
> > + writel(0x7, ddr_operation_base);
> > + cpu_do_idle();
> > +
> > + return index;
> > +}
> > +
> > +static struct cpuidle_driver kirkwood_idle_driver = {
> > + .name = "kirkwood_idle",
> > + .owner = THIS_MODULE,
> > + .en_core_tk_irqen = 1,
> > + .states[0] = ARM_CPUIDLE_WFI_STATE,
> > + .states[1] = {
> > + .enter = kirkwood_enter_idle,
> > + .exit_latency = 10,
> > + .target_residency = 100000,
> > + .flags = CPUIDLE_FLAG_TIME_VALID,
> > + .name = "DDR SR",
> > + .desc = "WFI and DDR Self Refresh",
> > + },
> > + .state_count = KIRKWOOD_MAX_STATES,
> > +};
> > +static struct cpuidle_device *device;
> > +
> > +static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> > +
> > +/* Initialize CPU idle by registering the idle states */
> > +static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> > +{
> > + struct resource *res;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (res == NULL)
> > + return -EINVAL;
> > +
> > + ddr_operation_base = devm_ioremap(&pdev->dev, res->start,
> > + resource_size(res));
> > + if (ddr_operation_base == NULL)
> > + return -EINVAL;
> > +
> > + device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > + device->state_count = KIRKWOOD_MAX_STATES;
> > +
> > + cpuidle_register_driver(&kirkwood_idle_driver);
> > + if (cpuidle_register_device(device)) {
> > + pr_err("kirkwood_init_cpuidle: Failed registering\n");
> > + return -EIO;
> > + }
> > + return 0;
> > +}
> > +
> > +int kirkwood_cpuidle_remove(struct platform_device *pdev)
> > +{
> > + cpuidle_unregister_device(device);
> > + cpuidle_unregister_driver(&kirkwood_idle_driver);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id of_kirkwood_cpuidle_match[] = {
> > + { .compatible = "marvell,kirkwood-cpuidle", },
> > + {},
> > +};
> > +
> > +static struct platform_driver kirkwood_cpuidle_driver = {
> > + .probe = kirkwood_cpuidle_probe,
> > + .remove = __devexit_p(kirkwood_cpuidle_remove),
> > + .driver = {
> > + .name = "kirkwood_cpuidle",
> > + .owner = THIS_MODULE,
> > + .of_match_table = of_kirkwood_cpuidle_match,
> > + },
> > +};
> > +
> > +module_platform_driver(kirkwood_cpuidle_driver);
> > +
> > +MODULE_AUTHOR("Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>");
> > +MODULE_DESCRIPTION("Kirkwood cpu idle driver");
> > +MODULE_LICENSE("GPLv2");
> > +MODULE_ALIAS("platform:kirkwood-cpuidle");
> >
>
^ permalink raw reply
* [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Andrew Lunn @ 2012-12-28 14:35 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <50DDAA42.2020101@gmail.com>
On Fri, Dec 28, 2012 at 08:18:42AM -0600, Rob Herring wrote:
> On 12/28/2012 06:47 AM, Andrew Lunn wrote:
> > Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> > into drivers/cpuidle. Convert the driver into a platform driver and
> > add a device tree binding. Add a DT node to instantiate the driver for
> > boards converted to DT, and a platform data for old style boards.
>
> Is this an old comment? I don't see any platform data.
There is no platform data, since all the driver needs is an address of
the DDR control register. The code to create a platform device entry
is in common.c hunk.
>
> >
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > ---
> > .../devicetree/bindings/power/qnap-poweroff.txt | 14 +++
> > arch/arm/boot/dts/kirkwood.dtsi | 5 +
> > arch/arm/configs/kirkwood_defconfig | 1 +
> > arch/arm/mach-kirkwood/Makefile | 1 -
> > arch/arm/mach-kirkwood/common.c | 23 ++++
> > arch/arm/mach-kirkwood/cpuidle.c | 73 -------------
> > arch/arm/mach-kirkwood/include/mach/kirkwood.h | 3 +-
> > drivers/cpuidle/Kconfig | 6 ++
> > drivers/cpuidle/Makefile | 1 +
> > drivers/cpuidle/cpuidle-kirkwood.c | 114 ++++++++++++++++++++
> > 10 files changed, 166 insertions(+), 75 deletions(-)
> > create mode 100644 Documentation/devicetree/bindings/power/qnap-poweroff.txt
> > delete mode 100644 arch/arm/mach-kirkwood/cpuidle.c
> > create mode 100644 drivers/cpuidle/cpuidle-kirkwood.c
> >
> > diff --git a/Documentation/devicetree/bindings/power/qnap-poweroff.txt b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> > new file mode 100644
> > index 0000000..e15a334
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> > @@ -0,0 +1,14 @@
> > +* QNAP Power Off
>
> This doesn't match the rest of the patch.
Yep, does not belong here. It should be in one of the next patches.
> > --- a/arch/arm/boot/dts/kirkwood.dtsi
> > +++ b/arch/arm/boot/dts/kirkwood.dtsi
> > @@ -23,6 +23,11 @@
> > #address-cells = <1>;
> > #size-cells = <1>;
> >
> > + cpuidle at 1418 {
> > + compatible = "marvell,kirkwood-cpuidle";
> > + reg = <0x1418 0x4>;
> > + };
> > +
>
> This is describing what linux wants, not the hardware. This is a common
> problem with cpuidle drivers in that they use shared registers. I don't
> have a good solution, but this doesn't belong in DTS.
Do you have a bad solution?
I could just hard code the address, since its the same for all
kirkwood SoCs. Also, the register is not being used by any other
code on kirkwood, so its not shared.
>
> Rob
>
> > core_clk: core-clocks at 10030 {
> > compatible = "marvell,kirkwood-core-clock";
> > reg = <0x10030 0x4>;
> > diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
> > index 93f3794..13482ea 100644
> > --- a/arch/arm/configs/kirkwood_defconfig
> > +++ b/arch/arm/configs/kirkwood_defconfig
> > @@ -56,6 +56,7 @@ CONFIG_AEABI=y
> > CONFIG_ZBOOT_ROM_TEXT=0x0
> > CONFIG_ZBOOT_ROM_BSS=0x0
> > CONFIG_CPU_IDLE=y
> > +CONFIG_CPU_IDLE_KIRKWOOD=y
> > CONFIG_NET=y
> > CONFIG_PACKET=y
> > CONFIG_UNIX=y
> > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> > index 8d2e5a9..d665309 100644
> > --- a/arch/arm/mach-kirkwood/Makefile
> > +++ b/arch/arm/mach-kirkwood/Makefile
> > @@ -19,7 +19,6 @@ obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> > obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> > obj-$(CONFIG_MACH_T5325) += t5325-setup.o
> >
> > -obj-$(CONFIG_CPU_IDLE) += cpuidle.o
> > obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
> > obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
> > obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
> > diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
> > index bac21a5..e8a2978 100644
> > --- a/arch/arm/mach-kirkwood/common.c
> > +++ b/arch/arm/mach-kirkwood/common.c
> > @@ -499,6 +499,28 @@ void __init kirkwood_wdt_init(void)
> > orion_wdt_init();
> > }
> >
> > +/*****************************************************************************
> > + * CPU idle
> > + ****************************************************************************/
> > +static struct resource kirkwood_cpuidle_resource[] = {
> > + {
> > + .flags = IORESOURCE_MEM,
> > + .start = DDR_OPERATION_BASE,
> > + .end = 3,
> > + },
> > +};
> > +
> > +static struct platform_device kirkwood_cpuidle = {
> > + .name = "kirkwood_cpuidle",
> > + .id = -1,
> > + .resource = kirkwood_cpuidle_resource,
> > + .num_resources = 1,
> > +};
> > +
> > +static void __init kirkwood_cpuidle_init(void)
> > +{
> > + platform_device_register(&kirkwood_cpuidle);
> > +}
> >
> > /*****************************************************************************
> > * Time handling
> > @@ -671,6 +693,7 @@ void __init kirkwood_init(void)
> > kirkwood_xor1_init();
> > kirkwood_crypto_init();
> >
> > + kirkwood_cpuidle_init();
> > #ifdef CONFIG_KEXEC
> > kexec_reinit = kirkwood_enable_pcie;
> > #endif
> > diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
> > deleted file mode 100644
> > index f730467..0000000
> > --- a/arch/arm/mach-kirkwood/cpuidle.c
> > +++ /dev/null
> > @@ -1,73 +0,0 @@
> > -/*
> > - * arch/arm/mach-kirkwood/cpuidle.c
> > - *
> > - * CPU idle Marvell Kirkwood SoCs
> > - *
> > - * This file is licensed under the terms of the GNU General Public
> > - * License version 2. This program is licensed "as is" without any
> > - * warranty of any kind, whether express or implied.
> > - *
> > - * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> > - * to implement two idle states -
> > - * #1 wait-for-interrupt
> > - * #2 wait-for-interrupt and DDR self refresh
> > - */
> > -
> > -#include <linux/kernel.h>
> > -#include <linux/init.h>
> > -#include <linux/platform_device.h>
> > -#include <linux/cpuidle.h>
> > -#include <linux/io.h>
> > -#include <linux/export.h>
> > -#include <asm/proc-fns.h>
> > -#include <asm/cpuidle.h>
> > -#include <mach/kirkwood.h>
> > -
> > -#define KIRKWOOD_MAX_STATES 2
> > -
> > -/* Actual code that puts the SoC in different idle states */
> > -static int kirkwood_enter_idle(struct cpuidle_device *dev,
> > - struct cpuidle_driver *drv,
> > - int index)
> > -{
> > - writel(0x7, DDR_OPERATION_BASE);
> > - cpu_do_idle();
> > -
> > - return index;
> > -}
> > -
> > -static struct cpuidle_driver kirkwood_idle_driver = {
> > - .name = "kirkwood_idle",
> > - .owner = THIS_MODULE,
> > - .en_core_tk_irqen = 1,
> > - .states[0] = ARM_CPUIDLE_WFI_STATE,
> > - .states[1] = {
> > - .enter = kirkwood_enter_idle,
> > - .exit_latency = 10,
> > - .target_residency = 100000,
> > - .flags = CPUIDLE_FLAG_TIME_VALID,
> > - .name = "DDR SR",
> > - .desc = "WFI and DDR Self Refresh",
> > - },
> > - .state_count = KIRKWOOD_MAX_STATES,
> > -};
> > -
> > -static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> > -
> > -/* Initialize CPU idle by registering the idle states */
> > -static int kirkwood_init_cpuidle(void)
> > -{
> > - struct cpuidle_device *device;
> > -
> > - device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > - device->state_count = KIRKWOOD_MAX_STATES;
> > -
> > - cpuidle_register_driver(&kirkwood_idle_driver);
> > - if (cpuidle_register_device(device)) {
> > - pr_err("kirkwood_init_cpuidle: Failed registering\n");
> > - return -EIO;
> > - }
> > - return 0;
> > -}
> > -
> > -device_initcall(kirkwood_init_cpuidle);
> > diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> > index 041653a..a05563a 100644
> > --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> > +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> > @@ -60,8 +60,9 @@
> > * Register Map
> > */
> > #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
> > +#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
> > #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500)
> > -#define DDR_OPERATION_BASE (DDR_VIRT_BASE + 0x1418)
> > +#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
> >
> > #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
> > #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)
> > diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> > index c4cc27e..071e2c3 100644
> > --- a/drivers/cpuidle/Kconfig
> > +++ b/drivers/cpuidle/Kconfig
> > @@ -39,4 +39,10 @@ config CPU_IDLE_CALXEDA
> > help
> > Select this to enable cpuidle on Calxeda processors.
> >
> > +config CPU_IDLE_KIRKWOOD
> > + bool "CPU Idle Driver for Kirkwood processors"
> > + depends on ARCH_KIRKWOOD
> > + help
> > + Select this to enable cpuidle on Kirkwood processors.
> > +
> > endif
> > diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> > index 03ee874..24c6e7d 100644
> > --- a/drivers/cpuidle/Makefile
> > +++ b/drivers/cpuidle/Makefile
> > @@ -6,3 +6,4 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
> > obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
> >
> > obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
> > +obj-$(CONFIG_CPU_IDLE_KIRKWOOD) += cpuidle-kirkwood.o
> > diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> > new file mode 100644
> > index 0000000..2d9d5b3
> > --- /dev/null
> > +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> > @@ -0,0 +1,114 @@
> > +/*
> > + * arch/arm/mach-kirkwood/cpuidle.c
> > + *
> > + * CPU idle Marvell Kirkwood SoCs
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2. This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + *
> > + * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> > + * to implement two idle states -
> > + * #1 wait-for-interrupt
> > + * #2 wait-for-interrupt and DDR self refresh
> > + */
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/cpuidle.h>
> > +#include <linux/io.h>
> > +#include <linux/export.h>
> > +#include <linux/of.h>
> > +#include <asm/proc-fns.h>
> > +#include <asm/cpuidle.h>
> > +
> > +#define KIRKWOOD_MAX_STATES 2
> > +
> > +static void __iomem *ddr_operation_base;
> > +
> > +/* Actual code that puts the SoC in different idle states */
> > +static int kirkwood_enter_idle(struct cpuidle_device *dev,
> > + struct cpuidle_driver *drv,
> > + int index)
> > +{
> > + writel(0x7, ddr_operation_base);
> > + cpu_do_idle();
> > +
> > + return index;
> > +}
> > +
> > +static struct cpuidle_driver kirkwood_idle_driver = {
> > + .name = "kirkwood_idle",
> > + .owner = THIS_MODULE,
> > + .en_core_tk_irqen = 1,
> > + .states[0] = ARM_CPUIDLE_WFI_STATE,
> > + .states[1] = {
> > + .enter = kirkwood_enter_idle,
> > + .exit_latency = 10,
> > + .target_residency = 100000,
> > + .flags = CPUIDLE_FLAG_TIME_VALID,
> > + .name = "DDR SR",
> > + .desc = "WFI and DDR Self Refresh",
> > + },
> > + .state_count = KIRKWOOD_MAX_STATES,
> > +};
> > +static struct cpuidle_device *device;
> > +
> > +static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> > +
> > +/* Initialize CPU idle by registering the idle states */
> > +static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> > +{
> > + struct resource *res;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (res == NULL)
> > + return -EINVAL;
> > +
> > + ddr_operation_base = devm_ioremap(&pdev->dev, res->start,
> > + resource_size(res));
> > + if (ddr_operation_base == NULL)
> > + return -EINVAL;
> > +
> > + device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> > + device->state_count = KIRKWOOD_MAX_STATES;
> > +
> > + cpuidle_register_driver(&kirkwood_idle_driver);
> > + if (cpuidle_register_device(device)) {
> > + pr_err("kirkwood_init_cpuidle: Failed registering\n");
> > + return -EIO;
> > + }
> > + return 0;
> > +}
> > +
> > +int kirkwood_cpuidle_remove(struct platform_device *pdev)
> > +{
> > + cpuidle_unregister_device(device);
> > + cpuidle_unregister_driver(&kirkwood_idle_driver);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id of_kirkwood_cpuidle_match[] = {
> > + { .compatible = "marvell,kirkwood-cpuidle", },
> > + {},
> > +};
> > +
> > +static struct platform_driver kirkwood_cpuidle_driver = {
> > + .probe = kirkwood_cpuidle_probe,
> > + .remove = __devexit_p(kirkwood_cpuidle_remove),
> > + .driver = {
> > + .name = "kirkwood_cpuidle",
> > + .owner = THIS_MODULE,
> > + .of_match_table = of_kirkwood_cpuidle_match,
> > + },
> > +};
> > +
> > +module_platform_driver(kirkwood_cpuidle_driver);
> > +
> > +MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
> > +MODULE_DESCRIPTION("Kirkwood cpu idle driver");
> > +MODULE_LICENSE("GPLv2");
> > +MODULE_ALIAS("platform:kirkwood-cpuidle");
> >
>
^ permalink raw reply
* Re: [CRIU] [PATCH 1/4] signalfd: add ability to return siginfo in a raw format
From: Andrey Wagin @ 2012-12-28 14:28 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Vagin, Pavel Emelyanov, David Howells, linux-kernel, criu,
Cyrill Gorcunov, Alexander Viro, linux-fsdevel, Thomas Gleixner,
Paul E. McKenney, Michael Kerrisk
In-Reply-To: <20121228141249.GA24229@redhat.com>
2012/12/28 Oleg Nesterov <oleg@redhat.com>:
> On 12/27, Andrey Wagin wrote:
>>
>> 2012/12/27 Oleg Nesterov <oleg@redhat.com>:
>> > On 12/27, Andrey Wagin wrote:
>> >>
>> >> On Wed, Dec 26, 2012 at 05:31:12PM +0100, Oleg Nesterov wrote:
>> >> >
>> >> > So I think we should not use llseek. But, probably we can rely on pread() ?
>> >> > This way we can avoid the problem above, and this looks even simpler.
>> >>
>> >> Yes. It is a good idea. A new patch is attached to this email. I
>> >> implemented pread for signalfd and fixed all your previous comments.
>> >>
>> ...
>> > I think it would be better to pass ppos, not *ppos, because ...
>> >
>> >> + if (*ppos)
>> >> + (*ppos)++;
>> >
>> > in this case we can update *ppos in signalfd_peek() and simplify the
>> > code a bit.
>> >
>> > Compared to the previous version it is "safe" to change *ppos even if
>> > copy_to_user() fails, *ppos will be "lost" anyway after we return.
>>
>> Yes. But ppos is updated, because pread() reads all siginfo-s from a queue,
>> which fit in a buffer starting with the initial ppos.
>
> Can't understand. And I guess you misunderstood.
>
> I meant, we can update *ppos in signalfd_peek() _and_ we can do this
> unconditionally even if copy_to_user() failed.
I see. Any way I fixed that in a new version of this patch. Thanks.
The new patch is a part of
[PATCH 0/3] signalfd: a kernel interface for dumping/restoring pending
signals (v2)
>
>> >> @@ -321,6 +372,7 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
>> >> }
>> >>
>> >> file->f_flags |= flags & SFD_RAW;
>> >> + file->f_mode |= FMODE_PREAD;
>> >>
>> >> fd_install(ufd, file);
>> >
>> > Hmm. Looks like it is based on other patches I didnt see...
>> >
>> > But I don't understand how FMODE_PREAD connects to this patch, we need
>> > this flag set even for regular sys_read() ???
>>
>> It doesn't need for sys_read(), but this patch is about pread() and
>> sys_pread() checks it.
>>
>> SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
>> size_t count, loff_t pos)
>> {
>> ....
>> if (f.file) {
>> ret = -ESPIPE;
>> if (f.file->f_mode & FMODE_PREAD)
>> ret = vfs_read(f.file, buf, count, &pos);
>
> And sys_read() checks it too, that was my point.
sys_read() doesn't check this flag. I tryed to remove this code from
this patch and pread returned ESPIPE as expected.
>
> So either this code was already broken before this patch, or FMODE_PREAD
> is already set and you do not need this chunk.
>
> Oleg.
>
^ permalink raw reply
* hvm_emulate_one() usage
From: Razvan Cojocaru @ 2012-12-28 14:34 UTC (permalink / raw)
To: xen-devel@lists.xen.org
Hello,
I have a dom0 userspace application that receives mem_events. Mem_events
are being received if a page fault occurs, and until I clear the page
access rights I keep receiving the event in a loop. If I do clear the
page access rights, I will no longer receive mem_events for said page.
What I thought I'd do was to add a new flag to the mem_event response
(MEM_EVENT_FLAG_EMULATE_WRITE), and have this code execute in
p2m_mem_access_resume() in xen/arch/x86/mm/p2m.c:
mem_event_get_response(d, &rsp);
if ( rsp.flags & MEM_EVENT_FLAG_EMULATE_WRITE )
{
struct hvm_emulate_ctxt ctx[1] = {};
struct vcpu *current_vcpu = current;
set_current(d->vcpu[rsp.vcpu_id]);
hvm_emulate_prepare(ctx, guest_cpu_user_regs());
hvm_emulate_one(ctx);
set_current(current_vcpu);
}
The code is supposed to go past the write instruction (without lifting
the page access restrictions). What it does seem to achieve is this:
(XEN) ----[ Xen-4.1.2 x86_64 debug=n Not tainted ]----
(XEN) CPU: 6
(XEN) RIP: e008:[<ffff82c4801bf4ea>] vmx_get_interrupt_shadow+0xa/0x10
(XEN) RFLAGS: 0000000000010203 CONTEXT: hypervisor
(XEN) rax: 0000000000004824 rbx: ffff83013c0c7ba0 rcx: 0000000000000008
(XEN) rdx: 0000000000000005 rsi: ffff83013c0c7f18 rdi: ffff8300bfca8000
(XEN) rbp: ffff83013c0c7f18 rsp: ffff83013c0c7b50 r8: 0000000000000002
(XEN) r9: 0000000000000002 r10: ffff82c48020af40 r11: 0000000000000282
(XEN) r12: ffff8300bfff2000 r13: ffff88012b478b18 r14: 00007fffd669c4c0
(XEN) r15: ffff83013c0c7e48 cr0: 0000000080050033 cr4: 00000000000026f0
(XEN) cr3: 000000005d6c4000 cr2: 000000000221e538
(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen stack trace from rsp=ffff83013c0c7b50:
(XEN) ffff82c4801a1a91 ffff83013f986000 ffff83013f986000 ffff83013c0c7f18
(XEN) ffff82c4801ce0e1 0000000500050000 000000000003f31a 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 ffff83013f986000 ffff8300bfff2000 ffff83013c0c7e48
(XEN) ffff82c4801d1d81 ffff8300bfcac000 ffff82c4801d05c5 ffff83013c0c7f18
(XEN) ffff82c4801a1447 ffff8300bfcac000 0000000000d7e004 0000000000d7e004
(XEN) ffff83013c0c7e48 ffff88012b478b18 00007fffd669c4c0 ffff83013c0c7e48
(XEN) ffff82c48014eb79 0000000000000000 000000000005d6f9 ffff82f600badf20
(XEN) 0000000000000000 4000000000000000 ffff82f600badf20 0000000000000000
(XEN) ffff88012fc0b928 0000000000000001 ffff82c48016bc4b ffff82f600badf20
(XEN) ffff82c48016c0b8 ffff83013c0ac000 ffff83013c0ac000 ffff82f600bb1940
(XEN) 000000000000000f ffff83013c0c7f18 ffff83013c0ac000 ffff82f600bb1940
(XEN) fffffffffffffff3 0000000000d7e004 ffff83013c0c7e48 ffff88012b478b18
(XEN) Xen call trace:
(XEN) [<ffff82c4801bf4ea>] vmx_get_interrupt_shadow+0xa/0x10
(XEN) [<ffff82c4801a1a91>] hvm_emulate_prepare+0x31/0x80
(XEN) [<ffff82c4801ce0e1>] p2m_mem_access_resume+0xe1/0x120
(XEN) [<ffff82c4801d1d81>] mem_access_domctl+0x21/0x30
(XEN) [<ffff82c4801d05c5>] mem_event_domctl+0x295/0x3b0
(XEN) [<ffff82c4801a1447>] hvmemul_do_pio+0x27/0x30
(XEN) [<ffff82c48014eb79>] arch_do_domctl+0x2e9/0x28a0
(XEN) [<ffff82c48016bc4b>] get_page_type+0xb/0x20
(XEN) [<ffff82c48016c0b8>] get_page_and_type_from_pagenr+0x78/0xe0
(XEN) [<ffff82c4801025bb>] do_domctl+0xfb/0x10b0
(XEN) [<ffff82c4801f2fa6>] ept_get_entry+0x136/0x250
(XEN) [<ffff82c480180965>] copy_to_user+0x25/0x70
(XEN) [<ffff82c4801f8778>] syscall_enter+0x88/0x8d
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 6:
(XEN) FATAL TRAP: vector = 6 (invalid opcode)
(XEN) ****************************************
I could find no documentation on either the hvm_*(), or the cpu-related
functions. Obviously the hvm_emulate_prepare() call crashes the
hypervisor, most likely because of the guest_cpu_user_regs() parameter,
but "regs" is not being passed to p2m_mem_access_resume() (like it is
being passed to p2m_mem_access_check()). I would appreciate your help in
figuring out how to implement this.
Thanks, and happy holidays,
Razvan Cojocaru
^ permalink raw reply
* Re: [PATCH RESEND] vfs: re-implement writeback_inodes_sb(_nr)_if_idle() and rename them
From: David Sterba @ 2012-12-28 14:33 UTC (permalink / raw)
To: Miao Xie
Cc: Linux Fsdevel, Linux Btrfs, Linux Ext4, Christoph Hellwig,
Kamal Mostafa, Al Viro
In-Reply-To: <50D2E3DF.4010105@cn.fujitsu.com>
On Thu, Dec 20, 2012 at 06:09:35PM +0800, Miao Xie wrote:
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1314,7 +1314,6 @@ void writeback_inodes_sb_nr(struct super_block *sb,
> bdi_queue_work(sb->s_bdi, &work);
> wait_for_completion(&done);
> }
> -EXPORT_SYMBOL(writeback_inodes_sb_nr);
Why do you remove the export? writeback_inodes_sb is exported as well.
Originally the _nr variant has been introduced for btrfs
(3259f8bed2f0f57c2fdcdac1b510c3fa319ef97e) and there are no other users
now, so from that point it would make sense. From the other side, the
change is not strictly necessary for this patch and keeps the writeback
API a bit more flexible. I vote for keeping it.
Otherwise (for the btrfs part),
Tested-by: David Sterba <dsterba@suse.cz>
thanks,
david
^ permalink raw reply
* Re: [PATCH 00/28][RFC] systemd Integration
From: Radu Moisan @ 2012-12-28 14:24 UTC (permalink / raw)
To: Saul Wold; +Cc: openembedded-core
In-Reply-To: <50D8FDBE.4030203@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4753 bytes --]
On 12/25/2012 03:13 AM, Saul Wold wrote:
> On 12/20/2012 09:11 AM, Radu Moisan wrote:
>> I've rebased my branch, again :), with some cleanups here and there
>> I also pushed a few patches suggested by Martin.
>> Feel free to comment on everything.
>>
>> The following changes since commit
>> 958162e96b4a4f23bca94500b5f20975633dd5c6:
>>
>> bitbake: hob: use base image only if it was set (2012-12-14
>> 17:31:31 +0000)
>>
>> are available in the git repository at:
>>
>> git://git.yoctoproject.org/poky-contrib rmoisan/systemd
>> http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=rmoisan/systemd
>>
>> Enrico Scholz (1):
>> systemd: move disable operation into prerm() script
>>
>> Holger Hans Peter Freyther (2):
>> systemd: Make the main systemd files proper CONFFILES
>> systemd: Introduce a create-volatile to create tmp directories
>>
>> Khem Raj (1):
>> systemd: Fix build when base_libdir is not /lib
>>
>> Martin Donnelly (2):
>> cgroups: Add INSANE_SKIP to avoid warning about .so file
>> Remove sysvinit mount related services if systemd is enabled
>>
>> Martin Jansa (2):
>> systemd-systemctl-native: fix FILESPATH to find systemctl
>> systemd: add PACKAGES_DYNAMIC
>>
>> Radu Moisan (20):
>> Systemd initial integration
>> Add DISTRO_FEATURES_INITMAN to DISTRO_FEATURES
>> Automatically set PREFERRED_PROVIDER_udev
>> Add systemd_base.bbclass
>> Include systemd-compat-units and avahi-systemd
>> Inherit the systemd_base class
>> set default.target to multi-user.target
>> wpa-supplicant: Fix indentation
>> dropbear: Fix indentation and cleanup
>> systemd: Some more cleanup
>> systemd: disable source rcS-default
>> polkit: merge together the two instances of PACKAGECONFIG
>> systemd-native: update FILESPATH with *-native directory
>> systemd: Remove gitpkgv.bbclass
>> systemd: (temporary) remove dependency on cairo
>> initscripts: Cleanup recipe
>> systemd: disable sysfs.service
>> xserver-nodm-init: add systemd support
>> util-linux: Enable systemd support
>> lighttpd: Remove automake patch
>>
>
> Please be sure to build this with the INCOMPATIBLE_LICENSE = "GPLv3"
> settig, I saw the following issues on the Autobuilder.
I've seen a patch from Martin Ertsaas <mailto:mertsas@cisco.com> which
will allow us to compile systemd without xz. I'll take a look over it.
>
>>
>> NOTE: Resolving any missing task queue dependencies
>> ERROR: Nothing PROVIDES 'xz' (but
>> /srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-non-gpl3/build/meta/recipes-core/systemd/systemd_git.bb
>> DEPENDS on or otherwise requires it)
>> ERROR: xz was skipped: incompatible with license GPLv2+ & GPLv3+ &
>> LGPLv2.1+
>> ERROR: Nothing RPROVIDES 'udev-systemd' (but
>> /srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-non-gpl3/build/meta/recipes-core/systemd/systemd_git.bb
>> RDEPENDS on or otherwise requires it)
>> ERROR: No eligible RPROVIDERs exist for 'udev-systemd'
>> NOTE: Runtime target 'udev-systemd' is unbuildable, removing...
>> Missing or unbuildable dependency chain was: ['udev-systemd']
>> ERROR: Nothing RPROVIDES 'systemd' (but
>> /srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-non-gpl3/build/meta/recipes-core/systemd/systemd_git.bb
>> RDEPENDS on or otherwise requires it)
>> ERROR: No eligible RPROVIDERs exist for 'systemd'
>> NOTE: Runtime target 'systemd' is unbuildable, removing...
>> Missing or unbuildable dependency chain was: ['systemd']
>> ERROR: Nothing RPROVIDES 'systemd-dev' (but
>> /srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-non-gpl3/build/meta/recipes-core/systemd/systemd_git.bb
>> RDEPENDS on or otherwise requires it)
>> ERROR: No eligible RPROVIDERs exist for 'systemd-dev'
>> NOTE: Runtime target 'systemd-dev' is unbuildable, removing...
>> Missing or unbuildable dependency chain was: ['systemd-dev']
>> NOTE: Runtime target 'systemd-serialgetty' is unbuildable, removing...
>> Missing or unbuildable dependency chain was: ['systemd-serialgetty']
>> NOTE: Preparing runqueue
>> NOTE: Executing SetScene Tasks
>
> Also, you do not provide very clear information at the beginning, but
> I assume to enable systemd, it's just setting DISTRO_FEATURE +=
> "systemd", or is there more?
>
DISTRO_FEATURES_INITMAN = "systemd" it's all you need. DISTRO_FEATURE +=
"systemd" might also work in some extent since I'm checking against
DISTRO_FEATURES, however there are variables like
VIRTUAL_RUNTIME_init_manager (which is inherited legacy) which get set
from DISTRO_FEATURES_INITMAN. The way to go is with DISTRO_FEATURES_INITMAN.
Radu
Radu
[-- Attachment #2: Type: text/html, Size: 7290 bytes --]
^ permalink raw reply
* Re: [PATCH 3/3] signalfd: add ability to read siginfo-s without dequeuing signals (v3)
From: Oleg Nesterov @ 2012-12-28 14:32 UTC (permalink / raw)
To: Andrey Vagin, Linus Torvalds
Cc: linux-kernel, criu, linux-fsdevel, linux-api, Alexander Viro,
Paul E. McKenney, David Howells, Dave Jones, Michael Kerrisk,
Pavel Emelyanov, Cyrill Gorcunov
In-Reply-To: <1356690181-1796-4-git-send-email-avagin@openvz.org>
On 12/28, Andrey Vagin wrote:
>
> pread(fd, buf, size, pos) with non-zero pos returns siginfo-s
> without dequeuing signals.
>
> A sequence number and a queue are encoded in pos.
>
> pos = seq + SFD_*_OFFSET
>
> seq is a sequence number of a signal in a queue.
>
> SFD_PER_THREAD_QUEUE_OFFSET - read signals from a per-thread queue.
> SFD_SHARED_QUEUE_OFFSET - read signals from a shared (process wide) queue.
>
> This functionality is required for checkpointing pending signals.
>
> v2: llseek() can't be used here, because peek_offset/f_pos/whatever
> has to be shared with all processes which have this file opened.
>
> Suppose that the task forks after sys_signalfd(). Now if parent or child
> do llseek this affects them both. This is insane because signalfd is
> "strange" to say at least, fork/dup/etc inherits signalfd_ctx but not
> the" source" of the data. // Oleg Nesterov
I think we should cc Linus.
This patch adds the hack and it makes signalfd even more strange.
Yes, this hack was suggested by me because I can't suggest something
better. But if Linus dislikes this user-visible API it would be better
to get his nack right now.
> +static ssize_t signalfd_peek(struct signalfd_ctx *ctx,
> + siginfo_t *info, loff_t *ppos)
> +{
> + struct sigpending *pending;
> + struct sigqueue *q;
> + loff_t seq;
> + int ret = 0;
> +
> + spin_lock_irq(¤t->sighand->siglock);
> +
> + if (*ppos >= SFD_SHARED_QUEUE_OFFSET) {
> + pending = ¤t->signal->shared_pending;
> + seq = *ppos - SFD_SHARED_QUEUE_OFFSET;
> + } else {
> + pending = ¤t->pending;
> + seq = *ppos - SFD_PER_THREAD_QUEUE_OFFSET;
> + }
You can do this outside of spin_lock_irq().
And I think it would be better to check SFD_PRIVATE_QUEUE_OFFSET too
although this is not strictly necessary. Otherwise this code assumes
that sys_pread() cheks pos >= 0 and SFD_PRIVATE_QUEUE_OFFSET == 1.
> + list_for_each_entry(q, &pending->list, list) {
> + if (sigismember(&ctx->sigmask, q->info.si_signo))
> + continue;
> +
> + if (seq-- == 0) {
> + copy_siginfo(info, &q->info);
> + ret = info->si_signo;
> + break;
> + }
> + }
> +
> + spin_unlock_irq(¤t->sighand->siglock);
> +
> + if (ret)
> + (*ppos)++;
We can change it unconditionally but I won't argue.
> @@ -338,6 +379,7 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
> }
>
> file->f_flags |= flags & SFD_RAW;
> + file->f_mode |= FMODE_PREAD;
Again, this is not needed or the code was broken by the previous patch.
Given that 2/3 passes O_RDWR to anon_inode_getfile() I think FMODE_PREAD
should be already set. Note OPEN_FMODE(flags) in anon_inode_getfile().
Oleg.
^ permalink raw reply
* Re: [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Florian Fainelli @ 2012-12-28 14:32 UTC (permalink / raw)
To: Andrew Lunn
Cc: len.brown, devicetree-discuss, rafael.j.wysocki, Jason Cooper,
linux ARM
In-Reply-To: <1356698844-4220-1-git-send-email-andrew@lunn.ch>
Hello Andrew,
Le 12/28/12 13:47, Andrew Lunn a écrit :
> Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> into drivers/cpuidle. Convert the driver into a platform driver and
> add a device tree binding. Add a DT node to instantiate the driver for
> boards converted to DT, and a platform data for old style boards.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
[snip]
>
> +/*****************************************************************************
> + * CPU idle
> + ****************************************************************************/
> +static struct resource kirkwood_cpuidle_resource[] = {
> + {
> + .flags = IORESOURCE_MEM,
> + .start = DDR_OPERATION_BASE,
> + .end = 3,
Should not this be DDR_OPERATION_BASE + 3?
--
Florian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Florian Fainelli @ 2012-12-28 14:32 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1356698844-4220-1-git-send-email-andrew@lunn.ch>
Hello Andrew,
Le 12/28/12 13:47, Andrew Lunn a ?crit :
> Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> into drivers/cpuidle. Convert the driver into a platform driver and
> add a device tree binding. Add a DT node to instantiate the driver for
> boards converted to DT, and a platform data for old style boards.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
[snip]
>
> +/*****************************************************************************
> + * CPU idle
> + ****************************************************************************/
> +static struct resource kirkwood_cpuidle_resource[] = {
> + {
> + .flags = IORESOURCE_MEM,
> + .start = DDR_OPERATION_BASE,
> + .end = 3,
Should not this be DDR_OPERATION_BASE + 3?
--
Florian
^ permalink raw reply
* Re: [PATCH 3/3] signalfd: add ability to read siginfo-s without dequeuing signals (v3)
From: Oleg Nesterov @ 2012-12-28 14:32 UTC (permalink / raw)
To: Andrey Vagin, Linus Torvalds
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, criu-GEFAQzZX7r8dnm+yROfE0A,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, Alexander Viro,
Paul E. McKenney, David Howells, Dave Jones, Michael Kerrisk,
Pavel Emelyanov, Cyrill Gorcunov
In-Reply-To: <1356690181-1796-4-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
On 12/28, Andrey Vagin wrote:
>
> pread(fd, buf, size, pos) with non-zero pos returns siginfo-s
> without dequeuing signals.
>
> A sequence number and a queue are encoded in pos.
>
> pos = seq + SFD_*_OFFSET
>
> seq is a sequence number of a signal in a queue.
>
> SFD_PER_THREAD_QUEUE_OFFSET - read signals from a per-thread queue.
> SFD_SHARED_QUEUE_OFFSET - read signals from a shared (process wide) queue.
>
> This functionality is required for checkpointing pending signals.
>
> v2: llseek() can't be used here, because peek_offset/f_pos/whatever
> has to be shared with all processes which have this file opened.
>
> Suppose that the task forks after sys_signalfd(). Now if parent or child
> do llseek this affects them both. This is insane because signalfd is
> "strange" to say at least, fork/dup/etc inherits signalfd_ctx but not
> the" source" of the data. // Oleg Nesterov
I think we should cc Linus.
This patch adds the hack and it makes signalfd even more strange.
Yes, this hack was suggested by me because I can't suggest something
better. But if Linus dislikes this user-visible API it would be better
to get his nack right now.
> +static ssize_t signalfd_peek(struct signalfd_ctx *ctx,
> + siginfo_t *info, loff_t *ppos)
> +{
> + struct sigpending *pending;
> + struct sigqueue *q;
> + loff_t seq;
> + int ret = 0;
> +
> + spin_lock_irq(¤t->sighand->siglock);
> +
> + if (*ppos >= SFD_SHARED_QUEUE_OFFSET) {
> + pending = ¤t->signal->shared_pending;
> + seq = *ppos - SFD_SHARED_QUEUE_OFFSET;
> + } else {
> + pending = ¤t->pending;
> + seq = *ppos - SFD_PER_THREAD_QUEUE_OFFSET;
> + }
You can do this outside of spin_lock_irq().
And I think it would be better to check SFD_PRIVATE_QUEUE_OFFSET too
although this is not strictly necessary. Otherwise this code assumes
that sys_pread() cheks pos >= 0 and SFD_PRIVATE_QUEUE_OFFSET == 1.
> + list_for_each_entry(q, &pending->list, list) {
> + if (sigismember(&ctx->sigmask, q->info.si_signo))
> + continue;
> +
> + if (seq-- == 0) {
> + copy_siginfo(info, &q->info);
> + ret = info->si_signo;
> + break;
> + }
> + }
> +
> + spin_unlock_irq(¤t->sighand->siglock);
> +
> + if (ret)
> + (*ppos)++;
We can change it unconditionally but I won't argue.
> @@ -338,6 +379,7 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
> }
>
> file->f_flags |= flags & SFD_RAW;
> + file->f_mode |= FMODE_PREAD;
Again, this is not needed or the code was broken by the previous patch.
Given that 2/3 passes O_RDWR to anon_inode_getfile() I think FMODE_PREAD
should be already set. Note OPEN_FMODE(flags) in anon_inode_getfile().
Oleg.
^ permalink raw reply
* [announce] Timeout Based User-space Low Memory Killer Daemon
From: Bartlomiej Zolnierkiewicz @ 2012-12-28 14:27 UTC (permalink / raw)
To: linux-mm; +Cc: Kyungmin Park, Anton Vorontsov
Hi,
I would like to announce the first public version of my timeout based
user-space low memory killer daemon (tbulmkd). It is based on idea
that user-space applications can be divided into two classes,
foreground and background ones. Foreground processes are visible in
graphical user interface (GUI) and therefore shouldn't be terminated
first when memory usage gets too high. OTOH background processes are
no longer visible in GUI and are pro-actively being killed to keep
overall memory usage smaller. Actual daemon implementation is heavily
based on the user-space low memory killer daemon (ulmkd) from Anton
Vorontsov (http://thread.gmane.org/gmane.linux.kernel.mm/84302).
The program is available at:
https://github.com/bzolnier/tbulmkd
kernel/add-tbulmkd-entries.patch needs to be applied to the kernel
that would be used with tbulmkd. It adds /proc/$pid/activity and
/proc/$pid/activity_time files. Write '0' to activity file to mark
the process as background one and '1' (the default value) to mark
it as foreground one. Please note that this interface is just for
a demonstration of tbulmkd functionality and will be changed in
the future.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung Poland R&D Center
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH] ARM: mach-imx: Kconfig: Do not select Babbage for MACH_IMX51_DT
From: Fabio Estevam @ 2012-12-28 14:25 UTC (permalink / raw)
To: linux-arm-kernel
From: Fabio Estevam <fabio.estevam@freescale.com>
When mx51 dt support was added it was necessary to select MACH_MX51_BABBAGE in
order to get the mx51 dt built without errors.
At that time, there was no pinctrl support for mx51 yet.
Currently there is no need to select MACH_MX51_BABBAGE anymore.
Reported-by: Matt Sealy <matt@genesi-usa.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
arch/arm/mach-imx/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 1ad0d76..ae3bd54 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -756,7 +756,6 @@ comment "i.MX51 machines:"
config MACH_IMX51_DT
bool "Support i.MX51 platforms from device tree"
- select MACH_MX51_BABBAGE
select SOC_IMX51
help
Include support for Freescale i.MX51 based platforms
--
1.7.9.5
^ permalink raw reply related
* Question: how can I get the real PCI address of a BAR?
From: Cédric Cano @ 2012-12-28 9:36 UTC (permalink / raw)
To: linux-pci
Hi,
I'm writing a driver for a DMA engine on the PCI bus. My architecture is
a 36-bit PowerPC (MPC85xx).
In my DMA driver, I want to configure the DMA to transfer data to/from a
PCI device.
I get the PCI address of the device BAR with the command pci_resource_start.
This address is 36-bit but the PCI BAR of the device is 32-bit: I can't
use the 36-bit address to run the DMA.
In kernel documentations, it's advised not to directly read the BAR.
Is there a function which provides the real PCI address i.e. the one
stored in the BAR?
Thanks.
C. Cano
^ permalink raw reply
* [3.6.9 -> 3.7.1 regression] sound: snd_hda_intel codec probing issue?
From: Vincent Blut @ 2012-12-28 14:25 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, tiwai
[-- Attachment #1: Type: text/plain, Size: 988 bytes --]
Hi,
Since I updated to Linux 3.7.1, listening to some audio/video bits
frequently cause the following:
[ 7896.166946] hda-intel: azx_get_response timeout, switching to polling
mode: last cmd=0x020c0000
[ 7897.173444] hda-intel: No response from codec, disabling MSI: last
cmd=0x020c0000
[ 7898.179932] hda_intel: azx_get_response timeout, switching to
single_cmd mode: last cmd=0x020c0000
[ 7898.179983] hda-codec: out of range cmd 0:0:20:400:fffff7ff
[ 9445.034371] plugin-containe[5873]: segfault at 7f44bb95e639 ip
00007f44e454bca0 sp 00007f44c91165f8 error 4 in
libc-2.13.so[7f44e442c000+180000]
It seems to be a codec probing failure (?). This is really fatal because
the sound become very choppy and can't recover until I reboot.
I'll try to play with 'probe_mask' kernel parameter to see if I can
narrow the correct codec slots!
By the way I can't reproduce this on 3.6.9, so is there something that
changed in this area in 3.7.1?
Cheers,
Vincent
[attached alsa-info output]
[-- Attachment #2: alsa-info.txt.8iqmjXNAIA --]
[-- Type: text/plain, Size: 28416 bytes --]
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.61
!!################################
!!Script ran on: Fri Dec 28 13:00:55 UTC 2012
!!Linux Distribution
!!------------------
Debian GNU/Linux 7.0 \n \l PRETTY_NAME="Debian GNU/Linux 7.0 (wheezy)" NAME="Debian GNU/Linux" ID=debian HOME_URL="http://www.debian.org/" SUPPORT_URL="http://www.debian.org/support/" BUG_REPORT_URL="http://bugs.debian.org/"
!!DMI Information
!!---------------
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: UX31A
Product Version: 1.0
Firmware Version: UX31A.216
!!Kernel Information
!!------------------
Kernel release: 3.7-trunk-amd64
Operating System: GNU/Linux
Architecture: x86_64
Processor: unknown
SMP Enabled: Yes
!!ALSA Version
!!------------
Driver version: k3.7-trunk-amd64
Library version: 1.0.25
Utilities version: 1.0.25
!!Loaded ALSA modules
!!-------------------
snd_hda_intel
!!Sound Servers on this system
!!----------------------------
Pulseaudio:
Installed - Yes (/usr/bin/pulseaudio)
Running - Yes
!!Soundcards recognised by ALSA
!!-----------------------------
0 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf7d18000 irq 47
!!PCI Soundcards installed in the system
!!--------------------------------------
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
!!Advanced information - PCI Vendor/Device/Subsystem ID's
!!-------------------------------------------------------
00:1b.0 0403: 8086:1e20 (rev 04)
Subsystem: 1043:1517
!!Modprobe options (Sound related)
!!--------------------------------
snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_hda_intel: power_save=10
!!Loaded sound module options
!!---------------------------
!!Module: snd_hda_intel
align_buffer_size : -1
bdl_pos_adj : 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
beep_mode : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
enable_msi : -1
id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
patch : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
position_fix : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
power_save : 1
power_save_controller : Y
probe_mask : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
probe_only : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
single_cmd : N
snoop : Y
!!HDA-Intel Codec information
!!---------------------------
--startcollapse--
Codec: Realtek ALC269VB
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0269
Subsystem Id: 0x10431517
Revision Id: 0x100100
No Modem Function Group found
Default PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
GPIO: io=2, o=0, i=0, unsolicited=1, wake=0
IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Node 0x02 [Audio Output] wcaps 0x1d: Stereo Amp-Out
Control: name="Headphone Playback Volume", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Device: name="ALC269VB Analog", type="Audio", device=0
Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
Amp-Out vals: [0x57 0x57]
Converter: stream=0, channel=0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Node 0x03 [Audio Output] wcaps 0x1d: Stereo Amp-Out
Control: name="Speaker Playback Volume", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
Amp-Out vals: [0x57 0x57]
Converter: stream=0, channel=0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Node 0x04 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x05 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x06 [Audio Output] wcaps 0x211: Stereo Digital
Converter: stream=0, channel=0
Digital:
Digital category: 0x0
IEC Coding Type: 0x0
PCM:
rates [0x5e0]: 44100 48000 88200 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Node 0x07 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In
Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
Amp-In vals: [0x8b 0x8b]
Converter: stream=0, channel=0
SDI-Select: 0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Connection: 1
0x23
Node 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In
Control: name="Capture Switch", index=0, device=0
Control: name="Capture Volume", index=0, device=0
Device: name="ALC269VB Analog", type="Audio", device=0
Amp-In caps: ofs=0x0b, nsteps=0x1f, stepsize=0x05, mute=1
Amp-In vals: [0x8b 0x8b]
Converter: stream=0, channel=0
SDI-Select: 0
PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Connection: 1
0x22
Node 0x0a [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Control: name="Mic Playback Volume", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Control: name="Mic Playback Switch", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
Amp-In vals: [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97]
Connection: 5
0x18 0x19 0x1a 0x1b 0x1d
Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-In vals: [0x00 0x00] [0x80 0x80]
Connection: 2
0x02 0x0b
Node 0x0d [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-In vals: [0x00 0x00] [0x80 0x80]
Connection: 2
0x03 0x0b
Node 0x0e [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0f [Audio Mixer] wcaps 0x20010a: Mono Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-In vals: [0x00] [0x80]
Connection: 2
0x02 0x0b
Node 0x10 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x11 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x12 [Pin Complex] wcaps 0x40000b: Stereo Amp-In
Control: name="Internal Mic Boost Volume", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Control: name="Internal Mic Phantom Jack", index=0, device=0
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
Amp-In vals: [0x00 0x00]
Pincap 0x00000020: IN
Pin Default 0x99a3092f: [Fixed] Mic at Int ATAPI
Conn = ATAPI, Color = Unknown
DefAssociation = 0x2, Sequence = 0xf
Misc = NO_PRESENCE
Pin-ctls: 0x00:
Node 0x13 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x14 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
Control: name="Speaker Playback Switch", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Control: name="Speaker Phantom Jack", index=0, device=0
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x80 0x80]
Pincap 0x00010014: OUT EAPD Detect
EAPD 0x0:
Pin Default 0x99130110: [Fixed] Speaker at Int ATAPI
Conn = ATAPI, Color = Unknown
DefAssociation = 0x1, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x00:
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0d
Node 0x15 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x16 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x17 [Pin Complex] wcaps 0x40010c: Mono Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x80]
Pincap 0x00000010: OUT
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x00:
Connection: 1
0x0f
Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Control: name="Mic Boost Volume", index=0, device=0
ControlAmp: chs=3, dir=In, idx=0, ofs=0
Control: name="Mic Jack", index=0, device=0
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x80 0x80]
Pincap 0x00001734: IN OUT Detect
Vref caps: HIZ 50 GRD 80
Pin Default 0x01a19c20: [Jack] Mic at Ext Rear
Conn = 1/8, Color = Pink
DefAssociation = 0x2, Sequence = 0x0
Pin-ctls: 0x20: IN VREF_HIZ
Unsolicited: tag=00, enabled=0
Connection: 1
0x0d
Node 0x19 [Pin Complex] wcaps 0x40008b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
Amp-In vals: [0x00 0x00]
Pincap 0x00001724: IN Detect
Vref caps: HIZ 50 GRD 80
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x20: IN VREF_HIZ
Unsolicited: tag=00, enabled=0
Node 0x1a [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x80 0x80]
Pincap 0x0000003c: IN OUT HP Detect
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x20: IN
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0d
Node 0x1b [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x80 0x80]
Pincap 0x00000034: IN OUT Detect
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x20: IN
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0d
Node 0x1c [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1d [Pin Complex] wcaps 0x400000: Mono
Pincap 0x00000020: IN
Pin Default 0x40079a2d: [N/A] Line Out at Ext N/A
Conn = Analog, Color = Pink
DefAssociation = 0x2, Sequence = 0xd
Pin-ctls: 0x20: IN
Node 0x1e [Pin Complex] wcaps 0x400381: Stereo Digital
Pincap 0x00000014: OUT Detect
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0xf, Sequence = 0x0
Misc = NO_PRESENCE
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Connection: 1
0x06
Node 0x1f [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x20 [Vendor Defined Widget] wcaps 0xf00040: Mono
Processing caps: benign=0, ncoeff=25
Node 0x21 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
Control: name="Headphone Playback Switch", index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Control: name="Headphone Jack", index=0, device=0
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x80 0x80]
Pincap 0x0000001c: OUT HP Detect
Pin Default 0x0121401f: [Jack] HP Out at Ext Rear
Conn = 1/8, Color = Green
DefAssociation = 0x1, Sequence = 0xf
Pin-ctls: 0x00:
Unsolicited: tag=00, enabled=0
Connection: 2
0x0c* 0x0d
Node 0x22 [Audio Selector] wcaps 0x30010b: Stereo Amp-In
Amp-In caps: N/A
Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00]
Connection: 7
0x18* 0x19 0x1a 0x1b 0x1d 0x0b 0x12
Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-In vals: [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
Connection: 6
0x18 0x19 0x1a 0x1b 0x1d 0x0b
Codec: Intel PantherPoint HDMI
Address: 3
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x80862806
Subsystem Id: 0x80860101
Revision Id: 0x100000
No Modem Function Group found
Default PCM:
rates [0x0]:
bits [0x0]:
formats [0x0]:
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x02 [Audio Output] wcaps 0x6611: 8-Channels Digital
Converter: stream=0, channel=0
Digital: Enabled
Digital category: 0x0
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1e]: 16 20 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x6611: 8-Channels Digital
Converter: stream=0, channel=0
Digital: Enabled GenLevel
Digital category: 0x2
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1e]: 16 20 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x6611: 8-Channels Digital
Converter: stream=0, channel=0
Digital: Enabled
Digital category: 0x0
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1e]: 16 20 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Node 0x05 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x80]
Pincap 0x09000094: OUT Detect HBR HDMI DP
Pin Default 0x58560010: [N/A] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x1, Sequence = 0x0
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
0x02
Node 0x06 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
Control: name="IEC958 Playback Con Mask", index=0, device=0
Control: name="IEC958 Playback Pro Mask", index=0, device=0
Control: name="IEC958 Playback Default", index=0, device=0
Control: name="IEC958 Playback Switch", index=0, device=0
Control: name="ELD", index=0, device=3
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x00]
Pincap 0x09000094: OUT Detect HBR HDMI DP
Pin Default 0x18560020: [Jack] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x2, Sequence = 0x0
Pin-ctls: 0x00:
Unsolicited: tag=01, enabled=1
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
0x03
Node 0x07 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x80]
Pincap 0x09000094: OUT Detect HBR HDMI DP
Pin Default 0x58560030: [N/A] Digital Out at Int HDMI
Conn = Digital, Color = Unknown
DefAssociation = 0x3, Sequence = 0x0
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
0x04
Node 0x08 [Vendor Defined Widget] wcaps 0xf00000: Mono
--endcollapse--
!!ALSA Device nodes
!!-----------------
crw-rw---T+ 1 root audio 116, 7 Dec 28 10:41 /dev/snd/controlC0
crw-rw---T+ 1 root audio 116, 6 Dec 28 10:41 /dev/snd/hwC0D0
crw-rw---T+ 1 root audio 116, 5 Dec 28 10:41 /dev/snd/hwC0D3
crw-rw---T+ 1 root audio 116, 4 Dec 28 10:42 /dev/snd/pcmC0D0c
crw-rw---T+ 1 root audio 116, 3 Dec 28 13:44 /dev/snd/pcmC0D0p
crw-rw---T+ 1 root audio 116, 2 Dec 28 10:42 /dev/snd/pcmC0D3p
crw-rw---T+ 1 root audio 116, 1 Dec 28 10:41 /dev/snd/seq
crw-rw---T+ 1 root audio 116, 33 Dec 28 10:41 /dev/snd/timer
/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 60 Dec 28 10:41 .
drwxr-xr-x 3 root root 220 Dec 28 10:41 ..
lrwxrwxrwx 1 root root 12 Dec 28 10:41 pci-0000:00:1b.0 -> ../controlC0
!!Aplay/Arecord output
!!--------------------
APLAY
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
ARECORD
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
!!Amixer output
!!-------------
!!-------Mixer controls for card 0 [PCH]
Card hw:0 'PCH'/'HDA Intel PCH at 0xf7d18000 irq 47'
Mixer name : 'Intel PantherPoint HDMI'
Components : 'HDA:10ec0269,10431517,00100100 HDA:80862806,80860101,00100000'
Controls : 27
Simple ctrls : 10
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback 0 - 87
Mono: Playback 58 [67%] [-21.75dB] [on]
Simple mixer control 'Headphone',0
Capabilities: pvolume pswitch penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 87
Mono:
Front Left: Playback 87 [100%] [0.00dB] [on]
Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Speaker',0
Capabilities: pvolume pswitch penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 87
Mono:
Front Left: Playback 87 [100%] [0.00dB] [on]
Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'PCM',0
Capabilities: pvolume penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 253 [99%] [0.40dB]
Front Right: Playback 253 [99%] [0.40dB]
Simple mixer control 'Mic',0
Capabilities: pvolume pswitch penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-34.50dB] [off]
Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Mic Boost',0
Capabilities: volume penum
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 0 [0%] [0.00dB]
Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
Capabilities: pswitch pswitch-joined penum
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch penum
Capture channels: Front Left - Front Right
Limits: Capture 0 - 31
Front Left: Capture 0 [0%] [-16.50dB] [off]
Front Right: Capture 0 [0%] [-16.50dB] [off]
Simple mixer control 'Auto-Mute Mode',0
Capabilities: enum
Items: 'Disabled' 'Enabled'
Item0: 'Enabled'
Simple mixer control 'Internal Mic Boost',0
Capabilities: volume penum
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 0 [0%] [0.00dB]
Front Right: 0 [0%] [0.00dB]
!!Alsactl output
!!--------------
--startcollapse--
state.PCH {
control.1 {
iface MIXER
name 'Headphone Playback Volume'
value.0 87
value.1 87
comment {
access 'read write'
type INTEGER
count 2
range '0 - 87'
dbmin -6525
dbmax 0
dbvalue.0 0
dbvalue.1 0
}
}
control.2 {
iface MIXER
name 'Headphone Playback Switch'
value.0 true
value.1 true
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.3 {
iface MIXER
name 'Speaker Playback Volume'
value.0 87
value.1 87
comment {
access 'read write'
type INTEGER
count 2
range '0 - 87'
dbmin -6525
dbmax 0
dbvalue.0 0
dbvalue.1 0
}
}
control.4 {
iface MIXER
name 'Speaker Playback Switch'
value.0 true
value.1 true
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.5 {
iface MIXER
name 'Mic Playback Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 31'
dbmin -3450
dbmax 1200
dbvalue.0 -3450
dbvalue.1 -3450
}
}
control.6 {
iface MIXER
name 'Mic Playback Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.7 {
iface MIXER
name 'Auto-Mute Mode'
value Enabled
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Disabled
item.1 Enabled
}
}
control.8 {
iface MIXER
name 'Internal Mic Boost Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 3'
dbmin 0
dbmax 3600
dbvalue.0 0
dbvalue.1 0
}
}
control.9 {
iface MIXER
name 'Mic Boost Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 3'
dbmin 0
dbmax 3600
dbvalue.0 0
dbvalue.1 0
}
}
control.10 {
iface MIXER
name 'Capture Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.11 {
iface MIXER
name 'Capture Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 31'
dbmin -1650
dbmax 3000
dbvalue.0 -1650
dbvalue.1 -1650
}
}
control.12 {
iface MIXER
name 'Master Playback Volume'
value 58
comment {
access 'read write'
type INTEGER
count 1
range '0 - 87'
dbmin -6525
dbmax 0
dbvalue.0 -2175
}
}
control.13 {
iface MIXER
name 'Master Playback Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.14 {
iface CARD
name 'Headphone Jack'
value false
comment {
access read
type BOOLEAN
count 1
}
}
control.15 {
iface CARD
name 'Speaker Phantom Jack'
value true
comment {
access read
type BOOLEAN
count 1
}
}
control.16 {
iface CARD
name 'Internal Mic Phantom Jack'
value true
comment {
access read
type BOOLEAN
count 1
}
}
control.17 {
iface CARD
name 'Mic Jack'
value false
comment {
access read
type BOOLEAN
count 1
}
}
control.18 {
iface PCM
name 'Playback Channel Map'
value.0 3
value.1 4
comment {
access read
type INTEGER
count 2
range '0 - 27'
}
}
control.19 {
iface PCM
name 'Capture Channel Map'
value.0 0
value.1 0
comment {
access read
type INTEGER
count 2
range '0 - 27'
}
}
control.20 {
iface CARD
name 'HDMI/DP,pcm=3 Jack'
value false
comment {
access read
type BOOLEAN
count 1
}
}
control.21 {
iface MIXER
name 'IEC958 Playback Con Mask'
value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
control.22 {
iface MIXER
name 'IEC958 Playback Pro Mask'
value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
control.23 {
iface MIXER
name 'IEC958 Playback Default'
value '0482000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write'
type IEC958
count 1
}
}
control.24 {
iface MIXER
name 'IEC958 Playback Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.25 {
iface PCM
device 3
name ELD
value ''
comment {
access 'read volatile'
type BYTES
count 0
}
}
control.26 {
iface PCM
device 3
name 'Playback Channel Map'
value.0 0
value.1 0
value.2 0
value.3 0
value.4 0
value.5 0
value.6 0
value.7 0
comment {
access 'read write'
type INTEGER
count 8
range '0 - 27'
}
}
control.27 {
iface MIXER
name 'PCM Playback Volume'
value.0 253
value.1 253
comment {
access 'read write user'
type INTEGER
count 2
range '0 - 255'
tlv '0000000100000008ffffec1400000014'
dbmin -5100
dbmax 0
dbvalue.0 -40
dbvalue.1 -40
}
}
}
--endcollapse--
!!All Loaded Modules
!!------------------
Module
rfcomm
bnep
msr
cpufreq_stats
ip6table_filter
ip6_tables
iptable_filter
ip_tables
x_tables
parport_pc
ppdev
lp
parport
binfmt_misc
uinput
nfsd
auth_rpcgss
nfs_acl
nfs
lockd
dns_resolver
fscache
sunrpc
nls_utf8
nls_cp437
vfat
fat
loop
snd_hda_codec_hdmi
snd_hda_codec_realtek
joydev
btusb
bluetooth
uvcvideo
videobuf2_vmalloc
videobuf2_memops
videobuf2_core
videodev
media
snd_hda_intel
snd_hda_codec
arc4
iwldvm
coretemp
snd_hwdep
kvm_intel
snd_pcm
mac80211
snd_page_alloc
kvm
crc32c_intel
snd_seq
snd_seq_device
ghash_clmulni_intel
iTCO_wdt
snd_timer
i915
iwlwifi
aesni_intel
iTCO_vendor_support
aes_x86_64
ablk_helper
asus_nb_wmi
acpi_cpufreq
cryptd
drm_kms_helper
mperf
xts
lrw
gf128mul
drm
i2c_i801
snd
cfg80211
asus_wmi
lpc_ich
rts5139
sparse_keymap
microcode
pcspkr
psmouse
serio_raw
evdev
i2c_algo_bit
i2c_core
mfd_core
wmi
soundcore
rfkill
mei
video
battery
ac
button
processor
ext4
crc16
jbd2
mbcache
sg
sd_mod
crc_t10dif
xhci_hcd
ahci
libahci
ehci_hcd
libata
scsi_mod
usbcore
thermal
thermal_sys
usb_common
!!Sysfs Files
!!-----------
/sys/class/sound/hwC0D0/init_pin_configs:
0x12 0x90a60930
0x14 0x90170110
0x17 0x411111f0
0x18 0x411111f0
0x19 0x411111f0
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x40079a2d
0x1e 0x411111f0
0x21 0x03211020
/sys/class/sound/hwC0D0/driver_pin_configs:
0x12 0x99a3092f
0x14 0x99130110
0x18 0x01a19c20
0x21 0x0121401f
/sys/class/sound/hwC0D0/user_pin_configs:
/sys/class/sound/hwC0D0/init_verbs:
/sys/class/sound/hwC0D3/init_pin_configs:
0x05 0x58560010
0x06 0x18560020
0x07 0x58560030
/sys/class/sound/hwC0D3/driver_pin_configs:
/sys/class/sound/hwC0D3/user_pin_configs:
/sys/class/sound/hwC0D3/init_verbs:
!!ALSA/HDA dmesg
!!--------------
[ 4.534693] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
[ 4.535604] snd_hda_intel 0000:00:1b.0: irq 47 for MSI/MSI-X
[ 4.588234] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1b.0/sound/card0/input9
[ 4.588670] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input10
[ 4.589001] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input11
[ 4.984465] Adding 1952764k swap on /dev/sda3. Priority:-1 extents:1 across:1952764k SS
--
[ 7686.851054] mei 0000:00:16.0: irq 44 for MSI/MSI-X
[ 7686.851099] snd_hda_intel 0000:00:1b.0: irq 47 for MSI/MSI-X
[ 7686.851147] ehci_hcd 0000:00:1d.0: setting latency timer to 64
--
[ 7693.806936] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 7896.166946] hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x020c0000
[ 7897.173444] hda-intel: No response from codec, disabling MSI: last cmd=0x020c0000
[ 7898.179932] hda_intel: azx_get_response timeout, switching to single_cmd mode: last cmd=0x020c0000
[ 7898.179983] hda-codec: out of range cmd 0:0:20:400:fffff7ff
[ 9445.034371] plugin-containe[5873]: segfault at 7f44bb95e639 ip 00007f44e454bca0 sp 00007f44c91165f8 error 4 in libc-2.13.so[7f44e442c000+180000]
^ permalink raw reply
* Re: [patch 02/03 v2] usb hid quirks for Masterkit MA901 usb radio
From: Mauro Carvalho Chehab @ 2012-12-28 14:21 UTC (permalink / raw)
To: Jiri Kosina; +Cc: LMML, Alexey Klimov
In-Reply-To: <alpine.LNX.2.00.1212281427120.12462@pobox.suse.cz>
Em Fri, 28 Dec 2012 14:27:56 +0100 (CET)
Jiri Kosina <jkosina@suse.cz> escreveu:
> On Fri, 28 Dec 2012, Mauro Carvalho Chehab wrote:
>
> > Hi Jiri,
> >
> > There's another radio device that it is incorrectly detected as an HID driver.
> > As I'll be applying the driver's patch via the media tree, do you mind if I also
> > apply this hid patch there?
>
> Hi Mauro,
>
> please feel free to add
>
> Acked-by: Jiri Kosina <jkosina@suse.cz>
>
> and take the patch through your tree.
Thank you, Jiri!
Regards,
Mauro
^ permalink raw reply
* [PATCH] ASoC: pxa2xx-ac97: fix oops when codec_driver probe runs
From: Mike Dunn @ 2012-12-28 14:17 UTC (permalink / raw)
To: alsa-devel
Cc: Marek Vasut, Eric Miao, Mark Brown, Haojian Zhuang, Mike Dunn,
Tomas Cech, linux-arm-kernel
This patch fixes a kernel oops that occurs when the snd_soc_codec_driver probe
function runs. The exception occurs when the codec calls soc_ac97_ops.reset().
The pxa2xx-ac97's clocks have not been initialized at this point, but the cpu's
reset function (pxa_ac97_cold_pxa27x()) expects them to be, resulting in a NULL
pointer dereference in the pxa's clk_enable().
The pxa2xx-ac97's clocks are initialized in pxa2xx_ac97_hw_probe(). To ensure
that the clocks are initialized when the codec_driver probe runs, the calls to
pxa2xx_ac97_hw_{probe,remove}() are moved from the cpu's dai_driver probe/remove
functions to those of its platform_driver. This is necessary because
snd_soc_instantiate_card() always calls the codec_driver probe before any of the
dai_drivers' probes.
This change leaves nothing in the cpu's dai_driver probe/remove functions, so
those functions are eliminated.
Tested on the pxa27x; palmtreo680 machine using the wm9712 codec.
Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
I'm new to the ASoC code. Experts, please have a look. Thanks!
sound/soc/pxa/pxa2xx-ac97.c | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 4b0a009..940e9f4 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -104,17 +104,6 @@ static int pxa2xx_ac97_resume(struct snd_soc_dai *dai)
#define pxa2xx_ac97_resume NULL
#endif
-static int pxa2xx_ac97_probe(struct snd_soc_dai *dai)
-{
- return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev));
-}
-
-static int pxa2xx_ac97_remove(struct snd_soc_dai *dai)
-{
- pxa2xx_ac97_hw_remove(to_platform_device(dai->dev));
- return 0;
-}
-
static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *cpu_dai)
@@ -184,8 +173,6 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
{
.name = "pxa2xx-ac97",
.ac97_control = 1,
- .probe = pxa2xx_ac97_probe,
- .remove = pxa2xx_ac97_remove,
.suspend = pxa2xx_ac97_suspend,
.resume = pxa2xx_ac97_resume,
.playback = {
@@ -236,21 +223,34 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
{
+ int ret;
+
if (pdev->id != -1) {
dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
return -ENXIO;
}
- /* Punt most of the init to the SoC probe; we may need the machine
- * driver to do interesting things with the clocking to get us up
- * and running.
- */
- return snd_soc_register_dais(&pdev->dev, pxa_ac97_dai_driver,
- ARRAY_SIZE(pxa_ac97_dai_driver));
+ ret = snd_soc_register_dais(&pdev->dev, pxa_ac97_dai_driver,
+ ARRAY_SIZE(pxa_ac97_dai_driver));
+ if (ret < 0) {
+ dev_err(&pdev->dev, "snd_soc_register_dais failed with %d\n",
+ ret);
+ return ret;
+ }
+
+ ret = pxa2xx_ac97_hw_probe(pdev);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "pxa2xx_ac97_hw_probe failed with %d\n",
+ ret);
+ snd_soc_unregister_dais(&pdev->dev,
+ ARRAY_SIZE(pxa_ac97_dai_driver));
+ }
+ return ret;
}
static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
{
+ pxa2xx_ac97_hw_remove(pdev);
snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(pxa_ac97_dai_driver));
return 0;
}
--
1.7.8.6
^ permalink raw reply related
* Re: [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Rob Herring @ 2012-12-28 14:18 UTC (permalink / raw)
To: Andrew Lunn
Cc: len.brown-ral2JQCrhuEAvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w, Jason Cooper, linux ARM
In-Reply-To: <1356698844-4220-1-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
On 12/28/2012 06:47 AM, Andrew Lunn wrote:
> Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> into drivers/cpuidle. Convert the driver into a platform driver and
> add a device tree binding. Add a DT node to instantiate the driver for
> boards converted to DT, and a platform data for old style boards.
Is this an old comment? I don't see any platform data.
>
> Signed-off-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> ---
> .../devicetree/bindings/power/qnap-poweroff.txt | 14 +++
> arch/arm/boot/dts/kirkwood.dtsi | 5 +
> arch/arm/configs/kirkwood_defconfig | 1 +
> arch/arm/mach-kirkwood/Makefile | 1 -
> arch/arm/mach-kirkwood/common.c | 23 ++++
> arch/arm/mach-kirkwood/cpuidle.c | 73 -------------
> arch/arm/mach-kirkwood/include/mach/kirkwood.h | 3 +-
> drivers/cpuidle/Kconfig | 6 ++
> drivers/cpuidle/Makefile | 1 +
> drivers/cpuidle/cpuidle-kirkwood.c | 114 ++++++++++++++++++++
> 10 files changed, 166 insertions(+), 75 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/power/qnap-poweroff.txt
> delete mode 100644 arch/arm/mach-kirkwood/cpuidle.c
> create mode 100644 drivers/cpuidle/cpuidle-kirkwood.c
>
> diff --git a/Documentation/devicetree/bindings/power/qnap-poweroff.txt b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> new file mode 100644
> index 0000000..e15a334
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> @@ -0,0 +1,14 @@
> +* QNAP Power Off
This doesn't match the rest of the patch.
> +
> +QNAP NAS devices have a microcontroller controlling the main power
> +supply. This microcontroller is connected to UART1 of the Kirkwood and
> +Orion5x SoCs. Sending the charactor 'A', at 19200 baud, tells the
> +microcontroller to turn the power off. This driver adds a handler to
> +pm_power_off which is called to turn the power off.
> +
> +Required Properties:
> +- compatibile: Should be "qnap,power-off"
> +
> +- reg: Address and length of the register set for UART1
> +- clocks: tclk clock
> +
> diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
> index 7735cee..ca99aa2 100644
> --- a/arch/arm/boot/dts/kirkwood.dtsi
> +++ b/arch/arm/boot/dts/kirkwood.dtsi
> @@ -23,6 +23,11 @@
> #address-cells = <1>;
> #size-cells = <1>;
>
> + cpuidle@1418 {
> + compatible = "marvell,kirkwood-cpuidle";
> + reg = <0x1418 0x4>;
> + };
> +
This is describing what linux wants, not the hardware. This is a common
problem with cpuidle drivers in that they use shared registers. I don't
have a good solution, but this doesn't belong in DTS.
Rob
> core_clk: core-clocks@10030 {
> compatible = "marvell,kirkwood-core-clock";
> reg = <0x10030 0x4>;
> diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
> index 93f3794..13482ea 100644
> --- a/arch/arm/configs/kirkwood_defconfig
> +++ b/arch/arm/configs/kirkwood_defconfig
> @@ -56,6 +56,7 @@ CONFIG_AEABI=y
> CONFIG_ZBOOT_ROM_TEXT=0x0
> CONFIG_ZBOOT_ROM_BSS=0x0
> CONFIG_CPU_IDLE=y
> +CONFIG_CPU_IDLE_KIRKWOOD=y
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> index 8d2e5a9..d665309 100644
> --- a/arch/arm/mach-kirkwood/Makefile
> +++ b/arch/arm/mach-kirkwood/Makefile
> @@ -19,7 +19,6 @@ obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> obj-$(CONFIG_MACH_T5325) += t5325-setup.o
>
> -obj-$(CONFIG_CPU_IDLE) += cpuidle.o
> obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
> obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
> obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
> diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
> index bac21a5..e8a2978 100644
> --- a/arch/arm/mach-kirkwood/common.c
> +++ b/arch/arm/mach-kirkwood/common.c
> @@ -499,6 +499,28 @@ void __init kirkwood_wdt_init(void)
> orion_wdt_init();
> }
>
> +/*****************************************************************************
> + * CPU idle
> + ****************************************************************************/
> +static struct resource kirkwood_cpuidle_resource[] = {
> + {
> + .flags = IORESOURCE_MEM,
> + .start = DDR_OPERATION_BASE,
> + .end = 3,
> + },
> +};
> +
> +static struct platform_device kirkwood_cpuidle = {
> + .name = "kirkwood_cpuidle",
> + .id = -1,
> + .resource = kirkwood_cpuidle_resource,
> + .num_resources = 1,
> +};
> +
> +static void __init kirkwood_cpuidle_init(void)
> +{
> + platform_device_register(&kirkwood_cpuidle);
> +}
>
> /*****************************************************************************
> * Time handling
> @@ -671,6 +693,7 @@ void __init kirkwood_init(void)
> kirkwood_xor1_init();
> kirkwood_crypto_init();
>
> + kirkwood_cpuidle_init();
> #ifdef CONFIG_KEXEC
> kexec_reinit = kirkwood_enable_pcie;
> #endif
> diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
> deleted file mode 100644
> index f730467..0000000
> --- a/arch/arm/mach-kirkwood/cpuidle.c
> +++ /dev/null
> @@ -1,73 +0,0 @@
> -/*
> - * arch/arm/mach-kirkwood/cpuidle.c
> - *
> - * CPU idle Marvell Kirkwood SoCs
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2. This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
> - *
> - * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> - * to implement two idle states -
> - * #1 wait-for-interrupt
> - * #2 wait-for-interrupt and DDR self refresh
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/init.h>
> -#include <linux/platform_device.h>
> -#include <linux/cpuidle.h>
> -#include <linux/io.h>
> -#include <linux/export.h>
> -#include <asm/proc-fns.h>
> -#include <asm/cpuidle.h>
> -#include <mach/kirkwood.h>
> -
> -#define KIRKWOOD_MAX_STATES 2
> -
> -/* Actual code that puts the SoC in different idle states */
> -static int kirkwood_enter_idle(struct cpuidle_device *dev,
> - struct cpuidle_driver *drv,
> - int index)
> -{
> - writel(0x7, DDR_OPERATION_BASE);
> - cpu_do_idle();
> -
> - return index;
> -}
> -
> -static struct cpuidle_driver kirkwood_idle_driver = {
> - .name = "kirkwood_idle",
> - .owner = THIS_MODULE,
> - .en_core_tk_irqen = 1,
> - .states[0] = ARM_CPUIDLE_WFI_STATE,
> - .states[1] = {
> - .enter = kirkwood_enter_idle,
> - .exit_latency = 10,
> - .target_residency = 100000,
> - .flags = CPUIDLE_FLAG_TIME_VALID,
> - .name = "DDR SR",
> - .desc = "WFI and DDR Self Refresh",
> - },
> - .state_count = KIRKWOOD_MAX_STATES,
> -};
> -
> -static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> -
> -/* Initialize CPU idle by registering the idle states */
> -static int kirkwood_init_cpuidle(void)
> -{
> - struct cpuidle_device *device;
> -
> - device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> - device->state_count = KIRKWOOD_MAX_STATES;
> -
> - cpuidle_register_driver(&kirkwood_idle_driver);
> - if (cpuidle_register_device(device)) {
> - pr_err("kirkwood_init_cpuidle: Failed registering\n");
> - return -EIO;
> - }
> - return 0;
> -}
> -
> -device_initcall(kirkwood_init_cpuidle);
> diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> index 041653a..a05563a 100644
> --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> @@ -60,8 +60,9 @@
> * Register Map
> */
> #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
> +#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
> #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500)
> -#define DDR_OPERATION_BASE (DDR_VIRT_BASE + 0x1418)
> +#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
>
> #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
> #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)
> diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> index c4cc27e..071e2c3 100644
> --- a/drivers/cpuidle/Kconfig
> +++ b/drivers/cpuidle/Kconfig
> @@ -39,4 +39,10 @@ config CPU_IDLE_CALXEDA
> help
> Select this to enable cpuidle on Calxeda processors.
>
> +config CPU_IDLE_KIRKWOOD
> + bool "CPU Idle Driver for Kirkwood processors"
> + depends on ARCH_KIRKWOOD
> + help
> + Select this to enable cpuidle on Kirkwood processors.
> +
> endif
> diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> index 03ee874..24c6e7d 100644
> --- a/drivers/cpuidle/Makefile
> +++ b/drivers/cpuidle/Makefile
> @@ -6,3 +6,4 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
> obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
>
> obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
> +obj-$(CONFIG_CPU_IDLE_KIRKWOOD) += cpuidle-kirkwood.o
> diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> new file mode 100644
> index 0000000..2d9d5b3
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> @@ -0,0 +1,114 @@
> +/*
> + * arch/arm/mach-kirkwood/cpuidle.c
> + *
> + * CPU idle Marvell Kirkwood SoCs
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + *
> + * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> + * to implement two idle states -
> + * #1 wait-for-interrupt
> + * #2 wait-for-interrupt and DDR self refresh
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/cpuidle.h>
> +#include <linux/io.h>
> +#include <linux/export.h>
> +#include <linux/of.h>
> +#include <asm/proc-fns.h>
> +#include <asm/cpuidle.h>
> +
> +#define KIRKWOOD_MAX_STATES 2
> +
> +static void __iomem *ddr_operation_base;
> +
> +/* Actual code that puts the SoC in different idle states */
> +static int kirkwood_enter_idle(struct cpuidle_device *dev,
> + struct cpuidle_driver *drv,
> + int index)
> +{
> + writel(0x7, ddr_operation_base);
> + cpu_do_idle();
> +
> + return index;
> +}
> +
> +static struct cpuidle_driver kirkwood_idle_driver = {
> + .name = "kirkwood_idle",
> + .owner = THIS_MODULE,
> + .en_core_tk_irqen = 1,
> + .states[0] = ARM_CPUIDLE_WFI_STATE,
> + .states[1] = {
> + .enter = kirkwood_enter_idle,
> + .exit_latency = 10,
> + .target_residency = 100000,
> + .flags = CPUIDLE_FLAG_TIME_VALID,
> + .name = "DDR SR",
> + .desc = "WFI and DDR Self Refresh",
> + },
> + .state_count = KIRKWOOD_MAX_STATES,
> +};
> +static struct cpuidle_device *device;
> +
> +static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> +
> +/* Initialize CPU idle by registering the idle states */
> +static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> +{
> + struct resource *res;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (res == NULL)
> + return -EINVAL;
> +
> + ddr_operation_base = devm_ioremap(&pdev->dev, res->start,
> + resource_size(res));
> + if (ddr_operation_base == NULL)
> + return -EINVAL;
> +
> + device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> + device->state_count = KIRKWOOD_MAX_STATES;
> +
> + cpuidle_register_driver(&kirkwood_idle_driver);
> + if (cpuidle_register_device(device)) {
> + pr_err("kirkwood_init_cpuidle: Failed registering\n");
> + return -EIO;
> + }
> + return 0;
> +}
> +
> +int kirkwood_cpuidle_remove(struct platform_device *pdev)
> +{
> + cpuidle_unregister_device(device);
> + cpuidle_unregister_driver(&kirkwood_idle_driver);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id of_kirkwood_cpuidle_match[] = {
> + { .compatible = "marvell,kirkwood-cpuidle", },
> + {},
> +};
> +
> +static struct platform_driver kirkwood_cpuidle_driver = {
> + .probe = kirkwood_cpuidle_probe,
> + .remove = __devexit_p(kirkwood_cpuidle_remove),
> + .driver = {
> + .name = "kirkwood_cpuidle",
> + .owner = THIS_MODULE,
> + .of_match_table = of_kirkwood_cpuidle_match,
> + },
> +};
> +
> +module_platform_driver(kirkwood_cpuidle_driver);
> +
> +MODULE_AUTHOR("Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>");
> +MODULE_DESCRIPTION("Kirkwood cpu idle driver");
> +MODULE_LICENSE("GPLv2");
> +MODULE_ALIAS("platform:kirkwood-cpuidle");
>
^ permalink raw reply
* [PATCH] cpuidle: kirkwood: Move out of mach directory, add DT.
From: Rob Herring @ 2012-12-28 14:18 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1356698844-4220-1-git-send-email-andrew@lunn.ch>
On 12/28/2012 06:47 AM, Andrew Lunn wrote:
> Move the Kirkwood cpuidle driver out of arch/arm/mach-kirkwood and
> into drivers/cpuidle. Convert the driver into a platform driver and
> add a device tree binding. Add a DT node to instantiate the driver for
> boards converted to DT, and a platform data for old style boards.
Is this an old comment? I don't see any platform data.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
> .../devicetree/bindings/power/qnap-poweroff.txt | 14 +++
> arch/arm/boot/dts/kirkwood.dtsi | 5 +
> arch/arm/configs/kirkwood_defconfig | 1 +
> arch/arm/mach-kirkwood/Makefile | 1 -
> arch/arm/mach-kirkwood/common.c | 23 ++++
> arch/arm/mach-kirkwood/cpuidle.c | 73 -------------
> arch/arm/mach-kirkwood/include/mach/kirkwood.h | 3 +-
> drivers/cpuidle/Kconfig | 6 ++
> drivers/cpuidle/Makefile | 1 +
> drivers/cpuidle/cpuidle-kirkwood.c | 114 ++++++++++++++++++++
> 10 files changed, 166 insertions(+), 75 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/power/qnap-poweroff.txt
> delete mode 100644 arch/arm/mach-kirkwood/cpuidle.c
> create mode 100644 drivers/cpuidle/cpuidle-kirkwood.c
>
> diff --git a/Documentation/devicetree/bindings/power/qnap-poweroff.txt b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> new file mode 100644
> index 0000000..e15a334
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/qnap-poweroff.txt
> @@ -0,0 +1,14 @@
> +* QNAP Power Off
This doesn't match the rest of the patch.
> +
> +QNAP NAS devices have a microcontroller controlling the main power
> +supply. This microcontroller is connected to UART1 of the Kirkwood and
> +Orion5x SoCs. Sending the charactor 'A', at 19200 baud, tells the
> +microcontroller to turn the power off. This driver adds a handler to
> +pm_power_off which is called to turn the power off.
> +
> +Required Properties:
> +- compatibile: Should be "qnap,power-off"
> +
> +- reg: Address and length of the register set for UART1
> +- clocks: tclk clock
> +
> diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
> index 7735cee..ca99aa2 100644
> --- a/arch/arm/boot/dts/kirkwood.dtsi
> +++ b/arch/arm/boot/dts/kirkwood.dtsi
> @@ -23,6 +23,11 @@
> #address-cells = <1>;
> #size-cells = <1>;
>
> + cpuidle at 1418 {
> + compatible = "marvell,kirkwood-cpuidle";
> + reg = <0x1418 0x4>;
> + };
> +
This is describing what linux wants, not the hardware. This is a common
problem with cpuidle drivers in that they use shared registers. I don't
have a good solution, but this doesn't belong in DTS.
Rob
> core_clk: core-clocks at 10030 {
> compatible = "marvell,kirkwood-core-clock";
> reg = <0x10030 0x4>;
> diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
> index 93f3794..13482ea 100644
> --- a/arch/arm/configs/kirkwood_defconfig
> +++ b/arch/arm/configs/kirkwood_defconfig
> @@ -56,6 +56,7 @@ CONFIG_AEABI=y
> CONFIG_ZBOOT_ROM_TEXT=0x0
> CONFIG_ZBOOT_ROM_BSS=0x0
> CONFIG_CPU_IDLE=y
> +CONFIG_CPU_IDLE_KIRKWOOD=y
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> index 8d2e5a9..d665309 100644
> --- a/arch/arm/mach-kirkwood/Makefile
> +++ b/arch/arm/mach-kirkwood/Makefile
> @@ -19,7 +19,6 @@ obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
> obj-$(CONFIG_MACH_T5325) += t5325-setup.o
>
> -obj-$(CONFIG_CPU_IDLE) += cpuidle.o
> obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
> obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
> obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
> diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
> index bac21a5..e8a2978 100644
> --- a/arch/arm/mach-kirkwood/common.c
> +++ b/arch/arm/mach-kirkwood/common.c
> @@ -499,6 +499,28 @@ void __init kirkwood_wdt_init(void)
> orion_wdt_init();
> }
>
> +/*****************************************************************************
> + * CPU idle
> + ****************************************************************************/
> +static struct resource kirkwood_cpuidle_resource[] = {
> + {
> + .flags = IORESOURCE_MEM,
> + .start = DDR_OPERATION_BASE,
> + .end = 3,
> + },
> +};
> +
> +static struct platform_device kirkwood_cpuidle = {
> + .name = "kirkwood_cpuidle",
> + .id = -1,
> + .resource = kirkwood_cpuidle_resource,
> + .num_resources = 1,
> +};
> +
> +static void __init kirkwood_cpuidle_init(void)
> +{
> + platform_device_register(&kirkwood_cpuidle);
> +}
>
> /*****************************************************************************
> * Time handling
> @@ -671,6 +693,7 @@ void __init kirkwood_init(void)
> kirkwood_xor1_init();
> kirkwood_crypto_init();
>
> + kirkwood_cpuidle_init();
> #ifdef CONFIG_KEXEC
> kexec_reinit = kirkwood_enable_pcie;
> #endif
> diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
> deleted file mode 100644
> index f730467..0000000
> --- a/arch/arm/mach-kirkwood/cpuidle.c
> +++ /dev/null
> @@ -1,73 +0,0 @@
> -/*
> - * arch/arm/mach-kirkwood/cpuidle.c
> - *
> - * CPU idle Marvell Kirkwood SoCs
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2. This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
> - *
> - * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> - * to implement two idle states -
> - * #1 wait-for-interrupt
> - * #2 wait-for-interrupt and DDR self refresh
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/init.h>
> -#include <linux/platform_device.h>
> -#include <linux/cpuidle.h>
> -#include <linux/io.h>
> -#include <linux/export.h>
> -#include <asm/proc-fns.h>
> -#include <asm/cpuidle.h>
> -#include <mach/kirkwood.h>
> -
> -#define KIRKWOOD_MAX_STATES 2
> -
> -/* Actual code that puts the SoC in different idle states */
> -static int kirkwood_enter_idle(struct cpuidle_device *dev,
> - struct cpuidle_driver *drv,
> - int index)
> -{
> - writel(0x7, DDR_OPERATION_BASE);
> - cpu_do_idle();
> -
> - return index;
> -}
> -
> -static struct cpuidle_driver kirkwood_idle_driver = {
> - .name = "kirkwood_idle",
> - .owner = THIS_MODULE,
> - .en_core_tk_irqen = 1,
> - .states[0] = ARM_CPUIDLE_WFI_STATE,
> - .states[1] = {
> - .enter = kirkwood_enter_idle,
> - .exit_latency = 10,
> - .target_residency = 100000,
> - .flags = CPUIDLE_FLAG_TIME_VALID,
> - .name = "DDR SR",
> - .desc = "WFI and DDR Self Refresh",
> - },
> - .state_count = KIRKWOOD_MAX_STATES,
> -};
> -
> -static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> -
> -/* Initialize CPU idle by registering the idle states */
> -static int kirkwood_init_cpuidle(void)
> -{
> - struct cpuidle_device *device;
> -
> - device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> - device->state_count = KIRKWOOD_MAX_STATES;
> -
> - cpuidle_register_driver(&kirkwood_idle_driver);
> - if (cpuidle_register_device(device)) {
> - pr_err("kirkwood_init_cpuidle: Failed registering\n");
> - return -EIO;
> - }
> - return 0;
> -}
> -
> -device_initcall(kirkwood_init_cpuidle);
> diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> index 041653a..a05563a 100644
> --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
> @@ -60,8 +60,9 @@
> * Register Map
> */
> #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
> +#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
> #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500)
> -#define DDR_OPERATION_BASE (DDR_VIRT_BASE + 0x1418)
> +#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
>
> #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
> #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)
> diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> index c4cc27e..071e2c3 100644
> --- a/drivers/cpuidle/Kconfig
> +++ b/drivers/cpuidle/Kconfig
> @@ -39,4 +39,10 @@ config CPU_IDLE_CALXEDA
> help
> Select this to enable cpuidle on Calxeda processors.
>
> +config CPU_IDLE_KIRKWOOD
> + bool "CPU Idle Driver for Kirkwood processors"
> + depends on ARCH_KIRKWOOD
> + help
> + Select this to enable cpuidle on Kirkwood processors.
> +
> endif
> diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> index 03ee874..24c6e7d 100644
> --- a/drivers/cpuidle/Makefile
> +++ b/drivers/cpuidle/Makefile
> @@ -6,3 +6,4 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
> obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
>
> obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
> +obj-$(CONFIG_CPU_IDLE_KIRKWOOD) += cpuidle-kirkwood.o
> diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c
> new file mode 100644
> index 0000000..2d9d5b3
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-kirkwood.c
> @@ -0,0 +1,114 @@
> +/*
> + * arch/arm/mach-kirkwood/cpuidle.c
> + *
> + * CPU idle Marvell Kirkwood SoCs
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + *
> + * The cpu idle uses wait-for-interrupt and DDR self refresh in order
> + * to implement two idle states -
> + * #1 wait-for-interrupt
> + * #2 wait-for-interrupt and DDR self refresh
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/cpuidle.h>
> +#include <linux/io.h>
> +#include <linux/export.h>
> +#include <linux/of.h>
> +#include <asm/proc-fns.h>
> +#include <asm/cpuidle.h>
> +
> +#define KIRKWOOD_MAX_STATES 2
> +
> +static void __iomem *ddr_operation_base;
> +
> +/* Actual code that puts the SoC in different idle states */
> +static int kirkwood_enter_idle(struct cpuidle_device *dev,
> + struct cpuidle_driver *drv,
> + int index)
> +{
> + writel(0x7, ddr_operation_base);
> + cpu_do_idle();
> +
> + return index;
> +}
> +
> +static struct cpuidle_driver kirkwood_idle_driver = {
> + .name = "kirkwood_idle",
> + .owner = THIS_MODULE,
> + .en_core_tk_irqen = 1,
> + .states[0] = ARM_CPUIDLE_WFI_STATE,
> + .states[1] = {
> + .enter = kirkwood_enter_idle,
> + .exit_latency = 10,
> + .target_residency = 100000,
> + .flags = CPUIDLE_FLAG_TIME_VALID,
> + .name = "DDR SR",
> + .desc = "WFI and DDR Self Refresh",
> + },
> + .state_count = KIRKWOOD_MAX_STATES,
> +};
> +static struct cpuidle_device *device;
> +
> +static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
> +
> +/* Initialize CPU idle by registering the idle states */
> +static int kirkwood_cpuidle_probe(struct platform_device *pdev)
> +{
> + struct resource *res;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (res == NULL)
> + return -EINVAL;
> +
> + ddr_operation_base = devm_ioremap(&pdev->dev, res->start,
> + resource_size(res));
> + if (ddr_operation_base == NULL)
> + return -EINVAL;
> +
> + device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
> + device->state_count = KIRKWOOD_MAX_STATES;
> +
> + cpuidle_register_driver(&kirkwood_idle_driver);
> + if (cpuidle_register_device(device)) {
> + pr_err("kirkwood_init_cpuidle: Failed registering\n");
> + return -EIO;
> + }
> + return 0;
> +}
> +
> +int kirkwood_cpuidle_remove(struct platform_device *pdev)
> +{
> + cpuidle_unregister_device(device);
> + cpuidle_unregister_driver(&kirkwood_idle_driver);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id of_kirkwood_cpuidle_match[] = {
> + { .compatible = "marvell,kirkwood-cpuidle", },
> + {},
> +};
> +
> +static struct platform_driver kirkwood_cpuidle_driver = {
> + .probe = kirkwood_cpuidle_probe,
> + .remove = __devexit_p(kirkwood_cpuidle_remove),
> + .driver = {
> + .name = "kirkwood_cpuidle",
> + .owner = THIS_MODULE,
> + .of_match_table = of_kirkwood_cpuidle_match,
> + },
> +};
> +
> +module_platform_driver(kirkwood_cpuidle_driver);
> +
> +MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
> +MODULE_DESCRIPTION("Kirkwood cpu idle driver");
> +MODULE_LICENSE("GPLv2");
> +MODULE_ALIAS("platform:kirkwood-cpuidle");
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.