Add sc16is7x2 driver
Subsystems (2)
PATCH RESEND 1/1 Add sc16is7x2 driver
This patch adds support for the sc16is7x2 SPI to UART chips. Each chip has two UARTs and 8 GPIOs.
---
drivers/serial/Kconfig | 9 + drivers/serial/Makefile | 1 + drivers/serial/sc16is7x2.c | 1325 +++++++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 3 +- include/linux/spi/sc16is7x2.h | 17 + 5 files changed, 1354 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +9 -0
@@ -269,6 +269,15 @@ config SERIAL_8250_RM9K comment "Non-8250 serial port support" +config SERIAL_SC16IS7X2 + tristate "SC16IS7x2 chips" + depends on SPI_MASTER && GPIOLIB + select SERIAL_CORE + help + Selecting this option will add support for SC16IS7x2 SPI UARTs. + The GPIOs are exported via gpiolib interface. + If unsure, say N. + config SERIAL_AMBA_PL010 tristate "ARM AMBA PL010 serial port support" depends on ARM_AMBA && (BROKEN || !ARCH_VERSATILE)
drivers/serial/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o +obj-$(CONFIG_SERIAL_SC16IS7X2) += sc16is7x2.o obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
drivers/serial/sc16is7x2.c new file +1325 -0
1,325 lines not on this page · raw message
include/linux/serial_core.h +2 -1
@@ -45,7 +45,8 @@#define PORT_OCTEON 17/* Cavium OCTEON internal UART */ #define PORT_AR7 18/* Texas Instruments AR7 internal UART */ #define PORT_U6_16550A 19/* ST-Ericsson U6xxx internal UART */ -#define PORT_MAX_8250 19/* max port ID */ +#define PORT_SC16IS7X2 20/* SC16IS7x2 SPI UART */ +#define PORT_MAX_8250 20/* max port ID */ /* * ARM specific type numbers. These are not currently guaranteed
include/linux/spi/sc16is7x2.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { +unsigned int uartclk; +/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ +const char *const *names; +}; + +#endif
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;
include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif
Why is this needed in a .h file? What other .c file uses this define and structure?
thanks,
greg k-h
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration. It can also define names for the GPIOs. Futhermore the base clock of the chip must be known, as it can be clocked by an external device.
Regards,
Signature · 12 lines
Manuel Stahl Fraunhofer-Institut IIS Leistungsoptimierte Systeme Nordostpark 93 D90411 Nürnberg Telefon +49 (0)911/58061-6419 Fax +49 (0)911/58061-6398 E-Mail [email protected] http://www.iis.fraunhofer.de http://www.smart-power.fraunhofer.de
begin:vcard
fn:Manuel Stahl
n:Stahl;Manuel
email;internet:[email protected]
tel;work:+49 911 58061-6419
x-mozilla-html:FALSE
version:2.1
end:vcard
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 27 lines · Greg KH
Quoted 26 lines · Manuel Stahl
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration.
What "board setup code"? I don't see that here in the patch anywhere.
SPI devices are generally set up for a specific hardware board. I.e. for some ARM boards there is setup code in linux/arch/arm/mach-at91/board-<xyz>.c
I use the sc16is7x2 for a board that is not yet in vanilla, so the board setup code is not included in the patch.
Regards,
Signature · 12 lines
Manuel Stahl Fraunhofer-Institut IIS Leistungsoptimierte Systeme Nordostpark 93 D90411 Nürnberg Telefon +49 (0)911/58061-6419 Fax +49 (0)911/58061-6398 E-Mail [email protected] http://www.iis.fraunhofer.de http://www.smart-power.fraunhofer.de
begin:vcard
fn:Manuel Stahl
n:Stahl;Manuel
email;internet:[email protected]
tel;work:+49 911 58061-6419
x-mozilla-html:FALSE
version:2.1
end:vcard
Quoted 35 lines · Manuel Stahl
Quoted 34 lines · Greg KH
Quoted 32 lines · Manuel Stahl
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration.
Quoted 8 lines
Quoted 1 line
What "board setup code"? I don't see that here in the patch anywhere.
SPI devices are generally set up for a specific hardware board. I.e. for some ARM boards there is setup code in linux/arch/arm/mach-at91/board-<xyz>.c
I use the sc16is7x2 for a board that is not yet in vanilla, so the board setup code is not included in the patch.
Then why not add this header (or move it to the header file) when your board setup code is merged? No need to have it there now, right?
Care to resend this driver changed that way?
thanks,
greg k-h
Quoted 42 lines · Greg KH
Quoted 41 lines · Manuel Stahl
Quoted 27 lines · Greg KH
Quoted 26 lines · Manuel Stahl
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration.
What "board setup code"? I don't see that here in the patch anywhere.
SPI devices are generally set up for a specific hardware board. I.e. for some ARM boards there is setup code in linux/arch/arm/mach-at91/board-<xyz>.c
Quoted 5 lines
Quoted 2 lines
I use the sc16is7x2 for a board that is not yet in vanilla, so the board setup code is not included in the patch.
Then why not add this header (or move it to the header file) when your board setup code is merged? No need to have it there now, right?
Cause everyone who want's to use this driver for his board needs the header. The board I use is a prototype, nearly the same as some Atmel Demo board, but with the sc16is752 attached to the SPI port. Therefore I don't see any benefit in publishing my board setup code.
Quoted 1 line
Care to resend this driver changed that way?
As I said the header definitely belongs to the driver, not to the board.
Regards,
Signature · 12 lines
Manuel Stahl Fraunhofer-Institut IIS Leistungsoptimierte Systeme Nordostpark 93 D90411 Nürnberg Telefon +49 (0)911/58061-6419 Fax +49 (0)911/58061-6398 E-Mail [email protected] http://www.iis.fraunhofer.de http://www.smart-power.fraunhofer.de
begin:vcard
fn:Manuel Stahl
n:Stahl;Manuel
email;internet:[email protected]
tel;work:+49 911 58061-6419
x-mozilla-html:FALSE
version:2.1
end:vcard
Quoted 46 lines · Manuel Stahl
Quoted 45 lines · Greg KH
Quoted 43 lines · Manuel Stahl
Quoted 27 lines · Greg KH
Quoted 26 lines · Manuel Stahl
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration.
What "board setup code"? I don't see that here in the patch anywhere.
SPI devices are generally set up for a specific hardware board. I.e. for some ARM boards there is setup code in linux/arch/arm/mach-at91/board-<xyz>.c
I use the sc16is7x2 for a board that is not yet in vanilla, so the board setup code is not included in the patch.
Quoted 7 lines
Quoted 2 lines
Then why not add this header (or move it to the header file) when your board setup code is merged? No need to have it there now, right?
Cause everyone who want's to use this driver for his board needs the header. The board I use is a prototype, nearly the same as some Atmel Demo board, but with the sc16is752 attached to the SPI port. Therefore I don't see any benefit in publishing my board setup code.
How nice, you are saying that we need a .h file in the kernel for no other reason than to support out-of-tree code? Well, feel free to resend this driver, and watch as the .h file is removed as it's not needed by any in-tree code...
good luck,
greg k-h
Quoted 55 lines · Greg KH
Quoted 46 lines · Manuel Stahl
Quoted 45 lines · Greg KH
Quoted 43 lines · Manuel Stahl
Quoted 27 lines · Greg KH
Quoted 26 lines · Manuel Stahl
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration.
What "board setup code"? I don't see that here in the patch anywhere.
SPI devices are generally set up for a specific hardware board. I.e. for some ARM boards there is setup code in linux/arch/arm/mach-at91/board-<xyz>.c
I use the sc16is7x2 for a board that is not yet in vanilla, so the board setup code is not included in the patch.
Quoted 7 lines
Quoted 2 lines
Then why not add this header (or move it to the header file) when your board setup code is merged? No need to have it there now, right?
Cause everyone who want's to use this driver for his board needs the header. The board I use is a prototype, nearly the same as some Atmel Demo board, but with the sc16is752 attached to the SPI port. Therefore I don't see any benefit in publishing my board setup code.
Quoted 4 lines
How nice, you are saying that we need a .h file in the kernel for no other reason than to support out-of-tree code? Well, feel free to resend this driver, and watch as the .h file is removed as it's not needed by any in-tree code...
OK, let's take an example: max3100
This is the driver I took as a template. It consists of drivers/serial/max3100.c and include/linux/serial_max3100.h
And huh, "grep -R serial_max3100.h *" gives what? Only max3100.c So do we need to remove serial_max3100.h as it's not used anywhere else?
Regards,
Signature · 12 lines
Manuel Stahl Fraunhofer-Institut IIS Leistungsoptimierte Systeme Nordostpark 93 D90411 Nürnberg Telefon +49 (0)911/58061-6419 Fax +49 (0)911/58061-6398 E-Mail [email protected] http://www.iis.fraunhofer.de http://www.smart-power.fraunhofer.de
begin:vcard
fn:Manuel Stahl
n:Stahl;Manuel
email;internet:[email protected]
tel;work:+49 911 58061-6419
x-mozilla-html:FALSE
version:2.1
end:vcard
Quoted 61 lines · Manuel Stahl
Quoted 55 lines · Greg KH
Quoted 46 lines · Manuel Stahl
Quoted 45 lines · Greg KH
Quoted 43 lines · Manuel Stahl
Quoted 27 lines · Greg KH
Quoted 26 lines · Manuel Stahl
Quoted 25 lines · Greg KH
Quoted 10 lines · Manuel Stahl
include/linux/spi/sc16is7x2.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef LINUX_SPI_SC16IS752_H +#define LINUX_SPI_SC16IS752_H + +#define SC16IS7X2_NR_GPIOS 8 + +struct sc16is7x2_platform_data { + unsigned int uartclk;include/linux/spi/sc16is7x2.h line 17
Quoted 10 lines
include/linux/spi/sc16is7x2.h new file +10
-0+/* uart line number of the first channel */ +unsigned uart_base; +/* number assigned to the first GPIO */ +unsigned gpio_base; +char *label; +/* list of GPIO names (array length = SC16IS7X2_NR_GPIOS) */ + const char *const *names; +}; + +#endif Why is this needed in a .h file? What other .c file uses this define and structure?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
The board setup code can pass information about the uart and gpio enumeration.
What "board setup code"? I don't see that here in the patch anywhere.
SPI devices are generally set up for a specific hardware board. I.e. for some ARM boards there is setup code in linux/arch/arm/mach-at91/board-<xyz>.c
I use the sc16is7x2 for a board that is not yet in vanilla, so the board setup code is not included in the patch.
Quoted 7 lines
Quoted 2 lines
Then why not add this header (or move it to the header file) when your board setup code is merged? No need to have it there now, right?
Cause everyone who want's to use this driver for his board needs the header. The board I use is a prototype, nearly the same as some Atmel Demo board, but with the sc16is752 attached to the SPI port. Therefore I don't see any benefit in publishing my board setup code.
Quoted 4 lines
How nice, you are saying that we need a .h file in the kernel for no other reason than to support out-of-tree code? Well, feel free to resend this driver, and watch as the .h file is removed as it's not needed by any in-tree code...
Quoted 6 lines
OK, let's take an example: max3100
This is the driver I took as a template. It consists ofdrivers/serial/max3100.candinclude/linux/serial_max3100.hAnd huh, "grep -R
serial_max3100.h*" gives what? Onlymax3100.cSo do we need to removeserial_max3100.has it's not used anywhere else?
Yup, that sounds like a great idea, I'll go queue up that patch when I get back from my travels at the moment.
thanks,
greg k-h
Quoted 5 lines
Quoted 2 lines
And huh, "grep -R
serial_max3100.h*" gives what? Onlymax3100.cSo do we need to removeserial_max3100.has it's not used anywhere else?Yup, that sounds like a great idea, I'll go queue up that patch when I get back from my travels at the moment.
Sounds a very bad idea to me. The point of the platform data objects throughout the kernel is to allow other devices to use the driver without having to hack it up. Removing these interfaces breaks that.
So NAK such a change. The existing code is right, the fact that the interface isn't being used in that way visibly by currently merged code doesn't mean it shouldn't be there.
Also max3100 has an active maintainer so perhaps you should Cc them on such discussion ?
Alan
Quoted 10 lines · Greg KH
Quoted 5 lines · Manuel Stahl
This is the driver I took as a template. It consists of
drivers/serial/max3100.candinclude/linux/serial_max3100.hAnd huh, "grep -R
serial_max3100.h*" gives what? Onlymax3100.cSo do we need to removeserial_max3100.has it's not used anywhere else?Yup, that sounds like a great idea, I'll go queue up that patch when I get back from my travels at the moment.
Requiring that we have a user for all platform data provided by drivers would be incredibly painful for embedded development. It would mean that we would be unable to usefully merge any drivers with platform data unless we also merge at least one board using them, meaning that we're dependant on getting the core board support for some public board into a state which can be merged (which would at best be likely to end up creating logjams on support for CPUs).
Am 07.10.2010 10:15, schrieb Manuel Stahl:
Quoted 2 lines
This patch adds support for the sc16is7x2 SPI to UART chips. Each chip has two UARTs and 8 GPIOs.
Hello Manuel,
can you send the patch inline?
Why you check in your probe function the gpio_base but not the uart_base?
Thomas