* Howto set DIO on MPC-5200 Lite
@ 2007-03-19 7:31 Matthias Fechner
2007-03-19 8:16 ` Sylvain Munaut
2007-03-19 8:45 ` Pedro Luis D. L.
0 siblings, 2 replies; 11+ messages in thread
From: Matthias Fechner @ 2007-03-19 7:31 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
how can I set the DIO ports from a MPC-5200 Lite?
Best regards,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-19 7:31 Matthias Fechner
@ 2007-03-19 8:16 ` Sylvain Munaut
2007-03-19 8:45 ` Pedro Luis D. L.
1 sibling, 0 replies; 11+ messages in thread
From: Sylvain Munaut @ 2007-03-19 8:16 UTC (permalink / raw)
To: linuxppc-embedded
Matthias Fechner wrote:
> Hi,
>
> how can I set the DIO ports from a MPC-5200 Lite?
>
>
> Best regards,
> Matthias
>
>
What's the DIO port ?
Sylvain
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Howto set DIO on MPC-5200 Lite
2007-03-19 7:31 Matthias Fechner
2007-03-19 8:16 ` Sylvain Munaut
@ 2007-03-19 8:45 ` Pedro Luis D. L.
2007-03-19 9:48 ` Matthias Fechner
1 sibling, 1 reply; 11+ messages in thread
From: Pedro Luis D. L. @ 2007-03-19 8:45 UTC (permalink / raw)
To: linuxppc-embedded
Matthias Fechner wrote on Mon, 19 Mar 2007 08:31:34
>Hi,
>
>how can I set the DIO ports from a MPC-5200 Lite?
>
>
>Best regards,
>Matthias
>
Could you mean "GIO" ports?
Pedro L.
_________________________________________________________________
Moda para esta temporada. Ponte al día de todas las tendencias.
http://www.msn.es/Mujer/moda/default.asp
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-19 8:45 ` Pedro Luis D. L.
@ 2007-03-19 9:48 ` Matthias Fechner
2007-03-19 10:12 ` Pedro Luis D. L.
2007-03-19 10:14 ` Sylvain Munaut
0 siblings, 2 replies; 11+ messages in thread
From: Matthias Fechner @ 2007-03-19 9:48 UTC (permalink / raw)
To: linuxppc-embedded
Hi Pedro and Sylvain,
Pedro Luis D. L. wrote:
> Could you mean "GIO" ports?
I mean the digital IO ports ok or general IO ports.
What I want is to set a signal to high or low which should control a relais.
I thought I can use the pin Dxx for that on the board.
Best regards,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-19 9:48 ` Matthias Fechner
@ 2007-03-19 10:12 ` Pedro Luis D. L.
2007-03-19 10:14 ` Sylvain Munaut
1 sibling, 0 replies; 11+ messages in thread
From: Pedro Luis D. L. @ 2007-03-19 10:12 UTC (permalink / raw)
To: linuxppc-embedded
Matthias Fechner wrote on Mon, 19 Mar 2007 10:48:19
>
>Hi Pedro and Sylvain,
>
>Pedro Luis D. L. wrote:
> > Could you mean "GIO" ports?
>
>I mean the digital IO ports ok or general IO ports.
>What I want is to set a signal to high or low which should control a
>relais.
>
>I thought I can use the pin Dxx for that on the board.
>
>Best regards,
>Matthias
The digital IO ports in the MPC5200 Lite are called GPIO ports. You can use
some pins in the PSC ports and some Timers as General Purpose IO ports.
You need to define the behaviour of these ports in the Port Config register
or the Timer registers.
Best,
Pedro L.
_________________________________________________________________
Acepta el reto MSN Premium: Protección para tus hijos en internet.
Descárgalo y pruébalo 2 meses gratis.
http://join.msn.com?XAPID=1697&DI=1055&HL=Footer_mailsenviados_proteccioninfantil
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-19 9:48 ` Matthias Fechner
2007-03-19 10:12 ` Pedro Luis D. L.
@ 2007-03-19 10:14 ` Sylvain Munaut
1 sibling, 0 replies; 11+ messages in thread
From: Sylvain Munaut @ 2007-03-19 10:14 UTC (permalink / raw)
To: linuxppc-embedded, idefix
Matthias Fechner wrote:
> Hi Pedro and Sylvain,
>
> Pedro Luis D. L. wrote:
>
>> Could you mean "GIO" ports?
>>
>
> I mean the digital IO ports ok or general IO ports.
> What I want is to set a signal to high or low which should control a relais.
>
> I thought I can use the pin Dxx for that on the board.
>
> Best regards,
> Matthias
>
Well, just lookup the schematics to which port the pin you want to
control is connected, then look in the datasheet how to control the
GPIO. You must make sure the port you want to control is in gpio mode in
port_config register, then setup it as output and drive a value onto it
... There is nothing currently in place to do that easily from userspace ...
Sylvain
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Howto set DIO on MPC-5200 Lite
@ 2007-03-19 13:18 Josu Onandia
2007-03-19 18:16 ` Matthias Fechner
2007-03-22 20:04 ` Matthias Fechner
0 siblings, 2 replies; 11+ messages in thread
From: Josu Onandia @ 2007-03-19 13:18 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
Some sample code. Hope this helps.
Regards
Josu Onandia
// PSC2_0 ----> J20 pin 2
// PSC2_1 ----> J20 pin 4
// PSC2_2 ----> J20 pin 6
// PSC2_3 ----> J20 pin 8
//
// GND ---- J20 pins 15,17,19,20
static void psc2_configure_pins(void)
{
struct mpc5xxx_gpio *gpio;
gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
gpio->port_config &= ~(0x00000070);
gpio->simple_gpioe |= 0x000000F0;
gpio->simple_ode &= ~0x000000F0;
gpio->simple_ddr |= 0x000000F0;
}
/* PSC2 0 to 3 pins */
static inline void psc2_pin_on(int pin)
{
struct mpc5xxx_gpio *gpio;
if((pin < 0) || (pin > 3))
return;
gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
gpio->simple_dvo |= (1 << (pin + 4));
}
static inline void psc2_pin_off(int pin)
{
struct mpc5xxx_gpio *gpio;
if((pin < 0) || (pin > 3))
return;
gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
gpio->simple_dvo &= ~ (1 << (pin + 4));
}
-----Mensaje original-----
De: linuxppc-embedded-bounces+jonandia=aotek.es@ozlabs.org en nombre de Matthias Fechner
Enviado el: lun 19/03/2007 8:31
Para: linuxppc-embedded@ozlabs.org
Asunto: Howto set DIO on MPC-5200 Lite
Hi,
how can I set the DIO ports from a MPC-5200 Lite?
Best regards,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 3239 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-19 13:18 Howto set DIO on MPC-5200 Lite Josu Onandia
@ 2007-03-19 18:16 ` Matthias Fechner
2007-03-22 20:04 ` Matthias Fechner
1 sibling, 0 replies; 11+ messages in thread
From: Matthias Fechner @ 2007-03-19 18:16 UTC (permalink / raw)
To: linuxppc-embedded
Hello Josu,
* Josu Onandia <jonandia@aotek.es> [19-03-07 14:18]:
> Some sample code. Hope this helps.
>
> // PSC2_0 ----> J20 pin 2
> // PSC2_1 ----> J20 pin 4
> // PSC2_2 ----> J20 pin 6
> // PSC2_3 ----> J20 pin 8
> //
> // GND ---- J20 pins 15,17,19,20
thx a lot for your code.
My problem is I have no documentation of the icecube board so I have
no idea which pin is connect to each other.
Have you possibly a documentation or schemtics from the icecube board
which you send send me?
Best regards,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-19 13:18 Howto set DIO on MPC-5200 Lite Josu Onandia
2007-03-19 18:16 ` Matthias Fechner
@ 2007-03-22 20:04 ` Matthias Fechner
2007-03-22 22:48 ` Steven Kaiser
1 sibling, 1 reply; 11+ messages in thread
From: Matthias Fechner @ 2007-03-22 20:04 UTC (permalink / raw)
To: linuxppc-embedded
Hello Josu,
* Josu Onandia <jonandia@aotek.es> [19-03-07 14:18]:
> Some sample code. Hope this helps.
thx a lot for all your help I love that mailinglist :)
Here is a very small kernel module for the icecube board.
It activates the LED 1 and 3 after module has been loaded
and off again if module has been removed.
Maybe that helps someone else:
#include <linux/module.h>
#include <asm/mpc52xx.h>
#define MPC5xxx_GPIO MPC52xx_VA(MPC52xx_GPIO_OFFSET)
static void psc6_configure_pins(void)
{
struct mpc52xx_gpio *config;
config = (struct mpc52xx_gpio*) MPC5xxx_GPIO;
printk("Address: %X\n",(u32)&config->port_config);
printk("Configure port\n");
config->port_config &= ~(0x00700000);
printk("Set IRDA to GPIO\n");
config->simple_gpioe |= 0x30000000;
printk("Set pins to CMOS output\n");
config->simple_ode &= ~(0x30000000);
printk("Set simple GPIO data direction register\n");
config->simple_ddr |= 0x30000000;
}
// the pins are active low, so we invert it
static void psc6_pin_on(unsigned int pin)
{
struct mpc52xx_gpio *config;
config = (struct mpc52xx_gpio*) MPC5xxx_GPIO;
printk("Set LEDs %i\n",pin);
config->simple_dvo &= ~(1 << (pin+28));
}
// the pins are active low, so we invert it
static void psc6_pin_off(unsigned int pin)
{
struct mpc52xx_gpio *config;
config = (struct mpc52xx_gpio*) MPC5xxx_GPIO;
printk("Clear LED %i\n",pin);
config->simple_dvo |= (1 << (pin+28));
}
static int icecube_led_init(void)
{
printk("Module Blink LED loaded\n");
printk("Set LEDs on\n");
psc6_configure_pins();
psc6_pin_on(0);
psc6_pin_on(1);
return 0;
}
static void icecube_led_cleanup(void)
{
printk("Module Blink LED unloaded\n");
psc6_pin_off(0);
psc6_pin_off(1);
}
MODULE_AUTHOR("Matthias Fechner <idefix@fechner.net>");
MODULE_DESCRIPTION("Driver to switch LED on icecube board after driver loaded successfully and switch LEDs of after driver unloaded successfully.");
MODULE_LICENSE("GPL");
module_init(icecube_led_init);
module_exit(icecube_led_cleanup);
Best regards,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Howto set DIO on MPC-5200 Lite
2007-03-22 20:04 ` Matthias Fechner
@ 2007-03-22 22:48 ` Steven Kaiser
2007-03-23 12:02 ` Sylvain Munaut
0 siblings, 1 reply; 11+ messages in thread
From: Steven Kaiser @ 2007-03-22 22:48 UTC (permalink / raw)
To: linuxppc-embedded
This DIO on MPC-5200 thread brings up a related question that has been
nagging me for a while.
I built a custom MPC5200B board based on the Lite5200B, and run a 2.4 kernel
using the ELDK. My hardware does not include PCI, but instead uses the
LocalPlus as a custom 18-bit external parallel bus to drive a bunch of
custom peripherals. I added some GPIO (PSC6_0 thru PSC6_3) to this custom
external bus to allow interrupts, signaling, and various types of control.
All's well. Now I would like to add more control lines, and even serial
interfaces to my custom bus.
But what holds me back is I am not entirely sure what 5200B peripherals the
stock linux kernel uses, and which ones are free for users to write their
own drivers and take over. I currently use a 2.4 kernel, but someday [soon]
will move up to a 2.6 kernel. I just want to download the basic ELDK
kernel, insmod my custom drivers, and go. I would hate to find out the pins
I have taken over require me to hack up and reconfigure the kernel (since
I'm not so intimate with Linux yet this scares me if something goes wrong).
For example, in another thread people here are talking about a power down
feature in 2.6 for the MPC5200B. Does this new feature use any GPIO lines I
should leave alone as reserved for linux use? The LITE5200B has some queer
ad-hoc network hack using PSC2_4 to power down the board's voltage
regulators, but linux 2.4 knows nothing of this and removing the zero ohm
resistor (R88) allows me to use that pin for my own purposes (At least
emperically linux 2.4 doesn't seem to mind me programming that pin).
Looks like from the DIO discussion here that PSC2_0 thru PSC2_3, and PSC6_0
thru PSC6_3 pins are clearly free. In general it looks like PSC2 (5 lines),
PSC3 (10 lines), and PSC6 (4 lines) are free for user use. Linux expects a
UART on PSC1, and PSC4 and PSC5 pins are taken over by Ethernet, so those
lines are off limits. Am I correct so far?
Are the TIMER_0 thru TIMER_7 lines used at all by the linux kernel? I
thirst after 2 timers for my custom bus.
If I don't use PCI, can I take over IRQ_0 thru IRQ_3 without disrupting the
normal operation of the 2.4 or 2.6 kernel? Some of the GPIO lines work fine
as interrupts so this is not so critical, but it would be nice to know.
EFIKA seems to have some sort of battery backed RTC to keep date and time,
but without a schematic I can't be sure what it is. Would be nice if the
LITE500B had something like this. What 5200B chip pins does EFIKA use for
this? Maybe should reserve these pins for a future RTC in the EFIKA
tradition.
So my general question is this: What pins on the 5200B are free for external
use by the user (i.e. what pins are reserved by the linux 2.4 and 2.6 stock
kernels for internal use)?
Steve Kaiser
> -----Original Message-----
> From: linuxppc-embedded-bounces+skaiser.uci=gmail.com@ozlabs.org
> [mailto:linuxppc-embedded-bounces+skaiser.uci=gmail.com@ozlabs.org] On
> Behalf Of Matthias Fechner
> Sent: Thursday, March 22, 2007 1:05 PM
> To: linuxppc-embedded@ozlabs.org
> Subject: Re: Howto set DIO on MPC-5200 Lite
>
> Hello Josu,
>
> * Josu Onandia <jonandia@aotek.es> [19-03-07 14:18]:
> > Some sample code. Hope this helps.
>
> thx a lot for all your help I love that mailinglist :)
>
> Here is a very small kernel module for the icecube board.
> It activates the LED 1 and 3 after module has been loaded
> and off again if module has been removed.
> Maybe that helps someone else:
>
> #include <linux/module.h>
> #include <asm/mpc52xx.h>
>
> #define MPC5xxx_GPIO MPC52xx_VA(MPC52xx_GPIO_OFFSET)
>
> static void psc6_configure_pins(void)
> {
> struct mpc52xx_gpio *config;
> config = (struct mpc52xx_gpio*) MPC5xxx_GPIO;
>
> printk("Address: %X\n",(u32)&config->port_config);
> printk("Configure port\n");
> config->port_config &= ~(0x00700000);
>
> printk("Set IRDA to GPIO\n");
> config->simple_gpioe |= 0x30000000;
>
> printk("Set pins to CMOS output\n");
> config->simple_ode &= ~(0x30000000);
>
> printk("Set simple GPIO data direction register\n");
> config->simple_ddr |= 0x30000000;
> }
>
> // the pins are active low, so we invert it
> static void psc6_pin_on(unsigned int pin)
> {
> struct mpc52xx_gpio *config;
> config = (struct mpc52xx_gpio*) MPC5xxx_GPIO;
> printk("Set LEDs %i\n",pin);
> config->simple_dvo &= ~(1 << (pin+28));
> }
>
> // the pins are active low, so we invert it
> static void psc6_pin_off(unsigned int pin)
> {
> struct mpc52xx_gpio *config;
> config = (struct mpc52xx_gpio*) MPC5xxx_GPIO;
> printk("Clear LED %i\n",pin);
> config->simple_dvo |= (1 << (pin+28));
> }
>
> static int icecube_led_init(void)
> {
> printk("Module Blink LED loaded\n");
> printk("Set LEDs on\n");
> psc6_configure_pins();
> psc6_pin_on(0);
> psc6_pin_on(1);
> return 0;
> }
>
> static void icecube_led_cleanup(void)
> {
> printk("Module Blink LED unloaded\n");
> psc6_pin_off(0);
> psc6_pin_off(1);
> }
>
> MODULE_AUTHOR("Matthias Fechner <idefix@fechner.net>");
> MODULE_DESCRIPTION("Driver to switch LED on icecube board after driver
> loaded successfully and switch LEDs of after driver unloaded
> successfully.");
> MODULE_LICENSE("GPL");
>
> module_init(icecube_led_init);
> module_exit(icecube_led_cleanup);
>
>
>
> Best regards,
> Matthias
>
> --
>
> "Programming today is a race between software engineers striving to
> build bigger and better idiot-proof programs, and the universe trying to
> produce bigger and better idiots. So far, the universe is winning." --
> Rich Cook
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Howto set DIO on MPC-5200 Lite
2007-03-22 22:48 ` Steven Kaiser
@ 2007-03-23 12:02 ` Sylvain Munaut
0 siblings, 0 replies; 11+ messages in thread
From: Sylvain Munaut @ 2007-03-23 12:02 UTC (permalink / raw)
To: Steven Kaiser; +Cc: linuxppc-embedded
Steven Kaiser wrote:
> EFIKA seems to have some sort of battery backed RTC to keep date and time,
> but without a schematic I can't be sure what it is. Would be nice if the
> LITE500B had something like this. What 5200B chip pins does EFIKA use for
> this? Maybe should reserve these pins for a future RTC in the EFIKA
> tradition.
>
The EFIKA has a small PIC that serves for power up / down and to keep time.
I think it's on a I2C bus but I don't know if they implemented it with
the embedded I2C controller or by bitbanging some GPIO.
(never saw the schema so that's and educated guess ...)
> So my general question is this: What pins on the 5200B are free for external
> use by the user (i.e. what pins are reserved by the linux 2.4 and 2.6 stock
> kernels for internal use)?
>
I can only speak for 2.6 and AFAIK it's none ...
Anyway you will need to write your own board file and your own device
tree and have your boot loader set port_config appropriatly. From there
you can free any pin you want (provided that pin is not used by a
function you want of course ...)
The lines used for PCI IRQ are specified for the Lite5200 and Lite5200B
in their device tree (or in the board file if you still use arch/ppc).
So when you write those files for your board, just make sure it match
your board.
Sylvain
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-03-23 12:03 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-19 13:18 Howto set DIO on MPC-5200 Lite Josu Onandia
2007-03-19 18:16 ` Matthias Fechner
2007-03-22 20:04 ` Matthias Fechner
2007-03-22 22:48 ` Steven Kaiser
2007-03-23 12:02 ` Sylvain Munaut
-- strict thread matches above, loose matches on Subject: below --
2007-03-19 7:31 Matthias Fechner
2007-03-19 8:16 ` Sylvain Munaut
2007-03-19 8:45 ` Pedro Luis D. L.
2007-03-19 9:48 ` Matthias Fechner
2007-03-19 10:12 ` Pedro Luis D. L.
2007-03-19 10:14 ` Sylvain Munaut
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).