RE: [PATCH 00/90] staging: comedi: cleanup the pci_dev usage

2012-07-19 Thread H Hartley Sweeten
On Thursday, July 19, 2012 4:53 PM, Greg KH wrote:
> On Wed, Jul 18, 2012 at 06:23:20PM -0700, H Hartley Sweeten wrote:
>> All the comedi pci drivers currently store a pointer to the pci_dev
>> in their private data. We can use the 'struct device *hw_dev' variable
>> in the comedi_device struct instead and introduce a wrapper for
>> to_pci_dev() to allow the drivers to easily get the pci_dev.
>> 
>> This patchset does just that. It also removes the private data from
>> the drivers that no longer needed it.
>> 
>> Some of the drivers required a bit of cleanup to their "find pci device"
>> code or the private data in order to make the conversion cleaner.
>> 
>> There are still a couple drivers, specifically the ni and addi ones,
>> that need additional work before they can be converted cleanly.
>
> I've applied all of these (with the updated 01/90 patch).  Can you
> please send follow-on patches to resolve the issues that Ian pointed
> out?

Thanks! I was a bit worried about having to repost the whole set
again. ;-)

I'm working on the issues now. You should see it tomorrow.

Regards,
Hartley

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


[PATCH v2] pwm: add ep93xx PWM support

2013-10-15 Thread H Hartley Sweeten
Remove the non-standard EP93xx PWM driver in drivers/misc and add
a new driver for the PWM controllers on the EP93xx platform based
on the PWM framework.

These PWM controllers each support 1 PWM channel with programmable
duty cycle, frequency, and polarity inversion.

Signed-off-by: H Hartley Sweeten 
Cc: Ryan Mallon 
Cc: Thierry Reding 
Cc: Arnd Bergmann 
Cc: Greg Kroah-Hartman 
---
v2: address issues pointed out by Thierry Reding.

 drivers/misc/Kconfig  |  13 ---
 drivers/misc/Makefile |   1 -
 drivers/misc/ep93xx_pwm.c | 286 --
 drivers/pwm/Kconfig   |   9 ++
 drivers/pwm/Makefile  |   1 +
 drivers/pwm/pwm-ep93xx.c  | 230 +
 6 files changed, 240 insertions(+), 300 deletions(-)
 delete mode 100644 drivers/misc/ep93xx_pwm.c
 create mode 100644 drivers/pwm/pwm-ep93xx.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 8dacd4c..c43c66a 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -381,19 +381,6 @@ config HMC6352
  This driver provides support for the Honeywell HMC6352 compass,
  providing configuration and heading data via sysfs.
 
-config EP93XX_PWM
-   tristate "EP93xx PWM support"
-   depends on ARCH_EP93XX
-   help
- This option enables device driver support for the PWM channels
- on the Cirrus EP93xx processors.  The EP9307 chip only has one
- PWM channel all the others have two, the second channel is an
- alternate function of the EGPIO14 pin.  A sysfs interface is
- provided to control the PWM channels.
-
- To compile this driver as a module, choose M here: the module will
- be called ep93xx_pwm.
-
 config DS1682
tristate "Dallas DS1682 Total Elapsed Time Recorder with Alarm"
depends on I2C
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c235d5b..ecccd00 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -33,7 +33,6 @@ obj-$(CONFIG_APDS9802ALS) += apds9802als.o
 obj-$(CONFIG_ISL29003) += isl29003.o
 obj-$(CONFIG_ISL29020) += isl29020.o
 obj-$(CONFIG_SENSORS_TSL2550)  += tsl2550.o
-obj-$(CONFIG_EP93XX_PWM)   += ep93xx_pwm.o
 obj-$(CONFIG_DS1682)   += ds1682.o
 obj-$(CONFIG_TI_DAC7512)   += ti_dac7512.o
 obj-$(CONFIG_C2PORT)   += c2port/
diff --git a/drivers/misc/ep93xx_pwm.c b/drivers/misc/ep93xx_pwm.c
deleted file mode 100644
index cdb67a9..000
--- a/drivers/misc/ep93xx_pwm.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- *  Simple PWM driver for EP93XX
- *
- * (c) Copyright 2009  Matthieu Crapet 
- * (c) Copyright 2009  H Hartley Sweeten 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- *  EP9307 has only one channel:
- *- PWMOUT
- *
- *  EP9301/02/12/15 have two channels:
- *- PWMOUT
- *- PWMOUT1 (alternate function for EGPIO14)
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define EP93XX_PWMx_TERM_COUNT 0x00
-#define EP93XX_PWMx_DUTY_CYCLE 0x04
-#define EP93XX_PWMx_ENABLE 0x08
-#define EP93XX_PWMx_INVERT 0x0C
-
-#define EP93XX_PWM_MAX_COUNT   0x
-
-struct ep93xx_pwm {
-   void __iomem*mmio_base;
-   struct clk  *clk;
-   u32 duty_percent;
-};
-
-/*
- * /sys/devices/platform/ep93xx-pwm.N
- *   /min_freq  read-only   minimum pwm output frequency
- *   /max_req   read-only   maximum pwm output frequency
- *   /freq  read-write  pwm output frequency (0 = disable output)
- *   /duty_percent  read-write  pwm duty cycle percent (1..99)
- *   /invertread-write  invert pwm output
- */
-
-static ssize_t ep93xx_pwm_get_min_freq(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
-   unsigned long rate = clk_get_rate(pwm->clk);
-
-   return sprintf(buf, "%ld\n", rate / (EP93XX_PWM_MAX_COUNT + 1));
-}
-
-static ssize_t ep93xx_pwm_get_max_freq(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
-   unsigned long rate = clk_get_rate(pwm->clk);
-
-   return sprintf(buf, "%ld\n", rate / 2);
-}
-
-static ssize_t ep93xx_pwm_get_freq(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
-
-   if (readl(pwm->mmio_base + EP93XX_PWMx_EN

[PATCH 0/2 v3] usb: ohci: remove ep93xx bus glue driver

2013-10-17 Thread H Hartley Sweeten
Refresh the ep93xx_defconfig then remove the ep93xx OHCI bus glue
driver in favor of the Generic OHCI driver for a platform device.

v3: split patch to refresh the ep93xx_defconfig before removing
ohci-ep93xx.c in favor of the Generic OHCI driver for a
platform device.

v2: Use the (*power_off) callback for (*power_suspend), as
suggested by Alan Stern.
Remove the Kconfig change to USB_OHCI_HCD_PLATFORM and
refresh the ep93xx_defconfig to enable this option, as
suggested by Alan Stern.

H Hartley Sweeten (2):
  ARM: ep93xx_defconfig: cleanup ep93xx_defconfig
  usb: ohci: remove ep93xx bus glue platform driver

 arch/arm/configs/ep93xx_defconfig |  17 +---
 arch/arm/mach-ep93xx/clock.c  |   2 +-
 arch/arm/mach-ep93xx/core.c   |  40 -
 drivers/usb/host/ohci-ep93xx.c| 184 --
 drivers/usb/host/ohci-hcd.c   |  18 
 5 files changed, 40 insertions(+), 221 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-ep93xx.c

-- 
1.8.3.2

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


[PATCH 1/2 v3] ARM: ep93xx_defconfig: cleanup ep93xx_defconfig

2013-10-17 Thread H Hartley Sweeten
Generate ep93xx_defconfig by doing:

make ep93xx_defconfig
make savedefconfig
mv defconfig arch/arm/configs/ep93xx_defconfig

No functional change. This just refreshes the ep93xx_defconfig to make it
easier and cleaner when adding new entries.

Signed-off-by: H Hartley Sweeten 
Cc: Ryan Mallon 
Cc: Alan Stern 
Cc: Lennert Buytenhek 
Cc: Greg Kroah-Hartman 
Cc: Olof Johansson 
Cc: Russell King 
---
 arch/arm/configs/ep93xx_defconfig | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/configs/ep93xx_defconfig 
b/arch/arm/configs/ep93xx_defconfig
index 806005a..8eccbcb 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -1,15 +1,14 @@
-CONFIG_EXPERIMENTAL=y
 CONFIG_SYSVIPC=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
-CONFIG_SYSFS_DEPRECATED_V2=y
 CONFIG_EXPERT=y
 CONFIG_SLAB=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
+CONFIG_PARTITION_ADVANCED=y
 # CONFIG_IOSCHED_CFQ is not set
 CONFIG_ARCH_EP93XX=y
 CONFIG_CRUNCH=y
@@ -47,11 +46,8 @@ CONFIG_IPV6=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_REDBOOT_PARTS=y
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -67,15 +63,14 @@ CONFIG_SCSI=y
 # CONFIG_SCSI_PROC_FS is not set
 CONFIG_BLK_DEV_SD=y
 CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
 CONFIG_EP93XX_ETH=y
 CONFIG_USB_RTL8150=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
+# CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_AMBA_PL010=y
 CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
-# CONFIG_LEGACY_PTYS is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
@@ -86,7 +81,6 @@ CONFIG_WATCHDOG=y
 CONFIG_EP93XX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_USB_DEBUG=y
-CONFIG_USB_DEVICEFS=y
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_STORAGE=y
@@ -100,24 +94,18 @@ CONFIG_RTC_DRV_EP93XX=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 # CONFIG_EXT3_FS_XATTR is not set
-CONFIG_INOTIFY=y
 CONFIG_VFAT_FS=y
 CONFIG_TMPFS=y
 CONFIG_JFFS2_FS=y
 CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
 CONFIG_ROOT_NFS=y
-CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_SLAB=y
 CONFIG_DEBUG_SPINLOCK=y
 CONFIG_DEBUG_MUTEXES=y
-# CONFIG_RCU_CPU_STALL_DETECTOR is not set
 CONFIG_DEBUG_USER=y
-CONFIG_DEBUG_ERRORS=y
 CONFIG_DEBUG_LL=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_LIBCRC32C=y
-- 
1.8.3.2

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


[PATCH 2/2 v3] usb: ohci: remove ep93xx bus glue platform driver

2013-10-17 Thread H Hartley Sweeten
Convert ep93xx to use the OHCI platform driver and remove the
ohci-ep93xx bus glue driver.

Enable CONFIG_OHCI_HCD_PLATFORM in the ep93xx_defconfig so that USB
is still enabled by default on the EP93xx platform.

Signed-off-by: H Hartley Sweeten 
Cc: Ryan Mallon 
Cc: Alan Stern 
Cc: Lennert Buytenhek 
Cc: Greg Kroah-Hartman 
Cc: Olof Johansson 
Cc: Russell King 
---
 arch/arm/configs/ep93xx_defconfig |   1 +
 arch/arm/mach-ep93xx/clock.c  |   2 +-
 arch/arm/mach-ep93xx/core.c   |  40 -
 drivers/usb/host/ohci-ep93xx.c| 184 --
 drivers/usb/host/ohci-hcd.c   |  18 
 5 files changed, 38 insertions(+), 207 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-ep93xx.c

diff --git a/arch/arm/configs/ep93xx_defconfig 
b/arch/arm/configs/ep93xx_defconfig
index 8eccbcb..6ac5ea7 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -83,6 +83,7 @@ CONFIG_USB=y
 CONFIG_USB_DEBUG=y
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_SERIAL=y
 CONFIG_USB_SERIAL_CONSOLE=y
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index c95dbce..39ef3b6 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -212,7 +212,7 @@ static struct clk_lookup clocks[] = {
INIT_CK(NULL,   "hclk", &clk_h),
INIT_CK(NULL,   "apb_pclk", &clk_p),
INIT_CK(NULL,   "pll2", &clk_pll2),
-   INIT_CK("ep93xx-ohci",  NULL,   &clk_usb_host),
+   INIT_CK("ohci-platform",NULL,   &clk_usb_host),
INIT_CK("ep93xx-keypad",NULL,   &clk_keypad),
INIT_CK("ep93xx-fb",NULL,   &clk_video),
INIT_CK("ep93xx-spi.0", NULL,   &clk_spi),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 3f12b88..92d59c4 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -297,22 +298,53 @@ static struct platform_device ep93xx_rtc_device = {
.resource   = ep93xx_rtc_resource,
 };
 
+/*
+ * EP93xx OHCI USB Host
+ */
+
+static struct clk *ep93xx_ohci_host_clock;
+
+static int ep93xx_ohci_power_on(struct platform_device *pdev)
+{
+   if (!ep93xx_ohci_host_clock) {
+   ep93xx_ohci_host_clock = devm_clk_get(&pdev->dev, NULL);
+   if (IS_ERR(ep93xx_ohci_host_clock))
+   return PTR_ERR(ep93xx_ohci_host_clock);
+   }
+
+   clk_enable(ep93xx_ohci_host_clock);
+
+   return 0;
+}
+
+static void ep93xx_ohci_power_off(struct platform_device *pdev)
+{
+   clk_disable(ep93xx_ohci_host_clock);
+}
+
+static struct usb_ohci_pdata ep93xx_ohci_pdata = {
+   .power_on   = ep93xx_ohci_power_on,
+   .power_off  = ep93xx_ohci_power_off,
+   .power_suspend  = ep93xx_ohci_power_off,
+};
 
 static struct resource ep93xx_ohci_resources[] = {
DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000),
DEFINE_RES_IRQ(IRQ_EP93XX_USB),
 };
 
+static u64 ep93xx_ohci_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device ep93xx_ohci_device = {
-   .name   = "ep93xx-ohci",
+   .name   = "ohci-platform",
.id = -1,
+   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
+   .resource   = ep93xx_ohci_resources,
.dev= {
-   .dma_mask   = 
&ep93xx_ohci_device.dev.coherent_dma_mask,
+   .dma_mask   = &ep93xx_ohci_dma_mask,
.coherent_dma_mask  = DMA_BIT_MASK(32),
+   .platform_data  = &ep93xx_ohci_pdata,
},
-   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
-   .resource   = ep93xx_ohci_resources,
 };
 
 
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
deleted file mode 100644
index 84a20d5..000
--- a/drivers/usb/host/ohci-ep93xx.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber 
- * (C) Copyright 2000-2002 David Brownell 
- * (C) Copyright 2002 Hewlett-Packard Company
- *
- * Bus Glue for ep93xx.
- *
- * Written by Christopher Hoover 
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ohci-sa.c
- *  by Durgesh Pattamatta 
- *
- * Modified for pxa27x from ohci-lh7a404.c
- *  by Nick Bane  26-8-2004
- *
- * Modified for ep93x

[PATCH 0/2 v4] usb: ohci: remove ep93xx bus glue platform driver

2013-10-17 Thread H Hartley Sweeten
Refresh the ep93xx_defconfig then remove the ep93xx OHCI bus glue
driver in favor of the Generic OHCI driver for a platform device.

v4: propagate errno from clk_enable() in ep93xx_ohci_power_on().

v3: split patch to refresh the ep93xx_defconfig before removing
ohci-ep93xx.c in favor of the Generic OHCI driver for a
platform device.

v2: Use the (*power_off) callback for (*power_suspend), as
suggested by Alan Stern.
Remove the Kconfig change to USB_OHCI_HCD_PLATFORM and
refresh the ep93xx_defconfig to enable this option, as
suggested by Alan Stern.


H Hartley Sweeten (2):
  ARM: ep93xx_defconfig: cleanup ep93xx_defconfig
  usb: ohci: remove ep93xx bus glue platform driver

 arch/arm/configs/ep93xx_defconfig |  17 +---
 arch/arm/mach-ep93xx/clock.c  |   2 +-
 arch/arm/mach-ep93xx/core.c   |  38 +++-
 drivers/usb/host/ohci-ep93xx.c| 184 --
 drivers/usb/host/ohci-hcd.c   |  18 
 5 files changed, 38 insertions(+), 221 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-ep93xx.c

-- 
1.8.3.2

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


[PATCH 2/2 v4] usb: ohci: remove ep93xx bus glue platform driver

2013-10-17 Thread H Hartley Sweeten
Convert ep93xx to use the OHCI platform driver and remove the
ohci-ep93xx bus glue driver.

Enable CONFIG_OHCI_HCD_PLATFORM in the ep93xx_defconfig so that USB
is still enabled by default on the EP93xx platform.

Signed-off-by: H Hartley Sweeten 
Acked-by: Alan Stern 
Cc: Ryan Mallon 
Cc: Lennert Buytenhek 
Cc: Greg Kroah-Hartman 
Cc: Olof Johansson 
Cc: Russell King 
---
 arch/arm/configs/ep93xx_defconfig |   1 +
 arch/arm/mach-ep93xx/clock.c  |   2 +-
 arch/arm/mach-ep93xx/core.c   |  38 +++-
 drivers/usb/host/ohci-ep93xx.c| 184 --
 drivers/usb/host/ohci-hcd.c   |  18 
 5 files changed, 36 insertions(+), 207 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-ep93xx.c

diff --git a/arch/arm/configs/ep93xx_defconfig 
b/arch/arm/configs/ep93xx_defconfig
index 8eccbcb..6ac5ea7 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -83,6 +83,7 @@ CONFIG_USB=y
 CONFIG_USB_DEBUG=y
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_SERIAL=y
 CONFIG_USB_SERIAL_CONSOLE=y
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index c95dbce..39ef3b6 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -212,7 +212,7 @@ static struct clk_lookup clocks[] = {
INIT_CK(NULL,   "hclk", &clk_h),
INIT_CK(NULL,   "apb_pclk", &clk_p),
INIT_CK(NULL,   "pll2", &clk_pll2),
-   INIT_CK("ep93xx-ohci",  NULL,   &clk_usb_host),
+   INIT_CK("ohci-platform",NULL,   &clk_usb_host),
INIT_CK("ep93xx-keypad",NULL,   &clk_keypad),
INIT_CK("ep93xx-fb",NULL,   &clk_video),
INIT_CK("ep93xx-spi.0", NULL,   &clk_spi),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 3f12b88..9408fde 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -297,22 +298,51 @@ static struct platform_device ep93xx_rtc_device = {
.resource   = ep93xx_rtc_resource,
 };
 
+/*
+ * EP93xx OHCI USB Host
+ */
+
+static struct clk *ep93xx_ohci_host_clock;
+
+static int ep93xx_ohci_power_on(struct platform_device *pdev)
+{
+   if (!ep93xx_ohci_host_clock) {
+   ep93xx_ohci_host_clock = devm_clk_get(&pdev->dev, NULL);
+   if (IS_ERR(ep93xx_ohci_host_clock))
+   return PTR_ERR(ep93xx_ohci_host_clock);
+   }
+
+   return clk_enable(ep93xx_ohci_host_clock);
+}
+
+static void ep93xx_ohci_power_off(struct platform_device *pdev)
+{
+   clk_disable(ep93xx_ohci_host_clock);
+}
+
+static struct usb_ohci_pdata ep93xx_ohci_pdata = {
+   .power_on   = ep93xx_ohci_power_on,
+   .power_off  = ep93xx_ohci_power_off,
+   .power_suspend  = ep93xx_ohci_power_off,
+};
 
 static struct resource ep93xx_ohci_resources[] = {
DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000),
DEFINE_RES_IRQ(IRQ_EP93XX_USB),
 };
 
+static u64 ep93xx_ohci_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device ep93xx_ohci_device = {
-   .name   = "ep93xx-ohci",
+   .name   = "ohci-platform",
.id = -1,
+   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
+   .resource   = ep93xx_ohci_resources,
.dev= {
-   .dma_mask   = 
&ep93xx_ohci_device.dev.coherent_dma_mask,
+   .dma_mask   = &ep93xx_ohci_dma_mask,
.coherent_dma_mask  = DMA_BIT_MASK(32),
+   .platform_data  = &ep93xx_ohci_pdata,
},
-   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
-   .resource   = ep93xx_ohci_resources,
 };
 
 
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
deleted file mode 100644
index 84a20d5..000
--- a/drivers/usb/host/ohci-ep93xx.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber 
- * (C) Copyright 2000-2002 David Brownell 
- * (C) Copyright 2002 Hewlett-Packard Company
- *
- * Bus Glue for ep93xx.
- *
- * Written by Christopher Hoover 
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ohci-sa.c
- *  by Durgesh Pattamatta 
- *
- * Modified for pxa27x from ohci-lh7a404.c
- *  by Nick Bane  26-8-2004
- *
- * Modified for ep93xx from ohci-pxa27x

[PATCH 1/2 v4] ARM: ep93xx_defconfig: cleanup ep93xx_defconfig

2013-10-17 Thread H Hartley Sweeten
Generate ep93xx_defconfig by doing:

make ep93xx_defconfig
make savedefconfig
mv defconfig arch/arm/configs/ep93xx_defconfig

No function change. This just refreshes the ep93xx_defconfig to make it
easier and cleaner when adding new entries.

Signed-off-by: H Hartley Sweeten 
Acked-by: Ryan Mallon 
Cc: Alan Stern 
Cc: Lennert Buytenhek 
Cc: Greg Kroah-Hartman 
Cc: Olof Johansson 
Cc: Russell King 
---
 arch/arm/configs/ep93xx_defconfig | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/configs/ep93xx_defconfig 
b/arch/arm/configs/ep93xx_defconfig
index 806005a..8eccbcb 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -1,15 +1,14 @@
-CONFIG_EXPERIMENTAL=y
 CONFIG_SYSVIPC=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
-CONFIG_SYSFS_DEPRECATED_V2=y
 CONFIG_EXPERT=y
 CONFIG_SLAB=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
+CONFIG_PARTITION_ADVANCED=y
 # CONFIG_IOSCHED_CFQ is not set
 CONFIG_ARCH_EP93XX=y
 CONFIG_CRUNCH=y
@@ -47,11 +46,8 @@ CONFIG_IPV6=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_REDBOOT_PARTS=y
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -67,15 +63,14 @@ CONFIG_SCSI=y
 # CONFIG_SCSI_PROC_FS is not set
 CONFIG_BLK_DEV_SD=y
 CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
 CONFIG_EP93XX_ETH=y
 CONFIG_USB_RTL8150=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
+# CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_AMBA_PL010=y
 CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
-# CONFIG_LEGACY_PTYS is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
@@ -86,7 +81,6 @@ CONFIG_WATCHDOG=y
 CONFIG_EP93XX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_USB_DEBUG=y
-CONFIG_USB_DEVICEFS=y
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_STORAGE=y
@@ -100,24 +94,18 @@ CONFIG_RTC_DRV_EP93XX=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 # CONFIG_EXT3_FS_XATTR is not set
-CONFIG_INOTIFY=y
 CONFIG_VFAT_FS=y
 CONFIG_TMPFS=y
 CONFIG_JFFS2_FS=y
 CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
 CONFIG_ROOT_NFS=y
-CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_SLAB=y
 CONFIG_DEBUG_SPINLOCK=y
 CONFIG_DEBUG_MUTEXES=y
-# CONFIG_RCU_CPU_STALL_DETECTOR is not set
 CONFIG_DEBUG_USER=y
-CONFIG_DEBUG_ERRORS=y
 CONFIG_DEBUG_LL=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_LIBCRC32C=y
-- 
1.8.3.2

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


[PATCH] pwm: add ep93xx PWM support

2013-10-14 Thread H Hartley Sweeten
Remove the non-standard EP93xx pwm driver in drivers/misc and add
a new driver for the PWM chips on the EP93xx platforms based on the
PWM framework.

These PWM chips each support 1 PWM channel with programmable duty
cycle, frequency, and polarity inversion.

Signed-off-by: H Hartley Sweeten 
Cc: Ryan Mallon 
Cc: Thierry Reding 
Cc: Arnd Bergmann 
Cc: Greg Kroah-Hartman 

---
 drivers/misc/Kconfig  |  13 ---
 drivers/misc/Makefile |   1 -
 drivers/misc/ep93xx_pwm.c | 286 --
 drivers/pwm/Kconfig   |   9 ++
 drivers/pwm/Makefile  |   1 +
 drivers/pwm/pwm-ep93xx.c  | 218 +++
 6 files changed, 228 insertions(+), 300 deletions(-)
 delete mode 100644 drivers/misc/ep93xx_pwm.c
 create mode 100644 drivers/pwm/pwm-ep93xx.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 8dacd4c..c43c66a 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -381,19 +381,6 @@ config HMC6352
  This driver provides support for the Honeywell HMC6352 compass,
  providing configuration and heading data via sysfs.
 
-config EP93XX_PWM
-   tristate "EP93xx PWM support"
-   depends on ARCH_EP93XX
-   help
- This option enables device driver support for the PWM channels
- on the Cirrus EP93xx processors.  The EP9307 chip only has one
- PWM channel all the others have two, the second channel is an
- alternate function of the EGPIO14 pin.  A sysfs interface is
- provided to control the PWM channels.
-
- To compile this driver as a module, choose M here: the module will
- be called ep93xx_pwm.
-
 config DS1682
tristate "Dallas DS1682 Total Elapsed Time Recorder with Alarm"
depends on I2C
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c235d5b..ecccd00 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -33,7 +33,6 @@ obj-$(CONFIG_APDS9802ALS) += apds9802als.o
 obj-$(CONFIG_ISL29003) += isl29003.o
 obj-$(CONFIG_ISL29020) += isl29020.o
 obj-$(CONFIG_SENSORS_TSL2550)  += tsl2550.o
-obj-$(CONFIG_EP93XX_PWM)   += ep93xx_pwm.o
 obj-$(CONFIG_DS1682)   += ds1682.o
 obj-$(CONFIG_TI_DAC7512)   += ti_dac7512.o
 obj-$(CONFIG_C2PORT)   += c2port/
diff --git a/drivers/misc/ep93xx_pwm.c b/drivers/misc/ep93xx_pwm.c
deleted file mode 100644
index cdb67a9..000
--- a/drivers/misc/ep93xx_pwm.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- *  Simple PWM driver for EP93XX
- *
- * (c) Copyright 2009  Matthieu Crapet 
- * (c) Copyright 2009  H Hartley Sweeten 
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- *  EP9307 has only one channel:
- *- PWMOUT
- *
- *  EP9301/02/12/15 have two channels:
- *- PWMOUT
- *- PWMOUT1 (alternate function for EGPIO14)
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define EP93XX_PWMx_TERM_COUNT 0x00
-#define EP93XX_PWMx_DUTY_CYCLE 0x04
-#define EP93XX_PWMx_ENABLE 0x08
-#define EP93XX_PWMx_INVERT 0x0C
-
-#define EP93XX_PWM_MAX_COUNT   0x
-
-struct ep93xx_pwm {
-   void __iomem*mmio_base;
-   struct clk  *clk;
-   u32 duty_percent;
-};
-
-/*
- * /sys/devices/platform/ep93xx-pwm.N
- *   /min_freq  read-only   minimum pwm output frequency
- *   /max_req   read-only   maximum pwm output frequency
- *   /freq  read-write  pwm output frequency (0 = disable output)
- *   /duty_percent  read-write  pwm duty cycle percent (1..99)
- *   /invertread-write  invert pwm output
- */
-
-static ssize_t ep93xx_pwm_get_min_freq(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
-   unsigned long rate = clk_get_rate(pwm->clk);
-
-   return sprintf(buf, "%ld\n", rate / (EP93XX_PWM_MAX_COUNT + 1));
-}
-
-static ssize_t ep93xx_pwm_get_max_freq(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
-   unsigned long rate = clk_get_rate(pwm->clk);
-
-   return sprintf(buf, "%ld\n", rate / 2);
-}
-
-static ssize_t ep93xx_pwm_get_freq(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
-
-   if (readl(pwm->mmio_base + EP93XX_PWMx_ENABLE) & 0x1) {
-   unsigned long rate = clk_get_rate(pwm-&

[PATCH] usb: ohci: remove ep93xx bus glue platform driver

2013-10-14 Thread H Hartley Sweeten
Convert ep93xx to use the OHCI platform driver and remove the
ohci-ep93xx bus glue driver.

Signed-off-by: H Hartley Sweeten 
Cc: Alan Stern 
Cc: Greg Kroah-Hartman 
Cc: Ryan Mallon 
---
 arch/arm/mach-ep93xx/clock.c   |   2 +-
 arch/arm/mach-ep93xx/core.c|  45 +-
 drivers/usb/host/Kconfig   |   2 +-
 drivers/usb/host/ohci-ep93xx.c | 184 -
 drivers/usb/host/ohci-hcd.c|  18 
 5 files changed, 43 insertions(+), 208 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-ep93xx.c

diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index c95dbce..39ef3b6 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -212,7 +212,7 @@ static struct clk_lookup clocks[] = {
INIT_CK(NULL,   "hclk", &clk_h),
INIT_CK(NULL,   "apb_pclk", &clk_p),
INIT_CK(NULL,   "pll2", &clk_pll2),
-   INIT_CK("ep93xx-ohci",  NULL,   &clk_usb_host),
+   INIT_CK("ohci-platform",NULL,   &clk_usb_host),
INIT_CK("ep93xx-keypad",NULL,   &clk_keypad),
INIT_CK("ep93xx-fb",NULL,   &clk_video),
INIT_CK("ep93xx-spi.0", NULL,   &clk_spi),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 3f12b88..5489824 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -297,22 +298,58 @@ static struct platform_device ep93xx_rtc_device = {
.resource   = ep93xx_rtc_resource,
 };
 
+/*
+ * EP93xx OHCI USB Host
+ */
+
+static struct clk *ep93xx_ohci_host_clock;
+
+static int ep93xx_ohci_power_on(struct platform_device *pdev)
+{
+   if (!ep93xx_ohci_host_clock) {
+   ep93xx_ohci_host_clock = devm_clk_get(&pdev->dev, NULL);
+   if (IS_ERR(ep93xx_ohci_host_clock))
+   return PTR_ERR(ep93xx_ohci_host_clock);
+   }
+
+   clk_enable(ep93xx_ohci_host_clock);
+
+   return 0;
+}
+
+static void ep93xx_ohci_power_off(struct platform_device *pdev)
+{
+   clk_disable(ep93xx_ohci_host_clock);
+}
+
+static void ep93xx_ohci_power_suspend(struct platform_device *pdev)
+{
+   ep93xx_ohci_power_off(pdev);
+}
+
+static struct usb_ohci_pdata ep93xx_ohci_pdata = {
+   .power_on   = ep93xx_ohci_power_on,
+   .power_off  = ep93xx_ohci_power_off,
+   .power_suspend  = ep93xx_ohci_power_suspend,
+};
 
 static struct resource ep93xx_ohci_resources[] = {
DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000),
DEFINE_RES_IRQ(IRQ_EP93XX_USB),
 };
 
+static u64 ep93xx_ohci_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device ep93xx_ohci_device = {
-   .name   = "ep93xx-ohci",
+   .name   = "ohci-platform",
.id = -1,
+   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
+   .resource   = ep93xx_ohci_resources,
.dev= {
-   .dma_mask   = 
&ep93xx_ohci_device.dev.coherent_dma_mask,
+   .dma_mask   = &ep93xx_ohci_dma_mask,
.coherent_dma_mask  = DMA_BIT_MASK(32),
+   .platform_data  = &ep93xx_ohci_pdata,
},
-   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
-   .resource   = ep93xx_ohci_resources,
 };
 
 
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index b3f20d7..2c8f2db 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -472,7 +472,7 @@ config USB_CNS3XXX_OHCI
 
 config USB_OHCI_HCD_PLATFORM
tristate "Generic OHCI driver for a platform device"
-   default n
+   default y if ARCH_EP93XX
---help---
  Adds an OHCI host driver for a generic platform device, which
  provides a memory space and an irq.
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
deleted file mode 100644
index 84a20d5..000
--- a/drivers/usb/host/ohci-ep93xx.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber 
- * (C) Copyright 2000-2002 David Brownell 
- * (C) Copyright 2002 Hewlett-Packard Company
- *
- * Bus Glue for ep93xx.
- *
- * Written by Christopher Hoover 
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ohci-sa.c
- *  by Durgesh Pattamatta 
- *
- * Modified for pxa27x from ohci-lh7a404.c
- *  by Nick Bane  26-8-2004
- *
- * Modified

[PATCH 2/2 v5] usb: ohci: remove ep93xx bus glue platform driver

2013-10-21 Thread H Hartley Sweeten
Convert ep93xx to use the OHCI platform driver and remove the
ohci-ep93xx bus glue driver.

Enable CONFIG_OHCI_HCD_PLATFORM in the ep93xx_defconfig so that USB
is still enabled by default on the EP93xx platform.

Signed-off-by: H Hartley Sweeten 
Acked-by: Alan Stern 
Cc: Ryan Mallon 
Cc: Lennert Buytenhek 
Cc: Greg Kroah-Hartman 
Cc: Olof Johansson 
Cc: Russell King 
---
v5: rebase to usb-next (patch 1/2 has already been applied)

v4: propagate errno from clk_enable() in ep93xx_ohci_power_on().

v3: split patch to refresh the ep93xx_defconfig before removing
ohci-ep93xx.c in favor of the Generic OHCI driver for a
platform device.

v2: Use the (*power_off) callback for (*power_suspend), as
suggested by Alan Stern.
Remove the Kconfig change to USB_OHCI_HCD_PLATFORM and
refresh the ep93xx_defconfig to enable this option, as
suggested by Alan Stern.

 arch/arm/configs/ep93xx_defconfig |   1 +
 arch/arm/mach-ep93xx/clock.c  |   2 +-
 arch/arm/mach-ep93xx/core.c   |  39 +++--
 drivers/usb/host/Kconfig  |   8 --
 drivers/usb/host/Makefile |   1 -
 drivers/usb/host/ohci-ep93xx.c| 174 --
 6 files changed, 36 insertions(+), 189 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-ep93xx.c

diff --git a/arch/arm/configs/ep93xx_defconfig 
b/arch/arm/configs/ep93xx_defconfig
index 8eccbcb..6ac5ea7 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -83,6 +83,7 @@ CONFIG_USB=y
 CONFIG_USB_DEBUG=y
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_SERIAL=y
 CONFIG_USB_SERIAL_CONSOLE=y
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index c95dbce..39ef3b6 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -212,7 +212,7 @@ static struct clk_lookup clocks[] = {
INIT_CK(NULL,   "hclk", &clk_h),
INIT_CK(NULL,   "apb_pclk", &clk_p),
INIT_CK(NULL,   "pll2", &clk_pll2),
-   INIT_CK("ep93xx-ohci",  NULL,   &clk_usb_host),
+   INIT_CK("ohci-platform",NULL,   &clk_usb_host),
INIT_CK("ep93xx-keypad",NULL,   &clk_keypad),
INIT_CK("ep93xx-fb",NULL,   &clk_video),
INIT_CK("ep93xx-spi.0", NULL,   &clk_spi),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 3f12b88..d95ee28a 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -297,25 +298,53 @@ static struct platform_device ep93xx_rtc_device = {
.resource   = ep93xx_rtc_resource,
 };
 
+/*
+ * EP93xx OHCI USB Host
+ */
+
+static struct clk *ep93xx_ohci_host_clock;
+
+static int ep93xx_ohci_power_on(struct platform_device *pdev)
+{
+   if (!ep93xx_ohci_host_clock) {
+   ep93xx_ohci_host_clock = devm_clk_get(&pdev->dev, NULL);
+   if (IS_ERR(ep93xx_ohci_host_clock))
+   return PTR_ERR(ep93xx_ohci_host_clock);
+   }
+
+   return clk_enable(ep93xx_ohci_host_clock);
+}
+
+static void ep93xx_ohci_power_off(struct platform_device *pdev)
+{
+   clk_disable(ep93xx_ohci_host_clock);
+}
+
+static struct usb_ohci_pdata ep93xx_ohci_pdata = {
+   .power_on   = ep93xx_ohci_power_on,
+   .power_off  = ep93xx_ohci_power_off,
+   .power_suspend  = ep93xx_ohci_power_off,
+};
 
 static struct resource ep93xx_ohci_resources[] = {
DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000),
DEFINE_RES_IRQ(IRQ_EP93XX_USB),
 };
 
+static u64 ep93xx_ohci_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device ep93xx_ohci_device = {
-   .name   = "ep93xx-ohci",
+   .name   = "ohci-platform",
.id = -1,
+   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
+   .resource   = ep93xx_ohci_resources,
.dev= {
-   .dma_mask   = 
&ep93xx_ohci_device.dev.coherent_dma_mask,
+   .dma_mask   = &ep93xx_ohci_dma_mask,
.coherent_dma_mask  = DMA_BIT_MASK(32),
+   .platform_data  = &ep93xx_ohci_pdata,
},
-   .num_resources  = ARRAY_SIZE(ep93xx_ohci_resources),
-   .resource   = ep93xx_ohci_resources,
 };
 
-
 /*
  * EP93xx physmap'ed flash
  **

[PATCH 2/2] watchdog: ts72xx_wdt: convert driver to watchdog core

2017-01-30 Thread H Hartley Sweeten
Cleanup this driver and convert it to use the watchdog framework API.

Signed-off-by: H Hartley Sweeten 
Cc: Mika Westerberg 
Cc: Wim Van Sebroeck 
Cc: Guenter Roeck 
---
 drivers/watchdog/ts72xx_wdt.c | 447 +-
 1 file changed, 93 insertions(+), 354 deletions(-)

diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c
index 4b54193..857ab71 100644
--- a/drivers/watchdog/ts72xx_wdt.c
+++ b/drivers/watchdog/ts72xx_wdt.c
@@ -13,413 +13,149 @@
  * warranty of any kind, whether express or implied.
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
+#include 
 #include 
-#include 
-
-#define TS72XX_WDT_FEED_VAL0x05
-#define TS72XX_WDT_DEFAULT_TIMEOUT 8
-
-static int timeout = TS72XX_WDT_DEFAULT_TIMEOUT;
-module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. "
- "(1 <= timeout <= 8, default="
- __MODULE_STRING(TS72XX_WDT_DEFAULT_TIMEOUT)
- ")");
+#include 
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
 
-/**
- * struct ts72xx_wdt - watchdog control structure
- * @lock: lock that protects this structure
- * @regval: watchdog timeout value suitable for control register
- * @flags: flags controlling watchdog device state
- * @control_reg: watchdog control register
- * @feed_reg: watchdog feed register
- * @pdev: back pointer to platform dev
- */
-struct ts72xx_wdt {
-   struct mutexlock;
-   int regval;
-
-#define TS72XX_WDT_BUSY_FLAG   1
-#define TS72XX_WDT_EXPECT_CLOSE_FLAG   2
-   int flags;
+/* priv->control_reg */
+#define TS72XX_WDT_CTRL_DISABLE0x00
+#define TS72XX_WDT_CTRL_250MS  0x01
+#define TS72XX_WDT_CTRL_500MS  0x02
+#define TS72XX_WDT_CTRL_1SEC   0x03
+#define TS72XX_WDT_CTRL_RESERVED   0x04
+#define TS72XX_WDT_CTRL_2SEC   0x05
+#define TS72XX_WDT_CTRL_4SEC   0x06
+#define TS72XX_WDT_CTRL_8SEC   0x07
+
+/* priv->feed_reg */
+#define TS72XX_WDT_FEED_VAL0x05
 
+struct ts72xx_wdt_priv {
void __iomem*control_reg;
void __iomem*feed_reg;
-
-   struct platform_device *pdev;
+   struct watchdog_device wdd;
+   unsigned char regval;
 };
 
-static struct platform_device *ts72xx_wdt_pdev;
-
-/*
- * TS-72xx Watchdog supports following timeouts (value written
- * to control register):
- * value   description
- * -
- * 0x00watchdog disabled
- * 0x01250ms
- * 0x02500ms
- * 0x031s
- * 0x04reserved
- * 0x052s
- * 0x064s
- * 0x078s
- *
- * Timeouts below 1s are not very usable so we don't
- * allow them at all.
- *
- * We provide two functions that convert between these:
- * timeout_to_regval() and regval_to_timeout().
- */
-static const struct {
-   int timeout;
-   int regval;
-} ts72xx_wdt_map[] = {
-   { 1, 3 },
-   { 2, 5 },
-   { 4, 6 },
-   { 8, 7 },
-};
-
-/**
- * timeout_to_regval() - converts given timeout to control register value
- * @new_timeout: timeout in seconds to be converted
- *
- * Function converts given @new_timeout into valid value that can
- * be programmed into watchdog control register. When conversion is
- * not possible, function returns %-EINVAL.
- */
-static int timeout_to_regval(int new_timeout)
+static int ts72xx_wdt_start(struct watchdog_device *wdd)
 {
-   int i;
+   struct ts72xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
 
-   /* first limit it to 1 - 8 seconds */
-   new_timeout = clamp_val(new_timeout, 1, 8);
+   writeb(TS72XX_WDT_FEED_VAL, priv->feed_reg);
+   writeb(priv->regval, priv->control_reg);
 
-   for (i = 0; i < ARRAY_SIZE(ts72xx_wdt_map); i++) {
-   if (ts72xx_wdt_map[i].timeout >= new_timeout)
-   return ts72xx_wdt_map[i].regval;
-   }
-
-   return -EINVAL;
-}
-
-/**
- * regval_to_timeout() - converts control register value to timeout
- * @regval: control register value to be converted
- *
- * Function converts given @regval to timeout in seconds (1, 2, 4 or 8).
- * If @regval cannot be converted, function returns %-EINVAL.
- */
-static int regval_to_timeout(int regval)
-{
-   int i;
-
-   for (i = 0; i < ARRAY_SIZE(ts72xx_wdt_map); i++) {
-   if (ts72xx_wdt_map[i].regval == regval)
-   return ts72xx_wdt_map[i].timeout;
-   }
-
-   return -EINVAL;
-}
-
-/**
- * ts72xx_wdt_kick() - kick the watchdog
- * @wdt: watchdog to be kicked
- *
- * Called with @wdt->lock held.
- */
-static inline void ts72xx_wdt_kick(struct ts72xx_wdt *wdt)
-{
-   __raw_writeb(TS72XX_WDT_FEED_VAL

[PATCH 1/2] watchdog: ep93xx_wdt: cleanup and let the core handle the heartbeat

2017-01-30 Thread H Hartley Sweeten
Cleanup this driver and remove the 200ms heartbeat timer. The core now
has the ability to handle the heartbeat.

Signed-off-by: H Hartley Sweeten 
Cc: Wim Van Sebroeck 
Cc: Guenter Roeck 
---
 drivers/watchdog/ep93xx_wdt.c | 115 +-
 1 file changed, 46 insertions(+), 69 deletions(-)

diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
index 0a4d7cc..756ca47 100644
--- a/drivers/watchdog/ep93xx_wdt.c
+++ b/drivers/watchdog/ep93xx_wdt.c
@@ -19,81 +19,55 @@
  * for us to rely on the user space daemon alone. So we ping the
  * wdt each ~200msec and eventually stop doing it if the user space
  * daemon dies.
- *
- * TODO:
- *
- * - Test last reset from watchdog status
- * - Add a few missing ioctls
  */
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
-#define WDT_VERSION"0.4"
-
-/* default timeout (secs) */
-#define WDT_TIMEOUT 30
-
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
 
-static unsigned int timeout = WDT_TIMEOUT;
-module_param(timeout, uint, 0);
-MODULE_PARM_DESC(timeout,
-   "Watchdog timeout in seconds. (1<=timeout<=3600, default="
-   __MODULE_STRING(WDT_TIMEOUT) ")");
-
-static void __iomem *mmio_base;
-static struct timer_list timer;
-static unsigned long next_heartbeat;
-
 #define EP93XX_WATCHDOG0x00
 #define EP93XX_WDSTATUS0x04
 
-/* reset the wdt every ~200ms - the heartbeat of the device is 0.250 seconds*/
-#define WDT_INTERVAL (HZ/5)
-
-static void ep93xx_wdt_timer_ping(unsigned long data)
-{
-   if (time_before(jiffies, next_heartbeat))
-   writel(0x, mmio_base + EP93XX_WATCHDOG);
-
-   /* Re-set the timer interval */
-   mod_timer(&timer, jiffies + WDT_INTERVAL);
-}
+struct ep93xx_wdt_priv {
+   void __iomem *mmio;
+   struct watchdog_device wdd;
+};
 
 static int ep93xx_wdt_start(struct watchdog_device *wdd)
 {
-   next_heartbeat = jiffies + (timeout * HZ);
+   struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
 
-   writel(0x, mmio_base + EP93XX_WATCHDOG);
-   mod_timer(&timer, jiffies + WDT_INTERVAL);
+   writel(0x, priv->mmio + EP93XX_WATCHDOG);
 
return 0;
 }
 
 static int ep93xx_wdt_stop(struct watchdog_device *wdd)
 {
-   del_timer_sync(&timer);
-   writel(0xaa55, mmio_base + EP93XX_WATCHDOG);
+   struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
+
+   writel(0xaa55, priv->mmio + EP93XX_WATCHDOG);
 
return 0;
 }
 
-static int ep93xx_wdt_keepalive(struct watchdog_device *wdd)
+static int ep93xx_wdt_ping(struct watchdog_device *wdd)
 {
-   /* user land ping */
-   next_heartbeat = jiffies + (timeout * HZ);
+   struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
+
+   writel(0x, priv->mmio + EP93XX_WATCHDOG);
 
return 0;
 }
 
 static const struct watchdog_info ep93xx_wdt_ident = {
.options= WDIOF_CARDRESET |
+ WDIOF_SETTIMEOUT |
  WDIOF_MAGICCLOSE |
  WDIOF_KEEPALIVEPING,
.identity   = "EP93xx Watchdog",
@@ -103,47 +77,48 @@ static struct watchdog_ops ep93xx_wdt_ops = {
.owner  = THIS_MODULE,
.start  = ep93xx_wdt_start,
.stop   = ep93xx_wdt_stop,
-   .ping   = ep93xx_wdt_keepalive,
-};
-
-static struct watchdog_device ep93xx_wdt_wdd = {
-   .info   = &ep93xx_wdt_ident,
-   .ops= &ep93xx_wdt_ops,
+   .ping   = ep93xx_wdt_ping,
 };
 
 static int ep93xx_wdt_probe(struct platform_device *pdev)
 {
+   struct ep93xx_wdt_priv *priv;
+   struct watchdog_device *wdd;
struct resource *res;
unsigned long val;
-   int err;
+   int ret;
+
+   priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+   if (!priv)
+   return -ENOMEM;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   mmio_base = devm_ioremap_resource(&pdev->dev, res);
-   if (IS_ERR(mmio_base))
-   return PTR_ERR(mmio_base);
+   priv->mmio = devm_ioremap_resource(&pdev->dev, res);
+   if (IS_ERR(priv->mmio))
+   return PTR_ERR(priv->mmio);
+
+   val = readl(priv->mmio + EP93XX_WATCHDOG);
 
-   if (timeout < 1 || timeout > 3600) {
-   timeout = WDT_TIMEOUT;
-   dev_warn(&pdev->dev,
-   "timeout value must be 1<=x<=3600, using %d\n",
-   timeout);
-   }
+   wdd = &priv->wdd;
+   wdd->bootstatus = (val & 0x01) ? WDIOF_CARDRESET : 0;
+   wdd->info = &ep93xx_wdt_ident;
+   wdd->ops 

[PATCH 0/2] watchdog: cleanup ep93xx platform drivers

2017-01-30 Thread H Hartley Sweeten
The ep93xx_wdt driver is used by EP93xx based platforms for the internal
watchdog of the EP93xx processor. The TS-72xx platforms have an additional
watchdog provided by the CPLD on those boards.

Cleanup both drivers.

H Hartley Sweeten (2):
  watchdog: ep93xx_wdt: cleanup and let the core handle the heartbeat
  watchdog: ts72xx_wdt: convert driver to watchdog core

 drivers/watchdog/ep93xx_wdt.c | 115 +--
 drivers/watchdog/ts72xx_wdt.c | 447 +-
 2 files changed, 139 insertions(+), 423 deletions(-)

-- 
2.10.0



[PATCH] getirq: fix /proc/interrupts output alignment

2017-02-10 Thread H Hartley Sweeten
If the irq_desc being output does not have a domain the information
following the 'name' is not aligned correctly.

Signed-off-by: H Hartley Sweeten 
Cc: Thomas Gleixner 
---
 kernel/irq/proc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index feaa813..c53edad 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -487,6 +487,8 @@ int show_interrupts(struct seq_file *p, void *v)
}
if (desc->irq_data.domain)
seq_printf(p, " %*d", prec, (int) desc->irq_data.hwirq);
+   else
+   seq_printf(p, " %*s", prec, "");
 #ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL
seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : 
"Edge");
 #endif
-- 
2.10.0



[tip:irq/core] genirq: Fix /proc/interrupts output alignment

2017-02-10 Thread tip-bot for H Hartley Sweeten
Commit-ID:  f435da416beaacc8934fc21820d9488269b39c98
Gitweb: http://git.kernel.org/tip/f435da416beaacc8934fc21820d9488269b39c98
Author: H Hartley Sweeten 
AuthorDate: Fri, 10 Feb 2017 09:54:16 -0700
Committer:  Thomas Gleixner 
CommitDate: Fri, 10 Feb 2017 20:17:52 +0100

genirq: Fix /proc/interrupts output alignment

If the irq_desc being output does not have a domain associated the
information following the 'name' is not aligned correctly.

Signed-off-by: H Hartley Sweeten 
Link: 
http://lkml.kernel.org/r/20170210165416.5629-1-hswee...@visionengravers.com
Signed-off-by: Thomas Gleixner 

---
 kernel/irq/proc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index feaa813..c53edad 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -487,6 +487,8 @@ int show_interrupts(struct seq_file *p, void *v)
}
if (desc->irq_data.domain)
seq_printf(p, " %*d", prec, (int) desc->irq_data.hwirq);
+   else
+   seq_printf(p, " %*s", prec, "");
 #ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL
seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : 
"Edge");
 #endif


<    3   4   5   6   7   8