summaryrefslogtreecommitdiffstats
path: root/drivers/base
Commit message (Collapse)AuthorAgeFilesLines
* driver: implement device_detect_by_name functionSascha Hauer2013-06-261-0/+10
| | | | | | | 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>
* devices: add detect mechanismSascha Hauer2013-05-311-0/+7
| | | | | | | | | | | | | | | 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>
* driver: Attach info callback to device, not to driverSascha Hauer2013-05-301-16/+2
| | | | | | | | 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>
* param: Add info functionSascha Hauer2013-05-231-2/+6
| | | | | | | Some parameters may wish to provide some information about their meaning or possible values. Provide an info callback for parameters. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add initial pinctrl supportSascha Hauer2013-04-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a massively stripped down pinctrl support. The upper API consists of only of: int pinctrl_select_state(struct device_d *dev, const char *state); This is used to setup the pinmux for a device to a certain state. This function normally does not need to be called manually. The device core will setup the default state before probing a device. The pinctrl core has the job of handling the devicetree. It parses the pinctrl phandles for a device from devicetree, finds the correct pinctrl device and calls its set_state callback with the pinctrl setup device node. The simplicity of this pinctrl framework comes from the fact that we: - Limit usage to devicetree only for now. For non devicetree use the old legacy SoC specific APIs still can be used. - Do not parse the devicetree into internal data structures which are used by the drivers later. This adds the overhead that we may parse the devicetree multiple times for more dynamic setups, but on the other hand we do not need to parse devices from the devicetree we don't use in barebox - Do not detect resource conflicts. Since the framework mainly is a devicetree parser this would be hard to implement. It should be easy for board maintainers to avoid resource conflicts though. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bus: Make struct device a pointerSascha Hauer2013-03-142-4/+5
| | | | | | | | 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>
* Make "dev_get_resource" publicly availableAlexander Shiyan2013-02-181-1/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/base: fix corrupt device treeSascha Hauer2012-12-121-21/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 c2e568d19c5c34a05a1002d25280bf113b72b752 | 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>
* Merge branch 'for-next/phylib'Sascha Hauer2012-12-071-6/+17
|\ | | | | | | | | Conflicts: drivers/net/phy/phy.c
| * driver: introduce device_probe to manully probe a deviceJean-Christophe PLAGNIOL-VILLARD2012-11-201-6/+17
| | | | | | | | | | | | | | | | 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>
* | Merge branch 'for-next/driver'Sascha Hauer2012-12-072-0/+15
|\ \
| * | bus: add bus deviceJean-Christophe PLAGNIOL-VILLARD2012-11-192-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* / correct simple typo, "plarform_init"Robert P. J. Day2012-12-031-2/+2
|/ | | | | Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2012-11-161-2/+53
|\ | | | | | | | | | | | | Conflicts: commands/Makefile Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * driver: add support for requesting resource by nameJean-Christophe PLAGNIOL-VILLARD2012-10-301-0/+46
| | | | | | | | | | | | | | 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>
| * cosmetic: remove right alignment on driver listFranck Jullien2012-10-171-1/+1
| | | | | | | | | | | | | | | | In order to avoid misalignment, just remove the right alignment while printing the drivers list. Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * driver: print error message when probe failsSascha Hauer2012-10-071-1/+6
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | platform driver: Drop check for resource conflictsSascha Hauer2012-10-131-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check is wrong since it would have to check whether the new iomem region overlaps with an existing region. Checking for the base address only is not enough. Currently this is not possible because every device conflicts with the top iomem region which covers the whole address space. This at least fixes the regression that devices whose memory region begins at 0x0 can no longer be succesfully registered. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Alexander Shiyan <shc_work@mail.ru> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* | Merge branch 'pu/misc-fixes'Sascha Hauer2012-10-072-16/+16
|\ \ | |/ |/|
| * driver: make get_bus_by_name staticSascha Hauer2012-10-041-1/+1
| | | | | | | | | | | | We have no prototype for it, so it should be static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * driver: move dev_get_drvdata out of CONFIG_CMD_DEVINFOSascha Hauer2012-10-041-15/+15
| | | | | | | | | | | | | | dev_get_drvdata accidently is inside #ifdef CONFIG_CMD_DEVINFO. Move it out of there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | devinfo: display device bus nameJean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+4
| | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* | switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-043-21/+33
|/ | | | | | | | 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>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-033-10/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-173-10/+0
| | | | | | | | | | | | | | 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>
* | driver: search device and driver based on the bus instead of allJean-Christophe PLAGNIOL-VILLARD2012-09-232-5/+9
| | | | | | | | | | | | | | 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>
* | driver: register busJean-Christophe PLAGNIOL-VILLARD2012-09-233-10/+39
| | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: add devicetree probing supportSascha Hauer2012-09-142-2/+28
| | | | | | | | | | | | | | 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>
* | driver: add dev_get_drvdata functionSascha Hauer2012-09-141-0/+10
| | | | | | | | | | | | | | | | Drivers need to get their driver data either from devicetree or the platform information. It should matter for the driver where this data comes from, so introduce a common function for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | driver: Add platform_device_id mechanismSascha Hauer2012-09-141-1/+16
| | | | | | | | | | | | | | | | 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>
* | driver: rewrite dev_printf as a functionSascha Hauer2012-09-141-0/+19
|/ | | | | | | | | | 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>
* Merge branch 'for-next/resource-size'Sascha Hauer2012-07-022-9/+9
|\ | | | | | | | | | | Conflicts: drivers/base/resource.c fs/fs.c
| * resource: store 'end' instead of 'size' in struct resourceSascha Hauer2012-07-012-9/+9
| | | | | | | | | | | | | | | | | | | | Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/sparse'Sascha Hauer2012-07-021-3/+3
|\ \
| * | Do not use iomem space for dev_get_mem_regionSascha Hauer2012-06-301-3/+3
| |/ | | | | | | | | | | It is mostly used for mmapping sdram which is no iomem. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/64bit'Sascha Hauer2012-07-021-1/+1
|\ \
| * | make cdev 64bit capableSascha Hauer2012-06-301-1/+1
| |/ | | | | | | | | | | Next step to 64bit support: Make cdev size a 64bit type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / ehci: Fix resource sizeSascha Hauer2012-07-021-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | We now have a resource size for the ehci hccr register space. This was assumed to be 0x40 in size. On OMAP though it is only 0x10 and then the hccr resource conflicts with the hcor resource which results in a non working ehci port on beagle and panda boards. This patch adds a nonintrusive workaround, it limits the hccr resource to 0x10, which then also works on OMAP. Later we should drop the multiple resources for the ehci port and make the resource as specified in the datasheets. This is broken since: commit 08845e41fba2b16dd3050b6b910c615e1bb8e57c Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Wed May 23 12:54:24 2012 +0200 usb ehci: Add resource sizes add_usb_ehci_device registers resources with size 0. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/base: bail out if request_iomem_region failsSascha Hauer2012-06-271-0/+2
| | | | | | | When request_iomem_region fails we have to bail out instead of dereferencing res->start. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* print out resource_size_t correctlySascha Hauer2012-06-251-1/+2
| | | | | | | resource_size_t can be 32bit or 64bit depending on the architecture. Add a define for it to be able to printf a resource_size_t correctly Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb ehci: Add resource sizesSascha Hauer2012-05-311-0/+2
| | | | | | add_usb_ehci_device registers resources with size 0. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* complete: add device name complete support for devinfoJean-Christophe PLAGNIOL-VILLARD2012-04-301-0/+2
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* devinfo: use accessor function for parametersSascha Hauer2012-04-241-1/+1
| | | | | | | Instead of directly accessing the struct member of struct param_d use the provided getter function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* device: make singular devices possibleSascha Hauer2012-04-151-2/+5
| | | | | | | | | Currently all devices have an id meaning that all devicenames end with a number. This patch adds a DEVICE_ID_SINGLE to make it ppossible to register a device without an id assigned to it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* NET: Add support for ks8851_mllJan Weitzel2012-03-131-0/+33
| | | | | | | Add support for KS8851 16bit MLL chip from Micrel Inc. Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: remove struct command pointer from commandsSascha Hauer2012-02-271-1/+1
| | | | | | This is unused in all commands and thus can be removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devices: unregister children when unregistering a deviceSascha Hauer2012-02-171-5/+15
| | | | | | | | | | | | | | | | | We currently do not allow to unregister a device when it has children. However, the return value is seldomly checked. Also this breaks for hot pluggable devices like USB which we have to unregister when they disappear. The best way to fix this is to unregister our children and also the partitions on the unregistered device. We unregister the device first and then afterwards the children. We do this because for example network devices have a miidev as child which they unregister themselves. So we only have to unregister the children which are not cleaned up by the drivers, namely fs devices. Also, unregister all partitions on a disappearing device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Remove the obsolet driver for the DM9000E ethernet deviceJuergen Beisert2011-12-141-1/+1
| | | | | | | | Support for the old DM9000E device is now part of the new dm9k.c driver. So, remove the old driver source and switch all users to the new driver. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* implement resource management for platform devicesSascha Hauer2011-12-041-2/+27
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: switch to generic memory banksSascha Hauer2011-09-231-15/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>