Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1507431 > unrolled thread
| Started by | ahaslam@baylibre.com |
|---|---|
| First post | 2016-10-24 18:50 +0200 |
| Last post | 2016-10-25 13:00 +0200 |
| Articles | 20 on this page of 33 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH/RFT v2 00/17] Add DT support for ohci-da8xx ahaslam@baylibre.com - 2016-10-24 18:50 +0200
[PATCH/RFT v2 01/17] ARM: davinci: da8xx: add usb phy clocks ahaslam@baylibre.com - 2016-10-24 18:50 +0200
[PATCH/RFT v2 15/17] usb: host: ohci-da8xx: Add devicetree bindings documentation ahaslam@baylibre.com - 2016-10-24 18:50 +0200
Re: [PATCH/RFT v2 15/17] usb: host: ohci-da8xx: Add devicetree bindings documentation David Lechner <david@lechnology.com> - 2016-10-25 03:10 +0200
Re: [PATCH/RFT v2 15/17] usb: host: ohci-da8xx: Add devicetree bindings documentation Axel Haslam <ahaslam@baylibre.com> - 2016-10-25 12:00 +0200
[PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable ahaslam@baylibre.com - 2016-10-24 18:50 +0200
Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable David Lechner <david@lechnology.com> - 2016-10-25 05:00 +0200
Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable Axel Haslam <ahaslam@baylibre.com> - 2016-10-25 12:10 +0200
Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable Sekhar Nori <nsekhar@ti.com> - 2016-10-25 12:20 +0200
Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable David Lechner <david@lechnology.com> - 2016-10-25 18:10 +0200
Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable Sekhar Nori <nsekhar@ti.com> - 2016-10-26 11:40 +0200
[PATCH/RFT v2 10/17] USB: da8xx: use flag instead of bitmask for over current change ahaslam@baylibre.com - 2016-10-24 18:50 +0200
[PATCH/RFT v2 16/17] USB: ohci-da8xx: Allow probing from DT ahaslam@baylibre.com - 2016-10-24 18:50 +0200
Re: [PATCH/RFT v2 16/17] USB: ohci-da8xx: Allow probing from DT David Lechner <david@lechnology.com> - 2016-10-25 03:00 +0200
Re: [PATCH/RFT v2 16/17] USB: ohci-da8xx: Allow probing from DT Axel Haslam <ahaslam@baylibre.com> - 2016-10-25 10:20 +0200
[PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. ahaslam@baylibre.com - 2016-10-24 18:50 +0200
Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. Sekhar Nori <nsekhar@ti.com> - 2016-10-25 10:20 +0200
Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. Axel Haslam <ahaslam@baylibre.com> - 2016-10-25 11:40 +0200
Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. Sekhar Nori <nsekhar@ti.com> - 2016-10-25 12:20 +0200
Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. David Lechner <david@lechnology.com> - 2016-10-25 18:00 +0200
Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. Sekhar Nori <nsekhar@ti.com> - 2016-10-26 11:00 +0200
[PATCH/RFT v2 04/17] ARM: DTS: da850: Add cfgchip syscon node ahaslam@baylibre.com - 2016-10-24 19:00 +0200
[PATCH/RFT v2 03/17] ARM: davinci: da8xx: Add USB PHY platform declaration ahaslam@baylibre.com - 2016-10-24 19:00 +0200
Re: [PATCH/RFT v2 03/17] ARM: davinci: da8xx: Add USB PHY platform declaration Sekhar Nori <nsekhar@ti.com> - 2016-10-25 11:20 +0200
Re: [PATCH/RFT v2 03/17] ARM: davinci: da8xx: Add USB PHY platform declaration Axel Haslam <ahaslam@baylibre.com> - 2016-10-25 11:40 +0200
[PATCH/RFT v2 08/17] ARM: davinci: hawk: add full constraints for ohci plat boot ahaslam@baylibre.com - 2016-10-24 19:00 +0200
Re: [PATCH/RFT v2 08/17] ARM: davinci: hawk: add full constraints for ohci plat boot Sekhar Nori <nsekhar@ti.com> - 2016-10-25 12:40 +0200
Re: [PATCH/RFT v2 08/17] ARM: davinci: hawk: add full constraints for ohci plat boot Axel Haslam <ahaslam@baylibre.com> - 2016-10-25 12:40 +0200
[PATCH/RFT v2 06/17] ARM: davinci: da8xx: Fix some redefined symbol warnings ahaslam@baylibre.com - 2016-10-24 19:00 +0200
Re: [PATCH/RFT v2 06/17] ARM: davinci: da8xx: Fix some redefined symbol warnings Sekhar Nori <nsekhar@ti.com> - 2016-10-25 12:10 +0200
Re: [PATCH/RFT v2 06/17] ARM: davinci: da8xx: Fix some redefined symbol warnings Alexandre Bailon <abailon@baylibre.com> - 2016-10-25 14:20 +0200
[PATCH/RFT v2 05/17] ARM: DTS: da850: Add usb phy node ahaslam@baylibre.com - 2016-10-24 19:00 +0200
Re: [PATCH/RFT v2 00/17] Add DT support for ohci-da8xx Sekhar Nori <nsekhar@ti.com> - 2016-10-25 13:00 +0200
Page 1 of 2 [1] 2 Next page →
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 00/17] Add DT support for ohci-da8xx |
| Message-ID | <svQBH-1Ks-3@gated-at.bofh.it> |
From: Axel Haslam <ahaslam@baylibre.com> The purpose of this patch series is to add DT support and modernize the ohci-da8xx glue driver without breaking the non-DT boot, which is still used in unconverted davinci devices. The first couple of patches, are the recent and ongoing efforts from David Lechner to clean up davinci-mach code and the ochi-da8xx driver, Im including these patches on this series for completeness sake. Then I re-based an old patch by Manjunath Goudar[4] to be able to build the driver as a module. We can now add this patch because we removed references to sysconf registers by using David's patches. Then I prepare the stage for a DT boot which does not depend on any mach-arch/* callbacks by using a regulator to handle the vbus and over current gpios. For this, i extended the fixed regulator driver to register for an irq and send a regulator notification if an over curent pin is specified. The only dependency left for this series is the recently re-posted patch by David to remove references to mach-code[1], which is approved and should be picked up soon. Note 1: Testing was done on a omap138-lcdk board, using DT, and non-DT boot, and checking that in both cases the hub, usb mass storage and an input device are correctly enumerated and working. The omap138-lcdk does not have gpios to control vbus and get over current interrupt notifications. If anyone has a da830-evm based board and could confirm that ohci is correctly working, i would appreciate it. (the OHCI option needs to be enabled in menuconfig) Note 2: It seems that the davinci-gpio driver is broken for DT based boot and any gpio > 32. (luckly none of the DT based boards use gpios yet) The issue is discussed here [2] Note 3: A git branch based on tag: next-20161021 with the dependencies is available in my github here [3]. [1] usb: ohci-da8xx: Remove code that references mach http://marc.info/?l=linux-kernel&m=147632744323084&w=4 [2] thread about invalid gpio in davinci http://www.gossamer-threads.com/lists/linux/kernel/2550178 [3] Git branch: https://github.com/axelhaslamx/linux-axel/commits/ohci-da8xx-dt-v2.1 [4] Separate ohci-da8xx driver patch https://patches.linaro.org/patch/18234/ Changes from v1->v2 * Rebased and added patch to make ohci a separate driver * Use a regulator instead of handling Gpios (David Lechner) * Add an overcurrent mode to regulator framework * Fixed regulator is able to register for and overcurrent irq * Added patch by Alexandre to remove build warnings * Moved global variables into private hcd structure. Alexandre Bailon (1): ARM: davinci: da8xx: Fix some redefined symbol warnings Axel Haslam (10): ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable ARM: davinci: hawk: add full constraints for ohci plat boot regulator: fixed: Add over current event USB: da8xx: use flag instead of bitmask for over current change USB: ochi-da8xx: Use a regulator for vbus/overcurrent USB: da8xx: use ohci priv data instead of globals ARM: davinci: register the usb20_phy clock on the DT file usb: host: ohci-da8xx: Add devicetree bindings documentation USB: ohci-da8xx: Allow probing from DT ARM: dts: da850: add usb device node David Lechner (5): ARM: davinci: da8xx: add usb phy clocks ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. ARM: davinci: da8xx: Add USB PHY platform declaration ARM: DTS: da850: Add cfgchip syscon node ARM: DTS: da850: Add usb phy node Manjunath Goudar (1): USB: OHCI: make ohci-da8xx a separate driver .../bindings/regulator/fixed-regulator.txt | 4 + .../devicetree/bindings/usb/ohci-da8xx.txt | 39 +++ arch/arm/boot/dts/da850-lcdk.dts | 8 + arch/arm/boot/dts/da850.dtsi | 17 + arch/arm/mach-davinci/board-da830-evm.c | 152 +++----- arch/arm/mach-davinci/board-da850-evm.c | 4 + arch/arm/mach-davinci/board-mityomapl138.c | 4 + arch/arm/mach-davinci/board-omapl138-hawk.c | 122 ++----- arch/arm/mach-davinci/da8xx-dt.c | 2 + arch/arm/mach-davinci/devices-da8xx.c | 28 ++ arch/arm/mach-davinci/include/mach/da8xx.h | 8 +- arch/arm/mach-davinci/usb-da8xx.c | 244 ++++++++++++- drivers/regulator/fixed.c | 64 ++++ drivers/usb/host/Kconfig | 2 +- drivers/usb/host/Makefile | 1 + drivers/usb/host/ohci-da8xx.c | 382 +++++++++++---------- drivers/usb/host/ohci-hcd.c | 18 - include/linux/platform_data/usb-davinci.h | 43 --- include/linux/regulator/consumer.h | 5 + include/linux/regulator/fixed.h | 3 + 20 files changed, 703 insertions(+), 447 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ohci-da8xx.txt -- 1.9.1
[toc] | [next] | [standalone]
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 01/17] ARM: davinci: da8xx: add usb phy clocks |
| Message-ID | <svQBH-1Ks-21@gated-at.bofh.it> |
| In reply to | #1507431 |
From: David Lechner <david@lechnology.com>
Up to this point, the USB phy clock configuration was handled manually in
the board files and in the usb drivers. This adds proper clocks so that
the usb drivers can use clk_get and clk_enable and not have to worry about
the details. Also, the related code is removed from the board files and
replaced with the new clock registration functions.
Signed-off-by: David Lechner <david@lechnology.com>
---
arch/arm/mach-davinci/board-da830-evm.c | 22 ++-
arch/arm/mach-davinci/board-omapl138-hawk.c | 16 +-
arch/arm/mach-davinci/include/mach/da8xx.h | 3 +
arch/arm/mach-davinci/usb-da8xx.c | 219 +++++++++++++++++++++++++++-
4 files changed, 239 insertions(+), 21 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 3d8cf8c..605d444 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -115,18 +115,6 @@ static __init void da830_evm_usb_init(void)
*/
cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
- /* USB2.0 PHY reference clock is 24 MHz */
- cfgchip2 &= ~CFGCHIP2_REFFREQ;
- cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ;
-
- /*
- * Select internal reference clock for USB 2.0 PHY
- * and use it as a clock source for USB 1.1 PHY
- * (this is the default setting anyway).
- */
- cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX;
- cfgchip2 |= CFGCHIP2_USB2PHYCLKMUX;
-
/*
* We have to override VBUS/ID signals when MUSB is configured into the
* host-only mode -- ID pin will float if no cable is connected, so the
@@ -143,6 +131,16 @@ static __init void da830_evm_usb_init(void)
__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
/* USB_REFCLKIN is not used. */
+ ret = da8xx_register_usb20_phy_clk(false);
+ if (ret)
+ pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n",
+ __func__, ret);
+
+ ret = da8xx_register_usb11_phy_clk(false);
+ if (ret)
+ pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n",
+ __func__, ret);
+
ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
if (ret)
pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index ee62486..d4930b6 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -243,7 +243,6 @@ static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
static __init void omapl138_hawk_usb_init(void)
{
int ret;
- u32 cfgchip2;
ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
if (ret) {
@@ -251,12 +250,15 @@ static __init void omapl138_hawk_usb_init(void)
return;
}
- /* Setup the Ref. clock frequency for the HAWK at 24 MHz. */
-
- cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
- cfgchip2 &= ~CFGCHIP2_REFFREQ;
- cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ;
- __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+ /* USB_REFCLKIN is not used. */
+ ret = da8xx_register_usb20_phy_clk(false);
+ if (ret)
+ pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n",
+ __func__, ret);
+ ret = da8xx_register_usb11_phy_clk(false);
+ if (ret)
+ pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n",
+ __func__, ret);
ret = gpio_request_one(DA850_USB1_VBUS_PIN,
GPIOF_DIR_OUT, "USB1 VBUS");
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index f9f9713..c367530 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -88,6 +88,9 @@
int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
int da8xx_register_spi_bus(int instance, unsigned num_chipselect);
int da8xx_register_watchdog(void);
+int da8xx_register_usb_refclkin(int rate);
+int da8xx_register_usb20_phy_clk(bool use_usb_refclkin);
+int da8xx_register_usb11_phy_clk(bool use_usb_refclkin);
int da8xx_register_usb20(unsigned mA, unsigned potpgt);
int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
int da8xx_register_emac(void);
diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c
index f141f51..c524d9e 100644
--- a/arch/arm/mach-davinci/usb-da8xx.c
+++ b/arch/arm/mach-davinci/usb-da8xx.c
@@ -1,20 +1,235 @@
/*
* DA8xx USB
*/
-#include <linux/dma-mapping.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
#include <linux/init.h>
#include <linux/platform_data/usb-davinci.h>
#include <linux/platform_device.h>
+#include <linux/mfd/da8xx-cfgchip.h>
#include <linux/usb/musb.h>
+#include <mach/clock.h>
#include <mach/common.h>
#include <mach/cputype.h>
#include <mach/da8xx.h>
-#include <mach/irqs.h>
+
+#include "clock.h"
#define DA8XX_USB0_BASE 0x01e00000
#define DA8XX_USB1_BASE 0x01e25000
+static struct clk usb_refclkin = {
+ .name = "usb_refclkin",
+ .set_rate = davinci_simple_set_rate,
+};
+
+static struct clk_lookup usb_refclkin_lookup =
+ CLK(NULL, "usb_refclkin", &usb_refclkin);
+
+/**
+ * da8xx_register_usb_refclkin - register USB_REFCLKIN clock
+ *
+ * @rate: The clock rate in Hz
+ *
+ * This clock is only needed if the board provides an external USB_REFCLKIN
+ * signal, in which case it will be used as the parent of usb20_phy_clk and/or
+ * usb11_phy_clk.
+ */
+int __init da8xx_register_usb_refclkin(int rate)
+{
+ int ret;
+
+ usb_refclkin.rate = rate;
+ ret = clk_register(&usb_refclkin);
+ if (ret)
+ return ret;
+
+ clkdev_add(&usb_refclkin_lookup);
+
+ return 0;
+}
+
+static void usb20_phy_clk_enable(struct clk *clk)
+{
+ u32 val;
+ u32 timeout = 500000; /* 500 msec */
+
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+ /*
+ * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1
+ * host may use the PLL clock without USB 2.0 OTG being used.
+ */
+ val &= ~(CFGCHIP2_RESET | CFGCHIP2_PHYPWRDN);
+ val |= CFGCHIP2_PHY_PLLON;
+
+ writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+ while (--timeout) {
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+ if (val & CFGCHIP2_PHYCLKGD)
+ return;
+ udelay(1);
+ }
+
+ pr_err("Timeout waiting for USB 2.0 PHY clock good.\n");
+}
+
+static void usb20_phy_clk_disable(struct clk *clk)
+{
+ u32 val;
+
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+ val |= CFGCHIP2_PHYPWRDN;
+ writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+}
+
+static int usb20_phy_clk_set_parent(struct clk *clk, struct clk *parent)
+{
+ u32 val;
+
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+ /* Set the mux depending on the parent clock. */
+ if (parent == &usb_refclkin) {
+ val &= ~CFGCHIP2_USB2PHYCLKMUX;
+ } else if (strcmp(parent->name, "pll0_aux_clk") == 0) {
+ val |= CFGCHIP2_USB2PHYCLKMUX;
+ } else {
+ pr_err("Bad parent on USB 2.0 PHY clock.\n");
+ return -EINVAL;
+ }
+
+ /* reference frequency also comes from parent clock */
+ val &= ~CFGCHIP2_REFFREQ_MASK;
+ switch (clk_get_rate(parent)) {
+ case 12000000:
+ val |= CFGCHIP2_REFFREQ_12MHZ;
+ break;
+ case 13000000:
+ val |= CFGCHIP2_REFFREQ_13MHZ;
+ break;
+ case 19200000:
+ val |= CFGCHIP2_REFFREQ_19_2MHZ;
+ break;
+ case 20000000:
+ val |= CFGCHIP2_REFFREQ_20MHZ;
+ break;
+ case 24000000:
+ val |= CFGCHIP2_REFFREQ_24MHZ;
+ break;
+ case 26000000:
+ val |= CFGCHIP2_REFFREQ_26MHZ;
+ break;
+ case 38400000:
+ val |= CFGCHIP2_REFFREQ_38_4MHZ;
+ break;
+ case 40000000:
+ val |= CFGCHIP2_REFFREQ_40MHZ;
+ break;
+ case 48000000:
+ val |= CFGCHIP2_REFFREQ_48MHZ;
+ break;
+ default:
+ pr_err("Bad parent clock rate on USB 2.0 PHY clock.\n");
+ return -EINVAL;
+ }
+
+ writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+ return 0;
+}
+
+static struct clk usb20_phy_clk = {
+ .name = "usb20_phy",
+ .clk_enable = usb20_phy_clk_enable,
+ .clk_disable = usb20_phy_clk_disable,
+ .set_parent = usb20_phy_clk_set_parent,
+};
+
+static struct clk_lookup usb20_phy_clk_lookup =
+ CLK(NULL, "usb20_phy", &usb20_phy_clk);
+
+/**
+ * da8xx_register_usb20_phy_clk - register USB0PHYCLKMUX clock
+ *
+ * @use_usb_refclkin: Selects the parent clock - either "usb_refclkin" if true
+ * or "pll0_aux" if false.
+ */
+int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin)
+{
+ struct clk *parent;
+ int ret = 0;
+
+ parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux");
+ if (IS_ERR(parent))
+ return PTR_ERR(parent);
+
+ usb20_phy_clk.parent = parent;
+ ret = clk_register(&usb20_phy_clk);
+ if (!ret)
+ clkdev_add(&usb20_phy_clk_lookup);
+
+ clk_put(parent);
+
+ return ret;
+}
+
+static int usb11_phy_clk_set_parent(struct clk *clk, struct clk *parent)
+{
+ u32 val;
+
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+ /* Set the USB 1.1 PHY clock mux based on the parent clock. */
+ if (parent == &usb20_phy_clk) {
+ val &= ~CFGCHIP2_USB1PHYCLKMUX;
+ } else if (parent == &usb_refclkin) {
+ val |= CFGCHIP2_USB1PHYCLKMUX;
+ } else {
+ pr_err("Bad parent on USB 1.1 PHY clock.\n");
+ return -EINVAL;
+ }
+
+ writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+ return 0;
+}
+
+static struct clk usb11_phy_clk = {
+ .name = "usb11_phy",
+ .set_parent = usb11_phy_clk_set_parent,
+};
+
+static struct clk_lookup usb11_phy_clk_lookup =
+ CLK(NULL, "usb11_phy", &usb11_phy_clk);
+
+/**
+ * da8xx_register_usb11_phy_clk - register USB1PHYCLKMUX clock
+ *
+ * @use_usb_refclkin: Selects the parent clock - either "usb_refclkin" if true
+ * or "usb20_phy" if false.
+ */
+int __init da8xx_register_usb11_phy_clk(bool use_usb_refclkin)
+{
+ struct clk *parent;
+ int ret = 0;
+
+ parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "usb20_phy");
+ if (IS_ERR(parent))
+ return PTR_ERR(parent);
+
+ usb11_phy_clk.parent = parent;
+ ret = clk_register(&usb11_phy_clk);
+ if (!ret)
+ clkdev_add(&usb11_phy_clk_lookup);
+
+ clk_put(parent);
+
+ return ret;
+}
+
#if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
static struct musb_hdrc_config musb_config = {
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 15/17] usb: host: ohci-da8xx: Add devicetree bindings documentation |
| Message-ID | <svQBI-1Ks-47@gated-at.bofh.it> |
| In reply to | #1507431 |
From: Axel Haslam <ahaslam@baylibre.com>
This patch documents the device tree bindings required for
the ohci controller found in TI da8xx family of SoC's
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
.../devicetree/bindings/usb/ohci-da8xx.txt | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/ohci-da8xx.txt
diff --git a/Documentation/devicetree/bindings/usb/ohci-da8xx.txt b/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
new file mode 100644
index 0000000..4251c84
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
@@ -0,0 +1,39 @@
+DA8XX USB OHCI controller
+
+Required properties:
+
+ - compatible: Should be "ti,da830-ohci"
+ - reg: Should contain one register range i.e. start and length
+ - interrupts: Description of the interrupt line
+ - phys: Phandle for the PHY device
+ - phy-names: Should be "usb-phy"
+
+Optional properties:
+ - vbus-supply: Regulator that controls vbus power
+
+Example for omap138-lck:
+
+vbus_fixed: fixed-regulator-vbus {
+ compatible = "regulator-fixed";
+ gpio = <&gpio 109 0>;
+ oc-gpio = <&gpio 36 0>;
+ regulator-boot-on;
+ enable-active-high;
+ regulator-name = "vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+};
+
+usb_phy: usb-phy {
+ compatible = "ti,da830-usb-phy";
+ #phy-cells = <1>;
+ status = "disabled";
+};
+usb: usb@0225000 {
+ compatible = "ti,da830-ohci";
+ reg = <0x225000 0x1000>;
+ interrupts = <59>;
+ phys = <&usb_phy 1>;
+ phy-names = "usb-phy";
+ status = "disabled";
+};
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2016-10-25 03:10 +0200 |
| Subject | Re: [PATCH/RFT v2 15/17] usb: host: ohci-da8xx: Add devicetree bindings documentation |
| Message-ID | <svYpz-6Zw-5@gated-at.bofh.it> |
| In reply to | #1507436 |
On 10/24/2016 11:46 AM, ahaslam@baylibre.com wrote:
> From: Axel Haslam <ahaslam@baylibre.com>
>
> This patch documents the device tree bindings required for
> the ohci controller found in TI da8xx family of SoC's
>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---
> .../devicetree/bindings/usb/ohci-da8xx.txt | 39 ++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/ohci-da8xx.txt
>
> diff --git a/Documentation/devicetree/bindings/usb/ohci-da8xx.txt b/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
> new file mode 100644
> index 0000000..4251c84
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
> @@ -0,0 +1,39 @@
> +DA8XX USB OHCI controller
> +
> +Required properties:
> +
> + - compatible: Should be "ti,da830-ohci"
> + - reg: Should contain one register range i.e. start and length
> + - interrupts: Description of the interrupt line
> + - phys: Phandle for the PHY device
> + - phy-names: Should be "usb-phy"
> +
> +Optional properties:
> + - vbus-supply: Regulator that controls vbus power
Isn't vbus-supply property required?
If it is really supposed to be optional, the ohci driver needs to use
devm_regulator_get_optional() and handle the case when there is no
regulator.
I don't see a problem with making it required though since one can just
use a dummy supply if there is not a real one.
> +
> +Example for omap138-lck:
> +
> +vbus_fixed: fixed-regulator-vbus {
> + compatible = "regulator-fixed";
> + gpio = <&gpio 109 0>;
> + oc-gpio = <&gpio 36 0>;
> + regulator-boot-on;
> + enable-active-high;
> + regulator-name = "vbus";
> + regulator-min-microvolt = <5000000>;
> + regulator-max-microvolt = <5000000>;
> +};
> +
> +usb_phy: usb-phy {
> + compatible = "ti,da830-usb-phy";
> + #phy-cells = <1>;
> + status = "disabled";
why disabled?
> +};
> +usb: usb@0225000 {
> + compatible = "ti,da830-ohci";
> + reg = <0x225000 0x1000>;
> + interrupts = <59>;
> + phys = <&usb_phy 1>;
> + phy-names = "usb-phy";
missing vbus-supply property
> + status = "disabled";
why disabled?
> +};
>
[toc] | [prev] | [next] | [standalone]
| From | Axel Haslam <ahaslam@baylibre.com> |
|---|---|
| Date | 2016-10-25 12:00 +0200 |
| Subject | Re: [PATCH/RFT v2 15/17] usb: host: ohci-da8xx: Add devicetree bindings documentation |
| Message-ID | <sw6Gu-3S0-37@gated-at.bofh.it> |
| In reply to | #1507900 |
On Tue, Oct 25, 2016 at 3:02 AM, David Lechner <david@lechnology.com> wrote:
> On 10/24/2016 11:46 AM, ahaslam@baylibre.com wrote:
>>
>> From: Axel Haslam <ahaslam@baylibre.com>
>>
>> This patch documents the device tree bindings required for
>> the ohci controller found in TI da8xx family of SoC's
>>
>> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
>> ---
>> .../devicetree/bindings/usb/ohci-da8xx.txt | 39
>> ++++++++++++++++++++++
>> 1 file changed, 39 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/usb/ohci-da8xx.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
>> b/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
>> new file mode 100644
>> index 0000000..4251c84
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/ohci-da8xx.txt
>> @@ -0,0 +1,39 @@
>> +DA8XX USB OHCI controller
>> +
>> +Required properties:
>> +
>> + - compatible: Should be "ti,da830-ohci"
>> + - reg: Should contain one register range i.e. start and length
>> + - interrupts: Description of the interrupt line
>> + - phys: Phandle for the PHY device
>> + - phy-names: Should be "usb-phy"
>> +
>> +Optional properties:
>> + - vbus-supply: Regulator that controls vbus power
>
>
>
> Isn't vbus-supply property required?
>
> If it is really supposed to be optional, the ohci driver needs to use
> devm_regulator_get_optional() and handle the case when there is no
> regulator.
>
> I don't see a problem with making it required though since one can just use
> a dummy supply if there is not a real one.
The regulator framework will use a dummy regulator if none is provided.
>
>> +
>> +Example for omap138-lck:
>> +
>> +vbus_fixed: fixed-regulator-vbus {
>> + compatible = "regulator-fixed";
>> + gpio = <&gpio 109 0>;
>> + oc-gpio = <&gpio 36 0>;
>> + regulator-boot-on;
>> + enable-active-high;
>> + regulator-name = "vbus";
>> + regulator-min-microvolt = <5000000>;
>> + regulator-max-microvolt = <5000000>;
>> +};
>> +
>> +usb_phy: usb-phy {
>> + compatible = "ti,da830-usb-phy";
>> + #phy-cells = <1>;
>> + status = "disabled";
>
>
> why disabled?
>
yes, i copied from the device tree im using, but
i should enable these for the example,
i will fix.
>> +};
>> +usb: usb@0225000 {
>> + compatible = "ti,da830-ohci";
>> + reg = <0x225000 0x1000>;
>> + interrupts = <59>;
>> + phys = <&usb_phy 1>;
>> + phy-names = "usb-phy";
>
>
> missing vbus-supply property
>
>> + status = "disabled";
>
>
> why disabled?
>
>> +};
>>
>
[toc] | [prev] | [next] | [standalone]
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable |
| Message-ID | <svQBI-1Ks-37@gated-at.bofh.it> |
| In reply to | #1507431 |
From: Axel Haslam <ahaslam@baylibre.com>
While probing ochi phy with usb20 phy as a parent clock for usb11_phy,
the usb20_phy clock enable would time out. This is because the usb20
module clock needs to enabled while trying to lock the usb20_phy PLL.
Call clk enable and get for the usb20 peripheral before trying to
enable the phy PLL.
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
arch/arm/mach-davinci/usb-da8xx.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c
index 9e41a7f..982e105 100644
--- a/arch/arm/mach-davinci/usb-da8xx.c
+++ b/arch/arm/mach-davinci/usb-da8xx.c
@@ -53,11 +53,19 @@ int __init da8xx_register_usb_refclkin(int rate)
static void usb20_phy_clk_enable(struct clk *clk)
{
+ struct clk *usb20_clk;
u32 val;
u32 timeout = 500000; /* 500 msec */
val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+ usb20_clk = clk_get(NULL, "usb20");
+ if (IS_ERR(usb20_clk)) {
+ pr_err("could not get usb20 clk\n");
+ return;
+ }
+
+ clk_prepare_enable(usb20_clk);
/*
* Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1
* host may use the PLL clock without USB 2.0 OTG being used.
@@ -70,11 +78,14 @@ static void usb20_phy_clk_enable(struct clk *clk)
while (--timeout) {
val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
if (val & CFGCHIP2_PHYCLKGD)
- return;
+ goto done;
udelay(1);
}
pr_err("Timeout waiting for USB 2.0 PHY clock good.\n");
+done:
+ clk_disable_unprepare(usb20_clk);
+ clk_put(usb20_clk);
}
static void usb20_phy_clk_disable(struct clk *clk)
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2016-10-25 05:00 +0200 |
| Subject | Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable |
| Message-ID | <sw082-82K-5@gated-at.bofh.it> |
| In reply to | #1507437 |
On 10/24/2016 11:46 AM, ahaslam@baylibre.com wrote: > From: Axel Haslam <ahaslam@baylibre.com> > > While probing ochi phy with usb20 phy as a parent clock for usb11_phy, > the usb20_phy clock enable would time out. This is because the usb20 > module clock needs to enabled while trying to lock the usb20_phy PLL. > > Call clk enable and get for the usb20 peripheral before trying to > enable the phy PLL. > > Signed-off-by: Axel Haslam <ahaslam@baylibre.com> > --- This patch can be combined with "ARM: davinci: da8xx: add usb phy clocks" since that patch has not been merged yet. If you like, I can resubmit my patches from this series along with the changes from this patch.
[toc] | [prev] | [next] | [standalone]
| From | Axel Haslam <ahaslam@baylibre.com> |
|---|---|
| Date | 2016-10-25 12:10 +0200 |
| Subject | Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable |
| Message-ID | <sw6Q9-4ba-21@gated-at.bofh.it> |
| In reply to | #1507936 |
On Tue, Oct 25, 2016 at 4:53 AM, David Lechner <david@lechnology.com> wrote: > On 10/24/2016 11:46 AM, ahaslam@baylibre.com wrote: >> >> From: Axel Haslam <ahaslam@baylibre.com> >> >> While probing ochi phy with usb20 phy as a parent clock for usb11_phy, >> the usb20_phy clock enable would time out. This is because the usb20 >> module clock needs to enabled while trying to lock the usb20_phy PLL. >> >> Call clk enable and get for the usb20 peripheral before trying to >> enable the phy PLL. >> >> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> >> --- > > > > This patch can be combined with "ARM: davinci: da8xx: add usb phy clocks" > since that patch has not been merged yet. yes, agree, these should be merged. > > If you like, I can resubmit my patches from this series along with the > changes from this patch. Ok, if you can resubmit those patches with this change included i can reference them and start making the series shorter. i will also submit in separate patches the regulator changes, as requested by Mark. Regards Axel. >
[toc] | [prev] | [next] | [standalone]
| From | Sekhar Nori <nsekhar@ti.com> |
|---|---|
| Date | 2016-10-25 12:20 +0200 |
| Subject | Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable |
| Message-ID | <sw6ZP-4he-15@gated-at.bofh.it> |
| In reply to | #1507437 |
On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote:
> diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c
> index 9e41a7f..982e105 100644
> --- a/arch/arm/mach-davinci/usb-da8xx.c
> +++ b/arch/arm/mach-davinci/usb-da8xx.c
> @@ -53,11 +53,19 @@ int __init da8xx_register_usb_refclkin(int rate)
>
> static void usb20_phy_clk_enable(struct clk *clk)
> {
> + struct clk *usb20_clk;
> u32 val;
> u32 timeout = 500000; /* 500 msec */
>
> val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
>
> + usb20_clk = clk_get(NULL, "usb20");
We should not be using a NULL device pointer here. Can you pass the musb
device pointer available in the same file? Also, da850_clks[] in da850.c
needs to be fixed to add the matching device name.
> + if (IS_ERR(usb20_clk)) {
> + pr_err("could not get usb20 clk\n");
> + return;
> + }
Thanks,
Sekhar
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2016-10-25 18:10 +0200 |
| Subject | Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable |
| Message-ID | <swcsy-7SW-23@gated-at.bofh.it> |
| In reply to | #1508162 |
On 10/25/2016 05:12 AM, Sekhar Nori wrote:
> On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote:
>> diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c
>> index 9e41a7f..982e105 100644
>> --- a/arch/arm/mach-davinci/usb-da8xx.c
>> +++ b/arch/arm/mach-davinci/usb-da8xx.c
>> @@ -53,11 +53,19 @@ int __init da8xx_register_usb_refclkin(int rate)
>>
>> static void usb20_phy_clk_enable(struct clk *clk)
>> {
>> + struct clk *usb20_clk;
>> u32 val;
>> u32 timeout = 500000; /* 500 msec */
>>
>> val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
>>
>> + usb20_clk = clk_get(NULL, "usb20");
>
> We should not be using a NULL device pointer here. Can you pass the musb
> device pointer available in the same file? Also, da850_clks[] in da850.c
> needs to be fixed to add the matching device name.
This clock can be used for usb 1.1 PHY even when musb is not being used,
so I don't think we can depend on having a musb device here.
Also, in a previous review, it was decided that the usb clocks should
*not* be added to da850_clks[] [1]. Instead, they are dynamically
registered elsewhere.
[1]: http://www.gossamer-threads.com/lists/linux/kernel/2396533
>
>> + if (IS_ERR(usb20_clk)) {
>> + pr_err("could not get usb20 clk\n");
>> + return;
>> + }
>
> Thanks,
> Sekhar
>
[toc] | [prev] | [next] | [standalone]
| From | Sekhar Nori <nsekhar@ti.com> |
|---|---|
| Date | 2016-10-26 11:40 +0200 |
| Subject | Re: [PATCH/RFT v2 07/17] ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable |
| Message-ID | <swsQG-1Lu-23@gated-at.bofh.it> |
| In reply to | #1508407 |
On Tuesday 25 October 2016 09:35 PM, David Lechner wrote:
> On 10/25/2016 05:12 AM, Sekhar Nori wrote:
>> On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote:
>>> diff --git a/arch/arm/mach-davinci/usb-da8xx.c
>>> b/arch/arm/mach-davinci/usb-da8xx.c
>>> index 9e41a7f..982e105 100644
>>> --- a/arch/arm/mach-davinci/usb-da8xx.c
>>> +++ b/arch/arm/mach-davinci/usb-da8xx.c
>>> @@ -53,11 +53,19 @@ int __init da8xx_register_usb_refclkin(int rate)
>>>
>>> static void usb20_phy_clk_enable(struct clk *clk)
>>> {
>>> + struct clk *usb20_clk;
>>> u32 val;
>>> u32 timeout = 500000; /* 500 msec */
>>>
>>> val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
>>>
>>> + usb20_clk = clk_get(NULL, "usb20");
>>
>> We should not be using a NULL device pointer here. Can you pass the musb
>> device pointer available in the same file? Also, da850_clks[] in da850.c
>> needs to be fixed to add the matching device name.
>
> This clock can be used for usb 1.1 PHY even when musb is not being used,
> so I don't think we can depend on having a musb device here.
Replied to this against the same question in v6 patch series you posted.
> Also, in a previous review, it was decided that the usb clocks should
> *not* be added to da850_clks[] [1]. Instead, they are dynamically
> registered elsewhere.
Thats only the USB phy clocks since there is associated
enable()/disable()/set_parent() code which is better kept outside of
da850.c for readability. No other reason. Lookup for the USB 2.0 module
clock is already present in da850.c
Thanks,
Sekhar
[toc] | [prev] | [next] | [standalone]
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 10/17] USB: da8xx: use flag instead of bitmask for over current change |
| Message-ID | <svQBI-1Ks-43@gated-at.bofh.it> |
| In reply to | #1507431 |
From: Axel Haslam <ahaslam@baylibre.com>
The da8xx ohci has only one port connected. In hub_control we
check that the port is 1, or else we bail out early. There is no point
in passing as argument the port number, if we know, and check that it
will always be 1.
Simplify functions and callbacks, by removing the port parameter, and
converting the over current indicatior change form a mask to a flag.
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
arch/arm/mach-davinci/board-da830-evm.c | 8 ++++----
arch/arm/mach-davinci/board-omapl138-hawk.c | 8 ++++----
drivers/usb/host/ohci-da8xx.c | 29 ++++++++++++++---------------
include/linux/platform_data/usb-davinci.h | 9 ++++-----
4 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index b33fc6b..d12fcf5 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -50,18 +50,18 @@
static da8xx_ocic_handler_t da830_evm_usb_ocic_handler;
-static int da830_evm_usb_set_power(unsigned port, int on)
+static int da830_evm_usb_set_power(int on)
{
gpio_set_value(ON_BD_USB_DRV, on);
return 0;
}
-static int da830_evm_usb_get_power(unsigned port)
+static int da830_evm_usb_get_power(void)
{
return gpio_get_value(ON_BD_USB_DRV);
}
-static int da830_evm_usb_get_oci(unsigned port)
+static int da830_evm_usb_get_oci(void)
{
return !gpio_get_value(ON_BD_USB_OVC);
}
@@ -100,7 +100,7 @@ static int da830_evm_usb_ocic_notify(da8xx_ocic_handler_t handler)
static irqreturn_t da830_evm_usb_ocic_irq(int irq, void *dev_id)
{
- da830_evm_usb_ocic_handler(&da830_evm_usb11_pdata, 1);
+ da830_evm_usb_ocic_handler(&da830_evm_usb11_pdata);
return IRQ_HANDLED;
}
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index c3ab7ea..1d31f45 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -189,18 +189,18 @@ static __init void omapl138_hawk_mmc_init(void)
-1
};
-static int hawk_usb_set_power(unsigned port, int on)
+static int hawk_usb_set_power(int on)
{
gpio_set_value(DA850_USB1_VBUS_PIN, on);
return 0;
}
-static int hawk_usb_get_power(unsigned port)
+static int hawk_usb_get_power(void)
{
return gpio_get_value(DA850_USB1_VBUS_PIN);
}
-static int hawk_usb_get_oci(unsigned port)
+static int hawk_usb_get_oci(void)
{
return !gpio_get_value(DA850_USB1_OC_PIN);
}
@@ -237,7 +237,7 @@ static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
{
- hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
+ hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata);
return IRQ_HANDLED;
}
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 3656d7c..e98066d 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -25,8 +25,8 @@
static struct clk *usb11_clk;
static struct phy *usb11_phy;
-/* Over-current indicator change bitmask */
-static volatile u16 ocic_mask;
+/* Over-current indicator change flag */
+static int ocic_flag;
static int ohci_da8xx_enable(void)
{
@@ -64,14 +64,13 @@ static void ohci_da8xx_disable(void)
/*
* Handle the port over-current indicator change.
*/
-static void ohci_da8xx_ocic_handler(struct da8xx_ohci_root_hub *hub,
- unsigned port)
+static void ohci_da8xx_ocic_handler(struct da8xx_ohci_root_hub *hub)
{
- ocic_mask |= 1 << port;
+ ocic_flag = 1;
/* Once over-current is detected, the port needs to be powered down */
- if (hub->get_oci(port) > 0)
- hub->set_power(port, 0);
+ if (hub->get_oci() > 0)
+ hub->set_power(0);
}
static int ohci_da8xx_init(struct usb_hcd *hcd)
@@ -147,8 +146,8 @@ static int ohci_da8xx_hub_status_data(struct usb_hcd *hcd, char *buf)
{
int length = ohci_hub_status_data(hcd, buf);
- /* See if we have OCIC bit set on port 1 */
- if (ocic_mask & (1 << 1)) {
+ /* See if we have OCIC flag set */
+ if (ocic_flag) {
dev_dbg(hcd->self.controller, "over-current indicator change "
"on port 1\n");
@@ -181,15 +180,15 @@ static int ohci_da8xx_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
temp = roothub_portstatus(hcd_to_ohci(hcd), wIndex - 1);
/* The port power status (PPS) bit defaults to 1 */
- if (hub->get_power && hub->get_power(wIndex) == 0)
+ if (hub->get_power && hub->get_power() == 0)
temp &= ~RH_PS_PPS;
/* The port over-current indicator (POCI) bit is always 0 */
- if (hub->get_oci && hub->get_oci(wIndex) > 0)
+ if (hub->get_oci && hub->get_oci() > 0)
temp |= RH_PS_POCI;
/* The over-current indicator change (OCIC) bit is 0 too */
- if (ocic_mask & (1 << wIndex))
+ if (ocic_flag)
temp |= RH_PS_OCIC;
put_unaligned(cpu_to_le32(temp), (__le32 *)buf);
@@ -213,16 +212,16 @@ static int ohci_da8xx_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
if (!hub->set_power)
return -EPIPE;
- return hub->set_power(wIndex, temp) ? -EPIPE : 0;
+ return hub->set_power(temp) ? -EPIPE : 0;
case USB_PORT_FEAT_C_OVER_CURRENT:
dev_dbg(dev, "%sPortFeature(%u): %s\n",
temp ? "Set" : "Clear", wIndex,
"C_OVER_CURRENT");
if (temp)
- ocic_mask |= 1 << wIndex;
+ ocic_flag = 1;
else
- ocic_mask &= ~(1 << wIndex);
+ ocic_flag = 0;
return 0;
}
}
diff --git a/include/linux/platform_data/usb-davinci.h b/include/linux/platform_data/usb-davinci.h
index 0926e99..3217fbe 100644
--- a/include/linux/platform_data/usb-davinci.h
+++ b/include/linux/platform_data/usb-davinci.h
@@ -13,17 +13,16 @@
struct da8xx_ohci_root_hub;
-typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub,
- unsigned port);
+typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub);
/* Passed as the platform data to the OHCI driver */
struct da8xx_ohci_root_hub {
/* Switch the port power on/off */
- int (*set_power)(unsigned port, int on);
+ int (*set_power)(int on);
/* Read the port power status */
- int (*get_power)(unsigned port);
+ int (*get_power)(void);
/* Read the port over-current indicator */
- int (*get_oci)(unsigned port);
+ int (*get_oci)(void);
/* Over-current indicator change notification (pass NULL to disable) */
int (*ocic_notify)(da8xx_ocic_handler_t handler);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 16/17] USB: ohci-da8xx: Allow probing from DT |
| Message-ID | <svQBI-1Ks-45@gated-at.bofh.it> |
| In reply to | #1507431 |
From: Axel Haslam <ahaslam@baylibre.com>
This adds the compatible string to the ohci driver
to be able to probe from DT
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
drivers/usb/host/ohci-da8xx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index bebc3f0..1a8db25 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -273,6 +273,13 @@ static int ohci_da8xx_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
}
/*-------------------------------------------------------------------------*/
+#ifdef CONFIG_OF
+static const struct of_device_id da8xx_ohci_ids[] = {
+ { .compatible = "ti,da830-ohci" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, da8xx_ohci_ids);
+#endif
static int ohci_da8xx_probe(struct platform_device *pdev)
{
@@ -421,6 +428,7 @@ static int ohci_da8xx_resume(struct platform_device *dev)
#endif
.driver = {
.name = "ohci",
+ .of_match_table = da8xx_ohci_ids,
},
};
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2016-10-25 03:00 +0200 |
| Subject | Re: [PATCH/RFT v2 16/17] USB: ohci-da8xx: Allow probing from DT |
| Message-ID | <svYfT-6Ht-5@gated-at.bofh.it> |
| In reply to | #1507442 |
On 10/24/2016 11:46 AM, ahaslam@baylibre.com wrote:
> From: Axel Haslam <ahaslam@baylibre.com>
>
> This adds the compatible string to the ohci driver
> to be able to probe from DT
>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---
> drivers/usb/host/ohci-da8xx.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
> index bebc3f0..1a8db25 100644
> --- a/drivers/usb/host/ohci-da8xx.c
> +++ b/drivers/usb/host/ohci-da8xx.c
> @@ -273,6 +273,13 @@ static int ohci_da8xx_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> }
>
> /*-------------------------------------------------------------------------*/
> +#ifdef CONFIG_OF
#ifdef CONFIG_OF is probably not needed here...
> +static const struct of_device_id da8xx_ohci_ids[] = {
> + { .compatible = "ti,da830-ohci" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, da8xx_ohci_ids);
> +#endif
>
> static int ohci_da8xx_probe(struct platform_device *pdev)
> {
> @@ -421,6 +428,7 @@ static int ohci_da8xx_resume(struct platform_device *dev)
> #endif
> .driver = {
> .name = "ohci",
> + .of_match_table = da8xx_ohci_ids,
...otherwise, da8xx_ohci_ids will not be defined here
> },
> };
>
>
[toc] | [prev] | [next] | [standalone]
| From | Axel Haslam <ahaslam@baylibre.com> |
|---|---|
| Date | 2016-10-25 10:20 +0200 |
| Subject | Re: [PATCH/RFT v2 16/17] USB: ohci-da8xx: Allow probing from DT |
| Message-ID | <sw57H-329-3@gated-at.bofh.it> |
| In reply to | #1507896 |
On Tue, Oct 25, 2016 at 2:53 AM, David Lechner <david@lechnology.com> wrote:
> On 10/24/2016 11:46 AM, ahaslam@baylibre.com wrote:
>>
>> From: Axel Haslam <ahaslam@baylibre.com>
>>
>> This adds the compatible string to the ohci driver
>> to be able to probe from DT
>>
>> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
>> ---
>> drivers/usb/host/ohci-da8xx.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
>> index bebc3f0..1a8db25 100644
>> --- a/drivers/usb/host/ohci-da8xx.c
>> +++ b/drivers/usb/host/ohci-da8xx.c
>> @@ -273,6 +273,13 @@ static int ohci_da8xx_hub_control(struct usb_hcd
>> *hcd, u16 typeReq, u16 wValue,
>> }
>>
>>
>> /*-------------------------------------------------------------------------*/
>> +#ifdef CONFIG_OF
>
>
> #ifdef CONFIG_OF is probably not needed here...
>
>> +static const struct of_device_id da8xx_ohci_ids[] = {
>> + { .compatible = "ti,da830-ohci" },
>> + { }
>> +};
>> +MODULE_DEVICE_TABLE(of, da8xx_ohci_ids);
>> +#endif
>>
>> static int ohci_da8xx_probe(struct platform_device *pdev)
>> {
>> @@ -421,6 +428,7 @@ static int ohci_da8xx_resume(struct platform_device
>> *dev)
>> #endif
>> .driver = {
>> .name = "ohci",
>> + .of_match_table = da8xx_ohci_ids,
>
>
> ...otherwise, da8xx_ohci_ids will not be defined here
this should be .of_match_table = of_match_ptr(da8xx_ohci_ids),
will fix.
>
>> },
>> };
>>
>>
>
[toc] | [prev] | [next] | [standalone]
| From | ahaslam@baylibre.com |
|---|---|
| Date | 2016-10-24 18:50 +0200 |
| Subject | [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. |
| Message-ID | <svQBI-1Ks-53@gated-at.bofh.it> |
| In reply to | #1507431 |
From: David Lechner <david@lechnology.com>
The CFGCHIP registers are used by a number of devices, so using a syscon
device to share them. The first consumer of this will by the phy-da8xx-usb
driver.
Signed-off-by: David Lechner <david@lechnology.com>
[Axel: minor fix: change id to -1]
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
arch/arm/mach-davinci/board-da830-evm.c | 4 ++++
arch/arm/mach-davinci/board-da850-evm.c | 4 ++++
arch/arm/mach-davinci/board-mityomapl138.c | 4 ++++
arch/arm/mach-davinci/board-omapl138-hawk.c | 4 ++++
arch/arm/mach-davinci/devices-da8xx.c | 28 ++++++++++++++++++++++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 2 ++
6 files changed, 46 insertions(+)
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 605d444..3051cb6 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -586,6 +586,10 @@ static __init void da830_evm_init(void)
struct davinci_soc_info *soc_info = &davinci_soc_info;
int ret;
+ ret = da8xx_register_cfgchip();
+ if (ret)
+ pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);
+
ret = da830_register_gpio();
if (ret)
pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 8e4539f..ec5cb10 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1345,6 +1345,10 @@ static __init void da850_evm_init(void)
{
int ret;
+ ret = da8xx_register_cfgchip();
+ if (ret)
+ pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);
+
ret = da850_register_gpio();
if (ret)
pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index bc4e63f..1a6d430 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -514,6 +514,10 @@ static void __init mityomapl138_init(void)
{
int ret;
+ ret = da8xx_register_cfgchip();
+ if (ret)
+ pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);
+
/* for now, no special EDMA channels are reserved */
ret = da850_register_edma(NULL);
if (ret)
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index d4930b6..8691a25 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -294,6 +294,10 @@ static __init void omapl138_hawk_init(void)
{
int ret;
+ ret = da8xx_register_cfgchip();
+ if (ret)
+ pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);
+
ret = da850_register_gpio();
if (ret)
pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index add3771..31a99db 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -11,6 +11,7 @@
* (at your option) any later version.
*/
#include <linux/init.h>
+#include <linux/platform_data/syscon.h>
#include <linux/platform_device.h>
#include <linux/dma-contiguous.h>
#include <linux/serial_8250.h>
@@ -1089,3 +1090,30 @@ int __init da850_register_sata(unsigned long refclkpn)
return platform_device_register(&da850_sata_device);
}
#endif
+
+static struct syscon_platform_data da8xx_cfgchip_platform_data = {
+ .label = "cfgchip",
+};
+
+static struct resource da8xx_cfgchip_resources[] = {
+ {
+ .start = DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP0_REG,
+ .end = DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP4_REG + 3,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device da8xx_cfgchip_device = {
+ .name = "syscon",
+ .id = -1,
+ .dev = {
+ .platform_data = &da8xx_cfgchip_platform_data,
+ },
+ .num_resources = ARRAY_SIZE(da8xx_cfgchip_resources),
+ .resource = da8xx_cfgchip_resources,
+};
+
+int __init da8xx_register_cfgchip(void)
+{
+ return platform_device_register(&da8xx_cfgchip_device);
+}
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index c367530..c32444b 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -61,6 +61,7 @@
#define DA8XX_CFGCHIP1_REG 0x180
#define DA8XX_CFGCHIP2_REG 0x184
#define DA8XX_CFGCHIP3_REG 0x188
+#define DA8XX_CFGCHIP4_REG 0x18c
#define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000)
#define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x))
@@ -116,6 +117,7 @@
int da8xx_register_rproc(void);
int da850_register_gpio(void);
int da830_register_gpio(void);
+int da8xx_register_cfgchip(void);
extern struct platform_device da8xx_serial_device[];
extern struct emac_platform_data da8xx_emac_pdata;
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Sekhar Nori <nsekhar@ti.com> |
|---|---|
| Date | 2016-10-25 10:20 +0200 |
| Subject | Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. |
| Message-ID | <sw57I-329-25@gated-at.bofh.it> |
| In reply to | #1507443 |
On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote: > From: David Lechner <david@lechnology.com> > > The CFGCHIP registers are used by a number of devices, so using a syscon > device to share them. The first consumer of this will by the phy-da8xx-usb > driver. > > Signed-off-by: David Lechner <david@lechnology.com> > [Axel: minor fix: change id to -1] Can you please clarify this change? There could be other syscon devices on the chip for other common registers. Why use the singular device-id? > Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Thanks, Sekhar
[toc] | [prev] | [next] | [standalone]
| From | Axel Haslam <ahaslam@baylibre.com> |
|---|---|
| Date | 2016-10-25 11:40 +0200 |
| Subject | Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. |
| Message-ID | <sw6n7-3Lf-3@gated-at.bofh.it> |
| In reply to | #1508065 |
Hi Sekar,
On Tue, Oct 25, 2016 at 10:10 AM, Sekhar Nori <nsekhar@ti.com> wrote:
> On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote:
>> From: David Lechner <david@lechnology.com>
>>
>> The CFGCHIP registers are used by a number of devices, so using a syscon
>> device to share them. The first consumer of this will by the phy-da8xx-usb
>> driver.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> [Axel: minor fix: change id to -1]
>
> Can you please clarify this change? There could be other syscon devices
> on the chip for other common registers. Why use the singular device-id?
>
in the case of non DT boot, the phy driver is looking for "syscon" :
d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon");
if we register the syscon driver with id = 0, the actual name of the syscon
device will be "syscon.0" and the phy driver will fail to probe, because
the strncmp match in the syscon driver (syscon_match_pdevname)
will fail.
should i change the phy driver instead?
Regards,
Axel.
>> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
>
> Thanks,
> Sekhar
>
[toc] | [prev] | [next] | [standalone]
| From | Sekhar Nori <nsekhar@ti.com> |
|---|---|
| Date | 2016-10-25 12:20 +0200 |
| Subject | Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. |
| Message-ID | <sw6ZP-4he-1@gated-at.bofh.it> |
| In reply to | #1508119 |
On Tuesday 25 October 2016 03:07 PM, Axel Haslam wrote:
> Hi Sekar,
>
> On Tue, Oct 25, 2016 at 10:10 AM, Sekhar Nori <nsekhar@ti.com> wrote:
>> On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote:
>>> From: David Lechner <david@lechnology.com>
>>>
>>> The CFGCHIP registers are used by a number of devices, so using a syscon
>>> device to share them. The first consumer of this will by the phy-da8xx-usb
>>> driver.
>>>
>>> Signed-off-by: David Lechner <david@lechnology.com>
>>> [Axel: minor fix: change id to -1]
>>
>> Can you please clarify this change? There could be other syscon devices
>> on the chip for other common registers. Why use the singular device-id?
>>
>
> in the case of non DT boot, the phy driver is looking for "syscon" :
>
> d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon");
>
> if we register the syscon driver with id = 0, the actual name of the syscon
> device will be "syscon.0" and the phy driver will fail to probe, because
> the strncmp match in the syscon driver (syscon_match_pdevname)
> will fail.
>
> should i change the phy driver instead?
Yes, please. Forcing only one syscon region for the whole chip will be
too restrictive, I am pretty sure.
Thanks,
Sekhar
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2016-10-25 18:00 +0200 |
| Subject | Re: [PATCH/RFT v2 02/17] ARM: davinci: da8xx: Add CFGCHIP syscon platform declaration. |
| Message-ID | <swciW-7zc-3@gated-at.bofh.it> |
| In reply to | #1508158 |
Hi Sekhar,
On 10/25/2016 05:17 AM, Sekhar Nori wrote:
> On Tuesday 25 October 2016 03:07 PM, Axel Haslam wrote:
>> Hi Sekar,
>>
>> On Tue, Oct 25, 2016 at 10:10 AM, Sekhar Nori <nsekhar@ti.com> wrote:
>>> On Monday 24 October 2016 10:16 PM, ahaslam@baylibre.com wrote:
>>>> From: David Lechner <david@lechnology.com>
>>>>
>>>> The CFGCHIP registers are used by a number of devices, so using a syscon
>>>> device to share them. The first consumer of this will by the phy-da8xx-usb
>>>> driver.
>>>>
>>>> Signed-off-by: David Lechner <david@lechnology.com>
>>>> [Axel: minor fix: change id to -1]
>>>
>>> Can you please clarify this change? There could be other syscon devices
>>> on the chip for other common registers. Why use the singular device-id?
>>>
>>
>> in the case of non DT boot, the phy driver is looking for "syscon" :
>>
>> d_phy->regmap = syscon_regmap_lookup_by_pdevname("syscon");
>>
>> if we register the syscon driver with id = 0, the actual name of the syscon
>> device will be "syscon.0" and the phy driver will fail to probe, because
>> the strncmp match in the syscon driver (syscon_match_pdevname)
>> will fail.
>>
>> should i change the phy driver instead?
>
> Yes, please. Forcing only one syscon region for the whole chip will be
> too restrictive, I am pretty sure.
>
> Thanks,
> Sekhar
>
In the previous review, you requested that this be changed to -1 [1].
If we change it back to 0, it will also require reverting a patch to the
phy driver that has already been merged[2].
[1]: http://www.gossamer-threads.com/lists/linux/kernel/2435807?page=last
[2]: http://www.gossamer-threads.com/lists/linux/kernel/2518804
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web