Xtensa fixes for 4.0:

- make xtfpgs LCD driver functional and configurable. This fixes hardware
   lockup on KC705/ML605 boot;
 - wire bpf and execveat syscalls;
 - provide __NR_sync_file_range2 instead of __NR_sync_file_range, as that's
   what xtensa uses.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJU9sxSAAoJEFH5zJH4P6BEwFsP/1qkSVtBdkiCQhhTp+jTxVfT
 uVUST6QbG+zcqV61Ni44ghd4T0qkfGZZixlCMvDT2o3mE/dNWVZiG0rAt+q09HQ3
 sUSmLaM8scUqreZRUdvLVq+wZTQH9dUhtBvssLrkFk0VJrTkNuCZo56A5d8BL7RM
 xD8FM2d3UVDBnG9Rs9O7guzu/lvIiYMYO9e3mOh//pY9aSDnn6fUVpoqVwx9qx7v
 azi8aSFDMQH4swGHojNdrRfM0eUZxyYie/fzcj1YkE5qOHo9m7ZvO1jighZc0xka
 qBTQV/k/5oA7hY6Ovg7PjSeZCuqWnK2nGV+wJnGJYH21JBLZvK/0NLT7UFEVDXbt
 7mCbhlxgBclj5a1Vb2zfmPjw1fZ3qRJ8DNPXt8KkCPCy+HYyN6RRqjCxfBAFV/KI
 L26TmyfpXOtdOYX3e+vp23LFn6hdSbZbY45LCIMBW1xi4bnPczmRviXtAhZwWtTA
 lrE1sPzckRAjbcqsfZ5+hDZDplQKI/VlA/YTIuG78bPzecSZLLRahycYJSlDl2CQ
 thoyZedLN6ia838yk3B17CHxf2NFNUEoSLxIuOC0xkhJ6OkOs79duGoL4sbVQLKt
 8EzVQ3p2ZmivLvRLYykUaqoq33tFleJCitANzq12k3auohDfBkpg6lFUkq6jmqP9
 XRQL52qTwt52phod1S3E
 =y80U
 -----END PGP SIGNATURE-----

Merge tag 'xtensa-for-next-20150304' of git://github.com/jcmvbkbc/linux-xtensa into for_next

Xtensa fixes for 4.0:

- make xtfpgs LCD driver functional and configurable. This fixes hardware
  lockup on KC705/ML605 boot;
- wire bpf and execveat syscalls;
- provide __NR_sync_file_range2 instead of __NR_sync_file_range, as that's
  what xtensa uses.
This commit is contained in:
Chris Zankel 2015-03-13 00:41:32 +00:00
commit 0372c1abdd
6 changed files with 87 additions and 27 deletions

View File

@ -428,6 +428,36 @@ config DEFAULT_MEM_SIZE
If unsure, leave the default value here.
config XTFPGA_LCD
bool "Enable XTFPGA LCD driver"
depends on XTENSA_PLATFORM_XTFPGA
default n
help
There's a 2x16 LCD on most of XTFPGA boards, kernel may output
progress messages there during bootup/shutdown. It may be useful
during board bringup.
If unsure, say N.
config XTFPGA_LCD_BASE_ADDR
hex "XTFPGA LCD base address"
depends on XTFPGA_LCD
default "0x0d0c0000"
help
Base address of the LCD controller inside KIO region.
Different boards from XTFPGA family have LCD controller at different
addresses. Please consult prototyping user guide for your board for
the correct address. Wrong address here may lead to hardware lockup.
config XTFPGA_LCD_8BIT_ACCESS
bool "Use 8-bit access to XTFPGA LCD"
depends on XTFPGA_LCD
default n
help
LCD may be connected with 4- or 8-bit interface, 8-bit access may
only be used with 8-bit interface. Please consult prototyping user
guide for your board for the correct interface width.
endmenu
menu "Executable file formats"

View File

@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6)
__SYSCALL(324, sys_name_to_handle_at, 5)
#define __NR_open_by_handle_at 325
__SYSCALL(325, sys_open_by_handle_at, 3)
#define __NR_sync_file_range 326
#define __NR_sync_file_range2 326
__SYSCALL(326, sys_sync_file_range2, 6)
#define __NR_perf_event_open 327
__SYSCALL(327, sys_perf_event_open, 5)
@ -749,8 +749,12 @@ __SYSCALL(337, sys_seccomp, 3)
__SYSCALL(338, sys_getrandom, 3)
#define __NR_memfd_create 339
__SYSCALL(339, sys_memfd_create, 2)
#define __NR_bpf 340
__SYSCALL(340, sys_bpf, 3)
#define __NR_execveat 341
__SYSCALL(341, sys_execveat, 5)
#define __NR_syscall_count 340
#define __NR_syscall_count 342
/*
* sysxtensa syscall handler

View File

@ -6,4 +6,5 @@
#
# Note 2! The CFLAGS definitions are in the main makefile...
obj-y = setup.o lcd.o
obj-y += setup.o
obj-$(CONFIG_XTFPGA_LCD) += lcd.o

View File

@ -40,9 +40,6 @@
/* UART */
#define DUART16552_PADDR (XCHAL_KIO_PADDR + 0x0D050020)
/* LCD instruction and data addresses. */
#define LCD_INSTR_ADDR ((char *)IOADDR(0x0D040000))
#define LCD_DATA_ADDR ((char *)IOADDR(0x0D040004))
/* Misc. */
#define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000)

View File

@ -11,10 +11,25 @@
#ifndef __XTENSA_XTAVNET_LCD_H
#define __XTENSA_XTAVNET_LCD_H
#ifdef CONFIG_XTFPGA_LCD
/* Display string STR at position POS on the LCD. */
void lcd_disp_at_pos(char *str, unsigned char pos);
/* Shift the contents of the LCD display left or right. */
void lcd_shiftleft(void);
void lcd_shiftright(void);
#else
static inline void lcd_disp_at_pos(char *str, unsigned char pos)
{
}
static inline void lcd_shiftleft(void)
{
}
static inline void lcd_shiftright(void)
{
}
#endif
#endif

View File

@ -1,50 +1,63 @@
/*
* Driver for the LCD display on the Tensilica LX60 Board.
* Driver for the LCD display on the Tensilica XTFPGA board family.
* http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001, 2006 Tensilica Inc.
* Copyright (C) 2015 Cadence Design Systems Inc.
*/
/*
*
* FIXME: this code is from the examples from the LX60 user guide.
*
* The lcd_pause function does busy waiting, which is probably not
* great. Maybe the code could be changed to use kernel timers, or
* change the hardware to not need to wait.
*/
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <platform/hardware.h>
#include <platform/lcd.h>
#include <linux/delay.h>
#define LCD_PAUSE_ITERATIONS 4000
/* LCD instruction and data addresses. */
#define LCD_INSTR_ADDR ((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR))
#define LCD_DATA_ADDR (LCD_INSTR_ADDR + 4)
#define LCD_CLEAR 0x1
#define LCD_DISPLAY_ON 0xc
/* 8bit and 2 lines display */
#define LCD_DISPLAY_MODE8BIT 0x38
#define LCD_DISPLAY_MODE4BIT 0x28
#define LCD_DISPLAY_POS 0x80
#define LCD_SHIFT_LEFT 0x18
#define LCD_SHIFT_RIGHT 0x1c
static void lcd_put_byte(u8 *addr, u8 data)
{
#ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS
ACCESS_ONCE(*addr) = data;
#else
ACCESS_ONCE(*addr) = data & 0xf0;
ACCESS_ONCE(*addr) = (data << 4) & 0xf0;
#endif
}
static int __init lcd_init(void)
{
*LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
mdelay(5);
*LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
udelay(200);
*LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
udelay(50);
*LCD_INSTR_ADDR = LCD_DISPLAY_ON;
#ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS
ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT;
udelay(50);
*LCD_INSTR_ADDR = LCD_CLEAR;
lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT);
udelay(50);
#endif
lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON);
udelay(50);
lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR);
mdelay(10);
lcd_disp_at_pos("XTENSA LINUX", 0);
return 0;
@ -52,10 +65,10 @@ static int __init lcd_init(void)
void lcd_disp_at_pos(char *str, unsigned char pos)
{
*LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos;
lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos);
udelay(100);
while (*str != 0) {
*LCD_DATA_ADDR = *str;
lcd_put_byte(LCD_DATA_ADDR, *str);
udelay(200);
str++;
}
@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned char pos)
void lcd_shiftleft(void)
{
*LCD_INSTR_ADDR = LCD_SHIFT_LEFT;
lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT);
udelay(50);
}
void lcd_shiftright(void)
{
*LCD_INSTR_ADDR = LCD_SHIFT_RIGHT;
lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT);
udelay(50);
}