Skip to contentSkip to conversation

ARM: SPEAr13xx: Add PCIe support

PATCH Superseded Viresh Kumar 5 participants 23 messages Jul 10, 2014 – Jul 14, 2014

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

v9 cover ARM: SPEAr13xx: Add PCIe support

This adds PCIe support for ARM based ST Microelectronics SPEAr13xx SoCs.

V8 was here: https://lkml.org/lkml/2014/4/15/260 and just before being pulled by Olof this happened: https://lkml.org/lkml/2014/7/9/641.

An detailed look at the patches make it clear why Olof was unhappy. Patches weren't in right order, groups, etc..

So, this is an attempt to fix all those issues. Pushed here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git spear/pcie-support-v9

V7->V8:
- Reorder, regroup patches.
- Improve logs and cc lists.
- And below diff to make checkpatch happy (generated with --word-diff), shouldn't have any functional impact.

Please let me know if someone still have objections to this set as I would be sending a pull request tomorrow.

---------x---------------x-------------

arch/arm/boot/dts/spear1310.dtsi +0 -0
index 77bebae..fa5f2bb 100644
@@ -30,7 +30,7 @@
		};

		miphy0: miphy at eb800000 {
			compatible =[-"st,miphy",-] "st,spear1310-miphy";
			reg = <0xeb800000 0x4000>;
			misc = <&misc>;
			phy-id = <0>;
@@ -39,7 +39,7 @@
		};

		miphy1: miphy at eb804000 {
			compatible =[-"st,miphy",-] "st,spear1310-miphy";
			reg = <0xeb804000 0x4000>;
			misc = <&misc>;
			phy-id = <1>;
@@ -48,7 +48,7 @@
		};

		miphy2: miphy at eb808000 {
			compatible =[-"st,miphy",-] "st,spear1310-miphy";
			reg = <0xeb808000 0x4000>;
			misc = <&misc>;
			phy-id = <2>;
arch/arm/boot/dts/spear1340.dtsi +0 -0
index 0d8fe32f..e71df0f 100644
@@ -32,7 +32,7 @@
		};

		miphy0: miphy at eb800000 {
			compatible =[-"st,miphy",-] "st,spear1340-miphy";
			reg = <0xeb800000 0x4000>;
			misc = <&misc>;
			#phy-cells = <1>;
arch/arm/mach-spear/spear1340.c +0 -0
index 5f06166f..3f3c0f1 100644
@@ -11,6 +11,8 @@
 * warranty of any kind, whether express or implied.
 */
 

{+#define pr_fmt(fmt) "SPEAr1340: " fmt+}

#include <linux/of_platform.h>
#include <asm/mach/arch.h>
#include "generic.h"

drivers/pci/host/pcie-spear13xx.c +0 -0
index 9d4874a..a6fc332 100644
@@ -176,21 +176,21 @@ static int spear13xx_pcie_establish_link(struct pcie_port *pp)
	 */
	if (spear13xx_pcie->is_gen1) {
		dw_pcie_cfg_read(pp->dbi_base, exp_cap_off + PCI_EXP_LNKCAP, 4,
				 &val);
		if ((val & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
			val &= ~((u32)PCI_EXP_LNKCAP_SLS);
			val |= PCI_EXP_LNKCAP_SLS_2_5GB;
			dw_pcie_cfg_write(pp->dbi_base, exp_cap_off +
					  PCI_EXP_LNKCAP, 4, val);
		}

		dw_pcie_cfg_read(pp->dbi_base, exp_cap_off + PCI_EXP_LNKCTL2, 4,
				 &val);
		if ((val & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
			val &= ~((u32)PCI_EXP_LNKCAP_SLS);
			val |= PCI_EXP_LNKCAP_SLS_2_5GB;
			dw_pcie_cfg_write(pp->dbi_base, exp_cap_off +
					  PCI_EXP_LNKCTL2, 4, val);
		}
	}

@@ -280,7 +280,7 @@ static int add_pcie_port(struct pcie_port *pp, struct platform_device *pdev)

		return -ENODEV;
	}
	ret = devm_request_irq(dev, pp->irq, spear13xx_pcie_irq_handler,
			       IRQF_SHARED, "spear1340-pcie", pp);
	if (ret) {
		dev_err(dev, "failed to request irq %d\n", pp->irq);
		return ret;
@@ -307,8 +307,7 @@ static int __init spear13xx_pcie_probe(struct platform_device *pdev)
	struct resource *dbi_base;
	int ret;

	spear13xx_pcie = devm_kzalloc(dev, sizeof(*spear13xx_pcie), GFP_KERNEL);
	if (!spear13xx_pcie) {
		dev_err(dev, "no memory for SPEAr13xx pcie\n");
		return -ENOMEM;
drivers/phy/phy-spear1310-miphy.c +0 -0
index dc0b97a..c58c869 100644
@@ -117,8 +117,8 @@ static int spear1310_miphy_pcie_init(struct spear1310_miphy_priv *priv)
	u32 val;

	regmap_update_bits(priv->misc, SPEAR1310_PCIE_MIPHY_CFG_1,
			   SPEAR1310_PCIE_SATA_MIPHY_CFG_PCIE_MASK,
			   SPEAR1310_PCIE_SATA_MIPHY_CFG_PCIE);

	switch (priv->id) {
	case 0:
@@ -135,7 +135,7 @@ static int spear1310_miphy_pcie_init(struct spear1310_miphy_priv *priv)
	}

	regmap_update_bits(priv->misc, SPEAR1310_PCIE_SATA_CFG,
			   SPEAR1310_PCIE_CFG_MASK(priv->id), val);

	return 0;
}
@@ -143,10 +143,10 @@ static int spear1310_miphy_pcie_init(struct spear1310_miphy_priv *priv)
static int spear1310_miphy_pcie_exit(struct spear1310_miphy_priv *priv)
{
	regmap_update_bits(priv->misc, SPEAR1310_PCIE_SATA_CFG,
			   SPEAR1310_PCIE_CFG_MASK(priv->id), 0);

	regmap_update_bits(priv->misc, SPEAR1310_PCIE_MIPHY_CFG_1,
			   SPEAR1310_PCIE_SATA_MIPHY_CFG_PCIE_MASK, 0);

	return 0;
}

@@ -186,7 +186,7 @@ static struct phy_ops spear1310_miphy_ops = { };

static struct phy *spear1310_miphy_xlate(struct device *dev,
struct of_phandle_args *args)

{
	struct spear1310_miphy_priv *priv = dev_get_drvdata(dev);
drivers/phy/phy-spear1340-miphy.c +0 -0
index e06e944..5e39231 100644
@@ -92,18 +92,19 @@ struct spear1340_miphy_priv {

static int spear1340_miphy_sata_init(struct spear1340_miphy_priv *priv)

{
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
			   SPEAR1340_PCIE_SATA_CFG_MASK,
			   SPEAR1340_SATA_CFG_VAL);
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
			   SPEAR1340_PCIE_MIPHY_CFG_MASK,
			   SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK);
	/* Switch on sata power domain */
	regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
			   SPEAR1340_PCM_CFG_SATA_POWER_EN,
			   SPEAR1340_PCM_CFG_SATA_POWER_EN);
	msleep(20);
	/* Disable PCIE SATA Controller reset */
	regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
			   SPEAR1340_PERIP1_SW_RSATA, 0);
	msleep(20);

	return 0;
@@ -112,18 +113,18 @@ static int spear1340_miphy_sata_init(struct spear1340_miphy_priv *priv)
static int spear1340_miphy_sata_exit(struct spear1340_miphy_priv *priv)
{
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
			   SPEAR1340_PCIE_SATA_CFG_MASK, 0);
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
			   SPEAR1340_PCIE_MIPHY_CFG_MASK, 0);

	/* Enable PCIE SATA Controller reset */
	regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
			   SPEAR1340_PERIP1_SW_RSATA,
			   SPEAR1340_PERIP1_SW_RSATA);
	msleep(20);
	/* Switch off sata power domain */
	regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
			   SPEAR1340_PCM_CFG_SATA_POWER_EN, 0);
	msleep(20);

	return 0;
@@ -132,10 +133,11 @@ static int spear1340_miphy_sata_exit(struct spear1340_miphy_priv *priv)
static int spear1340_miphy_pcie_init(struct spear1340_miphy_priv *priv)
{
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
			   SPEAR1340_PCIE_MIPHY_CFG_MASK,
			   SPEAR1340_PCIE_SATA_MIPHY_CFG_PCIE);
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
			   SPEAR1340_PCIE_SATA_CFG_MASK,
			   SPEAR1340_PCIE_CFG_VAL);

	return 0;
}
@@ -143,9 +145,9 @@ static int spear1340_miphy_pcie_init(struct spear1340_miphy_priv *priv)
static int spear1340_miphy_pcie_exit(struct spear1340_miphy_priv *priv)
{
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
			   SPEAR1340_PCIE_MIPHY_CFG_MASK, 0);
	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
			   SPEAR1340_PCIE_SATA_CFG_MASK, 0);

	return 0;
}

@@ -213,10 +215,10 @@ static int spear1340_miphy_resume(struct device *dev) #endif

static SIMPLE_DEV_PM_OPS(spear1340_miphy_pm_ops, spear1340_miphy_suspend,

			 spear1340_miphy_resume);

static struct phy *spear1340_miphy_xlate(struct device *dev,
struct of_phandle_args *args)

{
	struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);

---------x---------------x-----------

Mohit Kumar (1):
ARM: SPEAr13xx: Update defconfigs

Pratyush Anand (6):
pcie: Add designware wrapper driver for SPEAr13xx
phy: Add drivers for PCIe and SATA phy on SPEAr13xx
ARM: SPEAr13xx: Fix pcie clock name
ARM: SPEAr13xx: Fix static mapping table
ARM: SPEAr13xx: Add bindings and dt node for misc block
ARM: SPEAr13xx: Add pcie and miphy DT nodes

 .../devicetree/bindings/arm/spear-misc.txt         |   9 +
 .../devicetree/bindings/pci/spear13xx-pcie.txt     |  14 +
 .../devicetree/bindings/phy/st-spear1310-miphy.txt |  12 +
 .../devicetree/bindings/phy/st-spear1340-miphy.txt |  11 +
 MAINTAINERS                                        |   6 +
 arch/arm/boot/dts/spear1310-evb.dts                |   4 +
 arch/arm/boot/dts/spear1310.dtsi                   |  93 ++++-
 arch/arm/boot/dts/spear1340-evb.dts                |   4 +
 arch/arm/boot/dts/spear1340.dtsi                   |  30 +-
 arch/arm/boot/dts/spear13xx.dtsi                   |   9 +-
 arch/arm/configs/spear13xx_defconfig               |  16 +
 arch/arm/mach-spear/Kconfig                        |   4 +
 arch/arm/mach-spear/include/mach/spear.h           |   4 +-
 arch/arm/mach-spear/spear1340.c                    | 125 +------
 arch/arm/mach-spear/spear13xx.c                    |   2 +-
 drivers/clk/spear/spear1310_clock.c                |   6 +-
 drivers/clk/spear/spear1340_clock.c                |   2 +-
 drivers/pci/host/Kconfig                           |   8 +
 drivers/pci/host/Makefile                          |   1 +
 drivers/pci/host/pcie-spear13xx.c                  | 405 +++++++++++++++++++++
 drivers/phy/Kconfig                                |  12 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-spear1310-miphy.c                  | 274 ++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++
 24 files changed, 1218 insertions(+), 137 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt
 create mode 100644 Documentation/devicetree/bindings/pci/spear13xx-pcie.txt
 create mode 100644 Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt
 create mode 100644 Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt
 create mode 100644 drivers/pci/host/pcie-spear13xx.c
 create mode 100644 drivers/phy/phy-spear1310-miphy.c
 create mode 100644 drivers/phy/phy-spear1340-miphy.c
Signature · 1 line
2.0.0.rc2
#1 lore raw

PATCH v9 1/7 pcie: Add designware wrapper driver for SPEAr13xx

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310 and SPEAr1340 SOCs have onchip designware PCIe controller. To make that usable, this patch adds a wrapper driver based on existing designware driver.

Adds bindings for this new driver and update MAINTAINERS as well.

Cc linux-pci at vger.kernel.org
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
---
 .../devicetree/bindings/pci/spear13xx-pcie.txt     |  14 +
 MAINTAINERS                                        |   6 +
 drivers/pci/host/Kconfig                           |   8 +
 drivers/pci/host/Makefile                          |   1 +
 drivers/pci/host/pcie-spear13xx.c                  | 405 +++++++++++++++++++++
 5 files changed, 434 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/spear13xx-pcie.txt
 create mode 100644 drivers/pci/host/pcie-spear13xx.c
Documentation/devicetree/bindings/pci/spear13xx-pcie.txt new file +14 -0
new file mode 100644
index 0000000..49ea76d
@@ -0,0 +1,14 @@
+SPEAr13XX PCIe DT detail:
+================================
+
+SPEAr13XX uses synopsis designware PCIe controller and ST MiPHY as phy
+controller.
+
+Required properties:
+- compatible : should be "st,spear1340-pcie", "snps,dw-pcie".
+- phys		    : phandle to phy node associated with pcie controller
+- phy-names	    : must be "pcie-phy"
+- All other definitions as per generic PCI bindings
+
+ Optional properties:
+- st,pcie-is-gen1 indicates that forced gen1 initialization is needed.
MAINTAINERS +6 -0
index 702ca10..443dd05 100644
@@ -6820,6 +6820,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/pci/host-generic-pci.txt
 F:	drivers/pci/host/pci-host-generic.c
 
+PCIE DRIVER FOR ST SPEAR13XX
+M:	Mohit Kumar <[email protected]>
+L:	linux-pci at vger.kernel.org
+S:	Maintained
+F:	drivers/pci/host/pcie-spear13xx.c
+
 PCMCIA SUBSYSTEM
 P:	Linux PCMCIA Team
 L:	linux-pcmcia at lists.infradead.org
drivers/pci/host/Kconfig +8 -0
index 21df477..2d8a4d0 100644
@@ -46,4 +46,12 @@ config PCI_HOST_GENERIC
 	  Say Y here if you want to support a simple generic PCI host
 	  controller, such as the one emulated by kvmtool.
 
+config PCIE_SPEAR13XX
+	tristate "STMicroelectronics SPEAr PCIe controller"
+	depends on ARCH_SPEAR13XX
+	select PCIEPORTBUS
+	select PCIE_DW
+	help
+	  Say Y here if you want PCIe support on SPEAr13XX SoCs.
+
 endmenu
drivers/pci/host/Makefile +1 -0
index 611ba4b..0daec79 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o
 obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
 obj-$(CONFIG_PCI_RCAR_GEN2_PCIE) += pcie-rcar.o
 obj-$(CONFIG_PCI_HOST_GENERIC) += pci-host-generic.o
+obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
drivers/pci/host/pcie-spear13xx.c new file +405 -0

405 lines not on this page · raw message

Signature · 1 line
2.0.0.rc2
maintainer
#2 lore raw

PATCH v9 1/7 pcie: Add designware wrapper driver for SPEAr13xx

I guess I'm obsessive, but I think it's nice when people run "git log --oneline" on the file or directory they're changing, and then follow the existing style.

In this case, that would lead to a subject line like:

PCI: spear: Add PCIe driver for ST Microelectronics SPEAr13xx

Quoted 22 lines · Viresh Kumar

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310 and SPEAr1340 SOCs have onchip designware PCIe controller. To make that usable, this patch adds a wrapper driver based on existing designware driver.

Adds bindings for this new driver and update MAINTAINERS as well.

Cc linux-pci at vger.kernel.org
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
MAINTAINERS +0 -0
index 702ca10..443dd05 100644

MAINTAINERS S: Maintained · line 6827

Quoted 8 lines
MAINTAINERS +5 -0
@@ -6820,6 +6820,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/pci/host-generic-pci.txt
 F:	drivers/pci/host/pci-host-generic.c
 
+PCIE DRIVER FOR ST SPEAR13XX
+M:	Mohit Kumar <[email protected]>
+L:	linux-pci at vger.kernel.org
+S:	Maintained
+F:	drivers/pci/host/pcie-spear13xx.c

Wildcards work here, so you could follow the lead of IMX6, MVEBU, RCAR, and DESIGNWARE and use:

    F:	drivers/pci/host/*spear*

drivers/pci/host/pcie-spear13xx.c line 142

Quoted 4 lines
drivers/pci/host/pcie-spear13xx.c new file +1 -0
...
+#define PCI_CAP_ID_EXP_OFFSET			0x70

A nit, but I'd use a name like EXP_CAP_ID_OFFSET to make it more clear that this is specific to SPEAr, not something from the PCI specs.

Bjorn

#3 lore raw

PATCH v9 1/7 pcie: Add designware wrapper driver for SPEAr13xx

Quoted 7 lines · Bjorn Helgaas

I guess I'm obsessive, but I think it's nice when people run "git log --oneline" on the file or directory they're changing, and then follow the existing style.

In this case, that would lead to a subject line like:

PCI: spear: Add PCIe driver for ST Microelectronics SPEAr13xx

Correct.

Quoted 19 lines · Viresh Kumar
Quoted 6 lines
MAINTAINERS +0 -0
index 702ca10..443dd05 100644

MAINTAINERS S: Maintained · line 6827

Quoted 8 lines
MAINTAINERS +5 -0
@@ -6820,6 +6820,12 @@ S:     Maintained
 F:   Documentation/devicetree/bindings/pci/host-generic-pci.txt
 F:   drivers/pci/host/pci-host-generic.c
 
+PCIE DRIVER FOR ST SPEAR13XX
+M:   Mohit Kumar <[email protected]>
+L:   linux-pci at vger.kernel.org
+S:   Maintained
+F:   drivers/pci/host/pcie-spear13xx.c

Wildcards work here, so you could follow the lead of IMX6, MVEBU, RCAR, and DESIGNWARE and use:

Quoted 1 line

F: drivers/pci/host/*spear*

Ok.

Quoted 8 lines

drivers/pci/host/pcie-spear13xx.c line 142

Quoted 4 lines
drivers/pci/host/pcie-spear13xx.c new file +1 -0
...
+#define PCI_CAP_ID_EXP_OFFSET                        0x70

A nit, but I'd use a name like EXP_CAP_ID_OFFSET to make it more clear that this is specific to SPEAr, not something from the PCI specs.

Sure.

#4 lore raw

PATCH v9 1/7 pcie: Add designware wrapper driver for SPEAr13xx

In reply to Bjorn Helgaas
Quoted 28 lines · Bjorn Helgaas

I guess I'm obsessive, but I think it's nice when people run "git log --oneline" on the file or directory they're changing, and then follow the existing style.

In this case, that would lead to a subject line like:

PCI: spear: Add PCIe driver for ST Microelectronics SPEAr13xx

MAINTAINERS S: Maintained · line 6827

Quoted 13 lines
MAINTAINERS +5 -0
index 702ca10..443dd05 100644
@@ -6820,6 +6820,12 @@ S:     Maintained
 F:   Documentation/devicetree/bindings/pci/host-generic-pci.txt
 F:   drivers/pci/host/pci-host-generic.c
 
+PCIE DRIVER FOR ST SPEAR13XX
+M:   Mohit Kumar <[email protected]>
+L:   linux-pci at vger.kernel.org
+S:   Maintained
+F:   drivers/pci/host/pcie-spear13xx.c

Wildcards work here, so you could follow the lead of IMX6, MVEBU, RCAR, and DESIGNWARE and use:

F: drivers/pci/host/*spear*

Quoted 8 lines

drivers/pci/host/pcie-spear13xx.c

Quoted 4 lines
drivers/pci/host/pcie-spear13xx.c new file +1 -0
...
+#define PCI_CAP_ID_EXP_OFFSET                        0x70

A nit, but I'd use a name like EXP_CAP_ID_OFFSET to make it more clear that this is specific to SPEAr, not something from the PCI specs.

Hi Bjorn,

So this is how the diff looks like over this patch:

MAINTAINERS +1 -1
index 443dd05..766948e 100644
@@ -6824,7 +6824,7 @@ PCIE DRIVER FOR ST SPEAR13XX
 M:     Mohit Kumar <[email protected]>
 L:     linux-pci at vger.kernel.org
 S:     Maintained
-F:     drivers/pci/host/pcie-spear13xx.c
+F:     drivers/pci/host/*spear*
 
 PCMCIA SUBSYSTEM
 P:     Linux PCMCIA Team
(quoted diff) +0 -0

b/drivers/pci/host/pcie-spear13xx.c
index a6fc332..99738e4 100644

drivers/pci/host/pcie-spear13xx.c +1 -1
@@ -139,7 +139,7 @@ struct pcie_app_reg {
 #define VEN_MSI_TC_MASK                ((u32)0x7 << VEN_MSI_TC_ID)
 #define VEN_MSI_VECTOR_MASK    ((u32)0x1F << VEN_MSI_VECTOR_ID)
 
-#define PCI_CAP_ID_EXP_OFFSET                  0x70
+#define EXP_CAP_ID_OFFSET                      0x70
 
 #define to_spear13xx_pcie(x)   container_of(x, struct spear13xx_pcie, pp)
 
@@ -149,7 +149,7 @@ static int spear13xx_pcie_establish_link(struct

pcie_port *pp)

        int count = 0;
        struct spear13xx_pcie *spear13xx_pcie = to_spear13xx_pcie(pp);
        struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;

- u32 exp_cap_off = PCI_CAP_ID_EXP_OFFSET;
+ u32 exp_cap_off = EXP_CAP_ID_OFFSET;

        if (dw_pcie_link_up(pp)) {
                dev_err(pp->dev, "link already up\n");

And the subject looks like this now:
PCI: spear: Add PCIe driver for ST Microelectronics SPEAr13xx

I may skip sending a V10 for this and directly send a pull request as there aren't any significant changes suggested in V9.

Thanks.

#5 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

In reply to Viresh Kumar

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310/40 platforms uses ST's phy (known as 'miphy') for PCIe and SATA. This patch adds drivers for these miphys.

This also adds proper bindings for miphys.

Cc Kishon Vijay Abraham I <[email protected]>
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
---
 .../devicetree/bindings/phy/st-spear1310-miphy.txt |  12 +
 .../devicetree/bindings/phy/st-spear1340-miphy.txt |  11 +
 drivers/phy/Kconfig                                |  12 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-spear1310-miphy.c                  | 274 +++++++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++++++++
 6 files changed, 613 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt
 create mode 100644 Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt
 create mode 100644 drivers/phy/phy-spear1310-miphy.c
 create mode 100644 drivers/phy/phy-spear1340-miphy.c
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +12 -0
new file mode 100644
index 0000000..b9b281a
@@ -0,0 +1,12 @@
+ST SPEAr1310-miphy DT detail
+===================================
+
+SPEAr1310-miphy is a phy controller supporting PCIe and SATA.
+
+Required properties:
+- compatible : should be "st,spear1310-miphy"
+- reg : offset and length of the PHY register set.
+- misc: phandle for the syscon node to access misc registers
+- phy-id: Instance id of the phy.
+- #phy-cells : from the generic PHY bindings, must be 1.
+	- cell[1]: 0 if phy used for SATA, 1 for PCIe.
Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt new file +11 -0
new file mode 100644
index 0000000..7eb5335
@@ -0,0 +1,11 @@
+ST SPEAr1340-miphy DT detail
+===================================
+
+SPEAr1340-miphy is a phy controller supporting PCIe and SATA.
+
+Required properties:
+- compatible : should be "st,spear1340-miphy"
+- reg : offset and length of the PHY register set.
+- misc: phandle for the syscon node to access misc registers
+- #phy-cells : from the generic PHY bindings, must be 1.
+	- cell[1]: 0 if phy used for SATA, 1 for PCIe.
drivers/phy/Kconfig +12 -0
index 16a2f06..e8f8a2d 100644
@@ -178,4 +178,16 @@ config PHY_XGENE
 	help
 	  This option enables support for APM X-Gene SoC multi-purpose PHY.
 
+config PHY_ST_SPEAR1310_MIPHY
+	tristate "ST SPEAR1310-MIPHY driver"
+	select GENERIC_PHY
+	help
+	  Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA.
+
+config PHY_ST_SPEAR1340_MIPHY
+	tristate "ST SPEAR1340-MIPHY driver"
+	select GENERIC_PHY
+	help
+	  Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA.
+
 endmenu
drivers/phy/Makefile +2 -0
index b4f1d57..d39609b 100644
@@ -20,3 +20,5 @@ phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4X12_USB2)	+= phy-exynos4x12-usb2.o
 phy-exynos-usb2-$(CONFIG_PHY_EXYNOS5250_USB2)	+= phy-exynos5250-usb2.o
 obj-$(CONFIG_PHY_EXYNOS5_USBDRD)	+= phy-exynos5-usbdrd.o
 obj-$(CONFIG_PHY_XGENE)			+= phy-xgene.o
+obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY)	+= phy-spear1310-miphy.o
+obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY)	+= phy-spear1340-miphy.o
drivers/phy/phy-spear1310-miphy.c new file +274 -0

274 lines not on this page · raw message

drivers/phy/phy-spear1340-miphy.c new file +302 -0

302 lines not on this page · raw message

Signature · 1 line
2.0.0.rc2
#6 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Hi,

Quoted 13 lines · Viresh Kumar

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310/40 platforms uses ST's phy (known as 'miphy') for PCIe and SATA. This patch adds drivers for these miphys.

This also adds proper bindings for miphys.

Cc Kishon Vijay Abraham I <[email protected]>
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
Quoted 7 lines
---
 .../devicetree/bindings/phy/st-spear1310-miphy.txt |  12 +
 .../devicetree/bindings/phy/st-spear1340-miphy.txt |  11 +
 drivers/phy/Kconfig                                |  12 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-spear1310-miphy.c                  | 274 +++++++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++++++++

Please send separate patche for each driver.

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 11 lines
 6 files changed, 613 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt
 create mode 100644 Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt
 create mode 100644 drivers/phy/phy-spear1310-miphy.c
 create mode 100644 drivers/phy/phy-spear1340-miphy.c
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +0 -0
new file mode 100644
index 0000000..b9b281a

We generally create a single document for a SoC vendor. So just use st-phy.txt.

Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt

Quoted 18 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +12 -0
@@ -0,0 +1,12 @@
+ST SPEAr1310-miphy DT detail
+===================================
+
+SPEAr1310-miphy is a phy controller supporting PCIe and SATA.
+
+Required properties:
+- compatible : should be "st,spear1310-miphy"
+- reg : offset and length of the PHY register set.
+- misc: phandle for the syscon node to access misc registers
+- phy-id: Instance id of the phy.
+- #phy-cells : from the generic PHY bindings, must be 1.
+	- cell[1]: 0 if phy used for SATA, 1 for PCIe.
Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt new file +0 -0
new file mode 100644
index 0000000..7eb5335

use st-phy.txt for this.

Quoted 17 lines
Documentation/devicetree/bindings/phy/st-spear1340-miphy.txt new file +11 -0
@@ -0,0 +1,11 @@
+ST SPEAr1340-miphy DT detail
+===================================
+
+SPEAr1340-miphy is a phy controller supporting PCIe and SATA.
+
+Required properties:
+- compatible : should be "st,spear1340-miphy"
+- reg : offset and length of the PHY register set.
+- misc: phandle for the syscon node to access misc registers
+- #phy-cells : from the generic PHY bindings, must be 1.
+	- cell[1]: 0 if phy used for SATA, 1 for PCIe.
drivers/phy/Kconfig +0 -0
index 16a2f06..e8f8a2d 100644

drivers/phy/Kconfig config PHY_XGENE · line 180

Quoted 3 lines
drivers/phy/Kconfig +0 -0
@@ -178,4 +178,16 @@ config PHY_XGENE
 	help
 	  This option enables support for APM X-Gene SoC multi-purpose PHY.
 

..
<snip>
.
.

Quoted 8 lines
drivers/phy/Kconfig +8 -0
+
+static int spear1340_miphy_sata_init(struct spear1340_miphy_priv *priv)
+{
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+			   SPEAR1340_PCIE_SATA_CFG_MASK,
+			   SPEAR1340_SATA_CFG_VAL);
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+			   SPEAR1340_PCIE_MIPHY_CFG_MASK,

drivers/phy/Kconfig config PHY_XGENE

Quoted 10 lines
drivers/phy/Kconfig +10 -0
+			   SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK);
+	/* Switch on sata power domain */
+	regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
+			   SPEAR1340_PCM_CFG_SATA_POWER_EN,
+			   SPEAR1340_PCM_CFG_SATA_POWER_EN);
+	msleep(20);
+	/* Disable PCIE SATA Controller reset */
+	regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
+			   SPEAR1340_PERIP1_SW_RSATA, 0);
+	msleep(20);

Please add a comment for all delays added.

Quoted 10 lines
drivers/phy/Kconfig +10 -0
+
+	return 0;
+}
+
+static int spear1340_miphy_sata_exit(struct spear1340_miphy_priv *priv)
+{
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+			   SPEAR1340_PCIE_SATA_CFG_MASK, 0);
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+			   SPEAR1340_PCIE_MIPHY_CFG_MASK, 0);

drivers/phy/Kconfig

Quoted 10 lines
drivers/phy/Kconfig +10 -0
+
+	/* Enable PCIE SATA Controller reset */
+	regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
+			   SPEAR1340_PERIP1_SW_RSATA,
+			   SPEAR1340_PERIP1_SW_RSATA);
+	msleep(20);
+	/* Switch off sata power domain */
+	regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
+			   SPEAR1340_PCM_CFG_SATA_POWER_EN, 0);
+	msleep(20);

ditto.

Quoted 62 lines
drivers/phy/Kconfig +62 -0
+
+	return 0;
+}
+
+static int spear1340_miphy_pcie_init(struct spear1340_miphy_priv *priv)
+{
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+			   SPEAR1340_PCIE_MIPHY_CFG_MASK,
+			   SPEAR1340_PCIE_SATA_MIPHY_CFG_PCIE);
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+			   SPEAR1340_PCIE_SATA_CFG_MASK,
+			   SPEAR1340_PCIE_CFG_VAL);
+
+	return 0;
+}
+
+static int spear1340_miphy_pcie_exit(struct spear1340_miphy_priv *priv)
+{
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+			   SPEAR1340_PCIE_MIPHY_CFG_MASK, 0);
+	regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+			   SPEAR1340_PCIE_SATA_CFG_MASK, 0);
+
+	return 0;
+}
+
+static int spear1340_miphy_init(struct phy *phy)
+{
+	struct spear1340_miphy_priv *priv = phy_get_drvdata(phy);
+	int ret = 0;
+
+	if (priv->mode == SATA)
+		ret = spear1340_miphy_sata_init(priv);
+	else if (priv->mode == PCIE)
+		ret = spear1340_miphy_pcie_init(priv);
+
+	return ret;
+}
+
+static int spear1340_miphy_exit(struct phy *phy)
+{
+	struct spear1340_miphy_priv *priv = phy_get_drvdata(phy);
+	int ret = 0;
+
+	if (priv->mode == SATA)
+		ret = spear1340_miphy_sata_exit(priv);
+	else if (priv->mode == PCIE)
+		ret = spear1340_miphy_pcie_exit(priv);
+
+	return ret;
+}
+
+static const struct of_device_id spear1340_miphy_of_match[] = {
+	{ .compatible = "st,spear1340-miphy" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, spear1340_miphy_of_match);
+
+static struct phy_ops spear1340_miphy_ops = {
+	.init = spear1340_miphy_init,
+	.exit = spear1340_miphy_exit,
+	.owner = THIS_MODULE,

drivers/phy/Kconfig

Quoted 10 lines
drivers/phy/Kconfig +10 -0
+};
+
+#ifdef CONFIG_PM_SLEEP
+static int spear1340_miphy_suspend(struct device *dev)
+{
+	struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+	int ret = 0;
+
+	if (priv->mode == SATA)
+		ret = spear1340_miphy_sata_exit(priv);

Shouldn't this be spear1340_miphy_init()?

drivers/phy/Kconfig

Quoted 11 lines
drivers/phy/Kconfig +11 -0
+
+	return ret;
+}
+
+static int spear1340_miphy_resume(struct device *dev)
+{
+	struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+	int ret = 0;
+
+	if (priv->mode == SATA)
+		ret = spear1340_miphy_sata_init(priv);

And here spear1340_miphy_exit()? Why only for sata phys?

drivers/phy/Kconfig

Quoted 3 lines
drivers/phy/Kconfig +3 -0
+
+	return ret;
+}

Thanks
Kishon

#7 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Quoted 22 lines · Kishon Vijay Abraham I
Quoted 13 lines · Viresh Kumar

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310/40 platforms uses ST's phy (known as 'miphy') for PCIe and SATA. This patch adds drivers for these miphys.

This also adds proper bindings for miphys.

Cc Kishon Vijay Abraham I <[email protected]>
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
Quoted 7 lines
---
 .../devicetree/bindings/phy/st-spear1310-miphy.txt |  12 +
 .../devicetree/bindings/phy/st-spear1340-miphy.txt |  11 +
 drivers/phy/Kconfig                                |  12 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-spear1310-miphy.c                  | 274 +++++++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++++++++
Quoted 1 line

Please send separate patche for each driver.

These were both around SPEAr and were on the same lines.
So sending these in a single patch shouldn't be a big issue I believe.

In case another version is required, I may do it.

Quoted 7 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 5 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +0 -0
new file mode 100644
index 0000000..b9b281a

We generally create a single document for a SoC vendor. So just use st-phy.txt.

Probably yes.

Quoted 1 line

<snip>

Please keep line containing file names while removing stuff, makes it easy to locate code.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +12 -0
+
+static int spear1340_miphy_sata_init(struct spear1340_miphy_priv *priv)
+{
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+                        SPEAR1340_PCIE_SATA_CFG_MASK,
+                        SPEAR1340_SATA_CFG_VAL);
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+                        SPEAR1340_PCIE_MIPHY_CFG_MASK,
+                        SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK);
+     /* Switch on sata power domain */
+     regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN,
Quoted 8 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 6 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +6 -0
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN);
+     msleep(20);
+     /* Disable PCIE SATA Controller reset */
+     regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
+                        SPEAR1340_PERIP1_SW_RSATA, 0);
+     msleep(20);

Please add a comment for all delays added.

@Pratyush/Mohit: please let me know what to add here.

Quoted 10 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 8 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +8 -0
+#ifdef CONFIG_PM_SLEEP
+static int spear1340_miphy_suspend(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_exit(priv);

Shouldn't this be spear1340_miphy_init()?

Quoted 13 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 11 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +11 -0
+
+     return ret;
+}
+
+static int spear1340_miphy_resume(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_init(priv);

And here spear1340_miphy_exit()? Why only for sata phys?

@Mohit/Pratyush ??

Thanks Kishon for another round of review :)

#8 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Quoted 38 lines · Viresh Kumar
Quoted 22 lines · Kishon Vijay Abraham I
Quoted 13 lines · Viresh Kumar

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310/40 platforms uses ST's phy (known as 'miphy') for PCIe and SATA. This patch adds drivers for these miphys.

This also adds proper bindings for miphys.

Cc Kishon Vijay Abraham I <[email protected]>
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
Quoted 7 lines
---
 .../devicetree/bindings/phy/st-spear1310-miphy.txt |  12 +
 .../devicetree/bindings/phy/st-spear1340-miphy.txt |  11 +
 drivers/phy/Kconfig                                |  12 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-spear1310-miphy.c                  | 274 +++++++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++++++++
Quoted 1 line

Please send separate patche for each driver.

These were both around SPEAr and were on the same lines.
So sending these in a single patch shouldn't be a big issue I believe.

In case another version is required, I may do it.

Quoted 7 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 5 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +0 -0
new file mode 100644
index 0000000..b9b281a

We generally create a single document for a SoC vendor. So just use st-phy.txt.

Quoted 6 lines

Probably yes.

Quoted 1 line

<snip>

Please keep line containing file names while removing stuff, makes it easy to locate code.

ah.. apologies..

Quoted 52 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +12 -0
+
+static int spear1340_miphy_sata_init(struct spear1340_miphy_priv *priv)
+{
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+                        SPEAR1340_PCIE_SATA_CFG_MASK,
+                        SPEAR1340_SATA_CFG_VAL);
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+                        SPEAR1340_PCIE_MIPHY_CFG_MASK,
+                        SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK);
+     /* Switch on sata power domain */
+     regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN,
Quoted 8 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 6 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +6 -0
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN);
+     msleep(20);
+     /* Disable PCIE SATA Controller reset */
+     regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
+                        SPEAR1340_PERIP1_SW_RSATA, 0);
+     msleep(20);

Please add a comment for all delays added.

@Pratyush/Mohit: please let me know what to add here.

Quoted 10 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 8 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +8 -0
+#ifdef CONFIG_PM_SLEEP
+static int spear1340_miphy_suspend(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_exit(priv);

Shouldn't this be spear1340_miphy_init()?

Quoted 13 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 11 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +11 -0
+
+     return ret;
+}
+
+static int spear1340_miphy_resume(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_init(priv);

And here spear1340_miphy_exit()? Why only for sata phys?

@Mohit/Pratyush ??

Thanks Kishon for another round of review :)

#9 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

In reply to Viresh Kumar
Quoted 23 lines · Viresh Kumar
Quoted 22 lines · Kishon Vijay Abraham I
Quoted 20 lines · Viresh Kumar

From: Pratyush Anand <[email protected]>

ARM based ST Microelectronics's SPEAr1310/40 platforms uses ST's phy (known as 'miphy') for PCIe and SATA. This patch adds drivers for these miphys.

This also adds proper bindings for miphys.

Cc Kishon Vijay Abraham I <[email protected]>
[viresh: fixed logs/cclist/checkpatch warnings, broken into smaller patches]
---
 .../devicetree/bindings/phy/st-spear1310-miphy.txt |  12 +
 .../devicetree/bindings/phy/st-spear1340-miphy.txt |  11 +
 drivers/phy/Kconfig                                |  12 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-spear1310-miphy.c                  | 274 +++++++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++++++++
Quoted 6 lines
Quoted 1 line

Please send separate patche for each driver.

These were both around SPEAr and were on the same lines.
So sending these in a single patch shouldn't be a big issue I believe.

In case another version is required, I may do it.

yes please.

-Kishon

Quoted 67 lines
Quoted 8 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 6 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +0 -0
new file mode 100644
index 0000000..b9b281a

We generally create a single document for a SoC vendor. So just use st-phy.txt.

Probably yes.

Quoted 1 line

<snip>

Please keep line containing file names while removing stuff, makes it easy to locate code.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +12 -0
+
+static int spear1340_miphy_sata_init(struct spear1340_miphy_priv *priv)
+{
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+                        SPEAR1340_PCIE_SATA_CFG_MASK,
+                        SPEAR1340_SATA_CFG_VAL);
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+                        SPEAR1340_PCIE_MIPHY_CFG_MASK,
+                        SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK);
+     /* Switch on sata power domain */
+     regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN,
Quoted 8 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 6 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +6 -0
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN);
+     msleep(20);
+     /* Disable PCIE SATA Controller reset */
+     regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
+                        SPEAR1340_PERIP1_SW_RSATA, 0);
+     msleep(20);

Please add a comment for all delays added.

@Pratyush/Mohit: please let me know what to add here.

Quoted 10 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 8 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +8 -0
+#ifdef CONFIG_PM_SLEEP
+static int spear1340_miphy_suspend(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_exit(priv);

Shouldn't this be spear1340_miphy_init()?

Quoted 13 lines

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 11 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +11 -0
+
+     return ret;
+}
+
+static int spear1340_miphy_resume(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_init(priv);

And here spear1340_miphy_exit()? Why only for sata phys?

@Mohit/Pratyush ??

Thanks Kishon for another round of review :)

#10 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Hello Kishon/Viresh,

Quoted 17 lines

-----Original Message-----
From: Kishon Vijay Abraham I [mailto:kishon at ti.com]
Sent: Friday, July 11, 2014 2:03 PM
To: Viresh Kumar
Cc: Arnd Bergmann; olof at lixom.net; linux-arm-kernel at lists.infradead.org; spear-devel; Bartlomiej Zolnierkiewicz; Bjorn Helgaas; Mark Nicholson; linux- pci at vger.kernel.org; Pratyush ANAND
Subject: Re: [PATCH V9 2/7] phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Quoted 4 lines · Viresh Kumar
Quoted 3 lines · Kishon Vijay Abraham I
Quoted 2 lines · Viresh Kumar

From: Pratyush Anand <[email protected]>

[...]

Quoted 24 lines
Quoted 9 lines
Quoted 9 lines

drivers/phy/phy-spear1340-miphy.c line 109

Quoted 9 lines
drivers/phy/phy-spear1340-miphy.c new file +9 -0
+
+static int spear1340_miphy_sata_init(struct spear1340_miphy_priv
+*priv) {
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG,
+                        SPEAR1340_PCIE_SATA_CFG_MASK,
+                        SPEAR1340_SATA_CFG_VAL);
+     regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG,
+                        SPEAR1340_PCIE_MIPHY_CFG_MASK,
+

SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK);

Quoted 14 lines
Quoted 11 lines

drivers/phy/phy-spear1340-miphy.c line 108

Quoted 9 lines
drivers/phy/phy-spear1340-miphy.c new file +9 -0
+     /* Switch on sata power domain */
+     regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN,
+                        SPEAR1340_PCM_CFG_SATA_POWER_EN);
+     msleep(20);
+     /* Disable PCIE SATA Controller reset */
+     regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
+                        SPEAR1340_PERIP1_SW_RSATA, 0);
+     msleep(20);

Please add a comment for all delays added.

@Pratyush/Mohit: please let me know what to add here.

- I think we should read regmap_*() and msleep() in continuation and so the comment above it is valid for both the operations.

Otherwise we can add comment line for msleep() like:
/* Wait for SATA power domain on */
/* Wait for SATA reset de-assert completion */

Similarily in *_exit routine:
/* Wait for SATA power domain off */
/* Wait for SATA reset assert completion */

Thanks
Mohit

#11 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Quoted 2 lines · Mohit KUMAR DCG

- I think we should read regmap_*() and msleep() in continuation and so the comment above it is valid for both the operations.

Probably not, its not obvious why a msleep() is required after regmap_*().

Quoted 7 lines

Otherwise we can add comment line for msleep() like:
/* Wait for SATA power domain on */
/* Wait for SATA reset de-assert completion */

Similarily in *_exit routine:
/* Wait for SATA power domain off */
/* Wait for SATA reset assert completion */

These makes sense. Will add them.

#12 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

Quoted 1 line · Viresh Kumar

These makes sense. Will add them.

Kishon, here is how the diff looks like now:

(quoted diff) +0 -0

b/drivers/phy/phy-spear1340-miphy.c
index 5e39231..8de98ad 100644

drivers/phy/phy-spear1340-miphy.c +0 -0
@@ -101,10 +101,13 @@ static int spear1340_miphy_sata_init(struct

spear1340_miphy_priv *priv)

        regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
                           SPEAR1340_PCM_CFG_SATA_POWER_EN,
                           SPEAR1340_PCM_CFG_SATA_POWER_EN);
+       /* Wait for SATA power domain on */
        msleep(20);
+
        /* Disable PCIE SATA Controller reset */
        regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
                           SPEAR1340_PERIP1_SW_RSATA, 0);
+       /* Wait for SATA reset de-assert completion */
        msleep(20);

        return 0;
@@ -121,10 +124,12 @@ static int spear1340_miphy_sata_exit(struct
spear1340_miphy_priv *priv)
        regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST,
                           SPEAR1340_PERIP1_SW_RSATA,
                           SPEAR1340_PERIP1_SW_RSATA);
+       /* Wait for SATA power domain off */
        msleep(20);
        /* Switch off sata power domain */
        regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG,
                           SPEAR1340_PCM_CFG_SATA_POWER_EN, 0);
+       /* Wait for SATA reset assert completion */
        msleep(20);

        return 0;
#13 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

In reply to Viresh Kumar
Quoted 10 lines · Viresh Kumar
Quoted 10 lines

drivers/phy/phy-spear1340-miphy.c line 200

Quoted 8 lines
drivers/phy/phy-spear1340-miphy.c new file +8 -0
+#ifdef CONFIG_PM_SLEEP
+static int spear1340_miphy_suspend(struct device *dev)
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_exit(priv);

Shouldn't this be spear1340_miphy_init()?

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/phy/phy-spear1340-miphy.c new file +5 -0
+
+     return ret;
+}
+
+static int spear1340_miphy_resume(struct device *dev)
Quoted 8 lines

drivers/phy/phy-spear1340-miphy.c line 211

Quoted 6 lines
drivers/phy/phy-spear1340-miphy.c new file +6 -0
+{
+     struct spear1340_miphy_priv *priv = dev_get_drvdata(dev);
+     int ret = 0;
+
+     if (priv->mode == SATA)
+             ret = spear1340_miphy_sata_init(priv);

And here spear1340_miphy_exit()? Why only for sata phys?

Kishon,

I had a chat with Pratyush and this is what we came to:

init and exit are rightly placed I believe. We need to initialize from resume and exit from suspend. That's fine right? Also this was already part of: arch/arm/mach-spear/spear1340.c which is removed with this set.

Regarding sata and pcie, pcie suspend isn't yet implemented and tested. So only sata :)

For delays, need to wait for mohit. Was on leave today.

#14 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

In reply to Viresh Kumar
Quoted 7 lines · Viresh Kumar
Quoted 4 lines
Quoted 2 lines
 drivers/phy/phy-spear1310-miphy.c                  | 274 +++++++++++++++++++
 drivers/phy/phy-spear1340-miphy.c                  | 302 +++++++++++++++++++++

Please send separate patche for each driver.

These were both around SPEAr and were on the same lines.
So sending these in a single patch shouldn't be a big issue I believe.

For completeness I have still kept them together as they have a single bindings file now. And breaking it out *may* affect readability later.

#15 lore raw

PATCH v9 2/7 phy: Add drivers for PCIe and SATA phy on SPEAr13xx

In reply to Kishon Vijay Abraham I
Quoted 7 lines · Kishon Vijay Abraham I

Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt

Quoted 5 lines
Documentation/devicetree/bindings/phy/st-spear1310-miphy.txt new file +0 -0
new file mode 100644
index 0000000..b9b281a

We generally create a single document for a SoC vendor. So just use st-phy.txt.

st-phy may not be appropriate as this is specifically for SPEAr. New binding doc looks like this:

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/phy/st-spear-miphy.txt new file mode 100644
index 0000000..2a6bfdc

Documentation/devicetree/bindings/phy/st-spear-miphy.txt new file +15 -0
@@ -0,0 +1,15 @@
+ST SPEAr miphy DT details
+=========================
+
+ST Microelectronics SPEAr miphy is a phy controller supporting PCIe and SATA.
+
+Required properties:
+- compatible : should be "st,spear1310-miphy" or "st,spear1340-miphy"
+- reg : offset and length of the PHY register set.
+- misc: phandle for the syscon node to access misc registers
+- #phy-cells : from the generic PHY bindings, must be 1.
+       - cell[1]: 0 if phy used for SATA, 1 for PCIe.
+
+Optional properties:
+- phy-id: Instance id of the phy. Only required when there are multiple phys
+  present on a implementation.
#16 lore raw

PATCH v9 3/7 ARM: SPEAr13xx: Fix pcie clock name

In reply to Viresh Kumar

From: Pratyush Anand <[email protected]>

Follow dt clock naming convention for PCIe clocks.

Cc Mike Turquette <[email protected]>
[viresh: fixed logs/cclist]
---
 drivers/clk/spear/spear1310_clock.c | 6 +++---
 drivers/clk/spear/spear1340_clock.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/clk/spear/spear1310_clock.c +3 -3
index 65894f7..4daa597 100644
@@ -742,19 +742,19 @@ void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base)
 	clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
 			0, &_lock);
-	clk_register_clkdev(clk, NULL, "dw_pcie.0");
+	clk_register_clkdev(clk, NULL, "b1000000.pcie");
 	clk_register_clkdev(clk, NULL, "b1000000.ahci");
 
 	clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
 			0, &_lock);
-	clk_register_clkdev(clk, NULL, "dw_pcie.1");
+	clk_register_clkdev(clk, NULL, "b1800000.pcie");
 	clk_register_clkdev(clk, NULL, "b1800000.ahci");
 
 	clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
 			SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
 			0, &_lock);
-	clk_register_clkdev(clk, NULL, "dw_pcie.2");
+	clk_register_clkdev(clk, NULL, "b4000000.pcie");
 	clk_register_clkdev(clk, NULL, "b4000000.ahci");
 
 	clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
drivers/clk/spear/spear1340_clock.c +1 -1
index fe835c1..5a5c664 100644
@@ -839,7 +839,7 @@ void __init spear1340_clk_init(void __iomem *misc_base)
 	clk = clk_register_gate(NULL, "pcie_sata_clk", "ahb_clk", 0,
 			SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_PCIE_SATA_CLK_ENB,
 			0, &_lock);
-	clk_register_clkdev(clk, NULL, "dw_pcie");
+	clk_register_clkdev(clk, NULL, "b1000000.pcie");
 	clk_register_clkdev(clk, NULL, "b1000000.ahci");
 
 	clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
Signature · 1 line
2.0.0.rc2
#17 lore raw

PATCH v9 3/7 ARM: SPEAr13xx: Fix pcie clock name

Quoting Viresh Kumar (2014-07-10 00:26:34)

Quoted 9 lines

From: Pratyush Anand <[email protected]>

Follow dt clock naming convention for PCIe clocks.

Cc Mike Turquette <[email protected]>
[viresh: fixed logs/cclist]

Applied to clk-next.

Regards,
Mike

Quoted 48 lines
---
 drivers/clk/spear/spear1310_clock.c | 6 +++---
 drivers/clk/spear/spear1340_clock.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/clk/spear/spear1310_clock.c +3 -3
index 65894f7..4daa597 100644
@@ -742,19 +742,19 @@ void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base)
        clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
                        SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
                        0, &_lock);
-       clk_register_clkdev(clk, NULL, "dw_pcie.0");
+       clk_register_clkdev(clk, NULL, "b1000000.pcie");
        clk_register_clkdev(clk, NULL, "b1000000.ahci");
 
        clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
                        SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
                        0, &_lock);
-       clk_register_clkdev(clk, NULL, "dw_pcie.1");
+       clk_register_clkdev(clk, NULL, "b1800000.pcie");
        clk_register_clkdev(clk, NULL, "b1800000.ahci");
 
        clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
                        SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
                        0, &_lock);
-       clk_register_clkdev(clk, NULL, "dw_pcie.2");
+       clk_register_clkdev(clk, NULL, "b4000000.pcie");
        clk_register_clkdev(clk, NULL, "b4000000.ahci");
 
        clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
drivers/clk/spear/spear1340_clock.c +1 -1
index fe835c1..5a5c664 100644
@@ -839,7 +839,7 @@ void __init spear1340_clk_init(void __iomem *misc_base)
        clk = clk_register_gate(NULL, "pcie_sata_clk", "ahb_clk", 0,
                        SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_PCIE_SATA_CLK_ENB,
                        0, &_lock);
-       clk_register_clkdev(clk, NULL, "dw_pcie");
+       clk_register_clkdev(clk, NULL, "b1000000.pcie");
        clk_register_clkdev(clk, NULL, "b1000000.ahci");
 
        clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
Signature · 1 line
2.0.0.rc2
#18 lore raw

PATCH v9 4/7 ARM: SPEAr13xx: Fix static mapping table

In reply to Viresh Kumar

From: Pratyush Anand <[email protected]>

SPEAr13xx was using virtual address space 0xFE000000 to map physical address space 0xB3000000. But pci_remap_io uses 0xFEE00000 as virtual address and so replace 0xFE000000 with 0xF9000000.

---
 arch/arm/mach-spear/include/mach/spear.h | 4 ++--
 arch/arm/mach-spear/spear13xx.c          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-spear/include/mach/spear.h +2 -2
index 5cdc53d..f2d6a01 100644
@@ -52,10 +52,10 @@
 #ifdef CONFIG_ARCH_SPEAR13XX
 
 #define PERIP_GRP2_BASE				UL(0xB3000000)
-#define VA_PERIP_GRP2_BASE			IOMEM(0xFE000000)
+#define VA_PERIP_GRP2_BASE			IOMEM(0xF9000000)
 #define MCIF_SDHCI_BASE				UL(0xB3000000)
 #define SYSRAM0_BASE				UL(0xB3800000)
-#define VA_SYSRAM0_BASE				IOMEM(0xFE800000)
+#define VA_SYSRAM0_BASE				IOMEM(0xF9800000)
 #define SYS_LOCATION				(VA_SYSRAM0_BASE + 0x600)
 
 #define PERIP_GRP1_BASE				UL(0xE0000000)
arch/arm/mach-spear/spear13xx.c +1 -1
index c9897ea..53a7614 100644
@@ -52,7 +52,7 @@ void __init spear13xx_l2x0_init(void)
 /*
  * Following will create 16MB static virtual/physical mappings
  * PHYSICAL		VIRTUAL
- * 0xB3000000		0xFE000000
+ * 0xB3000000		0xF9000000
  * 0xE0000000		0xFD000000
  * 0xEC000000		0xFC000000
  * 0xED000000		0xFB000000
Signature · 1 line
2.0.0.rc2
#19 lore raw

PATCH v9 5/7 ARM: SPEAr13xx: Add bindings and dt node for misc block

In reply to Viresh Kumar

From: Pratyush Anand <[email protected]>

SPEAr SOCs have some miscellaneous registers which are used to configure peripheral.

This patch adds dt node and binding information for this block.

Cc devicetree at vger.kernel.org
[viresh: fixed logs/cclist]
---
 Documentation/devicetree/bindings/arm/spear-misc.txt | 9 +++++++++
 arch/arm/boot/dts/spear13xx.dtsi                     | 5 +++++
 arch/arm/mach-spear/Kconfig                          | 1 +
 3 files changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt
Documentation/devicetree/bindings/arm/spear-misc.txt new file +9 -0
new file mode 100644
index 0000000..cf64982
@@ -0,0 +1,9 @@
+SPEAr Misc configuration
+===========================
+SPEAr SOCs have some miscellaneous registers which are used to configure
+few properties of different peripheral controllers.
+
+misc node required properties:
+
+- compatible Should be	"st,spear1340-misc", "syscon".
+- reg: Address range of misc space upto 8K
arch/arm/boot/dts/spear13xx.dtsi +5 -0
index 4382547..3a72508 100644
@@ -220,6 +220,11 @@
 				  0xd8000000 0xd8000000 0x01000000
 				  0xe0000000 0xe0000000 0x10000000>;
 
+			misc: syscon at e0700000 {
+				compatible = "st,spear1340-misc", "syscon";
+				reg = <0xe0700000 0x1000>;
+			};
+
 			gpio0: gpio at e0600000 {
 				compatible = "arm,pl061", "arm,primecell";
 				reg = <0xe0600000 0x1000>;
arch/arm/mach-spear/Kconfig +1 -0
index 90df202..ba57677 100644
@@ -19,6 +19,7 @@ config ARCH_SPEAR13XX
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
 	select PINCTRL
+	select MFD_SYSCON
 	help
 	  Supports for ARM's SPEAR13XX family
 
Signature · 1 line
2.0.0.rc2
#20 lore raw

PATCH v9 6/7 ARM: SPEAr13xx: Add pcie and miphy DT nodes

In reply to Viresh Kumar

From: Pratyush Anand <[email protected]>

This patch adds necessary DT nodes for pcie controllers and miphys for SPEAr13xx SoCs.

SPEAr1310 has 3 PCIe ports and SPEAr1340 has 1, which are multiplexed with ahci/sata pins. By default evaluation board of both controller works in ahci mode. Because of this, these nodes are marked "disabled" by default.

In order to use pcie controller on evaluation boards do necessary modifications on board and enable (By replacing "disabled" with "okay") pcie and miphy from respective 'evb' dtsi file.

Phy specific initialization was previously done from spear1340.c, which isn't required anymore as we have separate drivers for it. Remove it.

[viresh: fixed logs/cclist/checkpatch warnings, clubbed multiple patches into one]
---
 arch/arm/boot/dts/spear1310-evb.dts |   4 ++
 arch/arm/boot/dts/spear1310.dtsi    |  93 ++++++++++++++++++++++++++-
 arch/arm/boot/dts/spear1340-evb.dts |   4 ++
 arch/arm/boot/dts/spear1340.dtsi    |  30 ++++++++-
 arch/arm/boot/dts/spear13xx.dtsi    |   4 +-
 arch/arm/mach-spear/Kconfig         |   3 +
 arch/arm/mach-spear/spear1340.c     | 125 +-----------------------------------
 7 files changed, 133 insertions(+), 130 deletions(-)
arch/arm/boot/dts/spear1310-evb.dts +4 -0
index b56a801..d42c84b 100644
@@ -106,6 +106,10 @@
 			status = "okay";
 		};
 
+		miphy at eb800000 {
+			status = "okay";
+		};
+
 		cf at b2800000 {
 			status = "okay";
 		};
arch/arm/boot/dts/spear1310.dtsi +90 -3

114 lines not on this page · raw message

arch/arm/boot/dts/spear1340-evb.dts +4 -0
index d6c30ae..b23e05e 100644
@@ -122,6 +122,10 @@
 			status = "okay";
 		};
 
+		miphy at eb800000 {
+			status = "okay";
+		};
+
 		dma at ea800000 {
 			status = "okay";
 		};
arch/arm/boot/dts/spear1340.dtsi +29 -1
index 54d128d..e71df0f 100644
@@ -31,10 +31,38 @@
 			status = "disabled";
 		};
 
-		ahci at b1000000 {
+		miphy0: miphy at eb800000 {
+			compatible = "st,spear1340-miphy";
+			reg = <0xeb800000 0x4000>;
+			misc = <&misc>;
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+
+		ahci0: ahci at b1000000 {
 			compatible = "snps,spear-ahci";
 			reg = <0xb1000000 0x10000>;
 			interrupts = <0 72 0x4>;
+			phys = <&miphy0 0>;
+			phy-names = "sata-phy";
+			status = "disabled";
+		};
+
+		pcie0: pcie at b1000000 {
+			compatible = "st,spear1340-pcie", "snps,dw-pcie";
+			reg = <0xb1000000 0x4000>;
+			interrupts = <0 68 0x4>;
+			interrupt-map-mask = <0 0 0 0>;
+			interrupt-map = <0x0 0 &gic 0 68 0x4>;
+			num-lanes = <1>;
+			phys = <&miphy0 1>;
+			phy-names = "pcie-phy";
+			#address-cells = <3>;
+			#size-cells = <2>;
+			device_type = "pci";
+			ranges = <0x00000800 0 0x80000000 0x80000000 0 0x00020000   /* configuration space */
+				0x81000000 0 0	 0x80020000 0 0x00010000   /* downstream I/O */
+				0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
 			status = "disabled";
 		};
 
arch/arm/boot/dts/spear13xx.dtsi +2 -2
index 3a72508..a6eb543 100644
@@ -83,8 +83,8 @@
 		#size-cells = <1>;
 		compatible = "simple-bus";
 		ranges = <0x50000000 0x50000000 0x10000000
-			  0xb0000000 0xb0000000 0x10000000
-			  0xd0000000 0xd0000000 0x02000000
+			  0x80000000 0x80000000 0x20000000
+			  0xb0000000 0xb0000000 0x22000000
 			  0xd8000000 0xd8000000 0x01000000
 			  0xe0000000 0xe0000000 0x10000000>;
 
arch/arm/mach-spear/Kconfig +3 -0
index ba57677..6fd4dc8 100644
@@ -20,6 +20,7 @@ config ARCH_SPEAR13XX
 	select HAVE_ARM_TWD if SMP
 	select PINCTRL
 	select MFD_SYSCON
+	select MIGHT_HAVE_PCI
 	help
 	  Supports for ARM's SPEAR13XX family
 
@@ -28,12 +29,14 @@ if ARCH_SPEAR13XX
 config MACH_SPEAR1310
 	bool "SPEAr1310 Machine support with Device Tree"
 	select PINCTRL_SPEAR1310
+	select PHY_ST_SPEAR1310_MIPHY
 	help
 	  Supports ST SPEAr1310 machine configured via the device-tree
 
 config MACH_SPEAR1340
 	bool "SPEAr1340 Machine support with Device Tree"
 	select PINCTRL_SPEAR1340
+	select PHY_ST_SPEAR1340_MIPHY
 	help
 	  Supports ST SPEAr1340 machine configured via the device-tree
 
arch/arm/mach-spear/spear1340.c +1 -124

137 lines not on this page · raw message

Signature · 1 line
2.0.0.rc2
#21 lore raw

PATCH v9 7/7 ARM: SPEAr13xx: Update defconfigs

In reply to Viresh Kumar

From: Mohit Kumar <[email protected]>

Enable PCIe, EABI, VFP and NFS configs in default configuration file for SPEAr13xx.

---
 arch/arm/configs/spear13xx_defconfig | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/configs/spear13xx_defconfig +16 -0
index 82eaa55..d271b26 100644
@@ -11,13 +11,24 @@ CONFIG_ARCH_SPEAR13XX=y
 CONFIG_MACH_SPEAR1310=y
 CONFIG_MACH_SPEAR1340=y
 # CONFIG_SWP_EMULATE is not set
+CONFIG_PCI=y
+CONFIG_PCI_MSI=y
+CONFIG_PCIE_SPEAR13XX=y
 CONFIG_SMP=y
 # CONFIG_SMP_ON_UP is not set
 # CONFIG_ARM_CPU_TOPOLOGY is not set
+CONFIG_AEABI=y
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
+CONFIG_VFP=y
 CONFIG_BINFMT_MISC=y
 CONFIG_NET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_NET_IPIP=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_MTD=y
 CONFIG_MTD_OF_PARTS=y
@@ -27,6 +38,7 @@ CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_FSMC=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=16384
+CONFIG_BLK_DEV_SD=y
 CONFIG_ATA=y
 # CONFIG_SATA_PMP is not set
 CONFIG_SATA_AHCI_PLATFORM=y
@@ -66,6 +78,7 @@ CONFIG_USB=y
 # CONFIG_USB_DEVICE_CLASS is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_STORAGE=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SPEAR=y
@@ -79,11 +92,14 @@ CONFIG_EXT2_FS_SECURITY=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_SECURITY=y
 CONFIG_AUTOFS4_FS=m
+CONFIG_FUSE_FS=y
 CONFIG_MSDOS_FS=m
 CONFIG_VFAT_FS=m
 CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
 CONFIG_TMPFS=y
 CONFIG_JFFS2_FS=y
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
 CONFIG_NLS_DEFAULT="utf8"
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ASCII=m
Signature · 1 line
2.0.0.rc2
#22 lore raw

v9 cover ARM: SPEAr13xx: Add PCIe support

In reply to Viresh Kumar
Quoted 10 lines · Viresh Kumar

This adds PCIe support for ARM based ST Microelectronics SPEAr13xx SoCs.

V8 was here: https://lkml.org/lkml/2014/4/15/260 and just before being pulled by Olof this happened: https://lkml.org/lkml/2014/7/9/641.

An detailed look at the patches make it clear why Olof was unhappy. Patches weren't in right order, groups, etc..

So, this is an attempt to fix all those issues. Pushed here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git spear/pcie-support-v9

It may not be worth enough to send V10 as there aren't many updates. I have provided proper diff's in response to the comments I got.

V10 is here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git
spear/pcie-support-v10

Let me know if something is still missing before I send a pull request tomorrow.

--
Viresh