Commit fd13f811 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

ARM: pxa: move smemc register access from clk to platform

The get_sdram_rows() and get_memclkdiv() helpers need smemc
register that are separate from the clk registers, move
them out of the clk driver, and use an extern declaration
instead.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Link: https://lore.kernel.org/lkml/87pnielzo4.fsf@belgarion.home/


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 5c6603e7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/soc/pxa/cpu.h>
#include <linux/soc/pxa/smemc.h>

#include <asm/mach/map.h>
#include <asm/mach-types.h>
@@ -84,6 +85,11 @@ void pxa_smemc_set_pcmcia_socket(int nr)
}
EXPORT_SYMBOL_GPL(pxa_smemc_set_pcmcia_socket);

void __iomem *pxa_smemc_get_mdrefr(void)
{
	return MDREFR;
}

/*
 * Intel PXA2xx internal register mapping.
 *
+27 −0
Original line number Diff line number Diff line
@@ -14,7 +14,10 @@

#include <mach/pxa2xx-regs.h>
#include "mfp-pxa25x.h"
#include "generic.h"
#include <mach/reset.h>
#include <mach/smemc.h>
#include <linux/soc/pxa/smemc.h>
#include <linux/platform_data/irda-pxaficp.h>

void pxa2xx_clear_reset_status(unsigned int mask)
@@ -50,3 +53,27 @@ void pxa2xx_transceiver_mode(struct device *dev, int mode)
		BUG();
}
EXPORT_SYMBOL_GPL(pxa2xx_transceiver_mode);

#define MDCNFG_DRAC2(mdcnfg)	(((mdcnfg) >> 21) & 0x3)
#define MDCNFG_DRAC0(mdcnfg)	(((mdcnfg) >> 5) & 0x3)

int pxa2xx_smemc_get_sdram_rows(void)
{
	static int sdram_rows;
	unsigned int drac2 = 0, drac0 = 0;
	u32 mdcnfg;

	if (sdram_rows)
		return sdram_rows;

	mdcnfg = readl_relaxed(MDCNFG);

	if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
		drac2 = MDCNFG_DRAC2(mdcnfg);

	if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
		drac0 = MDCNFG_DRAC0(mdcnfg);

	sdram_rows = 1 << (11 + max(drac0, drac2));
	return sdram_rows;
}
+4 −0
Original line number Diff line number Diff line
@@ -52,6 +52,10 @@ extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int));
#define NDCR_ND_ARB_EN		(1 << 12)
#define NDCR_ND_ARB_CNTL	(1 << 19)

#define CKEN_BOOT  		11      /* < Boot rom clock enable */
#define CKEN_TPM   		19      /* < TPM clock enable */
#define CKEN_HSIO2 		41      /* < HSIO2 clock enable */

#ifdef CONFIG_PM

#define ISRAM_START	0x5c000000
+9 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/soc/pxa/cpu.h>

#include <mach/smemc.h>
#include <linux/soc/pxa/smemc.h>

#ifdef CONFIG_PM
static unsigned long msc[2];
@@ -70,3 +71,11 @@ static int __init smemc_init(void)
}
subsys_initcall(smemc_init);
#endif

static const unsigned int df_clkdiv[4] = { 1, 2, 4, 1 };
unsigned int pxa3xx_smemc_get_memclkdiv(void)
{
	unsigned long memclkcfg = __raw_readl(MEMCLKCFG);

	return	df_clkdiv[(memclkcfg >> 16) & 0x3];
}
+3 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/clkdev.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/soc/pxa/smemc.h>

#include <dt-bindings/clock/pxa-clock.h>
#include "clk-pxa.h"
@@ -150,12 +151,13 @@ void pxa2xx_core_turbo_switch(bool on)
}

void pxa2xx_cpll_change(struct pxa2xx_freq *freq,
			u32 (*mdrefr_dri)(unsigned int), void __iomem *mdrefr,
			u32 (*mdrefr_dri)(unsigned int),
			void __iomem *cccr)
{
	unsigned int clkcfg = freq->clkcfg;
	unsigned int unused, preset_mdrefr, postset_mdrefr;
	unsigned long flags;
	void __iomem *mdrefr = pxa_smemc_get_mdrefr();

	local_irq_save(flags);

Loading