diff mbox

Current ms7724se LAN doesn't work

Message ID 20090824091416.GB15330@linux-sh.org (mailing list archive)
State Superseded
Delegated to: Paul Mundt
Headers show

Commit Message

Paul Mundt Aug. 24, 2009, 9:14 a.m. UTC
On Mon, Aug 24, 2009 at 05:19:47PM +0900, Kuninori Morimoto wrote:
> 
> Dear all
> 
> I got latest kernel from Paul's git,
> and current ms7724se LAN doesn't work.
> 
> When If I remove 
> archdata = {
>          .hwblk_id = HWBLK_ETHER,
> }
> from ${LINUX}/arch/sh/boards/mach-se/7724/setup.c
> then, it start works for me.
> 
> Are there any CONFIG to use SH-ETH or HWBLK ?
> 
This would be a runtime PM issue, which SH-Mobile unconditionally
selects. The problem is that the module is most likely disabled via its
MSTP bit under the new scheme, so sh-eth will need to tie in to the
runtime PM framework to get that resolved.

Can you give this a try?

---

 drivers/net/sh_eth.c |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kuninori Morimoto Aug. 24, 2009, 9:45 a.m. UTC | #1
Dear Paul

Thank you for your patch

> This would be a runtime PM issue, which SH-Mobile unconditionally
> selects. The problem is that the module is most likely disabled via its
> MSTP bit under the new scheme, so sh-eth will need to tie in to the
> runtime PM framework to get that resolved.
> 
> Can you give this a try?

hmmm..
I tried this patch, but it still doesn't work.
log is 

----------
(snip)
usbcore: registered new interface driver usbhid                                 
usbhid: v2.6:USB HID core driver                                                
heartbeat: version 0.1.1 loaded                                                 
TCP cubic registered                                                            
NET: Registered protocol family 17                                              
RPC: Registered udp transport module.                                           
RPC: Registered tcp transport module.                                           
/opt/usr/src/WORK/morimoto/gitlinux/sh-2.6/drivers/rtc/hctosys.c: unable to ope)
IP-Config: Failed to open eth0                                                  
eth1: link down                                                                 
Sending DHCP requests ......
----------

Best regards
--
Kuninori Morimoto
 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paul Mundt Aug. 24, 2009, 9:55 a.m. UTC | #2
On Mon, Aug 24, 2009 at 06:45:45PM +0900, Kuninori Morimoto wrote:
> 
> Dear Paul
> 
> Thank you for your patch
> 
> > This would be a runtime PM issue, which SH-Mobile unconditionally
> > selects. The problem is that the module is most likely disabled via its
> > MSTP bit under the new scheme, so sh-eth will need to tie in to the
> > runtime PM framework to get that resolved.
> > 
> > Can you give this a try?
> 
> hmmm..
> I tried this patch, but it still doesn't work.
> log is 
> 
Ok, we'll have to let Magnus take a look at it then, as it's certainly
runtime PM related.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Aug. 24, 2009, 10:15 a.m. UTC | #3
Dear Paul

> > I tried this patch, but it still doesn't work.
> > log is 
> > 
> Ok, we'll have to let Magnus take a look at it then, as it's certainly
> runtime PM related.

OK thanks

Best regards
--
Kuninori Morimoto
 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Magnus Damm Aug. 26, 2009, 8:02 a.m. UTC | #4
On Mon, Aug 24, 2009 at 6:55 PM, Paul Mundt<lethal@linux-sh.org> wrote:
> On Mon, Aug 24, 2009 at 06:45:45PM +0900, Kuninori Morimoto wrote:
>>
>> Dear Paul
>>
>> Thank you for your patch
>>
>> > This would be a runtime PM issue, which SH-Mobile unconditionally
>> > selects. The problem is that the module is most likely disabled via its
>> > MSTP bit under the new scheme, so sh-eth will need to tie in to the
>> > runtime PM framework to get that resolved.
>> >
>> > Can you give this a try?
>>
>> hmmm..
>> I tried this patch, but it still doesn't work.
>> log is
>>
> Ok, we'll have to let Magnus take a look at it then, as it's certainly
> runtime PM related.

It looks like the driver is accessing hardware from probe, so you need
to force a resume after enable. The LCDC driver does just that:

       pm_runtime_enable(priv->dev);
       pm_runtime_resume(priv->dev);

Hopefully that should do the trick. Can you try this fix on top of
Paul's patch Morimoto-san?

Cheers,

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Aug. 26, 2009, 10:09 a.m. UTC | #5
Hi Magnus

Thank you for your hard work

> It looks like the driver is accessing hardware from probe, so you need
> to force a resume after enable. The LCDC driver does just that:
> 
>        pm_runtime_enable(priv->dev);
>        pm_runtime_resume(priv->dev);
> 
> Hopefully that should do the trick. Can you try this fix on top of
> Paul's patch Morimoto-san?

hmm...
I tried Paul's patch + pm_runtime_resume
But it still doesn't work for me...

Best regards
--
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index a2d82dd..c195baa 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -30,7 +30,7 @@ 
 #include <linux/phy.h>
 #include <linux/cache.h>
 #include <linux/io.h>
-
+#include <linux/pm_runtime.h>
 #include "sh_eth.h"
 
 /* There is CPU dependent code */
@@ -1006,6 +1006,8 @@  static int sh_eth_open(struct net_device *ndev)
 	int ret = 0;
 	struct sh_eth_private *mdp = netdev_priv(ndev);
 
+	pm_runtime_get_sync(&ndev->dev);
+
 	ret = request_irq(ndev->irq, &sh_eth_interrupt,
 #if defined(CONFIG_CPU_SUBTYPE_SH7763) || defined(CONFIG_CPU_SUBTYPE_SH7764)
 				IRQF_SHARED,
@@ -1173,6 +1175,8 @@  static int sh_eth_close(struct net_device *ndev)
 	ringsize = sizeof(struct sh_eth_txdesc) * TX_RING_SIZE;
 	dma_free_coherent(NULL, ringsize, mdp->tx_ring, mdp->tx_desc_dma);
 
+	pm_runtime_put_sync(&ndev->dev);
+
 	return 0;
 }
 
@@ -1404,6 +1408,7 @@  static int sh_eth_drv_probe(struct platform_device *pdev)
 
 	mdp = netdev_priv(ndev);
 	spin_lock_init(&mdp->lock);
+	pm_runtime_enable(&pdev->dev);
 
 	pd = (struct sh_eth_plat_data *)(pdev->dev.platform_data);
 	/* get PHY ID */
@@ -1477,18 +1482,37 @@  static int sh_eth_drv_remove(struct platform_device *pdev)
 	sh_mdio_release(ndev);
 	unregister_netdev(ndev);
 	flush_scheduled_work();
-
+	pm_runtime_disable(&pdev->dev);
 	free_netdev(ndev);
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
 }
 
+static int sh_eth_runtime_nop(struct device *dev)
+{
+	/*
+	 * Runtime PM callback shared between ->runtime_suspend()
+	 * and ->runtime_resume(). Simply returns success.
+	 *
+	 * This driver re-initializes all registers after
+	 * pm_runtime_get_sync() anyway so there is no need
+	 * to save and restore registers here.
+	 */
+	return 0;
+}
+
+static struct dev_pm_ops sh_eth_dev_pm_ops = {
+	.runtime_suspend = sh_eth_runtime_nop,
+	.runtime_resume = sh_eth_runtime_nop,
+};
+
 static struct platform_driver sh_eth_driver = {
 	.probe = sh_eth_drv_probe,
 	.remove = sh_eth_drv_remove,
 	.driver = {
 		   .name = CARDNAME,
+		   .pm = &sh_eth_dev_pm_ops,
 	},
 };