linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* DMA support for MPC5xxx?
@ 2004-06-02 14:35 Iñigo Lopez Barranco
  2004-06-02 15:08 ` Wolfgang Denk
  0 siblings, 1 reply; 16+ messages in thread
From: Iñigo Lopez Barranco @ 2004-06-02 14:35 UTC (permalink / raw)
  To: linuxppc-dev


Hi everyone. Newbie question:
Are MPC5200's IDE UDMA and MDMA have support with the latests changes in bestcomm?
As I've read in the list, IDE and DMA were not supported due to bestcomm microcode (http://lists.linuxppc.org/linuxppc-embedded/200403/msg00214.html). Then, there is an announcement about a new API released on april 2004, included in linuxppc_2_4_devel cvs module. Does this solve the IDE DMA problem? I'm trying to use it on linuxppc_2_4_devel but doesn't work and I don't know if it's broken or I'm doing something wrong.
BTW, the target is a Lite5200 board.
Thanks.

Iñigo

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-02 14:35 DMA support for MPC5xxx? Iñigo Lopez Barranco
@ 2004-06-02 15:08 ` Wolfgang Denk
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Denk @ 2004-06-02 15:08 UTC (permalink / raw)
  To: Iñigo Lopez Barranco; +Cc: linuxppc-dev


In message <42A622EB18325843894BB8E1040E3DF5022732@sinaexchf> you wrote:
>
> Are MPC5200's IDE UDMA and MDMA have support with the latests changes in bestcomm?

Yes, partially :-(

> As I've read in the list, IDE and DMA were not supported due to bestcomm microcode (http://lists.linuxppc.org/linuxppc-embedded/200403/msg00214.html). Then, there is an announcement about a new API released on april 2004, included in linuxppc_2_4_devel
> cvs module. Does this solve the IDE DMA problem? I'm trying to use it on linuxppc_2_4_devel but doesn't work and I don't know if it's broken or I'm doing something wrong.
> BTW, the target is a Lite5200 board.

IDE DMA works if used alone, but it still causes conflicts  when  the
FEC ethernet driver is enabled, too. Motorola is investigating.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
"It takes all sorts of in & out-door schooling to get adapted  to  my
kind of fooling"                                           - R. Frost

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* RE: DMA support for MPC5xxx?
@ 2004-06-03 10:50 Iñigo Lopez Barranco
  2004-06-03 14:54 ` David Wolfe
  0 siblings, 1 reply; 16+ messages in thread
From: Iñigo Lopez Barranco @ 2004-06-03 10:50 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev


Thanks for your answer. Is there any place to follow the evolution of this problem, kind of bestcomm project web page or mail list, or is this list where motorola people uses to announce new bestcomm releases?
Thanks

Iñigo


-----Mensaje original-----
De: Wolfgang Denk [mailto:wd@denx.de]
Enviado el: mié 02/06/2004 17:08
Para: Iñigo Lopez Barranco
CC: linuxppc-dev@lists.linuxppc.org
Asunto: Re: DMA support for MPC5xxx?

In message <42A622EB18325843894BB8E1040E3DF5022732@sinaexchf> you wrote:
>
> Are MPC5200's IDE UDMA and MDMA have support with the latests changes in bestcomm?

Yes, partially :-(

> As I've read in the list, IDE and DMA were not supported due to bestcomm microcode (http://lists.linuxppc.org/linuxppc-embedded/200403/msg00214.html). Then, there is an announcement about a new API released on april 2004, included in linuxppc_2_4_devel
> cvs module. Does this solve the IDE DMA problem? I'm trying to use it on linuxppc_2_4_devel but doesn't work and I don't know if it's broken or I'm doing something wrong.
> BTW, the target is a Lite5200 board.

IDE DMA works if used alone, but it still causes conflicts  when  the
FEC ethernet driver is enabled, too. Motorola is investigating.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
"It takes all sorts of in & out-door schooling to get adapted  to  my
kind of fooling"                                           - R. Frost


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 10:50 DMA support for MPC5xxx? Iñigo Lopez Barranco
@ 2004-06-03 14:54 ` David Wolfe
  2004-06-03 16:06   ` Matt Porter
  0 siblings, 1 reply; 16+ messages in thread
From: David Wolfe @ 2004-06-03 14:54 UTC (permalink / raw)
  To: I?igo Lopez Barranco; +Cc: linuxppc-dev


[ I?igo Lopez Barranco writes: ]
> Thanks for your answer. Is there any place to follow the evolution
> of this problem, kind of bestcomm project web page or mail list, or
> is this list where motorola people uses to announce new bestcomm
> releases?

This is the list. As Wolfgang mentioned, we are seeing conflicts between
multiple drivers using Bestcomm tasks. Our results will be placed in the
linuxppc_2_4_devel CVS repository. I can't quote you a schedule, but I
can say my entire group will be off-site all of next week.

--
David Wolfe
Digital Audio, Radio & Telematics
Freescale Semiconductor

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 14:54 ` David Wolfe
@ 2004-06-03 16:06   ` Matt Porter
  2004-06-03 16:42     ` Wolfgang Denk
  0 siblings, 1 reply; 16+ messages in thread
From: Matt Porter @ 2004-06-03 16:06 UTC (permalink / raw)
  To: David Wolfe; +Cc: I?igo Lopez Barranco, linuxppc-dev


On Thu, Jun 03, 2004 at 09:54:34AM -0500, David Wolfe wrote:
>
> [ I?igo Lopez Barranco writes: ]
> > Thanks for your answer. Is there any place to follow the evolution
> > of this problem, kind of bestcomm project web page or mail list, or
> > is this list where motorola people uses to announce new bestcomm
> > releases?
>
> This is the list. As Wolfgang mentioned, we are seeing conflicts between
> multiple drivers using Bestcomm tasks. Our results will be placed in the
> linuxppc_2_4_devel CVS repository. I can't quote you a schedule, but I
> can say my entire group will be off-site all of next week.

It would be nice if you could work support for your silicon into
the de facto standard Linux/PPC community trees like the MPC85xx
folks are doing.

-Matt

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 16:06   ` Matt Porter
@ 2004-06-03 16:42     ` Wolfgang Denk
  2004-06-03 18:33       ` Matt Porter
  0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2004-06-03 16:42 UTC (permalink / raw)
  To: Matt Porter; +Cc: linuxppc-dev


Matt,

in message <20040603090635.B7347@home.com> you wrote:
>
> It would be nice if you could work support for your silicon into
> the de facto standard Linux/PPC community trees like the MPC85xx
> folks are doing.

We tried. We really tried.

See the thread starting at
http://lists.linuxppc.org/linuxppc-dev/200311/msg00000.html

David even posted on this list to get feedback  from  the  community.
But I haven't seen a single reply on the mailing lists.


Please don't blame _us_ that the 5xxx code was not accepted  for  the
public trees.

This is really not fair!!!


Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
"There was no difference between  the  behavior  of  a  god  and  the
operations of pure chance..."   - Thomas Pynchon, _Gravity's Rainbow_

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 16:42     ` Wolfgang Denk
@ 2004-06-03 18:33       ` Matt Porter
  2004-06-03 18:50         ` Tom Rini
  0 siblings, 1 reply; 16+ messages in thread
From: Matt Porter @ 2004-06-03 18:33 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: Matt Porter, linuxppc-dev


On Thu, Jun 03, 2004 at 06:42:40PM +0200, Wolfgang Denk wrote:
>
> Matt,
>
> in message <20040603090635.B7347@home.com> you wrote:
> >
> > It would be nice if you could work support for your silicon into
> > the de facto standard Linux/PPC community trees like the MPC85xx
> > folks are doing.
>
> We tried. We really tried.
>
> See the thread starting at
> http://lists.linuxppc.org/linuxppc-dev/200311/msg00000.html
>
> David even posted on this list to get feedback  from  the  community.
> But I haven't seen a single reply on the mailing lists.

So? Repost. I miss stuff the first time around a lot of times
myself [this is not to indicate that I would necessarily comment
on 5200 stuff, just an example].

> Please don't blame _us_ that the 5xxx code was not accepted  for  the
> public trees.
>
> This is really not fair!!!

Fair? Of course the community isn't fair. It's fickle and often
concerned only with its own current projects. Persistence really
helps when one wants something to be in the trees. Frankly, I'm
surprised that this isn't a top priority for Freescale. Maintaining
code in the kernel.org trees is far more efficient than when it
bit rots in some other tree. It also makes the support for Freescale's
silicon available to a wider audience.  I think that has got to be
high on their list.

Just to add fuel to the fire, I'll note that others are able to
appear on #mklinux and work out the issues in real-time with the
folks there. is often more desirable and productive. It's also often
the only way to get Paul's attention. Oh, and FWIW, the folks working
hard on 8xx and 85xx acceptance do manage to do this.

I'm glad I don't give up as easy. It took me a while to get core OCP/4xx
in linux-2.5. :)

-Matt

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 18:33       ` Matt Porter
@ 2004-06-03 18:50         ` Tom Rini
  2004-06-03 20:19           ` Sylvain Munaut
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Rini @ 2004-06-03 18:50 UTC (permalink / raw)
  To: Matt Porter; +Cc: Wolfgang Denk, linuxppc-dev


On Thu, Jun 03, 2004 at 11:33:02AM -0700, Matt Porter wrote:

>
> On Thu, Jun 03, 2004 at 06:42:40PM +0200, Wolfgang Denk wrote:
> >
> > Matt,
> >
> > in message <20040603090635.B7347@home.com> you wrote:
> > >
> > > It would be nice if you could work support for your silicon into
> > > the de facto standard Linux/PPC community trees like the MPC85xx
> > > folks are doing.
> >
> > We tried. We really tried.

Yes, and the outcome was we made a linux-2.4-mpc5xxx tree, tried to get
comments, did so, and it was rejected for being too ugly for kernel.org
at the time, IIRC.

> > See the thread starting at
> > http://lists.linuxppc.org/linuxppc-dev/200311/msg00000.html
> >
> > David even posted on this list to get feedback  from  the  community.
> > But I haven't seen a single reply on the mailing lists.
>
> So? Repost. I miss stuff the first time around a lot of times
> myself [this is not to indicate that I would necessarily comment
> on 5200 stuff, just an example].

And this time do it against 2.6.  Even if 2.4 wasn't necessarily frozen
at the time we first tried, it is now.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 18:50         ` Tom Rini
@ 2004-06-03 20:19           ` Sylvain Munaut
  2004-06-03 20:48             ` Matt Porter
  0 siblings, 1 reply; 16+ messages in thread
From: Sylvain Munaut @ 2004-06-03 20:19 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev


 >>> See the thread starting at
 >>> http://lists.linuxppc.org/linuxppc-dev/200311/msg00000.html
 >>>
 >>> David even posted on this list to get feedback  from  the
 >>> community. But I haven't seen a single reply on the mailing
 >>> lists.
 >>
 >> So? Repost. I miss stuff the first time around a lot of times
 >> myself [this is not to indicate that I would necessarily comment
 >> on 5200 stuff, just an example].
 >
 >
 > And this time do it against 2.6.  Even if 2.4 wasn't necessarily
 > frozen at the time we first tried, it is now.

Actually I got some patch to support MPC5200 ( and only this one, no
mgt5100 stuff ) for 2.6
It only supports booting, serial console and i2c. Not much but could
that be put in official tree if I submit it ? Or does it need to
support  more than that to worth inclusion.
So that at least if someone tries to implement more ( I'll resume my
work on it in a few weeks ), it has a base already in official tree.

Sylvain Munaut


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: DMA support for MPC5xxx?
  2004-06-03 20:19           ` Sylvain Munaut
@ 2004-06-03 20:48             ` Matt Porter
  2004-06-10 19:50               ` [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?) Sylvain Munaut
  0 siblings, 1 reply; 16+ messages in thread
From: Matt Porter @ 2004-06-03 20:48 UTC (permalink / raw)
  To: Sylvain Munaut; +Cc: Tom Rini, linuxppc-dev


On Thu, Jun 03, 2004 at 10:19:07PM +0200, Sylvain Munaut wrote:
>
>  >>> See the thread starting at
>  >>> http://lists.linuxppc.org/linuxppc-dev/200311/msg00000.html
>  >>>
>  >>> David even posted on this list to get feedback  from  the
>  >>> community. But I haven't seen a single reply on the mailing
>  >>> lists.
>  >>
>  >> So? Repost. I miss stuff the first time around a lot of times
>  >> myself [this is not to indicate that I would necessarily comment
>  >> on 5200 stuff, just an example].
>  >
>  >
>  > And this time do it against 2.6.  Even if 2.4 wasn't necessarily
>  > frozen at the time we first tried, it is now.
>
> Actually I got some patch to support MPC5200 ( and only this one, no
> mgt5100 stuff ) for 2.6
> It only supports booting, serial console and i2c. Not much but could
> that be put in official tree if I submit it ? Or does it need to
> support  more than that to worth inclusion.
> So that at least if someone tries to implement more ( I'll resume my
> work on it in a few weeks ), it has a base already in official tree.

Why not? You're the only one showing interest in supporting 5200 in
2.6. Post the patch and if it's clean it can go in. The "i2c", I
assume, is an i2c host adapter driver so that needs to be separated
so it can go to gregkh. Don't lump it in with the include/asm-ppc
and arch/ppc core support. :)

-Matt

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?)
  2004-06-03 20:48             ` Matt Porter
@ 2004-06-10 19:50               ` Sylvain Munaut
  2004-06-18 19:20                 ` Dale Farnsworth
  0 siblings, 1 reply; 16+ messages in thread
From: Sylvain Munaut @ 2004-06-10 19:50 UTC (permalink / raw)
  To: Matt Porter; +Cc: Tom Rini, linuxppc-dev


Hi

 > Why not? You're the only one showing interest in supporting 5200 in
 >  2.6.

Well, I'm getting used to it. I'm also working on ARM IXP1200 on 2.6,
and I'm also the only one AFAIK ;)

 > Post the patch and if it's clean it can go in. The "i2c", I assume,
 > is an i2c host adapter driver so that needs to be separated so it
 > can go to gregkh. Don't lump it in with the include/asm-ppc and
 > arch/ppc core support. :)

Here it is, slightly delayed because of hardrive crash and need to
rename all 'Motorola' to 'Freescale' ;)

It's there :

http://www.246tNt.com/linux-2.5-mpc52xx-pending-20040610.diff
bk://bkbits.246tNt.com/linux-2.5-mpc52xx-pending

I haven't inlined or attached it because it's quite large ( ~80k ).
But still, here the summary of the changes, so you at least know what
you're pulling ;)

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/06/10 21:08:41+02:00 tnt@246tnt-laptop.(none)
#   Added support for Freescale MPC52xx, both the processor and the
LITE5200 devboard
#
# include/asm-ppc/mpc52xx_psc.h
#   2004/06/10 21:04:05+02:00 tnt@246tnt-laptop.(none) +202 -0
#
# include/asm-ppc/mpc52xx_psc.h
#   2004/06/10 21:04:05+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/include/asm-ppc/mpc52xx_psc.h
#
# include/asm-ppc/mpc52xx.h
#   2004/06/10 21:04:04+02:00 tnt@246tnt-laptop.(none) +427 -0
#
# drivers/serial/mpc52xx_uart.c
#   2004/06/10 21:04:04+02:00 tnt@246tnt-laptop.(none) +872 -0
#
# include/asm-ppc/mpc52xx.h
#   2004/06/10 21:04:04+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/include/asm-ppc/mpc52xx.h
#
# drivers/serial/mpc52xx_uart.c
#   2004/06/10 21:04:04+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/drivers/serial/mpc52xx_uart.c
#
# arch/ppc/syslib/mpc52xx_setup.c
#   2004/06/10 21:04:03+02:00 tnt@246tnt-laptop.(none) +136 -0
#
# arch/ppc/syslib/mpc52xx_setup.c
#   2004/06/10 21:04:03+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/arch/ppc/syslib/mpc52xx_setup.c
#
# arch/ppc/syslib/mpc52xx_pic.c
#   2004/06/10 21:04:02+02:00 tnt@246tnt-laptop.(none) +259 -0
#
# arch/ppc/platforms/lite5200.h
#   2004/06/10 21:04:02+02:00 tnt@246tnt-laptop.(none) +34 -0
#
# arch/ppc/syslib/mpc52xx_pic.c
#   2004/06/10 21:04:02+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/arch/ppc/syslib/mpc52xx_pic.c
#
# arch/ppc/platforms/lite5200.h
#   2004/06/10 21:04:02+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/arch/ppc/platforms/lite5200.h
#
# arch/ppc/platforms/lite5200.c
#   2004/06/10 21:04:01+02:00 tnt@246tnt-laptop.(none) +155 -0
#
# arch/ppc/platforms/lite5200.c
#   2004/06/10 21:04:01+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/arch/ppc/platforms/lite5200.c
#
# arch/ppc/configs/lite5200_defconfig
#   2004/06/10 21:04:00+02:00 tnt@246tnt-laptop.(none) +477 -0
#
# arch/ppc/configs/lite5200_defconfig
#   2004/06/10 21:04:00+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/arch/ppc/configs/lite5200_defconfig
#
# Documentation/powerpc/mpc52xx.txt
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +70 -0
#
# include/linux/serial_core.h
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +3 -0
#   Added port type for the Freescale MPC52xx PSC
#
# include/asm-ppc/ppcboot.h
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +7 -0
#   Added specific fields for the Freescale MPC52xx
#
# drivers/serial/Makefile
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +1 -0
#   Added options for the Freescale MPC52xx PSC
#
# drivers/serial/Kconfig
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +18 -0
#   Added options for the Freescale MPC52xx PSC
#
# arch/ppc/syslib/Makefile
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +1 -0
#   Added options for the Freescale MPC52xx and the standard LITE5200
devboard
#
# arch/ppc/platforms/Makefile
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +1 -0
#   Added options for the Freescale MPC52xx and the standard LITE5200
devboard
#
# arch/ppc/kernel/cputable.c
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +8 -0
#   Added entry for the Freescale MPC52xx
#
# arch/ppc/Kconfig
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +20 -8
#   Added options for the Freescale MPC52xx and the standard LITE5200
devboard
#
# Documentation/powerpc/mpc52xx.txt
#   2004/06/10 21:03:59+02:00 tnt@246tnt-laptop.(none) +0 -0
#   BitKeeper file
/home/tnt/musicbox/kernel/linux-2.5-mpc52xx-pending/Documentation/powerpc/mpc52xx.txt
#



Sylvain Munaut


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?)
  2004-06-10 19:50               ` [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?) Sylvain Munaut
@ 2004-06-18 19:20                 ` Dale Farnsworth
  2004-06-18 20:04                   ` MPC52xx lite5200 support for booting from dBUG Dale Farnsworth
  2004-06-19 10:55                   ` [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?) Sylvain Munaut
  0 siblings, 2 replies; 16+ messages in thread
From: Dale Farnsworth @ 2004-06-18 19:20 UTC (permalink / raw)
  To: Sylvain Munaut, linuxppc-dev


On Thu, Jun 10, 2004 at 07:50:04PM +0000, Sylvain Munaut wrote:
> Here it is, slightly delayed because of hardrive crash and need to
> rename all 'Motorola' to 'Freescale' ;)
>
> It's there :
>
> http://www.246tNt.com/linux-2.5-mpc52xx-pending-20040610.diff
> bk://bkbits.246tNt.com/linux-2.5-mpc52xx-pending

FWIW, I'd like to see the above go into linux-2.5.

I found a few issues.
  - need to call uart_update_timeout
  - Maximum delay for console_write (printk) was too short
  - one missed icecube to lite5200 name change.

This patch applies on top Sylvain's patch above.

-Dale

===== drivers/serial/mpc52xx_uart.c 1.1 vs edited =====
--- 1.1/drivers/serial/mpc52xx_uart.c	2004-06-11 14:50:26 -07:00
+++ edited/drivers/serial/mpc52xx_uart.c	2004-06-17 15:28:36 -07:00
@@ -289,15 +289,18 @@
 	/* Get the lock */
 	spin_lock_irqsave(&port->lock, flags);

+	/* Update the per-port timeout */
+	uart_update_timeout(port, new->c_cflag, baud);
+
 	/* Do our best to flush TX & RX, so we don't loose anything */
 	/* But we don't wait indefinitly ! */
-	j = 1000;	/* Maximum wait */
+	j = 1000000;	/* Maximum wait */
 	/* FIXME Can't receive chars since set_termios might be called at early
 	 * boot for the console, all stuff is not yet ready to receive at that
 	 * time and that just makes the kernel oops */
 	/* while (j-- && mpc52xx_uart_int_rx_chars(port)); */
 	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
-	       j--)
+	       --j)
 		udelay(1);

 	if (!j)
@@ -588,40 +591,28 @@

 	/* Disable interrupts */
 	out_be16(&psc->mpc52xx_psc_imr, 0);
+
+	/* Wait the TX buffer to be empty */
+	j = 1000000;	/* Maximum wait */
+	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
+			j--)
+		udelay(1);

 	/* Write all the chars */
 	for ( i=0 ; i<count ; i++ ) {
-
-		/* Wait the TX buffer to be ready */
-		j = 10000;	/* Maximum wait */
-		while (!(in_be16(&psc->mpc52xx_psc_status) &
-		         MPC52xx_PSC_SR_TXRDY) &&
-		       j--)
-			udelay(1);
-
 		/* Send the char */
 		out_8(&psc->mpc52xx_psc_buffer_8, *s);

 		/* Line return handling */
-		if ( *s++ == '\n' ) {
-			/* Wait the TX buffer to be ready */
-			j = 10000;	/* Maximum wait */
-			while (!(in_be16(&psc->mpc52xx_psc_status) &
-			         MPC52xx_PSC_SR_TXRDY) &&
-			       j--)
-				udelay(1);
-
-			/* Send the char */
+		if ( *s++ == '\n' )
 			out_8(&psc->mpc52xx_psc_buffer_8, '\r');
-		}
-	}

-	/* Wait the TX buffer to be empty */
-	/* I'm not sure we really need to ... */
-	j = 10000;	/* Maximum wait */
-	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
-	       j--)
-		udelay(1);
+		/* Wait the TX buffer to be empty */
+		j = 100000;	/* Maximum wait */
+		while (!(in_be16(&psc->mpc52xx_psc_status) &
+				MPC52xx_PSC_SR_TXEMP) && j--)
+			udelay(1);
+	}

 	/* Restore interrupt state */
 	out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
===== include/asm-ppc/mpc52xx.h 1.1 vs edited =====
--- 1.1/include/asm-ppc/mpc52xx.h	2004-06-11 14:50:27 -07:00
+++ edited/include/asm-ppc/mpc52xx.h	2004-06-17 15:09:58 -07:00
@@ -339,7 +339,7 @@

 	volatile u8  mem_clk_sel;	/* MBAR_CDM + 0x0c  reg3 byte0 */
 	volatile u8  xlb_clk_sel;	/* MBAR_CDM + 0x0d  reg3 byte1 read only */
-	volatile u8  ipg_clk_sel;	/* MBAR_CDM + 0x0e  reg3 byte2 */
+	volatile u8  ipb_clk_sel;	/* MBAR_CDM + 0x0e  reg3 byte2 */
 	volatile u8  pci_clk_sel;	/* MBAR_CDM + 0x0f  reg3 byte3 */

 	volatile u8  ext_48mhz_en;	/* MBAR_CDM + 0x10  reg4 byte0 */
@@ -419,8 +419,8 @@
 extern bd_t __res;

 /* Platform options */
-#if defined(CONFIG_ICECUBE)
-#include <platforms/icecube.h>
+#if defined(CONFIG_LITE5200)
+#include <platforms/lite5200.h>
 #endif


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* MPC52xx lite5200 support for booting from dBUG
  2004-06-18 19:20                 ` Dale Farnsworth
@ 2004-06-18 20:04                   ` Dale Farnsworth
  2004-06-19 10:42                     ` Sylvain Munaut
  2004-06-19 10:55                   ` [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?) Sylvain Munaut
  1 sibling, 1 reply; 16+ messages in thread
From: Dale Farnsworth @ 2004-06-18 20:04 UTC (permalink / raw)
  To: linuxppc-dev


This patch allows Sylvain's 2.6 support for the lite5200 to boot
from dBUG as well as U-Boot.

When the arch/ppc/boot/simple bootwrapper is used, it computes the
values that U-boot would have supplied and stores them in __res.
That works for all needed fields except __res.bi_baudrate, which
can't be determined from the environment.  So, I added
CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD to supply the default baud rate.
The value of CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD is ignored if the
bootloader (U-boot) supplies the baudrate.

-Dale Farnsworth


===== arch/ppc/boot/common/misc-common.c 1.11 vs edited =====
--- 1.11/arch/ppc/boot/common/misc-common.c	2003-09-12 09:26:51 -07:00
+++ edited/arch/ppc/boot/common/misc-common.c	2004-06-11 17:29:30 -07:00
@@ -59,7 +59,7 @@
 void _vprintk(void(*putc)(const char), const char *fmt0, va_list ap);
 unsigned char *ISA_io = NULL;

-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_CORE_CONSOLE)
 extern unsigned long com_port;

 extern int serial_tstc(unsigned long com_port);
@@ -80,7 +80,7 @@

 int tstc(void)
 {
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_CORE_CONSOLE)
 	if(keyb_present)
 		return (CRT_tstc() || serial_tstc(com_port));
 	else
@@ -93,7 +93,7 @@
 int getc(void)
 {
 	while (1) {
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_CORE_CONSOLE)
 		if (serial_tstc(com_port))
 			return (serial_getc(com_port));
 #endif /* serial console */
@@ -108,7 +108,7 @@
 {
 	int x,y;

-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_CORE_CONSOLE)
 	serial_putc(com_port, c);
 	if ( c == '\n' )
 		serial_putc(com_port, '\r');
@@ -155,7 +155,7 @@
 	y = orig_y;

 	while ( ( c = *s++ ) != '\0' ) {
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
+#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_CORE_CONSOLE)
 	        serial_putc(com_port, c);
 	        if ( c == '\n' ) serial_putc(com_port, '\r');
 #endif /* serial console */
===== arch/ppc/boot/simple/Makefile 1.30 vs edited =====
--- 1.30/arch/ppc/boot/simple/Makefile	2004-05-27 01:26:54 -07:00
+++ edited/arch/ppc/boot/simple/Makefile	2004-06-11 16:25:53 -07:00
@@ -113,6 +113,12 @@
   entrypoint-$(CONFIG_SPRUCE)		:= 0x00800000
         misc-$(CONFIG_SPRUCE)		+= misc-spruce.o

+      zimage-$(CONFIG_LITE5200)		:= zImage-STRIPELF
+zimageinitrd-$(CONFIG_LITE5200)		:= zImage.initrd-STRIPELF
+         end-$(CONFIG_LITE5200)		:= lite5200
+   cacheflag-$(CONFIG_LITE5200)		:= -include $(clear_L2_L3)
+
+
 # SMP images should have a '.smp' suffix.
          end-$(CONFIG_SMP)             := $(end-y).smp

@@ -143,6 +149,9 @@
 boot-$(CONFIG_8xx)		+= m8xx_tty.o
 boot-$(CONFIG_8260)		+= m8260_tty.o
 boot-$(CONFIG_GT64260_CONSOLE)	+= gt64260_tty.o
+endif
+ifeq ($(CONFIG_SERIAL_CORE_CONSOLE),y)
+boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE) += mpc52xx_tty.o
 endif

 LIBS				:= $(common)/lib.a $(bootlib)/lib.a
===== arch/ppc/platforms/lite5200.c 1.1 vs edited =====
--- 1.1/arch/ppc/platforms/lite5200.c	2004-06-11 14:50:24 -07:00
+++ edited/arch/ppc/platforms/lite5200.c	2004-06-17 14:38:17 -07:00
@@ -72,28 +72,34 @@
 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
               unsigned long r6, unsigned long r7)
 {
-	parse_bootinfo(find_bootinfo());

 	/* Generic MPC52xx platform initialization */
 	/* TODO Create one and move a max of stuff in it.
 	   Put this init in the syslib */

-	/* Load the bd_t board info structure */
-	if (r3)
-		memcpy((void*)&__res,(void*)(r3+KERNELBASE), sizeof(bd_t));
+	struct bi_record *bootinfo = find_bootinfo();
+
+	if (bootinfo)
+		parse_bootinfo(bootinfo);
+	else {
+		/* Load the bd_t board info structure */
+		if (r3)
+			memcpy((void*)&__res,(void*)(r3+KERNELBASE),
+					sizeof(bd_t));

 #ifdef CONFIG_BLK_DEV_INITRD
-	/* Load the initrd */
-	if (r4) {
-		initrd_start = r4 + KERNELBASE;
-		initrd_end = r5 + KERNELBASE;
-	}
+		/* Load the initrd */
+		if (r4) {
+			initrd_start = r4 + KERNELBASE;
+			initrd_end = r5 + KERNELBASE;
+		}
 #endif

-	/* Load the command line */
-	if (r6) {
-		*(char *)(r7+KERNELBASE) = 0;
-		strcpy(cmd_line, (char *)(r6+KERNELBASE));
+		/* Load the command line */
+		if (r6) {
+			*(char *)(r7+KERNELBASE) = 0;
+			strcpy(cmd_line, (char *)(r6+KERNELBASE));
+		}
 	}

 	/* BAT setup */
===== arch/ppc/syslib/mpc52xx_setup.c 1.1 vs edited =====
--- 1.1/arch/ppc/syslib/mpc52xx_setup.c	2004-06-11 14:50:26 -07:00
+++ edited/arch/ppc/syslib/mpc52xx_setup.c	2004-06-17 15:14:53 -07:00
@@ -32,6 +32,14 @@
 #include <asm/mpc52xx_psc.h>
 #include <asm/ppcboot.h>

+extern bd_t __res;
+
+static int cpu_52xx[] = {
+	0,  0,  0,  10, 20, 20, 25, 45,
+	30, 55, 40, 50, 0,  60, 35, 0,
+	30, 25, 65, 10, 70, 20, 75, 45,
+	0,  55, 40, 50, 80, 60, 35, 0
+};

 void
 mpc52xx_restart(char *cmd)
@@ -110,8 +118,25 @@
 unsigned long __init
 mpc52xx_find_end_of_memory(void)
 {
-	/* We just read uBoot. We don't support anything else right now */
-	return __res.bi_memsize;
+	u32 ramsize = __res.bi_memsize;
+
+	/*
+	 * if bootloader passed a memsize, just use it
+	 * else get size from sdram config registers
+	 */
+	if (ramsize == 0) {
+		u32 sdram_config_0 = in_be32((u32 *)MPC52xx_SDRAM_CONFIG_0);
+		u32 sdram_config_1 = in_be32((u32 *)MPC52xx_SDRAM_CONFIG_1);
+
+		if ((sdram_config_0 & 0x1f) >= 0x13)
+			ramsize = 1 << ((sdram_config_0 & 0xf) + 17);
+
+		if (((sdram_config_1 & 0x1f) >= 0x13) &&
+				((sdram_config_1 & 0xfff00000) == ramsize))
+			ramsize += 1 << ((sdram_config_1 & 0xf) + 17);
+	}
+
+	return ramsize;
 }

 void __init
@@ -125,12 +150,46 @@
 mpc52xx_calibrate_decr(void)
 {
 	int freq, divisor;
-
+	struct mpc52xx_rtc *rtc = (struct mpc52xx_rtc*)MPC52xx_RTC;
+	struct mpc52xx_cdm *cdm = (struct mpc52xx_cdm*)MPC52xx_CDM;
+	int current_time, previous_time;
+	int tbl_start, tbl_end;
+	int cpufreq, ipbfreq, pcifreq;
+
 	freq = __res.bi_busfreq;
+	/* if bootloader didn't pass bus frequencies, calculate them */
+	if (freq == 0) {
+		previous_time = in_be32(&rtc->time);
+		while ((current_time = in_be32(&rtc->time)) == previous_time) ;
+		tbl_start = get_tbl();
+		previous_time = current_time;
+		while ((current_time = in_be32(&rtc->time)) == previous_time) ;
+		tbl_end = get_tbl();
+
+		freq = (tbl_end - tbl_start) * 4;
+
+		cpufreq = freq / 10 * cpu_52xx[in_be32(&cdm->rstcfg) & 0x1f];
+		ipbfreq = (in_8(&cdm->ipb_clk_sel) & 1) ?
+					freq / 2 : freq;
+		switch (in_8(&cdm->pci_clk_sel) & 3) {
+		case 0:
+			pcifreq = ipbfreq;
+			break;
+		case 1:
+			pcifreq = ipbfreq / 2;
+			break;
+		default:
+			pcifreq = ipbfreq / 4;
+			break;
+		}
+		__res.bi_busfreq = freq;
+		__res.bi_intfreq = cpufreq;
+		__res.bi_ipbfreq = ipbfreq;
+		__res.bi_pcifreq = pcifreq;
+	}

 	divisor = 4;

 	tb_ticks_per_jiffy = freq / HZ / divisor;
 	tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
 }
-
===== drivers/serial/Kconfig 1.32 vs edited =====
--- 1.32/drivers/serial/Kconfig	2004-06-11 14:50:23 -07:00
+++ edited/drivers/serial/Kconfig	2004-06-17 15:02:12 -07:00
@@ -633,6 +633,15 @@
 	help
 	  Select this options if you'd like to use one of the PSC serial port
 	  of the Freescale MPC52xx family as a console.
+
+config SERIAL_MPC52xx_CONSOLE_BAUD
+	int "Freescale MPC52xx family PSC serial port baud"
+	depends on SERIAL_MPC52xx_CONSOLE=y
+	default "9600"
+	help
+	  Select the MPC52xx console baud rate.
+	  This value is only used if the bootloader doesn't pass in the
+	  console baudrate

 endmenu

===== drivers/serial/mpc52xx_uart.c 1.1 vs edited =====
--- 1.1/drivers/serial/mpc52xx_uart.c	2004-06-11 14:50:26 -07:00
+++ edited/drivers/serial/mpc52xx_uart.c	2004-06-17 15:28:36 -07:00
@@ -562,9 +565,11 @@
 	out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1);
 	mr1 = in_8(&psc->mode);

-	/* Parse them */
-	*baud = __res.bi_baudrate;	/* CT{U,L}R are write-only ! */
+	/* CT{U,L}R are write-only ! */
+	*baud = __res.bi_baudrate ?
+		__res.bi_baudrate : CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD;

+	/* Parse them */
 	switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) {
 		case MPC52xx_PSC_MODE_5_BITS:	*bits = 5; break;
 		case MPC52xx_PSC_MODE_6_BITS:	*bits = 6; break;
===== include/asm-ppc/mpc52xx.h 1.1 vs edited =====
--- 1.1/include/asm-ppc/mpc52xx.h	2004-06-11 14:50:27 -07:00
+++ edited/include/asm-ppc/mpc52xx.h	2004-06-17 15:09:58 -07:00
@@ -68,6 +68,7 @@
 #define MPC52xx_SFTRST_BIT	0x01000000
 #define MPC52xx_INTR		(MPC52xx_MBAR + 0x0500)
 #define MPC52xx_GPT		(MPC52xx_MBAR + 0x0600)
+#define MPC52xx_RTC		(MPC52xx_MBAR + 0x0800)
 #define MPC52xx_MSCAN1		(MPC52xx_MBAR + 0x0900)
 #define MPC52xx_MSCAN2		(MPC52xx_MBAR + 0x0980)
 #define MPC52xx_GPIO		(MPC52xx_MBAR + 0x0b00)
@@ -280,6 +281,18 @@
 	volatile u32		EU37;		/* SDMA + 0xfc */
 };

+struct mpc52xx_rtc {
+	volatile u32 time_set;          /* RTC + 0x00 */
+	volatile u32 date_set;          /* RTC + 0x04 */
+	volatile u32 stopwatch;         /* RTC + 0x08 */
+	volatile u32 int_enable;        /* RTC + 0x0c */
+	volatile u32 time;              /* RTC + 0x10 */
+	volatile u32 date;              /* RTC + 0x14 */
+	volatile u32 stopwatch_intr;    /* RTC + 0x18 */
+	volatile u32 bus_error;         /* RTC + 0x1c */
+	volatile u32 dividers;          /* RTC + 0x20 */
+};
+
 /* GPIO */
 struct mpc52xx_gpio {
 	volatile u32		port_config;	/* GPIO + 0x00 */
@@ -312,6 +325,10 @@
 	volatile u8		reserved10;	/* GPIO + 0x3f */
 };

+#define MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD	4
+#define MPC52xx_GPIO_PSC_CONFIG_UART_WITH_CD	5
+#define MPC52xx_GPIO_PCI_DIS			(1<<15)
+
 /* XLB Bus control */
 struct mpc52xx_xlb {
 	volatile u8  reserved[0x40];

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: MPC52xx lite5200 support for booting from dBUG
  2004-06-18 20:04                   ` MPC52xx lite5200 support for booting from dBUG Dale Farnsworth
@ 2004-06-19 10:42                     ` Sylvain Munaut
  2004-06-19 22:07                       ` Dale Farnsworth
  0 siblings, 1 reply; 16+ messages in thread
From: Sylvain Munaut @ 2004-06-19 10:42 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev


Thanks,

I think a file ( arch/ppc/boot/simple/mpc52xx_tty.c ) is missing from
the patch.


    Sylvain Munaut


Dale Farnsworth wrote:

 > This patch allows Sylvain's 2.6 support for the lite5200 to boot
 > from dBUG as well as U-Boot.
 >
 > When the arch/ppc/boot/simple bootwrapper is used, it computes the
 > values that U-boot would have supplied and stores them in __res.
 > That works for all needed fields except __res.bi_baudrate, which
 > can't be determined from the environment.  So, I added
 > CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD to supply the default baud rate.
 >  The value of CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD is ignored if the
 > bootloader (U-boot) supplies the baudrate.
 >
 > -Dale Farnsworth


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?)
  2004-06-18 19:20                 ` Dale Farnsworth
  2004-06-18 20:04                   ` MPC52xx lite5200 support for booting from dBUG Dale Farnsworth
@ 2004-06-19 10:55                   ` Sylvain Munaut
  1 sibling, 0 replies; 16+ messages in thread
From: Sylvain Munaut @ 2004-06-19 10:55 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev


Dale Farnsworth wrote:

>On Thu, Jun 10, 2004 at 07:50:04PM +0000, Sylvain Munaut wrote:
>
>
>>Here it is, slightly delayed because of hardrive crash and need to
>>rename all 'Motorola' to 'Freescale' ;)
>>
>>It's there :
>>
>>http://www.246tNt.com/linux-2.5-mpc52xx-pending-20040610.diff
>>bk://bkbits.246tNt.com/linux-2.5-mpc52xx-pending
>>
>>
>
>FWIW, I'd like to see the above go into linux-2.5.
>
>I found a few issues.
>  - need to call uart_update_timeout
>  - Maximum delay for console_write (printk) was too short
>  - one missed icecube to lite5200 name change.
>
>This patch applies on top Sylvain's patch above.
>
>
Thanks,

Merged with others bits I fixed.
Already in the -devel tree. I'll push it to the others as soon as I
figure how to do it with bitkeeper ;) ...


Sylvain Munaut

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: MPC52xx lite5200 support for booting from dBUG
  2004-06-19 10:42                     ` Sylvain Munaut
@ 2004-06-19 22:07                       ` Dale Farnsworth
  0 siblings, 0 replies; 16+ messages in thread
From: Dale Farnsworth @ 2004-06-19 22:07 UTC (permalink / raw)
  To: Sylvain Munaut, linuxppc-dev


On Sat, Jun 19, 2004 at 10:42:05AM +0000, Sylvain Munaut wrote:
> I think a file ( arch/ppc/boot/simple/mpc52xx_tty.c ) is missing from
> the patch.

Your right.  Here it is.
-Dale

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/06/17 16:35:56-07:00 dfarnsworth@mvista.com
#   Oops, need arch/ppc/boot/simple/mpc52xx_tty.c too.
#
# arch/ppc/boot/simple/mpc52xx_tty.c
#   2004/06/17 16:35:49-07:00 dfarnsworth@mvista.com +141 -0
#
# arch/ppc/boot/simple/mpc52xx_tty.c
#   2004/06/17 16:35:49-07:00 dfarnsworth@mvista.com +0 -0
#   BitKeeper file /x/bk/linux-2.5-lite5200/arch/ppc/boot/simple/mpc52xx_tty.c
#
diff -Nru a/arch/ppc/boot/simple/mpc52xx_tty.c b/arch/ppc/boot/simple/mpc52xx_tty.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/boot/simple/mpc52xx_tty.c	2004-06-19 15:06:17 -07:00
@@ -0,0 +1,141 @@
+/*
+ * arch/ppc/boot/simple/mpc52xx_tty.c
+ *
+ * Minimal serial functions needed to send messages out a MPC52xx
+ * Programmable Serial Controller (PSC).
+ *
+ * Author: Dale Farnsworth <dfarnsworth@mvista.com>
+ *
+ * 2003-2004 (c) MontaVista, Software, Inc.  This file is licensed under the
+ * terms of the GNU General Public License version 2.  This program is licensed
+ * "as is" without any warranty of any kind, whether express or implied.
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <asm/uaccess.h>
+#include <asm/mpc52xx.h>
+#include <asm/mpc52xx_psc.h>
+#include <asm/serial.h>
+#include <asm/time.h>
+
+#if MPC52xx_PF_CONSOLE_PORT == 0
+#define MPC52xx_CONSOLE		MPC52xx_PSC1
+#define MPC52xx_PSC_CONFIG_SHIFT	0
+#elif MPC52xx_PF_CONSOLE_PORT == 1
+#define MPC52xx_CONSOLE		MPC52xx_PSC2
+#define MPC52xx_PSC_CONFIG_SHIFT	4
+#elif MPC52xx_PF_CONSOLE_PORT == 2
+#define MPC52xx_CONSOLE		MPC52xx_PSC3
+#define MPC52xx_PSC_CONFIG_SHIFT	8
+#else
+#error "MPC52xx_PF_CONSOLE_PORT not defined"
+#endif
+
+static struct mpc52xx_psc *psc = (struct mpc52xx_psc *)MPC52xx_CONSOLE;
+
+/* The decrementer counts at the system bus clock frequency
+ * divided by four.  The most accurate time base is connected to the
+ * rtc.  We read the decrementer change during one rtc tick (one second)
+ * and multiply by 4 to get the system bus clock frequency.
+ */
+int
+mpc52xx_ipbfreq(void)
+{
+	int busfreq, ipbfreq;
+	struct mpc52xx_rtc *rtc = (struct mpc52xx_rtc*)MPC52xx_RTC;
+	struct mpc52xx_cdm *cdm = (struct mpc52xx_cdm*)MPC52xx_CDM;
+	int current_time, previous_time;
+	int tbl_start, tbl_end;
+
+	/* force ipb to 66MHz and PCI to 33MHz */
+	out_8(&cdm->ipb_clk_sel, 1);
+	out_8(&cdm->pci_clk_sel, 1);
+
+	previous_time = in_be32(&rtc->time);
+	while ((current_time = in_be32(&rtc->time)) == previous_time) ;
+	tbl_start = get_tbl();
+	previous_time = current_time;
+	while ((current_time = in_be32(&rtc->time)) == previous_time) ;
+	tbl_end = get_tbl();
+
+	busfreq = (tbl_end - tbl_start) * 4;
+
+	ipbfreq = (in_8(&cdm->ipb_clk_sel) & 1) ? busfreq / 2 : busfreq;
+
+	return ipbfreq;
+}
+
+unsigned long
+serial_init(int ignored, void *ignored2)
+{
+	struct mpc52xx_gpio *gpio = (struct mpc52xx_gpio *)MPC52xx_GPIO;
+	int divisor;
+	int mode1;
+	int mode2;
+	u32 val32;
+
+	static int been_here = 0;
+
+	if (been_here)
+		return 0;
+
+	been_here = 1;
+
+	val32 = in_be32(&gpio->port_config);
+	val32 &= ~(0x7 << MPC52xx_PSC_CONFIG_SHIFT);
+	val32 |= MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD
+				<< MPC52xx_PSC_CONFIG_SHIFT;
+	out_be32(&gpio->port_config, val32);
+
+	out_8(&psc->command, MPC52xx_PSC_RST_TX
+			| MPC52xx_PSC_RX_DISABLE | MPC52xx_PSC_TX_ENABLE);
+	out_8(&psc->command, MPC52xx_PSC_RST_RX);
+
+	out_be32(&psc->sicr, 0x0);
+	out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00);
+	out_be16(&psc->tfalarm, 0xf8);
+
+	out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1
+			| MPC52xx_PSC_RX_ENABLE
+			| MPC52xx_PSC_TX_ENABLE);
+
+	divisor = ((mpc52xx_ipbfreq()
+			/ (CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD * 16)) + 1) >> 1;
+
+	mode1 = MPC52xx_PSC_MODE_8_BITS | MPC52xx_PSC_MODE_PARNONE
+			| MPC52xx_PSC_MODE_ERR;
+	mode2 = MPC52xx_PSC_MODE_ONE_STOP;
+
+	out_8(&psc->ctur, divisor>>8);
+	out_8(&psc->ctlr, divisor);
+	out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
+	out_8(&psc->mode, mode1);
+	out_8(&psc->mode, mode2);
+
+	return 0;	/* ignored */
+}
+
+void
+serial_putc(void *ignored, const char c)
+{
+	serial_init(0, 0);
+
+	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP)) ;
+	out_8(&psc->mpc52xx_psc_buffer_8, c);
+	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP)) ;
+}
+
+char
+serial_getc(void *ignored)
+{
+	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY)) ;
+
+	return in_8(&psc->mpc52xx_psc_buffer_8);
+}
+
+int
+serial_tstc(void *ignored)
+{
+	return (in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY) != 0;
+}

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2004-06-19 22:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-03 10:50 DMA support for MPC5xxx? Iñigo Lopez Barranco
2004-06-03 14:54 ` David Wolfe
2004-06-03 16:06   ` Matt Porter
2004-06-03 16:42     ` Wolfgang Denk
2004-06-03 18:33       ` Matt Porter
2004-06-03 18:50         ` Tom Rini
2004-06-03 20:19           ` Sylvain Munaut
2004-06-03 20:48             ` Matt Porter
2004-06-10 19:50               ` [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?) Sylvain Munaut
2004-06-18 19:20                 ` Dale Farnsworth
2004-06-18 20:04                   ` MPC52xx lite5200 support for booting from dBUG Dale Farnsworth
2004-06-19 10:42                     ` Sylvain Munaut
2004-06-19 22:07                       ` Dale Farnsworth
2004-06-19 10:55                   ` [PATCH][RFC] MPC52xx basic support on linux 2.6 (was DMA support for MPC5xxx?) Sylvain Munaut
  -- strict thread matches above, loose matches on Subject: below --
2004-06-02 14:35 DMA support for MPC5xxx? Iñigo Lopez Barranco
2004-06-02 15:08 ` Wolfgang Denk

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).