diff options
-rw-r--r-- | arch/xtensa/Kconfig | 30 | ||||
-rw-r--r-- | arch/xtensa/boot/dts/xtfpga.dtsi | 64 | ||||
-rw-r--r-- | arch/xtensa/configs/audio_kc705_defconfig | 142 | ||||
-rw-r--r-- | arch/xtensa/include/uapi/asm/unistd.h | 8 | ||||
-rw-r--r-- | arch/xtensa/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/xtensa/platforms/xtfpga/Makefile | 3 | ||||
-rw-r--r-- | arch/xtensa/platforms/xtfpga/include/platform/hardware.h | 3 | ||||
-rw-r--r-- | arch/xtensa/platforms/xtfpga/include/platform/lcd.h | 15 | ||||
-rw-r--r-- | arch/xtensa/platforms/xtfpga/lcd.c | 55 |
9 files changed, 294 insertions, 27 deletions
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index e31d4949124a..87be10e8b57a 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -428,6 +428,36 @@ config DEFAULT_MEM_SIZE | |||
428 | 428 | ||
429 | If unsure, leave the default value here. | 429 | If unsure, leave the default value here. |
430 | 430 | ||
431 | config XTFPGA_LCD | ||
432 | bool "Enable XTFPGA LCD driver" | ||
433 | depends on XTENSA_PLATFORM_XTFPGA | ||
434 | default n | ||
435 | help | ||
436 | There's a 2x16 LCD on most of XTFPGA boards, kernel may output | ||
437 | progress messages there during bootup/shutdown. It may be useful | ||
438 | during board bringup. | ||
439 | |||
440 | If unsure, say N. | ||
441 | |||
442 | config XTFPGA_LCD_BASE_ADDR | ||
443 | hex "XTFPGA LCD base address" | ||
444 | depends on XTFPGA_LCD | ||
445 | default "0x0d0c0000" | ||
446 | help | ||
447 | Base address of the LCD controller inside KIO region. | ||
448 | Different boards from XTFPGA family have LCD controller at different | ||
449 | addresses. Please consult prototyping user guide for your board for | ||
450 | the correct address. Wrong address here may lead to hardware lockup. | ||
451 | |||
452 | config XTFPGA_LCD_8BIT_ACCESS | ||
453 | bool "Use 8-bit access to XTFPGA LCD" | ||
454 | depends on XTFPGA_LCD | ||
455 | default n | ||
456 | help | ||
457 | LCD may be connected with 4- or 8-bit interface, 8-bit access may | ||
458 | only be used with 8-bit interface. Please consult prototyping user | ||
459 | guide for your board for the correct interface width. | ||
460 | |||
431 | endmenu | 461 | endmenu |
432 | 462 | ||
433 | menu "Executable file formats" | 463 | menu "Executable file formats" |
diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi index dec9178840f6..cd0b9e34adc8 100644 --- a/arch/xtensa/boot/dts/xtfpga.dtsi +++ b/arch/xtensa/boot/dts/xtfpga.dtsi | |||
@@ -40,6 +40,12 @@ | |||
40 | #clock-cells = <0>; | 40 | #clock-cells = <0>; |
41 | compatible = "fixed-clock"; | 41 | compatible = "fixed-clock"; |
42 | }; | 42 | }; |
43 | |||
44 | clk54: clk54 { | ||
45 | #clock-cells = <0>; | ||
46 | compatible = "fixed-clock"; | ||
47 | clock-frequency = <54000000>; | ||
48 | }; | ||
43 | }; | 49 | }; |
44 | 50 | ||
45 | soc { | 51 | soc { |
@@ -65,5 +71,63 @@ | |||
65 | local-mac-address = [00 50 c2 13 6f 00]; | 71 | local-mac-address = [00 50 c2 13 6f 00]; |
66 | clocks = <&osc>; | 72 | clocks = <&osc>; |
67 | }; | 73 | }; |
74 | |||
75 | i2s0: xtfpga-i2s@0d080000 { | ||
76 | #sound-dai-cells = <0>; | ||
77 | compatible = "cdns,xtfpga-i2s"; | ||
78 | reg = <0x0d080000 0x40>; | ||
79 | interrupts = <2 1>; /* external irq 2 */ | ||
80 | clocks = <&cdce706 4>; | ||
81 | }; | ||
82 | |||
83 | i2c0: i2c-master@0d090000 { | ||
84 | compatible = "opencores,i2c-ocores"; | ||
85 | #address-cells = <1>; | ||
86 | #size-cells = <0>; | ||
87 | reg = <0x0d090000 0x20>; | ||
88 | reg-shift = <2>; | ||
89 | reg-io-width = <1>; | ||
90 | interrupts = <4 1>; | ||
91 | clocks = <&osc>; | ||
92 | |||
93 | cdce706: clock-synth@69 { | ||
94 | compatible = "ti,cdce706"; | ||
95 | #clock-cells = <1>; | ||
96 | reg = <0x69>; | ||
97 | clocks = <&clk54>; | ||
98 | clock-names = "clk_in0"; | ||
99 | }; | ||
100 | }; | ||
101 | |||
102 | spi0: spi-master@0d0a0000 { | ||
103 | compatible = "cdns,xtfpga-spi"; | ||
104 | #address-cells = <1>; | ||
105 | #size-cells = <0>; | ||
106 | reg = <0x0d0a0000 0xc>; | ||
107 | |||
108 | tlv320aic23: sound-codec@0 { | ||
109 | #sound-dai-cells = <0>; | ||
110 | compatible = "tlv320aic23"; | ||
111 | reg = <0>; | ||
112 | spi-max-frequency = <12500000>; | ||
113 | }; | ||
114 | }; | ||
115 | }; | ||
116 | |||
117 | sound { | ||
118 | compatible = "simple-audio-card"; | ||
119 | simple-audio-card,format = "i2s"; | ||
120 | simple-audio-card,mclk-fs = <256>; | ||
121 | |||
122 | simple-audio-card,cpu { | ||
123 | sound-dai = <&i2s0>; | ||
124 | }; | ||
125 | |||
126 | simple-audio-card,codec { | ||
127 | sound-dai = <&tlv320aic23>; | ||
128 | simple-audio-card,bitclock-master = <0>; | ||
129 | simple-audio-card,frame-master = <0>; | ||
130 | clocks = <&cdce706 4>; | ||
131 | }; | ||
68 | }; | 132 | }; |
69 | }; | 133 | }; |
diff --git a/arch/xtensa/configs/audio_kc705_defconfig b/arch/xtensa/configs/audio_kc705_defconfig new file mode 100644 index 000000000000..c4904db15582 --- /dev/null +++ b/arch/xtensa/configs/audio_kc705_defconfig | |||
@@ -0,0 +1,142 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_POSIX_MQUEUE=y | ||
3 | CONFIG_FHANDLE=y | ||
4 | CONFIG_IRQ_DOMAIN_DEBUG=y | ||
5 | CONFIG_NO_HZ_IDLE=y | ||
6 | CONFIG_HIGH_RES_TIMERS=y | ||
7 | CONFIG_IRQ_TIME_ACCOUNTING=y | ||
8 | CONFIG_BSD_PROCESS_ACCT=y | ||
9 | CONFIG_CGROUP_DEBUG=y | ||
10 | CONFIG_CGROUP_FREEZER=y | ||
11 | CONFIG_CGROUP_DEVICE=y | ||
12 | CONFIG_CPUSETS=y | ||
13 | CONFIG_CGROUP_CPUACCT=y | ||
14 | CONFIG_MEMCG=y | ||
15 | CONFIG_NAMESPACES=y | ||
16 | CONFIG_SCHED_AUTOGROUP=y | ||
17 | CONFIG_RELAY=y | ||
18 | CONFIG_BLK_DEV_INITRD=y | ||
19 | CONFIG_EXPERT=y | ||
20 | CONFIG_SYSCTL_SYSCALL=y | ||
21 | CONFIG_KALLSYMS_ALL=y | ||
22 | CONFIG_PROFILING=y | ||
23 | CONFIG_OPROFILE=y | ||
24 | CONFIG_MODULES=y | ||
25 | CONFIG_MODULE_UNLOAD=y | ||
26 | # CONFIG_IOSCHED_DEADLINE is not set | ||
27 | # CONFIG_IOSCHED_CFQ is not set | ||
28 | CONFIG_XTENSA_VARIANT_CUSTOM=y | ||
29 | CONFIG_XTENSA_VARIANT_CUSTOM_NAME="test_kc705_hifi" | ||
30 | CONFIG_XTENSA_UNALIGNED_USER=y | ||
31 | CONFIG_PREEMPT=y | ||
32 | CONFIG_HIGHMEM=y | ||
33 | # CONFIG_PCI is not set | ||
34 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | ||
35 | CONFIG_CMDLINE_BOOL=y | ||
36 | CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" | ||
37 | CONFIG_USE_OF=y | ||
38 | CONFIG_BUILTIN_DTB="kc705" | ||
39 | # CONFIG_COMPACTION is not set | ||
40 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
41 | CONFIG_PM=y | ||
42 | CONFIG_NET=y | ||
43 | CONFIG_PACKET=y | ||
44 | CONFIG_UNIX=y | ||
45 | CONFIG_INET=y | ||
46 | CONFIG_IP_MULTICAST=y | ||
47 | CONFIG_IP_PNP=y | ||
48 | CONFIG_IP_PNP_DHCP=y | ||
49 | CONFIG_IP_PNP_BOOTP=y | ||
50 | CONFIG_IP_PNP_RARP=y | ||
51 | # CONFIG_IPV6 is not set | ||
52 | CONFIG_NETFILTER=y | ||
53 | # CONFIG_WIRELESS is not set | ||
54 | CONFIG_DEVTMPFS=y | ||
55 | CONFIG_DEVTMPFS_MOUNT=y | ||
56 | # CONFIG_STANDALONE is not set | ||
57 | CONFIG_MTD=y | ||
58 | CONFIG_MTD_CFI=y | ||
59 | CONFIG_MTD_JEDECPROBE=y | ||
60 | CONFIG_MTD_CFI_INTELEXT=y | ||
61 | CONFIG_MTD_CFI_AMDSTD=y | ||
62 | CONFIG_MTD_CFI_STAA=y | ||
63 | CONFIG_MTD_PHYSMAP_OF=y | ||
64 | CONFIG_MTD_UBI=y | ||
65 | CONFIG_BLK_DEV_LOOP=y | ||
66 | CONFIG_BLK_DEV_RAM=y | ||
67 | CONFIG_SCSI=y | ||
68 | CONFIG_BLK_DEV_SD=y | ||
69 | CONFIG_NETDEVICES=y | ||
70 | # CONFIG_NET_VENDOR_ARC is not set | ||
71 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
72 | # CONFIG_NET_VENDOR_INTEL is not set | ||
73 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
74 | # CONFIG_NET_VENDOR_MICREL is not set | ||
75 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
76 | # CONFIG_NET_VENDOR_SAMSUNG is not set | ||
77 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
78 | # CONFIG_NET_VENDOR_SMSC is not set | ||
79 | # CONFIG_NET_VENDOR_STMICRO is not set | ||
80 | # CONFIG_NET_VENDOR_VIA is not set | ||
81 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
82 | CONFIG_MARVELL_PHY=y | ||
83 | # CONFIG_WLAN is not set | ||
84 | # CONFIG_INPUT_MOUSEDEV is not set | ||
85 | # CONFIG_INPUT_KEYBOARD is not set | ||
86 | # CONFIG_INPUT_MOUSE is not set | ||
87 | # CONFIG_SERIO is not set | ||
88 | CONFIG_SERIAL_8250=y | ||
89 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set | ||
90 | CONFIG_SERIAL_8250_CONSOLE=y | ||
91 | CONFIG_SERIAL_OF_PLATFORM=y | ||
92 | CONFIG_HW_RANDOM=y | ||
93 | CONFIG_I2C=y | ||
94 | CONFIG_I2C_OCORES=y | ||
95 | CONFIG_SPI=y | ||
96 | CONFIG_SPI_XTENSA_XTFPGA=y | ||
97 | # CONFIG_HWMON is not set | ||
98 | CONFIG_WATCHDOG=y | ||
99 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
100 | CONFIG_SOFT_WATCHDOG=y | ||
101 | # CONFIG_VGA_CONSOLE is not set | ||
102 | CONFIG_SOUND=y | ||
103 | CONFIG_SND=y | ||
104 | CONFIG_SND_SOC=y | ||
105 | CONFIG_SND_SOC_XTFPGA_I2S=y | ||
106 | CONFIG_SND_SOC_TLV320AIC23_SPI=y | ||
107 | CONFIG_SND_SIMPLE_CARD=y | ||
108 | # CONFIG_USB_SUPPORT is not set | ||
109 | CONFIG_COMMON_CLK_CDCE706=y | ||
110 | # CONFIG_IOMMU_SUPPORT is not set | ||
111 | CONFIG_EXT3_FS=y | ||
112 | CONFIG_EXT4_FS=y | ||
113 | CONFIG_FANOTIFY=y | ||
114 | CONFIG_VFAT_FS=y | ||
115 | CONFIG_PROC_KCORE=y | ||
116 | CONFIG_TMPFS=y | ||
117 | CONFIG_TMPFS_POSIX_ACL=y | ||
118 | CONFIG_UBIFS_FS=y | ||
119 | CONFIG_NFS_FS=y | ||
120 | CONFIG_NFS_V4=y | ||
121 | CONFIG_NFS_SWAP=y | ||
122 | CONFIG_ROOT_NFS=y | ||
123 | CONFIG_SUNRPC_DEBUG=y | ||
124 | CONFIG_NLS_CODEPAGE_437=y | ||
125 | CONFIG_NLS_ISO8859_1=y | ||
126 | CONFIG_PRINTK_TIME=y | ||
127 | CONFIG_DYNAMIC_DEBUG=y | ||
128 | CONFIG_DEBUG_INFO=y | ||
129 | CONFIG_MAGIC_SYSRQ=y | ||
130 | CONFIG_LOCKUP_DETECTOR=y | ||
131 | # CONFIG_SCHED_DEBUG is not set | ||
132 | CONFIG_SCHEDSTATS=y | ||
133 | CONFIG_TIMER_STATS=y | ||
134 | CONFIG_DEBUG_RT_MUTEXES=y | ||
135 | CONFIG_DEBUG_SPINLOCK=y | ||
136 | CONFIG_DEBUG_MUTEXES=y | ||
137 | CONFIG_DEBUG_ATOMIC_SLEEP=y | ||
138 | CONFIG_STACKTRACE=y | ||
139 | CONFIG_RCU_TRACE=y | ||
140 | # CONFIG_FTRACE is not set | ||
141 | # CONFIG_S32C1I_SELFTEST is not set | ||
142 | CONFIG_CRYPTO_ANSI_CPRNG=y | ||
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index db5bb72e2f4e..b95c30594355 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6) | |||
715 | __SYSCALL(324, sys_name_to_handle_at, 5) | 715 | __SYSCALL(324, sys_name_to_handle_at, 5) |
716 | #define __NR_open_by_handle_at 325 | 716 | #define __NR_open_by_handle_at 325 |
717 | __SYSCALL(325, sys_open_by_handle_at, 3) | 717 | __SYSCALL(325, sys_open_by_handle_at, 3) |
718 | #define __NR_sync_file_range 326 | 718 | #define __NR_sync_file_range2 326 |
719 | __SYSCALL(326, sys_sync_file_range2, 6) | 719 | __SYSCALL(326, sys_sync_file_range2, 6) |
720 | #define __NR_perf_event_open 327 | 720 | #define __NR_perf_event_open 327 |
721 | __SYSCALL(327, sys_perf_event_open, 5) | 721 | __SYSCALL(327, sys_perf_event_open, 5) |
@@ -749,8 +749,12 @@ __SYSCALL(337, sys_seccomp, 3) | |||
749 | __SYSCALL(338, sys_getrandom, 3) | 749 | __SYSCALL(338, sys_getrandom, 3) |
750 | #define __NR_memfd_create 339 | 750 | #define __NR_memfd_create 339 |
751 | __SYSCALL(339, sys_memfd_create, 2) | 751 | __SYSCALL(339, sys_memfd_create, 2) |
752 | #define __NR_bpf 340 | ||
753 | __SYSCALL(340, sys_bpf, 3) | ||
754 | #define __NR_execveat 341 | ||
755 | __SYSCALL(341, sys_execveat, 5) | ||
752 | 756 | ||
753 | #define __NR_syscall_count 340 | 757 | #define __NR_syscall_count 342 |
754 | 758 | ||
755 | /* | 759 | /* |
756 | * sysxtensa syscall handler | 760 | * sysxtensa syscall handler |
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile index 18d962a8c0c2..d3a0f0fd56dd 100644 --- a/arch/xtensa/kernel/Makefile +++ b/arch/xtensa/kernel/Makefile | |||
@@ -29,6 +29,7 @@ AFLAGS_head.o += -mtext-section-literals | |||
29 | 29 | ||
30 | sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ | 30 | sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ |
31 | -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \ | 31 | -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \ |
32 | -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \ | ||
32 | -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g' | 33 | -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g' |
33 | 34 | ||
34 | quiet_cmd__cpp_lds_S = LDS $@ | 35 | quiet_cmd__cpp_lds_S = LDS $@ |
diff --git a/arch/xtensa/platforms/xtfpga/Makefile b/arch/xtensa/platforms/xtfpga/Makefile index b9ae206340cd..7839d38b2337 100644 --- a/arch/xtensa/platforms/xtfpga/Makefile +++ b/arch/xtensa/platforms/xtfpga/Makefile | |||
@@ -6,4 +6,5 @@ | |||
6 | # | 6 | # |
7 | # Note 2! The CFLAGS definitions are in the main makefile... | 7 | # Note 2! The CFLAGS definitions are in the main makefile... |
8 | 8 | ||
9 | obj-y = setup.o lcd.o | 9 | obj-y += setup.o |
10 | obj-$(CONFIG_XTFPGA_LCD) += lcd.o | ||
diff --git a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h index 4dc670850213..0a55bb9c5420 100644 --- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h +++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h | |||
@@ -40,9 +40,6 @@ | |||
40 | 40 | ||
41 | /* UART */ | 41 | /* UART */ |
42 | #define DUART16552_PADDR (XCHAL_KIO_PADDR + 0x0D050020) | 42 | #define DUART16552_PADDR (XCHAL_KIO_PADDR + 0x0D050020) |
43 | /* LCD instruction and data addresses. */ | ||
44 | #define LCD_INSTR_ADDR ((char *)IOADDR(0x0D040000)) | ||
45 | #define LCD_DATA_ADDR ((char *)IOADDR(0x0D040004)) | ||
46 | 43 | ||
47 | /* Misc. */ | 44 | /* Misc. */ |
48 | #define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000) | 45 | #define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000) |
diff --git a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h index 0e435645af5a..4c8541ed1139 100644 --- a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h +++ b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h | |||
@@ -11,10 +11,25 @@ | |||
11 | #ifndef __XTENSA_XTAVNET_LCD_H | 11 | #ifndef __XTENSA_XTAVNET_LCD_H |
12 | #define __XTENSA_XTAVNET_LCD_H | 12 | #define __XTENSA_XTAVNET_LCD_H |
13 | 13 | ||
14 | #ifdef CONFIG_XTFPGA_LCD | ||
14 | /* Display string STR at position POS on the LCD. */ | 15 | /* Display string STR at position POS on the LCD. */ |
15 | void lcd_disp_at_pos(char *str, unsigned char pos); | 16 | void lcd_disp_at_pos(char *str, unsigned char pos); |
16 | 17 | ||
17 | /* Shift the contents of the LCD display left or right. */ | 18 | /* Shift the contents of the LCD display left or right. */ |
18 | void lcd_shiftleft(void); | 19 | void lcd_shiftleft(void); |
19 | void lcd_shiftright(void); | 20 | void lcd_shiftright(void); |
21 | #else | ||
22 | static inline void lcd_disp_at_pos(char *str, unsigned char pos) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | static inline void lcd_shiftleft(void) | ||
27 | { | ||
28 | } | ||
29 | |||
30 | static inline void lcd_shiftright(void) | ||
31 | { | ||
32 | } | ||
33 | #endif | ||
34 | |||
20 | #endif | 35 | #endif |
diff --git a/arch/xtensa/platforms/xtfpga/lcd.c b/arch/xtensa/platforms/xtfpga/lcd.c index 2872301598df..4dc0c1b43f4b 100644 --- a/arch/xtensa/platforms/xtfpga/lcd.c +++ b/arch/xtensa/platforms/xtfpga/lcd.c | |||
@@ -1,50 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the LCD display on the Tensilica LX60 Board. | 2 | * Driver for the LCD display on the Tensilica XTFPGA board family. |
3 | * http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf | ||
3 | * | 4 | * |
4 | * This file is subject to the terms and conditions of the GNU General Public | 5 | * This file is subject to the terms and conditions of the GNU General Public |
5 | * License. See the file "COPYING" in the main directory of this archive | 6 | * License. See the file "COPYING" in the main directory of this archive |
6 | * for more details. | 7 | * for more details. |
7 | * | 8 | * |
8 | * Copyright (C) 2001, 2006 Tensilica Inc. | 9 | * Copyright (C) 2001, 2006 Tensilica Inc. |
10 | * Copyright (C) 2015 Cadence Design Systems Inc. | ||
9 | */ | 11 | */ |
10 | 12 | ||
11 | /* | 13 | #include <linux/delay.h> |
12 | * | ||
13 | * FIXME: this code is from the examples from the LX60 user guide. | ||
14 | * | ||
15 | * The lcd_pause function does busy waiting, which is probably not | ||
16 | * great. Maybe the code could be changed to use kernel timers, or | ||
17 | * change the hardware to not need to wait. | ||
18 | */ | ||
19 | |||
20 | #include <linux/init.h> | 14 | #include <linux/init.h> |
21 | #include <linux/io.h> | 15 | #include <linux/io.h> |
22 | 16 | ||
23 | #include <platform/hardware.h> | 17 | #include <platform/hardware.h> |
24 | #include <platform/lcd.h> | 18 | #include <platform/lcd.h> |
25 | #include <linux/delay.h> | ||
26 | 19 | ||
27 | #define LCD_PAUSE_ITERATIONS 4000 | 20 | /* LCD instruction and data addresses. */ |
21 | #define LCD_INSTR_ADDR ((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR)) | ||
22 | #define LCD_DATA_ADDR (LCD_INSTR_ADDR + 4) | ||
23 | |||
28 | #define LCD_CLEAR 0x1 | 24 | #define LCD_CLEAR 0x1 |
29 | #define LCD_DISPLAY_ON 0xc | 25 | #define LCD_DISPLAY_ON 0xc |
30 | 26 | ||
31 | /* 8bit and 2 lines display */ | 27 | /* 8bit and 2 lines display */ |
32 | #define LCD_DISPLAY_MODE8BIT 0x38 | 28 | #define LCD_DISPLAY_MODE8BIT 0x38 |
29 | #define LCD_DISPLAY_MODE4BIT 0x28 | ||
33 | #define LCD_DISPLAY_POS 0x80 | 30 | #define LCD_DISPLAY_POS 0x80 |
34 | #define LCD_SHIFT_LEFT 0x18 | 31 | #define LCD_SHIFT_LEFT 0x18 |
35 | #define LCD_SHIFT_RIGHT 0x1c | 32 | #define LCD_SHIFT_RIGHT 0x1c |
36 | 33 | ||
34 | static void lcd_put_byte(u8 *addr, u8 data) | ||
35 | { | ||
36 | #ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS | ||
37 | ACCESS_ONCE(*addr) = data; | ||
38 | #else | ||
39 | ACCESS_ONCE(*addr) = data & 0xf0; | ||
40 | ACCESS_ONCE(*addr) = (data << 4) & 0xf0; | ||
41 | #endif | ||
42 | } | ||
43 | |||
37 | static int __init lcd_init(void) | 44 | static int __init lcd_init(void) |
38 | { | 45 | { |
39 | *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT; | 46 | ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT; |
40 | mdelay(5); | 47 | mdelay(5); |
41 | *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT; | 48 | ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT; |
42 | udelay(200); | 49 | udelay(200); |
43 | *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT; | 50 | ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT; |
51 | udelay(50); | ||
52 | #ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS | ||
53 | ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT; | ||
54 | udelay(50); | ||
55 | lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT); | ||
44 | udelay(50); | 56 | udelay(50); |
45 | *LCD_INSTR_ADDR = LCD_DISPLAY_ON; | 57 | #endif |
58 | lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON); | ||
46 | udelay(50); | 59 | udelay(50); |
47 | *LCD_INSTR_ADDR = LCD_CLEAR; | 60 | lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR); |
48 | mdelay(10); | 61 | mdelay(10); |
49 | lcd_disp_at_pos("XTENSA LINUX", 0); | 62 | lcd_disp_at_pos("XTENSA LINUX", 0); |
50 | return 0; | 63 | return 0; |
@@ -52,10 +65,10 @@ static int __init lcd_init(void) | |||
52 | 65 | ||
53 | void lcd_disp_at_pos(char *str, unsigned char pos) | 66 | void lcd_disp_at_pos(char *str, unsigned char pos) |
54 | { | 67 | { |
55 | *LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos; | 68 | lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos); |
56 | udelay(100); | 69 | udelay(100); |
57 | while (*str != 0) { | 70 | while (*str != 0) { |
58 | *LCD_DATA_ADDR = *str; | 71 | lcd_put_byte(LCD_DATA_ADDR, *str); |
59 | udelay(200); | 72 | udelay(200); |
60 | str++; | 73 | str++; |
61 | } | 74 | } |
@@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned char pos) | |||
63 | 76 | ||
64 | void lcd_shiftleft(void) | 77 | void lcd_shiftleft(void) |
65 | { | 78 | { |
66 | *LCD_INSTR_ADDR = LCD_SHIFT_LEFT; | 79 | lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT); |
67 | udelay(50); | 80 | udelay(50); |
68 | } | 81 | } |
69 | 82 | ||
70 | void lcd_shiftright(void) | 83 | void lcd_shiftright(void) |
71 | { | 84 | { |
72 | *LCD_INSTR_ADDR = LCD_SHIFT_RIGHT; | 85 | lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT); |
73 | udelay(50); | 86 | udelay(50); |
74 | } | 87 | } |
75 | 88 | ||