Re: [RFC][PATCH V4] axi: add AXI bus driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/4/13 Larry Finger <Larry.Finger@xxxxxxxxxxxx>:
> On 04/12/2011 01:52 PM, RafaÅ MiÅecki wrote:
>>
>> Cc: Greg KH<greg@xxxxxxxxx>
>> Cc: Michael BÃsch<mb@xxxxxxxxx>
>> Cc: Larry Finger<Larry.Finger@xxxxxxxxxxxx>
>> Cc: George Kashperko<george@xxxxxxxxxxx>
>> Cc: Arend van Spriel<arend@xxxxxxxxxxxx>
>> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
>> Cc: Russell King<rmk@xxxxxxxxxxxxxxxx>
>> Cc: Arnd Bergmann<arnd@xxxxxxxx>
>> Cc: Andy Botting<andy@xxxxxxxxxxxxxxx>
>> Cc: linuxdriverproject<devel@xxxxxxxxxxxxxxxxxxxxxx>
>> Cc: linux-kernel@xxxxxxxxxxxxxxx<linux-kernel@xxxxxxxxxxxxxxx>
>> Signed-off-by: RafaÅ MiÅecki<zajec5@xxxxxxxxx>
>> ---
>> Greg: is this what you expected from dynamic allocation and documentation?
>>
>> Did I miss any other comments about something to change?
>>
>> V2: Rename to axi
>> Â Â Use DEFINE_PCI_DEVICE_TABLE in bridge
>> Â Â Make use of pr_fmt and pr_*
>> Â Â Store core class
>> Â Â Rename bridge to not b43 specific
>> Â Â Replace magic 0x1000 with BCMAI_CORE_SIZE
>> Â Â Remove some old "ssb" names and defines
>> Â Â Move BCMAI_ADDR_BASE def
>> Â Â Add drvdata field
>> V3: Fix reloading (kfree issue)
>> Â Â Add 14e4:0x4331
>> Â Â Fix non-initialized struct issue
>> Â Â Drop useless inline functions wrappers for pci core drv
>> Â Â Proper pr_* usage
>> V3.1: Include forgotten changes (pr_* and include related)
>> Â Â Explain why we dare to implement empty release function
>> V4: Add ABI documentation
>> Â Â Move struct device to wrapper and alloc it dynamically
>> Â Â checkpatch.pl pointed fixes
>> ---
>> ÂDocumentation/ABI/testing/sysfs-bus-axi  |  31 +++
>> Âdrivers/Kconfig              |  Â2 +
>> Âdrivers/Makefile             Â|  Â1 +
>> Âdrivers/axi/Kconfig            |  33 +++
>> Âdrivers/axi/Makefile           Â|  Â7 +
>> Âdrivers/axi/TODO Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â3 +
>> Âdrivers/axi/axi_pci_bridge.c       Â|  33 +++
>> Âdrivers/axi/axi_private.h         |  37 +++
>> Âdrivers/axi/core.c            Â|  51 ++++
>> Âdrivers/axi/driver_chipcommon.c      |  87 +++++++
>> Âdrivers/axi/driver_chipcommon_pmu.c    | Â134 ++++++++++
>> Âdrivers/axi/driver_pci.c         Â| Â163 ++++++++++++
>> Âdrivers/axi/host_pci.c          Â| Â178 +++++++++++++
>> Âdrivers/axi/main.c            Â| Â271 ++++++++++++++++++++
>> Âdrivers/axi/scan.c            Â| Â392
>> +++++++++++++++++++++++++++++
>> Âdrivers/axi/scan.h            Â|  56 ++++
>> Âinclude/linux/axi/axi.h          | Â227 +++++++++++++++++
>> Âinclude/linux/axi/axi_driver_chipcommon.h | Â308 ++++++++++++++++++++++
>> Âinclude/linux/axi/axi_driver_pci.h    Â|  89 +++++++
>> Âinclude/linux/axi/axi_regs.h       Â|  34 +++
>> Âinclude/linux/mod_devicetable.h      |  17 ++
>> Âscripts/mod/file2alias.c         Â|  21 ++
>> Â22 files changed, 2175 insertions(+), 0 deletions(-)
>> Âcreate mode 100644 Documentation/ABI/testing/sysfs-bus-axi
>> Âcreate mode 100644 drivers/axi/Kconfig
>> Âcreate mode 100644 drivers/axi/Makefile
>> Âcreate mode 100644 drivers/axi/TODO
>> Âcreate mode 100644 drivers/axi/axi_pci_bridge.c
>> Âcreate mode 100644 drivers/axi/axi_private.h
>> Âcreate mode 100644 drivers/axi/core.c
>> Âcreate mode 100644 drivers/axi/driver_chipcommon.c
>> Âcreate mode 100644 drivers/axi/driver_chipcommon_pmu.c
>> Âcreate mode 100644 drivers/axi/driver_pci.c
>> Âcreate mode 100644 drivers/axi/host_pci.c
>> Âcreate mode 100644 drivers/axi/main.c
>> Âcreate mode 100644 drivers/axi/scan.c
>> Âcreate mode 100644 drivers/axi/scan.h
>> Âcreate mode 100644 include/linux/axi/axi.h
>> Âcreate mode 100644 include/linux/axi/axi_driver_chipcommon.h
>> Âcreate mode 100644 include/linux/axi/axi_driver_pci.h
>> Âcreate mode 100644 include/linux/axi/axi_regs.h
>>
>> diff --git a/Documentation/ABI/testing/sysfs-bus-axi
>> b/Documentation/ABI/testing/sysfs-bus-axi
>> new file mode 100644
>> index 0000000..6223612
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/sysfs-bus-axi
>> @@ -0,0 +1,31 @@
>> +What: Â Â Â Â Â/sys/bus/axi/devices/.../class
>> +Date: Â Â Â Â ÂApril 2011
>> +KernelVersion: 2.6.40
>> +Contact: Â Â Â RafaÅ MiÅecki<zajec5@xxxxxxxxx>
>> +Description:
>> + Â Â Â Â Â Â Â Each AXI core is identified by few fields, including class
>> it
>> + Â Â Â Â Â Â Â belongs to. See include/linux/axi/axi.h for possible
>> values.
>> +
>> +What: Â Â Â Â Â/sys/bus/axi/devices/.../manuf
>> +Date: Â Â Â Â ÂApril 2011
>> +KernelVersion: 2.6.40
>> +Contact: Â Â Â RafaÅ MiÅecki<zajec5@xxxxxxxxx>
>> +Description:
>> + Â Â Â Â Â Â Â Each AXI core has it's manufacturer id. See
>> + Â Â Â Â Â Â Â include/linux/axi/axi.h for possible values.
>> +
>> +What: Â Â Â Â Â/sys/bus/axi/devices/.../rev
>> +Date: Â Â Â Â ÂApril 2011
>> +KernelVersion: 2.6.40
>> +Contact: Â Â Â RafaÅ MiÅecki<zajec5@xxxxxxxxx>
>> +Description:
>> + Â Â Â Â Â Â Â AXI cores of the same type can still slightly differ
>> depending
>> + Â Â Â Â Â Â Â on their revision. Use it for detailed programming.
>> +
>> +What: Â Â Â Â Â/sys/bus/axi/devices/.../id
>> +Date: Â Â Â Â ÂApril 2011
>> +KernelVersion: 2.6.40
>> +Contact: Â Â Â RafaÅ MiÅecki<zajec5@xxxxxxxxx>
>> +Description:
>> + Â Â Â Â Â Â Â There are a few types of AXI cores, they can be identified
>> by
>> + Â Â Â Â Â Â Â id field.
>> diff --git a/drivers/Kconfig b/drivers/Kconfig
>> index 177c7d1..1244e8c 100644
>> --- a/drivers/Kconfig
>> +++ b/drivers/Kconfig
>> @@ -68,6 +68,8 @@ source "drivers/watchdog/Kconfig"
>>
>> Âsource "drivers/ssb/Kconfig"
>>
>> +source "drivers/axi/Kconfig"
>> +
>> Âsource "drivers/mfd/Kconfig"
>>
>> Âsource "drivers/regulator/Kconfig"
>> diff --git a/drivers/Makefile b/drivers/Makefile
>> index 3f135b6..6e1979b 100644
>> --- a/drivers/Makefile
>> +++ b/drivers/Makefile
>> @@ -110,6 +110,7 @@ obj-$(CONFIG_HID) Â Â Â Â Â += hid/
>> Âobj-$(CONFIG_PPC_PS3) Â Â Â Â += ps3/
>> Âobj-$(CONFIG_OF) Â Â Â Â Â Â Â+= of/
>> Âobj-$(CONFIG_SSB) Â Â Â Â Â Â += ssb/
>> +obj-$(CONFIG_AXI) Â Â Â Â Â Â Â+= axi/
>> Âobj-$(CONFIG_VHOST_NET) Â Â Â Â Â Â Â += vhost/
>> Âobj-$(CONFIG_VLYNQ) Â Â Â Â Â += vlynq/
>> Âobj-$(CONFIG_STAGING) Â Â Â Â += staging/
>> diff --git a/drivers/axi/Kconfig b/drivers/axi/Kconfig
>> new file mode 100644
>> index 0000000..6221af0
>> --- /dev/null
>> +++ b/drivers/axi/Kconfig
>> @@ -0,0 +1,33 @@
>> +config AXI_POSSIBLE
>> + Â Â Â bool
>> + Â Â Â depends on HAS_IOMEM&& ÂHAS_DMA
>> + Â Â Â default y
>> +
>> +menu "AMBA AXI"
>> + Â Â Â depends on AXI_POSSIBLE
>> +
>> +config AXI
>> + Â Â Â tristate "AXI support"
>> + Â Â Â depends on AXI_POSSIBLE
>> + Â Â Â help
>> + Â Â Â Â Bus driver for one of the Advanced Microcontroller Bus
>> Architecture
>> + Â Â Â Â interfaces: Advanced eXtensible Interface.
>> +
>> +config AXI_HOST_PCI_POSSIBLE
>> + Â Â Â bool
>> + Â Â Â depends on AXI&& ÂPCI = y
>> + Â Â Â default y
>> +
>> +config AXI_HOST_PCI
>> + Â Â Â bool "Support for AXI on PCI-host bus"
>> + Â Â Â depends on AXI_HOST_PCI_POSSIBLE
>> +
>> +config AXI_DEBUG
>> + Â Â Â bool "AXI debugging"
>> + Â Â Â depends on AXI
>> + Â Â Â help
>> + Â Â Â Â This turns on additional debugging messages.
>> +
>> + Â Â Â Â If unsure, say N
>> +
>> +endmenu
>> diff --git a/drivers/axi/Makefile b/drivers/axi/Makefile
>> new file mode 100644
>> index 0000000..50d6797
>> --- /dev/null
>> +++ b/drivers/axi/Makefile
>> @@ -0,0 +1,7 @@
>> +axi-y                 Â+= main.o scan.o core.o
>> +axi-y                 Â+= driver_chipcommon.o
>> driver_chipcommon_pmu.o
>> +axi-y                 Â+= driver_pci.o
>> +axi-$(CONFIG_AXI_HOST_PCI) Â Â Â Â Â Â += host_pci.o axi_pci_bridge.o
>> +obj-$(CONFIG_AXI) Â Â Â Â Â Â Â Â Â Â Â+= axi.o
>> +
>> +ccflags-$(CONFIG_AXI_DEBUG) Â Â Â Â Â Â:= -DDEBUG
>> diff --git a/drivers/axi/TODO b/drivers/axi/TODO
>> new file mode 100644
>> index 0000000..5190336
>> --- /dev/null
>> +++ b/drivers/axi/TODO
>> @@ -0,0 +1,3 @@
>> +- Interrupts
>> +- Defines for PCI core driver
>> +- Convert axi_bus->cores into linked list
>> diff --git a/drivers/axi/axi_pci_bridge.c b/drivers/axi/axi_pci_bridge.c
>> new file mode 100644
>> index 0000000..17e882c
>> --- /dev/null
>> +++ b/drivers/axi/axi_pci_bridge.c
>> @@ -0,0 +1,33 @@
>> +/*
>> + * AXI PCI bridge module
>> + *
>> + * Licensed under the GNU/GPL. See COPYING for details.
>> + */
>> +
>> +#include "axi_private.h"
>> +
>> +#include<linux/axi/axi.h>
>> +#include<linux/pci.h>
>> +
>> +static DEFINE_PCI_DEVICE_TABLE(axi_pci_bridge_tbl) = {
>> + Â Â Â { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
>> + Â Â Â { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },
>> + Â Â Â { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
>> + Â Â Â { 0, },
>> +};
>> +MODULE_DEVICE_TABLE(pci, axi_pci_bridge_tbl);
>> +
>> +static struct pci_driver axi_pci_bridge_driver = {
>> + Â Â Â .name = "axi-pci-bridge",
>> + Â Â Â .id_table = axi_pci_bridge_tbl,
>> +};
>> +
>> +int __init axi_pci_bridge_init(void)
>> +{
>> + Â Â Â return axi_host_pci_register(&axi_pci_bridge_driver);
>> +}
>> +
>> +void __exit axi_pci_bridge_exit(void)
>> +{
>> + Â Â Â axi_host_pci_unregister(&axi_pci_bridge_driver);
>> +}
>> diff --git a/drivers/axi/axi_private.h b/drivers/axi/axi_private.h
>> new file mode 100644
>> index 0000000..756efb6
>> --- /dev/null
>> +++ b/drivers/axi/axi_private.h
>> @@ -0,0 +1,37 @@
>> +#ifndef LINUX_AXI_PRIVATE_H_
>> +#define LINUX_AXI_PRIVATE_H_
>> +
>> +#ifndef pr_fmt
>> +#define pr_fmt(fmt) Â Â Â Â Â ÂKBUILD_MODNAME ": " fmt
>> +#endif
>> +
>> +#include<linux/axi/axi.h>
>> +
>> +#define AXI_ADDR_BASE Â Â Â Â Â0x18000000
>> +#define AXI_WRAP_BASE Â Â Â Â Â0x18100000
>> +
>> +#define AXI_CORE_SIZE Â Â Â Â Â0x1000
>> +
>> +struct axi_bus;
>> +
>> +/* main.c */
>> +extern int axi_bus_register(struct axi_bus *bus);
>> +extern void axi_bus_unregister(struct axi_bus *bus);
>> +
>> +/* scan.c */
>> +int axi_bus_scan(struct axi_bus *bus);
>> +
>> +#ifdef CONFIG_AXI_HOST_PCI
>> +/* b43_pci_ai_bridge.c */
>> +extern int __init axi_pci_bridge_init(void);
>> +extern void __exit axi_pci_bridge_exit(void);
>> +
>> +/* host_pci.c */
>> +extern int axi_host_pci_register(struct pci_driver *driver);
>> +static inline void axi_host_pci_unregister(struct pci_driver *driver)
>> +{
>> + Â Â Â pci_unregister_driver(driver);
>> +}
>> +#endif /* CONFIG_AXI_HOST_PCI */
>> +
>> +#endif
>> diff --git a/drivers/axi/core.c b/drivers/axi/core.c
>> new file mode 100644
>> index 0000000..3d79749
>> --- /dev/null
>> +++ b/drivers/axi/core.c
>> @@ -0,0 +1,51 @@
>> +/*
>> + * AMBA AXI
>> + * Core ops
>> + *
>> + * Licensed under the GNU/GPL. See COPYING for details.
>> + */
>> +
>> +#include "axi_private.h"
>> +#include<linux/axi/axi.h>
>
> #include <linux/delay.h>
>
>> +
>> +bool axi_core_is_enabled(struct axi_device *core)
>> +{
>> + Â Â Â if ((axi_aread32(core, AXI_IOCTL)& Â(AXI_IOCTL_CLK |
>> AXI_IOCTL_FGC))
>> + Â Â Â Â Â != AXI_IOCTL_CLK)
>> + Â Â Â Â Â Â Â return false;
>> + Â Â Â if (axi_aread32(core, AXI_RESET_CTL)& ÂAXI_RESET_CTL_RESET)
>> + Â Â Â Â Â Â Â return false;
>> + Â Â Â return true;
>> +}
>> +EXPORT_SYMBOL(axi_core_is_enabled);
>> +
>> +static void axi_core_disable(struct axi_device *core, u32 flags)
>> +{
>> + Â Â Â if (axi_aread32(core, AXI_RESET_CTL)& ÂAXI_RESET_CTL_RESET)
>> + Â Â Â Â Â Â Â return;
>> +
>> + Â Â Â axi_awrite32(core, AXI_IOCTL, flags);
>> + Â Â Â axi_aread32(core, AXI_IOCTL);
>> + Â Â Â udelay(10);
>> +
>> + Â Â Â axi_awrite32(core, AXI_RESET_CTL, AXI_RESET_CTL_RESET);
>> + Â Â Â udelay(1);
>> +}
>> +
>> +int axi_core_enable(struct axi_device *core, u32 flags)
>> +{
>> + Â Â Â axi_core_disable(core, flags);
>> +
>> + Â Â Â axi_awrite32(core, AXI_IOCTL, (AXI_IOCTL_CLK | AXI_IOCTL_FGC |
>> flags));
>> + Â Â Â axi_aread32(core, AXI_IOCTL);
>> +
>> + Â Â Â axi_awrite32(core, AXI_RESET_CTL, 0);
>> + Â Â Â udelay(1);
>> +
>> + Â Â Â axi_awrite32(core, AXI_IOCTL, (AXI_IOCTL_CLK | flags));
>> + Â Â Â axi_aread32(core, AXI_IOCTL);
>> + Â Â Â udelay(1);
>> +
>> + Â Â Â return 0;
>> +}
>> +EXPORT_SYMBOL(axi_core_enable);
>> diff --git a/drivers/axi/driver_chipcommon.c
>> b/drivers/axi/driver_chipcommon.c
>> new file mode 100644
>> index 0000000..b3087df
>> --- /dev/null
>> +++ b/drivers/axi/driver_chipcommon.c
>> @@ -0,0 +1,87 @@
>> +/*
>> + * AMBA AXI
>> + * ChipCommon core driver
>> + *
>> + * Copyright 2005, Broadcom Corporation
>> + * Copyright 2006, 2007, Michael Buesch<mb@xxxxxxxxx>
>> + *
>> + * Licensed under the GNU/GPL. See COPYING for details.
>> + */
>> +
>> +#include "axi_private.h"
>> +#include<linux/axi/axi.h>
>> +
>> +static inline u32 axi_cc_write32_masked(struct axi_drv_cc *cc, u16
>> offset,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â u32 mask, u32 value)
>> +{
>> + Â Â Â value&= mask;
>> + Â Â Â value |= axi_cc_read32(cc, offset)& Â~mask;
>> + Â Â Â axi_cc_write32(cc, offset, value);
>> +
>> + Â Â Â return value;
>> +}
>> +
>> +void axi_core_chipcommon_init(struct axi_drv_cc *cc)
>> +{
>> + Â Â Â if (cc->core->id.rev>= 11)
>> + Â Â Â Â Â Â Â cc->status = axi_cc_read32(cc, AXI_CC_CHIPSTAT);
>> + Â Â Â cc->capabilities = axi_cc_read32(cc, AXI_CC_CAP);
>> + Â Â Â if (cc->core->id.rev>= 35)
>> + Â Â Â Â Â Â Â cc->capabilities_ext = axi_cc_read32(cc, AXI_CC_CAP_EXT);
>> +
>> + Â Â Â axi_cc_write32(cc, 0x58, 0);
>> + Â Â Â axi_cc_write32(cc, 0x5C, 0);
>> +
>> + Â Â Â if (cc->capabilities& ÂAXI_CC_CAP_PMU)
>> + Â Â Â Â Â Â Â axi_pmu_init(cc);
>> + Â Â Â if (cc->capabilities& ÂAXI_CC_CAP_PCTL)
>> + Â Â Â Â Â Â Â pr_err("Power control not implemented!\n");
>> +}
>> +
>> +/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
>> +void axi_chipco_watchdog_timer_set(struct axi_drv_cc *cc, u32 ticks)
>> +{
>> + Â Â Â /* instant NMI */
>> + Â Â Â axi_cc_write32(cc, AXI_CC_WATCHDOG, ticks);
>> +}
>> +
>> +void axi_chipco_irq_mask(struct axi_drv_cc *cc, u32 mask, u32 value)
>> +{
>> + Â Â Â axi_cc_write32_masked(cc, AXI_CC_IRQMASK, mask, value);
>> +}
>> +
>> +u32 axi_chipco_irq_status(struct axi_drv_cc *cc, u32 mask)
>> +{
>> + Â Â Â return axi_cc_read32(cc, AXI_CC_IRQSTAT)& Âmask;
>> +}
>> +
>> +u32 axi_chipco_gpio_in(struct axi_drv_cc *cc, u32 mask)
>> +{
>> + Â Â Â return axi_cc_read32(cc, AXI_CC_GPIOIN)& Âmask;
>> +}
>> +
>> +u32 axi_chipco_gpio_out(struct axi_drv_cc *cc, u32 mask, u32 value)
>> +{
>> + Â Â Â return axi_cc_write32_masked(cc, AXI_CC_GPIOOUT, mask, value);
>> +}
>> +
>> +u32 axi_chipco_gpio_outen(struct axi_drv_cc *cc, u32 mask, u32 value)
>> +{
>> + Â Â Â return axi_cc_write32_masked(cc, AXI_CC_GPIOOUTEN, mask, value);
>> +}
>> +
>> +u32 xaxi_chipco_gpio_control(struct axi_drv_cc *cc, u32 mask, u32 value)
>> +{
>> + Â Â Â return axi_cc_write32_masked(cc, AXI_CC_GPIOCTL, mask, value);
>> +}
>> +EXPORT_SYMBOL(xaxi_chipco_gpio_control);
>> +
>> +u32 axi_chipco_gpio_intmask(struct axi_drv_cc *cc, u32 mask, u32 value)
>> +{
>> + Â Â Â return axi_cc_write32_masked(cc, AXI_CC_GPIOIRQ, mask, value);
>> +}
>> +
>> +u32 axi_chipco_gpio_polarity(struct axi_drv_cc *cc, u32 mask, u32 value)
>> +{
>> + Â Â Â return axi_cc_write32_masked(cc, AXI_CC_GPIOPOL, mask, value);
>> +}
>> diff --git a/drivers/axi/driver_chipcommon_pmu.c
>> b/drivers/axi/driver_chipcommon_pmu.c
>> new file mode 100644
>> index 0000000..b57a9d0
>> --- /dev/null
>> +++ b/drivers/axi/driver_chipcommon_pmu.c
>> @@ -0,0 +1,134 @@
>> +/*
>> + * AMBA AXI
>> + * ChipCommon Power Management Unit driver
>> + *
>> + * Copyright 2009, Michael Buesch<mb@xxxxxxxxx>
>> + * Copyright 2007, Broadcom Corporation
>> + *
>> + * Licensed under the GNU/GPL. See COPYING for details.
>> + */
>> +
>> +#include "axi_private.h"
>> +#include<linux/axi/axi.h>
>> +
>> +static void axi_chipco_chipctl_maskset(struct axi_drv_cc *cc,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âu32 offset, u32 mask, u32 set)
>> +{
>> + Â Â Â u32 value;
>> +
>> + Â Â Â axi_cc_read32(cc, AXI_CC_CHIPCTL_ADDR);
>> + Â Â Â axi_cc_write32(cc, AXI_CC_CHIPCTL_ADDR, offset);
>> + Â Â Â axi_cc_read32(cc, AXI_CC_CHIPCTL_ADDR);
>> + Â Â Â value = axi_cc_read32(cc, AXI_CC_CHIPCTL_DATA);
>> + Â Â Â value&= mask;
>> + Â Â Â value |= set;
>> + Â Â Â axi_cc_write32(cc, AXI_CC_CHIPCTL_DATA, value);
>> + Â Â Â axi_cc_read32(cc, AXI_CC_CHIPCTL_DATA);
>> +}
>> +
>> +static void axi_pmu_pll_init(struct axi_drv_cc *cc)
>> +{
>> + Â Â Â struct axi_bus *bus = cc->core->bus;
>> +
>> + Â Â Â switch (bus->chipinfo.id) {
>> + Â Â Â case 0x4313:
>> + Â Â Â case 0x4331:
>> + Â Â Â case 43224:
>> + Â Â Â case 43225:
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â default:
>> + Â Â Â Â Â Â Â pr_err("PLL init unknown for device 0x%04X\n",
>> + Â Â Â Â Â Â Â Â Â Â Â bus->chipinfo.id);
>> + Â Â Â }
>> +}
>> +
>> +static void axi_pmu_resources_init(struct axi_drv_cc *cc)
>> +{
>> + Â Â Â struct axi_bus *bus = cc->core->bus;
>> + Â Â Â u32 min_msk = 0, max_msk = 0;
>> +
>> + Â Â Â switch (bus->chipinfo.id) {
>> + Â Â Â case 0x4313:
>> + Â Â Â Â Â Â Â min_msk = 0x200D;
>> + Â Â Â Â Â Â Â max_msk = 0xFFFF;
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â case 43224:
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â default:
>> + Â Â Â Â Â Â Â pr_err("PMU resource config unknown for device 0x%04X\n",
>> + Â Â Â Â Â Â Â Â Â Â Â bus->chipinfo.id);
>> + Â Â Â }
>> +
>> + Â Â Â /* Set the resource masks. */
>> + Â Â Â if (min_msk)
>> + Â Â Â Â Â Â Â axi_cc_write32(cc, AXI_CC_PMU_MINRES_MSK, min_msk);
>> + Â Â Â if (max_msk)
>> + Â Â Â Â Â Â Â axi_cc_write32(cc, AXI_CC_PMU_MAXRES_MSK, max_msk);
>> +}
>> +
>> +void axi_pmu_swreg_init(struct axi_drv_cc *cc)
>> +{
>> + Â Â Â struct axi_bus *bus = cc->core->bus;
>> +
>> + Â Â Â switch (bus->chipinfo.id) {
>> + Â Â Â case 0x4313:
>> + Â Â Â case 0x4331:
>> + Â Â Â case 43224:
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â default:
>> + Â Â Â Â Â Â Â pr_err("PMU switch/regulators init unknown for device "
>> + Â Â Â Â Â Â Â Â Â Â Â "0x%04X\n", bus->chipinfo.id);
>> + Â Â Â }
>> +}
>> +
>> +void axi_pmu_workarounds(struct axi_drv_cc *cc)
>> +{
>> + Â Â Â struct axi_bus *bus = cc->core->bus;
>> +
>> + Â Â Â switch (bus->chipinfo.id) {
>> + Â Â Â case 0x4313:
>> + Â Â Â Â Â Â Â axi_chipco_chipctl_maskset(cc, 0, ~0, 0x7);
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â case 0x4331:
>> + Â Â Â Â Â Â Â pr_err("Enabling Ext PA lines not implemented\n");
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â case 43224:
>> + Â Â Â Â Â Â Â if (bus->chipinfo.rev == 0) {
>> + Â Â Â Â Â Â Â Â Â Â Â pr_err("Workarounds for 43224 rev 0 not fully "
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "implemented\n");
>> + Â Â Â Â Â Â Â Â Â Â Â axi_chipco_chipctl_maskset(cc, 0, ~0, 0xF0);
>> + Â Â Â Â Â Â Â } else {
>> + Â Â Â Â Â Â Â Â Â Â Â axi_chipco_chipctl_maskset(cc, 0, ~0, 0xF0);
>> + Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â Â break;
>> + Â Â Â default:
>> + Â Â Â Â Â Â Â pr_err("Workarounds unknown for device 0x%04X\n",
>> + Â Â Â Â Â Â Â Â Â Â Â bus->chipinfo.id);
>> + Â Â Â }
>> +}
>> +
>> +void axi_pmu_init(struct axi_drv_cc *cc)
>> +{
>> + Â Â Â u32 pmucap;
>> +
>> + Â Â Â pmucap = axi_cc_read32(cc, AXI_CC_PMU_CAP);
>> + Â Â Â cc->pmu.rev = (pmucap& ÂAXI_CC_PMU_CAP_REVISION);
>> +
>> + Â Â Â pr_debug("Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev,
>> + Â Â Â Â Â Â Â Âpmucap);
>> +
>> + Â Â Â if (cc->pmu.rev == 1)
>> + Â Â Â Â Â Â Â axi_cc_mask32(cc, AXI_CC_PMU_CTL,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â ~AXI_CC_PMU_CTL_NOILPONW);
>> + Â Â Â else
>> + Â Â Â Â Â Â Â axi_cc_set32(cc, AXI_CC_PMU_CTL,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â ÂAXI_CC_PMU_CTL_NOILPONW);
>> +
>> + Â Â Â if (cc->core->id.id == 0x4329&& Âcc->core->id.rev == 2)
>> + Â Â Â Â Â Â Â pr_err("Fix for 4329b0 bad LPOM state not
>> implemented!\n");
>> +
>> + Â Â Â axi_pmu_pll_init(cc);
>> + Â Â Â axi_pmu_resources_init(cc);
>> + Â Â Â axi_pmu_swreg_init(cc);
>> + Â Â Â axi_pmu_workarounds(cc);
>> +}
>> diff --git a/drivers/axi/driver_pci.c b/drivers/axi/driver_pci.c
>> new file mode 100644
>> index 0000000..fc4ab25
>> --- /dev/null
>> +++ b/drivers/axi/driver_pci.c
>> @@ -0,0 +1,163 @@
>> +/*
>> + * AMBA AXI
>> + * PCI Core
>> + *
>> + * Copyright 2005, Broadcom Corporation
>> + * Copyright 2006, 2007, Michael Buesch<mb@xxxxxxxxx>
>> + *
>> + * Licensed under the GNU/GPL. See COPYING for details.
>> + */
>> +
>> +#include "axi_private.h"
>> +#include<linux/axi/axi.h>
>
> #include <linux/delay.h>
>
>
> Are you compiling for i386 architecture? For some reason, delay.h is not
> included for my x86_64 system, and the include is needed for core.c and
> driver_pci.c.

Yes, I use x86. Will include delay.h in next version, thanks for reporting.

-- 
RafaÅ
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux