From 2df7fab553239755c422838c27c4e7a202ff7efe Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Sep 2016 15:42:48 +0200 Subject: [PATCH] xburst: add kernel 4.4 support Add support for kernel 4.4 and make it the default. This was only compile tested. Signed-off-by: Hauke Mehrtens --- target/linux/xburst/Makefile | 2 +- target/linux/xburst/config-4.4 | 362 ++++++++++++++++++ ...e-vid-header-instead-of-the-whole-pa.patch | 20 + ...-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch | 43 +++ ...-for-subpage-reads-for-NAND_ECC_HW_O.patch | 104 +++++ ...y-activation-of-the-DAC-to-work-arou.patch | 33 ++ ...it-the-regulator-register-on-startup.patch | 55 +++ .../006-Add-ili8960-lcd-driver.patch | 306 +++++++++++++++ ...e-3-wire-spi-mode-for-the-display-fo.patch | 21 + 9 files changed, 945 insertions(+), 1 deletion(-) create mode 100644 target/linux/xburst/config-4.4 create mode 100644 target/linux/xburst/patches-4.4/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch create mode 100644 target/linux/xburst/patches-4.4/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch create mode 100644 target/linux/xburst/patches-4.4/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch create mode 100644 target/linux/xburst/patches-4.4/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch create mode 100644 target/linux/xburst/patches-4.4/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch create mode 100644 target/linux/xburst/patches-4.4/006-Add-ili8960-lcd-driver.patch create mode 100644 target/linux/xburst/patches-4.4/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch diff --git a/target/linux/xburst/Makefile b/target/linux/xburst/Makefile index 2a64b7c46f..2c67251444 100644 --- a/target/linux/xburst/Makefile +++ b/target/linux/xburst/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=Ingenic XBurst FEATURES:=targz nand ubifs audio SUBTARGETS:=qi_lb60 -KERNEL_PATCHVER:=3.18 +KERNEL_PATCHVER:=4.4 DEVICE_TYPE:=other diff --git a/target/linux/xburst/config-4.4 b/target/linux/xburst/config-4.4 new file mode 100644 index 0000000000..099621fed5 --- /dev/null +++ b/target/linux/xburst/config-4.4 @@ -0,0 +1,362 @@ +CONFIG_ARCH_BINFMT_ELF_STATE=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set +# CONFIG_ARCH_HAS_SG_CHAIN is not set +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_BACKLIGHT_PWM is not set +CONFIG_BATTERY_JZ4740=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BUILTIN_DTB=y +CONFIG_CHARGER_GPIO=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMMON_CLK=y +CONFIG_CONFIGFS_FS=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +CONFIG_CPU_MIPSR1=y +CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_R4K_FPU=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CRC16=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_XZ=y +CONFIG_DMADEVICES=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_JZ4740=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_DMA_OF=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_EXT4_FS=y +CONFIG_FAT_FS=y +CONFIG_FB=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_JZ4740=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FONTS=y +# CONFIG_FONT_10x18 is not set +# CONFIG_FONT_6x10 is not set +CONFIG_FONT_6x11=y +# CONFIG_FONT_7x14 is not set +# CONFIG_FONT_8x16 is not set +# CONFIG_FONT_8x8 is not set +# CONFIG_FONT_ACORN_8x8 is not set +# CONFIG_FONT_MINI_4x6 is not set +# CONFIG_FONT_PEARL_8x8 is not set +# CONFIG_FONT_SUN12x22 is not set +# CONFIG_FONT_SUN8x16 is not set +CONFIG_FONT_SUPPORT=y +CONFIG_FORCE_MAX_ZONEORDER=12 +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FREEZER=y +CONFIG_FS_MBCACHE=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +# CONFIG_HAVE_ARCH_BITREVERSE is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_HW_CONSOLE=y +CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_INGENIC_IRQ=y +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_KEYBOARD=y +CONFIG_INPUT_MATRIXKMAP=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_PWM_BEEPER=y +CONFIG_INPUT_UINPUT=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_JZ4740_QI_LB60=y +# CONFIG_JZ4780_CI20 is not set +CONFIG_KALLSYMS=y +CONFIG_KEXEC=y +CONFIG_KEXEC_CORE=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_MATRIX=y +CONFIG_LCD_CLASS_DEVICE=y +CONFIG_LCD_ILI8960=y +# CONFIG_LCD_PLATFORM is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=2 +CONFIG_LIBFDT=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACH_INGENIC=y +CONFIG_MACH_JZ4740=y +CONFIG_MFD_CORE=y +CONFIG_MFD_JZ4740_ADC=y +CONFIG_MIPS=y +# CONFIG_MIPS_CLOCK_VSYSCALL is not set +# CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set +CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_MIPS_CMDLINE_FROM_DTB is not set +# CONFIG_MIPS_ELF_APPENDED_DTB is not set +# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_MACHINE is not set +CONFIG_MIPS_NO_APPENDED_DTB=y +# CONFIG_MIPS_RAW_APPENDED_DTB is not set +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +# CONFIG_MMC_BLOCK_BOUNCE is not set +CONFIG_MMC_JZ4740=y +CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +# CONFIG_MOUSE_PS2 is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_JZ4740=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_BLOCK is not set +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MUSB_PIO_ONLY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NLS=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_CODEPAGE_1250=y +CONFIG_NLS_CODEPAGE_1251=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_737=y +CONFIG_NLS_CODEPAGE_775=y +CONFIG_NLS_CODEPAGE_850=y +CONFIG_NLS_CODEPAGE_852=y +CONFIG_NLS_CODEPAGE_855=y +CONFIG_NLS_CODEPAGE_857=y +CONFIG_NLS_CODEPAGE_860=y +CONFIG_NLS_CODEPAGE_861=y +CONFIG_NLS_CODEPAGE_862=y +CONFIG_NLS_CODEPAGE_863=y +CONFIG_NLS_CODEPAGE_864=y +CONFIG_NLS_CODEPAGE_865=y +CONFIG_NLS_CODEPAGE_866=y +CONFIG_NLS_CODEPAGE_869=y +CONFIG_NLS_CODEPAGE_874=y +CONFIG_NLS_CODEPAGE_932=y +CONFIG_NLS_CODEPAGE_936=y +CONFIG_NLS_CODEPAGE_949=y +CONFIG_NLS_CODEPAGE_950=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_13=y +CONFIG_NLS_ISO8859_14=y +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_ISO8859_2=y +CONFIG_NLS_ISO8859_3=y +CONFIG_NLS_ISO8859_4=y +CONFIG_NLS_ISO8859_5=y +CONFIG_NLS_ISO8859_6=y +CONFIG_NLS_ISO8859_7=y +CONFIG_NLS_ISO8859_8=y +CONFIG_NLS_ISO8859_9=y +CONFIG_NLS_KOI8_R=y +CONFIG_NLS_KOI8_U=y +CONFIG_NLS_UTF8=y +CONFIG_NOP_USB_XCEIV=y +# CONFIG_NO_IOPORT_MAP is not set +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PM=y +CONFIG_PM_CLK=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_POWER_SUPPLY=y +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_RCU=y +CONFIG_PRINTK_TIME=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PWM=y +CONFIG_PWM_JZ4740=y +CONFIG_PWM_SYSFS=y +CONFIG_RATIONAL=y +# CONFIG_RCU_BOOST is not set +CONFIG_RCU_STALL_COMMON=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_CMOS is not set +CONFIG_RTC_DRV_JZ4740=y +# CONFIG_SCHED_HRTICK is not set +# CONFIG_SCHED_INFO is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250_FSL is not set +CONFIG_SERIO=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SND=y +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_JACK=y +CONFIG_SND_JZ4740_SOC=y +CONFIG_SND_JZ4740_SOC_I2S=y +CONFIG_SND_JZ4740_SOC_QI_LB60=y +CONFIG_SND_PCM=y +CONFIG_SND_SOC=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +CONFIG_SND_SOC_I2C_AND_SPI=y +CONFIG_SND_SOC_JZ4740_CODEC=y +CONFIG_SOUND=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +# CONFIG_SQUASHFS is not set +CONFIG_SRCU=y +# CONFIG_STAGING is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SYN_COOKIES is not set +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_ZBOOT=y +CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_XZ=y +CONFIG_UBIFS_FS_ZLIB=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_USB=y +# CONFIG_USB_AUDIO is not set +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_ETH=y +# CONFIG_USB_ETH_EEM is not set +# CONFIG_USB_ETH_RNDIS is not set +CONFIG_USB_F_ECM=y +CONFIG_USB_F_SUBSET=y +CONFIG_USB_GADGET=y +CONFIG_USB_LIBCOMPOSITE=y +# CONFIG_USB_MUSB_DUAL_ROLE is not set +CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_MUSB_HDRC=y +# CONFIG_USB_MUSB_HOST is not set +CONFIG_USB_MUSB_JZ4740=y +CONFIG_USB_OTG_BLACKLIST_HUB=y +CONFIG_USB_PHY=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_U_ETHER=y +# CONFIG_USERIO is not set +CONFIG_USE_OF=y +CONFIG_VFAT_FS=y +# CONFIG_VGA_CONSOLE is not set +# CONFIG_VLAN_8021Q is not set +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_VT_HW_CONSOLE_BINDING=y +# CONFIG_WATCHDOG is not set +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/xburst/patches-4.4/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch b/target/linux/xburst/patches-4.4/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch new file mode 100644 index 0000000000..e1d23dea01 --- /dev/null +++ b/target/linux/xburst/patches-4.4/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch @@ -0,0 +1,20 @@ +From b0eb5175e0de3e5134a36a7da382d8811562af12 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Tue, 15 Mar 2011 12:49:15 +0100 +Subject: [PATCH 1/7] ubi: Read only the vid header instead of the whole page + +--- + drivers/mtd/ubi/io.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/ubi/io.c ++++ b/drivers/mtd/ubi/io.c +@@ -1019,7 +1019,7 @@ int ubi_io_read_vid_hdr(struct ubi_devic + + p = (char *)vid_hdr - ubi->vid_hdr_shift; + read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, +- ubi->vid_hdr_alsize); ++ UBI_VID_HDR_SIZE + ubi->vid_hdr_shift); + if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err)) + return read_err; + diff --git a/target/linux/xburst/patches-4.4/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch b/target/linux/xburst/patches-4.4/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch new file mode 100644 index 0000000000..2b5f62f19b --- /dev/null +++ b/target/linux/xburst/patches-4.4/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch @@ -0,0 +1,43 @@ +From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Sat, 26 Feb 2011 15:30:07 +0100 +Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read + +Avoid sending unnecessary READ commands to the chip. +--- + drivers/mtd/nand/nand_base.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -1512,9 +1512,16 @@ static int nand_read_page_hwecc_oob_firs + unsigned int max_bitflips = 0; + + /* Read the OOB area first */ +- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); +- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); +- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); ++ /* Read the OOB area first */ ++ if (mtd->writesize > 512) { ++ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1); ++ } else { ++ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); ++ } + + for (i = 0; i < chip->ecc.total; i++) + ecc_code[i] = chip->oob_poi[eccpos[i]]; +@@ -1727,7 +1734,9 @@ static int nand_do_read_ops(struct mtd_i + __func__, buf); + + read_retry: +- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); ++ if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) { ++ chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); ++ } + + /* + * Now read the page into the buffer. Absent an error, diff --git a/target/linux/xburst/patches-4.4/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch b/target/linux/xburst/patches-4.4/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch new file mode 100644 index 0000000000..072a3356fc --- /dev/null +++ b/target/linux/xburst/patches-4.4/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch @@ -0,0 +1,104 @@ +From 6031a240816d1c9a10f596d0648e586f6b878809 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Tue, 15 Mar 2011 12:33:41 +0100 +Subject: [PATCH 3/7] NAND: Add support for subpage reads for + NAND_ECC_HW_OOB_FIRST + +--- + drivers/mtd/nand/nand_base.c | 77 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 76 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -1545,6 +1545,75 @@ static int nand_read_page_hwecc_oob_firs + } + + /** ++ * nand_read_subpage_hwecc_oob_first - [REPLACABLE] hw ecc based sub-page read function ++ * @mtd: mtd info structure ++ * @chip: nand chip info structure ++ * @data_offs: offset of requested data within the page ++ * @readlen: data length ++ * @bufpoi: buffer to store read data ++ * @page: page number to read ++ * ++ * Hardware ECC for large page chips, require OOB to be read first. ++ * For this ECC mode, the write_page method is re-used from ECC_HW. ++ * These methods read/write ECC from the OOB area, unlike the ++ * ECC_HW_SYNDROME support with multiple ECC steps, follows the ++ * "infix ECC" scheme and reads/writes ECC from the data area, by ++ * overwriting the NAND manufacturer bad block markings. ++ */ ++static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_chip *chip, ++ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi, int page) ++{ ++ int start_step, end_step, num_steps; ++ uint32_t *eccpos = chip->ecc.layout->eccpos; ++ uint8_t *p; ++ int data_col_addr; ++ int eccsize = chip->ecc.size; ++ int eccbytes = chip->ecc.bytes; ++ uint8_t *ecc_code = chip->buffers->ecccode; ++ uint8_t *ecc_calc = chip->buffers->ecccalc; ++ int i; ++ ++ /* Column address wihin the page aligned to ECC size */ ++ start_step = data_offs / chip->ecc.size; ++ end_step = (data_offs + readlen - 1) / chip->ecc.size; ++ num_steps = end_step - start_step + 1; ++ ++ data_col_addr = start_step * chip->ecc.size; ++ ++ /* Read the OOB area first */ ++ if (mtd->writesize > 512) { ++ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1); ++ } else { ++ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); ++ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); ++ chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page); ++ } ++ ++ for (i = 0; i < chip->ecc.total; i++) ++ ecc_code[i] = chip->oob_poi[eccpos[i]]; ++ ++ p = bufpoi + data_col_addr; ++ ++ for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) { ++ int stat; ++ ++ chip->ecc.hwctl(mtd, NAND_ECC_READ); ++ chip->read_buf(mtd, p, eccsize); ++ chip->ecc.calculate(mtd, p, &ecc_calc[i]); ++ ++ stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL); ++ if (stat < 0) ++ mtd->ecc_stats.failed++; ++ else ++ mtd->ecc_stats.corrected += stat; ++ } ++ ++ return 0; ++} ++ ++/** + * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page read + * @mtd: mtd info structure + * @chip: nand chip info structure +@@ -4158,8 +4227,14 @@ int nand_scan_tail(struct mtd_info *mtd) + pr_warn("No ECC functions supplied; hardware ECC not possible\n"); + BUG(); + } +- if (!ecc->read_page) ++ ++ if (!ecc->read_page) { + ecc->read_page = nand_read_page_hwecc_oob_first; ++ if (!ecc->read_subpage) { ++ ecc->read_subpage = nand_read_subpage_hwecc_oob_first; ++ chip->options |= NAND_SUBPAGE_READ; ++ } ++ } + + case NAND_ECC_HW: + /* Use standard hwecc read page function? */ diff --git a/target/linux/xburst/patches-4.4/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch b/target/linux/xburst/patches-4.4/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch new file mode 100644 index 0000000000..024955c568 --- /dev/null +++ b/target/linux/xburst/patches-4.4/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch @@ -0,0 +1,33 @@ +From 1a1095927d224403af8ad57c354cc64521bf3081 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Sat, 16 Jun 2012 19:36:31 +0200 +Subject: [PATCH 4/7] ASoC: JZ4740: delay activation of the DAC to work around + a sound bug. + +A proper fix of that bug would require a big rewrite of the driver, +which (I hope) will be done eventually. +--- + sound/soc/codecs/jz4740.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/sound/soc/codecs/jz4740.c ++++ b/sound/soc/codecs/jz4740.c +@@ -248,12 +248,15 @@ static int jz4740_codec_set_bias_level(s + case SND_SOC_BIAS_ON: + break; + case SND_SOC_BIAS_PREPARE: +- mask = JZ4740_CODEC_1_VREF_DISABLE | +- JZ4740_CODEC_1_VREF_AMP_DISABLE | +- JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; ++ mask = JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; + value = 0; + + regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value); ++ ++ msleep(500); ++ mask = JZ4740_CODEC_1_VREF_DISABLE | ++ JZ4740_CODEC_1_VREF_AMP_DISABLE; ++ regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, 0); + break; + case SND_SOC_BIAS_STANDBY: + /* The only way to clear the suspend flag is to reset the codec */ diff --git a/target/linux/xburst/patches-4.4/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch b/target/linux/xburst/patches-4.4/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch new file mode 100644 index 0000000000..f38483ab5c --- /dev/null +++ b/target/linux/xburst/patches-4.4/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch @@ -0,0 +1,55 @@ +From f05b1ecd7e4fde7e69320a4b7be461636e982991 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Thu, 13 Sep 2012 00:09:20 +0200 +Subject: [PATCH 5/7] RTC: JZ4740: Init the "regulator" register on startup. + +This register controls the accuracy of the RTC. uC/OS-II use +the RTC as a 100Hz clock, and writes a completely wrong value +on that register, that we have to overwrite if we want a working +real-time clock. + +Signed-off-by: Paul Cercueil +--- + drivers/rtc/rtc-jz4740.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/rtc/rtc-jz4740.c ++++ b/drivers/rtc/rtc-jz4740.c +@@ -15,6 +15,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -216,6 +217,7 @@ static int jz4740_rtc_probe(struct platf + struct jz4740_rtc *rtc; + uint32_t scratchpad; + struct resource *mem; ++ struct clk *rtc_clk; + + rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + if (!rtc) +@@ -263,6 +265,21 @@ static int jz4740_rtc_probe(struct platf + } + } + ++ rtc_clk = clk_get(&pdev->dev, "rtc"); ++ if (IS_ERR(rtc_clk)) { ++ dev_err(&pdev->dev, "Failed to get RTC clock\n"); ++ return PTR_ERR(rtc_clk); ++ } ++ ++ /* TODO: initialize the ADJC bits (25:16) to fine-tune ++ * the accuracy of the RTC */ ++ ret = jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR, ++ (clk_get_rate(rtc_clk) - 1) & 0xffff); ++ clk_put(rtc_clk); ++ ++ if (ret) ++ dev_warn(&pdev->dev, "Could not update RTC regulator register\n"); ++ + return 0; + } + diff --git a/target/linux/xburst/patches-4.4/006-Add-ili8960-lcd-driver.patch b/target/linux/xburst/patches-4.4/006-Add-ili8960-lcd-driver.patch new file mode 100644 index 0000000000..88f3c89478 --- /dev/null +++ b/target/linux/xburst/patches-4.4/006-Add-ili8960-lcd-driver.patch @@ -0,0 +1,306 @@ +From 8741ead92bc93e66740237e51b88b8690ebcbba3 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Sun, 1 Aug 2010 21:19:40 +0200 +Subject: [PATCH 6/7] Add ili8960 lcd driver + +Includes the following changes from the jz-3.5 branch: +- Use module_spi_driver +- Use devm_kzalloc +- Use kstrtoul + +Signed-off-by: Lars-Peter Clausen +--- + drivers/video/backlight/Kconfig | 7 + + drivers/video/backlight/Makefile | 1 + + drivers/video/backlight/ili8960.c | 262 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 270 insertions(+) + create mode 100644 drivers/video/backlight/ili8960.c + +--- a/drivers/video/backlight/Kconfig ++++ b/drivers/video/backlight/Kconfig +@@ -61,6 +61,13 @@ config LCD_LTV350QV + + The LTV350QV panel is present on all ATSTK1000 boards. + ++config LCD_ILI8960 ++ tristate "Ilitek ili8960 LCD driver" ++ depends on LCD_CLASS_DEVICE && SPI ++ default n ++ help ++ Driver for the Ilitek ili8960 LCD controller chip. ++ + config LCD_ILI922X + tristate "ILI Technology ILI9221/ILI9222 support" + depends on SPI +--- a/drivers/video/backlight/Makefile ++++ b/drivers/video/backlight/Makefile +@@ -5,6 +5,7 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o + obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o + obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o + obj-$(CONFIG_LCD_HX8357) += hx8357.o ++obj-$(CONFIG_LCD_ILI8960) += ili8960.o + obj-$(CONFIG_LCD_ILI922X) += ili922x.o + obj-$(CONFIG_LCD_ILI9320) += ili9320.o + obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o +--- /dev/null ++++ b/drivers/video/backlight/ili8960.c +@@ -0,0 +1,259 @@ ++/* ++ * Copyright (C) 2009-2010, Lars-Peter Clausen ++ * Driver for Ilitek ili8960 LCD ++ * ++ * 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. ++ * ++ * 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., ++ * 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++struct ili8960 { ++ struct spi_device *spi; ++ struct lcd_device *lcd; ++ bool enabled; ++ unsigned int brightness; ++}; ++ ++#define ILI8960_REG_BRIGHTNESS 0x03 ++#define ILI8960_REG_POWER 0x05 ++#define ILI8960_REG_CONTRAST 0x0d ++ ++static int ili8960_write_reg(struct spi_device *spi, uint8_t reg, ++ uint8_t data) ++{ ++ uint8_t buf[2]; ++ buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f); ++ buf[1] = data; ++ ++ return spi_write(spi, buf, sizeof(buf)); ++} ++ ++static int ili8960_programm_power(struct spi_device *spi, bool enabled) ++{ ++ int ret; ++ ++ if (enabled) ++ mdelay(20); ++ ++ ret = ili8960_write_reg(spi, ILI8960_REG_POWER, enabled ? 0xc7 : 0xc6); ++ ++ if (!enabled) ++ mdelay(20); ++ ++ return ret; ++} ++ ++static int ili8960_set_power(struct lcd_device *lcd, int power) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ ++ switch (power) { ++ case FB_BLANK_UNBLANK: ++ ili8960->enabled = true; ++ break; ++ default: ++ return 0; ++ } ++ ++ return ili8960_programm_power(ili8960->spi, ili8960->enabled); ++} ++ ++static int ili8960_early_set_power(struct lcd_device *lcd, int power) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ ++ switch (power) { ++ case FB_BLANK_UNBLANK: ++ return 0; ++ default: ++ ili8960->enabled = false; ++ break; ++ } ++ ++ return ili8960_programm_power(ili8960->spi, ili8960->enabled); ++} ++ ++static int ili8960_get_power(struct lcd_device *lcd) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ return ili8960->enabled ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; ++} ++ ++static int ili8960_set_contrast(struct lcd_device *lcd, int contrast) ++{ ++ struct ili8960 *ili8960 = lcd_get_data(lcd); ++ ++ return ili8960_write_reg(ili8960->spi, ILI8960_REG_CONTRAST, contrast); ++} ++ ++static int ili8960_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) ++{ ++ if (mode->xres != 320 && mode->yres != 240) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int ili8960_set_brightness(struct ili8960 *ili8960, int brightness) ++{ ++ int ret; ++ ++ ret = ili8960_write_reg(ili8960->spi, ILI8960_REG_BRIGHTNESS, brightness); ++ ++ if (ret == 0) ++ ili8960->brightness = brightness; ++ ++ return ret; ++} ++ ++static ssize_t ili8960_show_brightness(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct lcd_device *ld = to_lcd_device(dev); ++ struct ili8960 *ili8960 = lcd_get_data(ld); ++ ++ return sprintf(buf, "%u\n", ili8960->brightness); ++} ++ ++static ssize_t ili8960_store_brightness(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ struct lcd_device *ld = to_lcd_device(dev); ++ struct ili8960 *ili8960 = lcd_get_data(ld); ++ unsigned long brightness; ++ int ret; ++ ++ ret = kstrtoul(buf, 0, &brightness); ++ if (ret) ++ return ret; ++ ++ if (brightness > 255) ++ return -EINVAL; ++ ++ ili8960_set_brightness(ili8960, brightness); ++ ++ return count; ++} ++ ++ ++static DEVICE_ATTR(brightness, 0644, ili8960_show_brightness, ++ ili8960_store_brightness); ++ ++static struct lcd_ops ili8960_lcd_ops = { ++ .set_power = ili8960_set_power, ++ .early_set_power = ili8960_early_set_power, ++ .get_power = ili8960_get_power, ++ .set_contrast = ili8960_set_contrast, ++ .set_mode = ili8960_set_mode, ++}; ++ ++static int ili8960_probe(struct spi_device *spi) ++{ ++ int ret; ++ struct ili8960 *ili8960; ++ ++ ili8960 = devm_kzalloc(&spi->dev, sizeof(*ili8960), GFP_KERNEL); ++ if (!ili8960) ++ return -ENOMEM; ++ ++ spi->bits_per_word = 8; ++ spi->mode = SPI_MODE_3; ++ ++ ret = spi_setup(spi); ++ if (ret) { ++ dev_err(&spi->dev, "Failed to setup spi\n"); ++ return ret; ++ } ++ ++ ili8960->spi = spi; ++ ++ ili8960->lcd = lcd_device_register("ili8960-lcd", &spi->dev, ili8960, ++ &ili8960_lcd_ops); ++ ++ if (IS_ERR(ili8960->lcd)) { ++ ret = PTR_ERR(ili8960->lcd); ++ dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret); ++ return ret; ++ } ++ ++ ili8960->lcd->props.max_contrast = 255; ++ ++ ret = device_create_file(&ili8960->lcd->dev, &dev_attr_brightness); ++ if (ret) ++ goto err_unregister_lcd; ++ ++ ili8960_programm_power(ili8960->spi, true); ++ ili8960->enabled = true; ++ ++ spi_set_drvdata(spi, ili8960); ++ ++ ili8960_write_reg(spi, 0x13, 0x01); ++ ++ return 0; ++err_unregister_lcd: ++ lcd_device_unregister(ili8960->lcd); ++ return ret; ++} ++ ++static int ili8960_remove(struct spi_device *spi) ++{ ++ struct ili8960 *ili8960 = spi_get_drvdata(spi); ++ ++ device_remove_file(&ili8960->lcd->dev, &dev_attr_brightness); ++ lcd_device_unregister(ili8960->lcd); ++ ++ spi_set_drvdata(spi, NULL); ++ return 0; ++} ++ ++#ifdef CONFIG_PM_SLEEP ++ ++static int ili8960_suspend(struct device *dev) ++{ ++ struct ili8960 *ili8960 = dev_get_drvdata(dev); ++ ++ if (ili8960->enabled) ++ ili8960_programm_power(ili8960->spi, false); ++ ++ return 0; ++} ++ ++static int ili8960_resume(struct device *dev) ++{ ++ struct ili8960 *ili8960 = dev_get_drvdata(dev); ++ ++ if (ili8960->enabled) ++ ili8960_programm_power(ili8960->spi, true); ++ ++ return 0; ++} ++ ++#endif ++ ++static SIMPLE_DEV_PM_OPS(ili8960_pm_ops, ili8960_suspend, ili8960_resume); ++ ++static struct spi_driver ili8960_driver = { ++ .driver = { ++ .name = "ili8960", ++ .pm = &ili8960_pm_ops, ++ }, ++ .probe = ili8960_probe, ++ .remove = ili8960_remove, ++}; ++module_spi_driver(ili8960_driver); ++ ++MODULE_AUTHOR("Lars-Peter Clausen"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("LCD driver for Ilitek ili8960"); ++MODULE_ALIAS("spi:ili8960"); diff --git a/target/linux/xburst/patches-4.4/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch b/target/linux/xburst/patches-4.4/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch new file mode 100644 index 0000000000..9d8a77cc65 --- /dev/null +++ b/target/linux/xburst/patches-4.4/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch @@ -0,0 +1,21 @@ +From 4371d60ae342c76708c4317e06fb7dcf0159c2f1 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Wed, 13 Oct 2010 01:17:24 +0200 +Subject: [PATCH 7/7] qi_lb60: Don't use 3-wire spi mode for the display for + now + +The spi_gpio driver does not support 3-wire mode. +--- + arch/mips/jz4740/board-qi_lb60.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/mips/jz4740/board-qi_lb60.c ++++ b/arch/mips/jz4740/board-qi_lb60.c +@@ -320,7 +320,6 @@ static struct spi_board_info qi_lb60_spi + .chip_select = 0, + .bus_num = 1, + .max_speed_hz = 30 * 1000, +- .mode = SPI_3WIRE, + }, + }; + -- 2.30.2