Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] irqchip: add basic infrastructure
From: Rob Herring @ 2012-10-28 13:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121028142408.7512671c@skate>

On 10/28/2012 08:24 AM, Thomas Petazzoni wrote:
> Rob,
> 
> On Sun, 28 Oct 2012 08:18:42 -0500, Rob Herring wrote:
> 
>>> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
>>> index 1bb8bf6..e0ff166 100644
>>> --- a/drivers/irqchip/Kconfig
>>> +++ b/drivers/irqchip/Kconfig
>>> @@ -1 +1,2 @@
>>> -# empty
>>> +config USE_IRQCHIP
>>> +	bool
>>
>> This should depend on OF_IRQ.
> 
> It is correct that the mechanism only works for irqchip drivers that
> are probed through the Device Tree. However, having a "depends on"
> inside a configuration that gets "select"ed by other configuration
> options (in our case ARCH_BCM2835 and ARCH_MVEBU select USE_IRQCHIP) is
> useless: kconfig doesn't care of the "depends on" dependencies when
> you're "select"ing an option.
> 
> So, I can add it for documentation purposes, but it is practically
> useless.

It will give a kconfig error rather than build error on of_irq_init
which would result in patches for empty of_irq_init.

How about default y and depends on OF_IRQ. Then you don't need a select.
I think we want all DT enabled platforms to use this and it's only a
small amount of init space.

Rob

> 
> Best regards,
> 
> Thomas
> 

^ permalink raw reply

* [PATCH v2 1/4] irqchip: add basic infrastructure
From: Thomas Petazzoni @ 2012-10-28 13:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <508D3359.6000309@gmail.com>

Rob,

On Sun, 28 Oct 2012 08:30:01 -0500, Rob Herring wrote:

> It will give a kconfig error rather than build error on of_irq_init
> which would result in patches for empty of_irq_init.

Right.

> How about default y and depends on OF_IRQ. Then you don't need a select.
> I think we want all DT enabled platforms to use this and it's only a
> small amount of init space.

Sounds good. Will do and post a v3.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* [PATCH 6/9] ARM: Kirkwood: Convert GoFlex Net to pinctrl.
From: Josh Coombs @ 2012-10-28 14:31 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351090434-30499-7-git-send-email-andrew@lunn.ch>

Tested-by: Joshua Coombs <josh.coombs@gmail.com>

On Wed, Oct 24, 2012 at 10:53 AM, Andrew Lunn <andrew@lunn.ch> wrote:
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  arch/arm/boot/dts/kirkwood-goflexnet.dts |   57 ++++++++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/board-goflexnet.c |   18 ----------
>  2 files changed, 57 insertions(+), 18 deletions(-)
>
> diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
> index 7c8238f..46d16a2 100644
> --- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
> +++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
> @@ -16,6 +16,63 @@
>         };
>
>         ocp at f1000000 {
> +               pinctrl: pinctrl at 10000 {
> +                       compatible = "marvell,88f6281-pinctrl";
> +                       reg = <0x10000 0x20>;
> +
> +                       pinctrl-0 = < &pmx_usb_power_enable &pmx_led_orange
> +                                     &pmx_led_left_cap_0 &pmx_led_left_cap_1
> +                                     &pmx_led_left_cap_2 &pmx_led_left_cap_3
> +                                     &pmx_led_right_cap_0 &pmx_led_right_cap_1
> +                                     &pmx_led_right_cap_2 &pmx_led_right_cap_3
> +                                   >;
> +                       pinctrl-names = "default";
> +
> +                       pmx_usb_power_enable: pmx-usb-power-enable {
> +                               marvell,pins = "mpp29";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_right_cap_0: pmx-led_right_cap_0 {
> +                               marvell,pins = "mpp38";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_right_cap_1: pmx-led_right_cap_1 {
> +                               marvell,pins = "mpp39";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_right_cap_2: pmx-led_right_cap_2 {
> +                               marvell,pins = "mpp40";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_right_cap_3: pmx-led_right_cap_3 {
> +                               marvell,pins = "mpp41";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_left_cap_0: pmx-led_left_cap_0 {
> +                               marvell,pins = "mpp42";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_left_cap_1: pmx-led_left_cap_1 {
> +                               marvell,pins = "mpp43";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_left_cap_2: pmx-led_left_cap_2 {
> +                               marvell,pins = "mpp44";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_left_cap_3: pmx-led_left_cap_3 {
> +                               marvell,pins = "mpp45";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_green: pmx-led_green {
> +                               marvell,pins = "mpp46";
> +                               marvell,function = "gpio";
> +                       };
> +                       pmx_led_orange: pmx-led_orange {
> +                               marvell,pins = "mpp47";
> +                               marvell,function = "gpio";
> +                       };
> +               };
>                 serial at 12000 {
>                         clock-frequency = <200000000>;
>                         status = "ok";
> diff --git a/arch/arm/mach-kirkwood/board-goflexnet.c b/arch/arm/mach-kirkwood/board-goflexnet.c
> index 001ca8c..9643f4b 100644
> --- a/arch/arm/mach-kirkwood/board-goflexnet.c
> +++ b/arch/arm/mach-kirkwood/board-goflexnet.c
> @@ -34,34 +34,16 @@
>  #include <mach/bridge-regs.h>
>  #include <linux/platform_data/mmc-mvsdio.h>
>  #include "common.h"
> -#include "mpp.h"
>
>  static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
>         .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
>  };
>
> -static unsigned int goflexnet_mpp_config[] __initdata = {
> -       MPP29_GPIO,     /* USB Power Enable */
> -       MPP47_GPIO,     /* LED Orange */
> -       MPP46_GPIO,     /* LED Green */
> -       MPP45_GPIO,     /* LED Left Capacity 3 */
> -       MPP44_GPIO,     /* LED Left Capacity 2 */
> -       MPP43_GPIO,     /* LED Left Capacity 1 */
> -       MPP42_GPIO,     /* LED Left Capacity 0 */
> -       MPP41_GPIO,     /* LED Right Capacity 3 */
> -       MPP40_GPIO,     /* LED Right Capacity 2 */
> -       MPP39_GPIO,     /* LED Right Capacity 1 */
> -       MPP38_GPIO,     /* LED Right Capacity 0 */
> -       0
> -};
> -
>  void __init goflexnet_init(void)
>  {
>         /*
>          * Basic setup. Needs to be called early.
>          */
> -       kirkwood_mpp_conf(goflexnet_mpp_config);
> -
>         if (gpio_request(29, "USB Power Enable") != 0 ||
>             gpio_direction_output(29, 1) != 0)
>                 pr_err("can't setup GPIO 29 (USB Power Enable)\n");
> --
> 1.7.10.4
>

^ permalink raw reply

* [PATCH 1/5] ARM: PXA: Add z2-usb-switch driver
From: Vasily Khoruzhick @ 2012-10-28 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

This driver controls mode of USB port #2 pins - device or host.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-pxa/Kconfig  | 7 +++++++
 arch/arm/mach-pxa/Makefile | 1 +
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 11aa739..5fffc4b 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -630,6 +630,13 @@ config MACH_ZIPIT2
 	bool "Zipit Z2 Handheld"
 	select HAVE_PWM
 	select PXA27x
+
+config Z2_USB_SWITCH
+	tristate "Control the state of USB port on Zipit Z2"
+	depends on MACH_ZIPIT2
+	help
+	  This is a simple driver that is able to control
+	  usb mode of Zipit Z2
 endif
 endmenu
 
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index ee88d6e..86a032f 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -99,3 +99,4 @@ obj-$(CONFIG_MACH_RAUMFELD_SPEAKER)	+= raumfeld.o
 obj-$(CONFIG_MACH_ZIPIT2)	+= z2.o
 
 obj-$(CONFIG_TOSA_BT)		+= tosa-bt.o
+obj-$(CONFIG_Z2_USB_SWITCH)	+= z2-usb-switch.o
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH 2/5] ARM: PXA: Zipit Z2: Add USB host and device support
From: Vasily Khoruzhick @ 2012-10-28 15:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351438555-4668-1-git-send-email-anarsoul@gmail.com>

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-pxa/z2.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index c97485f..ce90fa9 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -41,6 +41,9 @@
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <mach/pm.h>
+#include <mach/pxa27x-udc.h>
+#include <mach/udc.h>
+#include <linux/platform_data/usb-ohci-pxa27x.h>
 
 #include "generic.h"
 #include "devices.h"
@@ -680,6 +683,52 @@ static void __init z2_pmic_init(void)
 static inline void z2_pmic_init(void) {}
 #endif
 
+/******************************************************************************
+ * USB Switch
+ ******************************************************************************/
+static struct platform_device z2_usb_switch = {
+	.name		= "z2-usb-switch",
+	.id		= -1,
+};
+
+static void __init z2_usb_switch_init(void)
+{
+	platform_device_register(&z2_usb_switch);
+}
+
+/******************************************************************************
+ * USB Gadget
+ ******************************************************************************/
+#if defined(CONFIG_USB_GADGET_PXA27X) \
+	|| defined(CONFIG_USB_GADGET_PXA27X_MODULE)
+static int z2_udc_is_connected(void)
+{
+	return 1;
+}
+
+static struct pxa2xx_udc_mach_info z2_udc_info __initdata = {
+	.udc_is_connected	= z2_udc_is_connected,
+	.gpio_pullup		= -1,
+};
+
+static void __init z2_udc_init(void)
+{
+	pxa_set_udc_info(&z2_udc_info);
+}
+#else
+static inline void z2_udc_init(void) {}
+#endif
+
+/******************************************************************************
+ * USB Host (OHCI)
+ ******************************************************************************/
+static struct pxaohci_platform_data z2_ohci_platform_data = {
+	.port_mode	= PMM_PERPORT_MODE,
+	.flags		= ENABLE_PORT2 | NO_OC_PROTECTION,
+	.power_on_delay	= 10,
+	.power_budget	= 500,
+};
+
 #ifdef CONFIG_PM
 static void z2_power_off(void)
 {
@@ -705,10 +754,12 @@ static void __init z2_init(void)
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
 	pxa_set_stuart_info(NULL);
+	pxa_set_ohci_info(&z2_ohci_platform_data);
 
 	z2_lcd_init();
 	z2_mmc_init();
 	z2_mkp_init();
+	z2_udc_init();
 	z2_i2c_init();
 	z2_spi_init();
 	z2_nor_init();
@@ -716,6 +767,7 @@ static void __init z2_init(void)
 	z2_leds_init();
 	z2_keys_init();
 	z2_pmic_init();
+	z2_usb_switch_init();
 
 	pm_power_off = z2_power_off;
 }
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH 3/5] ARM: PXA: Zipit Z2: Fix oops in z2_power_off
From: Vasily Khoruzhick @ 2012-10-28 15:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351438555-4668-1-git-send-email-anarsoul@gmail.com>

pxa27x_set_pwrmode is called from z2_power_off, so it shouldn't
be marked with __init.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-pxa/pxa27x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 8047ee0..88ff275 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -242,7 +242,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
  */
 static unsigned int pwrmode = PWRMODE_SLEEP;
 
-int __init pxa27x_set_pwrmode(unsigned int mode)
+int pxa27x_set_pwrmode(unsigned int mode)
 {
 	switch (mode) {
 	case PWRMODE_SLEEP:
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH 4/5] ARM: PXA: Zipit Z2: Change active_state of power button
From: Vasily Khoruzhick @ 2012-10-28 15:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351438555-4668-1-git-send-email-anarsoul@gmail.com>

From: mcmajeres <mark@engine12.com>

Otherwise userspace might be confused about button state

Signed-off-by: mcmajeres <mark@engine12.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-pxa/z2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index ce90fa9..fac7cba 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -437,7 +437,7 @@ static struct gpio_keys_button z2_pxa_buttons[] = {
 	{
 		.code		= KEY_POWER,
 		.gpio		= GPIO1_ZIPITZ2_POWER_BUTTON,
-		.active_low	= 0,
+		.active_low	= 1,
 		.desc		= "Power Button",
 		.wakeup		= 1,
 		.type		= EV_KEY,
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH 5/5] ARM: PXA: Zipit Z2: Fix backlight PWM device number
From: Vasily Khoruzhick @ 2012-10-28 15:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351438555-4668-1-git-send-email-anarsoul@gmail.com>

Recent changes to PXA PWM support changed the PXA27X PWM device
numbering scheme, so keyboard and LCD backlight is not
working anymore on Z2.

Fix it and move from legacy to new PWM API.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-pxa/z2.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index fac7cba..06b8078 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/z2_battery.h>
 #include <linux/dma-mapping.h>
@@ -206,17 +207,22 @@ static inline void z2_nor_init(void) {}
  * Backlight
  ******************************************************************************/
 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
+static struct pwm_lookup z2_pwm_lookup[] = {
+	PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL),
+	PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight.1", NULL),
+};
+
 static struct platform_pwm_backlight_data z2_backlight_data[] = {
 	[0] = {
 		/* Keypad Backlight */
-		.pwm_id		= 1,
+		.pwm_id		= -1,
 		.max_brightness	= 1023,
 		.dft_brightness	= 0,
 		.pwm_period_ns	= 1260320,
 	},
 	[1] = {
 		/* LCD Backlight */
-		.pwm_id		= 2,
+		.pwm_id		= -1,
 		.max_brightness	= 1023,
 		.dft_brightness	= 512,
 		.pwm_period_ns	= 1260320,
@@ -243,6 +249,7 @@ static void __init z2_pwm_init(void)
 {
 	platform_device_register(&z2_backlight_devices[0]);
 	platform_device_register(&z2_backlight_devices[1]);
+	pwm_add_table(z2_pwm_lookup, ARRAY_SIZE(z2_pwm_lookup));
 }
 #else
 static inline void z2_pwm_init(void) {}
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH 1/5] ARM: PXA: Add z2-usb-switch driver
From: Vasily Khoruzhick @ 2012-10-28 15:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351438555-4668-1-git-send-email-anarsoul@gmail.com>

Ooops, sorry, please discard this patch. One file is missing after
rebase, will resend this patch shortly

On Sun, Oct 28, 2012 at 6:35 PM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> This driver controls mode of USB port #2 pins - device or host.
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  arch/arm/mach-pxa/Kconfig  | 7 +++++++
>  arch/arm/mach-pxa/Makefile | 1 +
>  2 files changed, 8 insertions(+)
>
> diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
> index 11aa739..5fffc4b 100644
> --- a/arch/arm/mach-pxa/Kconfig
> +++ b/arch/arm/mach-pxa/Kconfig
> @@ -630,6 +630,13 @@ config MACH_ZIPIT2
>         bool "Zipit Z2 Handheld"
>         select HAVE_PWM
>         select PXA27x
> +
> +config Z2_USB_SWITCH
> +       tristate "Control the state of USB port on Zipit Z2"
> +       depends on MACH_ZIPIT2
> +       help
> +         This is a simple driver that is able to control
> +         usb mode of Zipit Z2
>  endif
>  endmenu
>
> diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
> index ee88d6e..86a032f 100644
> --- a/arch/arm/mach-pxa/Makefile
> +++ b/arch/arm/mach-pxa/Makefile
> @@ -99,3 +99,4 @@ obj-$(CONFIG_MACH_RAUMFELD_SPEAKER)   += raumfeld.o
>  obj-$(CONFIG_MACH_ZIPIT2)      += z2.o
>
>  obj-$(CONFIG_TOSA_BT)          += tosa-bt.o
> +obj-$(CONFIG_Z2_USB_SWITCH)    += z2-usb-switch.o
> --
> 1.7.12.4
>

^ permalink raw reply

* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Vasily Khoruzhick @ 2012-10-28 15:42 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CA+E=qVc1MGPQoWZWQAcv-NEh8WpLoqeTYLQz4iFjiOyfc9CX5w@mail.gmail.com>

This driver controls mode of USB port #2 pins - device or host.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 arch/arm/mach-pxa/Kconfig         |   7 +++
 arch/arm/mach-pxa/Makefile        |   1 +
 arch/arm/mach-pxa/z2-usb-switch.c | 100 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)
 create mode 100644 arch/arm/mach-pxa/z2-usb-switch.c

diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 11aa739..5fffc4b 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -630,6 +630,13 @@ config MACH_ZIPIT2
 	bool "Zipit Z2 Handheld"
 	select HAVE_PWM
 	select PXA27x
+
+config Z2_USB_SWITCH
+	tristate "Control the state of USB port on Zipit Z2"
+	depends on MACH_ZIPIT2
+	help
+	  This is a simple driver that is able to control
+	  usb mode of Zipit Z2
 endif
 endmenu
 
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index ee88d6e..86a032f 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -99,3 +99,4 @@ obj-$(CONFIG_MACH_RAUMFELD_SPEAKER)	+= raumfeld.o
 obj-$(CONFIG_MACH_ZIPIT2)	+= z2.o
 
 obj-$(CONFIG_TOSA_BT)		+= tosa-bt.o
+obj-$(CONFIG_Z2_USB_SWITCH)	+= z2-usb-switch.o
diff --git a/arch/arm/mach-pxa/z2-usb-switch.c b/arch/arm/mach-pxa/z2-usb-switch.c
new file mode 100644
index 0000000..9583092
--- /dev/null
+++ b/arch/arm/mach-pxa/z2-usb-switch.c
@@ -0,0 +1,100 @@
+/*
+ * USB mode switcher for Z2
+ *
+ * Copyright (c) 2011 Vasily Khoruzhick
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+
+#include <mach/pxa27x.h>
+#include <mach/pxa27x-udc.h>
+
+#include <asm/io.h>
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+static ssize_t usb_mode_show(struct device *dev, struct device_attribute *attr,
+	char *buf)
+{
+	if (UP2OCR & UP2OCR_HXS)
+		return sprintf(buf, "host\n");
+	else
+		return sprintf(buf, "device\n");
+}
+
+static ssize_t usb_mode_set(struct device *dev, struct device_attribute *attr,
+	const char *buf, size_t count)
+{
+	if (strncmp(buf, "host", MIN(count, 4)) == 0) {
+		UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
+		return count;
+	} else if (strncmp(buf, "device", MIN(count, 6)) == 0) {
+		UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
+		return count;
+	}
+	return -EINVAL;
+}
+
+static DEVICE_ATTR(usb_mode, 0644, usb_mode_show, usb_mode_set);
+
+static const struct attribute *attrs[] = {
+	&dev_attr_usb_mode.attr,
+	NULL,
+};
+
+static const struct attribute_group attr_group = {
+	.attrs	= (struct attribute **)attrs,
+};
+
+static int z2_usb_switch_probe(struct platform_device *dev)
+{
+	int res;
+
+	res = sysfs_create_group(&dev->dev.kobj, &attr_group);
+	if (res)
+		return res;
+
+	UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
+
+	return 0;
+}
+
+static int __devexit z2_usb_switch_remove(struct platform_device *dev)
+{
+	UP2OCR = UP2OCR_HXOE;
+	sysfs_remove_group(&dev->dev.kobj, &attr_group);
+
+	return 0;
+}
+
+static struct platform_driver z2_usb_switch_driver = {
+	.probe = z2_usb_switch_probe,
+	.remove = __devexit_p(z2_usb_switch_remove),
+
+	.driver = {
+		.name = "z2-usb-switch",
+		.owner = THIS_MODULE,
+	},
+};
+
+
+static int __init z2_usb_switch_init(void)
+{
+	return platform_driver_register(&z2_usb_switch_driver);
+}
+
+static void __exit z2_usb_switch_exit(void)
+{
+	platform_driver_unregister(&z2_usb_switch_driver);
+}
+
+module_init(z2_usb_switch_init);
+module_exit(z2_usb_switch_exit);
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH RESEND] ARM: pxa27x_keypad: clear pending interrupts on keypad config
From: Vasily Khoruzhick @ 2012-10-28 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

Bootloader can leave interrupt bit pending, and it confuses driver.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
Rebased against v3.7-rc2

 drivers/input/keyboard/pxa27x_keypad.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 803ff6f..cad9d5d 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -368,6 +368,9 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
 	unsigned int mask = 0, direct_key_num = 0;
 	unsigned long kpc = 0;
 
+	/* clear pending interrupt bit */
+	keypad_readl(KPC);
+
 	/* enable matrix keys with automatic scan */
 	if (pdata->matrix_key_rows && pdata->matrix_key_cols) {
 		kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL;
-- 
1.7.12.4

^ permalink raw reply related

* [PATCH RESEND] spi-pxa2xx: fix memory corruption
From: Vasily Khoruzhick @ 2012-10-28 15:51 UTC (permalink / raw)
  To: linux-arm-kernel

pxa2xx_spi_probe allocates struct driver_data and null_dma_buf
at same time via spi_alloc_master(), but then calculates
null_dma_buf pointer incorrectly, and it causes memory corruption
later if DMA usage is enabled.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
Rebased against v3.7-rc2

 drivers/spi/spi-pxa2xx.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index dc25bee..b25fe27 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -106,6 +106,7 @@ struct driver_data {
 	int rx_channel;
 	int tx_channel;
 	u32 *null_dma_buf;
+	u8 null_dma_buf_unaligned[16];
 
 	/* SSP register addresses */
 	void __iomem *ioaddr;
@@ -1543,8 +1544,8 @@ static int __devinit pxa2xx_spi_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	/* Allocate master with space for drv_data and null dma buffer */
-	master = spi_alloc_master(dev, sizeof(struct driver_data) + 16);
+	/* Allocate master with space for drv_data */
+	master = spi_alloc_master(dev, sizeof(struct driver_data));
 	if (!master) {
 		dev_err(&pdev->dev, "cannot alloc spi_master\n");
 		pxa_ssp_free(ssp);
@@ -1569,8 +1570,8 @@ static int __devinit pxa2xx_spi_probe(struct platform_device *pdev)
 	master->transfer = transfer;
 
 	drv_data->ssp_type = ssp->type;
-	drv_data->null_dma_buf = (u32 *)ALIGN((u32)(drv_data +
-						sizeof(struct driver_data)), 8);
+	drv_data->null_dma_buf =
+		(u32 *)PTR_ALIGN(&drv_data->null_dma_buf_unaligned, 8);
 
 	drv_data->ioaddr = ssp->mmio_base;
 	drv_data->ssdr_physical = ssp->phys_base + SSDR;
-- 
1.7.12.4

^ permalink raw reply related

* irq_set_chained_handler() called too early for hwirq to be initialized
From: Roland Stigge @ 2012-10-28 15:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

consider arch/arm/mach-lpc32xx/irq.c: irq_set_chained_handler() is
called at a point where it accesses
irq_to_desc(IRQ_LPC32XX_SUB2IRQ)->irq_data.hwirq but which is not yet
initialized.

(This bug just surfaced on lpc32xx when the chained interrupt controller
SIC2 wasn't working. SIC1 does, but just by chance: The uninitialized
value 0 is just coincidentally the correct one.)

...->hwirq is actually defined only later on in lpc32xx_init_irq() at
irq_domain_add_legacy(). Ideally, I would just move the
irq_set_chained_handler() calls to after of_irq_init() and
irq_domain_add_legacy(). Is this OK or does this produce any race condition?

Thanks in advance,

Roland

^ permalink raw reply

* [PATCH] GPIO: mvebu-gpio: Don't initialize the mask_cache
From: Michael Walle @ 2012-10-28 16:33 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351344538-5238-1-git-send-email-andrew@lunn.ch>

Am Samstag 27 Oktober 2012, 15:28:58 schrieb Andrew Lunn:
> Due to the SMP nature of some of the chips, which have per CPU
> registers, the driver does not use the generic irq_gc_mask_set_bit() &
> irq_gc_mask_clr_bit() functions, which only support a single register.
> The driver has its own implementation of these functions, which can
> pick the correct register depending on the CPU being used. The
> functions do however use the gc->mask_cache value.
> 
> The call to irq_setup_generic_chip() was passing
> IRQ_GC_INIT_MASK_CACHE, which caused the gc->mask_cache to be
> initialized to the contents of some random register. This resulted in
> unexpected interrupts been delivered from random GPIO lines.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/gpio/gpio-mvebu.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index eb42ab1..cf7afb9 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -646,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct
> platform_device *pdev) ct->handler = handle_edge_irq;
>  	ct->chip.name = mvchip->chip.label;
> 
> -	irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE,
> +	irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0,
>  			       IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
> 
>  	/* Setup irq domain on top of the generic chip. */

Tested-by: Michael Walle <michael@walle.cc>

Fixes my lock ups when booting, too.

-- 
Michael

^ permalink raw reply

* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
From: Michael Walle @ 2012-10-28 16:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351427004-32110-1-git-send-email-jm@lentin.co.uk>

Am Sonntag 28 Oktober 2012, 13:23:24 schrieb Jamie Lentin:
> The plat-orion GPIO driver would disable any pin blinking whenever
> using a pin for output. Do the same here, as a blinking LED will
> continue to blink regardless of what the GPIO pin level is.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
> The power LED on the DNS-320/DNS-325 is left blinking by the bootloader,
> the LED turning steady indicates it's booted. The blinking needs to be
> disabled before setting the GPIO pin level has any effect.
> 
> Apart from the custom init code running too soon, I think everything is
> working now.
> 
> I haven't tested this on any other boards, so not sure if it's sensible
> beyond the kirkwood/orion world.
> 
>  drivers/gpio/gpio-mvebu.c |   23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index cf7afb9..be65c04 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -92,6 +92,11 @@ static inline void __iomem *mvebu_gpioreg_out(struct
> mvebu_gpio_chip *mvchip) return mvchip->membase + GPIO_OUT_OFF;
>  }
> 
> +static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip
> *mvchip) +{
> +	return mvchip->membase + GPIO_BLINK_EN_OFF;
> +}
> +
>  static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip
> *mvchip) {
>  	return mvchip->membase + GPIO_IO_CONF_OFF;
> @@ -206,6 +211,23 @@ static int mvebu_gpio_get(struct gpio_chip *chip,
> unsigned pin) return (u >> pin) & 1;
>  }
> 
> +static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int
> value) +{
> +	struct mvebu_gpio_chip *mvchip =
> +		container_of(chip, struct mvebu_gpio_chip, chip);
> +	unsigned long flags;
> +	u32 u;
> +
> +	spin_lock_irqsave(&mvchip->lock, flags);
> +	u = readl_relaxed(mvebu_gpioreg_blink(mvchip));
> +	if (value)
> +		u |= 1 << pin;
> +	else
> +		u &= ~(1 << pin);
> +	writel_relaxed(u, mvebu_gpioreg_blink(mvchip));
> +	spin_unlock_irqrestore(&mvchip->lock, flags);
> +}
> +
>  static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned
> pin) {
>  	struct mvebu_gpio_chip *mvchip =
> @@ -244,6 +266,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip
> *chip, unsigned pin, if (ret)
>  		return ret;
> 
> +	mvebu_gpio_blink(chip, pin, 0);
>  	mvebu_gpio_set(chip, pin, value);
> 
>  	spin_lock_irqsave(&mvchip->lock, flags);

Tested-by: Michael Walle <michael@walle.cc>


-- 
Michael

^ permalink raw reply

* [PATCH 8/9] ARM: Kirkwood: Convert lsxl boards to pinctrl.
From: Michael Walle @ 2012-10-28 16:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351090434-30499-9-git-send-email-andrew@lunn.ch>

[This is also includes the annotations from my previous reply. I missed the 
mpp43<->mpp48 in my previous reply]

Am Mittwoch 24 Oktober 2012, 16:53:53 schrieb Andrew Lunn:
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  arch/arm/boot/dts/kirkwood-lsxl.dtsi |   67
> ++++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-lsxl.c  | 
>  19 ----------
>  2 files changed, 67 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
> b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 8fea375..01d6e3a 100644
> --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
> +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
> @@ -6,6 +6,73 @@
>  	};
> 
>  	ocp at f1000000 {
> +		pinctrl: pinctrl at 10000 {
> +			compatible = "marvell,88f6281-pinctrl";
> +			reg = <0x10000 0x20>;
> +
> +			pinctrl-0 = < &pmx_power_hdd &pmx_usb_vbus
> +				      &pmx_fan_low &pmx_fan_high
> +				      &pmx_led_function_red &pmx_led_alarm
> +				      &pmx_led_info &pmx_led_power
> +				      &pmx_fan_lock &pmx_button_function
> +				      &pmx_power_switch &pmx_power_auto_switch
> +				      &pmx_led_function_blue >;
> +			pinctrl-names = "default";
> +
> +			pmx_power_hdd: pmx-power-hdd {
> +				marvell,pins = "mpp10";
> +				marvell,function = "gpio";
gpo

> +			};
> +			pmx_usb_vbus: pmx-usb-vbus {
> +				marvell,pins = "mpp11";
> +				marvell,function = "gpio";
> +			};
> +			pmx_fan_high: pmx-fan-high {
> +				marvell,pins = "mpp18";
> +				marvell,function = "gpo";
> +			};
> +			pmx_fan_low: pmx-fan-low {
> +				marvell,pins = "mpp19";
> +				marvell,function = "gpo";
> +			};
> +			pmx_led_function_blue: pmx-led-function-blue {
> +				marvell,pins = "mpp36";
> +				marvell,function = "gpio";
> +			};
> +			pmx_led_alarm: pmx-led-alarm {
> +				marvell,pins = "mpp37";
> +				marvell,function = "gpio";
> +			};
> +			pmx_led_info: pmx-led-info {
> +				marvell,pins = "mpp38";
> +				marvell,function = "gpio";
> +			};
> +			pmx_led_power: pmx-led-power {
> +				marvell,pins = "mpp39";
> +				marvell,function = "gpio";
> +			};
> +			pmx_fan_lock: pmx-fan-lock {
> +				marvell,pins = "mpp40";
> +				marvell,function = "gpo";
gpio

> +			};
> +			pmx_button_function: pmx-button-function {
> +				marvell,pins = "mpp41";
> +				marvell,function = "gpio";
> +			};
> +			pmx_power_switch: pmx-power-switch {
> +				marvell,pins = "mpp42";
> +				marvell,function = "gpio";
> +			};
> +			pmx_power_auto_switch: pmx-power-auto-switch {
> +				marvell,pins = "mpp43";
> +				marvell,function = "gpio";
> +			};
> +			pmx_led_function_red: pmx-led-function_red {
> +				marvell,pins = "mpp43";
mpp48

> +				marvell,function = "gpio";
> +			};
> +
> +		};
>  		sata at 80000 {
>  			status = "okay";
>  			nr-ports = <1>;
> diff --git a/arch/arm/mach-kirkwood/board-lsxl.c
> b/arch/arm/mach-kirkwood/board-lsxl.c index 83d8975..868bdb0 100644
> --- a/arch/arm/mach-kirkwood/board-lsxl.c
> +++ b/arch/arm/mach-kirkwood/board-lsxl.c
> @@ -26,7 +26,6 @@
>  #include <asm/mach/arch.h>
>  #include <mach/kirkwood.h>
>  #include "common.h"
> -#include "mpp.h"
> 
>  static struct mv643xx_eth_platform_data lsxl_ge00_data = {
>  	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
> @@ -36,23 +35,6 @@ static struct mv643xx_eth_platform_data lsxl_ge01_data =
> { .phy_addr	= MV643XX_ETH_PHY_ADDR(8),
>  };
> 
> -static unsigned int lsxl_mpp_config[] __initdata = {
> -	MPP10_GPO,	/* HDD Power Enable */
> -	MPP11_GPIO,	/* USB Vbus Enable */
> -	MPP18_GPO,	/* FAN High Enable# */
> -	MPP19_GPO,	/* FAN Low Enable# */
> -	MPP36_GPIO,	/* Function Blue LED */
> -	MPP37_GPIO,	/* Alarm LED */
> -	MPP38_GPIO,	/* Info LED */
> -	MPP39_GPIO,	/* Power LED */
> -	MPP40_GPIO,	/* Fan Lock */
> -	MPP41_GPIO,	/* Function Button */
> -	MPP42_GPIO,	/* Power Switch */
> -	MPP43_GPIO,	/* Power Auto Switch */
> -	MPP48_GPIO,	/* Function Red LED */
> -	0
> -};
> -
>  #define LSXL_GPIO_FAN_HIGH	18
>  #define LSXL_GPIO_FAN_LOW	19
>  #define LSXL_GPIO_FAN_LOCK	40
> @@ -119,7 +101,6 @@ void __init lsxl_init(void)
>  	/*
>  	 * Basic setup. Needs to be called early.
>  	 */
> -	kirkwood_mpp_conf(lsxl_mpp_config);
> 
>  	/* usb and sata power on */
>  	gpio_set_value(LSXL_GPIO_USB_POWER, 1);


-- 
Michael

^ permalink raw reply

* [PATCH 0/9] ARM: Kirkwood: Convert to pinctrl
From: Andrew Lunn @ 2012-10-28 16:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351090434-30499-1-git-send-email-andrew@lunn.ch>

On Wed, Oct 24, 2012 at 04:53:45PM +0200, Andrew Lunn wrote:
> This patchset converts all DT kirkwood boards to using pinctrl.

Thanks for the feedback everybody gave.

Progress has been made:

The bug causing the lockups has been found, fixed and passed upstream.

I factored out the repeated pinmux definitions for sata0, sata1, spi,
twsi0, uart0, uart1.

I fixed a few types reported by testers.

I found a solution to many of the gpio_request() failures. The ones
for controlling power to SATA or USB i've replaced with a regulator in
DT. The regulator will grab the GPIO, set it to output, and driver it
high/low as required. I just hope we don't have an ordering issue.
The regulator framework seems to load quite early and probes all the
regulators. This fails, because pinctrl has not yet loaded, so the
gpio framework returns EPROBE_DEFER. This is not fatal to the
regulator framework, it tries again later. But this later is after
most of the rest of the drivers have loaded. So we might get into
issues where uboot has not enabled power to USB/SATA, the driver is
probed and fails because of the lack of power, and once things of gone
wrong, we turn the power on.

I still expect problems with GPIOs used for power off. I've not yet
touched them. Again, a regulator makes sense, but there is no 'out of
the box' regulator type or property which adds itself to pm_power_off.

The last problem is:

        /* Set NAS to turn back on after a power failure */
        dnskw_gpio_register(37, "dnskw:power:recover", 1);

I think its a bit of a stretch calling this a regulator.

Since the current patchset is 18 patches, plus a few other bug fixes
and dependencies, i'm not going to post them all here. I think we are
still at the smoke/no-smoke stage of testing. Please pull from:

git://github.com/lunn/linux.git v3.7-rc2-pinctrl-v2

and let me know if things work, what typo's need fixing, where the
smoke comes out, etc.

      Thanks
	Andrew

^ permalink raw reply

* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Marko Katić @ 2012-10-28 17:03 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351438946-5331-1-git-send-email-anarsoul@gmail.com>

On Sun, Oct 28, 2012 at 4:42 PM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> This driver controls mode of USB port #2 pins - device or host.
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  arch/arm/mach-pxa/Kconfig         |   7 +++
>  arch/arm/mach-pxa/Makefile        |   1 +
>  arch/arm/mach-pxa/z2-usb-switch.c | 100 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 108 insertions(+)
>  create mode 100644 arch/arm/mach-pxa/z2-usb-switch.c
>
> diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
> index 11aa739..5fffc4b 100644
> --- a/arch/arm/mach-pxa/Kconfig
> +++ b/arch/arm/mach-pxa/Kconfig
> @@ -630,6 +630,13 @@ config MACH_ZIPIT2
>         bool "Zipit Z2 Handheld"
>         select HAVE_PWM
>         select PXA27x
> +
> +config Z2_USB_SWITCH
> +       tristate "Control the state of USB port on Zipit Z2"
> +       depends on MACH_ZIPIT2
> +       help
> +         This is a simple driver that is able to control
> +         usb mode of Zipit Z2
>  endif
>  endmenu
>
> diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
> index ee88d6e..86a032f 100644
> --- a/arch/arm/mach-pxa/Makefile
> +++ b/arch/arm/mach-pxa/Makefile
> @@ -99,3 +99,4 @@ obj-$(CONFIG_MACH_RAUMFELD_SPEAKER)   += raumfeld.o
>  obj-$(CONFIG_MACH_ZIPIT2)      += z2.o
>
>  obj-$(CONFIG_TOSA_BT)          += tosa-bt.o
> +obj-$(CONFIG_Z2_USB_SWITCH)    += z2-usb-switch.o
> diff --git a/arch/arm/mach-pxa/z2-usb-switch.c b/arch/arm/mach-pxa/z2-usb-switch.c
> new file mode 100644
> index 0000000..9583092
> --- /dev/null
> +++ b/arch/arm/mach-pxa/z2-usb-switch.c
> @@ -0,0 +1,100 @@
> +/*
> + * USB mode switcher for Z2
> + *
> + * Copyright (c) 2011 Vasily Khoruzhick
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/delay.h>
> +
> +#include <mach/pxa27x.h>
> +#include <mach/pxa27x-udc.h>
> +
> +#include <asm/io.h>
> +
> +#define MIN(a, b) ((a) < (b) ? (a) : (b))
> +
> +static ssize_t usb_mode_show(struct device *dev, struct device_attribute *attr,
> +       char *buf)
> +{
> +       if (UP2OCR & UP2OCR_HXS)
> +               return sprintf(buf, "host\n");
> +       else
> +               return sprintf(buf, "device\n");
> +}
> +
> +static ssize_t usb_mode_set(struct device *dev, struct device_attribute *attr,
> +       const char *buf, size_t count)
> +{
> +       if (strncmp(buf, "host", MIN(count, 4)) == 0) {
> +               UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
> +               return count;
> +       } else if (strncmp(buf, "device", MIN(count, 6)) == 0) {
> +               UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
> +               return count;
> +       }
> +       return -EINVAL;
> +}
> +
> +static DEVICE_ATTR(usb_mode, 0644, usb_mode_show, usb_mode_set);
> +
> +static const struct attribute *attrs[] = {
> +       &dev_attr_usb_mode.attr,
> +       NULL,
> +};
> +
> +static const struct attribute_group attr_group = {
> +       .attrs  = (struct attribute **)attrs,
> +};
> +
> +static int z2_usb_switch_probe(struct platform_device *dev)
> +{
> +       int res;
> +
> +       res = sysfs_create_group(&dev->dev.kobj, &attr_group);
> +       if (res)
> +               return res;
> +
> +       UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
> +
> +       return 0;
> +}
> +
> +static int __devexit z2_usb_switch_remove(struct platform_device *dev)
> +{
> +       UP2OCR = UP2OCR_HXOE;
> +       sysfs_remove_group(&dev->dev.kobj, &attr_group);
> +
> +       return 0;
> +}
> +
> +static struct platform_driver z2_usb_switch_driver = {
> +       .probe = z2_usb_switch_probe,
> +       .remove = __devexit_p(z2_usb_switch_remove),
> +
> +       .driver = {
> +               .name = "z2-usb-switch",
> +               .owner = THIS_MODULE,
> +       },
> +};
> +
> +
> +static int __init z2_usb_switch_init(void)
> +{
> +       return platform_driver_register(&z2_usb_switch_driver);
> +}
> +
> +static void __exit z2_usb_switch_exit(void)
> +{
> +       platform_driver_unregister(&z2_usb_switch_driver);
> +}
> +
> +module_init(z2_usb_switch_init);
> +module_exit(z2_usb_switch_exit);
> --
> 1.7.12.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


A more fitting name might be something like "pxa270-usb-switch", since
this isn't really z2 specific. Other pxa270 based devices could use it
aswell.

^ permalink raw reply

* irq_set_chained_handler() called too early for hwirq to be initialized
From: Thomas Gleixner @ 2012-10-28 17:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <508D55C9.3030702@antcom.de>

On Sun, 28 Oct 2012, Roland Stigge wrote:
> 
> consider arch/arm/mach-lpc32xx/irq.c: irq_set_chained_handler() is
> called at a point where it accesses
> irq_to_desc(IRQ_LPC32XX_SUB2IRQ)->irq_data.hwirq but which is not yet
> initialized.

None of the functions which are called inside of
irq_set_chained_handler() touches desc->irq_data.hwirq.

So what are you talking about?

I just had a look into that lpc32xx irq code. At the end of
lpc32xx_init_irq():

        irq_base = irq_alloc_descs(-1, 0, NR_IRQS, 0);
        if (irq_base < 0) {
                pr_warn("Cannot allocate irq_descs, assuming pre-allocated\n");
                irq_base = 0;
        }

That's just hilarious.

Of course are the interrupts preallocated, simply because
machine_desc->nr_irqs is 0 and therefor the ARM core code allocates
NR_IRQS irq descriptors in the early setup way before
lpc32xx_init_irq() is called.

If those interrupts would not be preallocated, then the code would
fail to initialize any interrupt at all. And of course nothing would
notice as all function calls to set_irq_* do not check the return
value.

That brilliant thing came in via commit f5c42271 (ARM: LPC32xx: Device
tree support). I have no idea from where you copied that and why you
thought putting it at the end of the init function would be a good
idea.

Though, that has nothing todo with your problem description above.

Thanks,

	tglx

^ permalink raw reply

* [PATCH RESEND] ARM: pxa27x_keypad: clear pending interrupts on keypad config
From: Robert Jarzmik @ 2012-10-28 17:55 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351439163-9575-1-git-send-email-anarsoul@gmail.com>

Vasily Khoruzhick <anarsoul@gmail.com> writes:

> Bootloader can leave interrupt bit pending, and it confuses driver.
OK, looks good to me.
One question though, just to make sure everything is covered :
  Suppose that the resume is the consequence of keypad press. If anybody relied
  previously on "reading the keypad" to know which key was pressed to wakeup the
  SoC, is it still working after your patch ?

And I suppose you can't "convince" your bootloader to behave correctly, can you ?

Cheers.

--
Robert

^ permalink raw reply

* [PATCH RESEND] ARM: pxa27x_keypad: clear pending interrupts on keypad config
From: Vasily Khoruzhick @ 2012-10-28 18:09 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <87vcduwkfa.fsf@free.fr>

On Sun, Oct 28, 2012 at 8:55 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Vasily Khoruzhick <anarsoul@gmail.com> writes:
>
>> Bootloader can leave interrupt bit pending, and it confuses driver.
> OK, looks good to me.
> One question though, just to make sure everything is covered :
>   Suppose that the resume is the consequence of keypad press. If anybody relied
>   previously on "reading the keypad" to know which key was pressed to wakeup the
>   SoC, is it still working after your patch ?

Hi Robert,

Code from git master will not call pxa27x_keypad_config on resume if
device can cause wakeup,
so everything is OK (however it's another issue for pxa27x, because
device is not resuming correctly)

> And I suppose you can't "convince" your bootloader to behave correctly, can you ?

It behaves correctly, it just can't handle last keypress (because it's
booting Linux).
Even if it would be possible to fix this issue in bootloader it's
always nice to keep driver
failure-proof, so it does not fail even if bootloader left something
in non-consistent state.

Regards
Vasily

^ permalink raw reply

* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Vasily Khoruzhick @ 2012-10-28 18:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAHod+GfMLV400L4p7=5j1TOGW=66jkBF1_VWx_gRYEF8=T11kQ@mail.gmail.com>

On Sun, Oct 28, 2012 at 8:03 PM, Marko Kati? <dromede@gmail.com> wrote:
>
> A more fitting name might be something like "pxa270-usb-switch", since
> this isn't really z2 specific. Other pxa270 based devices could use it
> aswell.

Sure. I'll wait for few more comments before sending v3 with fixed name.

Regards
Vasily

^ permalink raw reply

* [PATCH 0/9] ARM: Kirkwood: Convert to pinctrl
From: Michael Walle @ 2012-10-28 18:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121028165711.GG15824@lunn.ch>


Hi Andrew,

Am Sonntag 28 Oktober 2012, 17:57:11 schrieb Andrew Lunn:
> Since the current patchset is 18 patches, plus a few other bug fixes
> and dependencies, i'm not going to post them all here. I think we are
> still at the smoke/no-smoke stage of testing. Please pull from:
> 
> git://github.com/lunn/linux.git v3.7-rc2-pinctrl-v2
> 
> and let me know if things work, what typo's need fixing, where the
> smoke comes out, etc.

works for me now.

Thanks, Andrew

-- 
michael

^ permalink raw reply

* [PATCH] ARM: AM33xx: add support for reboot
From: Daniel Mack @ 2012-10-28 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the ability to reboot am33xx-based systems.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 arch/arm/mach-omap2/board-generic.c | 1 +
 arch/arm/mach-omap2/prcm.c          | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 601ecdf..6a69ceb 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_machine	= omap_generic_init,
 	.timer		= &omap3_am33xx_timer,
 	.dt_compat	= am33xx_boards_compat,
+	.restart	= omap_prcm_restart,
 MACHINE_END
 #endif
 
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 0f51e03..8a3068a 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -32,6 +32,7 @@
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
+#include "prm33xx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"
@@ -72,6 +73,11 @@ void omap_prcm_restart(char mode, const char *cmd)
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx()) {
 		omap4_prminst_global_warm_sw_reset(); /* never returns */
+	} else if (soc_is_am33xx()) {
+		prcm_offs = AM33XX_PRM_DEVICE_MOD;
+		omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
+					   prcm_offs,
+					   AM33XX_PRM_RSTCTRL_OFFSET);
 	} else {
 		WARN_ON(1);
 	}
-- 
1.7.11.7

^ permalink raw reply related

* [PATCH v3 0/6] DT support for AT91RM9200
From: Joachim Eastwood @ 2012-10-28 18:31 UTC (permalink / raw)
  To: linux-arm-kernel

Patch 1 is a fix for a build failure which can happen if board-dt is enabled when no AT91SAM machines are enabled.

Patch 2 adds DT support to the AT91RM9200 system timer. Based on AT91 PIT patch by Jean-Christophe PLAGNIOL-VILLARD.

Patch 3 adds clock lookups for DT.

Patch 4 adds a new board for RM9200 DT support.

Patch 5-6 adds the base devicetree for AT91RM9200 and support for AT91RM9200-EK board.


I don't have a AT91RM9200-EK to test on but I was able to boot at91rm9200ek.dts on my custom board using a initrd. As far as I can tell pinctrl, usart and ohci all work.

Patches based on linux-next.


Joachim Eastwood (6):
  ARM: AT91: Fix build failure on board-dt
  ARM: AT91: Add DT support to AT91RM9200 System Timer
  ARM: AT91: Add usart/tc/pio/ohci DT clock lookup to AT91RM9200
  ARM: AT91: Add AT91RM9200 DT board
  ARM: AT91: Add AT91RM9200 device tree
  ARM: AT91: Add AT91RM9200EK board device tree

 .../devicetree/bindings/arm/atmel-at91.txt         |   6 +
 arch/arm/boot/dts/Makefile                         |   2 +
 arch/arm/boot/dts/at91rm9200.dtsi                  | 333 +++++++++++++++++++++
 arch/arm/boot/dts/at91rm9200ek.dts                 |  78 +++++
 arch/arm/mach-at91/Kconfig                         |   9 +
 arch/arm/mach-at91/Makefile                        |   1 +
 arch/arm/mach-at91/at91rm9200.c                    |  18 ++
 arch/arm/mach-at91/at91rm9200_time.c               |  63 +++-
 arch/arm/mach-at91/board-rm9200-dt.c               |  59 ++++
 arch/arm/mach-at91/generic.h                       |   1 +
 arch/arm/mach-at91/setup.c                         |  14 +
 11 files changed, 582 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boot/dts/at91rm9200.dtsi
 create mode 100644 arch/arm/boot/dts/at91rm9200ek.dts
 create mode 100644 arch/arm/mach-at91/board-rm9200-dt.c

-- 
1.8.0

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox