]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/include/asm/arch-uniphier/led.h
Merge branch 'u-boot-marvell/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / arch / arm / include / asm / arch-uniphier / led.h
1 /*
2  * Copyright (C) 2012-2014 Panasonic Corporation
3  *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #ifndef ARCH_LED_H
9 #define ARCH_LED_H
10
11 #include <config.h>
12
13 #define LED_CHAR_0      0x7e
14 #define LED_CHAR_1      0x0c
15 #define LED_CHAR_2      0xb6
16 #define LED_CHAR_3      0x9e
17 #define LED_CHAR_4      0xcc
18 #define LED_CHAR_5      0xda
19 #define LED_CHAR_6      0xfa
20 #define LED_CHAR_7      0x4e
21 #define LED_CHAR_8      0xfe
22 #define LED_CHAR_9      0xde
23
24 #define LED_CHAR_A      0xee
25 #define LED_CHAR_B      0xf8
26 #define LED_CHAR_C      0x72
27 #define LED_CHAR_D      0xbc
28 #define LED_CHAR_E      0xf2
29 #define LED_CHAR_F      0xe2
30 #define LED_CHAR_G      0x7a
31 #define LED_CHAR_H      0xe8
32 #define LED_CHAR_I      0x08
33 #define LED_CHAR_J      0x3c
34 #define LED_CHAR_K      0xea
35 #define LED_CHAR_L      0x70
36 #define LED_CHAR_M      0x6e
37 #define LED_CHAR_N      0xa8
38 #define LED_CHAR_O      0xb8
39 #define LED_CHAR_P      0xe6
40 #define LED_CHAR_Q      0xce
41 #define LED_CHAR_R      0xa0
42 #define LED_CHAR_S      0xc8
43 #define LED_CHAR_T      0x8c
44 #define LED_CHAR_U      0x7c
45 #define LED_CHAR_V      0x54
46 #define LED_CHAR_W      0xfc
47 #define LED_CHAR_X      0xec
48 #define LED_CHAR_Y      0xdc
49 #define LED_CHAR_Z      0xa4
50
51 #define LED_CHAR_SPACE  0x00
52 #define LED_CHAR_DOT    0x01
53
54 #define LED_CHAR_       (LED_CHAR_SPACE)
55
56 /** Macro to translate 4 characters into integer to display led */
57 #define LED_C2I(C0, C1, C2, C3)                 \
58         (~(                                     \
59                 (LED_CHAR_##C0 << 24) |         \
60                 (LED_CHAR_##C1 << 16) |         \
61                 (LED_CHAR_##C2 <<  8) |         \
62                 (LED_CHAR_##C3)                 \
63         ))
64
65 #if defined(CONFIG_SUPPORT_CARD_LED_BASE)
66
67 #define LED_ADDR    CONFIG_SUPPORT_CARD_LED_BASE
68
69 #ifdef __ASSEMBLY__
70
71 #define led_write(C0, C1, C2, C3)  raw_led_write LED_C2I(C0, C1, C2, C3)
72 .macro raw_led_write data
73         ldr r0, =\data
74         ldr r1, =LED_ADDR
75         str r0, [r1]
76 .endm
77
78 #else /* __ASSEMBLY__ */
79
80 #include <asm/io.h>
81
82 #define led_write(C0, C1, C2, C3)               \
83 do {                                            \
84         raw_led_write(LED_C2I(C0, C1, C2, C3)); \
85 } while (0)
86
87 static inline void raw_led_write(u32 data)
88 {
89         writel(data, LED_ADDR);
90 }
91
92 #endif /* __ASSEMBLY__ */
93
94 #else /* CONFIG_SUPPORT_CARD_LED_BASE */
95
96 #define led_write(C0, C1, C2, C3)
97 #define raw_led_write(x)
98
99 #endif /* CONFIG_SUPPORT_CARD_LED_BASE */
100
101 #endif /* ARCH_LED_H */