mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
spi/spi-fsl-spi: Make driver usable in CPU mode outside of an FSL_SOC environment
This makes the spi-fsl-spi driver usable in CPU mode outside of an FSL_SOC and even an powerpc environment by moving CPM mode functionality to a separate file that is only compiled and linked in an FSL_SOC environment and adding some ifdefs to hide types and functions or provide alternatives. For devicetree probing a "clock-frequency" property is used for clock frequency instead of calls to FSL_SOC-specific functions. Acked-by: Anton Vorontsov <anton@enomsg.org> Signed-off-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
58ad60bbb2
commit
e8beacbb85
9 changed files with 520 additions and 405 deletions
|
@ -23,7 +23,9 @@
|
|||
#include <linux/mm.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#ifdef CONFIG_FSL_SOC
|
||||
#include <sysdev/fsl_soc.h>
|
||||
#endif
|
||||
|
||||
#include "spi-fsl-lib.h"
|
||||
|
||||
|
@ -208,6 +210,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
|
|||
/* Allocate bus num dynamically. */
|
||||
pdata->bus_num = -1;
|
||||
|
||||
#ifdef CONFIG_FSL_SOC
|
||||
/* SPI controller is either clocked from QE or SoC clock. */
|
||||
pdata->sysclk = get_brgfreq();
|
||||
if (pdata->sysclk == -1) {
|
||||
|
@ -217,6 +220,11 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
|
|||
goto err;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ret = of_property_read_u32(np, "clock-frequency", &pdata->sysclk);
|
||||
if (ret)
|
||||
goto err;
|
||||
#endif
|
||||
|
||||
prop = of_get_property(np, "mode", NULL);
|
||||
if (prop && !strcmp(prop, "cpu-qe"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue