* [PATCH 10/14] PCI: tegra: Move PCIe driver to drivers/pci/host
From: Andrew Murray @ 2013-01-18 9:56 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1357764194-12677-11-git-send-email-thierry.reding@avionic-design.de>
On Wed, Jan 09, 2013 at 08:43:10PM +0000, Thierry Reding wrote:
> Move the PCIe driver from arch/arm/mach-tegra into the drivers/pci/host
> directory. The motivation is to collect various host controller drivers
> in the same location in order to facilitate refactoring.
>
> The Tegra PCIe driver has been largely rewritten, both in order to turn
> it into a proper platform driver and to add MSI (based on code by
> Krishna Kishore <kthota@nvidia.com>) as well as device tree support.
>
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
[snip]
> +static int tegra_pcie_enable(struct tegra_pcie *pcie)
> +{
> + struct hw_pci hw;
> +
> + memset(&hw, 0, sizeof(hw));
> +
> + hw.nr_controllers = 1;
> + hw.private_data = (void **)&pcie;
> + hw.setup = tegra_pcie_setup;
> + hw.scan = tegra_pcie_scan_bus;
> + hw.map_irq = tegra_pcie_map_irq;
> +
> + pci_common_init(&hw);
> +
> + return 0;
> +}
[snip]
> +static int tegra_pcie_probe(struct platform_device *pdev)
> +{
> + struct device_node *port;
> + struct tegra_pcie *pcie;
> + int err;
> +
> + pcie = devm_kzalloc(&pdev->dev, sizeof(*pcie), GFP_KERNEL);
> + if (!pcie)
> + return -ENOMEM;
> +
> + INIT_LIST_HEAD(&pcie->ports);
> + pcie->dev = &pdev->dev;
> +
> + err = tegra_pcie_parse_dt(pcie);
> + if (err < 0)
> + return err;
> +
> + pcibios_min_mem = 0;
> +
> + err = tegra_pcie_get_resources(pcie);
> + if (err < 0) {
> + dev_err(&pdev->dev, "failed to request resources: %d\n", err);
> + return err;
> + }
> +
> + err = tegra_pcie_enable_controller(pcie);
> + if (err)
> + goto put_resources;
> +
> + /* probe root ports */
> + for_each_child_of_node(pdev->dev.of_node, port) {
> + if (!of_device_is_available(port))
> + continue;
> +
> + err = tegra_pcie_add_port(pcie, port);
> + if (err < 0) {
> + dev_err(&pdev->dev, "failed to add port %s: %d\n",
> + port->name, err);
> + }
> + }
> +
> + /* setup the AFI address translations */
> + tegra_pcie_setup_translations(pcie);
> +
> + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> + err = tegra_pcie_enable_msi(pcie);
> + if (err < 0) {
> + dev_err(&pdev->dev,
> + "failed to enable MSI support: %d\n",
> + err);
> + goto put_resources;
> + }
> + }
> +
> + err = tegra_pcie_enable(pcie);
> + if (err < 0) {
> + dev_err(&pdev->dev, "failed to enable PCIe ports: %d\n", err);
> + goto disable_msi;
> + }
> +
> + platform_set_drvdata(pdev, pcie);
> + return 0;
> +
> +disable_msi:
> + if (IS_ENABLED(CONFIG_PCI_MSI))
> + tegra_pcie_disable_msi(pcie);
> +put_resources:
> + tegra_pcie_put_resources(pcie);
> + return err;
> +}
> +
[snip]
> +
> +static const struct of_device_id tegra_pcie_of_match[] = {
> + { .compatible = "nvidia,tegra20-pcie", },
> + { },
> +};
> +
> +static struct platform_driver tegra_pcie_driver = {
> + .driver = {
> + .name = "tegra-pcie",
> + .owner = THIS_MODULE,
> + .of_match_table = tegra_pcie_of_match,
> + },
> + .probe = tegra_pcie_probe,
> + .remove = tegra_pcie_remove,
> +};
> +module_platform_driver(tegra_pcie_driver);
If you have multiple 'nvidia,tegra20-pcie's in your DT then you will end up
with multiple calls to tegra_pcie_probe/tegra_pcie_enable/pci_common_init.
However pci_common_init/pcibios_init_hw assumes it will only ever be called
once, and will thus result in trying to create multiple busses with the same
bus number. (The first root bus it creates is always zero provided you haven't
implemented hw->scan).
I have a patch for this if you want to fold it into your series? (I see you've
made changes to bios32 for per-controller data).
Andrew Murray
^ permalink raw reply
* [PATCH 3/3] ARM: dts: omap: Add usb_otg and glue data
From: Kishon Vijay Abraham I @ 2013-01-18 9:51 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502676-27193-1-git-send-email-kishon@ti.com>
Add usb otg data node in omap4/omap3 device tree file. Also update
the node with board specific setting in omapx-<board>.dts file.
The dt data specifies among others the interface type (ULPI or UTMI), mode
which is mostly OTG, power that specifies the amount of power this can supply
when in host mode.
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 2 ++
arch/arm/boot/dts/omap3-beagle-xm.dts | 6 ++++++
arch/arm/boot/dts/omap3-evm.dts | 6 ++++++
arch/arm/boot/dts/omap3-overo.dtsi | 6 ++++++
arch/arm/boot/dts/omap3.dtsi | 12 ++++++++++++
arch/arm/boot/dts/omap4-panda.dts | 6 ++++++
arch/arm/boot/dts/omap4-sdp.dts | 6 ++++++
arch/arm/boot/dts/omap4.dtsi | 13 +++++++++++++
arch/arm/boot/dts/twl4030.dtsi | 2 +-
9 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 8bedbba..985b093 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -18,6 +18,7 @@ OMAP MUSB GLUE
represents PERIPHERAL.
- power : Should be "50". This signifies the controller can supply upto
100mA when operating in host mode.
+ - usb_phy : the phandle for the PHY device
Optional properties:
- ctrl_module : phandle of the control module this glue uses to write to
@@ -32,6 +33,7 @@ usb_otg_hs: usb_otg_hs at 4a0ab000 {
num_eps = <16>;
ram_bits = <12>;
ctrl_module = <&omap_control_usb>;
+ usb_phy = <&usb2_phy>;
};
Board specific device node entry
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index 3705a81..cb07583 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -107,3 +107,9 @@
*/
ti,pulldowns = <0x03a1c4>;
};
+
+&usb_otg_hs {
+ interface_type = <0>;
+ mode = <3>;
+ power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index e8ba1c2..afb9ba9 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -59,3 +59,9 @@
&twl_gpio {
ti,use-leds;
};
+
+&usb_otg_hs {
+ interface_type = <0>;
+ mode = <3>;
+ power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap3-overo.dtsi b/arch/arm/boot/dts/omap3-overo.dtsi
index 89808ce..4b3d157 100644
--- a/arch/arm/boot/dts/omap3-overo.dtsi
+++ b/arch/arm/boot/dts/omap3-overo.dtsi
@@ -55,3 +55,9 @@
&twl_gpio {
ti,use-leds;
};
+
+&usb_otg_hs {
+ interface_type = <0>;
+ mode = <3>;
+ power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1acc261..176561b 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -397,5 +397,17 @@
ti,timer-alwon;
ti,timer-secure;
};
+
+ usb_otg_hs: usb_otg_hs at 480ab000 {
+ compatible = "ti,omap3-musb";
+ reg = <0x480ab000 0x1000>;
+ interrupts = <0 92 0x4>, <0 93 0x4>;
+ interrupt-names = "mc", "dma";
+ ti,hwmods = "usb_otg_hs";
+ usb_phy = <&usb2_phy>;
+ multipoint = <1>;
+ num_eps = <16>;
+ ram_bits = <12>;
+ };
};
};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 4122efe..612c9bb 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -206,3 +206,9 @@
&twl_usb_comparator {
usb-supply = <&vusb>;
};
+
+&usb_otg_hs {
+ interface_type = <1>;
+ mode = <3>;
+ power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 43e5258..582d7ee 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -428,3 +428,9 @@
&twl_usb_comparator {
usb-supply = <&vusb>;
};
+
+&usb_otg_hs {
+ interface_type = <1>;
+ mode = <3>;
+ power = <50>;
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index d69d6f2..7501c04 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -541,5 +541,18 @@
reg-names = "control_dev_conf", "otghs_control";
ti,has_mailbox;
};
+
+ usb_otg_hs: usb_otg_hs at 4a0ab000 {
+ compatible = "ti,omap4-musb";
+ reg = <0x4a0ab000 0x7ff>;
+ interrupts = <0 92 0x4>, <0 93 0x4>;
+ interrupt-names = "mc", "dma";
+ ti,hwmods = "usb_otg_hs";
+ usb_phy = <&usb2_phy>;
+ multipoint = <1>;
+ num_eps = <16>;
+ ram_bits = <12>;
+ ti,has_mailbox;
+ };
};
};
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index ed0bc95..398d2c3 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -67,7 +67,7 @@
#interrupt-cells = <1>;
};
- twl4030-usb {
+ usb2_phy: twl4030-usb {
compatible = "ti,twl4030-usb";
interrupts = <10>, <4>;
usb1v5-supply = <&vusb1v5>;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/3] ARM: dts: omap: Add omap-usb2 dt data
From: Kishon Vijay Abraham I @ 2013-01-18 9:51 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502676-27193-1-git-send-email-kishon@ti.com>
Add omap-usb2 data node in omap4 device tree file. Since omap-usb2 is
connected to ocp2scp, omap-usb2 dt data is added as a child node
of ocp2scp.
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/omap4.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index ad837e6..d69d6f2 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -438,6 +438,10 @@
#size-cells = <1>;
ranges;
ti,hwmods = "ocp2scp_usb_phy";
+ usb2_phy: usb2phy at 4a0ad080 {
+ compatible = "ti,omap-usb2";
+ reg = <0x4a0ad080 0x58>;
+ };
};
timer1: timer at 4a318000 {
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/3] ARM: dts: omap: Add omap control usb data
From: Kishon Vijay Abraham I @ 2013-01-18 9:51 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502676-27193-1-git-send-email-kishon@ti.com>
Add omap control usb data in omap4 device tree file. This will have the
register address of registers to power on the PHY and to write to
mailbox.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/omap4.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79..ad837e6 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,13 @@
ti,hwmods = "timer11";
ti,timer-pwm;
};
+
+ omap_control_usb: omap-control-usb at 4a002300 {
+ compatible = "ti,omap-control-usb";
+ reg = <0x4a002300 0x4>,
+ <0x4a00233c 0x4>;
+ reg-names = "control_dev_conf", "otghs_control";
+ ti,has_mailbox;
+ };
};
};
--
1.7.9.5
^ permalink raw reply related
* [PATCH 0/3] ARM: dts: omap: add dt data for MUSB
From: Kishon Vijay Abraham I @ 2013-01-18 9:51 UTC (permalink / raw)
To: linux-arm-kernel
This patch series adds dt data to get MUSB working in omap4 and omap3.
Long time back a patch series with the same title was sent but only
a part of it got merged. The rest of it wasn't merged because of
adding omap control usb data to glue and usb phy.
Now there exists a separate driver for control usb and hence added a
separate dt node for control usb.
This series was developed on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv
+ "usb: musb: add driver for control module" patch series
Did basic enumeration testing in omap4 panda, omap4 sdp and omap3 beagle.
Kishon Vijay Abraham I (3):
ARM: dts: omap: Add omap control usb data
ARM: dts: omap: Add omap-usb2 dt data
ARM: dts: omap: Add usb_otg and glue data
Documentation/devicetree/bindings/usb/omap-usb.txt | 2 ++
arch/arm/boot/dts/omap3-beagle-xm.dts | 6 +++++
arch/arm/boot/dts/omap3-evm.dts | 6 +++++
arch/arm/boot/dts/omap3-overo.dtsi | 6 +++++
arch/arm/boot/dts/omap3.dtsi | 12 ++++++++++
arch/arm/boot/dts/omap4-panda.dts | 6 +++++
arch/arm/boot/dts/omap4-sdp.dts | 6 +++++
arch/arm/boot/dts/omap4.dtsi | 25 ++++++++++++++++++++
arch/arm/boot/dts/twl4030.dtsi | 2 +-
9 files changed, 70 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply
* [PATCH v7 01/22] mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
From: Roger Quadros @ 2013-01-18 9:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20130117165943.GI14149@atomide.com>
On 01/17/2013 06:59 PM, Tony Lindgren wrote:
> * Alan Stern <stern@rowland.harvard.edu> [130117 07:19]:
>> On Thu, 17 Jan 2013, Roger Quadros wrote:
>>
>>> Let's have a single platform data structure for the OMAP's High-Speed
>>> USB host subsystem instead of having 3 separate ones i.e. one for
>>> board data, one for USB Host (UHH) module and one for USB-TLL module.
>>>
>>> This makes the code much simpler and avoids creating multiple copies of
>>> platform data.
>>>
>>> CC: Alan Stern <stern@rowland.harvard.edu>
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>
>> For the ehci-omap.c part:
>>
>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>
> If Samuel acks this patch, I can apply just this patch alone on v3.8-rc3
> into an immutable branch omap-for-v3.9/board-usb so we all merge it in
> as needed.
>
I'll be sending a v8 of this series with one stable patch candidate
before this patch and Felipe's comments addressed.
--
cheers,
-roger
^ permalink raw reply
* [PATCH 4/4] drivers: usb: start using the control module driver
From: Kishon Vijay Abraham I @ 2013-01-18 9:40 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502045-27008-1-git-send-email-kishon@ti.com>
Start using the control module driver for powering on the PHY and for
writing to the mailbox instead of writing to the control module
registers on their own.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 4 ++
Documentation/devicetree/bindings/usb/usb-phy.txt | 7 +--
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 13 ----
drivers/usb/musb/Kconfig | 1 +
drivers/usb/musb/omap2430.c | 64 ++++++++------------
drivers/usb/musb/omap2430.h | 9 ---
drivers/usb/phy/Kconfig | 1 +
drivers/usb/phy/omap-usb2.c | 38 +++---------
include/linux/usb/omap_usb.h | 4 +-
9 files changed, 42 insertions(+), 99 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index ead6ba9..8bedbba 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -3,6 +3,9 @@ OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
OMAP MUSB GLUE
- compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
- ti,hwmods : must be "usb_otg_hs"
+ - ti,has_mailbox : to specify that omap uses an external mailbox
+ (in control module) to communicate with the musb core during device connect
+ and disconnect.
- multipoint : Should be "1" indicating the musb controller supports
multipoint. This is a MUSB configuration-specific setting.
- num_eps : Specifies the number of endpoints. This is also a
@@ -24,6 +27,7 @@ SOC specific device node entry
usb_otg_hs: usb_otg_hs at 4a0ab000 {
compatible = "ti,omap4-musb";
ti,hwmods = "usb_otg_hs";
+ ti,has_mailbox;
multipoint = <1>;
num_eps = <16>;
ram_bits = <12>;
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 2466b6f..48761a2 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -4,9 +4,7 @@ OMAP USB2 PHY
Required properties:
- compatible: Should be "ti,omap-usb2"
- - reg : Address and length of the register set for the device. Also
-add the address of control module dev conf register until a driver for
-control module is added
+ - reg : Address and length of the register set for the device.
Optional properties:
- ctrl_module : phandle of the control module used by PHY driver to power on
@@ -16,7 +14,6 @@ This is usually a subnode of ocp2scp to which it is connected.
usb2phy at 4a0ad080 {
compatible = "ti,omap-usb2";
- reg = <0x4a0ad080 0x58>,
- <0x4a002300 0x4>;
+ reg = <0x4a0ad080 0x58>;
ctrl_module = <&omap_control_usb>;
};
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 129d508..103f4ba 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2698,13 +2698,6 @@ static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
.end = 0x4a0ae000,
.flags = IORESOURCE_MEM,
},
- {
- /* XXX: Remove this once control module driver is in place */
- .name = "ctrl_dev",
- .start = 0x4a002300,
- .end = 0x4a002303,
- .flags = IORESOURCE_MEM,
- },
{ }
};
@@ -6152,12 +6145,6 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
.pa_end = 0x4a0ab7ff,
.flags = ADDR_TYPE_RT
},
- {
- /* XXX: Remove this once control module driver is in place */
- .pa_start = 0x4a00233c,
- .pa_end = 0x4a00233f,
- .flags = ADDR_TYPE_RT
- },
{ }
};
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 23a0b7f..de6e5ce 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC
select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX)
select TWL4030_USB if MACH_OMAP_3430SDP
select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
+ select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
select USB_OTG_UTILS
help
Say Y here if your system has a dual role high speed USB
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index da00af4..3e7ceef 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -37,6 +37,7 @@
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/usb/musb-omap.h>
+#include <linux/usb/omap_control_usb.h>
#include "musb_core.h"
#include "omap2430.h"
@@ -46,7 +47,7 @@ struct omap2430_glue {
struct platform_device *musb;
enum omap_musb_vbus_id_status status;
struct work_struct omap_musb_mailbox_work;
- u32 __iomem *control_otghs;
+ struct device *control_otghs;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)
@@ -54,26 +55,6 @@ struct omap2430_glue *_glue;
static struct timer_list musb_idle_timer;
-/**
- * omap4_usb_phy_mailbox - write to usb otg mailbox
- * @glue: struct omap2430_glue *
- * @val: the value to be written to the mailbox
- *
- * On detection of a device (ID pin is grounded), this API should be called
- * to set AVALID, VBUSVALID and ID pin is grounded.
- *
- * When OMAP is connected to a host (OMAP in device mode), this API
- * is called to set AVALID, VBUSVALID and ID pin in high impedance.
- *
- * XXX: This function will be removed once we have a seperate driver for
- * control module
- */
-static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
-{
- if (glue->control_otghs)
- writel(val, glue->control_otghs);
-}
-
static void musb_do_idle(unsigned long _musb)
{
struct musb *musb = (void *)_musb;
@@ -269,7 +250,6 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
static void omap_musb_set_mailbox(struct omap2430_glue *glue)
{
- u32 val;
struct musb *musb = glue_to_musb(glue);
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *pdata = dev->platform_data;
@@ -285,8 +265,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
musb->xceiv->last_event = USB_EVENT_ID;
if (musb->gadget_driver) {
pm_runtime_get_sync(dev);
- val = AVALID | VBUSVALID;
- omap4_usb_phy_mailbox(glue, val);
+ if (!IS_ERR(glue->control_otghs))
+ omap_control_usb_host_mode(glue->control_otghs);
omap2430_musb_set_vbus(musb, 1);
}
break;
@@ -299,8 +279,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
musb->xceiv->last_event = USB_EVENT_VBUS;
if (musb->gadget_driver)
pm_runtime_get_sync(dev);
- val = IDDIG | AVALID | VBUSVALID;
- omap4_usb_phy_mailbox(glue, val);
+ if (!IS_ERR(glue->control_otghs))
+ omap_control_usb_device_mode(glue->control_otghs);
break;
case OMAP_MUSB_ID_FLOAT:
@@ -317,8 +297,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
if (musb->xceiv->otg->set_vbus)
otg_set_vbus(musb->xceiv->otg, 0);
}
- val = SESSEND | IDDIG;
- omap4_usb_phy_mailbox(glue, val);
+ if (!IS_ERR(glue->control_otghs))
+ omap_control_usb_set_sessionend(glue->control_otghs);
break;
default:
dev_dbg(dev, "ID float\n");
@@ -415,7 +395,6 @@ err1:
static void omap2430_musb_enable(struct musb *musb)
{
u8 devctl;
- u32 val;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct device *dev = musb->controller;
struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
@@ -425,8 +404,8 @@ static void omap2430_musb_enable(struct musb *musb)
switch (glue->status) {
case OMAP_MUSB_ID_GROUND:
- val = AVALID | VBUSVALID;
- omap4_usb_phy_mailbox(glue, val);
+ if (!IS_ERR(glue->control_otghs))
+ omap_control_usb_host_mode(glue->control_otghs);
if (data->interface_type != MUSB_INTERFACE_UTMI)
break;
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -445,8 +424,8 @@ static void omap2430_musb_enable(struct musb *musb)
break;
case OMAP_MUSB_VBUS_VALID:
- val = IDDIG | AVALID | VBUSVALID;
- omap4_usb_phy_mailbox(glue, val);
+ if (!IS_ERR(glue->control_otghs))
+ omap_control_usb_device_mode(glue->control_otghs);
break;
default:
@@ -456,13 +435,12 @@ static void omap2430_musb_enable(struct musb *musb)
static void omap2430_musb_disable(struct musb *musb)
{
- u32 val;
struct device *dev = musb->controller;
struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
if (glue->status != OMAP_MUSB_UNKNOWN) {
- val = SESSEND | IDDIG;
- omap4_usb_phy_mailbox(glue, val);
+ if (!IS_ERR(glue->control_otghs))
+ omap_control_usb_set_sessionend(glue->control_otghs);
}
}
@@ -523,9 +501,6 @@ static int omap2430_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- glue->control_otghs = devm_request_and_ioremap(&pdev->dev, res);
- if (glue->control_otghs == NULL)
- dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
if (np) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
@@ -558,11 +533,22 @@ static int omap2430_probe(struct platform_device *pdev)
of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
of_property_read_u32(np, "power", (u32 *)&pdata->power);
config->multipoint = of_property_read_bool(np, "multipoint");
+ pdata->has_mailbox = of_property_read_bool(np,
+ "ti,has_mailbox");
pdata->board_data = data;
pdata->config = config;
}
+ if (pdata->has_mailbox) {
+ glue->control_otghs = get_omap_control_dev();
+ if (IS_ERR(glue->control_otghs)) {
+ dev_vdbg(&pdev->dev, "Failed to get control device\n");
+ return -ENODEV;
+ }
+ } else {
+ glue->control_otghs = ERR_PTR(-ENODEV);
+ }
pdata->platform_ops = &omap2430_ops;
platform_set_drvdata(pdev, glue);
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index 8ef6566..1b5e83a 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -49,13 +49,4 @@
#define OTG_FORCESTDBY 0x414
# define ENABLEFORCE (1 << 0)
-/*
- * Control Module bit definitions
- * XXX: Will be removed once we have a driver for control module.
- */
-#define AVALID BIT(0)
-#define BVALID BIT(1)
-#define VBUSVALID BIT(2)
-#define SESSEND BIT(3)
-#define IDDIG BIT(4)
#endif /* __MUSB_OMAP243X_H__ */
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index a7277ee..16bdaca 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -8,6 +8,7 @@ config OMAP_USB2
tristate "OMAP USB2 PHY Driver"
depends on ARCH_OMAP2PLUS
select USB_OTG_UTILS
+ select OMAP_CONTROL_USB
help
Enable this to support the transceiver that is part of SOC. This
driver takes care of all the PHY functionality apart from comparator.
diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
index 26ae8f4..2152ce4 100644
--- a/drivers/usb/phy/omap-usb2.c
+++ b/drivers/usb/phy/omap-usb2.c
@@ -27,6 +27,7 @@
#include <linux/err.h>
#include <linux/pm_runtime.h>
#include <linux/delay.h>
+#include <linux/usb/omap_control_usb.h>
/**
* omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -52,29 +53,6 @@ int omap_usb2_set_comparator(struct phy_companion *comparator)
}
EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
-/**
- * omap_usb_phy_power - power on/off the phy using control module reg
- * @phy: struct omap_usb *
- * @on: 0 or 1, based on powering on or off the PHY
- *
- * XXX: Remove this function once control module driver gets merged
- */
-static void omap_usb_phy_power(struct omap_usb *phy, int on)
-{
- u32 val;
-
- if (on) {
- val = readl(phy->control_dev);
- if (val & PHY_PD) {
- writel(~PHY_PD, phy->control_dev);
- /* XXX: add proper documentation for this delay */
- mdelay(200);
- }
- } else {
- writel(PHY_PD, phy->control_dev);
- }
-}
-
static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
{
struct omap_usb *phy = phy_to_omapusb(otg->phy);
@@ -124,7 +102,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
struct omap_usb *phy = phy_to_omapusb(x);
if (suspend && !phy->is_suspended) {
- omap_usb_phy_power(phy, 0);
+ omap_control_usb_phy_power(phy->control_dev, 0);
pm_runtime_put_sync(phy->dev);
phy->is_suspended = 1;
} else if (!suspend && phy->is_suspended) {
@@ -134,7 +112,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
ret);
return ret;
}
- omap_usb_phy_power(phy, 1);
+ omap_control_usb_phy_power(phy->control_dev, 1);
phy->is_suspended = 0;
}
@@ -168,14 +146,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- phy->control_dev = devm_request_and_ioremap(&pdev->dev, res);
- if (phy->control_dev == NULL) {
- dev_err(&pdev->dev, "Failed to obtain io memory\n");
- return -ENXIO;
+ phy->control_dev = get_omap_control_dev();
+ if (IS_ERR(phy->control_dev)) {
+ dev_dbg(&pdev->dev, "Failed to get control device\n");
+ return -ENODEV;
}
phy->is_suspended = 1;
- omap_usb_phy_power(phy, 0);
+ omap_control_usb_phy_power(phy->control_dev, 0);
otg->set_host = omap_usb_set_host;
otg->set_peripheral = omap_usb_set_peripheral;
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
index 0ea17f8..3db9b53 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/usb/omap_usb.h
@@ -25,13 +25,11 @@ struct omap_usb {
struct usb_phy phy;
struct phy_companion *comparator;
struct device *dev;
- u32 __iomem *control_dev;
+ struct device *control_dev;
struct clk *wkupclk;
u8 is_suspended:1;
};
-#define PHY_PD 0x1
-
#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/4] ARM: OMAP2: MUSB: Specify omap4 has mailbox
From: Kishon Vijay Abraham I @ 2013-01-18 9:40 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502045-27008-1-git-send-email-kishon@ti.com>
Added has_mailbox to the musb platform data to specify that omap uses
an external mailbox (in control module) to communicate with the musb
core during device connect and disconnect.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/mach-omap2/usb-musb.c | 3 +++
include/linux/usb/musb.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 7b33b37..9d27e3f 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -85,6 +85,9 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
musb_plat.mode = board_data->mode;
musb_plat.extvbus = board_data->extvbus;
+ if (cpu_is_omap44xx())
+ musb_plat.has_mailbox = true;
+
if (soc_is_am35xx()) {
oh_name = "am35x_otg_hs";
name = "musb-am35x";
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index eb50525..053c268 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,6 +99,8 @@ struct musb_hdrc_platform_data {
/* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
u8 mode;
+ u8 has_mailbox:1;
+
/* for clk_get() */
const char *clock;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/4] ARM: OMAP: devices: create device for usb part of control module
From: Kishon Vijay Abraham I @ 2013-01-18 9:40 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502045-27008-1-git-send-email-kishon@ti.com>
A seperate driver has been added to handle the usb part of control
module. A device for the above driver is created here, using the register
address information to be used by the driver for powering on the PHY and
for writing to the mailbox.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/mach-omap2/devices.c | 48 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5e304d0..a58b0ce 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -20,6 +20,7 @@
#include <linux/pinctrl/machine.h>
#include <linux/platform_data/omap4-keypad.h>
#include <linux/platform_data/omap_ocp2scp.h>
+#include <linux/usb/omap_control_usb.h>
#include <asm/mach-types.h>
#include <asm/mach/map.h>
@@ -254,6 +255,52 @@ static inline void omap_init_camera(void)
#endif
}
+#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
+static struct omap_control_usb_platform_data omap4_control_usb_pdata = {
+ .has_mailbox = true,
+};
+
+struct resource omap4_control_usb_res[] = {
+ {
+ .name = "control_dev_conf",
+ .start = 0x4a002300,
+ .end = 0x4a002303,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "otghs_control",
+ .start = 0x4a00233c,
+ .end = 0x4a00233f,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device omap4_control_usb = {
+ .name = "omap-control-usb",
+ .id = -1,
+ .dev = {
+ .platform_data = &omap4_control_usb_pdata,
+ },
+ .num_resources = 2,
+ .resource = omap4_control_usb_res,
+};
+
+static inline void __init omap_init_control_usb(void)
+{
+ int ret = 0;
+
+ if (cpu_is_omap44xx()) {
+ ret = platform_device_register(&omap4_control_usb);
+ if (ret)
+ pr_err("Error registering omap_control_usb device:%d\n",
+ ret);
+ }
+}
+
+#else
+static inline void omap_init_control_usb(void) { }
+#endif /* CONFIG_OMAP_CONTROL_USB */
+
int __init omap4_keyboard_init(struct omap4_keypad_platform_data
*sdp4430_keypad_data, struct omap_board_data *bdata)
{
@@ -721,6 +768,7 @@ static int __init omap2_init_devices(void)
omap_init_mbox();
/* If dtb is there, the devices will be created dynamically */
if (!of_have_populated_dt()) {
+ omap_init_control_usb();
omap_init_dmic();
omap_init_mcpdm();
omap_init_mcspi();
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/4] drivers: usb: phy: add a new driver for usb part of control module
From: Kishon Vijay Abraham I @ 2013-01-18 9:40 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358502045-27008-1-git-send-email-kishon@ti.com>
Added a new driver for the usb part of control module. This has an API
to power on the USB2 phy and an API to write to the mailbox depending on
whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was
previously done in omap glue and in omap-usb2 phy will be removed.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 26 ++-
Documentation/devicetree/bindings/usb/usb-phy.txt | 5 +
drivers/usb/phy/Kconfig | 9 +
drivers/usb/phy/Makefile | 1 +
drivers/usb/phy/omap-control-usb.c | 204 ++++++++++++++++++++
include/linux/usb/omap_control_usb.h | 72 +++++++
6 files changed, 316 insertions(+), 1 deletion(-)
create mode 100644 drivers/usb/phy/omap-control-usb.c
create mode 100644 include/linux/usb/omap_control_usb.h
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 29a043e..ead6ba9 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -1,4 +1,4 @@
-OMAP GLUE
+OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
OMAP MUSB GLUE
- compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
@@ -16,6 +16,10 @@ OMAP MUSB GLUE
- power : Should be "50". This signifies the controller can supply upto
100mA when operating in host mode.
+Optional properties:
+ - ctrl_module : phandle of the control module this glue uses to write to
+ mailbox
+
SOC specific device node entry
usb_otg_hs: usb_otg_hs at 4a0ab000 {
compatible = "ti,omap4-musb";
@@ -23,6 +27,7 @@ usb_otg_hs: usb_otg_hs at 4a0ab000 {
multipoint = <1>;
num_eps = <16>;
ram_bits = <12>;
+ ctrl_module = <&omap_control_usb>;
};
Board specific device node entry
@@ -31,3 +36,22 @@ Board specific device node entry
mode = <3>;
power = <50>;
};
+
+OMAP CONTROL USB
+
+Required properties:
+ - compatible: Should be "ti,omap-control-usb"
+ - reg : Address and length of the register set for the device. It contains
+ the address of "control_dev_conf" and "otghs_control".
+ - reg-names: The names of the register addresses corresponding to the registers
+ filled in "reg".
+ - ti,has_mailbox: This is used to specify if the platform has mailbox in
+ control module.
+
+omap_control_usb: omap-control-usb at 4a002300 {
+ compatible = "ti,omap-control-usb";
+ reg = <0x4a002300 0x4>,
+ <0x4a00233c 0x4>;
+ reg-names = "control_dev_conf", "otghs_control";
+ ti,has_mailbox;
+};
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 80d4148..2466b6f 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -8,10 +8,15 @@ Required properties:
add the address of control module dev conf register until a driver for
control module is added
+Optional properties:
+ - ctrl_module : phandle of the control module used by PHY driver to power on
+ the PHY.
+
This is usually a subnode of ocp2scp to which it is connected.
usb2phy at 4a0ad080 {
compatible = "ti,omap-usb2";
reg = <0x4a0ad080 0x58>,
<0x4a002300 0x4>;
+ ctrl_module = <&omap_control_usb>;
};
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 5de6e7f..a7277ee 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -14,6 +14,15 @@ config OMAP_USB2
The USB OTG controller communicates with the comparator using this
driver.
+config OMAP_CONTROL_USB
+ tristate "OMAP CONTROL USB Driver"
+ depends on ARCH_OMAP2PLUS
+ help
+ Enable this to add support for the USB part present in the control
+ module. This driver has API to power on the PHY and to write to the
+ mailbox. The mailbox is present only in omap4 and the register to
+ power on the PHY is present in omap4 and omap5.
+
config USB_ISP1301
tristate "NXP ISP1301 USB transceiver support"
depends on USB || USB_GADGET
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 1a579a8..0dea4d2 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -5,6 +5,7 @@
ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
obj-$(CONFIG_OMAP_USB2) += omap-usb2.o
+obj-$(CONFIG_OMAP_CONTROL_USB) += omap-control-usb.o
obj-$(CONFIG_USB_ISP1301) += isp1301.o
obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o
obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o
diff --git a/drivers/usb/phy/omap-control-usb.c b/drivers/usb/phy/omap-control-usb.c
new file mode 100644
index 0000000..7edeb41
--- /dev/null
+++ b/drivers/usb/phy/omap-control-usb.c
@@ -0,0 +1,204 @@
+/*
+ * omap-control-usb.c - The USB part of control module.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ *
+ * Author: Kishon Vijay Abraham I <kishon@ti.com>
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/usb/omap_control_usb.h>
+
+static struct omap_control_usb *control_usb;
+
+/**
+ * get_omap_control_dev - returns the device pointer for this control device
+ *
+ * This API should be called to get the device pointer for this control
+ * module device. This device pointer should be passed to all other API's
+ * in this driver.
+ *
+ * To be used by PHY driver and glue driver
+ */
+struct device *get_omap_control_dev(void)
+{
+ if (!control_usb)
+ return ERR_PTR(-ENODEV);
+
+ return control_usb->dev;
+}
+EXPORT_SYMBOL_GPL(get_omap_control_dev);
+
+/**
+ * omap_control_usb_phy_power - power on/off the phy using control module reg
+ * @dev: the control module device
+ * @on: 0 or 1, based on powering on or off the PHY
+ */
+void omap_control_usb_phy_power(struct device *dev, int on)
+{
+ u32 val;
+ struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+
+ if (on) {
+ val = readl(control_usb->dev_conf);
+ if (val & PHY_PD)
+ writel(~PHY_PD, control_usb->dev_conf);
+ } else {
+ writel(PHY_PD, control_usb->dev_conf);
+ }
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
+
+/**
+ * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
+ * @dev: struct device *
+ *
+ * This is an API to write to the mailbox register to notify the usb core that
+ * a usb device has been connected.
+ */
+void omap_control_usb_host_mode(struct device *dev)
+{
+ u32 val;
+ struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+
+ val = AVALID | VBUSVALID;
+
+ writel(val, control_usb->otghs_control);
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_host_mode);
+
+/**
+ * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
+ * impedance
+ * @dev: struct device *
+ *
+ * This is an API to write to the mailbox register to notify the usb core that
+ * it has been connected to a usb host.
+ */
+void omap_control_usb_device_mode(struct device *dev)
+{
+ u32 val;
+ struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+
+ val = IDDIG | AVALID | VBUSVALID;
+
+ writel(val, control_usb->otghs_control);
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_device_mode);
+
+/**
+ * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
+ * impedance
+ * @dev: struct device *
+ *
+ * This is an API to write to the mailbox register to notify the usb core
+ * it's now in disconnected state.
+ */
+void omap_control_usb_set_sessionend(struct device *dev)
+{
+ u32 val;
+ struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+
+ val = SESSEND | IDDIG;
+
+ writel(val, control_usb->otghs_control);
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_set_sessionend);
+
+static int omap_control_usb_probe(struct platform_device *pdev)
+{
+ struct resource *res;
+ struct device_node *np = pdev->dev.of_node;
+ struct omap_control_usb_platform_data *pdata = pdev->dev.platform_data;
+
+ control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
+ GFP_KERNEL);
+ if (!control_usb) {
+ dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
+ return -ENOMEM;
+ }
+
+ if (np) {
+ control_usb->has_mailbox = of_property_read_bool(np,
+ "ti,has_mailbox");
+ } else if (pdata) {
+ control_usb->has_mailbox = pdata->has_mailbox;
+ } else {
+ dev_err(&pdev->dev, "no pdata present\n");
+ return -EINVAL;
+ }
+
+ control_usb->dev = &pdev->dev;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "control_dev_conf");
+ control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res);
+ if (control_usb->dev_conf == NULL) {
+ dev_err(&pdev->dev, "Failed to obtain io memory\n");
+ return -EADDRNOTAVAIL;
+ }
+
+ if (control_usb->has_mailbox) {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "otghs_control");
+ control_usb->otghs_control = devm_request_and_ioremap(
+ &pdev->dev, res);
+ if (control_usb->otghs_control == NULL) {
+ dev_err(&pdev->dev, "Failed to obtain io memory\n");
+ return -EADDRNOTAVAIL;
+ }
+ }
+
+ dev_set_drvdata(control_usb->dev, control_usb);
+
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id omap_control_usb_id_table[] = {
+ { .compatible = "ti,omap-control-usb" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
+#endif
+
+static struct platform_driver omap_control_usb_driver = {
+ .probe = omap_control_usb_probe,
+ .driver = {
+ .name = "omap-control-usb",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(omap_control_usb_id_table),
+ },
+};
+
+static int __init omap_control_usb_init(void)
+{
+ return platform_driver_register(&omap_control_usb_driver);
+}
+subsys_initcall(omap_control_usb_init);
+
+static void __exit omap_control_usb_exit(void)
+{
+ platform_driver_unregister(&omap_control_usb_driver);
+}
+module_exit(omap_control_usb_exit);
+
+MODULE_ALIAS("platform: omap_control_usb");
+MODULE_AUTHOR("Texas Instruments Inc.");
+MODULE_DESCRIPTION("OMAP CONTROL USB DRIVER");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
new file mode 100644
index 0000000..a16f993
--- /dev/null
+++ b/include/linux/usb/omap_control_usb.h
@@ -0,0 +1,72 @@
+/*
+ * omap_control_usb.h - Header file for the USB part of control module.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ *
+ * Author: Kishon Vijay Abraham I <kishon@ti.com>
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __OMAP_CONTROL_USB_H__
+#define __OMAP_CONTROL_USB_H__
+
+struct omap_control_usb {
+ struct device *dev;
+
+ u32 __iomem *dev_conf;
+ u32 __iomem *otghs_control;
+
+ u8 has_mailbox:1;
+};
+
+struct omap_control_usb_platform_data {
+ u8 has_mailbox:1;
+};
+
+#define PHY_PD BIT(0)
+
+#define AVALID BIT(0)
+#define BVALID BIT(1)
+#define VBUSVALID BIT(2)
+#define SESSEND BIT(3)
+#define IDDIG BIT(4)
+
+#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
+extern struct device *get_omap_control_dev(void);
+extern void omap_control_usb_phy_power(struct device *dev, int on);
+extern void omap_control_usb_host_mode(struct device *dev);
+extern void omap_control_usb_device_mode(struct device *dev);
+extern void omap_control_usb_set_sessionend(struct device *dev);
+#else
+static inline struct device *get_omap_control_dev()
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void omap_control_usb_phy_power(struct device *dev, int on)
+{
+}
+
+static inline void omap_control_usb_host_mode(struct device *dev)
+{
+}
+
+static inline void omap_control_usb_device_mode(struct device *dev)
+{
+}
+
+static inline void omap_control_usb_set_sessionend(struct device *dev)
+{
+}
+#endif
+
+#endif /* __OMAP_CONTROL_USB_H__ */
--
1.7.9.5
^ permalink raw reply related
* [PATCH 0/4] usb: musb: add driver for control module
From: Kishon Vijay Abraham I @ 2013-01-18 9:40 UTC (permalink / raw)
To: linux-arm-kernel
Added a new driver for the usb part of control module. This has an API
to power on the USB2 phy and an API to write to the mailbox depending on
whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was
previously done in omap glue and in omap-usb2 phy is removed.
Changes from RFC:
* Used "#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)" instead of
"#if (defined(CONFIG_OMAP_CONTROL_USB) || \
defined(CONFIG_OMAP_CONTROL_USB_MODULE))"
* return "-EADDRNOTAVAIL" if devm_request_and_ioremap fails.
* Removed the dt data from this patch series (I'll send that as a separate
series).
* added "ctrl_module" binding to usb otg glue and usb phy in the Documentaion.
This binding is not planned to be used until an actual requirement for
it arises.
This series was developed on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv
Did basic enumeration testing in omap4 panda, omap4 sdp and omap3 beagle.
Kishon Vijay Abraham I (4):
drivers: usb: phy: add a new driver for usb part of control module
ARM: OMAP: devices: create device for usb part of control module
ARM: OMAP2: MUSB: Specify omap4 has mailbox
drivers: usb: start using the control module driver
Documentation/devicetree/bindings/usb/omap-usb.txt | 30 ++-
Documentation/devicetree/bindings/usb/usb-phy.txt | 12 +-
arch/arm/mach-omap2/devices.c | 48 +++++
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 13 --
arch/arm/mach-omap2/usb-musb.c | 3 +
drivers/usb/musb/Kconfig | 1 +
drivers/usb/musb/omap2430.c | 64 +++---
drivers/usb/musb/omap2430.h | 9 -
drivers/usb/phy/Kconfig | 10 +
drivers/usb/phy/Makefile | 1 +
drivers/usb/phy/omap-control-usb.c | 204 ++++++++++++++++++++
drivers/usb/phy/omap-usb2.c | 38 +---
include/linux/usb/musb.h | 2 +
include/linux/usb/omap_control_usb.h | 72 +++++++
include/linux/usb/omap_usb.h | 4 +-
15 files changed, 411 insertions(+), 100 deletions(-)
create mode 100644 drivers/usb/phy/omap-control-usb.c
create mode 100644 include/linux/usb/omap_control_usb.h
--
1.7.9.5
^ permalink raw reply
* [v4 PATCH 00/12] atmel spi controller with dmaengine and device tree support
From: Yang, Wenyou @ 2013-01-18 9:31 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CACQ1gAit5KvhNqQsw4MznW4zyGPq5WD9BKHm5KhmcXjOmVjEcg@mail.gmail.com>
> -----Original Message-----
> From: Richard Genoud [mailto:richard.genoud at gmail.com]
> Sent: 2013?1?18? 16:46
> To: Yang, Wenyou
> Cc: linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Ferre,
> Nicolas; plagnioj at jcrosoft.com; Lin, JM
> Subject: Re: [v4 PATCH 00/12] atmel spi controller with dmaengine and device
> tree support
>
> 2013/1/14 Wenyou Yang <wenyou.yang@atmel.com>:
> > Hi All,
> >
> > This set of patches is to add dmaengine and device tree support for atmel spi.
> > The work is based on Nicolas and Richard's work.
> > It is tested on at91sam9x5ek, at91sam9m10g45ek, at91sam9263ek and
> at91sam9g20ek.
> >
> > It is based on v3.8-rc3.
> Hi,
> You should rebase it on rc4 because __devinit macros are gone in rc4.
> (cf 54b956b903607f8f8878754dd4352da6a54a1da2 )
> So the patches 05 and 06 will break compilation.
thanks
>
> >
> > Changelog:
> > v4:
> > 1./ Take Joe Perches's advance, rewrite atmel_spi_is_v2(struct
> atmel_spi *as)
> > and atmel_spi_use_dma(struct atmel_spi *as),
> > and remove atmel_spi_use_pdc(struct atmel_spi *as).
> >
> > 2./ Rebase on v3.8-rc3.
> >
> > V3:
> > 1./ Rebase on v3.8-rc2.
> >
> > 2./ Remove some Jean-Christophe's patches which has been
> > applied on v3.8-rc2.
> >
> > 3./ Remove spi property "cs-gpios" from the SoC dtsi files
> > to the board dts files to avoid some useless pin conflicts.
> >
> > v2:
> > 1./ Remove the patch :PATCH]mtd: m25p80: change the
> m25p80_read to reading page to page
> > which purpose to fix the BUG: when run "flashcp /bin/busybox
> /dev/mtdX" in
> > the at91sam9g25ek with DMA mode, it arises a OOPS.
> > Now fix it in this patch:
> > [PATHC] spi/atmel_spi: add dmaengine support changing to fix
> the [BUG].
> >
> > 2./ Remove two patches:
> > which purpose to read dts property to select SPI IP version
> and DMA mode
> > Now they will be gat from device tree different compatile.
> >
> > 3./ Fix DMA: when enable both spi0 AND spi1, the spi0 doesn't
> work BUG.
> >
> > 4./ Rebase v3.7-rc8.
> >
> > Best Regards,
> > Wenyou Yang.
> >
> > Nicolas Ferre (5):
> > spi/atmel_spi: add physical base address
> > spi/atmel_spi: call unmapping on transfers buffers
> > spi/atmel_spi: status information passed through controller data
> > spi/atmel_spi: add flag to controller data for lock operations
> > spi/atmel_spi: add dmaengine support
> >
> > Richard Genoud (6):
> > spi/atmel_spi: fix spi-atmel driver to adapt to slave_config changes
> > spi/atmel_spi: correct 16 bits transfers using PIO
> > spi/atmel_spi: correct 16 bits transfer with DMA
> > ARM: at91: add clocks for spi dt entries
> > ARM: dts: add spi nodes for atmel SoC
> > ARM: dts: add spi nodes for the atmel boards
> >
> > Wenyou Yang (1):
> > spi/atmel_spi: update the dt support
> >
> > arch/arm/boot/dts/at91sam9260.dtsi | 18 +
> > arch/arm/boot/dts/at91sam9263.dtsi | 18 +
> > arch/arm/boot/dts/at91sam9263ek.dts | 14 +
> > arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 14 +
> > arch/arm/boot/dts/at91sam9g45.dtsi | 18 +
> > arch/arm/boot/dts/at91sam9m10g45ek.dts | 14 +
> > arch/arm/boot/dts/at91sam9n12.dtsi | 18 +
> > arch/arm/boot/dts/at91sam9n12ek.dts | 14 +
> > arch/arm/boot/dts/at91sam9x5.dtsi | 18 +
> > arch/arm/boot/dts/at91sam9x5ek.dtsi | 14 +
> > arch/arm/mach-at91/at91sam9260.c | 2 +
> > arch/arm/mach-at91/at91sam9g45.c | 2 +
> > arch/arm/mach-at91/at91sam9n12.c | 2 +
> > arch/arm/mach-at91/at91sam9x5.c | 2 +
> > drivers/spi/spi-atmel.c | 809
> ++++++++++++++++++++++++---
> > 15 files changed, 908 insertions(+), 69 deletions(-)
> >
> > --
> > 1.7.9.5
> >
>
>
>
> --
> for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?
^ permalink raw reply
* [PATCH 10/14] PCI: tegra: Move PCIe driver to drivers/pci/host
From: Andrew Murray @ 2013-01-18 9:18 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20130117203010.GA24584@avionic-0098.adnet.avionic-design.de>
On Thu, Jan 17, 2013 at 08:30:10PM +0000, Thierry Reding wrote:
> On Thu, Jan 17, 2013 at 04:22:18PM +0000, Andrew Murray wrote:
> > On Thu, Jan 17, 2013 at 04:05:02PM +0000, Thierry Reding wrote:
> > > On Thu, Jan 17, 2013 at 03:42:36PM +0000, Andrew Murray wrote:
> > > > On Wed, Jan 16, 2013 at 06:31:01PM +0000, Thierry Reding wrote:
> > > > > Alright, putting the functions into pci_ops doesn't sound like a very
> > > > > good idea then. Or perhaps it would make sense for hardware where the
> > > > > root complex and the MSI controller are handled by the same driver.
> > > > > Basically it could be done as a shortcut and if those are not filled
> > > > > in, the drivers could still opt to look up an MSI controller from a
> > > > > phandle specified in DT.
> > > > >
> > > > > Even another alternative would be to keep the functions within the
> > > > > struct pci_ops and use generic ones if an external MSI controller is
> > > > > used. Just tossing around ideas.
> > > >
> > > > I think an ideal solution would be for additional logic in drivers/msi.c
> > > > (e.g. in functions like msi_capability_init) to determine (based on the
> > > > passed in pci_dev) which MSI controller ops to use. I'm not sure the best
> > > > way to implement an association between an MSI controller and PCI busses
> > > > (I believe arch/sparc does something like this - perhaps there will be
> > > > inspiration there).
> > > >
> > > > As you've pointed out, most RCs will have their own MSI controllers - so
> > > > it should be easy to register and associate both together.
> > > >
> > > > I've submitted my previous work on MSI controller registration, but it
> > > > doesn't quite solve this problem - perhaps it can be a starting point?
> > >
> > > We basically have two cases:
> > >
> > > - The PCI host bridge contains registers for MSI support. In that case
> > > it makes little sense to uncouple the MSI implementation from the
> > > host bridge driver.
> > >
> > > - An MSI controller exists outside of the PCI host bridge. The PCI
> > > host bridge would in that case have to lookup an MSI controller (via
> > > DT phandle or some other method).
> > >
> > > In either of those cases, does it make sense to use the MSI support
> > > outside the scope of the PCI infrastructure? That is, would devices
> > > other than PCI devices be able to generate an MSI?
> >
> > I've come around to your way of thinking. Your approach sounds good for
> > registration of MSI ops - let the RC host driver do it (it probably has its
> > own), or use a helper for following a phandle to get ops that are not part
> > of the driver. MSIs won't be used outside of PCI devices.
> >
> > Though existing drivers will use MSI framework functions to request MSIs, that
> > will result in callbacks to the arch_setup_msi_irqs type functions. These
> > functions would need to be updated to find these new ops if they exist, i.e. by
> > traversing the pci_dev structure up to the RC and finding a suitable structure.
> >
> > Perhaps the msi ops could live alongside pci_ops in the pci_bus structure. This
> > way when traversing up the buses from the provided pci_dev - the first bus with
> > msi ops populated would be used?
> >
> > If no ops are found, the standard arch callbacks can be called - thus preserving
> > exiting functionality.
>
> Yes, what you describe is exactly what I had in mind. I've been thinking
> about a possible implementation and there may be some details that could
> prove difficult to resolve. For instance, we likely need to pass context
> around for the MSI ops, or else make sure that they can find the context
> from the struct pci_dev or by traversing upwards from it.
>
> I think for the case where the MSI hardware is controlled by the same
> driver as the PCI host bridge, doing this is easy because the context
> could be part of the PCI host bridge context, which in case of Tegra is
> stored in struct pci_bus' sysdata field (which is actually an ARM struct
> pci_sys_data and in turn stores a pointer to the struct tegra_pcie in
> the .private_data field). Other drivers often just use a global variable
> assuming that there will only ever be a single instance of the PCI host
> bridge.
Yes.
> If the MSI controller is external to the PCI host bridge, things get a
> little more complicated. The easiest way would probably be to store the
> context along with the PCI host bridge context and use simple wrappers
> around the actual implementations to retrieve the PHB context and pass
> the attached MSI context.
This would be nice, but may not be necessary. The MSI controller could use
a global (file-scope) variable to hold context gained from its probe and
assume it will be the only instance of that MSI controller.
>
> Maybe this could even be made more generic by adding a struct msi_ops *
> along with a struct msi_chip * in struct pci_bus. Perhaps I should try
> and code something up to make things more concrete.
This would be the most complete way to handle this.
Andrew Murray
^ permalink raw reply
* [RESEND PATCH v9 2/2] usb: s3c-hsotg: Adding phy driver support
From: Praveen Paneri @ 2013-01-18 9:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358499623-13901-1-git-send-email-p.paneri@samsung.com>
Adding the transceiver to hsotg driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it
Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/usb/gadget/s3c-hsotg.c | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 439c3f9..c8ed7f1 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -32,6 +32,7 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
+#include <linux/usb/phy.h>
#include <linux/platform_data/s3c-hsotg.h>
#include <mach/map.h>
@@ -133,7 +134,9 @@ struct s3c_hsotg_ep {
* struct s3c_hsotg - driver state.
* @dev: The parent device supplied to the probe function
* @driver: USB gadget driver
- * @plat: The platform specific configuration data.
+ * @phy: The otg phy transceiver structure for phy control.
+ * @plat: The platform specific configuration data. This can be removed once
+ * all SoCs support usb transceiver.
* @regs: The memory area mapped for accessing registers.
* @irq: The IRQ number we are using
* @supplies: Definition of USB power supplies
@@ -153,6 +156,7 @@ struct s3c_hsotg_ep {
struct s3c_hsotg {
struct device *dev;
struct usb_gadget_driver *driver;
+ struct usb_phy *phy;
struct s3c_hsotg_plat *plat;
spinlock_t lock;
@@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
struct platform_device *pdev = to_platform_device(hsotg->dev);
dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
- if (hsotg->plat->phy_init)
+
+ if (hsotg->phy)
+ usb_phy_init(hsotg->phy);
+ else if (hsotg->plat->phy_init)
hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
}
@@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
{
struct platform_device *pdev = to_platform_device(hsotg->dev);
- if (hsotg->plat->phy_exit)
+ if (hsotg->phy)
+ usb_phy_shutdown(hsotg->phy);
+ else if (hsotg->plat->phy_exit)
hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
}
@@ -3492,6 +3501,7 @@ static void s3c_hsotg_release(struct device *dev)
static int s3c_hsotg_probe(struct platform_device *pdev)
{
struct s3c_hsotg_plat *plat = pdev->dev.platform_data;
+ struct usb_phy *phy;
struct device *dev = &pdev->dev;
struct s3c_hsotg_ep *eps;
struct s3c_hsotg *hsotg;
@@ -3500,20 +3510,27 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
int ret;
int i;
- plat = pdev->dev.platform_data;
- if (!plat) {
- dev_err(&pdev->dev, "no platform data defined\n");
- return -EINVAL;
- }
-
hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL);
if (!hsotg) {
dev_err(dev, "cannot get memory\n");
return -ENOMEM;
}
+ phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
+ if (IS_ERR_OR_NULL(phy)) {
+ /* Fallback for pdata */
+ plat = pdev->dev.platform_data;
+ if (!plat) {
+ dev_err(&pdev->dev, "no platform data or transceiver defined\n");
+ return -EPROBE_DEFER;
+ } else {
+ hsotg->plat = plat;
+ }
+ } else {
+ hsotg->phy = phy;
+ }
+
hsotg->dev = dev;
- hsotg->plat = plat;
hsotg->clk = devm_clk_get(&pdev->dev, "otg");
if (IS_ERR(hsotg->clk)) {
--
1.7.1
^ permalink raw reply related
* [RESEND PATCH v9 1/2] usb: phy: samsung: Introducing usb phy driver for hsotg
From: Praveen Paneri @ 2013-01-18 9:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358499623-13901-1-git-send-email-p.paneri@samsung.com>
This driver uses usb_phy interface to interact with s3c-hsotg. Supports
phy_init and phy_shutdown functions to enable/disable usb phy. Support
will be extended to host controllers and more Samsung SoCs.
Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
.../devicetree/bindings/usb/samsung-usbphy.txt | 11 +
drivers/usb/phy/Kconfig | 8 +
drivers/usb/phy/Makefile | 1 +
drivers/usb/phy/samsung-usbphy.c | 354 ++++++++++++++++++++
include/linux/platform_data/samsung-usbphy.h | 27 ++
5 files changed, 401 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt
create mode 100644 drivers/usb/phy/samsung-usbphy.c
create mode 100644 include/linux/platform_data/samsung-usbphy.h
diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
new file mode 100644
index 0000000..7b26e2d
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
@@ -0,0 +1,11 @@
+* Samsung's usb phy transceiver
+
+The Samsung's phy transceiver is used for controlling usb otg phy for
+s3c-hsotg usb device controller.
+TODO: Adding the PHY binding with controller(s) according to the under
+developement generic PHY driver.
+
+Required properties:
+- compatible : should be "samsung,exynos4210-usbphy"
+- reg : base physical address of the phy registers and length of memory mapped
+ region.
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 5de6e7f..36a85b6 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -45,3 +45,11 @@ config USB_RCAR_PHY
To compile this driver as a module, choose M here: the
module will be called rcar-phy.
+
+config SAMSUNG_USBPHY
+ bool "Samsung USB PHY controller Driver"
+ depends on USB_S3C_HSOTG
+ select USB_OTG_UTILS
+ help
+ Enable this to support Samsung USB phy controller for samsung
+ SoCs.
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 1a579a8..ec304f6 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_USB_ISP1301) += isp1301.o
obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o
obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o
obj-$(CONFIG_USB_RCAR_PHY) += rcar-phy.o
+obj-$(CONFIG_SAMSUNG_USBPHY) += samsung-usbphy.o
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
new file mode 100644
index 0000000..5c5e1bb
--- /dev/null
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -0,0 +1,354 @@
+/* linux/drivers/usb/phy/samsung-usbphy.c
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Author: Praveen Paneri <p.paneri@samsung.com>
+ *
+ * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/usb/otg.h>
+#include <linux/platform_data/samsung-usbphy.h>
+
+/* Register definitions */
+
+#define SAMSUNG_PHYPWR (0x00)
+
+#define PHYPWR_NORMAL_MASK (0x19 << 0)
+#define PHYPWR_OTG_DISABLE (0x1 << 4)
+#define PHYPWR_ANALOG_POWERDOWN (0x1 << 3)
+#define PHYPWR_FORCE_SUSPEND (0x1 << 1)
+/* For Exynos4 */
+#define PHYPWR_NORMAL_MASK_PHY0 (0x39 << 0)
+#define PHYPWR_SLEEP_PHY0 (0x1 << 5)
+
+#define SAMSUNG_PHYCLK (0x04)
+
+#define PHYCLK_MODE_USB11 (0x1 << 6)
+#define PHYCLK_EXT_OSC (0x1 << 5)
+#define PHYCLK_COMMON_ON_N (0x1 << 4)
+#define PHYCLK_ID_PULL (0x1 << 2)
+#define PHYCLK_CLKSEL_MASK (0x3 << 0)
+#define PHYCLK_CLKSEL_48M (0x0 << 0)
+#define PHYCLK_CLKSEL_12M (0x2 << 0)
+#define PHYCLK_CLKSEL_24M (0x3 << 0)
+
+#define SAMSUNG_RSTCON (0x08)
+
+#define RSTCON_PHYLINK_SWRST (0x1 << 2)
+#define RSTCON_HLINK_SWRST (0x1 << 1)
+#define RSTCON_SWRST (0x1 << 0)
+
+#ifndef MHZ
+#define MHZ (1000*1000)
+#endif
+
+enum samsung_cpu_type {
+ TYPE_S3C64XX,
+ TYPE_EXYNOS4210,
+};
+
+/*
+ * struct samsung_usbphy - transceiver driver state
+ * @phy: transceiver structure
+ * @plat: platform data
+ * @dev: The parent device supplied to the probe function
+ * @clk: usb phy clock
+ * @regs: usb phy register memory base
+ * @ref_clk_freq: reference clock frequency selection
+ * @cpu_type: machine identifier
+ */
+struct samsung_usbphy {
+ struct usb_phy phy;
+ struct samsung_usbphy_data *plat;
+ struct device *dev;
+ struct clk *clk;
+ void __iomem *regs;
+ int ref_clk_freq;
+ int cpu_type;
+};
+
+#define phy_to_sphy(x) container_of((x), struct samsung_usbphy, phy)
+
+/*
+ * Returns reference clock frequency selection value
+ */
+static int samsung_usbphy_get_refclk_freq(struct samsung_usbphy *sphy)
+{
+ struct clk *ref_clk;
+ int refclk_freq = 0;
+
+ ref_clk = clk_get(sphy->dev, "xusbxti");
+ if (IS_ERR(ref_clk)) {
+ dev_err(sphy->dev, "Failed to get reference clock\n");
+ return PTR_ERR(ref_clk);
+ }
+
+ switch (clk_get_rate(ref_clk)) {
+ case 12 * MHZ:
+ refclk_freq = PHYCLK_CLKSEL_12M;
+ break;
+ case 24 * MHZ:
+ refclk_freq = PHYCLK_CLKSEL_24M;
+ break;
+ case 48 * MHZ:
+ refclk_freq = PHYCLK_CLKSEL_48M;
+ break;
+ default:
+ if (sphy->cpu_type == TYPE_S3C64XX)
+ refclk_freq = PHYCLK_CLKSEL_48M;
+ else
+ refclk_freq = PHYCLK_CLKSEL_24M;
+ break;
+ }
+ clk_put(ref_clk);
+
+ return refclk_freq;
+}
+
+static void samsung_usbphy_enable(struct samsung_usbphy *sphy)
+{
+ void __iomem *regs = sphy->regs;
+ u32 phypwr;
+ u32 phyclk;
+ u32 rstcon;
+
+ /* set clock frequency for PLL */
+ phyclk = sphy->ref_clk_freq;
+ phypwr = readl(regs + SAMSUNG_PHYPWR);
+ rstcon = readl(regs + SAMSUNG_RSTCON);
+
+ switch (sphy->cpu_type) {
+ case TYPE_S3C64XX:
+ phyclk &= ~PHYCLK_COMMON_ON_N;
+ phypwr &= ~PHYPWR_NORMAL_MASK;
+ rstcon |= RSTCON_SWRST;
+ break;
+ case TYPE_EXYNOS4210:
+ phypwr &= ~PHYPWR_NORMAL_MASK_PHY0;
+ rstcon |= RSTCON_SWRST;
+ default:
+ break;
+ }
+
+ writel(phyclk, regs + SAMSUNG_PHYCLK);
+ /* Configure PHY0 for normal operation*/
+ writel(phypwr, regs + SAMSUNG_PHYPWR);
+ /* reset all ports of PHY and Link */
+ writel(rstcon, regs + SAMSUNG_RSTCON);
+ udelay(10);
+ rstcon &= ~RSTCON_SWRST;
+ writel(rstcon, regs + SAMSUNG_RSTCON);
+}
+
+static void samsung_usbphy_disable(struct samsung_usbphy *sphy)
+{
+ void __iomem *regs = sphy->regs;
+ u32 phypwr;
+
+ phypwr = readl(regs + SAMSUNG_PHYPWR);
+
+ switch (sphy->cpu_type) {
+ case TYPE_S3C64XX:
+ phypwr |= PHYPWR_NORMAL_MASK;
+ break;
+ case TYPE_EXYNOS4210:
+ phypwr |= PHYPWR_NORMAL_MASK_PHY0;
+ default:
+ break;
+ }
+
+ /* Disable analog and otg block power */
+ writel(phypwr, regs + SAMSUNG_PHYPWR);
+}
+
+/*
+ * The function passed to the usb driver for phy initialization
+ */
+static int samsung_usbphy_init(struct usb_phy *phy)
+{
+ struct samsung_usbphy *sphy;
+ int ret = 0;
+
+ sphy = phy_to_sphy(phy);
+
+ /* Enable the phy clock */
+ ret = clk_prepare_enable(sphy->clk);
+ if (ret) {
+ dev_err(sphy->dev, "%s: clk_prepare_enable failed\n", __func__);
+ return ret;
+ }
+
+ /* Disable phy isolation */
+ if (sphy->plat && sphy->plat->pmu_isolation)
+ sphy->plat->pmu_isolation(false);
+
+ /* Initialize usb phy registers */
+ samsung_usbphy_enable(sphy);
+
+ /* Disable the phy clock */
+ clk_disable_unprepare(sphy->clk);
+ return ret;
+}
+
+/*
+ * The function passed to the usb driver for phy shutdown
+ */
+static void samsung_usbphy_shutdown(struct usb_phy *phy)
+{
+ struct samsung_usbphy *sphy;
+
+ sphy = phy_to_sphy(phy);
+
+ if (clk_prepare_enable(sphy->clk)) {
+ dev_err(sphy->dev, "%s: clk_prepare_enable failed\n", __func__);
+ return;
+ }
+
+ /* De-initialize usb phy registers */
+ samsung_usbphy_disable(sphy);
+
+ /* Enable phy isolation */
+ if (sphy->plat && sphy->plat->pmu_isolation)
+ sphy->plat->pmu_isolation(true);
+
+ clk_disable_unprepare(sphy->clk);
+}
+
+static const struct of_device_id samsung_usbphy_dt_match[];
+
+static inline int samsung_usbphy_get_driver_data(struct platform_device *pdev)
+{
+ if (pdev->dev.of_node) {
+ const struct of_device_id *match;
+ match = of_match_node(samsung_usbphy_dt_match,
+ pdev->dev.of_node);
+ return (int) match->data;
+ }
+
+ return platform_get_device_id(pdev)->driver_data;
+}
+
+static int __devinit samsung_usbphy_probe(struct platform_device *pdev)
+{
+ struct samsung_usbphy *sphy;
+ struct samsung_usbphy_data *pdata;
+ struct device *dev = &pdev->dev;
+ struct resource *phy_mem;
+ void __iomem *phy_base;
+ struct clk *clk;
+
+ pdata = pdev->dev.platform_data;
+ if (!pdata) {
+ dev_err(&pdev->dev, "%s: no platform data defined\n", __func__);
+ return -EINVAL;
+ }
+
+ phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!phy_mem) {
+ dev_err(dev, "%s: missing mem resource\n", __func__);
+ return -ENODEV;
+ }
+
+ phy_base = devm_request_and_ioremap(dev, phy_mem);
+ if (!phy_base) {
+ dev_err(dev, "%s: register mapping failed\n", __func__);
+ return -ENXIO;
+ }
+
+ sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL);
+ if (!sphy)
+ return -ENOMEM;
+
+ clk = devm_clk_get(dev, "otg");
+ if (IS_ERR(clk)) {
+ dev_err(dev, "Failed to get otg clock\n");
+ return PTR_ERR(clk);
+ }
+
+ sphy->dev = &pdev->dev;
+ sphy->plat = pdata;
+ sphy->regs = phy_base;
+ sphy->clk = clk;
+ sphy->phy.dev = sphy->dev;
+ sphy->phy.label = "samsung-usbphy";
+ sphy->phy.init = samsung_usbphy_init;
+ sphy->phy.shutdown = samsung_usbphy_shutdown;
+ sphy->cpu_type = samsung_usbphy_get_driver_data(pdev);
+ sphy->ref_clk_freq = samsung_usbphy_get_refclk_freq(sphy);
+
+ platform_set_drvdata(pdev, sphy);
+
+ return usb_add_phy(&sphy->phy, USB_PHY_TYPE_USB2);
+}
+
+static int __exit samsung_usbphy_remove(struct platform_device *pdev)
+{
+ struct samsung_usbphy *sphy = platform_get_drvdata(pdev);
+
+ usb_remove_phy(&sphy->phy);
+
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id samsung_usbphy_dt_match[] = {
+ {
+ .compatible = "samsung,s3c64xx-usbphy",
+ .data = (void *)TYPE_S3C64XX,
+ }, {
+ .compatible = "samsung,exynos4210-usbphy",
+ .data = (void *)TYPE_EXYNOS4210,
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, samsung_usbphy_dt_match);
+#endif
+
+static struct platform_device_id samsung_usbphy_driver_ids[] = {
+ {
+ .name = "s3c64xx-usbphy",
+ .driver_data = TYPE_S3C64XX,
+ }, {
+ .name = "exynos4210-usbphy",
+ .driver_data = TYPE_EXYNOS4210,
+ },
+ {},
+};
+
+MODULE_DEVICE_TABLE(platform, samsung_usbphy_driver_ids);
+
+static struct platform_driver samsung_usbphy_driver = {
+ .probe = samsung_usbphy_probe,
+ .remove = __devexit_p(samsung_usbphy_remove),
+ .id_table = samsung_usbphy_driver_ids,
+ .driver = {
+ .name = "samsung-usbphy",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(samsung_usbphy_dt_match),
+ },
+};
+
+module_platform_driver(samsung_usbphy_driver);
+
+MODULE_DESCRIPTION("Samsung USB phy controller");
+MODULE_AUTHOR("Praveen Paneri <p.paneri@samsung.com>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:samsung-usbphy");
diff --git a/include/linux/platform_data/samsung-usbphy.h b/include/linux/platform_data/samsung-usbphy.h
new file mode 100644
index 0000000..1bd24cb
--- /dev/null
+++ b/include/linux/platform_data/samsung-usbphy.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * http://www.samsung.com/
+ * Author: Praveen Paneri <p.paneri@samsung.com>
+ *
+ * Defines platform data for samsung usb phy driver.
+ *
+ * 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.
+ */
+
+#ifndef __SAMSUNG_USBPHY_PLATFORM_H
+#define __SAMSUNG_USBPHY_PLATFORM_H
+
+/**
+ * samsung_usbphy_data - Platform data for USB PHY driver.
+ * @pmu_isolation: Function to control usb phy isolation in PMU.
+ */
+struct samsung_usbphy_data {
+ void (*pmu_isolation)(int on);
+};
+
+extern void samsung_usbphy_set_pdata(struct samsung_usbphy_data *pd);
+
+#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
--
1.7.1
^ permalink raw reply related
* [RESEND PATCH v9 0/2] usb: phy: samsung: Introducing usb phy driver for samsung SoCs
From: Praveen Paneri @ 2013-01-18 9:00 UTC (permalink / raw)
To: linux-arm-kernel
Changes from v8:
Resending this patch series after rebasing to the latest usb-next branch.
Rewording inline comments for better readability.
Removed IS_ENABLED(CONFIG_OF) as pdev->dev.of_node is enough to check for dt support.
Using of_match_ptr to add of_match_table to platform_driver structure.
Removed unnecessary variables.
Changes from v7:
Rebased to the latest usb-next branch.
Separating arch patches from these driver patches.
Changes from v6:
Modified register definitions according to the existing ones.
Changed default PHY clk selection for SoCs.
Improved binding text and rebased to the latest usb-next.
Changes from v5:
Moved clk_get() to driver's probe function. Now reference clock frequency
selection value is stored in samsung_usbphy structure for later use. Used
IS_ENABLED() instead of #ifdef in samsung_usbphy_get_driver_data().
Changes from v4:
Moved header file contents to driver's source file
Removed unnecessary print message from driver's probe function
Dropped the Free Software Foundation address from the header
Changes from v3:
Replaced susbsys_initcall()/module_exit() by module_platform_driver().
Accordingly in the hsotg driver returned -EPROBE_DEFER until phy driver
is registered
Removed unnecessary devm_usb_put_phy() call from the hsotg driver remove.
Changes from v2:
Changed the driver filenames to samsung-usbphy
Rectified coding style related errors
Changes from v1:
Rebased patches to latest usb-next branch
Changed the name 'sec_usbphy' to 'samsung_usbphy'
This patch set introduces a phy driver for samsung SoCs. It uses the existing
transceiver infrastructure to provide phy control functions. Use of this driver
can be extended for usb host phy as well. Over the period of time all the phy
related code for most of the samsung SoCs can be integrated here.
Removing the existing phy code from mach-s3c64xx. Same can be done for other SoCs
when they start supporting this phy driver.
This driver is tested with smdk6410 and Exynos4210(with DT).
Praveen Paneri (2):
usb: phy: samsung: Introducing usb phy driver for hsotg
usb: s3c-hsotg: Adding phy driver support
.../devicetree/bindings/usb/samsung-usbphy.txt | 11 +
drivers/usb/gadget/s3c-hsotg.c | 37 ++-
drivers/usb/phy/Kconfig | 8 +
drivers/usb/phy/Makefile | 1 +
drivers/usb/phy/samsung-usbphy.c | 354 ++++++++++++++++++++
include/linux/platform_data/samsung-usbphy.h | 27 ++
6 files changed, 428 insertions(+), 10 deletions(-)
create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt
create mode 100644 drivers/usb/phy/samsung-usbphy.c
create mode 100644 include/linux/platform_data/samsung-usbphy.h
^ permalink raw reply
* [[PATCH v2]] OMAP: omap4-panda: add WiLink shared transport power functions
From: Luciano Coelho @ 2013-01-18 8:58 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20130117231608.GP14149@atomide.com>
On Thu, 2013-01-17 at 15:16 -0800, Tony Lindgren wrote:
> * Luciano Coelho <coelho@ti.com> [130117 10:04]:
> > But this patch is pretty small and simple, so why not include it to at
> > least fix the breakage in 3.7 and 3.8? Whether you take it or not now
> > won't make any difference in the 5k LOC in these kernel versions.
>
> Well we are planning to drop the non-DT support for omap4 as soon as it's
> usable with DT. For omap4 we are only carrying SDP and panda support to
> make this transition easier. The only bindings missing AFAIK are wl12xx and
> USB.
In my view this is a regression and it should be fixed with as simple a
patch as possible. The alternative to my solution is to revert the
patch that removed the enable/disable from the ti-st driver *and* fix
u-boot, because if it doesn't mux the UART2 pins properly (and it
doesn't) the shared transport still won't work.
> If we add this, then it implies we're somehow supporting it, which is not
> the way to go IMHO as we need to get rid of these platform callbacks instead.
It's a regression fix, not a new feature. I also think these callbacks
are silly, but it's the quickest solution I found for 3.7 and 3.8.
> What's your estimate of having minimal wl12xx WLAN DT binding available?
To tell you the truth, I haven't even started looking into DT for wl12xx
myself. So I have no idea when it will be ready. Benoit has been
looking into it, but I don't know how far he is.
--
Luca.
^ permalink raw reply
* [PATCH v2] ARM: remove redundant 'select GENERIC_GPIO'
From: Shawn Guo @ 2013-01-18 8:58 UTC (permalink / raw)
To: linux-arm-kernel
In drivers/gpio/Kcong, ARCH_REQUIRE_GPIOLIB selects GPIOLIB which in
turn selects GENERIC_GPIO. So GENERIC_GPIO will be selected
automatically for those platforms that select ARCH_REQUIRE_GPIOLIB.
Remove the redundant 'select GENERIC_GPIO' for platforms that already
select ARCH_REQUIRE_GPIOLIB at either mach or plat level.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
Changes since v1:
- Update commit log to better explain why the select is unncessary
arch/arm/Kconfig | 9 ---------
arch/arm/mach-bcm/Kconfig | 1 -
arch/arm/mach-picoxcell/Kconfig | 1 -
arch/arm/mach-vt8500/Kconfig | 1 -
4 files changed, 12 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 67874b8..c217521 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -347,7 +347,6 @@ config ARCH_BCM2835
select COMMON_CLK
select CPU_V6
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select MULTI_IRQ_HANDLER
select PINCTRL
select PINCTRL_BCM2835
@@ -644,7 +643,6 @@ config ARCH_TEGRA
select CLKSRC_MMIO
select COMMON_CLK
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_CLK
select HAVE_SMP
select MIGHT_HAVE_CACHE_L2X0
@@ -744,7 +742,6 @@ config ARCH_S3C24XX
select ARCH_HAS_CPUFREQ
select ARCH_USES_GETTIMEOFFSET
select CLKDEV_LOOKUP
- select GENERIC_GPIO
select HAVE_CLK
select HAVE_S3C2410_I2C if I2C
select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -787,7 +784,6 @@ config ARCH_S5P64X0
select CLKSRC_MMIO
select CPU_V6
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_CLK
select HAVE_S3C2410_I2C if I2C
select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -802,7 +798,6 @@ config ARCH_S5PC100
select ARCH_USES_GETTIMEOFFSET
select CLKDEV_LOOKUP
select CPU_V7
- select GENERIC_GPIO
select HAVE_CLK
select HAVE_S3C2410_I2C if I2C
select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -820,7 +815,6 @@ config ARCH_S5PV210
select CLKSRC_MMIO
select CPU_V7
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_CLK
select HAVE_S3C2410_I2C if I2C
select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -838,7 +832,6 @@ config ARCH_EXYNOS
select CLKDEV_LOOKUP
select CPU_V7
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_CLK
select HAVE_S3C2410_I2C if I2C
select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -873,7 +866,6 @@ config ARCH_U300
select COMMON_CLK
select CPU_ARM926T
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_TCM
select SPARSE_IRQ
help
@@ -957,7 +949,6 @@ config ARCH_VT8500_SINGLE
select COMMON_CLK
select CPU_ARM926T
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_CLK
select MULTI_IRQ_HANDLER
select SPARSE_IRQ
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 48705c1..bf02471 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -7,7 +7,6 @@ config ARCH_BCM
select ARM_GIC
select CPU_V7
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select GENERIC_TIME
select GPIO_BCM
select SPARSE_IRQ
diff --git a/arch/arm/mach-picoxcell/Kconfig b/arch/arm/mach-picoxcell/Kconfig
index 868796f..13bae78 100644
--- a/arch/arm/mach-picoxcell/Kconfig
+++ b/arch/arm/mach-picoxcell/Kconfig
@@ -7,7 +7,6 @@ config ARCH_PICOXCELL
select DW_APB_TIMER
select DW_APB_TIMER_OF
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_TCM
select NO_IOPORT
select SPARSE_IRQ
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
index 2ed0b7d..8464497 100644
--- a/arch/arm/mach-vt8500/Kconfig
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -6,7 +6,6 @@ config ARCH_VT8500
select CLKDEV_LOOKUP
select CPU_ARM926T
select GENERIC_CLOCKEVENTS
- select GENERIC_GPIO
select HAVE_CLK
help
Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
--
1.7.9.5
^ permalink raw reply related
* [PATCH v2 2/2] ARM: uncompress debug support for multiplatform build
From: Arnd Bergmann @ 2013-01-18 8:47 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358477120-19673-1-git-send-email-shawn.guo@linaro.org>
On Friday 18 January 2013, Shawn Guo wrote:
> +ENTRY(putc)
> + addruart r1, r2, r3
> + waituart r3, r1
> + senduart r0, r1
> + busyuart r3, r1
> + mov pc, lr
> +ENDPROC(putc)
Ah, so it actually worked? I was expecting at least some part of
my code to be wrong ;-) My assembler skills are very much
lacking and I had not tried it.
Upon closer inspection, it seems that the CR/LF logic from
the printascii function is not here, and it probably should be.
I also saw that some similar code is already present in
arch/arm/boot/compressed/head.S as a local version of putc,
maybe that can be combined with this rather than adding a new
file.
Arnd
^ permalink raw reply
* [v4 PATCH 00/12] atmel spi controller with dmaengine and device tree support
From: Richard Genoud @ 2013-01-18 8:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358148877-18679-1-git-send-email-wenyou.yang@atmel.com>
2013/1/14 Wenyou Yang <wenyou.yang@atmel.com>:
> Hi All,
>
> This set of patches is to add dmaengine and device tree support for atmel spi.
> The work is based on Nicolas and Richard's work.
> It is tested on at91sam9x5ek, at91sam9m10g45ek, at91sam9263ek and at91sam9g20ek.
>
> It is based on v3.8-rc3.
Hi,
You should rebase it on rc4 because __devinit macros are gone in rc4.
(cf 54b956b903607f8f8878754dd4352da6a54a1da2 )
So the patches 05 and 06 will break compilation.
>
> Changelog:
> v4:
> 1./ Take Joe Perches's advance, rewrite atmel_spi_is_v2(struct atmel_spi *as)
> and atmel_spi_use_dma(struct atmel_spi *as),
> and remove atmel_spi_use_pdc(struct atmel_spi *as).
>
> 2./ Rebase on v3.8-rc3.
>
> V3:
> 1./ Rebase on v3.8-rc2.
>
> 2./ Remove some Jean-Christophe's patches which has been
> applied on v3.8-rc2.
>
> 3./ Remove spi property "cs-gpios" from the SoC dtsi files
> to the board dts files to avoid some useless pin conflicts.
>
> v2:
> 1./ Remove the patch :PATCH]mtd: m25p80: change the m25p80_read to reading page to page
> which purpose to fix the BUG: when run "flashcp /bin/busybox /dev/mtdX" in
> the at91sam9g25ek with DMA mode, it arises a OOPS.
> Now fix it in this patch:
> [PATHC] spi/atmel_spi: add dmaengine support changing to fix the [BUG].
>
> 2./ Remove two patches:
> which purpose to read dts property to select SPI IP version and DMA mode
> Now they will be gat from device tree different compatile.
>
> 3./ Fix DMA: when enable both spi0 AND spi1, the spi0 doesn't work BUG.
>
> 4./ Rebase v3.7-rc8.
>
> Best Regards,
> Wenyou Yang.
>
> Nicolas Ferre (5):
> spi/atmel_spi: add physical base address
> spi/atmel_spi: call unmapping on transfers buffers
> spi/atmel_spi: status information passed through controller data
> spi/atmel_spi: add flag to controller data for lock operations
> spi/atmel_spi: add dmaengine support
>
> Richard Genoud (6):
> spi/atmel_spi: fix spi-atmel driver to adapt to slave_config changes
> spi/atmel_spi: correct 16 bits transfers using PIO
> spi/atmel_spi: correct 16 bits transfer with DMA
> ARM: at91: add clocks for spi dt entries
> ARM: dts: add spi nodes for atmel SoC
> ARM: dts: add spi nodes for the atmel boards
>
> Wenyou Yang (1):
> spi/atmel_spi: update the dt support
>
> arch/arm/boot/dts/at91sam9260.dtsi | 18 +
> arch/arm/boot/dts/at91sam9263.dtsi | 18 +
> arch/arm/boot/dts/at91sam9263ek.dts | 14 +
> arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 14 +
> arch/arm/boot/dts/at91sam9g45.dtsi | 18 +
> arch/arm/boot/dts/at91sam9m10g45ek.dts | 14 +
> arch/arm/boot/dts/at91sam9n12.dtsi | 18 +
> arch/arm/boot/dts/at91sam9n12ek.dts | 14 +
> arch/arm/boot/dts/at91sam9x5.dtsi | 18 +
> arch/arm/boot/dts/at91sam9x5ek.dtsi | 14 +
> arch/arm/mach-at91/at91sam9260.c | 2 +
> arch/arm/mach-at91/at91sam9g45.c | 2 +
> arch/arm/mach-at91/at91sam9n12.c | 2 +
> arch/arm/mach-at91/at91sam9x5.c | 2 +
> drivers/spi/spi-atmel.c | 809 ++++++++++++++++++++++++---
> 15 files changed, 908 insertions(+), 69 deletions(-)
>
> --
> 1.7.9.5
>
--
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?
^ permalink raw reply
* [PATCH] am33xx: cpsw: default to ethernet hwaddr from efuse if not defined in dt
From: Michal Bachraty @ 2013-01-18 8:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <871udjlafn.fsf@dell.be.48ers.dk>
On Thu, Jan 17, 2013 at 11:19 PM, Peter Korsgaard <jacmet@sunsite.dk> wrote:
> >>>>> "Tony" == Tony Lindgren <tony@atomide.com> writes:
>
> Hi,
>
> >> The way I've handled it is similar to how it is done on atleast one
> >> other arm subarchicture, see
> >> arch/arm/mach-mxs/mach-mxs.c::update_fec_mac_prop()
>
> Tony> Cool this seems like the cleanest way to deal with it so far. Can
> Tony> you please resend with also linux-net and DT list Cc:d too?
>
> Tony> Also the arch_initcall should be omap_arch_initcall in linux next
> Tony> for consistency if we ever have SoC specific sections for those.
>
> Sure, resent with the initcall change and netdev/devicetree-discuss added.
>
> --
> Bye, Peter Korsgaard
>
Thanks,
I added DT option mac-address-source because there is still possiblility to
have mac address set by the u-boot in the future. Beaglebone have special
eeprom on board, were you can have stored user MAC and u-boot can read
eeprom
data. Maybe some users will want this feature. Also in cpsw dt binding
documentation, there is mention /* Filled in by U-Boot */. For that
purpose,
code I proposed can easily deal with any driver exteds.
Reading CPU mac address registers with (my approach) or without (your
approach) DT should be more discussed. Also your way seems to be fine.
Regards
Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130118/6d8983db/attachment-0001.html>
^ permalink raw reply
* [PATCH 5/5] ARM: exynos: enable/disable cpuidle when cpu1 is down/up
From: Daniel Lezcano @ 2013-01-18 8:18 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <00be01cdf52f$1bc907c0$535b1740$@samsung.com>
On 01/18/2013 04:51 AM, Kukjin Kim wrote:
> Daniel Lezcano wrote:
>> On 01/10/2013 11:33 PM, amit daniel kachhap wrote:
>>> On Thu, Jan 10, 2013 at 1:32 PM, Daniel Lezcano <daniel.lezcano@free.fr>
>> wrote:
>>>> On 01/10/2013 09:07 PM, amit daniel kachhap wrote:
>>>>> Hi Daniel,
>>>> Hi Amit Daniel,
>>>>
>>>>> This hotplug noifiers looks fine. I suppose it should add extra state
>>>>> C1 in cpu0. If it is done like below than for normal cases(when all
>>>>> cpu's are online) there wont be any statistics for C0 state
>>>> I guess you meant state 0 which is WFI, right ?
>>>> C0 state is the intel semantic for cpu fully turned on.
>>> Yes I meant C0 as wfi
>>>>> also which
>>>>> is required. Other patches look good.
>>>> Ok, that makes sense to have statistics even if they are only doing WFI.
>>>>
>>>> Then the patch 4/5 is not ok, no ?
>>> yes I suppose patch 4 and patch 5 are related and depends how you
>>> frame patch 5. I think it is better to create C0/C1 sysfs and other
>>> things in the beginning because it is a filesystem call and may
>>> increase the cpu hotplug time which is not worth. May be if cpuidle
>>> framework exposes some API to enable/disable states then it is better.
>>>
>>> For patch 1,2 and 3,
>>> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
>> Hi Kukjin,
>>
>> is it possible to take these patches [1-3/5] ?
>>
> Looks OK to me, I will apply with Amit's ack.
Cool Thanks !
>> The patches [3-4/5] could be ignored.
>>
> Probably, you mean [4-5/5] :-)
Oh, yes. Right ! :)
-- Daniel
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply
* [PATCH 3/3] dma: mv_xor: get rid of a DMA-API sanity check warning
From: Lubomir Rintel @ 2013-01-18 7:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358495154.28503.5.camel@unicorn>
mv_xor mv_xor.0: DMA-API: device driver frees DMA memory with different direction [device address=0x000000001dea4000] [size=4096 bytes] [mapped with DMA_FROM_DEVICE] [unmapped with DMA_BIDIRECTIONAL]
Change xor self test destination buffer allocation direction to bidirectional,
as it's what mv_xor_run_tx_complete_actions() frees for multiple sources.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/dma/mv_xor.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index d00a834..1e90f5d 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1042,7 +1042,7 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
/* test xor */
dest_dma = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
- DMA_FROM_DEVICE);
+ DMA_BIDIRECTIONAL);
if (dma_mapping_error(dma_chan->device->dev, dest_dma)) {
dev_err(dma_chan->device->dev,
"Could not map destination page, disabling\n");
--
1.7.1
^ permalink raw reply related
* [PATCH 2/3] dma: mv_xor: fix DMA-API error handling sanity check
From: Lubomir Rintel @ 2013-01-18 7:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358495154.28503.5.camel@unicorn>
Add error checking.
---
drivers/dma/mv_xor.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 8b81a04..d00a834 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -939,9 +939,21 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
dest_dma = dma_map_single(dma_chan->device->dev, dest,
MV_XOR_TEST_SIZE, DMA_FROM_DEVICE);
+ if (dma_mapping_error(dma_chan->device->dev, dest_dma)) {
+ dev_err(dma_chan->device->dev,
+ "Could not map destination buffer, disabling\n");
+ err = -ENODEV;
+ goto free_resources;
+ }
src_dma = dma_map_single(dma_chan->device->dev, src,
MV_XOR_TEST_SIZE, DMA_TO_DEVICE);
+ if (dma_mapping_error(dma_chan->device->dev, src_dma)) {
+ dev_err(dma_chan->device->dev,
+ "Could not map source buffer, disabling\n");
+ err = -ENODEV;
+ goto free_resources;
+ }
tx = mv_xor_prep_dma_memcpy(dma_chan, dest_dma, src_dma,
MV_XOR_TEST_SIZE,
@@ -1031,10 +1043,23 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
/* test xor */
dest_dma = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
DMA_FROM_DEVICE);
+ if (dma_mapping_error(dma_chan->device->dev, dest_dma)) {
+ dev_err(dma_chan->device->dev,
+ "Could not map destination page, disabling\n");
+ err = -ENODEV;
+ goto free_resources;
+ }
- for (i = 0; i < MV_XOR_NUM_SRC_TEST; i++)
+ for (i = 0; i < MV_XOR_NUM_SRC_TEST; i++) {
dma_srcs[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i],
0, PAGE_SIZE, DMA_TO_DEVICE);
+ if (dma_mapping_error(dma_chan->device->dev, dma_srcs[i])) {
+ dev_err(dma_chan->device->dev,
+ "Could not map source page, disabling\n");
+ err = -ENODEV;
+ goto free_resources;
+ }
+ }
tx = mv_xor_prep_dma_xor(dma_chan, dest_dma, dma_srcs,
MV_XOR_NUM_SRC_TEST, PAGE_SIZE, 0);
--
1.7.1
^ permalink raw reply related
* [PATCH 1/3] dma: mv_xor: do not sync the DMA buffer after being deallocated
From: Lubomir Rintel @ 2013-01-18 7:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1358495154.28503.5.camel@unicorn>
DMA_CHECK was unhappy:
mv_xor mv_xor.0: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000001f3a1a40] [size=2000 bytes]
Deallocation, which involves a sync, happens automatically by
mv_xor_slot_cleanup() once the transfer is finished.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/dma/mv_xor.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index e666983..8b81a04 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -960,8 +960,6 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
goto free_resources;
}
- dma_sync_single_for_cpu(dma_chan->device->dev, dest_dma,
- MV_XOR_TEST_SIZE, DMA_FROM_DEVICE);
if (memcmp(src, dest, MV_XOR_TEST_SIZE)) {
dev_err(dma_chan->device->dev,
"Self-test copy failed compare, disabling\n");
@@ -1054,8 +1052,6 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
goto free_resources;
}
- dma_sync_single_for_cpu(dma_chan->device->dev, dest_dma,
- PAGE_SIZE, DMA_FROM_DEVICE);
for (i = 0; i < (PAGE_SIZE / sizeof(u32)); i++) {
u32 *ptr = page_address(dest);
if (ptr[i] != cmp_word) {
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox