linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: vexpress: Remove non-DT code
@ 2015-01-20 17:25 Pawel Moll
  2015-02-16 14:45 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel Moll @ 2015-01-20 17:25 UTC (permalink / raw)
  To: linux-arm-kernel

Now, as all VE platforms have to be booted with DT,
the code handling non-DT case can be removed.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/mfd/vexpress-sysreg.c | 71 +++++++++----------------------------------
 1 file changed, 15 insertions(+), 56 deletions(-)

diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index 8f43ab8..3e628df 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -47,71 +47,26 @@
 #define SYS_HBI_MASK		0xfff
 #define SYS_PROCIDx_HBI_SHIFT	0
 
-#define SYS_MCI_CARDIN		(1 << 0)
-#define SYS_MCI_WPROT		(1 << 1)
-
 #define SYS_MISC_MASTERSITE	(1 << 14)
 
-
-static void __iomem *__vexpress_sysreg_base;
-
-static void __iomem *vexpress_sysreg_base(void)
+void vexpress_flags_set(u32 data)
 {
-	if (!__vexpress_sysreg_base) {
+	static void __iomem *base;
+
+	if (!base) {
 		struct device_node *node = of_find_compatible_node(NULL, NULL,
 				"arm,vexpress-sysreg");
 
-		__vexpress_sysreg_base = of_iomap(node, 0);
+		base = of_iomap(node, 0);
 	}
 
-	WARN_ON(!__vexpress_sysreg_base);
-
-	return __vexpress_sysreg_base;
-}
-
-
-static int vexpress_sysreg_get_master(void)
-{
-	if (readl(vexpress_sysreg_base() + SYS_MISC) & SYS_MISC_MASTERSITE)
-		return VEXPRESS_SITE_DB2;
-
-	return VEXPRESS_SITE_DB1;
-}
-
-void vexpress_flags_set(u32 data)
-{
-	writel(~0, vexpress_sysreg_base() + SYS_FLAGSCLR);
-	writel(data, vexpress_sysreg_base() + SYS_FLAGSSET);
-}
-
-unsigned int vexpress_get_mci_cardin(struct device *dev)
-{
-	return readl(vexpress_sysreg_base() + SYS_MCI) & SYS_MCI_CARDIN;
-}
-
-u32 vexpress_get_procid(int site)
-{
-	if (site == VEXPRESS_SITE_MASTER)
-		site = vexpress_sysreg_get_master();
+	if (WARN_ON(!base))
+		return;
 
-	return readl(vexpress_sysreg_base() + (site == VEXPRESS_SITE_DB1 ?
-			SYS_PROCID0 : SYS_PROCID1));
+	writel(~0, base + SYS_FLAGSCLR);
+	writel(data, base + SYS_FLAGSSET);
 }
 
-void __iomem *vexpress_get_24mhz_clock_base(void)
-{
-	return vexpress_sysreg_base() + SYS_24MHZ;
-}
-
-
-void __init vexpress_sysreg_early_init(void __iomem *base)
-{
-	__vexpress_sysreg_base = base;
-
-	vexpress_config_set_master(vexpress_sysreg_get_master());
-}
-
-
 /* The sysreg block is just a random collection of various functions... */
 
 static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = {
@@ -210,6 +165,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
 	struct resource *mem;
 	void __iomem *base;
 	struct bgpio_chip *mmc_gpio_chip;
+	int master;
 	u32 dt_hbi;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -220,11 +176,14 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
 	if (!base)
 		return -ENOMEM;
 
-	vexpress_config_set_master(vexpress_sysreg_get_master());
+	master = readl(base + SYS_MISC) & SYS_MISC_MASTERSITE ?
+			VEXPRESS_SITE_DB2 : VEXPRESS_SITE_DB1;
+	vexpress_config_set_master(master);
 
 	/* Confirm board type against DT property, if available */
 	if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) {
-		u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER);
+		u32 id = readl(base + (master == VEXPRESS_SITE_DB1 ?
+				 SYS_PROCID0 : SYS_PROCID1));
 		u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK;
 
 		if (WARN_ON(dt_hbi != hbi))
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] mfd: vexpress: Remove non-DT code
  2015-01-20 17:25 [PATCH] mfd: vexpress: Remove non-DT code Pawel Moll
@ 2015-02-16 14:45 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2015-02-16 14:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 20 Jan 2015, Pawel Moll wrote:

> Now, as all VE platforms have to be booted with DT,
> the code handling non-DT case can be removed.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---
>  drivers/mfd/vexpress-sysreg.c | 71 +++++++++----------------------------------
>  1 file changed, 15 insertions(+), 56 deletions(-)

Code looks better and I'm sure you've tested it.

Applied, thanks.

> diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
> index 8f43ab8..3e628df 100644
> --- a/drivers/mfd/vexpress-sysreg.c
> +++ b/drivers/mfd/vexpress-sysreg.c
> @@ -47,71 +47,26 @@
>  #define SYS_HBI_MASK		0xfff
>  #define SYS_PROCIDx_HBI_SHIFT	0
>  
> -#define SYS_MCI_CARDIN		(1 << 0)
> -#define SYS_MCI_WPROT		(1 << 1)
> -
>  #define SYS_MISC_MASTERSITE	(1 << 14)
>  
> -
> -static void __iomem *__vexpress_sysreg_base;
> -
> -static void __iomem *vexpress_sysreg_base(void)
> +void vexpress_flags_set(u32 data)
>  {
> -	if (!__vexpress_sysreg_base) {
> +	static void __iomem *base;
> +
> +	if (!base) {
>  		struct device_node *node = of_find_compatible_node(NULL, NULL,
>  				"arm,vexpress-sysreg");
>  
> -		__vexpress_sysreg_base = of_iomap(node, 0);
> +		base = of_iomap(node, 0);
>  	}
>  
> -	WARN_ON(!__vexpress_sysreg_base);
> -
> -	return __vexpress_sysreg_base;
> -}
> -
> -
> -static int vexpress_sysreg_get_master(void)
> -{
> -	if (readl(vexpress_sysreg_base() + SYS_MISC) & SYS_MISC_MASTERSITE)
> -		return VEXPRESS_SITE_DB2;
> -
> -	return VEXPRESS_SITE_DB1;
> -}
> -
> -void vexpress_flags_set(u32 data)
> -{
> -	writel(~0, vexpress_sysreg_base() + SYS_FLAGSCLR);
> -	writel(data, vexpress_sysreg_base() + SYS_FLAGSSET);
> -}
> -
> -unsigned int vexpress_get_mci_cardin(struct device *dev)
> -{
> -	return readl(vexpress_sysreg_base() + SYS_MCI) & SYS_MCI_CARDIN;
> -}
> -
> -u32 vexpress_get_procid(int site)
> -{
> -	if (site == VEXPRESS_SITE_MASTER)
> -		site = vexpress_sysreg_get_master();
> +	if (WARN_ON(!base))
> +		return;
>  
> -	return readl(vexpress_sysreg_base() + (site == VEXPRESS_SITE_DB1 ?
> -			SYS_PROCID0 : SYS_PROCID1));
> +	writel(~0, base + SYS_FLAGSCLR);
> +	writel(data, base + SYS_FLAGSSET);
>  }
>  
> -void __iomem *vexpress_get_24mhz_clock_base(void)
> -{
> -	return vexpress_sysreg_base() + SYS_24MHZ;
> -}
> -
> -
> -void __init vexpress_sysreg_early_init(void __iomem *base)
> -{
> -	__vexpress_sysreg_base = base;
> -
> -	vexpress_config_set_master(vexpress_sysreg_get_master());
> -}
> -
> -
>  /* The sysreg block is just a random collection of various functions... */
>  
>  static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = {
> @@ -210,6 +165,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
>  	struct resource *mem;
>  	void __iomem *base;
>  	struct bgpio_chip *mmc_gpio_chip;
> +	int master;
>  	u32 dt_hbi;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -220,11 +176,14 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
>  	if (!base)
>  		return -ENOMEM;
>  
> -	vexpress_config_set_master(vexpress_sysreg_get_master());
> +	master = readl(base + SYS_MISC) & SYS_MISC_MASTERSITE ?
> +			VEXPRESS_SITE_DB2 : VEXPRESS_SITE_DB1;
> +	vexpress_config_set_master(master);
>  
>  	/* Confirm board type against DT property, if available */
>  	if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) {
> -		u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER);
> +		u32 id = readl(base + (master == VEXPRESS_SITE_DB1 ?
> +				 SYS_PROCID0 : SYS_PROCID1));
>  		u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK;
>  
>  		if (WARN_ON(dt_hbi != hbi))

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-16 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 17:25 [PATCH] mfd: vexpress: Remove non-DT code Pawel Moll
2015-02-16 14:45 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).