Re: [PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2016-01-02 Thread Roman Volkov
В Fri, 01 Jan 2016 22:53:33 +0100
Arnd Bergmann  пишет:

> On Friday 01 January 2016 20:32:30 Roman Volkov wrote:
> > > Applied both to next/dt, thanks a lot for following up!
> > > 
> > > Let me know if you think this should go into stable backports as
> > > well, I did not apply it to the fixes branch as you don't have a
> > > 'Cc: sta...@vger.kernel.org' tag and it has never worked so far.  
> > 
> > Yes, this must go into the stable too. Let me know if I must change
> > something or resend.  
> 
> I can put them in the fixes branch with the appropriate stable
> tag myself, but please clarify whether we need just the first or
> both patches there. It looks to me that the second one while
> correct only addresses a cosmetic problem and everything works
> without it.

Correct, everything works without the second one. One of reviewers
noticed that addresses are different between WM8505 and WM8650 where
the hardware is the same. If such trivial changes are not accepted,
please do not apply.

Happy New Year,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2016-01-01 Thread Roman Volkov
В Fri, 01 Jan 2016 15:29:29 +0100
Arnd Bergmann  пишет:

> On Friday 01 January 2016 16:38:10 Roman Volkov wrote:
> > From: Roman Volkov 
> > 
> > This patch set enables SD controller support for WM8650 and
> > fixes minor errors in WM8505 Device Tree file.
> > 
> > Changes in v3:
> > 1. Add minor fixes for WM8505 SDHC node
> > 
> > Tested on both WM8505 and WM8650.
> > 
> > Roman Volkov (2):
> >   dts: vt8500: Add SDHC node to DTS file for WM8650
> >   dts: vt8500: Fix errors in SDHC node for WM8505
> > 
> >  arch/arm/boot/dts/wm8505.dtsi | 4 ++--
> >  arch/arm/boot/dts/wm8650.dtsi | 9 +
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> > 
> > -- 
> > Hi maintainers, I see my previous versions were not applied. Could
> > this little patch set be applied for the linux-next? I don't think
> > this is new functionality, this must be considered as bugfix for
> > existing Device Tree.
> > 
> > Any other suggestions?
> >   
> 
> Applied both to next/dt, thanks a lot for following up!
> 
> Let me know if you think this should go into stable backports as well,
> I did not apply it to the fixes branch as you don't have a
> 'Cc: sta...@vger.kernel.org' tag and it has never worked so far.

Yes, this must go into the stable too. Let me know if I must change
something or resend.

Thanks,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 1/2] dts: vt8500: Add SDHC node to DTS file for WM8650

2016-01-01 Thread Roman Volkov
From: Roman Volkov 

Since WM8650 has the same 'WMT' SDHC controller as WM8505, and the driver
is already in the kernel, this node enables the controller support for
WM8650

Signed-off-by: Roman Volkov 
Reviewed-by: Alexey Charkov 
---
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index b1c59a7..e12213d 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -187,6 +187,15 @@
interrupts = <43>;
};
 
+   sdhc@d800a000 {
+   compatible = "wm,wm8505-sdhc";
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
+   clocks = <&clksdhc>;
+   bus-width = <4>;
+   sdon-inverted;
+   };
+
fb: fb@d8050800 {
compatible = "wm,wm8505-fb";
reg = <0xd8050800 0x200>;
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 2/2] dts: vt8500: Fix errors in SDHC node for WM8505

2016-01-01 Thread Roman Volkov
From: Roman Volkov 

According to datasheet, the registers space of SDHC controller is 1Kb,
not '0x1000', the correct value should be '0x400'. Bracket interrupt
numbers individually per recommendations.

Signed-off-by: Roman Volkov 
---
 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index a1a854b..e9ef539 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -281,8 +281,8 @@
 
sdhc@d800a000 {
compatible = "wm,wm8505-sdhc";
-   reg = <0xd800a000 0x1000>;
-   interrupts = <20 21>;
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
clocks = <&clksdhc>;
bus-width = <4>;
};
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2016-01-01 Thread Roman Volkov
From: Roman Volkov 

This patch set enables SD controller support for WM8650 and
fixes minor errors in WM8505 Device Tree file.

Changes in v3:
1. Add minor fixes for WM8505 SDHC node

Tested on both WM8505 and WM8650.

Roman Volkov (2):
  dts: vt8500: Add SDHC node to DTS file for WM8650
  dts: vt8500: Fix errors in SDHC node for WM8505

 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
Hi maintainers, I see my previous versions were not applied. Could this
little patch set be applied for the linux-next? I don't think this is new
functionality, this must be considered as bugfix for existing Device Tree.

Any other suggestions?

2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-12-31 Thread Roman Volkov
В Thu, 31 Dec 2015 16:32:59 +0100
Arnd Bergmann  пишет:

> On Thursday 31 December 2015 16:31:02 Arnd Bergmann wrote:
> > On Thursday 24 December 2015 00:48:25 Roman Volkov wrote:  
> > > В Sat, 4 Apr 2015 15:27:20 +0300
> > > Roman Volkov  пишет:
> > >   
> > > > В Sun, 1 Mar 2015 23:39:11 +0300
> > > > Roman Volkov  пишет:
> > > >   
> > > > > В Sun, 01 Mar 2015 20:52:55 +0100
> > > > > Arnd Bergmann  пишет:  
> > > > > > > Any other suggestions?
> > > > > > 
> > > > > > According to the MAINTAINERS file, Tony Prisk should be the
> > > > > > person to pick them up, but he was not the recipient of the
> > > > > > mail.
> > > > > > 
> > > > > >   Arnd
> > > > > 
> > > > > Thanks for the tip. Tony probably need to add these files to
> > > > > his list of maintained files. get_maintainer.pl doesn't
> > > > > mention him.
> > > > > 
> > > > > Roman
> > > > 
> > > > Arnd,
> > > > 
> > > > No response yet from Tony for over a month.
> > > > 
> > > > Roman  
> > > 
> > > Ping. At least two patch sets for vt8500 are waiting to be picked
> > > up. vt8500 maintainer is inactive for over a year.  
> > 
> > I seem to have lost the original mails now, as it's been a while.
> > Can you send the entire series of patches to a...@kernel.org
> > please?  
> 
> To clarify, please first make sure they still apply cleanly on a
> recent kernel, then send them to a...@kernel.org with all the involved
> parties and the mailing list(s) in Cc.
> 

Arnd,
These series are still applicable (for next-20151231). I resent both
SDHC and clocksource series, and got my emails returned with:

>  (expanded from ): host
>mx0.arm.linux.org.uk[78.32.30.218] said: 550-We do not accept
> v1...@mail.ru from mail.kernel.org - please use mail.ru's 550 mail
> servers (in reply to RCPT TO command)

Please confirm what you received and let me know if I must resend again.

Happy New Year,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-12-31 Thread Roman Volkov
From: Roman Volkov 

This patch set enables SD controller support for WM8650 and
fixes minor errors in WM8505 Device Tree file.

Changes in v3:
1. Add minor fixes for WM8505 SDHC node

Tested on both WM8505 and WM8650.

Roman Volkov (2):
  dts: vt8500: Add SDHC node to DTS file for WM8650
  dts: vt8500: Fix errors in SDHC node for WM8505

 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
Hi maintainers, I see my previous versions were not applied. Could this
little patch set be applied for the linux-next? I don't think this is new
functionality, this must be considered as bugfix for existing Device Tree.

Any other suggestions?

2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 2/2] dts: vt8500: Fix errors in SDHC node for WM8505

2015-12-31 Thread Roman Volkov
From: Roman Volkov 

According to datasheet, the registers space of SDHC controller is 1Kb,
not '0x1000', the correct value should be '0x400'. Bracket interrupt
numbers individually per recommendations.

Signed-off-by: Roman Volkov 
---
 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index a1a854b..e9ef539 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -281,8 +281,8 @@
 
sdhc@d800a000 {
compatible = "wm,wm8505-sdhc";
-   reg = <0xd800a000 0x1000>;
-   interrupts = <20 21>;
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
clocks = <&clksdhc>;
bus-width = <4>;
};
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 1/2] dts: vt8500: Add SDHC node to DTS file for WM8650

2015-12-31 Thread Roman Volkov
From: Roman Volkov 

Since WM8650 has the same 'WMT' SDHC controller as WM8505, and the driver
is already in the kernel, this node enables the controller support for
WM8650

Signed-off-by: Roman Volkov 
Reviewed-by: Alexey Charkov 
---
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index b1c59a7..e12213d 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -187,6 +187,15 @@
interrupts = <43>;
};
 
+   sdhc@d800a000 {
+   compatible = "wm,wm8505-sdhc";
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
+   clocks = <&clksdhc>;
+   bus-width = <4>;
+   sdon-inverted;
+   };
+
fb: fb@d8050800 {
compatible = "wm,wm8505-fb";
reg = <0xd8050800 0x200>;
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-12-23 Thread Roman Volkov
В Sat, 4 Apr 2015 15:27:20 +0300
Roman Volkov  пишет:

> В Sun, 1 Mar 2015 23:39:11 +0300
> Roman Volkov  пишет:
> 
> > В Sun, 01 Mar 2015 20:52:55 +0100
> > Arnd Bergmann  пишет:
> >   
> > > On Sunday 01 March 2015 19:06:45 Roman Volkov wrote:  
> > > > This patch set enables SD controller support for WM8650 and
> > > > fixes minor errors in WM8505 Device Tree file.
> > > > 
> > > > Changes in v3:
> > > > 1. Add minor fixes for WM8505 SDHC node
> > > > 
> > > > Tested on both WM8505 and WM8650.
> > > > 
> > > > Roman Volkov (2):
> > > >   dts: vt8500: Add SDHC node to DTS file for WM8650
> > > >   dts: vt8500: Fix errors in SDHC node for WM8505
> > > > 
> > > >  arch/arm/boot/dts/wm8505.dtsi | 4 ++--
> > > >  arch/arm/boot/dts/wm8650.dtsi | 9 +
> > > >  2 files changed, 11 insertions(+), 2 deletions(-)
> > > > 
> > > > -- 
> > > > Hi maintainers, I see my previous versions were not applied.
> > > > Could this little patch set be applied for the linux-next? I
> > > > don't think this is new functionality, this must be considered
> > > > as bugfix for existing Device Tree.
> > > > 
> > > > Any other suggestions?  
> > > 
> > > According to the MAINTAINERS file, Tony Prisk should be the person
> > > to pick them up, but he was not the recipient of the mail.
> > > 
> > >   Arnd  
> > 
> > Thanks for the tip. Tony probably need to add these files to his
> > list of maintained files. get_maintainer.pl doesn't mention him.
> > 
> > Roman  
> 
> Arnd,
> 
> No response yet from Tony for over a month.
> 
> Roman

Ping. At least two patch sets for vt8500 are waiting to be picked up.
vt8500 maintainer is inactive for over a year.

Regards,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/4] i8042: Kernel configuration for OF/FDT support

2015-07-05 Thread Roman Volkov
i8042_of.h should be included when CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and
CONFIG_USE_OF are selected. Kconfig is not modified.

Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index fc080be..55fc856 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -28,6 +28,9 @@
 #include "i8042-x86ia64io.h"
 #elif defined(CONFIG_UNICORE32)
 #include "i8042-unicore32io.h"
+#elif defined(CONFIG_ARCH_MIGHT_HAVE_PC_SERIO) && defined(CONFIG_USE_OF)
+#define SERIO_I8042_OF
+#include "i8042-of.h"
 #else
 #include "i8042-io.h"
 #endif
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 3/4] i8042: Add OF/FDT support to the driver

2015-07-05 Thread Roman Volkov
Original driver should be modified to support OF/FDT bindings. The
platform_create_bundle() function should be removed when compiled for
OF-capable machines, since the device tree is already created by the
platform code. The driver should also contain the OF match table and
call platform-specific probe/remove functions.

Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.c | 43 ++-
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index cb5ece7..ec58af1 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1442,8 +1442,27 @@ static int __init i8042_probe(struct platform_device 
*dev)
 {
int error;
 
-   i8042_platform_device = dev;
+   if (i8042_platform_device) {
+   printk("%s: multiple controllers found, ignoring '%s'\n",
+   __func__, dev->name);
+   return 0;
+   }
+#ifdef SERIO_I8042_OF
+   if (!dev->dev.of_node) {
+   printk("%s: non-OF device found, ignoring '%s'\n",
+   __func__, dev->name);
+   return 0;
+   }
 
+   error = i8042_platform_probe(dev);
+   if (error)
+   return error;
+#endif
+   error = i8042_controller_check();
+   if (error)
+   return error;
+
+   i8042_platform_device = dev;
if (i8042_reset) {
error = i8042_controller_selftest();
if (error)
@@ -1488,9 +1507,17 @@ static int __init i8042_probe(struct platform_device 
*dev)
 
 static int i8042_remove(struct platform_device *dev)
 {
+   if (dev != i8042_platform_device) {
+   dbg("%s: ignoring device %s\n", __func__, dev->name);
+   return 0;
+   }
+
i8042_unregister_ports();
i8042_free_irqs();
i8042_controller_reset(false);
+#ifdef SERIO_I8042_OF
+   i8042_platform_remove(dev);
+#endif
i8042_platform_device = NULL;
 
return 0;
@@ -1502,6 +1529,9 @@ static struct platform_driver i8042_driver = {
 #ifdef CONFIG_PM
.pm = &i8042_pm_ops,
 #endif
+#ifdef SERIO_I8042_OF
+   .of_match_table = i8042_of_match,
+#endif
},
.remove = i8042_remove,
.shutdown   = i8042_shutdown,
@@ -1514,15 +1544,16 @@ static int __init i8042_init(void)
 
dbg_init();
 
+   i8042_platform_device = NULL;
err = i8042_platform_init();
if (err)
return err;
 
-   err = i8042_controller_check();
-   if (err)
-   goto err_platform_exit;
-
+#ifdef SERIO_I8042_OF
+   pdev = ERR_PTR(platform_driver_probe(&i8042_driver, i8042_probe));
+#else
pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, 
NULL, 0);
+#endif
if (IS_ERR(pdev)) {
err = PTR_ERR(pdev);
goto err_platform_exit;
@@ -1539,7 +1570,9 @@ static int __init i8042_init(void)
 
 static void __exit i8042_exit(void)
 {
+#ifndef SERIO_I8042_OF
platform_device_unregister(i8042_platform_device);
+#endif
platform_driver_unregister(&i8042_driver);
i8042_platform_exit();
 
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 4/4] Documentation: Add 'intel,8042' FDT bindings

2015-07-05 Thread Roman Volkov
Add a documentation file for the new OF/FDT binding for the i8042 interface.

Signed-off-by: Roman Volkov 
---
 .../devicetree/bindings/serio/intel,8042.txt   | 82 ++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serio/intel,8042.txt

diff --git a/Documentation/devicetree/bindings/serio/intel,8042.txt 
b/Documentation/devicetree/bindings/serio/intel,8042.txt
new file mode 100644
index 000..c2eb26f
--- /dev/null
+++ b/Documentation/devicetree/bindings/serio/intel,8042.txt
@@ -0,0 +1,82 @@
+* Intel 8042 interface
+
+This interface has the long history on various non-x86 platforms. The
+binding is based on the SPARC and PowerPC implementations, compatible to
+Open Firmware. The 'compatible' property has been added to make the binding
+compatible to ePAPR.
+
+Required properties:
+- #address-cells: Must be <1>, since the address for input devices is virtual.
+
+- #size-cells: Must be <0>, since the size is not applicable for the virtual
+  address.
+
+- compatible: Should be "intel,8042".
+
+- reg: Specifies the base address and size of the interface registers in the
+  following order:
+  - DATA: The serial data buffer address.
+  - COMMAND/STATUS: Has the status of the keyboard controller and interface,
+allows to send commands to the controller.
+
+Optional properties:
+- interrupts: One (keyboard) or two (keyboard and auxiliary) interrupts.
+
+- interrupt-names: names of interrupts, must be "kbd", "aux". If not specified,
+  the first interrupt is "kbd", and the second is "aux".
+
+Child nodes:
+The i8042 interface may control input devices such as keyboard and mouse. Each
+input device is represented by a child node. The input device could be
+identified by the 'compatible' property or the node name (obsolete).
+
+Required properties:
+- reg: Specifies the device virtual address. These numbers should not be
+  duplicated.
+- compatible: should be "pnpPNP,303" for keyboard, and "pnpPNP,f03" for mouse.
+
+Optional properties:
+- interrupts: Specifies the interrupt number for the device. Overwrites the
+  value from the parent node.
+
+Examples:
+
+// Most preferred way
+ps2@d8008800 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "intel,8042";
+   reg = <0xd8008800 0x1>, <0xd8008804 0x1>;
+   interrupts = <23>, <4>;
+   interrupt-names = "kbd", "aux";
+
+   keyboard@0 {
+   reg = <0x0>;
+   compatible = "pnpPNP,303";
+   };
+
+   mouse@1 {
+   reg = <0x1>;
+   compatible = "pnpPNP,f03";
+   };
+};
+
+// PowerPC
+i8042@60 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0x1 0x60 0x1 0x1 0x64 0x1>;
+   interrupts = <1 3 12 3>;
+   interrupt-parent = <&i8259>;
+   // 'compatible' property has to be added by the platform code
+
+   keyboard@0 {
+   reg = <0x0>;
+   compatible = "pnpPNP,303";
+   };
+
+   mouse@1 {
+   reg = <0x1>;
+   compatible = "pnpPNP,f03";
+   };
+};
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/4] i8042: Add i8042_of.h header

2015-07-05 Thread Roman Volkov
This file contains OF/FDT parsing code, based on older implementations
for SPARC and PowerPC. Currently it can be used to support the i8042
interface on the vt8500 boards. This code can be reused with some
workarounds to support the older SPARC machines. For example, older
machines do not have the 'compatible' property in the device tree,
required by the newer standards. A workaround would be to manually
insert these properties by the platform code.

Signed-off-by: Roman Volkov 
Signed-off-by: Tony Prisk 
---
 drivers/input/serio/i8042-of.h | 168 +
 1 file changed, 168 insertions(+)
 create mode 100644 drivers/input/serio/i8042-of.h

diff --git a/drivers/input/serio/i8042-of.h b/drivers/input/serio/i8042-of.h
new file mode 100644
index 000..3b95b86
--- /dev/null
+++ b/drivers/input/serio/i8042-of.h
@@ -0,0 +1,168 @@
+#ifndef _I8042_OF_H
+#define _I8042_OF_H
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * 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.
+ */
+static void __iomem *i8042_data;
+static void __iomem *i8042_ctrl;
+#define I8042_DATA_REG i8042_data
+#define I8042_COMMAND_REG  i8042_ctrl
+#define I8042_STATUS_REG   i8042_ctrl
+
+/*
+ * Names.
+ */
+#define I8042_KBD_PHYS_DESC"i8042/serio0"
+#define I8042_AUX_PHYS_DESC"i8042/serio1"
+#define I8042_MUX_PHYS_DESC"i8042/serio%d"
+
+#define OBP_PS2KBD_NAME1   "kb_ps2"
+#define OBP_PS2KBD_NAME2   "keyboard"
+#define OBP_PS2MS_NAME1"kdmouse"
+#define OBP_PS2MS_NAME2"mouse"
+
+/*
+ * IRQs.
+ */
+static int i8042_kbd_irq;
+static int i8042_aux_irq;
+#define I8042_KBD_IRQ  i8042_kbd_irq
+#define I8042_AUX_IRQ  i8042_aux_irq
+
+static inline int i8042_read_data(void)
+{
+   return readb(I8042_DATA_REG);
+}
+
+static inline void i8042_write_data(int val)
+{
+   writeb(val, I8042_DATA_REG);
+}
+
+static inline int i8042_read_status(void)
+{
+   return readb(I8042_STATUS_REG);
+}
+
+static inline void i8042_write_command(int val)
+{
+   writeb(val, I8042_COMMAND_REG);
+}
+
+/*
+ * Device Tree/platform code
+ */
+static int __init i8042_platform_probe_subdevice(struct platform_device *pdev,
+   struct device_node *psub)
+{
+   if (!pdev || !psub)
+   return -EINVAL;
+
+   if (of_device_is_compatible(psub, "pnpPNP,303") ||
+   !strcmp(psub->name, OBP_PS2KBD_NAME1) ||
+   !strcmp(psub->name, OBP_PS2KBD_NAME2)) {
+   i8042_kbd_irq = irq_of_parse_and_map(psub, 0);
+   if (i8042_kbd_irq <= 0)
+   i8042_kbd_irq = platform_get_irq_byname(pdev, "kbd");
+   if (i8042_kbd_irq <= 0)
+   i8042_kbd_irq = platform_get_irq(pdev, 0);
+   return 0;
+   }
+
+   if (of_device_is_compatible(psub, "pnpPNP,f03") ||
+   !strcmp(psub->name, OBP_PS2MS_NAME1) ||
+   !strcmp(psub->name, OBP_PS2MS_NAME2)) {
+   i8042_aux_irq = irq_of_parse_and_map(psub, 0);
+   if (i8042_aux_irq <= 0)
+   i8042_aux_irq = platform_get_irq_byname(pdev, "aux");
+   if (i8042_aux_irq <= 0)
+   i8042_aux_irq = platform_get_irq(pdev, 1);
+   return 0;
+   }
+
+   return -ENODEV;
+}
+
+static int __init i8042_platform_probe(struct platform_device *pdev)
+{
+   struct device_node *node;
+   struct resource *res;
+
+   if (i8042_data || i8042_ctrl)
+   return -EBUSY;
+
+   node = pdev->dev.of_node;
+   if (!node)
+   return -EINVAL;
+
+   node = node->child;
+   while (node) {
+   i8042_platform_probe_subdevice(pdev, node);
+   node = node->sibling;
+   }
+
+   if (i8042_kbd_irq <= 0)
+   i8042_nokbd = true;
+   if (i8042_aux_irq <= 0)
+   i8042_noaux = true;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   i8042_data = devm_ioremap_resource(&pdev->dev, res);
+   if (IS_ERR(i8042_data))
+   return PTR_ERR(i8042_data);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   i8042_ctrl = devm_ioremap_resource(&pdev->dev, res);
+   if (IS_ERR(i8042_ctrl)) {
+   devm_iounmap(&pdev->dev, i8042_data);
+   return PTR_ERR(i8042_ctrl);
+   }
+
+   return 0;
+}
+
+static int i8042_platform_remove(struct platform_device *pdev)
+{
+   if (i8042_data) {
+   if (!IS_ERR(i8042_data))
+   devm_iou

[PATCH v4 0/4] FDT support for i8042 driver

2015-07-05 Thread Roman Volkov
The i8042 interface is used not only on the x86 architecture. Some of
non-x86 architectures are using Open Firmware device tree, like SPARC
and PowerPC. There is also non-x86 platforms with the FDT support, such
as ARM SoCs. There is no code in Linux to support i8042-capable input
devices on these newer platforms.

This patch creates one more file (i8042-of.h), with OF parsing code
for the ePAPR-compatible binding with the 'compatible' property. The
binding is based on existing OF code for older platforms, making it
possible to reuse this code for these platforms.

 v2:
 -Changes in the documentation.
 -Errors fixed in the initialization function.
 -Redundant parameters removed from Device Tree bindings (init-reset, etc.).

 v3:
 -Reduced amount of 'ifdefs' in the i8042.c file. Initialization order
is now the same for all architectures.

 Warning: the change in v3 is more controversial and needs more testing
 since affects all architectures which use the driver. Please give
 information regarding required steps to get this patch accepted. Would
 be great to find testers to get additional tested-by records.

 v4:
 -Rename i8042-dt.h to i8042-of.h, rewrite init/probe/remove functions with
OF code to be compatible with SPARC/PowerPC.
 -Add MODULE_DEVICE_TABLE (it was a mistake to forget about it)
 -Remove 'command-reg', 'status-reg', 'data-reg' from the binding; it is not
required for now.
 -Yet another variant of changes in i8042.c. Unfortunately, it is not possible
to avoid these changes.
 -Move the documentation file into the right place
(thanks to Hans de Goede for the hint)
 -Change the order of patches
 Tested on: x86, ARM-vt8500, both as a module\built-in.

Roman Volkov (4):
  i8042: Add i8042_of.h header
  i8042: Kernel configuration for OF/FDT support
  i8042: Add OF/FDT support to the driver
  Documentation: Add 'intel,8042' FDT bindings

 .../devicetree/bindings/serio/intel,8042.txt   |  82 ++
 drivers/input/serio/i8042-of.h | 168 +
 drivers/input/serio/i8042.c|  43 +-
 drivers/input/serio/i8042.h|   3 +
 4 files changed, 291 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serio/intel,8042.txt
 create mode 100644 drivers/input/serio/i8042-of.h

-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/5] i8042: Add i8042_dt.h glue for DT support

2015-06-13 Thread Roman Volkov
Something prevents me from following the thread, replying to myself.

> В Sat, 14 Mar 2015 20:20:38 -0700
> Dmitry Torokhov  wrote:
>   
> > 
> > Hi Roman,
> > 
> > On Mon, Feb 16, 2015 at 12:11:43AM +0300, Roman Volkov wrote:
> > > Documentation for 'intel,8042' DT compatible node.
> > > 
> > > Signed-off-by: Tony Prisk 
> > > Signed-off-by: Roman Volkov 
> > > ---
> > >  .../devicetree/bindings/input/intel-8042.txt   | 26
> > > ++ 1 file changed, 26 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/input/intel-8042.txt
> > > 
> > > diff --git
> > > a/Documentation/devicetree/bindings/input/intel-8042.txt
> > > b/Documentation/devicetree/bindings/input/intel-8042.txt new file
> > > mode 100644 index 000..ab8a3e0 --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/input/intel-8042.txt
> > > @@ -0,0 +1,26 @@
> > > +Intel 8042 Keyboard Controller
> > > +
> > > +Required properties:
> > > +- compatible: should be "intel,8042"
> > > +- regs: memory for keyboard controller
> > > +- interrupts: usually, two interrupts should be specified
> > > (keyboard and aux).
> > > + However, only one interrupt is also allowed in case of
> > > absence of the
> > > + physical port in the controller. The i8042 driver must be
> > > loaded with
> > > + nokbd/noaux option in this case.
> > > +- interrupt-names: interrupt names corresponding to numbers in
> > > the list.
> > > + "kbd" is the keyboard interrupt and "aux" is the
> > > auxiliary (mouse)
> > > + interrupt.
> > > +- command-reg: offset in memory for command register
> > > +- status-reg: offset in memory for status register
> > > +- data-reg: offset in memory for data register
> > > +
> > > +Example:
> > > + i8042@d8008800 {
> > > + compatible = "intel,8042";
> > > + regs = <0xd8008800 0x100>;
> > > + interrupts = <23>, <4>;
> > > + interrupt-names = "kbd", "aux";
> > > + command-reg = <0x04>;
> > > + status-reg = <0x04>;
> > > + data-reg = <0x00>;
> > > + };
> > 
> > No, we already have existing OF bindings for i8042 on sparc and
> > powerpc, I do not think we need to invent a brand new one.
> > 
> > Thanks.
> > 

I have looked more into that header (i8042-sparcio.h). Probably 8042 is
broken for SPARCs, because there is the platform_driver registered twice
with the same name "i8042". One driver is registered by
platform_create_bundle() from i8042.c and another from
platform_driver_register() from the i8042_sparcio.h. Kernel prints a
message "Error: Driver 'i8042' is already registered, aborting...".

I have not tested SPARC version of the kernel, just used the same code
for ARM, to rewrite my patch set.

There is no bindings at all for i8042, because a binding requires
the 'compatible' property to be defined, according to ePAPR. In the
SPARC header there is an ancient surrogate with searching by name
instead of the 'compatible' property (I understand, no standards were
defined for that hardware those days).

Regards,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/5] i8042: intel-8042 DT documentation

2015-05-31 Thread Roman Volkov
В Sat, 14 Mar 2015 20:20:38 -0700
Dmitry Torokhov  wrote:

> 
> Hi Roman,
> 
> On Mon, Feb 16, 2015 at 12:11:43AM +0300, Roman Volkov wrote:  
> > Documentation for 'intel,8042' DT compatible node.
> > 
> > Signed-off-by: Tony Prisk 
> > Signed-off-by: Roman Volkov 
> > ---
> >  .../devicetree/bindings/input/intel-8042.txt   | 26
> > ++ 1 file changed, 26 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/input/intel-8042.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/input/intel-8042.txt
> > b/Documentation/devicetree/bindings/input/intel-8042.txt new file
> > mode 100644 index 000..ab8a3e0
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/input/intel-8042.txt
> > @@ -0,0 +1,26 @@
> > +Intel 8042 Keyboard Controller
> > +
> > +Required properties:
> > +- compatible: should be "intel,8042"
> > +- regs: memory for keyboard controller
> > +- interrupts: usually, two interrupts should be specified
> > (keyboard and aux).
> > +   However, only one interrupt is also allowed in case of
> > absence of the
> > +   physical port in the controller. The i8042 driver must be
> > loaded with
> > +   nokbd/noaux option in this case.
> > +- interrupt-names: interrupt names corresponding to numbers in the
> > list.
> > +   "kbd" is the keyboard interrupt and "aux" is the auxiliary
> > (mouse)
> > +   interrupt.
> > +- command-reg: offset in memory for command register
> > +- status-reg: offset in memory for status register
> > +- data-reg: offset in memory for data register
> > +
> > +Example:
> > +   i8042@d8008800 {
> > +   compatible = "intel,8042";
> > +   regs = <0xd8008800 0x100>;
> > +   interrupts = <23>, <4>;
> > +   interrupt-names = "kbd", "aux";
> > +   command-reg = <0x04>;
> > +   status-reg = <0x04>;
> > +   data-reg = <0x00>;
> > +   };  
> 
> No, we already have existing OF bindings for i8042 on sparc and
> powerpc, I do not think we need to invent a brand new one.
> 
> Thanks.
>   

Hi Dmitry,

I see some OF code in i8042-sparcio.h file. There are node definitions
like "kb_ps2", "keyboard", "kdmouse", "mouse". Are these documented
somewhere?

Great if vt8500 is not unique with OF bindings for i8042. The code from
sparc even looks compatible, only register offsets are hardcoded for
specific machine. Is it possible to read offsets from Device Tree using
these existing bindings without dealing with the kernel configuration?

Regards,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re:

2015-05-31 Thread Roman Volkov
В Sat, 14 Mar 2015 20:20:38 -0700
Dmitry Torokhov  wrote:

> 
> Hi Roman,
> 
> On Mon, Feb 16, 2015 at 12:11:43AM +0300, Roman Volkov wrote:
> > Documentation for 'intel,8042' DT compatible node.
> > 
> > Signed-off-by: Tony Prisk 
> > Signed-off-by: Roman Volkov 
> > ---
> >  .../devicetree/bindings/input/intel-8042.txt   | 26
> > ++ 1 file changed, 26 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/input/intel-8042.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/input/intel-8042.txt
> > b/Documentation/devicetree/bindings/input/intel-8042.txt new file
> > mode 100644 index 000..ab8a3e0
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/input/intel-8042.txt
> > @@ -0,0 +1,26 @@
> > +Intel 8042 Keyboard Controller
> > +
> > +Required properties:
> > +- compatible: should be "intel,8042"
> > +- regs: memory for keyboard controller
> > +- interrupts: usually, two interrupts should be specified
> > (keyboard and aux).
> > +   However, only one interrupt is also allowed in case of
> > absence of the
> > +   physical port in the controller. The i8042 driver must be
> > loaded with
> > +   nokbd/noaux option in this case.
> > +- interrupt-names: interrupt names corresponding to numbers in the
> > list.
> > +   "kbd" is the keyboard interrupt and "aux" is the auxiliary
> > (mouse)
> > +   interrupt.
> > +- command-reg: offset in memory for command register
> > +- status-reg: offset in memory for status register
> > +- data-reg: offset in memory for data register
> > +
> > +Example:
> > +   i8042@d8008800 {
> > +   compatible = "intel,8042";
> > +   regs = <0xd8008800 0x100>;
> > +   interrupts = <23>, <4>;
> > +   interrupt-names = "kbd", "aux";
> > +   command-reg = <0x04>;
> > +   status-reg = <0x04>;
> > +   data-reg = <0x00>;
> > +   };
> 
> No, we already have existing OF bindings for i8042 on sparc and
> powerpc, I do not think we need to invent a brand new one.
> 
> Thanks.
> 

Hi Dmitry,

I see some OF code in i8042-sparcio.h file. There are node definitions
like "kb_ps2", "keyboard", "kdmouse", "mouse". Are these documented
somewhere?

Great if vt8500 is not unique with OF bindings for i8042. The code from
sparc even looks compatible, only register offsets are hardcoded for
specific machine. Is it possible to read offsets from Device Tree using
these existing bindings without dealing with the kernel configuration?

Regards,
Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-04-04 Thread Roman Volkov
В Sun, 1 Mar 2015 23:39:11 +0300
Roman Volkov  пишет:

> В Sun, 01 Mar 2015 20:52:55 +0100
> Arnd Bergmann  пишет:
> 
> > On Sunday 01 March 2015 19:06:45 Roman Volkov wrote:
> > > This patch set enables SD controller support for WM8650 and
> > > fixes minor errors in WM8505 Device Tree file.
> > > 
> > > Changes in v3:
> > > 1. Add minor fixes for WM8505 SDHC node
> > > 
> > > Tested on both WM8505 and WM8650.
> > > 
> > > Roman Volkov (2):
> > >   dts: vt8500: Add SDHC node to DTS file for WM8650
> > >   dts: vt8500: Fix errors in SDHC node for WM8505
> > > 
> > >  arch/arm/boot/dts/wm8505.dtsi | 4 ++--
> > >  arch/arm/boot/dts/wm8650.dtsi | 9 +
> > >  2 files changed, 11 insertions(+), 2 deletions(-)
> > > 
> > > -- 
> > > Hi maintainers, I see my previous versions were not applied. Could
> > > this little patch set be applied for the linux-next? I don't think
> > > this is new functionality, this must be considered as bugfix for
> > > existing Device Tree.
> > > 
> > > Any other suggestions?
> > 
> > According to the MAINTAINERS file, Tony Prisk should be the person
> > to pick them up, but he was not the recipient of the mail.
> > 
> > Arnd
> 
> Thanks for the tip. Tony probably need to add these files to his list
> of maintained files. get_maintainer.pl doesn't mention him.
> 
> Roman

Arnd,

No response yet from Tony for over a month.

Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 2/2] dts: vt8500: Fix errors in SDHC node for WM8505

2015-03-01 Thread Roman Volkov
According to datasheet, the registers space of SDHC controller is 1Kb,
not '0x1000', the correct value should be '0x400'. Bracket interrupt
numbers individually per recommendations.

Signed-off-by: Roman Volkov 
---
 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index a1a854b..e9ef539 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -281,8 +281,8 @@
 
sdhc@d800a000 {
compatible = "wm,wm8505-sdhc";
-   reg = <0xd800a000 0x1000>;
-   interrupts = <20 21>;
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
clocks = <&clksdhc>;
bus-width = <4>;
};
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 1/2] dts: vt8500: Add SDHC node to DTS file for WM8650

2015-03-01 Thread Roman Volkov
Since WM8650 has the same 'WMT' SDHC controller as WM8505, and the driver
is already in the kernel, this node enables the controller support for
WM8650

Signed-off-by: Roman Volkov 
Reviewed-by: Alexey Charkov 
---
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index b1c59a7..e12213d 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -187,6 +187,15 @@
interrupts = <43>;
};
 
+   sdhc@d800a000 {
+   compatible = "wm,wm8505-sdhc";
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
+   clocks = <&clksdhc>;
+   bus-width = <4>;
+   sdon-inverted;
+   };
+
fb: fb@d8050800 {
compatible = "wm,wm8505-fb";
reg = <0xd8050800 0x200>;
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-03-01 Thread Roman Volkov
This patch set enables SD controller support for WM8650 and
fixes minor errors in WM8505 Device Tree file.

Changes in v3:
1. Add minor fixes for WM8505 SDHC node

Tested on both WM8505 and WM8650.

Roman Volkov (2):
  dts: vt8500: Add SDHC node to DTS file for WM8650
  dts: vt8500: Fix errors in SDHC node for WM8505

 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
Hi maintainers, I see my previous versions were not applied. Could this
little patch set be applied for the linux-next? I don't think this is new
functionality, this must be considered as bugfix for existing Device Tree.

Any other suggestions?

2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-03-01 Thread Roman Volkov
В Sun, 01 Mar 2015 20:52:55 +0100
Arnd Bergmann  пишет:

> On Sunday 01 March 2015 19:06:45 Roman Volkov wrote:
> > This patch set enables SD controller support for WM8650 and
> > fixes minor errors in WM8505 Device Tree file.
> > 
> > Changes in v3:
> > 1. Add minor fixes for WM8505 SDHC node
> > 
> > Tested on both WM8505 and WM8650.
> > 
> > Roman Volkov (2):
> >   dts: vt8500: Add SDHC node to DTS file for WM8650
> >   dts: vt8500: Fix errors in SDHC node for WM8505
> > 
> >  arch/arm/boot/dts/wm8505.dtsi | 4 ++--
> >  arch/arm/boot/dts/wm8650.dtsi | 9 +
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> > 
> > -- 
> > Hi maintainers, I see my previous versions were not applied. Could
> > this little patch set be applied for the linux-next? I don't think
> > this is new functionality, this must be considered as bugfix for
> > existing Device Tree.
> > 
> > Any other suggestions?
> 
> According to the MAINTAINERS file, Tony Prisk should be the person to
> pick them up, but he was not the recipient of the mail.
> 
>   Arnd

Thanks for the tip. Tony probably need to add these files to his list
of maintained files. get_maintainer.pl doesn't mention him.

Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/2] dts: vt8500: Add SDHC node to DTS file for WM8650

2015-03-01 Thread Roman Volkov
В Sun, 01 Mar 2015 20:59:13 +0300
Sergei Shtylyov  пишет:

> On 3/1/2015 7:06 PM, Roman Volkov wrote:
> 
> > Since WM8650 has the same 'WMT' SDHC controller as WM8505, and the
> > driver is already in the kernel, this node enables the controller
> > support for WM8650
> 
> > Signed-off-by: Roman Volkov 
> > Reviewed-by: Alexey Charkov 
> > ---
> >   arch/arm/boot/dts/wm8650.dtsi | 9 +
> >   1 file changed, 9 insertions(+)
> 
> > diff --git a/arch/arm/boot/dts/wm8650.dtsi
> > b/arch/arm/boot/dts/wm8650.dtsi index b1c59a7..e12213d 100644
> > --- a/arch/arm/boot/dts/wm8650.dtsi
> > +++ b/arch/arm/boot/dts/wm8650.dtsi
> > @@ -187,6 +187,15 @@
> > interrupts = <43>;
> > };
> >
> > +   sdhc@d800a000 {
> 
> According to the ePAPR standard, the device nodes should have
> generic names according to their functions, so this node should be
> named just "sd@d800a000".
> 
> WBR, Sergei
> 

Sergei,

Why not "sdmmc" or "sdhci" or "sdio" then? It would be great to name
nodes in same way, but there is no exact requirement in ePAPR v1.1
regarding SD/MMC controllers. Also, in Linux I don't see that someone
strictly follows this requirement. This renaming will affect driver,
since .compatible strings likely also need changing.

Roman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] dts: vt8500: Add SDHC node to DTS file for WM8650

2015-03-01 Thread Roman Volkov
Since WM8650 has the same 'WMT' SDHC controller as WM8505, and the driver
is already in the kernel, this node enables the controller support for
WM8650

Signed-off-by: Roman Volkov 
Reviewed-by: Alexey Charkov 
---
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index b1c59a7..e12213d 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -187,6 +187,15 @@
interrupts = <43>;
};
 
+   sdhc@d800a000 {
+   compatible = "wm,wm8505-sdhc";
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
+   clocks = <&clksdhc>;
+   bus-width = <4>;
+   sdon-inverted;
+   };
+
fb: fb@d8050800 {
compatible = "wm,wm8505-fb";
reg = <0xd8050800 0x200>;
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/2] dts: vt8500: Fix errors in SDHC node for WM8505

2015-03-01 Thread Roman Volkov
According to datasheet, the registers space of SDHC controller is 1Kb,
not '0x1000', the correct value should be '0x400'. Bracket interrupt
numbers individually per recommendations.

Signed-off-by: Roman Volkov 
---
 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index a1a854b..e9ef539 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -281,8 +281,8 @@
 
sdhc@d800a000 {
compatible = "wm,wm8505-sdhc";
-   reg = <0xd800a000 0x1000>;
-   interrupts = <20 21>;
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
clocks = <&clksdhc>;
bus-width = <4>;
};
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/2] WM8505/WM8650 DT fixes for SD card controller

2015-03-01 Thread Roman Volkov
This patch set enables SD controller support for WM8650 and
fixes minor errors in WM8505 Device Tree file.

Changes in v3:
1. Add minor fixes for WM8505 SDHC node

Tested on both WM8505 and WM8650.

Roman Volkov (2):
  dts: vt8500: Add SDHC node to DTS file for WM8650
  dts: vt8500: Fix errors in SDHC node for WM8505

 arch/arm/boot/dts/wm8505.dtsi | 4 ++--
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
Hi maintainers, I see my previous versions were not applied. Could this
little patch set be applied for the linux-next? I don't think this is new
functionality, this must be considered as bugfix for existing Device Tree.

Any other suggestions?

2.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/5] i8042: Prepare i8042 driver for DT support

2015-02-15 Thread Roman Volkov
Move i8042_platform_init() call from i8042_init() to i8042_probe() to
pass the platform_device structure pointer, since the former function
now requires this argument.

Use platform_create_bundle() when there is no DT support in the kernel,
and platform_driver_probe() otherwise, which does not create a device.

Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.c | 46 -
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 2f09062..96b62fd 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1422,6 +1422,18 @@ static int __init i8042_probe(struct platform_device 
*dev)
 
i8042_platform_device = dev;
 
+#ifdef SERIO_I8042_DT
+   error = i8042_platform_init(dev);
+#else
+   error = i8042_platform_init();
+#endif
+   if (error)
+   return error;
+
+   error = i8042_controller_check();
+   if (error)
+   goto out_platform_exit;
+
if (i8042_reset) {
error = i8042_controller_selftest();
if (error)
@@ -1440,13 +1452,13 @@ static int __init i8042_probe(struct platform_device 
*dev)
if (!i8042_noaux) {
error = i8042_setup_aux();
if (error && error != -ENODEV && error != -EBUSY)
-   goto out_fail;
+   goto out_res_free;
}
 
if (!i8042_nokbd) {
error = i8042_setup_kbd();
if (error)
-   goto out_fail;
+   goto out_res_free;
}
 /*
  * Ok, everything is ready, let's register all serio ports
@@ -1455,11 +1467,13 @@ static int __init i8042_probe(struct platform_device 
*dev)
 
return 0;
 
- out_fail:
+ out_res_free:
i8042_free_aux_ports(); /* in case KBD failed but AUX not */
i8042_free_irqs();
i8042_controller_reset(false);
i8042_platform_device = NULL;
+ out_platform_exit:
+   i8042_platform_exit();
 
return error;
 }
@@ -1498,36 +1512,26 @@ static struct platform_driver i8042_driver = {
 static int __init i8042_init(void)
 {
struct platform_device *pdev;
-   int err;
 
dbg_init();
-
-   err = i8042_platform_init();
-   if (err)
-   return err;
-
-   err = i8042_controller_check();
-   if (err)
-   goto err_platform_exit;
-
+#ifdef SERIO_I8042_DT
+   pdev = ERR_PTR(platform_driver_probe(&i8042_driver, i8042_probe));
+#else
pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, 
NULL, 0);
-   if (IS_ERR(pdev)) {
-   err = PTR_ERR(pdev);
-   goto err_platform_exit;
-   }
+#endif
+   if (IS_ERR(pdev))
+   return PTR_ERR(pdev);
 
panic_blink = i8042_panic_blink;
 
return 0;
-
- err_platform_exit:
-   i8042_platform_exit();
-   return err;
 }
 
 static void __exit i8042_exit(void)
 {
+#ifndef SERIO_I8042_DT
platform_device_unregister(i8042_platform_device);
+#endif
platform_driver_unregister(&i8042_driver);
i8042_platform_exit();
 
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 3/5] i8042: Add OF match table

2015-02-15 Thread Roman Volkov
The OF device table allows the platform_driver_probe() function to
automatically match device and parse the DT node.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 986a71c..2f09062 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1474,12 +1474,22 @@ static int i8042_remove(struct platform_device *dev)
return 0;
 }
 
+#ifdef SERIO_I8042_DT
+static struct of_device_id i8042_dt_ids[] = {
+   { .compatible = "intel,8042" },
+   { /* Sentinel */ },
+};
+#endif
+
 static struct platform_driver i8042_driver = {
.driver = {
.name   = "i8042",
 #ifdef CONFIG_PM
.pm = &i8042_pm_ops,
 #endif
+#ifdef SERIO_I8042_DT
+   .of_match_table = i8042_dt_ids,
+#endif
},
.remove = i8042_remove,
.shutdown   = i8042_shutdown,
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/5] i8042: intel-8042 DT documentation

2015-02-15 Thread Roman Volkov
Documentation for 'intel,8042' DT compatible node.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 .../devicetree/bindings/input/intel-8042.txt   | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/intel-8042.txt

diff --git a/Documentation/devicetree/bindings/input/intel-8042.txt 
b/Documentation/devicetree/bindings/input/intel-8042.txt
new file mode 100644
index 000..ab8a3e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/intel-8042.txt
@@ -0,0 +1,26 @@
+Intel 8042 Keyboard Controller
+
+Required properties:
+- compatible: should be "intel,8042"
+- regs: memory for keyboard controller
+- interrupts: usually, two interrupts should be specified (keyboard and aux).
+   However, only one interrupt is also allowed in case of absence of the
+   physical port in the controller. The i8042 driver must be loaded with
+   nokbd/noaux option in this case.
+- interrupt-names: interrupt names corresponding to numbers in the list.
+   "kbd" is the keyboard interrupt and "aux" is the auxiliary (mouse)
+   interrupt.
+- command-reg: offset in memory for command register
+- status-reg: offset in memory for status register
+- data-reg: offset in memory for data register
+
+Example:
+   i8042@d8008800 {
+   compatible = "intel,8042";
+   regs = <0xd8008800 0x100>;
+   interrupts = <23>, <4>;
+   interrupt-names = "kbd", "aux";
+   command-reg = <0x04>;
+   status-reg = <0x04>;
+   data-reg = <0x00>;
+   };
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 5/5] i8042: Add i8042_dt.h glue for DT support

2015-02-15 Thread Roman Volkov
This header file designed to be similar to other glue layers found
for i8042. The difference is that interrupt numbers, device address,
and other information should be retrieved from the device tree.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042-dt.h | 104 +
 1 file changed, 104 insertions(+)
 create mode 100644 drivers/input/serio/i8042-dt.h

diff --git a/drivers/input/serio/i8042-dt.h b/drivers/input/serio/i8042-dt.h
new file mode 100644
index 000..c0b319a
--- /dev/null
+++ b/drivers/input/serio/i8042-dt.h
@@ -0,0 +1,104 @@
+#ifndef _I8042_DT_H
+#define _I8042_DT_H
+
+#include 
+#include 
+#include 
+
+/*
+ * 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.
+ */
+
+static void __iomem *i8042_base;
+static unsigned int i8042_command_reg;
+static unsigned int i8042_status_reg;
+static unsigned int i8042_data_reg;
+#define I8042_COMMAND_REG i8042_command_reg
+#define I8042_STATUS_REG i8042_status_reg
+#define I8042_DATA_REG i8042_data_reg
+
+/*
+ * Names.
+ */
+
+#define I8042_KBD_PHYS_DESC "i8042/serio0"
+#define I8042_AUX_PHYS_DESC "i8042/serio1"
+#define I8042_MUX_PHYS_DESC "i8042/serio%d"
+
+/*
+ * IRQs.
+ */
+static int i8042_kbd_irq;
+static int i8042_aux_irq;
+#define I8042_KBD_IRQ i8042_kbd_irq
+#define I8042_AUX_IRQ i8042_aux_irq
+
+static inline int i8042_read_data(void)
+{
+   return readb(i8042_base + i8042_data_reg);
+}
+
+static inline int i8042_read_status(void)
+{
+   return readb(i8042_base + i8042_status_reg);
+}
+
+static inline void i8042_write_data(int val)
+{
+   writeb(val, i8042_base + i8042_data_reg);
+}
+
+static inline void i8042_write_command(int val)
+{
+   writeb(val, i8042_base + i8042_command_reg);
+}
+
+static inline int i8042_platform_init(struct platform_device *pdev)
+{
+   struct device_node *np = pdev->dev.of_node;
+   const __be32 *regbase_p;
+   u64 regsize;
+   int status;
+
+   regbase_p = of_get_address(np, 0, ®size, NULL);
+   if (!regbase_p)
+   return -EINVAL;
+
+   status = of_property_read_u32(np, "command-reg", &i8042_command_reg);
+   if (status)
+   return status;
+
+   status = of_property_read_u32(np, "status-reg", &i8042_status_reg);
+   if (status)
+   return status;
+
+   status = of_property_read_u32(np, "data-reg", &i8042_data_reg);
+   if (status)
+   return status;
+
+   if ((i8042_command_reg >= regsize) || (i8042_status_reg >= regsize) ||
+   (i8042_data_reg >= regsize))
+   return -EINVAL;
+
+   i8042_kbd_irq = platform_get_irq_byname(pdev, "kbd");
+   i8042_aux_irq = platform_get_irq_byname(pdev, "aux");
+
+   i8042_base = ioremap((unsigned long)of_translate_address(np, regbase_p),
+   (unsigned long)regsize);
+   if (!i8042_base)
+   return -ENOMEM;
+
+   i8042_reset = true;
+
+   return 0;
+}
+
+static inline void i8042_platform_exit(void)
+{
+   if (i8042_base)
+   iounmap(i8042_base);
+}
+
+#endif
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/5] i8042: Kernel configuration handling for DT support

2015-02-15 Thread Roman Volkov
i8042_dt.h should be included when CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and
CONFIG_USE_OF are selected. It should be not necessary to create
additional options in the kernel config.

Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index fc080be..d2c1761 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -28,6 +28,9 @@
 #include "i8042-x86ia64io.h"
 #elif defined(CONFIG_UNICORE32)
 #include "i8042-unicore32io.h"
+#elif defined(CONFIG_ARCH_MIGHT_HAVE_PC_SERIO) && defined(CONFIG_USE_OF)
+#define SERIO_I8042_DT
+#include "i8042-dt.h"
 #else
 #include "i8042-io.h"
 #endif
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/5] Device Tree support for i8042 driver

2015-02-15 Thread Roman Volkov
Yes, some embedded devices still use the i8042 controller. This patch set
enables the i8042 driver to get necessary information from Device Tree
instead of using specific headers with hardcoded addresses for each
specific machine. For example, vt8500 architecture has i8042.

 v2:
 -Changes in the documentation.
 -Errors fixed in the initialization function.
 -Redundant parameters removed from Device Tree bindings (init-reset, etc.).

 v3:
 -Reduced amount of 'ifdefs' in the i8042.c file. Initialization order
is now the same for all architectures.

 Warning: the change in v3 is more controversial and needs more testing
 since affects all architectures which use the driver. Please give
 information regarding required steps to get this patch accepted. Would
 be great to find testers to get additional tested-by records.

Roman Volkov (5):
  i8042: intel-8042 DT documentation
  i8042: Kernel configuration handling for DT support
  i8042: Add OF match table
  i8042: Prepare i8042 driver for DT support
  i8042: Add i8042_dt.h glue for DT support

 .../devicetree/bindings/input/intel-8042.txt   |  26 ++
 drivers/input/serio/i8042-dt.h | 104 +
 drivers/input/serio/i8042.c|  56 ++-
 drivers/input/serio/i8042.h|   3 +
 4 files changed, 168 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/intel-8042.txt
 create mode 100644 drivers/input/serio/i8042-dt.h

-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/5] i8042: Add OF match table

2015-02-13 Thread Roman Volkov
The OF device table allows the platform_driver_probe() function to
automatically match device and parse the DT node.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 986a71c..2f09062 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1474,12 +1474,22 @@ static int i8042_remove(struct platform_device *dev)
return 0;
 }
 
+#ifdef SERIO_I8042_DT
+static struct of_device_id i8042_dt_ids[] = {
+   { .compatible = "intel,8042" },
+   { /* Sentinel */ },
+};
+#endif
+
 static struct platform_driver i8042_driver = {
.driver = {
.name   = "i8042",
 #ifdef CONFIG_PM
.pm = &i8042_pm_ops,
 #endif
+#ifdef SERIO_I8042_DT
+   .of_match_table = i8042_dt_ids,
+#endif
},
.remove = i8042_remove,
.shutdown   = i8042_shutdown,
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/5] i8042: Add i8042_dt.h glue for DT support

2015-02-13 Thread Roman Volkov
This header file designed to be similar to other glue layers found
for i8042. The difference is that interrupt numbers, device address,
and other information should be retrieved from the device tree.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042-dt.h | 104 +
 1 file changed, 104 insertions(+)
 create mode 100644 drivers/input/serio/i8042-dt.h

diff --git a/drivers/input/serio/i8042-dt.h b/drivers/input/serio/i8042-dt.h
new file mode 100644
index 000..c0b319a
--- /dev/null
+++ b/drivers/input/serio/i8042-dt.h
@@ -0,0 +1,104 @@
+#ifndef _I8042_DT_H
+#define _I8042_DT_H
+
+#include 
+#include 
+#include 
+
+/*
+ * 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.
+ */
+
+static void __iomem *i8042_base;
+static unsigned int i8042_command_reg;
+static unsigned int i8042_status_reg;
+static unsigned int i8042_data_reg;
+#define I8042_COMMAND_REG i8042_command_reg
+#define I8042_STATUS_REG i8042_status_reg
+#define I8042_DATA_REG i8042_data_reg
+
+/*
+ * Names.
+ */
+
+#define I8042_KBD_PHYS_DESC "i8042/serio0"
+#define I8042_AUX_PHYS_DESC "i8042/serio1"
+#define I8042_MUX_PHYS_DESC "i8042/serio%d"
+
+/*
+ * IRQs.
+ */
+static int i8042_kbd_irq;
+static int i8042_aux_irq;
+#define I8042_KBD_IRQ i8042_kbd_irq
+#define I8042_AUX_IRQ i8042_aux_irq
+
+static inline int i8042_read_data(void)
+{
+   return readb(i8042_base + i8042_data_reg);
+}
+
+static inline int i8042_read_status(void)
+{
+   return readb(i8042_base + i8042_status_reg);
+}
+
+static inline void i8042_write_data(int val)
+{
+   writeb(val, i8042_base + i8042_data_reg);
+}
+
+static inline void i8042_write_command(int val)
+{
+   writeb(val, i8042_base + i8042_command_reg);
+}
+
+static inline int i8042_platform_init(struct platform_device *pdev)
+{
+   struct device_node *np = pdev->dev.of_node;
+   const __be32 *regbase_p;
+   u64 regsize;
+   int status;
+
+   regbase_p = of_get_address(np, 0, ®size, NULL);
+   if (!regbase_p)
+   return -EINVAL;
+
+   status = of_property_read_u32(np, "command-reg", &i8042_command_reg);
+   if (status)
+   return status;
+
+   status = of_property_read_u32(np, "status-reg", &i8042_status_reg);
+   if (status)
+   return status;
+
+   status = of_property_read_u32(np, "data-reg", &i8042_data_reg);
+   if (status)
+   return status;
+
+   if ((i8042_command_reg >= regsize) || (i8042_status_reg >= regsize) ||
+   (i8042_data_reg >= regsize))
+   return -EINVAL;
+
+   i8042_kbd_irq = platform_get_irq_byname(pdev, "kbd");
+   i8042_aux_irq = platform_get_irq_byname(pdev, "aux");
+
+   i8042_base = ioremap((unsigned long)of_translate_address(np, regbase_p),
+   (unsigned long)regsize);
+   if (!i8042_base)
+   return -ENOMEM;
+
+   i8042_reset = true;
+
+   return 0;
+}
+
+static inline void i8042_platform_exit(void)
+{
+   if (i8042_base)
+   iounmap(i8042_base);
+}
+
+#endif
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/5] i8042: Prepare i8042 driver for DT support

2015-02-13 Thread Roman Volkov
Use platform_device_probe() instead of platform_create_bundle() when
compiled with DT support, since the latter function is not suitable for
handling the OF device tree.

The order of initialization is changed, since i8042_platform_init() for DT
requires initialized platform_device structure. To avoid searching of the
compatible node twice, the platform_device structure pointer must be passed
to the i8042_platform_init() function right after initialization by
platform_device_probe().

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
This is remaining weak place in the patch set. No ideas yet on
how to reduce the using of ifdefs to make code cleaner, need more discussion.

 drivers/input/serio/i8042.c | 33 ++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 2f09062..86a47ec 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1421,16 +1421,32 @@ static int __init i8042_probe(struct platform_device 
*dev)
int error;
 
i8042_platform_device = dev;
+#ifdef SERIO_I8042_DT
+   error = i8042_platform_init(dev);
+   if (error)
+   return error;
 
+   error = i8042_controller_check();
+   if (error)
+   goto out_platform_exit;
+#endif
if (i8042_reset) {
error = i8042_controller_selftest();
if (error)
+#ifdef SERIO_I8042_DT
+   goto out_platform_exit;
+#else
return error;
+#endif
}
 
error = i8042_controller_init();
if (error)
+#ifdef SERIO_I8042_DT
+   goto out_platform_exit;
+#else
return error;
+#endif
 
 #ifdef CONFIG_X86
if (i8042_dritek)
@@ -1460,7 +1476,10 @@ static int __init i8042_probe(struct platform_device 
*dev)
i8042_free_irqs();
i8042_controller_reset(false);
i8042_platform_device = NULL;
-
+#ifdef SERIO_I8042_DT
+ out_platform_exit:
+   i8042_platform_exit();
+#endif
return error;
 }
 
@@ -1497,11 +1516,18 @@ static struct platform_driver i8042_driver = {
 
 static int __init i8042_init(void)
 {
+#ifndef SERIO_I8042_DT
struct platform_device *pdev;
+#endif
int err;
 
dbg_init();
 
+#ifdef SERIO_I8042_DT
+   err = platform_driver_probe(&i8042_driver, i8042_probe);
+   if (err)
+   return err;
+#else
err = i8042_platform_init();
if (err)
return err;
@@ -1515,14 +1541,15 @@ static int __init i8042_init(void)
err = PTR_ERR(pdev);
goto err_platform_exit;
}
-
+#endif
panic_blink = i8042_panic_blink;
 
return 0;
-
+#ifndef SERIO_I8042_DT
  err_platform_exit:
i8042_platform_exit();
return err;
+#endif
 }
 
 static void __exit i8042_exit(void)
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/5] i8042: Kernel configuration handling for DT support

2015-02-13 Thread Roman Volkov
i8042_dt.h should be included when CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and
CONFIG_USE_OF are selected. It should be not necessary to create
additional options in the kernel config.

Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index fc080be..d2c1761 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -28,6 +28,9 @@
 #include "i8042-x86ia64io.h"
 #elif defined(CONFIG_UNICORE32)
 #include "i8042-unicore32io.h"
+#elif defined(CONFIG_ARCH_MIGHT_HAVE_PC_SERIO) && defined(CONFIG_USE_OF)
+#define SERIO_I8042_DT
+#include "i8042-dt.h"
 #else
 #include "i8042-io.h"
 #endif
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/5] i8042: intel-8042 DT documentation

2015-02-13 Thread Roman Volkov
Documentation for 'intel,8042' DT compatible node.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 .../devicetree/bindings/input/intel-8042.txt   | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/intel-8042.txt

diff --git a/Documentation/devicetree/bindings/input/intel-8042.txt 
b/Documentation/devicetree/bindings/input/intel-8042.txt
new file mode 100644
index 000..ab8a3e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/intel-8042.txt
@@ -0,0 +1,26 @@
+Intel 8042 Keyboard Controller
+
+Required properties:
+- compatible: should be "intel,8042"
+- regs: memory for keyboard controller
+- interrupts: usually, two interrupts should be specified (keyboard and aux).
+   However, only one interrupt is also allowed in case of absence of the
+   physical port in the controller. The i8042 driver must be loaded with
+   nokbd/noaux option in this case.
+- interrupt-names: interrupt names corresponding to numbers in the list.
+   "kbd" is the keyboard interrupt and "aux" is the auxiliary (mouse)
+   interrupt.
+- command-reg: offset in memory for command register
+- status-reg: offset in memory for status register
+- data-reg: offset in memory for data register
+
+Example:
+   i8042@d8008800 {
+   compatible = "intel,8042";
+   regs = <0xd8008800 0x100>;
+   interrupts = <23>, <4>;
+   interrupt-names = "kbd", "aux";
+   command-reg = <0x04>;
+   status-reg = <0x04>;
+   data-reg = <0x00>;
+   };
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/5] Device Tree support for i8042 driver

2015-02-13 Thread Roman Volkov
Yes, some embedded devices still use the i8042 controller. This patch set
enables the i8042 driver to get necessary information from Device Tree instead
of using specific headers with hardcoded addresses for each specific machine.
For example, vt8500 architecture has i8042.

v2:
Changes in the documentation.
Errors fixed in the initialization funtion.
Redundant parameters removed from Device Tree bindings (init-reset, etc.).

Roman Volkov (5):
  i8042: intel-8042 DT documentation
  i8042: Kernel configuration handling for DT support
  i8042: Add OF match table
  i8042: Prepare i8042 driver for DT support
  i8042: Add i8042_dt.h glue for DT support

 .../devicetree/bindings/input/intel-8042.txt   |  26 ++
 drivers/input/serio/i8042-dt.h | 104 +
 drivers/input/serio/i8042.c|  43 -
 drivers/input/serio/i8042.h|   3 +
 4 files changed, 173 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/intel-8042.txt
 create mode 100644 drivers/input/serio/i8042-dt.h

--
Friday the 13-th
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] i8042: intel-8042 DT documentation

2015-02-10 Thread Roman Volkov
В Tue, 3 Feb 2015 11:32:02 -0800
Dmitry Torokhov  пишет:

> On Tue, Feb 03, 2015 at 11:38:16AM +, Mark Rutland wrote:
> > On Mon, Feb 02, 2015 at 09:48:46PM +0000, Roman Volkov wrote:
> > > Documentation for 'intel,8042' DT compatible node.
> > > 
> > > Signed-off-by: Tony Prisk 
> > > Signed-off-by: Roman Volkov 
> > > ---
> > >  .../devicetree/bindings/input/intel-8042.txt   | 29
> > > ++ 1 file changed, 29 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/input/intel-8042.txt
> > > 
> > > diff --git
> > > a/Documentation/devicetree/bindings/input/intel-8042.txt
> > > b/Documentation/devicetree/bindings/input/intel-8042.txt new file
> > > mode 100644 index 000..2aea7ec --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/input/intel-8042.txt
> > > @@ -0,0 +1,29 @@
> > > +* Intel 8042 Keyboard Controller
> > > +
> > > +Required properties:
> > > +- compatible: should be "intel,8042"
> > > +- regs: memory for keyboard controller
> > > +- interrupts: two interrupts should be specified (keyboard and
> > > aux)
> > 
> > Is it possible only one of these is wired up?
> 
> Yes, and we should support this case. The core of i8042 does.
> 

Do we need to just read these IRQ numbers and leave them negative if
absent? Will it be acceptable? This would look like:

i8042_kbd_irq = platform_get_irq_byname(pdev, "kbd");

Testing shows it prints "Invalid argument" error -22 when an IRQ is
absent and we are not using nokbd/noaux module options.

> 
> > 
> > It might be worth using interrupt-names.
> > 
> > > +- command-reg: offset in memory for command register
> > > +- status-reg: offset in memory for status register
> > > +- data-reg: offset in memory for data register
> > > +
> > > +Optional properties:
> > > +- init-reset: Controller should be reset on init and cleanup
> > 
> > Why is this necessary? Can't we just always reset it?
> 
> We do not reset by default on x86 because BIOS takes care of this for
> us and quite often firmware that emulates i8042 gets confused if we
> try to reset it too. Non non-x86 we reset by default. I think we
> should do the same for OF case  (reset) and not use this property.
> 
> > 
> > > +
> > > +Optional Linux-specific properties:
> > > +- linux,kbd_phys_desc: defaults to i8042/serio0
> > > +- linux,aux_phys_desc: defaults to i8042/serio1
> > > +- linux,mux_phys_desc: defaults to i8042/serio%d
> > 
> > As a general note, s/_/-/ in property names please.
> > 
> > That said, I don't follow why we should have these at all. I don't
> > understand what the description is intended to mean.
> > 
> > In general we want to avoid Linux-specific properties. If a DTB
> > needs to know about the inernals of an OS it's likely to be fragile
> > and broken over time.
> 
> Right, the desc were carried over from older days to keep dmesg
> familiar. With OF it is new platforms so just settle on a generic
> description and use it instead of allowing to specify through DT.
> 
> > 
> > > +
> > > +
> > > +Example:
> > > + keyboard@d8008800 {
> > > + compatible = "intel,8042";
> > > + reg = <0xd8008800 0x100>;
> > > + interrupts = <23 4>;
> > 
> > If this is intended to be two interrupts, please bracket them
> > individually, e.g.
> > 
> > interrupts = <23>, <4>;
> > 
> > > + command-reg = <0x04>;
> > > + status-reg = <0x04>;
> > 
> > Same address?
> > 
> > > + data-reg = <0x00>;
> > > + mux-ports = <2>;
> > 
> > This wasn't documented above.
> 
> I think active MUX is purely x86 concept, I have never heard of it
> being used anywhere else.
> 
> Thanks.
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 RESEND] dts: vt8500: Add SDHC node to DTS file for WM8650

2015-02-05 Thread Roman Volkov
There is no DT node for SDHC controller for WM8650, while the driver already
exists. Add missing node to make the controller working by default.

Signed-off-by: Roman Volkov 
Reviewed-by: Alexey Charkov 
---
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index b1c59a7..e12213d 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -187,6 +187,15 @@
interrupts = <43>;
};
 
+   sdhc@d800a000 {
+   compatible = "wm,wm8505-sdhc";
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
+   clocks = <&clksdhc>;
+   bus-width = <4>;
+   sdon-inverted;
+   };
+
fb: fb@d8050800 {
compatible = "wm,wm8505-fb";
reg = <0xd8050800 0x200>;
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] dts: vt8500: Add SDHC node to DTS file for WM8650

2015-02-05 Thread Roman Volkov
There is no DT node for SDHC controller for WM8650, while the driver already
exists. Add missing node to make the controller working by default.

Signed-off-by: Roman Volkov 
Reviewed-by: Alexey Charkov 
---
 arch/arm/boot/dts/wm8650.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index b1c59a7..5d85ccd 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -187,6 +187,15 @@
interrupts = <43>;
};
 
+   sdhc@d800a000 {
+   compatible = "wm,wm8505-sdhc";
+   reg = <0xd800a000 0x400>;
+   interrupts = <20>, <21>;
+   clocks = <&clksdhc>;
+   bus-width = <4>;
+   sdon-inverted;
+   };
+
fb: fb@d8050800 {
compatible = "wm,wm8505-fb";
reg = <0xd8050800 0x200>;
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] i8042: Prepare i8042 driver for DT support

2015-02-04 Thread Roman Volkov
В Tue, 3 Feb 2015 11:38:35 -0800
Dmitry Torokhov  пишет:

> On Tue, Feb 03, 2015 at 12:48:49AM +0300, Roman Volkov wrote:
> > Use platform_device_probe() instead of platform_create_bundle() when
> > compiled with DT support, since the latter function is not suitable
> > for handling the OF device tree.
> > 
> > The order of initialization is changed, since i8042_platform_init()
> > for DT requires initialized platform_device structure. To avoid
> > searching of the compatible node twice, the platform_device
> > structure pointer must be passed to the i8042_platform_init()
> > function right after initialization by platform_device_probe().
> > 
> > Signed-off-by: Tony Prisk 
> > Signed-off-by: Roman Volkov 
> > ---
> > 
> > Yes, many of these ifdefs look ugly. Suggestions on how to avoid
> > this are welcome (except using of_find_compatible_node() for
> > searching the node twice before calling the probe function).
> 
> I guess we need to split the dirver into part that create platform
> device and the standard driver part. Then your OF code can supply most
> of the needed data via resources/platform data. Yes, it is a larger
> change, but the current splat of ifdefs makes my eyes water.
> 
> Thanks.
> 

Dmitry, could you describe this in details? Currently there is
platform_create_bundle() function in the driver that is not acceptable
to be used with OF (it creates additional device). This function must be
replaced with platform_driver_probe() and it is all that common
between various architectures and can be the "standard" part of the
driver.

The difference is in device creation between OF case and, for example,
x86 case. Here is a chicken-and-egg problem that needs to be solved, if
we try to make the code consistent between various platforms. The
problem is that i8042_platform_init() expected to be called first, but
at this point DT version requires platform_device structure pointer.

Regards,
Roman.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] i8042: Add i8042_dt.h glue for DT support

2015-02-03 Thread Roman Volkov
В Tue, 3 Feb 2015 11:52:50 +
Mark Rutland  пишет:

> On Mon, Feb 02, 2015 at 09:48:50PM +0000, Roman Volkov wrote:
> > This header file designed to be similar to other glue layers found
> > for i8042. The difference is that interrupt numbers, device address,
> > and other information should be retrieved from the device tree.
> > 
> > Signed-off-by: Tony Prisk 
> > Signed-off-by: Roman Volkov 
> > ---
> >  drivers/input/serio/i8042-dt.h | 112
> > + 1 file changed, 112
> > insertions(+) create mode 100644 drivers/input/serio/i8042-dt.h
> > 
> > diff --git a/drivers/input/serio/i8042-dt.h
> > b/drivers/input/serio/i8042-dt.h new file mode 100644
> > index 000..0d1a344
> > --- /dev/null
> > +++ b/drivers/input/serio/i8042-dt.h
> > @@ -0,0 +1,112 @@
> > +#ifndef _I8042_DT_H
> > +#define _I8042_DT_H
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/*
> > + * 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.
> > + */
> > +
> > +static void __iomem *i8042_base;
> > +static unsigned int i8042_command_reg;
> > +static unsigned int i8042_status_reg;
> > +static unsigned int i8042_data_reg;
> > +#define I8042_COMMAND_REG i8042_command_reg
> > +#define I8042_STATUS_REG i8042_status_reg
> > +#define I8042_DATA_REG i8042_data_reg
> > +
> > +/*
> > + * Names.
> > + */
> > +
> > +static const char *i8042_kbd_phys_desc;
> > +static const char *i8042_aux_phys_desc;
> > +static const char *i8042_mux_phys_desc;
> > +#define I8042_KBD_PHYS_DESC i8042_kbd_phys_desc
> > +#define I8042_AUX_PHYS_DESC i8042_aux_phys_desc
> > +#define I8042_MUX_PHYS_DESC i8042_mux_phys_desc
> > +
> > +/*
> > + * IRQs.
> > + */
> > +static int i8042_kbd_irq;
> > +static int i8042_aux_irq;
> > +#define I8042_KBD_IRQ i8042_kbd_irq
> > +#define I8042_AUX_IRQ i8042_aux_irq
> 
> That's a lot of static values. Surely nothing physically prevents the
> use of multiple i8042 chips?
> 
> > +
> > +static inline int i8042_read_data(void)
> > +{
> > +   return readb(i8042_base + i8042_data_reg);
> > +}
> > +
> > +static inline int i8042_read_status(void)
> > +{
> > +   return readb(i8042_base + i8042_status_reg);
> > +}
> > +
> > +static inline void i8042_write_data(int val)
> > +{
> > +   writeb(val, i8042_base + i8042_data_reg);
> > +}
> > +
> > +static inline void i8042_write_command(int val)
> > +{
> > +   writeb(val, i8042_base + i8042_command_reg);
> > +}
> > +
> > +static inline int i8042_platform_init(struct platform_device *pdev)
> > +{
> > +   struct device_node *np = pdev->dev.of_node;
> > +   int status;
> > +
> > +   i8042_base = of_iomap(np, 0);
> > +   if (!i8042_base)
> > +   return -ENOMEM;
> > +
> > +   status = of_property_read_u32(np, "command-reg",
> > &i8042_command_reg);
> > +   if (status)
> > +   return status;
> > +
> > +   status = of_property_read_u32(np, "status-reg",
> > &i8042_status_reg);
> > +   if (status)
> > +   return status;
> > +
> > +   status = of_property_read_u32(np, "data-reg",
> > &i8042_data_reg);
> > +   if (status)
> > +   return status;
> 
> You should probably validate that these are within the range provided
> in the reg property.
> 
> You also need to clean up if you fail. It looks like here and below we
> leak the i8042_base mapping if we decide to fail.
> 
> > +
> > +   i8042_kbd_irq = irq_of_parse_and_map(np, 0);
> > +   i8042_aux_irq = irq_of_parse_and_map(np, 1);
> 
> You can use platform_get_irq(pdev, N) here, the IRQ will already have
> been parsed by the core.
> 
> > +   status = of_property_read_string(np, "linux,kbd_phys_desc",
> > +
> > &i8042_kbd_phys_desc);
> > +   if (status)
> > +   i8042_kbd_phys_desc = "i8042/serio0";
> > +
> > +   status = of_property_read_string(np, "linux,aux_phys_desc",
> > +
> > &i8042_aux_phys_desc);
> > +   if (status)
> > +   i8042_aux_phys_desc = "i8042/serio1";
> > +
> > +   status = of_property_read_string(np, "linux,mux_phys_desc",
> > +
> > &i804

Re: [PATCH 1/5] i8042: intel-8042 DT documentation

2015-02-02 Thread Roman Volkov
В Tue,  3 Feb 2015 00:48:46 +0300
Roman Volkov  пишет:

> Documentation for 'intel,8042' DT compatible node.
> 
> Signed-off-by: Tony Prisk 
> Signed-off-by: Roman Volkov 
> ---
>  .../devicetree/bindings/input/intel-8042.txt   | 29
> ++ 1 file changed, 29 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/input/intel-8042.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/intel-8042.txt
> b/Documentation/devicetree/bindings/input/intel-8042.txt new file
> mode 100644 index 000..2aea7ec
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/intel-8042.txt
> @@ -0,0 +1,29 @@
> +* Intel 8042 Keyboard Controller
> +
> +Required properties:
> +- compatible: should be "intel,8042"
> +- regs: memory for keyboard controller
> +- interrupts: two interrupts should be specified (keyboard and aux)
> +- command-reg: offset in memory for command register
> +- status-reg: offset in memory for status register
> +- data-reg: offset in memory for data register
> +
> +Optional properties:
> +- init-reset: Controller should be reset on init and cleanup
> +
> +Optional Linux-specific properties:
> +- linux,kbd_phys_desc: defaults to i8042/serio0
> +- linux,aux_phys_desc: defaults to i8042/serio1
> +- linux,mux_phys_desc: defaults to i8042/serio%d
> +
> +
> +Example:
> + keyboard@d8008800 {
> + compatible = "intel,8042";
> + reg = <0xd8008800 0x100>;
> + interrupts = <23 4>;
> + command-reg = <0x04>;
> + status-reg = <0x04>;
> + data-reg = <0x00>;
> + mux-ports = <2>;
> + };

Hi,

This patch set is to enable the Open Firmware Device Tree support for
the i8042 controller. Yes, some ARM SoC boards are still using i8042. As
an example, it is the vt8500 architecture.

I've tested this on my wm8505 machine in both configurations: as a
module and built-in. Also a modification of this driver is available
at https://github.com/linux-wmt/linux-vtwm. This should not affect x86
and similar architectures without the DT enabled in the config.

Regards,
Roman.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] i8042: Add OF match table

2015-02-02 Thread Roman Volkov
The OF device table allows the platform_driver_probe() function to
automatically match device and parse the DT node.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 924e4bf..c53323e 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1460,12 +1460,22 @@ static int i8042_remove(struct platform_device *dev)
return 0;
 }
 
+#ifdef SERIO_I8042_DT
+static struct of_device_id i8042_dt_ids[] = {
+   { .compatible = "intel,8042" },
+   { /* Sentinel */ },
+};
+#endif
+
 static struct platform_driver i8042_driver = {
.driver = {
.name   = "i8042",
 #ifdef CONFIG_PM
.pm = &i8042_pm_ops,
 #endif
+#ifdef SERIO_I8042_DT
+   .of_match_table = i8042_dt_ids,
+#endif
},
.remove = i8042_remove,
.shutdown   = i8042_shutdown,
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] i8042: Kernel configuration handling for DT support

2015-02-02 Thread Roman Volkov
i8042_dt.h should be included when CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and
CONFIG_USE_OF are selected. It should be not necessary to create
additional options in the kernel config.

Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index fc080be..d2c1761 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -28,6 +28,9 @@
 #include "i8042-x86ia64io.h"
 #elif defined(CONFIG_UNICORE32)
 #include "i8042-unicore32io.h"
+#elif defined(CONFIG_ARCH_MIGHT_HAVE_PC_SERIO) && defined(CONFIG_USE_OF)
+#define SERIO_I8042_DT
+#include "i8042-dt.h"
 #else
 #include "i8042-io.h"
 #endif
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] i8042: Prepare i8042 driver for DT support

2015-02-02 Thread Roman Volkov
Use platform_device_probe() instead of platform_create_bundle() when
compiled with DT support, since the latter function is not suitable for
handling the OF device tree.

The order of initialization is changed, since i8042_platform_init() for DT
requires initialized platform_device structure. To avoid searching of the
compatible node twice, the platform_device structure pointer must be passed
to the i8042_platform_init() function right after initialization by
platform_device_probe().

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---

Yes, many of these ifdefs look ugly. Suggestions on how to avoid this are
welcome (except using of_find_compatible_node() for searching the node twice
before calling the probe function).

The problem is that platform_device_add() causes parent drivers to be probed
while the i8042 is not ready yet (register addresses point to the sky).

I would suggest to do something like deferred probing of the parent drivers,
but this would be a part of another investigation and patchset.

Regards,
Roman.

 drivers/input/serio/i8042.c | 33 ++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index c53323e..2978b0e 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1407,16 +1407,32 @@ static int __init i8042_probe(struct platform_device 
*dev)
int error;
 
i8042_platform_device = dev;
+#ifdef SERIO_I8042_DT
+   error = i8042_platform_init(dev);
+   if (error)
+   return error;
 
+   error = i8042_controller_check();
+   if (error)
+   goto out_platform_exit;
+#endif
if (i8042_reset) {
error = i8042_controller_selftest();
if (error)
+#ifdef SERIO_I8042_DT
+   goto out_platform_exit;
+#else
return error;
+#endif
}
 
error = i8042_controller_init();
if (error)
+#ifdef SERIO_I8042_DT
+   goto out_platform_exit;
+#else
return error;
+#endif
 
 #ifdef CONFIG_X86
if (i8042_dritek)
@@ -1446,7 +1462,10 @@ static int __init i8042_probe(struct platform_device 
*dev)
i8042_free_irqs();
i8042_controller_reset(false);
i8042_platform_device = NULL;
-
+#ifdef SERIO_I8042_DT
+ out_platform_exit:
+   i8042_platform_exit();
+#endif
return error;
 }
 
@@ -1483,11 +1502,18 @@ static struct platform_driver i8042_driver = {
 
 static int __init i8042_init(void)
 {
+#ifndef SERIO_I8042_DT
struct platform_device *pdev;
+#endif
int err;
 
dbg_init();
 
+#ifdef SERIO_I8042_DT
+   err = platform_driver_probe(&i8042_driver, i8042_probe);
+   if (err)
+   return err;
+#else
err = i8042_platform_init();
if (err)
return err;
@@ -1501,14 +1527,15 @@ static int __init i8042_init(void)
err = PTR_ERR(pdev);
goto err_platform_exit;
}
-
+#endif
panic_blink = i8042_panic_blink;
 
return 0;
-
+#ifndef SERIO_I8042_DT
  err_platform_exit:
i8042_platform_exit();
return err;
+#endif
 }
 
 static void __exit i8042_exit(void)
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] i8042: intel-8042 DT documentation

2015-02-02 Thread Roman Volkov
Documentation for 'intel,8042' DT compatible node.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 .../devicetree/bindings/input/intel-8042.txt   | 29 ++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/intel-8042.txt

diff --git a/Documentation/devicetree/bindings/input/intel-8042.txt 
b/Documentation/devicetree/bindings/input/intel-8042.txt
new file mode 100644
index 000..2aea7ec
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/intel-8042.txt
@@ -0,0 +1,29 @@
+* Intel 8042 Keyboard Controller
+
+Required properties:
+- compatible: should be "intel,8042"
+- regs: memory for keyboard controller
+- interrupts: two interrupts should be specified (keyboard and aux)
+- command-reg: offset in memory for command register
+- status-reg: offset in memory for status register
+- data-reg: offset in memory for data register
+
+Optional properties:
+- init-reset: Controller should be reset on init and cleanup
+
+Optional Linux-specific properties:
+- linux,kbd_phys_desc: defaults to i8042/serio0
+- linux,aux_phys_desc: defaults to i8042/serio1
+- linux,mux_phys_desc: defaults to i8042/serio%d
+
+
+Example:
+   keyboard@d8008800 {
+   compatible = "intel,8042";
+   reg = <0xd8008800 0x100>;
+   interrupts = <23 4>;
+   command-reg = <0x04>;
+   status-reg = <0x04>;
+   data-reg = <0x00>;
+   mux-ports = <2>;
+   };
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] i8042: Add i8042_dt.h glue for DT support

2015-02-02 Thread Roman Volkov
This header file designed to be similar to other glue layers found
for i8042. The difference is that interrupt numbers, device address,
and other information should be retrieved from the device tree.

Signed-off-by: Tony Prisk 
Signed-off-by: Roman Volkov 
---
 drivers/input/serio/i8042-dt.h | 112 +
 1 file changed, 112 insertions(+)
 create mode 100644 drivers/input/serio/i8042-dt.h

diff --git a/drivers/input/serio/i8042-dt.h b/drivers/input/serio/i8042-dt.h
new file mode 100644
index 000..0d1a344
--- /dev/null
+++ b/drivers/input/serio/i8042-dt.h
@@ -0,0 +1,112 @@
+#ifndef _I8042_DT_H
+#define _I8042_DT_H
+
+#include 
+#include 
+#include 
+
+/*
+ * 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.
+ */
+
+static void __iomem *i8042_base;
+static unsigned int i8042_command_reg;
+static unsigned int i8042_status_reg;
+static unsigned int i8042_data_reg;
+#define I8042_COMMAND_REG i8042_command_reg
+#define I8042_STATUS_REG i8042_status_reg
+#define I8042_DATA_REG i8042_data_reg
+
+/*
+ * Names.
+ */
+
+static const char *i8042_kbd_phys_desc;
+static const char *i8042_aux_phys_desc;
+static const char *i8042_mux_phys_desc;
+#define I8042_KBD_PHYS_DESC i8042_kbd_phys_desc
+#define I8042_AUX_PHYS_DESC i8042_aux_phys_desc
+#define I8042_MUX_PHYS_DESC i8042_mux_phys_desc
+
+/*
+ * IRQs.
+ */
+static int i8042_kbd_irq;
+static int i8042_aux_irq;
+#define I8042_KBD_IRQ i8042_kbd_irq
+#define I8042_AUX_IRQ i8042_aux_irq
+
+static inline int i8042_read_data(void)
+{
+   return readb(i8042_base + i8042_data_reg);
+}
+
+static inline int i8042_read_status(void)
+{
+   return readb(i8042_base + i8042_status_reg);
+}
+
+static inline void i8042_write_data(int val)
+{
+   writeb(val, i8042_base + i8042_data_reg);
+}
+
+static inline void i8042_write_command(int val)
+{
+   writeb(val, i8042_base + i8042_command_reg);
+}
+
+static inline int i8042_platform_init(struct platform_device *pdev)
+{
+   struct device_node *np = pdev->dev.of_node;
+   int status;
+
+   i8042_base = of_iomap(np, 0);
+   if (!i8042_base)
+   return -ENOMEM;
+
+   status = of_property_read_u32(np, "command-reg", &i8042_command_reg);
+   if (status)
+   return status;
+
+   status = of_property_read_u32(np, "status-reg", &i8042_status_reg);
+   if (status)
+   return status;
+
+   status = of_property_read_u32(np, "data-reg", &i8042_data_reg);
+   if (status)
+   return status;
+
+   i8042_kbd_irq = irq_of_parse_and_map(np, 0);
+   i8042_aux_irq = irq_of_parse_and_map(np, 1);
+
+   status = of_property_read_string(np, "linux,kbd_phys_desc",
+   &i8042_kbd_phys_desc);
+   if (status)
+   i8042_kbd_phys_desc = "i8042/serio0";
+
+   status = of_property_read_string(np, "linux,aux_phys_desc",
+   &i8042_aux_phys_desc);
+   if (status)
+   i8042_aux_phys_desc = "i8042/serio1";
+
+   status = of_property_read_string(np, "linux,mux_phys_desc",
+   &i8042_mux_phys_desc);
+   if (status)
+   i8042_mux_phys_desc = "i8042/serio%d";
+
+   if (of_get_property(np, "init-reset", NULL))
+   i8042_reset = true;
+
+   return 0;
+}
+
+static inline void i8042_platform_exit(void)
+{
+   if (i8042_base)
+   iounmap(i8042_base);
+}
+
+#endif
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html