All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 14/23] x86: Move common FSP functions into a common file
Date: Wed, 28 Jan 2015 09:12:03 +0800	[thread overview]
Message-ID: <CAEUhbmVu906N8H9VZ1pGpw-zD3tfUNLFYxasKNgfm6TL2VNRmw@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ0KDgSDQz+pSdnQZGWgWAVCpZLb=2P3WUUhQ+8tS5hWRw@mail.gmail.com>

Hi Simon,

On Tue, Jan 27, 2015 at 11:15 PM, Simon Glass <sjg@chromium.org> wrote:
> Hi Bin,
>
> On 27 January 2015 at 05:20, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Hi Simon,
>>
>> On Tue, Jan 27, 2015 at 9:23 AM, Simon Glass <sjg@chromium.org> wrote:
>>> Since these board functions seem to be the same for all boards which use
>>> FSP, move them into a common file. We can adjust this later if future FSPs
>>> need more flexibility.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>> ---
>>>
>>>  arch/x86/cpu/queensbay/tnc.c      | 27 ------------
>>>  arch/x86/cpu/queensbay/tnc_pci.c  | 15 -------
>>>  arch/x86/cpu/queensbay/topcliff.c | 32 +-------------
>>>  arch/x86/include/asm/u-boot-x86.h | 17 ++++++++
>>>  arch/x86/lib/fsp/Makefile         |  1 +
>>>  arch/x86/lib/fsp/fsp_common.c     | 88 +++++++++++++++++++++++++++++++++++++++
>>>  6 files changed, 108 insertions(+), 72 deletions(-)
>>>  create mode 100644 arch/x86/lib/fsp/fsp_common.c
>>>
>>> diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
>>> index f9b3bfa..30ab725 100644
>>> --- a/arch/x86/cpu/queensbay/tnc.c
>>> +++ b/arch/x86/cpu/queensbay/tnc.c
>>> @@ -43,30 +43,3 @@ int arch_cpu_init(void)
>>>
>>>         return 0;
>>>  }
>>> -
>>> -int print_cpuinfo(void)
>>> -{
>>> -       post_code(POST_CPU_INFO);
>>> -       return default_print_cpuinfo();
>>> -}
>>> -
>>> -void reset_cpu(ulong addr)
>>> -{
>>> -       /* cold reset */
>>> -       outb(0x06, PORT_RESET);
>>> -}
>>> -
>>> -void board_final_cleanup(void)
>>> -{
>>> -       u32 status;
>>> -
>>> -       /* call into FspNotify */
>>> -       debug("Calling into FSP (notify phase INIT_PHASE_BOOT): ");
>>> -       status = fsp_notify(NULL, INIT_PHASE_BOOT);
>>> -       if (status != FSP_SUCCESS)
>>> -               debug("fail, error code %x\n", status);
>>> -       else
>>> -               debug("OK\n");
>>> -
>>> -       return;
>>> -}
>>> diff --git a/arch/x86/cpu/queensbay/tnc_pci.c b/arch/x86/cpu/queensbay/tnc_pci.c
>>> index 9b0b725..6c291f9 100644
>>> --- a/arch/x86/cpu/queensbay/tnc_pci.c
>>> +++ b/arch/x86/cpu/queensbay/tnc_pci.c
>>> @@ -44,18 +44,3 @@ void board_pci_setup_hose(struct pci_controller *hose)
>>>
>>>         hose->region_count = 4;
>>>  }
>>> -
>>> -int board_pci_post_scan(struct pci_controller *hose)
>>> -{
>>> -       u32 status;
>>> -
>>> -       /* call into FspNotify */
>>> -       debug("Calling into FSP (notify phase INIT_PHASE_PCI): ");
>>> -       status = fsp_notify(NULL, INIT_PHASE_PCI);
>>> -       if (status != FSP_SUCCESS)
>>> -               debug("fail, error code %x\n", status);
>>> -       else
>>> -               debug("OK\n");
>>> -
>>> -       return 0;
>>> -}
>>> diff --git a/arch/x86/cpu/queensbay/topcliff.c b/arch/x86/cpu/queensbay/topcliff.c
>>> index b01422a..25032cc 100644
>>> --- a/arch/x86/cpu/queensbay/topcliff.c
>>> +++ b/arch/x86/cpu/queensbay/topcliff.c
>>> @@ -5,43 +5,15 @@
>>>   */
>>>
>>>  #include <common.h>
>>> -#include <errno.h>
>>> -#include <malloc.h>
>>> -#include <pci.h>
>>>  #include <pci_ids.h>
>>> -#include <sdhci.h>
>>>
>>>  static struct pci_device_id mmc_supported[] = {
>>>         { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TCF_SDIO_0 },
>>>         { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TCF_SDIO_1 },
>>> -       { }
>>>  };
>>>
>>>  int cpu_mmc_init(bd_t *bis)
>>>  {
>>> -       struct sdhci_host *mmc_host;
>>> -       pci_dev_t devbusfn;
>>> -       u32 iobase;
>>> -       int ret;
>>> -       int i;
>>> -
>>> -       for (i = 0; i < ARRAY_SIZE(mmc_supported); i++) {
>>> -               devbusfn =  pci_find_devices(mmc_supported, i);
>>> -               if (devbusfn == -1)
>>> -                       return -ENODEV;
>>> -
>>> -               mmc_host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
>>> -               if (!mmc_host)
>>> -                       return -ENOMEM;
>>> -
>>> -               mmc_host->name = "Topcliff SDHCI";
>>> -               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &iobase);
>>> -               mmc_host->ioaddr = (void *)iobase;
>>> -               mmc_host->quirks = 0;
>>> -               ret = add_sdhci(mmc_host, 0, 0);
>>> -               if (ret)
>>> -                       return ret;
>>> -       }
>>> -
>>> -       return 0;
>>> +       return fsp_cpu_mmc_init("Topcliff SDHCI", mmc_supported,
>>> +                               ARRAY_SIZE(mmc_supported));
>>>  }
>>
>> I don't think this function should be moved to fsp_common.c as it has
>> nothing related to FSP. We can move this whole function to
>> drivers/mmc/, something like intel_mmc.c or intel_sdhc.c.
>
> How about pci_mmc.c if it is generic to PCI?
>

Sounds good.

[snip]

Regards,
Bin

  reply	other threads:[~2015-01-28  1:12 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27  1:22 [U-Boot] [PATCH 0/23] x86: Add bare support for Intel Minnowboard Max Simon Glass
2015-01-27  1:22 ` [U-Boot] [PATCH 01/23] x86: Enhance the microcode tool to support header files as input Simon Glass
2015-01-27  8:59   ` Bin Meng
2015-01-27 15:12     ` Simon Glass
2015-01-28  1:10       ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 02/23] pci: Add a function to find a device by class Simon Glass
2015-01-27  9:53   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 03/23] x86: pci: Add PCI IDs for Minnowboard Max Simon Glass
2015-01-27  9:44   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 04/23] x86: video: Enable video " Simon Glass
2015-01-27  9:45   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 05/23] usb: pci: Use pci_find_class() to find the device Simon Glass
2015-01-27  9:55   ` Bin Meng
2015-01-27 17:50   ` Marek Vasut
2015-01-27 20:53     ` Simon Glass
2015-01-27 21:16       ` Marek Vasut
2015-01-27  1:23 ` [U-Boot] [PATCH 06/23] usb: pci: Add XHCI driver for PCI Simon Glass
2015-01-27 10:06   ` Bin Meng
2015-01-27 17:57   ` Marek Vasut
2015-01-27 20:52     ` Simon Glass
2015-01-27 21:18       ` Marek Vasut
2015-01-27  1:23 ` [U-Boot] [PATCH 07/23] x86: Add an option to enabling building a ROM file Simon Glass
2015-01-27 10:14   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 08/23] x86: Make MMCONF_BASE_ADDRESS common across x86 Simon Glass
2015-01-27 10:22   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 09/23] x86: video: Allow video ROM execution to fall back to the other method Simon Glass
2015-01-27 10:37   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 10/23] x86: bootstage: Add time measurement for vesa start-up Simon Glass
2015-01-27 10:42   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 11/23] x86: Move common FSP code into a common location Simon Glass
2015-01-27 10:52   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 12/23] x86: Adjust the FSP types slightly Simon Glass
2015-01-27 12:25   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 13/23] x86: Make CAR and DRAM FSP code common Simon Glass
2015-01-27 12:27   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 14/23] x86: Move common FSP functions into a common file Simon Glass
2015-01-27 12:20   ` Bin Meng
2015-01-27 15:15     ` Simon Glass
2015-01-28  1:12       ` Bin Meng [this message]
2015-01-27  1:23 ` [U-Boot] [PATCH 15/23] x86: Remove unnecessary casts and fix comment typos Simon Glass
2015-01-27 12:32   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 16/23] x86: Allow FSP Kconfig settings for all x86 Simon Glass
2015-01-27 12:45   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 17/23] x86: Define cache line size Simon Glass
2015-01-27 13:05   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 18/23] x86: Allow a UART to be set up before the FSP is ready Simon Glass
2015-01-27 13:12   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 19/23] x86: spi: Support ValleyView in ICH SPI driver Simon Glass
2015-01-27 14:00   ` Bin Meng
2015-01-28  5:17     ` Simon Glass
2015-01-28  6:02       ` Bin Meng
2015-01-28 23:45         ` Simon Glass
2015-01-27  1:23 ` [U-Boot] [PATCH 20/23] scsi: bootstage: Measure time taken to scan the bus Simon Glass
2015-01-27 13:20   ` Bin Meng
2015-01-27 17:38   ` Rob Herring
2015-01-28  1:20     ` Bin Meng
2015-01-28  5:07       ` Simon Glass
2015-01-27  1:23 ` [U-Boot] [PATCH 21/23] x86: Enable bootstage features Simon Glass
2015-01-27 13:26   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 22/23] x86: Add some documentation on how to port U-Boot on x86 Simon Glass
2015-01-27  8:51   ` Bin Meng
2015-01-27  1:23 ` [U-Boot] [PATCH 23/23] x86: Add support for Intel Minnowboard Max Simon Glass
2015-01-27 14:25   ` Bin Meng
2015-01-27 14:31 ` [U-Boot] [PATCH 0/23] x86: Add bare " Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEUhbmVu906N8H9VZ1pGpw-zD3tfUNLFYxasKNgfm6TL2VNRmw@mail.gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.