LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: RAMDISK on EP88xc
From: Scott Wood @ 2009-07-06 19:01 UTC (permalink / raw)
  To: Mikhail Zaturenskiy; +Cc: linuxppc-dev
In-Reply-To: <97dd5fd20907061150o303418a3m3967650433fbb061@mail.gmail.com>

Mikhail Zaturenskiy wrote:
> ****************************************************
> in arch/powerpc/configs/ep88xc_defconfig:
> +	CONFIG_BLK_DEV = y

Hmm, missed this.  I'm not sure why the subsequent changes didn't take 
effect -- what did the .config look like after sucking in the defconfig 
changes, but without any Kconfig changes?

In any case, the best way to make changes is with one of the config 
editors (menuconfig, etc).

-Scott

^ permalink raw reply

* Re: RAMDISK on EP88xc
From: Scott Wood @ 2009-07-06 18:57 UTC (permalink / raw)
  To: Mikhail Zaturenskiy; +Cc: linuxppc-dev
In-Reply-To: <97dd5fd20907061150o303418a3m3967650433fbb061@mail.gmail.com>

Mikhail Zaturenskiy wrote:
>>> After doing this testing I have a side question:
>>> If I modify just arch/powerpc/configs/ep88x_defconfig, not all changes
>>> are reflected in the resulting .config when i do "make
>>> ep88x_defconfig; make uImage". I ended up having to modify
>>> arch/powerpc/Kconfig, arch/powerpc/configs/ep88xc_defconfig,
>>> fs/ext2/Kconfig and init/Kconfig to get "make ep88x_defconfig; make
>>> uImage" to create a properly configured image, but this really doesn't
>>> feel right. What's the proper way to set up a defconfig?
>> What changes are you trying to make to the config, and what did you change
>> in the Kconfig files?
>>
> 
> ****************************************************
> in arch/powerpc/Kconfig:
> +	config BLK_DEV_LOOP
> +		tristate
> +		default y
> 
> +	config BLK_DEV_RAM
> +		tristate
> +		default y
> 
> +	config BLK_DEV_RAM_COUNT
> +		int
> +		default 16
> 
> +	config BLK_DEV_RAM_SIZE
> +		int
> +		default 32768

You should definitely not do that.  In fact, I'm surprised kconfig 
didn't complain about the duplicate symbols.

Perhaps CONFIG_BLK_DEV is unset?

-Scott

^ permalink raw reply

* Re: RAMDISK on EP88xc
From: Mikhail Zaturenskiy @ 2009-07-06 18:50 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <4A5244B6.7030800@freescale.com>

>> After doing this testing I have a side question:
>> If I modify just arch/powerpc/configs/ep88x_defconfig, not all changes
>> are reflected in the resulting .config when i do "make
>> ep88x_defconfig; make uImage". I ended up having to modify
>> arch/powerpc/Kconfig, arch/powerpc/configs/ep88xc_defconfig,
>> fs/ext2/Kconfig and init/Kconfig to get "make ep88x_defconfig; make
>> uImage" to create a properly configured image, but this really doesn't
>> feel right. What's the proper way to set up a defconfig?
>
> What changes are you trying to make to the config, and what did you change
> in the Kconfig files?
>

****************************************************
in arch/powerpc/Kconfig:
+	config BLK_DEV_LOOP
+		tristate
+		default y

+	config BLK_DEV_RAM
+		tristate
+		default y

+	config BLK_DEV_RAM_COUNT
+		int
+		default 16

+	config BLK_DEV_RAM_SIZE
+		int
+		default 32768
****************************************************
in arch/powerpc/configs/ep88xc_defconfig:
+	CONFIG_BLK_DEV = y
-	CONFIG_BLK_DEV is not set
-	CONFIG_BLK_DEV_INITRD is not set
-	CONFIG_EXT2_FS is not set
****************************************************
in fs/ext2/Kconfig/"config EXT2_FS":
+	default y
****************************************************
in init/Kconfig/"config BLK_DEV_INITRD":
+	default y
****************************************************

If I make changes just to arch/powerpc/configs/ep88xc_defconfig they
don't seem to be propagated to the resulting configuration when using
"make ep88xc_defconfig"

^ permalink raw reply

* Re: RAMDISK on EP88xc
From: Scott Wood @ 2009-07-06 18:38 UTC (permalink / raw)
  To: Mikhail Zaturenskiy; +Cc: linuxppc-dev
In-Reply-To: <97dd5fd20907061129k67d2404m7e2a2c8fd8a71503@mail.gmail.com>

Mikhail Zaturenskiy wrote:
>> If you have time, could you bisect to see when the slowdown was introduced?
>>
>> -Scott
>>
> 
> Scott, I tested with kernels 2.6.28, 2.6.29 and 2.6.30 all obtained
> from git.kernel.org and configured the same.
> So, on my EP88xc board 2.6.28 and 2.6.29 work ok, 2.6.30 has the
> slowdown issue after loading a ramdisk.
> 
> After doing this testing I have a side question:
> If I modify just arch/powerpc/configs/ep88x_defconfig, not all changes
> are reflected in the resulting .config when i do "make
> ep88x_defconfig; make uImage". I ended up having to modify
> arch/powerpc/Kconfig, arch/powerpc/configs/ep88xc_defconfig,
> fs/ext2/Kconfig and init/Kconfig to get "make ep88x_defconfig; make
> uImage" to create a properly configured image, but this really doesn't
> feel right. What's the proper way to set up a defconfig?

What changes are you trying to make to the config, and what did you 
change in the Kconfig files?

-Scott

^ permalink raw reply

* Re: RAMDISK on EP88xc
From: Mikhail Zaturenskiy @ 2009-07-06 18:29 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <4A4D2B70.1030505@freescale.com>

> If you have time, could you bisect to see when the slowdown was introduced?
>
> -Scott
>

Scott, I tested with kernels 2.6.28, 2.6.29 and 2.6.30 all obtained
from git.kernel.org and configured the same.
So, on my EP88xc board 2.6.28 and 2.6.29 work ok, 2.6.30 has the
slowdown issue after loading a ramdisk.

After doing this testing I have a side question:
If I modify just arch/powerpc/configs/ep88x_defconfig, not all changes
are reflected in the resulting .config when i do "make
ep88x_defconfig; make uImage". I ended up having to modify
arch/powerpc/Kconfig, arch/powerpc/configs/ep88xc_defconfig,
fs/ext2/Kconfig and init/Kconfig to get "make ep88x_defconfig; make
uImage" to create a properly configured image, but this really doesn't
feel right. What's the proper way to set up a defconfig?

Thanks,
Mikhail Zaturenskiy

^ permalink raw reply

* dma_ops->map_page == NULL
From: Kári Davíðsson @ 2009-07-06 17:51 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

I am doing a driver that uses dma_map_single().

After changing to to linux 2.6.29.3 I am getting
segfaults in dma_map_single() because dma_ops->map_page is NULL.
Actually dma_ops looks funky too.

The driver is an of_platform_driver which is declared as an child of
the lbp (fsl,lpb) node of the device tree.

This is on powerpc 5200b platform.

rg
kd

^ permalink raw reply

* RE: ppc405ex + gigabit ethernet
From: Feng Kan @ 2009-07-06 16:56 UTC (permalink / raw)
  To: Lada Podivin, Cote, Sylvain; +Cc: linuxppc-dev
In-Reply-To: <e35801cc0907030209y2a4bd50s7d12cf75341e3536@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hi Lada:

Please contact support@amcc.com for additional help for the coalescing patch.

Feng Kan
AMCC Software


-----Original Message-----
From: linuxppc-dev-bounces+fkan=amcc.com@lists.ozlabs.org on behalf of Lada Podivin
Sent: Fri 7/3/2009 2:09 AM
To: Cote, Sylvain
Cc: linuxppc-dev@ozlabs.org
Subject: Re: ppc405ex + gigabit ethernet
 
Hi Sylvain,

the interrupt coalescing sounds like good idea - I'm surprised this
feature is missing in the original ibm_newemac driver. You wrote you
had got this optimisation directly from AMCC. Is it part of any
framework? I'm just wondering how one can obtain it. I tried to find
any suitable patch but with no success - the old friend Google didn't
help this time :)

Thank you very much!
Lada
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[-- Attachment #2: Type: text/html, Size: 1480 bytes --]

^ permalink raw reply

* Re: Non-contiguous physical memory on 8572
From: Scott Wood @ 2009-07-06 16:23 UTC (permalink / raw)
  To: Aaron Pace; +Cc: linuxppc-dev
In-Reply-To: <bc81dc640907021456v2e7750cer5732d5c84953801a@mail.gmail.com>

On Thu, Jul 02, 2009 at 03:56:39PM -0600, Aaron Pace wrote:
> Secondly, can you elaborate on how/when the reserved area could be
> mapped into the TLB?  I don't by any means lay claim to a complete
> understanding of this area, but aside from a direct ioremap/mmap call,
> how would this area get mapped at all?

Linux maps low memory (up to 768MiB) regardless of reserved regions --
the assumption is that it can't be clobbered, not that it isn't RAM.

-Scott

^ permalink raw reply

* Re: Subject: [PATCH v8] spi: Add PPC4xx SPI driver
From: Steven A. Falco @ 2009-07-06 16:19 UTC (permalink / raw)
  To: David Brownell; +Cc: linuxppc-dev@ozlabs.org, Stefan Roese
In-Reply-To: <200907021744.27636.david-b@pacbell.net>

David Brownell wrote:
> On Friday 26 June 2009, Steven A. Falco wrote:
>> +
>> +       /*
>> +        * If there are no chip selects at all, or if this is the special
>> +        * case of a non-existent (dummy) chip select, do nothing.
>> +        */
>> +
>> +       if (!hw->master->num_chipselect || hw->gpios[cs] == -EEXIST)
>> +               return;
>> +
> 
> I'm going to send this in, but please send a followup
> patch making all this "non-existent (dummy) chip select"
> stuff use the SPI_NO_CS flag.
> 

Not sure yet how this will work.  GPIOs are detected during probe.
of_get_gpio_flags() will return EEXIST for devices without a CS,
and will return the gpio number for devices with a CS, but probe
doesn't (currently) know anything about "struct spi_device".

In fact, the devices don't exist until spi_bitbang_start is called,
near the end of the probe.  So, I've not figured out how the probe
routine will set the new SPI_NO_CS flag on a per-device basis.

There is one example of a ppc board calling spi_register_board_info,
but even that board doesn't really use it, if a device tree exists.

> 
>> +       /*
>> +        * A count of zero implies a single SPI device without any chip-select.
>> +        * Note that of_gpio_count counts all gpios assigned to this spi master.
>> +        * This includes both "null" gpio's and real ones.
>> +        */
> 
> 
> 

^ permalink raw reply

* Re: Delay on intialization ide subsystem(most likely)
From: Bartlomiej Zolnierkiewicz @ 2009-07-06 15:04 UTC (permalink / raw)
  To: Andrey Gusev; +Cc: linuxppc-dev, petkovbb, David Miller, linux-ide
In-Reply-To: <20090705151754.6034ffad@power-debian>

On Sunday 05 July 2009 13:17:54 Andrey Gusev wrote:
> On Wed, 10 Jun 2009 13:44:29 +0200
> Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:
> 
> > On Tuesday 09 June 2009 01:26:27 Benjamin Herrenschmidt wrote:
> > > On Mon, 2009-06-08 at 22:20 +0200, Bartlomiej Zolnierkiewicz wrote:
> > > 
> > > > > [   70.584122]  hdb:<3>ide-pmac lost interrupt, dma status: 8480
> > > > 
> > > > DMA status indicates that DMA transfer is still active according
> > > > to the controller.  This one is really a platform/hardware
> > > > specific issue.
> > > 
> > > I've partially missed that thread. Is the a bugzilla entry or
> > 
> > There is no bugzilla entry currently so please check mailing list
> > archives for previous discussion.
> > 
> > > something ? Is this a regression ?
> > 
> > At least not a recent one (it happens since at least 2.6.24).
> > 
> 
> Delay is fixed itself in 2.6.31-rc2. Most likely it was platform specific issue. But lost interrupt still exists.
> There is log of 2.6.31-rc2:

Thanks for letting us know.  When it comes to the lost interrupt issue
I still suspect that this is pmac specific problem (though Dave may have
some fresh idea about it).

> [    1.595268] MacIO PCI driver attached to Keylargo chipset
> [    1.597024] irq: irq 32 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 32
> [    1.597988] irq: irq 19 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 19
> [    1.598024] irq: irq 11 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 16
> [    1.598365] irq: irq 20 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 20
> [    1.598401] irq: irq 12 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 17
> [    1.598762] irq: irq 5 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 18
> [    1.598797] irq: irq 6 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 21
> [    1.599264] irq: irq 7 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 24
> [    1.599300] irq: irq 8 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 29
> [    1.601336] Uniform Multi-Platform E-IDE driver
> [    1.602201] ide-pmac 0002:20:0d.0: enabling device (0000 -> 0002)
> [    2.630651] ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> [    2.630767] Probing IDE interface ide0...
> [    2.930834] hda: IBM-IC35L060AVVA07-0, ATA DISK drive
> [    3.290646] hdb: QUANTUM FIREBALLP LM20.5, ATA DISK drive
> [    3.291087] hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> [    3.291264] hda: UDMA/100 mode selected
> [    3.291473] hdb: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> [    3.291720] hdb: UDMA/66 mode selected
> [    3.292118] ide0 at 0xf10c2000-0xf10c2070,0xf10c2160 on irq 39
> [    4.320649] ide-pmac: Found Apple KeyLargo ATA-4 controller (macio), bus ID 2, irq 19
> [    4.320753] Probing IDE interface ide1...
> [    4.921004] ide1 at 0xf10ba000-0xf10ba070,0xf10ba160 on irq 19
> [    5.950647] ide-pmac: Found Apple KeyLargo ATA-3 controller (macio), bus ID 0, irq 20
> [    5.950743] Probing IDE interface ide2...
> [    6.370828] hde: PHILIPS CDD5101, ATAPI CD/DVD-ROM drive
> [    6.730948] hde: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> [    6.731332] hde: MWDMA2 mode selected
> [    6.731832] ide2 at 0xf10be000-0xf10be070,0xf10be160 on irq 20
> [    6.732558] ide-gd driver 1.18
> [    6.732735] hda: max request size: 128KiB
> [    6.763392] hda: 120103200 sectors (61492 MB) w/1863KiB Cache, CHS=65535/16/63
> [    6.763741] hda: cache flushes supported
> [    6.764277]  hda: [mac] hda1 hda2 hda3 hda4
> [    6.770469] hdb: max request size: 128KiB
> [    6.803427] hdb: Host Protected Area detected.
> [    6.803431] 	current capacity is 40130390 sectors (20546 MB)
> [    6.803435] 	native  capacity is 40132503 sectors (20547 MB)
> [    6.803590] hdb: 40130390 sectors (20546 MB) w/1900KiB Cache, CHS=39811/16/63
> [    6.803684] hdb: cache flushes not supported
> [    6.803910]  hdb:
> [   26.800743] ide-pmac lost interrupt, dma status: 8480
> [   26.800809] hdb: lost interrupt
> [   26.800850] hdb: dma_intr: status=0x58 { DriveReady SeekComplete DataRequest }
> [   26.800976] hdb: possibly failed opcode: 0xc8
> [   26.803449] hda: DMA disabled
> [   26.805664] hdb: DMA disabled
> [   26.900633] ide0: reset: success
> [   26.949147]  hdb1 hdb2 < hdb5 hdb6 hdb7 hdb8 >
> [   27.007890] ide-cd driver 5.00
> [   27.011728] ide-cd: hde: ATAPI 32X DVD-ROM CD-R/RW drive, 8192kB Cache
> [   27.014163] Uniform CD-ROM driver Revision: 3.20
> 

^ permalink raw reply

* Please pull 'merge' branch of 4xx tree
From: Josh Boyer @ 2009-07-06 14:07 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev

Hi Ben,

Please pull the fixes below from the 4xx tree.  A few Warp platform updates
that should fix the final issues Sean has reported.

thx,
josh

The following changes since commit fd0cca754f3f6756bfdafe500e4f49b1b9e9723f:
  Benjamin Herrenschmidt (1):
        Merge commit 'kumar/next' into merge

are available in the git repository at:

  ssh://master.kernel.org/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx.git merge

Josh Boyer (1):
      powerpc/44x: Fix build error with -Werror for Warp platform

Sean MacLennan (2):
      powerpc/44x: Update Warp defconfig
      powerpc/4xx: Have Warp take advantage of GPIO LEDs default-state = keep

 arch/powerpc/boot/dts/warp.dts          |    3 +-
 arch/powerpc/configs/44x/warp_defconfig |  200 ++++++++++++++++++++++++-------
 arch/powerpc/platforms/44x/warp.c       |   19 +--
 3 files changed, 166 insertions(+), 56 deletions(-)

^ permalink raw reply

* Re: [PATCH] powerpc/mpic: Fix MPIC_BROKEN_REGREAD on non broken MPICs
From: Olof Johansson @ 2009-07-06 13:59 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <6c9c0889feaceeea55bd2b6fef0c19e408425ef5.1246846125.git.michael@ellerman.id.au>

On Mon, Jul 06, 2009 at 12:08:52PM +1000, Michael Ellerman wrote:
> The workaround enabled by CONFIG_MPIC_BROKEN_REGREAD does not work
> on non-broken MPICs. The symptom is no interrupts being received.
> 
> The fix is twofold. Firstly the code was broken for multiple isus,
> we need to index into the shadow array with the src_no, not the idx.
> Secondly, we always do the read, but only use the VECPRI_MASK and
> VECPRI_ACTIVITY bits from the hardware, the rest of "val" comes
> from the shadow.

I'm travelling without remote access to a machine to test this on. Given
that it changes the errata workaround (subtly), I'd appreciate the chance
to give it a go before it gets merged.

Unfortunately I forgot to make sure that my remote console server was
up before I left. :-)

-Olof

^ permalink raw reply

* Re: Device tree for c67x00
From: Jorge Sánchez de Nova @ 2009-07-06 12:38 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Linuxppc-dev
In-Reply-To: <871vp2eu09.fsf@macbook.be.48ers.dk>


[-- Attachment #1.1: Type: text/plain, Size: 7904 bytes --]

Hi,

 ok, so I have managed to give it some OF support in a preliminary way(see
patch). But now, I am facing serious problems which I am finding difficult
to tackle. I understand that maybe these problems have to do partially or
entirely to the Xilinx ML403. Let me explain myself: First of all, I don't
know of anyone else who has used it for the ML403 with the XPS_EPC , so
there might be some particularities I should specifically take care of.

 First of all, I see a resetting problem. When I load the kernel with my
board from a powered off state to a powered on state it behaves differently
that if I just to try to load the kernel again with the board powered on
(see ERROR 1 below). I have seen that the reset line in the c67300 is
connected to the fpga and for sure, to take care of it one would need to do
it through a third gpio line outside. This would be to make a hard reset.
Looking at this old specific driver that I have found for kernel 2.4.20 (
http://www.sysf.physto.se/~attila/ATLAS/Digitizer/Testbench/System_ISE_SoftMAC/linux/software/uClinux-2.4.x/drivers/usb/cy7c67300/<http://www.sysf.physto.se/%7Eattila/ATLAS/Digitizer/Testbench/System_ISE_SoftMAC/linux/software/uClinux-2.4.x/drivers/usb/cy7c67300/>)
I see that the hard resets are common using the ugly gpio method.

 With the board on, if I reload the fpga programming and kernel image into
memory and set the PC to run properly, it gives different errors. Sometimes
ERROR2 and some other times ERROR3. When ERROR2, the processor halts when
calling WARN_ON(!res) and in the second, the interrupt handler keeps writing
to the output endlessly.

 I have added some printks to trace the problem and the OF support is simply
a rewriting of the normal platform_driver registration. Any ideas?

Jorge

-- ERROR 1 (just after power on--
Generic platform RAM MTD, (c) 2004 Simtec Electronics
usbmon: debugfs is not available
C67X00_DBG:c67x00_of_probe() - Request memory region
C67X00_DBG:c67x00_of_probe() - Allocating data structs
C67X00_DBG:c67x00_of_probe() - Configuring c67x00 device
C67X00_DBG:c67x00_of_probe() - Configure platform data based on the
device-tree data
C67X00_DBG:c67x00_of_probe() - hpi.regstep: 2
C67X00_DBG:c67x00_of_probe() - SIE_config: 1
C67X00_DBG:c67x00_of_probe() - SIE_config: 21
C67X00_DBG:c67x00_of_probe() - Low-level initizalization
C67X00_DBG:c67x00_ll_hpi_reg_init(): Reg:324 written=0x00 ; read: 0
C67X00_DBG:c67x00_ll_hpi_reg_init(): Reg:328 written=0x00 ; read: 0
C67X00_DBG:c67x00_of_probe() - Registering IRQ
C67X00_DBG:c67x00_of_probe() - Trying to register IRQ:17 @ 17
C67X00_DBG:c67x00_irq() - Handling IRQ number 57005
�����;�L�=?� : Not all interrupts handled! status = 0xdead
C67X00_DBG:c67x00_irq() - Handling IRQ number 57005
C67X00_DBG:c67x00_of_probe() - Low-level reset
C67X00_DBG:c67x00_ll_reset() - Send mbox
C67X00_DBG:c67x00_ll_reset() - recv_msg
C67X00_DBG:ll_recv_msg() -  calling wait_for_completion_timeout
C67X00_DBG:ll_recv_msg() res=5000
C67X00_DBG:c67x00_ll_reset() - done recv_msg
C67X00_DBG:c67x00_of_probe() - Configuring SIEs
C67X00_DBG:ll_recv_msg() -  calling wait_for_completion_timeout
C67X00_DBG:ll_recv_msg() res=5000
����� : SIE 0 not set to host mode
����� : Cypress C67X00 Host Controller
Unable to handle kernel paging request for data at address 0x00000002
Faulting instruction address: 0xc0012654
Oops: Kernel access of bad area, sig: 11 [#1]
PREEMPT Xilinx Virtex
Modules linked in:
NIP: c0012654 LR: c01c8ca0 CTR: c01fa0e4
REGS: c381db90 TRAP: 0300   Not tainted  (2.6.29.4)
MSR: 00029030 <EE,ME,CE,IR,DR>  CR: 35039055  XER: a000004b
DEAR: 00000002, ESR: 00000000
TASK = c381a000[1] 'swapper' THREAD: c381c000
GPR00: 00000002 c381dc40 c381a000 00000002 00000001 00000000 fffffffe
ffffffff
GPR08: 00000000 00000008 00000003 c380a0b1 35039059 ffffffff ffffffff
ffffffff
GPR16: ffffffff ffffffff ffffffff ffffffff ffffffff c398fee0 c035bdc4
c0360acc
GPR24: 00000000 00000000 c380a000 c03cac98 00000001 c385a84c 000000d0
c385a84c
NIP [c0012654] strlen+0x4/0x18
LR [c01c8ca0] kobject_get_path+0x34/0xe0
Call Trace:
[c381dc40] [c01c91fc] add_uevent_var+0x74/0xf4 (unreliable)
[c381dc60] [c01fa190] dev_uevent+0xac/0x210
[c381dc80] [c01c94a8] kobject_uevent_env+0x22c/0x454
[c381dcd0] [c01fb164] device_add+0x39c/0x594
[c381dd20] [c01fb418] device_create_vargs+0x8c/0xd0
[c381dd50] [c01fb49c] device_create+0x40/0x50
[c381dd80] [c0219fc0] usb_add_hcd+0x140/0x6d4
[c381ddb0] [c022daac] c67x00_hcd_probe+0x120/0x1f0
[c381ddd0] [c022c88c] c67x00_probe_sie+0xcc/0xe0
[c381dde0] [c02f43a4] c67x00_of_probe+0x3fc/0x458
[c381de50] [c0258a88] of_platform_device_probe+0x5c/0x84
[c381de70] [c01fdb8c] driver_probe_device+0xbc/0x1f4
[c381de90] [c01fdd68] __driver_attach+0xa4/0xa8
[c381deb0] [c01fce78] bus_for_each_dev+0x5c/0x98
[c381dee0] [c01fd990] driver_attach+0x24/0x34
[c381def0] [c01fd798] bus_add_driver+0x1d0/0x250
[c381df20] [c01fe0b4] driver_register+0x5c/0x150
[c381df40] [c0258950] of_register_driver+0x54/0x70
[c381df50] [c03aaa8c] c67x00_init+0x34/0x8c
[c381df60] [c000236c] do_one_initcall+0x34/0x1a4
[c381dfd0] [c0393170] kernel_init+0x90/0xfc
[c381dff0] [c000fa24] kernel_thread+0x4c/0x68
Instruction dump:
4d820020 7ca903a6 38a3ffff 3884ffff 8c650001 2c830000 8c040001 7c601851
4d860020 4102ffec 4e800020 3883ffff <8c040001> 2c000000 4082fff8 7c632050
---[ end trace f8500dd73d54b5fd ]---
Kernel panic - not syncing: Attempted to kill init!
Rebooting in 180 seconds..

-- ERROR 2 (with the board already on, just reprogramming fpga, kernel and
booting again)--

Generic platform RAM MTD, (c) 2004 Simtec Electronics
usbmon: debugfs is not available
C67X00_DBG:c67x00_of_probe() - Request memory region
C67X00_DBG:c67x00_of_probe() - Allocating data structs
C67X00_DBG:c67x00_of_probe() - Configuring c67x00 device
C67X00_DBG:c67x00_of_probe() - Configure platform data based on the
device-tree data
C67X00_DBG:c67x00_of_probe() - hpi.regstep: 2
C67X00_DBG:c67x00_of_probe() - SIE_config: 1
C67X00_DBG:c67x00_of_probe() - SIE_config: 21
C67X00_DBG:c67x00_of_probe() - Low-level initizalization
C67X00_DBG:c67x00_ll_hpi_reg_init(): Reg:324 written=0x00 ; read: 0
C67X00_DBG:c67x00_ll_hpi_reg_init(): Reg:328 written=0x00 ; read: 0
C67X00_DBG:c67x00_of_probe() - Registering IRQ
C67X00_DBG:c67x00_of_probe() - Trying to register IRQ:17 @ 17
C67X00_DBG:c67x00_of_probe() - Low-level reset
C67X00_DBG:c67x00_ll_reset() - Send mbox
C67X00_DBG:c67x00_ll_reset() - recv_msg
C67X00_DBG:ll_recv_msg() -  calling wait_for_completion_timeout
C67X00_DBG:ll_recv_msg() res=0
--> Here the processor halts when in call to WARN_ON(!res);

-- ERROR 3: gets stuck in the interrupt handler --
�����;�L�=?� : Not all interrupts handled! status = 0x0148
C67X00_DBG:c67x00_irq() - Handling IRQ number 328

2009/6/29 Peter Korsgaard <jacmet@sunsite.dk>

> >>>>> "Jorge" == Jorge Sánchez de Nova <j.s.denova@gmail.com> writes:
>
>  Jorge> Hi,
>
>  Jorge> It doesn't work at all since it doesn't load anything. I have
>  Jorge> looked at the driver and there is apparently no openfirmware
>  Jorge> support for it, so maybe the dts info won't work without
>  Jorge> it. Am I wrong? Does this means that the c67x00 needs OF
>  Jorge> support to work in this configuration? How can I make it
>  Jorge> otherwise?
>
> Yes, the c67x00 driver doesn't currently have any OF bindings. Either
> you can add it, or simply manually create the struct platform_device
> in your board file (or scan the DT in your board file and fill in the
> correct base address / interrupt number from it).
>
> Remember that arch/powerpc uses virtual interrupt numbers if you're
> going to fill in the platform_device by hand.
>
> --
> Bye, Peter Korsgaard
>

[-- Attachment #1.2: Type: text/html, Size: 8731 bytes --]

[-- Attachment #2: c67x00_of.patch --]
[-- Type: text/x-patch, Size: 8957 bytes --]

diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c
index 5633bc5..699cbef 100644
--- a/drivers/usb/c67x00/c67x00-drv.c
+++ b/drivers/usb/c67x00/c67x00-drv.c
@@ -39,6 +39,10 @@
 #include <linux/list.h>
 #include <linux/usb.h>
 #include <linux/usb/c67x00.h>
+#if defined(CONFIG_OF)
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#endif
 
 #include "c67x00.h"
 #include "c67x00-hcd.h"
@@ -87,8 +91,9 @@ static irqreturn_t c67x00_irq(int irq, void *__dev)
 	struct c67x00_sie *sie;
 	u16 msg, int_status;
 	int i, count = 8;
-
+//	printk("Handling IRQ!\n");
 	int_status = c67x00_ll_hpi_status(c67x00);
+	printk("C67X00_DBG:c67x00_irq() - Handling IRQ number %d\n",int_status);
 	if (!int_status)
 		return IRQ_NONE;
 
@@ -225,14 +230,241 @@ static struct platform_driver c67x00_driver = {
 };
 MODULE_ALIAS("platform:c67x00");
 
+/* ---------------------------------------------------------------------
+ * OF_Platform Bus Support
+ */
+
+#if defined(CONFIG_OF)
+static int __devinit c67x00_of_probe(struct of_device *dev, 
+				     const struct of_device_id *match)
+{
+ 	struct c67x00_device *c67x00;
+ 	struct c67x00_platform_data *pdata;
+	struct resource r_irq_struct;
+	struct resource *res;
+	struct resource memory;
+	struct device_node *dp = dev->node;
+	struct resource* r_irq = &r_irq_struct;
+	u32* iprop;
+	int len, ret, i;
+
+	/* Request memory region */
+	printk("C67X00_DBG:c67x00_of_probe() - Request memory region\n");
+	ret = of_address_to_resource(dp, 0, &memory);
+	if (ret)
+		return -ENXIO;
+
+	res = request_mem_region(memory.start, memory.end - memory.start + 1,
+			dev_name(&dev->dev));
+
+	if (!res){
+		dev_err(&dev->dev, "Memory region busy\n"); 
+		return -EBUSY;		
+	}
+
+	/* Allocate device and platform_data structs */
+	printk("C67X00_DBG:c67x00_of_probe() - Allocating data structs\n");
+	c67x00 = kzalloc(sizeof(*c67x00), GFP_KERNEL);
+	if (!c67x00)	
+	    return -ENOMEM;
+
+	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+	if (!pdata){
+		ret = -ENOMEM;
+	        goto request_mem_failed;
+	}
+
+	/* Configure c67x00 device */
+	printk("C67X00_DBG:c67x00_of_probe() - Configuring c67x00 device\n");
+	c67x00->hpi.base = ioremap(memory.start, memory.end - memory.start + 1);
+
+	if (!c67x00->hpi.base) {
+		dev_err(&dev->dev, "Unable to map HPI registers\n");
+		ret = -EIO;
+		goto map_failed;
+	}
+
+	/* Configure platform data based on the device-tree data */	
+	printk("C67X00_DBG:c67x00_of_probe() - Configure platform data based on the device-tree data\n");
+	spin_lock_init(&c67x00->hpi.lock);
+	//TODO: Check that we are using the ML403
+
+	iprop = of_get_property(dev->node, "xlnx,hpi_regstep", &len);
+	if (!iprop || len < sizeof(*iprop)) {
+		dev_err(&dev->dev, "No 'xlnx,hpi_regstep property'\n");
+		ret = -EIO;
+		goto map_failed; //TODO
+	}
+	c67x00->hpi.regstep = *iprop;
+	printk("C67X00_DBG:c67x00_of_probe() - hpi.regstep: %x\n", c67x00->hpi.regstep);	
+
+	iprop = of_get_property(dev->node, "xlnx,sie1_config", &len);
+	if (!iprop || len < sizeof(*iprop)) {
+		dev_err(&dev->dev, "No 'xlnx,sie1_config'\n");
+		ret = -EIO;
+		goto map_failed; //TODO
+	}
+	pdata->sie_config =  *iprop;
+	printk("C67X00_DBG:c67x00_of_probe() - SIE_config: %x\n", pdata->sie_config);	
+
+	iprop = of_get_property(dev->node, "xlnx,sie2_config", &len);
+	if (!iprop || len < sizeof(*iprop)) {
+		dev_err(&dev->dev, "No 'xlnx,sie2_config'\n");
+		ret = -EIO;
+		goto map_failed; //TODO
+	}
+	pdata->sie_config |= *iprop << 4;
+	printk("C67X00_DBG:c67x00_of_probe() - SIE_config: %x\n", pdata->sie_config);
+
+	c67x00->pdata = pdata;
+	c67x00->pdev = dev;
+
+	/* Low-level initizalization */
+	printk("C67X00_DBG:c67x00_of_probe() - Low-level initizalization \n");
+	c67x00_ll_init(c67x00);
+	c67x00_ll_hpi_reg_init(c67x00);
+
+	/* Request IRQ */	
+	printk("C67X00_DBG:c67x00_of_probe() - Registering IRQ\n");
+	dev_dbg(&dev->dev, "Registering IRQ\n");
+	ret = of_irq_to_resource(dev->node, 0, r_irq);
+
+	if (ret == NO_IRQ) {
+		dev_err(&dev->dev, "Couldn't find IRQ in device-tree\n");
+		goto request_irq_failed;
+	}
+	printk("C67X00_DBG:c67x00_of_probe() - Trying to register IRQ:%d @ %d\n",ret,r_irq->start);
+	ret = request_irq(r_irq->start, c67x00_irq, 0, dev_name(&dev->dev), c67x00);
+	if (ret) {
+		dev_err(&dev->dev, "Cannot claim IRQ\n");
+		goto request_irq_failed;
+	}
+
+	/* Reset c67x00 as part of the initizalization*/
+	printk("C67X00_DBG:c67x00_of_probe() - Low-level reset\n");
+	ret = c67x00_ll_reset(c67x00);
+	if (ret) {
+		printk("Device reset failed\n");
+		dev_err(&dev->dev, "Device reset failed\n");
+		goto reset_failed;
+	}
+
+	/* Probe each of the SIEs */
+	printk("C67X00_DBG:c67x00_of_probe() - Configuring SIEs\n");
+	dev_dbg(&dev->dev, "Configuring SIEs\n");
+	for (i = 0; i < C67X00_SIES; i++)
+		c67x00_probe_sie(&c67x00->sie[i], c67x00, i);
+	printk("C67X00_DBG:c67x00_of_probe() - Saving driver data\n");
+	dev_set_drvdata(&dev->dev, c67x00);
+	return 0;
+
+ reset_failed:
+	free_irq(r_irq->start, c67x00);
+ request_irq_failed:
+	iounmap(c67x00->hpi.base);
+ map_failed:
+	release_mem_region(memory.start, memory.end - memory.start + 1);
+	kfree(pdata);
+ request_mem_failed:
+	kfree(c67x00);
+    
+	return ret;
+}
+
+static int __devexit c67x00_of_remove(struct of_device *dev)
+{
+	struct c67x00_device *c67x00 = dev_get_drvdata(dev);
+	struct resource *res;
+	int i;
+
+	dev_dbg(dev, "c67x00_free(%p)\n", dev);
+
+	for (i = 0; i < C67X00_SIES; i++)
+		c67x00_remove_sie(&c67x00->sie[i]);
+
+	c67x00_ll_release(c67x00);
+
+	//TODO: release IRQ?
+// 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+// 	if (res)
+// 		free_irq(res->start, c67x00);
+
+	iounmap(c67x00->hpi.base);
+
+
+// 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+// 	if (res)
+// 		release_mem_region(res->start, res->end - res->start + 1);
+
+	kfree(c67x00);
+
+	return 0;
+}
+
+/* Match table for of_platform binding */
+static struct of_device_id c67x00_of_match[] __devinitdata = {	
+	{ .compatible = "cy,c67x00", },
+	{ .compatible = "cy,c67300", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, c67x00_of_match);
+
+static struct of_platform_driver c67x00_of_driver = {
+	.owner = THIS_MODULE,
+	.name = "c67x00",
+	.match_table = c67x00_of_match,
+	.probe = c67x00_of_probe,
+	.remove = __devexit_p(c67x00_of_remove),
+	.driver = {
+		.name = "c67x00",
+		.owner = THIS_MODULE,
+	},
+};
+
+/* Registration helpers to keep the number of #ifdefs to a minimum */
+static inline int __init c67x00_of_register(void)
+{
+	pr_debug("c67x00: registering OF binding\n");
+	return of_register_platform_driver(&c67x00_of_driver);
+}
+
+static inline void __exit c67x00_of_unregister(void)
+{
+	of_unregister_platform_driver(&c67x00_of_driver);
+}
+#else /* CONFIG_OF */
+/* CONFIG_OF not enabled; do nothing helpers */
+static inline int __init c67x00_of_register(void) { return 0; }
+static inline void __exit c67x00_of_unregister(void) { }
+#endif /* CONFIG_OF */
+
 static int __init c67x00_init(void)
 {
-	return platform_driver_register(&c67x00_driver);
+	int rc;
+
+	rc = c67x00_of_register();
+	if (rc)
+		goto err_of;
+
+	pr_debug("c67x00: registering platform binding\n");
+        rc = platform_driver_register(&c67x00_driver);
+	if (rc)
+		goto err_plat;
+
+	return 0; 
+
+err_of:
+	c67x00_of_unregister();
+err_plat: 
+	printk("c67x00: registration failed; err:%i\n",rc);
+	return rc; 	
 }
 
 static void __exit c67x00_exit(void)
 {
+	pr_debug("Unregistering c67x00\n"); 
 	platform_driver_unregister(&c67x00_driver);
+        c67x00_of_unregister();
 }
 
 module_init(c67x00_init);
diff --git a/drivers/usb/c67x00/c67x00-ll-hpi.c b/drivers/usb/c67x00/c67x00-ll-hpi.c
index a9636f4..2e7061a 100644
--- a/drivers/usb/c67x00/c67x00-ll-hpi.c
+++ b/drivers/usb/c67x00/c67x00-ll-hpi.c
@@ -219,6 +219,7 @@ void c67x00_ll_hpi_reg_init(struct c67x00_device *dev)
 	for (i = 0; i < C67X00_SIES; i++) {
 		hpi_write_word(dev, SIEMSG_REG(i), 0);
 		hpi_read_word(dev, SIEMSG_REG(i));
+		printk("C67X00_DBG:c67x00_ll_hpi_reg_init(): Reg:%d written=0x00 ; read: %d\n",SIEMSG_REG(i));
 	}
 }
 
@@ -240,8 +241,9 @@ void c67x00_ll_hpi_disable_sofeop(struct c67x00_sie *sie)
 static inline u16 ll_recv_msg(struct c67x00_device *dev)
 {
 	u16 res;
-
+	printk("C67X00_DBG:ll_recv_msg() -  calling wait_for_completion_timeout \n");
 	res = wait_for_completion_timeout(&dev->hpi.lcp.msg_received, 5 * HZ);
+	printk("C67X00_DBG:ll_recv_msg() res=%d\n", res);
 	WARN_ON(!res);
 
 	return (res == 0) ? -EIO : 0;
@@ -388,10 +390,13 @@ void c67x00_ll_irq(struct c67x00_device *dev, u16 int_status)
 int c67x00_ll_reset(struct c67x00_device *dev)
 {
 	int rc;
-
+	
 	mutex_lock(&dev->hpi.lcp.mutex);
+	printk("C67X00_DBG:c67x00_ll_reset() - Send mbox\n");
 	hpi_send_mbox(dev, COMM_RESET);
+	printk("C67X00_DBG:c67x00_ll_reset() - recv_msg\n");
 	rc = ll_recv_msg(dev);
+	printk("C67X00_DBG:c67x00_ll_reset() - done recv_msg\n");
 	mutex_unlock(&dev->hpi.lcp.mutex);
 
 	return rc;

^ permalink raw reply related

* [PATCH] powerpc/perf_counter: Add alignment-faults and emulation-faults sw events
From: Anton Blanchard @ 2009-07-06 12:18 UTC (permalink / raw)
  To: mingo, a.p.zijlstra, paulus, benh; +Cc: linuxppc-dev, linux-kernel


Hook up the alignment-faults and emulation-faults events for powerpc.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Lots of duplication between PPC_WARN_EMULATED() and perf_swcounter_event()
here. Maybe we need to create PPC_WARN_ALIGNMENT(), use it and hide all
calls to perf_swcounter_event in the macros.

Index: linux.trees.git/arch/powerpc/kernel/align.c
===================================================================
--- linux.trees.git.orig/arch/powerpc/kernel/align.c	2009-07-06 21:50:53.000000000 +1000
+++ linux.trees.git/arch/powerpc/kernel/align.c	2009-07-06 22:10:41.000000000 +1000
@@ -25,6 +25,7 @@
 #include <asm/cache.h>
 #include <asm/cputable.h>
 #include <asm/emulated_ops.h>
+#include <linux/perf_counter.h>
 
 struct aligninfo {
 	unsigned char len;
@@ -707,6 +708,9 @@
 	 */
 	CHECK_FULL_REGS(regs);
 
+	perf_swcounter_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs,
+			     regs->nip);
+
 	dsisr = regs->dsisr;
 
 	/* Some processors don't provide us with a DSISR we can use here,
Index: linux.trees.git/arch/powerpc/kernel/traps.c
===================================================================
--- linux.trees.git.orig/arch/powerpc/kernel/traps.c	2009-07-06 21:50:53.000000000 +1000
+++ linux.trees.git/arch/powerpc/kernel/traps.c	2009-07-06 22:11:52.000000000 +1000
@@ -34,6 +34,7 @@
 #include <linux/bug.h>
 #include <linux/kdebug.h>
 #include <linux/debugfs.h>
+#include <linux/perf_counter.h>
 
 #include <asm/emulated_ops.h>
 #include <asm/pgtable.h>
@@ -759,6 +760,8 @@
 
 	/* Emulate the mfspr rD, PVR. */
 	if ((instword & PPC_INST_MFSPR_PVR_MASK) == PPC_INST_MFSPR_PVR) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(mfpvr);
 		rd = (instword >> 21) & 0x1f;
 		regs->gpr[rd] = mfspr(SPRN_PVR);
@@ -767,6 +770,8 @@
 
 	/* Emulating the dcba insn is just a no-op.  */
 	if ((instword & PPC_INST_DCBA_MASK) == PPC_INST_DCBA) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(dcba);
 		return 0;
 	}
@@ -776,6 +781,8 @@
 		int shift = (instword >> 21) & 0x1c;
 		unsigned long msk = 0xf0000000UL >> shift;
 
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(mcrxr);
 		regs->ccr = (regs->ccr & ~msk) | ((regs->xer >> shift) & msk);
 		regs->xer &= ~0xf0000000UL;
@@ -784,18 +791,24 @@
 
 	/* Emulate load/store string insn. */
 	if ((instword & PPC_INST_STRING_GEN_MASK) == PPC_INST_STRING) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(string);
 		return emulate_string_inst(regs, instword);
 	}
 
 	/* Emulate the popcntb (Population Count Bytes) instruction. */
 	if ((instword & PPC_INST_POPCNTB_MASK) == PPC_INST_POPCNTB) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(popcntb);
 		return emulate_popcntb_inst(regs, instword);
 	}
 
 	/* Emulate isel (Integer Select) instruction */
 	if ((instword & PPC_INST_ISEL_MASK) == PPC_INST_ISEL) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(isel);
 		return emulate_isel(regs, instword);
 	}
@@ -994,8 +1007,11 @@
 
 #ifdef CONFIG_MATH_EMULATION
 	errcode = do_mathemu(regs);
-	if (errcode >= 0)
+	if (errcode >= 0) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(math);
+	}
 
 	switch (errcode) {
 	case 0:
@@ -1017,8 +1033,11 @@
 
 #elif defined(CONFIG_8XX_MINIMAL_FPEMU)
 	errcode = Soft_emulate_8xx(regs);
-	if (errcode >= 0)
+	if (errcode >= 0) {
+		perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0,
+				     regs, regs->nip);
 		PPC_WARN_EMULATED(8xx);
+	}
 
 	switch (errcode) {
 	case 0:
@@ -1129,6 +1148,8 @@
 
 	flush_altivec_to_thread(current);
 
+	perf_swcounter_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs,
+			     regs->nip);
 	PPC_WARN_EMULATED(altivec);
 	err = emulate_altivec(regs);
 	if (err == 0) {

^ permalink raw reply

* tcsetattr doesn't change baud rate
From: Landau, Bracha @ 2009-07-06 12:03 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

I have re-ported an application that ran (and worked) on linux kernel 2.6.14 (with Xenomai).
Now it works on linux kernel 2.6.29.4.
When I do tcsetattr to change the baud rate (from 9600 to 38400) the function returns without an error, but does not actually change the baud rate, and it remains at 9600. This is despite using the flag "TCSANOW" when requesting the change.
Any ideas why this is happening?


________________________________
This e-mail is confidential, the property of NDS Ltd and intended for the addressee only. Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited. If you have received this message in error, please immediately notify the postmaster@nds.com and destroy the original message. Messages sent to and from NDS may be monitored. NDS cannot guarantee any message delivery method is secure or error-free. Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission. You should carry out your own virus checks before opening any attachment. Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered Office: One London Road, Staines,Middlesex TW18 4EX, United Kingdom. A company registered in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00

[-- Attachment #2: Type: text/html, Size: 2376 bytes --]

^ permalink raw reply

* Re: sym scsi driver problem with 2.6.26 or newer debian kernel on p610 (fwd)
From: Michael Ellerman @ 2009-07-06  9:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Olof Johansson, linuxppc-dev, debian-powerpc,
	Guennadi Liakhovetski, blackluck
In-Reply-To: <1246143260.22312.66.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

On Sun, 2009-06-28 at 08:54 +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2009-06-27 at 19:46 +0200, Laszlo Fekete wrote:
> > Hello!
> > 
> > Thank you very much, this patch works me too.
> > 
> > Maybe this patch will be in the debian kernel someday?
> 
> The patch isn't actually correct just yet :-) Michael will
> be posting a proper one next week.

.. or the week after:

http://patchwork.ozlabs.org/patch/29475/

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: Inline assembly queries [2]
From: Gabriel Paubert @ 2009-07-06  6:56 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-help, kernel mailz, linux-kernel, linuxppc-dev
In-Reply-To: <m23a9deb87.fsf@igel.home>

On Fri, Jul 03, 2009 at 10:57:12PM +0200, Andreas Schwab wrote:
> Brad Boyer <flar@allandria.com> writes:
> 
> > On Fri, Jul 03, 2009 at 12:14:41PM +0530, kernel mailz wrote:
> >> b. using m or Z  with a memory address. I tried replacing m/Z but no change
> >> Is there some guideline ?
> >> gcc documentation says Z is obsolete. Is m/Z replaceable ?
> >
> > No idea. I don't remember ever seeing 'Z' used in anything. Maybe somebody
> > else remembers what it used to mean.
> 
> The 'Z' constraint is required for a memory operand for insns that don't
> have an update form (which would be selected by the %U modifier).  

Hmmm, I believed that it was for instructions that only have an indexed
form (all Altivec, byte reverse, and l?arx/st?cx for atomic operations).

Of course none of these instructions have an update form, but they don't
have an offset encoded in the instruction either.

	Gabriel

^ permalink raw reply

* [PATCH Resend2] Remove 'SBC8240 Wind River' Device Driver Code
From: Subrata Modak @ 2009-07-06  2:17 UTC (permalink / raw)
  To: linux-mtd
  Cc: carolyn.j.smith, Stephen Rothwell, Jim Cromie, linux-kernel,
	Linuxppc-dev, Sachin P Sant, linux-next, Scott Wood, dwmw2,
	Balbir Singh
In-Reply-To: <20090701135247.27488.10776.sendpatchset@subratamodak.linux.ibm.com>

Hi,

Is there somebody else whom i should also address to get an attention
for this patch ? I apolozise if i have not included someone. Kindly
connect to the concerned.

Regards--
Subrata

On Wed, 2009-07-01 at 19:22 +0530, Subrata Modak wrote:
> Hi,
> 
> Linux next tree(20090626) produced the following build error:
> 
> CC [M]  drivers/mtd/maps/sbc8240.o
> drivers/mtd/maps/sbc8240.c:31:1: warning: "DEBUG" redefined
> In file included from drivers/mtd/maps/sbc8240.c:23:
> include/linux/mtd/mtd.h:333:1: warning: this is the location of the previous definition
> drivers/mtd/maps/sbc8240.c: In function 'init_sbc8240_mtd':
> drivers/mtd/maps/sbc8240.c:172: warning: passing argument 1 of 'simple_map_init' from incompatible pointer type
> drivers/mtd/maps/sbc8240.c:177: error: 'struct mtd_info' has no member named 'module'
> make[3]: *** [drivers/mtd/maps/sbc8240.o] Error 1
> make[2]: *** [drivers/mtd/maps] Error 2
> make[1]: *** [drivers/mtd] Error 2
> make: *** [drivers] Error 2
> 
> I remember reporting this back in April, when it was suggested to remove
> the code as it is no more used:
> http://lkml.org/lkml/2009/4/21/476,
> 
> I tried to gather some more info about this driver from the link
> mentioned in Kconfig:
> http://www.windriver.com/products/sbc8240/,
> without much success.
> 
> The original author of this driver code has no problem, as she has
> expressed by the following mail:
> 
> >On Tue, 2009-06-30 at 09:37 -0700, carolyn.j.smith@tektronix.com wrote:
> >Hello Subrata,
> > 
> > I am the original author of this file and have no objection to its removal
> > from the 2.6 kernel. I added it to the 2.4 kernel when I ported Linux to
> > the SBC8240 board many years ago. I haven't used the board in several years.
> > 
> > Regards,
> > Carolyn
> > 
> 
> Last time i did not address: linux-mtd@lists.infradead.org. If there are
> no issues, can you please apply this patch to remove it ?
> 
> To: linux-mtd@lists.infradead.org,
> Cc: David Woodhouse <dwmw2@infradead.org>,
> Cc: Scott Wood <scottwood@freescale.com>,
> Cc: Jim Cromie <jim.cromie@gmail.com>,
> Cc: carolyn.j.smith@exgate.tek.com,
> Cc: dwmw2@infradead.org,
> Cc: Sachin P Sant <sachinp@linux.vnet.ibm.com>,
> Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
> Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
> Cc: linux-kernel <linux-kernel@vger.kernel.org>,
> Cc: Linuxppc-dev <Linuxppc-dev@ozlabs.org>,
> Cc: linux-next <linux-next@vger.kernel.org>,
> --
> 
> Signed-off-by: Subrata Modak <subrata@linux.vnet.ibm.com>
> Tested-on-PPC64-by: Subrata Modak <subrata@linux.vnet.ibm.com>
> ---
> 
> diff -uprN a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
> --- a/drivers/mtd/maps/Kconfig	2009-06-26 07:36:23.000000000 -0500
> +++ b/drivers/mtd/maps/Kconfig	2009-06-26 07:39:34.000000000 -0500
> @@ -284,13 +284,6 @@ config MTD_L440GX
> 
>  	  BE VERY CAREFUL.
> 
> -config MTD_SBC8240
> -	tristate "Flash device on SBC8240"
> -	depends on MTD_JEDECPROBE && 8260
> -	help
> -          Flash access on the SBC8240 board from Wind River.  See
> -          <http://www.windriver.com/products/sbc8240/>
> -
>  config MTD_TQM8XXL
>  	tristate "CFI Flash device mapped on TQM8XXL"
>  	depends on MTD_CFI && TQM8xxL
> diff -uprN a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
> --- a/drivers/mtd/maps/Makefile	2009-06-26 07:36:23.000000000 -0500
> +++ b/drivers/mtd/maps/Makefile	2009-06-26 07:40:03.000000000 -0500
> @@ -50,7 +50,6 @@ obj-$(CONFIG_MTD_UCLINUX)	+= uclinux.o
>  obj-$(CONFIG_MTD_NETtel)	+= nettel.o
>  obj-$(CONFIG_MTD_SCB2_FLASH)	+= scb2_flash.o
>  obj-$(CONFIG_MTD_H720X)		+= h720x-flash.o
> -obj-$(CONFIG_MTD_SBC8240)	+= sbc8240.o
>  obj-$(CONFIG_MTD_IXP4XX)	+= ixp4xx.o
>  obj-$(CONFIG_MTD_IXP2000)	+= ixp2000.o
>  obj-$(CONFIG_MTD_WRSBC8260)	+= wr_sbc82xx_flash.o
> diff -uprN a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c
> --- a/drivers/mtd/maps/sbc8240.c	2009-06-26 07:36:23.000000000 -0500
> +++ b/drivers/mtd/maps/sbc8240.c	1969-12-31 18:00:00.000000000 -0600
> @@ -1,250 +0,0 @@
> -/*
> - * Handle mapping of the flash memory access routines on the SBC8240 board.
> - *
> - * Carolyn Smith, Tektronix, Inc.
> - *
> - * This code is GPLed
> - */
> -
> -/*
> - * The SBC8240 has 2 flash banks.
> - * Bank 0 is a 512 KiB AMD AM29F040B; 8 x 64 KiB sectors.
> - * It contains the U-Boot code (7 sectors) and the environment (1 sector).
> - * Bank 1 is 4 x 1 MiB AMD AM29LV800BT; 15 x 64 KiB sectors, 1 x 32 KiB sector,
> - * 2 x 8 KiB sectors, 1 x 16 KiB sectors.
> - * Both parts are JEDEC compatible.
> - */
> -
> -#include <linux/module.h>
> -#include <linux/types.h>
> -#include <linux/kernel.h>
> -#include <asm/io.h>
> -
> -#include <linux/mtd/mtd.h>
> -#include <linux/mtd/map.h>
> -#include <linux/mtd/cfi.h>
> -
> -#ifdef CONFIG_MTD_PARTITIONS
> -#include <linux/mtd/partitions.h>
> -#endif
> -
> -#define	DEBUG
> -
> -#ifdef	DEBUG
> -# define debugk(fmt,args...)	printk(fmt ,##args)
> -#else
> -# define debugk(fmt,args...)
> -#endif
> -
> -
> -#define WINDOW_ADDR0	0xFFF00000		/* 512 KiB */
> -#define WINDOW_SIZE0	0x00080000
> -#define BUSWIDTH0	1
> -
> -#define WINDOW_ADDR1	0xFF000000		/* 4 MiB */
> -#define WINDOW_SIZE1	0x00400000
> -#define BUSWIDTH1	8
> -
> -#define MSG_PREFIX "sbc8240:"	/* prefix for our printk()'s */
> -#define MTDID	   "sbc8240-%d"	/* for mtdparts= partitioning */
> -
> -
> -static struct map_info sbc8240_map[2] = {
> -	{
> -		.name           = "sbc8240 Flash Bank #0",
> -		.size           = WINDOW_SIZE0,
> -		.bankwidth       = BUSWIDTH0,
> -	},
> -	{
> -		.name           = "sbc8240 Flash Bank #1",
> -		.size           = WINDOW_SIZE1,
> -		.bankwidth       = BUSWIDTH1,
> -	}
> -};
> -
> -#define NUM_FLASH_BANKS	ARRAY_SIZE(sbc8240_map)
> -
> -/*
> - * The following defines the partition layout of SBC8240 boards.
> - *
> - * See include/linux/mtd/partitions.h for definition of the
> - * mtd_partition structure.
> - *
> - * The *_max_flash_size is the maximum possible mapped flash size
> - * which is not necessarily the actual flash size. It must correspond
> - * to the value specified in the mapping definition defined by the
> - * "struct map_desc *_io_desc" for the corresponding machine.
> - */
> -
> -#ifdef CONFIG_MTD_PARTITIONS
> -
> -static struct mtd_partition sbc8240_uboot_partitions [] = {
> -	/* Bank 0 */
> -	{
> -		.name =	"U-boot",			/* U-Boot Firmware	*/
> -		.offset =	0,
> -		.size =	0x00070000,			/*  7 x 64 KiB sectors 	*/
> -		.mask_flags = MTD_WRITEABLE,		/*  force read-only	*/
> -	},
> -	{
> -		.name =	"environment",			/* U-Boot environment	*/
> -		.offset =	0x00070000,
> -		.size =	0x00010000,			/*  1 x 64 KiB sector	*/
> -	},
> -};
> -
> -static struct mtd_partition sbc8240_fs_partitions [] = {
> -	{
> -		.name =	"jffs",				/* JFFS  filesystem	*/
> -		.offset =	0,
> -		.size =	0x003C0000,			/*  4 * 15 * 64KiB	*/
> -	},
> -	{
> -		.name =	"tmp32",
> -		.offset =	0x003C0000,
> -		.size =	0x00020000,			/*  4 * 32KiB		*/
> -	},
> -	{
> -		.name =	"tmp8a",
> -		.offset =	0x003E0000,
> -		.size =	0x00008000,			/*  4 * 8KiB		*/
> -	},
> -	{
> -		.name =	"tmp8b",
> -		.offset =	0x003E8000,
> -		.size =	0x00008000,			/*  4 * 8KiB		*/
> -	},
> -	{
> -		.name =	"tmp16",
> -		.offset =	0x003F0000,
> -		.size =	0x00010000,			/*  4 * 16KiB		*/
> -	}
> -};
> -
> -/* trivial struct to describe partition information */
> -struct mtd_part_def
> -{
> -	int nums;
> -	unsigned char *type;
> -	struct mtd_partition* mtd_part;
> -};
> -
> -static struct mtd_info *sbc8240_mtd[NUM_FLASH_BANKS];
> -static struct mtd_part_def sbc8240_part_banks[NUM_FLASH_BANKS];
> -
> -
> -#endif	/* CONFIG_MTD_PARTITIONS */
> -
> -
> -static int __init init_sbc8240_mtd (void)
> -{
> -	static struct _cjs {
> -		u_long addr;
> -		u_long size;
> -	} pt[NUM_FLASH_BANKS] = {
> -		{
> -			.addr = WINDOW_ADDR0,
> -			.size = WINDOW_SIZE0
> -		},
> -		{
> -			.addr = WINDOW_ADDR1,
> -			.size = WINDOW_SIZE1
> -		},
> -	};
> -
> -	int devicesfound = 0;
> -	int i,j;
> -
> -	for (i = 0; i < NUM_FLASH_BANKS; i++) {
> -		printk (KERN_NOTICE MSG_PREFIX
> -			"Probing 0x%08lx at 0x%08lx\n", pt[i].size, pt[i].addr);
> -
> -		sbc8240_map[i].map_priv_1 =
> -			(unsigned long) ioremap (pt[i].addr, pt[i].size);
> -		if (!sbc8240_map[i].map_priv_1) {
> -			printk (MSG_PREFIX "failed to ioremap\n");
> -			for (j = 0; j < i; j++) {
> -				iounmap((void *) sbc8240_map[j].map_priv_1);
> -				sbc8240_map[j].map_priv_1 = 0;
> -			}
> -			return -EIO;
> -		}
> -		simple_map_init(&sbc8240_mtd[i]);
> -
> -		sbc8240_mtd[i] = do_map_probe("jedec_probe", &sbc8240_map[i]);
> -
> -		if (sbc8240_mtd[i]) {
> -			sbc8240_mtd[i]->module = THIS_MODULE;
> -			devicesfound++;
> -		} else {
> -			if (sbc8240_map[i].map_priv_1) {
> -				iounmap((void *) sbc8240_map[i].map_priv_1);
> -				sbc8240_map[i].map_priv_1 = 0;
> -			}
> -		}
> -	}
> -
> -	if (!devicesfound) {
> -		printk(KERN_NOTICE MSG_PREFIX
> -		       "No suppported flash chips found!\n");
> -		return -ENXIO;
> -	}
> -
> -#ifdef CONFIG_MTD_PARTITIONS
> -	sbc8240_part_banks[0].mtd_part   = sbc8240_uboot_partitions;
> -	sbc8240_part_banks[0].type       = "static image";
> -	sbc8240_part_banks[0].nums       = ARRAY_SIZE(sbc8240_uboot_partitions);
> -	sbc8240_part_banks[1].mtd_part   = sbc8240_fs_partitions;
> -	sbc8240_part_banks[1].type       = "static file system";
> -	sbc8240_part_banks[1].nums       = ARRAY_SIZE(sbc8240_fs_partitions);
> -
> -	for (i = 0; i < NUM_FLASH_BANKS; i++) {
> -
> -		if (!sbc8240_mtd[i]) continue;
> -		if (sbc8240_part_banks[i].nums == 0) {
> -			printk (KERN_NOTICE MSG_PREFIX
> -				"No partition info available, registering whole device\n");
> -			add_mtd_device(sbc8240_mtd[i]);
> -		} else {
> -			printk (KERN_NOTICE MSG_PREFIX
> -				"Using %s partition definition\n", sbc8240_part_banks[i].mtd_part->name);
> -			add_mtd_partitions (sbc8240_mtd[i],
> -					    sbc8240_part_banks[i].mtd_part,
> -					    sbc8240_part_banks[i].nums);
> -		}
> -	}
> -#else
> -	printk(KERN_NOTICE MSG_PREFIX
> -	       "Registering %d flash banks at once\n", devicesfound);
> -
> -	for (i = 0; i < devicesfound; i++) {
> -		add_mtd_device(sbc8240_mtd[i]);
> -	}
> -#endif	/* CONFIG_MTD_PARTITIONS */
> -
> -	return devicesfound == 0 ? -ENXIO : 0;
> -}
> -
> -static void __exit cleanup_sbc8240_mtd (void)
> -{
> -	int i;
> -
> -	for (i = 0; i < NUM_FLASH_BANKS; i++) {
> -		if (sbc8240_mtd[i]) {
> -			del_mtd_device (sbc8240_mtd[i]);
> -			map_destroy (sbc8240_mtd[i]);
> -		}
> -		if (sbc8240_map[i].map_priv_1) {
> -			iounmap ((void *) sbc8240_map[i].map_priv_1);
> -			sbc8240_map[i].map_priv_1 = 0;
> -		}
> -	}
> -}
> -
> -module_init (init_sbc8240_mtd);
> -module_exit (cleanup_sbc8240_mtd);
> -
> -MODULE_LICENSE ("GPL");
> -MODULE_AUTHOR ("Carolyn Smith <carolyn.smith@tektronix.com>");
> -MODULE_DESCRIPTION ("MTD map driver for SBC8240 boards");
> -
> 
> ---
> Regards--
> Subrata
> 

^ permalink raw reply

* [PATCH] powerpc/mpic: Fix MPIC_BROKEN_REGREAD on non broken MPICs
From: Michael Ellerman @ 2009-07-06  2:08 UTC (permalink / raw)
  To: linuxppc-dev

The workaround enabled by CONFIG_MPIC_BROKEN_REGREAD does not work
on non-broken MPICs. The symptom is no interrupts being received.

The fix is twofold. Firstly the code was broken for multiple isus,
we need to index into the shadow array with the src_no, not the idx.
Secondly, we always do the read, but only use the VECPRI_MASK and
VECPRI_ACTIVITY bits from the hardware, the rest of "val" comes
from the shadow.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/sysdev/mpic.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 82e8e88..e35ecf5 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -230,14 +230,16 @@ static inline u32 _mpic_irq_read(struct mpic *mpic, unsigned int src_no, unsigne
 {
 	unsigned int	isu = src_no >> mpic->isu_shift;
 	unsigned int	idx = src_no & mpic->isu_mask;
+	unsigned int	val;
 
+	val = _mpic_read(mpic->reg_type, &mpic->isus[isu],
+			 reg + (idx * MPIC_INFO(IRQ_STRIDE)));
 #ifdef CONFIG_MPIC_BROKEN_REGREAD
 	if (reg == 0)
-		return mpic->isu_reg0_shadow[idx];
-	else
+		val = (val & (MPIC_VECPRI_MASK | MPIC_VECPRI_ACTIVITY)) |
+			mpic->isu_reg0_shadow[src_no];
 #endif
-		return _mpic_read(mpic->reg_type, &mpic->isus[isu],
-				  reg + (idx * MPIC_INFO(IRQ_STRIDE)));
+	return val;
 }
 
 static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no,
@@ -251,7 +253,8 @@ static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no,
 
 #ifdef CONFIG_MPIC_BROKEN_REGREAD
 	if (reg == 0)
-		mpic->isu_reg0_shadow[idx] = value;
+		mpic->isu_reg0_shadow[src_no] =
+			value & ~(MPIC_VECPRI_MASK | MPIC_VECPRI_ACTIVITY);
 #endif
 }
 
-- 
1.6.2.1

^ permalink raw reply related

* Re: Delay on intialization ide subsystem(most likely)
From: Andrey Gusev @ 2009-07-05 11:17 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linuxppc-dev, petkovbb, linux-ide
In-Reply-To: <200906101344.30057.bzolnier@gmail.com>

On Wed, 10 Jun 2009 13:44:29 +0200
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:

> On Tuesday 09 June 2009 01:26:27 Benjamin Herrenschmidt wrote:
> > On Mon, 2009-06-08 at 22:20 +0200, Bartlomiej Zolnierkiewicz wrote:
> > 
> > > > [   70.584122]  hdb:<3>ide-pmac lost interrupt, dma status: 8480
> > > 
> > > DMA status indicates that DMA transfer is still active according
> > > to the controller.  This one is really a platform/hardware
> > > specific issue.
> > 
> > I've partially missed that thread. Is the a bugzilla entry or
> 
> There is no bugzilla entry currently so please check mailing list
> archives for previous discussion.
> 
> > something ? Is this a regression ?
> 
> At least not a recent one (it happens since at least 2.6.24).
> 

Delay is fixed itself in 2.6.31-rc2. Most likely it was platform specific issue. But lost interrupt still exists.
There is log of 2.6.31-rc2:

[    1.595268] MacIO PCI driver attached to Keylargo chipset
[    1.597024] irq: irq 32 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 32
[    1.597988] irq: irq 19 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 19
[    1.598024] irq: irq 11 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 16
[    1.598365] irq: irq 20 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 20
[    1.598401] irq: irq 12 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 17
[    1.598762] irq: irq 5 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 18
[    1.598797] irq: irq 6 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 21
[    1.599264] irq: irq 7 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 24
[    1.599300] irq: irq 8 on host /pci@f2000000/mac-io@17/interrupt-controller@40000 mapped to virtual irq 29
[    1.601336] Uniform Multi-Platform E-IDE driver
[    1.602201] ide-pmac 0002:20:0d.0: enabling device (0000 -> 0002)
[    2.630651] ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
[    2.630767] Probing IDE interface ide0...
[    2.930834] hda: IBM-IC35L060AVVA07-0, ATA DISK drive
[    3.290646] hdb: QUANTUM FIREBALLP LM20.5, ATA DISK drive
[    3.291087] hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
[    3.291264] hda: UDMA/100 mode selected
[    3.291473] hdb: host max PIO4 wanted PIO255(auto-tune) selected PIO4
[    3.291720] hdb: UDMA/66 mode selected
[    3.292118] ide0 at 0xf10c2000-0xf10c2070,0xf10c2160 on irq 39
[    4.320649] ide-pmac: Found Apple KeyLargo ATA-4 controller (macio), bus ID 2, irq 19
[    4.320753] Probing IDE interface ide1...
[    4.921004] ide1 at 0xf10ba000-0xf10ba070,0xf10ba160 on irq 19
[    5.950647] ide-pmac: Found Apple KeyLargo ATA-3 controller (macio), bus ID 0, irq 20
[    5.950743] Probing IDE interface ide2...
[    6.370828] hde: PHILIPS CDD5101, ATAPI CD/DVD-ROM drive
[    6.730948] hde: host max PIO4 wanted PIO255(auto-tune) selected PIO4
[    6.731332] hde: MWDMA2 mode selected
[    6.731832] ide2 at 0xf10be000-0xf10be070,0xf10be160 on irq 20
[    6.732558] ide-gd driver 1.18
[    6.732735] hda: max request size: 128KiB
[    6.763392] hda: 120103200 sectors (61492 MB) w/1863KiB Cache, CHS=65535/16/63
[    6.763741] hda: cache flushes supported
[    6.764277]  hda: [mac] hda1 hda2 hda3 hda4
[    6.770469] hdb: max request size: 128KiB
[    6.803427] hdb: Host Protected Area detected.
[    6.803431] 	current capacity is 40130390 sectors (20546 MB)
[    6.803435] 	native  capacity is 40132503 sectors (20547 MB)
[    6.803590] hdb: 40130390 sectors (20546 MB) w/1900KiB Cache, CHS=39811/16/63
[    6.803684] hdb: cache flushes not supported
[    6.803910]  hdb:
[   26.800743] ide-pmac lost interrupt, dma status: 8480
[   26.800809] hdb: lost interrupt
[   26.800850] hdb: dma_intr: status=0x58 { DriveReady SeekComplete DataRequest }
[   26.800976] hdb: possibly failed opcode: 0xc8
[   26.803449] hda: DMA disabled
[   26.805664] hdb: DMA disabled
[   26.900633] ide0: reset: success
[   26.949147]  hdb1 hdb2 < hdb5 hdb6 hdb7 hdb8 >
[   27.007890] ide-cd driver 5.00
[   27.011728] ide-cd: hde: ATAPI 32X DVD-ROM CD-R/RW drive, 8192kB Cache
[   27.014163] Uniform CD-ROM driver Revision: 3.20

^ permalink raw reply

* [PATCH] net: fix OF fixed-link property handling on Freescale network device drivers
From: Grant Likely @ 2009-07-03 22:20 UTC (permalink / raw)
  To: avorontsov, davem, leoli, afleming, netdev, linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>

The MDIO rework patches broke the handling of fixed MII links.  This
patch adds parsing of the fixed-link property to the gianfar, ucc-geth
and fs_eth network drivers, and ensures that the MAC will work without
a PHY attachment.

Note: This patch does not use the dummy phy approach previously used as I
think it is an abuse of the MDIO bus infrastructure and it doesn't account
for the possibility of MAC devices using a different binding for the
values in the fixed-link property.  The current dummy phy setup code
(which this patch removes) assumes the same data format for all fixed-link
properties which is a bad assumption.  fixed-link has not been standardized
for use by all Ethernet drivers.

If a generic interface is needed to control xMII speed, then I think it
would be better to compartmentalize the link speed interface and adapt
both phylib and fixed-link code to use it.  That would also provide
an interface for non-phy, non-MDIO devices to manipulate the link state
without pretending to be something that doesn't exist.  I think this
would be a simpler and more 'tasteful' structure for handling non-phy
cases.

This patch is not perfect, and I'm not sure that I'm programming the
speed registers in the best place (at of_phy_connect() time as opposed to
phy_start() time), but it does fix the fixed-link handling and keeps the
binding properly contained within the driver, so I think it is the right
approach for solving the fixed-link regression that I caused in 2.6.31.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
Anton, can you please review, comment and test?  I've tested it on an
mpc8349 board, but that is the only hardware that I have.  I've also
probably made mistakes and it needs to be split up into separate patches,
but this is probably a sufficient form for first review.  I'll also give
it another once over tomorrow when after I've had a decent night sleep.

Cheers,
g.


 arch/powerpc/sysdev/fsl_soc.c      |   31 --------
 drivers/net/fs_enet/fs_enet-main.c |   38 +++++-----
 drivers/net/gianfar.c              |  122 +++++++++++++++++---------------
 drivers/net/phy/phy.c              |   12 +++
 drivers/net/phy/phy_device.c       |    3 +
 drivers/net/ucc_geth.c             |  138 +++++++++++++++++++-----------------
 6 files changed, 172 insertions(+), 172 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 95dbc64..0b969c6 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -177,37 +177,6 @@ u32 get_baudrate(void)
 EXPORT_SYMBOL(get_baudrate);
 #endif /* CONFIG_CPM2 */
 
-#ifdef CONFIG_FIXED_PHY
-static int __init of_add_fixed_phys(void)
-{
-	int ret;
-	struct device_node *np;
-	u32 *fixed_link;
-	struct fixed_phy_status status = {};
-
-	for_each_node_by_name(np, "ethernet") {
-		fixed_link  = (u32 *)of_get_property(np, "fixed-link", NULL);
-		if (!fixed_link)
-			continue;
-
-		status.link = 1;
-		status.duplex = fixed_link[1];
-		status.speed = fixed_link[2];
-		status.pause = fixed_link[3];
-		status.asym_pause = fixed_link[4];
-
-		ret = fixed_phy_add(PHY_POLL, fixed_link[0], &status);
-		if (ret) {
-			of_node_put(np);
-			return ret;
-		}
-	}
-
-	return 0;
-}
-arch_initcall(of_add_fixed_phys);
-#endif /* CONFIG_FIXED_PHY */
-
 static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
 {
 	if (!phy_type)
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index b892c3a..39244b2 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -722,8 +722,6 @@ static void generic_adjust_link(struct  net_device *dev)
 	} else if (fep->oldlink) {
 		new_state = 1;
 		fep->oldlink = 0;
-		fep->oldspeed = 0;
-		fep->oldduplex = -1;
 	}
 
 	if (new_state && netif_msg_link(fep))
@@ -749,25 +747,21 @@ static void fs_adjust_link(struct net_device *dev)
 static int fs_init_phy(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	struct phy_device *phydev;
 
-	fep->oldlink = 0;
-	fep->oldspeed = 0;
-	fep->oldduplex = -1;
+	/* If a link is already flagged, then set up initial state */
+	if (fep->oldlink) {
+		netif_carrier_on(dev);
+		fep->ops->restart(dev);
+	}
+
 	if(fep->fpi->phy_node)
-		phydev = of_phy_connect(dev, fep->fpi->phy_node,
+	fep->phydev = of_phy_connect(dev, fep->fpi->phy_node,
 					&fs_adjust_link, 0,
 					PHY_INTERFACE_MODE_MII);
-	else {
-		printk("No phy bus ID specified in BSP code\n");
+	if (!fep->phydev && !fep->oldlink) {
+		dev_err(&dev->dev, "Could not attach to PHY\n");
 		return -EINVAL;
 	}
-	if (IS_ERR(phydev)) {
-		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
-		return PTR_ERR(phydev);
-	}
-
-	fep->phydev = phydev;
 
 	return 0;
 }
@@ -990,10 +984,8 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
 	fpi->rx_copybreak = 240;
 	fpi->use_napi = 1;
 	fpi->napi_weight = 17;
+
 	fpi->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0);
-	if ((!fpi->phy_node) && (!of_get_property(ofdev->node, "fixed-link",
-						  NULL)))
-		goto out_free_fpi;
 
 	privsize = sizeof(*fep) +
 	           sizeof(struct sk_buff **) *
@@ -1013,6 +1005,16 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
 	fep->fpi = fpi;
 	fep->ops = match->data;
 
+	/* Setup the initial link state */
+	data = of_get_property(ofdev->node, "fixed-link", &len);
+	if (data && len >= sizeof(*data) * 3) {
+		fep->oldlink = 1;
+		fep->oldduplex = data[1];
+		fep->oldspeed = data[2];
+	}
+	if (!fpi->phy_node && !fep->oldlink)
+		goto out_free_dev;
+
 	ret = fep->ops->setup_data(ndev);
 	if (ret)
 		goto out_free_dev;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 4ae1d25..3cb33e9 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -90,7 +90,6 @@
 #include <linux/crc32.h>
 #include <linux/mii.h>
 #include <linux/phy.h>
-#include <linux/phy_fixed.h>
 #include <linux/of.h>
 
 #include "gianfar.h"
@@ -179,6 +178,8 @@ static int gfar_of_init(struct net_device *dev)
 	const u32 *stash;
 	const u32 *stash_len;
 	const u32 *stash_idx;
+	const u32 *prop;
+	int prop_sz;
 
 	if (!np || !of_device_is_available(np))
 		return -ENODEV;
@@ -261,15 +262,18 @@ static int gfar_of_init(struct net_device *dev)
 	if (of_get_property(np, "fsl,magic-packet", NULL))
 		priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
 
-	priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
-	if (!priv->phy_node) {
-		u32 *fixed_link;
+	/* Setup the initial link state */
+	prop = of_get_property(np, "fixed-link", &prop_sz);
+	if (prop && prop_sz >= sizeof(*prop) * 3) {
+		priv->oldlink = 1;
+		priv->oldduplex = prop[1];
+		priv->oldspeed = prop[2];
+	}
 
-		fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL);
-		if (!fixed_link) {
-			err = -ENODEV;
-			goto err_out;
-		}
+	priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
+	if (!priv->phy_node && !priv->oldlink) {
+		err = -ENODEV;
+		goto err_out;
 	}
 
 	/* Find the TBI PHY.  If it's not there, we don't support SGMII */
@@ -639,6 +643,48 @@ static phy_interface_t gfar_get_interface(struct net_device *dev)
 	return PHY_INTERFACE_MODE_MII;
 }
 
+/**
+ * gfar_set_link - program MAC for current MII link speed
+ */
+static void gfar_set_link(struct net_device *dev)
+{
+	struct gfar_private *priv = netdev_priv(dev);
+	struct gfar __iomem *regs = priv->regs;
+	u32 tempval = gfar_read(&regs->maccfg2);
+	u32 ecntrl = gfar_read(&regs->ecntrl);
+
+	if (priv->oldduplex)
+		tempval |= MACCFG2_FULL_DUPLEX;
+	else
+		tempval &= ~(MACCFG2_FULL_DUPLEX);
+
+	switch (priv->oldspeed) {
+	case 1000:
+		tempval = ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII);
+		ecntrl &= ~(ECNTRL_R100);
+		break;
+	case 100:
+	case 10:
+		tempval = ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII);
+		/* Reduced mode distinguishes
+		 * between 10 and 100 */
+		if (priv->oldspeed == SPEED_100)
+			ecntrl |= ECNTRL_R100;
+		else
+			ecntrl &= ~(ECNTRL_R100);
+		break;
+	default:
+		if (netif_msg_link(priv))
+			dev_err(&dev->dev,
+				"error: speed (%d) is not 10/100/1000!\n",
+				priv->oldspeed);
+		break;
+	}
+
+	gfar_write(&regs->maccfg2, tempval);
+	gfar_write(&regs->ecntrl, ecntrl);
+}
+
 
 /* Initializes driver's PHY state, and attaches to the PHY.
  * Returns 0 on success.
@@ -651,9 +697,10 @@ static int init_phy(struct net_device *dev)
 		SUPPORTED_1000baseT_Full : 0;
 	phy_interface_t interface;
 
-	priv->oldlink = 0;
-	priv->oldspeed = 0;
-	priv->oldduplex = -1;
+	if (priv->oldlink) {
+		netif_carrier_on(dev);
+		gfar_set_link(dev);
+	}
 
 	interface = gfar_get_interface(dev);
 
@@ -664,15 +711,15 @@ static int init_phy(struct net_device *dev)
 			dev_err(&dev->dev, "error: Could not attach to PHY\n");
 			return -ENODEV;
 		}
+
+		/* Remove any features not supported by the controller */
+		priv->phydev->supported &= (GFAR_SUPPORTED | gigabit_support);
+		priv->phydev->advertising = priv->phydev->supported;
 	}
 
 	if (interface == PHY_INTERFACE_MODE_SGMII)
 		gfar_configure_serdes(dev);
 
-	/* Remove any features not supported by the controller */
-	priv->phydev->supported &= (GFAR_SUPPORTED | gigabit_support);
-	priv->phydev->advertising = priv->phydev->supported;
-
 	return 0;
 }
 
@@ -2013,72 +2060,33 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id)
 static void adjust_link(struct net_device *dev)
 {
 	struct gfar_private *priv = netdev_priv(dev);
-	struct gfar __iomem *regs = priv->regs;
 	unsigned long flags;
 	struct phy_device *phydev = priv->phydev;
 	int new_state = 0;
 
 	spin_lock_irqsave(&priv->txlock, flags);
 	if (phydev->link) {
-		u32 tempval = gfar_read(&regs->maccfg2);
-		u32 ecntrl = gfar_read(&regs->ecntrl);
-
 		/* Now we make sure that we can be in full duplex mode.
 		 * If not, we operate in half-duplex mode. */
 		if (phydev->duplex != priv->oldduplex) {
 			new_state = 1;
-			if (!(phydev->duplex))
-				tempval &= ~(MACCFG2_FULL_DUPLEX);
-			else
-				tempval |= MACCFG2_FULL_DUPLEX;
-
 			priv->oldduplex = phydev->duplex;
 		}
 
 		if (phydev->speed != priv->oldspeed) {
 			new_state = 1;
-			switch (phydev->speed) {
-			case 1000:
-				tempval =
-				    ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII);
-
-				ecntrl &= ~(ECNTRL_R100);
-				break;
-			case 100:
-			case 10:
-				tempval =
-				    ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII);
-
-				/* Reduced mode distinguishes
-				 * between 10 and 100 */
-				if (phydev->speed == SPEED_100)
-					ecntrl |= ECNTRL_R100;
-				else
-					ecntrl &= ~(ECNTRL_R100);
-				break;
-			default:
-				if (netif_msg_link(priv))
-					printk(KERN_WARNING
-						"%s: Ack!  Speed (%d) is not 10/100/1000!\n",
-						dev->name, phydev->speed);
-				break;
-			}
-
 			priv->oldspeed = phydev->speed;
 		}
 
-		gfar_write(&regs->maccfg2, tempval);
-		gfar_write(&regs->ecntrl, ecntrl);
-
 		if (!priv->oldlink) {
 			new_state = 1;
 			priv->oldlink = 1;
 		}
+
+		gfar_set_link(dev);
 	} else if (priv->oldlink) {
 		new_state = 1;
 		priv->oldlink = 0;
-		priv->oldspeed = 0;
-		priv->oldduplex = -1;
 	}
 
 	if (new_state && netif_msg_link(priv))
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 61755cb..021ead9 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -314,6 +314,9 @@ int phy_mii_ioctl(struct phy_device *phydev,
 {
 	u16 val = mii_data->val_in;
 
+	if (!phydev)
+		return -EOPNOTSUPP;
+
 	switch (cmd) {
 	case SIOCGMIIPHY:
 		mii_data->phy_id = phydev->addr;
@@ -385,6 +388,9 @@ int phy_start_aneg(struct phy_device *phydev)
 {
 	int err;
 
+	if (!phydev)
+		return -ENODEV;
+
 	mutex_lock(&phydev->lock);
 
 	if (AUTONEG_DISABLE == phydev->autoneg)
@@ -703,6 +709,9 @@ phy_err:
  */
 void phy_stop(struct phy_device *phydev)
 {
+	if (!phydev)
+		return;
+
 	mutex_lock(&phydev->lock);
 
 	if (PHY_HALTED == phydev->state)
@@ -741,6 +750,9 @@ out_unlock:
  */
 void phy_start(struct phy_device *phydev)
 {
+	if (!phydev)
+		return;
+
 	mutex_lock(&phydev->lock);
 
 	switch (phydev->state) {
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index eba937c..32e5934 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -365,6 +365,9 @@ EXPORT_SYMBOL(phy_connect);
  */
 void phy_disconnect(struct phy_device *phydev)
 {
+	if (!phydev)
+		return;
+
 	if (phydev->irq > 0)
 		phy_stop_interrupts(phydev);
 
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 40c6eba..c216cd5 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1443,6 +1443,53 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
 	return 0;
 }
 
+static void ugeth_set_link(struct net_device *dev)
+{
+	struct ucc_geth_private *ugeth = netdev_priv(dev);
+	struct phy_device *phydev = ugeth->phydev;
+	struct ucc_geth __iomem *ug_regs = ugeth->ug_regs;
+	struct ucc_fast __iomem *uf_regs = ugeth->uccf->uf_regs;
+	u32 tempval = in_be32(&ug_regs->maccfg2);
+	u32 upsmr = in_be32(&uf_regs->upsmr);
+
+	if (ugeth->oldduplex)
+		tempval |= MACCFG2_FDX;
+	else
+		tempval &= ~(MACCFG2_FDX);
+
+	switch (ugeth->oldspeed) {
+	case SPEED_1000:
+		tempval = ((tempval & ~(MACCFG2_INTERFACE_MODE_MASK)) |
+					MACCFG2_INTERFACE_MODE_BYTE);
+		break;
+	case SPEED_100:
+	case SPEED_10:
+		tempval = ((tempval & ~(MACCFG2_INTERFACE_MODE_MASK)) |
+					MACCFG2_INTERFACE_MODE_NIBBLE);
+		/* if reduced mode, re-set UPSMR.R10M */
+		if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
+		    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
+		    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
+		    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
+		    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
+		    (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
+			if (ugeth->oldspeed == SPEED_10)
+				upsmr |= UCC_GETH_UPSMR_R10M;
+			else
+				upsmr &= ~UCC_GETH_UPSMR_R10M;
+		}
+		break;
+	default:
+		if (netif_msg_link(ugeth))
+			ugeth_warn("%s: Ack!  Speed (%d) is not 10/100/1000!",
+				   dev->name, phydev->speed);
+		break;
+	}
+
+	out_be32(&ug_regs->maccfg2, tempval);
+	out_be32(&uf_regs->upsmr, upsmr);
+}
+
 /* Called every time the controller might need to be made
  * aware of new link state.  The PHY code conveys this
  * information through variables in the ugeth structure, and this
@@ -1453,79 +1500,34 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
 static void adjust_link(struct net_device *dev)
 {
 	struct ucc_geth_private *ugeth = netdev_priv(dev);
-	struct ucc_geth __iomem *ug_regs;
-	struct ucc_fast __iomem *uf_regs;
 	struct phy_device *phydev = ugeth->phydev;
 	unsigned long flags;
 	int new_state = 0;
 
-	ug_regs = ugeth->ug_regs;
-	uf_regs = ugeth->uccf->uf_regs;
-
 	spin_lock_irqsave(&ugeth->lock, flags);
 
 	if (phydev->link) {
-		u32 tempval = in_be32(&ug_regs->maccfg2);
-		u32 upsmr = in_be32(&uf_regs->upsmr);
 		/* Now we make sure that we can be in full duplex mode.
 		 * If not, we operate in half-duplex mode. */
 		if (phydev->duplex != ugeth->oldduplex) {
 			new_state = 1;
-			if (!(phydev->duplex))
-				tempval &= ~(MACCFG2_FDX);
-			else
-				tempval |= MACCFG2_FDX;
 			ugeth->oldduplex = phydev->duplex;
 		}
 
 		if (phydev->speed != ugeth->oldspeed) {
 			new_state = 1;
-			switch (phydev->speed) {
-			case SPEED_1000:
-				tempval = ((tempval &
-					    ~(MACCFG2_INTERFACE_MODE_MASK)) |
-					    MACCFG2_INTERFACE_MODE_BYTE);
-				break;
-			case SPEED_100:
-			case SPEED_10:
-				tempval = ((tempval &
-					    ~(MACCFG2_INTERFACE_MODE_MASK)) |
-					    MACCFG2_INTERFACE_MODE_NIBBLE);
-				/* if reduced mode, re-set UPSMR.R10M */
-				if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
-				    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
-				    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
-				    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
-				    (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
-				    (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
-					if (phydev->speed == SPEED_10)
-						upsmr |= UCC_GETH_UPSMR_R10M;
-					else
-						upsmr &= ~UCC_GETH_UPSMR_R10M;
-				}
-				break;
-			default:
-				if (netif_msg_link(ugeth))
-					ugeth_warn(
-						"%s: Ack!  Speed (%d) is not 10/100/1000!",
-						dev->name, phydev->speed);
-				break;
-			}
 			ugeth->oldspeed = phydev->speed;
 		}
 
-		out_be32(&ug_regs->maccfg2, tempval);
-		out_be32(&uf_regs->upsmr, upsmr);
-
 		if (!ugeth->oldlink) {
 			new_state = 1;
 			ugeth->oldlink = 1;
 		}
+
+		ugeth_set_link(dev);
 	} else if (ugeth->oldlink) {
-			new_state = 1;
-			ugeth->oldlink = 0;
-			ugeth->oldspeed = 0;
-			ugeth->oldduplex = -1;
+		new_state = 1;
+		ugeth->oldlink = 0;
 	}
 
 	if (new_state && netif_msg_link(ugeth))
@@ -1586,9 +1588,11 @@ static int init_phy(struct net_device *dev)
 	struct ucc_geth_info *ug_info = priv->ug_info;
 	struct phy_device *phydev;
 
-	priv->oldlink = 0;
-	priv->oldspeed = 0;
-	priv->oldduplex = -1;
+	/* If link is marked as up, then set initial link speed */
+	if (priv->oldlink) {
+		netif_carrier_on(dev);
+		ugeth_set_link(dev);
+	}
 
 	if (!ug_info->phy_node)
 		return 0;
@@ -2042,7 +2046,6 @@ static void ucc_geth_set_multi(struct net_device *dev)
 static void ucc_geth_stop(struct ucc_geth_private *ugeth)
 {
 	struct ucc_geth __iomem *ug_regs = ugeth->ug_regs;
-	struct phy_device *phydev = ugeth->phydev;
 
 	ugeth_vdbg("%s: IN", __func__);
 
@@ -2050,7 +2053,7 @@ static void ucc_geth_stop(struct ucc_geth_private *ugeth)
 	ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
 
 	/* Tell the kernel the link is down */
-	phy_stop(phydev);
+	phy_stop(ugeth->phydev);
 
 	/* Mask all interrupts */
 	out_be32(ugeth->uccf->p_uccm, 0x00000000);
@@ -3608,10 +3611,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 	struct ucc_geth_private *ugeth = NULL;
 	struct ucc_geth_info *ug_info;
 	struct resource res;
-	struct device_node *phy;
 	int err, ucc_num, max_speed = 0;
-	const u32 *fixed_link;
-	const unsigned int *prop;
+	const u32 *prop;
+	int prop_sz;
 	const char *sprop;
 	const void *mac_addr;
 	phy_interface_t phy_interface;
@@ -3708,15 +3710,19 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 
 	ug_info->uf_info.regs = res.start;
 	ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
-	fixed_link = of_get_property(np, "fixed-link", NULL);
-	if (fixed_link) {
-		phy = NULL;
-	} else {
-		phy = of_parse_phandle(np, "phy-handle", 0);
-		if (phy == NULL)
-			return -ENODEV;
+
+	/* Setup the initial link state */
+	prop = of_get_property(np, "fixed-link", &prop_sz);
+	if (prop && prop_sz >= sizeof(*prop) * 3) {
+		ugeth->oldlink = 1;
+		ugeth->oldduplex = prop[1];
+		ugeth->oldspeed = prop[2];
 	}
-	ug_info->phy_node = phy;
+
+	/* Find the phy.  Bail if there is no phy and no initial link speed */
+	ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
+	if (!ug_info->phy_node && !ugeth->oldlink)
+		return -ENODEV;
 
 	/* Find the TBI PHY node.  If it's not there, we don't support SGMII */
 	ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
@@ -3725,7 +3731,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 	prop = of_get_property(np, "phy-connection-type", NULL);
 	if (!prop) {
 		/* handle interface property present in old trees */
-		prop = of_get_property(phy, "interface", NULL);
+		prop = of_get_property(ug_info->phy_node, "interface", NULL);
 		if (prop != NULL) {
 			phy_interface = enet_to_phy_interface[*prop];
 			max_speed = enet_to_speed[*prop];

^ permalink raw reply related

* Re: Inline assembly queries [2]
From: Andreas Schwab @ 2009-07-03 21:19 UTC (permalink / raw)
  To: kernel mailz; +Cc: linuxppc-dev, linux-kernel, gcc-help
In-Reply-To: <abe8a1fd0907031305r5cb9e2e8pec170bffb1c497ff@mail.gmail.com>

kernel mailz <kernelmailz@googlemail.com> writes:

> My query was more on %U1%X1, I guess it is specifying U and/or X for %1 right ?
> what does U/X stand for (is it similar to u - unsigned and x for a hex address)
> are there any more literals like U/X/...

The 'U' and 'X' modifiers expand to 'u' and 'x' resp, depending on the
form of the referenced memory operand.  That allows one to select the
right mnemonic among for example lwz, lwzu, lwzx and lwzux.  Those
modifiers must always be used together with the "m" constraint.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply

* Re: Inline assembly queries [2]
From: Andreas Schwab @ 2009-07-03 20:57 UTC (permalink / raw)
  To: Brad Boyer; +Cc: gcc-help, linuxppc-dev, linux-kernel, kernel mailz
In-Reply-To: <20090703174031.GA12410@cynthia.pants.nu>

Brad Boyer <flar@allandria.com> writes:

> On Fri, Jul 03, 2009 at 12:14:41PM +0530, kernel mailz wrote:
>> b. using m or Z  with a memory address. I tried replacing m/Z but no change
>> Is there some guideline ?
>> gcc documentation says Z is obsolete. Is m/Z replaceable ?
>
> No idea. I don't remember ever seeing 'Z' used in anything. Maybe somebody
> else remembers what it used to mean.

The 'Z' constraint is required for a memory operand for insns that don't
have an update form (which would be selected by the %U modifier).  It
should only be used together with the %y operand modifier, which makes
sure that the first register is never 0.  If the 'm' constraint were
used the operand could contain a pre-in/decrement operation, and without
%U the side effect would be lost.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply

* Re: Inline assembly queries [2]
From: kernel mailz @ 2009-07-03 20:05 UTC (permalink / raw)
  To: Brad Boyer; +Cc: gcc-help, linuxppc-dev, linux-kernel
In-Reply-To: <20090703174031.GA12410@cynthia.pants.nu>

Hi Brad,
Thanks for responding.
My query was more on %U1%X1, I guess it is specifying U and/or X for %1 rig=
ht ?
what does U/X stand for (is it similar to u - unsigned and x for a hex addr=
ess)
are there any more literals like U/X/...

-Manish

On Fri, Jul 3, 2009 at 11:10 PM, Brad Boyer<flar@allandria.com> wrote:
> On Fri, Jul 03, 2009 at 12:14:41PM +0530, kernel mailz wrote:
>> Thanks for responding to my previous mail. A few more queries
>>
>> a. What is the use of adding format specifiers in inline assembly
>> like
>> asm volatile("ld%U1%X1 %0,%1":"=3Dr"(ret) : "m"(*ptr) : "memory");
>
> The format specifiers limit which registers or addressing modes will
> be chosen to access that parameter. For example, if you're using an
> instruction that treats r0 as a literal 0 value, you can't use the
> "r" specifier for that or you may see problems if it happens to allocate
> r0 for that particular argument. For memory access, the "m" lets you
> use any of the normal load/store patterns (which is why this particular
> choice also requires the "%U1%X1" part to allow changing the instruction)=
.
> The system was setup for an older style chip like x86 or 68k with many
> restrictions on which registers can be used where and large numbers of
> different addressing modes for accessing memory. It's a little clumsy
> for ppc by comparison to most other chips, but it's a fundamental part
> of inline assembly processing in gcc.
>
>> b. using m or Z =A0with a memory address. I tried replacing m/Z but no c=
hange
>> Is there some guideline ?
>> gcc documentation says Z is obsolete. Is m/Z replaceable ?
>
> No idea. I don't remember ever seeing 'Z' used in anything. Maybe somebod=
y
> else remembers what it used to mean.
>
> =A0 =A0 =A0 =A0Brad Boyer
> =A0 =A0 =A0 =A0flar@allandria.com
>
>

^ permalink raw reply

* Re: Inline assembly queries [2]
From: Brad Boyer @ 2009-07-03 17:40 UTC (permalink / raw)
  To: kernel mailz; +Cc: gcc-help, linuxppc-dev, linux-kernel
In-Reply-To: <abe8a1fd0907022344k2eb9874ejdbda3209a7cadf40@mail.gmail.com>

On Fri, Jul 03, 2009 at 12:14:41PM +0530, kernel mailz wrote:
> Thanks for responding to my previous mail. A few more queries
> 
> a. What is the use of adding format specifiers in inline assembly
> like
> asm volatile("ld%U1%X1 %0,%1":"=r"(ret) : "m"(*ptr) : "memory");

The format specifiers limit which registers or addressing modes will
be chosen to access that parameter. For example, if you're using an
instruction that treats r0 as a literal 0 value, you can't use the
"r" specifier for that or you may see problems if it happens to allocate
r0 for that particular argument. For memory access, the "m" lets you
use any of the normal load/store patterns (which is why this particular
choice also requires the "%U1%X1" part to allow changing the instruction).
The system was setup for an older style chip like x86 or 68k with many
restrictions on which registers can be used where and large numbers of
different addressing modes for accessing memory. It's a little clumsy
for ppc by comparison to most other chips, but it's a fundamental part
of inline assembly processing in gcc.

> b. using m or Z  with a memory address. I tried replacing m/Z but no change
> Is there some guideline ?
> gcc documentation says Z is obsolete. Is m/Z replaceable ?

No idea. I don't remember ever seeing 'Z' used in anything. Maybe somebody
else remembers what it used to mean.

	Brad Boyer
	flar@allandria.com

^ permalink raw reply


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