Commit | Line | Data |
---|---|---|
bd41b99d LW |
1 | /* |
2 | * | |
3 | * arch/arm/mach-u300/padmux.c | |
4 | * | |
5 | * | |
6 | * Copyright (C) 2009 ST-Ericsson AB | |
7 | * License terms: GNU General Public License (GPL) version 2 | |
8 | * U300 PADMUX functions | |
9 | * Author: Linus Walleij <linus.walleij@stericsson.com> | |
10 | * | |
11 | */ | |
12 | #include <linux/io.h> | |
13 | #include <linux/err.h> | |
14 | #include <mach/u300-regs.h> | |
15 | #include <mach/syscon.h> | |
16 | ||
17 | #include "padmux.h" | |
18 | ||
19 | /* Set the PAD MUX to route the MMC reader correctly to GPIO0. */ | |
20 | void pmx_set_mission_mode_mmc(void) | |
21 | { | |
22 | u16 val; | |
23 | ||
24 | val = readw(U300_SYSCON_VBASE + U300_SYSCON_PMC1LR); | |
25 | val &= ~U300_SYSCON_PMC1LR_MMCSD_MASK; | |
26 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_PMC1LR); | |
27 | val = readw(U300_SYSCON_VBASE + U300_SYSCON_PMC1HR); | |
28 | val &= ~U300_SYSCON_PMC1HR_APP_GPIO_1_MASK; | |
29 | val |= U300_SYSCON_PMC1HR_APP_GPIO_1_MMC; | |
30 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_PMC1HR); | |
31 | } | |
32 | ||
33 | void pmx_set_mission_mode_spi(void) | |
34 | { | |
35 | u16 val; | |
36 | ||
37 | /* Set up padmuxing so the SPI port and its chipselects are active */ | |
38 | val = readw(U300_SYSCON_VBASE + U300_SYSCON_PMC1HR); | |
39 | /* | |
40 | * Activate the SPI port (disable the use of these pins for generic | |
41 | * GPIO, DSP, AAIF | |
42 | */ | |
43 | val &= ~U300_SYSCON_PMC1HR_APP_SPI_2_MASK; | |
44 | val |= U300_SYSCON_PMC1HR_APP_SPI_2_SPI; | |
45 | /* | |
46 | * Use GPIO pin SPI CS1 for CS1 actually (it can be used for other | |
47 | * things also) | |
48 | */ | |
49 | val &= ~U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK; | |
50 | val |= U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI; | |
51 | /* | |
52 | * Use GPIO pin SPI CS2 for CS2 actually (it can be used for other | |
53 | * things also) | |
54 | */ | |
55 | val &= ~U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK; | |
56 | val |= U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI; | |
57 | writew(val, U300_SYSCON_VBASE + U300_SYSCON_PMC1HR); | |
58 | } |