Commit 0d481d41 authored by Kevin Hilman's avatar Kevin Hilman

Merge tag 'soc-3.13-2' of git://git.infradead.org/linux-mvebu into next/soc

From Jason Cooper:
mvebu soc changes for v3.13 (round 2)

 - kirkwood
    - remove mbus init, pcie clk init
    - retain MAC addr for DT ethernet (work around broken IP)
    - docs: clarify Armada SoCs

* tag 'soc-3.13-2' of git://git.infradead.org/linux-mvebu:
  Documentation: arm/Marvell: clarify Armada SoCs that match 78xx0 pattern
  ARM: kirkwood: retain MAC address for DT ethernet
  ARM: kirkwood: Remove unneeded PCIe clock adding
  ARM: kirkwood: Remove unneeded MBus initialization
  ARM: kirkwood: Add standby support
Signed-off-by: default avatarKevin Hilman <khilman@linaro.org>
parents 7bc13d78 d7f5baee
...@@ -88,6 +88,7 @@ EBU Armada family ...@@ -88,6 +88,7 @@ EBU Armada family
MV78230 MV78230
MV78260 MV78260
MV78460 MV78460
NOTE: not to be confused with the non-SMP 78xx0 SoCs
Product Brief: http://www.marvell.com/embedded-processors/armada-xp/assets/Marvell-ArmadaXP-SoC-product%20brief.pdf Product Brief: http://www.marvell.com/embedded-processors/armada-xp/assets/Marvell-ArmadaXP-SoC-product%20brief.pdf
No public datasheet available. No public datasheet available.
......
obj-y += common.o pcie.o obj-y += common.o pcie.o
obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o
obj-$(CONFIG_PM) += pm.o
obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_net.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clocksource.h> #include <linux/clocksource.h>
...@@ -44,14 +46,6 @@ static void __init kirkwood_legacy_clk_init(void) ...@@ -44,14 +46,6 @@ static void __init kirkwood_legacy_clk_init(void)
clkspec.np = np; clkspec.np = np;
clkspec.args_count = 1; clkspec.args_count = 1;
clkspec.args[0] = CGC_BIT_PEX0;
orion_clkdev_add("0", "pcie",
of_clk_get_from_provider(&clkspec));
clkspec.args[0] = CGC_BIT_PEX1;
orion_clkdev_add("1", "pcie",
of_clk_get_from_provider(&clkspec));
/* /*
* The ethernet interfaces forget the MAC address assigned by * The ethernet interfaces forget the MAC address assigned by
* u-boot if the clocks are turned off. Until proper DT support * u-boot if the clocks are turned off. Until proper DT support
...@@ -66,17 +60,89 @@ static void __init kirkwood_legacy_clk_init(void) ...@@ -66,17 +60,89 @@ static void __init kirkwood_legacy_clk_init(void)
clk_prepare_enable(clk); clk_prepare_enable(clk);
} }
static void __init kirkwood_dt_time_init(void) #define MV643XX_ETH_MAC_ADDR_LOW 0x0414
#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
static void __init kirkwood_dt_eth_fixup(void)
{ {
of_clk_init(NULL); struct device_node *np;
clocksource_of_init();
/*
* The ethernet interfaces forget the MAC address assigned by u-boot
* if the clocks are turned off. Usually, u-boot on kirkwood boards
* has no DT support to properly set local-mac-address property.
* As a workaround, we get the MAC address from mv643xx_eth registers
* and update the port device node if no valid MAC address is set.
*/
for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") {
struct device_node *pnp = of_get_parent(np);
struct clk *clk;
struct property *pmac;
void __iomem *io;
u8 *macaddr;
u32 reg;
if (!pnp)
continue;
/* skip disabled nodes or nodes with valid MAC address*/
if (!of_device_is_available(pnp) || of_get_mac_address(np))
goto eth_fixup_skip;
clk = of_clk_get(pnp, 0);
if (IS_ERR(clk))
goto eth_fixup_skip;
io = of_iomap(pnp, 0);
if (!io)
goto eth_fixup_no_map;
/* ensure port clock is not gated to not hang CPU */
clk_prepare_enable(clk);
/* store MAC address register contents in local-mac-address */
pr_err(FW_INFO "%s: local-mac-address is not set\n",
np->full_name);
pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
if (!pmac)
goto eth_fixup_no_mem;
pmac->value = pmac + 1;
pmac->length = 6;
pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
if (!pmac->name) {
kfree(pmac);
goto eth_fixup_no_mem;
}
macaddr = pmac->value;
reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH);
macaddr[0] = (reg >> 24) & 0xff;
macaddr[1] = (reg >> 16) & 0xff;
macaddr[2] = (reg >> 8) & 0xff;
macaddr[3] = reg & 0xff;
reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW);
macaddr[4] = (reg >> 8) & 0xff;
macaddr[5] = reg & 0xff;
of_update_property(np, pmac);
eth_fixup_no_mem:
iounmap(io);
clk_disable_unprepare(clk);
eth_fixup_no_map:
clk_put(clk);
eth_fixup_skip:
of_node_put(pnp);
}
} }
static void __init kirkwood_dt_init_early(void) static void __init kirkwood_dt_time_init(void)
{ {
mvebu_mbus_init("marvell,kirkwood-mbus", of_clk_init(NULL);
BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, clocksource_of_init();
DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ);
} }
static void __init kirkwood_dt_init(void) static void __init kirkwood_dt_init(void)
...@@ -97,11 +163,12 @@ static void __init kirkwood_dt_init(void) ...@@ -97,11 +163,12 @@ static void __init kirkwood_dt_init(void)
kirkwood_l2_init(); kirkwood_l2_init();
kirkwood_cpufreq_init(); kirkwood_cpufreq_init();
kirkwood_cpuidle_init();
/* Setup clocks for legacy devices */ /* Setup clocks for legacy devices */
kirkwood_legacy_clk_init(); kirkwood_legacy_clk_init();
kirkwood_cpuidle_init(); kirkwood_pm_init();
kirkwood_dt_eth_fixup();
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
kexec_reinit = kirkwood_enable_pcie; kexec_reinit = kirkwood_enable_pcie;
...@@ -121,7 +188,6 @@ static const char * const kirkwood_dt_board_compat[] = { ...@@ -121,7 +188,6 @@ static const char * const kirkwood_dt_board_compat[] = {
DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
/* Maintainer: Jason Cooper <jason@lakedaemon.net> */ /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
.map_io = kirkwood_map_io, .map_io = kirkwood_map_io,
.init_early = kirkwood_dt_init_early,
.init_time = kirkwood_dt_time_init, .init_time = kirkwood_dt_time_init,
.init_machine = kirkwood_dt_init, .init_machine = kirkwood_dt_init,
.restart = kirkwood_restart, .restart = kirkwood_restart,
......
...@@ -721,6 +721,7 @@ void __init kirkwood_init(void) ...@@ -721,6 +721,7 @@ void __init kirkwood_init(void)
kirkwood_xor1_init(); kirkwood_xor1_init();
kirkwood_crypto_init(); kirkwood_crypto_init();
kirkwood_pm_init();
kirkwood_cpuidle_init(); kirkwood_cpuidle_init();
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
kexec_reinit = kirkwood_enable_pcie; kexec_reinit = kirkwood_enable_pcie;
......
...@@ -58,6 +58,12 @@ void kirkwood_cpufreq_init(void); ...@@ -58,6 +58,12 @@ void kirkwood_cpufreq_init(void);
void kirkwood_restart(enum reboot_mode, const char *); void kirkwood_restart(enum reboot_mode, const char *);
void kirkwood_clk_init(void); void kirkwood_clk_init(void);
#ifdef CONFIG_PM
void kirkwood_pm_init(void);
#else
static inline void kirkwood_pm_init(void) {};
#endif
/* board init functions for boards not fully converted to fdt */ /* board init functions for boards not fully converted to fdt */
#ifdef CONFIG_MACH_MV88F6281GTW_GE_DT #ifdef CONFIG_MACH_MV88F6281GTW_GE_DT
void mv88f6281gtw_ge_init(void); void mv88f6281gtw_ge_init(void);
......
...@@ -78,4 +78,6 @@ ...@@ -78,4 +78,6 @@
#define CGC_TDM (1 << 20) #define CGC_TDM (1 << 20)
#define CGC_RESERVED (0x6 << 21) #define CGC_RESERVED (0x6 << 21)
#define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118)
#endif #endif
/*
* Power Management driver for Marvell Kirkwood SoCs
*
* Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
* Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
*
* 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.
*
* 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/kernel.h>
#include <linux/suspend.h>
#include <linux/io.h>
#include <mach/bridge-regs.h>
static void __iomem *ddr_operation_base;
static void kirkwood_low_power(void)
{
u32 mem_pm_ctrl;
mem_pm_ctrl = readl(MEMORY_PM_CTRL);
/* Set peripherals to low-power mode */
writel_relaxed(~0, MEMORY_PM_CTRL);
/* Set DDR in self-refresh */
writel_relaxed(0x7, ddr_operation_base);
/*
* Set CPU in wait-for-interrupt state.
* This disables the CPU core clocks,
* the array clocks, and also the L2 controller.
*/
cpu_do_idle();
writel_relaxed(mem_pm_ctrl, MEMORY_PM_CTRL);
}
static int kirkwood_suspend_enter(suspend_state_t state)
{
switch (state) {
case PM_SUSPEND_STANDBY:
kirkwood_low_power();
break;
default:
return -EINVAL;
}
return 0;
}
static int kirkwood_pm_valid_standby(suspend_state_t state)
{
return state == PM_SUSPEND_STANDBY;
}
static const struct platform_suspend_ops kirkwood_suspend_ops = {
.enter = kirkwood_suspend_enter,
.valid = kirkwood_pm_valid_standby,
};
int __init kirkwood_pm_init(void)
{
ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
suspend_set_ops(&kirkwood_suspend_ops);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment