9
0
Fork 0
Commit Graph

132 Commits

Author SHA1 Message Date
Sascha Hauer 98360be0fe Documentation: remove doxygen documentation
The doxygen documentation is long outdated. Remove it. It will
be replaced with sphinx based documentation later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-26 10:09:52 +02:00
Michel Stam 9f556d4b6f x86: ns16550: Rework driver to allow for x86 I/O space
The current implementation fakes a memory-mapped I/O device
at 0x3f8 and 0x2f8, then uses platform read/write functions
to do the actual reading and writing. These platform functions
only exist for the x86 platform; better to move the I/O
routines into the driver and have the driver request I/O ports
using request_ioport_region.

Signed-off-by: Michel Stam <michel@reverze.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-09 19:31:42 +02:00
Michel Stam 4d94f56c6c common: Allow for I/O mapped I/O
Rework the current framework so that I/O mapped I/O resources are
also possible.

Signed-off-by: Michel Stam <michel@reverze.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-08 08:17:55 +02:00
Sascha Hauer 74213ed9a7 Merge branch 'for-next/partitionhelper'
Conflicts:
	fs/devfs-core.c
2014-03-07 09:25:53 +01:00
Uwe Kleine-König 2a644bed63 devfs: partitioning: add new helper devfs_create_partitions
Compared to devfs_add_partition which adds a single partition
devfs_create_partitions creates several partitions at once. One nice
benefit is that this simplifies appending partitions because the start
of the latter partition doesn't need to be specified explicitly.
Also dev_add_bb_dev() is called by the new helper if the bbname is
specified for a partition.

Note that adding partitions is also more flexible now (also via
devfs_add_partition) because negative values for offset and size now
have a proper meaning instead of creating broken partitions.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:19:07 +01:00
Uwe Kleine-König a7f78e7273 devfs_add_partition: make flags parameter unsigned
The value is only used to assign to a (*struct cdev)->flags which is an
unsigned int and it is passed as fourth parameter of mtd_add_partition which
is an unsigned long.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:20:26 +01:00
Sascha Hauer 394edf6377 i2c/spi: match of_modaliases
i2c/spi devices in the devicetree often come with a "vendor,device"
comaptible string. These do not match in barebox, so add a
device_match_of_modalias function which does exactly that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-07 09:28:02 +01:00
Sascha Hauer f92f309c54 device: Add functions to add resources
We currently have functions to add a device based on function parameters.
This adds the corresponding functions to add resources to a device without
registering the device itself. This is useful to manipulate devices before
registering them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:54 +01:00
Sascha Hauer 1369bfd44f cdev: store dos partition type in struct cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer fbf082b565 Merge branch 'for-next/of'
Conflicts:
	arch/arm/boards/freescale-mx53-loco/board.c
	drivers/of/Makefile
2013-08-05 12:50:06 +02:00
Sascha Hauer feefc3ef3b Merge branch 'for-next/mtd' 2013-08-05 12:49:58 +02:00
Sascha Hauer 5cd4fd8fba dma: apbh: Turn into a driver
This converts the apbh driver into a real driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 0ee203186d cdev: add device_find_partition
device_find_partition allows to find a partition of a device with
a particular name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:14 +02:00
Sascha Hauer 2672c906a4 cdev: allow to open a struct cdev
cdev_open() opens a cdev by name. This introduces cdev_do_open which
allows to open a cdev when the cdev is already found by other means.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:09 +02:00
Sascha Hauer bec70b3aaa cdev: introduce partition names
currently most partition cdevs have the name <devname>.<partname>
This makes it hard to find a partition by <partname>. This introduces
a partname field in struct cdev so that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:04 +02:00
Sascha Hauer 121c3d6e9c devfs: let devfs_add_partition return the new partition
Useful for unregistering later or for adding addional flags.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:15:47 +02:00
Alexander Shiyan 7bc400d14c base: Transform "platform_match" into "device_match" and make this function public
This change will allow reuse this function for other buses.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 10:08:10 +02:00
Sascha Hauer 8d2762ff56 driver: implement device_detect_by_name function
It becomes a common pattern for boards to find a device and
call device_detect on it. Add a convenience wrapper for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-26 18:17:12 +02:00
Sascha Hauer 8f9044927d Merge branch 'for-next/mci'
Conflicts:
	include/driver.h
2013-06-02 16:28:21 +02:00
Sascha Hauer 95e7982f99 devices: add detect mechanism
We often encounter the situation where slow devices should not be
probed during startup since probing is slow and maybe unnecessary
for unused devices. With MMC we have the 'probe' device parameter,
for ata we have the same, for USB we have the 'usb' command. Overall
this is not very consistent.
With MMC there is the additional problem that the probe parameter
is attached to the logical device when we often have the information
which physical device we want to probe.
This patch adds a 'detect' callback for devices and adds a command
to detect devices and to list the devices which are actually detecable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 12:32:05 +02:00
Sascha Hauer 73b0d228e5 driver: Attach info callback to device, not to driver
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer 0cb87c4d1e of: Add of_match_node function
To match a of_device_id arrays against a device_node. Same functionality
as in the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-20 15:53:06 +02:00
Sascha Hauer 4856aee6a8 Merge branch 'for-next/malloc-all-initcalls' 2013-04-04 14:20:32 +02:00
Sascha Hauer 1a66a77567 bus: Make struct device a pointer
struct bus_type contains an embedded struct device_d which is quite
a big structure. Dynamically allocate this instead to save the space
in the binary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 08:42:24 +01:00
Alexander Shiyan 54cbf39fca Introduce console_platform_driver() macro and use it for serial drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:44 +01:00
Alexander Shiyan 943e586fe6 Extend device_platform_driver macro
This patch extends device_platform_driver macro, so now we allow
use it with various init levels and subsystems.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:44 +01:00
Alexander Shiyan 927eb75795 Make "dev_get_resource" publicly available
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 09:22:17 +01:00
Alexander Shiyan 12ff763535 Introduce device_platform_driver() macro
device_platform_driver() - Helper macro for drivers that don't do
anything special in module registration. This eliminates a lot of
boilerplate. Driver registration will called on device_initcall.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 09:23:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD b537a772c2 consolidate print* in a single header
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 14:23:09 +01:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:

| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date:   Sat Nov 3 16:11:05 2012 +0100
|
|    bus: add bus device
|
|    automatically add it as parent of any bus device if none already specified
|
|    we have now a nice output per bus

If for example a FATfs is mounted this nice output per bus often ends with:

>     `---- fat0
>     `---- 0
>          `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
>          `---- sram00
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>]    lr : [<87f08a04>]
> sp : 86eff8c0  ip : 87f3fbde  fp : ffffffff
> r10: ffffffff  r9 : 00000000  r8 : 00000003
> r7 : 86f075b8  r6 : 00000002  r5 : ffffffec  r4 : 86f07544
> r3 : 00000000  r2 : 43f900b4  r1 : 00000020  r0 : 00000005
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)

This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
2012-12-12 15:04:27 +01:00
Sascha Hauer 8f32824c6e Merge branch 'for-next/phylib'
Conflicts:
	drivers/net/phy/phy.c
2012-12-07 16:43:21 +01:00
Sascha Hauer 86ee7f112f Merge branch 'for-next/misc' 2012-12-07 16:43:15 +01:00
Jean-Christophe PLAGNIOL-VILLARD f777b3b13f driver: introduce device_probe to manully probe a device
This will expect a driver to be specified
This is needed by the phylib the probe the generic phy if not driver found

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-20 09:38:25 +01:00
Jean-Christophe PLAGNIOL-VILLARD c2e568d19c bus: add bus device
automatically add it as parent of any bus device if none already specified

we have now a nice output per bus

barebox@Atmel at91sam9x5-ek:/
devices:
`---- platform
     `---- atmel_usart0
          `---- cs0
     `---- atmel_usart1
          `---- cs1
     `---- mem0
          `---- 0x00000000-0x07ffffff: /dev/ram0
     `---- mem1
          `---- 0x00000000-0x00007fff: /dev/sram0
     `---- mem2
          `---- 0x00000000-0x000037bf: /dev/defaultenv
     `---- mem3
          `---- 0x00000000-0xfffffffe: /dev/mem
     `---- cs2
     `---- w1-gpio
          `---- w1_bus0
               `---- w1-2d-0
                    `---- 0x00000000-0x0000007f: /dev/ds24310
               `---- w1-2d-1
                    `---- 0x00000000-0x0000007f: /dev/ds24311
               `---- w1-23-0
                    `---- 0x00000000-0x000001ff: /dev/ds24330
     `---- at91sam9x5cm
     `---- at91sam9x5ek
     `---- at91sam9x5dm
     `---- atmel_nand0
          `---- nand0
               `---- 0x00000000-0x1fffffff: /dev/nand0
               `---- 0x00000000-0x0003ffff: /dev/at91bootstrap_raw
               `---- 0x00040000-0x0009ffff: /dev/self_raw
               `---- 0x000a0000-0x000bffff: /dev/env_raw
               `---- 0x000c0000-0x000dffff: /dev/env_raw1
               `---- 0x00000000-0x0003ffff: /dev/nand0.at91bootstrap
               `---- 0x00040000-0x0009ffff: /dev/nand0.barebox
               `---- 0x000a0000-0x000bffff: /dev/nand0.bareboxenv
               `---- 0x000c0000-0x000dffff: /dev/nand0.bareboxenv2
               `---- 0x000e0000-0x000fffff: /dev/nand0.oftree
               `---- 0x00100000-0x001fffff: /dev/nand0.free
               `---- 0x00200000-0x007fffff: /dev/nand0.kernel
               `---- 0x00800000-0x07ffffff: /dev/nand0.rootfs
               `---- 0x08000000-0x1fffffff: /dev/nand0.data
     `---- macb0
          `---- miibus0
          `---- eth0
     `---- atmel_spi0
          `---- mtd_dataflash0
               `---- dataflash0
                    `---- 0x00000000-0x0041ffff: /dev/dataflash0
     `---- atmel_mci0
          `---- mci0
               `---- 0x00000000-0x1d9bfffff: /dev/disk0
               `---- 0x00100000-0x064fffff: /dev/disk0.0
               `---- 0x06500000-0x1d9bfffff: /dev/disk0.1
     `---- i2c-gpio0
          `---- i2c0
               `---- qt10700
                    `---- cs3
`---- mdio_bus
`---- spi
`---- i2c
`---- w1_bus
`---- fs
     `---- ramfs0
     `---- devfs0
`---- net
`---- global

drivers:
atmel_usart
ramfs
devfs
fat
macb
Generic PHY
atmel_nand
mtd_dataflash
m25p80
atmel_spi
i2c-gpio
mci
atmel_mci
qt1070
w1-gpio
ds2431
ds2433
mem

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-19 11:36:33 +01:00
Jean-Christophe PLAGNIOL-VILLARD 7ce8a13c26 bus_for_each_device/bus_for_each_driver: add () to allow use &bus
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-19 11:35:31 +01:00
Jean-Christophe PLAGNIOL-VILLARD d54f5b1b48 driver: add support for requesting resource by name
this will allow to avoid issue with resource order

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:24:12 +01:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Jean-Christophe PLAGNIOL-VILLARD ed942bc085 driver: search device and driver based on the bus instead of all
This will allow reduce the number of driver and device to search on.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:13 +02:00
Jean-Christophe PLAGNIOL-VILLARD 72b0a6503f driver: register bus
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:13 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Sascha Hauer 58f3457f4f of: add devicetree probing support
This adds code to probe devices from a devicetree. Most helper
functions are directly imported from Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 11:47:42 +02:00
Sascha Hauer 420815465e driver: Add platform_device_id mechanism
It is common for drivers to handle multiple similar devices. On
Linux the driver can distinguish between the devices using the
platform_device_id mechanism. Introduce the same for barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 11:47:42 +02:00
Sascha Hauer 08a7d5a625 driver: rewrite dev_printf as a function
Printing device context normally should be "driver instance:",
but instead we printed the device name twice. This patch fixes
this and as a bonus makes the binary a bit smaller. Instead of
a '@' between driver and instance this function now prints a
whitespace which is a bit more like Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 11:47:42 +02:00
Jean-Christophe PLAGNIOL-VILLARD ad327344c9 driver: set DEVICE_ID_DYNAMIC to -2 and DEVICE_ID_SINGLE to -1
so we can have the same behaviour as in the kernel for id = -1

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-12 14:49:32 +02:00
Antony Pavlov dab7dfcec3 serial_ns16550: change the driver's name
The name "serial_ns16550" is not handy because the devices
will have the names like "serial_ns165500", "serial_ns165501",
"serial_ns165502" etc.

The names like "ns16550_serial0" and "ns16550_serial1" look
much better.

Also it is reasonable to make serial driver's names unification.
E.g. see the names for drivers in drivers/serial directory:
 "netx_serial",
 "mpc5xxx_serial",
 "altera_serial",
 "s3c_serial",
 "imx_serial",
 "pxa_serial",
 "blackfin_serial",
 "stm_serial",
 "pl010_serial",
and even "g_serial" in ./drivers/usb/gadget/serial.c

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-20 10:01:25 +02:00
Sascha Hauer 8d064097eb fs: fix standard zero, full devices
The standard devices are currently broken since they have
the size ~0. As now files use loff_t as file size which is a signed
type the read implementation gets confused and now returns -1.

The current implementation also has the (somewhat theorical) problem
that we do not have real streaming devices, so /dev/zero went out
of zeroes after reading 4GB (or now LLONG_MAX).

This patch introduces a new cdev flag DEVFS_IS_CHARACTER_DEV and a new
file size flag FILE_SIZE_STREAM which makes it possible to create
real stream devices instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-04 08:38:22 +02:00
Sascha Hauer f22d4e2778 Merge branch 'for-next/sparse' 2012-07-02 10:59:37 +02:00
Sascha Hauer 6f5ea13f28 Do not use iomem space for dev_get_mem_region
It is mostly used for mmapping sdram which is no iomem.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 22:34:54 +02:00
Sascha Hauer cfcfc66d54 partitions: Make 64bit capable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:25 +02:00