MXC PCMCIA Support
Subsystems (4)
cover MXC PCMCIA Support
This patch series adds support for the MXC PCMCIA / CF controller.
It has been tested on MX21 (with CF card + ide-cs as well as a broadcom based wificard using b43 driver)
It has been compile only tested for MX27, MX31 as I don't have this hardware but the code is based on Freescale's MX31.
Changes since RFC:
* Split arch specifc changes from driver
* Update to 2.6.33-rc8 [soc-common is now a standalone module]
PATCH 1/3 PCMCIA: Add soc_common support for banked SoC drivers.
Some SoCs (like freescale MXC) require configuring a device register to set the bank mapped into the memory window.
Also allow interrupt flags to be configured (to support shared interrupts).
---
drivers/pcmcia/soc_common.c | 21 +++++++++++++++------ drivers/pcmcia/soc_common.h | 7 +++++++ 2 files changed, 22 insertions(+), 6 deletions(-)
drivers/pcmcia/soc_common.c +15 -6
@@ -257,7 +257,8 @@ static irqreturn_t soc_common_pcmcia_interrupt(int irq, void *dev)struct soc_pcmcia_socket *skt = dev;debug (skt,3 ,"servicing IRQ %d\n" , irq); - +if (skt->ops->ack_interrupt) + skt->ops->ack_interrupt (skt);soc_common_check_status (skt);return IRQ_HANDLED ;
@@ -335,6 +336,7 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m {struct soc_pcmcia_socket *skt =to_soc_pcmcia_socket (sock);unsigned short speed = map->speed; +int ret =0 ; debug(skt, 2, "map %u speed %u start 0x%08llx stop 0x%08llx\n", map->map, map->speed, (unsigned long long)map->start,
@@ -368,11 +370,14 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *mif (map->stop ==1 ) map->stop =PAGE_SIZE -1 ; +if (skt->ops->set_io_map) + ret = skt->ops->set_io_map (skt, map); + map->stop -= map->start; map->stop += skt->socket.io_offset; map->start = skt->socket.io_offset; -return 0 ; +return ret; }
@@ -390,6 +395,7 @@ soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_mapstruct soc_pcmcia_socket *skt =to_soc_pcmcia_socket (sock);struct resource *res;unsigned short speed = map->speed; +int ret =0 ;debug (skt,2 ,"map %u speed %u card_start %08x\n" , map->map, map->speed, map->card_start);
@@ -424,10 +430,12 @@ soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map } skt->ops->set_timing (skt); +if (skt->ops->set_mem_map) + ret = skt->ops->set_mem_map (skt, map); +else + map->static_start = res->start + map->card_start; - map->static_start = res->start + map->card_start; - -return 0 ; +return ret; }struct bittbl {
@@ -521,7 +529,8 @@ int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt,if (irqs[i].sock != skt->nr)continue ; res =request_irq (irqs[i].irq, soc_common_pcmcia_interrupt, -IRQF_DISABLED , irqs[i].str, skt); +IRQF_DISABLED | irqs[i].flags, + irqs[i].str, skt);if (res)break ;set_irq_type (irqs[i].irq,IRQ_TYPE_NONE );
drivers/pcmcia/soc_common.h +7 -0
@@ -111,6 +111,12 @@ struct pcmcia_low_level {*/ int (*frequency_change)(struct soc_pcmcia_socket *,unsigned long ,struct cpufreq_freqs *);#endif +void (*ack_interrupt)(struct soc_pcmcia_socket *); + +/* Hardware specific mapping */ +int (*set_mem_map)(struct soc_pcmcia_socket *,struct pccard_mem_map *); +int (*set_io_map)(struct soc_pcmcia_socket *,struct pccard_io_map *map); + };
@@ -118,6 +124,7 @@ struct pcmcia_irqs {int sock;int irq;const char *str; +unsigned long flags; };struct soc_pcmcia_timing {
PATCH 2/3 MXC: add pcmcia support
In reply to Martin Fuzzey---
arch/arm/mach-mx2/clock_imx21.c | 1 + arch/arm/mach-mx2/clock_imx27.c | 1 + arch/arm/mach-mx2/devices.c | 21 +++++++++++++++++++++ arch/arm/mach-mx2/devices.h | 2 ++ arch/arm/mach-mx3/clock.c | 1 + 5 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/mach-mx2/clock_imx21.c +1 -0
@@ -960,6 +960,7 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK("mxc-keypad", NULL, kpp_clk) _REGISTER_CLOCK(NULL, "owire", owire_clk) _REGISTER_CLOCK(NULL, "rtc", rtc_clk) + _REGISTER_CLOCK("mxc-pcmcia", NULL, hclk_clk) };/*
arch/arm/mach-mx2/clock_imx27.c +1 -0
@@ -674,6 +674,7 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK("mxc_w1.0", NULL, owire_clk) _REGISTER_CLOCK(NULL, "rtc", rtc_clk) _REGISTER_CLOCK(NULL, "scc", scc_clk) + _REGISTER_CLOCK("mxc-pcmcia", NULL, ahb_clk) };/* Adjust the clock path for TO2 and later */
arch/arm/mach-mx2/devices.c +21 -0
@@ -642,3 +642,24 @@ int __init mxc_register_gpios(void) {return mxc_gpio_init (imx_gpio_ports,ARRAY_SIZE (imx_gpio_ports)); } + +static struct resource mxc_resource_pcmcia[] = { + { + .start =PCMCIA_CTL_BASE_ADDR , + .end =PCMCIA_CTL_BASE_ADDR +0x67 , + .flags =IORESOURCE_MEM , + }, + { + .start =MXC_INT_PCMCIA , + .end =MXC_INT_PCMCIA , + .flags =IORESOURCE_IRQ , + }, +}; + +struct platform_device mxc_device_pcmcia = { + .name ="mxc-pcmcia" , + .id =-1 , + .resource = mxc_resource_pcmcia, + .num_resources =ARRAY_SIZE (mxc_resource_pcmcia), +}; +
arch/arm/mach-mx2/devices.h +2 -0
@@ -28,3 +28,5 @@ extern struct platform_device mxc_spi_device1;extern struct platform_device mxc_spi_device2;extern struct platform_device imx_ssi_device0;extern struct platform_device imx_ssi_device1; +extern struct platform_device mxc_device_pcmcia; +
arch/arm/mach-mx3/clock.c +1 -0
@@ -573,6 +573,7 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK(NULL, "mpeg4", mpeg4_clk) _REGISTER_CLOCK(NULL, "mbx", mbx_clk) _REGISTER_CLOCK("mxc_rtc", NULL, ckil_clk) + _REGISTER_CLOCK("mxc-pcmcia", NULL, ahb_clk) };int __init mx31_clocks_init (unsigned long fref)
PATCH 3/3 PCMCIA: Add support for freescale MX2/3 SoCs
In reply to Martin Fuzzey---
drivers/pcmcia/Kconfig | 7 drivers/pcmcia/Makefile | 1 drivers/pcmcia/mxc_pcmcia.c | 710 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 718 insertions(+), 0 deletions(-) create mode 100644 drivers/pcmcia/mxc_pcmcia.c
drivers/pcmcia/Kconfig +7 -0
@@ -298,4 +298,11 @@ config PCCARD_NONSTATIC config PCCARD_IODYN bool +config PCMCIA_MXC + tristate "Freescale MXC PCMCIA Driver" + depends on PCMCIA && ARCH_MXC + select PCMCIA_SOC_COMMON + help + Say Y here to support the integrated PCMCIA in the freescale MXC SoCs. + endif # PCCARD
drivers/pcmcia/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_OMAP_CF) += omap_cf.o obj-$(CONFIG_BFIN_CFPCMCIA) += bfin_cf_pcmcia.o obj-$(CONFIG_AT91_CF) += at91_cf.o obj-$(CONFIG_ELECTRA_CF) += electra_cf.o +obj-$(CONFIG_PCMCIA_MXC) += mxc_pcmcia.o au1x00_ss-y += au1000_generic.o au1x00_ss-$(CONFIG_MIPS_PB1000) += au1000_pb1x00.o
drivers/pcmcia/mxc_pcmcia.c new file +710 -0
710 lines not on this page · raw message
cover MXC PCMCIA Support
In reply to Martin FuzzeyQuoted 11 lines · Martin Fuzzey
This patch series adds support for the MXC PCMCIA / CF controller.
It has been tested on MX21 (with CF card + ide-cs as well as a broadcom based wificard using b43 driver)
It has been compile only tested for MX27, MX31 as I don't have this hardware but the code is based on Freescale's MX31.
Changes since RFC:
* Split arch specifc changes from driver
* Update to 2.6.33-rc8 [soc-common is now a standalone module]
I do wonder whether, as you have windows, you should be using the soc support - the soc support is based interfacing hardware which does not have windows into the generic infrastructure which assumes the presence of windows.
cover MXC PCMCIA Support
Quoted 5 lines · Russell King - ARM Linux
I do wonder whether, as you have windows, you should be using the soc support - the soc support is based interfacing hardware which does not have windows into the generic infrastructure which assumes the presence of windows.
Hi Russell,
Yes I understand what you mean.
I asked on -pcmcia about the approach back in June 2009:
http://marc.info/?l=linux-pcmcia&m=124805223926065&w=2
but didn't get a reply :(
OTOH soc_common provides some other useful stuff like polling thread, common interrupt handler core, common debug etc.
Cheers,
Martin
Dominik Brodowski
maintainercover MXC PCMCIA Support
Russell,
Quoted 9 lines · Martin Fuzzey
Quoted 5 lines · Russell King - ARM Linux
I do wonder whether, as you have windows, you should be using the soc support - the soc support is based interfacing hardware which does not have windows into the generic infrastructure which assumes the presence of windows.
Hi Russell,
Yes I understand what you mean.
Quoted 6 lines
I asked on -pcmcia about the approach back in June 2009:
http://marc.info/?l=linux-pcmcia&m=124805223926065&w=2
but didn't get a reply :(OTOH
soc_commonprovides some other useful stuff like polling thread, common interrupt handler core, common debug etc.
What's your opinion in light of this?
Best,
Dominik