PCIe support for DRA7xx
Subsystems (10)
v2 cover PCIe support for DRA7xx
This patch series adds support for PCIe in DRA7xx including drivers and dt data. PCIe in DRA7xx uses desingware IP and hence this re-uses the pcie desingware driver (pcie-designware.c) by Jingoo.
The last couple of patches are marked as *TEMP* since the TI reset driver [1] is not yet merged and is in RFC.
Tested broadcom PCIe card and XIO2000 bridge along with DGE530T ethernet card.
Changes from v1:
* removed external clock support fro APLL since the clock framework patches are still in RFC.
* The configuration address space should be given in *reg* and made the corresponding driver changes in pcie-designware.c
* Used untraslated address while programming ATU since that is needed for DRA7. With this PCIe should be made the child node of axi.
* Used a new irq domain for PCIe legacy interrupts.
* Added clocks and dt data for the second instance of PCIe controller (with status = disabled).
Changes from RFC:
* Added external clock support for PCIE APLL
* Miscellaneous cleanups in Documentation, macro naming etc..
[1] -> http://www.spinics.net/lists/linux-omap/msg106411.html
Keerthy (2):
ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to
dpll_pcie_ref_m2ldo_ck
Kishon Vijay Abraham I (16):
phy: phy-omap-pipe3: Add support for PCIe PHY
phy: pipe3: insert delay to enumerate in GEN2 mode
PCI: designware: Configuration space should be specified in 'reg'
PCI: designware: use untranslated address while programming ATU
PCI: host: pcie-dra7xx: add support for pcie-dra7xx controller
arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy
arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems
ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
ARM: dts: dra7: Add dt data for PCIe PHY control module
ARM: dts: dra7xx-clocks: rename pcie clocks to accommodate second PHY
instance
ARM: dts: dra7xx-clocks: Add missing clocks for second PCIe PHY
instance
ARM: dts: dra7: Add dt data for PCIe PHY
ARM: dts: dra7: Add dt data for PCIe controller
ARM: OMAP: Enable PCI for DRA7
PCI: host: pcie-dra7xx: use reset framework APIs to reset PCIe
ARM: dts: dra7: Add *resets* property for PCIe dt node
.../devicetree/bindings/pci/designware-pcie.txt | 1 + Documentation/devicetree/bindings/pci/ti-pci.txt | 63 +++ Documentation/devicetree/bindings/phy/ti-phy.txt | 20 +- arch/arm/boot/dts/dra7.dtsi | 127 ++++++ arch/arm/boot/dts/dra7xx-clocks.dtsi | 39 +- arch/arm/mach-omap2/Kconfig | 2 + arch/arm/mach-omap2/cm2_7xx.h | 4 + arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 112 +++++ arch/arm/mach-omap2/prm7xx.h | 4 + drivers/pci/host/Kconfig | 10 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-dra7xx.c | 470 ++++++++++++++++++++ drivers/pci/host/pcie-designware.c | 66 ++- drivers/pci/host/pcie-designware.h | 4 + drivers/phy/phy-omap-control.c | 52 ++- drivers/phy/phy-ti-pipe3.c | 101 ++++- include/linux/phy/omap_control_phy.h | 10 + 17 files changed, 1041 insertions(+), 45 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt create mode 100644 drivers/pci/host/pci-dra7xx.c
Signature · 1 line
1.7.9.5
PATCH v2 1/18 phy: phy-omap-pipe3: Add support for PCIe PHY
PCIe PHY uses an external pll instead of the internal pll used by SATA and USB3. So added support in pipe3 PHY to use external pll.
--- Documentation/devicetree/bindings/phy/ti-phy.txt | 8 +- drivers/phy/phy-ti-pipe3.c | 99 +++++++++++++++++----- 2 files changed, 84 insertions(+), 23 deletions(-)
Documentation/devicetree/bindings/phy/ti-phy.txt +6 -2
@@ -56,8 +56,8 @@ usb2phy at 4a0ad080 { TI PIPE3 PHY Required properties: - - compatible: Should be "ti,phy-usb3" or "ti,phy-pipe3-sata". - "ti,omap-usb3" is deprecated. + - compatible: Should be "ti,phy-usb3", "ti,phy-pipe3-sata" or + "ti,phy-pipe3-pcie. "ti,omap-usb3" is deprecated. - reg : Address and length of the register set for the device. - reg-names: The names of the register addresses corresponding to the registers filled in "reg".
@@ -69,6 +69,10 @@ Required properties: * "wkupclk" - wakeup clock. * "sysclk" - system clock. * "refclk" - reference clock. + * "dpll_ref" - external dpll ref clk + * "dpll_ref_m2" - external dpll ref clk + * "phy-div" - divider for apll + * "div-clk" - apll clock Optional properties: - ctrl-module : phandle of the control module used by PHY driver to power on
drivers/phy/phy-ti-pipe3.c +78 -21
160 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 2/18 phy: pipe3: insert delay to enumerate in GEN2 mode
In reply to Kishon Vijay Abraham I8-bit delay value (0xF1) is required for GEN2 devices to be enumerated consistently. Added an API to be called from PHY drivers to set this delay value and called it from PIPE3 driver to set the delay value.
--- Documentation/devicetree/bindings/phy/ti-phy.txt | 12 ++--- drivers/phy/phy-omap-control.c | 52 +++++++++++++++++++++- drivers/phy/phy-ti-pipe3.c | 4 +- include/linux/phy/omap_control_phy.h | 10 +++++ 4 files changed, 71 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/phy/ti-phy.txt +7 -5
@@ -9,15 +9,17 @@ Required properties: e.g. USB2_PHY on OMAP5. "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control e.g. USB3 PHY and SATA PHY on OMAP5. + "ti,control-phy-pcie" - for pcie to support external clock for pcie and to + set PCS delay value. + e.g. PCIE PHY in DRA7x "ti,control-phy-usb2-dra7" - if it has power down register like USB2 PHY on DRA7 platform. "ti,control-phy-usb2-am437" - if it has power down register like USB2 PHY on AM437 platform. - - reg : Address and length of the register set for the device. It contains - the address of "otghs_control" for control-phy-otghs or "power" register - for other types. - - reg-names: should be "otghs_control" control-phy-otghs and "power" for - other types. + - reg : register ranges as listed in the reg-names property + - reg-names: "otghs_control" for control-phy-otghs + "power", "pcie_pcs" and "control_sma" for control-phy-pcie + "power" for all other types omap_control_usb: omap-control-usb at 4a002300 { compatible = "ti,control-phy-otghs";
drivers/phy/phy-omap-control.c +51 -1
88 lines not on this page · raw message
drivers/phy/phy-ti-pipe3.c +3 -1
@@ -216,8 +216,10 @@ static int ti_pipe3_init(struct phy *x)u32 val;int ret =0 ; -if (of_device_is_compatible (phy->dev->of_node,"ti,phy-pipe3-pcie" )) +if (of_device_is_compatible (phy->dev->of_node,"ti,phy-pipe3-pcie" )) { +omap_control_pcie_pcs (phy->control_dev,0x1 ,0xF1 );return 0 ; + }/* Bring it out of IDLE if it is IDLE */ val =ti_pipe3_readl (phy->pll_ctrl_base,PLL_CONFIGURATION2 );
include/linux/phy/omap_control_phy.h +10 -0
@@ -23,6 +23,7 @@ enum omap_control_phy_type {OMAP_CTRL_TYPE_OTGHS =1 ,/* Mailbox OTGHS_CONTROL */ OMAP_CTRL_TYPE_USB2 ,/* USB2_PHY, power down in CONTROL_DEV_CONF */ OMAP_CTRL_TYPE_PIPE3 ,/* PIPE3 PHY, DPLL & seperate Rx/Tx power */ +OMAP_CTRL_TYPE_PCIE ,/* RX TX control of ACSPCIE */ OMAP_CTRL_TYPE_DRA7USB2 ,/* USB2 PHY, power and power_aux e.g. DRA7 */ OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ };
@@ -33,6 +34,7 @@ struct omap_control_phy {u32 __iomem *otghs_control;u32 __iomem *power;u32 __iomem *power_aux; +u32 __iomem *pcie_pcs;struct clk *sys_clk;
@@ -63,6 +65,9 @@ enum omap_control_usb_mode {#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0 +#define OMAP_CTRL_PCIE_PCS_MASK 0xff +#define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 0x8 +#define OMAP_CTRL_USB2_PHY_PD BIT(28)#define AM437X_CTRL_USB2_PHY_PD BIT(0)
@@ -74,6 +79,7 @@ enum omap_control_usb_mode {void omap_control_phy_power (struct device *dev,int on);void omap_control_usb_set_mode (struct device *dev,enum omap_control_usb_mode mode); +void omap_control_pcie_pcs (struct device *dev,u8 id,u8 delay);#else static inline void omap_control_phy_power (struct device *dev,int on)
@@ -84,6 +90,10 @@ static inline void omap_control_usb_set_mode(struct device *dev, enum omap_control_usb_mode mode) { } + +static inline void omap_control_pcie_pcs (struct device *dev,u8 id,u8 delay) +{ +}#endif #endif /* __OMAP_CONTROL_PHY_H__ */
Signature · 1 line
1.7.9.5
PATCH v2 3/18 PCI: designware: Configuration space should be specified in 'reg'
In reply to Kishon Vijay Abraham IThe configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pci/designware-pcie.txt +1 -0
@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here. - interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.
drivers/pci/host/pcie-designware.c +15 -2
@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h"
@@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = {int __init dw_pcie_host_init (struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;int i; + cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" ); + } +if (of_pci_range_parser_init (&parser, np)) {dev_err (pp->dev,"missing ranges property\n" );return -EINVAL ;
@@ -429,6 +442,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)of_pci_range_to_resource (&range, np, &pp->cfg); pp->config.cfg0_size =resource_size (&pp->cfg)/2 ; pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; } }
@@ -441,8 +456,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } } - pp->cfg0_base = pp->cfg.start; - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; pp->mem_base = pp->mem.start; pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,
Signature · 1 line
1.7.9.5
PATCH v2 4/18 PCI: designware: use untranslated address while programming ATU
In reply to Kishon Vijay Abraham IIn DRA7, the cpu sees 32bit address, but the pcie controller can see only 28bit address. So whenever the cpu issues a read/write request, the 4 most significant bits are used by L3 to determine the target controller. For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe controller but the PCIe controller will see only (0x000_0000 - 0xFFF_FFF). So for programming the outbound translation window the *base* should be programmed as 0x000_0000. Whenever we try to write to say 0x2000_0000, it will be translated to whatever we have programmed in the translation window with base as 0x000_0000.
This is needed when the dt node is modelled something like below
axi {
compatible = "simple-bus";
#size-cells = <1>;
#address-cells = <1>;
ranges = <0x0 0x20000000 0x10000000 // 28-bit bus
0x51000000 0x51000000 0x3000>;
pcie at 51000000 {
reg = <0x1000 0x2000>, <0x51002000 0x14c>, <0x51000000 0x2000>;
reg-names = "config", "ti_conf", "rc_dbics";
#address-cells = <3>;
#size-cells = <2>;
ranges = <0x81000000 0 0 0x03000 0 0x00010000
0x82000000 0 0x20013000 0x13000 0 0xffed000>;
};
};Here the CPU address for configuration space is 0x20013000 and the controller address for configuration space is 0x13000. The controller address should be used while programming the ATU (in order for translation to happen properly in DRA7xx).
--- drivers/pci/host/pcie-designware.c | 49 ++++++++++++++++++++++++++++-------- drivers/pci/host/pcie-designware.h | 4 +++ 2 files changed, 42 insertions(+), 11 deletions(-)
drivers/pci/host/pcie-designware.c +38 -11
@@ -397,8 +397,15 @@ int __init dw_pcie_host_init(struct pcie_port *pp)struct of_pci_range range;struct of_pci_range_parser parser;struct resource *cfg_res; -u32 val; -int i; +u32 val, na, ns; +const __be32 *addrp; +int i, index; + +/* Find the address cell size and the number of cells in order to get +* the untranslated address. +*/ +of_property_read_u32 (np,"#address-cells" , &na); + ns =of_n_size_cells (np); cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" );if (cfg_res) {
@@ -406,6 +413,12 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.cfg1_size =resource_size (cfg_res)/2 ; pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + +/* Find the untranslated configuration space address */ + index =of_property_match_string (np,"reg-names" ,"config" ); + addrp =of_get_address (np, index, false, false); + pp->cfg0_mod_addr =of_read_number (addrp, ns); + pp->cfg1_mod_addr = pp->cfg0_mod_addr + pp->config.cfg0_size; }else {dev_err (pp->dev,"missing *config* reg space\n" ); }
@@ -431,12 +444,20 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.io_size =resource_size (&pp->io); pp->config.io_bus_addr = range.pci_addr; pp->io_base = range.cpu_addr; + +/* Find the untranslated IO space address */ + pp->io_mod_addr =of_read_number (parser.range - + parser.np + na, ns); }if (restype ==IORESOURCE_MEM ) {of_pci_range_to_resource (&range, np, &pp->mem); pp->mem.name ="MEM" ; pp->config.mem_size =resource_size (&pp->mem); pp->config.mem_bus_addr = range.pci_addr; + +/* Find the untranslated MEM space address */ + pp->mem_mod_addr =of_read_number (parser.range - + parser.np + na, ns); }if (restype ==0 ) {of_pci_range_to_resource (&range, np, &pp->cfg);
@@ -444,6 +465,12 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; pp->cfg0_base = pp->cfg.start; pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; + +/* Find the untranslated configuration space address */ + pp->cfg0_mod_addr =of_read_number (parser.range - + parser.np + na, ns); + pp->cfg1_mod_addr = pp->cfg0_mod_addr + + pp->config.cfg0_size; } }
@@ -518,9 +545,9 @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev)/* Program viewport 0 : OUTBOUND : CFG0 */ dw_pcie_writel_rc (pp,PCIE_ATU_REGION_OUTBOUND |PCIE_ATU_REGION_INDEX0 ,PCIE_ATU_VIEWPORT ); -dw_pcie_writel_rc (pp, pp->cfg0_base,PCIE_ATU_LOWER_BASE ); -dw_pcie_writel_rc (pp, (pp->cfg0_base >>32 ),PCIE_ATU_UPPER_BASE ); -dw_pcie_writel_rc (pp, pp->cfg0_base + pp->config.cfg0_size -1 , +dw_pcie_writel_rc (pp, pp->cfg0_mod_addr,PCIE_ATU_LOWER_BASE ); +dw_pcie_writel_rc (pp, (pp->cfg0_mod_addr >>32 ),PCIE_ATU_UPPER_BASE ); +dw_pcie_writel_rc (pp, pp->cfg0_mod_addr + pp->config.cfg0_size -1 ,PCIE_ATU_LIMIT );dw_pcie_writel_rc (pp, busdev,PCIE_ATU_LOWER_TARGET );dw_pcie_writel_rc (pp,0 ,PCIE_ATU_UPPER_TARGET );
@@ -534,9 +561,9 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev)dw_pcie_writel_rc (pp,PCIE_ATU_REGION_OUTBOUND |PCIE_ATU_REGION_INDEX1 ,PCIE_ATU_VIEWPORT );dw_pcie_writel_rc (pp,PCIE_ATU_TYPE_CFG1 ,PCIE_ATU_CR1 ); -dw_pcie_writel_rc (pp, pp->cfg1_base,PCIE_ATU_LOWER_BASE ); -dw_pcie_writel_rc (pp, (pp->cfg1_base >>32 ),PCIE_ATU_UPPER_BASE ); -dw_pcie_writel_rc (pp, pp->cfg1_base + pp->config.cfg1_size -1 , +dw_pcie_writel_rc (pp, pp->cfg1_mod_addr,PCIE_ATU_LOWER_BASE ); +dw_pcie_writel_rc (pp, (pp->cfg1_mod_addr >>32 ),PCIE_ATU_UPPER_BASE ); +dw_pcie_writel_rc (pp, pp->cfg1_mod_addr + pp->config.cfg1_size -1 ,PCIE_ATU_LIMIT );dw_pcie_writel_rc (pp, busdev,PCIE_ATU_LOWER_TARGET );dw_pcie_writel_rc (pp,0 ,PCIE_ATU_UPPER_TARGET );
@@ -549,9 +576,9 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)dw_pcie_writel_rc (pp,PCIE_ATU_REGION_OUTBOUND |PCIE_ATU_REGION_INDEX0 ,PCIE_ATU_VIEWPORT );dw_pcie_writel_rc (pp,PCIE_ATU_TYPE_MEM ,PCIE_ATU_CR1 ); -dw_pcie_writel_rc (pp, pp->mem_base,PCIE_ATU_LOWER_BASE ); -dw_pcie_writel_rc (pp, (pp->mem_base >>32 ),PCIE_ATU_UPPER_BASE ); -dw_pcie_writel_rc (pp, pp->mem_base + pp->config.mem_size -1 , +dw_pcie_writel_rc (pp, pp->mem_mod_addr,PCIE_ATU_LOWER_BASE ); +dw_pcie_writel_rc (pp, (pp->mem_mod_addr >>32 ),PCIE_ATU_UPPER_BASE ); +dw_pcie_writel_rc (pp, pp->mem_mod_addr + pp->config.mem_size -1 ,PCIE_ATU_LIMIT );dw_pcie_writel_rc (pp, pp->config.mem_bus_addr,PCIE_ATU_LOWER_TARGET ); dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr),
drivers/pci/host/pcie-designware.h +4 -0
@@ -36,11 +36,15 @@ struct pcie_port {u8 root_bus_nr;void __iomem *dbi_base;u64 cfg0_base; +u64 cfg0_mod_addr;void __iomem *va_cfg0_base;u64 cfg1_base; +u64 cfg1_mod_addr;void __iomem *va_cfg1_base;u64 io_base; +u64 io_mod_addr;u64 mem_base; +u64 mem_mod_addr;spinlock_t conf_lock;struct resource cfg;struct resource io;
Signature · 1 line
1.7.9.5
PATCH v2 5/18 PCI: host: pcie-dra7xx: add support for pcie-dra7xx controller
In reply to Kishon Vijay Abraham IAdded support for pcie controller in dra7xx. This driver re-uses the designware core code that is already present in kernel.
--- Documentation/devicetree/bindings/pci/ti-pci.txt | 59 +++ drivers/pci/host/Kconfig | 10 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-dra7xx.c | 460 ++++++++++++++++++++++ 4 files changed, 530 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt create mode 100644 drivers/pci/host/pci-dra7xx.c
Documentation/devicetree/bindings/pci/ti-pci.txt new file +59 -0
@@ -0,0 +1,59 @@ +TI PCI Controllers + +PCIe Designware Controller + - compatible: Should be "ti,dra7-pcie"" + - reg : Two register ranges as listed in the reg-names property + - reg-names : The first entry must be "ti-conf" for the TI specific registers + The second entry must be "rc-dbics" for the designware pcie + registers + The third entry must be "config" for the PCIe configurationspace + - phys : list of PHY specifiers (used by generic PHY framework) + - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the + number of PHYs as specified in *phys* property. + - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", + where <X> is the instance number of the pcie from the HW spec. + - interrupts : Two interrupt entries must be specified. The first one is for + main interrupt line and the second for MSI interrupt line. + - #address-cells, + #size-cells, + #interrupt-cells, + device_type, + ranges, + num-lanes, + interrupt-map-mask, + interrupt-map : as specified in ../designware-pcie.txt + +Example: +axi { + compatible = "simple-bus"; + #size-cells = <1>; + #address-cells = <1>; + ranges = <0x51000000 0x51000000 0x3000 + 0x0 0x20000000 0x10000000>; + pcie at 51000000 { + compatible = "ti,dra7-pcie"; + reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; + reg-names = "rc_dbics", "ti_conf", "config"; + interrupts = <0 232 0x4>, <0 233 0x4>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges = <0x81000000 0 0 0x03000 0 0x00010000 + 0x82000000 0 0x20013000 0x13000 0 0xffed000>; + #interrupt-cells = <1>; + num-lanes = <1>; + ti,hwmods = "pcie1"; + phys = <&pcie1_phy>; + phy-names = "pcie-phy0"; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie_intc 1>, + <0 0 0 2 &pcie_intc 2>, + <0 0 0 3 &pcie_intc 3>, + <0 0 0 4 &pcie_intc 4>; + pcie_intc: interrupt-controller { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + }; +};
drivers/pci/host/Kconfig +10 -0
@@ -1,6 +1,16 @@ menu "PCI host controller drivers" depends on PCI +config PCI_DRA7XX + bool "TI DRA7xx PCIe controller" + select PCIE_DW + depends on OF && HAS_IOMEM && TI_PIPE3 + help + Enables support for the PCIE controller present in DRA7xx SoC. There + are two instances of PCIE controller in DRA7xx. This controller can + act both as EP and RC. This reuses the same Designware core as used + by other SoCs. + config PCI_MVEBU bool "Marvell EBU PCIe controller" depends on ARCH_MVEBU || ARCH_DOVE || ARCH_KIRKWOOD
drivers/pci/host/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o obj-$(CONFIG_PCI_IMX6) += pci-imx6.o obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
drivers/pci/host/pci-dra7xx.c new file +460 -0
460 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 6/18 ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
In reply to Kishon Vijay Abraham IFrom: Keerthy <[email protected]>
Add divider table to optfclk_pciephy_div clock. The Documentation for divider clock can be found at ../clock/ti/divider.txt
--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -0
@@ -1170,6 +1170,7 @@ clocks = <&apll_pcie_ck>; #clock-cells = <0>; reg = <0x021c>; + ti,dividers = <2>, <1>; ti,bit-shift = <8>; ti,max-div = <2>; };
Signature · 1 line
1.7.9.5
PATCH v2 7/18 ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck
In reply to Kishon Vijay Abraham IFrom: Keerthy <[email protected]>
Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck from dpll_pcie_ref_ck.
--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
@@ -1152,7 +1152,7 @@ apll_pcie_in_clk_mux: apll_pcie_in_clk_mux at 4ae06118 { compatible = "ti,mux-clock"; - clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>; + clocks = <&dpll_pcie_ref_m2ldo_ck>, <&pciesref_acs_clk_ck>; #clock-cells = <0>; reg = <0x021c 0x4>; ti,bit-shift = <7>;
Signature · 1 line
1.7.9.5
PATCH v2 8/18 arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy
In reply to Kishon Vijay Abraham IAdded hwmod data for pcie1 and pcie2 phy present in DRA7xx SOC. Also added the missing CLKCTRL OFFSET macro and CONTEXT OFFSET macro for pcie1 phy and pcie2 phy.
--- arch/arm/mach-omap2/cm2_7xx.h | 4 ++ arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 57 +++++++++++++++++++++++++++++ arch/arm/mach-omap2/prm7xx.h | 4 ++ 3 files changed, 65 insertions(+)
arch/arm/mach-omap2/cm2_7xx.h +4 -0
@@ -357,6 +357,10 @@#define DRA7XX_CM_L3INIT_SATA_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x0088)#define DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET 0x00a0#define DRA7XX_CM_PCIE_STATICDEP_OFFSET 0x00a4 +#define DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET 0x00b0 +#define DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x00b0) +#define DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET 0x00b8 +#define DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x00b8)#define DRA7XX_CM_GMAC_CLKSTCTRL_OFFSET 0x00c0#define DRA7XX_CM_GMAC_STATICDEP_OFFSET 0x00c4#define DRA7XX_CM_GMAC_DYNAMICDEP_OFFSET 0x00c8
arch/arm/mach-omap2/omap_hwmod_7xx_data.c +57 -0
75 lines not on this page · raw message
arch/arm/mach-omap2/prm7xx.h +4 -0
@@ -374,6 +374,10 @@#define DRA7XX_RM_L3INIT_IEEE1500_2_OCP_CONTEXT_OFFSET 0x007c#define DRA7XX_PM_L3INIT_SATA_WKDEP_OFFSET 0x0088#define DRA7XX_RM_L3INIT_SATA_CONTEXT_OFFSET 0x008c +#define DRA7XX_PM_L3INIT_PCIESS1_WKDEP_OFFSET 0x00b0 +#define DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET 0x00b4 +#define DRA7XX_PM_L3INIT_PCIESS2_WKDEP_OFFSET 0x00b8 +#define DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET 0x00bc#define DRA7XX_RM_GMAC_GMAC_CONTEXT_OFFSET 0x00d4#define DRA7XX_RM_L3INIT_OCP2SCP1_CONTEXT_OFFSET 0x00e4#define DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET 0x00ec
Signature · 1 line
1.7.9.5
PATCH v2 9/18 arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems
In reply to Kishon Vijay Abraham IAdded hwmod data for pcie1 and pcie2 subsystem present in DRA7xx SOC.
--- arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
arch/arm/mach-omap2/omap_hwmod_7xx_data.c +55 -0
@@ -1231,6 +1231,43 @@ static struct omap_hwmod dra7xx_ocp2scp3_hwmod = { };/* +* 'PCIE' class +* +*/ + +static struct omap_hwmod_class dra7xx_pcie_hwmod_class = { + .name ="pcie" , +}; + +/* pcie1 */ +static struct omap_hwmod dra7xx_pcie1_hwmod = { + .name ="pcie1" , + .class = &dra7xx_pcie_hwmod_class, + .clkdm_name ="l3init_clkdm" , + .main_clk ="l4_root_clk_div" , + .prcm = { + .omap4 = { + .clkctrl_offs =DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET , + .modulemode =MODULEMODE_SWCTRL , + }, + }, +}; + +/* pcie2 */ +static struct omap_hwmod dra7xx_pcie2_hwmod = { + .name ="pcie2" , + .class = &dra7xx_pcie_hwmod_class, + .clkdm_name ="l3init_clkdm" , + .main_clk ="l4_root_clk_div" , + .prcm = { + .omap4 = { + .clkctrl_offs =DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET , + .modulemode =MODULEMODE_SWCTRL , + }, + }, +}; + +/* * 'PCIE PHY' class * */
@@ -2388,6 +2425,22 @@ static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp1 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* l4_cfg -> pcie1 */ +static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1 = { + .master = &dra7xx_l4_cfg_hwmod, + .slave = &dra7xx_pcie1_hwmod, + .clk ="l4_root_clk_div" , + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* l4_cfg -> pcie2 */ +static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie2 = { + .master = &dra7xx_l4_cfg_hwmod, + .slave = &dra7xx_pcie2_hwmod, + .clk ="l4_root_clk_div" , + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; +/* l4_cfg -> pcie1 phy */ static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1_phy = { .master = &dra7xx_l4_cfg_hwmod,
@@ -2751,6 +2804,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { &dra7xx_l4_cfg__mpu, &dra7xx_l4_cfg__ocp2scp1, &dra7xx_l4_cfg__ocp2scp3, + &dra7xx_l4_cfg__pcie1, + &dra7xx_l4_cfg__pcie2, &dra7xx_l4_cfg__pcie1_phy, &dra7xx_l4_cfg__pcie2_phy, &dra7xx_l3_main_1__qspi,
Signature · 1 line
1.7.9.5
PATCH v2 10/18 ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
In reply to Kishon Vijay Abraham IAdded missing 32khz clock used by PCIe PHY.
The documention for this node can be found @ ../bindings/clock/ti/gate.txt.
--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/dra7xx-clocks.dtsi +8 -0
@@ -1165,6 +1165,14 @@ reg = <0x021c>, <0x0220>; }; + optfclk_pciephy_32khz: optfclk_pciephy_32khz at 4a0093b0 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b0>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;
Signature · 1 line
1.7.9.5
PATCH v2 11/18 ARM: dts: dra7: Add dt data for PCIe PHY control module
In reply to Kishon Vijay Abraham IAdded dt data for PCIe PHY control module used by PCIe PHY. The documention for this node can be found @ ../bindings/phy/ti-phy.txt
--- arch/arm/boot/dts/dra7.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm/boot/dts/dra7.dtsi +17 -0
@@ -803,6 +803,23 @@ status = "disabled"; }; + omap_control_pcie1phy: omap-control-pciephy at 0x4a003c40 { + compatible = "ti,control-phy-pcie"; + reg = <0x4a003c40 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>; + reg-names = "power", "control_sma", "pcie_pcs"; + clocks = <&sys_clkin1>; + clock-names = "sysclk"; + }; + + omap_control_pcie2phy: omap-control-pciephy at 0x4a003c44 { + compatible = "ti,control-phy-pcie"; + reg = <0x4a003c44 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>; + reg-names = "power", "control_sma", "pcie_pcs"; + clocks = <&sys_clkin1>; + clock-names = "sysclk"; + status = "disabled"; + }; + omap_control_usb2phy1: control-phy at 4a002300 { compatible = "ti,control-phy-usb2"; reg = <0x4a002300 0x4>;
Signature · 1 line
1.7.9.5
PATCH v2 12/18 ARM: dts: dra7xx-clocks: rename pcie clocks to accommodate second PHY instance
In reply to Kishon Vijay Abraham IThere are two instances of PCIe PHY in DRA7xx. So renamed optfclk_pciephy_32khz, optfclk_pciephy_clk and optfclk_pciephy_div_clk to optfclk_pciephy1_32khz, optfclk_pciephy1_clk and optfclk_pciephy1_div_clk respectively. This is needed for adding the clocks for second PCIe PHY instance.
--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +3 -3
@@ -1165,7 +1165,7 @@ reg = <0x021c>, <0x0220>; }; - optfclk_pciephy_32khz: optfclk_pciephy_32khz at 4a0093b0 { + optfclk_pciephy1_32khz: optfclk_pciephy_32khz at 4a0093b0 { compatible = "ti,gate-clock"; clocks = <&sys_32k_ck>; #clock-cells = <0>;
@@ -1183,7 +1183,7 @@ ti,max-div = <2>; }; - optfclk_pciephy_clk: optfclk_pciephy_clk at 4a0093b0 { + optfclk_pciephy1_clk: optfclk_pciephy_clk at 4a0093b0 { compatible = "ti,gate-clock"; clocks = <&apll_pcie_ck>; #clock-cells = <0>;
@@ -1191,7 +1191,7 @@ ti,bit-shift = <9>; }; - optfclk_pciephy_div_clk: optfclk_pciephy_div_clk at 4a0093b0 { + optfclk_pciephy1_div_clk: optfclk_pciephy_div_clk at 4a0093b0 { compatible = "ti,gate-clock"; clocks = <&optfclk_pciephy_div>; #clock-cells = <0>;
Signature · 1 line
1.7.9.5
PATCH v2 13/18 ARM: dts: dra7xx-clocks: Add missing clocks for second PCIe PHY instance
In reply to Kishon Vijay Abraham IAdded missing clocks used by second instance of PCIe PHY.
The documention for this nodes can be found @ ../bindings/clock/ti/gate.txt.
--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/dra7xx-clocks.dtsi +24 -0
@@ -1173,6 +1173,14 @@ ti,bit-shift = <8>; }; + optfclk_pciephy2_32khz: optfclk_pciephy_32khz at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;
@@ -1191,6 +1199,14 @@ ti,bit-shift = <9>; }; + optfclk_pciephy2_clk: optfclk_pciephy_clk at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&apll_pcie_ck>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <9>; + }; + optfclk_pciephy1_div_clk: optfclk_pciephy_div_clk at 4a0093b0 { compatible = "ti,gate-clock"; clocks = <&optfclk_pciephy_div>;
@@ -1199,6 +1215,14 @@ ti,bit-shift = <10>; }; + optfclk_pciephy2_div_clk: optfclk_pciephy_div_clk at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&optfclk_pciephy_div>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <10>; + }; + apll_pcie_clkvcoldo: apll_pcie_clkvcoldo { #clock-cells = <0>; compatible = "fixed-factor-clock";
Signature · 1 line
1.7.9.5
PATCH v2 14/18 ARM: dts: dra7: Add dt data for PCIe PHY
In reply to Kishon Vijay Abraham IAdded dt data for PCIe PHY as a child node of ocp2scp3.
The documention for this node can be found @ ../bindings/phy/ti-phy.txt.
--- arch/arm/boot/dts/dra7.dtsi | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
arch/arm/boot/dts/dra7.dtsi +39 -0
@@ -912,6 +912,45 @@ clock-names = "sysclk"; #phy-cells = <0>; }; + + pcie1_phy: pciephy at 4a094000 { + compatible = "ti,phy-pipe3-pcie"; + reg = <0x4A094000 0x80>, /* phy_rx */ + <0x4A094400 0x64>; /* phy_tx */ + reg-names = "phy_rx", "phy_tx"; + ctrl-module = <&omap_control_pcie1phy>; + clocks = <&dpll_pcie_ref_ck>, + <&dpll_pcie_ref_m2ldo_ck>, + <&optfclk_pciephy1_32khz>, + <&optfclk_pciephy1_clk>, + <&optfclk_pciephy1_div_clk>, + <&optfclk_pciephy_div>; + clock-names = "dpll_ref", "dpll_ref_m2", + "wkupclk", "refclk", + "div-clk", "phy-div"; + #phy-cells = <0>; + ti,hwmods = "pcie1-phy"; + }; + + pcie2_phy: pciephy at 4a095000 { + compatible = "ti,phy-pipe3-pcie"; + reg = <0x4A095000 0x80>, /* phy_rx */ + <0x4A095400 0x64>; /* phy_tx */ + reg-names = "phy_rx", "phy_tx"; + ctrl-module = <&omap_control_pcie1phy>; + clocks = <&dpll_pcie_ref_ck>, + <&dpll_pcie_ref_m2ldo_ck>, + <&optfclk_pciephy2_32khz>, + <&optfclk_pciephy2_clk>, + <&optfclk_pciephy2_div_clk>, + <&optfclk_pciephy_div>; + clock-names = "dpll_ref", "dpll_ref_m2", + "wkupclk", "refclk", + "div-clk", "phy-div"; + #phy-cells = <0>; + ti,hwmods = "pcie2-phy"; + status = "disabled"; + }; }; omap_dwc3_1 at 48880000 {
Signature · 1 line
1.7.9.5
PATCH v2 15/18 ARM: dts: dra7: Add dt data for PCIe controller
In reply to Kishon Vijay Abraham IAdded dt data for PCIe controller. This node contains dt data for both the DRA7 part of designware controller and for the designware core. The documention for this node can be found @ ../bindings/pci/ti-pci.txt.
--- arch/arm/boot/dts/dra7.dtsi | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
arch/arm/boot/dts/dra7.dtsi +69 -0
@@ -1036,6 +1036,75 @@ }; }; + axi at 0 { + compatible = "simple-bus"; + #size-cells = <1>; + #address-cells = <1>; + ranges = <0x51000000 0x51000000 0x3000 + 0x0 0x20000000 0x10000000>; + pcie at 51000000 { + compatible = "ti,dra7-pcie"; + reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; + reg-names = "rc_dbics", "ti_conf", "config"; + interrupts = <0 232 0x4>, <0 233 0x4>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges = <0x81000000 0 0 0x03000 0 0x00010000 + 0x82000000 0 0x20013000 0x13000 0 0xffed000>; + #interrupt-cells = <1>; + num-lanes = <1>; + ti,hwmods = "pcie1"; + phys = <&pcie1_phy>; + phy-names = "pcie-phy0"; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie1_intc 1>, + <0 0 0 2 &pcie1_intc 2>, + <0 0 0 3 &pcie1_intc 3>, + <0 0 0 4 &pcie1_intc 4>; + pcie1_intc: interrupt-controller { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + }; + }; + + axi at 1 { + compatible = "simple-bus"; + #size-cells = <1>; + #address-cells = <1>; + ranges = <0x51800000 0x51800000 0x3000 + 0x0 0x30000000 0x10000000>; + status = "disabled"; + pcie at 51000000 { + compatible = "ti,dra7-pcie"; + reg = <0x51800000 0x2000>, <0x51802000 0x14c>, <0x1000 0x2000>; + reg-names = "rc_dbics", "ti_conf", "config"; + interrupts = <0 355 0x4>, <0 356 0x4>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges = <0x81000000 0 0 0x03000 0 0x00010000 + 0x82000000 0 0x30013000 0x13000 0 0xffed000>; + #interrupt-cells = <1>; + num-lanes = <1>; + ti,hwmods = "pcie2"; + phys = <&pcie2_phy>; + phy-names = "pcie-phy0"; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie2_intc 1>, + <0 0 0 2 &pcie2_intc 2>, + <0 0 0 3 &pcie2_intc 3>, + <0 0 0 4 &pcie2_intc 4>; + pcie2_intc: interrupt-controller { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + }; + }; + sata: sata at 4a141100 { compatible = "snps,dwc-ahci"; reg = <0x4a140000 0x1100>, <0x4a141100 0x7>;
Signature · 1 line
1.7.9.5
PATCH v2 16/18 ARM: OMAP: Enable PCI for DRA7
In reply to Kishon Vijay Abraham INow that we have added PCIe driver for DRA7 SOCs, enable PCI on DRA7 SOCs.
--- arch/arm/mach-omap2/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-omap2/Kconfig +2 -0
@@ -75,6 +75,8 @@ config SOC_DRA7XX select ARM_GIC select HAVE_ARM_ARCH_TIMER select IRQ_CROSSBAR + select MIGHT_HAVE_PCI + select ARCH_SUPPORTS_MSI config ARCH_OMAP2PLUS bool
Signature · 1 line
1.7.9.5
PATCH v2 17/18 PCI: host: pcie-dra7xx: use reset framework APIs to reset PCIe
In reply to Kishon Vijay Abraham IGet reset nodes from dt and use reset framework APIs to reset PCIe. This is needed since reset is handled by the SoC.
--- Documentation/devicetree/bindings/pci/ti-pci.txt | 4 ++++ drivers/pci/host/pci-dra7xx.c | 10 ++++++++++ 2 files changed, 14 insertions(+)
Documentation/devicetree/bindings/pci/ti-pci.txt +4 -0
@@ -22,6 +22,8 @@ PCIe Designware Controller num-lanes, interrupt-map-mask, interrupt-map : as specified in ../designware-pcie.txt + - resets: phandle used if reset is handled be soc + - reset-names: name given to the phandle Example: axi {
@@ -45,6 +47,8 @@ axi { ti,hwmods = "pcie1"; phys = <&pcie1_phy>; phy-names = "pcie-phy0"; + resets = <&prm_resets &device_reset>; + reset-names = "reset"; interrupt-map-mask = <0 0 0 7>; interrupt-map = <0 0 0 1 &pcie_intc 1>, <0 0 0 2 &pcie_intc 2>,
drivers/pci/host/pci-dra7xx.c +10 -0
@@ -22,6 +22,7 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/resource.h> +#include <linux/reset.h> #include <linux/types.h> #include "pcie-designware.h"
@@ -332,6 +333,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;char name[10 ]; +struct reset_control *rstc; dra7xx =devm_kzalloc (dev,sizeof (*dra7xx),GFP_KERNEL );if (!dra7xx)
@@ -355,6 +357,14 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)if (!base)return -ENOMEM ; + rstc =devm_reset_control_get (dev,"reset" ); +if (IS_ERR (rstc)) +return PTR_ERR (rstc); + + ret =reset_control_deassert (rstc); +if (ret) +return ret; + phy_count =of_property_count_strings (np,"phy-names" );if (phy_count <0 ) {dev_err (dev,"unable to find the strings\n" );
Signature · 1 line
1.7.9.5
PATCH v2 18/18 ARM: dts: dra7: Add *resets* property for PCIe dt node
In reply to Kishon Vijay Abraham IAdded *resets* and *reset-names* properies for PCIe dt node. The documention for this node can be found @ ../bindings/pci/ti-pci.txt.
--- arch/arm/boot/dts/dra7.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/dra7.dtsi +2 -0
@@ -1055,6 +1055,8 @@ #interrupt-cells = <1>; num-lanes = <1>; ti,hwmods = "pcie1"; + resets = <&prm_resets &device_reset>; + reset-names = "reset"; phys = <&pcie1_phy>; phy-names = "pcie-phy0"; interrupt-map-mask = <0 0 0 7>;
Signature · 1 line
1.7.9.5
Re: [PATCH v2 16/18] ARM: OMAP: Enable PCI for DRA7
In reply to Kishon Vijay Abraham IQuoted 19 lines · Kishon Vijay Abraham I
Now that we have added PCIe driver for DRA7 SOCs, enable PCI on DRA7 SOCs.
Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/Kconfig | 2 ++ 1 file changed, 2 insertions(+)arch/arm/mach-omap2/Kconfig +0
-0
arch/arm/mach-omap2/Kconfig config SOC_DRA7XX · line 79
Quoted 5 lines
arch/arm/mach-omap2/Kconfig +2
-0@@ -75,6 +75,8 @@ config SOC_DRA7XX select ARM_GIC select HAVE_ARM_ARCH_TIMER select IRQ_CROSSBAR + select MIGHT_HAVE_PCI + select ARCH_SUPPORTS_MSI
Hi Kishon,
Please, don't select ARCH_SUPPORTS_MSI, because this kconfig option was already removed in v3.12 by the commit ebd97be635 ('PCI: remove ARCH_SUPPORTS_MSI kconfig option'). So, there is NO need to select 'ARCH_SUPPORTS_MSI'.
Best regards,
Jingoo Han
Quoted 5 lines
arch/arm/mach-omap2/Kconfig +0
-1config ARCH_OMAP2PLUS bool --1.7.9.5
RE: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Kishon Vijay Abraham IHello Kishon,
Quoted 80 lines
-----Original Message-----
From: Kishon Vijay Abraham I [mailto:kishon at ti.com]
Sent: Thursday, May 29, 2014 12:08 PM
To: devicetree at vger.kernel.org; linux-doc at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-omap at vger.kernel.org; linux- pci at vger.kernel.org; linux-kernel at vger.kernel.org
Cc: arnd at arndb.de; tony at atomide.com; jg1.han at samsung.com; kishon at ti.com; Jason Gunthorpe; Bjorn Helgaas; Mohit KUMAR DCG; Marek Vasut
Subject: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/pci/designware-pcie.txt +1
-0@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here. - interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.drivers/pci/host/pcie- renamed from drivers/pci/host/pcie-designware.c +0
-0
designware.c
index c4e3732..603b386 100644drivers/pci/host/pcie-designware.c +13
-0@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h" @@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = { int __init dw_pcie_host_init(struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;int i; + cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" ); + } +if (of_pci_range_parser_init (&parser, np)) {dev_err (pp->dev,"missing ranges property\n" );return -EINVAL ;
drivers/pci/host/pcie-designware.c int __init dw_pcie_host_init(struct pcie_port *pp) · line 447
Quoted 6 lines
drivers/pci/host/pcie-designware.c +2
-0@@ -429,6 +442,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)of_pci_range_to_resource (&range, np, &pp->cfg); pp->config.cfg0_size =resource_size (&pp->cfg)/2 ; pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp- >config.cfg0_size;
- As you are getting cfg address space as MEM resource, so remove above code that gets the configuration space from dt range. Also correct dt for pcie cfg space for the platforms based on this driver.
Otherwise looks fine to me.
Thanks
Mohit
Quoted 14 lines
drivers/pci/host/pcie-designware.c +0
-3} }@@ -441,8 +456,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } } - pp->cfg0_base = pp->cfg.start; - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; pp->mem_base = pp->mem.start; pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, --1.7.9.5
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
Hi,
Quoted 87 lines · Mohit KUMAR DCG
Hello Kishon,
Quoted 85 lines
-----Original Message-----
From: Kishon Vijay Abraham I [mailto:kishon at ti.com]
Sent: Thursday, May 29, 2014 12:08 PM
To: devicetree at vger.kernel.org; linux-doc at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-omap at vger.kernel.org; linux- pci at vger.kernel.org; linux-kernel at vger.kernel.org
Cc: arnd at arndb.de; tony at atomide.com; jg1.han at samsung.com; kishon at ti.com; Jason Gunthorpe; Bjorn Helgaas; Mohit KUMAR DCG; Marek Vasut
Subject: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/pci/designware-pcie.txt +1
-0@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here. - interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.drivers/pci/host/pcie- renamed from drivers/pci/host/pcie-designware.c +0
-0
designware.c
index c4e3732..603b386 100644drivers/pci/host/pcie-designware.c +15
-0@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h" @@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = { int __init dw_pcie_host_init(struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;int i; + cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" ); + } +if (of_pci_range_parser_init (&parser, np)) {dev_err (pp->dev,"missing ranges property\n" );return -EINVAL ;@@ -429,6 +442,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)of_pci_range_to_resource (&range, np, &pp->cfg); pp->config.cfg0_size =resource_size (&pp->cfg)/2 ; pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp-
Quoted 5 lines
drivers/pci/host/pcie-designware.c int __init dw_pcie_host_init(struct pcie_port *pp) · line 447
Quoted 1 line
drivers/pci/host/pcie-designware.c +0
-0> config.cfg0_size;- As you are getting cfg address space as MEM resource, so remove above code that gets the configuration space from dt range. Also correct dt for pcie cfg space for the platforms based on this driver.
Ok. Will send that as a separate patch converting all platforms to use MEM resource.
Thanks
Kishon
Re: [PATCH v2 16/18] ARM: OMAP: Enable PCI for DRA7
In reply to Jingoo HanHi,
Quoted 28 lines · Jingoo Han
Quoted 19 lines · Kishon Vijay Abraham I
Now that we have added PCIe driver for DRA7 SOCs, enable PCI on DRA7 SOCs.
Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/Kconfig | 2 ++ 1 file changed, 2 insertions(+)arch/arm/mach-omap2/Kconfig +0
-0arch/arm/mach-omap2/Kconfig config SOC_DRA7XX · line 79
Quoted 5 lines
arch/arm/mach-omap2/Kconfig +2
-0@@ -75,6 +75,8 @@ config SOC_DRA7XX select ARM_GIC select HAVE_ARM_ARCH_TIMER select IRQ_CROSSBAR + select MIGHT_HAVE_PCI + select ARCH_SUPPORTS_MSIHi Kishon,
Quoted 4 lines
Please, don't select
ARCH_SUPPORTS_MSI, because this kconfig option was already removed in v3.12 by the commitebd97be635('PCI: removeARCH_SUPPORTS_MSIkconfig option'). So, there is NO need to select 'ARCH_SUPPORTS_MSI'.
Thanks for spotting it. Will remove it.
Thanks
Kishon
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Kishon Vijay Abraham IQuoted 12 lines · Kishon Vijay Abraham I
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>
Quoted 4 lines
---
.../devicetree/bindings/pci/designware-pcie.txt| 1 +drivers/pci/host/pcie-designware.c| 17 +++++++++++++++--2 files changed, 16 insertions(+), 2 deletions(-)
Why should the cfg space be defined in *reg* instead of ranges?
- k
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
Quoted 20 lines · Kumar Gala
Quoted 12 lines · Kishon Vijay Abraham I
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Quoted 4 lines
---
.../devicetree/bindings/pci/designware-pcie.txt| 1 +drivers/pci/host/pcie-designware.c| 17 +++++++++++++++--2 files changed, 16 insertions(+), 2 deletions(-)
Quoted 1 line
Why should the cfg space be defined in *reg* instead of ranges?
Because what you end up using is a struct resource to represent the cfg space and the conversion between ranges and resources breaks down for CFG space (we don't have a flag in the resource flags to say this is CFG resource). Specifying it as a *reg* property makes it a MEM resource and no special casing is needed.
Best regards,
Liviu
Quoted 12 lines
- k
Signature · 7 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 10 lines
-------------------
.oooO
( )
\ ( Oooo.
\_) ( )
) /
(_/
One small step
for me ...Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
Quoted 23 lines · Liviu Dudau
Quoted 20 lines · Kumar Gala
Quoted 12 lines · Kishon Vijay Abraham I
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Quoted 4 lines
---
.../devicetree/bindings/pci/designware-pcie.txt| 1 +drivers/pci/host/pcie-designware.c| 17 +++++++++++++++--2 files changed, 16 insertions(+), 2 deletions(-)Quoted 1 line
Why should the cfg space be defined in *reg* instead of ranges?
Quoted 7 lines
Because what you end up using is a struct resource to represent the cfg space and the conversion between ranges and resources breaks down for CFG space (we don't have a flag in the resource flags to say this is CFG resource). Specifying it as a *reg* property makes it a MEM resource and no special casing is needed.
Best regards,
Liviu
Just because the kernel doesn?t handle this is NO reason to change the way the DT works.
We are probably better of changing of_bus_pci_get_flags() to set IORESOURCE_MEM for cfg type. Will send a patch for this.
- k
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
Quoted 2 lines · Kumar Gala
Just because the kernel doesn?t handle this is NO reason to change the way the DT works.
The OF specs do not specify how to process a config type ranges entry, and we all mutually agreed that the only sane interpretation for such a thing would be to describe an ECAM memory space so generic code could potentially make use of it.
Since designware is not ECAM it should not use config ranges.
This has come up multiple times now, and the above is the consensus.
Jason
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Kishon Vijay Abraham IQuoted 22 lines · KISHON VIJAY
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0
Documentation/devicetree/bindings/pci/designware-pcie.txt Required properties: · line 9
Quoted 4 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +1
-0@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here.
Kishon,
I am working on the Keystone PCI driver for which v1 is already posted. Want to clarify
following.
1. Original text for reg states "base addresses and lengths of the pcie controller,
the phy controller, additional register for the phy controller"
and you added
"The configuration address space should also be specified here"
and the code below added resource name "config"
Does PCI designware follow some convention? Does it mean after applying this patch
config name is mandatory or optional? Below code you are not returning error. Can you
or author of PCI designware clarify what is expected to be present as mandatory and
what is optional.
Does config refers to RC's config space or EP's config space or both? The code below divide
the size by 2. So it appears to be RC's + EP's config space. Please clarify.
Quoted 24 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0- interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.drivers/pci/host/pcie-designware.c +3
-0@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h" @@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = {int __init dw_pcie_host_init (struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;
drivers/pci/host/pcie-designware.c static const struct irq_domain_ops msi_domain_ops = { · line 410
Quoted 10 lines
drivers/pci/host/pcie-designware.c +8
-0int i; + cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" );
This should return error -EINVAL.
Quoted 15 lines
drivers/pci/host/pcie-designware.c +4
-0+ } +if (of_pci_range_parser_init (&parser, np)) {dev_err (pp->dev,"missing ranges property\n" );return -EINVAL ;@@ -429,6 +442,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)of_pci_range_to_resource (&range, np, &pp->cfg); pp->config.cfg0_size =resource_size (&pp->cfg)/2 ; pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; } }
drivers/pci/host/pcie-designware.c int __init dw_pcie_host_init(struct pcie_port *pp) · line 461
Quoted 8 lines
drivers/pci/host/pcie-designware.c +0
-2@@ -441,8 +456,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } } - pp->cfg0_base = pp->cfg.start; - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; pp->mem_base = pp->mem.start; pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,
BTW, Please also review my Keystone series so that we could discuss this topic in that context
as well.
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Jason GunthorpeQuoted 10 lines · Jason Gunthorpe
Quoted 2 lines · Kumar Gala
Just because the kernel doesn?t handle this is NO reason to change the way the DT works.
The OF specs do not specify how to process a config type ranges entry, and we all mutually agreed that the only sane interpretation for such a thing would be to describe an ECAM memory space so generic code could potentially make use of it.
Quoted 5 lines
Since designware is not ECAM it should not use config ranges.
This has come up multiple times now, and the above is the consensus.
Jason
Well the designware controller does support ECAM, just that the current in kernel users don?t do cfg space that way.
So do we continue to support the current users that use a cfg range for a non-ECAM space? Or break their DT and convert them to using regs?
- k
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 16/18] ARM: OMAP: Enable PCI for DRA7
In reply to Kishon Vijay Abraham IQuoted 18 lines · Kishon Vijay Abraham I
Now that we have added PCIe driver for DRA7 SOCs, enable PCI on DRA7 SOCs.
Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/Kconfig | 2 ++ 1 file changed, 2 insertions(+)arch/arm/mach-omap2/Kconfig +0
-0
arch/arm/mach-omap2/Kconfig config SOC_DRA7XX · line 78
Quoted 4 lines
arch/arm/mach-omap2/Kconfig +1
-0@@ -75,6 +75,8 @@ config SOC_DRA7XX select ARM_GIC select HAVE_ARM_ARCH_TIMER select IRQ_CROSSBAR + select MIGHT_HAVE_PCI
I believe we moved or intend to move this under MULTI_PLATFORM, so you don't need this. Will D. had a patch, but I don't think I saw a final version to merge.
Rob
Quoted 7 lines
arch/arm/mach-omap2/Kconfig +1
-1+ select ARCH_SUPPORTS_MSI config ARCH_OMAP2PLUS bool --1.7.9.5
Re: [PATCH v2 16/18] ARM: OMAP: Enable PCI for DRA7
Quoted 14 lines · Rob Herring
Quoted 13 lines · Kishon Vijay Abraham I
Now that we have added PCIe driver for DRA7 SOCs, enable PCI on DRA7 SOCs.
Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
Quoted 13 lines
arch/arm/mach-omap2/Kconfig config SOC_DRA7XX · line 78
Quoted 9 lines
arch/arm/mach-omap2/Kconfig +1
-0@@ -75,6 +75,8 @@ config SOC_DRA7XX select ARM_GIC select HAVE_ARM_ARCH_TIMER select IRQ_CROSSBAR + select MIGHT_HAVE_PCII believe we moved or intend to move this under
MULTI_PLATFORM, so you don't need this. Will D. had a patch, but I don't think I saw a final version to merge.
I posted it earlier this week for somebody in arm-soc to pick up (although I don't think they have done yet):
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/260238.html
Will
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Murali KaricheriHi,
Quoted 41 lines · Murali Karicheri
Quoted 23 lines · KISHON VIJAY
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0Documentation/devicetree/bindings/pci/designware-pcie.txt Required properties: · line 9
Quoted 4 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +1
-0@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here.Kishon,
I am working on the Keystone PCI driver for which v1 is already posted. Want to clarify
following.
1. Original text for reg states "base addresses and lengths of the pcie controller,
the phy controller, additional register for the phy controller" and you
added
"The configuration address space should also be specified here"and the code below added resource name "config"
Quoted 8 lines
Does PCI designware follow some convention? Does it mean after applying this patch config name is mandatory or optional? Below code you are not returning error. Can you
or author of PCI designware clarify what is expected to be present as mandatory and
what is optional.From whatever I could make out from the comments for my previous version,
'config' is mandatory for all new platforms adding support for PCIe DW. However since there already exists platforms that use 'ranges', I'm not returning error. Once all the platforms that use DW is modified to use 'reg', will return error.
Quoted 3 lines
Does config refers to RC's config space or EP's config space or both? The code below divide
In the case of DRA7, it's the space from where you read the configuration space contents of the EP (we have separate address space for the configuration space of RC denoted by *rc_dbics* in this patch series). But there are other platforms where RC does not have a separate configuration address space.
Quoted 1 line
the size by 2. So it appears to be RC's + EP's config space. Please clarify.
No. divide by 2 is for cfg1 and cfg1 is used by PCIe bridges.
Quoted 27 lines
Quoted 27 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0- interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.drivers/pci/host/pcie-designware.c +3
-0@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h" @@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = {int __init dw_pcie_host_init (struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;int i; + cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" );
Quoted 8 lines
drivers/pci/host/pcie-designware.c static const struct irq_domain_ops msi_domain_ops = { · line 410
Quoted 7 lines
drivers/pci/host/pcie-designware.c +7
-0+if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" );This should return error
-EINVAL.
ah.. it'll break for other platforms. It should be part of a different patch once we convert all users to 8reg*.
Quoted 16 lines
Quoted 16 lines
drivers/pci/host/pcie-designware.c +4
-0+ } +if (of_pci_range_parser_init (&parser, np)) {dev_err (pp->dev,"missing ranges property\n" );return -EINVAL ;@@ -429,6 +442,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)of_pci_range_to_resource (&range, np, &pp->cfg); pp->config.cfg0_size =resource_size (&pp->cfg)/2 ; pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; } } @@ -441,8 +456,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp)}
Quoted 8 lines
Quoted 5 lines
} - pp->cfg0_base = pp->cfg.start; - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; pp->mem_base = pp->mem.start; pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,BTW, Please also review my Keystone series so that we could discuss this topic in that context
as well.
sure..
Cheers
Kishon
RE: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Murali KaricheriQuoted 122 lines
-----Original Message-----
From: Murali Karicheri [mailto:m-karicheri2 at ti.com]
Sent: Thursday, May 29, 2014 12:32 PM
To: ABRAHAM, KISHON VIJAY
Cc: devicetree at vger.kernel.org; linux-doc at vger.kernel.org; linux-arm-
kernel at lists.infradead.org; linux-omap at vger.kernel.org; linux-pci at vger.kernel.org; linux- kernel at vger.kernel.org; arnd at arndb.de; tony at atomide.com; jg1.han at samsung.com; Jason Gunthorpe; Bjorn Helgaas; Mohit Kumar; Marek Vasut
Subject: Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'Quoted 23 lines · KISHON VIJAY
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0Documentation/devicetree/bindings/pci/designware-pcie.txt Required properties: · line 9
Quoted 4 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +1
-0@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here.Kishon,
I am working on the Keystone PCI driver for which v1 is already posted. Want to clarify
following.
1. Original text for reg states "base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller"
and you added
"The configuration address space should also be specified here"and the code below added resource name "config"
Does PCI designware follow some convention? Does it mean after applying this patch config name is mandatory or optional? Below code you are not returning error. Can you or author of PCI designware clarify what is expected to be present as mandatory and what is optional.
Does config refers to RC's config space or EP's config space or both? The code below divide
the size by 2. So it appears to be RC's + EP's config space. Please clarify.Quoted 25 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0- interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.drivers/pci/host/pcie-designware.c +3
-0@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h" @@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = {int __init dw_pcie_host_init (struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;drivers/pci/host/pcie-designware.c static const struct irq_domain_ops msi_domain_ops = { · line 410
Quoted 10 lines
drivers/pci/host/pcie-designware.c +8
-0int i; + cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" );This should return error
-EINVAL.Quoted 15 lines
drivers/pci/host/pcie-designware.c +4
-0+ } +if (of_pci_range_parser_init (&parser, np)) {dev_err (pp->dev,"missing ranges property\n" );return -EINVAL ;@@ -429,6 +442,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)of_pci_range_to_resource (&range, np, &pp->cfg); pp->config.cfg0_size =resource_size (&pp->cfg)/2 ; pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; } }drivers/pci/host/pcie-designware.c int __init dw_pcie_host_init(struct pcie_port *pp) · line 461
Quoted 8 lines
drivers/pci/host/pcie-designware.c +0
-2@@ -441,8 +456,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } } - pp->cfg0_base = pp->cfg.start; - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; pp->mem_base = pp->mem.start; pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,BTW, Please also review my Keystone series so that we could discuss this topic in that context as well.
Re: [PATCH v2 04/18] PCI: designware: use untranslated address while programming ATU
In reply to Kishon Vijay Abraham IHi Arnd,
Quoted 26 lines · Kishon Vijay Abraham I
In DRA7, the cpu sees 32bit address, but the pcie controller can see only 28bit address. So whenever the cpu issues a read/write request, the 4 most significant bits are used by L3 to determine the target controller. For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe controller but the PCIe controller will see only (0x000_0000 - 0xFFF_FFF). So for programming the outbound translation window the *base* should be programmed as 0x000_0000. Whenever we try to write to say 0x2000_0000, it will be translated to whatever we have programmed in the translation window with base as 0x000_0000.
This is needed when the dt node is modelled something like below
axi { compatible = "simple-bus"; #size-cells = <1>; #address-cells = <1>; ranges = <0x0 0x20000000 0x10000000 // 28-bit bus 0x51000000 0x51000000 0x3000>; pcie at 51000000 { reg = <0x1000 0x2000>, <0x51002000 0x14c>, <0x51000000 0x2000>; reg-names = "config", "ti_conf", "rc_dbics"; #address-cells = <3>; #size-cells = <2>; ranges = <0x81000000 0 0 0x03000 0 0x00010000 0x82000000 0 0x20013000 0x13000 0 0xffed000>; }; };
Quoted 4 lines
Here the CPU address for configuration space is
0x20013000and the controller address for configuration space is0x13000. The controller address should be used while programming the ATU (in order for translation to happen properly in DRA7xx).
I've fixed this up with what you suggested in the v1 of the series. Do you think this is fine?
Thanks
Kishon
Quoted 142 lines
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/host/pcie-designware.c | 49 ++++++++++++++++++++++++++++-------- drivers/pci/host/pcie-designware.h | 4 +++ 2 files changed, 42 insertions(+), 11 deletions(-)drivers/pci/host/pcie-designware.c +38
-11@@ -397,8 +397,15 @@ int __init dw_pcie_host_init(struct pcie_port *pp)struct of_pci_range range;struct of_pci_range_parser parser;struct resource *cfg_res; -u32 val; -int i; +u32 val, na, ns; +const __be32 *addrp; +int i, index; + +/* Find the address cell size and the number of cells in order to get +* the untranslated address. +*/ +of_property_read_u32 (np,"#address-cells" , &na); + ns =of_n_size_cells (np); cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" );if (cfg_res) {@@ -406,6 +413,12 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.cfg1_size =resource_size (cfg_res)/2 ; pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + +/* Find the untranslated configuration space address */ + index =of_property_match_string (np,"reg-names" ,"config" ); + addrp =of_get_address (np, index, false, false); + pp->cfg0_mod_addr =of_read_number (addrp, ns); + pp->cfg1_mod_addr = pp->cfg0_mod_addr + pp->config.cfg0_size; }else {dev_err (pp->dev,"missing *config* reg space\n" ); }@@ -431,12 +444,20 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.io_size =resource_size (&pp->io); pp->config.io_bus_addr = range.pci_addr; pp->io_base = range.cpu_addr; + +/* Find the untranslated IO space address */ + pp->io_mod_addr =of_read_number (parser.range - + parser.np + na, ns); }if (restype ==IORESOURCE_MEM ) {of_pci_range_to_resource (&range, np, &pp->mem); pp->mem.name ="MEM" ; pp->config.mem_size =resource_size (&pp->mem); pp->config.mem_bus_addr = range.pci_addr; + +/* Find the untranslated MEM space address */ + pp->mem_mod_addr =of_read_number (parser.range - + parser.np + na, ns); }if (restype ==0 ) {of_pci_range_to_resource (&range, np, &pp->cfg);@@ -444,6 +465,12 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.cfg1_size =resource_size (&pp->cfg)/2 ; pp->cfg0_base = pp->cfg.start; pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; + +/* Find the untranslated configuration space address */ + pp->cfg0_mod_addr =of_read_number (parser.range - + parser.np + na, ns); + pp->cfg1_mod_addr = pp->cfg0_mod_addr + + pp->config.cfg0_size; } }@@ -518,9 +545,9 @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev)/* Program viewport 0 : OUTBOUND : CFG0 */ dw_pcie_writel_rc (pp,PCIE_ATU_REGION_OUTBOUND |PCIE_ATU_REGION_INDEX0 ,PCIE_ATU_VIEWPORT ); -dw_pcie_writel_rc (pp, pp->cfg0_base,PCIE_ATU_LOWER_BASE ); -dw_pcie_writel_rc (pp, (pp->cfg0_base >>32 ),PCIE_ATU_UPPER_BASE ); -dw_pcie_writel_rc (pp, pp->cfg0_base + pp->config.cfg0_size -1 , +dw_pcie_writel_rc (pp, pp->cfg0_mod_addr,PCIE_ATU_LOWER_BASE ); +dw_pcie_writel_rc (pp, (pp->cfg0_mod_addr >>32 ),PCIE_ATU_UPPER_BASE ); +dw_pcie_writel_rc (pp, pp->cfg0_mod_addr + pp->config.cfg0_size -1 ,PCIE_ATU_LIMIT );dw_pcie_writel_rc (pp, busdev,PCIE_ATU_LOWER_TARGET );dw_pcie_writel_rc (pp,0 ,PCIE_ATU_UPPER_TARGET );@@ -534,9 +561,9 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev)dw_pcie_writel_rc (pp,PCIE_ATU_REGION_OUTBOUND |PCIE_ATU_REGION_INDEX1 ,PCIE_ATU_VIEWPORT );dw_pcie_writel_rc (pp,PCIE_ATU_TYPE_CFG1 ,PCIE_ATU_CR1 ); -dw_pcie_writel_rc (pp, pp->cfg1_base,PCIE_ATU_LOWER_BASE ); -dw_pcie_writel_rc (pp, (pp->cfg1_base >>32 ),PCIE_ATU_UPPER_BASE ); -dw_pcie_writel_rc (pp, pp->cfg1_base + pp->config.cfg1_size -1 , +dw_pcie_writel_rc (pp, pp->cfg1_mod_addr,PCIE_ATU_LOWER_BASE ); +dw_pcie_writel_rc (pp, (pp->cfg1_mod_addr >>32 ),PCIE_ATU_UPPER_BASE ); +dw_pcie_writel_rc (pp, pp->cfg1_mod_addr + pp->config.cfg1_size -1 ,PCIE_ATU_LIMIT );dw_pcie_writel_rc (pp, busdev,PCIE_ATU_LOWER_TARGET );dw_pcie_writel_rc (pp,0 ,PCIE_ATU_UPPER_TARGET );@@ -549,9 +576,9 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)dw_pcie_writel_rc (pp,PCIE_ATU_REGION_OUTBOUND |PCIE_ATU_REGION_INDEX0 ,PCIE_ATU_VIEWPORT );dw_pcie_writel_rc (pp,PCIE_ATU_TYPE_MEM ,PCIE_ATU_CR1 ); -dw_pcie_writel_rc (pp, pp->mem_base,PCIE_ATU_LOWER_BASE ); -dw_pcie_writel_rc (pp, (pp->mem_base >>32 ),PCIE_ATU_UPPER_BASE ); -dw_pcie_writel_rc (pp, pp->mem_base + pp->config.mem_size -1 , +dw_pcie_writel_rc (pp, pp->mem_mod_addr,PCIE_ATU_LOWER_BASE ); +dw_pcie_writel_rc (pp, (pp->mem_mod_addr >>32 ),PCIE_ATU_UPPER_BASE ); +dw_pcie_writel_rc (pp, pp->mem_mod_addr + pp->config.mem_size -1 ,PCIE_ATU_LIMIT );dw_pcie_writel_rc (pp, pp->config.mem_bus_addr,PCIE_ATU_LOWER_TARGET ); dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr),drivers/pci/host/pcie-designware.h +4
-0@@ -36,11 +36,15 @@ struct pcie_port {u8 root_bus_nr;void __iomem *dbi_base;u64 cfg0_base; +u64 cfg0_mod_addr;void __iomem *va_cfg0_base;u64 cfg1_base; +u64 cfg1_mod_addr;void __iomem *va_cfg1_base;u64 io_base; +u64 io_mod_addr;u64 mem_base; +u64 mem_mod_addr;spinlock_t conf_lock;struct resource cfg;struct resource io;
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
In reply to Karicheri, MuralidharanHi,
Quoted 87 lines · Muralidharan
Quoted 87 lines
-----Original Message-----
From: Murali Karicheri [mailto:m-karicheri2 at ti.com]
Sent: Thursday, May 29, 2014 12:32 PM
To: ABRAHAM, KISHON VIJAY
Cc: devicetree at vger.kernel.org; linux-doc at vger.kernel.org; linux-arm-
kernel at lists.infradead.org; linux-omap at vger.kernel.org; linux-pci at vger.kernel.org; linux- kernel at vger.kernel.org; arnd at arndb.de; tony at atomide.com; jg1.han at samsung.com; Jason Gunthorpe; Bjorn Helgaas; Mohit Kumar; Marek Vasut
Subject: Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'Quoted 23 lines · KISHON VIJAY
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0Documentation/devicetree/bindings/pci/designware-pcie.txt Required properties: · line 9
Quoted 4 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +1
-0@@ -6,6 +6,7 @@ Required properties: as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". - reg: base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller. + The configuration address space should also be specified here.Kishon,
I am working on the Keystone PCI driver for which v1 is already posted. Want to clarify
following.
1. Original text for reg states "base addresses and lengths of the pcie controller, the phy controller, additional register for the phy controller"
and you added
"The configuration address space should also be specified here"and the code below added resource name "config"
Does PCI designware follow some convention? Does it mean after applying this patch config name is mandatory or optional? Below code you are not returning error. Can you or author of PCI designware clarify what is expected to be present as mandatory and what is optional.
Does config refers to RC's config space or EP's config space or both? The code below divide
the size by 2. So it appears to be RC's + EP's config space. Please clarify.Quoted 27 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +0
-0- interrupts: interrupt values for level interrupt, pulse interrupt, special interrupt. - clocks: from common clock binding: handle to pci clock.drivers/pci/host/pcie-designware.c +3
-0@@ -20,6 +20,7 @@#include <linux/of_pci.h> #include <linux/pci.h> #include <linux/pci_regs.h> +#include <linux/platform_device.h> #include <linux/types.h> #include "pcie-designware.h" @@ -392,11 +393,23 @@ static const struct irq_domain_ops msi_domain_ops = {int __init dw_pcie_host_init (struct pcie_port *pp) {struct device_node *np = pp->dev->of_node; +struct platform_device *pdev =to_platform_device (pp->dev);struct of_pci_range range;struct of_pci_range_parser parser; +struct resource *cfg_res;u32 val;int i;
Quoted 9 lines
Quoted 9 lines
drivers/pci/host/pcie-designware.c static const struct irq_domain_ops msi_domain_ops = { · line 410
Quoted 8 lines
drivers/pci/host/pcie-designware.c +8
-0+ cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" );This should return error
-EINVAL.
Just read the other thread and Grant Likely suggested the host controller driver should be backward compatible [1]. So we can't return -EINVAL here. So I'd assume this patch is fine as is? Arnd? Jingoo?
[1] -> https://lkml.org/lkml/2014/6/3/124
Thanks
Kishon
Re: [PATCH v2 03/18] PCI: designware: Configuration space should be specified in 'reg'
Quoted 18 lines · Kishon Vijay Abraham I
Quoted 17 lines · Muralidharan
Quoted 17 lines · KISHON VIJAY
Quoted 16 lines
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver.
Cc Jason Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Mohit Kumar <[email protected]>Cc Jingoo Han <[email protected]>Cc Marek Vasut <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 1 + drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
[...]
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
drivers/pci/host/pcie-designware.c static const struct irq_domain_ops msi_domain_ops = { · line 410
Quoted 8 lines
drivers/pci/host/pcie-designware.c +8
-0+ cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" ); +if (cfg_res) { + pp->config.cfg0_size =resource_size (cfg_res)/2 ; + pp->config.cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + }else { +dev_err (pp->dev,"missing *config* reg space\n" );This should return error
-EINVAL.
Quoted 3 lines
Just read the other thread and Grant Likely suggested the host controller driver should be backward compatible [1]. So we can't return
-EINVALhere. So I'd assume this patch is fine as is? Arnd? Jingoo?
Yes, you're right. The driver should keep backward compatibility for legacy DT binding. However, after enough time goes by, these legacy DT handling can be removed.
Best regards,
Jingoo Han
Quoted 5 lines
[1] -> https://lkml.org/lkml/2014/6/3/124
Thanks
Kishon
Re: [PATCH v2 06/18] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
In reply to Kishon Vijay Abraham IQuoted 4 lines · Kishon Vijay Abraham I
From: Keerthy <[email protected]>
Add divider table to
optfclk_pciephy_divclock. The Documentation for divider clock can be found at../clock/ti/divider.txt
This patch requires a better changelog. Why is the change done, any TRM refs etc.?
-Tero
Quoted 23 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +1
-0@@ -1170,6 +1170,7 @@ clocks = <&apll_pcie_ck>; #clock-cells = <0>; reg = <0x021c>; + ti,dividers = <2>, <1>; ti,bit-shift = <8>; ti,max-div = <2>; };
Re: [PATCH v2 07/18] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck
In reply to Kishon Vijay Abraham IQuoted 4 lines · Kishon Vijay Abraham I
From: Keerthy <[email protected]>
Change the parent of
apll_pcie_in_clk_muxtodpll_pcie_ref_m2ldo_ckfromdpll_pcie_ref_ck.
Why? Needs a better changelog also.
-Tero
Quoted 24 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/boot/dts/dra7xx-clocks.dtsi +1
-1@@ -1152,7 +1152,7 @@ apll_pcie_in_clk_mux: apll_pcie_in_clk_mux at 4ae06118 { compatible = "ti,mux-clock"; - clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>; + clocks = <&dpll_pcie_ref_m2ldo_ck>, <&pciesref_acs_clk_ck>; #clock-cells = <0>; reg = <0x021c 0x4>; ti,bit-shift = <7>;
Re: [PATCH v2 10/18] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
In reply to Kishon Vijay Abraham IQuoted 2 lines · Kishon Vijay Abraham I
Added missing 32khz clock used by PCIe PHY.
The documention for this node can be found @../bindings/clock/ti/gate.txt.
You can drop the node documentation ref, and rather add a TRM reference about hardware details. Other than that, looks good to me.
-Tero
Quoted 35 lines
Cc Tony Lindgren <[email protected]>Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +8
-0@@ -1165,6 +1165,14 @@ reg = <0x021c>, <0x0220>; }; + optfclk_pciephy_32khz: optfclk_pciephy_32khz at 4a0093b0 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b0>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;
Re: [PATCH v2 13/18] ARM: dts: dra7xx-clocks: Add missing clocks for second PCIe PHY instance
In reply to Kishon Vijay Abraham IQuoted 2 lines · Kishon Vijay Abraham I
Added missing clocks used by second instance of PCIe PHY.
The documention for this nodes can be found @../bindings/clock/ti/gate.txt.
Drop the ref to the binding doc and rather add a ref to TRM about the clock layout. Also, is the register offset wrong on these? Should be 0x13b8, no, or is my TRM version wrong?
-Tero
Quoted 65 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +24
-0@@ -1173,6 +1173,14 @@ ti,bit-shift = <8>; }; + optfclk_pciephy2_32khz: optfclk_pciephy_32khz at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;@@ -1191,6 +1199,14 @@ ti,bit-shift = <9>; }; + optfclk_pciephy2_clk: optfclk_pciephy_clk at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&apll_pcie_ck>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <9>; + }; + optfclk_pciephy1_div_clk: optfclk_pciephy_div_clk at 4a0093b0 { compatible = "ti,gate-clock"; clocks = <&optfclk_pciephy_div>;@@ -1199,6 +1215,14 @@ ti,bit-shift = <10>; }; + optfclk_pciephy2_div_clk: optfclk_pciephy_div_clk at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&optfclk_pciephy_div>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <10>; + }; + apll_pcie_clkvcoldo: apll_pcie_clkvcoldo { #clock-cells = <0>; compatible = "fixed-factor-clock";
Re: [PATCH v2 06/18] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
In reply to Tero KristoHi Tero,
Quoted 7 lines · Tero Kristo
Quoted 4 lines · Kishon Vijay Abraham I
From: Keerthy <[email protected]>
Add divider table to
optfclk_pciephy_divclock. The Documentation for divider clock can be found at../clock/ti/divider.txtThis patch requires a better changelog. Why is the change done, any TRM refs etc.?
The 8th bit of CM_CLKMODE_APLL_PCIE can be programmed to either 0x0 or 0x1 based on if the divider value is 0x2 or 0x1.
Figure 26-21. PCIe PHY Clock Generator Overview in vE of DRA7xx ES1.0 shows the block diagram of Clock Generator Subsystem of PCIe PHY module. We have to do a bypass (divided by 1) in order to get the correct PCIE_PHY_DIV_GCLK frequency.
Thanks
Kishon
Quoted 28 lines
-Tero
Quoted 24 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +1
-0@@ -1170,6 +1170,7 @@ clocks = <&apll_pcie_ck>; #clock-cells = <0>; reg = <0x021c>; + ti,dividers = <2>, <1>; ti,bit-shift = <8>; ti,max-div = <2>; };
Re: [PATCH v2 07/18] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck
In reply to Tero KristoHi Tero,
Quoted 7 lines · Tero Kristo
Quoted 4 lines · Kishon Vijay Abraham I
From: Keerthy <[email protected]>
Change the parent of
apll_pcie_in_clk_muxtodpll_pcie_ref_m2ldo_ckfromdpll_pcie_ref_ck.Why? Needs a better changelog also.
Figure 26-22. DPLL_PCIE_REF Functional Block Diagram in vE of DRA7xx ES1.0 TRM shows the signal name for the output of post divider (M2) is CLKOUTLDO.
Figure 26-21. PCIe PHY Clock Generator Overview shows CLKOUTLDO is used as input to apll mux.
So the actual output of dpll should be dpll_pcie_ref_m2ldo_ck instead of dpll_pcie_ref_ck (which is the input of apll mux).
Thanks
Kishon
Quoted 29 lines
-Tero
Quoted 25 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/boot/dts/dra7xx-clocks.dtsi +1
-1@@ -1152,7 +1152,7 @@ apll_pcie_in_clk_mux: apll_pcie_in_clk_mux at 4ae06118 { compatible = "ti,mux-clock"; - clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>; + clocks = <&dpll_pcie_ref_m2ldo_ck>, <&pciesref_acs_clk_ck>; #clock-cells = <0>; reg = <0x021c 0x4>; ti,bit-shift = <7>;
Re: [PATCH v2 10/18] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
In reply to Tero KristoHi Tero,
Quoted 6 lines · Tero Kristo
Quoted 2 lines · Kishon Vijay Abraham I
Added missing 32khz clock used by PCIe PHY.
The documention for this node can be found @../bindings/clock/ti/gate.txt.You can drop the node documentation ref, and rather add a TRM reference about hardware details. Other than that, looks good to me.
You mean something like why 32KHz clock is used (**PRCM.PCIE_32K_GFCLK (based on PRM.SYS_32K) for debounce and wakeup logic inside the PCIe1_PHY_RX**)? Or something like **Figure 26-19. PCIe PHY Subsystem Integration of DRA TRM vE shows how 32KHz clock is being used** ?
Thanks
Kishon
Quoted 40 lines
-Tero
Quoted 36 lines
Cc Tony Lindgren <[email protected]>Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +8
-0@@ -1165,6 +1165,14 @@ reg = <0x021c>, <0x0220>; }; + optfclk_pciephy_32khz: optfclk_pciephy_32khz at 4a0093b0 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b0>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;
Re: [PATCH v2 07/18] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck
In reply to Kishon Vijay Abraham IQuoted 11 lines · Kishon Vijay Abraham I
Hi Tero,
Quoted 7 lines · Tero Kristo
Quoted 4 lines · Kishon Vijay Abraham I
From: Keerthy <[email protected]>
Change the parent of
apll_pcie_in_clk_muxtodpll_pcie_ref_m2ldo_ckfromdpll_pcie_ref_ck.Why? Needs a better changelog also.
Quoted 8 lines
Figure 26-22.
DPLL_PCIE_REFFunctional Block Diagram in vE of DRA7xx ES1.0 TRM shows the signal name for the output of post divider (M2) is CLKOUTLDO.Figure 26-21. PCIe PHY Clock Generator Overview shows CLKOUTLDO is used as input to apll mux.
So the actual output of dpll should be
dpll_pcie_ref_m2ldo_ckinstead ofdpll_pcie_ref_ck(which is the input of apll mux).
Yep, this is what I want to see in the changelog, so please repost. The original changelog had no info on it whatsoever.
-Tero
Quoted 32 lines
Thanks
KishonQuoted 29 lines
-Tero
Quoted 25 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/boot/dts/dra7xx-clocks.dtsi +1
-1@@ -1152,7 +1152,7 @@ apll_pcie_in_clk_mux: apll_pcie_in_clk_mux at 4ae06118 { compatible = "ti,mux-clock"; - clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>; + clocks = <&dpll_pcie_ref_m2ldo_ck>, <&pciesref_acs_clk_ck>; #clock-cells = <0>; reg = <0x021c 0x4>; ti,bit-shift = <7>;
Re: [PATCH v2 13/18] ARM: dts: dra7xx-clocks: Add missing clocks for second PCIe PHY instance
In reply to Tero KristoHi,
Quoted 7 lines · Tero Kristo
Quoted 2 lines · Kishon Vijay Abraham I
Added missing clocks used by second instance of PCIe PHY.
The documention for this nodes can be found @../bindings/clock/ti/gate.txt.Drop the ref to the binding doc and rather add a ref to TRM about the clock layout. Also, is the register offset wrong on these? Should be
0x13b8, no, or is my TRM version wrong?
Er.. you are right. It should be 0x13b8.
Thanks
Kishon
Quoted 70 lines
-Tero
Quoted 66 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +24
-0@@ -1173,6 +1173,14 @@ ti,bit-shift = <8>; }; + optfclk_pciephy2_32khz: optfclk_pciephy_32khz at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;@@ -1191,6 +1199,14 @@ ti,bit-shift = <9>; }; + optfclk_pciephy2_clk: optfclk_pciephy_clk at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&apll_pcie_ck>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <9>; + }; + optfclk_pciephy1_div_clk: optfclk_pciephy_div_clk at 4a0093b0 { compatible = "ti,gate-clock"; clocks = <&optfclk_pciephy_div>;@@ -1199,6 +1215,14 @@ ti,bit-shift = <10>; }; + optfclk_pciephy2_div_clk: optfclk_pciephy_div_clk at 4a0093b4 { + compatible = "ti,gate-clock"; + clocks = <&optfclk_pciephy_div>; + #clock-cells = <0>; + reg = <0x13b4>; + ti,bit-shift = <10>; + }; + apll_pcie_clkvcoldo: apll_pcie_clkvcoldo { #clock-cells = <0>; compatible = "fixed-factor-clock";
Re: [PATCH v2 10/18] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
In reply to Kishon Vijay Abraham IQuoted 7 lines · Kishon Vijay Abraham I
Hi Tero,
Quoted 4 lines · Tero Kristo
Quoted 2 lines · Kishon Vijay Abraham I
Added missing 32khz clock used by PCIe PHY.
The documention for this node can be found @../bindings/clock/ti/gate.txt.
Quoted 7 lines
Quoted 2 lines
You can drop the node documentation ref, and rather add a TRM reference about hardware details. Other than that, looks good to me.
You mean something like why 32KHz clock is used (**PRCM.PCIE_32K_GFCLK (based on PRM.SYS_32K) for debounce and wakeup logic inside the PCIe1_PHY_RX**)? Or something like **Figure 26-19. PCIe PHY Subsystem Integration of DRA TRM vE shows how 32KHz clock is being used** ?
Just having a reference to the TRM version used and if you can provide a link to a figure or page where the clock integration is described should be good.
-Tero
Quoted 44 lines
Thanks
KishonQuoted 40 lines
-Tero
Quoted 36 lines
Cc Tony Lindgren <[email protected]>Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +8
-0@@ -1165,6 +1165,14 @@ reg = <0x021c>, <0x0220>; }; + optfclk_pciephy_32khz: optfclk_pciephy_32khz at 4a0093b0 { + compatible = "ti,gate-clock"; + clocks = <&sys_32k_ck>; + #clock-cells = <0>; + reg = <0x13b0>; + ti,bit-shift = <8>; + }; + optfclk_pciephy_div: optfclk_pciephy_div at 4a00821c { compatible = "ti,divider-clock"; clocks = <&apll_pcie_ck>;
Re: [PATCH v2 06/18] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
In reply to Kishon Vijay Abraham IQuoted 9 lines · Kishon Vijay Abraham I
Hi Tero,
Quoted 6 lines · Tero Kristo
Quoted 4 lines · Kishon Vijay Abraham I
From: Keerthy <[email protected]>
Add divider table to
optfclk_pciephy_divclock. The Documentation for divider clock can be found at../clock/ti/divider.txt
Quoted 8 lines
Quoted 1 line
This patch requires a better changelog. Why is the change done, any TRM refs etc.?
The 8th bit of
CM_CLKMODE_APLL_PCIEcan be programmed to either0x0or0x1based on if the divider value is0x2or0x1.Figure 26-21. PCIe PHY Clock Generator Overview in vE of DRA7xx ES1.0 shows the block diagram of Clock Generator Subsystem of PCIe PHY module. We have to do a bypass (divided by 1) in order to get the correct
PCIE_PHY_DIV_GCLK
Yes, something like this on the changelog would be good.
-Tero
Quoted 32 lines
frequency.
Thanks
KishonQuoted 28 lines
-Tero
Quoted 24 lines
Cc Rajendra Nayak <[email protected]>Cc Tero Kristo <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Keerthy <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/dra7xx-clocks.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm/boot/dts/dra7xx-clocks.dtsi +1
-0@@ -1170,6 +1170,7 @@ clocks = <&apll_pcie_ck>; #clock-cells = <0>; reg = <0x021c>; + ti,dividers = <2>, <1>; ti,bit-shift = <8>; ti,max-div = <2>; };
Re: [PATCH v2 04/18] PCI: designware: use untranslated address while programming ATU
In reply to Kishon Vijay Abraham IQuoted 9 lines · On Wednesday 18 June 2014 14:38:43 Kishon Vijay Abraham I wrote:
Quoted 5 lines · Kishon Vijay Abraham I
Here the CPU address for configuration space is
0x20013000and the controller address for configuration space is0x13000. The controller address should be used while programming the ATU (in order for translation to happen properly in DRA7xx).I've fixed this up with what you suggested in the v1 of the series. Do you think this is fine?
Hi Kishon,
Yes, I think this will work and do the right thing in all cases. I'm not completely sure if the change should be generalized into the range parser or better kept in the pcie-designware driver as you do it here:
Quoted 10 lines
drivers/pci/host/pcie-designware.c int __init dw_pcie_host_init(struct pcie_port *pp) · line 421
Quoted 10 lines
drivers/pci/host/pcie-designware.c +6
-0@@ -406,6 +413,12 @@ int __init dw_pcie_host_init(struct pcie_port *pp) pp->config.cfg1_size =resource_size (cfg_res)/2 ; pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + +/* Find the untranslated configuration space address */ + index =of_property_match_string (np,"reg-names" ,"config" ); + addrp =of_get_address (np, index, false, false); + pp->cfg0_mod_addr =of_read_number (addrp, ns); + pp->cfg1_mod_addr = pp->cfg0_mod_addr + pp->config.cfg0_size;
I think I've recently seen some objections to hand-parsing standard properties in driver code.
Quoted 4 lines
Quoted 4 lines
drivers/pci/host/pcie-designware.c +0
-0}else {dev_err (pp->dev,"missing *config* reg space\n" ); }@@ -431,12 +444,20 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
Quoted 8 lines
drivers/pci/host/pcie-designware.c int __init dw_pcie_host_init(struct pcie_port *pp) · line 451
Quoted 8 lines
drivers/pci/host/pcie-designware.c +4
-0pp->config.io_size =resource_size (&pp->io); pp->config.io_bus_addr = range.pci_addr; pp->io_base = range.cpu_addr; + +/* Find the untranslated IO space address */ + pp->io_mod_addr =of_read_number (parser.range - + parser.np + na, ns); }
So the of_read_number() call could be moved into of_pci_range_to_resource(), with another field added to struct of_pci_range to carry the address on the parent bus. Any other thoughts on this? Maybe Rob Herring or Andrew Murray have a strong opinion on this.
Arnd
Re: [PATCH v2 04/18] PCI: designware: use untranslated address while programming ATU
In reply to Kishon Vijay Abraham IQuoted 26 lines · Kishon Vijay Abraham I
In DRA7, the cpu sees 32bit address, but the pcie controller can see only 28bit address. So whenever the cpu issues a read/write request, the 4 most significant bits are used by L3 to determine the target controller. For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe controller but the PCIe controller will see only (0x000_0000 - 0xFFF_FFF). So for programming the outbound translation window the *base* should be programmed as 0x000_0000. Whenever we try to write to say 0x2000_0000, it will be translated to whatever we have programmed in the translation window with base as 0x000_0000.
This is needed when the dt node is modelled something like below
axi { compatible = "simple-bus"; #size-cells = <1>; #address-cells = <1>; ranges = <0x0 0x20000000 0x10000000 // 28-bit bus 0x51000000 0x51000000 0x3000>; pcie at 51000000 { reg = <0x1000 0x2000>, <0x51002000 0x14c>, <0x51000000 0x2000>; reg-names = "config", "ti_conf", "rc_dbics"; #address-cells = <3>; #size-cells = <2>; ranges = <0x81000000 0 0 0x03000 0 0x00010000 0x82000000 0 0x20013000 0x13000 0 0xffed000>; }; };
Quoted 4 lines
Here the CPU address for configuration space is
0x20013000and the controller address for configuration space is0x13000. The controller address should be used while programming the ATU (in order for translation to happen properly in DRA7xx).
This talks about config space, but the ranges field is PCI memory space. Also, does this actually work because I though Linux expects memory BARs to be 1MB aligned.
Getting the controller offset should work whether you specify the address as 0x13000 with translation or the absolute address 0x20013000. In other words, the driver should know how many bits to mask off to get the offset.
Rob
Re: [PATCH v2 04/18] PCI: designware: use untranslated address while programming ATU
Quoted 27 lines · On Friday 20 June 2014 12:45:46 Rob Herring wrote:
Quoted 26 lines · Kishon Vijay Abraham I
In DRA7, the cpu sees 32bit address, but the pcie controller can see only 28bit address. So whenever the cpu issues a read/write request, the 4 most significant bits are used by L3 to determine the target controller. For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe controller but the PCIe controller will see only (0x000_0000 - 0xFFF_FFF). So for programming the outbound translation window the *base* should be programmed as 0x000_0000. Whenever we try to write to say 0x2000_0000, it will be translated to whatever we have programmed in the translation window with base as 0x000_0000.
This is needed when the dt node is modelled something like below
axi { compatible = "simple-bus"; #size-cells = <1>; #address-cells = <1>; ranges = <0x0 0x20000000 0x10000000 // 28-bit bus 0x51000000 0x51000000 0x3000>; pcie at 51000000 { reg = <0x1000 0x2000>, <0x51002000 0x14c>, <0x51000000 0x2000>; reg-names = "config", "ti_conf", "rc_dbics"; #address-cells = >; #size-cells = <2>; ranges = <0x81000000 0 0 0x03000 0 0x00010000 0x82000000 0 0x20013000 0x13000 0 0xffed000>; }; };
Quoted 8 lines
Quoted 4 lines
Here the CPU address for configuration space is
0x20013000and the controller address for configuration space is0x13000. The controller address should be used while programming the ATU (in order for translation to happen properly in DRA7xx).This talks about config space, but the ranges field is PCI memory space. Also, does this actually work because I though Linux expects memory BARs to be 1MB aligned.
Good point about the alignment.
Actually both the config space and memory space are set up through the intermediate ranges of the parent bus.
Quoted 4 lines
Getting the controller offset should work whether you specify the address as
0x13000with translation or the absolute address0x20013000. In other words, the driver should know how many bits to mask off to get the offset.
That's what the first version of the patch did, and I didn't like that because the masking is not actually a property of the controller, but it's based on how the controller is connected to the parent bus, in this case by using a narrower connection. We can describe the connection just fine using standard DT properties and I think we should.
Arnd