Commit f628c64f authored by Olof Johansson's avatar Olof Johansson
Browse files

Merge tag 'at91-ab-4.6-drivers' of...

Merge tag 'at91-ab-4.6-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux into next/drivers

From Alexandre Belloni:

"This is a rework of the PMC driver. It touches multiple subsystems so
the easiest path is through arm-soc."

drivers update for 4.6:
 - Big PMC rework that touches clk, PM, usb

* tag 'at91-ab-4.6-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

:
  clk: at91: remove useless includes
  clk: at91: pmc: remove useless capacities handling
  clk: at91: pmc: drop at91_pmc_base
  usb: gadget: atmel: access the PMC using regmap
  ARM: at91: remove useless includes and function prototypes
  ARM: at91: pm: move idle functions to pm.c
  ARM: at91: pm: find and remap the pmc
  ARM: at91: pm: simply call at91_pm_init
  clk: at91: pmc: move pmc structures to C file
  clk: at91: pmc: merge at91_pmc_init in atmel_pmc_probe
  clk: at91: remove IRQ handling and use polling
  clk: at91: make use of syscon/regmap internally
  clk: at91: make use of syscon to share PMC registers in several drivers

Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 962f08f8 0002ca16
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -104,6 +104,7 @@ config HAVE_AT91_USB_CLK
config COMMON_CLK_AT91
config COMMON_CLK_AT91
	bool
	bool
	select COMMON_CLK
	select COMMON_CLK
	select MFD_SYSCON


config HAVE_AT91_SMD
config HAVE_AT91_SMD
	bool
	bool
+0 −2
Original line number Original line Diff line number Diff line
@@ -12,7 +12,6 @@
#include <linux/of_platform.h>
#include <linux/of_platform.h>


#include <asm/mach/arch.h>
#include <asm/mach/arch.h>
#include <asm/system_misc.h>


#include "generic.h"
#include "generic.h"
#include "soc.h"
#include "soc.h"
@@ -33,7 +32,6 @@ static void __init at91rm9200_dt_device_init(void)


	of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
	of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);


	arm_pm_idle = at91rm9200_idle;
	at91rm9200_pm_init();
	at91rm9200_pm_init();
}
}


+0 −2
Original line number Original line Diff line number Diff line
@@ -62,8 +62,6 @@ static void __init at91sam9_common_init(void)
		soc_dev = soc_device_to_device(soc);
		soc_dev = soc_device_to_device(soc);


	of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
	of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);

	arm_pm_idle = at91sam9_idle;
}
}


static void __init at91sam9_dt_device_init(void)
static void __init at91sam9_dt_device_init(void)
+2 −11
Original line number Original line Diff line number Diff line
@@ -11,27 +11,18 @@
#ifndef _AT91_GENERIC_H
#ifndef _AT91_GENERIC_H
#define _AT91_GENERIC_H
#define _AT91_GENERIC_H


#include <linux/of.h>
#include <linux/reboot.h>

 /* Map io */
extern void __init at91_map_io(void);
extern void __init at91_alt_map_io(void);

/* idle */
extern void at91rm9200_idle(void);
extern void at91sam9_idle(void);

#ifdef CONFIG_PM
#ifdef CONFIG_PM
extern void __init at91rm9200_pm_init(void);
extern void __init at91rm9200_pm_init(void);
extern void __init at91sam9260_pm_init(void);
extern void __init at91sam9260_pm_init(void);
extern void __init at91sam9g45_pm_init(void);
extern void __init at91sam9g45_pm_init(void);
extern void __init at91sam9x5_pm_init(void);
extern void __init at91sam9x5_pm_init(void);
extern void __init sama5_pm_init(void);
#else
#else
static inline void __init at91rm9200_pm_init(void) { }
static inline void __init at91rm9200_pm_init(void) { }
static inline void __init at91sam9260_pm_init(void) { }
static inline void __init at91sam9260_pm_init(void) { }
static inline void __init at91sam9g45_pm_init(void) { }
static inline void __init at91sam9g45_pm_init(void) { }
static inline void __init at91sam9x5_pm_init(void) { }
static inline void __init at91sam9x5_pm_init(void) { }
static inline void __init sama5_pm_init(void) { }
#endif
#endif


#endif /* _AT91_GENERIC_H */
#endif /* _AT91_GENERIC_H */
+59 −11
Original line number Original line Diff line number Diff line
@@ -31,10 +31,13 @@
#include <asm/mach/irq.h>
#include <asm/mach/irq.h>
#include <asm/fncpy.h>
#include <asm/fncpy.h>
#include <asm/cacheflush.h>
#include <asm/cacheflush.h>
#include <asm/system_misc.h>


#include "generic.h"
#include "generic.h"
#include "pm.h"
#include "pm.h"


static void __iomem *pmc;

/*
/*
 * FIXME: this is needed to communicate between the pinctrl driver and
 * FIXME: this is needed to communicate between the pinctrl driver and
 * the PM implementation in the machine. Possibly part of the PM
 * the PM implementation in the machine. Possibly part of the PM
@@ -87,7 +90,7 @@ static int at91_pm_verify_clocks(void)
	unsigned long scsr;
	unsigned long scsr;
	int i;
	int i;


	scsr = at91_pmc_read(AT91_PMC_SCSR);
	scsr = readl(pmc + AT91_PMC_SCSR);


	/* USB must not be using PLLB */
	/* USB must not be using PLLB */
	if ((scsr & at91_pm_data.uhp_udp_mask) != 0) {
	if ((scsr & at91_pm_data.uhp_udp_mask) != 0) {
@@ -101,8 +104,7 @@ static int at91_pm_verify_clocks(void)


		if ((scsr & (AT91_PMC_PCK0 << i)) == 0)
		if ((scsr & (AT91_PMC_PCK0 << i)) == 0)
			continue;
			continue;

		css = readl(pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
		css = at91_pmc_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
		if (css != AT91_PMC_CSS_SLOW) {
		if (css != AT91_PMC_CSS_SLOW) {
			pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css);
			pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css);
			return 0;
			return 0;
@@ -145,7 +147,7 @@ static void at91_pm_suspend(suspend_state_t state)
	flush_cache_all();
	flush_cache_all();
	outer_disable();
	outer_disable();


	at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0],
	at91_suspend_sram_fn(pmc, at91_ramc_base[0],
			     at91_ramc_base[1], pm_data);
			     at91_ramc_base[1], pm_data);


	outer_resume();
	outer_resume();
@@ -353,6 +355,21 @@ static __init void at91_dt_ramc(void)
	at91_pm_set_standby(standby);
	at91_pm_set_standby(standby);
}
}


void at91rm9200_idle(void)
{
	/*
	 * Disable the processor clock.  The processor will be automatically
	 * re-enabled by an interrupt or by a reset.
	 */
	writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR);
}

void at91sam9_idle(void)
{
	writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR);
	cpu_do_idle();
}

static void __init at91_pm_sram_init(void)
static void __init at91_pm_sram_init(void)
{
{
	struct gen_pool *sram_pool;
	struct gen_pool *sram_pool;
@@ -399,13 +416,36 @@ static void __init at91_pm_sram_init(void)
			&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
			&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
}
}


static void __init at91_pm_init(void)
static const struct of_device_id atmel_pmc_ids[] __initconst = {
	{ .compatible = "atmel,at91rm9200-pmc"  },
	{ .compatible = "atmel,at91sam9260-pmc" },
	{ .compatible = "atmel,at91sam9g45-pmc" },
	{ .compatible = "atmel,at91sam9n12-pmc" },
	{ .compatible = "atmel,at91sam9x5-pmc" },
	{ .compatible = "atmel,sama5d3-pmc" },
	{ .compatible = "atmel,sama5d2-pmc" },
	{ /* sentinel */ },
};

static void __init at91_pm_init(void (*pm_idle)(void))
{
{
	at91_pm_sram_init();
	struct device_node *pmc_np;


	if (at91_cpuidle_device.dev.platform_data)
	if (at91_cpuidle_device.dev.platform_data)
		platform_device_register(&at91_cpuidle_device);
		platform_device_register(&at91_cpuidle_device);


	pmc_np = of_find_matching_node(NULL, atmel_pmc_ids);
	pmc = of_iomap(pmc_np, 0);
	if (!pmc) {
		pr_err("AT91: PM not supported, PMC not found\n");
		return;
	}

	if (pm_idle)
		arm_pm_idle = pm_idle;

	at91_pm_sram_init();

	if (at91_suspend_sram_fn)
	if (at91_suspend_sram_fn)
		suspend_set_ops(&at91_pm_ops);
		suspend_set_ops(&at91_pm_ops);
	else
	else
@@ -424,7 +464,7 @@ void __init at91rm9200_pm_init(void)
	at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP;
	at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP;
	at91_pm_data.memctrl = AT91_MEMCTRL_MC;
	at91_pm_data.memctrl = AT91_MEMCTRL_MC;


	at91_pm_init();
	at91_pm_init(at91rm9200_idle);
}
}


void __init at91sam9260_pm_init(void)
void __init at91sam9260_pm_init(void)
@@ -432,7 +472,7 @@ void __init at91sam9260_pm_init(void)
	at91_dt_ramc();
	at91_dt_ramc();
	at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC;
	at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC;
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
	return at91_pm_init();
	at91_pm_init(at91sam9_idle);
}
}


void __init at91sam9g45_pm_init(void)
void __init at91sam9g45_pm_init(void)
@@ -440,7 +480,7 @@ void __init at91sam9g45_pm_init(void)
	at91_dt_ramc();
	at91_dt_ramc();
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP;
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP;
	at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
	at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
	return at91_pm_init();
	at91_pm_init(at91sam9_idle);
}
}


void __init at91sam9x5_pm_init(void)
void __init at91sam9x5_pm_init(void)
@@ -448,5 +488,13 @@ void __init at91sam9x5_pm_init(void)
	at91_dt_ramc();
	at91_dt_ramc();
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
	at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
	at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
	return at91_pm_init();
	at91_pm_init(at91sam9_idle);
}

void __init sama5_pm_init(void)
{
	at91_dt_ramc();
	at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
	at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
	at91_pm_init(NULL);
}
}
Loading