Commit 44760e52 authored by Russell King's avatar Russell King

[ARM] SA11x0 PCMCIA 2

Make low-level configure_socket() method take the socket number as
a parameter rather than embedded in a structure.
parent ac1689ff
......@@ -34,12 +34,12 @@ static int adsbitsy_pcmcia_init(struct pcmcia_init *init)
}
static int
adsbitsy_pcmcia_configure_socket(const struct pcmcia_configure *conf)
adsbitsy_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int pa_dwr_mask, pa_dwr_set;
int ret;
switch (conf->sock) {
switch (sock) {
case 0:
pa_dwr_mask = GPIO_GPIO0 | GPIO_GPIO1;
......@@ -71,7 +71,7 @@ adsbitsy_pcmcia_configure_socket(const struct pcmcia_configure *conf)
return -1;
}
ret = sa1111_pcmcia_configure_socket(conf);
ret = sa1111_pcmcia_configure_socket(sock, conf);
if (ret == 0) {
unsigned long flags;
......
......@@ -102,14 +102,14 @@ static int assabet_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
}
static int
assabet_pcmcia_configure_socket(const struct pcmcia_configure *configure)
assabet_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
unsigned int mask;
if (configure->sock > 1)
if (sock > 1)
return -1;
if (configure->sock == 0)
if (sock == 0)
return 0;
switch (configure->vcc) {
......
......@@ -96,11 +96,11 @@ static void complain_about_jumpering(const char *whom,
}
static int
badge4_pcmcia_configure_socket(const struct pcmcia_configure *conf)
badge4_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
int ret;
switch (conf->sock) {
switch (sock) {
case 0:
if ((conf->vcc != 0) &&
(conf->vcc != badge4_pcmvcc)) {
......@@ -130,7 +130,7 @@ badge4_pcmcia_configure_socket(const struct pcmcia_configure *conf)
return -1;
}
ret = sa1111_pcmcia_configure_socket(conf);
ret = sa1111_pcmcia_configure_socket(sock, conf);
if (ret == 0) {
unsigned long flags;
int need5V;
......
......@@ -96,13 +96,13 @@ static int cerf_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
return 0;
}
static int cerf_pcmcia_configure_socket(const struct pcmcia_configure
static int cerf_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
if(configure->sock>1)
if (sock>1)
return -1;
if (configure->sock != CERF_SOCKET)
if (sock != CERF_SOCKET)
return 0;
switch(configure->vcc){
......
......@@ -142,13 +142,12 @@ static int flexanet_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
/*
*
*/
static int flexanet_pcmcia_configure_socket(const struct pcmcia_configure
static int flexanet_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
unsigned long value, flags, mask;
if (configure->sock > 1)
if (sock > 1)
return -1;
/* Ignore the VCC level since it is 3.3V and always on */
......@@ -174,7 +173,7 @@ static int flexanet_pcmcia_configure_socket(const struct pcmcia_configure
/* Reset the slot(s) using the controls in the BCR */
mask = 0;
switch (configure->sock)
switch (sock)
{
case 0 : mask = FHH_BCR_CF1_RST; break;
case 1 : mask = FHH_BCR_CF2_RST; break;
......
......@@ -115,14 +115,14 @@ static int freebird_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
return 0;
}
static int freebird_pcmcia_configure_socket(const struct pcmcia_configure
static int freebird_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
unsigned long value, flags;
if(configure->sock>1) return -1;
if(sock>1) return -1;
if(configure->sock==1) return 0;
if(sock==1) return 0;
local_irq_save(flags);
......
......@@ -150,7 +150,6 @@ sa1100_pcmcia_config_skt(struct sa1100_pcmcia_socket *skt, socket_state_t *state
struct pcmcia_configure conf;
int ret;
conf.sock = skt->nr;
conf.vcc = state->Vcc;
conf.vpp = state->Vpp;
conf.output = state->flags & SS_OUTPUT_ENA ? 1 : 0;
......@@ -158,7 +157,7 @@ sa1100_pcmcia_config_skt(struct sa1100_pcmcia_socket *skt, socket_state_t *state
conf.reset = state->flags & SS_RESET ? 1 : 0;
conf.irq = state->io_irq != 0;
ret = skt->ops->configure_socket(&conf);
ret = skt->ops->configure_socket(skt->nr, &conf);
if (ret == 0) {
/*
* This really needs a better solution. The IRQ
......
......@@ -37,8 +37,7 @@ struct pcmcia_state_array {
};
struct pcmcia_configure {
unsigned sock: 8,
vcc: 8,
unsigned vcc: 8,
vpp: 8,
output: 1,
speaker: 1,
......@@ -56,7 +55,7 @@ struct pcmcia_low_level {
int (*shutdown)(void);
int (*socket_state)(struct pcmcia_state_array *);
int (*get_irq_info)(struct pcmcia_irq_info *);
int (*configure_socket)(const struct pcmcia_configure *);
int (*configure_socket)(int sock, const struct pcmcia_configure *);
/*
* Enable card status IRQs on (re-)initialisation. This can
......
......@@ -117,9 +117,9 @@ static int h3600_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
}
static int
h3600_pcmcia_configure_socket(const struct pcmcia_configure *conf)
h3600_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
if (conf->sock > 1)
if (sock > 1)
return -1;
if (conf->vcc != 0 && conf->vcc != 33 && conf->vcc != 50) {
......
......@@ -49,15 +49,15 @@ static int jornada720_pcmcia_init(struct pcmcia_init *init)
}
static int
jornada720_pcmcia_configure_socket(const struct pcmcia_configure *conf)
jornada720_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int pa_dwr_mask, pa_dwr_set;
int ret;
printk("%s(): config socket %d vcc %d vpp %d\n", __FUNCTION__,
conf->sock, conf->vcc, conf->vpp);
sock, conf->vcc, conf->vpp);
switch (conf->sock) {
switch (sock) {
case 0:
pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V;
......
......@@ -58,13 +58,13 @@ static int neponset_pcmcia_init(struct pcmcia_init *init)
}
static int
neponset_pcmcia_configure_socket(const struct pcmcia_configure *conf)
neponset_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int ncr_mask, pa_dwr_mask;
unsigned int ncr_set, pa_dwr_set;
int ret;
switch (conf->sock) {
switch (sock) {
case 0:
pa_dwr_mask = GPIO_GPIO0 | GPIO_GPIO1;
ncr_mask = NCR_A0VPP | NCR_A1VPP;
......@@ -113,7 +113,7 @@ neponset_pcmcia_configure_socket(const struct pcmcia_configure *conf)
return -1;
}
ret = sa1111_pcmcia_configure_socket(conf);
ret = sa1111_pcmcia_configure_socket(sock, conf);
if (ret == 0) {
unsigned long flags;
......
......@@ -14,6 +14,12 @@
#include <asm/irq.h>
#include "sa1100_generic.h"
#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
#define PANGOLIN_SOCK 1
#else
#define PANGOLIN_SOCK 0
#endif
static int pangolin_pcmcia_init(struct pcmcia_init *init){
int res;
......@@ -94,14 +100,14 @@ static int pangolin_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
return 0;
}
static int pangolin_pcmcia_configure_socket(const struct pcmcia_configure
static int pangolin_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
unsigned long value, flags;
if(configure->sock>1) return -1;
if(sock>1) return -1;
#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
if(configure->sock==0) return 0;
if(sock==0) return 0;
#endif
local_irq_save(flags);
......@@ -132,7 +138,7 @@ static int pangolin_pcmcia_configure_socket(const struct pcmcia_configure
}
#ifdef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
/* reset & unreset request */
if(configure->sock==0) {
if(sock==0) {
if(configure->reset) {
GPSR |= GPIO_PCMCIA_RESET;
} else {
......
......@@ -29,7 +29,7 @@ static int pfs168_pcmcia_init(struct pcmcia_init *init)
}
static int
pfs168_pcmcia_configure_socket(const struct pcmcia_configure *conf)
pfs168_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int pa_dwr_mask = 0, pa_dwr_set = 0;
int ret;
......@@ -46,7 +46,7 @@ pfs168_pcmcia_configure_socket(const struct pcmcia_configure *conf)
*
*/
switch (conf->sock) {
switch (sock) {
case 0:
pa_dwr_mask = GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3;
......@@ -106,7 +106,7 @@ pfs168_pcmcia_configure_socket(const struct pcmcia_configure *conf)
break;
}
ret = sa1111_pcmcia_configure_socket(conf);
ret = sa1111_pcmcia_configure_socket(sock, conf);
if (ret == 0) {
unsigned long flags;
......
......@@ -107,9 +107,8 @@ static int shannon_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
return 0;
}
static int shannon_pcmcia_configure_socket(const struct pcmcia_configure *configure)
static int shannon_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
switch (configure->vcc) {
case 0: /* power off */
printk(KERN_WARNING __FUNCTION__"(): CS asked for 0V, still applying 3.3V..\n");
......
......@@ -103,14 +103,14 @@ static int simpad_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
return 0;
}
static int simpad_pcmcia_configure_socket(const struct pcmcia_configure
static int simpad_pcmcia_configure_socket(int sock, const struct pcmcia_configure
*configure)
{
unsigned long value, flags;
if(configure->sock>1) return -1;
if(sock>1) return -1;
if(configure->sock==0) return 0;
if(sock==0) return 0;
local_irq_save(flags);
......
......@@ -135,21 +135,20 @@ static int stork_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
return 0;
}
static int stork_pcmcia_configure_socket(const struct pcmcia_configure *configure)
static int stork_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
int card = configure->sock;
unsigned long flags;
int DETECT, RDY, POWER, RESET;
if (card > 1) return -1;
if (sock > 1) return -1;
printk(__FUNCTION__ ": socket=%d vcc=%d vpp=%d reset=%d\n",
card, configure->vcc, configure->vpp, configure->reset);
sock, configure->vcc, configure->vpp, configure->reset);
local_irq_save(flags);
if (card == 0) {
if (sock == 0) {
DETECT = GPIO_STORK_PCMCIA_A_CARD_DETECT;
RDY = GPIO_STORK_PCMCIA_A_RDY;
POWER = STORK_PCMCIA_A_POWER_ON;
......
......@@ -57,16 +57,13 @@ int system3_pcmcia_shutdown(void)
return 0;
}
int system3_pcmcia_configure_socket(const struct pcmcia_configure *conf)
int system3_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
if (!conf)
return -1;
/* only CF ATM */
if (conf->sock == 0)
if (sock == 0)
return -1;
return sa1111_pcmcia_configure_socket( conf );
return sa1111_pcmcia_configure_socket(sock, conf);
}
static int system3_pcmcia_socket_state(struct pcmcia_state_array
......
......@@ -123,11 +123,11 @@ static int trizeps_pcmcia_get_irq_info(struct pcmcia_irq_info *info){
*
*
******************************************************/
static int trizeps_pcmcia_configure_socket(const struct pcmcia_configure *configure)
static int trizeps_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
unsigned long flags;
if(configure->sock>1) return -1;
if(sock>1) return -1;
local_irq_save(flags);
......
......@@ -40,7 +40,7 @@ static int xp860_pcmcia_init(struct pcmcia_init *init)
}
static int
xp860_pcmcia_configure_socket(const struct pcmcia_configure *conf)
xp860_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int gpio_mask, pa_dwr_mask;
unsigned int gpio_set, pa_dwr_set;
......@@ -70,7 +70,7 @@ xp860_pcmcia_configure_socket(const struct pcmcia_configure *conf)
* the corresponding truth table.
*/
switch (conf->sock) {
switch (sock) {
case 0:
pa_dwr_mask = GPIO_GPIO0 | GPIO_GPIO1;
gpio_mask = NCR_A0VPP | NCR_A1VPP;
......@@ -117,7 +117,7 @@ xp860_pcmcia_configure_socket(const struct pcmcia_configure *conf)
break;
}
ret = sa1111_pcmcia_configure_socket(conf);
ret = sa1111_pcmcia_configure_socket(sock, conf);
if (ret == 0) {
unsigned long flags;
......
......@@ -113,9 +113,9 @@ static int yopy_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
return 0;
}
static int yopy_pcmcia_configure_socket(const struct pcmcia_configure *configure)
static int yopy_pcmcia_configure_socket(int sock, const struct pcmcia_configure *configure)
{
if (configure->sock != 0)
if (sock != 0)
return -1;
switch (configure->vcc) {
......
......@@ -104,12 +104,12 @@ int sa1111_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
return ret;
}
int sa1111_pcmcia_configure_socket(const struct pcmcia_configure *conf)
int sa1111_pcmcia_configure_socket(int sock, const struct pcmcia_configure *conf)
{
unsigned int rst, flt, wait, pse, irq, pccr_mask, val;
unsigned long flags;
switch (conf->sock) {
switch (sock) {
case 0:
rst = PCCR_S0_RST;
flt = PCCR_S0_FLT;
......
......@@ -2,6 +2,6 @@ extern int sa1111_pcmcia_init(struct pcmcia_init *);
extern int sa1111_pcmcia_shutdown(void);
extern int sa1111_pcmcia_socket_state(struct pcmcia_state_array *);
extern int sa1111_pcmcia_get_irq_info(struct pcmcia_irq_info *);
extern int sa1111_pcmcia_configure_socket(const struct pcmcia_configure *);
extern int sa1111_pcmcia_configure_socket(int sock, const struct pcmcia_configure *);
extern int sa1111_pcmcia_socket_init(int);
extern int sa1111_pcmcia_socket_suspend(int);
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