Re: [PATCH 1/3] mtd: sharpsl: add sharpslpart MTD partition parser

2017-04-18 Thread Dmitry Eremin-Solenikov
2017-04-17 17:44 GMT+03:00 Boris Brezillon :
> Marek, Andrea,
>
> Before we even start discussing minor improvements (like coding style),
> I'd like to discuss the sharp FTL and partition table format, and
> decide whether we want to have such an old FTL included in the kernel.
>
> Actually, that's the very reason I asked Andrea to post his series as
> soon as possible even if some things were not perfect.
>
> I'll try to document myself on the on-flash format of the FTL and
> partition table before giving a definitive opinion, but I have the
> feeling this ancient FTL is not 100% safe, and by accepting an old
> (maybe unreliable?) FTL we are setting a precedent, and refusing other
> (broken) proprietary/vendor FTLs will be almost impossible after that.
>
> Maybe I'm wrong, and this FTL is really safe and can be used on other
> devices, that's why I'd like to understand how it works before giving
> my opinion.
>
>
> On Sun, 16 Apr 2017 18:07:47 +0200
> Marek Vasut  wrote:
>
>> On 04/15/2017 10:11 PM, Andrea Adami wrote:
>> > The Sharp SL Series (Zaurus) PXA handhelds have 16/64/128M of NAND flash
>> > and share the same layout of the first 7M partition, managed by Sharp FTL.
>> >
>> > The purpose of this self-contained patch is to add a common parser and
>> > remove the hardcoded sizes in the board files (these devices are not yet
>> > converted to devicetree).
>> > Users will have benefits because the mtdparts= tag will not be necessary
>> > anymore and they will be free to repartition the little sized flash.
>> >
>> > The obsolete bootloader can not pass the partitioning info to modern
>> > kernels anymore so it has to be read from flash at known logical addresses.
>> > (see http://www.h5.dion.ne.jp/~rimemoon/zaurus/memo_006.htm )
>
>
> Okay, IMO that's not really a good argument to support this partition
> parser. As Richard and I already mentioned several times, if your
> bootloader is not capable of passing valid mtdparts= you can hardcode
> it in the kernel using a default CMDLINE.
>
> Now, I understand that you want to support multiple devices with the
> same kernel, and having this partition parser would simplify your job.
> I also know you are developing a 2nd stage bootloader (based on
> kexec+a minimal initramfs) to address the limitations of the
> non-upgradable 1st stage bootloader.
>
> According to the rest of the description, you already have user-space
> tools to manipulate the partition-table and those are aware of the FTL
> layer, so I think you have all the basic blocks to get rid of this
> in-kernel implementation.
>
> All you need is a way to extract the partitions from the 2nd stage
> bootloader (using some tools you have in your initramfs) and build the
> according mtdparts= parameter to pass to kexec when booting the real
> kernel (the one used by the system).
>
> You tried to explain why it was not doable, but I still don't see
> why.
> You first said that not all systems had CONFIG_MTD_CMDLINE_PARTS
> enabled and that some people were booting distro kernels. Honestly, I
> think you have more chances to have CONFIG_MTD_CMDLINE_PARTS in those
> distro kernels than having your custom FTL enabled.
> Then you tried to explain that with the user-space only solution you
> wouldn't be able to support systems where the user had resized the
> partitions with the nandlogical tool, and I still don't see why. Maybe
> you can give more details to explain why this is impossible.
>
> Just going through all these details to say that, IMO, we should only
> consider inclusion of this feature if we think it's safe, because I
> think all that is done here can be done from user-space.

Not everybody is using kexecboot preloader. Asking users to depend on
the exact bootloader is not viable solution in my opinion.

>
> One last thing I was wondering. You said you want to keep existing
> partitioning unchanged, but I'd recommend to just drop the existing
> partitioning and have a single 121MB partition with UBI on it.
> This way you get support for UBI volumes, which is doing exactly what
> this FTL+partition-table is doing but in a standard/safe way.
> What is forcing you to keep the existing partitioning exactly?

Mostly compatibility with pre-flashed recovery kernel and with older kernels/
setups. Yes, flash on those PDAs contains secondary kernel+rootfs which
are used to reflash the main kernel (=kexecboot in some cases) and filesystems.

Just a short notice: we are not asking to add a full support for FTL,
read/write, etc.
We are asking for a small enough support that is necessary to actually read
partition table. After that MTD partitions are accessed w/o any FTL.

And unfortunately we are stuck with old FTL/partition table format, since
nobody wants to replace existing Sharp bootloader.

>> >
>> > In kernel, under arch/arm/mach-pxa we have already 8 machines:
>> > MACH_POODLE, MACH_CORGI, MACH_SHEPERD, MACH_HUSKY, MACH_AKITA, MACH_SPITZ,
>> > MACH_BORZOI, MACH_TOSA.
>> > Lost after the 2.4 vendor k

Re: [PATCH 6/9] mfd: tc6393xb: Use gpiochip data pointer

2016-03-31 Thread Dmitry Eremin-Solenikov
2016-03-30 11:48 GMT+03:00 Linus Walleij :
> This makes the driver use the data pointer added to the gpio_chip
> to store a pointer to the state container instead of relying on
> container_of().

Looks good.
Acked-by: Dmitry Eremin-Solenikov 

>
> Cc: Dmitry Baryshkov 
> Acked-by: Lee Jones 
> Signed-off-by: Linus Walleij 

-- 
With best wishes
Dmitry


Re: [RFT PATCH] arm: collie_defconfig: convert to use libata PATA drivers

2015-08-14 Thread Dmitry Eremin-Solenikov
2015-08-14 20:04 GMT+03:00 Bartlomiej Zolnierkiewicz :
> IDE subsystem has been deprecated since 2009 and the majority
> (if not all) of Linux distributions have switched to use
> libata for ATA support exclusively.  However there are still
> some users (mostly old or/and embedded non-x86 systems) that
> have not converted from using IDE subsystem to libata PATA
> drivers.  This doesn't seem to be good thing in the long-term
> for Linux as while there is less and less PATA systems left
> in use:
>
> * testing efforts are divided between two subsystems
>
> * having duplicate drivers for same hardware confuses users
>
> This patch converts collie_defconfig to use libata PATA
> drivers.
>
> Cc: Dmitry Eremin-Solenikov 
> Signed-off-by: Bartlomiej Zolnierkiewicz 

Acked-by: Dmitry Eremin-Solenikov 


-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pcmcia: fix a boot time warning in pcmcia cs code

2015-03-30 Thread Dmitry Eremin-Solenikov
During bootup pcmcia (pccardd) code enforces the following warning
backtrace:

do not call blocking ops when !TASK_RUNNING; state=1 set at [] 
pccardd+0xb8/0x3fc
Modules linked in:
CPU: 0 PID: 14 Comm: pccardd Not tainted 4.0.0-rc6+ #11
Hardware name: Sharp-Collie
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (warn_slowpath_common+0x74/0xac)
[] (warn_slowpath_common) from [] 
(warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt) from [] (__might_sleep+0x84/0xa0)
[] (__might_sleep) from [] (mutex_lock_nested+0x24/0x388)
[] (mutex_lock_nested) from [] (pccardd+0xf8/0x3fc)
[] (pccardd) from [] (kthread+0xdc/0xfc)
[] (kthread) from [] (ret_from_fork+0x14/0x2c)
---[ end trace fd94911637eed4ba ]---

This happens due to kthread trying to lock mutex in a TASK_INTERRUPTIBLE
state. Limit TASK_INTERRUPTIBLE task state to the schedule() call only,
so that the rest of the code runs in TASK_RUNNING state.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/pcmcia/cs.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 5292db6..367d45e 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -626,8 +626,6 @@ static int pccardd(void *__skt)
unsigned int events;
unsigned int sysfs_events;
 
-   set_current_state(TASK_INTERRUPTIBLE);
-
spin_lock_irqsave(&skt->thread_lock, flags);
events = skt->thread_events;
skt->thread_events = 0;
@@ -675,11 +673,15 @@ static int pccardd(void *__skt)
if (kthread_should_stop())
break;
 
+   set_current_state(TASK_INTERRUPTIBLE);
+
schedule();
+
+   /* make sure we are running */
+   __set_current_state(TASK_RUNNING);
+
try_to_freeze();
}
-   /* make sure we are running before we exit */
-   set_current_state(TASK_RUNNING);
 
/* shut down socket, if a device is still present */
if (skt->state & SOCKET_PRESENT) {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] power: gpio-charger: support disable the wakeup event

2015-02-10 Thread Dmitry Eremin-Solenikov
Hello,

2015-02-10 11:12 GMT+03:00 Chris Zhong :
> Support disable the wakeup event of gpio-charger by setting device tree.

I have the feelink, that this should be a userspace setting, rather than
a kernel/device-tree policy. In the end, the device tree is a hardware
description
and a hardware is capable of waking up the device.

>
> Signed-off-by: Chris Zhong 


-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] ARM: sa1100: implement irq driver as proper irqchip driver

2015-02-05 Thread Dmitry Eremin-Solenikov
Hello,

2015-02-04 15:19 GMT+03:00 Linus Walleij :
> On Fri, Jan 30, 2015 at 9:01 PM, Dmitry Eremin-Solenikov
>  wrote:
>
>> This is a second attempt to move Intel StrongARM SA-11x0 IRQ driver
>> to drivers/irqchip/ place.
>>
>> Changes since V1:
>>
>>  - Added soc/sa1100/pwer.h header containing sa11x0_*_set_wake()
>>prototypes.
>>
>>  - Removed spinlock from mask/unmask functions
>>
>>  - Minor whitespace changes.
>>
>> The patches are based on my previous sa1100 patches that can be found
>> in Russell's for-next branch or in linux-next tree.
>
> I have applied it and tested on the Compaq iPaq h3600:
> Tested-by: Linus Walleij 

Thank you. I'll probably wait for a couple more days for more feedback.
Especially from IRQ CHIP maintainers.

Thomas, Jason: any feedback on this version? If no, can you ack it
so that the patches can be merged through Russell's tree? If so, I
can maybe squash last two patches, so that the new driver will
be tied to old one through git internals?

Russell:any comments from your side?

>
> Very nice to see the SC and GPIO offsets in /proc/interrupts
> and very clean code, good work!

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-30 Thread Dmitry Eremin-Solenikov
PWER settings logically belongs neither to GPIO nor to system IRQ code.
Add special functions to handle PWER (for GPIO and for system IRQs)
from platform code.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/generic.c | 24 
 include/soc/sa1100/pwer.h  | 15 +++
 2 files changed, 39 insertions(+)
 create mode 100644 include/soc/sa1100/pwer.h

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 40e0d86..c651f6e 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -23,6 +23,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -416,3 +418,25 @@ void sa1110_mb_enable(void)
local_irq_restore(flags);
 }
 
+int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
+{
+   if (on)
+   PWER |= BIT(gpio);
+   else
+   PWER &= ~BIT(gpio);
+
+   return 0;
+}
+
+int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)
+{
+   if (BIT(irq) != IC_RTCAlrm)
+   return -EINVAL;
+
+   if (on)
+   PWER |= PWER_RTC;
+   else
+   PWER &= ~PWER_RTC;
+
+   return 0;
+}
diff --git a/include/soc/sa1100/pwer.h b/include/soc/sa1100/pwer.h
new file mode 100644
index 000..15a545b
--- /dev/null
+++ b/include/soc/sa1100/pwer.h
@@ -0,0 +1,15 @@
+#ifndef SOC_SA1100_PWER_H
+#define SOC_SA1100_PWER_H
+
+/*
+ * Copyright (C) 2015, Dmitry Eremin-Solenikov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on);
+int sa11x0_sc_set_wake(unsigned int irq, unsigned int on);
+
+#endif
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/5] irqchip: add sa1100 driver

2015-01-30 Thread Dmitry Eremin-Solenikov
Add an irqchip driver for Intel StrongARM SA-11x0 family of chips. For
now it is just a copy of the current arch/arm/mach-sa1100/irq.c driver.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-sa11x0.c   | 176 +
 include/linux/irqchip/irq-sa11x0.h |  16 
 3 files changed, 193 insertions(+)
 create mode 100644 drivers/irqchip/irq-sa11x0.c
 create mode 100644 include/linux/irqchip/irq-sa11x0.h

diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 9516a32..b0d1dde 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -42,3 +42,4 @@ obj-$(CONFIG_BRCMSTB_L2_IRQ)  += irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ) += irq-keystone.o
 obj-$(CONFIG_MIPS_GIC) += irq-mips-gic.o
 obj-$(CONFIG_ARCH_MEDIATEK)+= irq-mtk-sysirq.o
+obj-$(CONFIG_ARCH_SA1100)  += irq-sa11x0.o
diff --git a/drivers/irqchip/irq-sa11x0.c b/drivers/irqchip/irq-sa11x0.c
new file mode 100644
index 000..76b8c1d
--- /dev/null
+++ b/drivers/irqchip/irq-sa11x0.c
@@ -0,0 +1,176 @@
+/*
+ * drivers/irqchip/irq-sa11x0.c
+ *
+ * Copyright (C) 1999-2001 Nicolas Pitre
+ *
+ * Generic IRQ handling for the SA11x0.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define ICIP   0x00  /* IC IRQ Pending reg. */
+#define ICMR   0x04  /* IC Mask Reg.*/
+#define ICLR   0x08  /* IC Level Reg.   */
+#define ICCR   0x0C  /* IC Control Reg. */
+#define ICFP   0x10  /* IC FIQ Pending reg. */
+#define ICPR   0x20  /* IC Pending Reg. */
+
+static void __iomem *iobase;
+
+/*
+ * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
+ * this is for internal IRQs i.e. from IRQ LCD to RTCAlrm.
+ */
+static void sa1100_mask_irq(struct irq_data *d)
+{
+   u32 reg;
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg &= ~BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
+}
+
+static void sa1100_unmask_irq(struct irq_data *d)
+{
+   u32 reg;
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg |= BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
+}
+
+static int sa1100_set_wake(struct irq_data *d, unsigned int on)
+{
+   return sa11x0_sc_set_wake(d->hwirq, on);
+}
+
+static struct irq_chip sa1100_normal_chip = {
+   .name   = "SC",
+   .irq_ack= sa1100_mask_irq,
+   .irq_mask   = sa1100_mask_irq,
+   .irq_unmask = sa1100_unmask_irq,
+   .irq_set_wake   = sa1100_set_wake,
+};
+
+static int sa1100_normal_irqdomain_map(struct irq_domain *d,
+   unsigned int irq, irq_hw_number_t hwirq)
+{
+   irq_set_chip_and_handler(irq, &sa1100_normal_chip,
+handle_level_irq);
+   set_irq_flags(irq, IRQF_VALID);
+
+   return 0;
+}
+
+static struct irq_domain_ops sa1100_normal_irqdomain_ops = {
+   .map = sa1100_normal_irqdomain_map,
+   .xlate = irq_domain_xlate_onetwocell,
+};
+
+static struct irq_domain *sa1100_normal_irqdomain;
+
+static struct sa1100irq_state {
+   unsigned intsaved;
+   unsigned inticmr;
+   unsigned inticlr;
+   unsigned inticcr;
+} sa1100irq_state;
+
+static int sa1100irq_suspend(void)
+{
+   struct sa1100irq_state *st = &sa1100irq_state;
+
+   st->saved = 1;
+   st->icmr = readl_relaxed(iobase + ICMR);
+   st->iclr = readl_relaxed(iobase + ICLR);
+   st->iccr = readl_relaxed(iobase + ICCR);
+
+   /*
+* Disable all GPIO-based interrupts.
+*/
+   writel_relaxed(st->icmr & 0xf000, iobase + ICMR);
+
+   return 0;
+}
+
+static void sa1100irq_resume(void)
+{
+   struct sa1100irq_state *st = &sa1100irq_state;
+
+   if (st->saved) {
+   writel_relaxed(st->iccr, iobase + ICCR);
+   writel_relaxed(st->iclr, iobase + ICLR);
+
+   writel_relaxed(st->icmr, iobase + ICMR);
+   }
+}
+
+static struct syscore_ops sa1100irq_syscore_ops = {
+   .suspend= sa1100irq_suspend,
+   .resume = sa1100irq_resume,
+};
+
+static int __init sa1100irq_init_devicefs(void)
+{
+   register_syscore_ops(&sa1100irq_syscore_ops);
+   return 0;
+}
+
+device_initcall(sa1100irq_init_devicefs);
+
+static asmlinkage void __exception_irq_entry
+sa1100_handle_irq(struct pt_regs *regs)
+{
+   uint32_t icip, icmr, mask;
+
+   do {
+   icip = readl_relaxed(iobase + ICIP);
+   icmr = readl_relaxed(iobase + ICMR);
+   mask = icip & icmr;
+
+   if (mask == 0)
+ 

[PATCH v2 5/5] ARM: sa1100: drop irq driver

2015-01-30 Thread Dmitry Eremin-Solenikov
Drop irq driver for sa1100 in favour of irqchip driver replacement.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/Makefile  |   2 +-
 arch/arm/mach-sa1100/generic.c |  13 +++
 arch/arm/mach-sa1100/irq.c | 186 -
 3 files changed, 14 insertions(+), 187 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/irq.c

diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 61ff91e..ebc4d58 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := clock.o generic.o irq.o #nmi-oopser.o
+obj-y := clock.o generic.o #nmi-oopser.o
 
 # Specific board support
 obj-$(CONFIG_SA1100_ASSABET)   += assabet.o
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index c651f6e..345e63f 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -377,6 +378,18 @@ void __init sa1100_timer_init(void)
pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x9000), 3686400);
 }
 
+static struct resource irq_resource =
+   DEFINE_RES_MEM_NAMED(0x9005, SZ_64K, "irqs");
+
+void __init sa1100_init_irq(void)
+{
+   request_resource(&iomem_resource, &irq_resource);
+
+   sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start);
+
+   sa1100_init_gpio();
+}
+
 /*
  * Disable the memory bus request/grant signals on the SA1110 to
  * ensure that we don't receive spurious memory requests.  We set
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
deleted file mode 100644
index 08f929e..000
--- a/arch/arm/mach-sa1100/irq.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * linux/arch/arm/mach-sa1100/irq.c
- *
- * Copyright (C) 1999-2001 Nicolas Pitre
- *
- * Generic IRQ handling for the SA11x0, GPIO 11-27 IRQ demultiplexing.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include 
-#include 
-
-#include "generic.h"
-
-#define ICIP   0x00  /* IC IRQ Pending reg. */
-#define ICMR   0x04  /* IC Mask Reg.*/
-#define ICLR   0x08  /* IC Level Reg.   */
-#define ICCR   0x0C  /* IC Control Reg. */
-#define ICFP   0x10  /* IC FIQ Pending reg. */
-#define ICPR   0x20  /* IC Pending Reg. */
-
-static void __iomem *iobase;
-
-/*
- * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
- * this is for internal IRQs i.e. from IRQ LCD to RTCAlrm.
- */
-static void sa1100_mask_irq(struct irq_data *d)
-{
-   u32 reg;
-
-   reg = readl_relaxed(iobase + ICMR);
-   reg &= ~BIT(d->hwirq);
-   writel_relaxed(reg, iobase + ICMR);
-}
-
-static void sa1100_unmask_irq(struct irq_data *d)
-{
-   u32 reg;
-
-   reg = readl_relaxed(iobase + ICMR);
-   reg |= BIT(d->hwirq);
-   writel_relaxed(reg, iobase + ICMR);
-}
-
-static int sa1100_set_wake(struct irq_data *d, unsigned int on)
-{
-   return sa11x0_sc_set_wake(d->hwirq, on);
-}
-
-static struct irq_chip sa1100_normal_chip = {
-   .name   = "SC",
-   .irq_ack= sa1100_mask_irq,
-   .irq_mask   = sa1100_mask_irq,
-   .irq_unmask = sa1100_unmask_irq,
-   .irq_set_wake   = sa1100_set_wake,
-};
-
-static int sa1100_normal_irqdomain_map(struct irq_domain *d,
-   unsigned int irq, irq_hw_number_t hwirq)
-{
-   irq_set_chip_and_handler(irq, &sa1100_normal_chip,
-handle_level_irq);
-   set_irq_flags(irq, IRQF_VALID);
-
-   return 0;
-}
-
-static struct irq_domain_ops sa1100_normal_irqdomain_ops = {
-   .map = sa1100_normal_irqdomain_map,
-   .xlate = irq_domain_xlate_onetwocell,
-};
-
-static struct irq_domain *sa1100_normal_irqdomain;
-
-static struct resource irq_resource =
-   DEFINE_RES_MEM_NAMED(0x9005, SZ_64K, "irqs");
-
-static struct sa1100irq_state {
-   unsigned intsaved;
-   unsigned inticmr;
-   unsigned inticlr;
-   unsigned inticcr;
-} sa1100irq_state;
-
-static int sa1100irq_suspend(void)
-{
-   struct sa1100irq_state *st = &sa1100irq_state;
-
-   st->saved = 1;
-   st->icmr = readl_relaxed(iobase + ICMR);
-   st->iclr = readl_relaxed(iobase + ICLR);
-   st->iccr = readl_relaxed(iobase + ICCR);
-
-   /*
-* Disable all GPIO-based interrupts.
-*/
-   writel_relaxed(st->icmr & 0xf000, iobase + ICMR);
-
-   return 0;
-}
-
-static void sa1100irq_resume(void)
-{
-   struct sa1100irq_state *st = &sa1100irq_state;
-
-   if (st->saved) {
-   writel_relaxed(st->iccr, i

[PATCH v2 0/5] ARM: sa1100: implement irq driver as proper irqchip driver

2015-01-30 Thread Dmitry Eremin-Solenikov
Hello,

This is a second attempt to move Intel StrongARM SA-11x0 IRQ driver
to drivers/irqchip/ place.

Changes since V1:

 - Added soc/sa1100/pwer.h header containing sa11x0_*_set_wake()
   prototypes.

 - Removed spinlock from mask/unmask functions

 - Minor whitespace changes.

The patches are based on my previous sa1100 patches that can be found
in Russell's for-next branch or in linux-next tree.


Dmitry Eremin-Solenikov (5):
  ARM: sa1100: add platform functions to handle PWER settings
  ARM: sa1100: use sa11x0_sc_set_wake() in irq driver
  ARM: sa1100: use ioremapped memory to access SC registers
  irqchip: add sa1100 driver
  ARM: sa1100: drop irq driver

 arch/arm/mach-sa1100/Makefile  |  2 +-
 arch/arm/mach-sa1100/generic.c | 37 ++
 drivers/irqchip/Makefile   |  1 +
 .../irq.c => drivers/irqchip/irq-sa11x0.c  | 82 +++---
 include/linux/irqchip/irq-sa11x0.h | 16 +
 include/soc/sa1100/pwer.h  | 15 
 6 files changed, 110 insertions(+), 43 deletions(-)
 rename arch/arm/mach-sa1100/irq.c => drivers/irqchip/irq-sa11x0.c (66%)
 create mode 100644 include/linux/irqchip/irq-sa11x0.h
 create mode 100644 include/soc/sa1100/pwer.h

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/5] ARM: sa1100: use ioremapped memory to access SC registers

2015-01-30 Thread Dmitry Eremin-Solenikov
Use ioremap() and readl/writel_relaxed() to access IRQ controller
registers.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/irq.c | 52 ++
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 6afaa33..08f929e 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -20,13 +20,19 @@
 
 #include 
 
-#include 
 #include 
-#include 
 #include 
 
 #include "generic.h"
 
+#define ICIP   0x00  /* IC IRQ Pending reg. */
+#define ICMR   0x04  /* IC Mask Reg.*/
+#define ICLR   0x08  /* IC Level Reg.   */
+#define ICCR   0x0C  /* IC Control Reg. */
+#define ICFP   0x10  /* IC FIQ Pending reg. */
+#define ICPR   0x20  /* IC Pending Reg. */
+
+static void __iomem *iobase;
 
 /*
  * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
@@ -34,12 +40,20 @@
  */
 static void sa1100_mask_irq(struct irq_data *d)
 {
-   ICMR &= ~BIT(d->hwirq);
+   u32 reg;
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg &= ~BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
 }
 
 static void sa1100_unmask_irq(struct irq_data *d)
 {
-   ICMR |= BIT(d->hwirq);
+   u32 reg;
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg |= BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
 }
 
 static int sa1100_set_wake(struct irq_data *d, unsigned int on)
@@ -87,16 +101,14 @@ static int sa1100irq_suspend(void)
struct sa1100irq_state *st = &sa1100irq_state;
 
st->saved = 1;
-   st->icmr = ICMR;
-   st->iclr = ICLR;
-   st->iccr = ICCR;
+   st->icmr = readl_relaxed(iobase + ICMR);
+   st->iclr = readl_relaxed(iobase + ICLR);
+   st->iccr = readl_relaxed(iobase + ICCR);
 
/*
 * Disable all GPIO-based interrupts.
 */
-   ICMR &= ~(IC_GPIO11_27|IC_GPIO10|IC_GPIO9|IC_GPIO8|IC_GPIO7|
- IC_GPIO6|IC_GPIO5|IC_GPIO4|IC_GPIO3|IC_GPIO2|
- IC_GPIO1|IC_GPIO0);
+   writel_relaxed(st->icmr & 0xf000, iobase + ICMR);
 
return 0;
 }
@@ -106,10 +118,10 @@ static void sa1100irq_resume(void)
struct sa1100irq_state *st = &sa1100irq_state;
 
if (st->saved) {
-   ICCR = st->iccr;
-   ICLR = st->iclr;
+   writel_relaxed(st->iccr, iobase + ICCR);
+   writel_relaxed(st->iclr, iobase + ICLR);
 
-   ICMR = st->icmr;
+   writel_relaxed(st->icmr, iobase + ICMR);
}
 }
 
@@ -132,8 +144,8 @@ sa1100_handle_irq(struct pt_regs *regs)
uint32_t icip, icmr, mask;
 
do {
-   icip = (ICIP);
-   icmr = (ICMR);
+   icip = readl_relaxed(iobase + ICIP);
+   icmr = readl_relaxed(iobase + ICMR);
mask = icip & icmr;
 
if (mask == 0)
@@ -148,17 +160,21 @@ void __init sa1100_init_irq(void)
 {
request_resource(&iomem_resource, &irq_resource);
 
+   iobase = ioremap(irq_resource.start, SZ_64K);
+   if (WARN_ON(!iobase))
+   return;
+
/* disable all IRQs */
-   ICMR = 0;
+   writel_relaxed(0, iobase + ICMR);
 
/* all IRQs are IRQ, not FIQ */
-   ICLR = 0;
+   writel_relaxed(0, iobase + ICLR);
 
/*
 * Whatever the doc says, this has to be set for the wait-on-irq
 * instruction to work... on a SA1100 rev 9 at least.
 */
-   ICCR = 1;
+   writel_relaxed(1, iobase + ICCR);
 
sa1100_normal_irqdomain = irq_domain_add_simple(NULL,
32, IRQ_GPIO0_SC,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/5] ARM: sa1100: use sa11x0_sc_set_wake() in irq driver

2015-01-30 Thread Dmitry Eremin-Solenikov
Use new function controlling PWER register in IRQ driver.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/irq.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 65aebfa..6afaa33 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -18,6 +18,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -40,19 +42,9 @@ static void sa1100_unmask_irq(struct irq_data *d)
ICMR |= BIT(d->hwirq);
 }
 
-/*
- * Apart form GPIOs, only the RTC alarm can be a wakeup event.
- */
 static int sa1100_set_wake(struct irq_data *d, unsigned int on)
 {
-   if (BIT(d->hwirq) == IC_RTCAlrm) {
-   if (on)
-   PWER |= PWER_RTC;
-   else
-   PWER &= ~PWER_RTC;
-   return 0;
-   }
-   return -EINVAL;
+   return sa11x0_sc_set_wake(d->hwirq, on);
 }
 
 static struct irq_chip sa1100_normal_chip = {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] ARM: sa1100: use ioremapped memory to access SC registers

2015-01-24 Thread Dmitry Eremin-Solenikov
2015-01-24 22:24 GMT+03:00 Thomas Gleixner :
> On Sat, 24 Jan 2015, Dmitry Eremin-Solenikov wrote:
>
>> 2015-01-24 20:48 GMT+03:00 Thomas Gleixner :
>> > On Thu, 15 Jan 2015, Dmitry Eremin-Solenikov wrote:
>> >>  static void sa1100_mask_irq(struct irq_data *d)
>> >>  {
>> >> - ICMR &= ~BIT(d->hwirq);
>> >> + u32 reg;
>> >> + unsigned long flags;
>> >> +
>> >> + raw_spin_lock_irqsave(&lock, flags);
>> >
>> > What's the exact point of that lock? And how is it related to the
>> > $subject of the patch?
>>
>> It is needed to protect ICMR register during RMW cycle, isn't it?
>
> The original code has no protection for the RMW either.
>
> And there is a simple reason for this. These functions are guaranteed
> to be called with interrupts disabled and this is a uniprocessor
> machine and it will never grow SMP support. So interrupts disabled is
> serialization enough.

OK, thanks for pointing. I'll update the patchset in a few days.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] ARM: sa1100: use ioremapped memory to access SC registers

2015-01-24 Thread Dmitry Eremin-Solenikov
2015-01-24 20:48 GMT+03:00 Thomas Gleixner :
> On Thu, 15 Jan 2015, Dmitry Eremin-Solenikov wrote:
>>  static void sa1100_mask_irq(struct irq_data *d)
>>  {
>> - ICMR &= ~BIT(d->hwirq);
>> + u32 reg;
>> + unsigned long flags;
>> +
>> + raw_spin_lock_irqsave(&lock, flags);
>
> What's the exact point of that lock? And how is it related to the
> $subject of the patch?

It is needed to protect ICMR register during RMW cycle, isn't it?
I might have missed locks around ack/mask/unmask calls from irq
core. If so, I can happily drop this spinlock.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-21 Thread Dmitry Eremin-Solenikov
Hello,

2015-01-21 13:05 GMT+03:00 Linus Walleij :
>
> On Thu, Jan 15, 2015 at 11:09 AM, Dmitry Eremin-Solenikov
>  wrote:
>
> > PWER settings logically belongs neither to GPIO nor to system IRQ code.
> > Add special functions to handle PWER (for GPIO and for system IRQs)
> > from platform code.
> >
> > Signed-off-by: Dmitry Eremin-Solenikov 
>
> > diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
> (...)
> > +int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
> (...)
> > +int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)
>
> Why are these two functions not added to any .h file?
>
> Did you miss to commit something or are there compile
> warnings about this?

I thought quite a while about adding them to any header. In the end I ended
adding them to the irqchip header file. PWER handling is (a bit) related to IRQ
handling. The only other user of those functions would be a gpio (or pinctrl
if it ends that way) driver.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] ARM: sa1100: drop irq driver

2015-01-15 Thread Dmitry Eremin-Solenikov
Drop irq driver for sa1100 in favour of irqchip driver replacement.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/Makefile  |   2 +-
 arch/arm/mach-sa1100/generic.c |  13 +++
 arch/arm/mach-sa1100/irq.c | 195 -
 3 files changed, 14 insertions(+), 196 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/irq.c

diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 61ff91e..ebc4d58 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := clock.o generic.o irq.o #nmi-oopser.o
+obj-y := clock.o generic.o #nmi-oopser.o
 
 # Specific board support
 obj-$(CONFIG_SA1100_ASSABET)   += assabet.o
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 022e451..3fdc16b 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -375,6 +376,18 @@ void __init sa1100_timer_init(void)
pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x9000), 3686400);
 }
 
+static struct resource irq_resource =
+   DEFINE_RES_MEM_NAMED(0x9005, SZ_64K, "irqs");
+
+void __init sa1100_init_irq(void)
+{
+   request_resource(&iomem_resource, &irq_resource);
+
+   sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start);
+
+   sa1100_init_gpio();
+}
+
 /*
  * Disable the memory bus request/grant signals on the SA1110 to
  * ensure that we don't receive spurious memory requests.  We set
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
deleted file mode 100644
index 66464fd..000
--- a/arch/arm/mach-sa1100/irq.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * linux/arch/arm/mach-sa1100/irq.c
- *
- * Copyright (C) 1999-2001 Nicolas Pitre
- *
- * Generic IRQ handling for the SA11x0, GPIO 11-27 IRQ demultiplexing.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include "generic.h"
-
-#define ICIP   0x00  /* IC IRQ Pending reg. */
-#define ICMR   0x04  /* IC Mask Reg.*/
-#define ICLR   0x08  /* IC Level Reg.   */
-#define ICCR   0x0C  /* IC Control Reg. */
-#define ICFP   0x10  /* IC FIQ Pending reg. */
-#define ICPR   0x20  /* IC Pending Reg. */
-
-static void __iomem *iobase;
-static DEFINE_RAW_SPINLOCK(lock);
-
-/*
- * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
- * this is for internal IRQs i.e. from IRQ LCD to RTCAlrm.
- */
-static void sa1100_mask_irq(struct irq_data *d)
-{
-   u32 reg;
-   unsigned long flags;
-
-   raw_spin_lock_irqsave(&lock, flags);
-
-   reg = readl_relaxed(iobase + ICMR);
-   reg &= ~BIT(d->hwirq);
-   writel_relaxed(reg, iobase + ICMR);
-
-   raw_spin_unlock_irqrestore(&lock, flags);
-}
-
-static void sa1100_unmask_irq(struct irq_data *d)
-{
-   u32 reg;
-   unsigned long flags;
-
-   raw_spin_lock_irqsave(&lock, flags);
-
-   reg = readl_relaxed(iobase + ICMR);
-   reg |= BIT(d->hwirq);
-   writel_relaxed(reg, iobase + ICMR);
-
-   raw_spin_unlock_irqrestore(&lock, flags);
-}
-
-static int sa1100_set_wake(struct irq_data *d, unsigned int on)
-{
-   return sa11x0_sc_set_wake(d->hwirq, on);
-}
-
-static struct irq_chip sa1100_normal_chip = {
-   .name   = "SC",
-   .irq_ack= sa1100_mask_irq,
-   .irq_mask   = sa1100_mask_irq,
-   .irq_unmask = sa1100_unmask_irq,
-   .irq_set_wake   = sa1100_set_wake,
-};
-
-static int sa1100_normal_irqdomain_map(struct irq_domain *d,
-   unsigned int irq, irq_hw_number_t hwirq)
-{
-   irq_set_chip_and_handler(irq, &sa1100_normal_chip,
-handle_level_irq);
-   set_irq_flags(irq, IRQF_VALID);
-
-   return 0;
-}
-
-static struct irq_domain_ops sa1100_normal_irqdomain_ops = {
-   .map = sa1100_normal_irqdomain_map,
-   .xlate = irq_domain_xlate_onetwocell,
-};
-
-static struct irq_domain *sa1100_normal_irqdomain;
-
-static struct resource irq_resource =
-   DEFINE_RES_MEM_NAMED(0x9005, SZ_64K, "irqs");
-
-static struct sa1100irq_state {
-   unsigned intsaved;
-   unsigned inticmr;
-   unsigned inticlr;
-   unsigned inticcr;
-} sa1100irq_state;
-
-static int sa1100irq_suspend(void)
-{
-   struct sa1100irq_state *st = &sa1100irq_state;
-
-   st->saved = 1;
-   st->icmr = readl_relaxed(iobase + ICMR);
-   st->iclr = readl_relaxed(iobase + ICLR);
-   st->iccr = readl_relaxed(iobase + ICCR);
-
-   /*
-* Disable all GPI

[PATCH 4/5] irqchip: add sa1100 driver

2015-01-15 Thread Dmitry Eremin-Solenikov
Add an irqchip driver for Intel StrongARM SA-11x0 family of chips. For
now it is just a copy of the current arch/arm/mach-sa1100/irq.c driver.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-sa11x0.c   | 185 +
 include/linux/irqchip/irq-sa11x0.h |  18 
 3 files changed, 204 insertions(+)
 create mode 100644 drivers/irqchip/irq-sa11x0.c
 create mode 100644 include/linux/irqchip/irq-sa11x0.h

diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 9516a32..b0d1dde 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -42,3 +42,4 @@ obj-$(CONFIG_BRCMSTB_L2_IRQ)  += irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ) += irq-keystone.o
 obj-$(CONFIG_MIPS_GIC) += irq-mips-gic.o
 obj-$(CONFIG_ARCH_MEDIATEK)+= irq-mtk-sysirq.o
+obj-$(CONFIG_ARCH_SA1100)  += irq-sa11x0.o
diff --git a/drivers/irqchip/irq-sa11x0.c b/drivers/irqchip/irq-sa11x0.c
new file mode 100644
index 000..c840187
--- /dev/null
+++ b/drivers/irqchip/irq-sa11x0.c
@@ -0,0 +1,185 @@
+/*
+ * drivers/irqchip/irq-sa11x0.c
+ *
+ * Copyright (C) 1999-2001 Nicolas Pitre
+ *
+ * Generic IRQ handling for the SA11x0.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define ICIP   0x00  /* IC IRQ Pending reg. */
+#define ICMR   0x04  /* IC Mask Reg.*/
+#define ICLR   0x08  /* IC Level Reg.   */
+#define ICCR   0x0C  /* IC Control Reg. */
+#define ICFP   0x10  /* IC FIQ Pending reg. */
+#define ICPR   0x20  /* IC Pending Reg. */
+
+static void __iomem *iobase;
+static DEFINE_RAW_SPINLOCK(lock);
+
+/*
+ * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
+ * this is for internal IRQs i.e. from IRQ LCD to RTCAlrm.
+ */
+static void sa1100_mask_irq(struct irq_data *d)
+{
+   u32 reg;
+   unsigned long flags;
+
+   raw_spin_lock_irqsave(&lock, flags);
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg &= ~BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
+
+   raw_spin_unlock_irqrestore(&lock, flags);
+}
+
+static void sa1100_unmask_irq(struct irq_data *d)
+{
+   u32 reg;
+   unsigned long flags;
+
+   raw_spin_lock_irqsave(&lock, flags);
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg |= BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
+
+   raw_spin_unlock_irqrestore(&lock, flags);
+}
+
+static int sa1100_set_wake(struct irq_data *d, unsigned int on)
+{
+   return sa11x0_sc_set_wake(d->hwirq, on);
+}
+
+static struct irq_chip sa1100_normal_chip = {
+   .name   = "SC",
+   .irq_ack= sa1100_mask_irq,
+   .irq_mask   = sa1100_mask_irq,
+   .irq_unmask = sa1100_unmask_irq,
+   .irq_set_wake   = sa1100_set_wake,
+};
+
+static int sa1100_normal_irqdomain_map(struct irq_domain *d,
+   unsigned int irq, irq_hw_number_t hwirq)
+{
+   irq_set_chip_and_handler(irq, &sa1100_normal_chip,
+handle_level_irq);
+   set_irq_flags(irq, IRQF_VALID);
+
+   return 0;
+}
+
+static struct irq_domain_ops sa1100_normal_irqdomain_ops = {
+   .map = sa1100_normal_irqdomain_map,
+   .xlate = irq_domain_xlate_onetwocell,
+};
+
+static struct irq_domain *sa1100_normal_irqdomain;
+
+static struct sa1100irq_state {
+   unsigned intsaved;
+   unsigned inticmr;
+   unsigned inticlr;
+   unsigned inticcr;
+} sa1100irq_state;
+
+static int sa1100irq_suspend(void)
+{
+   struct sa1100irq_state *st = &sa1100irq_state;
+
+   st->saved = 1;
+   st->icmr = readl_relaxed(iobase + ICMR);
+   st->iclr = readl_relaxed(iobase + ICLR);
+   st->iccr = readl_relaxed(iobase + ICCR);
+
+   /*
+* Disable all GPIO-based interrupts.
+*/
+   writel_relaxed(st->icmr & 0xf000, iobase + ICMR);
+
+   return 0;
+}
+
+static void sa1100irq_resume(void)
+{
+   struct sa1100irq_state *st = &sa1100irq_state;
+
+   if (st->saved) {
+   writel_relaxed(st->iccr, iobase + ICCR);
+   writel_relaxed(st->iclr, iobase + ICLR);
+
+   writel_relaxed(st->icmr, iobase + ICMR);
+   }
+}
+
+static struct syscore_ops sa1100irq_syscore_ops = {
+   .suspend= sa1100irq_suspend,
+   .resume = sa1100irq_resume,
+};
+
+static int __init sa1100irq_init_devicefs(void)
+{
+   register_syscore_ops(&sa1100irq_syscore_ops);
+   return 0;
+}
+
+device_initcall(sa1100irq_init_devicefs);
+
+static asmlinkage void __exception_irq_e

[PATCH 3/5] ARM: sa1100: use ioremapped memory to access SC registers

2015-01-15 Thread Dmitry Eremin-Solenikov
Use ioremap() and readl/writel_relaxed() to access IRQ controller
registers.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/irq.c | 63 +-
 1 file changed, 45 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 7a5aa56..66464fd 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -18,13 +18,20 @@
 #include 
 #include 
 
-#include 
 #include 
-#include 
 #include 
 
 #include "generic.h"
 
+#define ICIP   0x00  /* IC IRQ Pending reg. */
+#define ICMR   0x04  /* IC Mask Reg.*/
+#define ICLR   0x08  /* IC Level Reg.   */
+#define ICCR   0x0C  /* IC Control Reg. */
+#define ICFP   0x10  /* IC FIQ Pending reg. */
+#define ICPR   0x20  /* IC Pending Reg. */
+
+static void __iomem *iobase;
+static DEFINE_RAW_SPINLOCK(lock);
 
 /*
  * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
@@ -32,12 +39,30 @@
  */
 static void sa1100_mask_irq(struct irq_data *d)
 {
-   ICMR &= ~BIT(d->hwirq);
+   u32 reg;
+   unsigned long flags;
+
+   raw_spin_lock_irqsave(&lock, flags);
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg &= ~BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
+
+   raw_spin_unlock_irqrestore(&lock, flags);
 }
 
 static void sa1100_unmask_irq(struct irq_data *d)
 {
-   ICMR |= BIT(d->hwirq);
+   u32 reg;
+   unsigned long flags;
+
+   raw_spin_lock_irqsave(&lock, flags);
+
+   reg = readl_relaxed(iobase + ICMR);
+   reg |= BIT(d->hwirq);
+   writel_relaxed(reg, iobase + ICMR);
+
+   raw_spin_unlock_irqrestore(&lock, flags);
 }
 
 static int sa1100_set_wake(struct irq_data *d, unsigned int on)
@@ -85,16 +110,14 @@ static int sa1100irq_suspend(void)
struct sa1100irq_state *st = &sa1100irq_state;
 
st->saved = 1;
-   st->icmr = ICMR;
-   st->iclr = ICLR;
-   st->iccr = ICCR;
+   st->icmr = readl_relaxed(iobase + ICMR);
+   st->iclr = readl_relaxed(iobase + ICLR);
+   st->iccr = readl_relaxed(iobase + ICCR);
 
/*
 * Disable all GPIO-based interrupts.
 */
-   ICMR &= ~(IC_GPIO11_27|IC_GPIO10|IC_GPIO9|IC_GPIO8|IC_GPIO7|
- IC_GPIO6|IC_GPIO5|IC_GPIO4|IC_GPIO3|IC_GPIO2|
- IC_GPIO1|IC_GPIO0);
+   writel_relaxed(st->icmr & 0xf000, iobase + ICMR);
 
return 0;
 }
@@ -104,10 +127,10 @@ static void sa1100irq_resume(void)
struct sa1100irq_state *st = &sa1100irq_state;
 
if (st->saved) {
-   ICCR = st->iccr;
-   ICLR = st->iclr;
+   writel_relaxed(st->iccr, iobase + ICCR);
+   writel_relaxed(st->iclr, iobase + ICLR);
 
-   ICMR = st->icmr;
+   writel_relaxed(st->icmr, iobase + ICMR);
}
 }
 
@@ -130,8 +153,8 @@ sa1100_handle_irq(struct pt_regs *regs)
uint32_t icip, icmr, mask;
 
do {
-   icip = (ICIP);
-   icmr = (ICMR);
+   icip = readl_relaxed(iobase + ICIP);
+   icmr = readl_relaxed(iobase + ICMR);
mask = icip & icmr;
 
if (mask == 0)
@@ -146,17 +169,21 @@ void __init sa1100_init_irq(void)
 {
request_resource(&iomem_resource, &irq_resource);
 
+   iobase = ioremap(irq_resource.start, SZ_64K);
+   if (WARN_ON(!iobase))
+   return;
+
/* disable all IRQs */
-   ICMR = 0;
+   writel_relaxed(0, iobase + ICMR);
 
/* all IRQs are IRQ, not FIQ */
-   ICLR = 0;
+   writel_relaxed(0, iobase + ICLR);
 
/*
 * Whatever the doc says, this has to be set for the wait-on-irq
 * instruction to work... on a SA1100 rev 9 at least.
 */
-   ICCR = 1;
+   writel_relaxed(1, iobase + ICCR);
 
sa1100_normal_irqdomain = irq_domain_add_simple(NULL,
32, IRQ_GPIO0_SC,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] ARM: sa1100: use sa11x0_sc_set_wake() in irq driver

2015-01-15 Thread Dmitry Eremin-Solenikov
Use new function controlling PWER register in IRQ driver.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/irq.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 65aebfa..7a5aa56 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -40,19 +40,9 @@ static void sa1100_unmask_irq(struct irq_data *d)
ICMR |= BIT(d->hwirq);
 }
 
-/*
- * Apart form GPIOs, only the RTC alarm can be a wakeup event.
- */
 static int sa1100_set_wake(struct irq_data *d, unsigned int on)
 {
-   if (BIT(d->hwirq) == IC_RTCAlrm) {
-   if (on)
-   PWER |= PWER_RTC;
-   else
-   PWER &= ~PWER_RTC;
-   return 0;
-   }
-   return -EINVAL;
+   return sa11x0_sc_set_wake(d->hwirq, on);
 }
 
 static struct irq_chip sa1100_normal_chip = {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-15 Thread Dmitry Eremin-Solenikov
PWER settings logically belongs neither to GPIO nor to system IRQ code.
Add special functions to handle PWER (for GPIO and for system IRQs)
from platform code.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/generic.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 40e0d86..022e451 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -416,3 +416,24 @@ void sa1110_mb_enable(void)
local_irq_restore(flags);
 }
 
+int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
+{
+   if (on)
+   PWER |= BIT(gpio);
+   else
+   PWER &= ~BIT(gpio);
+
+   return 0;
+}
+
+int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)
+{
+   if (BIT(irq) != IC_RTCAlrm)
+   return -EINVAL;
+
+   if (on)
+   PWER |= PWER_RTC;
+   else
+   PWER &= ~PWER_RTC;
+   return 0;
+}
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND V2 1/2] power: gpio-charger: balance enable/disable_irq_wake calls

2015-01-14 Thread Dmitry Eremin-Solenikov
enable_irq_wakeup returns 0 in case it correctly enabled the IRQ to
generate the wakeup event (and thus resume should call disable_irq_wake).
Currently gpio-charger driver has this logic inverted. Correct that thus
correcting enable/disable_irq_wake() calls balance.

Cc: sta...@vger.kernel.org
Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/power/gpio-charger.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
index 7536933..e5deb11 100644
--- a/drivers/power/gpio-charger.c
+++ b/drivers/power/gpio-charger.c
@@ -168,7 +168,7 @@ static int gpio_charger_suspend(struct device *dev)
 
if (device_may_wakeup(dev))
gpio_charger->wakeup_enabled =
-   enable_irq_wake(gpio_charger->irq);
+   !enable_irq_wake(gpio_charger->irq);
 
return 0;
 }
@@ -178,7 +178,7 @@ static int gpio_charger_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);
 
-   if (gpio_charger->wakeup_enabled)
+   if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled)
disable_irq_wake(gpio_charger->irq);
power_supply_changed(&gpio_charger->charger);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND V2 2/2] power: collie_battery: support generating wakeup event

2015-01-14 Thread Dmitry Eremin-Solenikov
Teach collie_battery driver to communicate to the kernel that it can
generate wakeup events. Handle enabling/disabling wakeup on battery full
event in suspend/resume callbacks.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/power/collie_battery.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/power/collie_battery.c b/drivers/power/collie_battery.c
index d02ae02..594e4db 100644
--- a/drivers/power/collie_battery.c
+++ b/drivers/power/collie_battery.c
@@ -26,6 +26,7 @@
 static DEFINE_MUTEX(bat_lock); /* protects gpio pins */
 static struct work_struct bat_work;
 static struct ucb1x00 *ucb;
+static int wakeup_enabled;
 
 struct collie_bat {
int status;
@@ -291,11 +292,21 @@ static int collie_bat_suspend(struct ucb1x00_dev *dev)
 {
/* flush all pending status updates */
flush_work(&bat_work);
+
+   if (device_may_wakeup(&dev->ucb->dev) &&
+   collie_bat_main.status == POWER_SUPPLY_STATUS_CHARGING)
+   wakeup_enabled = !enable_irq_wake(gpio_to_irq(COLLIE_GPIO_CO));
+   else
+   wakeup_enabled = 0;
+
return 0;
 }
 
 static int collie_bat_resume(struct ucb1x00_dev *dev)
 {
+   if (wakeup_enabled)
+   disable_irq_wake(gpio_to_irq(COLLIE_GPIO_CO));
+
/* things may have changed while we were away */
schedule_work(&bat_work);
return 0;
@@ -334,10 +345,15 @@ static int collie_bat_probe(struct ucb1x00_dev *dev)
collie_bat_gpio_isr,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"main full", &collie_bat_main);
-   if (!ret) {
-   schedule_work(&bat_work);
-   return 0;
-   }
+   if (ret)
+   goto err_irq;
+
+   device_init_wakeup(&ucb->dev, 1);
+   schedule_work(&bat_work);
+
+   return 0;
+
+err_irq:
power_supply_unregister(&collie_bat_bu.psy);
 err_psy_reg_bu:
power_supply_unregister(&collie_bat_main.psy);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND] pxa_timer: fix session missmatch warning

2015-01-14 Thread Dmitry Eremin-Solenikov
Fix the following warning:

WARNING: drivers/clocksource/built-in.o(.text.unlikely+0x70): Section mismatch 
in reference from the function pxa_timer_common_init() to the function 
.init.text:clocksource_mmio_init()
The function pxa_timer_common_init() references
the function __init clocksource_mmio_init().
This is often because pxa_timer_common_init lacks a __init
annotation or the annotation of clocksource_mmio_init is wrong.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/clocksource/pxa_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/pxa_timer.c b/drivers/clocksource/pxa_timer.c
index 941f3f3..d9438af 100644
--- a/drivers/clocksource/pxa_timer.c
+++ b/drivers/clocksource/pxa_timer.c
@@ -163,7 +163,7 @@ static struct irqaction pxa_ost0_irq = {
.dev_id = &ckevt_pxa_osmr0,
 };
 
-static void pxa_timer_common_init(int irq, unsigned long clock_tick_rate)
+static void __init pxa_timer_common_init(int irq, unsigned long 
clock_tick_rate)
 {
timer_writel(0, OIER);
timer_writel(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pxa_timer: fix session missmatch warning

2014-12-17 Thread Dmitry Eremin-Solenikov
Fix the following warning:

WARNING: drivers/clocksource/built-in.o(.text.unlikely+0x70): Section mismatch 
in reference from the function pxa_timer_common_init() to the function 
.init.text:clocksource_mmio_init()
The function pxa_timer_common_init() references
the function __init clocksource_mmio_init().
This is often because pxa_timer_common_init lacks a __init
annotation or the annotation of clocksource_mmio_init is wrong.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/clocksource/pxa_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/pxa_timer.c b/drivers/clocksource/pxa_timer.c
index 941f3f3..d9438af 100644
--- a/drivers/clocksource/pxa_timer.c
+++ b/drivers/clocksource/pxa_timer.c
@@ -163,7 +163,7 @@ static struct irqaction pxa_ost0_irq = {
.dev_id = &ckevt_pxa_osmr0,
 };
 
-static void pxa_timer_common_init(int irq, unsigned long clock_tick_rate)
+static void __init pxa_timer_common_init(int irq, unsigned long 
clock_tick_rate)
 {
timer_writel(0, OIER);
timer_writel(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: pxa: lubbock: use new cottula driver

2014-12-14 Thread Dmitry Eremin-Solenikov
On Mon, 15 Dec 2014 00:12:18 +0100, Robert Jarzmik wrote:

> As the interrupt handling was transferred to the cottula driver, make
> the switch in lubbock platform code.

As the pxa25x itself is named Cotulla, the 'cottula' doesn't look like
a good name for FPGA irq driver.

> 
> Signed-off-by: Robert Jarzmik 

-- 
With best wishes
Dmitry


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: pxa: fix lubbock interrupts handling

2014-11-27 Thread Dmitry Eremin-Solenikov
On Thu, 27 Nov 2014 19:42:01 +0100, Robert Jarzmik wrote:
> When gpio-pxa was moved to drivers/pxa, it became a driver, and its
> initialization and probing happen at postcore initcall. The lubbock code
> used to install the chained lubbock interrupt handler at init_irq()
> time.
> 
> The consequence of the gpio-pxa change is that the installed chained irq
> handler lubbock_irq_handler() was overwritten in pxa_gpio_probe(_dt)(),
> removing :
>  - the handler - the falling edge detection setting of GPIO0, which
>  revealed the
>interrupt request from the lubbock IO board.
> 
> As a fix, move the gpio0 chained handler setup to a place where we have
> the guarantee that pxa_gpio_probe() was called before, so that lubbock
> handler becomes the true IRQ chained handler of GPIO0, demuxing the
> lubbock IO board interrupts.
> 
> Signed-off-by: Robert Jarzmik 
> ---
> For Thomas: as a side note, I'm not very happy with this patch. What
> makes me unhappy is that I don't know how to express the
> dependency between gpio-pxa probe time and
> irq_set_chained_handler(irq, lubbock_irq_handler).
> 
> At the moment I rely on the fact that
> lubbock_irq_device_init() is called as device initcall while
> pxa_gpio_probe() is called as postcore initcall.
> 
> If you have a better idea I'm all ears.

What about just making a lubbock CPLD a special separate device?
Then it will have normal probe callback and a possibility to return
-EPROBE_DEFER? If only syscon (drivers/mfd/syscon.c) could support
irq generation, it would fit ideally.

-- 
With best wishes
Dmitry

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] mfd: t7l66xb: prepare/unprepare clocks

2014-11-15 Thread Dmitry Eremin-Solenikov
Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unrepapre().

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/mfd/t7l66xb.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 9e04a74..439d905 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -87,7 +87,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
unsigned long flags;
u8 dev_ctl;
 
-   clk_enable(t7l66xb->clk32k);
+   clk_prepare_enable(t7l66xb->clk32k);
 
spin_lock_irqsave(&t7l66xb->lock, flags);
 
@@ -118,7 +118,7 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
 
spin_unlock_irqrestore(&t7l66xb->lock, flags);
 
-   clk_disable(t7l66xb->clk32k);
+   clk_disable_unprepare(t7l66xb->clk32k);
 
return 0;
 }
@@ -285,7 +285,7 @@ static int t7l66xb_suspend(struct platform_device *dev, 
pm_message_t state)
 
if (pdata && pdata->suspend)
pdata->suspend(dev);
-   clk_disable(t7l66xb->clk48m);
+   clk_disable_unprepare(t7l66xb->clk48m);
 
return 0;
 }
@@ -295,7 +295,7 @@ static int t7l66xb_resume(struct platform_device *dev)
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
struct t7l66xb_platform_data *pdata = dev_get_platdata(&dev->dev);
 
-   clk_enable(t7l66xb->clk48m);
+   clk_prepare_enable(t7l66xb->clk48m);
if (pdata && pdata->resume)
pdata->resume(dev);
 
@@ -369,7 +369,7 @@ static int t7l66xb_probe(struct platform_device *dev)
goto err_ioremap;
}
 
-   clk_enable(t7l66xb->clk48m);
+   clk_prepare_enable(t7l66xb->clk48m);
 
if (pdata && pdata->enable)
pdata->enable(dev);
@@ -414,9 +414,9 @@ static int t7l66xb_remove(struct platform_device *dev)
int ret;
 
ret = pdata->disable(dev);
-   clk_disable(t7l66xb->clk48m);
+   clk_disable_unprepare(t7l66xb->clk48m);
clk_put(t7l66xb->clk48m);
-   clk_disable(t7l66xb->clk32k);
+   clk_disable_unprepare(t7l66xb->clk32k);
clk_put(t7l66xb->clk32k);
t7l66xb_detach_irq(dev);
iounmap(t7l66xb->scr);
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] mfd: tc6387xb: prepare/unprepare clocks

2014-11-15 Thread Dmitry Eremin-Solenikov
Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unrepapre().

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/mfd/tc6387xb.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index e71f880..85fab37 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -52,7 +52,7 @@ static int tc6387xb_suspend(struct platform_device *dev, 
pm_message_t state)
 
if (pdata && pdata->suspend)
pdata->suspend(dev);
-   clk_disable(tc6387xb->clk32k);
+   clk_disable_unprepare(tc6387xb->clk32k);
 
return 0;
 }
@@ -62,7 +62,7 @@ static int tc6387xb_resume(struct platform_device *dev)
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
struct tc6387xb_platform_data *pdata = dev_get_platdata(&dev->dev);
 
-   clk_enable(tc6387xb->clk32k);
+   clk_prepare_enable(tc6387xb->clk32k);
if (pdata && pdata->resume)
pdata->resume(dev);
 
@@ -100,7 +100,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
struct platform_device *dev  = to_platform_device(mmc->dev.parent);
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 
-   clk_enable(tc6387xb->clk32k);
+   clk_prepare_enable(tc6387xb->clk32k);
 
tmio_core_mmc_enable(tc6387xb->scr + 0x200, 0,
tc6387xb_mmc_resources[0].start & 0xfffe);
@@ -113,7 +113,7 @@ static int tc6387xb_mmc_disable(struct platform_device *mmc)
struct platform_device *dev  = to_platform_device(mmc->dev.parent);
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 
-   clk_disable(tc6387xb->clk32k);
+   clk_disable_unprepare(tc6387xb->clk32k);
 
return 0;
 }
@@ -214,7 +214,7 @@ static int tc6387xb_remove(struct platform_device *dev)
mfd_remove_devices(&dev->dev);
iounmap(tc6387xb->scr);
release_resource(&tc6387xb->rscr);
-   clk_disable(tc6387xb->clk32k);
+   clk_disable_unprepare(tc6387xb->clk32k);
clk_put(tc6387xb->clk32k);
kfree(tc6387xb);
 
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] genirq: Add IRQ 0 to domain debug file

2014-11-15 Thread Dmitry Eremin-Solenikov
Hello,

2014-11-15 16:01 GMT+03:00 Jiang Liu :
> On 2014/11/15 19:27, Dmitry Eremin-Solenikov wrote:
>> Currently irq_domain_mapping debugfs file dumps IRQ information starting
>> from IRQ 1. IRQ 0 is missing from that file. Add it to have the complete
>> picture of IRQ/domains mappings.
> Hi Dmitry,
> For most irqdomain interfaces, they treat irq0 as invalid
> interrupt. But on x86, it's possible to use irq0 for timer. It causes
> may confusion when enabling irqdomain for x86.

I encountered with this issue when enabling IRQ domains support for
one of ARM sub-architectures.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] genirq: Add IRQ 0 to domain debug file

2014-11-15 Thread Dmitry Eremin-Solenikov
Currently irq_domain_mapping debugfs file dumps IRQ information starting
from IRQ 1. IRQ 0 is missing from that file. Add it to have the complete
picture of IRQ/domains mappings.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 6534ff6..0e0c7a8 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -585,7 +585,7 @@ static int virq_debug_show(struct seq_file *m, void 
*private)
  "chip name", (int)(2 * sizeof(void *) + 2), "chip data",
  "active", "type", "domain");
 
-   for (i = 1; i < nr_irqs; i++) {
+   for (i = 0; i < nr_irqs; i++) {
desc = irq_to_desc(i);
if (!desc)
continue;
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] power: reset: augment versatile driver for integrator

2014-11-12 Thread Dmitry Eremin-Solenikov
2014-11-12 17:54 GMT+03:00 Linus Walleij :
> On Tue, Nov 4, 2014 at 12:31 PM, Linus Walleij  
> wrote:
>
>> Augment the Versatile reset driver to also handle the core
>> module reset sequence used on the Integrator/AP and
>> Integrator/CP.
>>
>> Cc: Dmitry Eremin-Solenikov 
>> Cc: David Woodhouse 
>> Cc: Sebastian Reichel 
>> Signed-off-by: Linus Walleij 
>> ---
>> Sebastian: please merge this into your power tree if you're
>> OK with it, the corresponding platform changes are orthogonal
>> so these can go separately through the ARM SoC tree.
>
> Power folks: ping on this patch.

I will apply tomorrow, if Sebastian does not respond earlier.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: tc6393xb: prepare/unprepare clocks

2014-11-10 Thread Dmitry Eremin-Solenikov
2014-11-10 16:53 GMT+03:00 Lee Jones :
> On Thu, 06 Nov 2014, Lee Jones wrote:
>
>> On Thu, 06 Nov 2014, Dmitry Eremin-Solenikov wrote:
>>
>> > Change clk_enable/disable() calls to clk_prepare_enable() and
>> > clk_disable_unrepapre().
>> >
>> > Signed-off-by: Dmitry Eremin-Solenikov 
>> > ---
>> >  drivers/mfd/tc6393xb.c | 10 +-
>> >  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> Applied, thanks.
>
> OOI, what kernel version was this patch based on?

v3.18-rc something. It is not required for previous kernel versions,
since machines with
these chips (PXA-based) do not use COMMON_CLK (and thus do not trigger
a warning).
Robert Jarzmik started converting pxa to common clocks framework and
thus I spotted
the warning.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1 0/3] Transition pxa25x clock to common clocks

2014-11-09 Thread Dmitry Eremin-Solenikov
2014-11-09 0:01 GMT+03:00 Robert Jarzmik :
> Dmitry Eremin-Solenikov  writes:
>
>> 2014-11-08 20:26 GMT+03:00 Robert Jarzmik :
>>> Dmitry Eremin-Solenikov  writes:
>>>
>>>> Hello,
>>>> Tested in qemu (pxa25x target).
>>>>
>>>> 2) sa1100-rtc could not find a clock and thus failed to be probed.
>>>> 4) Got an issue with IrDA driver - it gets -ENODEV for UARTCLK clock
>>>
>>> Hi Dmitry,
>>>
>>> Would you mind retesting with the patch in [1] applied to see if points 2 
>>> and 4
>>> are fixed ? Alternatively you can refetch from the github tree, I included 
>>> that
>>> incremental patch there too.
>>>
>>> If it works correctly for you, could I have your Tested-by ? If not, tell 
>>> me and
>>> I'll try to figure out what's wrong.
>>
>> Tested in qemu, everything works fine. I will test on the real hardware
>> tomorow.
> Aha, the test.
> Would you at that time do a "cat /sys/kernel/debug/clk/clk_summary" and send 
> it
> to me please ?

Tested-by: Dmitry Eremin-Solenikov 

Captured on tosa (pxa255):

   clock enable_cnt  prepare_cntrate
accuracy   phase

 clk_dummy00   0
   0 0
 osc_32_768khz3332768000
   0 0
OSTIMER0  1132768000
   0 0
sa1100-rtc1132768000
   0 0
GPIO12_CLK0032768000
   0 0
pxa26x-gpio   0032768000
   0 0
pxa25x-gpio   1132768000
   0 0
 osc_3_6864mhz33 3686400
   0 0
PWM1  00 3686400
   0 0
PWM0  00 3686400
   0 0
ASSP  00 3686400
   0 0
NSSP  00 3686400
   0 0
SSP   00 3686400
   0 0
GPIO11_CLK11 3686400
   0 0
cpll  00   398131200
   0 0
   core   00   398131200
   0 0
   run00   199065600
   0 0
  MEMC00   199065600
   0 0
  LCD 00   199065600
   0 0
  memory  0099532800
   0 0
ppll_147_46mhz24   147456000
   0 0
   AC97   1112288000
   0 0
   I2S00   147456000
   0 0
   HWUART 0014745600
   0 0
   STUART 0114745600
   0 0
  pxa2xx-ir   0014745600
   0 0
   BTUART 0114745600
   0 0
   FFUART 1214745600
   0 0
ppll_95_85mhz 1195846400
   0 0
   USB0047923200
   0 0
   FICP   0047923200
   0 0
   I2C1131948800
   0 0
   MMC0019169280
   0 0


>> BTW: It looks like pxa27x also shows the same behaviour wrt. sa1100-rtc and
>> pxa2xx-ir (after reverting a revert).
> Ah yes, you're very right about that.
>
> Same as before, github updated and patch included in this mail.

Could you please also include a revert of
23c4a3a5212701ad34bd30591fa33d7bacef9c5f
into your branch? Otherwise pxa27x is broken in your tree.

>
> Cheers.
>
> --
> Robert
>



-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1 0/3] Transition pxa25x clock to common clocks

2014-11-08 Thread Dmitry Eremin-Solenikov
2014-11-08 20:26 GMT+03:00 Robert Jarzmik :
> Dmitry Eremin-Solenikov  writes:
>
>> Hello,
>> Tested in qemu (pxa25x target).
>>
>> 2) sa1100-rtc could not find a clock and thus failed to be probed.
>> 4) Got an issue with IrDA driver - it gets -ENODEV for UARTCLK clock
>
> Hi Dmitry,
>
> Would you mind retesting with the patch in [1] applied to see if points 2 and 
> 4
> are fixed ? Alternatively you can refetch from the github tree, I included 
> that
> incremental patch there too.
>
> If it works correctly for you, could I have your Tested-by ? If not, tell me 
> and
> I'll try to figure out what's wrong.

Tested in qemu, everything works fine. I will test on the real hardware tomorow.

BTW: It looks like pxa27x also shows the same behaviour wrt. sa1100-rtc and
pxa2xx-ir (after reverting a revert).

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Fix entering suspend-to-IDLE if no freeze_oops is set

2014-11-08 Thread Dmitry Eremin-Solenikov
If no freeze_ops is set, trying to enter suspend-to-IDLE will cause a
nice oops in platform_suspend_prepare_late(). Add respective checks to
platform_suspend_prepare_late() and platform_resume_early() functions.

Fixes: a8d46b9e (ACPI / sleep: Rework the handling of ACPI GPE wakeup ...)
Signed-off-by: Dmitry Eremin-Solenikov 
---
 kernel/power/suspend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 4ca9a33..c347e3c 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -146,7 +146,7 @@ static int platform_suspend_prepare(suspend_state_t state)
 
 static int platform_suspend_prepare_late(suspend_state_t state)
 {
-   return state == PM_SUSPEND_FREEZE && freeze_ops->prepare ?
+   return state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->prepare ?
freeze_ops->prepare() : 0;
 }
 
@@ -164,7 +164,7 @@ static void platform_resume_noirq(suspend_state_t state)
 
 static void platform_resume_early(suspend_state_t state)
 {
-   if (state == PM_SUSPEND_FREEZE && freeze_ops->restore)
+   if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->restore)
freeze_ops->restore();
 }
 
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: tc6393xb: prepare/unprepare clocks

2014-11-06 Thread Dmitry Eremin-Solenikov
Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unrepapre().

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/mfd/tc6393xb.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 48579e5..abcb4eb 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -665,7 +665,7 @@ static int tc6393xb_probe(struct platform_device *dev)
goto err_ioremap;
}
 
-   ret = clk_enable(tc6393xb->clk);
+   ret = clk_prepare_enable(tc6393xb->clk);
if (ret)
goto err_clk_enable;
 
@@ -728,7 +728,7 @@ err_gpio_add:
temp = gpiochip_remove(&tc6393xb->gpio);
tcpd->disable(dev);
 err_enable:
-   clk_disable(tc6393xb->clk);
+   clk_disable_unprepare(tc6393xb->clk);
 err_clk_enable:
iounmap(tc6393xb->scr);
 err_ioremap:
@@ -764,7 +764,7 @@ static int tc6393xb_remove(struct platform_device *dev)
}
 
ret = tcpd->disable(dev);
-   clk_disable(tc6393xb->clk);
+   clk_disable_unprepare(tc6393xb->clk);
iounmap(tc6393xb->scr);
release_resource(&tc6393xb->rscr);
clk_put(tc6393xb->clk);
@@ -792,7 +792,7 @@ static int tc6393xb_suspend(struct platform_device *dev, 
pm_message_t state)
ioread8(tc6393xb->scr + SCR_GPI_BCR(i));
}
ret = tcpd->suspend(dev);
-   clk_disable(tc6393xb->clk);
+   clk_disable_unprepare(tc6393xb->clk);
 
return ret;
 }
@@ -804,7 +804,7 @@ static int tc6393xb_resume(struct platform_device *dev)
int ret;
int i;
 
-   clk_enable(tc6393xb->clk);
+   clk_prepare_enable(tc6393xb->clk);
 
ret = tcpd->resume(dev);
if (ret)
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1 0/3] Transition pxa25x clock to common clocks

2014-11-06 Thread Dmitry Eremin-Solenikov
Hello,

2014-11-02 18:16 GMT+03:00 Robert Jarzmik :
> Hello pxa25x board maintainers,
>
> This patchset will move the clock code out of pxa subarchitecture into the
> common clock framework. As this change can bring a lot of regression, I'd like
> to test it on your boards.
>
> I prepared for you a git tree based on v3.18-rc :
>  - git fetch https://github.com:rjarzmik/linux.git work/clocks-pxa:try
>  - git checkout try
>
>  - it contains all the common clock fixes for pxa and this pathset
>  - it builds and runs on lubbock (thanks Russell for the board)
>  - make your defconfig, kernel, boot
>  - test
>- if it does run normally, tell me
>- if it doesn't boot, retry once with the kernel command line argument 
> "clk_ignore_unused" and tell me if it fixed or not the problem
>- be aware of the GPIO11 clock change
>  => this is especially true for Ian as my change doesn't look good
>
> If you could give me feedback if it works for you there will be less breakage.
>
> And if you want to give a review, even better.

Tested in qemu (pxa25x target).

0) Had to revert 23c4a3a5212701ad34bd30591fa33d7bacef9c5f to get kernel
to build for pxa25x + pxa27x.

1) I got the following backtrace early in the boot:

Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper Not tainted 3.18.0-rc2-00011-g7805b78 #97
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (Ldiv0+0x8/0x10)
[] (Ldiv0) from [] (clk_pxa25x_memory_get_rate+0x28/0x30)
[] (clk_pxa25x_memory_get_rate) from []
(clk_composite_recalc_rate+0x20/0x24)
[] (clk_composite_recalc_rate) from []
(__clk_init+0x1d0/0x4e8)
[] (__clk_init) from [] (clk_register+0x100/0x1c4)
[] (clk_register) from []
(clk_register_composite+0x17c/0x250)
[] (clk_register_composite) from []
(pxa25x_clocks_init+0x194/0x240)
[] (pxa25x_clocks_init) from [] (pxa_timer_init+0x18/0x64)
[] (pxa_timer_init) from [] (time_init+0x1c/0x2c)
[] (time_init) from [] (start_kernel+0x268/0x3e8)
[] (start_kernel) from [] (0xa0008040)

It might be due to something being not emulated properly, but I'd
suggest to add a check
anyway.

2) sa1100-rtc could not find a clock and thus failed to be probed.

3) Had to patch tc6393xb driver to call
clk_prepare_enable/clk_disable_unprepare -
  will submit a patch shortly.

4) Got an issue with IrDA driver - it gets -ENODEV for UARTCLK clock

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] clocksource: enable pxa_timer for SA-1100 platform

2014-11-05 Thread Dmitry Eremin-Solenikov
Hello,

2014-10-20 23:07 GMT+04:00 Arnd Bergmann :
> On Wednesday 15 October 2014 16:50:04 Dmitry Eremin-Solenikov wrote:
>> SA-11x0 platform used the same IP block as was used on PXA. Consequently
>> it makes sense to have only one driver. Enable pxa_timer clocksource for
>> StrongARM platform.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>
> Both patches look good to me.
>
> Acked-by: Arnd Bergmann 
>
> Should we merge them through arm-soc or through the clocksource tree?


Thomas added his blessing (and an ack) to merge these patches through arm-soc.
Should I gather any additional Acks before it cn hit arm-soc/for-next?

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: tc6393xb fail ohci suspend if full state restore is required

2014-11-04 Thread Dmitry Eremin-Solenikov
Hello.

2014-11-03 17:56 GMT+03:00 Lee Jones :
> On Fri, 24 Oct 2014, Dmitry Eremin-Solenikov wrote:
>
>> Some boards with TC6393XB chip require full state restore during system
>> resume thanks to chip's VCC being cut off during suspend (Sharp SL-6000
>> tosa is one of them). Failing to do so would result in ohci Oops on
>> resume due to internal memory contentes being changed. Fail ohci suspend
>> on tc6393xb is full state restore is required.
>>
>> Recommended workaround is to unbind tmio-ohci driver before suspend and
>> rebind it after resume.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>> Cc: sta...@vger.kernel.org
>> ---
>>  drivers/mfd/tc6393xb.c | 13 -
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
>> index 11c19e5..48579e5 100644
>> --- a/drivers/mfd/tc6393xb.c
>> +++ b/drivers/mfd/tc6393xb.c
>> @@ -263,6 +263,17 @@ static int tc6393xb_ohci_disable(struct platform_device 
>> *dev)
>>   return 0;
>>  }
>>
>> +static int tc6393xb_ohci_suspend(struct platform_device *dev)
>> +{
>> + struct tc6393xb_platform_data *tcpd = 
>> dev_get_platdata(dev->dev.parent);
>> +
>> + /* We can't properly store/restore OHCI state, so fail here */
>> + if (tcpd->resume_restore)
>> + return -EBUSY;
>
> Wouldn't it be easier to just put these three lines into
> tc6393xb_ohci_disable() instead off adding 7 superfluous lines and
> making the Ops names inconsistent?

No. The problem only exists on suspend/resume path. tc6393xb_ohci_disable
is also used on driver removal and can (should?) be used on device shutdown.
Using the tc6393xb_ohci_disable() function in that paths is not a problem.

Also with this patch the Oops name will not be inconsistent - returning -EBUSY
from this disable callback will cancel the device suspension with
clearly stating
that OHCI is busy in dmesg.

>
>
>> + return tc6393xb_ohci_disable(dev);
>> +}
>> +
>>  static int tc6393xb_fb_enable(struct platform_device *dev)
>>  {
>>   struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
>> @@ -403,7 +414,7 @@ static struct mfd_cell tc6393xb_cells[] = {
>>   .num_resources = ARRAY_SIZE(tc6393xb_ohci_resources),
>>   .resources = tc6393xb_ohci_resources,
>>   .enable = tc6393xb_ohci_enable,
>> - .suspend = tc6393xb_ohci_disable,
>> + .suspend = tc6393xb_ohci_suspend,
>>   .resume = tc6393xb_ohci_enable,
>>   .disable = tc6393xb_ohci_disable,
>>   },


-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: tc6393xb fail ohci suspend if full state restore is required

2014-10-29 Thread Dmitry Eremin-Solenikov
2014-10-24 20:19 GMT+03:00 Dmitry Eremin-Solenikov :
> Some boards with TC6393XB chip require full state restore during system
> resume thanks to chip's VCC being cut off during suspend (Sharp SL-6000
> tosa is one of them). Failing to do so would result in ohci Oops on
> resume due to internal memory contentes being changed. Fail ohci suspend
> on tc6393xb is full state restore is required.
>
> Recommended workaround is to unbind tmio-ohci driver before suspend and
> rebind it after resume.

ping

>
> Signed-off-by: Dmitry Eremin-Solenikov 
> Cc: sta...@vger.kernel.org
> ---
>  drivers/mfd/tc6393xb.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)



-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: tc6393xb fail ohci suspend if full state restore is required

2014-10-24 Thread Dmitry Eremin-Solenikov
Some boards with TC6393XB chip require full state restore during system
resume thanks to chip's VCC being cut off during suspend (Sharp SL-6000
tosa is one of them). Failing to do so would result in ohci Oops on
resume due to internal memory contentes being changed. Fail ohci suspend
on tc6393xb is full state restore is required.

Recommended workaround is to unbind tmio-ohci driver before suspend and
rebind it after resume.

Signed-off-by: Dmitry Eremin-Solenikov 
Cc: sta...@vger.kernel.org
---
 drivers/mfd/tc6393xb.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 11c19e5..48579e5 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -263,6 +263,17 @@ static int tc6393xb_ohci_disable(struct platform_device 
*dev)
return 0;
 }
 
+static int tc6393xb_ohci_suspend(struct platform_device *dev)
+{
+   struct tc6393xb_platform_data *tcpd = dev_get_platdata(dev->dev.parent);
+
+   /* We can't properly store/restore OHCI state, so fail here */
+   if (tcpd->resume_restore)
+   return -EBUSY;
+
+   return tc6393xb_ohci_disable(dev);
+}
+
 static int tc6393xb_fb_enable(struct platform_device *dev)
 {
struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
@@ -403,7 +414,7 @@ static struct mfd_cell tc6393xb_cells[] = {
.num_resources = ARRAY_SIZE(tc6393xb_ohci_resources),
.resources = tc6393xb_ohci_resources,
.enable = tc6393xb_ohci_enable,
-   .suspend = tc6393xb_ohci_disable,
+   .suspend = tc6393xb_ohci_suspend,
.resume = tc6393xb_ohci_enable,
.disable = tc6393xb_ohci_disable,
},
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] clocksource: enable pxa_timer for SA-1100 platform

2014-10-23 Thread Dmitry Eremin-Solenikov
2014-10-20 23:07 GMT+04:00 Arnd Bergmann :
> On Wednesday 15 October 2014 16:50:04 Dmitry Eremin-Solenikov wrote:
>> SA-11x0 platform used the same IP block as was used on PXA. Consequently
>> it makes sense to have only one driver. Enable pxa_timer clocksource for
>> StrongARM platform.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>
> Both patches look good to me.
>
> Acked-by: Arnd Bergmann 
>
> Should we merge them through arm-soc or through the clocksource tree?

I'm fine with any of the approaches. Russell, Daniel, Thomas - any preferences?

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2] ARM: debug: move StrongARM debug include to arch/arm/include/debug

2014-10-20 Thread Dmitry Eremin-Solenikov
StrongARM debug-macro.S is quite standalone thing, depending only on
register mappings. Move it to proper place and add Kconfig entry.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/Kconfig.debug |  9 +
 .../include/mach/debug-macro.S => include/debug/sa1100.S}  | 10 --
 2 files changed, 17 insertions(+), 2 deletions(-)
 rename arch/arm/{mach-sa1100/include/mach/debug-macro.S => 
include/debug/sa1100.S} (83%)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index b11ad54..9a3bff0 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -699,6 +699,14 @@ choice
  their output to UART 2. The port must have been initialised
  by the boot-loader before use.
 
+   config DEBUG_SA1100
+   depends on ARCH_SA1100
+   bool "Use SA1100 UARTs for low-level debug"
+   help
+ Say Y here if you want kernel low-level debugging support
+ on SA-11x0 UART ports. The kernel will check for the first
+ enabled UART in a sequence 3-1-2.
+
config DEBUG_SOCFPGA_UART
depends on ARCH_SOCFPGA
bool "Use SOCFPGA UART for low-level debug"
@@ -1009,6 +1017,7 @@ config DEBUG_STI_UART
 
 config DEBUG_LL_INCLUDE
string
+   default "debug/sa1100.S" if DEBUG_SA1100
default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || 
DEBUG_CLPS711X_UART2
default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
diff --git a/arch/arm/mach-sa1100/include/mach/debug-macro.S 
b/arch/arm/include/debug/sa1100.S
similarity index 83%
rename from arch/arm/mach-sa1100/include/mach/debug-macro.S
rename to arch/arm/include/debug/sa1100.S
index 530772d..a0ae4f4 100644
--- a/arch/arm/mach-sa1100/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/sa1100.S
@@ -1,4 +1,4 @@
-/* arch/arm/mach-sa1100/include/mach/debug-macro.S
+/* arch/arm/include/debug/sa1100.S
  *
  * Debugging macro include header
  *
@@ -10,7 +10,13 @@
  * published by the Free Software Foundation.
  *
 */
-#include 
+
+#define UTCR3  0x0c
+#define UTDR   0x14
+#define UTSR1  0x20
+#define UTCR3_TXE  0x0002  /* Transmit Enable */
+#define UTSR1_TBY  0x0001  /* Transmitter BusY (read) */
+#define UTSR1_TNF  0x0004  /* Transmit FIFO Not Full (read)   */
 
.macro  addruart, rp, rv, tmp
mrc p15, 0, \rp, c1, c0
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] clocksource: enable pxa_timer for SA-1100 platform

2014-10-15 Thread Dmitry Eremin-Solenikov
SA-11x0 platform used the same IP block as was used on PXA. Consequently
it makes sense to have only one driver. Enable pxa_timer clocksource for
StrongARM platform.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/clocksource/Kconfig  | 6 ++
 drivers/clocksource/Makefile | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index cfd6519..fd99b08 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -216,4 +216,10 @@ config CLKSRC_VERSATILE
  ARM Versatile, RealView and Versatile Express reference
  platforms.
 
+config CLKSRC_PXA
+   def_bool y if ARCH_PXA || ARCH_SA1100
+   help
+ This enables OST0 support available on PXA and SA-11x0
+ platforms.
+
 endmenu
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 7fd9fd1..6d9822e 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_ARCH_CLPS711X)   += clps711x-timer.o
 obj-$(CONFIG_ARCH_MARCO)   += timer-marco.o
 obj-$(CONFIG_ARCH_MOXART)  += moxart_timer.o
 obj-$(CONFIG_ARCH_MXS) += mxs_timer.o
-obj-$(CONFIG_ARCH_PXA) += pxa_timer.o
+obj-$(CONFIG_CLKSRC_PXA)   += pxa_timer.o
 obj-$(CONFIG_ARCH_PRIMA2)  += timer-prima2.o
 obj-$(CONFIG_ARCH_U300)+= timer-u300.o
 obj-$(CONFIG_SUN4I_TIMER)  += sun4i_timer.o
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] ARM: sa1100: use pxa_timer clocksource driver

2014-10-15 Thread Dmitry Eremin-Solenikov
Use pxa_timer clocksource driver.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/Makefile  |   2 +-
 arch/arm/mach-sa1100/generic.c |   6 ++
 arch/arm/mach-sa1100/time.c| 139 -
 3 files changed, 7 insertions(+), 140 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/time.c

diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 2732eef..8eb9a6f 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := clock.o generic.o irq.o time.o #nmi-oopser.o
+obj-y := clock.o generic.o irq.o #nmi-oopser.o
 obj-m :=
 obj-n :=
 obj-  :=
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index d4ea142..40e0d86 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -33,6 +33,7 @@
 #include 
 
 #include "generic.h"
+#include 
 
 unsigned int reset_status;
 EXPORT_SYMBOL(reset_status);
@@ -369,6 +370,11 @@ void __init sa1100_map_io(void)
iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
 }
 
+void __init sa1100_timer_init(void)
+{
+   pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x9000), 3686400);
+}
+
 /*
  * Disable the memory bus request/grant signals on the SA1110 to
  * ensure that we don't receive spurious memory requests.  We set
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
deleted file mode 100644
index 1dea6cf..000
--- a/arch/arm/mach-sa1100/time.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * linux/arch/arm/mach-sa1100/time.c
- *
- * Copyright (C) 1998 Deborah Wallach.
- * Twiddles  (C) 1999 Hugo Fiennes 
- *
- * 2000/03/29 (C) Nicolas Pitre 
- * Rewritten: big cleanup, much simpler, better HZ accuracy.
- *
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#define SA1100_CLOCK_FREQ 3686400
-#define SA1100_LATCH DIV_ROUND_CLOSEST(SA1100_CLOCK_FREQ, HZ)
-
-static u64 notrace sa1100_read_sched_clock(void)
-{
-   return readl_relaxed(OSCR);
-}
-
-#define MIN_OSCR_DELTA 2
-
-static irqreturn_t sa1100_ost0_interrupt(int irq, void *dev_id)
-{
-   struct clock_event_device *c = dev_id;
-
-   /* Disarm the compare/match, signal the event. */
-   writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER);
-   writel_relaxed(OSSR_M0, OSSR);
-   c->event_handler(c);
-
-   return IRQ_HANDLED;
-}
-
-static int
-sa1100_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c)
-{
-   unsigned long next, oscr;
-
-   writel_relaxed(readl_relaxed(OIER) | OIER_E0, OIER);
-   next = readl_relaxed(OSCR) + delta;
-   writel_relaxed(next, OSMR0);
-   oscr = readl_relaxed(OSCR);
-
-   return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0;
-}
-
-static void
-sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c)
-{
-   switch (mode) {
-   case CLOCK_EVT_MODE_ONESHOT:
-   case CLOCK_EVT_MODE_UNUSED:
-   case CLOCK_EVT_MODE_SHUTDOWN:
-   writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER);
-   writel_relaxed(OSSR_M0, OSSR);
-   break;
-
-   case CLOCK_EVT_MODE_RESUME:
-   case CLOCK_EVT_MODE_PERIODIC:
-   break;
-   }
-}
-
-#ifdef CONFIG_PM
-unsigned long osmr[4], oier;
-
-static void sa1100_timer_suspend(struct clock_event_device *cedev)
-{
-   osmr[0] = readl_relaxed(OSMR0);
-   osmr[1] = readl_relaxed(OSMR1);
-   osmr[2] = readl_relaxed(OSMR2);
-   osmr[3] = readl_relaxed(OSMR3);
-   oier = readl_relaxed(OIER);
-}
-
-static void sa1100_timer_resume(struct clock_event_device *cedev)
-{
-   writel_relaxed(0x0f, OSSR);
-   writel_relaxed(osmr[0], OSMR0);
-   writel_relaxed(osmr[1], OSMR1);
-   writel_relaxed(osmr[2], OSMR2);
-   writel_relaxed(osmr[3], OSMR3);
-   writel_relaxed(oier, OIER);
-
-   /*
-* OSMR0 is the system timer: make sure OSCR is sufficiently behind
-*/
-   writel_relaxed(OSMR0 - SA1100_LATCH, OSCR);
-}
-#else
-#define sa1100_timer_suspend NULL
-#define sa1100_timer_resume NULL
-#endif
-
-static struct clock_event_device ckevt_sa1100_osmr0 = {
-   .name   = "osmr0",
-   .features   = CLOCK_EVT_FEAT_ONESHOT,
-   .rating = 200,
-   .set_next_event = sa1100_osmr0_set_next_event,
-   .set_mode   = sa1100_osmr0_set_mode,
-   .suspend= sa1100_timer_suspend,
-   .resume = sa1100_timer_resume,
-};
-
-static struct irqaction sa1100_timer_irq = {
-   .name   = "ost0",
-   .flags  = IRQF_TIMER | IRQF_IRQPOLL,
-   .handler= sa1100_ost0_interrupt,
-   .dev_id = &ckevt_sa1100_osmr0,
-};
-
-void __init sa1100_timer_init(void)
-{
-   writel_relaxed(0, OIER);
-   write

Re: [PATCH] regulator: core: GPIO #0 is a valid GPIO

2014-09-03 Thread Dmitry Eremin-Solenikov

On 09/01/2014 04:49 PM, Mark Brown wrote:

On Mon, Sep 01, 2014 at 04:35:27PM +0400, Dmitry Eremin-Solenikov wrote:

On 09/01/2014 04:06 PM, Mark Brown wrote:



Please consider my point about making users instantly buggy - it's not
practical to introduce a new field into existing platform data which
needs initialization.  Disallowing the use of 0 as a GPIO seems more
practical here (in that it's something the platform can control with
more reliable coordination).



I think that this makes other users buggy - those, whose platforms use GPIO
numbering starting from 0. IMX platform does. legacy platforms do.


It means that they can't use this feature for these specific GPIOs
unless someone writes some code to make it happen either by renumbering
or by adding generic code that provides a way to specify this, it
doesn't make anything worse than it is already.


Consider NO_IRQ which is still defined to -1 on ARM platforms. If a device
does not have a connected IRQ, it has to explicitly specify -1 instead of
specifying logical default 0. Is it so? What is so different with GPIOs and
regulators?


As I'm getting fed up of pointing out we can't make existing users buggy
- we couldn't do it when we added support for enable GPIOs and we can't
do it now.  Exactly the same problem would occur if adding platform data
to specify an interrupt where none was previously specified (which is
why there's a move away from NO_IRQ being -1).

Please, you need to care about other users.


OK, if the question is about other users, should we review all current 
users that do not specify that gpio, change them to pass -1 and then 
allow valid GPIO#0 as a valid ena_gpio? What do you think about a patch
that will warn for one or two releases that ena_gpio == 0 will change 
meaning in a forthcoming feature?



--
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] regulator: core: GPIO #0 is a valid GPIO

2014-09-01 Thread Dmitry Eremin-Solenikov

On 09/01/2014 04:06 PM, Mark Brown wrote:

On Mon, Sep 01, 2014 at 03:59:34PM +0400, Dmitry Eremin-Solenikov wrote:

On 09/01/2014 02:15 PM, Mark Brown wrote:



There's no practical way to deploy that without breaking users - as soon
as you treat 0 as a valid GPIO you make all existing users relying on
the natural behaviour of treating 0 as default instantly buggy which is
not practical.  Really the GPIO API is badly specified here.



Back in the time before DTS conversion started, the 0 was a correct GPIO
number. If somebody wanted to specify that no gpio is provided, he provided
-1 as an invalid number. I have the feeling that allowing users to use 0 as
'no gpio' is a mistake. Or the API should be changed
to disallow GPIO 0 to exist at all.


Please consider my point about making users instantly buggy - it's not
practical to introduce a new field into existing platform data which
needs initialization.  Disallowing the use of 0 as a GPIO seems more
practical here (in that it's something the platform can control with
more reliable coordination).


I think that this makes other users buggy - those, whose platforms use 
GPIO numbering starting from 0. IMX platform does. legacy platforms do.


Consider NO_IRQ which is still defined to -1 on ARM platforms. If a 
device does not have a connected IRQ, it has to explicitly specify -1 
instead of specifying logical default 0. Is it so? What is so different 
with GPIOs and regulators?


--
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] regulator: core: GPIO #0 is a valid GPIO

2014-09-01 Thread Dmitry Eremin-Solenikov

On 09/01/2014 02:15 PM, Mark Brown wrote:

On Mon, Sep 01, 2014 at 09:46:54AM +0200, Dirk Behme wrote:

I wonder how this fits to



https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/gpio/gpio-legacy.txt



"GPIOs are identified by unsigned integers in the range 0..MAX_INT"



"If you want to initialize a structure with an invalid GPIO number, use
some negative number (perhaps "-EINVAL");"



then?


There's no practical way to deploy that without breaking users - as soon
as you treat 0 as a valid GPIO you make all existing users relying on
the natural behaviour of treating 0 as default instantly buggy which is
not practical.  Really the GPIO API is badly specified here.



Back in the time before DTS conversion started, the 0 was a correct GPIO 
number. If somebody wanted to specify that no gpio is provided, he 
provided -1 as an invalid number. I have the feeling that allowing users 
to use 0 as 'no gpio' is a mistake. Or the API should be changed

to disallow GPIO 0 to exist at all.

--
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] regulator: core: GPIO #0 is a valid GPIO

2014-08-29 Thread Dmitry Eremin-Solenikov
From: Dirk Behme 

With GPIO #0, this if statement will always fail. Remove this, the
check for gpio_is_valid() is sufficent here.

Change-Id: Ia10e8e9c74e11deba852fcd44040cc275b583cfd
Signed-off-by: Gokulkrishnan Nagarajan 
Signed-off-by: Dirk Behme 
---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 117f9f8..2f0794f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3524,7 +3524,7 @@ regulator_register(const struct regulator_desc 
*regulator_desc,
 
dev_set_drvdata(&rdev->dev, rdev);
 
-   if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) {
+   if (gpio_is_valid(config->ena_gpio)) {
ret = regulator_ena_gpio_request(rdev, config);
if (ret != 0) {
rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2] MAINTAINERS: power_supply: update maintainership

2014-07-16 Thread Dmitry Eremin-Solenikov
Hello,

On Wed, Jul 16, 2014 at 10:14 PM, Sebastian Reichel  wrote:
> Take over maintanence for orphaned power supply subsystem
> and assign linux...@vger.kernel.org as mailing list.
>
> Signed-off-by: Sebastian Reichel 
> ---
> Changes since PATCHv1 [0]:
>  * Add linux...@vger.kernel.org as mailing list for
>the power supply subsystem
>  * Do not change the git tree
>(I will get access to the tree on infradead.org)
>  * Do not remove existing maintainers
>(So that they can can take over again when they return)

Acked-by: Dmitry Eremin-Solenikov 

>
> [0] https://lkml.org/lkml/2014/6/14/89


-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Power Supply Subsystem Maintainer

2014-07-12 Thread Dmitry Eremin-Solenikov
Hello,

On Mon, Jul 7, 2014 at 10:20 PM, Andrew Morton
 wrote:
> On Wed, 2 Jul 2014 08:41:19 +0530 Jenny Tc  wrote:
>
>> Andrew Morton,
>>
>> Appreciate your help to sort out the power supply maintainer issue. The
>> subsystem is not active after February 2014. No response from maintainer and 
>> the
>> last commit on git://git.infradead.org/battery-2.6 was on 2014-02-01. 
>> Appreciate
>> your help.
>
> Well, two weeks ago Dmitry did say that he'd been busy at work and
> planned to pick things up again soon.
>
> Dmitry, could you please make a firm and realistic decision one way or
> the other?  If it isn't truly going to happen then that's OK - these
> things happen.  But please tell us so other arrangements can be put in
> place if that's the way we'll be proceeding.

Well, I am sorry. I promised that I will have time for this, but it
seems things did not go
the way I expected. Sebastian volunteered  to pick up power/reset
maintainership,
so if he still is willing to work on that topic, I'll ack a patch
transferring maintainership
to him.

As a side note, I'd suggest to also open a mailing list either on
infradead.org (David, I
made several requests, to n/a) or on vger.kernel.org.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] MAINTAINERS: power_supply: update maintainership

2014-06-15 Thread Dmitry Eremin-Solenikov
Hello,

On Sun, Jun 15, 2014 at 5:20 AM, Stephen Rothwell  wrote:
> Hi Sebastian,
>
> On Sat, 14 Jun 2014 17:32:09 +0200 Sebastian Reichel  wrote:
>>
>> Take over maintanence for orphaned power supply subsystem
>> and move the git tree to a new kernel.org based repository.
>>
>> Signed-off-by: Sebastian Reichel 
>> ---
>> Hi,
>>
>> As suggested by Rafael in [0] I volunteer to take over the orphaned
>> power supply subsystem.
>>
>> [0] http://www.spinics.net/lists/kernel/msg1744793.html
>>
>>  POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS
>> -M:   Dmitry Eremin-Solenikov 
>> -M:   David Woodhouse 
>> -T:   git git://git.infradead.org/battery-2.6.git
>
> OK, the master branch of that tree is in linux-next as the "battery"
> tree.  My contact for that tree is Anton Vorontsov (cc'd) and its
> latest commit is from January.  So should I dump that tree in favour of
> the one below with you as the contact?  If so, whatr branch of that
> tree should I fetch?  (And should I change its linux-next name?)

Not at this point, we will reconsider after -rc1.

>
>> +M:   Sebastian Reichel 
>> +T:   git 
>> git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
>
> --
> Cheers,
> Stephen Rothwells...@canb.auug.org.au



-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Status of Power Supply Subsystem

2014-06-14 Thread Dmitry Eremin-Solenikov
Hello, colleagues,

On Sat, Jun 14, 2014 at 7:53 PM, David Woodhouse  wrote:
> On Sat, 2014-06-14 at 17:36 +0200, Sebastian Reichel wrote:
>>
>> I waited a bit to see if maybe Dmitry or David want to give feedback.
>> But I haven't received anything, so I volunteer to take this subsystem
>> over.

I'm sorry, I had too much trouble on my work to be able to think about
community projects. My work load is now getting back to normal,
so I will probably have more time.

>
> I've never really done much with the subsystem except getting Dmitry set
> up to maintain it. I certainly have no objection if you want to take it
> over and Dmitry isn't objecting.

I'd welcome any help, team or co-maintenance of any kind. What do you
think about patchwork?

BTW, David, I remember several people (including myself) asking for
a separate power-related ML to be set up on the infradead.org. Could you
please set it up? I think it might help all of us.

> If you like, you can send me a SSH public key and I'll give you access
> to the existing git tree on git.infradead.org to take it over.
>
> You can work in coordination with Dmitry if he comes back to life, that
> way.

I'm doing a scan over my patches inbox during next few days (yes, huge
task after so long time). I'll just base it on your kernel. After -rc1 we
can think about something sane.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] serial: 8250_pci: unbreak last serial ports on NetMos 9865 cards

2014-02-18 Thread Dmitry Eremin-Solenikov
On Tue, Feb 18, 2014 at 3:00 PM, Dmitry Eremin-Solenikov
 wrote:
> Hello,
>
> On Tue, Feb 11, 2014 at 2:18 PM, Dmitry Eremin-Solenikov
>  wrote:
>> Aparently 9865 uses standard BAR encoding scheme (unlike 99xx cards).
>> Current pci_netmos_9900_setup() uses wrong BAR indices for the 9865 PCI
>> device, function 2. Using standard BAR indices makes all 6 ports work
>> for me. Thus disable the NetMos 9900 quirk for NetMos 9865 pci device.
>
> Do you need any additional details for the patch?

Sorry for the noise, I missed that you have it in -fixes. Please excuse me.


-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] serial: 8250_pci: unbreak last serial ports on NetMos 9865 cards

2014-02-18 Thread Dmitry Eremin-Solenikov
Hello,

On Tue, Feb 11, 2014 at 2:18 PM, Dmitry Eremin-Solenikov
 wrote:
> Aparently 9865 uses standard BAR encoding scheme (unlike 99xx cards).
> Current pci_netmos_9900_setup() uses wrong BAR indices for the 9865 PCI
> device, function 2. Using standard BAR indices makes all 6 ports work
> for me. Thus disable the NetMos 9900 quirk for NetMos 9865 pci device.

Do you need any additional details for the patch?

[skipped lspci]

>
> Signed-off-by: Dmitry Eremin-Solenikov 
> ---
>  drivers/tty/serial/8250/8250_pci.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_pci.c 
> b/drivers/tty/serial/8250/8250_pci.c
> index 4697a51..143a381 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -784,7 +784,8 @@ static int pci_netmos_9900_setup(struct serial_private 
> *priv,
>  {
> unsigned int bar;
>
> -   if ((priv->dev->subsystem_device & 0xff00) == 0x3000) {
> +   if ((priv->dev->device != PCI_DEVICE_ID_NETMOS_9865) &&
> +   (priv->dev->subsystem_device & 0xff00) == 0x3000) {
> /* netmos apparently orders BARs by datasheet layout, so 
> serial
>  * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
>  */
> --
> 1.8.5.2
>



-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] battery-2.6.git: fixes for v3.14

2014-02-12 Thread Dmitry Eremin-Solenikov
Hello Linus,

Could you please pull battery-2.6.git tree containing several fixes
for v3.14 kernel.

The following changes since commit 573189354b7c97cd2256b87cf083ee435584594e:

  MAINTAINERS: Pick up power supply maintainership (2014-01-21 03:33:09 +0400)

are available in the git repository at:

  git://git.infradead.org/battery-2.6.git tags/for-v3.14-fixes

for you to fetch changes up to ac323d8d807060f7c95a685a9fe861e7b6300993:

  power: max17040: Fix NULL pointer dereference when there is no platform_data 
(2014-02-01 20:11:32 +0400)


Few fixes:

- Fix NULL pointer dereference in max17040 driver

- Add bq2415x dts bindings documentation

- Fix misleading comment in ds2782 driver

- Remove useless check in isp1704 charger driver.


Krzysztof Kozlowski (1):
  power: max17040: Fix NULL pointer dereference when there is no 
platform_data

Matthias Brugger (1):
  power: ds2782_battery: Typo in comment

Sebastian Reichel (1):
  dt: binding documentation for bq2415x charger

Wei Yongjun (1):
  isp1704_charger: remove useless check in isp1704_charger_probe()

 .../devicetree/bindings/power/bq2415x.txt  | 47 ++
 drivers/power/ds2782_battery.c |  2 +-
 drivers/power/isp1704_charger.c|  2 -
 drivers/power/max17040_battery.c   |  5 ++-
 4 files changed, 51 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/bq2415x.txt

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] power: reset: msm - switch Kconfig to ARCH_QCOM depends

2014-02-11 Thread Dmitry Eremin-Solenikov
On Wed, Feb 12, 2014 at 12:22 AM, Kumar Gala  wrote:
> We've split Qualcomm MSM support into legacy and multiplatform.  The reset
> driver is only relevant on the multiplatform supported SoCs so switch the
> Kconfig depends to ARCH_QCOM.
>
> Signed-off-by: Kumar Gala 

Acked-by: Dmitry Eremin-Solenikov

> ---
> Dmitry, David,
>
> If you can ack this I'll send it via linux-qcom/arm-soc tree's

Please, go ahead.

>
> thanks



-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] serial: 8250_pci: unbreak last serial ports on NetMos 9865 cards

2014-02-11 Thread Dmitry Eremin-Solenikov
Aparently 9865 uses standard BAR encoding scheme (unlike 99xx cards).
Current pci_netmos_9900_setup() uses wrong BAR indices for the 9865 PCI
device, function 2. Using standard BAR indices makes all 6 ports work
for me. Thus disable the NetMos 9900 quirk for NetMos 9865 pci device.

For the reference, here is the relevant part of lspci for my device:

02:07.0 Serial controller: MosChip Semiconductor Technology Ltd. PCI
9865 Multi-I/O Controller (prog-if 02 [16550])
Subsystem: Device a000:1000
Flags: bus master, medium devsel, latency 32, IRQ 17
I/O ports at ac00 [size=8]
Memory at fcfff000 (32-bit, non-prefetchable) [size=4K]
Memory at fcffe000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [48] Power Management version 2
Kernel driver in use: serial

02:07.1 Serial controller: MosChip Semiconductor Technology Ltd. PCI
9865 Multi-I/O Controller (prog-if 02 [16550])
Subsystem: Device a000:1000
Flags: bus master, medium devsel, latency 32, IRQ 18
I/O ports at a800 [size=8]
Memory at fcffd000 (32-bit, non-prefetchable) [size=4K]
Memory at fcffc000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [48] Power Management version 2
Kernel driver in use: serial

02:07.2 Communication controller: MosChip Semiconductor Technology Ltd.
PCI 9865 Multi-I/O Controller
Subsystem: Device a000:3004
Flags: bus master, medium devsel, latency 32, IRQ 19
I/O ports at a400 [size=8]
I/O ports at a000 [size=8]
I/O ports at 9c00 [size=8]
I/O ports at 9800 [size=8]
Memory at fcffb000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [48] Power Management version 2
Kernel driver in use: serial

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/tty/serial/8250/8250_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c 
b/drivers/tty/serial/8250/8250_pci.c
index 4697a51..143a381 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -784,7 +784,8 @@ static int pci_netmos_9900_setup(struct serial_private 
*priv,
 {
unsigned int bar;
 
-   if ((priv->dev->subsystem_device & 0xff00) == 0x3000) {
+   if ((priv->dev->device != PCI_DEVICE_ID_NETMOS_9865) &&
+   (priv->dev->subsystem_device & 0xff00) == 0x3000) {
/* netmos apparently orders BARs by datasheet layout, so serial
 * ports get BARs 0 and 3 (or 1 and 4 for memmapped)
 */
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] power: max17040: Fix NULL pointer dereference when there is no platform_data

2014-02-01 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jan 30, 2014 at 5:32 PM, Krzysztof Kozlowski
 wrote:
> Fix NULL pointer dereference of "chip->pdata" if platform_data was not
> supplied to the driver.
>
> The driver during probe stored the pointer to the platform_data:
> chip->pdata = client->dev.platform_data;
> Later it was dereferenced in max17040_get_online() and
> max17040_get_status().
>
> If platform_data was not supplied, the NULL pointer exception would
> happen:
>
> [6.626094] Unable to handle kernel  of a at virtual address 
> [6.628557] pgd = c0004000
> [6.632868] [] *pgd=66262564
> [6.634636] Unable to handle kernel paging request at virtual address 
> e6262000
> [6.642014] pgd = de468000
> [6.644700] [e6262000] *pgd=
> [6.648265] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> [6.653552] Modules linked in:
> [6.656598] CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 
> 3.10.14-02717-gc58b4b4 #505
> [6.664334] Workqueue: events max17040_work
> [6.668488] task: dfa11b80 ti: df9f6000 task.ti: df9f6000
> [6.673873] PC is at show_pte+0x80/0xb8
> [6.677687] LR is at show_pte+0x3c/0xb8
> [6.681503] pc : []lr : []psr: 600f0113
> [6.681503] sp : df9f7d58  ip : 600f0113  fp : 0009
> [6.692965] r10:   r9 :   r8 : dfa11b80
> [6.698171] r7 : df9f7ea0  r6 : e6262000  r5 :   r4 : 
> [6.704680] r3 :   r2 : e6262000  r1 : 600f0193  r0 : c05b3750
> [6.711194] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment 
> kernel
> [6.718485] Control: 10c53c7d  Table: 5e46806a  DAC: 0015
> [6.724218] Process kworker/0:1 (pid: 31, stack limit = 0xdf9f6238)
> [6.730465] Stack: (0xdf9f7d58 to 0xdf9f8000)
> [6.914325] [] (show_pte+0x80/0xb8) from [] 
> (__do_kernel_fault.part.9+0x44/0x74)
> [6.923425] [] (__do_kernel_fault.part.9+0x44/0x74) from 
> [] (do_page_fault+0x2c4/0x360)
> [6.933144] [] (do_page_fault+0x2c4/0x360) from [] 
> (do_DataAbort+0x34/0x9c)
> [6.941825] [] (do_DataAbort+0x34/0x9c) from [] 
> (__dabt_svc+0x38/0x60)
> [6.950058] Exception stack(0xdf9f7ea0 to 0xdf9f7ee8)
> [6.955099] 7ea0: df0c1790  0002  df0c1794 df0c1790 
> df0c1790 0042
> [6.963271] 7ec0: df0c1794 0001  0009  df9f7ee8 
> c0306268 c0306270
> [6.971419] 7ee0: a00f0113 
> [6.974902] [] (__dabt_svc+0x38/0x60) from [] 
> (max17040_work+0x8c/0x144)
> [6.983317] [] (max17040_work+0x8c/0x144) from [] 
> (process_one_work+0x138/0x440)
> [6.992429] [] (process_one_work+0x138/0x440) from [] 
> (worker_thread+0x134/0x3b8)
> [7.001628] [] (worker_thread+0x134/0x3b8) from [] 
> (kthread+0xa4/0xb0)
> [7.009875] [] (kthread+0xa4/0xb0) from [] 
> (ret_from_fork+0x14/0x2c)
> [7.017943] Code: e1a03005 e2422480 e0826104 e59f002c (e7922104)
> [7.024017] ---[ end trace 73bc7006b9cc5c79 ]---
>
> Signed-off-by: Krzysztof Kozlowski 
> Fixes: c6f4a42de60b981dd210de01cd3e575835e3158e
> Cc: 

Thank you, I will apply to fixes branch.




-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: power_supply mailing list

2014-02-01 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jan 30, 2014 at 10:46 PM, Jenny Tc  wrote:
>
> Do we have any mailing list for power_supply subsystem? If not what about 
> having
> one - linux-power-sup...@vger.kernel.org?

I'm not sure that if that ML will have enough traffic to be fully
usefull or enough
reviewers on it. However as currently most of the power_supply patches receive
a long list of To and Cc people, let's try that ML.


David, could you please create a mailing list for power_supply discussions?

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code.

2014-01-26 Thread Dmitry Eremin-Solenikov
On Mon, Jan 27, 2014 at 3:14 AM, Dmitry Torokhov
 wrote:
> On Mon, Jan 27, 2014 at 02:31:59AM +0400, Dmitry Eremin-Solenikov wrote:
>> On Mon, Jan 27, 2014 at 1:49 AM, Tomasz Figa  wrote:
>> > On 26.01.2014 22:45, Dmitry Torokhov wrote:
>> >>
>> >> On Sun, Jan 26, 2014 at 07:31:50PM +0530, Manish Badarkhe wrote:
>> >>>
>> >>> Hi Tomasz,
>> >>>
>> >>> Thank you for your review comments.
>> >>>
>> >>> On Sun, Jan 26, 2014 at 6:52 PM, Tomasz Figa 
>> >>> wrote:
>> >>>>
>> >>>>
>> >>>> Hi Manish,
>> >>>>
>> >>>>
>> >>>> On 26.01.2014 08:15, Manish Badarkhe wrote:
>> >>>>>
>> >>>>>
>> >>>>> Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)"
>> >>>>> option for DT code to avoid if-deffery in code.
>> >>>>>
>> >>>>> Signed-off-by: Manish Badarkhe 
>> >>>>> ---
>> >>>>> :100644 100644 b4513f2... d353fbc... M  drivers/power/max8925_power.c
>> >>>>>drivers/power/max8925_power.c |   14 +-
>> >>>>>1 file changed, 5 insertions(+), 9 deletions(-)
>> >>>>>
>> >>>>> diff --git a/drivers/power/max8925_power.c
>> >>>>> b/drivers/power/max8925_power.c
>> >>>>> index b4513f2..d353fbc 100644
>> >>>>> --- a/drivers/power/max8925_power.c
>> >>>>> +++ b/drivers/power/max8925_power.c
>> >>>>> @@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct
>> >>>>> max8925_power_info *info)
>> >>>>>  return 0;
>> >>>>>}
>> >>>>>
>> >>>>> -#ifdef CONFIG_OF
>> >>>>>static struct max8925_power_pdata *
>> >>>>>max8925_power_dt_init(struct platform_device *pdev)
>> >>>>>{
>> >>>>> @@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device
>> >>>>> *pdev)
>> >>>>>
>> >>>>>  return pdata;
>> >>>>>}
>> >>>>> -#else
>> >>>>> -static struct max8925_power_pdata *
>> >>>>> -max8925_power_dt_init(struct platform_device *pdev)
>> >>>>> -{
>> >>>>> -   return pdev->dev.platform_data;
>> >>>>> -}
>> >>>>> -#endif
>> >>>>>
>> >>>>>static int max8925_power_probe(struct platform_device *pdev)
>> >>>>>{
>> >>>>> @@ -483,7 +475,11 @@ static int max8925_power_probe(struct
>> >>>>> platform_device *pdev)
>> >>>>>  struct max8925_power_info *info;
>> >>>>>  int ret;
>> >>>>>
>> >>>>> -   pdata = max8925_power_dt_init(pdev);
>> >>>>> +   if (IS_ENABLED(CONFIG_OF))
>> >>>>> +   pdata = max8925_power_dt_init(pdev);
>> >>>>> +   else
>> >>>>> +   pdata = pdev->dev.platform_data;
>> >>>>> +
>> >>>>
>> >>>>
>> >>>>
>> >>>> This does not look much better than before this patch. Instead of
>> >>>> "if-deffery" outside function bodies you are adding "iffery" (if there 
>> >>>> is
>> >>>> such a word) inside a function.
>> >>>> What about adding
>> >>>>
>> >>>>  if (!IS_ENABLED(CONFIG_OF))
>> >>>>  return pdev->dev.platform_data;
>> >>>>
>> >>>> on top of max8925_power_dt_init() instead or maybe also renaming this
>> >>>> function to max8925_get_pdata()?
>> >>>
>> >>>
>> >>> Okay, I will rename function "max8925_power_dt_init()" to
>> >>> "max8925_get_pdata()".
>> >>> As you suggested, in the body of this function  will add a logic to
>> >>> retrieve  data in case
>> >>> of DT and non-DT platforms.
>> >>
>> >>
>> >> Should we not always favor platform-supplied data regardless of
>> >> CONFIG_OF state and fall back to DT (firmware) supplied data if platform
>> >> data is absent? This way one can tweak kernel behavior without needing
>> >> to change firmware.
>> >
>> >
>> > I guess we should, but apparently this was not the original behavior before
>> > this patch, so I'm not sure if we should be squashing such semantic change
>> > with this simple refactor.
>>
>> Hmm. Judging from the code, max8925_power_dt_init() function follows exactly
>> opposite strategy - it uses platform_data if of_node is not 
>> populated/available.
>> So (if dt_init will compile with CONFIG_OF disabled) one can always
>> use _dt_init()
>> function to retrieve pdata.
>
> Right, and I question whether this is good behavior or if it should be
> corrected.

I'd say, correct it.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code.

2014-01-26 Thread Dmitry Eremin-Solenikov
On Mon, Jan 27, 2014 at 1:49 AM, Tomasz Figa  wrote:
> On 26.01.2014 22:45, Dmitry Torokhov wrote:
>>
>> On Sun, Jan 26, 2014 at 07:31:50PM +0530, Manish Badarkhe wrote:
>>>
>>> Hi Tomasz,
>>>
>>> Thank you for your review comments.
>>>
>>> On Sun, Jan 26, 2014 at 6:52 PM, Tomasz Figa 
>>> wrote:


 Hi Manish,


 On 26.01.2014 08:15, Manish Badarkhe wrote:
>
>
> Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)"
> option for DT code to avoid if-deffery in code.
>
> Signed-off-by: Manish Badarkhe 
> ---
> :100644 100644 b4513f2... d353fbc... M  drivers/power/max8925_power.c
>drivers/power/max8925_power.c |   14 +-
>1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/power/max8925_power.c
> b/drivers/power/max8925_power.c
> index b4513f2..d353fbc 100644
> --- a/drivers/power/max8925_power.c
> +++ b/drivers/power/max8925_power.c
> @@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct
> max8925_power_info *info)
>  return 0;
>}
>
> -#ifdef CONFIG_OF
>static struct max8925_power_pdata *
>max8925_power_dt_init(struct platform_device *pdev)
>{
> @@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device
> *pdev)
>
>  return pdata;
>}
> -#else
> -static struct max8925_power_pdata *
> -max8925_power_dt_init(struct platform_device *pdev)
> -{
> -   return pdev->dev.platform_data;
> -}
> -#endif
>
>static int max8925_power_probe(struct platform_device *pdev)
>{
> @@ -483,7 +475,11 @@ static int max8925_power_probe(struct
> platform_device *pdev)
>  struct max8925_power_info *info;
>  int ret;
>
> -   pdata = max8925_power_dt_init(pdev);
> +   if (IS_ENABLED(CONFIG_OF))
> +   pdata = max8925_power_dt_init(pdev);
> +   else
> +   pdata = pdev->dev.platform_data;
> +



 This does not look much better than before this patch. Instead of
 "if-deffery" outside function bodies you are adding "iffery" (if there is
 such a word) inside a function.
 What about adding

  if (!IS_ENABLED(CONFIG_OF))
  return pdev->dev.platform_data;

 on top of max8925_power_dt_init() instead or maybe also renaming this
 function to max8925_get_pdata()?
>>>
>>>
>>> Okay, I will rename function "max8925_power_dt_init()" to
>>> "max8925_get_pdata()".
>>> As you suggested, in the body of this function  will add a logic to
>>> retrieve  data in case
>>> of DT and non-DT platforms.
>>
>>
>> Should we not always favor platform-supplied data regardless of
>> CONFIG_OF state and fall back to DT (firmware) supplied data if platform
>> data is absent? This way one can tweak kernel behavior without needing
>> to change firmware.
>
>
> I guess we should, but apparently this was not the original behavior before
> this patch, so I'm not sure if we should be squashing such semantic change
> with this simple refactor.

Hmm. Judging from the code, max8925_power_dt_init() function follows exactly
opposite strategy - it uses platform_data if of_node is not populated/available.
So (if dt_init will compile with CONFIG_OF disabled) one can always
use _dt_init()
function to retrieve pdata.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -next] isp1704_charger: remove useless check in isp1704_charger_probe()

2014-01-25 Thread Dmitry Eremin-Solenikov
On Tue, Jan 07, 2014 at 09:12:29PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun 
> 
> Neither devm_usb_get_phy_by_phandle() nor devm_usb_get_phy() can
> return a NULL result, so remove the useless !isp->phy check.

Thank you, applying.

> Signed-off-by: Wei Yongjun 
> ---
>  drivers/power/isp1704_charger.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
> index 80edb7d..0b4cf9d 100644
> --- a/drivers/power/isp1704_charger.c
> +++ b/drivers/power/isp1704_charger.c
> @@ -444,8 +444,6 @@ static int isp1704_charger_probe(struct platform_device 
> *pdev)
>   ret = PTR_ERR(isp->phy);
>   goto fail0;
>   }
> - if (!isp->phy)
> - goto fail0;
>  
>   isp->dev = &pdev->dev;
>   platform_set_drvdata(pdev, isp);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] power: ds2782_battery: Typo in comment

2014-01-25 Thread Dmitry Eremin-Solenikov
On Fri, Jan 17, 2014 at 06:02:38PM +0100, Matthias Brugger wrote:
> Change missleading comment to actual shift value provided by the chip.

Thank you, applied.

> 
> Signed-off-by: Matthias Brugger 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] power_supply: Add inlmt,iterm, min/max temp props

2014-01-24 Thread Dmitry Eremin-Solenikov
On 22/01/14 21:19, Jenny TC wrote:
> Add new power supply properties for input current, charge termination
> current, min and max temperature
> 
> POWER_SUPPLY_PROP_TEMP_MIN - minimum operatable temperature
> POWER_SUPPLY_PROP_TEMP_MAX - maximum operatable temperature

What is the difference from TEMP_ALERT_MIN/TEMP_ALERT_MAX ?
There is a difference in definitions, but what is the logical difference?

> POWER_SUPPLY_PROP_INLMT - input current limit programmed by charger. Indicates
> the input current for a charging source.
> POWER_SUPPLY_PROP_CHARGE_TERM_CUR - Charge termination current used to detect
> the end of charge condition

For both of them:

1) Please don't use obscure abbreviations
2) Is this generic enough? I.e. besides your charge manager who will
use that?

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3] dt: binding documentation for bq2415x charger

2014-01-22 Thread Dmitry Eremin-Solenikov
Hello,

On Wed, Jan 22, 2014 at 12:48 AM, Sebastian Reichel  wrote:
> Hi Dmitry,
>
>> Add devicetree binding documentation for bq2415x charger.
>>
>> Signed-off-by: Sebastian Reichel 
>> Acked-by: Pavel Machek 
>
> I've seen, that you just sent a pull request for the power supply
> tree. Can you please add this patch [0] and send another pull
> request? It should go into the kernel together with the bq2415x DT
> support patch!

If that is fine with you, I will add this to a 'fixes' branch and send
a pull request
somewhere near -rc2/-rc3. Agreed?

>
> [0] http://www.spinics.net/lists/devicetree/msg18023.html

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] battery-2.6.git

2014-01-21 Thread Dmitry Eremin-Solenikov
Hello Linus,

I'm picking up power supply maintainership from Anton Vorontov. Could
you please pull battery-2.6 git tree changes prepared for the v3.14
release.

The following changes since commit 93353e8088057dd988362e6cae727af43734b494:

  max17042_battery: Fix build errors caused by missing REGMAP_I2C config 
(2013-12-01 14:25:03 -0800)

are available in the git repository at:

  git://git.infradead.org/battery-2.6.git tags/for-v3.14

for you to fetch changes up to 573189354b7c97cd2256b87cf083ee435584594e:

  MAINTAINERS: Pick up power supply maintainership (2014-01-21 03:33:09 +0400)


Highlights:

- Power supply notifier

- Several drivers gained DT support

- Added Maxim 14577 driver

- Change of maintainer


Anton Vorontsov (1):
  charger-manager: of_cm_parse_desc() should be static

Dmitry Eremin-Solenikov (2):
  gpio-charger: Support wakeup events
  MAINTAINERS: Pick up power supply maintainership

Jonghwa Lee (3):
  charger-manager: Modify the way of checking battery's temperature
  charger-manager: Support deivce tree in charger manager driver
  max17042_battery: Add IRQF_ONESHOT flag to use default irq handler

Krzysztof Kozlowski (1):
  power_supply: Add charger support for Maxim 14577

Laxman Dewangan (2):
  mfd: AS3722: Add dt node properties for system power controller
  power: reset: Add as3722 power-off driver

Pali Rohár (2):
  power_supply: Add power_supply notifier
  bq2415x_charger: Use power_supply notifier for automode

Sebastian Reichel (4):
  power_supply: Add power_supply_get_by_phandle
  bq2415x_charger: Add DT support
  isp1704_charger: Add DT support
  dt: Binding documentation for isp1704 charger

 Documentation/devicetree/bindings/mfd/as3722.txt   |  11 +
 .../devicetree/bindings/power/isp1704.txt  |  17 ++
 .../bindings/power_supply/charger-manager.txt  |  81 ++
 MAINTAINERS|   2 +-
 drivers/power/Kconfig  |   7 +
 drivers/power/Makefile |   1 +
 drivers/power/bq2415x_charger.c| 121 ++--
 drivers/power/charger-manager.c| 299 +---
 drivers/power/gpio-charger.c   |  19 +-
 drivers/power/isp1704_charger.c|  54 +++-
 drivers/power/max14577_charger.c   | 311 +
 drivers/power/max17042_battery.c   |   6 +-
 drivers/power/power_supply_core.c  |  44 +++
 drivers/power/reset/Kconfig|   6 +
 drivers/power/reset/Makefile   |   1 +
 drivers/power/reset/as3722-poweroff.c  |  96 +++
 include/linux/power/bq2415x_charger.h  |  48 +---
 include/linux/power/charger-manager.h  |  34 ++-
 include/linux/power/isp1704_charger.h  |   1 +
 include/linux/power_supply.h   |  16 ++
 20 files changed, 1043 insertions(+), 132 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/isp1704.txt
 create mode 100644 
Documentation/devicetree/bindings/power_supply/charger-manager.txt
 create mode 100644 drivers/power/max14577_charger.c
 create mode 100644 drivers/power/reset/as3722-poweroff.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: Tree for Jan 14 (lowpan, 802.15.4)

2014-01-17 Thread Dmitry Eremin-Solenikov
Hello,

On Fri, Jan 17, 2014 at 11:13 PM, Stephen Warren  wrote:
> On 01/14/2014 03:54 PM, Dmitry Eremin-Solenikov wrote:
>> Hello,
>>
>>
>> On Tue, Jan 14, 2014 at 9:49 PM, Randy Dunlap  wrote:
>>>
>>> On 01/13/2014 09:51 PM, Stephen Rothwell wrote:
>>>> Hi all,
>>>>
>>>> This tree fails (more than usual) the powerpc allyesconfig build.
>>>>
>>>> Changes since 20140113:
>>>>
>>>
>>>
>>> on i386:
>>>
>>> net/built-in.o: In function `header_create':
>>> 6lowpan.c:(.text+0x166149): undefined reference to `lowpan_header_compress'
>>> net/built-in.o: In function `bt_6lowpan_recv':
>>> (.text+0x166b3c): undefined reference to `lowpan_process_data'
>>
>> Ah, nice Makefile hack there.
>> David, Marcel, could you please consider the attached patch.
>
> I think you forgot to "git add net/bluetooth/Makefile" into that patch;
> don't you need the following too (I certainly do, to build next-20140117)
>
>> diff --git a/net/bluetooth/Makefile b/net/bluetooth/Makefile
>> index cc6827e2ce68..80cb215826e8 100644
>> --- a/net/bluetooth/Makefile
>> +++ b/net/bluetooth/Makefile
>> @@ -12,8 +12,4 @@ bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o 
>> hci_event.o mgmt.o \
>>   hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
>>   a2mp.o amp.o 6lowpan.o
>>
>> -ifeq ($(CONFIG_IEEE802154_6LOWPAN),)
>> -  bluetooth-y +=  ../ieee802154/6lowpan_iphc.o
>> -endif
>> -
>>  subdir-ccflags-y += -D__CHECK_ENDIAN__
>
> Should I send this as a separate followup patch?

Yes, please. I forgot to add it to the patch.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: Tree for Jan 14 (lowpan, 802.15.4)

2014-01-14 Thread Dmitry Eremin-Solenikov
Hello,


On Tue, Jan 14, 2014 at 9:49 PM, Randy Dunlap  wrote:
>
> On 01/13/2014 09:51 PM, Stephen Rothwell wrote:
> > Hi all,
> >
> > This tree fails (more than usual) the powerpc allyesconfig build.
> >
> > Changes since 20140113:
> >
>
>
> on i386:
>
> net/built-in.o: In function `header_create':
> 6lowpan.c:(.text+0x166149): undefined reference to `lowpan_header_compress'
> net/built-in.o: In function `bt_6lowpan_recv':
> (.text+0x166b3c): undefined reference to `lowpan_process_data'

Ah, nice Makefile hack there.
David, Marcel, could you please consider the attached patch.


-- 
With best wishes
Dmitry
From 4c3db6d3c244decf434665c30c1bf75aad1f94b2 Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov 
Date: Wed, 15 Jan 2014 02:50:40 +0400
Subject: [PATCH] net: move 6lowpan compression code to separate module

IEEE 802.15.4 and Bluetooth networking stacks share 6lowpan compression
code. Instead of introducing Makefile/Kconfig hacks, build this code as
a separate module referenced from both ieee802154 and bluetooth modules.

This fixes the following build error observed in some kernel
configurations:

net/built-in.o: In function `header_create': 6lowpan.c:(.text+0x166149): undefined reference to `lowpan_header_compress'
net/built-in.o: In function `bt_6lowpan_recv': (.text+0x166b3c): undefined reference to `lowpan_process_data'

Signed-off-by: Dmitry Eremin-Solenikov 
---
 net/Makefile| 2 +-
 net/bluetooth/Kconfig   | 1 +
 net/ieee802154/Kconfig  | 7 +++
 net/ieee802154/Makefile | 3 ++-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/Makefile b/net/Makefile
index 8fa2f91..cbbbe6d 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_CAIF)		+= caif/
 ifneq ($(CONFIG_DCB),)
 obj-y+= dcb/
 endif
-obj-$(CONFIG_IEEE802154)	+= ieee802154/
+obj-y+= ieee802154/
 obj-$(CONFIG_MAC802154)		+= mac802154/
 
 ifeq ($(CONFIG_NET),y)
diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
index d3f3f7b..985b560 100644
--- a/net/bluetooth/Kconfig
+++ b/net/bluetooth/Kconfig
@@ -12,6 +12,7 @@ menuconfig BT
 	select CRYPTO_AES
 	select CRYPTO_ECB
 	select CRYPTO_SHA256
+	select 6LOWPAN_IPHC
 	help
 	  Bluetooth is low-cost, low-power, short-range wireless technology.
 	  It was designed as a replacement for cables and other short-range
diff --git a/net/ieee802154/Kconfig b/net/ieee802154/Kconfig
index b2e06df..9c9879d 100644
--- a/net/ieee802154/Kconfig
+++ b/net/ieee802154/Kconfig
@@ -13,5 +13,12 @@ config IEEE802154
 config IEEE802154_6LOWPAN
 	tristate "6lowpan support over IEEE 802.15.4"
 	depends on IEEE802154 && IPV6
+	select 6LOWPAN_IPHC
 	---help---
 	IPv6 compression over IEEE 802.15.4.
+
+config 6LOWPAN_IPHC
+	tristate
+	---help---
+	  6lowpan compression code which is shared between IEEE 802.15.4 and Bluetooth
+	  stacks.
diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile
index 951a83e..e8f0588 100644
--- a/net/ieee802154/Makefile
+++ b/net/ieee802154/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_IEEE802154) += ieee802154.o af_802154.o
-obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o 6lowpan_iphc.o
+obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o
+obj-$(CONFIG_6LOWPAN_IPHC) += 6lowpan_iphc.o
 
 ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o
 af_802154-y := af_ieee802154.o raw.o dgram.o
-- 
1.8.5.2



[PATCH] gpio-charger: support wakeup events

2013-12-10 Thread Dmitry Eremin-Solenikov
Add support for using gpio-charger IRQ as a wakeup event.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/power/gpio-charger.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
index 4e858a2..a0024b2 100644
--- a/drivers/power/gpio-charger.c
+++ b/drivers/power/gpio-charger.c
@@ -28,6 +28,7 @@
 struct gpio_charger {
const struct gpio_charger_platform_data *pdata;
unsigned int irq;
+   bool wakeup_enabled;
 
struct power_supply charger;
 };
@@ -136,6 +137,8 @@ static int gpio_charger_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, gpio_charger);
 
+   device_init_wakeup(&pdev->dev, 1);
+
return 0;
 
 err_gpio_free:
@@ -159,18 +162,32 @@ static int gpio_charger_remove(struct platform_device 
*pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
+static int gpio_charger_suspend(struct device *dev)
+{
+   struct gpio_charger *gpio_charger = dev_get_drvdata(dev);
+
+   if (device_may_wakeup(dev))
+   gpio_charger->wakeup_enabled =
+   enable_irq_wake(gpio_charger->irq);
+
+   return 0;
+}
+
 static int gpio_charger_resume(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);
 
+   if (gpio_charger->wakeup_enabled)
+   disable_irq_wake(gpio_charger->irq);
power_supply_changed(&gpio_charger->charger);
 
return 0;
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(gpio_charger_pm_ops, NULL, gpio_charger_resume);
+static SIMPLE_DEV_PM_OPS(gpio_charger_pm_ops,
+   gpio_charger_suspend, gpio_charger_resume);
 
 static struct platform_driver gpio_charger_driver = {
.probe = gpio_charger_probe,
-- 
1.8.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 02/11] arm: pxa27x: support ICP DAS LP-8x4x

2013-12-10 Thread Dmitry Eremin-Solenikov
On Tue, 10 Dec 2013 13:43:27 +0100, Linus Walleij wrote:
 
> Argh! Now you're adding another user for a legacy custom pin control
> implementation. But if noone is going to modernize PXA2xx what can we do
> :-/

I plan to work on pxa2xx (pxa25x to be precise) after finishing with 
sa1100 - my second (well, first) PDA is Sharp SL-6000 (pxa255).

StrongARM somewhat resembles pxa2xx, so some of the drivers will be 
shared, some expertise will be shared, etc. I tried doing pxa first, but 
later found that it might be easier to update sa1100.

-- 
With best wishes
Dmitry

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/9] ARM: dts: pxa27x: skip static platform devices

2013-12-09 Thread Dmitry Eremin-Solenikov
Hello,

On Mon, 09 Dec 2013 02:53:47 +0400, Sergei Ianovich wrote:

> Static plaform devices are created from postcore_initcall(). The status
> quo remains for non-device tree machines.
> 
> Device tree machine now have a chance to prevent spawning of static
> devices by calling pxa27x_skip_init().
> 
> Signed-off-by: Sergei Ianovich 
> CC: Russell King - ARM Linux 
> CC: Daniel Mack 
> CC: Arnd Bergmann 
> ---
>  arch/arm/mach-pxa/include/mach/pxa27x.h |  1 +
>  arch/arm/mach-pxa/pxa27x.c  | 10 ++ 2 files
>  changed, 11 insertions(+)

I would suggest to copy the corresponding code from pxa3xx.c - use 
of_have_populated_dt() instead of adding extra static variable.

-- 
With best wishes
Dmitry


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] of/i2c: don't register disabled devices

2013-02-20 Thread Dmitry Eremin-Solenikov
On 20/02/13 23:09, Rob Herring wrote:
> On 02/20/2013 12:28 PM, Dmitry Eremin-Solenikov wrote:
>> Don't register i2c slave device tree nodes which have
>> status = "disabled" property.
>>
> 
> This is already in 3.8.

Ah, true. Sorry for the noise then.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] of/i2c: don't register disabled devices

2013-02-20 Thread Dmitry Eremin-Solenikov
Don't register i2c slave device tree nodes which have
status = "disabled" property.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/of/of_i2c.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 1e173f3..63f3236 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -35,6 +35,9 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
const __be32 *addr;
int len;
 
+   if (!of_device_is_available(node))
+   continue;
+
dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name);
 
if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mtd: map: BUG() in non handled cases

2013-01-31 Thread Dmitry Eremin-Solenikov
Several map-related functions look like a serie of ifs, checking
widths of map. Those functions do not have any handling for default
case. Instead of fiddling with uninitialized_var in those functions,
let's just add a (correct) BUG() to the default case on those maps. This
will also allow us to catch potential errors in maps setup in future.

Signed-off-by: Dmitry Eremin-Solenikov 
Cc: Artem Bityutskiy 
Cc: David Woodhouse 
---
 include/linux/mtd/map.h |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index f6eb433..1d6ef97 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -328,7 +328,7 @@ static inline int map_word_bitsset(struct map_info *map, 
map_word val1, map_word
 
 static inline map_word map_word_load(struct map_info *map, const void *ptr)
 {
-   map_word r = {{0} };
+   map_word r;
 
if (map_bankwidth_is_1(map))
r.x[0] = *(unsigned char *)ptr;
@@ -342,6 +342,8 @@ static inline map_word map_word_load(struct map_info *map, 
const void *ptr)
 #endif
else if (map_bankwidth_is_large(map))
memcpy(r.x, ptr, map->bankwidth);
+   else
+   BUG();
 
return r;
 }
@@ -391,7 +393,7 @@ static inline map_word map_word_ff(struct map_info *map)
 
 static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
 {
-   map_word uninitialized_var(r);
+   map_word r;
 
if (map_bankwidth_is_1(map))
r.x[0] = __raw_readb(map->virt + ofs);
@@ -425,6 +427,8 @@ static inline void inline_map_write(struct map_info *map, 
const map_word datum,
 #endif
else if (map_bankwidth_is_large(map))
memcpy_toio(map->virt+ofs, datum.x, map->bankwidth);
+   else
+   BUG();
mb();
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] MAINTAINERS: reflect actual changes in IEEE 802.15.4 maintainership

2012-07-13 Thread Dmitry Eremin-Solenikov
As the life flows, developers priorities shifts a bit. Reflect actual
changes in the maintainership of IEEE 802.15.4 code: Sergey mostly
stopped cared about this piece of code. Most of the work recently was
done by Alexander, so put him to the MAINTAINERS file to reflect his
status and to ease the life of respective patches.

Also add new net/mac802154/ directory to the list of maintained files.

Signed-off-by: Dmitry Eremin-Solenikov 
Cc: Alexander Smirnov 
---
 MAINTAINERS |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 150a29f..f03c703 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3403,13 +3403,14 @@ S:  Supported
 F: drivers/idle/i7300_idle.c
 
 IEEE 802.15.4 SUBSYSTEM
+M: Alexander Smirnov 
 M: Dmitry Eremin-Solenikov 
-M: Sergey Lapin 
 L: linux-zigbee-de...@lists.sourceforge.net (moderated for non-subscribers)
 W: http://apps.sourceforge.net/trac/linux-zigbee
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git
 S: Maintained
 F: net/ieee802154/
+F: net/mac802154/
 F: drivers/ieee802154/
 
 IIO SUBSYSTEM AND DRIVERS
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/