blob: 254c7a35d80ea5b0b5745f68447b3a6072521fbb [file] [log] [blame]
Albin Tonnerre94539672009-08-24 18:03:26 +02001/*
2 * Copyright (C) 2009
3 * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Albin Tonnerre94539672009-08-24 18:03:26 +02006 */
7
8#include <common.h>
9#include <asm/arch/hardware.h>
10#include <asm/arch/at91_spi.h>
11#include <asm/arch/gpio.h>
12#include <spi.h>
13
14#define SBC_A9260_CS0_PIN AT91_PIN_PA3
15#define SBC_A9260_CS1_PIN AT91_PIN_PC11
16
17int spi_cs_is_valid(unsigned int bus, unsigned int cs)
18{
19 return bus == 0 && (cs == 1 || cs == 0);
20}
21
22void spi_cs_activate(struct spi_slave *slave)
23{
24 if(slave->cs == 0)
25 at91_set_gpio_value(SBC_A9260_CS0_PIN, 0);
26 else if(slave->cs == 1)
27 at91_set_gpio_value(SBC_A9260_CS1_PIN, 0);
28}
29
30void spi_cs_deactivate(struct spi_slave *slave)
31{
32 if(slave->cs == 0)
33 at91_set_gpio_value(SBC_A9260_CS0_PIN, 1);
34 else if(slave->cs == 1)
35 at91_set_gpio_value(SBC_A9260_CS1_PIN, 1);
36}
37
38void spi_init_f(void)
39{
40 /* everything done in board_init */
41}