提交 323cdfc1 编写于 作者: R Russell King 提交者: Russell King

[MFD] Add SA11x0 MCP platform device support

Add platform device data for the SA11x0 MCP device.  This allows
platforms to customise the configuration of the SA11x0 MCP device
according to their needs.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 5e742ad6
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/serial_sa1100.h> #include <asm/mach/serial_sa1100.h>
#include <asm/arch/assabet.h> #include <asm/arch/assabet.h>
#include <asm/arch/mcp.h>
#include "generic.h" #include "generic.h"
...@@ -198,6 +199,11 @@ static struct irda_platform_data assabet_irda_data = { ...@@ -198,6 +199,11 @@ static struct irda_platform_data assabet_irda_data = {
.set_speed = assabet_irda_set_speed, .set_speed = assabet_irda_set_speed,
}; };
static struct mcp_plat_data assabet_mcp_data = {
.mccr0 = MCCR0_ADM,
.sclk_rate = 11981000,
};
static void __init assabet_init(void) static void __init assabet_init(void)
{ {
/* /*
...@@ -246,6 +252,7 @@ static void __init assabet_init(void) ...@@ -246,6 +252,7 @@ static void __init assabet_init(void)
sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources, sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources,
ARRAY_SIZE(assabet_flash_resources)); ARRAY_SIZE(assabet_flash_resources));
sa11x0_set_irda_data(&assabet_irda_data); sa11x0_set_irda_data(&assabet_irda_data);
sa11x0_set_mcp_data(&assabet_mcp_data);
} }
/* /*
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <asm/mach/serial_sa1100.h> #include <asm/mach/serial_sa1100.h>
#include <asm/arch/cerf.h> #include <asm/arch/cerf.h>
#include <asm/arch/mcp.h>
#include "generic.h" #include "generic.h"
static struct resource cerfuart2_resources[] = { static struct resource cerfuart2_resources[] = {
...@@ -116,10 +117,16 @@ static void __init cerf_map_io(void) ...@@ -116,10 +117,16 @@ static void __init cerf_map_io(void)
GPDR |= CERF_GPIO_CF_RESET; GPDR |= CERF_GPIO_CF_RESET;
} }
static struct mcp_plat_data cerf_mcp_data = {
.mccr0 = MCCR0_ADM,
.sclk_rate = 11981000,
};
static void __init cerf_init(void) static void __init cerf_init(void)
{ {
platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices)); platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1); sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1);
sa11x0_set_mcp_data(&cerf_mcp_data);
} }
MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
......
...@@ -221,6 +221,11 @@ static struct platform_device sa11x0mcp_device = { ...@@ -221,6 +221,11 @@ static struct platform_device sa11x0mcp_device = {
.resource = sa11x0mcp_resources, .resource = sa11x0mcp_resources,
}; };
void sa11x0_set_mcp_data(struct mcp_plat_data *data)
{
sa11x0mcp_device.dev.platform_data = data;
}
static struct resource sa11x0ssp_resources[] = { static struct resource sa11x0ssp_resources[] = {
[0] = { [0] = {
.start = 0x80070000, .start = 0x80070000,
......
...@@ -34,5 +34,8 @@ struct resource; ...@@ -34,5 +34,8 @@ struct resource;
extern void sa11x0_set_flash_data(struct flash_platform_data *flash, extern void sa11x0_set_flash_data(struct flash_platform_data *flash,
struct resource *res, int nr); struct resource *res, int nr);
struct sa11x0_ssp_plat_ops;
extern void sa11x0_set_ssp_data(struct sa11x0_ssp_plat_ops *ops);
struct irda_platform_data; struct irda_platform_data;
void sa11x0_set_irda_data(struct irda_platform_data *irda); void sa11x0_set_irda_data(struct irda_platform_data *irda);
...@@ -13,12 +13,23 @@ ...@@ -13,12 +13,23 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/serial_sa1100.h> #include <asm/mach/serial_sa1100.h>
#include <asm/arch/mcp.h>
#include "generic.h" #include "generic.h"
#warning "include/asm/arch-sa1100/ide.h needs fixing for lart" #warning "include/asm/arch-sa1100/ide.h needs fixing for lart"
static struct mcp_plat_data lart_mcp_data = {
.mccr0 = MCCR0_ADM,
.sclk_rate = 11981000,
};
static void __init lart_init(void)
{
sa11x0_set_mcp_data(&lart_mcp_data);
}
static struct map_desc lart_io_desc[] __initdata = { static struct map_desc lart_io_desc[] __initdata = {
/* virtual physical length type */ /* virtual physical length type */
{ 0xe8000000, 0x00000000, 0x00400000, MT_DEVICE }, /* main flash memory */ { 0xe8000000, 0x00000000, 0x00400000, MT_DEVICE }, /* main flash memory */
...@@ -47,5 +58,6 @@ MACHINE_START(LART, "LART") ...@@ -47,5 +58,6 @@ MACHINE_START(LART, "LART")
.boot_params = 0xc0000100, .boot_params = 0xc0000100,
.map_io = lart_map_io, .map_io = lart_map_io,
.init_irq = sa1100_init_irq, .init_irq = sa1100_init_irq,
.init_machine = lart_init,
.timer = &sa1100_timer, .timer = &sa1100_timer,
MACHINE_END MACHINE_END
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/serial_sa1100.h> #include <asm/mach/serial_sa1100.h>
#include <asm/arch/mcp.h>
#include <asm/arch/shannon.h> #include <asm/arch/shannon.h>
#include "generic.h" #include "generic.h"
...@@ -52,9 +53,15 @@ static struct resource shannon_flash_resource = { ...@@ -52,9 +53,15 @@ static struct resource shannon_flash_resource = {
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}; };
static struct mcp_plat_data shannon_mcp_data = {
.mccr0 = MCCR0_ADM,
.sclk_rate = 11981000,
};
static void __init shannon_init(void) static void __init shannon_init(void)
{ {
sa11x0_set_flash_data(&shannon_flash_data, &shannon_flash_resource, 1); sa11x0_set_flash_data(&shannon_flash_data, &shannon_flash_resource, 1);
sa11x0_set_mcp_data(&shannon_mcp_data);
} }
static void __init shannon_map_io(void) static void __init shannon_map_io(void)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/serial_sa1100.h> #include <asm/mach/serial_sa1100.h>
#include <asm/arch/mcp.h>
#include <asm/arch/simpad.h> #include <asm/arch/simpad.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
...@@ -123,6 +124,11 @@ static struct resource simpad_flash_resources [] = { ...@@ -123,6 +124,11 @@ static struct resource simpad_flash_resources [] = {
} }
}; };
static struct mcp_plat_data simpad_mcp_data = {
.mccr0 = MCCR0_ADM,
.sclk_rate = 11981000,
};
static void __init simpad_map_io(void) static void __init simpad_map_io(void)
...@@ -157,6 +163,7 @@ static void __init simpad_map_io(void) ...@@ -157,6 +163,7 @@ static void __init simpad_map_io(void)
sa11x0_set_flash_data(&simpad_flash_data, simpad_flash_resources, sa11x0_set_flash_data(&simpad_flash_data, simpad_flash_resources,
ARRAY_SIZE(simpad_flash_resources)); ARRAY_SIZE(simpad_flash_resources));
sa11x0_set_mcp_data(&simpad_mcp_data);
} }
static void simpad_power_off(void) static void simpad_power_off(void)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/arch/mcp.h>
#include <asm/arch/assabet.h> #include <asm/arch/assabet.h>
...@@ -140,16 +141,11 @@ static struct mcp_ops mcp_sa11x0 = { ...@@ -140,16 +141,11 @@ static struct mcp_ops mcp_sa11x0 = {
static int mcp_sa11x0_probe(struct device *dev) static int mcp_sa11x0_probe(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct mcp_plat_data *data = pdev->dev.platform_data;
struct mcp *mcp; struct mcp *mcp;
int ret; int ret;
if (!machine_is_adsbitsy() && !machine_is_assabet() && if (!data)
!machine_is_cerf() && !machine_is_flexanet() &&
!machine_is_freebird() && !machine_is_graphicsclient() &&
!machine_is_graphicsmaster() && !machine_is_lart() &&
!machine_is_omnimeter() && !machine_is_pfs168() &&
!machine_is_shannon() && !machine_is_simpad() &&
!machine_is_yopy())
return -ENODEV; return -ENODEV;
if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp")) if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp"))
...@@ -163,7 +159,7 @@ static int mcp_sa11x0_probe(struct device *dev) ...@@ -163,7 +159,7 @@ static int mcp_sa11x0_probe(struct device *dev)
mcp->owner = THIS_MODULE; mcp->owner = THIS_MODULE;
mcp->ops = &mcp_sa11x0; mcp->ops = &mcp_sa11x0;
mcp->sclk_rate = 11981000, mcp->sclk_rate = data->sclk_rate;
mcp->dma_audio_rd = DMA_Ser4MCP0Rd; mcp->dma_audio_rd = DMA_Ser4MCP0Rd;
mcp->dma_audio_wr = DMA_Ser4MCP0Wr; mcp->dma_audio_wr = DMA_Ser4MCP0Wr;
mcp->dma_telco_rd = DMA_Ser4MCP1Rd; mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
...@@ -184,9 +180,13 @@ static int mcp_sa11x0_probe(struct device *dev) ...@@ -184,9 +180,13 @@ static int mcp_sa11x0_probe(struct device *dev)
PSDR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM); PSDR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM); PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
/*
* Initialise device. Note that we initially
* set the sampling rate to minimum.
*/
Ser4MCSR = -1; Ser4MCSR = -1;
Ser4MCCR1 = 0; Ser4MCCR1 = data->mccr1;
Ser4MCCR0 = 0x00007f7f | MCCR0_ADM; Ser4MCCR0 = data->mccr0 | 0x7f7f;
/* /*
* Calculate the read/write timeout (us) from the bit clock * Calculate the read/write timeout (us) from the bit clock
......
/*
* linux/include/asm-arm/arch-sa1100/mcp.h
*
* Copyright (C) 2005 Russell King.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __ASM_ARM_ARCH_MCP_H
#define __ASM_ARM_ARCH_MCP_H
#include <linux/types.h>
struct mcp_plat_data {
u32 mccr0;
u32 mccr1;
unsigned int sclk_rate;
};
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册