Skip to content

Commit

Permalink
ARM: Orion: mbus_dram_info consolidation
Browse files Browse the repository at this point in the history
Move the *_mbus_dram_info structure into the orion platform and call it
orion_mbus_dram_info everywhere.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Michael Walle <michael@walle.cc>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
  • Loading branch information
Andrew Lunn authored and Nicolas Pitre committed Dec 13, 2011
1 parent b6d1c33 commit 45173d5
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 55 deletions.
8 changes: 3 additions & 5 deletions arch/arm/mach-dove/addr-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#define ATTR_PCIE_MEM 0xe8
#define ATTR_SCRATCHPAD 0x0

struct mbus_dram_target_info dove_mbus_dram_info;

static inline void __iomem *ddr_map_sc(int i)
{
return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4));
Expand Down Expand Up @@ -102,7 +100,7 @@ void __init dove_setup_cpu_mbus(void)
/*
* Setup MBUS dram target info.
*/
dove_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;

for (i = 0, cs = 0; i < 2; i++) {
u32 map = readl(ddr_map_sc(i));
Expand All @@ -113,7 +111,7 @@ void __init dove_setup_cpu_mbus(void)
if (map & 1) {
struct mbus_dram_window *w;

w = &dove_mbus_dram_info.cs[cs++];
w = &orion_mbus_dram_info.cs[cs++];
w->cs_index = i;
w->mbus_attr = 0; /* CS address decoding done inside */
/* the DDR controller, no need to */
Expand All @@ -122,5 +120,5 @@ void __init dove_setup_cpu_mbus(void)
w->size = 0x100000 << (((map & 0x000f0000) >> 16) - 4);
}
}
dove_mbus_dram_info.num_cs = cs;
orion_mbus_dram_info.num_cs = cs;
}
11 changes: 6 additions & 5 deletions arch/arm/mach-dove/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/irq.h>
#include <plat/time.h>
#include <plat/common.h>
#include <plat/addr-map.h>
#include "common.h"

static int get_tclk(void);
Expand Down Expand Up @@ -71,7 +72,7 @@ void __init dove_map_io(void)
****************************************************************************/
void __init dove_ehci0_init(void)
{
orion_ehci_init(&dove_mbus_dram_info,
orion_ehci_init(&orion_mbus_dram_info,
DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0);
}

Expand All @@ -80,7 +81,7 @@ void __init dove_ehci0_init(void)
****************************************************************************/
void __init dove_ehci1_init(void)
{
orion_ehci_1_init(&dove_mbus_dram_info,
orion_ehci_1_init(&orion_mbus_dram_info,
DOVE_USB1_PHYS_BASE, IRQ_DOVE_USB1);
}

Expand All @@ -89,7 +90,7 @@ void __init dove_ehci1_init(void)
****************************************************************************/
void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
orion_ge00_init(eth_data, &dove_mbus_dram_info,
orion_ge00_init(eth_data, &orion_mbus_dram_info,
DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
0, get_tclk());
}
Expand All @@ -107,7 +108,7 @@ void __init dove_rtc_init(void)
****************************************************************************/
void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
{
orion_sata_init(sata_data, &dove_mbus_dram_info,
orion_sata_init(sata_data, &orion_mbus_dram_info,
DOVE_SATA_PHYS_BASE, IRQ_DOVE_SATA);

}
Expand Down Expand Up @@ -198,7 +199,7 @@ struct sys_timer dove_timer = {
****************************************************************************/
void __init dove_xor0_init(void)
{
orion_xor0_init(&dove_mbus_dram_info,
orion_xor0_init(&orion_mbus_dram_info,
DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE,
IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01);
}
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-dove/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ struct mv643xx_eth_platform_data;
struct mv_sata_platform_data;

extern struct sys_timer dove_timer;
extern struct mbus_dram_target_info dove_mbus_dram_info;

/*
* Basic Dove init functions used early by machine-setup.
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-dove/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <plat/pcie.h>
#include <mach/irqs.h>
#include <mach/bridge-regs.h>
#include <plat/addr-map.h>
#include "common.h"

struct pcie_port {
Expand Down Expand Up @@ -50,7 +51,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
*/
orion_pcie_set_local_bus_nr(pp->base, sys->busnr);

orion_pcie_setup(pp->base, &dove_mbus_dram_info);
orion_pcie_setup(pp->base, &orion_mbus_dram_info);

/*
* IORESOURCE_IO
Expand Down
5 changes: 1 addition & 4 deletions arch/arm/mach-kirkwood/addr-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#define ATTR_PCIE1_MEM 0xd8
#define ATTR_SRAM 0x01

struct mbus_dram_target_info kirkwood_mbus_dram_info;

/*
* Description of the windows needed by the platform code
*/
Expand Down Expand Up @@ -88,6 +86,5 @@ void __init kirkwood_setup_cpu_mbus(void)
/*
* Setup MBUS dram target info.
*/
orion_setup_cpu_mbus_target(&addr_map_cfg, &kirkwood_mbus_dram_info,
DDR_WINDOW_CPU_BASE);
orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU_BASE);
}
15 changes: 8 additions & 7 deletions arch/arm/mach-kirkwood/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <plat/orion_nand.h>
#include <plat/common.h>
#include <plat/time.h>
#include <plat/addr-map.h>
#include "common.h"

/*****************************************************************************
Expand Down Expand Up @@ -73,7 +74,7 @@ unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED;
void __init kirkwood_ehci_init(void)
{
kirkwood_clk_ctrl |= CGC_USB0;
orion_ehci_init(&kirkwood_mbus_dram_info,
orion_ehci_init(&orion_mbus_dram_info,
USB_PHYS_BASE, IRQ_KIRKWOOD_USB);
}

Expand All @@ -85,7 +86,7 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
kirkwood_clk_ctrl |= CGC_GE0;

orion_ge00_init(eth_data, &kirkwood_mbus_dram_info,
orion_ge00_init(eth_data, &orion_mbus_dram_info,
GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
IRQ_KIRKWOOD_GE00_ERR, kirkwood_tclk);
}
Expand All @@ -99,7 +100,7 @@ void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)

kirkwood_clk_ctrl |= CGC_GE1;

orion_ge01_init(eth_data, &kirkwood_mbus_dram_info,
orion_ge01_init(eth_data, &orion_mbus_dram_info,
GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
IRQ_KIRKWOOD_GE01_ERR, kirkwood_tclk);
}
Expand Down Expand Up @@ -178,7 +179,7 @@ void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
if (sata_data->n_ports > 1)
kirkwood_clk_ctrl |= CGC_SATA1;

orion_sata_init(sata_data, &kirkwood_mbus_dram_info,
orion_sata_init(sata_data, &orion_mbus_dram_info,
SATA_PHYS_BASE, IRQ_KIRKWOOD_SATA);
}

Expand Down Expand Up @@ -221,7 +222,7 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
mvsdio_data->clock = 100000000;
else
mvsdio_data->clock = 200000000;
mvsdio_data->dram = &kirkwood_mbus_dram_info;
mvsdio_data->dram = &orion_mbus_dram_info;
kirkwood_clk_ctrl |= CGC_SDIO;
kirkwood_sdio.dev.platform_data = mvsdio_data;
platform_device_register(&kirkwood_sdio);
Expand Down Expand Up @@ -285,7 +286,7 @@ static void __init kirkwood_xor0_init(void)
{
kirkwood_clk_ctrl |= CGC_XOR0;

orion_xor0_init(&kirkwood_mbus_dram_info,
orion_xor0_init(&orion_mbus_dram_info,
XOR0_PHYS_BASE, XOR0_HIGH_PHYS_BASE,
IRQ_KIRKWOOD_XOR_00, IRQ_KIRKWOOD_XOR_01);
}
Expand Down Expand Up @@ -364,7 +365,7 @@ static struct resource kirkwood_i2s_resources[] = {
};

static struct kirkwood_asoc_platform_data kirkwood_i2s_data = {
.dram = &kirkwood_mbus_dram_info,
.dram = &orion_mbus_dram_info,
.burst = 128,
};

Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-kirkwood/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ void kirkwood_init(void);
void kirkwood_init_early(void);
void kirkwood_init_irq(void);

extern struct mbus_dram_target_info kirkwood_mbus_dram_info;
void kirkwood_setup_cpu_mbus(void);

void kirkwood_enable_pcie(void);
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-kirkwood/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <asm/mach/pci.h>
#include <plat/pcie.h>
#include <mach/bridge-regs.h>
#include <plat/addr-map.h>
#include "common.h"

void kirkwood_enable_pcie(void)
Expand Down Expand Up @@ -208,7 +209,7 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
*/
orion_pcie_set_local_bus_nr(pp->base, sys->busnr);

orion_pcie_setup(pp->base, &kirkwood_mbus_dram_info);
orion_pcie_setup(pp->base, &orion_mbus_dram_info);

return 1;
}
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/mach-mv78xx0/addr-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
#define WIN0_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))
#define WIN8_OFF(n) (BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4))

struct mbus_dram_target_info mv78xx0_mbus_dram_info;

static void __init __iomem *win_cfg_base(int win)
{
/*
Expand Down Expand Up @@ -73,11 +71,9 @@ void __init mv78xx0_setup_cpu_mbus(void)
*/
if (mv78xx0_core_index() == 0)
orion_setup_cpu_mbus_target(&addr_map_cfg,
&mv78xx0_mbus_dram_info,
DDR_WINDOW_CPU0_BASE);
else
orion_setup_cpu_mbus_target(&addr_map_cfg,
&mv78xx0_mbus_dram_info,
DDR_WINDOW_CPU1_BASE);
}

Expand Down
17 changes: 9 additions & 8 deletions arch/arm/mach-mv78xx0/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <plat/orion_nand.h>
#include <plat/time.h>
#include <plat/common.h>
#include <plat/addr-map.h>
#include "common.h"

static int get_tclk(void);
Expand Down Expand Up @@ -169,7 +170,7 @@ void __init mv78xx0_map_io(void)
****************************************************************************/
void __init mv78xx0_ehci0_init(void)
{
orion_ehci_init(&mv78xx0_mbus_dram_info,
orion_ehci_init(&orion_mbus_dram_info,
USB0_PHYS_BASE, IRQ_MV78XX0_USB_0);
}

Expand All @@ -179,7 +180,7 @@ void __init mv78xx0_ehci0_init(void)
****************************************************************************/
void __init mv78xx0_ehci1_init(void)
{
orion_ehci_1_init(&mv78xx0_mbus_dram_info,
orion_ehci_1_init(&orion_mbus_dram_info,
USB1_PHYS_BASE, IRQ_MV78XX0_USB_1);
}

Expand All @@ -189,7 +190,7 @@ void __init mv78xx0_ehci1_init(void)
****************************************************************************/
void __init mv78xx0_ehci2_init(void)
{
orion_ehci_2_init(&mv78xx0_mbus_dram_info,
orion_ehci_2_init(&orion_mbus_dram_info,
USB2_PHYS_BASE, IRQ_MV78XX0_USB_2);
}

Expand All @@ -199,7 +200,7 @@ void __init mv78xx0_ehci2_init(void)
****************************************************************************/
void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
orion_ge00_init(eth_data, &mv78xx0_mbus_dram_info,
orion_ge00_init(eth_data, &orion_mbus_dram_info,
GE00_PHYS_BASE, IRQ_MV78XX0_GE00_SUM,
IRQ_MV78XX0_GE_ERR, get_tclk());
}
Expand All @@ -210,7 +211,7 @@ void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
****************************************************************************/
void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
{
orion_ge01_init(eth_data, &mv78xx0_mbus_dram_info,
orion_ge01_init(eth_data, &orion_mbus_dram_info,
GE01_PHYS_BASE, IRQ_MV78XX0_GE01_SUM,
NO_IRQ, get_tclk());
}
Expand All @@ -234,7 +235,7 @@ void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
eth_data->duplex = DUPLEX_FULL;
}

orion_ge10_init(eth_data, &mv78xx0_mbus_dram_info,
orion_ge10_init(eth_data, &orion_mbus_dram_info,
GE10_PHYS_BASE, IRQ_MV78XX0_GE10_SUM,
NO_IRQ, get_tclk());
}
Expand All @@ -258,7 +259,7 @@ void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
eth_data->duplex = DUPLEX_FULL;
}

orion_ge11_init(eth_data, &mv78xx0_mbus_dram_info,
orion_ge11_init(eth_data, &orion_mbus_dram_info,
GE11_PHYS_BASE, IRQ_MV78XX0_GE11_SUM,
NO_IRQ, get_tclk());
}
Expand All @@ -277,7 +278,7 @@ void __init mv78xx0_i2c_init(void)
****************************************************************************/
void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
{
orion_sata_init(sata_data, &mv78xx0_mbus_dram_info,
orion_sata_init(sata_data, &orion_mbus_dram_info,
SATA_PHYS_BASE, IRQ_MV78XX0_SATA);
}

Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-mv78xx0/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void mv78xx0_init(void);
void mv78xx0_init_early(void);
void mv78xx0_init_irq(void);

extern struct mbus_dram_target_info mv78xx0_mbus_dram_info;
void mv78xx0_setup_cpu_mbus(void);
void mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
int maj, int min);
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-mv78xx0/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <asm/irq.h>
#include <asm/mach/pci.h>
#include <plat/pcie.h>
#include <plat/addr-map.h>
#include "common.h"

struct pcie_port {
Expand Down Expand Up @@ -153,7 +154,7 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
* Generic PCIe unit setup.
*/
orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
orion_pcie_setup(pp->base, &mv78xx0_mbus_dram_info);
orion_pcie_setup(pp->base, &orion_mbus_dram_info);

sys->resource[0] = &pp->res[0];
sys->resource[1] = &pp->res[1];
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/mach-orion5x/addr-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#define ATTR_DEV_BOOT 0xf
#define ATTR_SRAM 0x0

struct mbus_dram_target_info orion5x_mbus_dram_info;
static int __initdata win_alloc_count;

static int __init cpu_win_can_remap(const struct orion_addr_map_cfg *cfg,
Expand Down Expand Up @@ -114,8 +113,7 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
/*
* Setup MBUS dram target info.
*/
orion_setup_cpu_mbus_target(&addr_map_cfg, &orion5x_mbus_dram_info,
ORION5X_DDR_WINDOW_CPU_BASE);
orion_setup_cpu_mbus_target(&addr_map_cfg, ORION5X_DDR_WINDOW_CPU_BASE);
}

void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
Expand Down
Loading

0 comments on commit 45173d5

Please sign in to comment.