Merge branch 'master' of git://gitorious.org/linux-on-wince-htc/linux_on_wince_htc
Conflicts: arch/arm/configs/htcleo_defconfig
This commit is contained in:
commit
4bfd3f37c2
78
.gitignore
vendored
Normal file
78
.gitignore
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
#
|
||||
# NOTE! Don't add files that are generated in specific
|
||||
# subdirectories here. Add them in the ".gitignore" file
|
||||
# in that subdirectory instead.
|
||||
#
|
||||
# NOTE! Please use 'git ls-files -i --exclude-standard'
|
||||
# command after changing this file, to see if there are
|
||||
# any tracked files which get ignored after the change.
|
||||
#
|
||||
# Normal rules
|
||||
#
|
||||
.*
|
||||
*.o
|
||||
*.o.*
|
||||
*.a
|
||||
*.s
|
||||
*.ko
|
||||
*.so
|
||||
*.so.dbg
|
||||
*.mod.c
|
||||
*.i
|
||||
*.lst
|
||||
*.symtypes
|
||||
*.order
|
||||
*.elf
|
||||
*.bin
|
||||
*.gz
|
||||
*.bz2
|
||||
*.lzma
|
||||
*.patch
|
||||
*.gcno
|
||||
|
||||
#
|
||||
# Top-level generic files
|
||||
#
|
||||
tags
|
||||
TAGS
|
||||
vmlinux
|
||||
System.map
|
||||
Module.markers
|
||||
Module.symvers
|
||||
!.gitignore
|
||||
!.mailmap
|
||||
|
||||
#
|
||||
# Generated include files
|
||||
#
|
||||
include/asm
|
||||
include/asm-*/asm-offsets.h
|
||||
include/asm-arm/mach-types.h
|
||||
include/config
|
||||
include/linux/autoconf.h
|
||||
include/linux/compile.h
|
||||
include/linux/version.h
|
||||
include/linux/utsrelease.h
|
||||
include/linux/bounds.h
|
||||
include/generated
|
||||
|
||||
# stgit generated dirs
|
||||
patches-*
|
||||
|
||||
# quilt's files
|
||||
patches
|
||||
series
|
||||
|
||||
# cscope files
|
||||
cscope.*
|
||||
ncscope.*
|
||||
|
||||
# gnu global files
|
||||
GPATH
|
||||
GRTAGS
|
||||
GSYMS
|
||||
GTAGS
|
||||
|
||||
*.orig
|
||||
*~
|
||||
\#*#
|
2
Makefile
2
Makefile
@ -523,7 +523,7 @@ endif # $(dot-config)
|
||||
all: vmlinux
|
||||
|
||||
#ifdef CONFIG_MACH_HTCLEO
|
||||
KBUILD_CFLAGS += -mcpu=cortex-a8 -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3
|
||||
KBUILD_CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3
|
||||
#endif
|
||||
|
||||
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||
|
1932
arch/arm/configs/htcleo-gnu_defconfig
Normal file
1932
arch/arm/configs/htcleo-gnu_defconfig
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.32.15
|
||||
# Mon Sep 27 15:22:40 2010
|
||||
# Thu Oct 7 21:47:02 2010
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||
@ -315,6 +315,10 @@ CONFIG_HTCLEO_NO_UNDERVOLT=y
|
||||
# CONFIG_HTC_FB_CONSOLE is not set
|
||||
CONFIG_VERY_EARLY_CONSOLE=y
|
||||
CONFIG_HTCLEO_ENABLE_MULTI_TOUCH=y
|
||||
CONFIG_HTCLEO_KEYMAP_ANDROID=y
|
||||
# CONFIG_HTCLEO_KEYMAP_DPAD is not set
|
||||
CONFIG_HTCLEO_BACKLIGHT_LED=y
|
||||
# CONFIG_HTCLEO_BACKLIGHT is not set
|
||||
|
||||
#
|
||||
# Processor Type
|
||||
@ -808,7 +812,6 @@ CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_CHAR=y
|
||||
CONFIG_MTD_BLKDEVS=y
|
||||
CONFIG_MTD_BLOCK=y
|
||||
CONFIG_MTD_BLOCK_RO=y
|
||||
# CONFIG_FTL is not set
|
||||
# CONFIG_NFTL is not set
|
||||
# CONFIG_INFTL is not set
|
||||
@ -911,7 +914,17 @@ CONFIG_HAVE_IDE=y
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
# CONFIG_SCSI_NETLINK is not set
|
||||
# CONFIG_ATA is not set
|
||||
# CONFIG_MD is not set
|
||||
CONFIG_MD=y
|
||||
# CONFIG_BLK_DEV_MD is not set
|
||||
CONFIG_BLK_DEV_DM=y
|
||||
# CONFIG_DM_DEBUG is not set
|
||||
CONFIG_DM_CRYPT=y
|
||||
# CONFIG_DM_SNAPSHOT is not set
|
||||
# CONFIG_DM_MIRROR is not set
|
||||
# CONFIG_DM_ZERO is not set
|
||||
# CONFIG_DM_MULTIPATH is not set
|
||||
# CONFIG_DM_DELAY is not set
|
||||
# CONFIG_DM_UEVENT is not set
|
||||
CONFIG_NETDEVICES=y
|
||||
CONFIG_IFB=y
|
||||
CONFIG_DUMMY=y
|
||||
|
@ -498,7 +498,7 @@ choice
|
||||
bool "DG Timer"
|
||||
help
|
||||
High resolution timer.
|
||||
endchoice
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "Suspend sleep mode"
|
||||
@ -525,7 +525,7 @@ choice
|
||||
|
||||
config MSM7X00A_SLEEP_WAIT_FOR_INTERRUPT
|
||||
bool "Wait for interrupt"
|
||||
endchoice
|
||||
endchoice
|
||||
|
||||
config MSM7X00A_SLEEP_MODE
|
||||
int
|
||||
@ -560,7 +560,7 @@ choice
|
||||
|
||||
config MSM7X00A_IDLE_SLEEP_WAIT_FOR_INTERRUPT
|
||||
bool "Wait for interrupt"
|
||||
endchoice
|
||||
endchoice
|
||||
|
||||
config MSM7X00A_IDLE_SLEEP_MODE
|
||||
int
|
||||
@ -861,7 +861,7 @@ config WIFI_CONTROL_FUNC
|
||||
bool "Enable WiFi control function abstraction"
|
||||
help
|
||||
Enables Power/Reset/Carddetect function abstraction
|
||||
|
||||
|
||||
config WIFI_MEM_PREALLOC
|
||||
depends on WIFI_CONTROL_FUNC
|
||||
bool "Preallocate memory for WiFi buffers"
|
||||
@ -1117,3 +1117,35 @@ config HTCLEO_ENABLE_MULTI_TOUCH
|
||||
depends on MACH_HTCLEO
|
||||
help
|
||||
Add multitouch support for touchscreen
|
||||
|
||||
choice
|
||||
prompt "HTCLEO Keymapping"
|
||||
default HTCLEO_KEYMAP_ANDROID
|
||||
|
||||
config HTCLEO_KEYMAP_ANDROID
|
||||
bool "Keymapping for Android"
|
||||
help
|
||||
Optimized for the default Android GUI
|
||||
|
||||
config HTCLEO_KEYMAP_DPAD
|
||||
bool "Alternative Keymapping"
|
||||
help
|
||||
Useful in GUIs not designed for touch-only use as this enables
|
||||
four direction keys, alt key and enter key. Assumes landscape orientation.
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "HTCLEO Backlight API type"
|
||||
default HTCLEO_BACKLIGHT_LED
|
||||
|
||||
config HTCLEO_BACKLIGHT_LED
|
||||
bool "Backlight control via LED API"
|
||||
help
|
||||
Needed by Google Android
|
||||
|
||||
config HTCLEO_BACKLIGHT
|
||||
select BACKLIGHT_LCD_SUPPORT
|
||||
bool "Standard backlight API"
|
||||
help
|
||||
Works in standard Linux distros. Tested in GNOME.
|
||||
endchoice
|
||||
|
@ -18,7 +18,7 @@ obj-$(CONFIG_ARCH_MSM_SCORPION) += idle-v7.o
|
||||
obj-y += gpio.o generic_gpio.o
|
||||
obj-y += nand_partitions.o
|
||||
obj-y += drv_callback.o
|
||||
obj-$(CONFIG_ARCH_QSD8X50) += pmic.o
|
||||
obj-$(CONFIG_ARCH_QSD8X50) += pmic.o
|
||||
ifndef CONFIG_MACH_HTCLEO
|
||||
obj-$(CONFIG_ARCH_QSD8X50) += htc_wifi_nvs.o htc_bluetooth.o
|
||||
else
|
||||
@ -118,9 +118,11 @@ obj-$(CONFIG_MACH_HTCLEO) += board-htcleo.o board-htcleo-spi.o board-htcleo-pane
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-ts.o board-htcleo-mmc.o ieee754-df.o board-htcleo-power.o
|
||||
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-battery.o board-htcleo-log.o board-htcleo-audio.o board-htcleo-acoustic.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-bt.o board-htcleo-wifi.o board-htcleo-microp.o board-htcleo-bkl.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-rfkill.o board-htcleo-wifi.o board-htcleo-microp.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-proximity.o board-htcleo-leds.o board-htcleo-ls.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += clock-wince.o
|
||||
obj-$(CONFIG_HTCLEO_BACKLIGHT) += board-htcleo-bl.o
|
||||
obj-$(CONFIG_HTCLEO_BACKLIGHT_LED) += board-htcleo-bl-led.o
|
||||
|
||||
# MSM7x30 boards
|
||||
obj-$(CONFIG_ARCH_MSM7X30) += panel-samsungwvga-tl2796a.o panel-samsungwvga-s6e63m0.o panel-sonywvga-s6d16a0x21-7x30.o
|
||||
@ -244,5 +246,3 @@ obj-$(CONFIG_MACH_MAHIMAHI) += board-mahimahi-smb329.o
|
||||
obj-$(CONFIG_MSM_SSBI) += ssbi.o
|
||||
|
||||
obj-$(CONFIG_HTC_FB_CONSOLE) += htc_fb_console.o
|
||||
|
||||
|
||||
|
164
arch/arm/mach-msm/board-htcleo-bl.c
Normal file
164
arch/arm/mach-msm/board-htcleo-bl.c
Normal file
@ -0,0 +1,164 @@
|
||||
/* linux/arch/arm/mach-msm/board-htcleo-bkl.c
|
||||
*
|
||||
* Copyright (c) 2010 Cotulla
|
||||
* Copyright (c) 2010 Denis 'GNUtoo' Carikli
|
||||
* Copyright (c) 2010 Lukas-David Gorris
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/backlight.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <mach/msm_fb.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <mach/atmega_microp.h>
|
||||
|
||||
|
||||
//#define DEBUG_LCM
|
||||
#ifdef DEBUG_LCM
|
||||
#define LCMDBG(fmt, arg...) printk(fmt, ## arg)
|
||||
#else
|
||||
#define LCMDBG(fmt, arg...) {}
|
||||
#endif
|
||||
|
||||
|
||||
#define HTCLEO_MAX_BRIGHTNESS 255
|
||||
|
||||
int htcleo_brightness_onoff_bkl(int enable)
|
||||
{
|
||||
int ret;
|
||||
uint8_t data[1];
|
||||
|
||||
data[0] = enable ? 1 : 0;
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_BL_EN, data, 1);
|
||||
if (ret != 0)
|
||||
pr_err("%s: set failed\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int htcleo_brightness_set_bkl(uint8_t value)
|
||||
{
|
||||
int ret;
|
||||
uint8_t cmd[2], data[2];
|
||||
|
||||
printk("microp_set_bkl(%d)\n", value);
|
||||
|
||||
if (value > 9)
|
||||
{
|
||||
value = 9;
|
||||
}
|
||||
// disable autobrigtness
|
||||
// CotullaTEST: Lsensor test, add 0x100
|
||||
// data[0] = 0;
|
||||
data[0] = 1;
|
||||
data[1] = 0;
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); // 23
|
||||
if (ret != 0)
|
||||
pr_err("%s: set auto light sensor fail\n", __func__);
|
||||
|
||||
// setvalue
|
||||
cmd[0] = value << 4;
|
||||
// printk("22LEVEL %02X\n", cmd[0]);
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_LCM_BL_MANU_CTL, cmd, 1); // 22
|
||||
if (ret < 0)
|
||||
{
|
||||
pr_err("%s: request adc fail\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct led_trigger *htcleo_lcd_backlight;
|
||||
|
||||
|
||||
int htcleo_brightness_set(struct backlight_device *bd)
|
||||
{
|
||||
int intensity;
|
||||
intensity = bd->props.brightness;
|
||||
|
||||
// set brigtness level via MicroP
|
||||
LCMDBG("htcleo_brightness_set: %d\n", intensity);
|
||||
if (intensity > 255) intensity = 255;
|
||||
if (intensity < 30)
|
||||
{
|
||||
htcleo_brightness_onoff_bkl(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
htcleo_brightness_onoff_bkl(1);
|
||||
htcleo_brightness_set_bkl((intensity - 30) / 23);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int htcleo_brightness_get(struct backlight_device *bd)
|
||||
{
|
||||
return bd->props.brightness;
|
||||
}
|
||||
|
||||
static struct backlight_ops htcleo_backlight_ops =
|
||||
{
|
||||
.options = BL_CORE_SUSPENDRESUME,
|
||||
.update_status = htcleo_brightness_set,
|
||||
.get_brightness = htcleo_brightness_get,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static int htcleo_backlight_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct backlight_device *bd;
|
||||
bd = backlight_device_register("htcleo-backlight", &pdev->dev, NULL, &htcleo_backlight_ops);
|
||||
bd->props.max_brightness = HTCLEO_MAX_BRIGHTNESS;
|
||||
bd->props.brightness = HTCLEO_MAX_BRIGHTNESS;
|
||||
htcleo_brightness_set(bd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int htcleo_backlight_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct backlight_device *bl = platform_get_drvdata(pdev);
|
||||
backlight_device_unregister(bl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct platform_driver htcleo_backlight_driver =
|
||||
{
|
||||
.probe = htcleo_backlight_probe,
|
||||
.remove = htcleo_backlight_remove,
|
||||
.driver =
|
||||
{
|
||||
.name = "htcleo-backlight",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static int __init htcleo_backlight_init(void)
|
||||
{
|
||||
return platform_driver_register(&htcleo_backlight_driver);
|
||||
}
|
||||
|
||||
module_init(htcleo_backlight_init);
|
||||
|
||||
// END OF FILE
|
@ -36,13 +36,13 @@ struct led_data {
|
||||
} keypad_led_data;
|
||||
|
||||
|
||||
static unsigned int htcleo_col_gpios[] = {
|
||||
static unsigned int htcleo_col_gpios[] = {
|
||||
HTCLEO_GPIO_KP_MKOUT0,
|
||||
HTCLEO_GPIO_KP_MKOUT1,
|
||||
HTCLEO_GPIO_KP_MKOUT2
|
||||
};
|
||||
|
||||
static unsigned int htcleo_row_gpios[] = {
|
||||
static unsigned int htcleo_row_gpios[] = {
|
||||
HTCLEO_GPIO_KP_MPIN0,
|
||||
HTCLEO_GPIO_KP_MPIN1,
|
||||
HTCLEO_GPIO_KP_MPIN2
|
||||
@ -54,13 +54,24 @@ static unsigned int htcleo_row_gpios[] = {
|
||||
|
||||
/* keypad */
|
||||
static const unsigned short htcleo_keymap[KEYMAP_SIZE] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_VOLUMEDOWN,
|
||||
#if defined(CONFIG_HTCLEO_KEYMAP_DPAD)
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_LEFT, // Volume Up
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_RIGHT, // Volume Down
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_DOWN, // Windows Button
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_ENTER, // Dial Button
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_END, // Hangup Button
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_UP, // Back Button
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_LEFTALT, // Home Button
|
||||
#endif
|
||||
#if defined(CONFIG_HTCLEO_KEYMAP_ANDROID)
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_VOLUMEUP, // Volume Up
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_VOLUMEDOWN, // Volume Down
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_MENU, // Windows Button
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND, // Green Button
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_END, // Red Button
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND, // Dial Button
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_END, // Hangup Button
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_BACK, // Back Button
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, // Home Button
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_event_matrix_info htcleo_keypad_matrix_info = {
|
||||
|
@ -953,7 +953,12 @@ int __init htcleo_init_panel(void)
|
||||
}
|
||||
|
||||
detect_panel_type();
|
||||
|
||||
|
||||
gpio_set_value(HTCLEO_GPIO_LCM_RESET, 0);
|
||||
LCM_DELAY(2);
|
||||
vreg_disable(vreg_lcd);
|
||||
gpio_set_value(HTCLEO_GPIO_LCM_POWER, 0);
|
||||
|
||||
ret = platform_device_register(&msm_device_mdp);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
357
arch/arm/mach-msm/board-htcleo-rfkill.c
Normal file
357
arch/arm/mach-msm/board-htcleo-rfkill.c
Normal file
@ -0,0 +1,357 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Google, Inc.
|
||||
* Copyright (C) 2009 HTC Corporation.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Control bluetooth power for htcleo platform */
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "gpio_chip.h"
|
||||
#include "proc_comm.h"
|
||||
#include "board-htcleo.h"
|
||||
|
||||
#define HTC_RFKILL_DBG
|
||||
|
||||
static struct rfkill *bt_rfk;
|
||||
static const char bt_name[] = "bcm4329";
|
||||
static int pre_state;
|
||||
|
||||
static uint32_t htcleo_bt_init_table[] = {
|
||||
/* BT_RTS */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RTS,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
/* BT_CTS */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_CTS,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_RX */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RX,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_TX */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_TX,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
|
||||
/* BT_SHUTDOWN_N */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_SHUTDOWN_N,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
/* BT_RESET_N */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_RESET_N,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
|
||||
/* BT_HOST_WAKE */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_HOST_WAKE,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_4MA),
|
||||
/* BT_CHIP_WAKE */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
};
|
||||
|
||||
static uint32_t htcleo_bt_on_table[] = {
|
||||
/* BT_RTS */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RTS,
|
||||
2,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_CTS */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_CTS,
|
||||
2,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_RX */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RX,
|
||||
2,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_TX */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_TX,
|
||||
2,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
|
||||
/* BT_HOST_WAKE */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_HOST_WAKE,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
/* BT_CHIP_WAKE */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
};
|
||||
|
||||
static uint32_t htcleo_bt_off_table[] = {
|
||||
/* BT_RTS */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RTS,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
/* BT_CTS */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_CTS,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_RX */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RX,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_8MA),
|
||||
/* BT_TX */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_TX,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_8MA),
|
||||
|
||||
/* BT_HOST_WAKE */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_HOST_WAKE,
|
||||
0,
|
||||
GPIO_INPUT,
|
||||
GPIO_PULL_UP,
|
||||
GPIO_4MA),
|
||||
/* BT_CHIP_WAKE */
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
0,
|
||||
GPIO_OUTPUT,
|
||||
GPIO_NO_PULL,
|
||||
GPIO_4MA),
|
||||
};
|
||||
|
||||
static void config_bt_table(uint32_t *table, int len)
|
||||
{
|
||||
int n;
|
||||
unsigned id;
|
||||
for (n = 0; n < len; n++) {
|
||||
id = table[n];
|
||||
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void htcleo_config_bt_init(void)
|
||||
{
|
||||
/* set bt initial configuration*/
|
||||
config_bt_table(htcleo_bt_init_table,
|
||||
ARRAY_SIZE(htcleo_bt_init_table));
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
mdelay(5);
|
||||
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
mdelay(15);
|
||||
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
/* BT_RTS */
|
||||
gpio_configure(HTCLEO_GPIO_BT_UART1_RTS,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_TX */
|
||||
gpio_configure(HTCLEO_GPIO_BT_UART1_TX,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
/* BT_CHIP_WAKE */
|
||||
gpio_configure(HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
}
|
||||
|
||||
static void htcleo_config_bt_on(void)
|
||||
{
|
||||
|
||||
#ifdef HTC_RFKILL_DBG
|
||||
printk(KERN_INFO "-- RK ON --\n");
|
||||
#endif
|
||||
|
||||
/* set bt on configuration*/
|
||||
config_bt_table(htcleo_bt_on_table,
|
||||
ARRAY_SIZE(htcleo_bt_on_table));
|
||||
mdelay(5);
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
mdelay(5);
|
||||
|
||||
/* BT_CHIP_WAKE */
|
||||
gpio_configure(HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
|
||||
}
|
||||
|
||||
static void htcleo_config_bt_off(void)
|
||||
{
|
||||
#ifdef HTC_RFKILL_DBG
|
||||
printk(KERN_INFO "-- RK OFF --\n");
|
||||
#endif
|
||||
|
||||
/* BT_RESET_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_RESET_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_SHUTDOWN_N */
|
||||
gpio_configure(HTCLEO_GPIO_BT_SHUTDOWN_N,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
config_bt_table(htcleo_bt_off_table,
|
||||
ARRAY_SIZE(htcleo_bt_off_table));
|
||||
mdelay(5);
|
||||
|
||||
/* BT_RTS */
|
||||
gpio_configure(HTCLEO_GPIO_BT_UART1_RTS,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
/* BT_TX */
|
||||
gpio_configure(HTCLEO_GPIO_BT_UART1_TX,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
|
||||
/* BT_CHIP_WAKE */
|
||||
gpio_configure(HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
|
||||
}
|
||||
|
||||
static int bluetooth_set_power(void *data, bool blocked)
|
||||
{
|
||||
if (pre_state == blocked) {
|
||||
#ifdef HTC_RFKILL_DBG
|
||||
printk(KERN_INFO "-- SAME ST --\n");
|
||||
#endif
|
||||
return 0;
|
||||
} else
|
||||
pre_state = blocked;
|
||||
|
||||
if (!blocked)
|
||||
htcleo_config_bt_on();
|
||||
else
|
||||
htcleo_config_bt_off();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rfkill_ops htcleo_rfkill_ops = {
|
||||
.set_block = bluetooth_set_power,
|
||||
};
|
||||
|
||||
static int htcleo_rfkill_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc = 0;
|
||||
bool default_state = true; /* off */
|
||||
|
||||
htcleo_config_bt_init(); /* bt gpio initial config */
|
||||
|
||||
bluetooth_set_power(NULL, default_state);
|
||||
|
||||
bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
|
||||
&htcleo_rfkill_ops, NULL);
|
||||
if (!bt_rfk) {
|
||||
rc = -ENOMEM;
|
||||
goto err_rfkill_reset;
|
||||
}
|
||||
|
||||
rfkill_set_states(bt_rfk, default_state, false);
|
||||
|
||||
/* userspace cannot take exclusive control */
|
||||
rc = rfkill_register(bt_rfk);
|
||||
if (rc)
|
||||
goto err_rfkill_reg;
|
||||
|
||||
return 0;
|
||||
|
||||
err_rfkill_reg:
|
||||
rfkill_destroy(bt_rfk);
|
||||
err_rfkill_reset:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int htcleo_rfkill_remove(struct platform_device *dev)
|
||||
{
|
||||
rfkill_unregister(bt_rfk);
|
||||
rfkill_destroy(bt_rfk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver htcleo_rfkill_driver = {
|
||||
.probe = htcleo_rfkill_probe,
|
||||
.remove = htcleo_rfkill_remove,
|
||||
.driver = {
|
||||
.name = "htcleo_rfkill",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init htcleo_rfkill_init(void)
|
||||
{
|
||||
pre_state = -1;
|
||||
if (!machine_is_htcleo())
|
||||
return 0;
|
||||
|
||||
return platform_driver_register(&htcleo_rfkill_driver);
|
||||
}
|
||||
|
||||
static void __exit htcleo_rfkill_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&htcleo_rfkill_driver);
|
||||
}
|
||||
|
||||
module_init(htcleo_rfkill_init);
|
||||
module_exit(htcleo_rfkill_exit);
|
||||
MODULE_DESCRIPTION("htcleo rfkill");
|
||||
MODULE_AUTHOR("Nick Pelly <npelly@google.com>");
|
||||
MODULE_LICENSE("GPL");
|
@ -333,6 +333,14 @@ unsigned htcleo_get_vbus_state(void)
|
||||
|
||||
#endif
|
||||
|
||||
static struct platform_device htcleo_rfkill = {
|
||||
.name = "htcleo_rfkill",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Flashlight
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@ -476,61 +484,6 @@ static struct platform_device msm_camera_sensor_s5k3e2fx =
|
||||
},
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// bluetooth
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
static char bdaddress[20];
|
||||
static void bt_export_bd_address(void)
|
||||
{
|
||||
unsigned char cTemp[6];
|
||||
|
||||
memcpy(cTemp, get_bt_bd_ram(), 6);
|
||||
sprintf(bdaddress, "%02x:%02x:%02x:%02x:%02x:%02x", cTemp[0], cTemp[1], cTemp[2], cTemp[3], cTemp[4], cTemp[5]);
|
||||
pr_info("BD_ADDRESS=%s\n", bdaddress);
|
||||
}
|
||||
|
||||
module_param_string(bdaddress, bdaddress, sizeof(bdaddress), S_IWUSR | S_IRUGO);
|
||||
MODULE_PARM_DESC(bdaddress, "BT MAC ADDRESS");
|
||||
|
||||
static uint32_t bt_gpio_table[] =
|
||||
{
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RTS, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_CTS, 2, GPIO_INPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RX, 2, GPIO_INPUT, GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_TX, 2, GPIO_OUTPUT,GPIO_PULL_UP, GPIO_8MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_RESET_N, 0, GPIO_OUTPUT,GPIO_PULL_DOWN, GPIO_4MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_SHUTDOWN_N, 0, GPIO_OUTPUT,GPIO_PULL_DOWN, GPIO_4MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_CHIP_WAKE, 0, GPIO_OUTPUT,GPIO_PULL_DOWN, GPIO_4MA),
|
||||
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_HOST_WAKE, 0, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_4MA),
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
static struct msm_serial_hs_platform_data msm_uart_dm1_pdata =
|
||||
{
|
||||
/* Chip to Device */
|
||||
.rx_wakeup_irq = MSM_GPIO_TO_INT(HTCLEO_GPIO_BT_HOST_WAKE),
|
||||
.inject_rx_on_wakeup = 0,
|
||||
.cpu_lock_supported = 0,
|
||||
|
||||
/* for bcm */
|
||||
.bt_wakeup_pin_supported = 1,
|
||||
.bt_wakeup_pin = HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
.host_wakeup_pin = HTCLEO_GPIO_BT_HOST_WAKE,
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
static void __init htcleo_bt_init(void)
|
||||
{
|
||||
config_gpio_table(bt_gpio_table, ARRAY_SIZE(bt_gpio_table));
|
||||
}
|
||||
|
||||
|
||||
static struct platform_device htcleo_rfkill =
|
||||
{
|
||||
.name = "htcleo_rfkill",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// KGSL (HW3D support)#include <linux/android_pmem.h>
|
||||
@ -693,6 +646,9 @@ static struct platform_device *devices[] __initdata =
|
||||
&htc_headset_mgr,
|
||||
&htc_headset_gpio,
|
||||
};
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Vibrator
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@ -811,14 +767,29 @@ static void __init htcleo_init(void)
|
||||
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
|
||||
msm_device_uart_dm1.name = "msm_serial_hs_bcm"; /* for bcm */
|
||||
msm_device_uart_dm1.resource[3].end = 6;
|
||||
static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
|
||||
.rx_wakeup_irq = MSM_GPIO_TO_INT(HTCLEO_GPIO_BT_HOST_WAKE), /*Chip to Device*/
|
||||
.inject_rx_on_wakeup = 0,
|
||||
.cpu_lock_supported = 0,
|
||||
|
||||
/* for bcm */
|
||||
.bt_wakeup_pin_supported = 1,
|
||||
.bt_wakeup_pin = HTCLEO_GPIO_BT_CHIP_WAKE,
|
||||
.host_wakeup_pin = HTCLEO_GPIO_BT_HOST_WAKE,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
|
||||
msm_device_uart_dm1.name = "msm_serial_hs_bcm"; /* for bcm */
|
||||
msm_device_uart_dm1.resource[3].end = 6;
|
||||
#endif
|
||||
|
||||
i2c_register_board_info(0, base_i2c_devices, ARRAY_SIZE(base_i2c_devices));
|
||||
|
||||
|
||||
#ifdef CONFIG_USB_ANDROID
|
||||
htcleo_add_usb_devices();
|
||||
#endif
|
||||
@ -826,8 +797,6 @@ static void __init htcleo_init(void)
|
||||
htcleo_init_mmc(0);
|
||||
platform_device_register(&htcleo_timed_gpios);
|
||||
|
||||
bt_export_bd_address();
|
||||
htcleo_bt_init();
|
||||
htcleo_audio_init();
|
||||
|
||||
#ifdef CONFIG_USB_ANDROID
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <mach/msm_smd.h>
|
||||
#include <mach/amss_para.h>
|
||||
#include "board-htcleo.h"
|
||||
|
||||
#define MAX_SMD_TTYS 32
|
||||
|
||||
@ -200,9 +199,6 @@ static int smd_tty_write(struct tty_struct *tty,
|
||||
struct smd_tty_info *info = tty->driver_data;
|
||||
int avail;
|
||||
int ret;
|
||||
static int init=0;
|
||||
const unsigned char* firstcall="AT@BRIC=0\r";
|
||||
unsigned int firstcall_len;
|
||||
|
||||
/* if we're writing to a packet channel we will
|
||||
** never be able to write more data than there
|
||||
@ -211,17 +207,6 @@ static int smd_tty_write(struct tty_struct *tty,
|
||||
#ifndef CONFIG_MACH_HTCLEO
|
||||
mutex_lock(&smd_tty_lock);
|
||||
#endif
|
||||
if(len>7 && !init && htcleo_is_nand_boot()) {
|
||||
if(strncmp(buf, "AT+CFUN", 7)==0) {
|
||||
pr_info("SMD AT FIX!\n");
|
||||
firstcall_len = strlen(firstcall);
|
||||
avail = smd_write_avail(info->ch);
|
||||
if (firstcall_len > avail)
|
||||
firstcall_len = avail;
|
||||
ret = smd_write(info->ch, firstcall, firstcall_len);
|
||||
init=1;
|
||||
}
|
||||
}
|
||||
avail = smd_write_avail(info->ch);
|
||||
if (len > avail)
|
||||
len = avail;
|
||||
|
@ -162,7 +162,7 @@ static struct nand_ecclayout msm_nand_oob_64 =
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 10, 11, 12, 13, // 14, 15, // ecc, oob, bbf (inaccessible)
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 26, 27, 28, 29, // 30, 31, // ecc, oob, bbf (inaccessible)
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, // 42, 43, 44, 45, // 46, 47, // ecc, oob, bbf (inaccessible)
|
||||
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 56, 57, 58, 59, // 60, 61, // ecc, oob, bbf (inaccessible)
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, // 58, 59, 60, 61, // 62, 63, // ecc, oob, bbf (inaccessible)
|
||||
},
|
||||
.oobavail = 16,
|
||||
.oobfree =
|
||||
@ -170,10 +170,12 @@ static struct nand_ecclayout msm_nand_oob_64 =
|
||||
{10, 4},
|
||||
{26, 4},
|
||||
{42, 4},
|
||||
{56, 4},
|
||||
{58, 4},
|
||||
}
|
||||
};
|
||||
|
||||
#define NUM_PROTECTED_BLOCKS (0x212)
|
||||
|
||||
struct flash_identification {
|
||||
uint32_t flash_id;
|
||||
uint32_t mask;
|
||||
@ -564,8 +566,8 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
else if (ops->mode == MTD_OOB_PLACE)
|
||||
oobType = "MTD_OOB_PLACE";
|
||||
|
||||
printk("msm_nand_read_oob [%d %08X] %08X %08X %d %s\n",
|
||||
(uint32_t)(from - 0x42c0000) / 0x800, (uint32_t)ops->len, (uint32_t)ops->datbuf,
|
||||
printk("msm_nand_read_oob [%08X %08X] %08X %08X %d %s\n",
|
||||
(uint32_t)(from), (uint32_t)ops->len, (uint32_t)ops->datbuf,
|
||||
(uint32_t)ops->oobbuf, oob_count, readoob?oobType:"OOB_NONE");
|
||||
#endif
|
||||
|
||||
@ -1033,7 +1035,7 @@ msm_nand_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
|
||||
unsigned page = 0;
|
||||
uint32_t cwdatasize;
|
||||
uint32_t cwoobsize;
|
||||
int err;
|
||||
int err=0;
|
||||
dma_addr_t data_dma_addr = 0;
|
||||
dma_addr_t oob_dma_addr = 0;
|
||||
dma_addr_t data_dma_addr_curr = 0;
|
||||
@ -1074,6 +1076,12 @@ msm_nand_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
|
||||
pr_err("%s: unsupported to, 0x%llx\n", __func__, to);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (to < (NUM_PROTECTED_BLOCKS*mtd->erasesize))
|
||||
{
|
||||
pr_err("%s: cannot write to page in protected area, to=0x%llx\n",
|
||||
__func__, to);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ops->datbuf != NULL && (ops->len % mtd->writesize) != 0)
|
||||
{
|
||||
/* when ops->datbuf is NULL, ops->len may refer to ooblen */
|
||||
@ -1110,8 +1118,8 @@ msm_nand_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
|
||||
else if (ops->mode == MTD_OOB_AUTO)
|
||||
oobType = "MTD_OOB_AUTO";
|
||||
|
||||
printk("msm_nand_write_oob [%d %08X] %08X %08X %d %s\n",
|
||||
(uint32_t)(to - 0x42c0000) / 0x800, writedata?(uint32_t)ops->len:0, (uint32_t)ops->datbuf,
|
||||
printk("msm_nand_write_oob [%08X %08X] %08X %08X %d %s\n",
|
||||
(uint32_t)(to), writedata?(uint32_t)ops->len:0, (uint32_t)ops->datbuf,
|
||||
(uint32_t)ops->oobbuf, oob_count, writeoob?oobType:"OOB_NONE");
|
||||
#endif
|
||||
|
||||
@ -1207,27 +1215,6 @@ msm_nand_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
|
||||
|
||||
while (page_count-- > 0)
|
||||
{
|
||||
//dont write pages from userland that are empty
|
||||
if (writedata && !writeoob)
|
||||
{
|
||||
unsigned skippage=1;
|
||||
uint8_t *datbuf = ops->datbuf + pages_written * mtd->writesize;
|
||||
for(n=0;n<mtd->writesize;n++)
|
||||
{
|
||||
if (datbuf[n] != 0xFF)
|
||||
{
|
||||
skippage=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skippage)
|
||||
{
|
||||
pages_written++;
|
||||
page++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
page_oob_done=0;
|
||||
|
||||
cmd = dma_buffer->cmd;
|
||||
@ -1535,13 +1522,21 @@ msm_nand_erase(struct mtd_info *mtd, struct erase_info *instr)
|
||||
if (mtd->writesize == 4096)
|
||||
page = instr->addr >> 12;
|
||||
|
||||
printk("nand_erase(%d)\n", page);
|
||||
#ifdef ENABLE_ENTRY_TRACE
|
||||
printk("+msm_nand_erase(%d)\n", page);
|
||||
#endif
|
||||
|
||||
if (instr->addr & (mtd->erasesize - 1)) {
|
||||
pr_err("%s: unsupported erase address, 0x%llx\n",
|
||||
__func__, instr->addr);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (instr->addr < (NUM_PROTECTED_BLOCKS*mtd->erasesize))
|
||||
{
|
||||
pr_err("%s: cannot erase block in protected area, addr=0x%llx\n",
|
||||
__func__, instr->addr);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (instr->len != mtd->erasesize) {
|
||||
pr_err("%s: unsupported erase len, %lld\n",
|
||||
__func__, instr->len);
|
||||
@ -1672,6 +1667,11 @@ msm_nand_block_isbad(struct mtd_info *mtd, loff_t ofs)
|
||||
pr_err("%s: unsupported block address, 0x%x\n", __func__, (uint32_t)ofs);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ofs < (NUM_PROTECTED_BLOCKS*mtd->erasesize))
|
||||
{
|
||||
//protected blocks are always good
|
||||
return 0;
|
||||
}
|
||||
|
||||
wait_event(chip->wait_queue,
|
||||
(dma_buffer = msm_nand_get_dma_buffer(chip ,
|
||||
@ -1746,7 +1746,19 @@ msm_nand_block_isbad(struct mtd_info *mtd, loff_t ofs)
|
||||
|
||||
ret = 0;
|
||||
if (dma_buffer->data.result.flash_status & 0x110)
|
||||
{
|
||||
#if VERBOSE
|
||||
if (dma_buffer->data.result.flash_status & 0x100)
|
||||
{
|
||||
pr_err("msm_block_isbad off=%d protection violation\n",(uint32_t)ofs);
|
||||
}
|
||||
if (dma_buffer->data.result.flash_status & 0x10)
|
||||
{
|
||||
pr_err("msm_block_isbad off=%d wrfail\n",(uint32_t)ofs);
|
||||
}
|
||||
#endif
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
@ -1756,13 +1768,16 @@ msm_nand_block_isbad(struct mtd_info *mtd, loff_t ofs)
|
||||
if (buf[0] != 0xFF || buf[1] != 0xFF)
|
||||
{
|
||||
ret = 1;
|
||||
printk("###BAD BLOCK [%08X] %08X###\n", (uint32_t)(ofs - 0x42c0000) / 0x800, (uint32_t)ofs);
|
||||
printk("###BAD BLOCK %d %08X###\n", (uint32_t)(ofs) / mtd->erasesize, (uint32_t)ofs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buf[0] != 0xFF)
|
||||
{
|
||||
ret = 1;
|
||||
printk("###BAD BLOCK %d %08X###\n", (uint32_t)(ofs) / mtd->erasesize, (uint32_t)ofs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2016,6 +2031,26 @@ int msm_nand_scan(struct mtd_info *mtd, int maxchips)
|
||||
/* msm_nand_unlock_all(mtd); */
|
||||
|
||||
/* return this->scan_bbt(mtd); */
|
||||
|
||||
#if VERBOSE
|
||||
for (i=0;i<nand_info->block_count;i++)
|
||||
{
|
||||
int blockretval = msm_nand_block_isbad(mtd,i*mtd->erasesize);
|
||||
if(blockretval == 1)
|
||||
{
|
||||
pr_info("msm_nand block %d is bad\n",i);
|
||||
}
|
||||
else if (blockretval == -EINVAL)
|
||||
{
|
||||
pr_info("msm_nand block %d -EINVAL\n",i);
|
||||
}
|
||||
else if (blockretval == -EIO)
|
||||
{
|
||||
pr_info("msm_nand block %d -EIO\n",i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(msm_nand_scan);
|
||||
|
Loading…
x
Reference in New Issue
Block a user