summaryrefslogtreecommitdiff
path: root/arch/m68k/cpu/mcf5227x/dspi.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-05-24 08:12:22 -0400
committerTom Rini <trini@konsulko.com>2019-05-24 08:12:22 -0400
commit6760cef3856b12d6d3bb09ee58733ed3acaa82aa (patch)
treee169db6609ab6add1b2c0f917cbc12ba733025da /arch/m68k/cpu/mcf5227x/dspi.c
parent40920bdecc4e1b7096de6f546d7b5c2185554ba6 (diff)
parent196afe62d6b3e720295bbda046d260ccc6292a28 (diff)
Merge branch '2019-05-24-master-imports'
- Import Angelo's series to add basic DT support to m68k
Diffstat (limited to 'arch/m68k/cpu/mcf5227x/dspi.c')
-rw-r--r--arch/m68k/cpu/mcf5227x/dspi.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/m68k/cpu/mcf5227x/dspi.c b/arch/m68k/cpu/mcf5227x/dspi.c
new file mode 100644
index 0000000000..8fc4da271e
--- /dev/null
+++ b/arch/m68k/cpu/mcf5227x/dspi.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019
+ * Angelo Dureghello <angleo@sysam.it>
+ *
+ * CPU specific dspi routines
+ */
+
+#include <common.h>
+#include <asm/immap.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_CF_DSPI
+void dspi_chip_select(int cs)
+{
+ struct gpio *gpio = (struct gpio *)MMAP_GPIO;
+
+ switch (cs) {
+ case 0:
+ clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_UNMASK);
+ setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
+ break;
+ case 2:
+ clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);
+ setbits_8(&gpio->par_timer, GPIO_PAR_TIMER_T2IN_DSPIPCS2);
+ break;
+ }
+}
+
+void dspi_chip_unselect(int cs)
+{
+ struct gpio *gpio = (struct gpio *)MMAP_GPIO;
+
+ switch (cs) {
+ case 0:
+ clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
+ break;
+ case 2:
+ clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);
+ break;
+ }
+}
+#endif /* CONFIG_CF_DSPI */