* [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS
@ 2005-11-18 16:42 Vitaly Bordug
2005-11-23 12:53 ` Marcelo Tosatti
0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Bordug @ 2005-11-18 16:42 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: linuxppc-embedded list
[-- Attachment #1: Type: text/plain, Size: 302 bytes --]
This adds adds PCMCIA supported for both MPC885ADS and MPC866ADS.
This is established not together with FADS, because 885 does not have
io_block_mapping() for BCSR area.
Also, some cleanups done both for 885ADS and MBX.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
--
Sincerely,
Vitaly
[-- Attachment #2: mpc8xx_pcmcia_885ads1.patch --]
[-- Type: text/x-patch, Size: 3553 bytes --]
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 6d9f71c..5b7a04f 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -9,6 +9,9 @@
* <oliver.kurth@cyclades.de>
* Further fixes, v2.6 kernel port
* <marcelo.tosatti@cyclades.com>
+ *
+ * Some fixes, additions (C) 2005 Montavista Software, Inc.
+ * <vbordug@ru.mvista.com>
*
* "The ExCA standard specifies that socket controllers should provide
* two IO and five memory windows per socket, which can be independently
@@ -97,6 +100,11 @@ MODULE_LICENSE("Dual MPL/GPL");
#endif
#endif
+#if defined(CONFIG_MPC885ADS)
+#define CONFIG_PCMCIA_SLOT_A
+#define PCMCIA_GLITCHY_CD
+#endif
+
/* Cyclades ACS uses both slots */
#ifdef CONFIG_PRxK
#define CONFIG_PCMCIA_SLOT_A
@@ -374,11 +382,80 @@ static int voltage_set(int slot, int vcc
}
/* first, turn off all power */
- out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK));
+ out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK));
+
+ /* enable new powersettings */
+ out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) | reg);
+
+ return 0;
+}
+
+#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
+
+static void hardware_enable(int slot)
+{
+ out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) & ~BCSR1_PCCEN);
+}
+
+static void hardware_disable(int slot)
+{
+ out_be32((u32 *)BCSR1, in_be32((u32 *)BCSR1) | BCSR1_PCCEN);
+}
+
+#endif
+
+/* MPC885ADS Boards */
+
+#if defined(CONFIG_MPC885ADS)
+
+#define PCMCIA_BOARD_MSG "MPC885ADS"
+
+static int voltage_set(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 */
+ out_be32(bcsr_io, in_be32(bcsr_io) & ~(BCSR1_PCCVCC_MASK | BCSR1_PCCVPP_MASK));
/* enable new powersettings */
- out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | reg);
+ out_be32(bcsr_io, in_be32(bcsr_io) | reg);
+ iounmap(bcsr_io);
return 0;
}
@@ -386,12 +463,20 @@ static int voltage_set(int slot, int vcc
static void hardware_enable(int slot)
{
- out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) & ~BCSR1_PCCEN);
+ unsigned *bcsr_io;
+
+ bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
+ out_be32(bcsr_io, in_be32(bcsr_io) & ~BCSR1_PCCEN);
+ iounmap(bcsr_io);
}
static void hardware_disable(int slot)
{
- out_be32(&((u32 *)BCSR1), in_be32(&((u32 *)BCSR1)) | BCSR1_PCCEN);
+ unsigned *bcsr_io;
+
+ bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
+ out_be32(bcsr_io, in_be32(bcsr_io) | BCSR1_PCCEN);
+ iounmap(bcsr_io);
}
#endif
@@ -440,10 +525,10 @@ static int voltage_set(int slot, int vcc
}
/* first, turn off all power */
- out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK));
+ out_8((u8 *)MBX_CSR2_ADDR, in_8((u8 *)MBX_CSR2_ADDR) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK));
/* enable new powersettings */
- out_8(&((u8 *)MBX_CSR2_ADDR), in_8(&((u8 *)MBX_CSR2_ADDR)) | reg);
+ out_8((u8 *)MBX_CSR2_ADDR, in_8((u8 *)MBX_CSR2_ADDR) | reg);
return 0;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS
2005-11-18 16:42 [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS Vitaly Bordug
@ 2005-11-23 12:53 ` Marcelo Tosatti
2005-11-23 18:42 ` Kumar Gala
2005-11-23 20:22 ` Dan Malek
0 siblings, 2 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2005-11-23 12:53 UTC (permalink / raw)
To: Vitaly Bordug, Kumar Gala; +Cc: linuxppc-embedded list
Hi Vitaly,
On Fri, Nov 18, 2005 at 07:42:51PM +0300, Vitaly Bordug wrote:
> This adds adds PCMCIA supported for both MPC885ADS and MPC866ADS.
>
> This is established not together with FADS, because 885 does not have
> io_block_mapping() for BCSR area.
> Also, some cleanups done both for 885ADS and MBX.
>
> Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
<snip>
> + bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
Shouldnt you handle ioremap() failure? Most 85xx code written
by Kumar also does not.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS
2005-11-23 20:22 ` Dan Malek
@ 2005-11-23 15:13 ` Marcelo Tosatti
0 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2005-11-23 15:13 UTC (permalink / raw)
To: Dan Malek; +Cc: Vitaly Bordug, linuxppc-embedded list
On Wed, Nov 23, 2005 at 03:22:40PM -0500, Dan Malek wrote:
>
> On Nov 23, 2005, at 7:53 AM, Marcelo Tosatti wrote:
>
> >Shouldnt you handle ioremap() failure? Most 85xx code written
> >by Kumar also does not.
>
> And do what if it fails? Chances are you don't have any
> way to report an error message or panic at this point. In
> fact, there are a few silly tests like this where the
> failure tries to panic or print some message that will never
> be seen. Fortunately, the code will never fail and we will
> never take such code paths.
OK! Was talking BS then.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS
2005-11-23 12:53 ` Marcelo Tosatti
@ 2005-11-23 18:42 ` Kumar Gala
2005-11-23 20:22 ` Dan Malek
1 sibling, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2005-11-23 18:42 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Vitaly Bordug, linuxppc-embedded list
On Nov 23, 2005, at 6:53 AM, Marcelo Tosatti wrote:
> Hi Vitaly,
>
> On Fri, Nov 18, 2005 at 07:42:51PM +0300, Vitaly Bordug wrote:
>> This adds adds PCMCIA supported for both MPC885ADS and MPC866ADS.
>>
>> This is established not together with FADS, because 885 does not have
>> io_block_mapping() for BCSR area.
>> Also, some cleanups done both for 885ADS and MBX.
>>
>> Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
>
> <snip>
>
>> + bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
>
> Shouldnt you handle ioremap() failure? Most 85xx code written
> by Kumar also does not.
Ok, I'll take a hint to go audit my code for ioremap() returns :)
- kumar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS
2005-11-23 12:53 ` Marcelo Tosatti
2005-11-23 18:42 ` Kumar Gala
@ 2005-11-23 20:22 ` Dan Malek
2005-11-23 15:13 ` Marcelo Tosatti
1 sibling, 1 reply; 5+ messages in thread
From: Dan Malek @ 2005-11-23 20:22 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Vitaly Bordug, linuxppc-embedded list
On Nov 23, 2005, at 7:53 AM, Marcelo Tosatti wrote:
> Shouldnt you handle ioremap() failure? Most 85xx code written
> by Kumar also does not.
And do what if it fails? Chances are you don't have any
way to report an error message or panic at this point. In
fact, there are a few silly tests like this where the
failure tries to panic or print some message that will never
be seen. Fortunately, the code will never fail and we will
never take such code paths.
-- Dan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-11-23 20:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-18 16:42 [PATCH] 8xx PCMCIA: support for MPC885ADS and MPC866ADS Vitaly Bordug
2005-11-23 12:53 ` Marcelo Tosatti
2005-11-23 18:42 ` Kumar Gala
2005-11-23 20:22 ` Dan Malek
2005-11-23 15:13 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).