lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 Feb 2017 17:51:41 +0100
From:   Heiko Stuebner <heiko@...ech.de>
To:     David Wu <david.wu@...k-chips.com>
Cc:     linus.walleij@...aro.org, huangtao@...k-chips.com,
        linux-rockchip@...ts.infradead.org, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] pinctrl: rockchip:Add input schmitt support

Hi David,

Am Dienstag, 14. Februar 2017, 18:35:40 CET schrieb David Wu:
> From: "david.wu" <david.wu@...k-chips.com>
> 
> To prevent external noise crosstalk, some pins need to
> enable input schmitt, like i2c pins, 32k-input pin and so on.
> 
> Signed-off-by: david.wu <david.wu@...k-chips.com>
> ---
>  drivers/pinctrl/pinctrl-rockchip.c | 69
> ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index a20ce9f..6a071b1 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -308,6 +308,9 @@ struct rockchip_pin_ctrl {
>  				    int *reg, u8 *bit);
>  	void	(*iomux_recalc)(u8 bank_num, int pin, int *reg,
>  				u8 *bit, int *mask);
> +	void	(*schmitt_calc_reg)(struct rockchip_pin_bank *bank,
> +				    int pin_num, struct regmap **regmap,
> +				    int *reg, u8 *bit);
>  };
> 
>  struct rockchip_pin_config {
> @@ -1355,6 +1358,53 @@ static int rockchip_set_pull(struct rockchip_pin_bank
> *bank, return ret;
>  }
> 
> +static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int
> pin_num) +{
> +	struct rockchip_pinctrl *info = bank->drvdata;
> +	struct rockchip_pin_ctrl *ctrl = info->ctrl;
> +	struct regmap *regmap;
> +	int reg, ret;
> +	u8 bit;
> +	u32 data;
> +
> +	ctrl->schmitt_calc_reg(bank, pin_num, &regmap, &reg, &bit);

we might want to have and check an actual return value here.
On things like the rk3288 only some special pins have these schmitt triggers 
it seems, so we might want to abort if something tries to access an 
unsupported one.

> +
> +	ret = regmap_read(regmap, reg, &data);
> +	if (ret)
> +		return ret;
> +
> +	data >>= bit;
> +	return data & 0x1;

The mask seems to also be variable, for example on the rk3399 there seem to be 
multiple "levels" for at least gpio2. So your calc-callback might want to also 
set the right mask.

Otherwise looks good.


Heiko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ