|
@@ -38,6 +38,7 @@
|
|
#include <linux/irqchip/chained_irq.h>
|
|
#include <linux/irqchip/chained_irq.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/regmap.h>
|
|
|
|
+#include <linux/mfd/syscon.h>
|
|
#include <dt-bindings/pinctrl/rockchip.h>
|
|
#include <dt-bindings/pinctrl/rockchip.h>
|
|
|
|
|
|
#include "core.h"
|
|
#include "core.h"
|
|
@@ -164,6 +165,7 @@ struct rockchip_pinctrl {
|
|
struct regmap *regmap_base;
|
|
struct regmap *regmap_base;
|
|
int reg_size;
|
|
int reg_size;
|
|
struct regmap *regmap_pull;
|
|
struct regmap *regmap_pull;
|
|
|
|
+ struct regmap *regmap_pmu;
|
|
struct device *dev;
|
|
struct device *dev;
|
|
struct rockchip_pin_ctrl *ctrl;
|
|
struct rockchip_pin_ctrl *ctrl;
|
|
struct pinctrl_desc pctl;
|
|
struct pinctrl_desc pctl;
|
|
@@ -438,6 +440,7 @@ static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
|
|
#define RK3188_PULL_BITS_PER_PIN 2
|
|
#define RK3188_PULL_BITS_PER_PIN 2
|
|
#define RK3188_PULL_PINS_PER_REG 8
|
|
#define RK3188_PULL_PINS_PER_REG 8
|
|
#define RK3188_PULL_BANK_STRIDE 16
|
|
#define RK3188_PULL_BANK_STRIDE 16
|
|
|
|
+#define RK3188_PULL_PMU_OFFSET 0x64
|
|
|
|
|
|
static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
|
|
static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
|
|
int pin_num, struct regmap **regmap,
|
|
int pin_num, struct regmap **regmap,
|
|
@@ -447,8 +450,9 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
|
|
|
|
|
|
/* The first 12 pins of the first bank are located elsewhere */
|
|
/* The first 12 pins of the first bank are located elsewhere */
|
|
if (bank->bank_type == RK3188_BANK0 && pin_num < 12) {
|
|
if (bank->bank_type == RK3188_BANK0 && pin_num < 12) {
|
|
- *regmap = bank->regmap_pull;
|
|
|
|
- *reg = 0;
|
|
|
|
|
|
+ *regmap = info->regmap_pmu ? info->regmap_pmu
|
|
|
|
+ : bank->regmap_pull;
|
|
|
|
+ *reg = info->regmap_pmu ? RK3188_PULL_PMU_OFFSET : 0;
|
|
*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
|
|
*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
|
|
*bit = pin_num % RK3188_PULL_PINS_PER_REG;
|
|
*bit = pin_num % RK3188_PULL_PINS_PER_REG;
|
|
*bit *= RK3188_PULL_BITS_PER_PIN;
|
|
*bit *= RK3188_PULL_BITS_PER_PIN;
|
|
@@ -1539,6 +1543,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
|
|
struct rockchip_pinctrl *info;
|
|
struct rockchip_pinctrl *info;
|
|
struct device *dev = &pdev->dev;
|
|
struct device *dev = &pdev->dev;
|
|
struct rockchip_pin_ctrl *ctrl;
|
|
struct rockchip_pin_ctrl *ctrl;
|
|
|
|
+ struct device_node *np = pdev->dev.of_node, *node;
|
|
struct resource *res;
|
|
struct resource *res;
|
|
void __iomem *base;
|
|
void __iomem *base;
|
|
int ret;
|
|
int ret;
|
|
@@ -1587,6 +1592,14 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
|
|
&rockchip_regmap_config);
|
|
&rockchip_regmap_config);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* try to find the optional reference to the pmu syscon */
|
|
|
|
+ node = of_parse_phandle(np, "rockchip,pmu", 0);
|
|
|
|
+ if (node) {
|
|
|
|
+ info->regmap_pmu = syscon_node_to_regmap(node);
|
|
|
|
+ if (IS_ERR(info->regmap_pmu))
|
|
|
|
+ return PTR_ERR(info->regmap_pmu);
|
|
|
|
+ }
|
|
|
|
+
|
|
ret = rockchip_gpiolib_register(pdev, info);
|
|
ret = rockchip_gpiolib_register(pdev, info);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|