2022-04-29 14:46:45

by Niklas Schnelle

[permalink] [raw]
Subject: [RFC v2 29/39] rtc: add HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add HAS_IOPORT as dependency for
those drivers using them.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/rtc/Kconfig | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 41c65b4d2baf..e1bb11a225b2 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -951,6 +951,7 @@ comment "Platform RTC drivers"
config RTC_DRV_CMOS
tristate "PC-style 'CMOS'"
depends on X86 || ARM || PPC || MIPS || SPARC64
+ depends on HAS_IOPORT
default y if X86
select RTC_MC146818_LIB
help
@@ -971,6 +972,7 @@ config RTC_DRV_CMOS
config RTC_DRV_ALPHA
bool "Alpha PC-style CMOS"
depends on ALPHA
+ depends on HAS_IOPORT
select RTC_MC146818_LIB
default y
help
@@ -1188,7 +1190,7 @@ config RTC_DRV_MSM6242

config RTC_DRV_BQ4802
tristate "TI BQ4802"
- depends on HAS_IOMEM
+ depends on HAS_IOMEM && HAS_IOPORT
help
If you say Y here you will get support for the TI
BQ4802 RTC chip.
--
2.32.0


2022-05-18 04:56:20

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [RFC v2 29/39] rtc: add HAS_IOPORT dependencies

Hi,

On 29/04/2022 15:50:49+0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them.
>

I'm fine taking that this cycle if there are no dependencies. Should I?

> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> drivers/rtc/Kconfig | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 41c65b4d2baf..e1bb11a225b2 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -951,6 +951,7 @@ comment "Platform RTC drivers"
> config RTC_DRV_CMOS
> tristate "PC-style 'CMOS'"
> depends on X86 || ARM || PPC || MIPS || SPARC64
> + depends on HAS_IOPORT
> default y if X86
> select RTC_MC146818_LIB
> help
> @@ -971,6 +972,7 @@ config RTC_DRV_CMOS
> config RTC_DRV_ALPHA
> bool "Alpha PC-style CMOS"
> depends on ALPHA
> + depends on HAS_IOPORT
> select RTC_MC146818_LIB
> default y
> help
> @@ -1188,7 +1190,7 @@ config RTC_DRV_MSM6242
>
> config RTC_DRV_BQ4802
> tristate "TI BQ4802"
> - depends on HAS_IOMEM
> + depends on HAS_IOMEM && HAS_IOPORT
> help
> If you say Y here you will get support for the TI
> BQ4802 RTC chip.
> --
> 2.32.0
>

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2022-05-18 13:49:43

by Niklas Schnelle

[permalink] [raw]
Subject: Re: [RFC v2 29/39] rtc: add HAS_IOPORT dependencies

On Wed, 2022-05-18 at 00:15 +0200, Alexandre Belloni wrote:
> Hi,
>
> On 29/04/2022 15:50:49+0200, Niklas Schnelle wrote:
> > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > not being declared. We thus need to add HAS_IOPORT as dependency for
> > those drivers using them.
> >
>
> I'm fine taking that this cycle if there are no dependencies. Should I?
>

I'd say the dependency here is the first patch in the series and we
don't seem to have full consensus on this yet. So as of now I sadly
don't think so.


2022-06-01 19:36:19

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [RFC v2 29/39] rtc: add HAS_IOPORT dependencies

On Fri, 29 Apr 2022, Niklas Schnelle wrote:

> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 41c65b4d2baf..e1bb11a225b2 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -951,6 +951,7 @@ comment "Platform RTC drivers"
> config RTC_DRV_CMOS
> tristate "PC-style 'CMOS'"
> depends on X86 || ARM || PPC || MIPS || SPARC64
> + depends on HAS_IOPORT

Umm, I missed this one previously and this is wrong. We use this driver
for the DECstation machines (CONFIG_MIPS/CONFIG_MACH_DECSTATION) and those
do not use (nor indeed have) port I/O as they are TURBOchannel systems and
they only have a single (memory) address space. Consequently their DS1287
chip is memory-mapped (in a linear fashion actually, i.e. there's no
visible address/data register and individual locations are accessible with
single CPU instructions), cf. arch/mips/include/asm/mach-dec/mc146818rtc.h
(that probably ought to be converted to `readb'/`writeb' one day).

So this has to be sorted differently, perhaps by just:

+ depends on HAS_IOPORT || MACH_DECSTATION

Note that other machines handled by the MIPS port do use port I/O, cf.
arch/mips/include/asm/mach-*/mc146818rtc.h.

Maciej