167e38f57SArnd Bergmann /* SPDX-License-Identifier: GPL-2.0 */ 267e38f57SArnd Bergmann #ifndef _SOC_EP93XX_H 367e38f57SArnd Bergmann #define _SOC_EP93XX_H 467e38f57SArnd Bergmann 567e38f57SArnd Bergmann struct platform_device; 6*ede5bbe4SNikita Shubin struct regmap; 7*ede5bbe4SNikita Shubin struct spinlock_t; 8*ede5bbe4SNikita Shubin 9*ede5bbe4SNikita Shubin enum ep93xx_soc_model { 10*ede5bbe4SNikita Shubin EP93XX_9301_SOC, 11*ede5bbe4SNikita Shubin EP93XX_9307_SOC, 12*ede5bbe4SNikita Shubin EP93XX_9312_SOC, 13*ede5bbe4SNikita Shubin }; 14*ede5bbe4SNikita Shubin 15*ede5bbe4SNikita Shubin #include <linux/auxiliary_bus.h> 16*ede5bbe4SNikita Shubin #include <linux/compiler_types.h> 17*ede5bbe4SNikita Shubin #include <linux/container_of.h> 1867e38f57SArnd Bergmann 1967e38f57SArnd Bergmann #define EP93XX_CHIP_REV_D0 3 2067e38f57SArnd Bergmann #define EP93XX_CHIP_REV_D1 4 2167e38f57SArnd Bergmann #define EP93XX_CHIP_REV_E0 5 2267e38f57SArnd Bergmann #define EP93XX_CHIP_REV_E1 6 2367e38f57SArnd Bergmann #define EP93XX_CHIP_REV_E2 7 2467e38f57SArnd Bergmann 25*ede5bbe4SNikita Shubin struct ep93xx_regmap_adev { 26*ede5bbe4SNikita Shubin struct auxiliary_device adev; 27*ede5bbe4SNikita Shubin struct regmap *map; 28*ede5bbe4SNikita Shubin void __iomem *base; 29*ede5bbe4SNikita Shubin spinlock_t *lock; 30*ede5bbe4SNikita Shubin void (*write)(struct regmap *map, spinlock_t *lock, unsigned int reg, 31*ede5bbe4SNikita Shubin unsigned int val); 32*ede5bbe4SNikita Shubin void (*update_bits)(struct regmap *map, spinlock_t *lock, 33*ede5bbe4SNikita Shubin unsigned int reg, unsigned int mask, unsigned int val); 34*ede5bbe4SNikita Shubin }; 35*ede5bbe4SNikita Shubin 36*ede5bbe4SNikita Shubin #define to_ep93xx_regmap_adev(_adev) \ 37*ede5bbe4SNikita Shubin container_of((_adev), struct ep93xx_regmap_adev, adev) 38*ede5bbe4SNikita Shubin 3967e38f57SArnd Bergmann #ifdef CONFIG_ARCH_EP93XX 4067e38f57SArnd Bergmann int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); 4167e38f57SArnd Bergmann void ep93xx_pwm_release_gpio(struct platform_device *pdev); 4267e38f57SArnd Bergmann int ep93xx_ide_acquire_gpio(struct platform_device *pdev); 4367e38f57SArnd Bergmann void ep93xx_ide_release_gpio(struct platform_device *pdev); 4467e38f57SArnd Bergmann int ep93xx_keypad_acquire_gpio(struct platform_device *pdev); 4567e38f57SArnd Bergmann void ep93xx_keypad_release_gpio(struct platform_device *pdev); 4667e38f57SArnd Bergmann int ep93xx_i2s_acquire(void); 4767e38f57SArnd Bergmann void ep93xx_i2s_release(void); 4867e38f57SArnd Bergmann unsigned int ep93xx_chip_revision(void); 4967e38f57SArnd Bergmann 5067e38f57SArnd Bergmann #else 5167e38f57SArnd Bergmann static inline int ep93xx_pwm_acquire_gpio(struct platform_device *pdev) { return 0; } 5267e38f57SArnd Bergmann static inline void ep93xx_pwm_release_gpio(struct platform_device *pdev) {} 5367e38f57SArnd Bergmann static inline int ep93xx_ide_acquire_gpio(struct platform_device *pdev) { return 0; } 5467e38f57SArnd Bergmann static inline void ep93xx_ide_release_gpio(struct platform_device *pdev) {} 5567e38f57SArnd Bergmann static inline int ep93xx_keypad_acquire_gpio(struct platform_device *pdev) { return 0; } 5667e38f57SArnd Bergmann static inline void ep93xx_keypad_release_gpio(struct platform_device *pdev) {} 5767e38f57SArnd Bergmann static inline int ep93xx_i2s_acquire(void) { return 0; } 5867e38f57SArnd Bergmann static inline void ep93xx_i2s_release(void) {} 5967e38f57SArnd Bergmann static inline unsigned int ep93xx_chip_revision(void) { return 0; } 6067e38f57SArnd Bergmann 6167e38f57SArnd Bergmann #endif 6267e38f57SArnd Bergmann 6367e38f57SArnd Bergmann #endif 64