motofan logo
10 страниц V « < 4 5 6 7 > »         
> 

Сборка ядра для ZN5. Compiling your own kernel, Компилим ядро. Мануал. 740 (798) MHz. Разгон

EXL
сообщение 29.11.2011, 5:26 Закрепленное сообщение!


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



На днях поковырялся в ядре и немного повысил частоту работы процессора.
В целом, производительность устройства увеличилась. Это можно судить по тестам:

532 MHz:
Прикрепленное изображение

636 MHz (изначально неправильно высчитанная частота 665 MHz):
Прикрепленное изображение

740 MHz (изначально неправильно высчитанная частота 798 MHz):
Прикрепленное изображение

Кроме того аппарат начал быстрее работать в некоторых меню, к сожалению поднятие частоты процессора конечно же не помогло избавится полностью от глюков и фризов Qt оболочки. Телефон нормально запускается и работает на 798 MHz у меня уже примерно две недели. 798 MHz лишь заменяет 532 MHz при нагрузке, поэтому все утилиты типа zCpu, aiCPU и др. будут работать.
Насчёт продолжительности от работы аккумулятора точно сказать не могу, т.к имею убитый на морозе аккум. Кто протестирует и отпишется о результатах - буду рад. Но скажу точно, денёк у меня держит, если не играть и пользоваться телефоном - как телефоном.
Кроме того, немного повысилась производительность в играх и эмуляторах. Например, pscx4all стал работать быстрее, Picodrive от rock88 вообще выдаёт фуллспид, а в quake 1 разогнался настолько, что играть стало не реально. crazy.gif Подробнее можете посмотреть на видео:

[video]https://www.youtube.com/watch?v=TJLPbUxXoSc[/video]

Ядра собраны под Symbiosis X.2 - 0DR, для ZN5 РСТ 64 Mb RAM. Кто портирует под ZN5 T-mobile - буду только рад. По-моему там просто загрузчик в sbf файлах поменять... P.S. Ядро от стандартного отличается только наличием возможности работы со свапом + другая частота.
665 MHz - Скачать 0DR
798 MHz - Скачать 0DR
665 MHz - Скачать 2CR_128 (ZE 0.9)
798 MHz - Скачать 2CR_128 (ZE 0.9)

Установка - обычная прошивка sbf-файла с помощью RSD Lite.

Изменения в сорцах ядра
Файл hardhat/linux-2.6.x/arch/arm/mach-mxc91231/mxc_pm.c, функция static ap_pll_mfn_values_t opinfo[NUM_DVFSOP_INDEXES], там где комментом отмечено /* 532 */:
значение ap_pll_dp_hfs_op: 0x000000A0 меняем на ap_pll_dp_hfs_op: 0x000000E0 для 798 и на ap_pll_dp_hfs_op: 0x000000C0 для 665.

Напоминаю, что ответственность за ваши действия лежит только на вас.

Полезная информация
Температурные тесты работы процессора ZN5.
Компилируем ядро ZN5. Мануал.

Прикреплённые файлы:
Прикрепленный файл 665MHz_Kernel_062A_Symbiosis_X.2.7z   ( 1.36 мегабайт ) Кол-во скачиваний: 3611
Прикрепленный файл 798MHz_Kernel_062A_Symbiosis_X.2.7z   ( 1.36 мегабайт ) Кол-во скачиваний: 3879
Прикрепленный файл ZE0.9_beta_665.7z   ( 1.36 мегабайт ) Кол-во скачиваний: 4053
Прикрепленный файл ZE0.9_beta_798.7z   ( 1.36 мегабайт ) Кол-во скачиваний: 4185
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
noph8
сообщение 12.7.2014, 14:00


Авторитет
********

Группа: Модераторы
Сообщений: 2 558
Регистрация: 22.10.2005
Из: Kyiv
Пользователь №: 55 238
Модель телефона: в подписи
Прошивка: в подписи
Победитель конкурса 2008


Настроение:
Золотые были времена



Рейтинг: 2740



давненько не заходил в эту ветку.
Цитата(VINRARUS @ 23.5.2014, 23:27)
* многогигабайтную флешку + тв выход. smile.gif

ага, разрешение по ТВ-выходу ваще огонь. 4k просто.
Насчёт переходника, попробую на днях - у коллеги есть такая штука, распайка, надеюсь, подойдёт.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
Claus398
сообщение 12.7.2014, 15:46


Авторитет
********

Группа: Контент-менеджеры
Сообщений: 12 345
Регистрация: 6.7.2007
Из: Украина. Кривой Рог
Пользователь №: 140 536
Модель телефона: Motorola ROKR E1
Прошивка: My skins mod

Рейтинг: 3125.5



Цитата(VINRARUS @ 23.5.2014, 23:27)
* Ну а через зину можна бы организовать кинотеатр - многогигабайтную флешку + тв выход.

ещё бы если без проблем видео нормально запускалось 640х480...
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
lcrmslcrms
сообщение 12.7.2014, 17:20


Гуру
******

Группа: Пользователи
Сообщений: 1 384
Регистрация: 16.1.2009
Пользователь №: 191 309
Модель телефона: motor e1/mpx200/w270
Прошивка: 42r/wm6.1/wm5.0


Настроение:
--+-+--



Рейтинг: 443.5



Проверял я otg , флешку не видит с доп питанием тоже .

Добавлено позже (12.7.2014, 20:23):
Цитата(noph8 @ 12.7.2014, 17:00) *

давненько не заходил в эту ветку.
Цитата(VINRARUS @ 23.5.2014, 23:27)
* многогигабайтную флешку + тв выход. smile.gif

ага, разрешение по ТВ-выходу ваще огонь. 4k просто.
Насчёт переходника, попробую на днях - у коллеги есть такая штука, распайка, надеюсь, подойдёт.

Работает av выход 100%.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 12.7.2014, 18:54


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(lcrmslcrms @ Сегодня, 0:20)
* Проверял я otg , флешку не видит с доп питанием тоже .

Интересно, в dmesg при подключении флехи через OTG что-нибудь отображается?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
lcrmslcrms
сообщение 12.7.2014, 20:21


Гуру
******

Группа: Пользователи
Сообщений: 1 384
Регистрация: 16.1.2009
Пользователь №: 191 309
Модель телефона: motor e1/mpx200/w270
Прошивка: 42r/wm6.1/wm5.0


Настроение:
--+-+--



Рейтинг: 443.5



Уменя нет такой программы , где она должна быть ?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 13.7.2014, 6:23


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(lcrmslcrms @ 12.7.2014, 20:21) *

Уменя нет такой программы , где она должна быть ?


Думаю вы ожидали что в файловом менеджере появится сама флэшка? конечно этого небудет, и это неговорит что все неработает, а вот через dmesq можно узнать подключилось или нет, создалось ли устройство и тд. А дальше уже ручками все подключается(покачто).
Так что ждем проверки от noph8 и вывод dmesq.

Кстати когда гугли про кабеля(думал спаять) есть несколько их видов. Там доп клема(5ая, которая для определения что подключено по otg) по разному бывает подключена.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 19.10.2015, 14:40


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(EXL @ 12.7.2014, 18:54) *

Цитата(lcrmslcrms @ Сегодня, 0:20)
* Проверял я otg , флешку не видит с доп питанием тоже .

Интересно, в dmesg при подключении флехи через OTG что-нибудь отображается?


Попался мне тут телефон с кабелем otg, проверил - в dmesg ничего нового. Питание было от телефона.

СТалобыть ядро невидет я правильно понимаю?

Сообщение отредактировал fill.sa - 19.10.2015, 14:41
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 20.10.2015, 7:01


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(fill.sa @ Вчера, 20:40)
*
СТалобыть ядро невидет я правильно понимаю?

Тут может быть куча причин, в том числе и железных.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 20.10.2015, 8:03


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Я может ошибаюсь, но вроди как otg кабель должен быть виден даже если в него ничего невключено?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
VINRARUS
сообщение 20.10.2015, 8:22


Термоядерный
********

Группа: Пользователи
Сообщений: 3 496
Регистрация: 12.12.2009
Из: Чорнобиль
Пользователь №: 211 044
Модель телефона: WX160 & L7 & Z6 & ZN5-128
Прошивка: 740 MHz: Z6 and ZN5


Настроение:
youtu.be/A_yQLYLiSGQ



Рейтинг: 1211



Цитата(fill.sa @ Сегодня, 11:03)
* вроди как otg кабель должен быть виден даже если в него ничего невключено?

А чем он отличается от обычного?
ПС: юзай pmtool -p
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 20.10.2015, 8:47


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(VINRARUS @ 20.10.2015, 8:22) *

Цитата(fill.sa @ Сегодня, 11:03)
* вроди как otg кабель должен быть виден даже если в него ничего невключено?

А чем он отличается от обычного?
ПС: юзай pmtool -p


Вроди как там сопротивление на какую-то ногу стоит для определения что кабель подключен.
Давно я это изучал - может уже путаю.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 23.10.2015, 11:57


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Кстати аппаратно телефон реагирует на ОТГ кабель. Т.е. пытаюсь через ОТГ подключиться к компу - и он не подключается, даже заряжаться неначинает. Т.е. тел понимает что включен ОТГ кабель.

Возможно все-таки нужно доп питание. У меня кабель с питанием от телефона - возможно по этому dmesq ничего не сказал.

Сообщение отредактировал fill.sa - 23.10.2015, 11:58
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
VINRARUS
сообщение 23.10.2015, 12:54


Термоядерный
********

Группа: Пользователи
Сообщений: 3 496
Регистрация: 12.12.2009
Из: Чорнобиль
Пользователь №: 211 044
Модель телефона: WX160 & L7 & Z6 & ZN5-128
Прошивка: 740 MHz: Z6 and ZN5


Настроение:
youtu.be/A_yQLYLiSGQ



Рейтинг: 1211



Цитата(fill.sa @ Сегодня, 14:57)
* Возможно все-таки нужно доп питание.

Ну а усилитель наушников через USB же как то питается.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 24.10.2015, 8:19


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(VINRARUS @ 23.10.2015, 12:54) *

Цитата(fill.sa @ Сегодня, 14:57)
* Возможно все-таки нужно доп питание.

Ну а усилитель наушников через USB же как то питается.

усилитель через какой кабель питается?
Яж говорю когда телефон понимат что включен ОТГ от отключает питание сразу, т.к. мой тел даже не начал заряжаться.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 27.10.2015, 8:40


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



ВОт теперь на 100% могу сказать что как минимум нужно доп питание.
Взял мультиметр, воткнул ОТГ в телефон и померял на контактах питание - его нету.

Так что если кто будет эксперементировать - берите ОТГ с доп.питанием.

Сообщение отредактировал fill.sa - 1.11.2015, 6:57
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 1.11.2015, 6:56


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Что, никто не хочет проверить ОТГ кабель с доп питанием на своем телефоне? А то у меня зинка еще пару дней и опять небудет. И кабеля с доп питанием я не найду.

Винрарус, тыже еще владеешь зинкой, поспрашивай у земляков кабелья для проверки. Мож ты доконца ответить на вопрос про otg
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
VINRARUS
сообщение 1.11.2015, 9:20


Термоядерный
********

Группа: Пользователи
Сообщений: 3 496
Регистрация: 12.12.2009
Из: Чорнобиль
Пользователь №: 211 044
Модель телефона: WX160 & L7 & Z6 & ZN5-128
Прошивка: 740 MHz: Z6 and ZN5


Настроение:
youtu.be/A_yQLYLiSGQ



Рейтинг: 1211



Цитата(fill.sa @ Сегодня, 9:56)
* А то у меня зинка еще пару дней и опять небудет.

this.gif
Цитата(fill.sa @ Сегодня, 9:56)
* Винрарус, тыже еще владеешь зинкой, поспрашивай у земляков кабелья для проверки. Мож ты доконца ответить на вопрос про otg

Цитата(VINRARUS @ 23.10.2015, 15:54)
* Из: Чернобыль

blind.gif Боюсь спросить у некого.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 26.8.2016, 14:21


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Что за патч? ARM: mxc91231 вроди наш проц?
Код
This fixes:

    arch/arm/kernel/built-in.o: In function `__irq_svc':
    io.c:(.text+0x2e0): undefined reference to `avic_base'
    arch/arm/kernel/built-in.o: In function `__irq_usr':
    io.c:(.text+0x4c8): undefined reference to `avic_base'
    arch/arm/mach-mxc91231/built-in.o: In function `mxc91231_init_irq':
    magx-zn5.c:(.init.text+0x18): undefined reference to `mxc_init_irq'

and was broken by

    c7259df (ARM i.MX irq: Compile avic irq code only on SoCs that need it)

Signed-off-by: Uwe Kleine-Kцnig <u.kleine-koenig at pengutronix.de>
---
arch/arm/plat-mxc/Kconfig |    1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index 15dd518..8d183c5 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -33,6 +33,7 @@ config ARCH_MX3
config ARCH_MXC91231
    bool "MXC91231-based"
    select CPU_V6
+    select MXC_AVIC
    help
      This enables support for systems based on the Freescale MXC91231 family

--
1.7.2.3


http://lists.infradead.org/pipermail/linux...rch/044733.html

Сообщение отредактировал fill.sa - 26.8.2016, 14:21
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 27.8.2016, 8:49


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Там же в заголовке написано, что патч исправляет ошибки линковки при компиляции ядра.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 3.9.2016, 16:16


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Еще патч один, про битые сектора nand
http://lists.infradead.org/pipermail/linux...ust/022837.html
название
diff -urN a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
--- a/drivers/mtd/mtdpart.c 2008-08-21 02:19:31.000000000 -0500
+++ b/drivers/mtd/mtdpart.c 2008-08-24 22:46:34.000000000 -0500
@@ -1,12 +1,17 @@
/*
* Simple MTD partitioning layer
*
+ * Copyright 2005 Motorola, Inc.
* © 2000 Nicolas Pitre <nico at cam.org>
*
* This code is GPL
*
* 02-21-2002 Thomas Gleixner <gleixner at autronix.de>
* added support for read_oob, write_oob
+ *
+ * 05-06-2005 feature CONFIG_MTD_NAND_BBM added by Motorola, Inc.
+ * create the block reserve pool partition.
+ * verify the size and start address of the reserve pool partition.
*/

#include <linux/module.h>
@@ -19,6 +24,14 @@
#include <linux/mtd/partitions.h>
#include <linux/mtd/compatmac.h>

+#if defined(CONFIG_MTD_NAND_BBM)
+/*
+ * reserved block offset
+ * the last NAND partition will be used as reserved blocks
+ */
+unsigned long rsvdblock_offset;
+#endif
+
/* Our partition linked list */
static LIST_HEAD(mtd_partitions);

@@ -163,6 +176,14 @@
len, retlen, buf);
}

+#ifdef CONFIG_MTD_NAND_BBM
+static int part_block_replace (struct mtd_info *mtd, loff_t ofs, int lock)
+{
+ struct mtd_part *part = PART(mtd);
+ return part->master->block_replace (part->master, ofs + part->offset, lock);
+}
+#endif
+
static int part_write_oob(struct mtd_info *mtd, loff_t to,
struct mtd_oob_ops *ops)
{
@@ -349,6 +370,11 @@
if (master->panic_write)
slave->mtd.panic_write = part_panic_write;

+#ifdef CONFIG_MTD_NAND_BBM
+ if (master->block_replace)
+ slave->mtd.block_replace = part_block_replace;
+#endif
+
if (master->point && master->unpoint) {
slave->mtd.point = part_point;
slave->mtd.unpoint = part_unpoint;
@@ -465,6 +491,10 @@
}

slave->mtd.ecclayout = master->ecclayout;
+#ifndef CONFIG_MTD_NAND_BBM
+ /* Since we have bbt, there is no need to check here.
+ * block_isbad may use uninitialized rsvdblock_offset before 'rsv' partition is added.
+ */
if (master->block_isbad) {
uint32_t offs = 0;

@@ -475,7 +505,7 @@
offs += slave->mtd.erasesize;
}
}
-
+#endif
out_register:
if (part->mtdp) {
/* store the object pointer (caller may or may not register it*/
@@ -486,6 +516,40 @@
add_mtd_device(&slave->mtd);
slave->registered = 1;
}
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* preset the reserved block offset */
+ if (master->type == MTD_NANDFLASH && i == nbparts-1) {
+ int bbmblocks = 0;
+ int rsvdblocks = 0;
+ int erasesize = master->erasesize;
+
+ if (strcmp(slave->mtd.name, "rsv"))
+ panic("%s's \"rsv\" partition does not exist,"
+ " NAND Bad Block cann't be handled!\n", master->name);
+
+ rsvdblock_offset = slave->offset;
+ printk (KERN_INFO "%s's capacity:%dMB, reserved block offset:0x%08x\n",
+ master->name, (master->size/(1024*1024)), rsvdblock_offset);
+
+ /*
+ * check the block number for the BBT/BBM reserved block pool...
+ * reserved block number for NAND flash should be 2% of the total blocks,
+ * plus:
+ * add extra 1 NFI, 2 BBT and 2 BBMs blocks.
+ *
+ * how to calculate BBMs:
+ * - 2 bytes for each block,
+ * - bbmblocks = ((totalblock*2)+(blocksize-1))/blocksize;
+ */
+
+ bbmblocks = ((master->size/erasesize)*2 + (erasesize-1)) / erasesize;
+ rsvdblocks = ((master->size/erasesize)/100)*2 + 3 + (bbmblocks*2);
+
+ if (rsvdblock_offset != (master->size - (rsvdblocks*erasesize)))
+ panic("%s:0x%08x's rsv partition must start at offset:0x%08x\n",
+ master->name, master->size, master->size-(rsvdblocks*erasesize));
+ }
+#endif
return slave;
}

diff -urN a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
--- a/drivers/mtd/nand/Kconfig 2008-08-21 02:19:23.000000000 -0500
+++ b/drivers/mtd/nand/Kconfig 2008-08-27 00:26:33.000000000 -0500
@@ -359,6 +359,23 @@
The simulator may simulate various NAND flash chips for the
MTD nand layer.

+config MTD_NAND_BBM
+ bool "NAND Bad Block Management support"
+ depends on MTD_NAND
+ default "n"
+ help
+ This enables the driver for the NAND flash to support Motorola Bad Block Management.
+ With this BBM feature, any exist bad block or newly wearing out block will be
+ replaced with good blocks from the reserved pool . applications will see the NAN
+ chip contains only contiguous good blocks and it is transparent to the upper level
+ applications.
+
+config MTD_NAND_BBM_DBG
+ bool "NAND Bad Block Management Debug support"
+ depends on MTD_NAND_BBM
+ help
+ This is for Bad Block Management development only
+
config MTD_NAND_PLATFORM
tristate "Support for generic platform NAND driver"
depends on MTD_NAND
diff -urN a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
--- a/drivers/mtd/nand/nand_base.c 2008-08-27 01:46:49.000000000 -0500
+++ b/drivers/mtd/nand/nand_base.c 2008-08-21 02:28:18.000000000 -0500
@@ -9,9 +9,15 @@
* Additional technical information is available on
* http://www.linux-mtd.infradead.org/doc/nand.html
*
+ * Copyright © 2005 - 2007 Motorola, Inc.
* Copyright © 2000 Steven J. Hill (sjhill at realitydiluted.com)
* 2002-2006 Thomas Gleixner (tglx at linutronix.de)
*
+ * 05-06-2005 feature CONFIG_MTD_NAND_BBM added by Motorola, Inc.
+ * added bad block management support. With the reserved block pool
+ * available, nand_base driver will do bad block replacement based on
+ * the BBM map (Bad Block Map) stored in flash.
+ *
* Credits:
* David Woodhouse for adding multichip support
*
@@ -52,6 +58,10 @@
#include <linux/mtd/partitions.h>
#endif

+#if defined(CONFIG_MTD_NAND_BBM)
+/* the rsvdblock_offset is the start address for rsv partition*/
+extern unsigned long rsvdblock_offset;
+#endif
/* Define default oob placement schemes for large and small page devices */
static struct nand_ecclayout nand_oob_8 = {
.eccbytes = 3,
@@ -335,6 +345,45 @@
return res;
}

+#if defined(CONFIG_MTD_NAND_BBM)
+/**
+ * nand_translate_block - get translated block from reserve pool
+ * @mtd: MTD device structure
+ * @ofs: offset from device start
+ *
+ * return translated block from reserved pool - offset from device start
+ */
+loff_t nand_translate_block(struct mtd_info *mtd, loff_t ofs)
+{
+ struct nand_chip *chip = mtd->priv;
+ int orig_block;
+ loff_t page_ofs, translate_block_ofs;
+retry:
+ /* calculate the block number and page offset */
+ orig_block = (int)(ofs >> chip->phys_erase_shift);
+ page_ofs = ofs - (loff_t)(orig_block << chip->phys_erase_shift);
+
+ /* check, if no translate returns back the original offset */
+ if (chip->bbm[orig_block] == 0xffff)
+ return ofs;
+
+ /* get the translate block */
+ translate_block_ofs =
+ (chip->bbm[orig_block] << chip->phys_erase_shift) +
+ rsvdblock_offset + page_ofs;
+ DEBUG (MTD_DEBUG_LEVEL0, "original bad block# %d with "
+ " offset 0x%08x, translate_block_ofs 0x%08x\n",
+ orig_block, (unsigned int)ofs, (unsigned int)translate_block_ofs);
+
+ /* make sure the translate is a good block */
+ if (nand_isbad_bbt(mtd, translate_block_ofs, 0)) {
+ ofs = translate_block_ofs;
+ goto retry;
+ }
+ /* must have the good block for the translate */
+ return translate_block_ofs;
+}
+#endif /* CONFIG_MTD_NAND_BBM */
/**
* nand_default_block_markbad - [DEFAULT] mark a block bad
* @mtd: MTD device structure
@@ -410,8 +459,27 @@
if (!chip->bbt)
return chip->block_bad(mtd, ofs, getchip);

+#if defined(CONFIG_MTD_NAND_BBM)
+/*
+ * With the Bad Block management feature, this function has been modified to
+ * return good (return 0) if the physical block is bad, but it can be replaced
+ * by a good block from reserved pool. It returns bad (return 1) only if the
+ * bad block with no replacement
+ */
+ if (nand_isbad_bbt (mtd, ofs, allowbbt)) { /* bbt said: bad block */
+ if (ofs != nand_translate_block(mtd, ofs))
+ /* has replacement - return as good block */
+ return 0;
+ else
+ /* no replcaement - return block bad */
+ return 1;
+ }
+ else /* bbt said: block is good */
+ return 0;
+#else
/* Return info from the table */
return nand_isbad_bbt(mtd, ofs, allowbbt);
+#endif
}

/*
@@ -1045,6 +1113,10 @@
uint32_t readlen = ops->len;
uint32_t oobreadlen = ops->ooblen;
uint8_t *bufpoi, *oob, *buf;
+#if defined(CONFIG_MTD_NAND_BBM)
+ loff_t from_rb;
+ int page_cnt = 0, block_replace_flag = 0;
+#endif

stats = mtd->ecc_stats;

@@ -1052,6 +1124,20 @@
chip->select_chip(mtd, chipnr);

realpage = (int)(from >> chip->page_shift);
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Check for block replacement if the given page is in bad block */
+ if (nand_isbad_bbt (mtd, from, 0)) {
+ from_rb = nand_translate_block(mtd, from);
+ if (from_rb != from) {
+ block_replace_flag = 1;
+ DEBUG (MTD_DEBUG_LEVEL0,
+ "%s: badblock offset:0x%08x, replblock offset:0x%08x\n",
+ __FUNCTION__, (unsigned int)from, (unsigned int)from_rb);
+ realpage = (int) (from_rb >> chip->page_shift);
+ }
+ }
+#endif
+
page = realpage & chip->pagemask;

col = (int)(from & (mtd->writesize - 1));
@@ -1147,6 +1233,31 @@
*/
if (!NAND_CANAUTOINCR(chip) || !(page & blkcheck))
sndcmd = 1;
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Increment page address */
+ page_cnt++;
+ /* do bad block check, if we have hit a block boundary */
+ if (!(page & blkcheck)) {
+ int pg_shift = chip->page_shift;
+
+ /* check, if it is in a replacement block */
+ if (block_replace_flag) {
+ /* set page back to original block */
+ realpage = (int) (from >> pg_shift) + page_cnt;
+ block_replace_flag = 0;
+ }
+ /* check, if the given start page is in bad block */
+ if (nand_isbad_bbt (mtd, (realpage << pg_shift), 0)) {
+ from_rb = nand_translate_block(mtd, (realpage << pg_shift));
+ if (from_rb != (realpage << pg_shift)) {
+ realpage = (int) (from_rb >> pg_shift);
+ block_replace_flag = 1;
+ }
+ }
+ page = realpage & chip->pagemask;
+ }
+#endif
+
}

ops->retlen = ops->len - (size_t) readlen;
@@ -1356,6 +1467,11 @@
int len;
uint8_t *buf = ops->oobbuf;

+#if defined(CONFIG_MTD_NAND_BBM)
+ loff_t from_rb;
+ int page_cnt = 0, block_replace_flag = 0;
+#endif
+
DEBUG(MTD_DEBUG_LEVEL3, "nand_read_oob: from = 0x%08Lx, len = %i\n",
(unsigned long long)from, readlen);

@@ -1386,6 +1502,22 @@
realpage = (int)(from >> chip->page_shift);
page = realpage & chip->pagemask;

+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Check for block replacement if the given page is in bad block */
+ if (nand_isbad_bbt (mtd, from, 0)) {
+ from_rb = nand_translate_block(mtd, from);
+ if (from_rb != from) {
+ block_replace_flag=1;
+ DEBUG (MTD_DEBUG_LEVEL0,
+ "%s: badblock offset:0x%08x, replblock offset:0x%08x\n",
+ __FUNCTION__, (unsigned int) from,
+ (unsigned int)from_rb );
+
+ realpage = (int) (from_rb >> chip->page_shift);
+ }
+ }
+#endif
+
while(1) {
sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);

@@ -1425,6 +1557,30 @@
*/
if (!NAND_CANAUTOINCR(chip) || !(page & blkcheck))
sndcmd = 1;
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Increment page address */
+ page_cnt++;
+ /* do bad block check, if we have hit a block boundary */
+ if (!(page & blkcheck)) {
+ /* check, if it is in a replacement block */
+ if (block_replace_flag) {
+ /* set page back to original block */
+ realpage = (int) (from >> chip->page_shift) + page_cnt;
+ block_replace_flag = 0;
+ }
+
+ /* check, if the given start page is in bad block */
+ if (nand_isbad_bbt (mtd, (realpage << chip->page_shift), 0)) {
+ from_rb = nand_translate_block(mtd, (realpage << chip->page_shift));
+ if (from_rb != (realpage << chip->page_shift)) {
+ realpage = (int) (from_rb >> chip->page_shift);
+ block_replace_flag = 1;
+ }
+ }
+ page = realpage & chip->pagemask;
+ }
+#endif /* CONFIG_MTD_NAND_BBM */
+
}

ops->oobretlen = ops->ooblen;
@@ -1713,6 +1869,11 @@
uint8_t *buf = ops->datbuf;
int ret, subpage;

+#if defined(CONFIG_MTD_NAND_BBM)
+ loff_t to_rb;
+ int page_cnt = 0, block_replace_flag = 0;
+#endif
+
ops->retlen = 0;
if (!writelen)
return 0;
@@ -1738,13 +1899,36 @@
return -EIO;

realpage = (int)(to >> chip->page_shift);
+
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Check for block replacement if the given page is in bad block */
+ if (nand_isbad_bbt (mtd, to, 0)) {
+ to_rb = nand_translate_block(mtd, to);
+ if (to_rb != to) {
+ DEBUG (MTD_DEBUG_LEVEL0,
+ "%s: badblock offset:0x%08x, replblock offset:0x%08x\n",
+ __FUNCTION__, (unsigned int)to, (unsigned int)to_rb);
+
+ realpage = (int) (to_rb >> chip->page_shift);
+ block_replace_flag = 1;
+ }
+ }
+#endif
+
page = realpage & chip->pagemask;
blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;

+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Invalidate the page cache, when we write to the cached page */
+ if (realpage <= chip->pagebuf &&
+ (chip->pagebuf < (realpage + (ops->len >> chip->page_shift)
+ chip->pagebuf = -1;
+#else
/* Invalidate the page cache, when we write to the cached page */
if (to <= (chip->pagebuf << chip->page_shift) &&
(chip->pagebuf << chip->page_shift) < (to + ops->len))
chip->pagebuf = -1;
+#endif

/* If we're not given explicit OOB data, let it be 0xFF */
if (likely(!oob))
@@ -1781,6 +1965,31 @@
buf += bytes;
realpage++;

+#if defined(CONFIG_MTD_NAND_BBM)
+ page_cnt++;
+ /* Check a block boundary. If we hit the block boundary and
+ * we were working with the replaced block, we need
+ * to find the real page from the start address.
+ */
+ if (!(realpage & blockmask)) {
+ /* check, if it is in a replacement block */
+ if (block_replace_flag) {
+ /* set page back to original block */
+ realpage = (int) (to >> chip->page_shift) + page_cnt;
+ block_replace_flag = 0;
+ }
+ /* check, if the given start page is in a bad block */
+ if (nand_isbad_bbt (mtd, (realpage << chip->page_shift), 0)) {
+ to_rb = nand_translate_block(mtd,
+ (realpage << chip->page_shift));
+ if (to_rb != (realpage << chip->page_shift)) {
+ block_replace_flag = 1;
+ realpage = (int) (to_rb >> chip->page_shift);
+ }
+ }
+ }
+#endif
+
page = realpage & chip->pagemask;
/* Check, if we cross a chip boundary */
if (!page) {
@@ -1881,6 +2090,13 @@
chipnr = (int)(to >> chip->chip_shift);
chip->select_chip(mtd, chipnr);

+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Check for block replacement if the given page is in bad block */
+ if (nand_isbad_bbt (mtd, to, 0)) {
+ to = nand_translate_block(mtd, to);
+ }
+#endif
+
/* Shift to get page */
page = (int)(to >> chip->page_shift);

@@ -2019,6 +2235,11 @@
int rewrite_bbt[NAND_MAX_CHIPS]={0};
unsigned int bbt_masked_page = 0xffffffff;

+#if defined(CONFIG_MTD_NAND_BBM)
+ loff_t orig_addr = instr->addr;
+ int block_replace_flag = 0;
+#endif
+
DEBUG(MTD_DEBUG_LEVEL3, "nand_erase: start = 0x%08x, len = %i\n",
(unsigned int)instr->addr, (unsigned int)instr->len);

@@ -2080,6 +2301,38 @@
instr->state = MTD_ERASING;

while (len) {
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* check, if it is in a replacement block */
+ if (block_replace_flag) {
+ /* set page back to original block */
+ page = (int) (orig_addr >> chip->page_shift);
+ block_replace_flag = 0;
+ }
+ /* check, if the given start page is in a bad block */
+ if (nand_isbad_bbt (mtd, (page << chip->page_shift), allowbbt)) {
+ instr->addr = nand_translate_block(mtd,
+ (page << chip->page_shift));
+ /* Check if we have a bad block with no replacement,
+ we do not erase bad blocks ! */
+ if (instr->addr == orig_addr) {
+ printk (KERN_WARNING
+ "nand_erase: attempt to erase a bad block at page 0x%08x\n",
+ page);
+ instr->state = MTD_ERASE_FAILED;
+ goto erase_exit;
+ }
+ block_replace_flag = 1;
+ DEBUG (MTD_DEBUG_LEVEL0,
+ "nand_erase: badblck at 0x%08x replced by 0x%08x\n",
+ (unsigned int) (page << chip->page_shift),
+ (unsigned int) instr->addr);
+
+ /* updating page offset with the replacement page offset */
+ page = (int) (instr->addr >> chip->page_shift);
+ }
+ orig_addr += (1 << chip->phys_erase_shift);
+
+#else /* !CONFIG_MTD_NAND_BBM */
/*
* heck if we have a bad block, we do not erase bad blocks !
*/
@@ -2091,6 +2344,8 @@
goto erase_exit;
}

+#endif /* CONFIG_MTD_NAND_BBM */
+
/*
* Invalidate the page cache, if we erase the block which
* contains the current cached page
@@ -2260,6 +2515,79 @@
"in suspended state\n");
}

+#ifdef CONFIG_MTD_NAND_BBM
+/* This is the Linux 2.6.10 code. Linux 2.6.18 obsoleted this function and
+ * it uses the mtd->read_oob api to read the OOB data from nand_bbt.c.
+ * A bad block is checked in nand_do_read_ops so if nand_bbt.c uses mtd->read_oob
+ * API, we may encounter recursive issue.
+ *
+ * We need to investigate more whether it is safe to call mtd->read_oob from
+ * nand_bbt.c with the BBM support. For now, let's use the nand_read_raw.
+ */
+
+/**
+ * nand_read_raw - [GENERIC] Read raw data including oob into buffer
+ * @mtd: MTD device structure
+ * @buf: temporary buffer
+ * @from: offset to read from
+ * @len: number of bytes to read
+ * @ooblen: number of oob data bytes to read
+ *
+ * Read raw data including oob into buffer
+ */
+int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len, size_t ooblen)
+{
+ struct nand_chip *this = mtd->priv;
+ int page = (int) (from >> this->page_shift);
+ int chip = (int) (from >> this->chip_shift);
+ int sndcmd = 1;
+ int cnt = 0;
+ int pagesize = mtd->writesize + mtd->oobsize;
+ int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;
+
+ /* Do not allow reads past end of device */
+ if ((from + len) > mtd->size) {
+ DEBUG (MTD_DEBUG_LEVEL0, "nand_read_raw: Attempt read beyond end of device\n");
+ return -EINVAL;
+ }
+
+ /* Grab the lock and see if the device is available */
+ nand_get_device (this, mtd , FL_READING);
+
+ this->select_chip (mtd, chip);
+
+ /* Add requested oob length */
+ len += ooblen;
+
+ while (len) {
+ if (sndcmd) {
+ this->cmdfunc (mtd, NAND_CMD_READ0, 0, page & this->pagemask);
+ }
+ sndcmd = 0;
+
+ this->read_buf (mtd, &buf[cnt], pagesize);
+
+ len -= pagesize;
+ cnt += pagesize;
+ page++;
+
+ if (!this->dev_ready)
+ udelay (this->chip_delay);
+ else
+ nand_wait_ready(mtd);
+
+ /* Check, if the chip supports auto page increment */
+ if (!NAND_CANAUTOINCR(this) || !(page & blockcheck))
+ sndcmd = 1;
+ }
+
+ /* Deselect and wake up anyone waiting on the device */
+ nand_release_device(mtd);
+ return 0;
+}
+
+#endif /* CONFIG_MTD_NAND_BBM */
+
/*
* Set default functions
*/
diff -urN a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
--- a/drivers/mtd/nand/nand_bbt.c 2008-08-27 01:46:40.000000000 -0500
+++ b/drivers/mtd/nand/nand_bbt.c 2008-08-27 01:39:45.000000000 -0500
@@ -4,6 +4,7 @@
* Overview:
* Bad block table support for the NAND driver
*
+ * Copyright © 2005-2007 Motorola, Inc.
* Copyright © 2004 Thomas Gleixner (tglx at linutronix.de)
*
* This program is free software; you can redistribute it and/or modify
@@ -48,6 +49,19 @@
* - bbts start at a page boundary, if autolocated on a block boundary
* - the space necessary for a bbt in FLASH does not exceed a block boundary
*
+ * ChangeLog:
+ * (mm-dd-yyyy) Author Comment
+ * 05-06-2005 Motorola implemented CONFIG_MTD_NAND_BBM feature.
+ * BBMs (bad block maps): both preimary and mirriored bbms
+ * stored in flash next to BBTs (bad block table) blocks.
+ * BBMs are used for the nand_base driver for mapping a bad block
+ * to a reserved good block from reserve pool.
+ * The initial BBMs were created based on the original BBT table.
+ * Original (factory marked) bad blocka are mapped to reserved good blocks.
+ * BBTs and BBMs will be updated if new bad block detected.
+ * new BBTs and BBMs's data will be written back to the flash with
+ * version updates.
+ *
*/

#include <linux/slab.h>
@@ -60,6 +74,32 @@
#include <linux/delay.h>
#include <linux/vmalloc.h>

+#if defined(CONFIG_MTD_NAND_BBM)
+/*
+ * the following definitions are used by BBM feature
+ */
+extern unsigned long rsvdblock_offset;
+static uint8_t bbm_pattern[] = {'B', 'b', 'm', '0'};
+static uint8_t mirror_bbm_pat[] = {'1', 'm', 'b', 'B'};
+static uint8_t bbm_multi_pat[] = {'B', 'b', 'm', '2'};
+static uint8_t mir_bbm_multi_pat[] = {'3', 'm', 'b', 'B'};
+
+static struct nand_bbt_descr bbt_descr = {
+ .options = NAND_BBT_LASTBLOCK | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+#if defined(CONFIG_ARCH_OMAP34XX)
+ .offs = 12,
+ .len = 4,
+ .veroffs = 0,
+ .maxblocks = 8,
+#else
+ .offs = 8,
+ .len = 4,
+ .veroffs = 12,
+ .maxblocks = 4,
+#endif
+};
+#endif /* CONFIG_MTD_NAND_BBM */
+
/**
* check_pattern - [GENERIC] check if a pattern is in the buffer
* @buf: the buffer to search
@@ -148,6 +188,9 @@
size_t retlen, len, totlen;
loff_t from;
uint8_t msk = (uint8_t) ((1 << bits) - 1);
+#if defined(CONFIG_MTD_NAND_BBM)
+ int update_bbm_flag = 0;
+#endif

totlen = (num * bits) >> 3;
from = ((loff_t) page) << this->page_shift;
@@ -167,6 +210,9 @@
for (i = 0; i < len; i++) {
uint8_t dat = buf[i];
for (j = 0; j < 8; j += bits, act += 2) {
+#if defined(CONFIG_MTD_NAND_BBM)
+ uint16_t badblock;
+#endif
uint8_t tmp = (dat >> j) & msk;
if (tmp == msk)
continue;
@@ -179,8 +225,25 @@
}
/* Leave it for now, if its matured we can move this
* message to MTD_DEBUG_LEVEL0 */
+#if defined(CONFIG_MTD_NAND_BBM)
+ badblock = (offs << 2) + (act >> 1);
+ printk (KERN_INFO "nand_read_bbt: Bad block at %d\n", badblock);
+ /* check if this is new bad block, update the bbm table */
+ if (this->bbm[badblock] == 0xffff) {
+ this->bbm[badblock] = get_bbm_index(mtd, this->bbm);
+ printk(KERN_INFO
+ "\tbad block %d will be mapped to reserved block %d\n",
+ badblock, this->bbm[badblock]);
+ update_bbm_flag = 1;
+ }
+ else /* bad blokcs already mapped in bbm table */
+ printk(KERN_INFO
+ "\tbad block %d has beed mapped to reserved block %d\n",
+ badblock, this->bbm[badblock]);
+#else
printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%08x\n",
((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
+#endif
/* Factory marked bad or worn out ? */
if (tmp == 0)
this->bbt[offs + (act >> 3)] |= 0x3 << (act & 0x06);
@@ -192,9 +255,105 @@
totlen -= len;
from += len;
}
+#if defined(CONFIG_MTD_NAND_BBM)
+ if (update_bbm_flag)
+ update_bbm(mtd, this->bbm, 0);
+#endif
+
+#if defined(CONFIG_MTD_NAND_BBM_DBG) /* debugging the bbt data */
+ totlen = (num * bits) >> 3;
+ for (i = 0; i < totlen; i++) {
+ printk("bbt[%04d]=%02x ",i , buf[i]);
+ if (i%8 == 7) printk("\n");
+ }
+#endif
+ return 0;
+}
+
+#if defined(CONFIG_MTD_NAND_BBM)
+/**
+ * read_bbm - Read the bad block map starting from page
+ * @mtd: MTD device structure
+ * @buf: temporary buffer
+ * @page: the starting page
+ *
+ * Read the bad block map starting from page.
+ *
+ */
+static int read_bbm (struct mtd_info *mtd, uint8_t *buf, struct nand_bbm_descr *bbm_td, int chip)
+{
+ int i, res;
+ struct nand_chip *this = mtd->priv;
+ size_t page, retlen, readlen, bbm_len, tmplen = 0;
+ loff_t from;
+
+ /* calculate the bbm read length */
+ bbm_len = mtd->size >> (this->bbt_erase_shift-1);
+
+ for (i = 0; i < NAND_MAX_BBMS; i++) {
+ page = bbm_td->pages[chip][i];
+ if (page && page < (mtd->size >> this->page_shift) ) {
+ /* For NAND chip with pagesize=512Bytes, blocksize=16KBytes:
+ * - mtd->size <= 128MB, 'read_ecc' called exactly once.
+ * - mtd->size > 128MB && <= 256MB (up to 2 Gigabit), 'read_ecc' cal
+ */
+ from = ((loff_t)page) << this->page_shift;
+ DEBUG (MTD_DEBUG_LEVEL0,
+ "nand_read_bbm: BBM read from page = 0x%08x\n", from);
+
+ /* read bbm data - up to one block size for each read */
+ readlen = min(bbm_len - tmplen, mtd->erasesize);
+ res = mtd->read (mtd, from, readlen, &retlen, &buf[tmplen]);
+ tmplen += retlen;
+ if (res < 0) {
+ if (retlen != readlen ) {
+ printk (KERN_INFO
+ "nand_read_bbm: Error reading bad block map\n");
+ return res;
+ }
+ printk (KERN_WARNING
+ "nand_read_bbm: ECC error while reading bad block map\n");
+ }
+ }
+ else
+ break;
+ }
+
+#if defined(CONFIG_MTD_NAND_BBM_DBG) /* debugging the bbm data */
+ for (i = 0; i < bbm_len/2; i++) {
+ printk("bbm[%04d]=%04x ",i , this->bbm[i]);
+ if (i%8 == 7) printk("\n");
+ }
+#endif
return 0;
}

+/***
+ * get_bbm_index() - [GENERIC] get the reserved block index through BBM map
+ * @mtd MTD device structure
+ * @bbm memory version of BBM map
+ *
+ * Return: The index to the next available block in reserved pool.
+ */
+int get_bbm_index(struct mtd_info *mtd, uint16_t* bbm)
+{
+ int i, index=0, blocks = mtd->size/mtd->erasesize;
+ int max_rsvblks =
+ (mtd->size - rsvdblock_offset)/mtd->erasesize-bbt_descr.maxblocks;
+ for (i=0; i<blocks; i++)
+ if (bbm[i] != 0xffff)
+ index++;
+ /* check, if index is out of reserved pool */
+ if (index >= max_rsvblks)
+ {
+ printk(KERN_ERR "out of reserved pool\n");
+ return -1;
+ }
+ return index;
+}
+
+#endif /* CONFIG_MTD_NAND_BBM */
+
/**
* read_abs_bbt - [GENERIC] Read the bad block table starting at a given page
* @mtd: MTD device structure
@@ -216,16 +375,31 @@
if (td->options & NAND_BBT_PERCHIP) {
int offs = 0;
for (i = 0; i < this->numchips; i++) {
- if (chip == -1 || chip == i)
+ if (chip == -1 || chip == i) {
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* read BBM into memory for this chip */
+ res = read_bbm (mtd, (uint8_t*)this->bbm, this->bbm_td, chip);
+ if (res)
+ return res;
+#endif
res = read_bbt (mtd, buf, td->pages[i], this->chipsize >> this->bbt_erase_shift, bits, offs, td->reserved_block_code);
- if (res)
- return res;
+ if (res)
+ return res;
+
+ }
+
offs += this->chipsize >> (this->bbt_erase_shift + 2);
}
} else {
+#if defined(CONFIG_MTD_NAND_BBM)
+ res = read_bbm (mtd, (uint8_t*)this->bbm, this->bbm_td, 0);
+ if (res)
+ return res;
+#endif
res = read_bbt (mtd, buf, td->pages[0], mtd->size >> this->bbt_erase_shift, bits, 0, td->reserved_block_code);
if (res)
return res;
+
}
return 0;
}
@@ -282,6 +456,11 @@
{
struct nand_chip *this = mtd->priv;

+#if defined(CONFIG_MTD_NAND_BBM)
+ int i, page, ret;
+ uint8_t *buf_bbm = (uint8_t *)this->bbm;
+#endif
+
/* Read the primary version, if available */
if (td->options & NAND_BBT_VERSION) {
scan_read_raw(mtd, buf, td->pages[0] << this->page_shift,
@@ -299,7 +478,58 @@
printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n",
md->pages[0], md->version[0]);
}
+
+#if defined(CONFIG_MTD_NAND_BBM)
+ /* Read the primary version of bbm, if available */
+ ret = scan_read_raw (mtd, buf_bbm,
+ this->bbm_td->pages[0][0] << this->page_shift,
+ mtd->writesize);
+ if (!ret) {
+ this->bbm_td->version[0] =
+ buf_bbm[mtd->writesize + this->bbm_td->veroffs];
+ printk (KERN_DEBUG "Bad block map at page %d, version 0x%02X\n",
+ this->bbm_td->pages[0][0], this->bbm_td->version[0]);
+ /* Step in for multiple BBM block case */
+ for (i = 1; i < NAND_MAX_BBMS; i++) {
+ page = this->bbm_td->pages[0][i];
+ if (page)
+ /* read additional BBM data if available */
+ scan_read_raw (mtd, &buf_bbm[mtd->erasesize*i],
+ page << this->page_shift,
+ mtd->writesize);
+ else
+ break;
+ }
+ return 1;
+ }
+
+ /* Read the mirror version, if primary failed */
+ ret = scan_read_raw (mtd, buf_bbm,
+ this->bbm_md->pages[0][0] << this->page_shift,
+ mtd->writesize);
+ if (!ret) {
+ this->bbm_md->version[0] = buf_bbm[mtd->writesize + this->bbm_md->veroffs];
+ printk (KERN_DEBUG "Bad block map at page %d, version 0x%02X\n",
+ this->bbm_md->pages[0][0], this->bbm_md->version[0]);
+ /* Step in for multiple BBM block case */
+ for (i = 1; i < NAND_MAX_BBMS; i++) {
+ page = this->bbm_md->pages[0][i];
+ if (page)
+ /* read additional BBM data if available */
+ scan_read_raw (mtd, &buf_bbm[mtd->erasesize*i],
+ page << this->page_shift,
+ mtd->writesize);
+ else
+ break;
+ }
+ return 1;
+ }
+
+ return 0;
+#else
return 1;
+#endif /* CONFIG_MTD_NAND_BBM */
+
}

/*
@@ -456,7 +686,12 @@
* The bbt ident pattern resides in the oob area of the first page
* in a block.
*/
+#if defined(CONFIG_MTD_NAND_BBM)
+static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td,
+ struct nand_bbm_descr *bbm)
+#else
static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td)
+#endif
{
struct nand_chip *this = mtd->priv;
int i, chips;
@@ -464,6 +699,11 @@
int scanlen = mtd->writesize + mtd->oobsize;
int bbtblocks;
int blocktopage = this->bbt_erase_shift - this->page_shift;
+#if defined(CONFIG_MTD_NAND_BBM)
+ int bbt_found;
+ struct nand_bbt_descr *bbm_td = &bbt_descr;
+ int bbm_found, m_bbm_found, multi_bbm = 0;
+#endif

/* Search direction top -> down ? */
if (td->options & NAND_BBT_LASTBLOCK) {
@@ -487,6 +727,90 @@
/* Number of bits for each erase block in the bbt */
bits = td->options & NAND_BBT_NRBITS_MSK;

+#if defined(CONFIG_MTD_NAND_BBM)
+ /*
+ * check, if we need multiple bbm blocks.
+ * (2 bytes per block for storing bbm data)
+ */
+ if (bbtblocks > (mtd->erasesize >> 1))
+ multi_bbm = 1;
+
+ for (i = 0; i < chips; i++) {
+ /* Reset version information */
+ bbt_found = 0;
+ bbm_found = 0;
+ m_bbm_found = 0;
+ td->version[i] = 0;
+ td->pages[i] = -1;
+ bbm->version[i] = 0;
+ bbm->pages[i][0] = -1;
+ bbm->pages[i][1] = -1;
+
+ /* Scan the maximum number of blocks */
+ for (block = 0; block < td->maxblocks; block++) {
+
+ int actblock = startblock + dir * block;
+ loff_t offs = actblock << this->bbt_erase_shift;
+
+ /* Read first page */
+ scan_read_raw (mtd, buf, offs, mtd->writesize);
+ if (!bbt_found) {
+ if (!check_pattern(buf, scanlen, mtd->writesize, td)) {
+ td->pages[i] = actblock << blocktopage;
+ if (td->options & NAND_BBT_VERSION) {
+ td->version[i] =
+ buf[mtd->writesize + td->veroffs];
+ }
+ bbt_found = 1;
+ continue;
+ }
+ }
+ /* check for bbm */
+ if (!bbm_found) {
+ if (!strcmp(bbm->pattern, bbm_pattern))
+ bbm_td->pattern = bbm_pattern;
+ else
+ bbm_td->pattern = mirror_bbm_pat;
+
+ if (!check_pattern(buf, scanlen, mtd->writesize, bbm_td)) {
+ bbm->pages[i][0] = actblock << blocktopage;
+ if (bbm->options & NAND_BBT_VERSION) {
+ bbm->version[i] =
+ buf[mtd->writesize + bbm->veroffs];
+ }
+ bbm_found = 1;
+ continue;
+ }
+ }
+ /* check if multi bbm iis required */
+ if (!m_bbm_found) {
+ if (multi_bbm) {
+ if (!strcmp(bbm->pattern, bbm_pattern))
+ bbm_td->pattern = bbm_multi_pat;
+ else
+ bbm_td->pattern = mir_bbm_multi_pat;
+
+ if (!check_pattern(buf, scanlen, mtd->writesize, bbm_td)) {
+ bbm->pages[i][1] = actblock << blocktopage;
+ m_bbm_found = 1;
+ }
+ }
+ else {
+ bbm->pages[i][1] = 0;
+ m_bbm_found = 1;
+ }
+ }
+
+ /* found all bbt and bbm for one chip */
+ if (bbt_found && bbm_found && m_bbm_found) {
+ break;
+ }
+ }
+ startblock += this->chipsize >> this->bbt_erase_shift;
+ }
+
+#else /* !CONFIG_MTD_NAND_BBM */
+
for (i = 0; i < chips; i++) {
/* Reset version information */
td->version[i] = 0;
@@ -509,6 +833,8 @@
}
startblock += this->chipsize >> this->bbt_erase_shift;
}
+#endif /* CONFIG_MTD_NAND_BBM */
+
/* Check, if we found a bbt for each requested chip */
for (i = 0; i < chips; i++) {
if (td->pages[i] == -1)
@@ -517,6 +843,28 @@
printk(KERN_DEBUG "Bad block table found at page %d, version 0x%02X\n", td->pages[i],
td->version[i]);
}
+
+#if defined (CONFIG_MTD_NAND_BBM)
+ /* Check, if we found a bbm for each requested chip */
+ for (i = 0; i < chips; i++) {
+ if (bbm->pages[i][0] == -1)
+ printk (KERN_WARNING
+ "Bad block map not found for chip %d\n", i);
+ else {
+ printk (KERN_INFO
+ "Bad block map found at page %d, version 0x%02X\n",
+ bbm->pages[i][0], bbm->version[i]);
+ if (multi_bbm && bbm->pages[i][1] != -1)
+ printk (KERN_INFO
+ "multiple Bad block found at page %d, version 0x%02X\n",
+ bbm->pages[i][1], bbm->version[i]);
+ else
+ printk (KERN_WARNING
+ "multiple Bad block map not found for chip %d\n", i);
+ }
+ }
+#endif
+
return 0;
}

@@ -531,12 +879,23 @@
*/
static int search_read_bbts(struct mtd_info *mtd, uint8_t * buf, struct nand_bbt_descr *td, struct nand_bbt_descr *md)
{
+#if defined (CONFIG_MTD_NAND_BBM)
+ struct nand_chip *this = mtd->priv;
+
+ /* Search the primary table */
+ search_bbt (mtd, buf, td, this->bbm_td);
+
+ /* Search the mirror table */
+ if (md)
+ search_bbt (mtd, buf, md, this->bbm_md);
+#else
/* Search the primary table */
search_bbt(mtd, buf, td);

/* Search the mirror table */
if (md)
search_bbt(mtd, buf, md);
+#endif

/* Force result check */
return 1;
@@ -743,6 +1102,198 @@
return res;
}

+#if defined(CONFIG_MTD_NAND_BBM)
+
+/*
+ * Scan write data with oob to flash
+ */
+static int scan_write_bbm(struct mtd_info *mtd, loff_t offs, size_t len,
+ uint8_t *buf, uint8_t *oob)
+{
+ struct mtd_oob_ops ops;
+
+ ops.mode = MTD_OOB_PLACE;
+ ops.ooboffs = 0;
+ ops.ooblen = mtd->oobsize;
+ ops.datbuf = buf;
+ ops.oobbuf = oob;
+ ops.len = len;
+
+ return mtd->write_oob(mtd, offs, &ops);
+}
+
+/* this function is not inspected since it is only used for debug. */
+
+/**
+ * write_bbm - [GENERIC] (Re)write the bad block map
+ *
+ * @mtd: MTD device structure
+ * @buff: holds the memory versio nof BBM data
+ * @bbmd: descriptor for the bad block map (or mirrored)
+ * @chipsel: selector for a specific chip, -1 for all
+ *
+*/
+static int write_bbm (struct mtd_info *mtd, uint8_t *buff,
+ struct nand_bbm_descr *bbmd, int chipsel)
+{
+ struct nand_chip *this = mtd->priv;
+ struct erase_info einfo;
+ int i, j, res, multi_bbm = 0, chip = 0;
+ int startblock, dir, page, numblocks;
+ int nrchips;
+ uint8_t *tmpbuf;
+ uint16_t *bbmbuf;
+ size_t len, retlen, ooblen, totlen = mtd->size >> (this->bbt_erase_shift-1);
+ loff_t to;
+
+ /* Write bad block table per chip rather than per device ? */
+ if (bbmd->options & NAND_BBT_PERCHIP) {
+ numblocks = (int) (this->chipsize >> this->bbt_erase_shift);
+ /* Full device write or specific chip ? */
+ if (chipsel == -1) {
+ nrchips = this->numchips;
+ } else {
+ nrchips = chipsel + 1;
+ chip = chipsel;
+ }
+ } else {
+ numblocks = (int) (mtd->size >> this->bbt_erase_shift);
+ nrchips = 1;
+ }
+
+ /* calculate oobbuf length */
+ ooblen = mtd->oobsize * (mtd->erasesize/mtd->writesize);
+ tmpbuf = vmalloc(mtd->erasesize+ooblen);
+ if (!tmpbuf) {
+ printk (KERN_ERR "write_bbm: tmpbuf - Out of memory (size %d)\n",mtd->erasesize+ooblen);
+ return -ENOMEM;
+ }
+
+ /* Preset the tmpbuffer for 1st BBM */
+ memset (tmpbuf, 0xff, mtd->erasesize+ooblen);
+
+ /* Placed the BBM data into tmpbuf */
+ memcpy (tmpbuf, buff, mtd->size>>(this->bbt_erase_shift-1));
+
+ /* BBM Pattern is located in oob area of first page */
+ if (!strcmp(bbmd->pattern, bbm_pattern))
+ memcpy (&tmpbuf[mtd->erasesize+bbt_descr.offs], bbm_pattern, bbt_descr.len);
+ else
+ memcpy (&tmpbuf[mtd->erasesize+bbt_descr.offs], mirror_bbm_pat, bbt_descr.len);
+
+ tmpbuf[mtd->erasesize+bbt_descr.veroffs] = bbmd->version[chip];
+
+ /*
+ * check, if we need multiple bbm blocks.
+ * (2 bytes per block for storing bbm data)
+ */
+ if (numblocks > (mtd->erasesize >> 1))
+ multi_bbm = 1;
+
+ /* Loop through the chips */
+ for (; chip < nrchips; chip++) {
+ for (i = 0; i < NAND_MAX_BBMS; i++) {
+ /* check for multiple bbms */
+ if (i > 0) {
+ if (!multi_bbm)
+ break;
+ else {
+ /* Preset the tmpbuffer for multiple BBM */
+ memset (tmpbuf, 0xff, mtd->erasesize+ooblen);
+ memcpy (&tmpbuf[0], this->bbm+(mtd->erasesize>>1), mtd->erasesize);
+ if (!strcmp(bbmd->pattern, bbm_pattern))
+ memcpy (&tmpbuf[mtd->erasesize+bbt_descr.offs], bbm_multi_pat, bbt_descr.len);
+ else
+ memcpy (&tmpbuf[mtd->erasesize+bbt_descr.offs], mir_bbm_multi_pat, bbt_descr.len);
+
+ len = min((totlen-(mtd->erasesize<<(i-1))), mtd->erasesize);
+ }
+ }
+ else
+ len = min (totlen, (size_t)(1 << this->bbt_erase_shift));
+
+ /* There was already a version of the map, reuse the page
+ * This applies for absolute placement too, as we have the
+ * page nr. in bbmd->pages.
+ */
+ if (bbmd->pages[chip][i] != -1) {
+ page = bbmd->pages[chip][i];
+ goto write;
+ }
+
+ /* Automatic placement of the bad block table */
+ /* Search direction top -> down ? */
+ if (bbmd->options & NAND_BBT_LASTBLOCK) {
+ startblock = numblocks * (chip + 1) - 1;
+ dir = -1;
+ } else {
+ startblock = chip * numblocks;
+ dir = 1;
+ }
+
+ for (j = 0; j < bbmd->maxblocks; j++) {
+ int block = startblock + dir * j;
+ /* Check, if the block is bad */
+ switch ((this->bbt[block >> 2] >> (2 * (block & 0x03))) & 0x03) {
+ case 0x01: /* block worn-out */
+ case 0x03: /* factory bad block */
+ continue;
+ }
+ page = block << (this->bbt_erase_shift - this->page_shift);
+ /* Check, if the block is used by bbms and bbts */
+ if ( (this->bbm_td->pages[chip][0] != page) &&
+ (this->bbm_td->pages[chip][1] != page) &&
+ (this->bbm_md->pages[chip][0] != page) &&
+ (this->bbm_md->pages[chip][1] != page) &&
+ (this->bbt_td->pages[chip] != page) &&
+ (!this->bbt_md||this->bbt_md->pages[chip]!=page))
+ goto write;
+ }
+ printk (KERN_ERR "No space left to write bad block map\n");
+ return -ENOSPC;
+write:
+
+#ifdef CONFIG_MTD_NAND_BBM_DBG /* debugging the bbm data */
+ bbmbuf = (uint16_t *) tmpbuf;
+ for (j = 0; j < len/2; j++) {
+ if (bbmbuf[j] != 0xffff)
+ printk("bbm%d[%d]=%04x ", i ,j , bbmbuf[j]);
+ }
+ printk("\n");
+#endif
+ to = ((loff_t) page) << this->page_shift;
+
+ /* walk through the memory table */
+ memset (&einfo, 0, sizeof (einfo));
+ einfo.mtd = mtd;
+ einfo.addr = (unsigned long) to;
+ einfo.len = 1 << this->bbt_erase_shift;
+ res = nand_erase_nand (mtd, &einfo, 1);
+ if (res < 0) {
+ printk (KERN_WARNING "nand_bbm: Error during block erase: %d\n", res);
+ this->block_markbad(mtd, to);
+ return res;
+ }
+ res = scan_write_bbm(mtd, to, len, tmpbuf, &tmpbuf[mtd->erasesize]);
+ if (res < 0) {
+ printk (KERN_WARNING "nand_bbm: Error while writing bad block map %d\n", res);
+ return res;
+ }
+
+ printk (KERN_INFO "Bad block map written to 0x%08x, version 0x%02X, length %d\n",
+ (unsigned int) to, bbmd->version[chip], len);
+
+ /* Mark it as used */
+ bbmd->pages[chip][i] = page;
+ }
+ }
+
+ vfree(tmpbuf);
+ return 0;
+}
+
+#endif /* CONFIG_MTD_NAND_BBM */
+
/**
* nand_memory_bbt - [GENERIC] create a memory based bad block table
* @mtd: MTD device structure
@@ -875,6 +1426,134 @@
return 0;
}

+#if defined(CONFIG_MTD_NAND_BBM)
+/**
+ * check_bbm - [GENERIC] create and write bbm(s) if neccecary
+ * @mtd: MTD device structure
+ *
+ * The function checks the results of the previous call to read_bbt
+ * and creates / updates the bbm(s) if neccecary
+ * Creation is neccecary if no bbt was found for the chip/device
+ * Update is neccecary if one of the tables is missing or the
+ * version nr. of one table is less than the other
+*/
+static int check_bbm (struct mtd_info *mtd)
+{
+ int i, j, chips, writeops, chipsel, res=0, res2=0, rsvdblock_idx = 0;
+ struct nand_chip *this = mtd->priv;
+ struct nand_bbm_descr *td = this->bbm_td;
+ struct nand_bbm_descr *md = this->bbm_md;
+ struct nand_bbm_descr *rd, *rd2;
+
+ /* Do we have a bbt per chip ? */
+ if (td->options & NAND_BBT_PERCHIP)
+ chips = this->numchips;
+ else
+ chips = 1;
+
+ for (i = 0; i < chips; i++) {
+ writeops = 0;
+ rd = NULL;
+ rd2 = NULL;
+ /* Per chip or per device ? */
+ chipsel = (td->options & NAND_BBT_PERCHIP) ? i : -1;
+ /* Mirrored table available ? */
+ if (md) {
+#if defined(CONFIG_MTD_NAND_BBM_DBG)
+ /* don't have bbm and mirrored bbm
+ * need to create both */
+ if (td->pages[i][0] == -1 && md->pages[i][0] == -1) {
+ writeops = 0x03;
+ goto create;
+ }
+#endif
+ /* have mirrored bbm, don't have primary bbm
+ * use mirrored bbm to create primary bbm
+ */
+ if (td->pages[i][0] == -1) {
+ rd = md;
+ td->version[i] = md->version[i];
+ writeops = 1;
+ goto writecheck;
+ }
+ /* have primary bbm, don't have mirrored bbm
+ * use primary bbm to create mirrored bbm
+ */
+ if (md->pages[i][0] == -1) {
+ rd = td;
+ md->version[i] = td->version[i];
+ writeops = 2;
+ goto writecheck;
+ }
+
+ /* both primary and mirrored bbm exist
+ * vesrion matched
+ */
+ if (td->version[i] == md->version[i]) {
+ rd = td;
+ if (!(td->options & NAND_BBT_VERSION))
+ rd2 = md;
+ goto writecheck; /*check only */
+ }
+
+ /* primary and mirrored bbm version not match */
+ if (((int8_t) (td->version[i] - md->version[i])) > 0) {
+ /* update mirrored with primary bbm */
+ rd = td;
+ md->version[i] = td->version[i];
+ writeops = 2;
+ } else { /* update primary with mirrored bbm */
+ rd = md;
+ td->version[i] = md->version[i];
+ writeops = 1;
+ }
+
+ goto writecheck;
+
+ } else { /* only care for primary bbm */
+ if (td->pages[i][0] == -1) {
+ writeops = 0x01;
+ goto create;
+ }
+ rd = td;
+ goto writecheck;
+ }
+create:
+ /* Create the bbm map in memory by reading the bbt table */
+ for (j = 0; j<mtd->size>>this->bbt_erase_shift; j++) {
+ if (nand_isbad_bbt (mtd, j<<this->phys_erase_shift, 0)) {
+ printk(KERN_INFO "Bad block mapping: bbm[%d] = %d\n",
+ j, rsvdblock_idx);
+ this->bbm[j]=rsvdblock_idx++;
+ }
+ }
+
+ td->version[i] = 1;
+ if (md)
+ md->version[i] = 1;
+writecheck:
+ /* read back first ? */
+ if (rd)
+ read_bbm (mtd, (uint8_t*)this->bbm, rd, chipsel);
+ /* If they weren't versioned, read both. */
+ if (rd2)
+ read_bbm (mtd, (uint8_t*)this->bbm, rd2, chipsel);
+
+ /* Write the bad block map to the device ? */
+ if (writeops & 0x01)
+ res = write_bbm (mtd, (uint8_t*)this->bbm, td, chipsel);
+
+ /* Write the mirror bad block map to the device ? */
+ if (writeops & 0x02) {
+ res2 = write_bbm (mtd, (uint8_t*)this->bbm, md, chipsel);
+ if (res2 < 0)
+ return res2;
+ }
+ }
+ return res;
+}
+#endif /* CONFIG_MTD_NAND_BBM */
+
/**
* mark_bbt_regions - [GENERIC] mark the bad block table regions
* @mtd: MTD device structure
@@ -965,6 +1644,19 @@
return -ENOMEM;
}

+#if defined (CONFIG_MTD_NAND_BBM)
+ /* Allocate memory for Bad Block Map (2 bytes per block) */
+ len = mtd->size >> (this->bbt_erase_shift-1);
+ this->bbm = kmalloc (len, GFP_KERNEL);
+ if (!this->bbm) {
+ printk (KERN_ERR "nand_scan_bbt: bbm - Out of memory\n");
+ kfree (this->bbt);
+ this->bbt = NULL;
+ return -ENOMEM;
+ }
+ /* initializing bb map */
+ memset (this->bbm, 0xff, len);
+#endif
/* If no primary table decriptor is given, scan the device
* to build a memory based bad block table
*/
@@ -973,6 +1665,11 @@
printk(KERN_ERR "nand_bbt: Can't scan flash and build the RAM-based BBT\n");
kfree(this->bbt);
this->bbt = NULL;
+
+#if defined (CONFIG_MTD_NAND_BBM)
+ kfree(this->bbm);
+ this->bbm = NULL;
+#endif
}
return res;
}
@@ -985,6 +1682,10 @@
printk(KERN_ERR "nand_bbt: Out of memory\n");
kfree(this->bbt);
this->bbt = NULL;
+#if defined (CONFIG_MTD_NAND_BBM)
+ kfree (this->bbm);
+ this->bbm = NULL;
+#endif
return -ENOMEM;
}

@@ -999,6 +1700,12 @@
if (res)
res = check_create(mtd, buf, bd);

+#if defined (CONFIG_MTD_NAND_BBM)
+ if (!res)
+ /* check bbm if we have valid bbts */
+ res = check_bbm (mtd);
+#endif
+
/* Prevent the bbt regions from erasing / writing */
mark_bbt_region(mtd, td);
if (md)
@@ -1031,7 +1738,11 @@
/* Allocate a temporary buffer for one eraseblock incl. oob */
len = (1 << this->bbt_erase_shift);
len += (len >> this->page_shift) * mtd->oobsize;
+#ifdef CONFIG_MTD_NAND_BBM
+ buf = vmalloc (len);
+#else
buf = kmalloc(len, GFP_KERNEL);
+#endif
if (!buf) {
printk(KERN_ERR "nand_update_bbt: Out of memory\n");
return -ENOMEM;
@@ -1064,7 +1775,12 @@
}

out:
+#ifdef CONFIG_MTD_NAND_BBM
+ vfree(buf);
+#else
kfree(buf);
+#endif
+
return res;
}

@@ -1120,7 +1836,11 @@
.offs = 8,
.len = 4,
.veroffs = 12,
+#if defined(CONFIG_MTD_NAND_BBM)
+ .maxblocks = 8,
+#else
.maxblocks = 4,
+#endif
.pattern = bbt_pattern
};

@@ -1130,10 +1850,34 @@
.offs = 8,
.len = 4,
.veroffs = 12,
+#if defined(CONFIG_MTD_NAND_BBM)
+ .maxblocks = 8,
+#else
.maxblocks = 4,
+#endif
.pattern = mirror_pattern
};

+#if defined(CONFIG_MTD_NAND_BBM)
+static struct nand_bbm_descr bbm_main_descr = {
+ .options = NAND_BBT_LASTBLOCK | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+ .offs = 8,
+ .len = 4,
+ .veroffs = 12,
+ .maxblocks = 4,
+ .pattern = bbm_pattern
+};
+
+static struct nand_bbm_descr bbm_mirror_descr = {
+ .options = NAND_BBT_LASTBLOCK | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
+ .offs = 8,
+ .len = 4,
+ .veroffs = 12,
+ .maxblocks = 4,
+ .pattern = mirror_bbm_pat
+};
+#endif /* CONFIG_MTD_NAND_BBM */
+
/**
* nand_default_bbt - [NAND Interface] Select a default bad block table for the device
* @mtd: MTD device structure
@@ -1159,6 +1903,12 @@
this->bbt_td = &bbt_main_descr;
this->bbt_md = &bbt_mirror_descr;
}
+#if defined(CONFIG_MTD_NAND_BBM)
+ if (!this->bbm_td) {
+ this->bbm_td = &bbm_main_descr;
+ this->bbm_md = &bbm_mirror_descr;
+ }
+#endif
this->options |= NAND_USE_FLASH_BBT;
return nand_scan_bbt(mtd, &agand_flashbased);
}
@@ -1170,6 +1920,12 @@
this->bbt_td = &bbt_main_descr;
this->bbt_md = &bbt_mirror_descr;
}
+#if defined(CONFIG_MTD_NAND_BBM)
+ if (!this->bbm_td) {
+ this->bbm_td = &bbm_main_descr;
+ this->bbm_md = &bbm_mirror_descr;
+ }
+#endif
if (!this->badblock_pattern) {
this->badblock_pattern = (mtd->writesize > 512) ? &largepage_flashbased : &smallpage_flashbased;
}
diff -urN a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
--- a/include/linux/mtd/mtd.h 2008-08-21 02:19:27.000000000 -0500
+++ b/include/linux/mtd/mtd.h 2008-08-25 01:26:06.000000000 -0500
@@ -1,7 +1,12 @@
/*
+ * Copyright 2006 Motorola, Inc.
* Copyright © 1999-2003 David Woodhouse <dwmw2 at infradead.org> et al.
*
* Released under GPL
+ *
+ * ChangeLog:
+ * (mm-dd-yyyy) Author Comment
+ * 10-20-2006 Motorola feature CONFIG_MTD_NAND_BBM added.
*/

#ifndef __MTD_MTD_H__
@@ -200,6 +205,10 @@
/* Bad block management functions */
int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
+#ifdef CONFIG_MTD_NAND_BBM
+ /* get block replacement from reserve pool */
+ int (*block_replace) (struct mtd_info *mtd, loff_t ofs, int lock);
+#endif

struct notifier_block reboot_notifier; /* default mode before reboot */

diff -urN a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
--- a/include/linux/mtd/nand.h 2008-08-21 02:19:35.000000000 -0500
+++ b/include/linux/mtd/nand.h 2008-08-21 02:28:19.000000000 -0500
@@ -1,6 +1,7 @@
/*
* linux/include/linux/mtd/nand.h
*
+ * Copyright © 2005 Motorola, Inc.
* Copyright © 2000 David Woodhouse <dwmw2 at infradead.org>
* Steven J. Hill <sjhill at realitydiluted.com>
* Thomas Gleixner <tglx at linutronix.de>
@@ -14,6 +15,11 @@
*
* Changelog:
* See git changelog.
+ *
+ * 05-06-2005 Motorola implemented CONFIG_MTD_NAND_BBM feature.
+ * added new attributes to nand_chip structure, and added new
+ * nand_bbm_descr structure to support bad block management
+ *
*/
#ifndef __LINUX_MTD_NAND_H
#define __LINUX_MTD_NAND_H
@@ -39,6 +45,13 @@
/* The maximum number of NAND chips in an array */
#define NAND_MAX_CHIPS 8

+#if defined(CONFIG_MTD_NAND_BBM)
+extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from,
+ size_t len, size_t ooblen);
+/* The maximum number of BB map blocks per chip in an array */
+#define NAND_MAX_BBMS 2
+#endif
+
/* This constant declares the max. oobsize / page, which
* is supported now. If you add a chip with bigger oobsize/page
* adjust this accordingly.
@@ -359,6 +372,9 @@
* @bbt: [INTERN] bad block table pointer
* @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup
* @bbt_md: [REPLACEABLE] bad block table mirror descriptor
+ * @bbm: [INTERN] bad block map pointer
+ * @bbm_td: [REPLACEABLE] bad block map descriptor for flash lookup
+ * @bbm_md: [REPLACEABLE] bad block map mirror descriptor
* @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan
* @controller: [REPLACEABLE] a pointer to a hardware controller structure
* which is shared among multiple independend devices
@@ -421,6 +437,11 @@
uint8_t *bbt;
struct nand_bbt_descr *bbt_td;
struct nand_bbt_descr *bbt_md;
+#ifdef CONFIG_MTD_NAND_BBM
+ uint16_t *bbm;
+ struct nand_bbm_descr *bbm_td;
+ struct nand_bbm_descr *bbm_md;
+#endif

struct nand_bbt_descr *badblock_pattern;

@@ -509,6 +530,42 @@
uint8_t *pattern;
};

+#ifdef CONFIG_MTD_NAND_BBM
+/**
+ * struct nand_bbm_descr - bad block map descriptor
+ * @options: options for this descriptor
+ * @pages: the page(s) where we find the bbm, used with option BBT_ABSPAGE
+ * when bbm is searched, then we store the found bbms pages here.
+ * Its a two dimensions array and supports up 2 bbm blocks for each chip
+ and up to 8 chips now
+ * @offs: offset of the pattern in the oob area of the page
+ * @veroffs: offset of the bbm version counter in the oob are of the page
+ * @version: version read from the bbt page during scan
+ * @len: length of the pattern, if 0 no pattern check is performed
+ * @maxblocks: maximum number of blocks to search for a bbm. This number of
+ * blocks is reserved at the end of the device where the tables are
+ * written.
+ * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than
+ * bad) block in the stored bbt
+ * @pattern: pattern to identify bad block map.
+ *
+ * Descriptor for the bad block map marker and the descriptor for the
+ * pattern which identifies bad blocks map. The assumption is made
+ * that the pattern and the version count are always located in the oob area
+ * of the first block.
+ */
+struct nand_bbm_descr {
+ int options;
+ int pages[NAND_MAX_CHIPS][NAND_MAX_BBMS];
+ int offs;
+ int veroffs;
+ uint8_t version[NAND_MAX_CHIPS];
+ int len;
+ int maxblocks;
+ int reserved_block_code;
+ uint8_t *pattern;
+};
+#endif
/* Options for the bad block table descriptors */

/* The number of bits used per block in the bbt on the device */
[close]
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 3.9.2016, 18:55


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(fill.sa @ Сегодня, 22:16)
* Еще патч один, про битые сектора nand

И? Что ты хочешь сделать, копаясь в исходниках ядра?

Цитата
This patch implements "reserve block method" on Motorola's SCUM-A11 platform mobile devices.


Этот патч уже есть в исходниках ядра ZN5: https://github.com/GodFox/magx_kernel_xpixl

https://github.com/GodFox/magx_kernel_xpixl...nand/nand_bbt.c

Разраб по твоей ссылке просит наоборот, интегрировать эту функциональность из ядра ZN5 в ядро Linux.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
VINRARUS
сообщение 3.9.2016, 18:57


Термоядерный
********

Группа: Пользователи
Сообщений: 3 496
Регистрация: 12.12.2009
Из: Чорнобиль
Пользователь №: 211 044
Модель телефона: WX160 & L7 & Z6 & ZN5-128
Прошивка: 740 MHz: Z6 and ZN5


Настроение:
youtu.be/A_yQLYLiSGQ



Рейтинг: 1211



Цитата(EXL @ Сегодня, 21:55)
* Разраб по твоей ссылке просит наоборот, интегрировать эту функциональность из ядра ZN5 в ядро Linux.

laugh.gif
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 3.9.2016, 20:04


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



EXL,
Сори, не знал. Мой инглишь веьсма плох ))

З.Ы. может несовсем по теме и может уже это знают. Но оставлю пока тут, если чего - пишите удалю.
название
v1.00
XXXXXXXX

Motorola resource file format 1.00

Brought to you by Beijing Motorola. Nimen Hao!

Motorola is not liable for any damage resulting use of the information
below.

We nerdy engineers (and groovy UI designers) would love for you to create
luscious skins for our humble phones. To help you, there is enough info
below for a C or C++ programmer to write tools to read and write these
resource files.

Good luck!

The first 24 bytes must match the following format:
motoskin\n\nv1.00\nXXXXXXXX
replace the Xs above with an 8-byte hex offset of the start block.

Between this header and the start block is a \n-terminated list of
resource IDs used by the hash table.

IDs for images end in .g, and IDs for sounds end in .a

struct startBlock
{
unsigned check; // 0xABCDDCBA
unsigned IDTableOffset;
unsigned nHashTableEntries;
unsigned hashTableOffset;
unsigned dataOffset;
};

struct hashTableEntry
{
unsigned hashedID;
unsigned IDOffset;
unsigned dataOffset;
};

Note: the start block and first entry of the hash table MUST be aligned
on a 4-byte boundary. If they aren't we don't load the file.

hashing function: (taken from usenet--thanks David Hanley!)

int hashVal(char *c)
{
int hv=0;
while (*c)
{
hv=(hv<<1)^(hv>>20)^*(c++);
}

return hv;
}

After the hash table is the binary resource data. The first four
bytes are check bytes and should be 0xDCBAABCD. The next four bytes
are the size of the data, not inclusive of the four bytes. The rest
is the data.

ID table:
[close]


Сообщение отредактировал fill.sa - 3.9.2016, 20:08
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 3.9.2016, 21:05


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(fill.sa @ Сегодня, 2:04)
* Сори, не знал. Мой инглишь веьсма плох ))


Я просто не понимаю, что ты хочешь сделать, копаясь в исходниках ядра. По-моему, из него было выжато вообще всё возможное, swap, z-ram, разгон, отключение всяких проверок от Motorola и прочее и прочее.

Цитата(fill.sa @ Сегодня, 2:04)
* З.Ы. может несовсем по теме и может уже это знают. Но оставлю пока тут, если чего - пишите удалю.


А где ты это нашёл?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 4.9.2016, 17:21


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(EXL @ 3.9.2016, 22:05) *

Цитата(fill.sa @ Сегодня, 2:04)
* Сори, не знал. Мой инглишь веьсма плох ))


Я просто не понимаю, что ты хочешь сделать, копаясь в исходниках ядра. По-моему, из него было выжато вообще всё возможное, swap, z-ram, разгон, отключение всяких проверок от Motorola и прочее и прочее.



Ну вообще в начале я хотел понять чем вообще отличаются между собой прошивки, особенно зная что производители от версии к версии могут могут добавлять разные фичи по защите, которые реальному пользователю наоборот не нужны. В итоге выяснилось что ядра у зины вообще одинаковые, отличаются только у инжинерных 10I и 7fr, ну и между собой 64 и 128 версии.
Тем неменее в ядрах есть чего еще покопать, хотябы таже скорость по усб как на 7fr ядре, да и какую либо полезную фичу перенести в ядро зины.

Добавлено позже (4.9.2016, 18:25):
Цитата(EXL @ 3.9.2016, 22:05) *


Цитата(fill.sa @ Сегодня, 2:04)
* З.Ы. может несовсем по теме и может уже это знают. Но оставлю пока тут, если чего - пишите удалю.


А где ты это нашёл?


В мотороловских файлах откопал.

EXL: В каких именно файлах?

Сообщение отредактировал EXL - 4.9.2016, 21:19
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
VINRARUS
сообщение 4.9.2016, 17:26


Термоядерный
********

Группа: Пользователи
Сообщений: 3 496
Регистрация: 12.12.2009
Из: Чорнобиль
Пользователь №: 211 044
Модель телефона: WX160 & L7 & Z6 & ZN5-128
Прошивка: 740 MHz: Z6 and ZN5


Настроение:
youtu.be/A_yQLYLiSGQ



Рейтинг: 1211



Цитата(fill.sa @ Сегодня, 20:21)
* да и какую либо полезную фичу перенести в ядро зины.

Попробуй повысить скорость работы с флешкой, а то на клас10 совсем не жвачка.
Прикрепленное изображение
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 28.9.2016, 16:06


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



CONFIG_MOT_FEAT_POWERUP_LOGO отключает логотип при старте, к сожалению вывода загрузки на экран непроисходит, даже если в настройках ядра console-ttmyxc2, просто черный экран.
Добавлено позже [color=#FF0000]
Хотите такое?
Прикрепленное изображение
хотя консоль читаемая
Прикрепленное изображение
Это CONFIG_MOT_FEAT_LANDSKAPE_IMODULES проще говоря горизонтальное расположение экрана.
нужен для E8 т.к там повернутый экран. Параметр зависит от CONFIG_FB_MXC_SANYO_QVGA_PANEL и CONFIG_FB_MXC_SHARP_QVGA_PANEL т.к применялись экраны SANYO и SHARP

Сообщение отредактировал fill.sa - 2.10.2016, 6:44
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 1.10.2016, 14:15


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



А вот это интересно CONFIG_FB_MXC_VGA_PANEL
поддержка VGA экрана NEC 640х480 , неу ж то планировали такой запихать?

Добавлено позже (1.10.2016, 15:44):
Ура, я наконец вывел на экран процесс загрузки.
можно будет отлаживать не стартующие телефоны.

Прикрепленное изображение

к сожалению есть ограничения, после анимации , сам гуи так и не появился.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 2.10.2016, 6:32


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(fill.sa @ 28.9.2016, 22:06)
* хотя консоль читаемая


Это фреймбуфферная консолька или сторонняя cmd?

Цитата(fill.sa @ Вчера, 20:15)
* поддержка VGA экрана NEC 640х480 , неу ж то планировали такой запихать?


Всё просто: к референсной плате scma11ref подрубали всякое разное железо, в том числе и дисплей от NEC. Это вряд ли должно было пойти в релиз, возможно это даже задумывалось и не телефоном вовсе.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 2.10.2016, 6:40


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(EXL @ 2.10.2016, 7:32) *

Цитата(fill.sa @ 28.9.2016, 22:06)
* хотя консоль читаемая


Это фреймбуфферная консолька или сторонняя cmd?


На первой фотке это стороняя, А в следующем сообщении уже фреймбуфферная, т.е. тел в таком виде стартует вместо логотипа М.
Вернее М горит 2сек пока загрузчик работает, а потом когда пошла система секунду чернй экран(видимо ядро только начинает старт) и погнала консоль.

Но когда стартует гуи, мы попрежнему видим консоль и то как что туда гуи отсылает. Ну и ввести что-то свое тоже нельзя, просто наблюдать, хотя тут еще есть идея.

З.Ы. теперь понятно куда почему тел не так быстро стартует, около 2сек тупо загрузчик грузится

Сообщение отредактировал fill.sa - 2.10.2016, 7:11
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
Unreal_man
сообщение 2.10.2016, 6:54


Гуру
******

Группа: Разработчики
Сообщений: 732
Регистрация: 16.12.2009
Из: Другого Края Земли
Пользователь №: 211 211
Модель телефона: Motorola Moto Z Play


Настроение:
:-I



Рейтинг: 607



А можно узнать на какой частоте загружается тел? Может там по дефолту на 133 грузится. И в какой момент апмд врубается? Может можно это контролировать? Если будет 740, то и грузиться будет быстрее?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 2.10.2016, 6:59


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(Unreal_man @ 2.10.2016, 7:54) *

А можно узнать на какой частоте загружается тел? Может там по дефолту на 133 грузится. И в какой момент апмд врубается? Может можно это контролировать? Если будет 740, то и грузиться будет быстрее?

Тел грузится с максимальной частотой пока не подхватится apmd. А он уже в каждом моде по свойму.
И фишка в том что при таком мощном старте в 740 пол батареи уже сядит. Нужно вам такое?

Добавлено позже (2.10.2016, 9:03):
Выкладываю описание функций которые можно включить в конфиге соборки ядра.
Жаль только что все на инглише.

Осторожно, очень много текста!


MOT_FEAT_RAW_I2C_API "enable raw i2c r/w interface"
help

This setting configures i2c raw read/write interface enable/disable
[close]


MOT_FEAT_I2C_BLK_SUSPEND "Block suspend when I2C transaction is in progress"
help

This setting will block suspend when I2C transaction is in progress and also keep clock gating on when the phone is awake.
[close]


MOT_FEAT_BRDREV "Board Revision Feature"
help

Motorola supports a board revision feature that provides dynamic access to the board revision. Code can dynamically be targeted to specific revisions of the board.
[close]


MOT_FEAT_BOOTINFO "Boot Information Feature"
help

This feature provides access to certain boot information from both kernel context (via function call) and user context (via /proc/bootinfo).
[close]


MOT_FEAT_RF_PYTHON "Support Freescale Python Chipset"
help

Set this option if the phone is using the Python RF chip from Freescale.
[close]


MOT_FEAT_DOWN_TIMEOUT "down timeout services"
help

This enables semaphore down services with timeout parameter.
[close]


MOT_FEAT_POWERUP_LOGO "Powerup LOGO Feature"
Зависит от MOT_FEAT_BOOTINFO
help

This feature enables exposing IPU/GPU related information that MBM provides during boot.
[close]


MOT_FEAT_DEVICE_TREE "Builds hardware configuration device tree during bootup."
Зависит от MOT_FEAT_BOOTINFO
help

This feature enables building of the hardware configuration tree at bottup based on a serialized device tree provided by the platform phone build and possibly modified by the bootloader. This feature also provides APIs for creating, modifying, and deleting nodes and properties in the device tree.
[close]


MOT_FEAT_POWERUP_REASON_EZX_COMPAT "EZX Compatibility Powerup Reason Feature"
Зависит от MOT_FEAT_BOOTINFO
help

This feature enables EzX compatibility access to the powerup reason that is provided during boot. This access occurs through the /proc/powerup_info interface. Use of this feature is deprecated. Use MOT_FEAT_BOOTINFO instead.
[close]


MOT_FEAT_MTD_FS "Motorola specific MTD/file system support "
Зависит от MTD
help

This flag controls for Motorola specific changes made in the MTD driver and file system areas.
[close]


MOT_FEAT_LPNAND_SUPPORT "MTD NAND Large Page (2K) Support "
Зависит от MTD_NAND_MXC
help

This feature is adding the capability to support large page (2K) NAND chip into the mxc_nd lower level board driver. With this feature turned on both small page (512B) and large page (2K) are supported by mxc_nd borad driver.
[close]


MOT_FEAT_NAND_AUTO_DETECT "MTD NAND Chip type Auto-detection support "
Зависит от MTD_NAND_MXC
help

This feature automatically detects the on-board NAND chip_type, manufacturer_id chip_id and chip capacity; it automatically sets the appropriate NFC clock rate based on chip_id and manufacturer_id.
[close]


###choice###
prompt "Framebuffer pixel packing format"
Зависит от FB_MXC
default MOT_FEAT_FB_MXC_BGR

MOT_FEAT_FB_MXC_RGB "RGB format"

MOT_FEAT_FB_MXC_BGR "BGR format"
###endchoice###

MOT_FEAT_IPU_BGRA6666 "BGR pixel packing"
Зависит от MOT_FEAT_FB_MXC_BGR && FB_MXC_24BPP
help

This feature enables the compile-time selection of BGRA6666 (Blue-Green-Red-Alpha) pixel packing format. The default MontaVista kernel comes with BGR24 format by default. But MME applications require this format which allows the use of local alpha set with each graphics pixel.
[close]


MOT_FEAT_EMULATED_CLI "Secondary CLI display on main LCD"
help

This feature enables an emulated CLI display, which displays its contents on the main display instead of a physical CLI display.
[close]


MOT_FEAT_IPU_PF_PERM666 "set MXC MPEG4/H.264 Post Filter Driver permission to rw-rw-rw-"
Зависит от MXC_IPU_PF
help

Driver for MPEG4 dering and deblock and H.264 deblock using MXC IPU h/w with permision rw-rw-rw-. Default permission to this driver is rw-r--r--.
[close]


MOT_FEAT_DISABLE_SW_CURSOR "Disable software cursor"
help

This feature is to disable software cursor flashing on the fb console.
[close]


MOT_FEAT_SYSREBOOT "Use alternative reboot mechanisms"
help

Use a method other than the watchdog to implement rebooting.
[close]

###choice###
prompt "Reboot Mechanism"
Зависит от MOT_FEAT_SYSREBOOT
default MOT_FEAT_SYSREBOOT_CRM

MOT_FEAT_SYSREBOOT_CRM "warm reset from clock reset module"
help

This feature causes a warm reset using the CRM_AP_AMCR register (SW_AP) rather than using the WDOG register
[close]


MOT_FEAT_SYSREBOOT_ATLAS "reboot using the Atlas alaram clock"
help

This implements rebooting by setting an Atlas RTC alarm to wake the phone up two seconds after powering down.
[close]

###endchoice###

MOT_FIX_ASCENSION "Ascension HW bug"
help

The Ascension HW has incorrect display interface to the main display. As compared to the MXC91231 reference hardware, the difference is that blue and red lines are swapped.
[close]


MOT_FEAT_IPU_MEM_ADDR "IPU memory allocation address"
help

This feature dynamically determines at boot time how much memory is allocated to the kernel, and reserves space immediately after the kernel for the IPU framebuffer.
[close]


MOT_FEAT_IPU_IOCTL "IPU ioctl definition relocation"
help

This feature relocates all nonstandard ioctl definitions into Motorola and architecture specific header files.
[close]


MOT_FEAT_FB_PANIC_TEXT "Draw a panic string on the display"
Зависит от FRAMEBUFFER_CONSOLE
help

This feature causes a panic string to be drawn to the display upon either kernel panic or user ioctl.
[close]


MOT_FEAT_IPU_IOCTL_EZX_COMPAT "IPU ioctl compatibility with EzX PXAFB driver"
Зависит от MOT_FEAT_IPU_IOCTL
help

This feature provides minimal EzX PXAFB ioctl compatibility to support parts of the PXAFB API. The use of this feature is deprecated and is not fully implemented. If unsure, say no.
[close]


MOT_FEAT_ACTIVE_AND_LOW_POWER_INTERVAL_TIMERS 'EZX RTC Stopwatch support'
Зависит от ARCH_MXC91331 || ARCH_MXC91321 || ARCH_MXC91231 || ARCH_MXC91131
help

This flag controls Motorola changes that allow user space applications to set timers that will expire in active and low power modes, waking the system up if necessary.
[close]


MOT_FEAT_PRINTK_TIMES "Motorola specific printk timing information"
help

This flag controls Motorola specific changes made to printk.c and others, needed to output timing information with each printk message.
[close]


MOT_FEAT_ADVANCED_DEBUG "Enable advanced debugging features"
help

This feature adds advanced debugging capabilities such as memory dump and panic on oops
[close]

#############################"Advanced Debugging Options"#############################
Зависит от MOT_FEAT_ADVANCED_DEBUG

MOT_FEAT_KPANIC "Panic dump to flash support"
Зависит от MOT_FEAT_OTP_EFUSE
help

This flag controls Motorola specific changes that allows the printk buffer to be written out to a dedicated kpanic flash partition, whenever the kernel panics.
[close]


MOT_FEAT_DEBUG_WDOG "Enable saving debug information on watchdog timeout"
help

This feature enables saving extra debug information when the system fails to service watchdogs and reset.
[close]


MOT_FEAT_MEMDUMP "Enable memory dump to mass storage partition on panic"
Зависит от MOT_FEAT_KPANIC
help

This feature enables dumping the content of main memory to the mass storage partition when kernel panics. It is also recommended to enable DEBUG_ERRORS. In addition to saying y to this option, you need to include "memdump=/dev/mtdblock/dump_partition_name" in the boot command line to make it work. Make sure no user-space program tries to fsck or format the partition on boot.
[close]


MOT_FEAT_TEST_PANIC "Enable the test panic capability"
help

If enabled, the kernel can be made to panic by echo 1 > /proc/sys/kernel/cause_panic. This is useful when testing the memory dump feature.
[close]


MOT_FEAT_PANIC_ON_OOPS "Panic on oops"
help

If enabled, kernel will panic on oops
[close]


MOT_FEAT_PANIC_ON_SCHED_ATOMIC "Panic on scheduling while atomic"
help

If enabled, kernel will panic on the scheduling while atomic conditions
[close]


MOT_FEAT_WDOG_CLEANUP "Motorola Wdog Code clean up"
help

This flag controls the code clean up for Wdog, in oreder to make it readable.
[close]


MOT_FEAT_WDOG1_ENABLE "If the MBM haven't enable the WDog1 we will enable it using 32s timeout."
Зависит от MOT_FEAT_WDOG_CLEANUP
help

If the MBM haven't enable the WDog1 we will enable it using 32s timeout.
[close]

#######################################################################################



MOT_FEAT_MODEM_RELAY "Modem Relay Line Discipline"
help

By setting this flag, modem relay line discipline number is added.
[close]


MOT_KEYPAD "Motorola Internal Keypad Driver"
Зависит от (ARCH_MXC91331 || ARCH_MXC91321 || ARCH_MXC91231 || ARCH_MXC91131) && VT
help

This is the Keypad driver for Motorola phones
[close]


MOT_FEAT_FLIP "Motorola Keypad Driver supports FLIP"
help

This is on if the phone has a flip.
[close]


MOT_FEAT_SLIDER "Motorola Keypad Driver supports SLIDER"
help

This is on if the phone is a slider.
[close]


MOT_FEAT_CANDYBAR "Motorola MPM Driver supports CANDYBAR"
help

This is on if the phone is a candybar.
[close]


MOT_FEAT_PPP_EZX_COMPAT "EzX Compatibility for PPP"
help

Motorola supports the following changes to how PPP is supported: PPPIOCGIDLE is implemented in ppp_async.c
[close]


MOT_FEAT_SLABFREE_PROC "Enables /proc/slabfree entry"
help

The EZX support library "libezxappbase-x86-r.so" requires a proc filesystem entry named "slabfree" that contains an estimate of the amount of freeable memory held in the slab cache.
[close]


MOT_FEAT_MXC_IPC_SDMA_STATS "IPC SDMA RX/TX statistics"
Зависит от MXC_SDMA_API
help

By setting this flag you are able to view send and receive statistics over IPC SDMA channels, through the /proc interface.
[close]


MOT_FEAT_APP_DUMP "AP Application Core Dump"
Зависит от MOT_FEAT_OTP_EFUSE
help

By enabling this feature, the customized AP application core dump can be captured, for debugging purposes.
[close]


MOT_FEAT_PM "Motorola Power Management changes"
Зависит от PM
help

This flag controls Motorola specific Power Management changes.
[close]


MOT_FEAT_PM_DESENSE "Motorola Power Management Desense changes"
Зависит от MOT_FEAT_PM
help

This flag controls Motorola specific Power Management Desense changes.
[close]


MOT_FEAT_PM_BUTE "Porting PMDaemon for Bute"
Зависит от ARCH_MXC91321 && PM
help

This feature implements a temporary fix that is intended to be removed in the future. It provides capabilities that Freescale has not implemented yet. When they do, then we will accept the FSL changes and remove this feature.
[close]


MOT_FEAT_PM_STATS "Motorola Power Management statistics collection"
Зависит от MOT_FEAT_PM
help

This flag controls Motorola specific changes for statistics collection for Power Management.
[close]


MOT_FEAT_PM_DEVICE_SUSPEND_DEBUG "Motorola Power Management device suspend debugging"
Зависит от MOT_FEAT_PM
help

This flag controls Motorola specific changes for debugging of the device suspend sequence for Power Management.
[close]


PROFILER "Profiler support"

MOT_FEAT_SET_MAC "Workaround for the factory not setting the Ethernet MAC address."
help

The factory does not programm the EEPROM on wingboards to set the Ethernet MAC address. This feature writes a MAC address based upon the processor unique ID to EEPROM, thus enabling the use of the Ethernet interface on the board.
[close]


MOT_FEAT_NAND_RDDIST "MTD NAND read disturb detection and recovery feature."
Зависит от MTD_NAND_BBM
help

This feature is for the MTD NAND driver working with NAND watchdog daemon to detect and fix any potential read disturb blocks.
[close]


MOT_FEAT_MTD_AUTO_BBM "MTD NAND automatically bad block replacement feature."
Зависит от MTD_NAND_BBM
help

This feature implements the automatically bad block replacement functionality at block device layer, also provides the capability for the MTD applications and upper layer filesystem to do the bad block replacement.
[close]


MOT_FEAT_NAND_BLKCNT_TEST "MTD NAND block iaccess count test feature."
Зависит от MOT_FEAT_NAND_RDDIST
help

This feature privides the capabilities for the user to get the NAND flash block access matrix (block read|write|erase count for every block on the flash chip) through the extra ioctl APIs provided by this feature.
[close]


MOT_FEAT_NANDECC_TEST "MTD NAND ECC test"
help

This NAND ECC test feature privides the capability and the tool for user to inject 1 bit or 2 bit ECC error on slected MTD NAND partition and block number through the ioctl - MEMSETOOBSEL.
[close]


MOT_FEAT_SO_BINDTODEVICE_EZX_COMPAT "Bring the sock_setsockopt SO_BINDTODEVICE option up to EZX compatibility"
help

In EZX, unprivledged users can bind sockets to a particular device. We have replicated this functionality in our code.
[close]


MOT_FEAT_MU_TEST "MXC MU driver code for testing purposes only"
help

In order to test the MU driver, an IOCtl was added to allow the simulation of a BP. The code should not be included under any circumstances other than testing so this feature was defined.
[close]


MOT_FEAT_SECURE_CLOCK "Enable capability to set the secure real-time clock"
Зависит от MOT_FEAT_LSM
help

Enabling this feature will allow certain processes to be able to set the secure real-time clock.
[close]


MOT_FEAT_OTP_EFUSE "Sets the type of OTP storage used to E-Fuses."
help

The type of OTP storage for a given phone is currently limited to EFUSE or FLASH. Freescale processors rely on e-fuses while INTEL uses special OTP registers in flash.
[close]


MOT_FEAT_ATLAS_TIMING_ISSUES "Fixes Atlas SPI port timing issues"
Зависит от MXC_SPI
help

Enabling this feature fixes issues with Atlas reads and writes when the SPI clock is set to 66.6Mhz/4. The SPI clock is changed to 66.6Mhz/8 which slows operations down to a point where reads and writes to Atlas are reliable again.
[close]


MOT_FEAT_CONSOLE_DISABLED "The framebuffer is not used as a console by default"
help

To prevent any console output from being routed to the LCD, the frame buffer device will be placed into a suspended state by default.
[close]


MOT_FEAT_CHKSUM "Enable consistent checksum of kernel across builds"
help

Enables consistent generation of binary output across builds. A build with a particular spec and build commands should create a vmlinux and zImage that is bit-for-bit identical, independent of view name, date, and hostname.
[close]


MOT_FEAT_BT_MAXUARTBAUDRATE "Allow additional data rates for Bluetooth"
help

This feature provides support for the new Bluetooth data rates.
[close]


MOT_FEAT_FX2LP_I2C "FX2LP firmware download support over I2C"
Зависит от (ARCH_MXC91321 || ARCH_MXC91231) && MOT_FEAT_BOOTINFO
help

This turns on support for downloading firmware to the FX2LP USB High Speed chip at kernel init. The firmware transfer is done using the I2C protocol with the MXC I2C bus acting as the slave.
[close]


MOT_FEAT_SECURE_USERMEM "Remove userspace access to raw memory (/dev/mem, /dev/kmem, /proc entries)"
help

Enabling this feature will remove the /dev/mem and /dev/kmem device functionality as well as /proc entries for direct memory access in userspace.
[close]


MOT_FEAT_NO_PTRACE "Disables ptrace functionality"
help

Enabling this feature will remove ptrace functionality from the kernel.
[close]


MOT_FEAT_LSM "Motorola Security Module"
Зависит от SECURITY
help

If enabled the Motorola Security Module LSM will be compiled
[close]


MOT_FEAT_SECURE_MOUNT "Enable filesystem mount protection"
Зависит от MOT_FEAT_LSM
help

If enabled mounts will be secured using the Motorola LSM
[close]


MOT_FEAT_SECURE_MOUNT_SYSFS "Enable filesystem mount protection sysfs interface"
Зависит от MOT_FEAT_SECURE_MOUNT
help

If enabled a sysfs interface will be created to supply trusted mounts to the filesystem mount protection
[close]


MOT_FEAT_PANIC_DECISION "Enable proper decision making during kernel panic"
help

If this feature is enabled, during kernel panics proper set of actions will be taken (depending upon whether the phone is in production or engineering mode).
[close]


MOT_FEAT_SECURE_DRM "Enable additional security for Janus DRM "
Зависит от MOT_FEAT_LSM
help

Feature 11396 requires additional mandatory-access control security to protect the DRM key files. Setting this config option to 'y' enables that additional security.
[close]


MOT_FEAT_DRM_COREDUMP "Enable full coredump for non-security related application."
Зависит от MOT_FEAT_APP_DUMP && MOT_FEAT_SECURE_DRM
help

This feature enables full coredump for non-security related application.
[close]


MOT_FEAT_SECURE_MODULE "Allow only trusted kernel modules to be loaded"
Зависит от CRYPTO && CRYPTO_SHA1
help

By enabling this feature only modules that have a trusted SHA1 digest in /etc/modules.hash will be able to be inserted into the kernel.
[close]


MOT_FEAT_DISABLE_UART3_DMA "Disable DMA on MXC internal UART 3"
help

Disabling DMA on MXC internal UART 3 allows the use of that port as a serial console.
[close]


MOT_FEAT_ANTIVIRUS_HOOKS "Enable file system hooks to support anti-virus"
help

This feature places system hooks in open(), close(), and execve() to support anti-virus.
[close]


MOT_FEAT_GPIO_API "Enable Motorola-hardware-specific GPIO API"
help

Kernel-space API to control GPIO signals.
[close]


#############################"GPIO API Options"#############################
Зависит от MOT_FEAT_GPIO_API

MOT_FEAT_GPIO_TRACE "Enable trace messages during GPIO initialization"
Зависит от MOT_FEAT_GPIO_API
help

This feature enables extended trace messages during GPIO initialization.
[close]


MOT_FEAT_GPIO_API_EDIO "Allow device drivers to read and set the status of EDIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Enable the deprecated edio_set_data and edio_get_data functions which were removed in the MontaVista 05/12 drop.
[close]


MOT_FEAT_GPIO_API_MC13783 "Allow control over GPIO signals connected to the Atlas."
Зависит от MOT_FEAT_GPIO_API
help

This allows control over GPIO signals between the Atlas and the SCM-A11.
[close]


MOT_FEAT_GPIO_API_BTPOWER "Allow control over bluetooth power GPIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Enables API to control the power of the bluetooth module.
[close]


MOT_FEAT_GPIO_API_CSI "Allow control over camera sensor interface GPIO signals"
Зависит от MOT_FEAT_GPIO_API
help

Enables control over camera power down and reset signals.
[close]


MOT_FEAT_GPIO_API_DAI "Allow control over digital audio IOMUX settings."
Зависит от MOT_FEAT_GPIO_API
help

Enables API to control IOMUX state of DAI pins.
[close]


MOT_FEAT_GPIO_API_ETHERNET "Control Ethernet related GPIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Enables API for receiving Ethernet interrupts.
[close]


MOT_FEAT_GPIO_API_ETM "Allow ETM signals to be IOMUXed to alternative pins"
Зависит от MOT_FEAT_GPIO_API
help

On SCM-A11 and Argon, the ETM signals can be IOMUXed onto IPU and CSI/KPP pins.
[close]


MOT_FEAT_GPIO_API_GPU "Enable support for GPU GPIO signals"
Зависит от MOT_FEAT_GPIO_API
help

Enables API and setting for the GPU-based display.
[close]


MOT_FEAT_GPIO_API_LCD "Control IPU/LCD related GPIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Enables API for controlling IPU and LCD GPIO signals.
[close]



MOT_FEAT_GPIO_API_LIGHTING "Allow control over display, keypad, and camera light GPIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Control lighting related GPIO signals.
[close]

#############################"GPIO Lighting API Options"#############################
Зависит от MOT_FEAT_GPIO_API_LIGHTING

MOT_FEAT_GPIO_API_LIGHTING_LCD "Control the LCD backlight via GPIO signals."
Зависит от MOT_FEAT_GPIO_API_LIGHTING
help

On some boards, like the SCM-A11 and ArgonLV reference designs, the LCD backlight can be enabled and disabled via GPIO settings.
[close]


MOT_FEAT_GPIO_API_LIGHTING_CAM_TORCH "Control the camera torch GPIO signals."
Зависит от MOT_FEAT_GPIO_API_LIGHTING
help

On some phones, like Ascension, the camera torch can be enabled and disabled via GPIO settings.
[close]


MOT_FEAT_GPIO_API_LIGHTING_CAM_FLASH "Control the camera flash GPIO signals."
Зависит от MOT_FEAT_GPIO_API_LIGHTING
help

On some phones; like Ascension, Lido, and Saipan, the camera flash can be enabled and disabled via GPIO settings.
[close]


MOT_FEAT_GPIO_API_LIGHTING_EL "Control the electroluminescent keypad backlight via GPIO signals."
Зависит от MOT_FEAT_GPIO_API_LIGHTING
help

On some phones the keypad electroluminescent backlight can be enabled and disabled via GPIO settings.
[close]

comment 'End of Motorola GPIO Lighting API'
#######################################################################################



MOT_FEAT_GPIO_API_SDHC "Control Secure Digital Host Controller GPIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Enables API to control signals related to SDHC.
[close]


MOT_FEAT_GPIO_API_SERIALIZER "Control display serializer GPIO signals."
Зависит от MOT_FEAT_GPIO_API
help

Enables API to control display serializers signals independently of LCD power control signals.
[close]


MOT_FEAT_GPIO_API_USBHS "Control GPIO signals related to high-speed USB controller."
Зависит от MOT_FEAT_GPIO_API
help

Enables API to control signals related to the high-speed USB controller.
[close]


MOT_FEAT_GPIO_API_WLAN "Allow control over WLAN GPIO signals"
Зависит от MOT_FEAT_GPIO_API
help

Enables API to control WLAN reset, client wake, and power down signals.
[close]

comment 'End of Motorola-hardware-specific GPIO API'
#######################################################################################



MOT_FEAT_SD1_TF_DET "Detect MMC insertion and removal for SD1 via external interrupt."
help

Some phones, like Ascension, connect a line to external interrupt 4 that can be used to detect the insertion and removal of transflash cards.
[close]


MOT_FEAT_YAFFS_PARSE_MOUNT_OPTIONS "Enable parsing of yaffs specific mount options"
help

If this feature is enabled the mount command will parse and validate any YAFFS specific options passed. (ie -o shred)
[close]


MOT_FEAT_YAFFS_SHREDDER "Enable yaffs shredding"
Зависит от MOT_FEAT_YAFFS_PARSE_MOUNT_OPTIONS
help

If this feature is enabled the mount command will verfiy if the shredding option has been passed. Then all subsequent dirty blocks will be overwritten with Zeros.
[close]


MOT_FEAT_YAFFS_SYNC "Enable yaffs auto syncing"
help

If this feature is enabled the yaffs will sync the contents to disk on a sync call
[close]



MOT_FEAT_FAT_SYNC "Enable fat auto syncing"
help

If this feature is enabled the fat will sync the contents to disk on a sync call
[close]


MOT_FEAT_2MP_CAMERA_WRKARND "Enable bandwidth-improvement workarounds for 2MP image capture"
help

Enabling this option turns on the GEM and RTIC modules, as well as disables MAX slave 0, during still-image capture. These three workarounds increase the memory bandwidth available to the IPU CSI (Camera Sensor Interface) to transfer image data from sensor to memory.
[close]


MOT_FEAT_STM90NM "support for Saipan P1 with slower STM 90nm NAND chip"
Зависит от MOT_FEAT_BRDREV
help

This is for supporting Saipan P1 with slower STM 90nm NAND chip.
[close]


MOT_FEAT_BOOT_BACKLIGHT "Turn on the backlight during boot"
help

Enabling this feature will cause the backlight to turn on during the boot process.
[close]


MOT_FEAT_INTERN_SD "Create internal sd block device for mmc/sd driver"
help

Create internal sd block device automaticly on mmc/sd driver initial time.
[close]


MOT_FEAT_EXTERN_SD "Create external sd block device for mmc/sd driver"
help

Create external sd block device automaticly on mmc/sd driver initial time.
[close]


MOT_FEAT_MEGASIM "Create MegaSIM block device for mmc/sd driver"
help

Create MegaSIM block device automaticly on mmc/sd driver initial time.
[close]


MOT_FEAT_MMC_SDHC1 "Enable MMC driver on MXC SDHC1"
Зависит от MMC
help

Enable probing for MMC devices on SDHC1.
[close]


MOT_FEAT_MMC_SDHC2 "Enable MMC driver of MXC SDHC2"
Зависит от MMC
help

Enable probing for MMC devices on SDHC2.
[close]


MOT_FEAT_BT_WLAN_SINGLE_ANTENNA "Support Single BT WLAN antenna solution"
help

This feature is required when BT and WLAN are sharing the same antenna.
[close]



MOT_FEAT_LANDSCAPE_IMODULE "Enable the landscape I module main display"
help

This feature was just required by Elba phone, as it uses the unique LCD landscape I display mode.
[close]


MOT_FEAT_MMCSD_DEV_HOST_BIND "Bind mmc/sd driver device number to sdhc host id"
help

Fix the mmc/sd device number to sdhc host id. eg. /dev/mmc/blk0 --> sdhc host 1 /dev/mmc/blk1 --> sdhc host 2
[close]


MOT_FEAT_VFP_RUNFAST_PANIC "Enable kernel panics if an application leaves VFP RunFast mode"
depends on MOT_WFN456
help

Causes a kernel panic if an application leaves VFP RunFast mode. This is used to determine is user space is erroneously disabling VFP RunFast mode.
[close]


MOT_FEAT_NO_PAGE_SHARED "Do not hardcode pgprot to PAGE_SHARED in device drivers"
help

MMU TLB entries created with PAGE_SHARED do not have L_PTE_ASID bit set, could cause context switch problem.
[close]


MOT_FEAT_CACHE_OPTIMIZATION "Improve cache performance"
Зависит от MOT_FEAT_PM
help

Configure the cache in a write-back policy and decrease the wait cycles between cache accesses.
[close]


MOT_FEAT_INOTIFY "Add inotify support to the kernel"
Зависит от INOTIFY
help

Replaces dnotify with inotify support in the kernel. Adds the character device /dev/inotify.
[close]


MOT_FEAT_SYNC_INODE "Enable inode sync during wb_kupdate function"
help

Syncs the inodes for yaffs and vfat files during the wbkupdate function call (~ 5secs)
[close]


MOT_WFN475 "mu_[read/write]_tasklet_kernel doesn't check return values on MU reads/writes"
Зависит от MXC_IPC
help

The mu_[read/write]_tasklet_kernel bottom halves don't check return values when reading and writing MU data. This can result in bogus data being returned to the client of the channel. Enabing this option solves this problem.
[close]


MOT_WFN470 "CTS asserted before baudrate set"
help

In the mxc_uart driver function mxcuart_set_termios. It is possible to assert the CTS pin before the baud rate has been set.
[close]


MOT_WFN472 "NAND driver issues an extra read status"
help

With this bugfix, the redundant request for read status will be removed from the NAND driver.
[close]


MOT_WFN473 "mtdblockd priority is set incorrectly"
help

With this bugfix, the mtdblockd priority will be changed to -20.
[close]


MOT_WFN477 "Fix ARMV6 processor bug that could result in instruction cache flush failing"
help

This bugfix modifies all locations where the instruction cache is flushed to fix the processor bug.
[close]


MOT_WFN479 "Initialize jiffies to zero"
help

This bugfix initializes the jiffie counter to zero to avoid a problem that occurs with the times() system call when the counter rolls over
[close]


MOT_WFN493 "Fix the bug that when access /proc/[pid]/memmap the phone hangs sometimes"
help

This bugfix removes the calling of functions down_read and up_read in function show_mem_node_map to prevent from deadlock.
[close]


MOT_FEAT_HOTPLUG_FILTER "Enables hotplug event filtering"
help

This adds in hotplug event filtering. A sysfs entry will be created which takes a list of events allowed.
[close]


MOT_FEAT_NO_READ_AHEAD "Initializes block device read ahead kb to zero"
help

Set the read ahead default to zero for all block devices
[close]


MOT_FEAT_PRINT_PC_ON_PANIC "When a kernel panic occurs, print out the PC from where panic was called"
help

This feature helps identify where a panic originated.
[close]


MOT_FEAT_PANIC_ON_OOM "Panic the phone in an out of memory situation"
Зависит от !PRIORITIZED_OOM_KILL
help

Instead of selecting a process and killing it in hopes that it'll free up memory, just panic the phone.
[close]


MOT_FEAT_32KHZ_GPT "Enable 32KHz clock source for GPT"
help

GPT can use high frequency source or 32KHz source. This option enables 32KHz clock source. Note that DEBUG_PREEMPT, LATENCY_TIMING and ILATENCY requires the use of high frequncy clock source, which gives a sub-microsecond resolution.
[close]


MOT_FEAT_DSCP_UMA "DSCP mapping between inner and outer ip headers of IPSEC tunneled UMA data"
help

DSCP values of inner and outer ip packets is stored when tunnelled data is received and used when sending tunnelled data
[close]


MOT_FEAT_FLUSH_LOCKED_TLB "Enable flush main locked TLB"
help

If this feature is enabled, it will flush main locked TLB.
[close]


MOT_WFN482 "Fix high resolution timer bug"
help

This will fix a bug that causes high resolution timers to spin until the timer expir

Сообщение отредактировал EXL - 3.10.2016, 1:32
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
VINRARUS
сообщение 2.10.2016, 19:18


Термоядерный
********

Группа: Пользователи
Сообщений: 3 496
Регистрация: 12.12.2009
Из: Чорнобиль
Пользователь №: 211 044
Модель телефона: WX160 & L7 & Z6 & ZN5-128
Прошивка: 740 MHz: Z6 and ZN5


Настроение:
youtu.be/A_yQLYLiSGQ



Рейтинг: 1211



Цитата(fill.sa @ Сегодня, 9:59)
* И фишка в том что при таком мощном старте в 740 пол батареи уже сядит. Нужно вам такое?

Ееее, с какого перепугу? 740 всего в 3 раза больше за 399 ест, а не в 100.

А в моем моде предусмотрен аварийный режим, на случай если убитая батарея не выдает напряжение для 532-740 МГц, и тел грузится на 399.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 3.10.2016, 1:52


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(fill.sa @ Вчера, 12:59)
* Тел грузится с максимальной частотой пока не подхватится apmd. А он уже в каждом моде по свойму.
И фишка в том что при таком мощном старте в 740 пол батареи уже сядит. Нужно вам такое?

А ты посмотри в dmesg, в самом начале там должно быть что-то вроде Calibrating loops, XXX BogoMIPS...

По этому можно получить представление о том, на какой частоте стартует телефон.
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
Unreal_man
сообщение 3.10.2016, 5:02


Гуру
******

Группа: Разработчики
Сообщений: 732
Регистрация: 16.12.2009
Из: Другого Края Земли
Пользователь №: 211 211
Модель телефона: Motorola Moto Z Play


Настроение:
:-I



Рейтинг: 607



Почему максимум 798? Почему нельзя 931?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 3.10.2016, 14:42


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(Unreal_man @ Сегодня, 11:02)
* Почему максимум 798?

Актуальный максимум сегодня -- 740 МГц.

798 МГц это первоначально неправильно рассчитанные мною значения частоты.

Цитата(Unreal_man @ Сегодня, 11:02)
* Почему нельзя 931?


Потому что выше 0x000000E0 у меня начиналось нечто вроде дросселирования тактов CPU: производительность резко снижалась, да и вообще появлялось огромное количество глюков, появлялись зелёные артефакты на экране и т. д.

Насколько я помню (пять лет прошло).
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 3.10.2016, 17:29


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(EXL @ 3.10.2016, 2:52) *

Цитата(fill.sa @ Вчера, 12:59)
* Тел грузится с максимальной частотой пока не подхватится apmd. А он уже в каждом моде по свойму.
И фишка в том что при таком мощном старте в 740 пол батареи уже сядит. Нужно вам такое?

А ты посмотри в dmesg, в самом начале там должно быть что-то вроде Calibrating loops, XXX BogoMIPS...

По этому можно получить представление о том, на какой частоте стартует телефон.


Я выводил инфу в файл сразу после подгрузки модуля Управления частотой - и там 532, потом уже когда подхватится apmd - он уже урегулирует как нужно все.
А еще я пробовал ядро на 740 но модуль обычный и при старте тел так не раскаляется как еслиб он работал на 740.
Из всехо делаю вывод что на максимуме, да это и логично помоему. Еслибы было меньше 532 значит ядру нужно принудительно ограничивать частоты, а потом после старта все возращать чтобы уже apmd и занимался ограничением.
Но за подсказу Calibrating loops спасибо - нужно глянуть будет.

Добавлено позже (3.10.2016, 18:32):
Эй ребята, кто мой пост поправил Сборка ядра для ZN5. Compiling your own kernel

Там много текста обрезалось. К тому же я не все выложил, опять таки из-за ограничения по количеству текста.
Как бы это все аккуратно в один пост запихать?
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
Unreal_man
сообщение 3.10.2016, 22:37


Гуру
******

Группа: Разработчики
Сообщений: 732
Регистрация: 16.12.2009
Из: Другого Края Земли
Пользователь №: 211 211
Модель телефона: Motorola Moto Z Play


Настроение:
:-I



Рейтинг: 607



fill.sa, в тхт и в архив
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
EXL
сообщение 4.10.2016, 4:18


Rock The Microphone
********

Группа: Администраторы
Сообщений: 3 145
Регистрация: 12.5.2007
Из: г. Новосибирск
Пользователь №: 134 652

Рейтинг: 4654



Цитата(fill.sa @ Вчера, 23:29)
* Эй ребята, кто мой пост поправил Сборка ядра для ZN5. Compiling your own kernel

Я поправил. Слишком долго мотать простыню.

Лучше всего либо в TXT и в архив, либо на https://gist.github.com/ (лучше) или на http://paste.org.ru/, http://pastebin.com/ (хуже).

Добавлено позже (4.10.2016, 10:22):
Цитата(fill.sa @ Вчера, 23:29)
* Но за подсказу Calibrating loops спасибо - нужно глянуть будет.


Так ты запиши полный лог с помощью dmesg. Я в этой теме только кусочки вижу. Или он полный не отдаёт?

Код
dmesg &> dmesg.log
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
fill.sa
сообщение 4.10.2016, 4:47


Гуру
******

Группа: Разработчики
Сообщений: 1 240
Регистрация: 8.2.2011
Из: Беларусь
Пользователь №: 223 758
Модель телефона: z6 V8
Прошивка: Linux SAedition MOD

Рейтинг: 400



Цитата(EXL @ 4.10.2016, 5:18) *


Добавлено позже (4.10.2016, 10:22):
Цитата(fill.sa @ Вчера, 23:29)
* Но за подсказу Calibrating loops спасибо - нужно глянуть будет.


Так ты запиши полный лог с помощью dmesg. Я в этой теме только кусочки вижу. Или он полный не отдаёт?

Код
dmesg &> dmesg.log



Да в принципе вот то что выкладывал, это почти полный
Ковыряем ZN5
И вот как раз вижу строчку
Calibrating delay loop... 354.71 BogoMIPS (lpj=1773568)

Добавлено позже (4.10.2016, 6:06):
Вот еще вычитал.
Цитата
Английская компания ARM сегодня, на конференции Microprocessor Forum, представила два новых процессорных ядра ARM1136J-S и ARM1136JF-S. Новые чипы – первые представители процессорной архитектуры ARM11.

Новые чипы ARM11, которые компания уже предлагает для лицензирования, обладают тактовой частотой 533 МГц и выше, будут изготавливаться с применением норм 0,13 мкм техпроцесса, и обладать производительностью на уровне 600 Dhrystone MIPs (без оптимизации), при энергопотреблении не более 200 мВт. Типичное энергопотребление 0,13 мкм чипов ARM1136J-S и ARM1136JF-S при тактовой частоте 400 МГц, напряжении питания 1В составляет 160 мВт.

Чипы обладают восьмистадийным конвейером с двухтактным кэшем, что в перспективе позволит без проблем поднимать тактовую частоту.


Сообственно что хотел отметить
-тактовой частотой 533 МГц и выше - т.е. наш разгон возможно и не такой разгон, проц это возможно реально пооддерживает.

и вот такое: напряжении питания 1В. У нас питание 1.2 , но я в сорцах ядра видел настройку на 1В, нужно будет попробовать включить - может удасться снизить энергопотребление.

Добавлено позже (4.10.2016, 6:25):
А вот еще

Цитата

https://www.arm.com/products/processors/cla...m11/arm1136.php
System IP, reference methodologies, and 3rd party design support enable 600MHz+ in 90G, up to 1GHz at 65nm in under 2 sq.mm

Я правильно понял что можно поднять то 1GHz ?

Добавлено позже (4.10.2016, 6:48):
А вот еще даташитик http://www.nxp.com/files/dsp/doc/data_shee...IMX35SR2AEC.pdf

Сообщение отредактировал fill.sa - 4.10.2016, 5:25
Юзер вышелВ друзьяВизиткаП/Я
К началу страницы
+Ответить
Сборка ядра для ZN5. Compiling your own kernel, Компилим ядро. Мануал. 740 (798) MHz. Разгон · Motorola ZINE ZN5, ZN5 T-Mobile · Forum
 

10 страниц V « < 4 5 6 7 > » 
Ответ в темуСоздание новой темы
2 чел. читают эту тему (гостей: 2, скрытых пользователей: 0)
Пользователей: 0

 



Текстовая версия Сейчас: 19.7.2025, 8:23

Форум живёт: