dra7xx: get pcie working in mainline
Subsystems (6)
cover dra7xx: get pcie working in mainline
This series adds pdata-quirk mechanism to reset PCIe as a temporary fix till reset controller driver is added in mainline.
Without this series, a stall is observed if pci dra7xx driver is enabled.
Kishon Vijay Abraham I (3):
ARM: DRA7: hwmod: Add reset data for PCIe
HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe
HACK: pci: dra7xx: use pdata callbacks to perform reset
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 15 ++++++++++++++ arch/arm/mach-omap2/pdata-quirks.c | 11 ++++++++++ arch/arm/mach-omap2/prm7xx.h | 1 + drivers/pci/host/pci-dra7xx.c | 32 +++++++++++++++++++++++++++++ include/linux/platform_data/pci-dra7xx.h | 22 ++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 include/linux/platform_data/pci-dra7xx.h
Signature · 1 line
1.7.9.5
PATCH 1/3 ARM: DRA7: hwmod: Add reset data for PCIe
Add PCIe reset data to PCIe hwmods on DRA7x.
--- arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 15 +++++++++++++++ arch/arm/mach-omap2/prm7xx.h | 1 + 2 files changed, 16 insertions(+)
arch/arm/mach-omap2/omap_hwmod_7xx_data.c +15 -0
@@ -1532,14 +1532,21 @@ static struct omap_hwmod_class dra7xx_pciess_hwmod_class = { };/* pcie1 */ +static struct omap_hwmod_rst_info dra7xx_pciess1_resets[] = { + { .name ="pcie" , .rst_shift =0 }, +}; +static struct omap_hwmod dra7xx_pciess1_hwmod = { .name ="pcie1" , .class = &dra7xx_pciess_hwmod_class, .clkdm_name ="pcie_clkdm" , + .rst_lines = dra7xx_pciess1_resets, + .rst_lines_cnt =ARRAY_SIZE (dra7xx_pciess1_resets), .main_clk ="l4_root_clk_div" , .prcm = { .omap4 = { .clkctrl_offs =DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET , + .rstctrl_offs =DRA7XX_RM_L3INIT_PCIESS_RSTCTRL_OFFSET , .context_offs =DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET , .modulemode =MODULEMODE_SWCTRL , },
@@ -1547,14 +1554,22 @@ static struct omap_hwmod dra7xx_pciess1_hwmod = { };/* pcie2 */ +static struct omap_hwmod_rst_info dra7xx_pciess2_resets[] = { + { .name ="pcie" , .rst_shift =1 }, +}; + +/* pcie2 */ static struct omap_hwmod dra7xx_pciess2_hwmod = { .name ="pcie2" , .class = &dra7xx_pciess_hwmod_class, .clkdm_name ="pcie_clkdm" , + .rst_lines = dra7xx_pciess2_resets, + .rst_lines_cnt =ARRAY_SIZE (dra7xx_pciess2_resets), .main_clk ="l4_root_clk_div" , .prcm = { .omap4 = { .clkctrl_offs =DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET , + .rstctrl_offs =DRA7XX_RM_L3INIT_PCIESS_RSTCTRL_OFFSET , .context_offs =DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET , .modulemode =MODULEMODE_SWCTRL , },
arch/arm/mach-omap2/prm7xx.h +1 -0
@@ -360,6 +360,7 @@/* PRM.L3INIT_PRM register offsets */ #define DRA7XX_PM_L3INIT_PWRSTCTRL_OFFSET 0x0000#define DRA7XX_PM_L3INIT_PWRSTST_OFFSET 0x0004 +#define DRA7XX_RM_L3INIT_PCIESS_RSTCTRL_OFFSET 0x0010#define DRA7XX_PM_L3INIT_MMC1_WKDEP_OFFSET 0x0028#define DRA7XX_RM_L3INIT_MMC1_CONTEXT_OFFSET 0x002c#define DRA7XX_PM_L3INIT_MMC2_WKDEP_OFFSET 0x0030
Signature · 1 line
1.7.9.5
PATCH 2/3 HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe
In reply to Kishon Vijay Abraham IUse pdata-quirks to reset PCIe IP. This is to be used until a drivers/reset/ interface is available for this purpose.
--- arch/arm/mach-omap2/pdata-quirks.c | 11 +++++++++++ include/linux/platform_data/pci-dra7xx.h | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 include/linux/platform_data/pci-dra7xx.h
arch/arm/mach-omap2/pdata-quirks.c +11 -0
@@ -23,6 +23,7 @@#include <linux/platform_data/pinctrl-single.h> #include <linux/platform_data/iommu-omap.h> #include <linux/platform_data/wkup_m3.h> +#include <linux/platform_data/pci-dra7xx.h> #include "common.h" #include "common-board-devices.h"
@@ -404,6 +405,14 @@ static void __init omap5_uevm_legacy_init(void) }#endif +#ifdef CONFIG_SOC_DRA7XX +static struct pci_dra7xx_platform_data dra7xx_pci_pdata = { + .reset_name ="pcie" , + .assert_reset = omap_device_assert_hardreset, + .deassert_reset = omap_device_deassert_hardreset, +}; +#endif +static struct pcs_pdata pcs_pdata;void omap_pcs_legacy_init (int irq,void (*rearm)(void ))
@@ -474,6 +483,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {#endif #ifdef CONFIG_SOC_DRA7XX OF_DEV_AUXDATA ("ti,dra7-padconf" ,0x4a003400 ,"4a003400.pinmux" , &pcs_pdata), +OF_DEV_AUXDATA ("ti,dra7-pcie" ,0x51000000 ,"51000000.pcie" , &dra7xx_pci_pdata), +OF_DEV_AUXDATA ("ti,dra7-pcie" ,0x51800000 ,"51800000.pcie" , &dra7xx_pci_pdata), #endif #ifdef CONFIG_SOC_AM43XX OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata),
include/linux/platform_data/pci-dra7xx.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* pcie-dra7xx - Platform data for PCIe controller +* +* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ +* +* Authors: Kishon Vijay Abraham I <[email protected]> +* +* 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. +*/ + +#ifndef __PCI_DRA7XX_H +#define __PCI_DRA7XX_H + +struct pci_dra7xx_platform_data { +const char *reset_name; + +int (*assert_reset)(struct platform_device *pdev,const char *name); +int (*deassert_reset)(struct platform_device *pdev,const char *name); +}; +#endif /* __PCI_DRA7XX_H */
Signature · 1 line
1.7.9.5
PATCH 3/3 HACK: pci: dra7xx: use pdata callbacks to perform reset
In reply to Kishon Vijay Abraham IUse platform populated reset assert and deassert
callbacks to perform reset of PCIe.
Use these callbacks until a reset interface using drivers/reset is available for the purpose.
--- drivers/pci/host/pci-dra7xx.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/pci/host/pci-dra7xx.c +32 -0
@@ -25,6 +25,8 @@#include <linux/resource.h> #include <linux/types.h> +#include <linux/platform_data/pci-dra7xx.h> +#include "pcie-designware.h" /* PCIe controller wrapper DRA7XX configuration registers */
@@ -329,6 +331,32 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,return 0 ; } +static int dra7xx_pcie_reset (struct platform_device *pdev) +{ +int ret; +struct device *dev = &pdev->dev; +struct pci_dra7xx_platform_data *pdata = pdev->dev.platform_data; + +if (!(pdata && pdata->deassert_reset && pdata->assert_reset)) { +dev_err (dev,"platform data for reset not found!\n" ); +return -EINVAL ; + } + + ret = pdata->assert_reset (pdev, pdata->reset_name); +if (ret) { +dev_err (dev,"assert_reset failed: %d\n" , ret); +return ret; + } + + ret = pdata->deassert_reset (pdev, pdata->reset_name); +if (ret) { +dev_err (dev,"deassert_reset failed: %d\n" , ret); +return ret; + } + +return 0 ; +} +static int __init dra7xx_pcie_probe (struct platform_device *pdev) {u32 reg;
@@ -347,6 +375,10 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)enum of_gpio_flags flags;unsigned long gpio_flags; + ret =dra7xx_pcie_reset (pdev); +if (ret) +return ret; + dra7xx =devm_kzalloc (dev,sizeof (*dra7xx),GFP_KERNEL );if (!dra7xx)return -ENOMEM ;
Signature · 1 line
1.7.9.5
Hi Kishon,
Quoted 10 lines · Kishon Vijay Abraham I
This series adds pdata-quirk mechanism to reset PCIe as a temporary fix till reset controller driver is added in mainline.
Without this series, a stall is observed if pci dra7xx driver is enabled.
Kishon Vijay Abraham I (3):
ARM: DRA7: hwmod: Add reset data for PCIe
HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe
HACK: pci: dra7xx: use pdata callbacks to perform reset
Please drop the HACK: tag from the commit headers, that was an internal convention/choice made by Sekhar, and we had our differences there as it is. On the same note, my internal Reviewed-by also mean nothing as they were done against a different kernel.
regards
Suman
Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 15 ++++++++++++++ arch/arm/mach-omap2/pdata-quirks.c | 11 ++++++++++ arch/arm/mach-omap2/prm7xx.h | 1 + drivers/pci/host/pci-dra7xx.c | 32 +++++++++++++++++++++++++++++ include/linux/platform_data/pci-dra7xx.h | 22 ++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 include/linux/platform_data/pci-dra7xx.h