Karthik Ramasubramanian has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c A src/mainboard/google/dedede/variants/baseboard/include/baseboard/gpio.h A src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 9 files changed, 114 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/38278/1
diff --git a/src/mainboard/google/dedede/Kconfig b/src/mainboard/google/dedede/Kconfig index 02e4e51..7c42404 100644 --- a/src/mainboard/google/dedede/Kconfig +++ b/src/mainboard/google/dedede/Kconfig @@ -32,4 +32,8 @@ int default 2
+config VARIANT_DIR + string + default "dedede" if BOARD_GOOGLE_DEDEDE + endif #BOARD_GOOGLE_BASEBOARD_DEDEDE diff --git a/src/mainboard/google/dedede/Makefile.inc b/src/mainboard/google/dedede/Makefile.inc index be05b6b..8f50113 100644 --- a/src/mainboard/google/dedede/Makefile.inc +++ b/src/mainboard/google/dedede/Makefile.inc @@ -3,3 +3,8 @@ ramstage-y += mainboard.c
subdirs-y += variants/baseboard +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include + +VARIANT_DIR:=$(call strip_quotes,$(CONFIG_VARIANT_DIR)) +subdirs-y += variants/$(VARIANT_DIR) +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/google/dedede/bootblock.c b/src/mainboard/google/dedede/bootblock.c index 11186f7..04658b4 100644 --- a/src/mainboard/google/dedede/bootblock.c +++ b/src/mainboard/google/dedede/bootblock.c @@ -6,9 +6,16 @@ * SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/gpio.h> +#include <baseboard/variants.h> #include <bootblock_common.h> +#include <soc/gpio.h>
void bootblock_mainboard_init(void) { - /* TODO: Perform mainboard initialization */ + const struct pad_config *pads; + size_t num; + + pads = variant_early_gpio_table(&num); + gpio_configure_pads(pads, num); } diff --git a/src/mainboard/google/dedede/mainboard.c b/src/mainboard/google/dedede/mainboard.c index 51b1aa4..7b02be7 100644 --- a/src/mainboard/google/dedede/mainboard.c +++ b/src/mainboard/google/dedede/mainboard.c @@ -6,11 +6,19 @@ * SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/gpio.h> +#include <baseboard/variants.h> #include <device/device.h> +#include <soc/gpio.h> +#include <variant/gpio.h>
static void mainboard_init(void *chip_info) { - /* TODO: Perform mainboard initialization */ + const struct pad_config *pads; + size_t num; + + pads = variant_gpio_table(&num); + gpio_configure_pads(pads, num); }
static void mainboard_enable(struct device *dev) diff --git a/src/mainboard/google/dedede/variants/baseboard/Makefile.inc b/src/mainboard/google/dedede/variants/baseboard/Makefile.inc new file mode 100644 index 0000000..7c092e4 --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/Makefile.inc @@ -0,0 +1,5 @@ +bootblock-y += gpio.c + +ramstage-y += gpio.c + +smm-y += gpio.c diff --git a/src/mainboard/google/dedede/variants/baseboard/gpio.c b/src/mainboard/google/dedede/variants/baseboard/gpio.c new file mode 100644 index 0000000..a141a58 --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/gpio.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include <baseboard/gpio.h> +#include <baseboard/variants.h> +#include <commonlib/helpers.h> + +/* Pad configuration in ramstage*/ +static const struct pad_config gpio_table[] = { + /* ToDo: Fill gpio configuration */ +}; + +/* Early pad configuration in bootblock */ +static const struct pad_config early_gpio_table[] = { +/* ToDo: Fill early gpio configurations for TPM and WWAN */ +}; + +const struct pad_config *variant_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(gpio_table); + return gpio_table; +} + +const struct pad_config *variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} diff --git a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/gpio.h b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/gpio.h new file mode 100644 index 0000000..55faf01 --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/gpio.h @@ -0,0 +1,15 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef __BASEBOARD_GPIO_H__ +#define __BASEBOARD_GPIO_H__ + +#include <soc/gpe.h> +#include <soc/gpio.h> + +#endif /* __BASEBOARD_GPIO_H__ */ diff --git a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h new file mode 100644 index 0000000..ebcd594 --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h @@ -0,0 +1,21 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef __BASEBOARD_VARIANTS_H__ +#define __BASEBOARD_VARIANTS_H__ + +#include <soc/gpio.h> +#include <stdint.h> + +/* The next set of functions return the gpio table and fill in the number of + * entries for each table. */ + +const struct pad_config *variant_gpio_table(size_t *num); +const struct pad_config *variant_early_gpio_table(size_t *num); + +#endif /*__BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h b/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h new file mode 100644 index 0000000..bf23f6e --- /dev/null +++ b/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h @@ -0,0 +1,14 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef MAINBOARD_GPIO_H +#define MAINBOARD_GPIO_H + +#include <baseboard/gpio.h> + +#endif /* MAINBOARD_GPIO_H */
Hello Justin TerAvest, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38278
to look at the new patch set (#3).
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 7 files changed, 77 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/38278/3
Hello Justin TerAvest, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38278
to look at the new patch set (#4).
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c M src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 8 files changed, 83 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/38278/4
Justin TerAvest has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 4: Code-Review+2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 4: Code-Review+2
Furquan Shaikh has removed a vote from this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Removed Code-Review+2 by Furquan Shaikh furquan@google.com
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38278/4/src/mainboard/google/dedede... File src/mainboard/google/dedede/variants/baseboard/gpio.c:
https://review.coreboot.org/c/coreboot/+/38278/4/src/mainboard/google/dedede... PS4, Line 23: * __weak
https://review.coreboot.org/c/coreboot/+/38278/4/src/mainboard/google/dedede... PS4, Line 29: * __weak
Hello Justin TerAvest, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38278
to look at the new patch set (#5).
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c M src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 8 files changed, 83 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/38278/5
Karthik Ramasubramanian has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38278/4/src/mainboard/google/dedede... File src/mainboard/google/dedede/variants/baseboard/gpio.c:
https://review.coreboot.org/c/coreboot/+/38278/4/src/mainboard/google/dedede... PS4, Line 23: *
__weak
Done
https://review.coreboot.org/c/coreboot/+/38278/4/src/mainboard/google/dedede... PS4, Line 29: *
__weak
Done
Aamir Bohra has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 5:
(3 comments)
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... File src/mainboard/google/dedede/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 9: #include <baseboard/gpio.h> not needed?
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... File src/mainboard/google/dedede/mainboard.c:
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 9: #include <baseboard/gpio.h> not needed?
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 13: #include <variant/gpio.h> not needed?
Karthik Ramasubramanian has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... File src/mainboard/google/dedede/mainboard.c:
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 9: #include <baseboard/gpio.h>
not needed?
Currently the header is empty, but once you start adding things to the header you need to include it.
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 13: #include <variant/gpio.h>
not needed?
Currently there are no variants. But once we start adding variants, you need to include it.
Hello Balaji Manigandan, Aamir Bohra, Justin TerAvest, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38278
to look at the new patch set (#6).
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c M src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 8 files changed, 78 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/38278/6
Karthik Ramasubramanian has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 6:
(3 comments)
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... File src/mainboard/google/dedede/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 9: #include <baseboard/gpio.h>
not needed?
Done
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... File src/mainboard/google/dedede/mainboard.c:
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 9: #include <baseboard/gpio.h>
Currently the header is empty, but once you start adding things to the header you need to include it […]
Done
https://review.coreboot.org/c/coreboot/+/38278/5/src/mainboard/google/dedede... PS5, Line 13: #include <variant/gpio.h>
Currently there are no variants. But once we start adding variants, you need to include it.
Done
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 6: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/38278/6/src/mainboard/google/dedede... File src/mainboard/google/dedede/variants/baseboard/gpio.c:
https://review.coreboot.org/c/coreboot/+/38278/6/src/mainboard/google/dedede... PS6, Line 20: / nit: tab before comment?
Hello Balaji Manigandan, Aamir Bohra, Justin TerAvest, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38278
to look at the new patch set (#7).
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c M src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 8 files changed, 78 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/38278/7
Karthik Ramasubramanian has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38278/6/src/mainboard/google/dedede... File src/mainboard/google/dedede/variants/baseboard/gpio.c:
https://review.coreboot.org/c/coreboot/+/38278/6/src/mainboard/google/dedede... PS6, Line 20: /
nit: tab before comment?
Done
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 8: Code-Review+2
Aamir Bohra has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
Patch Set 9: Code-Review+2
Furquan Shaikh has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38278 )
Change subject: mb/google/dedede: Add GPIO stubs ......................................................................
mb/google/dedede: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage.
BUG=b:144768001 TEST=Build Test
Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian kramasub@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38278 Reviewed-by: Aamir Bohra aamir.bohra@intel.com Reviewed-by: Furquan Shaikh furquan@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/mainboard/google/dedede/Kconfig M src/mainboard/google/dedede/Makefile.inc M src/mainboard/google/dedede/bootblock.c M src/mainboard/google/dedede/mainboard.c A src/mainboard/google/dedede/variants/baseboard/Makefile.inc A src/mainboard/google/dedede/variants/baseboard/gpio.c M src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h 8 files changed, 78 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved Aamir Bohra: Looks good to me, approved
diff --git a/src/mainboard/google/dedede/Kconfig b/src/mainboard/google/dedede/Kconfig index 02e4e51..7c42404 100644 --- a/src/mainboard/google/dedede/Kconfig +++ b/src/mainboard/google/dedede/Kconfig @@ -32,4 +32,8 @@ int default 2
+config VARIANT_DIR + string + default "dedede" if BOARD_GOOGLE_DEDEDE + endif #BOARD_GOOGLE_BASEBOARD_DEDEDE diff --git a/src/mainboard/google/dedede/Makefile.inc b/src/mainboard/google/dedede/Makefile.inc index c2fc419..8f50113 100644 --- a/src/mainboard/google/dedede/Makefile.inc +++ b/src/mainboard/google/dedede/Makefile.inc @@ -4,3 +4,7 @@
subdirs-y += variants/baseboard CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include + +VARIANT_DIR:=$(call strip_quotes,$(CONFIG_VARIANT_DIR)) +subdirs-y += variants/$(VARIANT_DIR) +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/google/dedede/bootblock.c b/src/mainboard/google/dedede/bootblock.c index 11186f7..8685fa7 100644 --- a/src/mainboard/google/dedede/bootblock.c +++ b/src/mainboard/google/dedede/bootblock.c @@ -6,9 +6,14 @@ * SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/variants.h> #include <bootblock_common.h>
void bootblock_mainboard_init(void) { - /* TODO: Perform mainboard initialization */ + const struct pad_config *pads; + size_t num; + + pads = variant_early_gpio_table(&num); + gpio_configure_pads(pads, num); } diff --git a/src/mainboard/google/dedede/mainboard.c b/src/mainboard/google/dedede/mainboard.c index 51b1aa4..3b36abe 100644 --- a/src/mainboard/google/dedede/mainboard.c +++ b/src/mainboard/google/dedede/mainboard.c @@ -6,11 +6,16 @@ * SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/variants.h> #include <device/device.h>
static void mainboard_init(void *chip_info) { - /* TODO: Perform mainboard initialization */ + const struct pad_config *pads; + size_t num; + + pads = variant_gpio_table(&num); + gpio_configure_pads(pads, num); }
static void mainboard_enable(struct device *dev) diff --git a/src/mainboard/google/dedede/variants/baseboard/Makefile.inc b/src/mainboard/google/dedede/variants/baseboard/Makefile.inc new file mode 100644 index 0000000..7c092e4 --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/Makefile.inc @@ -0,0 +1,5 @@ +bootblock-y += gpio.c + +ramstage-y += gpio.c + +smm-y += gpio.c diff --git a/src/mainboard/google/dedede/variants/baseboard/gpio.c b/src/mainboard/google/dedede/variants/baseboard/gpio.c new file mode 100644 index 0000000..c94af6f --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/gpio.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include <baseboard/gpio.h> +#include <baseboard/variants.h> +#include <commonlib/helpers.h> + +/* Pad configuration in ramstage*/ +static const struct pad_config gpio_table[] = { + /* ToDo: Fill gpio configuration */ +}; + +/* Early pad configuration in bootblock */ +static const struct pad_config early_gpio_table[] = { + /* ToDo: Fill early gpio configuration */ +}; + +const struct pad_config *__weak variant_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(gpio_table); + return gpio_table; +} + +const struct pad_config *__weak variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} diff --git a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h index b326ec0..ebcd594 100644 --- a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h @@ -12,4 +12,10 @@ #include <soc/gpio.h> #include <stdint.h>
+/* The next set of functions return the gpio table and fill in the number of + * entries for each table. */ + +const struct pad_config *variant_gpio_table(size_t *num); +const struct pad_config *variant_early_gpio_table(size_t *num); + #endif /*__BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h b/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h new file mode 100644 index 0000000..bf23f6e --- /dev/null +++ b/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h @@ -0,0 +1,14 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef MAINBOARD_GPIO_H +#define MAINBOARD_GPIO_H + +#include <baseboard/gpio.h> + +#endif /* MAINBOARD_GPIO_H */