aboutsummaryrefslogtreecommitdiffstats
path: root/tools/quilt/Makefile
diff options
context:
space:
mode:
authorAlexandros C. Couloumbis <alex@ozo.com>2010-07-27 17:21:30 +0000
committerAlexandros C. Couloumbis <alex@ozo.com>2010-07-27 17:21:30 +0000
commitd83a959719de9178c455eead004e9215d54a04a0 (patch)
tree85ea11642e1e3bcb812a1b4f8841612d037f13bb /tools/quilt/Makefile
parent7a052dc79957fd5bc719e64b124afa0449b89171 (diff)
downloadupstream-d83a959719de9178c455eead004e9215d54a04a0.tar.gz
upstream-d83a959719de9178c455eead004e9215d54a04a0.tar.bz2
upstream-d83a959719de9178c455eead004e9215d54a04a0.zip
tools/quilt: fix openSUSE/patch-2.6.1.81 issue (closes #7635)
SVN-Revision: 22397
Diffstat (limited to 'tools/quilt/Makefile')
-rw-r--r--tools/quilt/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/quilt/Makefile b/tools/quilt/Makefile
index b973eb404f..221398f29b 100644
--- a/tools/quilt/Makefile
+++ b/tools/quilt/Makefile
@@ -16,6 +16,7 @@ PKG_MD5SUM:=f77adda60039ffa753f3c584a286f12b
include $(INCLUDE_DIR)/host-build.mk
define Host/Configure
+ cd $(HOST_BUILD_DIR) && autoconf
$(call Host/Configure/Default)
[ -f $(HOST_BUILD_DIR)/Makefile ]
endef
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
/*
 * This file is part of the flashrom project.
 *
 * Copyright (C) 2020 The Chromium OS Authors
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>

#include "programmer.h"
#include "spi.h"
#include "i2c_helper.h"

#define REGISTER_ADDRESS	(0x94 >> 1)
#define PAGE_ADDRESS		(0x9e >> 1)
#define LSPCON_PAGE_SIZE	256
#define MAX_SPI_WAIT_RETRIES	1000

#define CLT2_SPI		0x82
#define SPIEDID_BASE_ADDR2	0x8d
#define ROMADDR_BYTE1		0x8e
#define ROMADDR_BYTE2		0x8f
#define SWSPI_WDATA		0x90
 #define SWSPI_WDATA_CLEAR_STATUS		0x00
 #define SWSPI_WDATA_WRITE_REGISTER		0x01
 #define SWSPI_WDATA_READ_REGISTER		0x05
 #define SWSPI_WDATA_ENABLE_REGISTER		0x06
 #define SWSPI_WDATA_SECTOR_ERASE		0x20
 #define SWSPI_WDATA_PROTECT_BP			0x8c
#define SWSPI_RDATA		0x91
#define SWSPI_LEN		0x92
#define SWSPICTL		0x93
 #define SWSPICTL_ACCESS_TRIGGER			1
 #define SWSPICTL_CLEAR_PTR			(1 << 1)
 #define SWSPICTL_NO_READ			(1 << 2)
 #define SWSPICTL_ENABLE_READBACK		(1 << 3)
 #define SWSPICTL_MOT				(1 << 4)
#define SPISTATUS		0x9e
 #define SPISTATUS_BYTE_PROGRAM_FINISHED		0
 #define SPISTATUS_BYTE_PROGRAM_IN_IF		1
 #define SPISTATUS_BYTE_PROGRAM_SEND_DONE	(1 << 1)
 #define SPISTATUS_SECTOR_ERASE_FINISHED		0
 #define SPISTATUS_SECTOR_ERASE_IN_IF		(1 << 2)
 #define SPISTATUS_SECTOR_ERASE_SEND_DONE	(1 << 3)
 #define SPISTATUS_CHIP_ERASE_FINISHED		0
 #define SPISTATUS_CHIP_ERASE_IN_IF		(1 << 4)
 #define SPISTATUS_CHIP_ERASE_SEND_DONE		(1 << 5)
 #define SPISTATUS_FW_UPDATE_ENABLE		(1 << 6)
#define WRITE_PROTECTION	0xb3
 #define WRITE_PROTECTION_ON			0
 #define WRITE_PROTECTION_OFF			0x10
#define MPU			0xbc
#define PAGE_HW_WRITE		0xda
 #define PAGE_HW_WRITE_DISABLE			0
 #define PAGE_HW_COFIG_REGISTER			0xaa
 #define PAGE_HW_WRITE_ENABLE			0x55

struct lspcon_i2c_spi_data {
	int fd;
};

typedef struct {
	uint8_t command;
	const uint8_t *data;
	uint8_t data_size;
	uint8_t control;
} packet_t;

static int lspcon_i2c_spi_write_data(int fd, uint16_t addr, void *buf, uint16_t len)
{
	i2c_buffer_t data;
	if (i2c_buffer_t_fill(&data, buf, len))
		return SPI_GENERIC_ERROR;

	return i2c_write(fd, addr, &data) == len ? 0 : SPI_GENERIC_ERROR;
}

static int lspcon_i2c_spi_read_data(int fd, uint16_t addr, void *buf, uint16_t len)
{
	i2c_buffer_t data;
	if (i2c_buffer_t_fill(&data, buf, len))
		return SPI_GENERIC_ERROR;

	return i2c_read(fd, addr, &data) == len ? 0 : SPI_GENERIC_ERROR;
}

static int get_fd_from_context(const struct flashctx *flash)
{
	if (!flash || !flash->mst || !flash->mst->spi.data) {
		msg_perr("Unable to extract fd from flash context.\n");
		return SPI_GENERIC_ERROR;
	}
        const struct lspcon_i2c_spi_data *data =
		(const struct lspcon_i2c_spi_data *)flash->mst->spi.data;

	return data->fd;
}

static int lspcon_i2c_spi_write_register(int fd, uint8_t i2c_register, uint8_t value)
{
	uint8_t command[] = { i2c_register, value };
	return lspcon_i2c_spi_write_data(fd, REGISTER_ADDRESS, command, 2);
}

static int lspcon_i2c_spi_read_register(int fd, uint8_t i2c_register, uint8_t *value)