Angelo Dureghello | 9ffe1eb | 2019-03-13 21:46:53 +0100 | [diff] [blame] | 1 | // 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 |
| 14 | void dspi_chip_select(int cs) |
| 15 | { |
| 16 | struct gpio *gpio = (struct gpio *)MMAP_GPIO; |
| 17 | |
Angelo Dureghello | 9ffe1eb | 2019-03-13 21:46:53 +0100 | [diff] [blame] | 18 | #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 | |
| 36 | void dspi_chip_unselect(int cs) |
| 37 | { |
| 38 | struct gpio *gpio = (struct gpio *)MMAP_GPIO; |
| 39 | |
Angelo Dureghello | 9ffe1eb | 2019-03-13 21:46:53 +0100 | [diff] [blame] | 40 | #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 */ |