diff options
author | Jeremy Kerr <jeremy.kerr@canonical.com> | 2010-01-30 03:45:26 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-02-09 10:34:10 -0500 |
commit | 337148812f97368a8ec4a69f1691e4c5ce3af494 (patch) | |
tree | 3fa2e5477c657cb2ebc40db9182d0989a5d60e13 /drivers/of/of_spi.c | |
parent | 2e89e685a8fd0e8334de967739d11e2e28c1a4dd (diff) |
of: assume big-endian properties, adding conversions where necessary
Properties in the device tree are specified as big-endian. At present,
the only platforms to support device trees are also big-endian, so we've
been acessing the properties as raw values.
We'd like to add device tree support to little-endian platforms too, so
add endian conversion to the sites where we access property values in
the common of code.
Compiled on powerpc (ppc44x_defconfig & ppc64_defconfig) and arm (fdt
support only for now).
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of/of_spi.c')
-rw-r--r-- | drivers/of/of_spi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c index bed0ed6dcdc1..f65f48b98448 100644 --- a/drivers/of/of_spi.c +++ b/drivers/of/of_spi.c | |||
@@ -23,7 +23,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np) | |||
23 | { | 23 | { |
24 | struct spi_device *spi; | 24 | struct spi_device *spi; |
25 | struct device_node *nc; | 25 | struct device_node *nc; |
26 | const u32 *prop; | 26 | const __be32 *prop; |
27 | int rc; | 27 | int rc; |
28 | int len; | 28 | int len; |
29 | 29 | ||
@@ -54,7 +54,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np) | |||
54 | spi_dev_put(spi); | 54 | spi_dev_put(spi); |
55 | continue; | 55 | continue; |
56 | } | 56 | } |
57 | spi->chip_select = *prop; | 57 | spi->chip_select = be32_to_cpup(prop); |
58 | 58 | ||
59 | /* Mode (clock phase/polarity/etc.) */ | 59 | /* Mode (clock phase/polarity/etc.) */ |
60 | if (of_find_property(nc, "spi-cpha", NULL)) | 60 | if (of_find_property(nc, "spi-cpha", NULL)) |
@@ -72,7 +72,7 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np) | |||
72 | spi_dev_put(spi); | 72 | spi_dev_put(spi); |
73 | continue; | 73 | continue; |
74 | } | 74 | } |
75 | spi->max_speed_hz = *prop; | 75 | spi->max_speed_hz = be32_to_cpup(prop); |
76 | 76 | ||
77 | /* IRQ */ | 77 | /* IRQ */ |
78 | spi->irq = irq_of_parse_and_map(nc, 0); | 78 | spi->irq = irq_of_parse_and_map(nc, 0); |