From patchwork Mon Jul 11 07:39:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Salveti X-Patchwork-Id: 2640 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 04C1723F3F for ; Mon, 11 Jul 2011 07:39:41 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id B37DDA183D4 for ; Mon, 11 Jul 2011 07:39:40 +0000 (UTC) Received: by qwb8 with SMTP id 8so2496143qwb.11 for ; Mon, 11 Jul 2011 00:39:40 -0700 (PDT) Received: by 10.229.68.200 with SMTP id w8mr3634609qci.114.1310369979973; Mon, 11 Jul 2011 00:39:39 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs199998qcb; Mon, 11 Jul 2011 00:39:39 -0700 (PDT) Received: by 10.236.191.68 with SMTP id f44mr4613251yhn.476.1310369979099; Mon, 11 Jul 2011 00:39:39 -0700 (PDT) Received: from mail-gx0-f178.google.com (mail-gx0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id q66si31212860yhj.82.2011.07.11.00.39.37 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jul 2011 00:39:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of ricardo.salveti@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of ricardo.salveti@linaro.org) smtp.mail=ricardo.salveti@linaro.org Received: by gxk8 with SMTP id 8so1679713gxk.37 for ; Mon, 11 Jul 2011 00:39:37 -0700 (PDT) Received: by 10.150.53.14 with SMTP id b14mr3957102yba.181.1310369977490; Mon, 11 Jul 2011 00:39:37 -0700 (PDT) Received: from localhost.localdomain ([201.82.65.93]) by mx.google.com with ESMTPS id s21sm510693ybm.15.2011.07.11.00.39.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jul 2011 00:39:35 -0700 (PDT) From: Ricardo Salveti de Araujo To: x-loader@googlegroups.com Cc: patches@linaro.org, Ricardo Salveti de Araujo Subject: [PATCH v2] omap4: pandaboard: ehci fref_clkout per board revision Date: Mon, 11 Jul 2011 04:39:17 -0300 Message-Id: <1310369957-28444-1-git-send-email-ricardo.salveti@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1305973002-28352-1-git-send-email-ricardo.salveti@linaro.org> References: <1305973002-28352-1-git-send-email-ricardo.salveti@linaro.org> Add support for correctly configuring the fref_clkout depending on the board revision of the pandaboard. This patch is necessary to make u-boot work with the smsc usb+ethernet driver. Tested USB+Eth with TFTP and PXE using linaro u-boot: http://git.linaro.org/gitweb?p=boot/u-boot-linaro-stable.git;a=summary Based on patch from David Anders from omap4_panda_L24.9 branch at gitorious.org/pandaboard x-loader tree. Changes since v1: * Moving the code from s_init instead of adding a new block Signed-off-by: Ricardo Salveti de Araujo --- board/omap4430panda/omap4430panda.c | 58 +++++++++++++++------------------- 1 files changed, 26 insertions(+), 32 deletions(-) diff --git a/board/omap4430panda/omap4430panda.c b/board/omap4430panda/omap4430panda.c index 9b4e457..bcee6fe 100644 --- a/board/omap4430panda/omap4430panda.c +++ b/board/omap4430panda/omap4430panda.c @@ -531,6 +531,7 @@ static void ddr_init(void) *****************************************/ int board_init(void) { + unsigned int rev = omap_revision(); unsigned int v; /* @@ -546,10 +547,32 @@ int board_init(void) v = __raw_readl(OMAP44XX_GPIO_BASE2 + __GPIO_DATAOUT); __raw_writel((v & ~(1 << 30)), OMAP44XX_GPIO_BASE2 + __GPIO_DATAOUT); - /* kill USB PLL */ + if (rev == OMAP4430_ES1_0) + return 0; - v = __raw_readl(CM_CLKMODE_DPLL_USB); - __raw_writel((v & ~7) | 1, CM_CLKMODE_DPLL_USB); + if (__raw_readl(OMAP44XX_GPIO_BASE6 + __GPIO_DATAIN) & (1 << 22)) { + /* enable software ioreq */ + sr32(OMAP44XX_SCRM_AUXCLK3, 8, 1, 0x1); + /* set for sys_clk (38.4MHz) */ + sr32(OMAP44XX_SCRM_AUXCLK3, 1, 2, 0x0); + /* set divisor to 2 */ + sr32(OMAP44XX_SCRM_AUXCLK3, 16, 4, 0x1); + /* set the clock source to active */ + sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1); + /* enable clocks */ + sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); + } else { + /* enable software ioreq */ + sr32(OMAP44XX_SCRM_AUXCLK1, 8, 1, 0x1); + /* set for PER_DPLL */ + sr32(OMAP44XX_SCRM_AUXCLK1, 1, 2, 0x2); + /* set divisor to 16 */ + sr32(OMAP44XX_SCRM_AUXCLK1, 16, 4, 0xf); + /* set the clock source to active */ + sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1); + /* enable clocks */ + sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); + } return 0; } @@ -683,8 +706,6 @@ static int scale_vcores(void) void s_init(void) { - unsigned int rev = omap_revision(); - /* * this is required to survive the muxconf in the case the ROM * started up USB OTG @@ -707,33 +728,6 @@ void s_init(void) /* setup_auxcr(get_device_type(), external_boot); */ ddr_init(); - - if (rev == OMAP4430_ES1_0) - return; - - if (__raw_readl(OMAP44XX_GPIO_BASE6 + __GPIO_DATAIN) & (1 << 22)) { - /* enable software ioreq */ - sr32(OMAP44XX_SCRM_AUXCLK3, 8, 1, 0x1); - /* set for sys_clk (38.4MHz) */ - sr32(OMAP44XX_SCRM_AUXCLK3, 1, 2, 0x0); - /* set divisor to 2 */ - sr32(OMAP44XX_SCRM_AUXCLK3, 16, 4, 0x1); - /* set the clock source to active */ - sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1); - /* enable clocks */ - sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); - } else { - /* enable software ioreq */ - sr32(OMAP44XX_SCRM_AUXCLK1, 8, 1, 0x1); - /* set for PER_DPLL */ - sr32(OMAP44XX_SCRM_AUXCLK1, 1, 2, 0x2); - /* set divisor to 16 */ - sr32(OMAP44XX_SCRM_AUXCLK1, 16, 4, 0xf); - /* set the clock source to active */ - sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1); - /* enable clocks */ - sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); - } } /*******************************************************