static DEFINE_SPINLOCK(ifx_pcie_lock);
u32 g_pcie_debug_flag = PCIE_MSG_ANY & (~PCIE_MSG_CFG);
-+static int pcie_reset_gpio;
++static struct gpio_desc *pcie_reset_gpio;
+static struct phy *ltq_pcie_phy;
+static struct reset_control *ltq_pcie_reset;
+static struct regmap *ltq_rcu_regmap;
+static inline void pcie_ep_gpio_rst_init(int pcie_port)
+{
-+ gpio_set_value(pcie_reset_gpio, 0);
++ gpiod_set_value(pcie_reset_gpio, 0);
+}
+
+static inline void pcie_device_rst_assert(int pcie_port)
+{
-+ gpio_set_value(pcie_reset_gpio, 1);
++ gpiod_set_value(pcie_reset_gpio, 1);
+}
+
+static inline void pcie_device_rst_deassert(int pcie_port)
+{
+ mdelay(100);
-+ gpio_set_value(pcie_reset_gpio, 0);
++ gpiod_set_value(pcie_reset_gpio, 0);
+}
static inline int pcie_ltssm_enable(int pcie_port)
}
if (i >= IFX_PCIE_PHY_LOOP_CNT) {
printk(KERN_ERR "%s link up failed!!!!!\n", __func__);
-@@ -1045,17 +1082,67 @@ pcie_rc_initialize(int pcie_port)
+@@ -1045,17 +1082,63 @@ pcie_rc_initialize(int pcie_port)
return 0;
}
+ if (IS_ERR(ltq_rcu_regmap))
+ return PTR_ERR(ltq_rcu_regmap);
+
-+ pcie_reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);
-+ if (gpio_is_valid(pcie_reset_gpio)) {
-+ int ret = devm_gpio_request(&pdev->dev, pcie_reset_gpio, "pcie-reset");
-+ if (ret) {
-+ dev_err(&pdev->dev, "failed to request gpio %d\n", pcie_reset_gpio);
-+ return ret;
-+ }
-+ gpio_direction_output(pcie_reset_gpio, 0);
-+ }
++ pcie_reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
++ GPIOD_OUT_LOW);
++ if (IS_ERR(pcie_reset_gpio)) {
++ return dev_err_probe(&pdev->dev, PTR_ERR(pcie_reset_gpio),
++ "failed to request gpio\n");
+
for (pcie_port = startup_port; pcie_port < IFX_PCIE_CORE_NR; pcie_port++){
if (pcie_rc_initialize(pcie_port) == 0) {
IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: ifx_pcie_cfg_base 0x%p\n",
-@@ -1067,6 +1154,7 @@ static int __init ifx_pcie_bios_init(voi
+@@ -1067,6 +1150,7 @@ static int __init ifx_pcie_bios_init(voi
return -ENOMEM;
}
ifx_pcie_controller[pcie_port].pcic.io_map_base = (unsigned long)io_map_base;
register_pci_controller(&ifx_pcie_controller[pcie_port].pcic);
/* XXX, clear error status */
-@@ -1083,6 +1171,30 @@ static int __init ifx_pcie_bios_init(voi
+@@ -1083,6 +1167,30 @@ static int __init ifx_pcie_bios_init(voi
return 0;
}
static DEFINE_SPINLOCK(ifx_pcie_lock);
u32 g_pcie_debug_flag = PCIE_MSG_ANY & (~PCIE_MSG_CFG);
-+static int pcie_reset_gpio;
++static struct gpio_desc *pcie_reset_gpio;
+static struct phy *ltq_pcie_phy;
+static struct reset_control *ltq_pcie_reset;
+static struct regmap *ltq_rcu_regmap;
+static inline void pcie_ep_gpio_rst_init(int pcie_port)
+{
-+ gpio_set_value(pcie_reset_gpio, 0);
++ gpiod_set_value(pcie_reset_gpio, 0);
+}
+
+static inline void pcie_device_rst_assert(int pcie_port)
+{
-+ gpio_set_value(pcie_reset_gpio, 1);
++ gpiod_set_value(pcie_reset_gpio, 1);
+}
+
+static inline void pcie_device_rst_deassert(int pcie_port)
+{
+ mdelay(100);
-+ gpio_set_value(pcie_reset_gpio, 0);
++ gpiod_set_value(pcie_reset_gpio, 0);
+}
static inline int pcie_ltssm_enable(int pcie_port)
}
if (i >= IFX_PCIE_PHY_LOOP_CNT) {
printk(KERN_ERR "%s link up failed!!!!!\n", __func__);
-@@ -1045,17 +1082,67 @@ pcie_rc_initialize(int pcie_port)
+@@ -1045,17 +1082,66 @@ pcie_rc_initialize(int pcie_port)
return 0;
}
+ if (IS_ERR(ltq_rcu_regmap))
+ return PTR_ERR(ltq_rcu_regmap);
+
-+ pcie_reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);
-+ if (gpio_is_valid(pcie_reset_gpio)) {
-+ int ret = devm_gpio_request(&pdev->dev, pcie_reset_gpio, "pcie-reset");
-+ if (ret) {
-+ dev_err(&pdev->dev, "failed to request gpio %d\n", pcie_reset_gpio);
-+ return ret;
-+ }
-+ gpio_direction_output(pcie_reset_gpio, 0);
++ pcie_reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
++ GPIOD_OUT_LOW);
++ if (IS_ERR(pcie_reset_gpio)) {
++ if (PTR_ERR(pcie_reset_gpio) != -EPROBE_DEFER)
++ dev_err(&pdev->dev, "failed to request gpio\n");
++
++ return PTR_ERR(pcie_reset_gpio);
+ }
+
for (pcie_port = startup_port; pcie_port < IFX_PCIE_CORE_NR; pcie_port++){
if (pcie_rc_initialize(pcie_port) == 0) {
IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: ifx_pcie_cfg_base 0x%p\n",
-@@ -1067,6 +1154,7 @@ static int __init ifx_pcie_bios_init(voi
+@@ -1067,6 +1153,7 @@ static int __init ifx_pcie_bios_init(voi
return -ENOMEM;
}
ifx_pcie_controller[pcie_port].pcic.io_map_base = (unsigned long)io_map_base;
register_pci_controller(&ifx_pcie_controller[pcie_port].pcic);
/* XXX, clear error status */
-@@ -1083,6 +1171,30 @@ static int __init ifx_pcie_bios_init(voi
+@@ -1083,6 +1170,30 @@ static int __init ifx_pcie_bios_init(voi
return 0;
}