* Xilin Temac Timer ?
@ 2008-03-26 17:02 khollan
2008-03-26 19:48 ` Xilinx " John Linn
2008-03-31 14:33 ` JFFS2 root-fs Georg Schardt
0 siblings, 2 replies; 6+ messages in thread
From: khollan @ 2008-03-26 17:02 UTC (permalink / raw)
To: linuxppc-embedded
Hi
What is the purpose of stopping the timer in the ioctl call to read a PHY
register? This is the code:
case SIOCGMIIREG: /* Read GMII PHY register. */
case SIOCDEVPRIVATE + 1: /* for binary compat, remove in 2.5 */
if (data->phy_id > 31 || data->reg_num > 31)
return -ENXIO;
/* Stop the PHY timer to prevent reentrancy. */
spin_lock_irqsave(&XTE_spinlock, flags);
del_timer_sync(&lp->phy_timer);
ret = XTemac_PhyRead(&lp->Emac, data->phy_id,
data->reg_num, &data->val_out);
/* Start the PHY timer up again. */
lp->phy_timer.expires = jiffies + 2 * HZ;
add_timer(&lp->phy_timer);
spin_unlock_irqrestore(&XTE_spinlock, flags);
if (ret != XST_SUCCESS) {
printk(KERN_ERR
"%s: XTemac: could not read from PHY, error=%d.\n",
dev->name, ret);
return -EBUSY;
}
return 0;
I ask because I have an application that needs to read a Phy register before
the timer has started to see if a link is present. This causes a kernel bug
when trying to run the del_timer_sync function because there is not a
running timer. I would like to know if it is safe to remove the timer del
and add but keep the spin lock.
Thanks for your help
Kevin
--
View this message in context: http://www.nabble.com/Xilin-Temac-Timer---tp16306218p16306218.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Xilinx Temac Timer ?
2008-03-26 17:02 Xilin Temac Timer ? khollan
@ 2008-03-26 19:48 ` John Linn
2008-03-27 19:31 ` khollan
2008-03-31 14:33 ` JFFS2 root-fs Georg Schardt
1 sibling, 1 reply; 6+ messages in thread
From: John Linn @ 2008-03-26 19:48 UTC (permalink / raw)
To: khollan, linuxppc-embedded
Hi Kevin,
I didn't write the code but I know the driver somewhat.
I think the intention of stopping the timer is to prevent the reentrancy
as the comment says because there is a function, gmii_poll, that is
setup on the timer to go read the phy registers to see if anything
changed in the phy.=20
Stopping the timer prevents a phy read from happening in gmii_poll in
the middle of the ioctl phy read which could hose things up.
I don't see why you couldn't change that timer stop to some other form
of synchronization/mutual exclusion so that the phy reads don't collide.
As I look at it, it appears to me the spinlock should provide the
synchronization needed without stopping the timer, but maybe I'm missing
something. I CCed John Bonesio as he's the guy that developed this code
I believe and maybe he'll have more insight here.
Thanks,
John
-----Original Message-----
From: linuxppc-embedded-bounces+john.linn=3Dxilinx.com@ozlabs.org
[mailto:linuxppc-embedded-bounces+john.linn=3Dxilinx.com@ozlabs.org] On
Behalf Of khollan
Sent: Wednesday, March 26, 2008 11:03 AM
To: linuxppc-embedded@ozlabs.org
Subject: Xilinx Temac Timer ?
Hi
What is the purpose of stopping the timer in the ioctl call to read a
PHY
register? This is the code:
case SIOCGMIIREG: /* Read GMII PHY register. */
case SIOCDEVPRIVATE + 1: /* for binary compat, remove in 2.5 */
if (data->phy_id > 31 || data->reg_num > 31)
return -ENXIO;
/* Stop the PHY timer to prevent reentrancy. */
spin_lock_irqsave(&XTE_spinlock, flags);
del_timer_sync(&lp->phy_timer);
ret =3D XTemac_PhyRead(&lp->Emac, data->phy_id,
data->reg_num, &data->val_out);
/* Start the PHY timer up again. */
lp->phy_timer.expires =3D jiffies + 2 * HZ;
add_timer(&lp->phy_timer);
spin_unlock_irqrestore(&XTE_spinlock, flags);
if (ret !=3D XST_SUCCESS) {
printk(KERN_ERR
"%s: XTemac: could not read from PHY, error=3D%d.\n",
dev->name, ret);
return -EBUSY;
}
return 0;
I ask because I have an application that needs to read a Phy register
before
the timer has started to see if a link is present. This causes a kernel
bug
when trying to run the del_timer_sync function because there is not a
running timer. I would like to know if it is safe to remove the timer
del
and add but keep the spin lock.
Thanks for your help
Kevin
--=20
View this message in context:
http://www.nabble.com/Xilinx-Temac-Timer---tp16306218p16306218.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Xilinx Temac Timer ?
2008-03-26 19:48 ` Xilinx " John Linn
@ 2008-03-27 19:31 ` khollan
0 siblings, 0 replies; 6+ messages in thread
From: khollan @ 2008-03-27 19:31 UTC (permalink / raw)
To: linuxppc-embedded
John Linn wrote:
>
> Hi Kevin,
>
> I didn't write the code but I know the driver somewhat.
>
> I think the intention of stopping the timer is to prevent the reentrancy
> as the comment says because there is a function, gmii_poll, that is
> setup on the timer to go read the phy registers to see if anything
> changed in the phy.
>
> Stopping the timer prevents a phy read from happening in gmii_poll in
> the middle of the ioctl phy read which could hose things up.
>
> I don't see why you couldn't change that timer stop to some other form
> of synchronization/mutual exclusion so that the phy reads don't collide.
>
> As I look at it, it appears to me the spinlock should provide the
> synchronization needed without stopping the timer, but maybe I'm missing
> something. I CCed John Bonesio as he's the guy that developed this code
> I believe and maybe he'll have more insight here.
>
> Thanks,
> John
>
I removed the timer code, and it seems to be working correctly, hopefully
the spin lock is all I need to lock out the polling function. Thanks for
you help
Kevin
--
View this message in context: http://www.nabble.com/Xilinx-Temac-Timer---tp16306218p16332251.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* JFFS2 root-fs
2008-03-26 17:02 Xilin Temac Timer ? khollan
2008-03-26 19:48 ` Xilinx " John Linn
@ 2008-03-31 14:33 ` Georg Schardt
1 sibling, 0 replies; 6+ messages in thread
From: Georg Schardt @ 2008-03-31 14:33 UTC (permalink / raw)
To: linuxppc-embedded
Hi all,
i ask this questions a few months ago but i still have no solution for
my problem :(
i try to boot linux with a root-fs from flash. i create a jffs2-image,
download it to flash and
the u-boot "ls" shows me all my files, so i think all is right with the
image.
BUT, the kernel hangs after mounting the rootfs:
[ 0.572527] physmap platform flash device: 00400000 at 04000000
[ 0.579205] physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
[ 0.586062] Amd/Fujitsu Extended Query Table at 0x0041
[ 0.591456] number of CFI chips: 1
[ 0.594973] cfi_cmdset_0002: Disabling erase-suspend-program due to
code brokenness.
[ 0.602916] 4 cmdlinepart partitions found on MTD device physmap-flash.0
[ 0.609759] Creating 4 MTD partitions on "physmap-flash.0":
[ 0.615454] 0x00000000-0x00010000 : "env"
[ 0.619599] mtd: Giving out device 0 to env
[ 0.628166] 0x00010000-0x00030000 : "uboot"
[ 0.632563] mtd: Giving out device 1 to uboot
[ 0.641172] 0x00030000-0x00160000 : "kernel"
[ 0.645744] mtd: Giving out device 2 to kernel
[ 0.654372] 0x00160000-0x00400000 : "fs"
[ 0.658604] mtd: Giving out device 3 to fs
[ 0.666992] block2mtd: version $Revision: 1.30 $
[ 0.673341] mice: PS/2 mouse device common for all mice
[ 0.679193] TCP cubic registered
[ 0.683016] NET: Registered protocol family 1
[ 0.687619] NET: Registered protocol family 17
[ 0.696556] MTDSB: dev_name "/dev/root"
[ 0.700723] MTDSB: path_lookup() returned 0, inode c02ec290
[ 0.706515] MTDSB: New superblock for device 3 ("fs")
[ 2.386543] VFS: Mounted root (jffs2 filesystem).
[ 2.392022] Freeing unused kernel memory: 76k init
[ 2.397182] Warning: unable to open an initial console.
[ 2.416877] Kernel panic - not syncing: No init found. Try passing
init= option to kernel.
[ 2.427312] Rebooting in 180 seconds..
It seems to me, that the kernel does not find ANY file. because the
/dev/console file is in the image, but the initial console is not found too
any ideas and hints are appreciated
regars
georg
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich
Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Bärbel Brumme-Bothe
Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: JFFS2 root-fs
@ 2008-03-31 17:23 Sugathan, Rupesh
2008-04-01 6:07 ` Georg Schardt
0 siblings, 1 reply; 6+ messages in thread
From: Sugathan, Rupesh @ 2008-03-31 17:23 UTC (permalink / raw)
To: Georg Schardt; +Cc: linuxppc-embedded
=20
It seems to me, that the kernel does not find ANY file. because the
/dev/console file is in the image, but the initial console is not found
too
1) You should probably unpack and mount the jffs2 image on your host
directory to ensure that you see all files in place.=20
2) Check to see if your designated flash partition can hold all of your
jffs2 image.
Were you able to use the 'same' rootfs in any other way (nfs mount or
ramdisk) on the target?
Thanks
--
Rupesh Sugathan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: JFFS2 root-fs
2008-03-31 17:23 Sugathan, Rupesh
@ 2008-04-01 6:07 ` Georg Schardt
0 siblings, 0 replies; 6+ messages in thread
From: Georg Schardt @ 2008-04-01 6:07 UTC (permalink / raw)
To: linuxppc-embedded
Sugathan, Rupesh schrieb:
>
> It seems to me, that the kernel does not find ANY file. because the
> /dev/console file is in the image, but the initial console is not found
> too
>
> 1) You should probably unpack and mount the jffs2 image on your host
> directory to ensure that you see all files in place.
>
i see all the files with the u-boot jffs2 commands, but will try to
mount the jffs image on the host
> 2) Check to see if your designated flash partition can hold all of your
> jffs2 image.
>
yes, its big enough
> Were you able to use the 'same' rootfs in any other way (nfs mount or
> ramdisk) on the target?
>
i will try this
Thanks
Georg
> Thanks
> --
> Rupesh Sugathan
>
>
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich
Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Bärbel Brumme-Bothe
Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-01 6:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26 17:02 Xilin Temac Timer ? khollan
2008-03-26 19:48 ` Xilinx " John Linn
2008-03-27 19:31 ` khollan
2008-03-31 14:33 ` JFFS2 root-fs Georg Schardt
-- strict thread matches above, loose matches on Subject: below --
2008-03-31 17:23 Sugathan, Rupesh
2008-04-01 6:07 ` Georg Schardt
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).