Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+14 -12
-1
drivers/pcmcia/Kconfig
··· 277 277 tristate "AT91 CompactFlash Controller" 278 278 depends on PCI 279 279 depends on PCMCIA && ARCH_AT91 280 - depends on !ARCH_MULTIPLATFORM 281 280 help 282 281 Say Y here to support the CompactFlash controller on AT91 chips. 283 282 Or choose M to compile the driver as a module named "at91_cf".
+14 -11
drivers/pcmcia/at91_cf.c
··· 20 20 #include <linux/platform_data/atmel.h> 21 21 #include <linux/io.h> 22 22 #include <linux/sizes.h> 23 + #include <linux/mfd/syscon.h> 24 + #include <linux/mfd/syscon/atmel-mc.h> 23 25 #include <linux/of.h> 24 26 #include <linux/of_device.h> 25 27 #include <linux/of_gpio.h> 28 + #include <linux/regmap.h> 26 29 27 30 #include <pcmcia/ss.h> 28 - 29 - #include <mach/at91rm9200_mc.h> 30 - #include <mach/at91_ramc.h> 31 - 32 31 33 32 /* 34 33 * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; ··· 38 39 #define CF_ATTR_PHYS (0) 39 40 #define CF_IO_PHYS (1 << 23) 40 41 #define CF_MEM_PHYS (0x017ff800) 42 + 43 + struct regmap *mc; 41 44 42 45 /*--------------------------------------------------------------------------*/ 43 46 ··· 156 155 157 156 /* 158 157 * Use 16 bit accesses unless/until we need 8-bit i/o space. 159 - */ 160 - csr = at91_ramc_read(0, AT91_SMC_CSR(cf->board->chipselect)) & ~AT91_SMC_DBW; 161 - 162 - /* 158 + * 163 159 * NOTE: this CF controller ignores IOIS16, so we can't really do 164 160 * MAP_AUTOSZ. The 16bit mode allows single byte access on either 165 161 * D0-D7 (even addr) or D8-D15 (odd), so it's close enough for many ··· 167 169 * CF 3.0 spec table 35 also giving the D8-D15 option. 168 170 */ 169 171 if (!(io->flags & (MAP_16BIT | MAP_AUTOSZ))) { 170 - csr |= AT91_SMC_DBW_8; 172 + csr = AT91_MC_SMC_DBW_8; 171 173 dev_dbg(&cf->pdev->dev, "8bit i/o bus\n"); 172 174 } else { 173 - csr |= AT91_SMC_DBW_16; 175 + csr = AT91_MC_SMC_DBW_16; 174 176 dev_dbg(&cf->pdev->dev, "16bit i/o bus\n"); 175 177 } 176 - at91_ramc_write(0, AT91_SMC_CSR(cf->board->chipselect), csr); 178 + regmap_update_bits(mc, AT91_MC_SMC_CSR(cf->board->chipselect), 179 + AT91_MC_SMC_DBW, csr); 177 180 178 181 io->start = cf->socket.io_offset; 179 182 io->stop = io->start + SZ_2K - 1; ··· 234 235 board->rst_pin = of_get_gpio(pdev->dev.of_node, 3); 235 236 236 237 pdev->dev.platform_data = board; 238 + 239 + mc = syscon_regmap_lookup_by_compatible("atmel,at91rm9200-sdramc"); 240 + if (IS_ERR(mc)) 241 + return PTR_ERR(mc); 237 242 238 243 return 0; 239 244 }