GPIO driver for MPC8313.

2009-09-22 Thread Johnny Hung
Hi All:
   Is there a alreday written GPIO dirver or example for
MPC8313/similar ppc platform. It looks like many people need GPIO
dirver to control LED, etc... I think is it possible to write a
general gpio driver for all ppc platform and only need to modify gpio
iomap information of dtb file. Please give me a advice. Thanks in
advanced.

BRs, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev



Re: GPIO driver for MPC8313.

2009-09-23 Thread Johnny Hung
Thanks, got it. BTW, how to trigger GPIO level in user space
application? I also found arch/powerpc/platforms/52xx/mpc52xx_gpio.c
is a good example. Any reply is appreciate.

BRs, H. Johnny

2009/9/23 Peter Korsgaard :
>>>>>> "Johnny" == Johnny Hung  writes:
>
>  Johnny> Hi All:
>  Johnny>    Is there a alreday written GPIO dirver or example for
>  Johnny> MPC8313/similar ppc platform. It looks like many people need GPIO
>  Johnny> dirver to control LED, etc... I think is it possible to write a
>  Johnny> general gpio driver for all ppc platform and only need to modify gpio
>  Johnny> iomap information of dtb file. Please give me a advice. Thanks in
>  Johnny> advanced.
>
> Sure, it's arch/powerpc/sysdev/mpc8xxx_gpio.c, included since 2.6.28. To
> use it, simply enable CONFIG_MPC8xxx_GPIO and add a gpio-controller node
> to your dts, similar to how it's done in
> arch/powerpc/boot/dts/mpc837*_rdb.dts.
>
> See Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt for details of
> the dts bindings.
>
> --
> Bye, Peter Korsgaard
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: GPIO driver for MPC8313.

2009-09-23 Thread Johnny Hung
Many thanks for your help. I will try it.

2009/9/23 Peter Korsgaard :
>>>>>> "Johnny" == Johnny Hung  writes:
>
>  Johnny> Thanks, got it. BTW, how to trigger GPIO level in user space
>  Johnny> application? I also found
>  Johnny> arch/powerpc/platforms/52xx/mpc52xx_gpio.c is a good
>  Johnny> example. Any reply is appreciate.
>
> Through sysfs. See 'Sysfs Interface for Userspace' section of
> Documentation/gpio.txt
>
> --
> Bye, Peter Korsgaard
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: GPIO driver for MPC8313.

2009-09-27 Thread Johnny Hung
The kerne source I used now is 2.6.23 with MPC8313-erdb pached. I
think I should port 2.6.28 gpio function back to 2.6.23. Is it a
common way to implement it in the kernel I used or I should port
MPC8313-erdb pached to 2.6.28 opposite?

BRs, H. Johnny

2009/9/23 Johnny Hung :
> Many thanks for your help. I will try it.
>
> 2009/9/23 Peter Korsgaard :
>>>>>>> "Johnny" == Johnny Hung  writes:
>>
>>  Johnny> Thanks, got it. BTW, how to trigger GPIO level in user space
>>  Johnny> application? I also found
>>  Johnny> arch/powerpc/platforms/52xx/mpc52xx_gpio.c is a good
>>  Johnny> example. Any reply is appreciate.
>>
>> Through sysfs. See 'Sysfs Interface for Userspace' section of
>> Documentation/gpio.txt
>>
>> --
>> Bye, Peter Korsgaard
>>
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: linux booting fails on ppc440x5 with SRAM

2009-10-02 Thread Johnny Hung
It's seems a RAM initialize problem. Try to use ICE or your bootloader
to test initialized RAM wirh write/read operation.
Ex, use mtest in uboot to check memory. For ICE, it should be an
detailed memory test function like hardware diagnostic.

2009/9/24 Benjamin Herrenschmidt :
> On Wed, 2009-09-23 at 20:19 +0530, Vineeth _ wrote:
>> I am trying to port linux on IBM powerpc-440x5. I have this board
>> which has this processor, a 16MB SRAM sits on location 0x0, uart and a
>> flash.I have a simple bootloader which does the following.
>>     1. Initialize the processor (as part of it, we Generates the tlbs
>> for UART,16MB flash,16MB SRAM)
>>     2. Initialize the UART
>>     3. Copy the simple-boot linux_image (binary file) from flash to
>> 0x40 location of SRAM.
>>     4. Kernel entry to 0x40
>
> Not sure yet, looks like things are being overwritten during boot.
> Interestingly enough, the DEAR value looks like an MSR value..
>
> Hard to tell what's up. You'll have to dig a bit more youself to
> figure out how come the kernel's getting that bad pointer.
>
> All I can tell you is that things work fine on 440x5 cores, though
> I haven't tested a configuration with so little memory in a while.
>
> Ben.
>
>> zImage starting: loaded at 0x0040 (sp: 0x004deeb0)
>> Allocating 0x1dad84 bytes for kernel ...
>> gunzipping (0x <- 0x0040c000:0x004dd3f1)...done 0x1c31cc bytes
>>
>> Linux/PowerPC load: console=ttyS0 root=/dev/ram
>> Finalizing device tree... flat tree at 0x4eb300
>> id mach(): done
>> inside skybeam_register_console function
>> MMU:enterMMU:hw initMMU:mapinMMU:setioMMU:exitinside
>> _setup_arch-begininginside _setup_arch-1inside
>> _setup_arch-2setup_arch: bootmemarch: exit<7>Top of RAM: 0x100,
>> Total RAM: 0x100
>> Zone PFN ranges:
>>  DMA      0x -> 0x1000
>>  Normal   0x1000 -> 0x1000
>> Movable zone start PFN for each node
>> early_node_map[1] active PFN ranges
>>    0: 0x -> 0x1000
>> MMU: Allocated 1088 bytes of context maps for 255 contexts
>> Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 4064
>> Kernel command line: console=ttyS0 root=/dev/ram
>> Unable to handle kernel paging request for data at address 0x00021000
>> Faulting instruction address: 0xc010a7c4
>> Oops: Kernel access of bad area, sig: 11 [#1]
>> PREEMPT PowerPC 44x Platform
>> Modules linked in:
>> NIP: c010a7c4 LR: c010dc50 CTR: 
>> REGS: c01bfeb0 TRAP: 0300   Not tainted  (2.6.30)
>> MSR: 00021000   CR: 2444  XER: 
>> DEAR: 00021000, ESR: 
>> TASK = c01a94b8[0] 'swapper' THREAD: c01be000
>> GPR00: 1180 c01bff60 c01a94b8 00021000 0025 0008 c0104968 
>> 
>> GPR08: 2f72616d c011 c0155938 c01a 2224  f104 
>> 
>> GPR16:     fff8 08b8 c010d758 
>> c0104968
>> GPR24: 1198 1190 c018a001 c01c5498 08c0 1188 00021000 
>> c01c42f0
>> NIP [c010a7c4] strchr+0x0/0x3c
>> LR [c010dc50] match_token+0x138/0x228
>> Call Trace:
>> [c01bff60] [c016b99c] 0xc016b99c (unreliable)
>> [c01bffa0] [c0104a00] sort_extable+0x28/0x38
>> [c01bffb0] [c01938ec] sort_main_extable+0x20/0x30
>> [c01bffc0] [c018c734] start_kernel+0x140/0x288
>> [c01bfff0] [c200] skpinv+0x190/0x1cc
>> Instruction dump:
>> 7ca903a6 8804 38a5 38840001 2f80 9809 39290001 419e0010
>> 4200ffe4 98a9 4e800020 4e800020 <8803> 5484063e 7f802000 4d9e0020
>> ---[ end trace 31fd0ba7d8756001 ]---
>> Kernel panic - not syncing: Attempted to kill the idle task!
>> Call Trace:
>> [c01bfd90] [c0005d5c] show_stack+0x4c/0x16c (unreliable)
>> [c01bfdd0] [c002f17c] panic+0xa0/0x168
>> [c01bfe20] [c0032eb8] do_exit+0x61c/0x638
>> [c01bfe60] [c000b60c] kernel_bad_stack+0x0/0x4c
>> [c01bfe90] [c000f310] bad_page_fault+0x90/0xd8
>> [c01bfea0] [c000e184] handle_page_fault+0x7c/0x80
>> [c01bff60] [c016b99c] 0xc016b99c
>> [c01bffa0] [c0104a00] sort_extable+0x28/0x38
>> [c01bffb0] [c01938ec] sort_main_extable+0x20/0x30
>> [c01bffc0] [c018c734] start_kernel+0x140/0x288
>> [c01bfff0] [c200] skpinv+0x190/0x1cc
>> Rebooting in 180 seconds..
>> ___
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


jffs2_gcd_mtdx thread and umount problem.

2010-01-17 Thread Johnny Hung
Hi All,

I have a customized MPC8313 (ppc arch) board with SPANSION 64MB NOR
flash, everything works fine but I found a abnormal about JFFS2 flahs
filesystem.

The system will mount JFFS2 to /mnt/mtd when system boot up. I try to
execute umount /mnt/mtd or sync or reboot right away after login then
these commands hangs. Use ps command to check process status and is D
(Uninterruptible sleep, usually IO). I try to kill jffs2_gcd_mtd4 and
umount/reboot/syc commands execute successfully. I think
jffs2_gcd_mtd4 (mount /dev/mtd4) do something in the background so I
wait for 10 minutes after login and execute the same commands and it
doesn't hangs.

The following procedure is I to make jffs2 file system and write to
flash then mount to /mnt/mtd.

1. mkfs.jffs2 -d mtd -e 0x2 --pad 0x308 -o mtd.jffs2 (erase
block size is 128KB and jffs2 partition size is 48.5MB)

2. write jffs2 file system to flash in uboot.
  tftpboot 20 mtd.jffs2;(load mtd.jffs2 to memory)
  protect off f8f8 fbff;
  erase f8f8 fbff;   (erase all 48.5MB)
  cp.b 20 f8f8 $filesize; (program mtd.jffs2 to flash)
  protect on f8f8 fbff;
  cmp.b 20 f8f8 $filesize

3. Add below in /etc/fstab file to mount to /mnt/mtd
  /dev/mtdblock4  /mnt/mtdjffs2   defaults1   1

Does anyone knows what purpose for jffs2_gcd_mtdx thread and why it
cause umount/sync/reboot commands hangs it is reasonable or  something
I did wrong?

BRs, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: jffs2_gcd_mtdx thread and umount problem.

2010-01-18 Thread Johnny Hung
Yes, umount / reboot command doesn't hang after first boot + wait for
20 minutes. The jffs2_gcd_mtdx will re-erase empty blocks but how do I
know it is finished?

BTW, why jffs2_gcd_mtd need to re-erase empty blocks and it will cause
some command cannot work if erase block is necessary. I mean many
pepple could meet this problem if it is need to erase empty block and
how do they overcome or workaround it.

Thank you so much, Jocke
BRs, H. Johnny

> I guess this is the first reboot after mounting a new JFFS2 FS?
> Then JFFS2 is reerasing empty blocks and you will have to wait
> until it is done.
>
> I posted a patch long ago for this, but it was racy w.r.t JFSS2 module unload 
> so
> it didn't make it into the repo. Search the list for
> "[JFFS2] Stop erasing blocks when rebooting." to find my old patch
>
>  Jocke
>
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
Hi ALL,

I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
rootfs resides in memory so modify files is non-effective after a
reboot. Some directories in rootfs, like /etc, /usr, ... are contain
many application configuration files and I want to mount it to jffs2
flash filesysyem so it will take effect after a reboot. Is it
possible? I know the flash has write times limited so the log files
(syslogd/klogd) should not store in flash. In general, how to deploy
root file system for embedded linux with flash storage?

H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 05:20:53PM +0800 Johnny Hung ha dit:
>
>> I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
>> rootfs resides in memory so modify files is non-effective after a
>> reboot. Some directories in rootfs, like /etc, /usr, ... are contain
>> many application configuration files and I want to mount it to jffs2
>> flash filesysyem so it will take effect after a reboot. Is it
>> possible?
>
How to do it? The ramdisk rootfs is ext2 filesystem and I try,
mount /mnt/mtd/etc /etc

Try to modify /etc/ files is not works.

> yes, this is possible
>
>> I know the flash has write times limited so the log files
>> (syslogd/klogd) should not store in flash. In general, how to deploy
>> root file system for embedded linux with flash storage?
>
> - add jffs2 support to your kernel
> - create your image using mkfs.jffs2 from mtd-utils
> - flash the image
> - specify the rootfs partition and type in the bootargs of the kernel
The above procedure is to create a jffs2 rootfs image but I  prefer to
use ramdisk rootfs.
I think the rootfs is build as ramdisk and some configurable file is
store in jffs2 flash.

Thank your reply.
BRs, H. Johnny

>
> for further information i recommend the lecture of
> http://free-electrons.com/doc/flash-filesystems.pdf
>
> depending on your requirements/size of the rootfs partitions UBIFS
> might be an option to consider
>
> --
> Matthias Kaehlcke
> Embedded Linux Developer
> Barcelona
>
>      El trabajo es el refugio de los que no tienen nada que hacer
>                            (Oscar Wilde)
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 06:13:07PM +0800 Johnny Hung ha dit:
>
>> 2010/1/19 Matthias Kaehlcke :
>> > El Tue, Jan 19, 2010 at 05:20:53PM +0800 Johnny Hung ha dit:
>> >
>> >> I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
>> >> rootfs resides in memory so modify files is non-effective after a
>> >> reboot. Some directories in rootfs, like /etc, /usr, ... are contain
>> >> many application configuration files and I want to mount it to jffs2
>> >> flash filesysyem so it will take effect after a reboot. Is it
>> >> possible?
>> >
>> How to do it? The ramdisk rootfs is ext2 filesystem and I try,
>> mount /mnt/mtd/etc /etc
>>
>> Try to modify /etc/ files is not works.
>
> ok, i understood you want to substitute the ramdisk rootfs by jffs2
> based one
>
> mounting the ramdisk as writable with the flash as backing storage
> isn't possible AFAIK. and even if it was possible it wouldn't be
> recommended as ext2 doesn't care about flash wear out, in consequence
> you would write the same blocks over and over again.
>
>> > yes, this is possible
>> >
>> >> I know the flash has write times limited so the log files
>> >> (syslogd/klogd) should not store in flash. In general, how to deploy
>> >> root file system for embedded linux with flash storage?
>> >
>> > - add jffs2 support to your kernel
>> > - create your image using mkfs.jffs2 from mtd-utils
>> > - flash the image
>> > - specify the rootfs partition and type in the bootargs of the kernel
>> The above procedure is to create a jffs2 rootfs image but I  prefer to
>> use ramdisk rootfs.
>> I think the rootfs is build as ramdisk and some configurable file is
>> store in jffs2 flash.
>

Okay, I think the steps is below if my rootfs is ramdisk and configure
files in jffs2,

1. cp /etc/* /mnt/mtd/etc/(/mnt/mtd is my jffs2 fs)
2. rm -rf /etc/*
3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
4. remake ramdisk rootfs

It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
and try to modify these files is effective after reboot.
But is this a common way in embedded linux ?

I also have another idea, keep ramdisk rootfs /etc files and add a shell script.

1. The shell script execute when system boot up.
2. Check /mnt/mtd/etc/xxx if is exist. If yes, remove /etc/xxx file
and make a symbolic link to /mnt/mtd/etc/xxx. If no, keep /etc/xxx
file.
3. repeat 2 for all /etc files

Any suggestion?

Thank your help.
BRs, H. Johnny

> in this case follow the above steps, except the last one about the
> bootargs and mount the jffs2 partition from your init script. you
> could use symlinks from your ramdisk to the files on jffs2 to
> integrate them in your rootfs
>
> --
> Matthias Kaehlcke
> Embedded Linux Developer
> Barcelona
>
>      Anyone who has never made a mistake has never tried anything new
>                            (Albert Einstein)
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>
>> On Tue, 19 Jan 2010, Johnny Hung wrote:
>>
>>> Okay, I think the steps is below if my rootfs is ramdisk and configure
>>> files in jffs2,
>>>
>>> 1. cp /etc/* /mnt/mtd/etc/    (/mnt/mtd is my jffs2 fs)
>>> 2. rm -rf /etc/*
>>> 3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
>>> 4. remake ramdisk rootfs
>>>
>>> It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
>>> and try to modify these files is effective after reboot.
>>> But is this a common way in embedded linux ?
>>

Thanks, I understand.

>> In principle, but it is easier (and cleaner) to make a symbolic link from
>> (say) /etc -> /mnt/mtd/etc without linking every individual file and
>> directory.
>
> i totally agree with ricard when you want to move the entire directory
> to jffs2 and not only some selected files
>
>> You could also use a jffs2 file system in flash for your rootfs, that way
>> you wouldn't need a ramdisk at all.
>
> i'd also recommend you to consider if you really need the
> ramdisk. when using a ram disk its entire content is loaded to the RAM
> occupying space, even if you don't use certain files (or part of
> them). other filesystems are more efficient in this aspect.
> if the main purpose is to have a read only rootfs, i'd suggest a look
> at squashfs.

I consider to use ramdisk as rootfs because worry about wrong
operation in rootfs (is use jffs2 rootfs) and it will cause system
boot up failed.
Another query, does the syslogd/klogd log files also store in jffs2
rootfs? Write to jffs2 frequently will reduce flash life cycle.

BRs, H. Johnny
>
> --
> Matthias Kaehlcke
> Embedded Linux Developer
> Barcelona
>
>              La posibilidad de realizar un suenyo es lo
>                 que hace que la vida sea interesante
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-21 Thread Johnny Hung
2010/1/20 Ricard Wanderlof :
>
> On Wed, 20 Jan 2010, Johnny Hung wrote:
>
>>> i'd also recommend you to consider if you really need the
>>> ramdisk. when using a ram disk its entire content is loaded to the RAM
>>> occupying space, even if you don't use certain files (or part of
>>> them). other filesystems are more efficient in this aspect.
>>> if the main purpose is to have a read only rootfs, i'd suggest a look
>>> at squashfs.
>>
>> I consider to use ramdisk as rootfs because worry about wrong
>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>> boot up failed.
>
> You have a point, however, you could do two things to help:
>
> a) Mount the root file system as read-only. That way you can never write to
> it, unless you remount it read-write. But you can still reflash that
> partition if you need to upgrade.
>
> b) Register the mtd partition holding the root file system as read-only.
> This is even more seecure as remounting the file system won't permit writes.
> However, it also means you can't write to it for upgrading. (I
> don't think the mtd core permits changing an already registered mtd
> partition from readonly to writable, but I could be wrong.)
>
>> Another query, does the syslogd/klogd log files also store in jffs2
>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>
> I think it is fairly common to have a combination of devices:
>
> / (root)        is a readonly flash device (mtd partition)
> /etc            is a writable flash device (mtd partition)
> /tmp and /var   are ramdisks (tmpfs), so they are writable, but lost when
>                power is cycled.

I think it's a good combination for my board. How do I sepcific the
/etc to another mtd part?
The busybox init will parse /etc/inittab after setup signal handler
and initializes console. I only
know to do it is to re-mount etc directory from another mtd to /etc.
Is it right?

Thank your help.
BRs, H. Johnny

>
> /Ricard
> --
> Ricard Wolf Wanderlöf                           ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden            www.axis.com
> Phone +46 46 272 2016                           Fax +46 46 13 61 30
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-21 Thread Johnny Hung
2010/1/20 Marco Stornelli :
> 2010/1/20 Johnny Hung :
>> 2010/1/19 Matthias Kaehlcke :
>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>
>> I consider to use ramdisk as rootfs because worry about wrong
>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>> boot up failed.
>> Another query, does the syslogd/klogd log files also store in jffs2
>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>
>> BRs, H. Johnny
>>>
>>> --
>

It seems there are a lot of file-systems I have to study :P. The same
question is
how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
system boot up?

Thank your good advice.
BRs, H. Johnny
> In general a good splitting for rootfs could be: squashfs for rootfs,
> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
> "strong" permanent data (/etc, ) and pramfs for "light" permanent
> data (/var/log, .).
> I think you should "split" your rootfs. Ramdisk is an old approach
> with some drawbacks.
>
> Marco
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-24 Thread Johnny Hung
2010/1/22 Marco Stornelli :
> 2010/1/22 Johnny Hung :
>> 2010/1/20 Marco Stornelli :
>>> 2010/1/20 Johnny Hung :
>>>> 2010/1/19 Matthias Kaehlcke :
>>>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>>>
>>>> I consider to use ramdisk as rootfs because worry about wrong
>>>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>>>> boot up failed.
>>>> Another query, does the syslogd/klogd log files also store in jffs2
>>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>>
>>>> BRs, H. Johnny
>>>>>
>>>>> --
>>>
>>
>> It seems there are a lot of file-systems I have to study :P. The same
>> question is
>> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part 
>> when
>> system boot up?
>>
>
Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
/, I need to add "/dev/mtdblock5  /etcjffs2   defaults
0   0" in /etc/fstab file but rootfs doesn't contain /etc
directory because /etc directoyr is store in /dev/mtdblock5.
Do you know what I mean? The kernel execute /sbin/init after mount
rootfs and /sbin/init is link to busybox, busybox will read
/etc/inittab file to initial. The problem is coming, how busybox to
read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
program to mount /dev/mtdblock5 to /etc before busybox init execute.

I think I must mistake some concept, please give me a hint.
Thank you
BRs, H. Johnny

> Simply, you can mount each mount point with the fstab file and a
> script, same approach of every linux distribution, nothing more. Even
> in the pc world you can mount your /home on a partition with ext3,
> /var in a partition with ext4, and so on. A very simple approach to
> setup the system, it is to start with NFS for example with "whole" fs,
> copy what you need in the right place, setup the start-up script and
> reboot.
>
> Marco
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-25 Thread Johnny Hung
2010/1/25 Chris Simmonds :
> Johnny Hung wrote:
>>
>> 2010/1/22 Marco Stornelli :
>>>
>>> 2010/1/22 Johnny Hung :
>>>>
>>>> 2010/1/20 Marco Stornelli :
>>>>>
>>>>> 2010/1/20 Johnny Hung :
>>>>>>
>>>>>> 2010/1/19 Matthias Kaehlcke :
>>>>>>>
>>>>>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>>>>>
>>>>>> I consider to use ramdisk as rootfs because worry about wrong
>>>>>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>>>>>> boot up failed.
>>>>>> Another query, does the syslogd/klogd log files also store in jffs2
>>>>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>>>>
>>>>>> BRs, H. Johnny
>>>>>>>
>>>>>>> --
>>>>
>>>> It seems there are a lot of file-systems I have to study :P. The same
>>>> question is
>>>> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd
>>>> part when
>>>> system boot up?
>>>>
>> Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
>> /, I need to add "/dev/mtdblock5  /etc        jffs2   defaults
>> 0       0" in /etc/fstab file but rootfs doesn't contain /etc
>> directory because /etc directoyr is store in /dev/mtdblock5.
>> Do you know what I mean? The kernel execute /sbin/init after mount
>> rootfs and /sbin/init is link to busybox, busybox will read
>> /etc/inittab file to initial. The problem is coming, how busybox to
>> read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
>> program to mount /dev/mtdblock5 to /etc before busybox init execute.
>>
>> I think I must mistake some concept, please give me a hint.
>> Thank you
>> BRs, H. Johnny
>>
>

I got it. The rootfs contains at least /etc directory, /etc/inittab,
/etc/fstab. Bysybox will read /etc/fstab to mount etc to rootfs's etc
from other partition. Okay, it's reasonable. Another query, how to do
it in many Linux dist as Macro mentioned, use initramfs ? I am sure I
can arrange / to /dev/hda1 and /etc to /dev/hda2.

Thank you so much
BRs, H. Johnny

> You have two /etc directories: one in the the read-only root file system and
> one in the jffs2 fs. In the root fs you have /etc/fstab, /etc/inittab and
> any scripts it may call. The init program will mount /dev/mtdblock5 over the
> top of the /etc that is in the rootfs, so giving you the read/write version
> of /etc. Any files open in the old /etc - e.g. /etc/inittab - will continue
> to be open, but any new files opened in /etc will use the read/write version
> in jffs2. You can also do some interesting things with symbolic links...
> This technique works. I have used it in several projects.
>
> --
> Chris Simmonds                   2net Limited
> ch...@2net.co.uk                 http://www.2net.co.uk/
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Freescale MPC8313 TSEC SGMII problem.

2010-01-28 Thread Johnny Hung
Hi All,

I have a Freescale MPC8313 customized board and want to confiugre
TSEC1 to SGMII. Would you please help me for this question,

1). Is it possible for MPC8313 TSEC1 connect to Ethernet Switch by
SGMII (without phy), like below diagram.

[MPC8313 TSEC1]   [Ethernet Switch]

2). If yes in 1), how to configure it in MPC8313, as I know it can set
TSEC1 to SGMII in LTIB uboot setting. How about in Linux Kernel driver
? Is it need extra setting or patch?

BRs, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


How the kernel printk works before do console_setup.

2009-06-23 Thread Johnny Hung
Hi All:
I have a powerpc arch platform. The default console is ttyS1 not
ttyS0 in the platform. My question is how the kernel print debug
message
like DBG before parse kernel command line and do console_setup
function. The command line passed to kernel about console info is
console=ttyS1.
So kernel can not print anything before parse cmd line and initial
console but the result is against. Anyone point me or give me a clue
is appreciate.

BR, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: How the kernel printk works before do console_setup.

2009-06-24 Thread Johnny Hung
2009/6/25 Benjamin Herrenschmidt :
>
>> Before the console is set up, the printk data is formatted
>> and put into the kernel log buffer, but not sent to any console.
>> Any messages printk'ed before that are buffered but do not
>> appear.  When the console is initialized, then all buffered
>> messages are sent to the console, and subsequent printks cause
>> the message to go to the log buffer, but then immediately
>> get sent from there to the console.
>>
>> Under certain conditions you can examine the log buffer of
>> a kernel that failed to initialize it's console, after a
>> warm reset of the machine, using the firmware memory dump
>> command.
>
> On ppc, we have tricks to display things earlier :-)
>
> We can initialize the serial ports way before console_setup() (and we do
> in most cases) and we use what we call the "udbg" console until the real
> one takes over. The "udbg" console is a very small layer which outputs
> via a provided "putc" routine. Platforms can provide their own here, we
> have a collection of standard ones for legacy UARTs (it should be
> automatically setup in that case by the code in legacy_serial), Apple
> ESCCs, etc... We even have compile time options that allow that stuff to
> be initialized before start_kernel...

Thank you. This is what I described and want to understand. The
arch/powerpc/kernel/legacy_serial.c
do find_legacy_serial_ports then take a default serial port by using
open firmware device tree
information. The find_legacy_serial_ports() called form setup_arch but
I don't know who call
setup_arch (setup_32.c)function. Can you give me a hint ? Thanks in advanced.

BRs, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


PCI device support in Open Firmware (device tree syntax)

2009-06-29 Thread Johnny Hung
Hi all,
I am working in customized Freescale MPC8313 board. There are two
PCI devices (Broadcom Switch) in PCI bus.
Each PCI device has its configuration space. It contains
vendor/product ID (RO)..., and important information, likes BARs
(Base Address), INT line and IRQ(RW). These resources (BAR, INT, IRQ)
is assigned from BIOS in x86 arch.
My problem is how to assign PCI device resources in device tree. I
can't find exist dts file as an example. I have read the
http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf
file. It's described detailed about device tree
except PCI device. So, anyone give me a hint or sany tuff is appreciated.
   I think Linux Kernel parses device tree and get the PCI device
resources information then write into PCI configuration space.
So PCI device driver do pci_register_driver (get resource) and do
itself probe for PCI device. Is it right? CMIIAW

BRs, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: PCI device support in Open Firmware (device tree syntax)

2009-06-29 Thread Johnny Hung
Thanks for your reply. So there are no PCI device resource info in
flat device tree.
How do PCI device resources be assign in general case or is there any example?
I am so confusing, would you please give me detailed describle?

BRs, H. Johnny
>
> With flat device trees, PCI devices are not typically included as they
> can be probed instead.  Interrupt mapping is conveyed by the
> interrupt-map property in the PCI controller node.
>
> -Scott
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: PCI device support in Open Firmware (device tree syntax)

2009-06-30 Thread Johnny Hung
2009/6/30 Marco Stornelli :
> 2009/6/30 Johnny Hung :
>> Thanks for your reply. So there are no PCI device resource info in
>> flat device tree.
>> How do PCI device resources be assign in general case or is there any 
>> example?
>> I am so confusing, would you please give me detailed describle?
>>
>> BRs, H. Johnny
>>>
>
> You should look at your bootloader about the initial configuration of
> the pci device, in general it should (more or less) do the work of
> BIOS as you said. After that the kernel can probe them.
>
> Marco
>
You are right. u-boot do PCI device BAR resources assign and flat
device tree describe PCI device interrupt-map. I use "lspci -s xxx -x"
for the PCI device, the resources was assigned properly.
Thanks.

BRs, H. Johnny
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev