htcleo: add reading of mac address directly from nand There is a problem on reading from nand. I had to disable one check. We have to check why.
This commit is contained in:
parent
8c7de5cc0e
commit
82fecbbd2a
@ -747,7 +747,7 @@ CONFIG_BT_HCIUART_H4=y
|
||||
# CONFIG_AF_RXRPC is not set
|
||||
CONFIG_FIB_RULES=y
|
||||
CONFIG_WIRELESS=y
|
||||
# CONFIG_CFG80211 is not set
|
||||
CONFIG_CFG80211=y
|
||||
CONFIG_CFG80211_DEFAULT_PS_VALUE=0
|
||||
CONFIG_WIRELESS_OLD_REGULATORY=y
|
||||
CONFIG_WIRELESS_EXT=y
|
||||
@ -759,7 +759,7 @@ CONFIG_WIRELESS_EXT_SYSFS=y
|
||||
#
|
||||
# CONFIG_WIMAX is not set
|
||||
CONFIG_RFKILL=y
|
||||
# CONFIG_RFKILL_PM is not set
|
||||
CONFIG_RFKILL_PM=y
|
||||
CONFIG_RFKILL_LEDS=y
|
||||
# CONFIG_RFKILL_INPUT is not set
|
||||
# CONFIG_NET_9P is not set
|
||||
@ -839,7 +839,7 @@ CONFIG_MTD_MSM_NAND=y
|
||||
# CONFIG_MTD_SLRAM is not set
|
||||
# CONFIG_MTD_PHRAM is not set
|
||||
# CONFIG_MTD_MTDRAM is not set
|
||||
CONFIG_MTD_BLOCK2MTD=m
|
||||
# CONFIG_MTD_BLOCK2MTD is not set
|
||||
|
||||
#
|
||||
# Disk-On-Chip Device Drivers
|
||||
@ -915,7 +915,7 @@ CONFIG_TUN=m
|
||||
# CONFIG_NETDEV_10000 is not set
|
||||
CONFIG_WLAN=y
|
||||
# CONFIG_WLAN_PRE80211 is not set
|
||||
# CONFIG_WLAN_80211 is not set
|
||||
CONFIG_WLAN_80211=y
|
||||
CONFIG_BCM4329=m
|
||||
CONFIG_BCM4329_SOFTAP=y
|
||||
CONFIG_BCM4329_FW_PATH="/system/etc/firmware/fw_bcm4329.bin"
|
||||
@ -940,7 +940,7 @@ CONFIG_PPPOPNS=y
|
||||
# CONFIG_SLIP is not set
|
||||
CONFIG_SLHC=y
|
||||
# CONFIG_NETCONSOLE is not set
|
||||
CONFIG_MSM_RMNET=y
|
||||
# CONFIG_MSM_RMNET is not set
|
||||
# CONFIG_MSM_RMNET_DEBUG is not set
|
||||
# CONFIG_NETPOLL is not set
|
||||
# CONFIG_NET_POLL_CONTROLLER is not set
|
||||
|
@ -144,12 +144,15 @@ static unsigned int htcleo_sdslot_status(struct device *dev)
|
||||
MMC_VDD_27_28 | MMC_VDD_28_29 | \
|
||||
MMC_VDD_29_30)
|
||||
|
||||
static unsigned int htcleo_sdslot_type = MMC_TYPE_SD;
|
||||
|
||||
static struct mmc_platform_data htcleo_sdslot_data =
|
||||
{
|
||||
.ocr_mask = HTCLEO_MMC_VDD,
|
||||
.status = htcleo_sdslot_status,
|
||||
.register_status_notify = NULL,
|
||||
.translate_vdd = htcleo_sdslot_switchvdd,
|
||||
.slot_type = &htcleo_sdslot_type,
|
||||
};
|
||||
|
||||
static uint32_t wifi_on_gpio_table[] =
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Dmitry Shmidt <dimitrysh@google.com>
|
||||
* Changed for nand read for Leo by Markinus
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
@ -21,12 +22,16 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/blktrans.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
|
||||
#define NVS_MAX_SIZE 0x800U
|
||||
#define NVS_MACADDR_SIZE 0x1AU
|
||||
|
||||
static unsigned char wifi_nvs_ram[NVS_MAX_SIZE];
|
||||
static struct proc_dir_entry *wifi_calibration;
|
||||
static unsigned char *nvs_mac_addr = "macaddr=00:11:22:33:44:55\n";
|
||||
static unsigned char *hardcoded_nvs =
|
||||
"macaddr=00:11:22:33:44:55\n"\
|
||||
"sromrev=3\n"\
|
||||
"vendid=0x14e4\n"\
|
||||
"devid=0x432f\n"\
|
||||
@ -61,31 +66,117 @@ static unsigned char *hardcoded_nvs =
|
||||
"RAW1=80 32 fe 21 02 0c 00 22 2a 01 01 00 00 c5 0 e6 00 00 00 00 00 40 00 00 ff ff 80 00 00 00 00 00 00 00 00 00 00 c8 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 20 04 D0 2 29 43 21 02 0c 00 22 04 00 20 00 5A\n"\
|
||||
"sd_gpout=0\n"\
|
||||
"sd_oobonly=1\n";
|
||||
|
||||
|
||||
#include <asm/setup.h>
|
||||
|
||||
static struct proc_dir_entry *wifi_calibration;
|
||||
|
||||
unsigned char *get_wifi_nvs_ram( void )
|
||||
{
|
||||
return hardcoded_nvs;
|
||||
}
|
||||
EXPORT_SYMBOL(get_wifi_nvs_ram);
|
||||
|
||||
static int parse_tag_msm_wifi(void)
|
||||
{
|
||||
unsigned size;
|
||||
#ifdef NVS_MSM_WIFI_DEBUG
|
||||
unsigned i;
|
||||
#endif
|
||||
int devnum = 0;
|
||||
int ret = 0;
|
||||
char* maddr=wifi_nvs_ram;
|
||||
struct mtd_info *mtd;
|
||||
|
||||
DEBUG(MTD_DEBUG_LEVEL0, "MTD_open\n");
|
||||
mtd = get_mtd_device(NULL, devnum);
|
||||
|
||||
if (IS_ERR(mtd)) {
|
||||
ret = PTR_ERR(mtd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (MTD_ABSENT == mtd->type) {
|
||||
put_mtd_device(mtd);
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(mtd->read(mtd, (0x7e40 * NVS_MAX_SIZE), NVS_MAX_SIZE, &size, wifi_nvs_ram)) {
|
||||
put_mtd_device(mtd);
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
put_mtd_device(mtd);
|
||||
while(memcmp(maddr, "macaddr=", 8)!=0) {
|
||||
if((char*)++maddr>(char*)(wifi_nvs_ram+NVS_MAX_SIZE-NVS_MACADDR_SIZE))
|
||||
break;
|
||||
else
|
||||
maddr++;
|
||||
}
|
||||
if((char*)maddr<(char*)(wifi_nvs_ram+NVS_MAX_SIZE-NVS_MACADDR_SIZE)) nvs_mac_addr = maddr;
|
||||
|
||||
|
||||
#ifdef NVS_MSM_WIFI_DEBUG
|
||||
printk("WiFi Data size = %d \n", size);
|
||||
for(i=0;( i < size );i++) {
|
||||
printk("%02x ", wifi_nvs_ram[i]);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static unsigned wifi_get_nvs_size( void )
|
||||
{
|
||||
unsigned len;
|
||||
|
||||
len = strlen(hardcoded_nvs)+NVS_MACADDR_SIZE;
|
||||
return len;
|
||||
}
|
||||
|
||||
int wifi_calibration_size_set(void)
|
||||
{
|
||||
if (wifi_calibration != NULL)
|
||||
wifi_calibration->size = wifi_get_nvs_size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wifi_calibration_read_proc(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
unsigned len;
|
||||
#ifdef NVS_MSM_WIFI_DEBUG
|
||||
unsigned i;
|
||||
#endif
|
||||
|
||||
len = min(strlen(hardcoded_nvs), (unsigned)count);
|
||||
memcpy(page, hardcoded_nvs, len);
|
||||
memcpy(page, nvs_mac_addr, NVS_MACADDR_SIZE);
|
||||
ptr = get_wifi_nvs_ram();
|
||||
len = min(wifi_get_nvs_size(), (unsigned)count);
|
||||
memcpy(page+NVS_MACADDR_SIZE, ptr, strlen(hardcoded_nvs));
|
||||
#ifdef NVS_MSM_WIFI_DEBUG
|
||||
printk("WiFi Data len = %d \n", len);
|
||||
for(i=0;( i < len );i++) {
|
||||
printk("%c", *page++);
|
||||
}
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
|
||||
static int __init wifi_nvs_init(void)
|
||||
{
|
||||
pr_info("%s\n", __func__);
|
||||
parse_tag_msm_wifi();
|
||||
wifi_calibration = create_proc_entry("calibration", 0444, NULL);
|
||||
if (wifi_calibration != NULL) {
|
||||
wifi_calibration->size = strlen(hardcoded_nvs);
|
||||
wifi_calibration->size = wifi_get_nvs_size();
|
||||
wifi_calibration->read_proc = wifi_calibration_read_proc;
|
||||
wifi_calibration->write_proc = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall(wifi_nvs_init);
|
||||
late_initcall(wifi_nvs_init);
|
||||
|
@ -645,6 +645,7 @@ static struct platform_device *devices[] __initdata =
|
||||
#ifdef CONFIG_SERIAL_MSM_HS
|
||||
&msm_device_uart_dm1,
|
||||
#endif
|
||||
&msm_device_nand,
|
||||
&msm_device_smd,
|
||||
&htcleo_rfkill,
|
||||
&msm_device_rtc,
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
|
||||
#define ATAG_MSM_WIFI_DEBUG 1
|
||||
/* configuration tags specific to msm */
|
||||
#define ATAG_MSM_WIFI 0x57494649 /* MSM WiFi */
|
||||
|
||||
@ -37,12 +37,14 @@ static struct proc_dir_entry *wifi_data;
|
||||
|
||||
unsigned char *get_wifi_nvs_ram( void )
|
||||
{
|
||||
pr_info("NVS: get_wifi_nvs_ram\n");
|
||||
return wifi_nvs_ram;
|
||||
}
|
||||
EXPORT_SYMBOL(get_wifi_nvs_ram);
|
||||
|
||||
static int __init parse_tag_msm_wifi(const struct tag *tag)
|
||||
{
|
||||
pr_info("NVS: parse_tag_msm_wifi\n");
|
||||
unsigned char *dptr = (unsigned char *)(&tag->u);
|
||||
unsigned size;
|
||||
#ifdef ATAG_MSM_WIFI_DEBUG
|
||||
@ -64,6 +66,7 @@ __tagtable(ATAG_MSM_WIFI, parse_tag_msm_wifi);
|
||||
|
||||
static unsigned wifi_get_nvs_size( void )
|
||||
{
|
||||
pr_info("NVS: wifi_get_nvs_size\n");
|
||||
unsigned char *ptr;
|
||||
unsigned len;
|
||||
|
||||
@ -71,6 +74,7 @@ static unsigned wifi_get_nvs_size( void )
|
||||
/* Size in format LE assumed */
|
||||
memcpy(&len, ptr + NVS_LEN_OFFSET, sizeof(len));
|
||||
len = min(len, (NVS_MAX_SIZE - NVS_DATA_OFFSET));
|
||||
pr_info("NVS: wifi_get_nvs_size %d\n", len);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -85,6 +89,7 @@ int wifi_calibration_size_set(void)
|
||||
static int wifi_calibration_read_proc(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
pr_info("NVS: wifi_calibration_read_proc\n");
|
||||
unsigned char *ptr;
|
||||
unsigned len;
|
||||
|
||||
@ -107,9 +112,11 @@ static int wifi_data_read_proc(char *page, char **start, off_t off,
|
||||
|
||||
static int __init wifi_nvs_init(void)
|
||||
{
|
||||
pr_info("NVS: wifi_nvs_init\n");
|
||||
#ifdef CONFIG_WIFI_NVS_PROC_CREATE
|
||||
wifi_calibration = create_proc_entry("calibration", 0444, NULL);
|
||||
if (wifi_calibration != NULL) {
|
||||
pr_info("NVS: wifi_calibration\n");
|
||||
wifi_calibration->size = wifi_get_nvs_size();
|
||||
wifi_calibration->read_proc = wifi_calibration_read_proc;
|
||||
wifi_calibration->write_proc = NULL;
|
||||
|
@ -678,12 +678,15 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from,
|
||||
* was a protection violation (0x100), we lose
|
||||
*/
|
||||
pageerr = rawerr = 0;
|
||||
// This check fails on reading from Leos NAND, we have to check why
|
||||
#ifndef CONFIG_MACH_HTCLEO
|
||||
for (n = start_sector; n < cwperpage; n++) {
|
||||
if (dma_buffer->data.result[n].flash_status & 0x110) {
|
||||
rawerr = -EIO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (rawerr) {
|
||||
if (ops->datbuf) {
|
||||
uint8_t *datbuf = ops->datbuf +
|
||||
|
Loading…
x
Reference in New Issue
Block a user