linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC5121e, Linux, simple IO ports
@ 2013-03-21  8:54 CF Studelec
  2013-03-21 13:44 ` CF Studelec
  2013-03-31  9:51 ` Anatolij Gustschin
  0 siblings, 2 replies; 3+ messages in thread
From: CF Studelec @ 2013-03-21  8:54 UTC (permalink / raw)
  To: linuxppc-dev

Hello,

This is a simple board base on mpc5121e MCU.


Gpio is detected: kernel is compiled with its support - i got
gpiochip_find_base: found new base @224 in dmesg - on kernel 3.0.4.

 
But i'm unable to access it through /sys/class/gpio. I can successfully
export a pin (ie, if i type cat 224 > export, gpio224 is created), but i
can't successfully control it:

 

echo "out" > /sys/class/gpio/gpio224/direction

cat /sys/class/gpio/gpio224/value

0

echo 1 > /sys/class/gpio/gpio224/value

cat /sys/class/gpio/gpio224/value

0

 

My need is a simple chipselect (well, 3 chipselect exactly ), for a
custom design. Running linux is mandatory. I suspect the MPC5121e to be
in the bad function mode, so:

- does anyone knows how to change mode ? What register can i acces and
how ? does it worths a try ?

- does anyone successfully performed simple IO control ?

 

Last thing, i have tryed to access internal registers through /dev/mem,
but no success. There are very few ressources available for this
microcontroler, but i'm stick to it. Perhaps anybody knows how to access
(read) internal registers with /proc or sys-fs ?

 

Thank you for your help.

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

* Re: MPC5121e, Linux, simple IO ports
  2013-03-21  8:54 MPC5121e, Linux, simple IO ports CF Studelec
@ 2013-03-21 13:44 ` CF Studelec
  2013-03-31  9:51 ` Anatolij Gustschin
  1 sibling, 0 replies; 3+ messages in thread
From: CF Studelec @ 2013-03-21 13:44 UTC (permalink / raw)
  To: linuxppc-dev

Sorry to bump the post, i'm wondering if it was correctly sent.

Le 21/03/2013 09:54, CF Studelec a écrit :
> Hello,
>
> This is a simple board base on mpc5121e MCU.
>
>
> Gpio is detected: kernel is compiled with its support - i got
> gpiochip_find_base: found new base @224 in dmesg - on kernel 3.0.4.
>
>  
> But i'm unable to access it through /sys/class/gpio. I can successfully
> export a pin (ie, if i type cat 224 > export, gpio224 is created), but i
> can't successfully control it:
>
>  
>
> echo "out" > /sys/class/gpio/gpio224/direction
>
> cat /sys/class/gpio/gpio224/value
>
> 0
>
> echo 1 > /sys/class/gpio/gpio224/value
>
> cat /sys/class/gpio/gpio224/value
>
> 0
>
>  
>
> My need is a simple chipselect (well, 3 chipselect exactly ), for a
> custom design. Running linux is mandatory. I suspect the MPC5121e to be
> in the bad function mode, so:
>
> - does anyone knows how to change mode ? What register can i acces and
> how ? does it worths a try ?
>
> - does anyone successfully performed simple IO control ?
>
>  
>
> Last thing, i have tryed to access internal registers through /dev/mem,
> but no success. There are very few ressources available for this
> microcontroler, but i'm stick to it. Perhaps anybody knows how to access
> (read) internal registers with /proc or sys-fs ?
>
>  
>
> Thank you for your help.
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>

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

* Re: MPC5121e, Linux, simple IO ports
  2013-03-21  8:54 MPC5121e, Linux, simple IO ports CF Studelec
  2013-03-21 13:44 ` CF Studelec
@ 2013-03-31  9:51 ` Anatolij Gustschin
  1 sibling, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2013-03-31  9:51 UTC (permalink / raw)
  To: CF Studelec; +Cc: linuxppc-dev

Hello,

On Thu, 21 Mar 2013 09:54:46 +0100
CF Studelec <cfoissac@studelec-sa.com> wrote:

> Hello,
> 
> This is a simple board base on mpc5121e MCU.
> 
> 
> Gpio is detected: kernel is compiled with its support - i got
> gpiochip_find_base: found new base @224 in dmesg - on kernel 3.0.4.
> 
>  
> But i'm unable to access it through /sys/class/gpio. I can successfully
> export a pin (ie, if i type cat 224 > export, gpio224 is created), but i
> can't successfully control it:
> 
>  
> 
> echo "out" > /sys/class/gpio/gpio224/direction
> 
> cat /sys/class/gpio/gpio224/value
> 
> 0
> 
> echo 1 > /sys/class/gpio/gpio224/value
> 
> cat /sys/class/gpio/gpio224/value
> 
> 0
>
> My need is a simple chipselect (well, 3 chipselect exactly ), for a
> custom design. Running linux is mandatory. I suspect the MPC5121e to be
> in the bad function mode, so:
> 
> - does anyone knows how to change mode ? What register can i acces and
> how ? does it worths a try ?

For GPIO0 - GPIO7 pins you additionally need to configure the pin mux
for GPIO mode, see IO_CONTROL_GP register description in the manual.

> - does anyone successfully performed simple IO control ?

We use it all the time, i.e. as SD-Card detect and/or
write-protect GPIOs, as SPI Chips-Select GPIOs, etc. It works.

> Last thing, i have tryed to access internal registers through /dev/mem,
> but no success. There are very few ressources available for this
> microcontroler, but i'm stick to it. Perhaps anybody knows how to access
> (read) internal registers with /proc or sys-fs ?

Accessing registers using /dev/mem should work (tested using
devmem2.c tool with recent v3.9-rc4 kernel. Should work with
older kernels too).

Alternatively (as a quick test) you could configure the registers
under U-Boot using "mw" command, assuming you are using U-Boot as
a bootloader.

HTH,

Anatolij

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0  Fax: +49-8142-66989-80 Email: office@denx.de

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

end of thread, other threads:[~2013-03-31  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-21  8:54 MPC5121e, Linux, simple IO ports CF Studelec
2013-03-21 13:44 ` CF Studelec
2013-03-31  9:51 ` Anatolij Gustschin

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