blob: 456af171a4e23b3e19a5b19c6614860a91ff8db4 [file] [log] [blame]
Angelo Dureghello9ffe1eb2019-03-13 21:46:53 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2019
4 * Angelo Dureghello <angleo@sysam.it>
5 *
6 * CPU specific dspi routines
7 */
8
9#include <common.h>
10#include <asm/immap.h>
11#include <asm/io.h>
12
13#ifdef CONFIG_CF_DSPI
14void dspi_chip_select(int cs)
15{
16 struct gpio *gpio = (struct gpio *)MMAP_GPIO;
17
Angelo Dureghello9ffe1eb2019-03-13 21:46:53 +010018#ifdef CONFIG_MCF5441x
19 switch (cs) {
20 case 0:
21 clrbits_8(&gpio->par_dspi0,
22 ~GPIO_PAR_DSPI0_PCS0_MASK);
23 setbits_8(&gpio->par_dspi0,
24 GPIO_PAR_DSPI0_PCS0_DSPI0PCS0);
25 break;
26 case 1:
27 clrbits_8(&gpio->par_dspiow,
28 GPIO_PAR_DSPIOW_DSPI0PSC1);
29 setbits_8(&gpio->par_dspiow,
30 GPIO_PAR_DSPIOW_DSPI0PSC1);
31 break;
32 }
33#endif
34}
35
36void dspi_chip_unselect(int cs)
37{
38 struct gpio *gpio = (struct gpio *)MMAP_GPIO;
39
Angelo Dureghello9ffe1eb2019-03-13 21:46:53 +010040#ifdef CONFIG_MCF5441x
41 if (cs == 1)
42 clrbits_8(&gpio->par_dspiow, GPIO_PAR_DSPIOW_DSPI0PSC1);
43#endif
44}
45#endif /* CONFIG_CF_DSPI */