On Wed, 30 Jan 2013 13:15:24 +0100, Andreas Larsson <andreas@xxxxxxxxxxx> wrote:This patch relies upon parts of the "of, of_gpio, of_spi: Fix and
improve of_parse_phandle_with_args, of_gpio_named_count and
of_spi_register_master" patchset - https://lkml.org/lkml/2012/12/27/54
(v2 at https://lkml.org/lkml/2013/1/29/308).
Maybe the different out/in_be32 vs iowrite/read32be in spi-fsl-lib.h is
over the top, but I'm not sure if there might be subtle differences
between those on powerpc and I don't have any fsl hardware to try things
out on.
Changing to ioread/write globally should be fine. I would change it and get
someone with an fsl board to try it out. That will reduce the diffstat a
bit.
As is, this is quite an invasive patch, so I'm not going to be
comfortable merging it without at least one 3rd party tester. (Breaking
things up into discrete patches will make me less nervous and possible
to merge parts while still revising others.
+#ifdef CONFIG_FSL_SOC
else if (prop && !strcmp(prop, "qe"))
pdata->flags = SPI_CPM_MODE | SPI_QE;
else if (of_device_is_compatible(np, "fsl,cpm2-spi"))
pdata->flags = SPI_CPM_MODE | SPI_CPM2;
else if (of_device_is_compatible(np, "fsl,cpm1-spi"))
pdata->flags = SPI_CPM_MODE | SPI_CPM1;
+#endif
The ifdefs are ugly and these lines won't affect sparc. Just leave them
in.
+/* TYPE_GRLIB SPI Controller capability register definitions */
+#define SPCAP_SSEN(x) (((x) >> 16) & 0x1)
+#define SPCAP_SSSZ(x) (((x) >> 24) & 0xff)
+#define SPCAP_MAXWLEN(x) (((x) >> 20) & 0xf)
Nit: inconsistent whitespace (tabs vs. spaces)
+ ret = of_property_read_u32(dev->of_node, "bus-number", &bus_num);
+ if (!ret)
+ master->bus_num = bus_num;
Drop these lines. Never set the bus number explicitly when using DT. If
you really want to assign a particular bus number, then use an alias.
That's all the comments I've got for now, but there are an awful lot of
#defines that are added to the driver which is kind of ugly. I'm not
going to nack over that, but it would be good to clean it up and do some
better abstraction.