blob: 3cc16e49e67beeeb7688f915265db403af8e0ae0 [file] [log] [blame]
Sergey 'Jin' Bostandzhyan80a90ed2013-01-04 02:29:03 +01001/*
2 * Copyright (c) 2013 Sergey 'Jin' Bostandzhyan
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Kra1o531679362014-06-20 19:06:06 +020017/* This is a hack for Rockchip rk3x based devices. The problem is that
Sergey 'Jin' Bostandzhyan80a90ed2013-01-04 02:29:03 +010018 * the MEMERASE ioctl is failing (hangs and never returns) in their kernel.
19 * The sources are not fully available, so fixing it in the rk30xxnand_ko driver
20 * is not possible.
21 *
22 * I straced the stock recovery application and it seems to avoid this
23 * particular ioctl, instead it is simply writing zeroes using the write() call.
24 *
25 * This workaround does the same and will replace all MEMERASE occurances in
26 * the recovery code.
27 */
28
Kra1o531679362014-06-20 19:06:06 +020029#ifndef __RK3X_HACK_H__
30#define __RK3X_HACK_H__
Sergey 'Jin' Bostandzhyan80a90ed2013-01-04 02:29:03 +010031
32#include <sys/types.h> // for size_t, etc.
33
34// write zeroes to fd at position pos
35int zero_out(int fd, off_t pos, ssize_t length);
36
Kra1o531679362014-06-20 19:06:06 +020037#endif//__RK3X_HACK_H__