mcb changes for v4.8 or v4.9
cover mcb changes for v4.8 or v4.9
Hi Greg,
This is a re-send for my mcb-for-v4.8 series from Tue, 5 Jul 2016 15:39:49 +0200. I understand that it might be to late to in the rc phase to include it in v4.8 so I think it's good to target them to v4.9.
A highlight would be Andy's patches to support MCB FPGA carrier devices on the LPC bus.
There are two more patches by me that just do removal of dead code or add some type safety.
All this is tested on real hardware as well as on a prototyped Qemu implementation, and passes a 'make C=1 W=1' run.
The changes are also available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jth/linux.git tags/for-v4.8
Thanks,
Johannes
Andreas Werner (2):
mcb: Added support for LPC or non PCI based MCB carrier
mcb: Added bar descriptor support for non PCI bus MCB carrier
Johannes Thumshirn (2):
mcb: Introduce type safety for to_mcb_*
mcb: remove sub-device handling code
drivers/mcb/Kconfig | 9 +++ drivers/mcb/Makefile | 1 + drivers/mcb/mcb-core.c | 17 ----- drivers/mcb/mcb-internal.h | 9 +++ drivers/mcb/mcb-lpc.c | 158 +++++++++++++++++++++++++++++++++++++++++++++ drivers/mcb/mcb-parse.c | 126 ++++++++++++++++++++++++++++++++---- include/linux/mcb.h | 22 +++++-- 7 files changed, 304 insertions(+), 38 deletions(-) create mode 100644 drivers/mcb/mcb-lpc.c
Signature · 1 line
2.9.3
PATCH RESEND 1/4 mcb: Added support for LPC or non PCI based MCB carrier
From: Andreas Werner <[email protected]>
Add support for MCB bases FPGAs connected to the LPC or non PCI Bus.
This driver currently supports the SC24 board. The FPGA is connected to the LPC bus and is identified using the BIOS DMI string.
--- drivers/mcb/Kconfig | 9 +++ drivers/mcb/Makefile | 1 + drivers/mcb/mcb-lpc.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 drivers/mcb/mcb-lpc.c
drivers/mcb/Kconfig +9 -0
@@ -28,4 +28,13 @@ config MCB_PCI If build as a module, the module is called mcb-pci.ko +config MCB_LPC + tristate "LPC (non PCI) based MCB carrier" + default n + help + + This is a MCB carrier on a LPC or non PCI device. + + If build as a module, the module is called mcb-lpc.ko + endif # MCB
drivers/mcb/Makefile +1 -0
@@ -5,3 +5,4 @@ mcb-y += mcb-core.o mcb-y += mcb-parse.o obj-$(CONFIG_MCB_PCI) += mcb-pci.o +obj-$(CONFIG_MCB_LPC) += mcb-lpc.o
drivers/mcb/mcb-lpc.c new file +158 -0
158 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH RESEND 2/4 mcb: Added bar descriptor support for non PCI bus MCB carrier
In reply to Johannes ThumshirnFrom: Andreas Werner <[email protected]>
Added support for the bar descriptor. This type is used for FPGAs connect to the LPC or to a non PCI bus.
The Bar descriptor could have a maximum of 6 BARs. Each of the devices within the FPGA could be mapped to a different BAR. The BAR descriptor is comparable to the PCI header.
--- drivers/mcb/mcb-internal.h | 9 ++++ drivers/mcb/mcb-parse.c | 126 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 121 insertions(+), 14 deletions(-)
drivers/mcb/mcb-internal.h +9 -0
@@ -112,6 +112,15 @@ struct chameleon_bdd {u32 size; } __packed; +struct chameleon_bar { +u32 addr; +u32 size; +}; + +#define BAR_CNT (x) ((x) & 0x07) +#define CHAMELEON_BAR_MAX 6 +#define BAR_DESC_SIZE (x) ((x) * sizeof(struct chameleon_bar) + sizeof(__le32)) +int chameleon_parse_cells (struct mcb_bus *bus,phys_addr_t mapbase,void __iomem *base);
drivers/mcb/mcb-parse.c +112 -14
200 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH RESEND 3/4 mcb: Introduce type safety for to_mcb_*
In reply to Johannes ThumshirnThe to_mcb_{bus,device,driver}() macros lacked type safety, so convert them to inline functions to enforce compile time type checking.
--- include/linux/mcb.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
include/linux/mcb.h +15 -3
@@ -41,7 +41,11 @@ struct mcb_bus {char name[CHAMELEON_FILENAME_LEN +1 ];int (*get_irq)(struct mcb_device *dev); }; -#define to_mcb_bus (b) container_of((b), struct mcb_bus, dev) + +static inline struct mcb_bus *to_mcb_bus (struct device *dev) +{ + return container_of(dev, struct mcb_bus, dev); +}/** * struct mcb_device - MEN Chameleon Bus device
@@ -77,7 +81,11 @@ struct mcb_device {struct resource irq;struct resource mem; }; -#define to_mcb_device (x) container_of((x), struct mcb_device, dev) + +static inline struct mcb_device *to_mcb_device (struct device *dev) +{ + return container_of(dev, struct mcb_device, dev); +}/** * struct mcb_driver - MEN Chameleon Bus device driver
@@ -95,7 +103,11 @@ struct mcb_driver {void (*remove)(struct mcb_device *mdev);void (*shutdown)(struct mcb_device *mdev); }; -#define to_mcb_driver (x) container_of((x), struct mcb_driver, driver) + +static inline struct mcb_driver *to_mcb_driver (struct device_driver *drv) +{ + return container_of(drv, struct mcb_driver, driver); +}static inline void *mcb_get_drvdata (struct mcb_device *dev) {
Signature · 1 line
2.9.3
PATCH RESEND 4/4 mcb: remove sub-device handling code
In reply to Johannes ThumshirnThe MEN Chameleon specification states that a chameleon FPGA can include a bridge descriptor, which then opens up a new bus behind this bridge. MCB included subdevice handling code in the core, but no support for bus descriptors in the parser, due to a lack of hardware access.
As this is technically dead code, but it gets executed on a device add, I've decided to remove it.
--- drivers/mcb/mcb-core.c | 17 ----------------- include/linux/mcb.h | 4 ---- 2 files changed, 21 deletions(-)
drivers/mcb/mcb-core.c +0 -17
@@ -369,7 +369,6 @@ struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus)if (!dev)return NULL ; -INIT_LIST_HEAD (&dev->bus_list); dev->bus = bus;return dev;
@@ -405,20 +404,6 @@ static int __mcb_bus_add_devices(struct device *dev, void *data)return 0 ; } -static int __mcb_bus_add_child (struct device *dev,void *data) -{ -struct mcb_device *mdev =to_mcb_device (dev); -struct mcb_bus *child; - -BUG_ON (!mdev->is_added); - child = mdev->subordinate; - -if (child) -mcb_bus_add_devices (child); - -return 0 ; -} -/** * mcb_bus_add_devices() - Add devices in the bus' internal device list * @bus: The @mcb_bus we add the devices
@@ -428,8 +413,6 @@ static int __mcb_bus_add_child(struct device *dev, void *data)void mcb_bus_add_devices (const struct mcb_bus *bus) {bus_for_each_dev (&mcb_bus_type,NULL ,NULL , __mcb_bus_add_devices); -bus_for_each_dev (&mcb_bus_type,NULL ,NULL , __mcb_bus_add_child); - }EXPORT_SYMBOL_GPL (mcb_bus_add_devices);
include/linux/mcb.h +0 -4
@@ -50,10 +50,8 @@ static inline struct mcb_bus *to_mcb_bus(struct device *dev)/** * struct mcb_device - MEN Chameleon Bus device * -* @bus_list: internal list handling for bus code * @dev: device in kernel representation * @bus: mcb bus the device is plugged to -* @subordinate: subordinate MCBus in case of bridge * @is_added: flag to check if device is added to bus * @driver: associated mcb_driver * @id: mcb device id
@@ -66,10 +64,8 @@ static inline struct mcb_bus *to_mcb_bus(struct device *dev)* @memory: memory resource */ struct mcb_device { -struct list_head bus_list;struct device dev;struct mcb_bus *bus; -struct mcb_bus *subordinate;bool is_added;struct mcb_driver *driver;u16 id;
Signature · 1 line
2.9.3