Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V7 01/12] drivers: move clock common macros out from vendor directories
From: Chunyan Zhang @ 2017-12-07 12:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207125715.16160-1-chunyan.zhang@spreadtrum.com>

These macros are used by more than one SoC vendor platforms, avoid to
have many copies of these code, this patch moves them to the common
header file which every clock drivers can access to.

Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 drivers/clk/sunxi-ng/ccu_common.h | 29 -----------------------------
 drivers/clk/zte/clk.h             | 18 ------------------
 include/linux/clk-provider.h      | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 47 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h
index 5d684ce..568cfae 100644
--- a/drivers/clk/sunxi-ng/ccu_common.h
+++ b/drivers/clk/sunxi-ng/ccu_common.h
@@ -31,35 +31,6 @@
 
 struct device_node;
 
-#define CLK_HW_INIT(_name, _parent, _ops, _flags)			\
-	&(struct clk_init_data) {					\
-		.flags		= _flags,				\
-		.name		= _name,				\
-		.parent_names	= (const char *[]) { _parent },		\
-		.num_parents	= 1,					\
-		.ops 		= _ops,					\
-	}
-
-#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags)		\
-	&(struct clk_init_data) {					\
-		.flags		= _flags,				\
-		.name		= _name,				\
-		.parent_names	= _parents,				\
-		.num_parents	= ARRAY_SIZE(_parents),			\
-		.ops 		= _ops,					\
-	}
-
-#define CLK_FIXED_FACTOR(_struct, _name, _parent,			\
-			_div, _mult, _flags)				\
-	struct clk_fixed_factor _struct = {				\
-		.div		= _div,					\
-		.mult		= _mult,				\
-		.hw.init	= CLK_HW_INIT(_name,			\
-					      _parent,			\
-					      &clk_fixed_factor_ops,	\
-					      _flags),			\
-	}
-
 struct ccu_common {
 	void __iomem	*base;
 	u16		reg;
diff --git a/drivers/clk/zte/clk.h b/drivers/clk/zte/clk.h
index 4df0f12..f1041e3 100644
--- a/drivers/clk/zte/clk.h
+++ b/drivers/clk/zte/clk.h
@@ -14,24 +14,6 @@
 
 #define PNAME(x) static const char *x[]
 
-#define CLK_HW_INIT(_name, _parent, _ops, _flags)			\
-	&(struct clk_init_data) {					\
-		.flags		= _flags,				\
-		.name		= _name,				\
-		.parent_names	= (const char *[]) { _parent },		\
-		.num_parents	= 1,					\
-		.ops		= _ops,					\
-	}
-
-#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags)		\
-	&(struct clk_init_data) {					\
-		.flags		= _flags,				\
-		.name		= _name,				\
-		.parent_names	= _parents,				\
-		.num_parents	= ARRAY_SIZE(_parents),			\
-		.ops		= _ops,					\
-	}
-
 struct zx_pll_config {
 	unsigned long rate;
 	u32 cfg0;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 7c925e6..26ea037 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -806,6 +806,44 @@ extern struct of_device_id __clk_of_table;
 	}								\
 	OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver)
 
+#define CLK_HW_INIT(_name, _parent, _ops, _flags)		\
+	(&(struct clk_init_data) {				\
+		.flags		= _flags,			\
+		.name		= _name,			\
+		.parent_names	= (const char *[]) { _parent },	\
+		.num_parents	= 1,				\
+		.ops		= _ops,				\
+	})
+
+#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags)	\
+	(&(struct clk_init_data) {				\
+		.flags		= _flags,			\
+		.name		= _name,			\
+		.parent_names	= _parents,			\
+		.num_parents	= ARRAY_SIZE(_parents),		\
+		.ops		= _ops,				\
+	})
+
+#define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags)	\
+	(&(struct clk_init_data) {			\
+		.flags          = _flags,		\
+		.name           = _name,		\
+		.parent_names   = NULL,			\
+		.num_parents    = 0,			\
+		.ops            = _ops,			\
+	})
+
+#define CLK_FIXED_FACTOR(_struct, _name, _parent,			\
+			_div, _mult, _flags)				\
+	struct clk_fixed_factor _struct = {				\
+		.div		= _div,					\
+		.mult		= _mult,				\
+		.hw.init	= CLK_HW_INIT(_name,			\
+					      _parent,			\
+					      &clk_fixed_factor_ops,	\
+					      _flags),			\
+	}
+
 #ifdef CONFIG_OF
 int of_clk_add_provider(struct device_node *np,
 			struct clk *(*clk_src_get)(struct of_phandle_args *args,
-- 
2.7.4

^ permalink raw reply related

* [PATCH V7 00/12] add clock driver for Spreadtrum platforms
From: Chunyan Zhang @ 2017-12-07 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Chunyan Zhang <zhang.chunyan@linaro.org>

This series adds Spreadtrum clock support together with its binding
documentation and devicetree data.

Any comments would be greatly appreciated.

Thanks,
Chunyan

Changes from V6: (https://lkml.org/lkml/2017/11/27/217)
* Changed to use "//" format for the file header
* Addressed Stephen's comments:
  - Put the common macros in clk-provider.h instead of clk_common.h, also removed
    the same macros from sunxi-ng/ccu_common.h and zte/clk.h;
  - Removed CLK_FIXED_RATE(), and moved the fixed rate clocks from driver to DT;
  - Use devm_of_clk_add_hw_provider() instead;
  - Removed sprd_regmap_{read|write}(), use regmap API directly;
  - Removed all full stop on error messages.
* Use IS_ERR_OR_NULL() instead of IS_ERR() for checking regmap pointers;

Changes from V5: (https://lkml.org/lkml/2017/11/20/21)
* Rebased the whole patch-set to 4.15-rc1;
* Fixed kbuild-test warnings;
* Switched to use devm_clk_hw_register() instead of clk_hw_register();
* Removed useless debug information from sc9860-clk.c.

Changes from V4: (https://lkml.org/lkml/2017/11/10/30)
* Added acked-by of Rob Herring;
* Removed spin lock from Spreadtrum's gate, mux, div drivers, since we have
  switched to use regmap.

Changes from V3: (https://lkml.org/lkml/2017/11/2/61)
* Addressed comments from Julien Thierry:
  - Clean the if branch of sprd_mux_helper_get_parent()
  - Have the Gate clock macros and ops for both mode (i.e. sc_gate and gate) separate;
  - Have the Mux clock macros with/without table separate, and same changes
    for the composite clock.
* Switched the function name from _endisable to _toggle;
* Fixed Kbuild test error:
  - Added exporting sprd_clk_regmap_init() which would be used in other module(s);
* Change the function sprd_clk_set_regmap() to the static one, and removed the
  declear from the include file;
* Addressed comments from Rob:
  - Separate the dt-binding include file from the driver patch;
  - Documented more for the property "clocks"
* Changed the syscon device names;
* Changed the name of 'sprd_mux_internal' to 'sprd_mux_ssel'
  

Changes from V2: (http://lkml.iu.edu/hypermail/linux/kernel/1707.1/01504.html)
* Switch to use regmap to access registers;
* Splited all clocks into 16 separated nodes, for each belongs to a single address area; 
* Rearranged the order of clock declaration in sc9860-clk.c, sorted them upon the address area;
* Added syscon device tree nodes which will be quoted by the node of clocks which are in
  the same address area with the syscon device;
* Revised the binding documentation according to the dt modification. 

Changes from V1: (https://lkml.org/lkml/2017/6/17/356)
* Address Stephen's comments:
  - Switch to use platform device driver instead of the DT probing mechanism.
  - Move the common clock macro out from vendor directory, but need to remove those
    overlap code from other vendors (such as sunxi-ng) once this get merged.
  - Add support to be built as a module.
  - Add 'sprd_' prefix for all spin locks used in these drivers.
  - Mark input parameter of sprd_x with const.
  - Remove unreasonable dependencies to CONFIG_64BIT.
  - Add readl() after writing the same register.
  - Remove CLK_IS_BASIC which is no longer used.
  - Remove unnecessery CLK_IGNORE_UNUSED when defining a clock.
  - Change to expose all clock index.
  - Use clk_ instead of ccu.
  - Add Kconfig for sprd clocks.
  - Move the fixed clocks out from the soc node.
  - Switch to use 64-bit math in pll driver instead of 32-bit math.
* Revise binding documentation according to dt modification.
* Rename sc9860.c to sc9860-clk.c


Chunyan Zhang (12):
  drivers: move clock common macros out from vendor directories
  clk: sprd: Add common infrastructure
  clk: sprd: add gate clock support
  clk: sprd: add mux clock support
  clk: sprd: add divider clock support
  clk: sprd: add composite clock support
  clk: sprd: add adjustable pll support
  dt-bindings: Add Spreadtrum clock binding documentation
  clk: sprd: Add dt-bindings include file for SC9860
  clk: sprd: add clocks support for SC9860
  arm64: dts: add syscon for whale2 platform
  arm64: dts: add clocks for SC9860

 Documentation/devicetree/bindings/clock/sprd.txt |   63 +
 arch/arm64/boot/dts/sprd/sc9860.dtsi             |  115 ++
 arch/arm64/boot/dts/sprd/whale2.dtsi             |   62 +-
 drivers/clk/Kconfig                              |    1 +
 drivers/clk/Makefile                             |    1 +
 drivers/clk/sprd/Kconfig                         |   14 +
 drivers/clk/sprd/Makefile                        |   11 +
 drivers/clk/sprd/common.c                        |   96 ++
 drivers/clk/sprd/common.h                        |   38 +
 drivers/clk/sprd/composite.c                     |   60 +
 drivers/clk/sprd/composite.h                     |   51 +
 drivers/clk/sprd/div.c                           |   90 +
 drivers/clk/sprd/div.h                           |   75 +
 drivers/clk/sprd/gate.c                          |  111 ++
 drivers/clk/sprd/gate.h                          |   59 +
 drivers/clk/sprd/mux.c                           |   76 +
 drivers/clk/sprd/mux.h                           |   74 +
 drivers/clk/sprd/pll.c                           |  266 +++
 drivers/clk/sprd/pll.h                           |  108 ++
 drivers/clk/sprd/sc9860-clk.c                    | 1974 ++++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu_common.h                |   29 -
 drivers/clk/zte/clk.h                            |   18 -
 include/dt-bindings/clock/sprd,sc9860-clk.h      |  404 +++++
 include/linux/clk-provider.h                     |   38 +
 24 files changed, 3785 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd.txt
 create mode 100644 drivers/clk/sprd/Kconfig
 create mode 100644 drivers/clk/sprd/Makefile
 create mode 100644 drivers/clk/sprd/common.c
 create mode 100644 drivers/clk/sprd/common.h
 create mode 100644 drivers/clk/sprd/composite.c
 create mode 100644 drivers/clk/sprd/composite.h
 create mode 100644 drivers/clk/sprd/div.c
 create mode 100644 drivers/clk/sprd/div.h
 create mode 100644 drivers/clk/sprd/gate.c
 create mode 100644 drivers/clk/sprd/gate.h
 create mode 100644 drivers/clk/sprd/mux.c
 create mode 100644 drivers/clk/sprd/mux.h
 create mode 100644 drivers/clk/sprd/pll.c
 create mode 100644 drivers/clk/sprd/pll.h
 create mode 100644 drivers/clk/sprd/sc9860-clk.c
 create mode 100644 include/dt-bindings/clock/sprd,sc9860-clk.h

-- 
2.7.4

^ permalink raw reply

* [PATCH v2 4/8] clocksource: owl: Prepare S700
From: Andreas Färber @ 2017-12-07 12:47 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <126e159d-76db-8249-6844-d2a968c4a083@linaro.org>

Am 07.12.2017 um 10:23 schrieb Daniel Lezcano:
> On 05/12/2017 00:00, Andreas F?rber wrote:
>> Hi Daniel,
>>
>> Am 14.11.2017 um 00:34 schrieb Andreas F?rber:
>>> Actions S700 has two 2Hz timers like S500, and four TIMx timers like S900.
>>>
>>> Signed-off-by: Andreas F?rber <afaerber@suse.de>
>>> ---
>>>  v1 -> v2:
>>>  * Adopted TIMER_OF_DECLARE() (Daniel)
>>>  
>>>  drivers/clocksource/owl-timer.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>
>> Are you planning to queue this v2 patch for 4.16?
> 
> Yeah, what about the patch 1/8 ?

In linux-next already.

If you take 2-4, I can take 5; if you'd rather have me take the binding,
fine with me as well.

Thanks,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply

* [RFC] Improving udelay/ndelay on platforms where that is possible
From: Pavel Machek @ 2017-12-07 12:43 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171115131351.GE31757@n2100.armlinux.org.uk>

> On Wed, Nov 15, 2017 at 01:51:54PM +0100, Marc Gonzalez wrote:
> > On 01/11/2017 20:38, Marc Gonzalez wrote:
> > 
> > > OK, I'll just send my patch, and then crawl back under my rock.
> > 
> > Linus,
> > 
> > As promised, the patch is provided below. And as promised, I will
> > no longer bring this up on LKML.
> > 
> > FWIW, I have checked that the computed value matches the expected
> > value for all HZ and delay_us, and for a few clock frequencies,
> > using the following program:
> > 
> > $ cat delays.c
> > #include <stdio.h>
> > #define MEGA 1000000u
> > typedef unsigned int uint;
> > typedef unsigned long long u64;
> > #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> > 
> > static const uint HZ_tab[] = { 100, 250, 300, 1000 };
> > 
> > static void check_cycle_count(uint freq, uint HZ, uint delay_us)
> > {
> > 	uint UDELAY_MULT = (2147 * HZ) + (483648 * HZ / MEGA);
> > 	uint lpj = DIV_ROUND_UP(freq, HZ);
> > 	uint computed = ((u64)lpj * delay_us * UDELAY_MULT >> 31) + 1;
> > 	uint expected = DIV_ROUND_UP((u64)delay_us * freq, MEGA);
> > 
> > 	if (computed != expected)
> > 		printf("freq=%u HZ=%u delay_us=%u comp=%u exp=%u\n", freq, HZ, delay_us, computed, expected);
> > }
> > 
> > int main(void)
> > {
> > 	uint idx, delay_us, freq;
> > 
> > 	for (freq = 3*MEGA; freq <= 100*MEGA; freq += 3*MEGA)
> > 		for (idx = 0; idx < sizeof HZ_tab / sizeof *HZ_tab; ++idx)
> > 			for (delay_us = 1; delay_us <= 2000; ++delay_us)
> > 				check_cycle_count(freq, HZ_tab[idx], delay_us);
> > 
> > 	return 0;
> > }
> > 
> > 
> > 
> > -- >8 --
> > Subject: [PATCH] ARM: Tweak clock-based udelay implementation
> > 
> > In 9f8197980d87a ("delay: Add explanation of udelay() inaccuracy")
> > Russell pointed out that loop-based delays may return early.
> > 
> > On the arm platform, delays may be either loop-based or clock-based.
> > 
> > This patch tweaks the clock-based implementation so that udelay(N)
> > is guaranteed to spin at least N microseconds.
> 
> As I've already said, I don't want this, because it encourages people
> to use too-small delays in driver code, and if we merge it then you
> will look at your data sheet, decide it says "you need to wait 10us"
> and write in your driver "udelay(10)" which will break on the loops
> based delay.
> 
> udelay() needs to offer a consistent interface so that drivers know
> what to expect no matter what the implementation is.  Making one
> implementation conform to your ideas while leaving the other
> implementations with other expectations is a recipe for bugs.

udelay() needs to be consistent across platforms, and yes, udelay(10)
is expected to delay at least 10usec.

If that is not true on your platform, _fix your platform_. But it is
not valid to reject patches fixing other platforms, just because your
platform is broken.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply

* [PATCH V6 0/7] dmaengine: qcom_hidma: add support for bugfixed HW
From: Sakari Ailus @ 2017-12-07 12:41 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAJZ5v0gq-Xv1V90GEcfxdnrADQn2Gern=LBnsbSzmrU9M0+FEQ@mail.gmail.com>

On Tue, Dec 05, 2017 at 11:05:52PM +0100, Rafael J. Wysocki wrote:
> On Tue, Dec 5, 2017 at 6:04 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
> > Introduce new ACPI and OF device ids for thw HW along with the helper
> > functions.
> >
> > Changes from v5:
> > * use struct device as a calling parameter to get_match_data() callback
> > so that we can reuse the existing OF API.
> > * revert the change on acpi_get_match_data() to V4.
> >
> > Sinan Kaya (7):
> >   Documentation: DT: qcom_hidma: Bump HW revision for the bugfixed HW
> >   ACPI / bus: Introduce acpi_get_match_data() function
> >   device property: Introduce a common API to fetch device match data
> >   OF: properties: Implement get_match_data() callback
> >   ACPI: properties: Implement get_match_data() callback
> >   dmaengine: qcom_hidma: Add support for the new revision
> >   dmaengine: qcom_hidma: Add identity register support
> 
> Sakari, can you please have a look at this series?
> 
> I'm particularly interested in your opinion on patches [2-3/7] and [5/7].

Reviewed. Thanks for the heads up!

-- 
Sakari Ailus
e-mail: sakari.ailus at iki.fi

^ permalink raw reply

* [PATCH V6 3/7] device property: Introduce a common API to fetch device match data
From: Sakari Ailus @ 2017-12-07 12:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512493493-6464-4-git-send-email-okaya@codeaurora.org>

On Tue, Dec 05, 2017 at 12:04:48PM -0500, Sinan Kaya wrote:
> @@ -101,6 +103,8 @@ struct fwnode_operations {
>  	(*graph_get_port_parent)(struct fwnode_handle *fwnode);
>  	int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
>  				    struct fwnode_endpoint *endpoint);
> +	void *(*get_match_data)(const struct fwnode_handle *fwnode,
> +				struct device *dev);

You can make dev const, too.

-- 
Sakari Ailus
e-mail: sakari.ailus at iki.fi

^ permalink raw reply

* [PATCH V6 4/7] OF: properties: Implement get_match_data() callback
From: Sakari Ailus @ 2017-12-07 12:38 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512493493-6464-5-git-send-email-okaya@codeaurora.org>

Hi Sinan,

On Tue, Dec 05, 2017 at 12:04:49PM -0500, Sinan Kaya wrote:
> Now that we have a get_match_data() callback as part of the firmware node,
> implement the OF specific piece for it.
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/of/property.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 264c355..9964169 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -981,6 +981,12 @@ static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
>  	return 0;
>  }
>  
> +void *of_fwnode_get_match_data(const struct fwnode_handle *fwnode,
> +			       struct device *dev)

static, as Rob mentioned.

> +{
> +	return (void *)of_device_get_match_data(dev);
> +}
> +
>  const struct fwnode_operations of_fwnode_ops = {
>  	.get = of_fwnode_get,
>  	.put = of_fwnode_put,
> @@ -996,5 +1002,6 @@ static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
>  	.graph_get_remote_endpoint = of_fwnode_graph_get_remote_endpoint,
>  	.graph_get_port_parent = of_fwnode_graph_get_port_parent,
>  	.graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
> +	.get_match_data = of_fwnode_get_match_data,

Please arrange right after device_is_available, the same applies to the
ACPI equivalent (5th patch).

>  };
>  EXPORT_SYMBOL_GPL(of_fwnode_ops);

With the above changes plus the ones in my comments on 3rd patch, on
patches 3--5:

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus at iki.fi

^ permalink raw reply

* Applied "spi: sun4i: disable clocks in the remove function" to the spi tree
From: Mark Brown @ 2017-12-07 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512631227-27334-1-git-send-email-takuo.koguchi.sw@hitachi.com>

The patch

   spi: sun4i: disable clocks in the remove function

has been applied to the spi tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From c810daba0ab5226084a56893a789af427a801146 Mon Sep 17 00:00:00 2001
From: Takuo Koguchi <takuo.koguchi@gmail.com>
Date: Thu, 7 Dec 2017 16:20:14 +0900
Subject: [PATCH] spi: sun4i: disable clocks in the remove function

mclk and hclk need to be disabled. Since pm_runtime_disable does
not disable the clocks, use pm_runtime_force_suspend instead.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Takuo Koguchi <takuo.koguchi.sw@hitachi.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-sun4i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
index c5cd635c28f3..41410031f8e9 100644
--- a/drivers/spi/spi-sun4i.c
+++ b/drivers/spi/spi-sun4i.c
@@ -525,7 +525,7 @@ static int sun4i_spi_probe(struct platform_device *pdev)
 
 static int sun4i_spi_remove(struct platform_device *pdev)
 {
-	pm_runtime_disable(&pdev->dev);
+	pm_runtime_force_suspend(&pdev->dev);
 
 	return 0;
 }
-- 
2.15.0

^ permalink raw reply related

* [RFC] Improving udelay/ndelay on platforms where that is possible
From: Pavel Machek @ 2017-12-07 12:31 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAD=FV=VKEz9jvJaD2KTitH=2G+wb42RXHyRVKi4-zrypAu9jSA@mail.gmail.com>

Hi!

> On Wed, Nov 1, 2017 at 2:26 AM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
> > On Tue, Oct 31, 2017 at 05:23:19PM -0700, Doug Anderson wrote:
> >> Hi,
> >>
> >> On Tue, Oct 31, 2017 at 10:45 AM, Linus Torvalds
> >> <torvalds@linux-foundation.org> wrote:
> >> > So I'm very much open to udelay improvements, and if somebody sends
> >> > patches for particular platforms to do particularly well on that
> >> > platform, I think we should merge them. But ...
> >>
> >> If I'm reading this all correctly, this sounds like you'd be willing
> >> to merge <https://patchwork.kernel.org/patch/9429841/>.  This makes
> >> udelay() guaranteed not to underrun on arm32 platforms.
> >
> > That's a mis-representation again.  It stops a timer-based udelay()
> > possibly underrunning by one tick if we are close to the start of
> > a count increment.  However, it does nothing for the loops_per_jiffy
> > udelay(), which can still underrun.
> >
> > My argument against merging that patch is that with it merged, we get
> > (as you say) a udelay() that doesn't underrun _when using a timer_
> > but when we end up using the loops_per_jiffy udelay(), we're back to
> > the old problem.
> >
> > My opinion is that's bad, because it encourages people to write drivers
> > that rely on udelay() having "good" behaviour, which it is not guaranteed
> > to have.  So, they'll specify a delay period of exactly what they want,
> > and their drivers will then fail when running on systems that aren't
> > using a timer-based udelay().
> 
> IMHO the current udelay is broken in an off-by-one way and it's easy
> to fix.  Intentionally leaving a bug in the code seems silly.  This
> seems to by what Linus is saying with his statement that "(a) platform
> code could try to make their udelay/ndelay() be as good as it can be
> on a particular platform".
> 
> So no matter the rest of the discussions, we should land that.  If you
> disagree then I'm happy to re-post that patch straight to Linus later
> this week since it sounds as if he'd take it.

Did this get fixed in any way? Russell having crazy arguments for
keeping kernel buggy should not be good enough reason to keep the
bugs...

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply

* [PATCH V6 3/7] device property: Introduce a common API to fetch device match data
From: Sakari Ailus @ 2017-12-07 12:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512493493-6464-4-git-send-email-okaya@codeaurora.org>

Hi Sinan,

Thanks for the update.

Just one small comment below.

On Tue, Dec 05, 2017 at 12:04:48PM -0500, Sinan Kaya wrote:
> There is an OF/ACPI function to obtain the driver data. We want to hide
> OF/ACPI details from the device drivers and abstract following the device
> family of functions.
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/base/property.c  | 6 ++++++
>  include/linux/fwnode.h   | 4 ++++
>  include/linux/property.h | 2 ++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 7ed99c1..65bf6f2 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -1335,3 +1335,9 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
>  	return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint);
>  }
>  EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
> +
> +void *device_get_match_data(struct device *dev)
> +{
> +	return fwnode_call_ptr_op(dev_fwnode(dev), get_match_data, dev);
> +}
> +EXPORT_SYMBOL_GPL(device_get_match_data);
> diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> index 0c35b6c..ab9aab5 100644
> --- a/include/linux/fwnode.h
> +++ b/include/linux/fwnode.h
> @@ -15,6 +15,7 @@
>  #include <linux/types.h>
>  
>  struct fwnode_operations;
> +struct device;
>  
>  struct fwnode_handle {
>  	struct fwnode_handle *secondary;
> @@ -66,6 +67,7 @@ struct fwnode_reference_args {
>   *			       endpoint node.
>   * @graph_get_port_parent: Return the parent node of a port node.
>   * @graph_parse_endpoint: Parse endpoint for port and endpoint id.
> + * @get_match_data: Return the driver match data.

Could you arrange the new get_match_data op closer to the other ops that
don't deal with the graphs? Such as device_is_available. As the ops are
dealing generally with fwnodes, I might call this device_get_match_data to
explicitly mention it's for devices.

>   */
>  struct fwnode_operations {
>  	void (*get)(struct fwnode_handle *fwnode);
> @@ -101,6 +103,8 @@ struct fwnode_operations {
>  	(*graph_get_port_parent)(struct fwnode_handle *fwnode);
>  	int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
>  				    struct fwnode_endpoint *endpoint);
> +	void *(*get_match_data)(const struct fwnode_handle *fwnode,
> +				struct device *dev);

Same comment about the order here.

>  };
>  
>  #define fwnode_has_op(fwnode, op)				\
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 6bebee1..01fa55b 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -275,6 +275,8 @@ int device_add_properties(struct device *dev,
>  
>  enum dev_dma_attr device_get_dma_attr(struct device *dev);
>  
> +void *device_get_match_data(struct device *dev);
> +
>  int device_get_phy_mode(struct device *dev);
>  
>  void *device_get_mac_address(struct device *dev, char *addr, int alen);

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus at iki.fi

^ permalink raw reply

* [RFC 3/9] arm64: handle 52-bit addresses in TTBR
From: Kristina Martsenko @ 2017-12-07 12:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <8ebb78d3-68b0-3272-e12b-005c1b524736@arm.com>

On 21/11/17 14:39, Robin Murphy wrote:
> Hi Kristina,
> 
> On 21/11/17 11:57, Kristina Martsenko wrote:
>> The top 4 bits of a 52-bit physical address are positioned at bits 2..5
>> in the TTBR registers. Introduce a couple of macros to move the bits
>> there, and change all TTBR writers to use them.
>>
>> Leave TTBR0 PAN code unchanged, to avoid complicating it. A system with
>> 52-bit PA will have PAN anyway (because it's ARMv8.1 or later), and a
>> system without 52-bit PA can only use up to 48-bit PAs. Add a kconfig
>> dependency to ensure PAN is configured.
>>
>> In addition, when using 52-bit PA there is a special alignment
>> requirement on the top-level table. We don't currently have any VA_BITS
>> configuration that would violate the requirement, but one could be added
>> in the future, so add a compile-time BUG_ON to check for it.
>>
>> Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com>
>> ---

[...]

>> diff --git a/arch/arm64/include/asm/assembler.h
>> b/arch/arm64/include/asm/assembler.h
>> index 04cf94766b78..ba3c796b9fe1 100644
>> --- a/arch/arm64/include/asm/assembler.h
>> +++ b/arch/arm64/include/asm/assembler.h
>> @@ -512,4 +512,21 @@ alternative_else_nop_endif
>> ? #endif
>> ????? .endm
>> ? +/*
>> + * Arrange a physical address in a TTBR register, taking care of 52-bit
>> + * addresses.
>> + *
>> + *???? phys:??? physical address, preserved
>> + *???? ttbr:??? returns the TTBR value
>> + */
>> +??? .macro??? phys_to_ttbr, phys, ttbr
>> +#ifdef CONFIG_ARM64_PA_BITS_52
>> +??? and??? \ttbr, \phys, #(1 << 48) - 1
>> +??? orr??? \ttbr, \ttbr, \phys, lsr #48 - 2
>> +??? bic??? \ttbr, \ttbr, #(1 << 2) - 1
> 
> Is there any reason for masking off each end of the result separately
> like this, or could we just do it more straightforwardly?

I don't recall any reason, maybe just to keep it simple, to avoid having
a separate mask macro.

> #define TTBR_BADDR_MASK ((1 << 46) - 1) << 2
> 
> ????orr??? \ttbr, \phys, \phys, lsr #46
> ????and??? \ttbr, \ttbr, #TTBR_BADDR_MASK
> 
> (and equivalently for phys_to_pte in patch 4)

Ok, I'll rewrite it like this. (Note that mask is 52-bit-specific though.)

> Even better if there's a convenient place to define the mask such that
> it can be shared with KVM's existing VTTBR stuff too.

Do you mean VTTBR_BADDR_MASK? I don't think this would be useful there,
VTTBR_BADDR_MASK checks the alignment of the address that goes into
VTTBR (not the VTTBR value itself), and takes into account specifically
the 40-bit IPA and concatenated page tables.

Kristina

>> +#else
>> +??? mov??? \ttbr, \phys
>> +#endif
>> +??? .endm
>> +
>> ? #endif??? /* __ASM_ASSEMBLER_H */

^ permalink raw reply

* [PATCH v3 08/15] drm/sun4i: Add LVDS support
From: Maxime Ripard @ 2017-12-07 12:25 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAGb2v65Voua-AjHDnCLgDOKqUeSG-yD4wuSO5-BJ230FCp4OuQ@mail.gmail.com>

Hi,

On Thu, Dec 07, 2017 at 02:05:47PM +0800, Chen-Yu Tsai wrote:
> > +static void sun4i_tcon_lvds_set_status(struct sun4i_tcon *tcon,
> > +                                      const struct drm_encoder *encoder,
> > +                                      bool enabled)
> > +{
> > +       if (enabled) {
> > +               u8 val;
> > +
> > +               regmap_update_bits(tcon->regs, SUN4I_TCON0_LVDS_IF_REG,
> > +                                  SUN4I_TCON0_LVDS_IF_EN,
> > +                                  SUN4I_TCON0_LVDS_IF_EN);
> > +
> > +               regmap_write(tcon->regs, SUN4I_TCON0_LVDS_ANA0_REG,
> > +                            SUN4I_TCON0_LVDS_ANA0_C(2) |
> > +                            SUN4I_TCON0_LVDS_ANA0_V(3) |
> > +                            SUN4I_TCON0_LVDS_ANA0_PD(2) |
> > +                            SUN4I_TCON0_LVDS_ANA0_EN_LDO);
> > +               udelay(2);
> > +
> > +               regmap_update_bits(tcon->regs, SUN4I_TCON0_LVDS_ANA0_REG,
> > +                                  SUN4I_TCON0_LVDS_ANA0_EN_MB,
> > +                                  SUN4I_TCON0_LVDS_ANA0_EN_MB);
> > +               udelay(2);
> > +
> > +               regmap_update_bits(tcon->regs, SUN4I_TCON0_LVDS_ANA0_REG,
> > +                                  SUN4I_TCON0_LVDS_ANA0_EN_DRVC,
> > +                                  SUN4I_TCON0_LVDS_ANA0_EN_DRVC);
> > +
> > +               if (sun4i_tcon_get_pixel_depth(encoder) == 18)
> > +                       val = 7;
> > +               else
> > +                       val = 0xf;
> > +
> > +               regmap_write_bits(tcon->regs, SUN4I_TCON0_LVDS_ANA0_REG,
> > +                                 SUN4I_TCON0_LVDS_ANA0_EN_DRVD(0xf),
> > +                                 SUN4I_TCON0_LVDS_ANA0_EN_DRVD(val));
> 
> I suggest changing the prefix of the macros of the analog bits to
> SUN6I_TCON0_*. The register definitions and sequence do not apply
> to the A10/A20. Furthermore you should add a comment saying this
> doesn't apply to the A10/A20. In the future we might want to move
> this part into a separate function, referenced by a function pointer
> from the quirks structure.

I'll change the bit field names and add a comment like you suggested.

> > +       } else {
> > +               regmap_update_bits(tcon->regs, SUN4I_TCON0_LVDS_IF_REG,
> > +                                  SUN4I_TCON0_LVDS_IF_EN, 0);
> > +       }
> > +}
> > +
> >  void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
> >                            const struct drm_encoder *encoder,
> >                            bool enabled)
> >  {
> > +       bool is_lvds = false;
> >         int channel;
> >
> >         switch (encoder->encoder_type) {
> > +       case DRM_MODE_ENCODER_LVDS:
> > +               is_lvds = true;
> > +               /* Fallthrough */
> >         case DRM_MODE_ENCODER_NONE:
> >                 channel = 0;
> >                 break;
> > @@ -84,10 +171,16 @@ void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
> >                 return;
> >         }
> >
> > +       if (is_lvds && !enabled)
> > +               sun4i_tcon_lvds_set_status(tcon, encoder, false);
> > +
> >         regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
> >                            SUN4I_TCON_GCTL_TCON_ENABLE,
> >                            enabled ? SUN4I_TCON_GCTL_TCON_ENABLE : 0);
> >
> > +       if (is_lvds && enabled)
> > +               sun4i_tcon_lvds_set_status(tcon, encoder, true);
> > +
> >         sun4i_tcon_channel_set_status(tcon, channel, enabled);
> >  }
> >
> > @@ -170,6 +263,78 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
> >                      SUN4I_TCON0_BASIC0_Y(mode->crtc_vdisplay));
> >  }
> >
> > +static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
> > +                                     const struct drm_encoder *encoder,
> > +                                     const struct drm_display_mode *mode)
> > +{
> > +       unsigned int bp;
> > +       u8 clk_delay;
> > +       u32 reg, val = 0;
> > +
> > +       tcon->dclk_min_div = 7;
> > +       tcon->dclk_max_div = 7;
> > +       sun4i_tcon0_mode_set_common(tcon, mode);
> > +
> > +       /* Adjust clock delay */
> > +       clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
> > +       regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
> > +                          SUN4I_TCON0_CTL_CLK_DELAY_MASK,
> > +                          SUN4I_TCON0_CTL_CLK_DELAY(clk_delay));
> > +
> > +       /*
> > +        * This is called a backporch in the register documentation,
> > +        * but it really is the back porch + hsync
> > +        */
> > +       bp = mode->crtc_htotal - mode->crtc_hsync_start;
> > +       DRM_DEBUG_DRIVER("Setting horizontal total %d, backporch %d\n",
> > +                        mode->crtc_htotal, bp);
> > +
> > +       /* Set horizontal display timings */
> > +       regmap_write(tcon->regs, SUN4I_TCON0_BASIC1_REG,
> > +                    SUN4I_TCON0_BASIC1_H_TOTAL(mode->htotal) |
> > +                    SUN4I_TCON0_BASIC1_H_BACKPORCH(bp));
> > +
> > +       /*
> > +        * This is called a backporch in the register documentation,
> > +        * but it really is the back porch + hsync
> > +        */
> > +       bp = mode->crtc_vtotal - mode->crtc_vsync_start;
> > +       DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n",
> > +                        mode->crtc_vtotal, bp);
> > +
> > +       /* Set vertical display timings */
> > +       regmap_write(tcon->regs, SUN4I_TCON0_BASIC2_REG,
> > +                    SUN4I_TCON0_BASIC2_V_TOTAL(mode->crtc_vtotal * 2) |
> > +                    SUN4I_TCON0_BASIC2_V_BACKPORCH(bp));
> 
> Can we move the above to a common function?

Until we have DSI support figured out I'd rather not do too much of
consolidation. We know already a few things are going to change there
(like the clk_delay), but it's not clear yet how much.

> > +       /* Map output pins to channel 0 */
> > +       regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
> > +                          SUN4I_TCON_GCTL_IOMAP_MASK,
> > +                          SUN4I_TCON_GCTL_IOMAP_TCON0);
> > +
> > +       /* Enable the output on the pins */
> > +       regmap_write(tcon->regs, SUN4I_TCON0_IO_TRI_REG, 0xe0000000);
> 
> Is this still needed? You are no longer using the TCON LCD pins
> with LVDS.

We do. It's a separate function of the pins, but it's the same pins.

> >  static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
> >         .has_channel_1          = true,
> > +       .has_lvds_pll           = true,
> 
> The A31s does not have MIPI.

I'll change that.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171207/bcca38af/attachment.sig>

^ permalink raw reply

* [PATCH v5 15/30] arm64/sve: Signal handling support
From: Dave Martin @ 2017-12-07 12:03 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207104948.GE31900@arm.com>

On Thu, Dec 07, 2017 at 10:49:48AM +0000, Will Deacon wrote:
> Hi Kees,
> 
> On Wed, Dec 06, 2017 at 11:56:50AM -0800, Kees Cook wrote:
> > On Tue, Oct 31, 2017 at 8:51 AM, Dave Martin <Dave.Martin@arm.com> wrote:
> > > Miscellaneous:
> > >
> > >  * Change inconsistent copy_to_user() calls to __copy_to_user() in
> > >    preserve_sve_context().
> > >
> > >    There are already __put_user_error() calls here.
> > >
> > >    The whole extended signal frame is already checked for
> > >    access_ok(VERIFY_WRITE) in get_sigframe().
> > 
> > Verifying all these __copy_to/from_user() calls is rather non-trivial.
> > For example, I had to understand that the access_ok() check actually
> > spans memory that both user->sigframe and user->next_frame point into.
> 
> I don't think that's particularly difficult -- you just have to read the
> four lines preceding the access_ok.
> 
> > And it isn't clear to me that all users of apply_user_offset() are
> > within this range too, along with other manually calculated offsets in
> > setup_sigframe().
> 
> The offsets passed into apply_user_offset are calculated by
> setup_sigframe_layout as the stack is allocated, so they're correct by
> construction. We could add a size check in apply_user_offset if you like?

Adding a BUG_ON(out of bounds) in apply_user_offset doesn't seem a
terrible idea.

> > And it's not clear if parse_user_sigframe() is safe either. Are
> > user->fpsimd and user->sve checked somewhere? It seems like it's
> > safely contained by in sf->uc.uc_mcontext.__reserved, but it's hard to
> > read, though I do see access_ok() checks against __reserved at the end
> > of the while loop.
> 
> This one is certainly more difficult to follow, mainly because it's spread
> about a bit and we have to check the extra context separately. However, the
> main part of the frame is checked in sys_rt_sigreturn before calling
> restore_sigframe, and the extra context is checked in parse_user_sigframe
> if we find it.
> 
> Dave, any thoughts on making this easier to understand?

I'm open to ideas myself -- I did screw this up previously with the
missing access_ok() check on the extra_context data area -- though
that wasn't catastrophic since that area is enforced to be contiguous
with the base frame which was always access_ok() checked.


During development, many essential invariants were "documented" using
BUG_ON()s.  Unfortunately we don't really distinguish between marking
invariants that should be derivable from each other and from the code,
and marking things that the developer merely hopes are true (or would
rather not think about at all).  Comprehensive annotation also
burdens the code with a lot of clutter...


It would be good if there were type annotations for pointers that have
passed through the access_ok() check that could be analysed by tools,
something like:

	void __user __user_write_ok(base_offset, size) *p;

Such type annotations could be derived via an access_ok() check, and
taken into account by checkers examining calls to __put_user() etc.:
ultimately __put_user() might be forbidden on types lacking an
annotation with sufficient bounds.

The devil is in the detail though, and to be most useful the
annotations would need to be bindable to runtime values, not
just constants.  This does not preclude static analysis, but it's
far from trivial.  Has anything like this been considered in the past?


For the sigframe code, here's my rationale -- I'm happy to base
comments on it, but the more rationale is documented in comments
the higher the risk that the code will drift away from it over
time without anybody noticing...

Would you pick anything out of this as particularly critical?


The basic flow is:

Signal delivery
---------------
 1. The location and size of each signal frame block is calculated
    in terms of offsets from the base of the frame.

    (Done by setup_sigframe_layout().)

 2. The base (user) address of the frame is calculated by subtracting
    the overall size of the computed frame from the initial user sp.

 3. access_ok() is done on the resulting address range.

    (Steps 2-3 are done by get_sigframe().)

 4. The signal frame is poked using addresses derived in two ways:

  a) Direct derivation from the user sp, within the bounds of the
     access_ok() check in get_sigframe().

  b) Addition to the sigframe base address, of offsets computed in (1);
     these fall with the access_ok() range by construction due to the
     way the access_ok() range is computed from those offsets in the
     first place.

     (b) is done by apply_user_offset(), with no further checks.


Signal return
-------------
 1. The base signal frame is access_ok()'d.

    (sys_rt_sigreturn())

 2. Contents of the base frame is read out and processed using the
    same base address and within the range that was access_ok()'d.

    (restore_sigframe())

 2. parse_user_sigframe() walks over its contents, picking out __user
    pointers to the records found.  The parse is bounded to within the
    access_ok()'d size by the limit variable in parse_user_sigframe().

    Only __user * pointers whose referent's full bounds fit within the
    limits are picked out.
   
 3. limit is updated only for extra_context, and only one extra_context
    is allowed (policed by the have_extra_context bool).

    The extension area that the extra_context block points to is
    required to be contiguous with the end of the (already access_ok()'d)
    sigframe.  The additional space is access_ok()'d and limit updated
    accordingly.

    Parsing then proceeds, still bounded by limit.

 4. The signal frame contents are read out and processed using pointers
    derived by parse_user_sigframe().


Cheers
---Dave

^ permalink raw reply

* [PATCH V3] spi: sun4i: disable clocks in the remove function
From: Mark Brown @ 2017-12-07 11:58 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1512631227-27334-1-git-send-email-takuo.koguchi.sw@hitachi.com>

On Thu, Dec 07, 2017 at 04:20:14PM +0900, Takuo Koguchi wrote:
> mclk and hclk need to be disabled. Since pm_runtime_disable does
> not disable the clocks, use pm_runtime_force_suspend instead.

Please don't send new patches in reply to existing threads, it makes it
harder to spot them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171207/5a69ab48/attachment-0001.sig>

^ permalink raw reply

* [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data()
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <ff2797a0487a0b30a2292c2685dedcbbfeead293.1512647458.git.chunfeng.yun@mediatek.com>

reduce the boilerplate code to get the specific data

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index d99f79b1..bd26de3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -20,6 +20,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 
@@ -995,7 +996,6 @@ static struct phy *mtk_phy_xlate(struct device *dev,
 
 static int mtk_tphy_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device_node *child_np;
@@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	struct resource res;
 	int port, retval;
 
-	match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
-	if (!match)
-		return -EINVAL;
-
 	tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
 	if (!tphy)
 		return -ENOMEM;
 
-	tphy->pdata = match->data;
+	tphy->pdata = of_device_get_match_data(dev);
+	if (!tphy->pdata)
+		return -EINVAL;
+
 	tphy->nphys = of_get_child_count(np);
 	tphy->phys = devm_kcalloc(dev, tphy->nphys,
 				  sizeof(*tphy->phys), GFP_KERNEL);
-- 
1.9.1

^ permalink raw reply related

* [PATCH 2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <ff2797a0487a0b30a2292c2685dedcbbfeead293.1512647458.git.chunfeng.yun@mediatek.com>

V1 TPHY for SATA doesn't have shared banks if it isn't shared
with PCIe or USB, so make it optional.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 5d9d7f3..d99f79b1 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -1023,9 +1023,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
 	tphy->dev = dev;
 	platform_set_drvdata(pdev, tphy);
 
-	if (tphy->pdata->version == MTK_PHY_V1) {
+	sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	/* SATA phy of V1 needn't it if not shared with PCIe or USB */
+	if (sif_res && tphy->pdata->version == MTK_PHY_V1) {
 		/* get banks shared by multiple phys */
-		sif_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		tphy->sif_base = devm_ioremap_resource(dev, sif_res);
 		if (IS_ERR(tphy->sif_base)) {
 			dev_err(dev, "failed to remap sif regs\n");
-- 
1.9.1

^ permalink raw reply related

* [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
From: Chunfeng Yun @ 2017-12-07 11:53 UTC (permalink / raw)
  To: linux-arm-kernel

When system is running, if usb2 phy is forced to bypass utmi signals,
all PLL will be turned off, and it can't detect device connection
anymore, so replace force mode with auto mode which can bypass utmi
signals automatically if no device attached for normal flow.
But keep the force mode to fix RX sensitivity degradation issue.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index fb8aba4..5d9d7f3 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* switch to USB function. (system register, force ip into usb mode) */
+	/* switch to USB function, and enable usb pll */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_FORCE_UART_EN;
+	tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM);
 	tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(struct mtk_tphy *tphy,
 	u32 index = instance->index;
 	u32 tmp;
 
-	/* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */
 	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL);
-	tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
+	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK);
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Enable */
@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 
 	tmp = readl(com + U3P_U2PHYDTM0);
 	tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN);
-	tmp |= P2C_FORCE_SUSPENDM;
 	writel(tmp, com + U3P_U2PHYDTM0);
 
 	/* OTG Disable */
@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(struct mtk_tphy *tphy,
 	tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN;
 	writel(tmp, com + U3P_USBPHYACR6);
 
-	/* let suspendm=0, set utmi into analog power down */
-	tmp = readl(com + U3P_U2PHYDTM0);
-	tmp &= ~P2C_RG_SUSPENDM;
-	writel(tmp, com + U3P_U2PHYDTM0);
-	udelay(1);
-
 	tmp = readl(com + U3P_U2PHYDTM1);
 	tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID);
 	tmp |= P2C_RG_SESSEND;
 	writel(tmp, com + U3P_U2PHYDTM1);
 
 	if (tphy->pdata->avoid_rx_sen_degradation && index) {
+		tmp = readl(com + U3P_U2PHYDTM0);
+		tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM);
+		writel(tmp, com + U3P_U2PHYDTM0);
+
 		tmp = readl(com + U3D_U2PHYDCR0);
 		tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON;
 		writel(tmp, com + U3D_U2PHYDCR0);
-- 
1.9.1

^ permalink raw reply related

* [PATCH] KVM: arm/arm64: timer: Don't set irq as forwarded if no usable GIC
From: Marc Zyngier @ 2017-12-07 11:46 UTC (permalink / raw)
  To: linux-arm-kernel

If we don't have a usable GIC, do not try to set the vcpu affinity
as this is guaranteed to fail.

Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 include/kvm/arm_arch_timer.h |  2 +-
 virt/kvm/arm/arch_timer.c    | 13 ++++++++-----
 virt/kvm/arm/arm.c           |  2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index 01ee473517e2..5fa4fef257a4 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -62,7 +62,7 @@ struct arch_timer_cpu {
 	bool			enabled;
 };
 
-int kvm_timer_hyp_init(void);
+int kvm_timer_hyp_init(bool);
 int kvm_timer_enable(struct kvm_vcpu *vcpu);
 int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu);
 void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 4151250ce8da..4804b5608013 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -726,7 +726,7 @@ static int kvm_timer_dying_cpu(unsigned int cpu)
 	return 0;
 }
 
-int kvm_timer_hyp_init(void)
+int kvm_timer_hyp_init(bool has_gic)
 {
 	struct arch_timer_kvm_info *info;
 	int err;
@@ -762,10 +762,13 @@ int kvm_timer_hyp_init(void)
 		return err;
 	}
 
-	err = irq_set_vcpu_affinity(host_vtimer_irq, kvm_get_running_vcpus());
-	if (err) {
-		kvm_err("kvm_arch_timer: error setting vcpu affinity\n");
-		goto out_free_irq;
+	if (has_gic) {
+		err = irq_set_vcpu_affinity(host_vtimer_irq,
+					    kvm_get_running_vcpus());
+		if (err) {
+			kvm_err("kvm_arch_timer: error setting vcpu affinity\n");
+			goto out_free_irq;
+		}
 	}
 
 	kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index a67c106d73f5..d9df6d0731e6 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1323,7 +1323,7 @@ static int init_subsystems(void)
 	/*
 	 * Init HYP architected timer support
 	 */
-	err = kvm_timer_hyp_init();
+	err = kvm_timer_hyp_init(vgic_present);
 	if (err)
 		goto out;
 
-- 
2.14.2

^ permalink raw reply related

* [PATCH] KVM: arm/arm64: Fix HYP unmapping going off limits
From: Marc Zyngier @ 2017-12-07 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

When we unmap the HYP memory, we try to be clever and unmap one
PGD at a time. If we start with a non-PGD aligned address and try
to unmap a whole PGD, things go horribly wrong in unmap_hyp_range
(addr and end can never match, and it all goes really badly as we
keep incrementing pgd and parse random memory as page tables...).

The obvious fix is to let unmap_hyp_range do what it does best,
which is to iterate over a range.

Cc: stable at vger.kernel.org
Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 virt/kvm/arm/mmu.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
index b36945d49986..b4b69c2d1012 100644
--- a/virt/kvm/arm/mmu.c
+++ b/virt/kvm/arm/mmu.c
@@ -509,8 +509,6 @@ static void unmap_hyp_range(pgd_t *pgdp, phys_addr_t start, u64 size)
  */
 void free_hyp_pgds(void)
 {
-	unsigned long addr;
-
 	mutex_lock(&kvm_hyp_pgd_mutex);
 
 	if (boot_hyp_pgd) {
@@ -521,10 +519,10 @@ void free_hyp_pgds(void)
 
 	if (hyp_pgd) {
 		unmap_hyp_range(hyp_pgd, hyp_idmap_start, PAGE_SIZE);
-		for (addr = PAGE_OFFSET; virt_addr_valid(addr); addr += PGDIR_SIZE)
-			unmap_hyp_range(hyp_pgd, kern_hyp_va(addr), PGDIR_SIZE);
-		for (addr = VMALLOC_START; is_vmalloc_addr((void*)addr); addr += PGDIR_SIZE)
-			unmap_hyp_range(hyp_pgd, kern_hyp_va(addr), PGDIR_SIZE);
+		unmap_hyp_range(hyp_pgd, kern_hyp_va(PAGE_OFFSET),
+				(uintptr_t)high_memory - PAGE_OFFSET);
+		unmap_hyp_range(hyp_pgd, kern_hyp_va(VMALLOC_START),
+				VMALLOC_END - VMALLOC_START);
 
 		free_pages((unsigned long)hyp_pgd, hyp_pgd_order);
 		hyp_pgd = NULL;
-- 
2.14.2

^ permalink raw reply related

* [kernel-hardening][PATCH v5 1/3] arm: mm: dump: make page table dumping reusable
From: Philippe Ombredanne @ 2017-12-07 11:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171207105319.GA10075@pjb1027-Latitude-E5410>

Dear Jinbum,

On Thu, Dec 7, 2017 at 11:53 AM, Jinbum Park <jinb.park7@gmail.com> wrote:
> This patch refactors the arm page table dumping code,
> so multiple tables may be registered with the framework.
>
> This patch refers below commits of arm64.
> (4674fdb9f149 ("arm64: mm: dump: make page table dumping reusable"))
> (4ddb9bf83349 ("arm64: dump: Make ptdump debugfs a separate option"))
>
> Tested-by: Laura Abbott <labbott@redhat.com>
> Reviewed-by: Laura Abbott <labbott@redhat.com>
> Signed-off-by: Jinbum Park <jinb.park7@gmail.com>
[]
> diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
> new file mode 100644
> index 0000000..3a6c0b7
> --- /dev/null
> +++ b/arch/arm/include/asm/ptdump.h
> @@ -0,0 +1,48 @@
> +/*
> + * Copyright (C) 2014 ARM Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */

Sorry if I am nitpicking, but have you considered replacing this
beautiful piece of fine legalese with the new SPDX ids?
e.g. this:
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2014 ARM Ltd.

Or if this does not work and your includes break something if they are
used in assembly, then this can work out too

> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (C) 2014 ARM Ltd. */

See Thomas doc patches, and Greg and Linus comments on these topics.

This is much leaner, is it?
Less legalese comment also means more code and a better, smaller
boilerplate lines/total lines ratio!
Thank you for your kind consideration.

-- 
Cordially
Philippe Ombredanne

^ permalink raw reply

* [PATCH v2 0/8] arm64: Add initial Actions Semi S700 and CubieBoard7 support
From: Andreas Färber @ 2017-12-07 11:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <e43387f9-60a6-129b-d0e9-dff6d0df301a@linaro.org>

Am 07.12.2017 um 10:20 schrieb Daniel Lezcano:
> On 14/11/2017 00:34, Andreas F?rber wrote:
>> Hello,
>>
>> This series prepares the Actions Semi S700 SoC and Cubietech CubieBoard7.
>> It boots equally far as the S900 based Bubblegum-96 these patches are based on,
>> i.e. into an initrd with serial and all four cores up.
>>
>> v2 modifies the clocksource driver patches and adds SPS patches.
>>
>> Not having succeeded to replace the bootloader on eMMC or to try
>> booting from SD, the only working way I've found to boot mainline kernels
>> appears to be booting into Android, then issuing "reboot bootloader". U-Boot
>> is lacking the saveenv command, so it wasn't possible to change the bootdelay
>> to facilitate this.
> 
> Is it possible this change fixes your issue ?
> 
> http://git.denx.de/?p=u-boot.git;a=commit;h=c9e87ba66540cf72c164674a71af43853d087ba8

Actions is not yet supported in mainline U-Boot, and S500 boards did not
have a problem there. The saveenv command is simply not enabled in this
config deployed by Cubietech. Since I have not succeeded in getting a
self-built U-Boot booted from SD, I cannot test individual commits on
top either.

Maybe Cubietech or Actions can comment?

Regards,
Andreas

>> Cf. https://en.opensuse.org/HCL:CubieBoard7

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply

* [PATCH] media: platform: sti: Adopt SPDX identifier
From: Hugues FRUCHET @ 2017-12-07 11:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171205145239.17908-1-benjamin.gaignard@st.com>



On 12/05/2017 03:52 PM, Benjamin Gaignard wrote:
> Add SPDX identifiers to files under sti directory
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>   drivers/media/platform/sti/bdisp/bdisp-debug.c           |  2 +-
>   drivers/media/platform/sti/bdisp/bdisp-filter.h          |  2 +-
>   drivers/media/platform/sti/bdisp/bdisp-hw.c              |  2 +-
>   drivers/media/platform/sti/bdisp/bdisp-reg.h             |  2 +-
>   drivers/media/platform/sti/bdisp/bdisp-v4l2.c            |  2 +-
>   drivers/media/platform/sti/bdisp/bdisp.h                 |  2 +-
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c  |  5 +----
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.h  |  5 +----
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c    |  5 +----
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.h    |  5 +----
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.c |  9 +--------
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.h |  9 +--------
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c     | 11 +----------
>   drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.h     |  5 +----
>   drivers/media/platform/sti/cec/stih-cec.c                |  5 +----
>   drivers/media/platform/sti/delta/delta-cfg.h             |  2 +-
>   drivers/media/platform/sti/delta/delta-debug.c           |  2 +-
>   drivers/media/platform/sti/delta/delta-debug.h           |  2 +-
>   drivers/media/platform/sti/delta/delta-ipc.c             |  2 +-
>   drivers/media/platform/sti/delta/delta-ipc.h             |  2 +-
>   drivers/media/platform/sti/delta/delta-mem.c             |  2 +-
>   drivers/media/platform/sti/delta/delta-mem.h             |  2 +-
>   drivers/media/platform/sti/delta/delta-mjpeg-dec.c       |  2 +-
>   drivers/media/platform/sti/delta/delta-mjpeg-fw.h        |  2 +-
>   drivers/media/platform/sti/delta/delta-mjpeg-hdr.c       |  2 +-
>   drivers/media/platform/sti/delta/delta-mjpeg.h           |  2 +-
>   drivers/media/platform/sti/delta/delta-v4l2.c            |  2 +-
>   drivers/media/platform/sti/delta/delta.h                 |  2 +-
>   drivers/media/platform/sti/hva/hva-debugfs.c             |  2 +-
>   drivers/media/platform/sti/hva/hva-h264.c                |  2 +-
>   drivers/media/platform/sti/hva/hva-hw.c                  |  2 +-
>   drivers/media/platform/sti/hva/hva-hw.h                  |  2 +-
>   drivers/media/platform/sti/hva/hva-mem.c                 |  2 +-
>   drivers/media/platform/sti/hva/hva-mem.h                 |  2 +-
>   drivers/media/platform/sti/hva/hva-v4l2.c                |  2 +-
>   drivers/media/platform/sti/hva/hva.h                     |  2 +-
>   36 files changed, 36 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-debug.c b/drivers/media/platform/sti/bdisp/bdisp-debug.c
> index 2cc289e4dea1..c6a4e2de5c0c 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-debug.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-debug.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2014
>    * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/debugfs.h>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-filter.h b/drivers/media/platform/sti/bdisp/bdisp-filter.h
> index 53e52fb4127f..d25adb57e3d0 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-filter.h
> +++ b/drivers/media/platform/sti/bdisp/bdisp-filter.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2014
>    * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #define BDISP_HF_NB             64
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> index b7892f3efd98..e7836b307d21 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2014
>    * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/delay.h>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-reg.h b/drivers/media/platform/sti/bdisp/bdisp-reg.h
> index e7e1a425f65a..b07ecc903707 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-reg.h
> +++ b/drivers/media/platform/sti/bdisp/bdisp-reg.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2014
>    * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   struct bdisp_node {
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> index 7e9ed9c7b3e1..bf4ca16db440 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2014
>    * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/errno.h>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp.h b/drivers/media/platform/sti/bdisp/bdisp.h
> index b3fbf9902595..e309cde379ca 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp.h
> +++ b/drivers/media/platform/sti/bdisp/bdisp.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2014
>    * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/clk.h>
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> index 2dfbe8ab5214..c64909e5ab64 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * c8sectpfe-common.c - C8SECTPFE STi DVB driver
>    *
> @@ -5,10 +6,6 @@
>    *
>    *   Author: Peter Griffin <peter.griffin@linaro.org>
>    *
> - *      This program is free software; you can redistribute it and/or
> - *      modify it under the terms of the GNU General Public License as
> - *      published by the Free Software Foundation; either version 2 of
> - *      the License, or (at your option) any later version.
>    */
>   #include <linux/completion.h>
>   #include <linux/delay.h>
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.h b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.h
> index da21c0ac0fc1..694f63832d3f 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.h
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * c8sectpfe-common.h - C8SECTPFE STi DVB driver
>    *
> @@ -5,10 +6,6 @@
>    *
>    *   Author: Peter Griffin <peter.griffin@linaro.org>
>    *
> - *      This program is free software; you can redistribute it and/or
> - *      modify it under the terms of the GNU General Public License as
> - *      published by the Free Software Foundation; either version 2 of
> - *      the License, or (at your option) any later version.
>    */
>   #ifndef _C8SECTPFE_COMMON_H_
>   #define _C8SECTPFE_COMMON_H_
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> index a0acee7671b1..d9a73d5c97fa 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * c8sectpfe-core.c - C8SECTPFE STi DVB driver
>    *
> @@ -6,10 +7,6 @@
>    *   Author:Peter Bennett <peter.bennett@st.com>
>    *	    Peter Griffin <peter.griffin@linaro.org>
>    *
> - *	This program is free software; you can redistribute it and/or
> - *	modify it under the terms of the GNU General Public License as
> - *	published by the Free Software Foundation; either version 2 of
> - *	the License, or (at your option) any later version.
>    */
>   #include <linux/atomic.h>
>   #include <linux/clk.h>
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.h b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.h
> index 39e7a221a941..3dbb3a287cc0 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.h
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * c8sectpfe-core.h - C8SECTPFE STi DVB driver
>    *
> @@ -6,10 +7,6 @@
>    *   Author:Peter Bennett <peter.bennett@st.com>
>    *	    Peter Griffin <peter.griffin@linaro.org>
>    *
> - *	This program is free software; you can redistribute it and/or
> - *	modify it under the terms of the GNU General Public License as
> - *	published by the Free Software Foundation; either version 2 of
> - *	the License, or (at your option) any later version.
>    */
>   #ifndef _C8SECTPFE_CORE_H_
>   #define _C8SECTPFE_CORE_H_
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.c
> index e9ba13db49cd..8f0ddcbeed9d 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * c8sectpfe-debugfs.c - C8SECTPFE STi DVB driver
>    *
> @@ -5,14 +6,6 @@
>    *
>    * Author: Peter Griffin <peter.griffin@linaro.org>
>    *
> - * This program is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2  of
> - * the License as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
>    */
>   #include <linux/debugfs.h>
>   #include <linux/device.h>
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.h b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.h
> index 8af1ac1378c8..b8c30bcc8df9 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.h
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-debugfs.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /**
>    * c8sectpfe-debugfs.h - C8SECTPFE STi DVB driver debugfs header
>    *
> @@ -5,14 +6,6 @@
>    *
>    * Authors: Peter Griffin <peter.griffin@linaro.org>
>    *
> - * This program is free software: you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2  of
> - * the License as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
>    */
>   
>   #ifndef __C8SECTPFE_DEBUG_H
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c
> index 2c0015b1264d..075d4695ee4d 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    *  c8sectpfe-dvb.c - C8SECTPFE STi DVB driver
>    *
> @@ -5,16 +6,6 @@
>    *
>    *  Author Peter Griffin <peter.griffin@linaro.org>
>    *
> - *  This program is free software; you can redistribute it and/or modify
> - *  it under the terms of the GNU General Public License as published by
> - *  the Free Software Foundation; either version 2 of the License, or
> - *  (at your option) any later version.
> - *
> - *  This program is distributed in the hope that it will be useful,
> - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - *
> - *  GNU General Public License for more details.
>    */
>   #include <linux/completion.h>
>   #include <linux/delay.h>
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.h b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.h
> index bd366dbc82b3..3d87a9ae8702 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.h
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * c8sectpfe-common.h - C8SECTPFE STi DVB driver
>    *
> @@ -5,10 +6,6 @@
>    *
>    *   Author: Peter Griffin <peter.griffin@linaro.org>
>    *
> - *      This program is free software; you can redistribute it and/or
> - *      modify it under the terms of the GNU General Public License as
> - *      published by the Free Software Foundation; either version 2 of
> - *      the License, or (at your option) any later version.
>    */
>   #ifndef _C8SECTPFE_DVB_H_
>   #define _C8SECTPFE_DVB_H_
> diff --git a/drivers/media/platform/sti/cec/stih-cec.c b/drivers/media/platform/sti/cec/stih-cec.c
> index 70160df36de9..d34099f75990 100644
> --- a/drivers/media/platform/sti/cec/stih-cec.c
> +++ b/drivers/media/platform/sti/cec/stih-cec.c
> @@ -1,11 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * STIH4xx CEC driver
>    * Copyright (C) STMicroelectronics SA 2016
>    *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
>    */
>   #include <linux/clk.h>
>   #include <linux/interrupt.h>
> diff --git a/drivers/media/platform/sti/delta/delta-cfg.h b/drivers/media/platform/sti/delta/delta-cfg.h
> index c6388f575800..f47c6e6ff083 100644
> --- a/drivers/media/platform/sti/delta/delta-cfg.h
> +++ b/drivers/media/platform/sti/delta/delta-cfg.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_CFG_H
> diff --git a/drivers/media/platform/sti/delta/delta-debug.c b/drivers/media/platform/sti/delta/delta-debug.c
> index a7ebf2cc7783..4b2eb6b63aa2 100644
> --- a/drivers/media/platform/sti/delta/delta-debug.c
> +++ b/drivers/media/platform/sti/delta/delta-debug.c
> @@ -1,9 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Hugues Fruchet <hugues.fruchet@st.com>
>    *          Fabrice Lecoultre <fabrice.lecoultre@st.com>
>    *          for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include "delta.h"
> diff --git a/drivers/media/platform/sti/delta/delta-debug.h b/drivers/media/platform/sti/delta/delta-debug.h
> index 955c1587ac2d..fa90252623e1 100644
> --- a/drivers/media/platform/sti/delta/delta-debug.h
> +++ b/drivers/media/platform/sti/delta/delta-debug.h
> @@ -1,9 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Hugues Fruchet <hugues.fruchet@st.com>
>    *          Fabrice Lecoultre <fabrice.lecoultre@st.com>
>    *          for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_DEBUG_H
> diff --git a/drivers/media/platform/sti/delta/delta-ipc.c b/drivers/media/platform/sti/delta/delta-ipc.c
> index 41e4a4c259b3..a4603d573c34 100644
> --- a/drivers/media/platform/sti/delta/delta-ipc.c
> +++ b/drivers/media/platform/sti/delta/delta-ipc.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/rpmsg.h>
> diff --git a/drivers/media/platform/sti/delta/delta-ipc.h b/drivers/media/platform/sti/delta/delta-ipc.h
> index cef2019c72d4..9fba6b5d169a 100644
> --- a/drivers/media/platform/sti/delta/delta-ipc.h
> +++ b/drivers/media/platform/sti/delta/delta-ipc.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_IPC_H
> diff --git a/drivers/media/platform/sti/delta/delta-mem.c b/drivers/media/platform/sti/delta/delta-mem.c
> index d7b53d31caa6..aeccd50583da 100644
> --- a/drivers/media/platform/sti/delta/delta-mem.c
> +++ b/drivers/media/platform/sti/delta/delta-mem.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include "delta.h"
> diff --git a/drivers/media/platform/sti/delta/delta-mem.h b/drivers/media/platform/sti/delta/delta-mem.h
> index f8ca109e1241..ff7d02f00b28 100644
> --- a/drivers/media/platform/sti/delta/delta-mem.h
> +++ b/drivers/media/platform/sti/delta/delta-mem.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_MEM_H
> diff --git a/drivers/media/platform/sti/delta/delta-mjpeg-dec.c b/drivers/media/platform/sti/delta/delta-mjpeg-dec.c
> index 84ea43c0eb46..0533d4a083d2 100644
> --- a/drivers/media/platform/sti/delta/delta-mjpeg-dec.c
> +++ b/drivers/media/platform/sti/delta/delta-mjpeg-dec.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2013
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/slab.h>
> diff --git a/drivers/media/platform/sti/delta/delta-mjpeg-fw.h b/drivers/media/platform/sti/delta/delta-mjpeg-fw.h
> index de803d0c2fe8..5a9404f4d055 100644
> --- a/drivers/media/platform/sti/delta/delta-mjpeg-fw.h
> +++ b/drivers/media/platform/sti/delta/delta-mjpeg-fw.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_MJPEG_FW_H
> diff --git a/drivers/media/platform/sti/delta/delta-mjpeg-hdr.c b/drivers/media/platform/sti/delta/delta-mjpeg-hdr.c
> index a8fd8fa0ecb5..90e5b2f72c82 100644
> --- a/drivers/media/platform/sti/delta/delta-mjpeg-hdr.c
> +++ b/drivers/media/platform/sti/delta/delta-mjpeg-hdr.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2013
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include "delta.h"
> diff --git a/drivers/media/platform/sti/delta/delta-mjpeg.h b/drivers/media/platform/sti/delta/delta-mjpeg.h
> index 18e6b37217ee..43f7a88b6e59 100644
> --- a/drivers/media/platform/sti/delta/delta-mjpeg.h
> +++ b/drivers/media/platform/sti/delta/delta-mjpeg.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2013
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_MJPEG_H
> diff --git a/drivers/media/platform/sti/delta/delta-v4l2.c b/drivers/media/platform/sti/delta/delta-v4l2.c
> index b2dc3d223a9c..232d508c5b66 100644
> --- a/drivers/media/platform/sti/delta/delta-v4l2.c
> +++ b/drivers/media/platform/sti/delta/delta-v4l2.c
> @@ -1,9 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Hugues Fruchet <hugues.fruchet@st.com>
>    *          Jean-Christophe Trotin <jean-christophe.trotin@st.com>
>    *          for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/clk.h>
> diff --git a/drivers/media/platform/sti/delta/delta.h b/drivers/media/platform/sti/delta/delta.h
> index 60c073246a01..2ba99922c05b 100644
> --- a/drivers/media/platform/sti/delta/delta.h
> +++ b/drivers/media/platform/sti/delta/delta.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef DELTA_H
> diff --git a/drivers/media/platform/sti/hva/hva-debugfs.c b/drivers/media/platform/sti/hva/hva-debugfs.c
> index 83a6258a155b..9f7e8ac875d1 100644
> --- a/drivers/media/platform/sti/hva/hva-debugfs.c
> +++ b/drivers/media/platform/sti/hva/hva-debugfs.c
> @@ -1,8 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/debugfs.h>
> diff --git a/drivers/media/platform/sti/hva/hva-h264.c b/drivers/media/platform/sti/hva/hva-h264.c
> index a7e5eed17ada..6b0b321db8cc 100644
> --- a/drivers/media/platform/sti/hva/hva-h264.c
> +++ b/drivers/media/platform/sti/hva/hva-h264.c
> @@ -1,8 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include "hva.h"
> diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c
> index ec25bdcfa3d1..7917fd2c4bd4 100644
> --- a/drivers/media/platform/sti/hva/hva-hw.c
> +++ b/drivers/media/platform/sti/hva/hva-hw.c
> @@ -1,8 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/clk.h>
> diff --git a/drivers/media/platform/sti/hva/hva-hw.h b/drivers/media/platform/sti/hva/hva-hw.h
> index b46017dcfae9..b298990264d5 100644
> --- a/drivers/media/platform/sti/hva/hva-hw.h
> +++ b/drivers/media/platform/sti/hva/hva-hw.h
> @@ -1,8 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef HVA_HW_H
> diff --git a/drivers/media/platform/sti/hva/hva-mem.c b/drivers/media/platform/sti/hva/hva-mem.c
> index 821c78ed208c..caf50cd4bb77 100644
> --- a/drivers/media/platform/sti/hva/hva-mem.c
> +++ b/drivers/media/platform/sti/hva/hva-mem.c
> @@ -1,8 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include "hva.h"
> diff --git a/drivers/media/platform/sti/hva/hva-mem.h b/drivers/media/platform/sti/hva/hva-mem.h
> index a95c728a45e6..fec549dff2b3 100644
> --- a/drivers/media/platform/sti/hva/hva-mem.h
> +++ b/drivers/media/platform/sti/hva/hva-mem.h
> @@ -1,8 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef HVA_MEM_H
> diff --git a/drivers/media/platform/sti/hva/hva-v4l2.c b/drivers/media/platform/sti/hva/hva-v4l2.c
> index 1c4fc33cbcb5..2ab0b5cc5c22 100644
> --- a/drivers/media/platform/sti/hva/hva-v4l2.c
> +++ b/drivers/media/platform/sti/hva/hva-v4l2.c
> @@ -1,8 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #include <linux/module.h>
> diff --git a/drivers/media/platform/sti/hva/hva.h b/drivers/media/platform/sti/hva/hva.h
> index 0d749b257a21..8882d901d119 100644
> --- a/drivers/media/platform/sti/hva/hva.h
> +++ b/drivers/media/platform/sti/hva/hva.h
> @@ -1,8 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>    * Copyright (C) STMicroelectronics SA 2015
>    * Authors: Yannick Fertre <yannick.fertre@st.com>
>    *          Hugues Fruchet <hugues.fruchet@st.com>
> - * License terms:  GNU General Public License (GPL), version 2
>    */
>   
>   #ifndef HVA_H
> 

Acked-by: Hugues Fruchet <hugues.fruchet@st.com>

Best regards,
Hugues.

^ permalink raw reply

* [PATCH] arm64: allwinner: a64: orangepi-zero-plus2: add usb otg
From: Jagan Teki @ 2017-12-07 11:05 UTC (permalink / raw)
  To: linux-arm-kernel

Add usb otg support for orangepi-zero-plus2 board:
- Add usb_otg node with dr_mode as 'otg'
- USB0-IDDET connected to PA21
- VBUS connected through DCIN which always on

Tested mass storage function.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Note: Anyone please check vbus connection [1]
Since it is connected through DCIN of vcc-5v, I've added vcc-5v0
regulator for the same and attached to usb0_vbus-supply but it is
disabling during kernel boot.
[    1.887854] vcc5v0: disabling

[1] http://linux-sunxi.org/File:ORANGE_PI-ZERO-PLUS2_V1_0.pdf

 .../dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
index d349399..7f298ee 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
@@ -73,6 +73,10 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>;
@@ -111,6 +115,10 @@
 	status = "okay";
 };
 
+&ohci0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
@@ -122,3 +130,13 @@
 	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
 	status = "okay";
 };
+
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usbphy {
+	usb0_id_det-gpios = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
+	status = "okay";
+};
-- 
2.7.4

^ permalink raw reply related

* [PATCH v2] clocksource: tcb_clksrc: Fix clock speed message
From: Daniel Lezcano @ 2017-12-07 11:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20171201122233.21828-1-romain.izard.pro@gmail.com>

On 01/12/2017 13:22, Romain Izard wrote:
> The clock speed displayed at boot in an information message was 500 kHz
> too high compared to its real value. As the value is not used anywhere,
> there is no functional impact.
> 
> Fix the rounding formula to display the correct value.
> 
> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
> ---
> v2: rebase over v4.15-rc1
> 
> There is no specified maintainer for this file, only supporters.

That is not correct, it defaults to Thomas and me, the maintainers of
drivers/clocksource :)

> Nicolas, could you pick this through the at91 tree as the TCB block
> is an AT91 peripheral ?

Nicolas, do you agree with this change ? If yes, I will take it.

>  drivers/clocksource/tcb_clksrc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
> index 9de47d4d2d9e..43f4d5c4d6fa 100644
> --- a/drivers/clocksource/tcb_clksrc.c
> +++ b/drivers/clocksource/tcb_clksrc.c
> @@ -384,7 +384,7 @@ static int __init tcb_clksrc_init(void)
>  
>  	printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK,
>  			divided_rate / 1000000,
> -			((divided_rate + 500000) % 1000000) / 1000);
> +			((divided_rate % 1000000) + 500) / 1000);
>  	if (tc->tcb_config && tc->tcb_config->counter_width == 32) {
>  		/* use apropriate function to read 32 bit counter */
> 


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply

* [PATCH v3 09/15] drm/sun4i: Add A83T support
From: Maxime Ripard @ 2017-12-07 10:55 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1729482.Mgh5nx8BIs@jernej-laptop>

Hi,

On Wed, Dec 06, 2017 at 05:37:47PM +0100, Jernej ?krabec wrote:
> Hi,
> 
> Dne torek, 05. december 2017 ob 16:42:55 CET je Jernej ?krabec napisal(a):
> > Hi Maxime,
> > 
> > Dne torek, 05. december 2017 ob 16:10:21 CET je Maxime Ripard napisal(a):
> > > Add support for the A83T display pipeline.
> > > 
> > > Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > ---
> > > 
> > >  drivers/gpu/drm/sun4i/sun4i_drv.c   |  1 +
> > >  drivers/gpu/drm/sun4i/sun4i_tcon.c  |  5 +++++
> > >  drivers/gpu/drm/sun4i/sun8i_mixer.c |  9 +++++++++
> > >  3 files changed, 15 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > b/drivers/gpu/drm/sun4i/sun4i_drv.c index 49215d91c853..6f5e721b545e
> > > 100644
> > > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > @@ -347,6 +347,7 @@ static const struct of_device_id sun4i_drv_of_table[]
> > > =
> > > { { .compatible = "allwinner,sun6i-a31s-display-engine" },
> > > 
> > >  	{ .compatible = "allwinner,sun7i-a20-display-engine" },
> > >  	{ .compatible = "allwinner,sun8i-a33-display-engine" },
> > > 
> > > +	{ .compatible = "allwinner,sun8i-a83t-display-engine" },
> > > 
> > >  	{ .compatible = "allwinner,sun8i-v3s-display-engine" },
> > >  	{ }
> > >  
> > >  };
> > > 
> > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 92f4738101e6..9b757450555f
> > > 100644
> > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > @@ -1132,6 +1132,10 @@ static const struct sun4i_tcon_quirks
> > > sun8i_a33_quirks = { .has_lvds_pll		= true,
> > > 
> > >  };
> > > 
> > > +static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = {
> > > +	/* nothing is supported */
> > > +};
> > > +
> > > 
> > >  static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
> > >  
> > >  	/* nothing is supported */
> > >  
> > >  };
> > > 
> > > @@ -1144,6 +1148,7 @@ const struct of_device_id sun4i_tcon_of_table[] = {
> > > 
> > >  	{ .compatible = "allwinner,sun6i-a31s-tcon", .data = 
> &sun6i_a31s_quirks
> > >  	},
> > > 
> > > { .compatible = "allwinner,sun7i-a20-tcon", .data = &sun7i_a20_quirks }, {
> > > .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks }, +	
> {
> > > .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data =
> > > &sun8i_a83t_lcd_quirks }, { .compatible = "allwinner,sun8i-v3s-tcon",
> > > .data
> > > = &sun8i_v3s_quirks }, { }
> > > 
> > >  };
> > > 
> > > diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> > > b/drivers/gpu/drm/sun4i/sun8i_mixer.c index ff235e3228ce..6829bec4ba68
> > > 100644
> > > --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> > > +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> > > @@ -477,6 +477,11 @@ static int sun8i_mixer_remove(struct platform_device
> > > *pdev) return 0;
> > > 
> > >  }
> > > 
> > > +static const struct sun8i_mixer_cfg sun8i_a83t_mixer_cfg = {
> > > +	.vi_num = 1,
> > > +	.ui_num = 3,
> > > +};
> > > +
> > 
> > I think you should expand that structure with:
> > .ccsc = 0,
> > .scaler_mask = 0xf,
> > .mod_rate = 150000000,
> 
> I guess you could set higher clock if CLK_SET_RATE_PARENT flag is set to de_clk 
> in A83T CCU driver. BSP sets it to 500 MHz, which is a bit high...

Actually, I didn't have to change the rate used by default, so it's
not clear what it should be on the A83T.

And yeah, I'd like to avoid setting it at 500MHz without any
particular reason. The A83T draws way to much power already without
making it worse.

I'll add the CCSC and scaler_mask fields.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171207/c02352d1/attachment.sig>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox