source: trunk/target/linux/brcm47xx/patches-3.0/0008-bcma-add-pci-e-host-mode.patch @ 27301

Last change on this file since 27301 was 27301, checked in by hauke, 5 years ago

brcm47xx: add initial support for devices with bcma bus.

Ethernet and wifi are not working and this is highly experimental.

File size: 4.0 KB
  • drivers/bcma/Kconfig

    From f93062e72447b4a4a51afbe33ea086ce8c922587 Mon Sep 17 00:00:00 2001
    From: Hauke Mehrtens <hauke@hauke-m.de>
    Date: Sun, 19 Jun 2011 17:52:09 +0200
    Subject: [PATCH 08/14] bcma: add pci(e) host mode
    
    This adds some stub for a pci(e) host controller. This controller is
    found on some embedded devices to attach other chips.
    
    Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
    ---
     drivers/bcma/Kconfig                 |    6 ++++
     drivers/bcma/Makefile                |    1 +
     drivers/bcma/bcma_private.h          |    6 ++++
     drivers/bcma/driver_pci.c            |   14 ++++++++++-
     drivers/bcma/driver_pci_host.c       |   43 ++++++++++++++++++++++++++++++++++
     include/linux/bcma/bcma_driver_pci.h |    1 +
     6 files changed, 70 insertions(+), 1 deletions(-)
     create mode 100644 drivers/bcma/driver_pci_host.c
    
    a b config BCMA_HOST_SOC 
    3232        depends on BCMA_DRIVER_MIPS 
    3333        default n 
    3434 
     35config BCMA_DRIVER_PCI_HOSTMODE 
     36        bool "Hostmode support for BCMA PCI core" 
     37        depends on BCMA_DRIVER_MIPS 
     38        help 
     39          PCIcore hostmode operation (external PCI bus). 
     40 
    3541config BCMA_DRIVER_MIPS 
    3642        bool "BCMA Broadcom MIPS core driver" 
    3743        depends on BCMA && MIPS 
  • drivers/bcma/Makefile

    a b  
    11bcma-y                                  += main.o scan.o core.o sprom.o 
    22bcma-y                                  += driver_chipcommon.o driver_chipcommon_pmu.o 
    33bcma-y                                  += driver_pci.o 
     4bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o 
    45bcma-$(CONFIG_BCMA_DRIVER_MIPS)         += driver_mips.o 
    56bcma-$(CONFIG_BCMA_HOST_PCI)            += host_pci.o 
    67bcma-$(CONFIG_BCMA_HOST_SOC)            += host_soc.o 
  • drivers/bcma/bcma_private.h

    a b extern int bcma_chipco_serial_init(struc 
    3838                                   struct bcma_drv_mips_serial_port *ports); 
    3939#endif /* CONFIG_BCMA_DRIVER_MIPS */ 
    4040 
     41#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 
     42/* driver_pci_host.c */ 
     43int bcma_core_pci_in_hostmode(struct bcma_drv_pci *pc); 
     44void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); 
     45#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ 
     46 
    4147#ifdef CONFIG_BCMA_HOST_PCI 
    4248/* host_pci.c */ 
    4349extern int __init bcma_host_pci_init(void); 
  • drivers/bcma/driver_pci.c

    a b static void bcma_pcicore_serdes_workarou 
    159159 
    160160void bcma_core_pci_init(struct bcma_drv_pci *pc) 
    161161{ 
     162        struct bcma_device *core = pc->core; 
     163 
    162164        if (pc->setup_done) 
    163165                return; 
    164         bcma_pcicore_serdes_workaround(pc); 
     166 
     167        if (!bcma_core_is_enabled(core)) 
     168                bcma_core_enable(core, 0); 
     169#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 
     170        pc->hostmode = bcma_core_pci_in_hostmode(pc); 
     171        if (pc->hostmode) 
     172                bcma_core_pci_hostmode_init(pc); 
     173#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ 
     174        if (!pc->hostmode) 
     175                bcma_pcicore_serdes_workaround(pc); 
     176 
    165177        pc->setup_done = true; 
    166178} 
    167179 
  • new file drivers/bcma/driver_pci_host.c

    - +  
     1/* 
     2 * Broadcom specific AMBA 
     3 * PCI Host mode 
     4 * 
     5 * Copyright 2005, Broadcom Corporation 
     6 * 
     7 * Licensed under the GNU/GPL. See COPYING for details. 
     8 */ 
     9 
     10#include "bcma_private.h" 
     11#include <linux/bcma/bcma.h> 
     12 
     13#include <asm/paccess.h> 
     14/* Probe a 32bit value on the bus and catch bus exceptions. 
     15 * Returns nonzero on a bus exception. 
     16 * This is MIPS specific */ 
     17#define mips_busprobe32(val, addr)      get_dbe((val), ((u32 *)(addr))) 
     18 
     19 
     20void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) 
     21{ 
     22        /* TODO: implement PCI host mode */ 
     23} 
     24 
     25int bcma_core_pci_in_hostmode(struct bcma_drv_pci *pc) 
     26{ 
     27        struct bcma_bus *bus = pc->core->bus; 
     28        u16 chipid_top; 
     29        u32 tmp; 
     30 
     31        chipid_top = (bus->chipinfo.id & 0xFF00); 
     32        if (chipid_top != 0x4700 && 
     33            chipid_top != 0x5300) 
     34                return 0; 
     35 
     36/* TODO: add when sprom is available 
     37 * if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) 
     38 *              return 0; 
     39 */ 
     40 
     41        return !mips_busprobe32(tmp, (bus->mmio + (pc->core->core_index * 
     42                                                   BCMA_CORE_SIZE))); 
     43} 
  • include/linux/bcma/bcma_driver_pci.h

    a b struct pci_dev; 
    7878struct bcma_drv_pci { 
    7979        struct bcma_device *core; 
    8080        u8 setup_done:1; 
     81        u8 hostmode:1; 
    8182}; 
    8283 
    8384/* Register access */ 
Note: See TracBrowser for help on using the repository browser.