Commit 80128ff7 authored by Vitaly Bordug's avatar Vitaly Bordug Committed by Kumar Gala

[POWERPC] 8xx: mpc885ads pcmcia support

Adds support for PowerQuicc on-chip PCMCIA.  The driver is implemented as
of_device, so only arch/powerpc stuff is capable to use it, which now implies
only mpc885ads reference board.

To cope with the code that should be hooked inside driver, but is really board
specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds
necessary function pointers that are filled in the BSP code.

[akpm@linux-foundation.org: whitespace diddles]
Signed-off-by: default avatarVitaly Bordug <vitb@kernel.crashing.org>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 90faf4fa
...@@ -112,6 +112,17 @@ pic@ff000000 { ...@@ -112,6 +112,17 @@ pic@ff000000 {
compatible = "CPM"; compatible = "CPM";
}; };
pcmcia@0080 {
#address-cells = <3>;
#interrupt-cells = <1>;
#size-cells = <2>;
compatible = "fsl,pq-pcmcia";
device_type = "pcmcia";
reg = <80 80>;
interrupt-parent = <ff000000>;
interrupts = <d 1>;
};
cpm@ff000000 { cpm@ff000000 {
linux,phandle = <ff000000>; linux,phandle = <ff000000>;
#address-cells = <1>; #address-cells = <1>;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/fsl_devices.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/reg.h> #include <asm/reg.h>
...@@ -49,6 +50,10 @@ ...@@ -49,6 +50,10 @@
#include "sysdev/mpc8xx_pic.h" #include "sysdev/mpc8xx_pic.h"
#ifdef CONFIG_PCMCIA_M8XX
struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
#endif
void m8xx_calibrate_decr(void); void m8xx_calibrate_decr(void);
extern void m8xx_wdt_handler_install(bd_t *bp); extern void m8xx_wdt_handler_install(bd_t *bp);
extern int cpm_pic_init(void); extern int cpm_pic_init(void);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/fs_enet_pd.h> #include <linux/fs_enet_pd.h>
#include <linux/fs_uart_pd.h> #include <linux/fs_uart_pd.h>
#include <linux/fsl_devices.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <asm/delay.h> #include <asm/delay.h>
...@@ -51,6 +52,70 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); ...@@ -51,6 +52,70 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi);
static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi);
static void init_scc3_ioports(struct fs_platform_info* ptr); static void init_scc3_ioports(struct fs_platform_info* ptr);
#ifdef CONFIG_PCMCIA_M8XX
static void pcmcia_hw_setup(int slot, int enable)
{
unsigned *bcsr_io;
bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
if (enable)
clrbits32(bcsr_io, BCSR1_PCCEN);
else
setbits32(bcsr_io, BCSR1_PCCEN);
iounmap(bcsr_io);
}
static int pcmcia_set_voltage(int slot, int vcc, int vpp)
{
u32 reg = 0;
unsigned *bcsr_io;
bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
switch(vcc) {
case 0:
break;
case 33:
reg |= BCSR1_PCCVCC0;
break;
case 50:
reg |= BCSR1_PCCVCC1;
break;
default:
return 1;
}
switch(vpp) {
case 0:
break;
case 33:
case 50:
if(vcc == vpp)
reg |= BCSR1_PCCVPP1;
else
return 1;
break;
case 120:
if ((vcc == 33) || (vcc == 50))
reg |= BCSR1_PCCVPP0;
else
return 1;
default:
return 1;
}
/* first, turn off all power */
clrbits32(bcsr_io, 0x00610000);
/* enable new powersettings */
setbits32(bcsr_io, reg);
iounmap(bcsr_io);
return 0;
}
#endif
void __init mpc885ads_board_setup(void) void __init mpc885ads_board_setup(void)
{ {
cpm8xx_t *cp; cpm8xx_t *cp;
...@@ -115,6 +180,12 @@ void __init mpc885ads_board_setup(void) ...@@ -115,6 +180,12 @@ void __init mpc885ads_board_setup(void)
immr_unmap(io_port); immr_unmap(io_port);
#endif #endif
#ifdef CONFIG_PCMCIA_M8XX
/*Set up board specific hook-ups*/
m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup;
m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage;
#endif
} }
......
...@@ -1028,6 +1028,19 @@ static int __init fs_enet_of_init(void) ...@@ -1028,6 +1028,19 @@ static int __init fs_enet_of_init(void)
arch_initcall(fs_enet_of_init); arch_initcall(fs_enet_of_init);
static int __init fsl_pcmcia_of_init(void)
{
struct device_node *np = NULL;
/*
* Register all the devices which type is "pcmcia"
*/
while ((np = of_find_compatible_node(np,
"pcmcia", "fsl,pq-pcmcia")) != NULL)
of_platform_device_create(np, "m8xx-pcmcia", NULL);
return 0;
}
arch_initcall(fsl_pcmcia_of_init);
static const char *smc_regs = "regs"; static const char *smc_regs = "regs";
static const char *smc_pram = "pram"; static const char *smc_pram = "pram";
......
...@@ -4,9 +4,16 @@ ...@@ -4,9 +4,16 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
extern struct hw_interrupt_type mpc8xx_pic;
int mpc8xx_pic_init(void); int mpc8xx_pic_init(void);
unsigned int mpc8xx_get_irq(void); unsigned int mpc8xx_get_irq(void);
/*
* Some internal interrupt registers use an 8-bit mask for the interrupt
* level instead of a number.
*/
static inline uint mk_int_int_mask(uint mask)
{
return (1 << (7 - (mask/2)));
}
#endif /* _PPC_KERNEL_PPC8xx_H */ #endif /* _PPC_KERNEL_PPC8xx_H */
...@@ -180,14 +180,15 @@ config TCIC ...@@ -180,14 +180,15 @@ config TCIC
PCMCIA cards are plugged into. If unsure, say N. PCMCIA cards are plugged into. If unsure, say N.
config PCMCIA_M8XX config PCMCIA_M8XX
tristate "MPC8xx PCMCIA support" tristate "MPC8xx PCMCIA support"
depends on PCMCIA && PPC && 8xx depends on PCMCIA && PPC && 8xx
select PCCARD_IODYN select PCCARD_IODYN
help select PCCARD_NONSTATIC
Say Y here to include support for PowerPC 8xx series PCMCIA help
controller. Say Y here to include support for PowerPC 8xx series PCMCIA
controller.
This driver is also available as a module called m8xx_pcmcia.
This driver is also available as a module called m8xx_pcmcia.
config HD64465_PCMCIA config HD64465_PCMCIA
tristate "HD64465 host bridge support" tristate "HD64465 host bridge support"
......
This diff is collapsed.
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#include <platforms/8xx/mpc885ads.h> #include <platforms/8xx/mpc885ads.h>
#endif #endif
#ifdef CONFIG_PCMCIA_M8XX
extern struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
#endif
#endif /* CONFIG_8xx */ #endif /* CONFIG_8xx */
#endif /* __CONFIG_8xx_DEFS */ #endif /* __CONFIG_8xx_DEFS */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
...@@ -120,5 +120,10 @@ struct fsl_spi_platform_data { ...@@ -120,5 +120,10 @@ struct fsl_spi_platform_data {
u32 sysclk; u32 sysclk;
}; };
struct mpc8xx_pcmcia_ops {
void(*hw_ctrl)(int slot, int enable);
int(*voltage_set)(int slot, int vcc, int vpp);
};
#endif /* _FSL_DEVICE_H_ */ #endif /* _FSL_DEVICE_H_ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment