All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Jeffy Chen <jeffy.chen@rock-chips.com>
Cc: linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Kumar Gala <galak@codeaurora.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH v1 1/8] pinctrl: rockchip: add support for the rk3228
Date: Wed, 09 Dec 2015 12:30:10 +0100	[thread overview]
Message-ID: <2989163.WWcXAyahsV@diego> (raw)
In-Reply-To: <1449651853-1667-2-git-send-email-jeffy.chen@rock-chips.com>

Hi Jeffy,

Am Mittwoch, 9. Dezember 2015, 17:04:06 schrieb Jeffy Chen:
> The pinctrl of rk3228 is much the same as rk3288's, but
> without pmu.
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>

After verifying the offset and register-layout values with the TRM

Reviewed-by: Heiko Stuebner <heiko@sntech.de>


I just love how that still seems to fit for new socs ;-)


Thanks
Heiko


> ---
> 
>  .../bindings/pinctrl/rockchip,pinctrl.txt          |  3 +-
>  drivers/pinctrl/pinctrl-rockchip.c                 | 53
> ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
> b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt index
> 391ef4b..0cd701b 100644
> --- a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
> @@ -21,7 +21,8 @@ defined as gpio sub-nodes of the pinmux controller.
>  Required properties for iomux controller:
>    - compatible: one of "rockchip,rk2928-pinctrl",
> "rockchip,rk3066a-pinctrl" "rockchip,rk3066b-pinctrl",
> "rockchip,rk3188-pinctrl"
> -		       "rockchip,rk3288-pinctrl", "rockchip,rk3368-pinctrl"
> +		       "rockchip,rk3228-pinctrl", "rockchip,rk3288-pinctrl"
> +		       "rockchip,rk3368-pinctrl"
>    - rockchip,grf: phandle referencing a syscon providing the
>  	 "general register files"
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index a065112..faab36e 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -614,6 +614,40 @@ static void rk3288_calc_drv_reg_and_bit(struct
> rockchip_pin_bank *bank, }
>  }
> 
> +#define RK3228_PULL_OFFSET		0x100
> +
> +static void rk3228_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
> +				    int pin_num, struct regmap **regmap,
> +				    int *reg, u8 *bit)
> +{
> +	struct rockchip_pinctrl *info = bank->drvdata;
> +
> +	*regmap = info->regmap_base;
> +	*reg = RK3228_PULL_OFFSET;
> +	*reg += bank->bank_num * RK3188_PULL_BANK_STRIDE;
> +	*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
> +
> +	*bit = (pin_num % RK3188_PULL_PINS_PER_REG);
> +	*bit *= RK3188_PULL_BITS_PER_PIN;
> +}
> +
> +#define RK3228_DRV_GRF_OFFSET		0x200
> +
> +static void rk3228_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank,
> +				    int pin_num, struct regmap **regmap,
> +				    int *reg, u8 *bit)
> +{
> +	struct rockchip_pinctrl *info = bank->drvdata;
> +
> +	*regmap = info->regmap_base;
> +	*reg = RK3228_DRV_GRF_OFFSET;
> +	*reg += bank->bank_num * RK3288_DRV_BANK_STRIDE;
> +	*reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4);
> +
> +	*bit = (pin_num % RK3288_DRV_PINS_PER_REG);
> +	*bit *= RK3288_DRV_BITS_PER_PIN;
> +}
> +
>  #define RK3368_PULL_GRF_OFFSET		0x100
>  #define RK3368_PULL_PMU_OFFSET		0x10
> 
> @@ -2143,6 +2177,23 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = {
>  		.pull_calc_reg		= rk3188_calc_pull_reg_and_bit,
>  };
> 
> +static struct rockchip_pin_bank rk3228_pin_banks[] = {
> +	PIN_BANK(0, 32, "gpio0"),
> +	PIN_BANK(1, 32, "gpio1"),
> +	PIN_BANK(2, 32, "gpio2"),
> +	PIN_BANK(3, 32, "gpio3"),
> +};
> +
> +static struct rockchip_pin_ctrl rk3228_pin_ctrl = {
> +		.pin_banks		= rk3228_pin_banks,
> +		.nr_banks		= ARRAY_SIZE(rk3228_pin_banks),
> +		.label			= "RK3228-GPIO",
> +		.type			= RK3288,
> +		.grf_mux_offset		= 0x0,
> +		.pull_calc_reg		= rk3228_calc_pull_reg_and_bit,
> +		.drv_calc_reg		= rk3228_calc_drv_reg_and_bit,
> +};
> +
>  static struct rockchip_pin_bank rk3288_pin_banks[] = {
>  	PIN_BANK_IOMUX_FLAGS(0, 24, "gpio0", IOMUX_SOURCE_PMU,
>  					     IOMUX_SOURCE_PMU,
> @@ -2220,6 +2271,8 @@ static const struct of_device_id
> rockchip_pinctrl_dt_match[] = { .data = (void *)&rk3066b_pin_ctrl },
>  	{ .compatible = "rockchip,rk3188-pinctrl",
>  		.data = (void *)&rk3188_pin_ctrl },
> +	{ .compatible = "rockchip,rk3228-pinctrl",
> +		.data = (void *)&rk3228_pin_ctrl },
>  	{ .compatible = "rockchip,rk3288-pinctrl",
>  		.data = (void *)&rk3288_pin_ctrl },
>  	{ .compatible = "rockchip,rk3368-pinctrl",

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 1/8] pinctrl: rockchip: add support for the rk3228
Date: Wed, 09 Dec 2015 12:30:10 +0100	[thread overview]
Message-ID: <2989163.WWcXAyahsV@diego> (raw)
In-Reply-To: <1449651853-1667-2-git-send-email-jeffy.chen@rock-chips.com>

Hi Jeffy,

Am Mittwoch, 9. Dezember 2015, 17:04:06 schrieb Jeffy Chen:
> The pinctrl of rk3228 is much the same as rk3288's, but
> without pmu.
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>

After verifying the offset and register-layout values with the TRM

Reviewed-by: Heiko Stuebner <heiko@sntech.de>


I just love how that still seems to fit for new socs ;-)


Thanks
Heiko


> ---
> 
>  .../bindings/pinctrl/rockchip,pinctrl.txt          |  3 +-
>  drivers/pinctrl/pinctrl-rockchip.c                 | 53
> ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
> b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt index
> 391ef4b..0cd701b 100644
> --- a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
> @@ -21,7 +21,8 @@ defined as gpio sub-nodes of the pinmux controller.
>  Required properties for iomux controller:
>    - compatible: one of "rockchip,rk2928-pinctrl",
> "rockchip,rk3066a-pinctrl" "rockchip,rk3066b-pinctrl",
> "rockchip,rk3188-pinctrl"
> -		       "rockchip,rk3288-pinctrl", "rockchip,rk3368-pinctrl"
> +		       "rockchip,rk3228-pinctrl", "rockchip,rk3288-pinctrl"
> +		       "rockchip,rk3368-pinctrl"
>    - rockchip,grf: phandle referencing a syscon providing the
>  	 "general register files"
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index a065112..faab36e 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -614,6 +614,40 @@ static void rk3288_calc_drv_reg_and_bit(struct
> rockchip_pin_bank *bank, }
>  }
> 
> +#define RK3228_PULL_OFFSET		0x100
> +
> +static void rk3228_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
> +				    int pin_num, struct regmap **regmap,
> +				    int *reg, u8 *bit)
> +{
> +	struct rockchip_pinctrl *info = bank->drvdata;
> +
> +	*regmap = info->regmap_base;
> +	*reg = RK3228_PULL_OFFSET;
> +	*reg += bank->bank_num * RK3188_PULL_BANK_STRIDE;
> +	*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
> +
> +	*bit = (pin_num % RK3188_PULL_PINS_PER_REG);
> +	*bit *= RK3188_PULL_BITS_PER_PIN;
> +}
> +
> +#define RK3228_DRV_GRF_OFFSET		0x200
> +
> +static void rk3228_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank,
> +				    int pin_num, struct regmap **regmap,
> +				    int *reg, u8 *bit)
> +{
> +	struct rockchip_pinctrl *info = bank->drvdata;
> +
> +	*regmap = info->regmap_base;
> +	*reg = RK3228_DRV_GRF_OFFSET;
> +	*reg += bank->bank_num * RK3288_DRV_BANK_STRIDE;
> +	*reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4);
> +
> +	*bit = (pin_num % RK3288_DRV_PINS_PER_REG);
> +	*bit *= RK3288_DRV_BITS_PER_PIN;
> +}
> +
>  #define RK3368_PULL_GRF_OFFSET		0x100
>  #define RK3368_PULL_PMU_OFFSET		0x10
> 
> @@ -2143,6 +2177,23 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = {
>  		.pull_calc_reg		= rk3188_calc_pull_reg_and_bit,
>  };
> 
> +static struct rockchip_pin_bank rk3228_pin_banks[] = {
> +	PIN_BANK(0, 32, "gpio0"),
> +	PIN_BANK(1, 32, "gpio1"),
> +	PIN_BANK(2, 32, "gpio2"),
> +	PIN_BANK(3, 32, "gpio3"),
> +};
> +
> +static struct rockchip_pin_ctrl rk3228_pin_ctrl = {
> +		.pin_banks		= rk3228_pin_banks,
> +		.nr_banks		= ARRAY_SIZE(rk3228_pin_banks),
> +		.label			= "RK3228-GPIO",
> +		.type			= RK3288,
> +		.grf_mux_offset		= 0x0,
> +		.pull_calc_reg		= rk3228_calc_pull_reg_and_bit,
> +		.drv_calc_reg		= rk3228_calc_drv_reg_and_bit,
> +};
> +
>  static struct rockchip_pin_bank rk3288_pin_banks[] = {
>  	PIN_BANK_IOMUX_FLAGS(0, 24, "gpio0", IOMUX_SOURCE_PMU,
>  					     IOMUX_SOURCE_PMU,
> @@ -2220,6 +2271,8 @@ static const struct of_device_id
> rockchip_pinctrl_dt_match[] = { .data = (void *)&rk3066b_pin_ctrl },
>  	{ .compatible = "rockchip,rk3188-pinctrl",
>  		.data = (void *)&rk3188_pin_ctrl },
> +	{ .compatible = "rockchip,rk3228-pinctrl",
> +		.data = (void *)&rk3228_pin_ctrl },
>  	{ .compatible = "rockchip,rk3288-pinctrl",
>  		.data = (void *)&rk3288_pin_ctrl },
>  	{ .compatible = "rockchip,rk3368-pinctrl",

  reply	other threads:[~2015-12-09 11:30 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09  9:04 [PATCH v1 0/8] This serial of patches add dts/pinctrl/clock-tree/doc for rk3228 Jeffy Chen
2015-12-09  9:04 ` Jeffy Chen
2015-12-09  9:04 ` [PATCH v1 1/8] pinctrl: rockchip: add support for the rk3228 Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
2015-12-09 11:30   ` Heiko Stübner [this message]
2015-12-09 11:30     ` Heiko Stübner
2015-12-09 20:09   ` Rob Herring
2015-12-09 20:09     ` Rob Herring
2015-12-11 18:10   ` Linus Walleij
2015-12-11 18:10     ` Linus Walleij
2015-12-09  9:04 ` [PATCH v1 2/8] clk: rockchip: add dt-binding header for rk3228 Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
     [not found]   ` <1449651853-1667-3-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-12-09 23:17     ` Heiko Stuebner
2015-12-09 23:17       ` Heiko Stuebner
2015-12-09 23:17       ` Heiko Stuebner
2015-12-09  9:04 ` [PATCH v1 3/8] rockchip: add clock controller " Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
2015-12-10  0:19   ` Heiko Stuebner
2015-12-10  0:19     ` Heiko Stuebner
2015-12-11  1:46     ` Jeffy Chen
2015-12-11  1:46       ` Jeffy Chen
2015-12-09  9:04 ` [PATCH v1 5/8] clk: rockchip: allow more than 2 parents for cpuclk Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
2015-12-09 21:35   ` Heiko Stuebner
2015-12-09 21:35     ` Heiko Stuebner
2015-12-09  9:04 ` [PATCH v1 6/8] ARM: rockchip: enable support for RK3228 SoCs Jeffy Chen
2015-12-09  9:04   ` Jeffy Chen
2015-12-09 21:27   ` Heiko Stuebner
2015-12-09 21:27     ` Heiko Stuebner
     [not found] ` <1449651853-1667-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-12-09  9:04   ` [PATCH v1 4/8] dt-bindings: add documentation of rk3228 clock controller Jeffy Chen
2015-12-09  9:04     ` Jeffy Chen
2015-12-09  9:04     ` Jeffy Chen
2015-12-09 20:12     ` Rob Herring
2015-12-09 20:12       ` Rob Herring
2015-12-09 23:11       ` Heiko Stuebner
2015-12-09 23:11         ` Heiko Stuebner
     [not found]     ` <1449651853-1667-5-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-12-09 23:17       ` Heiko Stuebner
2015-12-09 23:17         ` Heiko Stuebner
2015-12-09 23:17         ` Heiko Stuebner
2015-12-09  9:04   ` [PATCH v1 7/8] ARM: dts: rockchip: add core rk3228 dtsi Jeffy Chen
2015-12-09  9:04     ` Jeffy Chen
2015-12-09  9:04     ` Jeffy Chen
2015-12-10  0:32     ` Heiko Stuebner
2015-12-10  0:32       ` Heiko Stuebner
2015-12-11  1:53       ` Jeffy Chen
2015-12-11  1:53         ` Jeffy Chen
2015-12-11  1:53         ` Jeffy Chen
     [not found]         ` <566A2CB7.4050801-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-12-11 10:12           ` Heiko Stübner
2015-12-11 10:12             ` Heiko Stübner
2015-12-11 10:12             ` Heiko Stübner
2015-12-12  2:34             ` Jeffy Chen
2015-12-12  2:34               ` Jeffy Chen
2015-12-12  2:34               ` Jeffy Chen
2015-12-09  9:04   ` [PATCH v1 8/8] ARM: dts: rockchip: add rk3228-evb board Jeffy Chen
2015-12-09  9:04     ` Jeffy Chen
2015-12-09  9:04     ` Jeffy Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2989163.WWcXAyahsV@diego \
    --to=heiko@sntech.de \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jeffy.chen@rock-chips.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.