mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
this patch add uboot-xburst package
uboot-xburst-avt2 uboot-xburst-n516 uboot-xburst-qi_lb60 uboot-xburst-sakc Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
This commit is contained in:
1178
package/uboot-xburst/files/drivers/mmc/jz_mmc.c
Normal file
1178
package/uboot-xburst/files/drivers/mmc/jz_mmc.c
Normal file
File diff suppressed because it is too large
Load Diff
176
package/uboot-xburst/files/drivers/mmc/jz_mmc.h
Normal file
176
package/uboot-xburst/files/drivers/mmc/jz_mmc.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* linux/drivers/mmc/jz_mmc.h
|
||||
*
|
||||
* Author: Vladimir Shebordaev, Igor Oblakov
|
||||
* Copyright: MontaVista Software Inc.
|
||||
*
|
||||
* $Id: jz_mmc.h,v 1.3 2007-06-15 08:04:20 jlwei Exp $
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __MMC_JZMMC_H__
|
||||
#define __MMC_JZMMC_H__
|
||||
|
||||
#define ID_TO_RCA(x) ((x)+1)
|
||||
#define MMC_OCR_ARG 0x00ff8000 /* Argument of OCR */
|
||||
|
||||
/* Standard MMC/SD clock speeds */
|
||||
#define MMC_CLOCK_SLOW 400000 /* 400 kHz for initial setup */
|
||||
#define MMC_CLOCK_FAST 20000000 /* 20 MHz for maximum for normal operation */
|
||||
#define SD_CLOCK_FAST 24000000 /* 24 MHz for SD Cards */
|
||||
|
||||
/* Use negative numbers to disambiguate */
|
||||
#define MMC_CIM_RESET -1
|
||||
#define SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
|
||||
|
||||
#define R1_OUT_OF_RANGE (1 << 31) /* er, c */
|
||||
#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */
|
||||
#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */
|
||||
#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */
|
||||
#define R1_ERASE_PARAM (1 << 27) /* ex, c */
|
||||
#define R1_WP_VIOLATION (1 << 26) /* erx, c */
|
||||
#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */
|
||||
#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */
|
||||
#define R1_COM_CRC_ERROR (1 << 23) /* er, b */
|
||||
#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */
|
||||
#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */
|
||||
#define R1_CC_ERROR (1 << 20) /* erx, c */
|
||||
#define R1_ERROR (1 << 19) /* erx, c */
|
||||
#define R1_UNDERRUN (1 << 18) /* ex, c */
|
||||
#define R1_OVERRUN (1 << 17) /* ex, c */
|
||||
#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */
|
||||
#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */
|
||||
#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */
|
||||
#define R1_ERASE_RESET (1 << 13) /* sr, c */
|
||||
#define R1_STATUS(x) (x & 0xFFFFE000)
|
||||
|
||||
#define MMC_CARD_BUSY 0x80000000 /* Card Power up status bit */
|
||||
|
||||
#define MMC_PROGRAM_CID 26 /* adtc R1 */
|
||||
#define MMC_PROGRAM_CSD 27 /* adtc R1 */
|
||||
|
||||
#define MMC_GO_IRQ_STATE 40 /* bcr R5 */
|
||||
#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1b */
|
||||
#define MMC_LOCK_UNLOCK 42 /* adtc R1b */
|
||||
#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
|
||||
#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
|
||||
#define MMC_SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */
|
||||
|
||||
|
||||
enum mmc_result_t {
|
||||
MMC_NO_RESPONSE = -1,
|
||||
MMC_NO_ERROR = 0,
|
||||
MMC_ERROR_OUT_OF_RANGE,
|
||||
MMC_ERROR_ADDRESS,
|
||||
MMC_ERROR_BLOCK_LEN,
|
||||
MMC_ERROR_ERASE_SEQ,
|
||||
MMC_ERROR_ERASE_PARAM,
|
||||
MMC_ERROR_WP_VIOLATION,
|
||||
MMC_ERROR_CARD_IS_LOCKED,
|
||||
MMC_ERROR_LOCK_UNLOCK_FAILED,
|
||||
MMC_ERROR_COM_CRC,
|
||||
MMC_ERROR_ILLEGAL_COMMAND,
|
||||
MMC_ERROR_CARD_ECC_FAILED,
|
||||
MMC_ERROR_CC,
|
||||
MMC_ERROR_GENERAL,
|
||||
MMC_ERROR_UNDERRUN,
|
||||
MMC_ERROR_OVERRUN,
|
||||
MMC_ERROR_CID_CSD_OVERWRITE,
|
||||
MMC_ERROR_STATE_MISMATCH,
|
||||
MMC_ERROR_HEADER_MISMATCH,
|
||||
MMC_ERROR_TIMEOUT,
|
||||
MMC_ERROR_CRC,
|
||||
MMC_ERROR_DRIVER_FAILURE,
|
||||
};
|
||||
|
||||
enum card_state {
|
||||
CARD_STATE_EMPTY = -1,
|
||||
CARD_STATE_IDLE = 0,
|
||||
CARD_STATE_READY = 1,
|
||||
CARD_STATE_IDENT = 2,
|
||||
CARD_STATE_STBY = 3,
|
||||
CARD_STATE_TRAN = 4,
|
||||
CARD_STATE_DATA = 5,
|
||||
CARD_STATE_RCV = 6,
|
||||
CARD_STATE_PRG = 7,
|
||||
CARD_STATE_DIS = 8,
|
||||
};
|
||||
|
||||
enum mmc_rsp_t {
|
||||
RESPONSE_NONE = 0,
|
||||
RESPONSE_R1 = 1,
|
||||
RESPONSE_R1B = 2,
|
||||
RESPONSE_R2_CID = 3,
|
||||
RESPONSE_R2_CSD = 4,
|
||||
RESPONSE_R3 = 5,
|
||||
RESPONSE_R4 = 6,
|
||||
RESPONSE_R5 = 7,
|
||||
RESPONSE_R6 = 8,
|
||||
};
|
||||
|
||||
struct mmc_response_r1 {
|
||||
u8 cmd;
|
||||
u32 status;
|
||||
};
|
||||
|
||||
struct mmc_response_r3 {
|
||||
u32 ocr;
|
||||
};
|
||||
|
||||
/* the information structure of MMC/SD Card */
|
||||
struct mmc_info {
|
||||
int id; /* Card index */
|
||||
int sd; /* MMC or SD card */
|
||||
int rca; /* RCA */
|
||||
u32 scr; /* SCR 63:32*/
|
||||
int flags; /* Ejected, inserted */
|
||||
enum card_state state; /* empty, ident, ready, whatever */
|
||||
|
||||
/* Card specific information */
|
||||
struct mmc_cid cid;
|
||||
struct mmc_csd csd;
|
||||
u32 block_num;
|
||||
u32 block_len;
|
||||
u32 erase_unit;
|
||||
};
|
||||
|
||||
struct mmc_info mmcinfo;
|
||||
|
||||
struct mmc_request {
|
||||
int index; /* Slot index - used for CS lines */
|
||||
int cmd; /* Command to send */
|
||||
u32 arg; /* Argument to send */
|
||||
enum mmc_rsp_t rtype; /* Response type expected */
|
||||
|
||||
/* Data transfer (these may be modified at the low level) */
|
||||
u16 nob; /* Number of blocks to transfer*/
|
||||
u16 block_len; /* Block length */
|
||||
u8 *buffer; /* Data buffer */
|
||||
u32 cnt; /* Data length, for PIO */
|
||||
|
||||
/* Results */
|
||||
u8 response[18]; /* Buffer to store response - CRC is optional */
|
||||
enum mmc_result_t result;
|
||||
};
|
||||
|
||||
char * mmc_result_to_string(int);
|
||||
int mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd);
|
||||
int mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state);
|
||||
int mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca);
|
||||
int mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr);
|
||||
int mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid);
|
||||
int mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3);
|
||||
|
||||
void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg,
|
||||
u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer);
|
||||
u32 mmc_tran_speed(u8 ts);
|
||||
void jz_mmc_set_clock(int sd, u32 rate);
|
||||
|
||||
static inline void mmc_simple_cmd(struct mmc_request *request, int cmd, u32 arg, enum mmc_rsp_t rtype)
|
||||
{
|
||||
mmc_send_cmd( request, cmd, arg, 0, 0, rtype, 0);
|
||||
}
|
||||
|
||||
#endif /* __MMC_JZMMC_H__ */
|
||||
250
package/uboot-xburst/files/drivers/mtd/nand/jz4740_nand.c
Normal file
250
package/uboot-xburst/files/drivers/mtd/nand/jz4740_nand.c
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Platform independend driver for JZ4740.
|
||||
*
|
||||
* Copyright (c) 2007 Ingenic Semiconductor Inc.
|
||||
* Author: <jlwei@ingenic.cn>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*/
|
||||
#include <common.h>
|
||||
|
||||
#if defined(CONFIG_CMD_NAND)
|
||||
#include <nand.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/jz4740.h>
|
||||
|
||||
#define __nand_ecc_enable() (REG_EMC_NFECR = EMC_NFECR_ECCE | EMC_NFECR_ERST )
|
||||
#define __nand_ecc_disable() (REG_EMC_NFECR &= ~EMC_NFECR_ECCE)
|
||||
|
||||
#define JZ_NAND_DATA_ADDR ((void __iomem *)0xB8000000)
|
||||
#define JZ_NAND_CMD_ADDR (JZ_NAND_DATA_ADDR + 0x8000)
|
||||
#define JZ_NAND_ADDR_ADDR (JZ_NAND_DATA_ADDR + 0x10000)
|
||||
|
||||
#define BIT(x) (1 << (x))
|
||||
#define JZ_NAND_ECC_CTRL_ENCODING BIT(3)
|
||||
#define JZ_NAND_ECC_CTRL_RS BIT(2)
|
||||
#define JZ_NAND_ECC_CTRL_RESET BIT(1)
|
||||
#define JZ_NAND_ECC_CTRL_ENABLE BIT(0)
|
||||
|
||||
static struct nand_ecclayout qi_lb60_ecclayout_2gb = {
|
||||
.eccbytes = 72,
|
||||
.eccpos = {
|
||||
12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 34, 35,
|
||||
36, 37, 38, 39, 40, 41, 42, 43,
|
||||
44, 45, 46, 47, 48, 49, 50, 51,
|
||||
52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 66, 67,
|
||||
68, 69, 70, 71, 72, 73, 74, 75,
|
||||
76, 77, 78, 79, 80, 81, 82, 83},
|
||||
.oobfree = {
|
||||
{.offset = 2,
|
||||
.length = 10},
|
||||
{.offset = 84,
|
||||
.length = 44}}
|
||||
};
|
||||
|
||||
static int is_reading;
|
||||
|
||||
static void jz_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *this = mtd->priv;
|
||||
|
||||
if (ctrl & NAND_CTRL_CHANGE) {
|
||||
if (ctrl & NAND_ALE)
|
||||
this->IO_ADDR_W = JZ_NAND_ADDR_ADDR;
|
||||
else if (ctrl & NAND_CLE)
|
||||
this->IO_ADDR_W = JZ_NAND_CMD_ADDR;
|
||||
else
|
||||
this->IO_ADDR_W = JZ_NAND_DATA_ADDR;
|
||||
|
||||
if (ctrl & NAND_NCE)
|
||||
REG_EMC_NFCSR |= EMC_NFCSR_NFCE1;
|
||||
else
|
||||
REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1;
|
||||
}
|
||||
|
||||
if (cmd != NAND_CMD_NONE)
|
||||
writeb(cmd, this->IO_ADDR_W);
|
||||
}
|
||||
|
||||
static int jz_nand_device_ready(struct mtd_info *mtd)
|
||||
{
|
||||
udelay(20);
|
||||
return (REG_GPIO_PXPIN(2) & 0x40000000) ? 1 : 0;
|
||||
}
|
||||
|
||||
void board_nand_select_device(struct nand_chip *nand, int chip)
|
||||
{
|
||||
/*
|
||||
* Don't use "chip" to address the NAND device,
|
||||
* generate the cs from the address where it is encoded.
|
||||
*/
|
||||
}
|
||||
|
||||
static int jz_nand_rs_calculate_ecc(struct mtd_info* mtd, const u_char* dat,
|
||||
u_char* ecc_code)
|
||||
{
|
||||
uint32_t reg, status;
|
||||
int i;
|
||||
volatile u8 *paraddr = (volatile u8 *)EMC_NFPAR0;
|
||||
|
||||
if(is_reading)
|
||||
return 0;
|
||||
|
||||
do {
|
||||
status = REG_EMC_NFINTS;
|
||||
} while(!(status & EMC_NFINTS_ENCF));
|
||||
|
||||
__nand_ecc_disable();
|
||||
|
||||
for(i = 0; i < 9; i++)
|
||||
ecc_code[i] = *(paraddr + i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void jz_nand_hwctl(struct mtd_info* mtd, int mode)
|
||||
{
|
||||
uint32_t reg;
|
||||
REG_EMC_NFINTS = 0;
|
||||
reg = REG_EMC_NFECR;
|
||||
reg |= JZ_NAND_ECC_CTRL_RESET;
|
||||
reg |= JZ_NAND_ECC_CTRL_ENABLE;
|
||||
reg |= JZ_NAND_ECC_CTRL_RS;
|
||||
|
||||
switch(mode) {
|
||||
case NAND_ECC_READ:
|
||||
reg &= ~JZ_NAND_ECC_CTRL_ENCODING;
|
||||
is_reading = 1;
|
||||
break;
|
||||
case NAND_ECC_WRITE:
|
||||
reg |= JZ_NAND_ECC_CTRL_ENCODING;
|
||||
is_reading = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
REG_EMC_NFECR = reg;
|
||||
}
|
||||
|
||||
/* Correct 1~9-bit errors in 512-bytes data */
|
||||
static void jz_rs_correct(unsigned char *dat, int idx, int mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
idx--;
|
||||
|
||||
i = idx + (idx >> 3);
|
||||
if (i >= 512)
|
||||
return;
|
||||
|
||||
mask <<= (idx & 0x7);
|
||||
|
||||
dat[i] ^= mask & 0xff;
|
||||
if (i < 511)
|
||||
dat[i+1] ^= (mask >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
|
||||
u_char *read_ecc, u_char *calc_ecc)
|
||||
{
|
||||
int k;
|
||||
uint32_t reg, status;
|
||||
volatile u8 *paraddr = (volatile u8 *)EMC_NFPAR0;
|
||||
|
||||
/* Set PAR values */
|
||||
static uint8_t all_ff_ecc[] = {0xcd, 0x9d, 0x90, 0x58, 0xf4, 0x8b, 0xff, 0xb7, 0x6f};
|
||||
if (read_ecc[0] == 0xff &&
|
||||
read_ecc[1] == 0xff &&
|
||||
read_ecc[2] == 0xff &&
|
||||
read_ecc[3] == 0xff &&
|
||||
read_ecc[4] == 0xff &&
|
||||
read_ecc[5] == 0xff &&
|
||||
read_ecc[6] == 0xff &&
|
||||
read_ecc[7] == 0xff &&
|
||||
read_ecc[8] == 0xff) {
|
||||
for (k = 0; k < 9; k++)
|
||||
*(paraddr + k) = all_ff_ecc[k];
|
||||
} else {
|
||||
|
||||
for (k = 0; k < 9; k++)
|
||||
*(paraddr + k) = read_ecc[k];
|
||||
}
|
||||
/* Set PRDY */
|
||||
REG_EMC_NFECR |= EMC_NFECR_PRDY;
|
||||
|
||||
/* Wait for completion */
|
||||
do {
|
||||
status = REG_EMC_NFINTS;
|
||||
} while (!(status & EMC_NFINTS_DECF));
|
||||
|
||||
__nand_ecc_disable();
|
||||
|
||||
/* Check decoding */
|
||||
if (status & EMC_NFINTS_ERR) {
|
||||
if (status & EMC_NFINTS_UNCOR) {
|
||||
printk("uncorrectable ecc\n");
|
||||
while(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t errcnt = (status & EMC_NFINTS_ERRCNT_MASK) >> EMC_NFINTS_ERRCNT_BIT;
|
||||
switch (errcnt) {
|
||||
case 4:
|
||||
jz_rs_correct(dat,
|
||||
(REG_EMC_NFERR3 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT,
|
||||
(REG_EMC_NFERR3 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT);
|
||||
case 3:
|
||||
jz_rs_correct(dat,
|
||||
(REG_EMC_NFERR2 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT,
|
||||
(REG_EMC_NFERR2 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT);
|
||||
case 2:
|
||||
jz_rs_correct(dat,
|
||||
(REG_EMC_NFERR1 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT,
|
||||
(REG_EMC_NFERR1 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT);
|
||||
case 1:
|
||||
jz_rs_correct(dat,
|
||||
(REG_EMC_NFERR0 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT,
|
||||
(REG_EMC_NFERR0 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT);
|
||||
return errcnt;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main initialization routine
|
||||
*/
|
||||
int board_nand_init(struct nand_chip *nand)
|
||||
{
|
||||
/* EMC setup, Set NFE bit */
|
||||
REG_EMC_NFCSR |= EMC_NFCSR_NFE1;
|
||||
REG_EMC_SMCR1 = 0x094c4400;
|
||||
/* REG_EMC_SMCR3 = 0x04444400; */
|
||||
|
||||
nand->IO_ADDR_R = JZ_NAND_DATA_ADDR;
|
||||
nand->IO_ADDR_W = JZ_NAND_DATA_ADDR;
|
||||
nand->cmd_ctrl = jz_nand_cmd_ctrl;
|
||||
nand->dev_ready = jz_nand_device_ready;
|
||||
|
||||
nand->ecc.hwctl = jz_nand_hwctl;
|
||||
nand->ecc.correct = jz_nand_rs_correct_data;
|
||||
nand->ecc.calculate = jz_nand_rs_calculate_ecc;
|
||||
nand->ecc.mode = NAND_ECC_HW_OOB_FIRST;
|
||||
nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE;
|
||||
nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES;
|
||||
nand->ecc.layout = &qi_lb60_ecclayout_2gb;
|
||||
nand->chip_delay = 50;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* (CONFIG_CMD_NAND) */
|
||||
414
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.c
Normal file
414
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.c
Normal file
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* JzRISC lcd controller
|
||||
*
|
||||
* Xiangfu Liu <xiangfu@sharism.cc>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <common.h>
|
||||
#include <lcd.h>
|
||||
|
||||
#include <asm/io.h> /* virt_to_phys() */
|
||||
|
||||
#include <asm/jz4740.h>
|
||||
#include "nanonote_gpm940b0.h"
|
||||
|
||||
#define align2(n) (n)=((((n)+1)>>1)<<1)
|
||||
#define align4(n) (n)=((((n)+3)>>2)<<2)
|
||||
#define align8(n) (n)=((((n)+7)>>3)<<3)
|
||||
|
||||
struct jzfb_info {
|
||||
unsigned int cfg; /* panel mode and pin usage etc. */
|
||||
unsigned int w;
|
||||
unsigned int h;
|
||||
unsigned int bpp; /* bit per pixel */
|
||||
unsigned int fclk; /* frame clk */
|
||||
unsigned int hsw; /* hsync width, in pclk */
|
||||
unsigned int vsw; /* vsync width, in line count */
|
||||
unsigned int elw; /* end of line, in pclk */
|
||||
unsigned int blw; /* begin of line, in pclk */
|
||||
unsigned int efw; /* end of frame, in line count */
|
||||
unsigned int bfw; /* begin of frame, in line count */
|
||||
};
|
||||
|
||||
static struct jzfb_info jzfb = {
|
||||
MODE_8BIT_SERIAL_TFT | PCLK_N | HSYNC_N | VSYNC_N,
|
||||
320, 240, 32, 70, 1, 1, 273, 140, 1, 20
|
||||
};
|
||||
|
||||
vidinfo_t panel_info = {
|
||||
320, 240, LCD_BPP,
|
||||
};
|
||||
|
||||
int lcd_line_length;
|
||||
int lcd_color_fg;
|
||||
int lcd_color_bg;
|
||||
/*
|
||||
* Frame buffer memory information
|
||||
*/
|
||||
void *lcd_base; /* Start of framebuffer memory */
|
||||
void *lcd_console_address; /* Start of console buffer */
|
||||
|
||||
short console_col;
|
||||
short console_row;
|
||||
|
||||
void lcd_ctrl_init (void *lcdbase);
|
||||
void lcd_enable (void);
|
||||
void lcd_disable (void);
|
||||
|
||||
static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid);
|
||||
static void jz_lcd_desc_init(vidinfo_t *vid);
|
||||
static int jz_lcd_hw_init(vidinfo_t *vid);
|
||||
extern int flush_cache_all(void);
|
||||
|
||||
void lcd_ctrl_init (void *lcdbase)
|
||||
{
|
||||
jz_lcd_init_mem(lcdbase, &panel_info);
|
||||
jz_lcd_desc_init(&panel_info);
|
||||
jz_lcd_hw_init(&panel_info);
|
||||
}
|
||||
|
||||
/*
|
||||
* Before enabled lcd controller, lcd registers should be configured correctly.
|
||||
*/
|
||||
void lcd_enable (void)
|
||||
{
|
||||
REG_LCD_CTRL &= ~(1<<4); /* LCDCTRL.DIS */
|
||||
REG_LCD_CTRL |= 1<<3; /* LCDCTRL.ENA*/
|
||||
}
|
||||
|
||||
void lcd_disable (void)
|
||||
{
|
||||
REG_LCD_CTRL |= (1<<4); /* LCDCTRL.DIS, regular disable */
|
||||
/* REG_LCD_CTRL |= (1<<3); */ /* LCDCTRL.DIS, quikly disable */
|
||||
}
|
||||
|
||||
static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
|
||||
{
|
||||
u_long palette_mem_size;
|
||||
struct jz_fb_info *fbi = &vid->jz_fb;
|
||||
int fb_size = vid->vl_row * (vid->vl_col * NBITS (vid->vl_bpix)) / 8;
|
||||
|
||||
fbi->screen = (u_long)lcdbase;
|
||||
fbi->palette_size = 256;
|
||||
palette_mem_size = fbi->palette_size * sizeof(u16);
|
||||
|
||||
debug("jz_lcd.c palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size);
|
||||
/* locate palette and descs at end of page following fb */
|
||||
fbi->palette = (u_long)lcdbase + fb_size + PAGE_SIZE - palette_mem_size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void jz_lcd_desc_init(vidinfo_t *vid)
|
||||
{
|
||||
struct jz_fb_info * fbi;
|
||||
fbi = &vid->jz_fb;
|
||||
fbi->dmadesc_fblow = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 3*16);
|
||||
fbi->dmadesc_fbhigh = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 2*16);
|
||||
fbi->dmadesc_palette = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 1*16);
|
||||
|
||||
#define BYTES_PER_PANEL (vid->vl_col * vid->vl_row * NBITS(vid->vl_bpix) / 8)
|
||||
|
||||
/* populate descriptors */
|
||||
fbi->dmadesc_fblow->fdadr = virt_to_phys(fbi->dmadesc_fblow);
|
||||
fbi->dmadesc_fblow->fsadr = virt_to_phys((void *)(fbi->screen + BYTES_PER_PANEL));
|
||||
fbi->dmadesc_fblow->fidr = 0;
|
||||
fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL / 4 ;
|
||||
|
||||
fbi->fdadr1 = virt_to_phys(fbi->dmadesc_fblow); /* only used in dual-panel mode */
|
||||
|
||||
fbi->dmadesc_fbhigh->fsadr = virt_to_phys((void *)fbi->screen);
|
||||
fbi->dmadesc_fbhigh->fidr = 0;
|
||||
fbi->dmadesc_fbhigh->ldcmd = BYTES_PER_PANEL / 4; /* length in word */
|
||||
|
||||
fbi->dmadesc_palette->fsadr = virt_to_phys((void *)fbi->palette);
|
||||
fbi->dmadesc_palette->fidr = 0;
|
||||
fbi->dmadesc_palette->ldcmd = (fbi->palette_size * 2)/4 | (1<<28);
|
||||
|
||||
if(NBITS(vid->vl_bpix) < 12)
|
||||
{
|
||||
/* assume any mode with <12 bpp is palette driven */
|
||||
fbi->dmadesc_palette->fdadr = virt_to_phys(fbi->dmadesc_fbhigh);
|
||||
fbi->dmadesc_fbhigh->fdadr = virt_to_phys(fbi->dmadesc_palette);
|
||||
/* flips back and forth between pal and fbhigh */
|
||||
fbi->fdadr0 = virt_to_phys(fbi->dmadesc_palette);
|
||||
} else {
|
||||
/* palette shouldn't be loaded in true-color mode */
|
||||
fbi->dmadesc_fbhigh->fdadr = virt_to_phys((void *)fbi->dmadesc_fbhigh);
|
||||
fbi->fdadr0 = virt_to_phys(fbi->dmadesc_fbhigh); /* no pal just fbhigh */
|
||||
}
|
||||
|
||||
flush_cache_all();
|
||||
}
|
||||
|
||||
static int jz_lcd_hw_init(vidinfo_t *vid)
|
||||
{
|
||||
struct jz_fb_info *fbi = &vid->jz_fb;
|
||||
unsigned int val = 0;
|
||||
unsigned int pclk;
|
||||
unsigned int stnH;
|
||||
int pll_div;
|
||||
|
||||
/* Setting Control register */
|
||||
switch (jzfb.bpp) {
|
||||
case 1:
|
||||
val |= LCD_CTRL_BPP_1;
|
||||
break;
|
||||
case 2:
|
||||
val |= LCD_CTRL_BPP_2;
|
||||
break;
|
||||
case 4:
|
||||
val |= LCD_CTRL_BPP_4;
|
||||
break;
|
||||
case 8:
|
||||
val |= LCD_CTRL_BPP_8;
|
||||
break;
|
||||
case 15:
|
||||
val |= LCD_CTRL_RGB555;
|
||||
case 16:
|
||||
val |= LCD_CTRL_BPP_16;
|
||||
break;
|
||||
case 17 ... 32:
|
||||
val |= LCD_CTRL_BPP_18_24; /* target is 4bytes/pixel */
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("jz_lcd.c The BPP %d is not supported\n", jzfb.bpp);
|
||||
val |= LCD_CTRL_BPP_16;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (jzfb.cfg & MODE_MASK) {
|
||||
case MODE_STN_MONO_DUAL:
|
||||
case MODE_STN_COLOR_DUAL:
|
||||
case MODE_STN_MONO_SINGLE:
|
||||
case MODE_STN_COLOR_SINGLE:
|
||||
switch (jzfb.bpp) {
|
||||
case 1:
|
||||
/* val |= LCD_CTRL_PEDN; */
|
||||
case 2:
|
||||
val |= LCD_CTRL_FRC_2;
|
||||
break;
|
||||
case 4:
|
||||
val |= LCD_CTRL_FRC_4;
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
val |= LCD_CTRL_FRC_16;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
val |= LCD_CTRL_BST_16; /* Burst Length is 16WORD=64Byte */
|
||||
val |= LCD_CTRL_OFUP; /* OutFIFO underrun protect */
|
||||
|
||||
switch (jzfb.cfg & MODE_MASK) {
|
||||
case MODE_STN_MONO_DUAL:
|
||||
case MODE_STN_COLOR_DUAL:
|
||||
case MODE_STN_MONO_SINGLE:
|
||||
case MODE_STN_COLOR_SINGLE:
|
||||
switch (jzfb.cfg & STN_DAT_PINMASK) {
|
||||
case STN_DAT_PIN1:
|
||||
/* Do not adjust the hori-param value. */
|
||||
break;
|
||||
case STN_DAT_PIN2:
|
||||
align2(jzfb.hsw);
|
||||
align2(jzfb.elw);
|
||||
align2(jzfb.blw);
|
||||
break;
|
||||
case STN_DAT_PIN4:
|
||||
align4(jzfb.hsw);
|
||||
align4(jzfb.elw);
|
||||
align4(jzfb.blw);
|
||||
break;
|
||||
case STN_DAT_PIN8:
|
||||
align8(jzfb.hsw);
|
||||
align8(jzfb.elw);
|
||||
align8(jzfb.blw);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
REG_LCD_CTRL = val;
|
||||
|
||||
switch (jzfb.cfg & MODE_MASK) {
|
||||
case MODE_STN_MONO_DUAL:
|
||||
case MODE_STN_COLOR_DUAL:
|
||||
case MODE_STN_MONO_SINGLE:
|
||||
case MODE_STN_COLOR_SINGLE:
|
||||
if (((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL))
|
||||
stnH = jzfb.h >> 1;
|
||||
else
|
||||
stnH = jzfb.h;
|
||||
|
||||
REG_LCD_VSYNC = (0 << 16) | jzfb.vsw;
|
||||
REG_LCD_HSYNC = ((jzfb.blw+jzfb.w) << 16) | (jzfb.blw+jzfb.w+jzfb.hsw);
|
||||
|
||||
/* Screen setting */
|
||||
REG_LCD_VAT = ((jzfb.blw + jzfb.w + jzfb.hsw + jzfb.elw) << 16) | (stnH + jzfb.vsw + jzfb.bfw + jzfb.efw);
|
||||
REG_LCD_DAH = (jzfb.blw << 16) | (jzfb.blw + jzfb.w);
|
||||
REG_LCD_DAV = (0 << 16) | (stnH);
|
||||
|
||||
/* AC BIAs signal */
|
||||
REG_LCD_PS = (0 << 16) | (stnH+jzfb.vsw+jzfb.efw+jzfb.bfw);
|
||||
|
||||
break;
|
||||
|
||||
case MODE_TFT_GEN:
|
||||
case MODE_TFT_SHARP:
|
||||
case MODE_TFT_CASIO:
|
||||
case MODE_TFT_SAMSUNG:
|
||||
case MODE_8BIT_SERIAL_TFT:
|
||||
case MODE_TFT_18BIT:
|
||||
REG_LCD_VSYNC = (0 << 16) | jzfb.vsw;
|
||||
REG_LCD_HSYNC = (0 << 16) | jzfb.hsw;
|
||||
REG_LCD_DAV =((jzfb.vsw+jzfb.bfw) << 16) | (jzfb.vsw +jzfb.bfw+jzfb.h);
|
||||
REG_LCD_DAH = ((jzfb.hsw + jzfb.blw) << 16) | (jzfb.hsw + jzfb.blw + jzfb.w );
|
||||
REG_LCD_VAT = (((jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw)) << 16) \
|
||||
| (jzfb.vsw + jzfb.bfw + jzfb.h + jzfb.efw);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (jzfb.cfg & MODE_MASK) {
|
||||
case MODE_TFT_SAMSUNG:
|
||||
{
|
||||
unsigned int total, tp_s, tp_e, ckv_s, ckv_e;
|
||||
unsigned int rev_s, rev_e, inv_s, inv_e;
|
||||
|
||||
pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) *
|
||||
(jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */
|
||||
|
||||
total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw;
|
||||
tp_s = jzfb.blw + jzfb.w + 1;
|
||||
tp_e = tp_s + 1;
|
||||
/* ckv_s = tp_s - jz_clocks.pixclk/(1000000000/4100); */
|
||||
ckv_s = tp_s - pclk/(1000000000/4100);
|
||||
ckv_e = tp_s + total;
|
||||
rev_s = tp_s - 11; /* -11.5 clk */
|
||||
rev_e = rev_s + total;
|
||||
inv_s = tp_s;
|
||||
inv_e = inv_s + total;
|
||||
REG_LCD_CLS = (tp_s << 16) | tp_e;
|
||||
REG_LCD_PS = (ckv_s << 16) | ckv_e;
|
||||
REG_LCD_SPL = (rev_s << 16) | rev_e;
|
||||
REG_LCD_REV = (inv_s << 16) | inv_e;
|
||||
jzfb.cfg |= STFT_REVHI | STFT_SPLHI;
|
||||
break;
|
||||
}
|
||||
case MODE_TFT_SHARP:
|
||||
{
|
||||
unsigned int total, cls_s, cls_e, ps_s, ps_e;
|
||||
unsigned int spl_s, spl_e, rev_s, rev_e;
|
||||
total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw;
|
||||
spl_s = 1;
|
||||
spl_e = spl_s + 1;
|
||||
cls_s = 0;
|
||||
cls_e = total - 60; /* > 4us (pclk = 80ns) */
|
||||
ps_s = cls_s;
|
||||
ps_e = cls_e;
|
||||
rev_s = total - 40; /* > 3us (pclk = 80ns) */
|
||||
rev_e = rev_s + total;
|
||||
jzfb.cfg |= STFT_PSHI;
|
||||
REG_LCD_SPL = (spl_s << 16) | spl_e;
|
||||
REG_LCD_CLS = (cls_s << 16) | cls_e;
|
||||
REG_LCD_PS = (ps_s << 16) | ps_e;
|
||||
REG_LCD_REV = (rev_s << 16) | rev_e;
|
||||
break;
|
||||
}
|
||||
case MODE_TFT_CASIO:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Configure the LCD panel */
|
||||
REG_LCD_CFG = jzfb.cfg;
|
||||
|
||||
/* Timing setting */
|
||||
__cpm_stop_lcd();
|
||||
|
||||
val = jzfb.fclk; /* frame clk */
|
||||
if ( (jzfb.cfg & MODE_MASK) != MODE_8BIT_SERIAL_TFT) {
|
||||
pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) *
|
||||
(jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */
|
||||
} else {
|
||||
/* serial mode: Hsync period = 3*Width_Pixel */
|
||||
pclk = val * (jzfb.w*3 + jzfb.hsw + jzfb.elw + jzfb.blw) *
|
||||
(jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */
|
||||
}
|
||||
|
||||
if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL))
|
||||
pclk = (pclk * 3);
|
||||
|
||||
if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_SINGLE) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL))
|
||||
pclk = pclk >> ((jzfb.cfg & STN_DAT_PINMASK) >> 4);
|
||||
|
||||
if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL))
|
||||
pclk >>= 1;
|
||||
|
||||
pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source,0:pllout/2 1: pllout */
|
||||
pll_div = pll_div ? 1 : 2 ;
|
||||
val = ( __cpm_get_pllout()/pll_div ) / pclk;
|
||||
val--;
|
||||
if ( val > 0x1ff ) {
|
||||
printf("CPM_LPCDR too large, set it to 0x1ff\n");
|
||||
val = 0x1ff;
|
||||
}
|
||||
__cpm_set_pixdiv(val);
|
||||
|
||||
val = pclk * 3 ; /* LCDClock > 2.5*Pixclock */
|
||||
if ( val > 150000000 ) {
|
||||
printf("Warning: LCDClock=%d\n, LCDClock must less or equal to 150MHz.\n", val);
|
||||
printf("Change LCDClock to 150MHz\n");
|
||||
val = 150000000;
|
||||
}
|
||||
val = ( __cpm_get_pllout()/pll_div ) / val;
|
||||
val--;
|
||||
if ( val > 0x1f ) {
|
||||
printf("CPM_CPCCR.LDIV too large, set it to 0x1f\n");
|
||||
val = 0x1f;
|
||||
}
|
||||
__cpm_set_ldiv( val );
|
||||
REG_CPM_CPCCR |= CPM_CPCCR_CE ; /* update divide */
|
||||
|
||||
__cpm_start_lcd();
|
||||
udelay(1000);
|
||||
|
||||
REG_LCD_DA0 = fbi->fdadr0; /* frame descripter*/
|
||||
|
||||
if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ||
|
||||
((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL))
|
||||
REG_LCD_DA1 = fbi->fdadr1; /* frame descripter*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
|
||||
{
|
||||
}
|
||||
|
||||
void lcd_initcolregs (void)
|
||||
{
|
||||
}
|
||||
135
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.h
Normal file
135
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* JzRISC lcd controller
|
||||
*
|
||||
* Xiangfu Liu <xiangfu@sharism.cc>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __QI_LB60_GPM940B0_H__
|
||||
#define __QI_LB60_GPM940B0_H__
|
||||
|
||||
struct lcd_desc{
|
||||
unsigned int next_desc; /* LCDDAx */
|
||||
unsigned int databuf; /* LCDSAx */
|
||||
unsigned int frame_id; /* LCDFIDx */
|
||||
unsigned int cmd; /* LCDCMDx */
|
||||
};
|
||||
|
||||
#define MODE_MASK 0x0f
|
||||
#define MODE_TFT_GEN 0x00
|
||||
#define MODE_TFT_SHARP 0x01
|
||||
#define MODE_TFT_CASIO 0x02
|
||||
#define MODE_TFT_SAMSUNG 0x03
|
||||
#define MODE_CCIR656_NONINT 0x04
|
||||
#define MODE_CCIR656_INT 0x05
|
||||
#define MODE_STN_COLOR_SINGLE 0x08
|
||||
#define MODE_STN_MONO_SINGLE 0x09
|
||||
#define MODE_STN_COLOR_DUAL 0x0a
|
||||
#define MODE_STN_MONO_DUAL 0x0b
|
||||
#define MODE_8BIT_SERIAL_TFT 0x0c
|
||||
|
||||
#define MODE_TFT_18BIT (1<<7)
|
||||
|
||||
#define STN_DAT_PIN1 (0x00 << 4)
|
||||
#define STN_DAT_PIN2 (0x01 << 4)
|
||||
#define STN_DAT_PIN4 (0x02 << 4)
|
||||
#define STN_DAT_PIN8 (0x03 << 4)
|
||||
#define STN_DAT_PINMASK STN_DAT_PIN8
|
||||
|
||||
#define STFT_PSHI (1 << 15)
|
||||
#define STFT_CLSHI (1 << 14)
|
||||
#define STFT_SPLHI (1 << 13)
|
||||
#define STFT_REVHI (1 << 12)
|
||||
|
||||
#define SYNC_MASTER (0 << 16)
|
||||
#define SYNC_SLAVE (1 << 16)
|
||||
|
||||
#define DE_P (0 << 9)
|
||||
#define DE_N (1 << 9)
|
||||
|
||||
#define PCLK_P (0 << 10)
|
||||
#define PCLK_N (1 << 10)
|
||||
|
||||
#define HSYNC_P (0 << 11)
|
||||
#define HSYNC_N (1 << 11)
|
||||
|
||||
#define VSYNC_P (0 << 8)
|
||||
#define VSYNC_N (1 << 8)
|
||||
|
||||
#define DATA_NORMAL (0 << 17)
|
||||
#define DATA_INVERSE (1 << 17)
|
||||
|
||||
|
||||
/* Jz LCDFB supported I/O controls. */
|
||||
#define FBIOSETBACKLIGHT 0x4688
|
||||
#define FBIODISPON 0x4689
|
||||
#define FBIODISPOFF 0x468a
|
||||
#define FBIORESET 0x468b
|
||||
#define FBIOPRINT_REG 0x468c
|
||||
|
||||
/*
|
||||
* LCD panel specific definition
|
||||
*/
|
||||
#define MODE (0xc9) /* 8bit serial RGB */
|
||||
|
||||
#define __spi_write_reg1(reg, val) \
|
||||
do { \
|
||||
unsigned char no; \
|
||||
unsigned short value; \
|
||||
unsigned char a=reg; \
|
||||
unsigned char b=val; \
|
||||
__gpio_set_pin(SPEN); \
|
||||
__gpio_set_pin(SPCK); \
|
||||
__gpio_clear_pin(SPDA); \
|
||||
__gpio_clear_pin(SPEN); \
|
||||
value=((a<<8)|(b&0xFF)); \
|
||||
for(no=0;no<16;no++) \
|
||||
{ \
|
||||
__gpio_clear_pin(SPCK); \
|
||||
if((value&0x8000)==0x8000) \
|
||||
__gpio_set_pin(SPDA); \
|
||||
else \
|
||||
__gpio_clear_pin(SPDA); \
|
||||
__gpio_set_pin(SPCK); \
|
||||
value=(value<<1); \
|
||||
} \
|
||||
__gpio_set_pin(SPEN); \
|
||||
} while (0)
|
||||
|
||||
#define __lcd_display_pin_init() \
|
||||
do { \
|
||||
__cpm_start_tcu(); \
|
||||
__gpio_as_output(SPEN); /* use SPDA */ \
|
||||
__gpio_as_output(SPCK); /* use SPCK */ \
|
||||
__gpio_as_output(SPDA); /* use SPDA */ \
|
||||
} while (0)
|
||||
|
||||
#define __lcd_display_on() \
|
||||
do { \
|
||||
__spi_write_reg1(0x05, 0x1e); \
|
||||
__spi_write_reg1(0x05, 0x5e); \
|
||||
__spi_write_reg1(0x07, 0x8d); \
|
||||
__spi_write_reg1(0x13, 0x01); \
|
||||
__spi_write_reg1(0x05, 0x5f); \
|
||||
} while (0)
|
||||
|
||||
#define __lcd_display_off() \
|
||||
do { \
|
||||
__spi_write_reg1(0x05, 0x5e); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __QI_LB60_GPM940B0_H__ */
|
||||
Reference in New Issue
Block a user