ChromeOS: Use common fill_lb_gpio()

Change-Id: I2ba7a1c2b2e6ce2c00c9a2916141bed67930ba2d
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/5586
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Kyösti Mälkki 2013-12-22 03:12:38 +02:00
parent 9ab1c106c3
commit 6578475d93
18 changed files with 15 additions and 114 deletions

View File

@ -200,6 +200,8 @@ struct lb_framebuffer {
struct lb_gpio { struct lb_gpio {
uint32_t port; uint32_t port;
uint32_t polarity; uint32_t polarity;
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
uint32_t value; uint32_t value;
#define GPIO_MAX_NAME_LENGTH 16 #define GPIO_MAX_NAME_LENGTH 16
uint8_t name[GPIO_MAX_NAME_LENGTH]; uint8_t name[GPIO_MAX_NAME_LENGTH];
@ -339,6 +341,8 @@ unsigned long write_coreboot_table(
unsigned long rom_table_start, unsigned long rom_table_end); unsigned long rom_table_start, unsigned long rom_table_end);
void fill_lb_gpios(struct lb_gpios *gpios); void fill_lb_gpios(struct lb_gpios *gpios);
void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int value);
void uart_fill_lb(void *data); void uart_fill_lb(void *data);
void lb_add_serial(struct lb_serial *serial, void *data); void lb_add_serial(struct lb_serial *serial, void *data);

View File

@ -145,6 +145,17 @@ static void lb_framebuffer(struct lb_header *header)
} }
#if CONFIG_CHROMEOS #if CONFIG_CHROMEOS
void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int value)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = num;
gpio->polarity = polarity;
if (value >= 0)
gpio->value = value;
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
static void lb_gpios(struct lb_header *header) static void lb_gpios(struct lb_header *header)
{ {
struct lb_gpios *gpios; struct lb_gpios *gpios;

View File

@ -36,8 +36,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static int get_lid_switch(void) static int get_lid_switch(void)
{ {
@ -50,19 +48,6 @@ static int get_lid_switch(void)
#endif #endif
} }
static void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int force)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = num;
gpio->polarity = polarity;
if (force >= 0)
gpio->value = force;
else if (num >= 0)
gpio->value = get_gpio(num);
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;

View File

@ -28,8 +28,6 @@
#include <ec/quanta/ene_kb3940q/ec.h> #include <ec/quanta/ene_kb3940q/ec.h>
#include "ec.h" #include "ec.h"
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
#define WP_GPIO 6 #define WP_GPIO 6
#define DEVMODE_GPIO 54 #define DEVMODE_GPIO 54
#define FORCE_RECOVERY_MODE 0 #define FORCE_RECOVERY_MODE 0

View File

@ -33,8 +33,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static int get_lid_switch(void) static int get_lid_switch(void)
{ {
@ -47,19 +45,6 @@ static int get_lid_switch(void)
#endif #endif
} }
static void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int force)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = num;
gpio->polarity = polarity;
if (force >= 0)
gpio->value = force;
else if (num >= 0)
gpio->value = get_gpio(num);
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;

View File

@ -30,8 +30,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static int get_lid_switch(void) static int get_lid_switch(void)
{ {

View File

@ -28,8 +28,6 @@
#include <ec/compal/ene932/ec.h> #include <ec/compal/ene932/ec.h>
#include "ec.h" #include "ec.h"
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
#ifndef __PRE_RAM__ #ifndef __PRE_RAM__
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>

View File

@ -33,8 +33,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static int get_lid_switch(void) static int get_lid_switch(void)
{ {
@ -47,19 +45,6 @@ static int get_lid_switch(void)
#endif #endif
} }
static void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int force)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = num;
gpio->polarity = polarity;
if (force >= 0)
gpio->value = force;
else if (num >= 0)
gpio->value = get_gpio(num);
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;

View File

@ -26,11 +26,6 @@
#include <cpu/samsung/exynos5420/cpu.h> #include <cpu/samsung/exynos5420/cpu.h>
#include <cpu/samsung/exynos5420/gpio.h> #include <cpu/samsung/exynos5420/gpio.h>
enum {
ACTIVE_LOW = 0,
ACTIVE_HIGH = 1
};
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
int count = 0; int count = 0;

View File

@ -36,8 +36,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static int get_lid_switch(void) static int get_lid_switch(void)
{ {
@ -51,17 +49,6 @@ static int get_lid_switch(void)
#endif #endif
} }
static void fill_lb_gpio(struct lb_gpio *gpio, int port, int polarity,
const char *name, int force)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = port;
gpio->polarity = polarity;
if (force >= 0)
gpio->value = force;
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;

View File

@ -33,8 +33,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static int get_lid_switch(void) static int get_lid_switch(void)
{ {
@ -47,19 +45,6 @@ static int get_lid_switch(void)
#endif #endif
} }
static void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int force)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = num;
gpio->polarity = polarity;
if (force >= 0)
gpio->value = force;
else if (num >= 0)
gpio->value = get_gpio(num);
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
struct lb_gpio *gpio; struct lb_gpio *gpio;

View File

@ -26,11 +26,6 @@
#include <cpu/samsung/exynos5250/cpu.h> #include <cpu/samsung/exynos5250/cpu.h>
#include <cpu/samsung/exynos5250/gpio.h> #include <cpu/samsung/exynos5250/gpio.h>
enum {
ACTIVE_LOW = 0,
ACTIVE_HIGH = 1
};
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
int count = 0; int count = 0;

View File

@ -32,8 +32,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 7 #define GPIO_COUNT 7
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {

View File

@ -29,8 +29,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {

View File

@ -28,8 +28,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {

View File

@ -32,21 +32,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
static void fill_lb_gpio(struct lb_gpio *gpio, int num,
int polarity, const char *name, int force)
{
memset(gpio, 0, sizeof(*gpio));
gpio->port = num;
gpio->polarity = polarity;
if (force >= 0)
gpio->value = force;
else if (num >= 0)
gpio->value = get_gpio(num);
strncpy((char *)gpio->name, name, GPIO_MAX_NAME_LENGTH);
}
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {

View File

@ -39,8 +39,6 @@
#include <ec/smsc/mec1308/ec.h> #include <ec/smsc/mec1308/ec.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {

View File

@ -36,8 +36,6 @@
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#define GPIO_COUNT 6 #define GPIO_COUNT 6
#define ACTIVE_LOW 0
#define ACTIVE_HIGH 1
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {