public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* pcmcia vs. MECR on pxa25x/sa1111
@ 2011-02-01 12:03 Pavel Machek
  2011-02-01 12:59 ` Russell King
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2011-02-01 12:03 UTC (permalink / raw)
  To: kernel list; +Cc: cko, rmk+kernel, linux, eric.miao


After 2.6.34 changes, __pxa2xx_drv_pcmcia_probe() was replaced by
sa1111_pcmcia_add(). That unfortunately means that configure_sockets()
is not called, leading to MECR not being set properly, leading to
strange crashes.

Tested on pxa255+sa1111, I do not have lubbock board nearby. Perhaps
cleaner solution exists?

Signed-off-by: Pavel Machek <pma@sysgo.com>


--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -204,10 +204,10 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 }
 #endif
 
-static void pxa2xx_configure_sockets(struct device *dev)
+void pxa2xx_configure_sockets(struct device *dev)
 {
 	struct pcmcia_low_level *ops = dev->platform_data;
 
 	/*
 	 * We have at least one socket, so set MECR:CIT
 	 * (Card Is There)
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c
--- a/drivers/pcmcia/pxa2xx_lubbock.c
+++ b/drivers/pcmcia/pxa2xx_lubbock.c
@@ -209,6 +209,8 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = {
 
 #include "pxa2xx_base.h"
 
+extern void pxa2xx_configure_sockets(struct device *dev);
+
 int pcmcia_lubbock_init(struct sa1111_dev *sadev)
 {
 	int ret = -ENODEV;
@@ -228,6 +230,7 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev)
 		pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops);
 		ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops,
 				pxa2xx_drv_pcmcia_add_one);
+		pxa2xx_configure_sockets(&(sadev->dev));
 	}
 
 	return ret;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pcmcia vs. MECR on pxa25x/sa1111
  2011-02-01 12:03 pcmcia vs. MECR on pxa25x/sa1111 Pavel Machek
@ 2011-02-01 12:59 ` Russell King
  2011-02-04  8:03   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2011-02-01 12:59 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, cko, linux, eric.miao

On Tue, Feb 01, 2011 at 01:03:03PM +0100, Pavel Machek wrote:
> 
> After 2.6.34 changes, __pxa2xx_drv_pcmcia_probe() was replaced by
> sa1111_pcmcia_add(). That unfortunately means that configure_sockets()
> is not called, leading to MECR not being set properly, leading to
> strange crashes.
> 
> Tested on pxa255+sa1111, I do not have lubbock board nearby. Perhaps
> cleaner solution exists?
> 
> Signed-off-by: Pavel Machek <pma@sysgo.com>
> 
> 
> --- a/drivers/pcmcia/pxa2xx_base.c
> +++ b/drivers/pcmcia/pxa2xx_base.c
> @@ -204,10 +204,10 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
>  }
>  #endif
>  
> -static void pxa2xx_configure_sockets(struct device *dev)
> +void pxa2xx_configure_sockets(struct device *dev)
>  {
>  	struct pcmcia_low_level *ops = dev->platform_data;
>  
>  	/*
>  	 * We have at least one socket, so set MECR:CIT
>  	 * (Card Is There)
> diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c
> --- a/drivers/pcmcia/pxa2xx_lubbock.c
> +++ b/drivers/pcmcia/pxa2xx_lubbock.c
> @@ -209,6 +209,8 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = {
>  
>  #include "pxa2xx_base.h"
>  
> +extern void pxa2xx_configure_sockets(struct device *dev);
> +

Please put function prototypes in header files.

>  int pcmcia_lubbock_init(struct sa1111_dev *sadev)
>  {
>  	int ret = -ENODEV;
> @@ -228,6 +230,7 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev)
>  		pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops);
>  		ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops,
>  				pxa2xx_drv_pcmcia_add_one);
> +		pxa2xx_configure_sockets(&(sadev->dev));

Additional parens not required.

While making this a visible function, it may also make sense to
change it from taking a struct device pointer to taking the
struct pcmcia_low_level pointer which is really what its after.

Lastly the ordering of pxa2xx_configure_sockets() is wrong - doing
setup after adding sockets is racy.  That's probably something which
should fixed in the pxa2xx code too.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pcmcia vs. MECR on pxa25x/sa1111
  2011-02-01 12:59 ` Russell King
@ 2011-02-04  8:03   ` Pavel Machek
  2011-02-16  7:25     ` Dominik Brodowski
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2011-02-04  8:03 UTC (permalink / raw)
  To: Russell King; +Cc: kernel list, cko, linux, eric.miao, Andrew Morton


After 2.6.34 changes, __pxa2xx_drv_pcmcia_probe() was replaced by
sa1111_pcmcia_add(). That unfortunately means that configure_sockets()
is not called, leading to MECR not being set properly, leading to
strange crashes.

Tested on pxa255+sa1111, I do not have lubbock board nearby. Perhaps
cleaner solution exists?

Signed-off-by: Pavel Machek <pma@sysgo.com>

---

Here's updated version. I'd prefer not to do too extensive changes as
I do not have lubbock nearby.


--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -204,7 +204,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 }
 #endif
 
-static void pxa2xx_configure_sockets(struct device *dev)
+void pxa2xx_configure_sockets(struct device *dev)
 {
 	struct pcmcia_low_level *ops = dev->platform_data;
 
--- a/drivers/pcmcia/pxa2xx_base.h
+++ b/drivers/pcmcia/pxa2xx_base.h
@@ -1,3 +1,4 @@
 int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt);
 void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops);
+void pxa2xx_configure_sockets(struct device *dev);
 
--- a/drivers/pcmcia/pxa2xx_lubbock.c
+++ b/drivers/pcmcia/pxa2xx_lubbock.c
@@ -226,6 +226,7 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev)
 		lubbock_set_misc_wr((1 << 15) | (1 << 14), 0);
 
 		pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops);
+		pxa2xx_configure_sockets(&sadev->dev);
 		ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops,
 				pxa2xx_drv_pcmcia_add_one);
 	}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pcmcia vs. MECR on pxa25x/sa1111
  2011-02-04  8:03   ` Pavel Machek
@ 2011-02-16  7:25     ` Dominik Brodowski
  0 siblings, 0 replies; 4+ messages in thread
From: Dominik Brodowski @ 2011-02-16  7:25 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Russell King, kernel list, cko, eric.miao, Andrew Morton

Russell,

On Fri, Feb 04, 2011 at 09:03:43AM +0100, Pavel Machek wrote:
> 
> After 2.6.34 changes, __pxa2xx_drv_pcmcia_probe() was replaced by
> sa1111_pcmcia_add(). That unfortunately means that configure_sockets()
> is not called, leading to MECR not being set properly, leading to
> strange crashes.
> 
> Tested on pxa255+sa1111, I do not have lubbock board nearby. Perhaps
> cleaner solution exists?
> 
> Signed-off-by: Pavel Machek <pma@sysgo.com>
> 
> ---
> 
> Here's updated version. I'd prefer not to do too extensive changes as
> I do not have lubbock nearby.

will you pick this up, or shall I?

Best,
	Dominik


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-16  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-01 12:03 pcmcia vs. MECR on pxa25x/sa1111 Pavel Machek
2011-02-01 12:59 ` Russell King
2011-02-04  8:03   ` Pavel Machek
2011-02-16  7:25     ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox