From f494635faf4fa39138d4775879f09101063efb55 Mon Sep 17 00:00:00 2001 From: Juan64Bits Date: Fri, 12 Mar 2010 09:59:15 -0500 Subject: [PATCH] Update SAKC kernel. --- .../mips/include/asm/mach-jz4740/board-sakc.h | 35 +++ .../mips/include/asm/mach-jz4740/jz4740.h | 42 +++ linux-2.6.32.7_sakc/arch/mips/jz4740/Kconfig | 40 +++ linux-2.6.32.7_sakc/arch/mips/jz4740/Makefile | 21 ++ .../arch/mips/jz4740/board-sakc.c | 245 ++++++++++++++++++ linux-2.6.32.7_sakc/sound/soc/jz4740/Kconfig | 29 +++ 6 files changed, 412 insertions(+) create mode 100644 linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/board-sakc.h create mode 100644 linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/jz4740.h create mode 100644 linux-2.6.32.7_sakc/arch/mips/jz4740/Kconfig create mode 100644 linux-2.6.32.7_sakc/arch/mips/jz4740/Makefile create mode 100644 linux-2.6.32.7_sakc/arch/mips/jz4740/board-sakc.c create mode 100644 linux-2.6.32.7_sakc/sound/soc/jz4740/Kconfig diff --git a/linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/board-sakc.h b/linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/board-sakc.h new file mode 100644 index 0000000..511f069 --- /dev/null +++ b/linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/board-sakc.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2009 Qi Hardware Inc., + * Author: Xiangfu Liu + * + * 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 3 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, see . + */ + +#ifndef __ASM_JZ4725_SAKC_H__ +#define __ASM_JZ4725_SAKC_H__ + +#include +/* + * Frequencies of on-board oscillators + */ +#define JZ_EXTAL 12000000 /* Main extal freq: 12 MHz */ +#define JZ_EXTAL_RTC 32768 /* RTC extal freq: 32.768 KHz */ + +/* + * GPIO + */ + +#define GPIO_SD_CD_N JZ_GPIO_PORTC(27) + +#endif /* __ASM_JZ4725_SAKC_H__ */ diff --git a/linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/jz4740.h b/linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/jz4740.h new file mode 100644 index 0000000..9570c0a --- /dev/null +++ b/linux-2.6.32.7_sakc/arch/mips/include/asm/mach-jz4740/jz4740.h @@ -0,0 +1,42 @@ +/* + * linux/include/asm-mips/mach-jz4740/jz4740.h + * + * JZ4740 common definition. + * + * Copyright (C) 2006 - 2007 Ingenic Semiconductor Inc. + * + * Author: + * + * 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 __ASM_JZ4740_H__ +#define __ASM_JZ4740_H__ + +#include +#include + +/*------------------------------------------------------------------ + * Platform definitions + */ + +#ifdef CONFIG_JZ4740_QI_LB60 +#include +#endif + +#ifdef CONFIG_JZ4725_SAKC +#include +#endif + +/* Add other platform definition here ... */ + + +/*------------------------------------------------------------------ + * Follows are related to platform definitions + */ + +#include + +#endif /* __ASM_JZ4740_H__ */ diff --git a/linux-2.6.32.7_sakc/arch/mips/jz4740/Kconfig b/linux-2.6.32.7_sakc/arch/mips/jz4740/Kconfig new file mode 100644 index 0000000..1e5277c --- /dev/null +++ b/linux-2.6.32.7_sakc/arch/mips/jz4740/Kconfig @@ -0,0 +1,40 @@ +choice + prompt "Machine type" + depends on MACH_JZ + default JZ4740_QI_LB60 + +config JZ4740_QI_LB60 + bool "Qi Hardware Ben NanoNote" + select DMA_NONCOHERENT + select SOC_JZ4740 + +config JZ4725_SAKC + bool "Qi Hardware SAKC FPGA board" + select DMA_NONCOHERENT + select SOC_JZ4740 + +config JZ4740_N526 + bool "Hanvon n526 eBook reader" + select DMA_NONCOHERENT + select SOC_JZ4740 + + +endchoice + +config SOC_JZ4740 + bool + select JZSOC + select GENERIC_GPIO + select ARCH_REQUIRE_GPIOLIB + select SYS_HAS_EARLY_PRINTK + select SYS_SUPPORTS_LITTLE_ENDIAN + select IRQ_CPU + +config JZSOC + bool + select JZRISC + select SYS_HAS_CPU_MIPS32_R1 + select SYS_SUPPORTS_32BIT_KERNEL + +config JZRISC + bool diff --git a/linux-2.6.32.7_sakc/arch/mips/jz4740/Makefile b/linux-2.6.32.7_sakc/arch/mips/jz4740/Makefile new file mode 100644 index 0000000..ca40ee0 --- /dev/null +++ b/linux-2.6.32.7_sakc/arch/mips/jz4740/Makefile @@ -0,0 +1,21 @@ +# +# Makefile for the Ingenic JZ4740. +# + +# Object file lists. + +obj-y += prom.o irq.o time.o reset.o setup.o dma.o \ + gpio.o clock.o platform.o + +obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o + +# board specific support + +obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o +obj-$(CONFIG_JZ4740_N526) += board-n526.o +obj-$(CONFIG_JZ4725_SAKC) += board-sakc.o + +# PM support + +obj-$(CONFIG_PM) +=pm.o + diff --git a/linux-2.6.32.7_sakc/arch/mips/jz4740/board-sakc.c b/linux-2.6.32.7_sakc/arch/mips/jz4740/board-sakc.c new file mode 100644 index 0000000..1fba3d3 --- /dev/null +++ b/linux-2.6.32.7_sakc/arch/mips/jz4740/board-sakc.c @@ -0,0 +1,245 @@ +/* + * linux/arch/mips/jz4740/board-sakc.c + * + * SAKC setup routines, based on QI_LB60 + * + * Copyright (c) 2009 Qi Hardware inc., + * Author: Xiangfu Liu + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 or later + * as published by the Free Software Foundation. + */ + +#include +#include +#include + +#include +#include + +#include +//#include +#include +#include +//#include +#include +#include +#include +//#include +//#include +//#include +#include + + +/* NAND */ +static struct nand_ecclayout sakc_ecclayout_1gb = { + .eccbytes = 36, + .eccpos = { + 6, 7, 8, 9, 10, 11, 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}, + .oobfree = { + {.offset = 2, + .length = 4}, + {.offset = 42, + .length = 22}} +}; + +static struct mtd_partition sakc_partitions_1gb[] = { + { .name = "NAND BOOT partition", + .offset = 0 * 0x100000, + .size = 4 * 0x100000, + }, + { .name = "NAND KERNEL partition", + .offset = 4 * 0x100000, + .size = 4 * 0x100000, + }, + { .name = "NAND ROOTFS partition", + .offset = 8 * 0x100000, + .size = (504 + 512) * 0x100000, + }, +}; + +static struct nand_ecclayout sakc_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 struct mtd_partition sakc_partitions_2gb[] = { + { .name = "NAND BOOT partition", + .offset = 0 * 0x100000, + .size = 4 * 0x100000, + }, + { .name = "NAND KERNEL partition", + .offset = 4 * 0x100000, + .size = 4 * 0x100000, + }, + { .name = "NAND ROOTFS partition", + .offset = 8 * 0x100000, + .size = (504 + 512 + 1024) * 0x100000, + }, +}; + +static void sakc_nand_ident(struct platform_device *pdev, + struct nand_chip *chip, + struct mtd_partition **partitions, + int *num_partitions) +{ + if (chip->page_shift == 12) { + chip->ecc.layout = &sakc_ecclayout_2gb; + *partitions = sakc_partitions_2gb; + *num_partitions = ARRAY_SIZE(sakc_partitions_2gb); + } else { + chip->ecc.layout = &sakc_ecclayout_1gb; + *partitions = sakc_partitions_1gb; + *num_partitions = ARRAY_SIZE(sakc_partitions_1gb); + } +} + +static struct jz_nand_platform_data sakc_nand_pdata = { + .ident_callback = sakc_nand_ident, + .busy_gpio = 94, +}; + + +/* Display */ +static struct fb_videomode sakc_video_modes[] = { + { + .name = "320x240", + .xres = 320, + .yres = 240, + .pixclock = 700000, + .left_margin = 140, + .right_margin = 273, + .upper_margin = 20, + .lower_margin = 2, + .hsync_len = 1, + .vsync_len = 1, + .sync = 0, + .vmode = FB_VMODE_NONINTERLACED, + }, +}; + +static struct jz4740_fb_platform_data sakc_fb_pdata = { + .width = 60, + .height = 45, + .num_modes = ARRAY_SIZE(sakc_video_modes), + .modes = sakc_video_modes, + .bpp = 24, + .lcd_type = JZ_LCD_TYPE_8BIT_SERIAL, +}; + + +struct spi_gpio_platform_data spigpio_platform_data = { + .sck = JZ_GPIO_PORTC(23), + .mosi = JZ_GPIO_PORTC(22), + .miso = JZ_GPIO_PORTC(22), + .num_chipselect = 1, +}; + +static struct platform_device spigpio_device = { + .name = "spi_gpio", + .id = 1, + .dev = { + .platform_data = &spigpio_platform_data, + }, +}; + +static struct spi_board_info sakc_spi_board_info[] = { + { + .modalias = "gpm940b0", + .controller_data = (void*)JZ_GPIO_PORTC(21), + .chip_select = 0, + .bus_num = 1, + .max_speed_hz = 30 * 1000, + }, +}; + +/* MMC */ + +static struct jz4740_mmc_platform_data sakc_mmc_pdata = { + .gpio_card_detect = JZ_GPIO_PORTC(27), + .gpio_read_only = -1, + .gpio_power = -1, + .power_active_low = 1, + .data_1bit = 1, +}; + +static struct platform_device *jz_platform_devices[] __initdata = { + &jz4740_usb_ohci_device, + &jz4740_usb_gdt_device, + &jz4740_mmc_device, + &jz4740_nand_device, + &spigpio_device, + &jz4740_framebuffer_device, + &jz4740_i2s_device, + &jz4740_codec_device, + &jz4740_rtc_device, + &jz4740_adc_device, +}; + +static void __init board_gpio_setup(void) +{ + /* We only need to enable/disable pullup here for pins used in generic + * drivers. Everything else is done by the drivers themselfs. */ + jz_gpio_disable_pullup(GPIO_SD_CD_N); +} + +static int __init sakc_init_platform_devices(void) +{ + jz4740_framebuffer_device.dev.platform_data = &sakc_fb_pdata; + jz4740_nand_device.dev.platform_data = &sakc_nand_pdata; + jz4740_mmc_device.dev.platform_data = &sakc_mmc_pdata; + + spi_register_board_info(sakc_spi_board_info, + ARRAY_SIZE(sakc_spi_board_info)); + + return platform_add_devices(jz_platform_devices, + ARRAY_SIZE(jz_platform_devices)); + +} +extern int jz_gpiolib_init(void); +extern int jz_init_clocks(unsigned long extal); + +static __init int board_sakc(char *str) +{ + sakc_mmc_pdata.card_detect_active_low = 1; + + return 1; +} + +__setup("sakc", board_sakc); + +static int __init sakc_board_setup(void) +{ + printk("Qi Hardware JZ4725 SAKC setup\n"); + if (jz_gpiolib_init()) + panic("Failed to initalize jz gpio\n"); + jz_init_clocks(12000000); + + board_gpio_setup(); + + if (sakc_init_platform_devices()) + panic("Failed to initalize platform devices\n"); + + return 0; +} + +arch_initcall(sakc_board_setup); diff --git a/linux-2.6.32.7_sakc/sound/soc/jz4740/Kconfig b/linux-2.6.32.7_sakc/sound/soc/jz4740/Kconfig new file mode 100644 index 0000000..b19fd8f --- /dev/null +++ b/linux-2.6.32.7_sakc/sound/soc/jz4740/Kconfig @@ -0,0 +1,29 @@ +config SND_JZ4740_SOC + tristate "SoC Audio for Ingenic JZ4740 SoC" + depends on SOC_JZ4740 && SND_SOC + help + Say Y or M if you want to add support for codecs attached to + the Jz4740 AC97, I2S or SSP interface. You will also need + to select the audio interfaces to support below. + +config SND_JZ4740_SOC_QI_LB60 + tristate "SoC Audio support for Qi Hardware Ben Nanonote" + depends on SND_JZ4740_SOC && JZ4740_QI_LB60 + select SND_JZ4740_SOC_I2S + select SND_SOC_JZCODEC + help + Say Y if you want to add support for SoC audio of internal codec on Ingenic Jz4740 QI_LB60 board. + +config SND_JZ4740_SOC_N526 + tristate "SoC Audio support for Hanvon N526 eBook reader" + depends on SND_JZ4740_SOC && JZ4740_N526 + select SND_JZ4740_SOC_I2S + select SND_SOC_JZCODEC + help + Say Y if you want to enable support for SoC audio on the Hanvon N526. + +config SND_JZ4740_SOC_I2S + depends on SND_JZ4740_SOC + tristate "SoC Audio (I2S protocol) for Ingenic jz4740 chip" + help + Say Y if you want to use I2S protocol and I2S codec on Ingenic Jz4740 QI_LB60 board.