Something that I don't understand...

Screwface
Hi,

I'm learning embedded systems "the hard way". I'm comparing what
FriendlyARM did in their Linux BSP (mini2440) and what people usually do.
I don't understand FriendlyARM's approach of handling hardware peripherals
such LEDs, GPIO, buzzer and so on: they disabled everything in the kernel
and they wrote specific drivers to have access to those peripherals.
What I understand from vanilla kernels is you have to declare your
peripherals un mach-mini2440.c file and then you will have access to your
peripherals via /sys sysfs.

So I wonder why FriendlyARM chose to write drivers.

Can somebody help me to understand driver handling?

Juergen Beisert
In the open source area you can do what you want: you can go the mainline
way, developing all the stuff for it, bring it into the vanilla kernel and
enable users to just use any vanilla kernel they want and it will work
out-of-the-box. Or you can go your own way. Develop things in a way you
like or want (or need). Find yourself the better way.

Screwface
Thanks for your reply Juergen.
I understand a bit more. I assume you have to comply with certain rules to
see your driver integrated in the vanilla kernel. And as far as I know,
FriendlyARM is known to do ugly things in the kernel, so maybe they didn't
want to have to respect those rules. But they could have done more ugly
things in mach-mini2440.c...

Is there a way to load drivers automatically at startup? Place insmod in
rcS file?

Juergen Beisert
If you use my Mini2440 BSP just enable module loading at system start-up
and add the module names to be loaded into '/etc/modules'. On other systems
I don't know.

Screwface
I tried to use your BSP, but it was a bit complicated for what I wanted to
do. I have to reflash Barebox instead of uboot and so on. When I'll have a
bit more time, I'll try it deeper. Anyway, I tried to take your kernel as
you made several patches to improve it. I wondered why we do not get your
patches added in new kernel revisions. Did you submit them, or do you
prefer to maintain a patched kernel?

By the way, for the moment I use vanilla kernel with modifications in
mach-mini2440.c to get the touchscreen working. I've seen you made many
tuning in the config of your kernel, I tried to report them in the vanilla
kernel I use, but I'm not an expert so I don't really understand
everything. I'm looking for a way to understand how kernel works and have
an explanation of the options.

I have to find time to read Linux kernel in a nutshell and kernel
documentation also. By now I try to find answer to some question a bit
quickly than reading the whole book and documentation, even if it would be
very interesting.

TheRegnirps
Screwface, there are mainly two kinds of drivers. Kernel drivers, and a
simpler and more restrictive method for making userland drivers. The ones
from FA you have seen are userland drivers. It is probably more than you
want to read, but "Essential Linux Drivers" by Sreekrishnan Venkateswaran
goes into detail with emphasis on userland drivers for embedded design.

Juergen Beisert
I'm still unsure if it makes sense to bring the modifications into
mainline. First of all the platform files will be obsolete in the future
because the 'device tree' will replace them. Some other modifications are
not generic enough to run on all samsung CPUs. That's why they are all
still in BSP's kernel.

Screwface
Ok, that's clear now.

@TheRegnirps : thant you for the book reference, I'll keep it in mind and
try to find it. I'd like to learn a bit more when I'll have more time.

@Juergen Beisert : ok, you mean Mini2440 is supported by now in the
mainline kernel but maybe in the future it will be considered as obsolete.
So in the future I'll start to use your kernel via your git repository (if
I manage to do it!) in a first step and your whole BSP in a second step.

Thanks a lot for your replies

Juergen Beisert
Not the Mini2440 support in the kernel will be obsolete. Only the
'mach-mini2440.c' file, as it will be replaced by a 'device tree file'. The
'device tree' is some kind of 'database' that describes the system and its
configuration.

Screwface
Oh, I have not enough knowledge of kernel and its future to see what you
mean. I'll see that in the future. For the moment I'll use your patch files
with actual vanilla kernel. It will be enough for me to learn basic
concepts.

Thank you for your explanation

sudhakar_G
Hi Juergen,
I was using the mini2440 board.I want to drive the peripherals
LEDS,GPIO,I2C,ADC,TOUCHSCREEN,SPI,RTC.How should i start ? any docs ? any
sample driver prgs? 
Please help me.

Regards,
sudhakar.g