diff options
| author | Roman Yeryomin <roman@advem.lv> | 2013-05-26 01:02:55 +0300 | 
|---|---|---|
| committer | Roman Yeryomin <roman@advem.lv> | 2013-05-26 01:02:55 +0300 | 
| commit | 342045a35b1981a89e4bc80842b10c065e1050da (patch) | |
| tree | 4140720b20e8d641c11da882010d6130a75fef21 /target/linux/generic/patches-3.8/033-backport-spi-of-Use-DT-aliases-for-assigning-bus-number.patch | |
| parent | 7338133dde8238afce34676214b494c8db96689b (diff) | |
| parent | 1a116ce7818ecee5d167a9c0ebb1a0feca9120e6 (diff) | |
Merge trunk into realtek-unstable
Conflicts:
	Config.in
	feeds.conf.default
	package/base-files/files/etc/hotplug2-common.rules
	package/network/config/netifd/files/etc/init.d/network
Diffstat (limited to 'target/linux/generic/patches-3.8/033-backport-spi-of-Use-DT-aliases-for-assigning-bus-number.patch')
| -rw-r--r-- | target/linux/generic/patches-3.8/033-backport-spi-of-Use-DT-aliases-for-assigning-bus-number.patch | 37 | 
1 files changed, 37 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.8/033-backport-spi-of-Use-DT-aliases-for-assigning-bus-number.patch b/target/linux/generic/patches-3.8/033-backport-spi-of-Use-DT-aliases-for-assigning-bus-number.patch new file mode 100644 index 000000000..02a2eca17 --- /dev/null +++ b/target/linux/generic/patches-3.8/033-backport-spi-of-Use-DT-aliases-for-assigning-bus-number.patch @@ -0,0 +1,37 @@ +From bb29785e0d6d150181704be2efcc3141044625e2 Mon Sep 17 00:00:00 2001 +From: Grant Likely <grant.likely@secretlab.ca> +Date: Fri, 21 Dec 2012 19:32:09 +0000 +Subject: [PATCH] spi/of: Use DT aliases for assigning bus number + +Linux assigns a number to each spi_master in the system, but when the +platform used the device tree, the numbers are dynamically assigned and +are not predictable. In general this shouldn't matter since the kernel +doesn't use the bus number for anything other than matching a bus to +spi_boardinfo (not used for DT). However, sometimes userspace needs to +figure out which bus is which, so it makes sense to use the global +/aliases namespace to choose a specific bus number. + +It is safe to derive the bus number from an alias because aliases will +never cause two buses to try and use the same bus number. (At one time +the cell-index property was used for this purpose, but cell-index has +the risk of an id collision). + +Signed-off-by: Grant Likely <grant.likely@secretlab.ca> +Cc: Anatolij Gustschin <agust@denx.de> +Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> +--- + drivers/spi/spi.c |    3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -1135,6 +1135,9 @@ int spi_register_master(struct spi_maste + 	if (master->num_chipselect == 0) + 		return -EINVAL; +  ++	if ((master->bus_num < 0) && master->dev.of_node) ++		master->bus_num = of_alias_get_id(master->dev.of_node, "spi"); ++ + 	/* convention:  dynamically assigned bus IDs count down from the max */ + 	if (master->bus_num < 0) { + 		/* FIXME switch to an IDR based scheme, something like  | 
