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 | |
| 18 | switch (cs) { |
| 19 | case 0: |
| 20 | clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_UNMASK); |
| 21 | setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0); |
| 22 | break; |
| 23 | case 2: |
| 24 | clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK); |
| 25 | setbits_8(&gpio->par_timer, GPIO_PAR_TIMER_T2IN_DSPIPCS2); |
| 26 | break; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | void dspi_chip_unselect(int cs) |
| 31 | { |
| 32 | struct gpio *gpio = (struct gpio *)MMAP_GPIO; |
| 33 | |
| 34 | switch (cs) { |
| 35 | case 0: |
| 36 | clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0); |
| 37 | break; |
| 38 | case 2: |
| 39 | clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK); |
| 40 | break; |
| 41 | } |
| 42 | } |
| 43 | #endif /* CONFIG_CF_DSPI */ |