Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401093

Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller

From Kevin Hilman <khilman@baylibre.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller
Date 2016-05-14 17:10 +0200
Message-ID <ryJmx-2Rw-5@gated-at.bofh.it> (permalink)
References <rylWW-4R7-9@gated-at.bofh.it> <rylWW-4R7-7@gated-at.bofh.it>
Organization BayLibre

Show all headers | View raw


Neil Armstrong <narmstrong@baylibre.com> writes:

> This patch adds the platform driver for the Amlogic Meson GXBB Reset
> Controller.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

[...]

> +static int meson_gxbb_reset_assert(struct reset_controller_dev *rcdev,
> +			      unsigned long id)
> +{
> +	struct meson_gxbb_reset *data =
> +		container_of(rcdev, struct meson_gxbb_reset, rcdev);
> +	unsigned int bank = id / BITS_PER_REG;
> +	unsigned int offset = id % BITS_PER_REG;
> +	void *reg_addr = data->reg_base + (bank << 2);
> +
> +	if (bank >= REG_COUNT)
> +		return -EINVAL;
> +
> +	writel(readl(reg_addr) | BIT(offset), reg_addr);

The spec lists these registers as 16-bit registers, so probably readw/writew
are more appropriate here.

> +	return 0;
> +}
> +
> +static int meson_gxbb_reset_deassert(struct reset_controller_dev *rcdev,
> +				unsigned long id)
> +{
> +	struct meson_gxbb_reset *data =
> +		container_of(rcdev, struct meson_gxbb_reset, rcdev);
> +	unsigned int bank = id / BITS_PER_REG;
> +	unsigned int offset = id % BITS_PER_REG;
> +	void *reg_addr = data->reg_base + (bank << 2);
> +
> +	if (bank >= REG_COUNT)
> +		return -EINVAL;
> +
> +	writel(readl(reg_addr) & ~BIT(offset), reg_addr);

and here.

> +	return 0;
> +}

Kevin

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller Neil Armstrong <narmstrong@baylibre.com> - 2016-05-13 16:10 +0200
  Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller Kevin Hilman <khilman@baylibre.com> - 2016-05-14 17:10 +0200
    Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB  Reset Controller Neil Armstrong <narmstrong@baylibre.com> - 2016-05-16 10:50 +0200
  Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller Kevin Hilman <khilman@baylibre.com> - 2016-05-14 19:50 +0200

csiph-web