aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-03-16 09:17:50 -0400
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-05-20 10:37:38 -0400
commiteaa9a21dd14be8f4fdc6dbdb3732e2f5c3f49fa9 (patch)
treeffe3938d1e9ef3ef9dfc2e8d1b0130bedf017ff1 /drivers/pcmcia
parent0506b2986c0971a987d7c63ac728f39c722f358a (diff)
pcmcia: at91_cf: Use syscon to configure the MC/smc
Use syscon/regmap to configure the smc part of the memory controller. This allows to avoid using mach/at91rm9200_mc.h and mach/at91_ramc.h and to compile the driver in a multiplatform configuration. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/Kconfig1
-rw-r--r--drivers/pcmcia/at91_cf.c25
2 files changed, 14 insertions, 12 deletions
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index a65f821f52eb..d3c378b4db6c 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -277,7 +277,6 @@ config AT91_CF
277 tristate "AT91 CompactFlash Controller" 277 tristate "AT91 CompactFlash Controller"
278 depends on PCI 278 depends on PCI
279 depends on PCMCIA && ARCH_AT91 279 depends on PCMCIA && ARCH_AT91
280 depends on !ARCH_MULTIPLATFORM
281 help 280 help
282 Say Y here to support the CompactFlash controller on AT91 chips. 281 Say Y here to support the CompactFlash controller on AT91 chips.
283 Or choose M to compile the driver as a module named "at91_cf". 282 Or choose M to compile the driver as a module named "at91_cf".
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index e7775a41ae5d..87147bcd1655 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -20,16 +20,15 @@
20#include <linux/platform_data/atmel.h> 20#include <linux/platform_data/atmel.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/sizes.h> 22#include <linux/sizes.h>
23#include <linux/mfd/syscon.h>
24#include <linux/mfd/syscon/atmel-mc.h>
23#include <linux/of.h> 25#include <linux/of.h>
24#include <linux/of_device.h> 26#include <linux/of_device.h>
25#include <linux/of_gpio.h> 27#include <linux/of_gpio.h>
28#include <linux/regmap.h>
26 29
27#include <pcmcia/ss.h> 30#include <pcmcia/ss.h>
28 31
29#include <mach/at91rm9200_mc.h>
30#include <mach/at91_ramc.h>
31
32
33/* 32/*
34 * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; 33 * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW;
35 * some other bit in {A24,A22..A11} is nREG to flag memory access 34 * some other bit in {A24,A22..A11} is nREG to flag memory access
@@ -40,6 +39,8 @@
40#define CF_IO_PHYS (1 << 23) 39#define CF_IO_PHYS (1 << 23)
41#define CF_MEM_PHYS (0x017ff800) 40#define CF_MEM_PHYS (0x017ff800)
42 41
42struct regmap *mc;
43
43/*--------------------------------------------------------------------------*/ 44/*--------------------------------------------------------------------------*/
44 45
45struct at91_cf_socket { 46struct at91_cf_socket {
@@ -155,10 +156,7 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
155 156
156 /* 157 /*
157 * Use 16 bit accesses unless/until we need 8-bit i/o space. 158 * Use 16 bit accesses unless/until we need 8-bit i/o space.
158 */ 159 *
159 csr = at91_ramc_read(0, AT91_SMC_CSR(cf->board->chipselect)) & ~AT91_SMC_DBW;
160
161 /*
162 * NOTE: this CF controller ignores IOIS16, so we can't really do 160 * NOTE: this CF controller ignores IOIS16, so we can't really do
163 * MAP_AUTOSZ. The 16bit mode allows single byte access on either 161 * MAP_AUTOSZ. The 16bit mode allows single byte access on either
164 * D0-D7 (even addr) or D8-D15 (odd), so it's close enough for many 162 * D0-D7 (even addr) or D8-D15 (odd), so it's close enough for many
@@ -169,13 +167,14 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
169 * CF 3.0 spec table 35 also giving the D8-D15 option. 167 * CF 3.0 spec table 35 also giving the D8-D15 option.
170 */ 168 */
171 if (!(io->flags & (MAP_16BIT | MAP_AUTOSZ))) { 169 if (!(io->flags & (MAP_16BIT | MAP_AUTOSZ))) {
172 csr |= AT91_SMC_DBW_8; 170 csr = AT91_MC_SMC_DBW_8;
173 dev_dbg(&cf->pdev->dev, "8bit i/o bus\n"); 171 dev_dbg(&cf->pdev->dev, "8bit i/o bus\n");
174 } else { 172 } else {
175 csr |= AT91_SMC_DBW_16; 173 csr = AT91_MC_SMC_DBW_16;
176 dev_dbg(&cf->pdev->dev, "16bit i/o bus\n"); 174 dev_dbg(&cf->pdev->dev, "16bit i/o bus\n");
177 } 175 }
178 at91_ramc_write(0, AT91_SMC_CSR(cf->board->chipselect), csr); 176 regmap_update_bits(mc, AT91_MC_SMC_CSR(cf->board->chipselect),
177 AT91_MC_SMC_DBW, csr);
179 178
180 io->start = cf->socket.io_offset; 179 io->start = cf->socket.io_offset;
181 io->stop = io->start + SZ_2K - 1; 180 io->stop = io->start + SZ_2K - 1;
@@ -236,6 +235,10 @@ static int at91_cf_dt_init(struct platform_device *pdev)
236 235
237 pdev->dev.platform_data = board; 236 pdev->dev.platform_data = board;
238 237
238 mc = syscon_regmap_lookup_by_compatible("atmel,at91rm9200-sdramc");
239 if (IS_ERR(mc))
240 return PTR_ERR(mc);
241
239 return 0; 242 return 0;
240} 243}
241#else 244#else