* [U-Boot] [PATCH] arm: exynos: odroid: Fix build if BOARD_TYPES are not set
@ 2019-03-06 9:23 ` Krzysztof Kozlowski
2019-03-12 1:10 ` Minkyu Kang
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2019-03-06 9:23 UTC (permalink / raw)
To: u-boot
CONFIG_BOARD_TYPES is necessary for Odroid X/X2/U3 boards to detect
proper revision. However building should succeed even without it.
While moving code around, document also the reference clock selection.
This fixes the build error without CONFIG_BOARD_TYPES:
board/samsung/odroid/odroid.c: In function 'board_usb_init':
board/samsung/odroid/odroid.c:473:8: error: 'gd_t' {aka 'volatile struct global_data'} has no member named 'board_type'
if (gd->board_type == ODROID_TYPE_U3)
^~
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
board/samsung/odroid/odroid.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 552333fe869d..b11d99223346 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -462,18 +462,33 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
+static void set_usb3503_ref_clk(void)
+{
+#ifdef CONFIG_BOARD_TYPES
+ /*
+ * gpx3-0 chooses primary (low) or secondary (high) reference clock
+ * frequencies table. The choice of clock is done through hard-wired
+ * REF_SEL pins.
+ * The Odroid Us have reference clock at 24 MHz (00 entry from secondary
+ * table) and Odroid Xs have it at 26 MHz (01 entry from primary table).
+ */
+ if (gd->board_type == ODROID_TYPE_U3)
+ gpio_direction_output(EXYNOS4X12_GPIO_X30, 0);
+ else
+ gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
+#else
+ /* Choose Odroid Xs frequency without board types */
+ gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
+#endif /* CONFIG_BOARD_TYPES */
+}
+
int board_usb_init(int index, enum usb_init_type init)
{
#ifdef CONFIG_CMD_USB
struct udevice *dev;
int ret;
- /* Set Ref freq 0 => 24MHz, 1 => 26MHz*/
- /* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
- if (gd->board_type == ODROID_TYPE_U3)
- gpio_direction_output(EXYNOS4X12_GPIO_X30, 0);
- else
- gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
+ set_usb3503_ref_clk();
/* Disconnect, Reset, Connect */
gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] arm: exynos: odroid: Fix build if BOARD_TYPES are not set
2019-03-06 9:23 ` [U-Boot] [PATCH] arm: exynos: odroid: Fix build if BOARD_TYPES are not set Krzysztof Kozlowski
@ 2019-03-12 1:10 ` Minkyu Kang
0 siblings, 0 replies; 2+ messages in thread
From: Minkyu Kang @ 2019-03-12 1:10 UTC (permalink / raw)
To: u-boot
On 06/03/2019 18:23, Krzysztof Kozlowski wrote:
> CONFIG_BOARD_TYPES is necessary for Odroid X/X2/U3 boards to detect
> proper revision. However building should succeed even without it.
> While moving code around, document also the reference clock selection.
>
> This fixes the build error without CONFIG_BOARD_TYPES:
>
> board/samsung/odroid/odroid.c: In function 'board_usb_init':
> board/samsung/odroid/odroid.c:473:8: error: 'gd_t' {aka 'volatile struct global_data'} has no member named 'board_type'
> if (gd->board_type == ODROID_TYPE_U3)
> ^~
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
> board/samsung/odroid/odroid.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> index 552333fe869d..b11d99223346 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -462,18 +462,33 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
>
> #if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
>
> +static void set_usb3503_ref_clk(void)
> +{
> +#ifdef CONFIG_BOARD_TYPES
> + /*
> + * gpx3-0 chooses primary (low) or secondary (high) reference clock
> + * frequencies table. The choice of clock is done through hard-wired
> + * REF_SEL pins.
> + * The Odroid Us have reference clock at 24 MHz (00 entry from secondary
> + * table) and Odroid Xs have it at 26 MHz (01 entry from primary table).
> + */
> + if (gd->board_type == ODROID_TYPE_U3)
> + gpio_direction_output(EXYNOS4X12_GPIO_X30, 0);
> + else
> + gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
> +#else
> + /* Choose Odroid Xs frequency without board types */
> + gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
> +#endif /* CONFIG_BOARD_TYPES */
> +}
> +
> int board_usb_init(int index, enum usb_init_type init)
> {
> #ifdef CONFIG_CMD_USB
> struct udevice *dev;
> int ret;
>
> - /* Set Ref freq 0 => 24MHz, 1 => 26MHz*/
> - /* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
> - if (gd->board_type == ODROID_TYPE_U3)
> - gpio_direction_output(EXYNOS4X12_GPIO_X30, 0);
> - else
> - gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
> + set_usb3503_ref_clk();
>
> /* Disconnect, Reset, Connect */
> gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
>
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-12 1:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20190306092322epcas4p37a0710fb202e6eac1621627239d511e9@epcas4p3.samsung.com>
2019-03-06 9:23 ` [U-Boot] [PATCH] arm: exynos: odroid: Fix build if BOARD_TYPES are not set Krzysztof Kozlowski
2019-03-12 1:10 ` Minkyu Kang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.