diff options
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/google/nyan/Makefile.inc | 3 | ||||
-rw-r--r-- | src/mainboard/google/nyan/pmic.c | 14 | ||||
-rw-r--r-- | src/mainboard/google/nyan/reset.c | 29 | ||||
-rw-r--r-- | src/mainboard/google/nyan/reset.h | 25 | ||||
-rw-r--r-- | src/mainboard/google/nyan_big/Makefile.inc | 1 | ||||
-rw-r--r-- | src/mainboard/google/nyan_big/pmic.c | 14 | ||||
-rw-r--r-- | src/mainboard/google/nyan_big/reset.c | 29 | ||||
-rw-r--r-- | src/mainboard/google/nyan_big/reset.h | 25 | ||||
-rw-r--r-- | src/mainboard/google/nyan_blaze/Makefile.inc | 1 | ||||
-rw-r--r-- | src/mainboard/google/nyan_blaze/pmic.c | 14 | ||||
-rw-r--r-- | src/mainboard/google/nyan_blaze/reset.c | 29 | ||||
-rw-r--r-- | src/mainboard/google/nyan_blaze/reset.h | 25 |
12 files changed, 199 insertions, 10 deletions
diff --git a/src/mainboard/google/nyan/Makefile.inc b/src/mainboard/google/nyan/Makefile.inc index 825b33e9d755..30cd27d9fcee 100644 --- a/src/mainboard/google/nyan/Makefile.inc +++ b/src/mainboard/google/nyan/Makefile.inc @@ -1,7 +1,7 @@ ## ## This file is part of the coreboot project. ## -## Copyright 2013 Google Inc. +## Copyright 2014 Google Inc. ## ## 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 @@ -30,6 +30,7 @@ subdirs-y += bct bootblock-y += boardid.c bootblock-y += bootblock.c bootblock-y += pmic.c +bootblock-y += reset.c romstage-y += romstage.c romstage-y += sdram_configs.c diff --git a/src/mainboard/google/nyan/pmic.c b/src/mainboard/google/nyan/pmic.c index a6e881d10f71..dc5f7447a612 100644 --- a/src/mainboard/google/nyan/pmic.c +++ b/src/mainboard/google/nyan/pmic.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <console/console.h> #include <delay.h> #include <device/i2c.h> #include <stdint.h> @@ -25,6 +26,7 @@ #include "boardid.h" #include "pmic.h" +#include "reset.h" enum { AS3722_I2C_ADDR = 0x40 @@ -59,9 +61,15 @@ static struct as3722_init_reg init_list[] = { static void pmic_write_reg(unsigned bus, uint8_t reg, uint8_t val, int do_delay) { - i2c_writeb(bus, AS3722_I2C_ADDR, reg, val); - if (do_delay) - udelay(500); + if (i2c_writeb(bus, AS3722_I2C_ADDR, reg, val)) { + printk(BIOS_ERR, "%s: reg = 0x%02X, value = 0x%02X failed!\n", + __func__, reg, val); + /* Reset the SoC on any PMIC write error */ + cpu_reset(); + } else { + if (do_delay) + udelay(500); + } } static void pmic_slam_defaults(unsigned bus) diff --git a/src/mainboard/google/nyan/reset.c b/src/mainboard/google/nyan/reset.c new file mode 100644 index 000000000000..7f1fff922a92 --- /dev/null +++ b/src/mainboard/google/nyan/reset.c @@ -0,0 +1,29 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2014 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <arch/io.h> +#include <soc/nvidia/tegra124/gpio.h> + +#include "reset.h" + +void cpu_reset(void) +{ + gpio_output(GPIO(I5), 0); + while(1); +} diff --git a/src/mainboard/google/nyan/reset.h b/src/mainboard/google/nyan/reset.h new file mode 100644 index 000000000000..debe83818be5 --- /dev/null +++ b/src/mainboard/google/nyan/reset.h @@ -0,0 +1,25 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2014 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ +#define __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ + +void cpu_reset(void); + +#endif /* __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ */ diff --git a/src/mainboard/google/nyan_big/Makefile.inc b/src/mainboard/google/nyan_big/Makefile.inc index 9cdff3b9b0be..30cd27d9fcee 100644 --- a/src/mainboard/google/nyan_big/Makefile.inc +++ b/src/mainboard/google/nyan_big/Makefile.inc @@ -30,6 +30,7 @@ subdirs-y += bct bootblock-y += boardid.c bootblock-y += bootblock.c bootblock-y += pmic.c +bootblock-y += reset.c romstage-y += romstage.c romstage-y += sdram_configs.c diff --git a/src/mainboard/google/nyan_big/pmic.c b/src/mainboard/google/nyan_big/pmic.c index 6bbff0da8b8d..4d52f7072c62 100644 --- a/src/mainboard/google/nyan_big/pmic.c +++ b/src/mainboard/google/nyan_big/pmic.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <console/console.h> #include <delay.h> #include <device/i2c.h> #include <stdint.h> @@ -25,6 +26,7 @@ #include "boardid.h" #include "pmic.h" +#include "reset.h" enum { AS3722_I2C_ADDR = 0x40 @@ -59,9 +61,15 @@ static struct as3722_init_reg init_list[] = { static void pmic_write_reg(unsigned bus, uint8_t reg, uint8_t val, int do_delay) { - i2c_writeb(bus, AS3722_I2C_ADDR, reg, val); - if (do_delay) - udelay(500); + if (i2c_writeb(bus, AS3722_I2C_ADDR, reg, val)) { + printk(BIOS_ERR, "%s: reg = 0x%02X, value = 0x%02X failed!\n", + __func__, reg, val); + /* Reset the SoC on any PMIC write error */ + cpu_reset(); + } else { + if (do_delay) + udelay(500); + } } static void pmic_slam_defaults(unsigned bus) diff --git a/src/mainboard/google/nyan_big/reset.c b/src/mainboard/google/nyan_big/reset.c new file mode 100644 index 000000000000..7f1fff922a92 --- /dev/null +++ b/src/mainboard/google/nyan_big/reset.c @@ -0,0 +1,29 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2014 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <arch/io.h> +#include <soc/nvidia/tegra124/gpio.h> + +#include "reset.h" + +void cpu_reset(void) +{ + gpio_output(GPIO(I5), 0); + while(1); +} diff --git a/src/mainboard/google/nyan_big/reset.h b/src/mainboard/google/nyan_big/reset.h new file mode 100644 index 000000000000..debe83818be5 --- /dev/null +++ b/src/mainboard/google/nyan_big/reset.h @@ -0,0 +1,25 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2014 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ +#define __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ + +void cpu_reset(void); + +#endif /* __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ */ diff --git a/src/mainboard/google/nyan_blaze/Makefile.inc b/src/mainboard/google/nyan_blaze/Makefile.inc index 9cdff3b9b0be..30cd27d9fcee 100644 --- a/src/mainboard/google/nyan_blaze/Makefile.inc +++ b/src/mainboard/google/nyan_blaze/Makefile.inc @@ -30,6 +30,7 @@ subdirs-y += bct bootblock-y += boardid.c bootblock-y += bootblock.c bootblock-y += pmic.c +bootblock-y += reset.c romstage-y += romstage.c romstage-y += sdram_configs.c diff --git a/src/mainboard/google/nyan_blaze/pmic.c b/src/mainboard/google/nyan_blaze/pmic.c index 6bbff0da8b8d..4d52f7072c62 100644 --- a/src/mainboard/google/nyan_blaze/pmic.c +++ b/src/mainboard/google/nyan_blaze/pmic.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <console/console.h> #include <delay.h> #include <device/i2c.h> #include <stdint.h> @@ -25,6 +26,7 @@ #include "boardid.h" #include "pmic.h" +#include "reset.h" enum { AS3722_I2C_ADDR = 0x40 @@ -59,9 +61,15 @@ static struct as3722_init_reg init_list[] = { static void pmic_write_reg(unsigned bus, uint8_t reg, uint8_t val, int do_delay) { - i2c_writeb(bus, AS3722_I2C_ADDR, reg, val); - if (do_delay) - udelay(500); + if (i2c_writeb(bus, AS3722_I2C_ADDR, reg, val)) { + printk(BIOS_ERR, "%s: reg = 0x%02X, value = 0x%02X failed!\n", + __func__, reg, val); + /* Reset the SoC on any PMIC write error */ + cpu_reset(); + } else { + if (do_delay) + udelay(500); + } } static void pmic_slam_defaults(unsigned bus) diff --git a/src/mainboard/google/nyan_blaze/reset.c b/src/mainboard/google/nyan_blaze/reset.c new file mode 100644 index 000000000000..7f1fff922a92 --- /dev/null +++ b/src/mainboard/google/nyan_blaze/reset.c @@ -0,0 +1,29 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2014 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <arch/io.h> +#include <soc/nvidia/tegra124/gpio.h> + +#include "reset.h" + +void cpu_reset(void) +{ + gpio_output(GPIO(I5), 0); + while(1); +} diff --git a/src/mainboard/google/nyan_blaze/reset.h b/src/mainboard/google/nyan_blaze/reset.h new file mode 100644 index 000000000000..debe83818be5 --- /dev/null +++ b/src/mainboard/google/nyan_blaze/reset.h @@ -0,0 +1,25 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2014 Google Inc. + * + * 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; version 2 of the License. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ +#define __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ + +void cpu_reset(void); + +#endif /* __MAINBOARD_GOOGLE_NYAN_BOOTBLOCK_H__ */ |